Beispiel #1
0
        public static void MountHorse()
        {
            byte found_horse = 0;

            for (int i = 0; i < Data.inventoryid.Count; i++)
            {
                string type = Data.inventorytype[i].ToString();
                if (type.StartsWith("ITEM_COS_C_HORSE") || type.StartsWith("ITEM_COS_C_DHORSE"))
                {
                    if (Character.Level >= (Data.inventorylevel[i]))
                    {
                        found_horse = 1;
                        Packet NewPacket = new Packet((ushort)WorldServerOpcodes.CLIENT_OPCODES.CLIENT_INVENTORYUSE, true);
                        uint   slot      = Data.inventoryslot[i];
                        NewPacket.WriteUInt8((byte)slot);
                        NewPacket.WriteUInt8(0xEC);
                        NewPacket.WriteUInt8(0x11);
                        Proxy.ag_remote_security.Send(NewPacket);
                        break;
                    }
                }
            }
            if (found_horse == 0)
            {
                Data.loopend = 1;
                StartLooping.LoadTrainScript();
            }
        }
Beispiel #2
0
 public static void CheckStart()
 {
     if ((Globals.MainWindow.ReadText(Globals.MainWindow.x_setbox) != "") || (Globals.MainWindow.ReadText(Globals.MainWindow.x_setbox) != null))
     {
         Data.bot = true;
         StartLooping.Start();
     }
     else
     {
         Globals.MainWindow.UpdateLogs("Please Set Training Coordinates in the Fight Tab!");
     }
 }
Beispiel #3
0
        public static void HorseAction(Packet packet)
        {
            if (packet.ReadUInt8() == 1)
            {
                uint char_id = packet.ReadUInt32();
                if (char_id == Character.UniqueID)
                {
                    byte action = packet.ReadUInt8();
                    uint pet_id = packet.ReadUInt32();
                    for (int i = 0; i < Pets.CharPets.Count; i++)
                    {
                        if (Pets.CharPets[i].UniqueID == pet_id)
                        {
                            switch (action)
                            {
                            case 0:
                                Data.char_horseid    = 0;
                                Data.char_horsespeed = 0;
                                if (Data.loopaction == "dismounthorse")
                                {
                                    Data.loopaction = "";
                                    StartLooping.Start();
                                }
                                break;

                            case 1:
                                Data.char_horseid    = pet_id;
                                Data.char_horsespeed = Pets.CharPets[i].Speed;
                                if (Data.loopaction == "mounthorse")
                                {
                                    Data.loopaction = "";
                                    Data.loopend    = 1;
                                    StartLooping.LoadTrainScript();
                                }
                                break;
                            }
                            break;
                        }
                    }
                }
            }
        }
