// get a queue info by name public static MiniMapBattlefieldFrameState GetQueueState(string sBattlefield) { MiniMapBattlefieldFrameState bfState = MiniMapBattlefieldFrameState.Unknown; if (sBattlefield != null && sBattlefield.Length > 0) { MiniMapBattlefieldFrame.GetBattlefieldState(); int statusCount = Status.Count; for (int i = 0; i < statusCount; i++) { if (Status[i] != null && Status[i].Name.Equals(sBattlefield.ToLower())) { //PPather.WriteLine("BGQueueTaskManager.GetQueueState(" + sBattlefield + ") found entry"); return(Status[i].State); } } if (statusCount < MAX_BATTLEGROUNDS) { bfState = MiniMapBattlefieldFrameState.CanQueue; //PPather.WriteLine("BGQueueTaskManager.GetQueueState(" + sBattlefield + ") adding entry: " + bfState); SetQueueState(sBattlefield, bfState); } } return(bfState); }
private void UpdateWants() { // Check queue wantQueue = false; MiniMapBattlefieldFrameState bfState = BGQueueTaskManager.GetQueueState(Battlefield); if (NPC != null && !ppather.IsBlacklisted(NPC)) { Location l = GetLocationOfNPC(); //PPather.WriteLine("BG NPC loc: " + l); if (l != null && bfState == MiniMapBattlefieldFrameState.CanQueue) { wantQueue = true; } /* * else * { * PPather.WriteLine("Queue State (" + Battlefield + "): " + bfState); * } */ } //PPather.WriteLine("Want to Queue (" + Battlefield + "): " + (wantQueue ? "yes" : "no")); }
// are we queued (or inside) a battleground? public static bool IsQueued() { int statusCount = Status.Count; for (int i = 0; i < statusCount; i++) { MiniMapBattlefieldFrameState bfState = GetQueueState(Status[i].Name); if (bfState == MiniMapBattlefieldFrameState.Queue || bfState == MiniMapBattlefieldFrameState.CanEnter || bfState == MiniMapBattlefieldFrameState.Inside) { return(true); } } return(false); }
public static bool SetQueueState(string sBattlefield, MiniMapBattlefieldFrameState bfState) { bool setStatus = false; if (sBattlefield != null && sBattlefield.Length > 0) { int statusCount = Status.Count; for (int i = 0; i < statusCount && !setStatus; i++) { if (Status[i] != null && Status[i].Name.Equals(sBattlefield.ToLower())) { Status[i].State = bfState; setStatus = true; } } if (!setStatus && Status.Count < MAX_BATTLEGROUNDS) { BGQueueTaskStatus bfStatus = new BGQueueTaskStatus(); bfStatus.Name = sBattlefield.ToLower(); bfStatus.State = bfState; Status.Add(bfStatus); setStatus = true; } //PPather.WriteLine("BGQueueTaskManager.SetQueueState(" + sBattlefield + ", " + bfState + "), Status.Count=" + Status.Count); statusCount = Status.Count; for (int i = 0; i < statusCount; i++) { if (Status[i] != null) { //PPather.WriteLine("BGQueueTaskManager.SetQueueState: Status[" + i + "] is " + Status[i]); } else { //PPather.WriteLine("BGQueueTaskManager.SetQueueState: Status[" + i + "] is null"); } } } return(setStatus); }
public static Value BGQueued(params Value[] args) { String bf = args[0].GetStringValue(); if (bf.Length > 0) { MiniMapBattlefieldFrameState bfState = Tasks.BGQueueTaskManager.GetQueueState(bf); bool isQueued = false; if (bfState == MiniMapBattlefieldFrameState.Queue || bfState == MiniMapBattlefieldFrameState.CanEnter || bfState == MiniMapBattlefieldFrameState.Inside) { isQueued = true; } return(new Value(isQueued ? 1 : 0)); } else { PPather.WriteLine("*** Warning - BGQueued() called without a battleground name!"); PPather.WriteLine("*** Did you mean to use $BGQueued?"); } return(null); }
public static void GetBattlefieldState() { if (IsVisible() && CheckDropDown.IsReady) { // get the 1st dropdown frame GInterfaceObject obj = DropDownListFrame.GetFrame(); // check to see if it's already up (possible) if (obj == null || obj.IsVisible == false) { RightClick(); Thread.Sleep(600); } // at this point dropdown is visible, else something blocked the click if (obj != null && obj.IsVisible) { string curBattlefield = null; int foundAt = 0; // index match was found at int lookAt = 0; // num elements past index we looked at Tasks.BGQueueTaskManager.ResetQueueState(); // if the dropdown ever has more than 16 lines this has to be increased // look at the two entries after the name that matches, if one does for (int i = 1; i <= 16; i++) { MiniMapBattlefieldFrameState bfState = MiniMapBattlefieldFrameState.Unknown; string rowText = DropDownListFrame.GetButtonText(i); //if (rowText != null) PPather.WriteLine("rowText=" + rowText); if (rowText != null && rowText.Length > 0 && foundAt == 0) { curBattlefield = rowText; foundAt = i; } else if (foundAt > 0) { if (rowText != null) { // TODO change this to a GetLocale string if (rowText.Equals("Leave Queue", StringComparison.CurrentCultureIgnoreCase)) { bfState = MiniMapBattlefieldFrameState.Queue; } // TODO change this to a GetLocale string else if (rowText.Equals("Enter Battle", StringComparison.CurrentCultureIgnoreCase)) { bfState = MiniMapBattlefieldFrameState.CanEnter; } // TODO change this to a GetLocale string else if (rowText.Equals("Leave Battleground", StringComparison.CurrentCultureIgnoreCase)) { bfState = MiniMapBattlefieldFrameState.Inside; } } lookAt++; } if (lookAt == 2) { Tasks.BGQueueTaskManager.SetQueueState(curBattlefield, bfState); //PPather.WriteLine("GetBattlefieldState: set " + curBattlefield + " to " + bfState); foundAt = 0; lookAt = 0; } } } // send a second right click to close it, we're done with it RightClick(); Thread.Sleep(300); CheckDropDown.Reset(); } }