-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bee5104
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
local function SetSelectedBattlefieldByNumber(bgNumber) | ||
for i=1, GetNumBattlefields(), 1 do | ||
if tostring(GetBattlefieldInstanceInfo(i)) == bgNumber then | ||
SetSelectedBattlefield(i); | ||
BattlefieldFrame_Update(); | ||
return true; | ||
end | ||
end | ||
return false; | ||
end | ||
|
||
StaticPopupDialogs["BG_SELECTOR_NOT_FOUND"] = { | ||
text = "BG with that number was not found.", | ||
button1 = "Okay", | ||
timeout = 0, | ||
whileDead = true, | ||
hideOnEscape = true, | ||
referredIndex = 3 | ||
} | ||
|
||
local frame = CreateFrame("Frame", "BGSelectorFrame", BattlefieldFrame); | ||
|
||
local editBox = CreateFrame("EditBox", "BGSelectorEditBox", frame, "InputBoxTemplate"); | ||
editBox:SetSize(80, 22); | ||
editBox:SetPoint("CENTER", BattlefieldFrame, "TOPLEFT", 305, -401); | ||
editBox:SetAutoFocus(false); | ||
editBox:SetNumeric(true); | ||
editBox:SetScript("OnEnterPressed", function(self) | ||
self:ClearFocus(); | ||
local text = self:GetText(); | ||
|
||
if SetSelectedBattlefieldByNumber(text) then | ||
BattlefieldFrameJoinButton:SetText(BATTLEFIELD_JOIN.."("..text..")"); | ||
elseif text == "" then | ||
BattlefieldFrame_Update(); | ||
BattlefieldFrameJoinButton:SetText(BATTLEFIELD_JOIN); | ||
else | ||
StaticPopup_Show("BG_SELECTOR_NOT_FOUND"); | ||
BattlefieldFrameJoinButton:SetText(BATTLEFIELD_JOIN); | ||
end | ||
end) | ||
|
||
editBox:SetScript("OnShow", function(self) | ||
self:SetText(""); | ||
BattlefieldFrameJoinButton:SetText(BATTLEFIELD_JOIN); | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Interface: 11302 | ||
|
||
## Title: FLeX BG Selector | ||
|
||
## Notes: Allows you to select a battleground by BG number. | ||
|
||
## Version: 1.0 | ||
## Author: FLeX | ||
|
||
FLeX_BG_Selector.lua |