Beispiel #4
0
        public static void CharData(Packet packet)
        {
            try
            {
                Globals.MainWindow.UnEnable(Globals.MainWindow.characterselect);
                Globals.MainWindow.UnEnable(Globals.MainWindow.charnameselect);
                Globals.MainWindow.UnEnable(Globals.MainWindow.charlist);
                Globals.MainWindow.UnEnable(Globals.MainWindow.selectcharbutton);

                #region ResetData
                Data.inventorycount.Clear();
                Data.inventoryid.Clear();
                Data.inventoryslot.Clear();
                Data.inventorytype.Clear();
                Data.inventorydurability.Clear();
                Data.inventorylevel.Clear();
                Data.inventoryname.Clear();
                Data.maxdurability.Clear();

                Data.storageid.Clear();
                Data.storagetype.Clear();
                Data.storagecount.Clear();
                Data.storageslot.Clear();
                Data.storagedurability.Clear();
                Data.storagelevel.Clear();
                Data.storagename.Clear();

                Skill.Skills.Clear();

                Data.char_horseid  = 0;
                Data.storageopened = 0;
                #endregion

                #region Main
                packet.ReadUInt32();
                Character.RefObjID = packet.ReadUInt32();
                Character.Scale    = packet.ReadUInt8();
                Character.Level    = packet.ReadUInt8();
                Character.MaxLevel = packet.ReadUInt8();
                int maxlvl = (int)Character.Level - 1;
                Character.ExpMax           = Convert.ToUInt64(Character.explist[maxlvl]);
                Character.ExpOffset        = packet.ReadUInt64();
                Character.SExpOffset       = packet.ReadUInt32();
                Character.Gold             = packet.ReadUInt64();
                Character.SP               = packet.ReadUInt32();
                Character.RemainStatPoint  = packet.ReadUInt16();
                Character.BerserkLevel     = packet.ReadUInt8();
                Character.GatheredExpPoint = packet.ReadUInt32();
                Character.CurrentHP        = packet.ReadUInt32();
                Character.CurrentMP        = packet.ReadUInt32();
                Character.AutoInvestExp    = packet.ReadUInt8();
                Character.DailyPK          = packet.ReadUInt8();
                Character.TotalPK          = packet.ReadUInt16();
                Character.PKPenaltyPoint   = packet.ReadUInt32();
                packet.ReadUInt8();
                Globals.MainWindow.UpdateBar();
                Globals.MainWindow.SetText(Globals.MainWindow.level, Convert.ToString(Level));
                Globals.MainWindow.SetText(Globals.MainWindow.gold, Convert.ToString(Character.Gold));
                Globals.MainWindow.SetText(Globals.MainWindow.berserklevel, String.Format("{0}/5", Character.BerserkLevel));
                Globals.MainWindow.SetText(Globals.MainWindow.currentsp, Convert.ToString(Character.SP));
                packet.ReadUInt8();
                #endregion

                #region Items
                Character.InventorySize       = packet.ReadUInt8();
                Character.InventoryItemsCount = packet.ReadUInt8();
                for (int i = 0; i < Character.InventoryItemsCount; i++)
                {
                    byte ItemSlot     = packet.ReadUInt8();
                    uint ItemRentType = packet.ReadUInt32();
                    switch (ItemRentType)
                    {
                    case 1:
                        packet.ReadUInt16();
                        packet.ReadUInt32();
                        packet.ReadUInt32();
                        break;

                    case 2:
                        packet.ReadUInt16();
                        packet.ReadUInt16();
                        packet.ReadUInt32();
                        break;

                    case 3:
                        packet.ReadUInt16();
                        packet.ReadUInt32();
                        packet.ReadUInt32();
                        packet.ReadUInt16();
                        packet.ReadUInt32();
                        break;
                    }

                    uint   ItemRefItemID = packet.ReadUInt32();
                    int    index         = Items_Info.itemsidlist.IndexOf(ItemRefItemID);
                    string type          = Items_Info.itemstypelist[index];
                    string name          = Items_Info.itemsnamelist[index];
                    Data.inventoryname.Add(name);
                    Data.inventoryslot.Add(ItemSlot);
                    Data.inventorytype.Add(type);
                    Data.inventorylevel.Add(Items_Info.itemslevellist[index]);
                    Data.maxdurability.Add(Items_Info.itemsdurabilitylist[index]);
                    Data.inventoryid.Add(ItemRefItemID);
                    if (type.StartsWith("ITEM_CH") || type.StartsWith("ITEM_EU") || type.StartsWith("ITEM_MALL_AVATAR") || type.StartsWith("ITEM_ETC_E060529_GOLDDRAGONFLAG") || type.StartsWith("ITEM_EVENT_CH") || type.StartsWith("ITEM_EVENT_EU") || type.StartsWith("ITEM_EVENT_AVATAR_W_NASRUN") || type.StartsWith("ITEM_EVENT_AVATAR_M_NASRUN"))
                    {
                        byte  OptLevel   = packet.ReadUInt8();
                        ulong Variance   = packet.ReadUInt64();
                        uint  Durability = packet.ReadUInt32();
                        Data.inventorydurability.Add(Durability);
                        byte MagParamNum = packet.ReadUInt8();
                        for (int k = 0; k < MagParamNum; k++)
                        {
                            uint MagParamType  = packet.ReadUInt32();
                            uint MagParamValue = packet.ReadUInt32();
                        }
                        byte OptType  = packet.ReadUInt8();
                        byte OptCount = packet.ReadUInt8(); //1 => Socket
                        for (int l = 0; l < OptCount; l++)
                        {
                            byte OptionSlot    = packet.ReadUInt8();
                            uint OptionID      = packet.ReadUInt32();
                            uint OptionnParam1 = packet.ReadUInt32(); //=> Reference to Socket
                        }
                        byte OptType1  = packet.ReadUInt8();          //2 => Advanced Elixir
                        byte OptCount1 = packet.ReadUInt8();
                        for (int m = 0; m < OptCount1; m++)
                        {
                            byte OptionSlot1    = packet.ReadUInt8();
                            uint OptionID1      = packet.ReadUInt32();
                            uint OptionOptValue = packet.ReadUInt32(); //=> Advanced elixir in effect
                        }
                        Data.inventorycount.Add(1);
                    }
                    else if (((Data.Types.attack_spawn_types.IndexOf(type)) != -1) || (Data.Types.attack_types.IndexOf(type) != -1))
                    {
                        byte Status = packet.ReadUInt8(); //1 =>  Unsumonned, 2 => Summonned, 3 => Alive, 4 => Dead
                        if (Status == 2 || Status == 3 || Status == 4)
                        {
                            uint   PetID   = packet.ReadUInt32();
                            string PetName = packet.ReadAscii();
                            packet.ReadUInt8();
                        }
                        Data.inventorycount.Add(1);
                        Data.inventorydurability.Add(0);
                    }
                    else if (Data.Types.grabpet_spawn_types.IndexOf(type) != -1 || Data.Types.grab_types.IndexOf(type) != -1)
                    {
                        byte Status = packet.ReadUInt8(); //1 =>  Unsumonned, 2 => Summonned, 3 => Alive, 4 => Dead
                        if (Status == 2 || Status == 3 || Status == 4)
                        {
                            uint   PetID   = packet.ReadUInt32();
                            string PetName = packet.ReadAscii();
                            uint   SecondsToRentEndTime = packet.ReadUInt32();
                            packet.ReadUInt8();
                        }
                        Data.inventorycount.Add(1);
                        Data.inventorydurability.Add(0);
                    }
                    else if (type == "ITEM_ETC_TRANS_MONSTER")
                    {
                        packet.ReadUInt32();
                        Data.inventorycount.Add(1);
                        Data.inventorydurability.Add(0);
                    }
                    else if (type.Contains("ITEM_ETC_ARCHEMY_ATTRSTONE") || type.Contains("ITEM_ETC_ARCHEMY_MAGICSTONE"))
                    {
                        ushort StoneStackCount = packet.ReadUInt16();
                        if (type.Contains("ITEM_ETC_ARCHEMY_MAGICSTONE_LUCK") == false)
                        {
                            byte AttributeAssimilationProbability = packet.ReadUInt8();
                        }
                        Data.inventorycount.Add(StoneStackCount);
                        Data.inventorydurability.Add(0);
                    }
                    else if (type.StartsWith("ITEM_MALL_MAGIC_CUBE"))
                    {
                        uint StoredItemCount = packet.ReadUInt32();
                        Data.inventorycount.Add(1);
                        Data.inventorydurability.Add(0);
                    }
                    else if (type.Contains("ITEM_MALL_GACHA_CARD_WIN") || type.Contains("ITEM_MALL_GACHA_CARD_LOSE"))
                    {
                        ushort CouponStackCount  = packet.ReadUInt16();
                        byte   CouponMagParamNum = packet.ReadUInt8();
                        for (int n = 0; n < CouponMagParamNum; n++)
                        {
                            ulong CouponMagParamNumValue = packet.ReadUInt64();
                        }
                        Data.inventorycount.Add(CouponStackCount);
                        Data.inventorydurability.Add(0);
                    }
                    else
                    {
                        ushort ItemStackCount = packet.ReadUInt16();
                        Data.inventorycount.Add(ItemStackCount);
                        Data.inventorydurability.Add(0);
                    }
                }
                ItemsCount.CountManager();

                Character.AvatarInventorySize      = packet.ReadUInt8();
                Character.AvatarInventoryItemCount = packet.ReadUInt8();
                for (int i = 0; i < Character.AvatarInventoryItemCount; i++)
                {
                    byte AvatarSlot = packet.ReadUInt8(); //Slot
                    packet.ReadUInt32();
                    uint   AvatarID = packet.ReadUInt32();
                    int    index    = Items_Info.itemsidlist.IndexOf(AvatarID);
                    string type     = Items_Info.itemstypelist[index];
                    string name     = Items_Info.itemsnamelist[index];
                    byte   ItemPlus = packet.ReadUInt8();
                    packet.ReadUInt64();
                    packet.ReadUInt32();
                    byte AvatarMagParamNum = packet.ReadUInt8();
                    for (int o = 0; o < AvatarMagParamNum; o++)
                    {
                        packet.ReadUInt32();
                        packet.ReadUInt32();
                    }
                    packet.ReadUInt32();
                }
                #endregion

                #region MasteryFlag
                packet.ReadUInt8();
                Character.MasteryFlag = packet.ReadUInt8(); //0 = done, 1 = mastery
                while (MasteryFlag == 1)
                {
                    uint MasteryID    = packet.ReadUInt32();
                    byte MasteryLevel = packet.ReadUInt8();

                    MasteryFlag = packet.ReadUInt8(); //0 = done, 1 = mastery
                }
                packet.ReadUInt8();

                Character.SkillFlag = packet.ReadUInt8(); //0 = done, 1 = mastery
                while (SkillFlag == 1)
                {
                    uint SkillID     = packet.ReadUInt32();
                    byte SkillEnable = packet.ReadUInt8();
                    SkillFlag = packet.ReadUInt8(); //0 = done, 1 = mastery
                    int index = Skills_Info.skillsidlist.IndexOf(SkillID);
                    System.Timers.Timer Timer = new System.Timers.Timer();
                    Skill NewSkill            = new Skill(SkillID, Skills_Info.skillsnamelist[index], Skills_Info.skillstypelist[index], Skills_Info.skillslevellist[index],
                                                          Skills_Info.skillbuffcheck[index], 0, Skills_Info.skillscasttimelist[index],
                                                          Skills_Info.skillcooldownlist[index], Skills_Info.skillsmpreq[index], Skills_Info.skillbufftime[index], 0, Timer);

                    Skill.Skills.Add(NewSkill);
                }
                Globals.MainWindow.Updatehealskill();
                Globals.MainWindow.UpdateSkillList();
                #endregion

                #region SkippingQuestPart
                //Read every Byte the compare them to the UniqueID got from opcode 3020, if equal then stop, if not keep reading the ByteArray
                Packet charid = new Packet(3020);
                charid.WriteUInt32(Character.UniqueID);
                charid.Lock();
                byte idpart1 = charid.ReadUInt8();
                byte idpart2 = charid.ReadUInt8();
                byte idpart3 = charid.ReadUInt8();
                byte idpart4 = charid.ReadUInt8();
                while (true)
                {
                    if (packet.ReadUInt8() == idpart1)
                    {
                        if (packet.ReadUInt8() == idpart2)
                        {
                            if (packet.ReadUInt8() == idpart3)
                            {
                                if (packet.ReadUInt8() == idpart4)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                #endregion

                #region CharacterData
                //Unique ID here has been taken by the comparison #Skipping Quest Part
                byte  xsec   = packet.ReadUInt8();
                byte  ysec   = packet.ReadUInt8();
                float xcoord = packet.ReadSingle();
                float zcoord = packet.ReadSingle();
                float ycoord = packet.ReadSingle();
                if (ysec == 0x80)
                {
                    cave.char_incave = true;
                    cave.xsector     = xsec;
                    cave.zcoord      = zcoord;
                    cave.xcoord      = xcoord;
                }
                else
                {
                    cave.char_incave = false;
                }
                Character.X = Globals.CalculatePositionX(xsec, xcoord);
                Character.Y = Globals.CalculatePositionY(ysec, ycoord);
                string sector = (String.Format("{0:X2}{1:X2}", xsec, ysec));
                int    indexx = Character.locationsector.IndexOf(sector);
                if (indexx != -1)
                {
                    string location = Character.location[indexx];
                    PortConfigs.TrainWindow.Label(PortConfigs.TrainWindow.location, location);
                }
                Globals.MainWindow.SetText(Globals.MainWindow.xlabel, Convert.ToString(Character.X));
                Globals.MainWindow.SetText(Globals.MainWindow.ylabel, Convert.ToString(Character.Y));
                packet.ReadUInt8();
                packet.ReadUInt8();
                byte move = packet.ReadUInt8(); // Flag
                packet.ReadUInt8();             // Running
                if (move == 1)
                {
                    xsec   = packet.ReadUInt8();
                    ysec   = packet.ReadUInt8();
                    xcoord = packet.ReadUInt16();
                    packet.ReadUInt16();
                    ycoord = packet.ReadUInt16();
                }
                else
                {
                    packet.ReadUInt8();  // Unknown
                    packet.ReadUInt16(); // Unknwon
                }
                byte StateFlag = packet.ReadUInt8();
                packet.ReadUInt8(); //Action: 0 = None, 2 = Walking, 3 = Running, 4 = Sitting
                packet.ReadUInt8(); //Status: 0 = None, 2 = ??*GrowthPet, 3 = Invincible, 4 = Invisible
                packet.ReadUInt8();
                Character.WalkSpeed    = packet.ReadSingle();
                Character.RunSpeed     = packet.ReadSingle();
                Character.BerserkSpeed = packet.ReadSingle();
                byte ActiveBuffCount = packet.ReadUInt8();
                for (int a = 0; a < ActiveBuffCount; a++)
                {
                    uint   skillid   = packet.ReadUInt32();
                    int    buffindex = Skills_Info.skillsidlist.IndexOf(skillid);
                    string type      = Skills_Info.skillstypelist[buffindex];
                    if (type.StartsWith("SKILL_EU_CLERIC_RECOVERYA_GROUP") || type.StartsWith("SKILL_EU_BARD_BATTLAA_GUARD") || type.StartsWith("SKILL_EU_BARD_DANCEA") || type.StartsWith("SKILL_EU_BARD_SPEEDUPA_HITRATE"))
                    {
                        packet.ReadUInt8();
                    }
                }
                Character.PlayerName = packet.ReadAscii();
                Globals.MainWindow.SetText(Globals.MainWindow.charname, Character.PlayerName);
                #endregion

                #region Job
                string JobTitle        = packet.ReadAscii();
                byte   JobType         = packet.ReadUInt8(); //0 => None, 1 => Trader, 2 => Thief, 3 => Hunter
                byte   JobLevel        = packet.ReadUInt8();
                uint   JobEXP          = packet.ReadUInt8();
                uint   JobContribution = packet.ReadUInt32();
                uint   JobReward       = packet.ReadUInt32();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                packet.ReadUInt8();
                Character.AccountID = packet.ReadUInt32();
                Globals.MainWindow.SetText(Globals.MainWindow.accID, String.Format("{0:X8}", Character.AccountID));
                Globals.MainWindow.UpdateInventory();
                #endregion

                Globals.MainWindow.SetText(Globals.MainWindow.status, "Normal");
                Globals.MainWindow.SetText(Globals.MainWindow.currentexp, Convert.ToString(Character.ExpOffset));
                Globals.MainWindow.SetText(Globals.MainWindow.exppercent, String.Format("{0}%", Character.ExpOffset * 100 / ExpMax));
                Globals.MainWindow.UpdateTray();
                Globals.MainWindow.Enable(Globals.MainWindow.startbot);

                if (data_loaded == 0)
                {
                    data_loaded               = 1;
                    Data.Statistic.sp_begin   = (int)Character.SP;
                    Data.Statistic.gold_begin = (long)Character.Gold;
                    Configs.ReadConfigs();
                    System.Threading.Thread time_thread = new Thread(StartTimer);
                    time_thread.Start();
                    System.Threading.Thread time_thread1 = new Thread(StartTimer1);
                    time_thread1.Start();
                }

                for (int i = 0; i < Skill.Skills.Count; i++)
                {
                    Skill.Skills[i].index = i;
                }

                for (int i = 0; i < Globals.MainWindow.generalimbue.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.generalimbue.Items[i].ToString())
                        {
                            Skill.Imbue.Add(skill);
                            break;
                        }
                    }
                }

                for (int i = 0; i < Globals.MainWindow.partyimbue.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.partyimbue.Items[i].ToString())
                        {
                            Skill.PartyImbue.Add(skill);
                            break;
                        }
                    }
                }

                for (int i = 0; i < Globals.MainWindow.generalattack.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.generalattack.Items[i].ToString())
                        {
                            Skill.AttackSkills.Add(skill);
                            break;
                        }
                    }
                }

                for (int i = 0; i < Globals.MainWindow.partyattack.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.partyattack.Items[i].ToString())
                        {
                            Skill.PartyAttackSkills.Add(skill);
                            break;
                        }
                    }
                }

                for (int i = 0; i < Globals.MainWindow.buff.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.buff.Items[i].ToString())
                        {
                            skill.bufftype    = 1;
                            skill.BuffWaiting = 1;
                            break;
                        }
                    }
                    Buffas.buff_waiting = true;
                }

                for (int i = 0; i < Globals.MainWindow.secondbuff.Items.Count; i++)
                {
                    foreach (Skill skill in Skill.Skills)
                    {
                        if (skill.Name == Globals.MainWindow.secondbuff.Items[i].ToString())
                        {
                            skill.bufftype    = 3;
                            skill.BuffWaiting = 1;
                            break;
                        }
                    }
                    Buffas.buff_waiting = true;
                }

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

                if (Data.bot == true)
                {
                    StartLooping.Start();
                }
            }
            catch { }
        }
