Esempio n. 1
0
        static void btnUseWaypointTag_Click(object sender, RoutedEventArgs e)
        {
            if (BotMain.IsRunning)
            {
                BotMain.Stop();
            }
            Thread.Sleep(500);
            try
            {
                using (new ZetaCacheHelper())
                {
                    if (!ZetaDia.IsInGame)
                    {
                        return;
                    }
                    if (ZetaDia.Me == null)
                    {
                        return;
                    }
                    if (!ZetaDia.Me.IsValid)
                    {
                        return;
                    }

                    ZetaDia.Actors.Update();

                    List <GizmoWaypoint> objList = (from o in ZetaDia.Actors.GetActorsOfType <GizmoWaypoint>(true)
                                                    where o.IsValid
                                                    orderby o.Position.Distance(ZetaDia.Me.Position)
                                                    select o).ToList();

                    string tagText = "";
                    if (objList.Any())
                    {
                        GizmoWaypoint obj = objList.FirstOrDefault();

                        if (obj != null)
                        {
                            tagText = string.Format("\n<UseWaypoint questId=\"{0}\" stepId=\"{1}\" waypointNumber=\"{2}\" name=\"{3}\" statusText=\"\" /> \n",
                                                    ZetaDia.CurrentQuest.QuestSNO, ZetaDia.CurrentQuest.StepId, obj.WaypointNumber, obj.Name);
                        }
                    }
                    else
                    {
                        tagText = string.Format("\n<UseWaypoint questId=\"{0}\" stepId=\"{1}\" waypointNumber=\"\" name=\"\" statusText=\"\" /> \n",
                                                ZetaDia.CurrentQuest.QuestSNO, ZetaDia.CurrentQuest.StepId);
                    }
                    Clipboard.SetText(tagText);
                    Logger.Log(tagText);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }
Esempio n. 2
0
        private bool SafeActorUpdate()
        {
            var units=ZetaDia.Actors.GetActorsOfType<GizmoWaypoint>(false, false)
                .Where(o => o.IsValid&&o.InLineOfSight)
                .OrderBy(o => o.Distance);

            if (units.Count()==0)
                return false;

            try
            {
                WaypointGizmo=units.First();
                return true;
            } catch (Exception)
            {

                return false;
            }
        }