private async Task <bool> TypeTwoVehicleBehavior()
        {
            if (!Query.IsInVehicle())
            {
                return(false);
            }

            while (Me.IsAlive)
            {
                if (Counter > NumOfTimes && QuestId == 0 || Me.IsQuestComplete(QuestId))
                {
                    Lua.DoString("VehicleExit()");
                    _isBehaviorDone = true;
                    return(true);
                }
                var target = NpcList.FirstOrDefault();
                if (target != null)
                {
                    await Coroutine.Sleep(OftenToUse);

                    TreeRoot.StatusText = "Attacking: " + target.SafeName + ", AttackButton: " + AttackButton + ", Times Used: " + Counter;
                    target.Target();
                    Lua.DoString("CastPetAction({0})", AttackButton);
                    SpellManager.ClickRemoteLocation(target.Location);
                    await Coroutine.Sleep(WaitTime);

                    Counter++;
                }
                await Coroutine.Yield();
            }
            return(false);
        }
Ejemplo n.º 2
0
        private WoWUnit FindTarget(Vector3 location)
        {
            WoWUnit target = null;

            if (_targetGuid.IsValid)
            {
                target = ObjectManager.GetObjectByGuid <WoWUnit>(_targetGuid);
            }

            if (target != null && target.IsAlive
                // if rescuing NPCs then we don't want to include those rescued by other players.
                && (DropPassengerButton == 0 || !IsRescuedByOtherPlayer(target)) &&
                !Blacklist.Contains(target, BlacklistFlags.Combat | BlacklistFlags.Interact))
            {
                return(target);
            }

            target = ObjectManager.GetObjectsOfType <WoWUnit>()
                     .Where(u => !u.IsDead && NpcList.Contains((int)u.Entry) &&
                            !Blacklist.Contains(u, BlacklistFlags.Combat | BlacklistFlags.Interact)
                            // if rescuing NPCs then we don't want to include those rescued by other players.
                            && (DropPassengerButton == 0 || !IsRescuedByOtherPlayer(target)) &&
                            u.Location.Distance2D(location) < NpcScanRange)
                     .OrderBy(u => location.Distance2DSquared(u.Location))
                     .FirstOrDefault();

            if (target != null)
            {
                _targetGuid = target.Guid;
            }

            return(target);
        }
        private async Task <bool> TypeOneVehicleBehavior()
        {
            if (!Query.IsInVehicle())
            {
                return(false);
            }

            while (Me.IsAlive)
            {
                var target  = NpcList.FirstOrDefault();
                var vehicle = VehicleList.FirstOrDefault();
                if (target == null || vehicle != null && target.Location.Distance(vehicle.Location) > 15)
                {
                    TreeRoot.StatusText = "Waiting for Mob to Come Into Range or Appear.";
                    await Coroutine.Yield();

                    continue;
                }
                if (vehicle != null && target.Location.Distance(vehicle.Location) <= 15)
                {
                    TreeRoot.StatusText = "Attacking: " + target.SafeName + ", AttackButton: " + AttackButton;
                    if (Me.CurrentTargetGuid != target.Guid)
                    {
                        target.Target();
                    }
                    Lua.DoString("CastPetAction({0})", AttackButton);
                    await Coroutine.Sleep(WaitTime);

                    Counter++;
                    return(true);
                }
                await Coroutine.Yield();
            }
            return(false);
        }
 private void AddSortedDragons()
 {
     NpcList.Add(_holdedDragons.FirstOrDefault(x => x.TemplateId == 1102));
     NpcList.Add(_holdedDragons.FirstOrDefault(x => x.TemplateId == 1100));
     NpcList.Add(_holdedDragons.FirstOrDefault(x => x.TemplateId == 1101));
     NpcList.Add(_holdedDragons.FirstOrDefault(x => x.TemplateId == 1103));
     _holdedDragons.Clear();
 }
