Esempio n. 1
0
        public static void Refresh(Packet packet)
        {
            byte flag1 = packet.ReadUInt8();
            byte flag2 = packet.ReadUInt8();

            if (flag1 == 2 && (flag2 == 0 || flag2 == 1))
            {
                LogicControl.Manager();

                /*if (Skills.skill_casted == true || PickupControl.picked == true || Training.normal_attack == true)
                 * {
                 *  Training.normal_attack = false;
                 *  Skills.skill_casted = false;
                 *  PickupControl.picking = false;
                 *  PickupControl.picked = false;
                 * }*/
            }

            /*else if (flag1 == 2 && flag2 == 1)
             * {
             *  Training.normal_attack = true;
             * }*/
            else if (flag1 == 3 && flag2 == 1)
            {
                //LogicControl.Manager();
            }
        }
Esempio n. 2
0
 public static void OnTickSecond(object sender, ElapsedEventArgs e)
 {
     if (running == true)
     {
         running = false;
         LogicControl.Manager();
     }
 }
Esempio n. 3
0
 public static void BuffAdd(Packet packet)
 {
     {
         uint charid = packet.ReadUInt32();
         if (charid == Character.UniqueID)
         {
             uint id = packet.ReadUInt32();
             for (int i = 0; i < Skill.Skills.Count; i++)
             {
                 if (Skill.Skills[i].UniqueID == id)
                 {
                     uint temp = packet.ReadUInt32();
                     Skill.Skills[i].bufftemp    = temp;
                     Skill.Skills[i].Status      = 1;
                     Skill.Skills[i].BuffWaiting = 0;
                     if (Skill.Skills[i].Type.Contains("SKILL_CH_COLD_BINGBYEOK") || Skill.Skills[i].Type.Contains("SKILL_CH_FIRE_HWABYEOK"))
                     {
                         if (Skill.Skills[i].Type.Contains("SKILL_CH_COLD_BINGBYEOK"))
                         {
                             Skills.buffcount1++;
                             Skills.buff1 = id;
                         }
                         if (Skill.Skills[i].Type.Contains("SKILL_CH_FIRE_HWABYEOK"))
                         {
                             Skills.buffcount2++;
                             Skills.buff2 = id;
                         }
                     }
                     else
                     {
                         if (Skill.Skills[i].Bufftime < Skill.Skills[i].Cooldown)
                         {
                             Skill.Skills[i].CooldownTime.Interval = Skill.Skills[i].Cooldown;
                             Skill.Skills[i].CooldownTime.Elapsed += new ElapsedEventHandler((sender, e) => Buffs_Elapsed(sender, e, Skill.Skills[i]));
                             Skill.Skills[i].CooldownTime.Start();
                             Skill.Skills[i].CooldownTime.AutoReset = false;
                             Skill.Skills[i].CooldownTime.Enabled   = true;
                         }
                         else
                         {
                             Skill.Skills[i].CooldownTime.Interval = Skill.Skills[i].Bufftime - 100;
                             Skill.Skills[i].CooldownTime.Elapsed += new ElapsedEventHandler((sender, e) => Buffs_Elapsed(sender, e, Skill.Skills[i]));
                             Skill.Skills[i].CooldownTime.Start();
                             Skill.Skills[i].CooldownTime.AutoReset = false;
                             Skill.Skills[i].CooldownTime.Enabled   = true;
                         }
                     }
                     if (!((Skill.Skills[i].Type.Equals(Skill.Imbue[0].Type)) || (Skill.Skills[i].Type.Equals(Skill.PartyImbue[0].Type))))
                     {
                         System.Threading.Thread.Sleep(Skill.Skills[i].Casttime);
                         LogicControl.Manager();
                     }
                     break;
                 }
             }
         }
     }
 }
Esempio n. 4
0
 public static void AdvanceFilter()
 {
     for (int i = 0; i < Item.PickableItem.Count; i++)
     {
         try
         {
             System.Threading.Thread.Sleep(2);
             if (Item.PickableItem[i].Status == 0 && Item.PickableItem[i].Type != null)
             {
                 string type = Item.PickableItem[i].Type;
                 if (Filter(type) == true)
                 {
                     PickItem(Item.PickableItem[i].UniqueID);
                     break;
                 }
             }
             if (i + 1 >= Item.PickableItem.Count)
             {
                 System.Threading.Thread.Sleep(1);
                 there_is_pickable = false;
                 if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true)
                 {
                     LogicControl.Manager();
                 }
             }
         }
         catch
         {
             if (i + 1 >= Item.PickableItem.Count)
             {
                 System.Threading.Thread.Sleep(1);
                 there_is_pickable = false;
                 if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true)
                 {
                     LogicControl.Manager();
                 }
             }
         }
     }
     if (Item.PickableItem.Count == 0)
     {
         System.Threading.Thread.Sleep(1);
         there_is_pickable = false;
         if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true)
         {
             LogicControl.Manager();
         }
     }
 }
Esempio n. 5
0
 public static void NormalFilter()
 {
     for (int i = 0; i < Item.PickableItem.Count; i++)
     {
         {
             System.Threading.Thread.Sleep(2);
             if (Item.PickableItem[i].Status == 0 && Item.PickableItem[i].Type != null)
             {
                 string type = Item.PickableItem[i].Type;
                 if (type.StartsWith("ITEM_ETC_GOLD"))
                 {
                     if (Globals.MainWindow.ReadText(Globals.MainWindow.gold_drop) == "Just Pick")
                     {
                         PickItem(Item.PickableItem[i].UniqueID);
                         break;
                     }
                 }
                 if (Data.itemscount.items_count < Character.InventorySize - 13)
                 {
                     if (type.Contains("RARE") || type.Contains("ITEM_ROC") || type.Contains("ITEM_MALL") || type.Contains("ITEM_QSP") || type.Contains("ITEM_EVENT_CH") || type.Contains("ITEM_EVENT_EU") || type.Contains("ITEM_QNO"))
                     {
                         PickItem(Item.PickableItem[i].UniqueID);
                         break;
                     }
                     if (type.StartsWith("ITEM_CH_SWORD") || type.StartsWith("ITEM_CH_BLADE") || type.StartsWith("ITEM_CH_SPEAR") || type.StartsWith("ITEM_CH_TBLADE") || type.StartsWith("ITEM_CH_BOW") || type.StartsWith("ITEM_CH_SHIELD") || type.StartsWith("ITEM_EU_DAGGER") || type.StartsWith("ITEM_EU_SWORD") || type.StartsWith("ITEM_EU_TSWORD") || type.StartsWith("ITEM_EU_AXE") || type.StartsWith("ITEM_EU_CROSSBOW") || type.StartsWith("ITEM_EU_DARKSTAFF") || type.StartsWith("ITEM_EU_TSTAFF") || type.StartsWith("ITEM_EU_HARP") || type.StartsWith("ITEM_EU_STAFF") || type.StartsWith("ITEM_EU_SHIELD"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.wep_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_CH_M_HEAVY") || type.StartsWith("ITEM_CH_M_LIGHT") || type.StartsWith("ITEM_CH_M_CLOTHES") || type.StartsWith("ITEM_CH_W_HEAVY") || type.StartsWith("ITEM_CH_W_LIGHT") || type.StartsWith("ITEM_CH_W_CLOTHES") || type.StartsWith("ITEM_EU_M_HEAVY") || type.StartsWith("ITEM_EU_M_LIGHT") || type.StartsWith("ITEM_EU_M_CLOTHES") || type.StartsWith("ITEM_EU_W_HEAVY") || type.StartsWith("ITEM_EU_W_LIGHT") || type.StartsWith("ITEM_EU_W_CLOTHES"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.armor_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_EU_RING") || type.StartsWith("ITEM_EU_EARRING") || type.StartsWith("ITEM_EU_NECKLACE") || type.StartsWith("ITEM_CH_RING") || type.StartsWith("ITEM_CH_EARRING") || type.StartsWith("ITEM_CH_NECKLACE"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.acc_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_REINFORCE_RECIPE_WEAPON"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.wepe_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_REINFORCE_RECIPE_SHIELD"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.shielde_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_REINFORCE_RECIPE_ARMOR"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.prote_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_REINFORCE_RECIPE_ACCESSARY"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.acce_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_AMMO_ARROW"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.arrow_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_AMMO_BOLT"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.bolt_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_SCROLL_RETURN"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.return_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_CURE_ALL"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.uni_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ALL_SPOTION"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.vigorg_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ALL_POTION"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.vigorp_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_MP_POTION"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.mp_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_HP_POTION"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.hp_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_MAGICTABLET") || type.StartsWith("ITEM_ETC_ARCHEMY_ATTRTABLET") || type.Contains("MAGICSTONE"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.tablets_drop) != "Ignore")
                         {
                             {
                                 PickItem(Item.PickableItem[i].UniqueID);
                                 break;
                             }
                         }
                     }
                     if (type.StartsWith("ITEM_ETC_ARCHEMY_MATERIAL"))
                     {
                         if (Globals.MainWindow.ReadText(Globals.MainWindow.materials_drop) != "Ignore")
                         {
                             PickItem(Item.PickableItem[i].UniqueID);
                             break;
                         }
                     }
                 }
             }
             if (i + 1 >= Item.PickableItem.Count)
             {
                 System.Threading.Thread.Sleep(1);
                 there_is_pickable = false;
                 if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true)
                 {
                     LogicControl.Manager();
                 }
             }
         }
     }
     if (Item.PickableItem.Count == 0)
     {
         System.Threading.Thread.Sleep(1);
         there_is_pickable = false;
         if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true)
         {
             LogicControl.Manager();
         }
     }
 }
