public void LoadPointsOfInterest() { OpenFileDialog OpenDialog = new OpenFileDialog(); Tc.PointsComboBox.Items.Clear(); string PATH = (string.Format(Application.StartupPath + "\\Documents\\Points of intrest")); OpenDialog.InitialDirectory = PATH; OpenDialog.FilterIndex = 0; if (OpenDialog.ShowDialog() == DialogResult.OK) { Navi.Reset(); Points.Clear(); string PointsFilename = OpenDialog.FileName; Logger.AddDebugText(Tc.rtbDebug, string.Format(@"Nav file loaded = {0}", PointsFilename)); try { Points = XmlSerializationHelper.Deserialize <List <PointsOfInterest> >(PointsFilename) ?? new List <PointsOfInterest>(); OpenDialog.Dispose(); foreach (var item in Points) { Tc.PointsComboBox.Items.Add(item.Name); } Logger.AddDebugText(Tc.rtbDebug, string.Format(@"Added {0} Points of interest", Points.Count.ToString())); Tc.PointsComboBox.SelectedIndex = 0; } catch (Exception ex) { Logger.AddDebugText(Tc.rtbDebug, string.Format(@"LoadWaypoints error {0}", ex.ToString())); } } }
public override void Update() { log.AddDebugText(TC.rtbDebug, "Moving to Mob"); var Target = Api.Target.GetTargetInfo(); var MobPos = new Node { X = Api.Entity.GetEntity(TS.TargetMobId).X, Z = Api.Entity.GetEntity(TS.TargetMobId).Z, Y = Api.Entity.GetEntity(TS.TargetMobId).Y }; Navi.FaceHeading(MobPos); if (Target.TargetIndex != TS.TargetMobId) { Api.ThirdParty.KeyPress(Keys.ESCAPE); Thread.Sleep(1000); Api.Target.SetTarget(TS.TargetMobId); } if (Target.TargetIndex != TS.TargetMobId) { log.AddDebugText(TC.rtbDebug, "Unable to target mob."); return; } while (Navi.DistanceTo(TS.TargetMobId) > 3 && Options.PullWhilstMoving && !Token.IsCancellationRequested) { Navi.GotoNPC(TS.TargetMobId, true); if (Options.PullWhilstMoving && Navi.DistanceTo(TS.TargetMobId) < Options.PullDistance) { Api.ThirdParty.SendString(string.Format("{0}", TC.pullTb.Text)); log.AddDebugText(TC.rtbDebug, "Pulling"); } } while (Navi.DistanceTo(TS.TargetMobId) > Options.PullDistance && !Options.PullWhilstMoving && !Token.IsCancellationRequested) { Navi.GotoNPC(TS.TargetMobId, true); if (!Options.PullWhilstMoving && Navi.DistanceTo(TS.TargetMobId) < Options.PullDistance) { Navi.Reset(); Api.ThirdParty.SendString(string.Format("{0}", TC.pullTb.Text)); log.AddDebugText(TC.rtbDebug, "Pulling"); } while (Navi.DistanceTo(TS.TargetMobId) > 3 && Navi.DistanceTo(TS.TargetMobId) < Options.PullDistance && !Token.IsCancellationRequested) { Navi.GotoNPC(TS.TargetMobId, true); } } #endregion Methods }