public static void Manager() { { if (Data.bot && (Movement.enablelogic && (Data.dead == false))) { if (Globals.MainWindow.Checked(Globals.MainWindow.nopick) == false) { if (Globals.MainWindow.Checked(Globals.MainWindow.normalpick) == true) { if (Movement.stuck == true) { Movement.StuckMove(); } else { if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && Data.char_grabpetid != 0) { PickupControl.NormalFilter(); } if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == false && PickupControl.there_is_pickable == true) { PickupControl.NormalFilter(); } else { if (Buffas.buff_waiting == true) { Buffas.BuffChecker(); } else { if (Training.monster_selected == false) { Training.SelectMonster(); } else { Skills.CheckSkills(); } } } } } else if (Globals.MainWindow.Checked(Globals.MainWindow.advancepick) == true) { if (Movement.stuck == true) { Movement.StuckMove(); } else { if (Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && Data.char_grabpetid != 0) { PickupControl.AdvanceFilter(); } if (!Globals.MainWindow.Checked(Globals.MainWindow.petpick) == true && PickupControl.there_is_pickable == true) { PickupControl.AdvanceFilter(); } else { if (Buffas.buff_waiting == true) { Buffas.BuffChecker(); } else { if (Training.monster_selected == false) { Training.SelectMonster(); } else { Skills.CheckSkills(); } } } } } } else { if (Movement.stuck == true) { Movement.StuckMove(); } else { if (Buffas.buff_waiting == true) { Buffas.BuffChecker(); } else { if (Training.monster_selected == false) { Training.SelectMonster(); } else { Skills.CheckSkills(); } } } } } } }
public static void Move(Packet packet) { uint id = packet.ReadUInt32(); if (id == Character.UniqueID) { if (packet.ReadUInt8() == 1) { byte xsec = packet.ReadUInt8(); byte ysec = packet.ReadUInt8(); float xcoord = 0; float zcoord = 0; float ycoord = 0; if (ysec == 0x80) { xcoord = packet.ReadUInt16() - packet.ReadUInt16(); zcoord = packet.ReadUInt16() - packet.ReadUInt16(); ycoord = packet.ReadUInt16() - packet.ReadUInt16(); } else { xcoord = packet.ReadUInt16(); zcoord = packet.ReadUInt16(); ycoord = packet.ReadUInt16(); } int real_xcoord = 0; int real_ycoord = 0; if (xcoord > 32768) { real_xcoord = (int)(65536 - xcoord); } else { real_xcoord = (int)xcoord; } if (ycoord > 32768) { real_ycoord = (int)(65536 - ycoord); } else { real_ycoord = (int)ycoord; } int x = Globals.CalculatePositionX(xsec, real_xcoord); int y = Globals.CalculatePositionY(ysec, real_ycoord); xcome = x; ycome = y; if (Skills.ghostwalking == true) { Skills.CastGhostWalk(Skills.ghostwalkid, xsec, ysec, (ushort)xcoord, (ushort)zcoord, (ushort)ycoord); Skills.ghostwalking = false; } //Loop //Training recording if (Movement.TrainingRecording == true) { string text = "go(" + x + "," + y + ")"; Globals.MainWindow.AddText(Globals.MainWindow.trainbox, text); } if (Data.loopaction == "record") { string text = "go(" + x + "," + y + ")"; Globals.MainWindow.AddText(Globals.MainWindow.walkscript, text); } Character.X = x; Character.Y = y; string sector = (String.Format("{0:X2}{1:X2}", xsec, ysec)); int index = Character.locationsector.IndexOf(sector); if (index != -1) { string location = Character.location[index]; 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)); //Recalculate Mob Distance foreach (Monster monster in Monster.SpawnMob) { System.Threading.Thread.Sleep(2); { monster.Distance = (int)(Math.Abs((monster.X - Character.X)) + Math.Abs((monster.Y - Character.Y))); } } //Recalculate Mob Distance } } else if (id == Data.char_horseid) { if (packet.ReadUInt8() == 1) { byte xsec = packet.ReadUInt8(); byte ysec = packet.ReadUInt8(); float xcoord = 0; float zcoord = 0; float ycoord = 0; if (ysec == 0x80) { xcoord = packet.ReadUInt16() - packet.ReadUInt16(); zcoord = packet.ReadUInt16() - packet.ReadUInt16(); ycoord = packet.ReadUInt16() - packet.ReadUInt16(); } else { xcoord = packet.ReadUInt16(); zcoord = packet.ReadUInt16(); ycoord = packet.ReadUInt16(); } int real_xcoord = 0; int real_ycoord = 0; if (xcoord > 33000) { real_xcoord = (int)(65352 - xcoord); } else { real_xcoord = (int)xcoord; } if (ycoord > 33000) { real_ycoord = (int)(65352 - ycoord); } else { real_ycoord = (int)ycoord; } int x = Globals.CalculatePositionX(xsec, real_xcoord); int y = Globals.CalculatePositionY(ysec, real_ycoord); xcome = x; ycome = y; Character.X = x; Character.Y = y; Globals.MainWindow.SetText(Globals.MainWindow.xlabel, Convert.ToString(Character.X)); Globals.MainWindow.SetText(Globals.MainWindow.ylabel, Convert.ToString(Character.Y)); //Recalculate Mob Distance foreach (Monster monster in Monster.SpawnMob) { System.Threading.Thread.Sleep(2); { monster.Distance = (int)(Math.Abs((monster.X - Character.X)) + Math.Abs((monster.Y - Character.Y))); } } //Recalculate Mob Distance } } else { if (packet.ReadUInt8() == 0x01) { foreach (Monster monster in Monster.SpawnMob) { if (id == monster.UniqueID) { byte xsec = packet.ReadUInt8(); byte ysec = packet.ReadUInt8(); float xcoord = 0; float ycoord = 0; if (ysec == 0x80) { xcoord = packet.ReadUInt16() - packet.ReadUInt16(); packet.ReadUInt16(); packet.ReadUInt16(); ycoord = packet.ReadUInt16() - packet.ReadUInt16(); } else { xcoord = packet.ReadUInt16(); packet.ReadUInt16(); ycoord = packet.ReadUInt16(); } int x = Globals.CalculatePositionX(xsec, xcoord); int y = Globals.CalculatePositionY(ysec, ycoord); int dist = Math.Abs((x - Character.X)) + Math.Abs((y - Character.Y)); monster.X = x; monster.Y = y; monster.Distance = dist; break; } } } } }
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(); //--------------------------------------------------------------------------------------------------------------------------------------------------------- } } } }