private void GoToLocation_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Location locationItem = null; int closestLocation = 999999999; //Logging.Write("inside mouse click ok"); foreach (Location loc in LocationList.Items) { WoWPoint destination = new WoWPoint(float.Parse(loc.X), float.Parse(loc.Y), float.Parse(loc.Z)); int distanceToLocation = (int)destination.Distance2D(ObjectManager.Me.Location); if (distanceToLocation < closestLocation) { locationItem = loc; closestLocation = distanceToLocation; } } if (!Equals(null, locationItem)) { LocationList.SelectedItem = locationItem; } } }
private void Locations_SelectedIndexChanged(object sender, EventArgs e) { Location loc = (Location)LocationList.SelectedItem; WoWPoint destination = new WoWPoint(float.Parse(loc.X), float.Parse(loc.Y), float.Parse(loc.Z)); int distanceToDestination = (int)destination.Distance2D(ObjectManager.Me.Location); //string distanceToDest = ""; statusLabel.Text = string.Format("{0} ({1}) in {2} is {3} yards", loc.Name, loc.Category, loc.Zone, distanceToDestination); //statuslabel.Text = loc.Name + subzone + zone; }
protected override Composite CreateBehavior() { return _root ?? (_root = new PrioritySelector( new Decorator(ret => IsDone, new Action(c => { TreeRoot.StatusText = "The Humanoid Cannonball complete!"; })), new Decorator(ret => HasBuff, new PrioritySelector( new Decorator(ret => !_hadWings, new Action(c => { _hadWings = true; LogMessage("debug", "Got wings buff."); })), new Decorator(ret => BuffDuration <= (CancelTimeLeft + _latency), new Action(c => { LogMessage("debug", "Cancelling wings with {0}s left. CancelTime+Latency = {1} + {2} = {3}", BuffDuration, CancelTimeLeft, _latency, CancelTimeLeft + _latency); TreeRoot.StatusText = "Cancelling wings."; PerformAction(ActionButton); })), new Action(c => { TreeRoot.StatusText = "Waiting to cancel wings."; }) )), new Decorator(ret => _started && _hadWings && !HasBuff, new PrioritySelector( new Decorator(ret => Me.IsFalling, new Action(c => { TreeRoot.StatusText = "Waiting to land."; })), new Decorator(ret => WoWPoint.Empty == _landPoint && !Me.IsMoving, new Action(c => { _landPoint = Me.Location; LogMessage("info", "Landed {0} yards from bullseye.", _landPoint.Distance2D(BullseyePoint)); })), new Decorator(ret => WoWPoint.Empty == _landPoint, new ActionAlwaysSucceed()), new Decorator(ret => null == TeleportNpc, new Action(c => { TreeRoot.StatusText = "Waiting for teleport npc to load."; })), new Decorator(ret => TeleportNpc.DistanceSqr < DistanceCheckSqr, new Sequence( new Action(c => { TreeRoot.StatusText = "Teleporting back to cannon."; TeleportNpc.Interact(); Thread.Sleep(2000); }), new Action(c => { if (UseTeleport && Me.Silver >= TeleportCostSilver) { GossipFrame.Instance.SelectGossipOption(TeleportGossipOption); Thread.Sleep(1000); Lua.DoString("StaticPopup1Button1:Click()"); // accept cost } }), new Action(c => { _isDone = true; }) )), new Action(c => { TreeRoot.StatusText = "Moving to teleport back."; //WoWMovement.ClickToMove(TeleportNpc.Location); Navigator.MoveTo(TeleportNpc.Location); }) )), new Decorator(ret => !_started, new PrioritySelector( new Decorator(ret => !HasGameToken, new Action(c => { LogMessage("error", "No game tokens, skipping cannon."); _isDone = true; // Can't play the game without a token })), new Decorator(ret => Npc.DistanceSqr > Npc.InteractRangeSqr, new Action(c => { Navigator.MoveTo(Npc.Location); })), new Sequence( new Action(c => { //using (new FrameLock()) { // FIXME foreach (int buffId in BadBuffIds) { if (Me.HasAura(buffId)) { CancelBuff(buffId); } } //} }), new Action(c => { Npc.Interact(); Thread.Sleep(2000); GossipFrame.Instance.SelectGossipOption(GossipOption); Thread.Sleep(1000); _started = true; }) ) )), new Action(c => { TreeRoot.StatusText = "Waiting to get wings."; }) )); }
private void GoToLocation_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Location locationItem = null; int closestLocation = 999999999; //Logging.Write("inside mouse click ok"); foreach (Location loc in LocationList.Items) { WoWPoint destination = new WoWPoint(float.Parse(loc.X), float.Parse(loc.Y), float.Parse(loc.Z)); int distanceToLocation = (int)destination.Distance2D(ObjectManager.Me.Location); if (distanceToLocation < closestLocation) { locationItem = loc; closestLocation = distanceToLocation; } } if (!Equals(null, locationItem)) LocationList.SelectedItem = locationItem; } }
private void Locations_SelectedIndexChanged(object sender, EventArgs e) { Location loc = (Location) LocationList.SelectedItem; WoWPoint destination = new WoWPoint(float.Parse(loc.X), float.Parse(loc.Y), float.Parse(loc.Z)); int distanceToDestination = (int)destination.Distance2D(ObjectManager.Me.Location); //string distanceToDest = ""; statusLabel.Text = string.Format("{0} ({1}) in {2} is {3} yards", loc.Name, loc.Category, loc.Zone, distanceToDestination); //statuslabel.Text = loc.Name + subzone + zone; }