public static void MonsterAction(Packet packet) { uint id = packet.ReadUInt32(); string type = packet.ReadUInt8().ToString("X2") + packet.ReadUInt8().ToString("X2"); if (type == "0002" || type == "0003") { if (id != Character.UniqueID) { foreach (Monster monster in Monster.SpawnMob) { if (id == monster.UniqueID) { if (id != Training.monster_id) { Monster.SpawnMob.Remove(monster); Stuck.DeleteMob(id); break; } } } } } }
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 { } }
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 }
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; } } } }