Ejemplo n.º 5
0
 private void reloadMemoryItemsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     IconList.List.Clear();
     NpcList.List.Clear();   //dethunter12 important
     IconSkill.List.Clear(); //dethunter12 add
     IconAction.List.Clear();
     IconList.Import();
     NpcList.Import();   //dethunter12 important
     IconSkill.Import(); //dethunter12 add
     SkillList.Import(); //dethunter12 add 7/31/2020
     IconAction.Import();
 }
    IEnumerator GetData()
    {
        UnityWebRequest request = UnityWebRequest.Get(MainController._rootAPI + api + "npcs.json");

        yield return(request.SendWebRequest());

        if (request.isNetworkError || request.isHttpError)
        {
            Debug.Log(request.error);
            itemsJson = File.ReadAllText(Application.dataPath + "/npcs.json");
        }
        else
        {
            npcs = JsonUtility.FromJson <NpcList>(request.downloadHandler.text);
        }
    }
Ejemplo n.º 7
0
 public static void LoadNPC()
 {
     NpcList.Clear();
     using (SQLiteConnection conn = new SQLiteConnection("Data Source=npc.db"))
     {
         conn.Open();
         SQLiteCommand cmd = conn.CreateCommand();
         cmd.CommandText = "SELECT * FROM npc";
         using (SQLiteDataReader rdr = cmd.ExecuteReader())
         {
             while (rdr.Read())
             {
                 if (rdr.HasRows)
                 {
                     string    Name = rdr[1].ToString();
                     Texture2D tx   = NpcSpriteList[rdr[2].ToString()];
                     NpcList.Add(new Npc(Name, tx));
                 }
             }
         }
         cmd.CommandText = "SELECT * FROM spawn";
         using (SQLiteDataReader rdr = cmd.ExecuteReader())
         {
             while (rdr.Read())
             {
                 if (rdr.HasRows)
                 {
                     string[]     spltString = new string[] { "<>" };
                     List <Quest> AQuest     = new List <Quest>();
                     if (rdr[4].ToString() != string.Empty)
                     {
                         string[] QuestString = rdr[4].ToString().Split(spltString, StringSplitOptions.RemoveEmptyEntries);
                         foreach (string sb in QuestString)
                         {
                             AQuest.Add(QuestList.Find(x => x.QuestName == sb));
                         }
                     }
                     Npc   n = NpcList.Find(x => x.NpcName == rdr[1].ToString());
                     Spawn s = new Spawn(n, Int32.Parse(rdr[2].ToString()), Int32.Parse(rdr[3].ToString()), AQuest);
                     SpawnList.Add(s);
                 }
             }
         }
     }
 }
Ejemplo n.º 8
0
        public ArcarinasSquare(short id) : base(id)
        {
            MapExits.Add(new MapExit(86, new Rect(59, 0, 67, 2), 63, 105));

            NpcList.Add(new NpcObject(0, "Transporter", 61456, 6, 85, 46, 2, Id));
            NpcList.Add(new NpcObject(1, "North Gate Guard", 61458, 1, 58, 10, 2, Id));
            NpcList.Add(new NpcObject(2, "North Gate Guard", 61458, 1, 67, 10, 2, Id));

            MonsterList.Add(new MonsterObject(0, 1, 68, 36, 2, Id));

            PetList.Add(new PetObject(0, 1, 101, 6, 2, Id));
            PetList.Add(new PetObject(1, 2, 104, 6, 2, Id));
            PetList.Add(new PetObject(2, 3, 107, 6, 2, Id));
            PetList.Add(new PetObject(3, 4, 110, 6, 2, Id));
            PetList.Add(new PetObject(4, 5, 113, 6, 2, Id));
            PetList.Add(new PetObject(5, 6, 116, 9, 3, Id));
            PetList.Add(new PetObject(6, 7, 116, 12, 3, Id));
            PetList.Add(new PetObject(7, 8, 116, 15, 3, Id));
            PetList.Add(new PetObject(8, 9, 116, 18, 3, Id));
            PetList.Add(new PetObject(9, 10, 116, 21, 3, Id));
        }
Ejemplo n.º 9
0
        WoWUnit GetNpc()
        {
            WoWUnit veh = GetVehicle();

            return(ObjectManager.GetObjectsOfType <WoWUnit>().OrderBy(u => veh.Location.Distance2D(u.Location)).
                   FirstOrDefault(u => u.Location.Distance2D(veh.Location) <= NpcScanRange && !u.Dead && NpcList.Contains((int)u.Entry)));
        }