Esempio n. 6
0
        public static void Selected(Packet packet)
        {
            try
            {
                if (packet.ReadUInt8() == 1)
                {
                    Training.currentlyselected = packet.ReadUInt32();

                    try
                    {
                        Data.selectednpctype = Spawns.NPCType[Spawns.NPCID.IndexOf(Training.currentlyselected)];
                    }
                    catch { }

                    #region Loop
                    if (Data.loop && Data.bot)
                    {
                        if (Data.loopaction == "storage")
                        {
                            if (Data.storageopened == 0)
                            {
                                StorageControl.GetStorageItems(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                            }
                            else
                            {
                                StorageControl.OpenStorage1();
                            }
                        }
                        if (Data.loopaction == "blacksmith")
                        {
                            SellControl.SellManager(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                        }
                        if (Data.loopaction == "stable" || Data.loopaction == "accessory" || Data.loopaction == "potion")
                        {
                            BuyControl.BuyManager(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                        }
                    }
                    #endregion

                    else
                    {
                        if (Data.bot && monster_selected)
                        {
                            PortConfigs.TrainWindow.Label(PortConfigs.TrainWindow.monstername, monster_name);
                            PortConfigs.TrainWindow.Label(PortConfigs.TrainWindow.monstertype, monster_type_string);

                            if (packet.ReadUInt8() == 0x01)
                            {
                                if (Data.bot)
                                {
                                    if (monster_selected)
                                    {
                                        Movement.stuck_count = 0;
                                    }
                                }
                                uint hp = packet.ReadUInt32();
                                PortConfigs.TrainWindow.Label(PortConfigs.TrainWindow.monsterHP, Convert.ToString(hp));
                                if (hp > 0)
                                {
                                    if (currentlyselected == monster_id)
                                    {
                                        Skills.GhostWalk(distance, X, Y);
                                        if (Globals.MainWindow.Checked(Globals.MainWindow.petattack) == true)
                                        {
                                            BotAction.AttackWithPet();
                                        }
                                        Berserk.CheckBerserk(Training.monster_id, monster_type_string);

                                        /*if ((Globals.MainWindow.buffs_list3.Items.Count != 0 || Globals.MainWindow.buffs_list4.Items.Count != 0) && monster_type > 1)
                                         * {
                                         *  Buffas.buff_waiting = true;
                                         * }*/
                                        LogicControl.Manager();
                                    }
                                }
                                else
                                {
                                    Training.monster_selected = false;
                                    Training.monster_id       = 0;

                                    LogicControl.Manager();
                                }
                            }
                        }
                    }
                }
                else
                {
                    LeoBot.Stuck.AddMob(Training.monster_id, 3);

                    Training.monster_selected = false;
                    Training.monster_id       = 0;

                    LogicControl.Manager();
                }
            }
            catch (Exception)
            {
                Training.monster_selected = false;
                Training.monster_id       = 0;

                LogicControl.Manager();
            }
        }
Esempio n. 7
0
        public static void GroupSpawns(Packet packet)
        {
            try
            {
                if (Data.groupespawninfo == 1)
                {
                    for (int i = 0; i < Data.groupespawncount; i++)
                    {
                        #region DetectType
                        uint model      = packet.ReadUInt32();
                        int  index      = Mobs_Info.mobsidlist.IndexOf(model);
                        int  itemsindex = Items_Info.itemsidlist.IndexOf(model);
                        #endregion

                        if (itemsindex != -1)
                        {
                            #region ItemsParsing
                            DataParser.ParseItem(packet, itemsindex);
                            #endregion
                        }
                        if (index != -1)
                        {
                            #region MobsParsing
                            if (Mobs_Info.mobstypelist[index].StartsWith("MOB"))
                            {
                                DataParser.ParseMob(packet, index);
                            }
                            #endregion

                            #region PetsParsing
                            else if (Mobs_Info.mobstypelist[index].StartsWith("COS"))
                            {
                                DataParser.ParsePets(packet, index);
                            }
                            #endregion

                            #region NPCParsing
                            else if (Mobs_Info.mobstypelist[index].StartsWith("NPC"))
                            {
                                DataParser.ParseNPC(packet, index);
                            }
                            #endregion

                            #region CharParsing
                            else if (Mobs_Info.mobstypelist[index].StartsWith("CHAR"))
                            {
                                DataParser.ParseChar(packet, index);
                            }
                            #endregion

                            #region PortalParsing
                            else if (Mobs_Info.mobstypelist[index].Contains("_GATE"))
                            {
                                DataParser.ParsePortal(packet, index);
                            }
                            #endregion

                            #region StructureParsing
                            else if (Mobs_Info.mobstypelist[index].StartsWith("STRUCTURE"))
                            {
                                DataParser.ParseStructure(packet, index);
                            }
                            #endregion

                            #region OtherParsing
                            else
                            {
                                DataParser.ParseOthers(packet, index);
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < Data.groupespawncount; i++)
                    {
                        #region Deselect
                        uint id = packet.ReadUInt32();
                        if (id == Training.currentlyselected)
                        {
                            Training.currentlyselected = 0;
                        }
                        #endregion

                        #region Items
                        foreach (Item item in Item.SpawnItem)
                        {
                            if (id == item.UniqueID)
                            {
                                Item.SpawnItem.Remove(item);
                                break;
                            }
                        }
                        foreach (Item item in Item.PickableItem)
                        {
                            if (id == item.UniqueID)
                            {
                                Item.PickableItem.Remove(item);
                                break;
                            }
                        }
                        #endregion

                        #region Chars
                        foreach (OtherCharacter character in OtherCharacter.Characters)
                        {
                            if (id == character.UniqueID)
                            {
                                OtherCharacter.Characters.Remove(character);
                                break;
                            }
                        }
                        #endregion

                        #region Mobs
                        foreach (Monster monster in Monster.SpawnMob)
                        {
                            if (monster.UniqueID == id)
                            {
                                Monster.SpawnMob.Remove(monster);
                                Stuck.DeleteMob(id);
                                if (id == Training.monster_id)
                                {
                                    Training.monster_selected = false;
                                    Training.monster_id       = 0;
                                    //Pause the character and call the Logic!

                                    //Select New Monster, cause selected just disapeared
                                    LogicControl.Manager();
                                }
                                break;
                            }
                        }
                        #endregion

                        #region Pets
                        for (int z = 0; z < Spawns.pets.Length; z++)
                        {
                            if (id == Spawns.pets[z].id)
                            {
                                Spawns.pets[z] = new Spawns.Pets_();
                                break;
                            }
                        }
                        #endregion
                    }
                }
            }
            catch { }
        }
Esempio n. 8
0
        public static void SingleDeSpawn(Packet packet)
        {
            #region Deselect
            uint id = packet.ReadUInt32();
            if (id == Training.currentlyselected)
            {
                Training.currentlyselected = 0;
            }
            #endregion

            #region Items
            foreach (Item item in Item.SpawnItem)
            {
                if (id == item.UniqueID)
                {
                    Item.SpawnItem.Remove(item);
                    break;
                }
            }
            foreach (Item item in Item.PickableItem)
            {
                if (id == item.UniqueID)
                {
                    Item.PickableItem.Remove(item);
                    break;
                }
            }
            #endregion

            #region Pets
            for (int z = 0; z < Spawns.pets.Length; z++)
            {
                if (id == Spawns.pets[z].id)
                {
                    Spawns.pets[z] = new Spawns.Pets_();
                    break;
                }
            }
            #endregion

            #region Chars
            foreach (OtherCharacter character in OtherCharacter.Characters)
            {
                if (id == character.UniqueID)
                {
                    OtherCharacter.Characters.Remove(character);
                    break;
                }
            }
            #endregion

            #region Mobs
            foreach (Monster monster in Monster.SpawnMob)
            {
                if (monster.UniqueID == id)
                {
                    Monster.SpawnMob.Remove(monster);
                    Stuck.DeleteMob(id);
                    if (id == Training.monster_id)
                    {
                        Training.monster_selected = false;
                        Training.monster_id       = 0;
                        //Pause the character and call the Logic!

                        //Select New Monster, cause selected just disapeared
                        LogicControl.Manager();
                    }
                    break;
                }
            }
            #endregion
        }
Esempio n. 9
0
        public static void HPMPUpdate(Packet hp_packet)
        {
            {
                uint id = hp_packet.ReadUInt32();

                if (id == Character.UniqueID)
                {
                    hp_packet.ReadUInt8();
                    hp_packet.ReadUInt8(); // 0x00
                    byte type2 = hp_packet.ReadUInt8();
                    switch (type2)
                    {
                    case 0x01:
                        Character.CurrentHP = hp_packet.ReadUInt32();
                        break;

                    case 0x02:
                        Character.CurrentMP = hp_packet.ReadUInt32();
                        break;

                    case 0x03:
                        Character.CurrentHP = hp_packet.ReadUInt32();
                        Character.CurrentMP = hp_packet.ReadUInt32();
                        break;

                    case 0x04:
                        uint status = hp_packet.ReadUInt32();
                        if (status == 0)
                        {
                            bad_status = 0;
                            Globals.MainWindow.SetText(Globals.MainWindow.status, "Normal");
                            if (frozen == true)
                            {
                                frozen = false;
                                System.Threading.Thread.Sleep(500);
                                Globals.MainWindow.UpdateLogs("Frozen!");
                            }
                        }
                        else
                        {
                            if (status == 3 || status == 2)
                            {
                                frozen = true;
                            }
                            bad_status = 1;
                            Globals.MainWindow.SetText(Globals.MainWindow.status, "Bad Status");
                        }
                        break;
                    }

                    Globals.MainWindow.UpdateBar();

                    if (Character.CurrentMP >= Buffas.min_mp_require)
                    {
                        Buffas.min_mp_require = 200000;
                        Buffas.buff_waiting   = true;
                    }
                    if (Character.CurrentHP > 0)
                    {
                        Data.dead = false;
                    }
                    else
                    {
                        Data.dead = true;
                        Data.Statistic.died_count++;

                        /*if (Globals.MainWindow.alert_char_die.Checked)
                         * {
                         *  Alert.StartAlert();
                         * }*/
                        if (Globals.MainWindow.Checked(Globals.MainWindow.dead) == true)
                        {
                            //Return To Town
                            Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_ACCEPTDEAD);
                            NewPacket.WriteUInt8(1);
                            Proxy.ag_remote_security.Send(NewPacket);
                            Data.returning = 1;
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.uniuse) == true && bad_status == 1)
                    {
                        Autopot.UseUni();
                    }
                    uint hp = Character.CurrentHP * 100 / Character.MaxHP;
                    uint mp = Character.CurrentMP * 100 / Character.MaxMP;

                    if (Globals.MainWindow.Checked(Globals.MainWindow.hpuse) == true)
                    {
                        if (hp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.hptext)))
                        {
                            Autopot.UseHP();
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.shpuse) == true)
                    {
                        if (hp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.shptext)))
                        {
                            Autopot.UseSHP();
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.mpuse) == true)
                    {
                        if (mp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.mptext)))
                        {
                            Autopot.UseMP();
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.smpuse) == true)
                    {
                        if (mp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.smptext)))
                        {
                            Autopot.UseSMP();
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.vigorhpuse) == true)
                    {
                        if (hp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.vigorhptext)))
                        {
                            Autopot.UseVigor();
                        }
                    }
                    if (Globals.MainWindow.Checked(Globals.MainWindow.vigormpuse) == true)
                    {
                        if (mp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.vigormptext)))
                        {
                            Autopot.UseVigor();
                        }
                    }
                    try
                    {
                        if (Globals.MainWindow.Checked(Globals.MainWindow.skillhpuse) == true)
                        {
                            if (hp < Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.skillhptext)))
                            {
                                foreach (Skill skill in Skill.Skills)
                                {
                                    if (skill.Name == Globals.MainWindow.ReadText1(Globals.MainWindow.healskill))
                                    {
                                        Skills.CastSkill(skill, 0);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                        Globals.MainWindow.UpdateLogs("Cannot find any skill to buff! Heal by skill disabled!");
                        Globals.MainWindow.UnCheck(Globals.MainWindow.skillhpuse);
                    }
                }
                else if (id == Data.char_attackpetid)
                {
                    hp_packet.ReadUInt8();
                    hp_packet.ReadUInt8();
                    byte type = hp_packet.ReadUInt8();
                    switch (type)
                    {
                    case 0x05:
                        Pets.CurrentHP = hp_packet.ReadUInt32();
                        uint hp = Pets.CurrentHP * 100 / Pets.MaxHP;
                        if (Globals.MainWindow.Checked(Globals.MainWindow.pethpuse) == true)
                        {
                            foreach (Pets CharPet in Pets.CharPets)
                            {
                                if (CharPet.UniqueID == id)
                                {
                                    if (hp < Convert.ToUInt32(Globals.MainWindow.ReadText(Globals.MainWindow.pethptext)))
                                    {
                                        Autopot.UsePetHP(CharPet.UniqueID);
                                    }
                                    break;
                                }
                            }
                        }
                        break;

                    case 0x04:
                        if (hp_packet.ReadUInt32() == 0)
                        {
                            pet_status = 0;
                        }
                        else
                        {
                            pet_status = 1;
                        }
                        break;
                    }
                    foreach (Pets CharPet in Pets.CharPets)
                    {
                        if (CharPet.UniqueID == id)
                        {
                            if (Globals.MainWindow.Checked(Globals.MainWindow.unipet) == true && pet_status == 1)
                            {
                                Autopot.UsePetUni(CharPet.UniqueID);
                            }
                            break;
                        }
                    }
                }
                else if (id == Data.char_horseid)
                {
                    hp_packet.ReadUInt8();
                    hp_packet.ReadUInt8();
                    byte type = hp_packet.ReadUInt8();
                    switch (type)
                    {
                    case 0x05:
                        Pets.HorseCurrentHP = hp_packet.ReadUInt32();
                        uint hp = Pets.HorseCurrentHP * 100 / Pets.HorseMaxHP;
                        if (Globals.MainWindow.Checked(Globals.MainWindow.horsehpuse) == true)
                        {
                            foreach (Pets CharPet in Pets.CharPets)
                            {
                                if (CharPet.UniqueID == id)
                                {
                                    if (hp < Convert.ToUInt32(Globals.MainWindow.ReadText(Globals.MainWindow.horsehptext)))
                                    {
                                        Autopot.UsePetHP(CharPet.UniqueID);
                                    }
                                    break;
                                }
                            }
                        }
                        break;

                    case 0x04:
                        if (hp_packet.ReadUInt32() == 0)
                        {
                            horse_status = 0;
                        }
                        else
                        {
                            horse_status = 1;
                        }
                        break;
                    }
                    foreach (Pets CharPet in Pets.CharPets)
                    {
                        if (CharPet.UniqueID == id)
                        {
                            if (Globals.MainWindow.Checked(Globals.MainWindow.unihorse) == true && horse_status == 1)
                            {
                                Autopot.UsePetUni(CharPet.UniqueID);
                            }
                            break;
                        }
                    }
                }
                else
                {
                    hp_packet.ReadUInt8();
                    hp_packet.ReadUInt8();
                    byte type = hp_packet.ReadUInt8();
                    switch (type)
                    {
                    case 0x05:
                        uint hp = hp_packet.ReadUInt32();
                        PortConfigs.TrainWindow.Label(PortConfigs.TrainWindow.monsterHP, Convert.ToString(hp));
                        if (hp == 0)
                        {
                            foreach (Monster monster in Monster.SpawnMob)
                            {
                                if (id == monster.UniqueID)
                                {
                                    Monster.SpawnMob.Remove(monster);
                                    Stuck.DeleteMob(id);
                                    if (id == Training.monster_id)
                                    {
                                        Training.monster_selected = false;
                                        Training.monster_id       = 0;
                                        //Select New Monster, cause selected just disapeared
                                        //If there is fire/cold wall, delete the buff
                                        if (Skills.buffcount1 > 0)
                                        {
                                            Packet NewPacket1 = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_OBJECTACTION);
                                            NewPacket1.WriteUInt8(1);
                                            NewPacket1.WriteUInt8(5);
                                            NewPacket1.WriteUInt32(Skills.buff1);
                                            NewPacket1.WriteInt8(0);
                                            Proxy.ag_remote_security.Send(NewPacket1);
                                        }
                                        if (Skills.buffcount2 > 0)
                                        {
                                            Packet NewPacket1 = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_OBJECTACTION);
                                            NewPacket1.WriteUInt8(1);
                                            NewPacket1.WriteUInt8(5);
                                            NewPacket1.WriteUInt32(Skills.buff2);
                                            NewPacket1.WriteInt8(0);
                                            Proxy.ag_remote_security.Send(NewPacket1);
                                        }
                                        LogicControl.Manager();
                                    }
                                    break;
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 10
0
        public static void Inventory_Update1(Packet packet)
        {
            Packet vienas = packet;
            int    check  = packet.ReadUInt8();

            if (check == 1)
            {
                int typ = packet.ReadUInt8();
                if (typ == 0) // Inventory <> Inventory
                {
                    byte   inv_1   = packet.ReadUInt8();
                    byte   inv_2   = packet.ReadUInt8();
                    ushort count   = packet.ReadUInt16();
                    int    index_1 = Data.inventoryslot.IndexOf(inv_1);
                    int    index_2 = Data.inventoryslot.IndexOf(inv_2);
                    if (index_2 == -1)
                    {
                        // No item, Moving !
                        Data.inventoryslot[index_1] = inv_2;
                        if (itemid != 0)
                        {
                            Data.inventoryslot[Data.inventorytype.IndexOf(Items_Info.itemstypelist[Items_Info.itemsidlist.IndexOf(itemid)])] = intendtomove;
                            itemid       = 0;
                            intendtomove = 0;
                        }
                    }
                    else
                    {
                        // The item exist !
                        if (Data.inventorytype[index_1] == Data.inventorytype[index_2])
                        {
                            // Items Are Same, Merge It !
                            if (Data.inventorycount[index_2] == Items_Info.items_maxlist[Items_Info.itemstypelist.IndexOf(Data.inventorytype[index_2])])
                            {
                                // Items Are Maxed, Move It !
                                Data.inventoryslot[index_1] = inv_2;
                                Data.inventoryslot[index_2] = inv_1;
                            }
                            else
                            {
                                // Items Are Same, Merge It !
                                if (Data.inventorycount[index_1] == count)
                                {
                                    // Merged Everything, Delete The First Item !
                                    Data.inventorycount[index_2] += count;

                                    Data.inventoryid.RemoveAt(index_1);
                                    Data.inventorytype.RemoveAt(index_1);
                                    Data.inventorycount.RemoveAt(index_1);
                                    Data.inventoryslot.RemoveAt(index_1);
                                    Data.inventorydurability.RemoveAt(index_1);
                                    Data.inventorylevel.RemoveAt(index_1);
                                    Data.inventoryname.RemoveAt(index_1);
                                    Data.maxdurability.RemoveAt(index_1);
                                }
                                else
                                {
                                    // Merged Not Everything, Recalculate Quantity !
                                    Data.inventorycount[index_2] += count;
                                    Data.inventorycount[index_1] -= count;
                                }
                            }
                        }
                        else
                        {
                            // Items Are Different, Move It !
                            Data.inventoryslot[index_1] = inv_2;
                            Data.inventoryslot[index_2] = inv_1;
                        }
                    }
                    Globals.MainWindow.UpdateInventory();
                    if (Buffas.changing_weapon)
                    {
                        LogicControl.Manager();
                    }
                    if (Data.loopaction == "merge")
                    {
                        InventoryControl.MergeItems();
                    }
                }
                if (typ == 1) // Storage -> Storage
                {
                    byte   str_1   = packet.ReadUInt8();
                    byte   str_2   = packet.ReadUInt8();
                    ushort count   = packet.ReadUInt16();
                    int    index_1 = Data.storageslot.IndexOf(str_1);
                    int    index_2 = Data.storageslot.IndexOf(str_2);
                    if (index_2 == -1)
                    {
                        // No item, Moving !
                        Data.storageslot[index_1] = str_2;
                    }
                    else
                    {
                        //The item exist !
                        if (Data.storagetype[index_1] == Data.storagetype[index_2])
                        {
                            // Items Are Same, Merge It !
                            if (Data.storagecount[index_2] == Items_Info.items_maxlist[Items_Info.itemstypelist.IndexOf(Data.storagetype[index_2])])
                            {
                                // Items Are Maxed, Move It !
                                Data.storageslot[index_1] = str_2;
                                Data.storageslot[index_2] = str_1;
                            }
                            else
                            {
                                // Items Are Same, Merge It !
                                if (Data.storagecount[index_1] == count)
                                {
                                    // Merged Everything, Delete The First Item !
                                    Data.storagecount[index_2] += count;
                                    string name = Items_Info.itemsnamelist[Items_Info.itemstypelist.IndexOf(Data.storagetype[index_1])];
                                    //Globals.MainWindow.storage_list.Items.Remove(name);

                                    Data.storageid.RemoveAt(index_1);
                                    Data.storagetype.RemoveAt(index_1);
                                    Data.storagecount.RemoveAt(index_1);
                                    Data.storageslot.RemoveAt(index_1);
                                    Data.storagedurability.RemoveAt(index_1);
                                    Data.storagelevel.RemoveAt(index_1);
                                    Data.storagename.RemoveAt(index_1);
                                }
                                else
                                {
                                    // Merged Not Everything, Recalculate Quantity !
                                    Data.storagecount[index_2] += count;
                                    Data.storagecount[index_1] -= count;
                                }
                            }
                        }
                        else
                        {
                            // Items Are Different, Move It !
                            Data.storageslot[index_1] = str_2;
                            Data.storageslot[index_2] = str_1;
                        }
                    }
                }
                if (typ == 2) // From INV to STR
                {
                    byte slot_inv = packet.ReadUInt8();
                    byte slot_bnk = packet.ReadUInt8();
                    int  index    = Data.inventoryslot.IndexOf(slot_inv);
                    Data.storageid.Add(Data.inventoryid[index]);
                    Data.storagetype.Add(Data.inventorytype[index]);
                    Data.storageslot.Add(slot_bnk);
                    Data.storagecount.Add(Data.inventorycount[index]);
                    Data.storagedurability.Add(Data.inventorydurability[index]);
                    Data.storagelevel.Add(Data.inventorylevel[index]);
                    Data.storagename.Add(Data.inventoryname[index]);
                    Data.strmaxdurability.Add(Data.maxdurability[index]);

                    Data.inventoryid.RemoveAt(index);
                    Data.inventorytype.RemoveAt(index);
                    Data.inventoryslot.RemoveAt(index);
                    Data.inventorycount.RemoveAt(index);
                    Data.inventorydurability.RemoveAt(index);
                    Data.inventorylevel.RemoveAt(index);
                    Data.inventoryname.RemoveAt(index);
                    Data.maxdurability.RemoveAt(index);

                    Globals.MainWindow.UpdateInventory();
                    //Globals.MainWindow.storage_list.Items.Clear();
                    for (int i = 0; i < Data.storageid.Count; i++)
                    {
                        uint   id   = Data.storageid[i];
                        string name = Items_Info.itemsnamelist[Items_Info.itemsidlist.IndexOf(id)];
                        //Globals.MainWindow.storage_list.Items.Add(name);
                    }
                    ItemsCount.CountManager();
                    StorageControl.StorageManager(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                }
                if (typ == 3) // From STR to INV
                {
                    byte slot_bnk = packet.ReadUInt8();
                    byte slot_inv = packet.ReadUInt8();
                    int  index    = Data.storageslot.IndexOf(slot_bnk);

                    Data.inventoryid.Add(Data.storageid[index]);
                    Data.inventorytype.Add(Data.storagetype[index]);
                    Data.inventoryslot.Add(slot_inv);
                    Data.inventorycount.Add(Data.storagecount[index]);
                    Data.inventorydurability.Add(Data.storagedurability[index]);
                    Data.inventorylevel.Add(Data.storagelevel[index]);
                    Data.inventoryname.Add(Data.storagename[index]);
                    Data.maxdurability.Add(Data.strmaxdurability[index]);

                    Data.storageid.RemoveAt(index);
                    Data.storagetype.RemoveAt(index);
                    Data.storageslot.RemoveAt(index);
                    Data.storagecount.RemoveAt(index);
                    Data.storagedurability.RemoveAt(index);
                    Data.storagelevel.RemoveAt(index);
                    Data.storagename.RemoveAt(index);
                    Data.strmaxdurability.RemoveAt(index);

                    Globals.MainWindow.UpdateInventory();
                    //Globals.MainWindow.storage_list.Items.Clear();
                    for (int i = 0; i < Data.storageid.Count; i++)
                    {
                        uint   id   = Data.storageid[i];
                        string name = Items_Info.itemsnamelist[Items_Info.itemsidlist.IndexOf(id)];
                        //Globals.MainWindow.storage_list.Items.Add(name);
                    }
                    ItemsCount.CountManager();
                }
                if (typ == 6) // PICKED ITEM
                {
                    byte slot = packet.ReadUInt8();
                    if (slot == 254)
                    {
                        packet.ReadUInt32();
                    }
                    else
                    {
                        packet.ReadUInt32();
                        uint   item_id = packet.ReadUInt32();
                        int    index   = Items_Info.itemsidlist.IndexOf(item_id);
                        string type    = Items_Info.itemstypelist[index];
                        if (type.StartsWith("ITEM_CH") || type.StartsWith("ITEM_EU"))
                        {
                            byte item_plus = packet.ReadUInt8();
                            packet.ReadUInt64();
                            uint durability = packet.ReadUInt32();
                            byte blueamm    = packet.ReadUInt8();
                            for (int i = 0; i < blueamm; i++)
                            {
                                packet.ReadUInt8();
                                packet.ReadUInt16();
                                packet.ReadUInt32();
                                packet.ReadUInt8();
                            }
                            Data.inventoryid.Add(item_id);
                            Data.inventorytype.Add(type);
                            Data.inventoryslot.Add(slot);
                            Data.inventorycount.Add(1);
                            Data.inventorydurability.Add(durability);
                            Data.inventorylevel.Add(Items_Info.itemslevellist[index]);
                            Data.inventoryname.Add(Items_Info.itemsnamelist[index]);
                            Data.maxdurability.Add(Items_Info.itemsdurabilitylist[index]);
                            Globals.MainWindow.UpdateInventory();
                        }
                        else
                        {
                            ushort count   = packet.ReadUInt16();
                            int    indexas = Data.inventoryslot.IndexOf(slot);
                            if (indexas != -1)
                            {
                                Data.inventorycount[indexas] = count;
                            }
                            else
                            {
                                Data.inventoryid.Add(item_id);
                                Data.inventorytype.Add(type);
                                Data.inventoryslot.Add(slot);
                                Data.inventorydurability.Add(0);
                                Data.inventorycount.Add(count);
                                Data.inventorylevel.Add(Items_Info.itemslevellist[index]);
                                Data.inventoryname.Add(Items_Info.itemsnamelist[index]);
                                Data.maxdurability.Add(Items_Info.itemsdurabilitylist[index]);

                                Globals.MainWindow.UpdateInventory();
                            }
                            ItemsCount.CountManager();
                        }
                    }
                }
                if (typ == 7)
                {
                    byte slot  = packet.ReadUInt8();
                    int  index = Data.inventoryslot.IndexOf(slot);
                    Data.inventoryid.RemoveAt(index);
                    Data.inventorytype.RemoveAt(index);
                    Data.inventoryslot.RemoveAt(index);
                    Data.inventorycount.RemoveAt(index);
                    Data.inventorydurability.RemoveAt(index);
                    Data.inventorylevel.RemoveAt(index);
                    Data.inventoryname.RemoveAt(index);
                    Data.maxdurability.RemoveAt(index);

                    Globals.MainWindow.UpdateInventory();
                    ItemsCount.CountManager();
                }
                if (typ == 8) // Shop => Inventory
                {
                    byte tab   = packet.ReadUInt8();
                    byte slot  = packet.ReadUInt8();
                    byte count = packet.ReadUInt8();
                    #region Finding Item Info
                    uint item_id = 0;
                    for (int i = 0; i < Data.ShopTabData.Length; i++)
                    {
                        if (Data.ShopTabData[i].StoreName.Replace("STORE_", "NPC_") == Data.selectednpctype)
                        {
                            item_id = Items_Info.itemsidlist[Items_Info.itemstypelist.IndexOf(Data.ShopTabData[i].Tab[tab].ItemType[slot])];
                            break;
                        }
                    }
                    string item_type = Items_Info.itemstypelist[Items_Info.itemsidlist.IndexOf(item_id)];
                    #endregion
                    if (count == 1)
                    {
                        byte   inv_slot  = packet.ReadUInt8();
                        ushort inv_count = packet.ReadUInt16();

                        Packet du = new Packet((ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_INVENTORYMOVEMENT);
                        du.WriteUInt8(1);
                        du.WriteUInt8(6);
                        du.WriteUInt8(inv_slot);
                        du.WriteUInt32(0);
                        du.WriteUInt32(item_id);
                        if (item_type.StartsWith("ITEM_CH") == false && item_type.StartsWith("ITEM_EU") == false)
                        {
                            du.WriteUInt16(inv_count);
                        }
                        else
                        {
                            du.WriteUInt8(0);
                            du.WriteUInt64(0);
                            du.WriteUInt32(Items_Info.itemsdurabilitylist[Items_Info.itemsidlist.IndexOf(item_id)]);
                            du.WriteUInt8(0);
                            du.WriteUInt16(1);
                            du.WriteUInt16(2);
                        }
                        Proxy.ag_local_security.Send(du);

                        Data.inventoryid.Add(item_id);
                        Data.inventorytype.Add(item_type);
                        Data.inventoryslot.Add(inv_slot);
                        Data.inventorycount.Add(inv_count);
                        Data.inventorydurability.Add(0);
                        Data.inventorylevel.Add(Items_Info.itemslevellist[Items_Info.itemsidlist.IndexOf(item_id)]);
                        Data.inventoryname.Add(Items_Info.itemsnamelist[Items_Info.itemsidlist.IndexOf(item_id)]);
                        Data.maxdurability.Add(Items_Info.itemsdurabilitylist[Items_Info.itemsidlist.IndexOf(item_id)]);
                    }
                    else
                    {
                        for (int i = 0; i < count; i++)
                        {
                            byte inv_slot = packet.ReadUInt8();

                            Packet du = new Packet((ushort)WorldServerOpcodes.SERVER_OPCODES.SERVER_INVENTORYMOVEMENT);
                            du.WriteUInt8(0x01);
                            du.WriteUInt8(0x06);
                            du.WriteUInt8(inv_slot);
                            du.WriteUInt32(0x00000000);
                            du.WriteUInt32(item_id);
                            if (item_type.StartsWith("ITEM_CH") == false && item_type.StartsWith("ITEM_EU") == false)
                            {
                                du.WriteUInt16(1);
                            }
                            else
                            {
                                du.WriteUInt8(0x00);
                                du.WriteUInt64(0x0000000000000000);
                                du.WriteUInt32(Items_Info.itemsdurabilitylist[Items_Info.itemsidlist.IndexOf(item_id)]);
                                du.WriteUInt8(0x00);
                                du.WriteUInt16(1);
                                du.WriteUInt16(2);
                            }
                            Proxy.ag_local_security.Send(du);

                            Data.inventoryid.Add(item_id);
                            Data.inventorytype.Add(item_type);
                            Data.inventoryslot.Add(inv_slot);
                            Data.inventorycount.Add(1);
                            Data.inventorydurability.Add(0);
                            Data.inventorylevel.Add(Items_Info.itemslevellist[Items_Info.itemsidlist.IndexOf(item_id)]);
                            Data.inventoryname.Add(Items_Info.itemsnamelist[Items_Info.itemsidlist.IndexOf(item_id)]);
                            Data.maxdurability.Add(Items_Info.itemsdurabilitylist[Items_Info.itemsidlist.IndexOf(item_id)]);
                        }
                    }
                    Globals.MainWindow.UpdateInventory();
                    ItemsCount.CountManager();
                    System.Threading.Thread.Sleep(500);
                    BuyControl.BuyManager(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                }
                if (typ == 9) // Inventory -> Shop
                {
                    byte   inv_slot = packet.ReadUInt8();
                    ushort count    = packet.ReadUInt16();

                    int    index      = Data.inventoryslot.IndexOf(inv_slot);
                    ushort real_count = Data.inventorycount[index];

                    if (count == real_count)
                    {
                        //Sold Everything - Delete Item
                        Data.inventoryid.RemoveAt(index);
                        Data.inventorytype.RemoveAt(index);
                        Data.inventoryslot.RemoveAt(index);
                        Data.inventorycount.RemoveAt(index);
                        Data.inventorydurability.RemoveAt(index);
                        Data.inventorylevel.RemoveAt(index);
                        Data.inventoryname.RemoveAt(index);
                        Data.maxdurability.RemoveAt(index);
                    }
                    else
                    {
                        //Reduce count of item
                        ushort new_count = (ushort)(real_count - count);
                        Data.inventorycount[index] = new_count;
                    }
                    Globals.MainWindow.UpdateInventory();
                    ItemsCount.CountManager();
                    SellControl.SellManager(Spawns.NPCID[Spawns.NPCType.IndexOf(Data.selectednpctype)]);
                }
                if (typ == 16) // From Pet Inventory To Pet Inventory
                {
                    uint   petid = packet.ReadUInt32();
                    byte   pet_1 = packet.ReadUInt8();
                    byte   pet_2 = packet.ReadUInt8();
                    ushort count = packet.ReadUInt16();

                    for (int i = 0; i < Pets.CharPets.Count; i++)
                    {
                        if (Pets.CharPets[i].UniqueID == petid)
                        {
                            if (Pets.CharPets[i].Inventory[pet_1].type == Pets.CharPets[i].Inventory[pet_2].type)
                            {
                                // Items Are Same, Merge It !
                                if (Pets.CharPets[i].Inventory[pet_2].count == Items_Info.items_maxlist[Items_Info.itemstypelist.IndexOf(Pets.CharPets[i].Inventory[pet_2].type)])
                                {
                                    // Items Are Maxed, Move It !
                                    Pets.Inventory_ inv_temp = Pets.CharPets[i].Inventory[pet_1];
                                    Pets.CharPets[i].Inventory[pet_1] = Pets.CharPets[i].Inventory[pet_2];
                                    Pets.CharPets[i].Inventory[pet_2] = inv_temp;
                                }
                                else
                                {
                                    if (Pets.CharPets[i].Inventory[pet_1].count == count)
                                    {
                                        // Merged Everything, Delete The First Item !
                                        Pets.CharPets[i].Inventory[pet_2].count += count;
                                        string name = Items_Info.itemsnamelist[Items_Info.itemstypelist.IndexOf(Pets.CharPets[i].Inventory[pet_1].type)];
                                        //Globals.MainWindow.pet_inv_list.Items.Remove(name);
                                        Pets.CharPets[i].Inventory[pet_1] = new Pets.Inventory_();
                                    }
                                    else
                                    {
                                        // Merged Not Everything, Recalculate Quantity !
                                        Pets.CharPets[i].Inventory[pet_2].count += count;
                                        Pets.CharPets[i].Inventory[pet_1].count -= count;
                                    }
                                }
                            }
                            else
                            {
                                // Items Are Different, Move It !
                                Pets.Inventory_ inv_temp = Pets.CharPets[i].Inventory[pet_1];
                                Pets.CharPets[i].Inventory[pet_1] = Pets.CharPets[i].Inventory[pet_2];
                                Pets.CharPets[i].Inventory[pet_2] = inv_temp;
                            }
                            break;
                        }
                    }
                }
                if (typ == 26) // From Pet Inventory To Inventory
                {
                    uint pet_id = packet.ReadUInt32();
                    for (int i = 0; i < Pets.CharPets.Count; i++)
                    {
                        if (pet_id == Pets.CharPets[i].UniqueID)
                        {
                            byte pet_slot = packet.ReadUInt8();
                            byte inv_slot = packet.ReadUInt8();
                            Data.inventoryid.Add(Pets.CharPets[i].Inventory[pet_slot].id);
                            Data.inventorytype.Add(Pets.CharPets[i].Inventory[pet_slot].type);
                            Data.inventoryslot.Add(inv_slot);
                            Data.inventorydurability.Add(Pets.CharPets[i].Inventory[pet_slot].durability);
                            Data.inventorycount.Add(Pets.CharPets[i].Inventory[pet_slot].count);
                            Data.inventorylevel.Add(Pets.CharPets[i].Inventory[pet_slot].level);
                            Data.inventoryname.Add(Pets.CharPets[i].Inventory[pet_slot].name);
                            Data.maxdurability.Add(Pets.CharPets[i].Inventory[pet_slot].maxdurability);
                            string name = Items_Info.itemsnamelist[Items_Info.itemstypelist.IndexOf(Pets.CharPets[i].Inventory[pet_slot].type)];
                            Globals.MainWindow.UpdateInventory();
                            //Globals.MainWindow.pet_inv_list.Items.Remove(name);
                            Pets.CharPets[i].Inventory[pet_slot] = new Pets.Inventory_();
                            break;
                        }
                    }
                }
                if (typ == 27) // From Inventory To Pet Inventory
                {
                    uint pet_id = packet.ReadUInt32();
                    for (int i = 0; i < Pets.CharPets.Count; i++)
                    {
                        if (pet_id == Pets.CharPets[i].UniqueID)
                        {
                            byte inv_slot  = packet.ReadUInt8();
                            byte pet_slot  = packet.ReadUInt8();
                            int  inv_index = Data.inventoryslot.IndexOf(inv_slot);
                            Pets.CharPets[i].Inventory[pet_slot].id            = Data.inventoryid[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].type          = Data.inventorytype[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].slot          = pet_slot;
                            Pets.CharPets[i].Inventory[pet_slot].durability    = Data.inventorydurability[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].count         = Data.inventorycount[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].level         = Data.inventorylevel[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].name          = Data.inventoryname[inv_index];
                            Pets.CharPets[i].Inventory[pet_slot].maxdurability = Data.maxdurability[inv_index];
                            //Globals.MainWindow.pet_inv_list.Items.Add(Items_Info.itemsnamelist[Items_Info.itemstypelist.IndexOf(Data.inventorytype[inv_index])]);
                            Data.inventoryid.RemoveAt(inv_index);
                            Data.inventorytype.RemoveAt(inv_index);
                            Data.inventorycount.RemoveAt(inv_index);
                            Data.inventorydurability.RemoveAt(inv_index);
                            Data.inventoryslot.RemoveAt(inv_index);
                            Data.inventorylevel.RemoveAt(inv_index);
                            Data.inventoryname.RemoveAt(inv_index);
                            Data.maxdurability.RemoveAt(inv_index);

                            Globals.MainWindow.UpdateInventory();
                            break;
                        }
                    }
                }
                if (typ != 8)
                {
                    Proxy.ag_local_security.Send(vienas);
                }
            }
            if (check == 2)
            {
                byte check1 = packet.ReadUInt8();
                switch (check1)
                {
                case 0x03:
                    //Unknown
                    break;
                }
            }
        }
Esempio n. 11
0
        public static void SkillAdd(Packet packet)
        {
            byte result = packet.ReadUInt8();

            if (result == 0x01)
            {
                byte type = packet.ReadUInt8();
                if (type == 0x00)
                {
                    //Buff Add!
                }
                else if (type == 0x02)
                {
                    if (packet.ReadUInt8() == 0x30)
                    {
                        uint skill_id    = packet.ReadUInt32();
                        uint attacker_id = packet.ReadUInt32();
                        if (attacker_id == Character.UniqueID)
                        {
                            //Skill casted !
                            packet.ReadUInt32();
                            packet.ReadUInt32();
                            Checker(skill_id);

                            if (Data.bot)
                            {
                                if (Training.monster_selected)
                                {
                                    Movement.stuck_count = 0;
                                }
                            }
                        }
                        else
                        {
                            packet.ReadUInt32();
                            uint obj_id = packet.ReadUInt32();
                            if ((obj_id == Character.UniqueID) || (obj_id == Data.char_attackpetid && Globals.MainWindow.Checked(Globals.MainWindow.protectpet) == true))
                            {
                                if (Data.bot && !Data.loop)
                                {
                                    if (Training.monster_selected == false && Buffas.buff_waiting == false)
                                    {
                                        foreach (Monster monster in Monster.SpawnMob)
                                        {
                                            if (monster.UniqueID == attacker_id)
                                            {
                                                if (Walking.running == true)
                                                {
                                                    Walking.running = false;
                                                }

                                                Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_OBJECTSELECT);
                                                NewPacket.WriteUInt32(attacker_id);
                                                Proxy.ag_remote_security.Send(NewPacket);

                                                Training.monster_id          = attacker_id;
                                                Training.monster_selected    = true;
                                                Training.monster_type        = monster.MobType;
                                                Training.monster_type_string = monster.MobTypename;
                                                Training.monster_name        = monster.AdvanceName;
                                                Training.distance            = monster.Distance;
                                                break;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (attacker_id != Training.monster_id)
                                        {
                                            foreach (Monster monster in Monster.SpawnMob)
                                            {
                                                if ((monster.UniqueID == attacker_id) && (monster.Priority < 9))
                                                {
                                                    monster.Status   = 0;
                                                    monster.Priority = 9;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (result == 0x02)
            {
                byte type = packet.ReadUInt8();
                switch (type)
                {
                case 16:
                    if (Training.monster_selected && Training.monster_id != 0)
                    {
                        Stuck.AddMob(Training.monster_id, 10);

                        Training.monster_selected = false;
                        Training.monster_id       = 0;

                        LogicControl.Manager();
                    }
                    break;

                case 5:
                    //LogicControl.Manager();
                    //Skill errors
                    break;

                case 6:
                    //LogicControl.Manager();
                    //Skill errors
                    break;
                }
            }
        }
Esempio n. 12
0
        public static void WalkManager()
        {
            {
                if (Globals.MainWindow.Checked(Globals.MainWindow.walkcenter) == true)
                {
                    int trainx = Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.x_setbox));
                    int trainy = Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.y_setbox));

                    if (!walking_center)
                    {
                        walking_center = true;
                        BotAction.WalkTo(trainx, trainy);
                        LogicControl.Manager();
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(1000);
                        LogicControl.Manager();
                    }
                }
                else if (Globals.MainWindow.Checked(Globals.MainWindow.walkaround) == true)
                {
                    if (walking_circle == true)
                    {
                        if (Walking.i == 24)
                        {
                            Walking.i = 0;
                        }

                        running = true;
                        int runangle = 0;
                        try
                        {
                            runangle = angle[i];
                        }
                        catch
                        {
                            i        = 0;
                            runangle = angle[i];
                        }

                        nextx = Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.x_setbox)) + Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.runningrangebox)) * Math.Cos(Math.PI * runangle / 180.0);
                        nexty = Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.y_setbox)) + Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.runningrangebox)) * Math.Sin(Math.PI * runangle / 180.0);

                        int dist = (int)(Math.Abs((nextx - Character.X)) + Math.Abs((nexty - Character.Y)));

                        BotAction.WalkTo((nextx + Character.X) / 2, (nexty + Character.Y) / 2);
                        i++;

                        double time = (dist / Convert.ToInt64(Character.RunSpeed * 0.12f));

                        Timer RandomTimer = new Timer();
                        RandomTimer.Elapsed += new ElapsedEventHandler(OnTick);
                        RandomTimer.Interval = time * 500 + 1;
                        RandomTimer.Start();
                        RandomTimer.AutoReset = false;
                        RandomTimer.Enabled   = true;
                    }
                }
                else if (Globals.MainWindow.Checked(Globals.MainWindow.walkpath) == true)
                {
                    if (Globals.MainWindow.trainbox.Items.Count > 0)
                    {
                        if (walking_path == true)
                        {
                            string line = Globals.MainWindow.trainbox.Items[j].ToString();
                            if (line.StartsWith("go"))
                            {
                                string coodinates = line.Split('(')[1].Split(')')[0];
                                nextx = Convert.ToDouble(coodinates.Split(',')[0]);
                                nexty = Convert.ToDouble(coodinates.Split(',')[1]);
                                int dist = (int)(Math.Abs((nextx - Character.X)) + Math.Abs((nexty - Character.Y)));

                                BotAction.WalkTo((nextx + Character.X) / 2, (nexty + Character.Y) / 2);

                                double time = (dist / Convert.ToInt64(Character.RunSpeed * 0.12f));

                                Timer RandomTimer = new Timer();
                                RandomTimer.Elapsed += new ElapsedEventHandler(OnTick);
                                RandomTimer.Interval = time * 500 + 1;
                                RandomTimer.Start();
                                RandomTimer.AutoReset = false;
                                RandomTimer.Enabled   = true;
                            }
                            j++;
                            if (j == Globals.MainWindow.trainbox.Items.Count)
                            {
                                j = 0;
                            }
                        }
                    }
                    else
                    {
                        Globals.MainWindow.UpdateLogs("Cannot find any coordinates to walk to during training!");
                    }
                }
            }
        }
Esempio n. 13
0
        public static void Start()
        {
            if (Data.bot)
            {
                type = Location.FindTown();
                switch (type)
                {
                case null:
                    Data.loopend = 0;
                    Data.loop    = false;
                    Data.bot     = false;
                    Globals.MainWindow.UpdateLogs("Train coordinates are not correct! Please set coordinates before training.");
                    Globals.MainWindow.Content(Globals.MainWindow.startbot, "Start Bot");
                    break;

                case "train":
                    if (Data.char_horseid == 0)
                    {
                        Data.loopend = 0;
                        Data.loop    = false;
                        Data.bot     = true;
                        PickupControl.there_is_pickable = true;
                        Buffas.buff_waiting             = true;

                        Globals.MainWindow.UpdateLogs("Start Botting!");
                        Globals.MainWindow.Content(Globals.MainWindow.startbot, "Stop Bot");

                        if (Globals.MainWindow.Checked(Globals.MainWindow.autoparty) == true)
                        {
                            Party.CreateParty();
                        }

                        LogicControl.Manager();
                    }
                    else
                    {
                        Data.loopaction = "dismounthorse";
                        Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_KILLHORSE);
                        NewPacket.WriteUInt32(Data.char_horseid);
                        Proxy.ag_remote_security.Send(NewPacket);
                    }
                    break;

                case "ch":
                    if (Globals.MainWindow.Checked(Globals.MainWindow.loop_off) == true)
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        if (Data.char_horseid == 0)
                        {
                            Data.loopaction = "mounthorse";
                            BotAction.MountHorse();
                        }
                        else
                        {
                            Data.loopend = 1;
                            StartLooping.LoadTrainScript();
                        }
                    }
                    else
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        LoopControl.read  = new StreamReader(@"Data/Scripts/ch_town.txt");
                        LoopControl.count = File.ReadAllLines(@"Data/Scripts/ch_town.txt").Length;
                        Data.loopend      = 0;
                        Data.loop         = false;
                        LoopControl.WalkScript();
                    }
                    break;

                case "wc":
                    if (Globals.MainWindow.Checked(Globals.MainWindow.loop_off) == true)
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        if (Data.char_horseid == 0)
                        {
                            Data.loopaction = "mounthorse";
                            BotAction.MountHorse();
                        }
                        else
                        {
                            Data.loopend = 1;
                            StartLooping.LoadTrainScript();
                        }
                    }
                    else
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        LoopControl.read  = new StreamReader(@"Data/Scripts/wc_town.txt");
                        LoopControl.count = File.ReadAllLines(@"Data/Scripts/wc_town.txt").Length;
                        Data.loopend      = 0;
                        Data.loop         = false;
                        LoopControl.WalkScript();
                    }
                    break;

                case "kt":
                    if (Globals.MainWindow.Checked(Globals.MainWindow.loop_off) == true)
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        if (Data.char_horseid == 0)
                        {
                            Data.loopaction = "mounthorse";
                            BotAction.MountHorse();
                        }
                        else
                        {
                            Data.loopend = 1;
                            StartLooping.LoadTrainScript();
                        }
                    }
                    else
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        LoopControl.read  = new StreamReader(@"Data/Scripts/kt_town.txt");
                        LoopControl.count = File.ReadAllLines(@"Data/Scripts/kt_town.txt").Length;
                        Data.loopend      = 0;
                        Data.loop         = false;
                        LoopControl.WalkScript();
                    }
                    break;

                case "ca":
                    if (Globals.MainWindow.Checked(Globals.MainWindow.loop_off) == true)
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        if (Data.char_horseid == 0)
                        {
                            Data.loopaction = "mounthorse";
                            BotAction.MountHorse();
                        }
                        else
                        {
                            Data.loopend = 1;
                            StartLooping.LoadTrainScript();
                        }
                    }
                    else
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        LoopControl.read  = new StreamReader(@"Data/Scripts/ca_town.txt");
                        LoopControl.count = File.ReadAllLines(@"Data/Scripts/ca_town.txt").Length;
                        Data.loopend      = 0;
                        Data.loop         = false;
                        LoopControl.WalkScript();
                    }
                    break;

                case "eu":
                    if (Globals.MainWindow.Checked(Globals.MainWindow.loop_off) == true)
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        if (Data.char_horseid == 0)
                        {
                            Data.loopaction = "mounthorse";
                            BotAction.MountHorse();
                        }
                        else
                        {
                            Data.loopend = 1;
                            StartLooping.LoadTrainScript();
                        }
                    }
                    else
                    {
                        try
                        {
                            LoopControl.read.Close();
                        }
                        catch { }
                        LoopControl.read  = new StreamReader(@"Data/Scripts/eu_town.txt");
                        LoopControl.count = File.ReadAllLines(@"Data/Scripts/eu_town.txt").Length;
                        Data.loopend      = 0;
                        Data.loop         = false;
                        LoopControl.WalkScript();
                    }
                    break;
                }
            }
        }
