Exemplo n.º 1
0
        public static void OnTick(object sender, ElapsedEventArgs e)
        {
            Training.SelectMonster();

            if (Training.monster_selected == false)
            {
                int dist = (int)(Math.Abs((nextx - Character.X)) + Math.Abs((nexty - Character.Y)));
                BotAction.WalkTo(nextx, nexty);

                double time        = (dist / Convert.ToInt64(Character.RunSpeed * 0.12f));
                Timer  RandomTimer = new Timer();
                RandomTimer.Elapsed += new ElapsedEventHandler(OnTickSecond);
                RandomTimer.Interval = time * 1000 + 1;
                RandomTimer.Start();
                RandomTimer.AutoReset = false;
                RandomTimer.Enabled   = true;
            }
            else
            {
                running = false;
            }
        }
Exemplo n.º 2
0
        public static void Handler(Packet packet)
        {
            switch (packet.Opcode)
            {
                #region Login
            case (ushort)0xA103:
                Servers.AgentRespond(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_CHARACTERLISTING:
                Character.CharacterList(packet);
                break;
                #endregion

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_CONFIRMSPAWN:
                Character.CharID(packet);
                Character.CharData(Character.CharPacket);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_CHARDATA:
                Character.CharPacket = packet;
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_CHARACTERINFO:
                Character.CharacterInfo(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_STUFFUPDATE:
                Character.UpdateInfo(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_LVLUP:
                Character.LevelUp(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_EXPSPUPDATE:
                Character.ExpSpUpdate(packet);
                break;

                #region Pets
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_PETINFO:
                PetsData.PetInfo(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_PETSTATS:
                PetsData.PetStats(packet);
                break;
                #endregion

                #region Spawns
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_SINGLESPAWN:
                Spawn.SingleSpawn(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_SINGLEDESPAWN:
                Spawn.SingleDeSpawn(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_GROUPSPAWNB:
                GroupSpawns.GroupeSpawnB(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_GROUPESPAWN:
                GroupSpawns.Manager(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_GROUPSPAWNEND:
                GroupSpawns.GroupSpawned();
                break;
                #endregion

                #region Training
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_OBJECTDIE:
                MonsterControl.MonsterAction(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_NPCSELECT:
                MonsterControl.NPCSelect(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_NPCDESELECT:
                MonsterControl.NPCDeselect(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_OBJECTSELECT:
                Training.Selected(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_OBJECTACTION:
                MonsterControl.Refresh(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_HPMPUPDATE:
                HPMPPacket.HPMPUpdate(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_HORSEACTION:
                PetsData.HorseAction(packet);
                break;
                #endregion

                #region Storage
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_STORAGEITEMS:
                StorageControl.ParseStorageItems(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_STORAGEGOLD:
                StorageControl.StorageGold(packet);
                break;
                #endregion

                #region Movement
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_MOVE:
                Movement.Move(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_STUCK:
                Movement.Stuck(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_SPEEDUPDATE:
                Character.SpeedUpdate(packet);
                break;
                #endregion

                #region Items

            /*case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_ITEMFIXED:
             *  InventoryControl.ItemFixed(packet);
             *  break;*/
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_DURABILITYCHANGE:
                InventoryControl.Durability(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_INVENTORYMOVEMENT:
                InventoryControl.Inventory_Update1(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_INVENTORYUSE:
                InventoryControl.Inventory_Update(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_ITEMMODIFY:
                InventoryControl.Inventory_Update2(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_ITEMRELEASE:
                PickupControl.Itemfree(packet);
                break;
                #endregion

                #region Skills
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_SKILLADD:
                Skills.SkillAdd(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_SKILLUPDATE:
                Skills.SkillUpdate(packet);
                break;
                #endregion

                #region Buffs
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_BUFFINFO:
                Buffas.BuffAdd(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_BUFFDELL:
                Buffas.BuffDell(packet);
                break;
                #endregion

                #region Party
            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_ACCEPTPARTY:
                Party.AcceptParty(packet);
                break;

            case (ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_PARTYREMOVE:
                Party.ReformParty(packet);
                break;
                #endregion
            }
        }
Exemplo n.º 3
0
 public static void CheckSkills()
 {
     {
         if (Data.bot && Training.monster_selected == true)
         {
             if (Globals.MainWindow.secondbuff.Items.Count == 0)
             {
                 if (Training.monster_type == 0 || Training.monster_type == 1 || Training.monster_type == 4 || Globals.MainWindow.partyattack.Items.Count == 0)
                 {
                     if (Globals.MainWindow.generalattack.Items.Count == 0)
                     {
                         ImbueCast();
                         Training.Attack(Training.monster_id);
                     }
                     else
                     {
                         for (int i = 0; i < Globals.MainWindow.generalattack.Items.Count; i++)
                         {
                             if (Skill.Skills[Skill.AttackSkills[i].index].Status == 0 && Skill.AttackSkills[i].MinMP <= Character.CurrentMP)
                             {
                                 ImbueCast();
                                 CastSkill(Skill.AttackSkills[i], Training.monster_id);
                                 break;
                             }
                             if (i + 1 == Globals.MainWindow.generalattack.Items.Count) /*&& (Globals.MainWindow.no_normal_attack.unchecked)*/
                             {
                                 ImbueCast();
                                 Training.Attack(Training.monster_id);
                                 //No more skills, normal attack
                             }
                         }
                     }
                 }
                 else
                 {
                     for (int i = 0; i < Globals.MainWindow.partyattack.Items.Count; i++)
                     {
                         if (Skill.Skills[Skill.PartyAttackSkills[i].index].Status == 0 && Skill.PartyAttackSkills[i].MinMP <= Character.CurrentMP)
                         {
                             ImbueCast();
                             CastSkill(Skill.PartyAttackSkills[i], Training.monster_id);
                             break;
                         }
                         if (i + 1 == Globals.MainWindow.partyattack.Items.Count) /*&& (Globals.MainWindow.no_normal_attack.unchecked)*/
                         {
                             ImbueCast();
                             Training.Attack(Training.monster_id);
                             //No more skills, normal attack
                         }
                     }
                 }
             }
             else
             {
                 if (Training.monster_type == 0 || Training.monster_type == 1 || Training.monster_type == 4 || Globals.MainWindow.partyattack.Items.Count == 0)
                 {
                     if (Globals.MainWindow.generalattack.Items.Count == 0)
                     {
                         if (Data.f_wep_name != "" && Data.f_wep_name != null)
                         {
                             int index = Data.inventorytype.IndexOf(Data.f_wep_name);
                             if (index == -1)
                             {
                                 Data.f_wep_name = "";
                             }
                         }
                         System.Threading.Thread.Sleep(1);
                         if (Data.f_wep_name != "")
                         {
                             int index1 = Data.inventorytype.IndexOf(Data.f_wep_name);
                             if (Data.inventoryslot[index1] != 6)
                             {
                                 System.Threading.Thread.Sleep(1);
                                 Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                 NewPacket.WriteUInt8(0);
                                 NewPacket.WriteUInt8((byte)Data.inventoryslot[index1]);
                                 NewPacket.WriteUInt8(6);
                                 NewPacket.WriteUInt16(0x0000);
                                 Proxy.ag_remote_security.Send(NewPacket);
                             }
                             else
                             {
                                 ImbueCast();
                                 Training.Attack(Training.monster_id);
                             }
                         }
                         else
                         {
                             Data.bot  = false;
                             Data.loop = false;
                             Globals.MainWindow.Content(Globals.MainWindow.startbot, "Start Bot");
                             Globals.MainWindow.UpdateLogs("Bot Stops! Cannot Find 1st Weapon");
                         }
                     }
                     else
                     {
                         for (int i = 0; i < Globals.MainWindow.generalattack.Items.Count; i++)
                         {
                             if (Data.f_wep_name != "" && Data.f_wep_name != null)
                             {
                                 int index = Data.inventorytype.IndexOf(Data.f_wep_name);
                                 if (index == -1)
                                 {
                                     Data.f_wep_name = "";
                                 }
                             }
                             System.Threading.Thread.Sleep(1);
                             if (Data.f_wep_name != "")
                             {
                                 if (Skill.Skills[Skill.AttackSkills[i].index].Status == 0 && Skill.AttackSkills[i].MinMP <= Character.CurrentMP)
                                 {
                                     System.Threading.Thread.Sleep(1);
                                     int index1 = Data.inventorytype.IndexOf(Data.f_wep_name);
                                     if (Data.inventoryslot[index1] != 6)
                                     {
                                         System.Threading.Thread.Sleep(1);
                                         Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                         NewPacket.WriteUInt8(0);
                                         NewPacket.WriteUInt8((byte)Data.inventoryslot[index1]);
                                         NewPacket.WriteUInt8(6);
                                         NewPacket.WriteUInt16(0x0000);
                                         Proxy.ag_remote_security.Send(NewPacket);
                                         break;
                                     }
                                     else
                                     {
                                         ImbueCast();
                                         CastSkill(Skill.AttackSkills[i], Training.monster_id);
                                         break;
                                     }
                                 }
                                 if (i + 1 == Globals.MainWindow.generalattack.Items.Count) /*&& (Globals.MainWindow.no_normal_attack.unchecked)*/
                                 {
                                     int index1 = Data.inventorytype.IndexOf(Data.f_wep_name);
                                     if (Data.inventoryslot[index1] != 6)
                                     {
                                         System.Threading.Thread.Sleep(1);
                                         Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                         NewPacket.WriteUInt8(0);
                                         NewPacket.WriteUInt8((byte)Data.inventoryslot[index1]);
                                         NewPacket.WriteUInt8(6);
                                         NewPacket.WriteUInt16(0x0000);
                                         Proxy.ag_remote_security.Send(NewPacket);
                                     }
                                     else
                                     {
                                         ImbueCast();
                                         Training.Attack(Training.monster_id);
                                         //No more skills, normal attack
                                     }
                                 }
                             }
                             else
                             {
                                 Data.bot  = false;
                                 Data.loop = false;
                                 Globals.MainWindow.Content(Globals.MainWindow.startbot, "Start Bot");
                                 Globals.MainWindow.UpdateLogs("Bot Stops! Cannot Find 1st Weapon");
                                 break;
                             }
                         }
                     }
                 }
                 else
                 {
                     for (int i = 0; i < Globals.MainWindow.partyattack.Items.Count; i++)
                     {
                         if (Data.f_wep_name != "" && Data.f_wep_name != null)
                         {
                             int index = Data.inventorytype.IndexOf(Data.f_wep_name);
                             if (index == -1)
                             {
                                 Data.f_wep_name = "";
                             }
                         }
                         System.Threading.Thread.Sleep(1);
                         if (Data.f_wep_name != "")
                         {
                             if (Skill.Skills[Skill.PartyAttackSkills[i].index].Status == 0 && Skill.PartyAttackSkills[i].MinMP <= Character.CurrentMP)
                             {
                                 System.Threading.Thread.Sleep(1);
                                 int index1 = Data.inventorytype.IndexOf(Data.f_wep_name);
                                 if (Data.inventoryslot[index1] != 6)
                                 {
                                     System.Threading.Thread.Sleep(1);
                                     Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                     NewPacket.WriteUInt8(0);
                                     NewPacket.WriteUInt8((byte)Data.inventoryslot[index1]);
                                     NewPacket.WriteUInt8(6);
                                     NewPacket.WriteUInt16(0x0000);
                                     Proxy.ag_remote_security.Send(NewPacket);
                                     break;
                                 }
                                 else
                                 {
                                     ImbueCast();
                                     CastSkill(Skill.PartyAttackSkills[i], Training.monster_id);
                                     break;
                                 }
                             }
                             if (i + 1 == Globals.MainWindow.partyattack.Items.Count) /*&& (Globals.MainWindow.no_normal_attack.unchecked)*/
                             {
                                 System.Threading.Thread.Sleep(1);
                                 int index1 = Data.inventorytype.IndexOf(Data.f_wep_name);
                                 if (Data.inventoryslot[index1] != 6)
                                 {
                                     System.Threading.Thread.Sleep(1);
                                     Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                     NewPacket.WriteUInt8(0);
                                     NewPacket.WriteUInt8((byte)Data.inventoryslot[index1]);
                                     NewPacket.WriteUInt8(6);
                                     NewPacket.WriteUInt16(0x0000);
                                     Proxy.ag_remote_security.Send(NewPacket);
                                 }
                                 else
                                 {
                                     ImbueCast();
                                     Training.Attack(Training.monster_id);
                                     //No more skills, normal attack
                                 }
                             }
                         }
                         else
                         {
                             Data.bot  = false;
                             Data.loop = false;
                             Globals.MainWindow.Content(Globals.MainWindow.startbot, "Start Bot");;
                             Globals.MainWindow.UpdateLogs("Bot Stops! Cannot Find 1st Weapon");
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public static void Manager()
 {
     {
         if (Data.bot && (Movement.enablelogic && (Data.dead == false)))
         {
             if (Globals.MainWindow.Checked(Globals.MainWindow.nopick) == false)
             {
                 if (Globals.MainWindow.Checked(Globals.MainWindow.normalpick) == true)
                 {
                     if (Movement.stuck == true)
                     {
                         Movement.StuckMove();
                     }
                     else
                     {
                         if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && Data.char_grabpetid != 0)
                         {
                             PickupControl.NormalFilter();
                         }
                         if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == false && PickupControl.there_is_pickable == true)
                         {
                             PickupControl.NormalFilter();
                         }
                         else
                         {
                             if (Buffas.buff_waiting == true)
                             {
                                 Buffas.BuffChecker();
                             }
                             else
                             {
                                 if (Training.monster_selected == false)
                                 {
                                     Training.SelectMonster();
                                 }
                                 else
                                 {
                                     Skills.CheckSkills();
                                 }
                             }
                         }
                     }
                 }
                 else if (Globals.MainWindow.Checked(Globals.MainWindow.advancepick) == true)
                 {
                     if (Movement.stuck == true)
                     {
                         Movement.StuckMove();
                     }
                     else
                     {
                         if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && Data.char_grabpetid != 0)
                         {
                             PickupControl.AdvanceFilter();
                         }
                         if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && PickupControl.there_is_pickable == true)
                         {
                             PickupControl.AdvanceFilter();
                         }
                         else
                         {
                             if (Buffas.buff_waiting == true)
                             {
                                 Buffas.BuffChecker();
                             }
                             else
                             {
                                 if (Training.monster_selected == false)
                                 {
                                     Training.SelectMonster();
                                 }
                                 else
                                 {
                                     Skills.CheckSkills();
                                 }
                             }
                         }
                     }
                 }
             }
             else
             {
                 if (Movement.stuck == true)
                 {
                     Movement.StuckMove();
                 }
                 else
                 {
                     if (Buffas.buff_waiting == true)
                     {
                         Buffas.BuffChecker();
                     }
                     else
                     {
                         if (Training.monster_selected == false)
                         {
                             Training.SelectMonster();
                         }
                         else
                         {
                             Skills.CheckSkills();
                         }
                     }
                 }
             }
         }
     }
 }