Ejemplo n.º 10
0
        protected override Composite CreateBehavior()
        {
            return _root ??
                (_root = new PrioritySelector(
                    new Decorator(c => Counter > NumOfTimes,
                        new Action(c =>
                        {
                            TreeRoot.StatusText = "Finished!";
                            if (GoHomeButton > 0)
                            {
                                Lua.DoString("CastPetAction({0})", GoHomeButton);
                            }
                            _isBehaviorDone = true;
                            return RunStatus.Success;
                        })
                    ),

                    new Decorator(c => NpcVehicleList.Count > 0 && !InVehicle,
                        new Action(c =>
                        {
                            if (!NpcVehicleList[0].WithinInteractRange)
                            {
                                Navigator.MoveTo(NpcVehicleList[0].Location);
                                TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].Name + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location);
                            }
                            else
                            {
                                NpcVehicleList[0].Interact();
                                MountedPoint = Me.Location;
                            }

                        })
                    ),
                    new Decorator(c => InVehicle && SpellType == 1,
                        new Action(c =>
                        {
                            if (NpcList.Count == 0 || NpcList[0].Location.Distance(VehicleList[0].Location) > 15)
                            {
                                TreeRoot.StatusText = "Waiting for Mob to Come Into Range or Appear.";
                                return RunStatus.Running;
                            }
                            else if (NpcList.Count >= 1 && NpcList[0].Location.Distance(VehicleList[0].Location) <= 15)
                            {
                                TreeRoot.StatusText = "Attacking: " + NpcList[0].Name + ", AttackButton: " + AttackButton;
                                NpcList[0].Target();
                                Lua.DoString("CastPetAction({0})", AttackButton);
                                Thread.Sleep(WaitTime);
                                Counter++;
                                return RunStatus.Success;
                            }
                            return RunStatus.Running;
                        })),

                    new Decorator(c => InVehicle && SpellType == 2,
                        new Action(c =>
                        {
                            if (NpcList.Count >= 1)
                            {
                                Thread.Sleep(OftenToUse);

                                TreeRoot.StatusText = "Attacking: " + NpcList[0].Name + ", AttackButton: " + AttackButton + ", Times Used: " + Counter;

                                if ((Counter > NumOfTimes && QuestId == 0) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted && QuestId > 0))
                                {
                                    Lua.DoString("VehicleExit()");
                                    _isBehaviorDone = true;
                                    return RunStatus.Success;
                                }
                                NpcList[0].Target();
                                Lua.DoString("CastPetAction({0})", AttackButton);
                                LegacySpellManager.ClickRemoteLocation(NpcList[0].Location);
                                Thread.Sleep(WaitTime);
                                Counter++;
                                return RunStatus.Running;                                
                            }
                            return RunStatus.Running;
                        })),

                   new Decorator(c => InVehicle && SpellType == 3,
                       new PrioritySelector(
                           ret => NpcList.OrderBy(u => u.DistanceSqr).FirstOrDefault(u => Me.Transport.IsSafelyFacing(u)),
                            new Decorator(
                                ret => ret != null,
                                new PrioritySelector(
                                    new Decorator(
                                        ret => Me.CurrentTarget == null || Me.CurrentTarget != (WoWUnit)ret,
                                        new Action(ret => ((WoWUnit)ret).Target())),
                                    new Decorator(
                                        ret => !Me.Transport.IsSafelyFacing(((WoWUnit)ret),10),
                                        new Action(ret => Me.CurrentTarget.Face())),
                                    new Action(ret =>
                                        {
                                            Vector3 v = Me.CurrentTarget.Location - StyxWoW.Me.Location;
                                            v.Normalize();
                                            Lua.DoString(string.Format(
                                                "local pitch = {0}; local delta = pitch - VehicleAimGetAngle(); VehicleAimIncrement(delta); CastPetAction({1});",
                                                Math.Asin(v.Z).ToString(CultureInfo.InvariantCulture), AttackButton));

                                            Thread.Sleep(WaitTime);
                                            Counter++;
                                            return RunStatus.Success;         
                                        }))))),
          
                    new Decorator(c => InVehicle && SpellType == 4,
                        new Action(c =>
                        {
                            if (NpcList.Count >= 1)
                            {
                                using (new FrameLock())
                                {
                                    if ((Counter > NumOfTimes && QuestId == 0) || (Me.QuestLog.GetQuestById((uint)QuestId) != null && Me.QuestLog.GetQuestById((uint)QuestId).IsCompleted && QuestId > 0))
                                    {
                                        Lua.DoString("VehicleExit()");
                                        _isBehaviorDone = true;
                                        return RunStatus.Success;
                                    }
                                    NpcList[0].Target();
                                    WoWMovement.ClickToMove(NpcList[0].Location);
                                    Lua.DoString("CastPetAction({0})", AttackButton);
                                    LegacySpellManager.ClickRemoteLocation(NpcList[0].Location);
                                    Counter++;
                                    return RunStatus.Running;
                                }
                            }
                            return RunStatus.Running;
                        }))
                ));
        }
        protected override Composite CreateBehavior()
        {
            return(_root ??
                   (_root = new PrioritySelector(
                        new Decorator(c => (Counter > NumOfTimes) || Me.IsQuestComplete(QuestId),
                                      new Action(c =>
            {
                TreeRoot.StatusText = "Finished!";
                if (GoHomeButton > 0)
                {
                    Lua.DoString("CastPetAction({0})", GoHomeButton);
                }
                _isBehaviorDone = true;
                return RunStatus.Success;
            })
                                      ),

                        // Enable combat while not in a vehicle
                        new Decorator(ctx => (LevelBot.BehaviorFlags & BehaviorFlags.Combat) == 0 && !Query.IsInVehicle(),
                                      new Action(ctx => LevelBot.BehaviorFlags |= BehaviorFlags.Combat)),

                        // Disable combat while in a vehicle
                        new Decorator(ctx => (LevelBot.BehaviorFlags & BehaviorFlags.Combat) != 0 && Query.IsInVehicle(),
                                      new Action(ctx => LevelBot.BehaviorFlags &= ~BehaviorFlags.Combat)),

                        new Decorator(c => NpcVehicleList.Any() && !Query.IsInVehicle(),
                                      new Action(c =>
            {
                if (!NpcVehicleList[0].WithinInteractRange)
                {
                    Navigator.MoveTo(NpcVehicleList[0].Location);
                    TreeRoot.StatusText = "Moving To Vehicle - " + NpcVehicleList[0].SafeName + " Yards Away: " + NpcVehicleList[0].Location.Distance(Me.Location);
                }
                else
                {
                    NpcVehicleList[0].Interact();
                    MountedPoint = Me.Location;
                }
            })
                                      ),
                        new Decorator(c => SpellType == 1, new ActionRunCoroutine(ctx => TypeOneVehicleBehavior())),

                        new Decorator(c => SpellType == 2, new ActionRunCoroutine(ctx => TypeTwoVehicleBehavior())),

                        new Decorator(c => Query.IsInVehicle() && SpellType == 3,
                                      new PrioritySelector(
                                          ret => NpcList.OrderBy(u => u.DistanceSqr).FirstOrDefault(u => Me.Transport.IsSafelyFacing(u)),
                                          new Decorator(
                                              ret => ret != null,
                                              new PrioritySelector(
                                                  new Decorator(
                                                      ret => Me.CurrentTarget == null || Me.CurrentTarget != (WoWUnit)ret,
                                                      new Action(ret => ((WoWUnit)ret).Target())),
                                                  new Decorator(
                                                      ret => !Me.Transport.IsSafelyFacing(((WoWUnit)ret), 10),
                                                      new Action(ret => Me.CurrentTarget.Face())),
                                                  new Sequence(
                                                      new Action(
                                                          ctx =>
            {
                Vector3 v = Vector3.Normalize(Me.CurrentTarget.Location - StyxWoW.Me.Location);
                Lua.DoString(
                    string.Format(
                        "local pitch = {0}; local delta = pitch - VehicleAimGetAngle(); VehicleAimIncrement(delta); CastPetAction({1});",
                        Math.Asin(v.Z).ToString(CultureInfo.InvariantCulture),
                        AttackButton));
            }),
                                                      new Sleep(WaitTime),
                                                      new Action(ctx => Counter++)))))),

                        new Decorator(c => SpellType == 4,
                                      new Action(c =>
            {
                if (!Query.IsInVehicle())
                {
                    return RunStatus.Failure;
                }

                if (Counter > NumOfTimes && QuestId == 0 || Me.IsQuestComplete(QuestId))
                {
                    Lua.DoString("VehicleExit()");
                    _isBehaviorDone = true;
                    return RunStatus.Success;
                }

                var target = NpcList.FirstOrDefault();

                if (target != null)
                {
                    if (Me.CurrentTargetGuid != target.Guid)
                    {
                        target.Target();
                    }
                    WoWMovement.ClickToMove(target.Location);
                    Lua.DoString("CastPetAction({0})", AttackButton);
                    SpellManager.ClickRemoteLocation(target.Location);
                    Counter++;
                }
                return RunStatus.Running;
            })),

                        new Decorator(c => SpellType == 5,
                                      new Action(c =>
            {
                if (!Query.IsInVehicle())
                {
                    return RunStatus.Failure;
                }

                if (Counter > NumOfTimes && QuestId == 0 || Me.IsQuestComplete(QuestId))
                {
                    Lua.DoString("VehicleExit()");
                    _isBehaviorDone = true;
                    return RunStatus.Success;
                }
                var target = NpcList.FirstOrDefault();

                if (target != null)
                {
                    if (Me.CurrentTargetGuid != target.Guid)
                    {
                        target.Target();
                    }
                    WoWMovement.ConstantFace(Me.CurrentTargetGuid);
                    Lua.DoString("CastPetAction({0})", AttackButton);
                    if (QuestId == 0)
                    {
                        Counter++;
                    }
                }

                var target2 = NpcListSecondary.FirstOrDefault();
                if (target2 != null)
                {
                    if (Me.CurrentTargetGuid != target2.Guid)
                    {
                        target2.Target();
                    }
                    WoWMovement.ConstantFace(Me.CurrentTargetGuid);
                    Lua.DoString("CastPetAction({0})", AttackButton);
                    if (QuestId == 0)
                    {
                        Counter++;
                    }
                }

                Lua.DoString("CastPetAction({0})", AttackButton2);

                return RunStatus.Running;
            }))
                        )));
        }
 public void Spawn(INpc spawnable)
 {
     NpcList.Add(spawnable);
 }