Esempio n. 14
0
 public static void OnTick1(object sender, ElapsedEventArgs e)
 {
     stuck = false;
     LogicControl.Manager();
 }
Esempio n. 15
0
        public static void BuffChecker()
        {
            if (Globals.MainWindow.secondbuff.Items.Count != 0)
            {
                for (int i = 0; i < Skill.Skills.Count; i++)
                {
                    //if (Skill.Skills[i].BuffWaiting == 1)
                    {
                        if (Skill.Skills[i].bufftype == 3) // At First We need to check 2nd weapon buffs :)
                        {
                            if (Skill.Skills[i].Status == 0)
                            {
                                //Checking If User Have 2nd Weapon !
                                if (Data.s_wep_name != "" && Data.s_wep_name != null)
                                {
                                    int index = Data.inventorytype.IndexOf(Data.s_wep_name);
                                    if (index == -1)
                                    {
                                        Data.s_wep_name = "";
                                        Globals.MainWindow.UpdateLogs("Could not find second weapon!");
                                        break;
                                    }
                                    else
                                    {
                                        if (Data.s_wep_name.Contains("SHIELD"))
                                        {
                                            correct2nslot = 7;
                                        }
                                        else
                                        {
                                            correct2nslot = 6;
                                        }
                                    }
                                }

                                //Trying To Cast Buff
                                if (Skill.Skills[i].MinMP <= Character.CurrentMP) //Checking if enough MP and it's possible to cast buff (cooldown).
                                {
                                    System.Threading.Thread.Sleep(1);
                                    int item_index = Data.inventorytype.IndexOf(Data.s_wep_name); //Getting Second Weapon Index
                                    if (Data.inventoryslot[item_index] != correct2nslot)          //Checking If Second Weapon Is In Weapon Slot
                                    {
                                        System.Threading.Thread.Sleep(1);
                                        //Weapon Isn't In Weapon Slot, Changing The Weapon !!!
                                        changing_weapon = true;
                                        Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                        NewPacket.WriteUInt8(0);
                                        NewPacket.WriteUInt8((byte)Data.inventoryslot[item_index]);
                                        if (Data.s_wep_name.Contains("SHIELD"))
                                        {
                                            NewPacket.WriteUInt8(7);
                                        }
                                        else
                                        {
                                            NewPacket.WriteUInt8(6);
                                        }
                                        NewPacket.WriteUInt16(0x0000);
                                        Proxy.ag_remote_security.Send(NewPacket);
                                        break;
                                    }
                                    else
                                    {
                                        //Weapon Is In Weapon Slot, Casting The Buff !!!
                                        Skills.CastSkill(Skill.Skills[i], 0);
                                        break;
                                    }
                                }
                                else
                                {
                                    if (Skill.Skills[i].MinMP > Character.CurrentMP)
                                    {
                                        min_mp_require = Skill.Skills[i].MinMP;
                                    }
                                }
                            }
                            if (i + 1 >= Skill.Skills.Count)
                            {
                                //---------------------------------------------------------------------------------------------------------------------------------------------------------
                                for (int a = 0; a < Skill.Skills.Count; a++)
                                {
                                    //if (Skill.Skills[a].BuffWaiting == 1)
                                    {
                                        if (Skill.Skills[a].bufftype == 1) // We need to check 1st weapon buffs :)
                                        {
                                            if (Skill.Skills[a].Status == 0)
                                            {
                                                //Checking If User Have 1st Weapon !
                                                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 = "";
                                                        Globals.MainWindow.UpdateLogs("Could not find first weapon!");
                                                        break;
                                                    }
                                                }
                                                System.Threading.Thread.Sleep(2); //MicroSleep For Less CPU Usage

                                                //Trying To Cast Buff
                                                if (Skill.Skills[a].MinMP <= Character.CurrentMP)                 //Checking if enough MP and it's possible to cast buff (cooldown).
                                                {
                                                    int item_index = Data.inventorytype.IndexOf(Data.f_wep_name); //Getting First Weapon Index
                                                    if (Data.inventoryslot[item_index] != 6)                      //Checking If First Weapon Is In Weapon Slot
                                                    {
                                                        System.Threading.Thread.Sleep(1);
                                                        //Weapon Isn't In Weapon Slot, Changing The Weapon !!!
                                                        changing_weapon = true;
                                                        Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYMOVEMENT);
                                                        NewPacket.WriteUInt8(0);
                                                        NewPacket.WriteUInt8((byte)Data.inventoryslot[item_index]);
                                                        NewPacket.WriteUInt8(6);
                                                        NewPacket.WriteUInt16(0x0000);
                                                        Proxy.ag_remote_security.Send(NewPacket);
                                                        break;
                                                    }
                                                    else
                                                    {
                                                        //Weapon Is In Weapon Slot, Casting The Buff !!!
                                                        Skills.CastSkill(Skill.Skills[a], 0);
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    if (Skill.Skills[a].MinMP > Character.CurrentMP)
                                                    {
                                                        min_mp_require = Skill.Skills[a].MinMP;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if (a + 1 >= Skill.Skills.Count)
                                    {
                                        //---------------------------------------------------------------------------------------------------------------------------------------------------------
                                        buff_waiting = false;
                                        LogicControl.Manager();
                                        //---------------------------------------------------------------------------------------------------------------------------------------------------------
                                    }
                                    //---------------------------------------------------------------------------------------------------------------------------------------------------------
                                }
                            }
                        }
                    }
                }
            }
            else //No 2nd weapon buffs, just cast buff
            {
                for (int a = 0; a < Skill.Skills.Count; a++)
                {
                    //if (Skill.Skills[a].BuffWaiting == 1)
                    {
                        if (Skill.Skills[a].bufftype == 1)
                        {
                            //Trying To Cast Buff
                            if (Skill.Skills[a].Status == 0 && Skill.Skills[a].MinMP <= Character.CurrentMP) //Checking if enough MP and it's possible to cast buff (cooldown).
                            {
                                Skills.CastSkill(Skill.Skills[a], 0);
                                break;
                            }
                            else
                            {
                                if (Skill.Skills[a].MinMP > Character.CurrentMP)
                                {
                                    min_mp_require = Skill.Skills[a].MinMP;
                                }
                            }
                        }
                    }
                    if (a + 1 >= Skill.Skills.Count)
                    {
                        //---------------------------------------------------------------------------------------------------------------------------------------------------------
                        buff_waiting = false;
                        LogicControl.Manager();
                        //---------------------------------------------------------------------------------------------------------------------------------------------------------
                    }
                }
            }
        }