--[v1.0 beta]-- local bg = { ["1v1"] = {Name = "1 vs 1 Arena", Id = 440}, ["wr"] = {Name = "Windrunner Race", Id = 441}, ["3v3"] = {Name = "3 vs 3 Arena", Id = 442}, ["6v6"] = {Name = "6 vs 6 Arena", Id = 443}, ["kc"] = {Name = "Karros Canyon", Id = 444}, ["vf"] = {Name = "Visdun Fortress", Id = 445}, ["tmr"] = {Name = "Tyrefen Mountain Range", Id = 446}, ["aa"] = {Name = "Arcanium Arena", Id = 448}, } function BGPopup(poparg) local _popup = "SET_BG_ENTER_QUERY_DIALOG1" if poparg == "ok" then AcceptPopup(_popup) else return RoMScript("StaticPopup_Visible('".._popup.."')") ~= nil end end function BGqtime(bgcode) local bgmatched = false for k, v in pairs(bg) do if bgcode == k then bgmatched = true break end end if not bgmatched then error("function BGqtime error: Invalid Argument.") end local queuetime repeat queuetime = RoMScript("GetTimeInBattleGroundQueue("..bg[bgcode].Id..")") until queuetime return math.floor(queuetime/1000) end function joinBG(arg, withteam, loadscreenwait) local argmatched = false for k, v in pairs(bg) do if arg == k then argmatched = true break end end if not argmatched then error("function joinBG error: Invalid Argument.") end local bgname, bgtoenter, popup, popupaccepted, indexnum = bg[arg].Name, bg[arg].Id, "SET_REQUESTDIALOG", false if arg == "wr" then player:updateBuffs() yrest(200) if not player:hasBuff(503080) and 15 > inventory:itemTotalCount(203038) then -- Obtained Windrunner Race Ticket cprintf(cli.lightred, "Not enough Token for Windrunner Race Ticket.") return end end for k,v in pairs(RoMScript("BATTLE_GROUND_COLUMN_LIST")) do if v == bgtoenter then indexnum = k break end end repeat if BGqtime(arg) == 0 then if withteam then RoMScript("JoinBattleGroundWithTeam(BATTLE_GROUND_COLUMN_LIST["..indexnum.."])") else RoMScript("JoinBattleGround(BATTLE_GROUND_COLUMN_LIST["..indexnum.."])") ends if arg == "wr" then player:updateBuffs() yrest(200) if not player:hasBuff(503080) then repeat yrest(500) until RoMScript("StaticPopup_Visible('"..popup.."')") ~= nil yrest(500) if RoMScript("StaticPopup_Visible('"..popup.."')") ~= nil then AcceptPopup(popup) end end end else print("You are already queued in this BG.") end print("Waiting for BG Queue Popup.") repeat yrest(5000) local qtime = BGqtime(arg) if qtime ~= 0 then printf("\rThe char has been waiting for %s seconds.", qtime) end until BGPopup() or qtime == 0 print("") yrest(500) if BGPopup() then BGPopup("ok") popupaccepted = true waitForLoadingScreen(tonumber(loadscreenwait)) yrest(1000) if getZoneId() == bgtoenter then cprintf(cli.lightblue,"\nThe Char successfully teleported into BattleGround: %s.\n\n", bgname) else cprintf(cli.lightred,"\nThere was a problem teleporting into BattleGround: %s.\n\n", bgname) end end until popupaccepted end function leaveBG(_loadscreenwait) sendMacro("LeaveBattleGround_and_CloseFrames()") waitForLoadingScreen(tonumber(_loadscreenwait)) end function inBG(_arg) local _argmatched = false for k, v in pairs(bg) do if _arg == k then _argmatched = true break end end if not _argmatched then error("function inBG error: Invalid Argument.") end return getZoneId() == bg[_arg].Id end function quitBG(__arg) if __arg == nil then sendMacro("Leave_All_Battle_Ground_Queue()") else local __argmatched = false for k, v in pairs(bg) do if __arg == k then __argmatched = true break end end if not __argmatched then error("function quitBG error: Invalid Argument.") end sendMacro("LeaveBattleGroundWaitQueue"..bg[arg].Id..")") end end