public static void OnTick(object sender, ElapsedEventArgs e) { BotAction.WalkTo(xescape, yescape); Timer Timer2 = new Timer(); double time = (10 / Convert.ToInt64(Character.RunSpeed * 0.1f)); Timer2.Elapsed += new ElapsedEventHandler(OnTick1); Timer2.Interval = time * 1000 + 1; Timer2.Start(); Timer2.AutoReset = false; Timer2.Enabled = true; }
public static void HPMPUNIVIGOR_Pots() { uint hp = 0; uint mp = 0; uint uni = 0; uint vigor = 0; for (int i = 0; i < Data.inventoryid.Count; i++) { string name = Data.inventorytype[i]; if (name.StartsWith("ITEM_ETC_HP_POTION")) { hp = hp + Convert.ToUInt32(Data.inventorycount[i]); } if (name.StartsWith("ITEM_ETC_MP_POTION")) { mp = mp + Convert.ToUInt32(Data.inventorycount[i]); } if (name.StartsWith("ITEM_ETC_CURE_ALL")) { uni = uni + Convert.ToUInt32(Data.inventorycount[i]); } if (name.StartsWith("ITEM_ETC_ALL_POTION")) { vigor = vigor + Convert.ToUInt32(Data.inventorycount[i]); } } Data.itemscount.hp_pots = hp; Data.itemscount.mp_pots = mp; Data.itemscount.uni_pills = uni; Data.itemscount.vigor = vigor; if (Globals.MainWindow.Checked(Globals.MainWindow.lowhp) == true && !Data.loop) { if (Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.lowhptext)) >= hp) { Globals.MainWindow.UpdateLogs("Returning To Town: Low HP Potions"); BotAction.UseReturn(); } } if (Globals.MainWindow.Checked(Globals.MainWindow.lowmp) == true && !Data.loop) { if (Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.lowmptext)) >= mp) { Globals.MainWindow.UpdateLogs("Returning To Town: Low MP Potions"); BotAction.UseReturn(); } } }
public static void InventorySlots() { byte items_count = 0; for (int i = 0; i < Data.inventoryslot.Count; i++) { if (Data.inventoryslot[i] >= 13) { items_count++; } } Data.itemscount.items_count = items_count; if (items_count == Character.InventorySize - 13 && Globals.MainWindow.Checked(Globals.MainWindow.inventoryfull) == true && !Data.loop) { Globals.MainWindow.UpdateLogs("Returning To Town: Inventory Full"); BotAction.UseReturn(); } }
public static void Durability(Packet packet) { byte slot = packet.ReadUInt8(); uint new_durability = packet.ReadUInt32(); int index = Data.inventoryslot.IndexOf(slot); if (index != -1) { Data.inventorydurability[index] = new_durability; if (Globals.MainWindow.Checked(Globals.MainWindow.lowdurability) == true) { if (new_durability <= 1) { Globals.MainWindow.UpdateLogs("Returning To Town! Low Durability"); BotAction.UseReturn(); } } } }
public static void StuckMove() { int dist = (int)(Math.Abs(xcome - xstuck) + Math.Abs(ycome - ystuck)); double xp = (10 * xcome - (dist + 10) * xstuck) / (0 - dist); double yp = (10 * ycome - (dist + 10) * ystuck) / (0 - dist); BotAction.WalkTo(xp, yp); Timer Timer1 = new Timer(); double time = (10 / Convert.ToInt64(Character.RunSpeed * 0.1f)); Timer1.Elapsed += new ElapsedEventHandler(OnTick); Timer1.Interval = time * 1000 + 1; Timer1.Start(); Timer1.AutoReset = false; Timer1.Enabled = true; xescape = xp - (yp - ystuck); yescape = (xp - xstuck) + yp; }
public static void OnTick(object sender, ElapsedEventArgs e) { Training.SelectMonster(); if (Training.monster_selected == false) { int dist = (int)(Math.Abs((nextx - Character.X)) + Math.Abs((nexty - Character.Y))); BotAction.WalkTo(nextx, nexty); double time = (dist / Convert.ToInt64(Character.RunSpeed * 0.12f)); Timer RandomTimer = new Timer(); RandomTimer.Elapsed += new ElapsedEventHandler(OnTickSecond); RandomTimer.Interval = time * 1000 + 1; RandomTimer.Start(); RandomTimer.AutoReset = false; RandomTimer.Enabled = true; } else { running = false; } }
public static void Arrows_Bolts() { int arrows = 0; int bolts = 0; for (int i = 0; i < Data.inventoryid.Count; i++) { string name = Data.inventorytype[i]; if (name == "ITEM_ETC_AMMO_ARROW_01" || name == "ITEM_ETC_AMMO_ARROW_01_DEF" || name == "ITEM_MALL_QUIVER") { arrows = arrows + Convert.ToInt32(Data.inventorycount[i]); } if (name == "ITEM_ETC_AMMO_BOLT_01" || name == "ITEM_ETC_AMMO_BOLT_01_DEF" || name == "ITEM_MALL_BOLT") { bolts = bolts + Convert.ToInt32(Data.inventorycount[i]); } } Data.itemscount.arrows = (uint)arrows; Data.itemscount.bolts = (uint)bolts; if (Globals.MainWindow.Checked(Globals.MainWindow.lowarrow) == true && !Data.loop) { if (Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.lowarrowtext)) >= arrows) { Globals.MainWindow.UpdateLogs("Returning To Town: Low Arrows"); BotAction.UseReturn(); } } if (Globals.MainWindow.Checked(Globals.MainWindow.lowbolt) == true && !Data.loop) { if (Convert.ToInt32(Globals.MainWindow.ReadText(Globals.MainWindow.lowbolttext)) >= bolts) { Globals.MainWindow.UpdateLogs("Returning To Town: Low Bolts"); BotAction.UseReturn(); } } }
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(); } }
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(); } } } } } }
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!"); } } } }
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; } } }