Beispiel #5
0
        public static void WalkScript()
        {
            {
                if (Data.bot)
                {
                    if (i < count)
                    {
                        Data.loop = true;
                        i++;
                        try
                        {
                            string action = read.ReadLine();
                            if (action.StartsWith("go"))
                            {
                                Data.loopaction = "go";
                                Coordinates.x   = Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[0]);
                                Coordinates.y   = Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[1]);
                                int dist = (int)(Math.Abs(Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[0]) - Character.X) + Math.Abs(Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[1]) - Character.Y));
                                BotAction.WalkTo(Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[0]), Convert.ToInt32(action.Split('(')[1].Split(')')[0].Split(',')[1]));
                                double time = 0;
                                if (Data.char_horseid == 0)
                                {
                                    time = (dist / Convert.ToInt64(Character.RunSpeed * 0.08));
                                }
                                else
                                {
                                    time = (dist / Convert.ToInt64(Data.char_horsespeed * 0.08));
                                }
                                Timer repeat = new Timer();
                                repeat.Elapsed += new ElapsedEventHandler(repeat_Elapsed);
                                repeat.Interval = time * 1000 + 1;
                                repeat.Start();
                                repeat.AutoReset = false;
                                repeat.Enabled   = true;
                            }
                            if (action.StartsWith("talk"))
                            {
                                if (action.Split('(')[1].Split(')')[0] == "Storage")
                                {
                                    Data.loopaction = "storage";
                                    StorageControl.OpenStorage();
                                }
                                if (action.Split('(')[1].Split(')')[0] == "Sell")
                                {
                                    Data.loopaction = "blacksmith";
                                    SellControl.OpenShop();
                                }
                                if (action.Split('(')[1].Split(')')[0] == "Stable")
                                {
                                    Data.loopaction = "stable";
                                    BuyControl.OpenShop();
                                }
                                if (action.Split('(')[1].Split(')')[0] == "Grocery")
                                {
                                    Data.loopaction = "accessory";
                                    BuyControl.OpenShop();
                                }
                                if (action.Split('(')[1].Split(')')[0] == "Potion")
                                {
                                    Data.loopaction = "potion";
                                    BuyControl.OpenShop();
                                }
                            }
                            if (action.StartsWith("delay"))
                            {
                                Timer timer = new Timer();
                                timer.Elapsed += new ElapsedEventHandler(OnTick);
                                timer.Interval = Convert.ToInt32(action.Split('(')[1].Split(')')[0]) + 1;
                                timer.Start();
                                timer.AutoReset = false;
                                timer.Enabled   = true;
                            }
                            if (action.StartsWith("teleport"))
                            {
                                string[] tmp = action.Split(',');
                                uint     id  = Spawns.NPCID[Spawns.NPCType.IndexOf(Mobs_Info.mobstypelist[Mobs_Info.mobsidlist.IndexOf(Convert.ToUInt32(tmp[1]))])];
                                Teleport.Tele(id, Convert.ToByte(tmp[2]), Convert.ToUInt32(tmp[3]));
                            }
                            if (action.StartsWith("set"))
                            {
                                Globals.MainWindow.SetText(Globals.MainWindow.x_setbox, action.Split('(')[1].Split(')')[0].Split(',')[0]);
                                Globals.MainWindow.SetText(Globals.MainWindow.y_setbox, action.Split('(')[1].Split(')')[0].Split(',')[1]);
                            }
                        }
                        catch { }
                        if (i == count)
                        {
                            Data.loopaction = null;
                            Data.loop       = false;
                            i = 0;
                            read.Close();
                            if (Data.loopend == 0)
                            {
                                InventoryControl.MergeItems();
                                System.Threading.Thread.Sleep(5000);

                                Globals.MainWindow.UpdateLogs("Townloop Ended");
                                if (Data.char_horseid == 0)
                                {
                                    Data.loopaction = "mounthorse";
                                    BotAction.MountHorse();
                                }
                                else
                                {
                                    Data.loopend = 1;
                                    StartLooping.LoadTrainScript();
                                }
                            }
                            else
                            {
                                Globals.MainWindow.UpdateLogs("Walkscript Ended");
                                Globals.MainWindow.SetText(Globals.MainWindow.x_setbox, Character.X.ToString());
                                Globals.MainWindow.SetText(Globals.MainWindow.y_setbox, Character.Y.ToString());
                                StartLooping.Start();
                            }
                        }
                    }
                }
            }
        }
Beispiel #6
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;
                }
            }
        }