Ejemplo n.º 13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            statusLabel.Text = "Version: " + Globals.Version;

            checkedListBox1.Items.AddRange(new object[22]
            {
                "Catalog",
                "LuckyDraw",
                "Magic",
                "Moonstone",
                "Option",
                "Shop",
                "Title",
                "Skill",
                "ItemEditor",
                "MobEditor",
                "QuestEditor",
                "RewardEditor",
                "AffinityEditor",
                //"BigPetEditor",
                "ItemCollection",
                // "SetItemEditor", //dethunter12 add
                //  "MakeItemEditor" //dethunter12 add
                "BigPetEditor", //test dethunter12
                "ExChange",     //test AssasinPL
                "LevelUpGuide", //Test By AssasinPL
                "Rare Option",
                "Jewel Prob",
                "Log Reader",
                "Ip Reader",
                "Action Editor",
            });
            try
            {
                MySqlConnection mySqlConnection = new MySqlConnection("SERVER=" + Host + ";DATABASE=" + Database + ";UID=" + User + ";PASSWORD="******";");
                mySqlConnection.Open();
                Text = Globals.Name;
                if (mySqlConnection.State == ConnectionState.Open)
                {
                    Text = Text + " [Connected to: " + Host + "]";
                }
            }
            catch (MySqlException ex)
            {
                int num = (int)MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show(ex.Message, "Unknown Exception", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            IconList.SetConnection();
            NpcList.SetConnection();   //dethunter12 important!!
            SkillList.SetConnection(); //dethunter12 important!!
            IconSkill.SetConnection(); //test
            IconAction.SetConnection();
            IconSkill.Import();        //test
            IconAction.Import();
            IconList.Import();
            NpcList.Import();   //dethunter12 important!!!
            SkillList.Import(); //dethunter12 add 7/31/2020
            checkedListBox1.Enabled = true;
            if (!Globals.Console)
            {
                return;
            }
            Main.AllocConsole();
            Console.Title = "Debug Console";
            Console.WriteLine("Console Initialized.");
        }