public static void WarpCommand(PacketReader packet, PacketBuilder builder, ClientHandler client, EventHandler events) { Character character = client.Metadata["fullchar"] as Character; var npc = packet.ReadUShort(); var unk1 = packet.ReadUShort(); var unk2 = packet.ReadByte(); var unk3 = packet.ReadByte(); var unk4 = packet.ReadByte(); var y = packet.ReadByte(); var x = packet.ReadByte(); var unk5 = packet.ReadByte(); var unk6 = packet.ReadByte(); var warpID = packet.ReadUInt(); var unk7 = packet.ReadByte(); var unk8 = packet.ReadByte(); var unk9 = packet.ReadByte(); var unk10 = packet.ReadByte(); var unk11 = packet.ReadByte(); var unk12 = packet.ReadByte(); var unk13 = packet.ReadByte(); var unk14 = packet.ReadByte(); var map = (client.Metadata["map"] as IMap); var fee = character.stats.alz; var alive = (warpID == 0 && npc != 54 && npc != 63); int[] dest = null; if (alive) dest = map.GetWarpDestination(npc, 0); else if (npc == 201) warpID = (uint)map.ID; else dest = map.GetDeathDestination(); if (dest!=null) { warpID = (byte)dest[0]; x = (byte)dest[1]; y = (byte)dest[2]; } map.GetSurroundingClients(client, 1); map.RemoveClient(client); events.Warped("world.WarpCommand", client, (int)warpID, x, y); builder.New(0x00F4); // TODO: Load x,y values from WarpList { builder += (ushort)x; builder += (ushort)y; builder += (uint)character.stats.exp; builder += 0; //axp builder += fee; //Alz (for death penalty and fee?) builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (ulong)0; builder += warpID; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; builder += (byte)1; } #region PacketAnalisys #if DEBUG string notice = ""; /*for (int i = 0; i< packet.Size-10; i++) { notice += packet.ReadByte()+" "; } */ notice += npc + " " + unk1 + " " + unk2 + " " + unk3 + " " + unk4 + " " + x + " " + y + " " + unk5 + " " + unk6 + " " + warpID + " " + unk7 + " " + unk8 + " " + unk9 + " " + unk10 + " " + unk11 + " " + unk12 + " " + unk13 + " " + unk14; Log.Notice(notice); #endif #endregion client.Send(builder, "WarpCommand"); character.map = (byte)warpID; character.x = x; character.y = y; CharacterManagement.UpdatePosition(client.Metadata["syncServer"] as SyncReceiver, (int)client.Metadata["server"], client.AccountID, character.slot, (byte)warpID, character.x, character.y); }
public static void SkillToMobs(PacketReader packet, PacketBuilder builder, ClientHandler client, EventHandler events) { var skillid = packet.ReadUShort(); var unk = packet.ReadInt(); var unk2 = packet.ReadByte(); var mobid = packet.ReadUShort(); var unk3 = packet.ReadShort(); var unk4 = packet.ReadByte(); var dmg = packet.ReadUInt(); var unk5 = packet.ReadByte(); var unk6 = packet.ReadShort(); var unk7 = packet.ReadShort(); var unk8 = packet.ReadShort(); var unk9 = packet.ReadShort(); var unk10 = packet.ReadShort(); var unk11 = packet.ReadByte(); var unk12 = packet.ReadShort(); var unk13 = packet.ReadShort(); #if DEBUG Log.Notice("" + skillid + " " + unk + " " + unk2 + " " + mobid + " " + unk3 + " " + unk4 + " " + dmg + " " + unk5 + " " + unk6 + " " + unk7 + " " + unk8 + " " + unk9 + " " + unk10 + " " + unk11 + " " + unk12 + " " + unk13 + ""); #endif //packet.Skip(6); var attack = packet.ReadUShort(); Character character = client.Metadata["fullchar"] as Character; uint hp = character.stats.curhp; uint mp = character.stats.curmp; character.stats.exp += 100; var exp = character.stats.exp; /* * builder.New(0x00AE); * { * builder += skillid; * builder += (byte)1; * builder += (uint)hp; * builder += (uint)mp; * builder += (ushort)0; * builder += (ushort)1; * builder += (uint)2; * builder += (ushort)3; * builder += (uint)4; * builder += (ushort)5; * builder += (uint)6; * builder += (uint)7; * builder += (uint)8; * builder += (uint)9; * builder += (uint)10; * builder += (uint)11; * builder += (uint)12; * builder += (uint)0xFFFFFFFF; * builder += (byte)1; * builder += (uint)13; * builder += (uint)14; * builder += (byte)1; * builder += (ushort)15; * builder += (ushort)16; * builder += (ushort)17; * builder += (uint)18; * builder += (uint)19; * builder += (uint)20; * builder += (uint)21; * builder += (uint)22; * builder += (byte)1; * }*/ builder.New(0x00AE); { builder += (ushort)skillid; //skillid builder += hp; //Hp builder += mp; //Mp builder += (ushort)0; //Unk builder += (ulong)exp; //Exp builder += (int)0xFFFFFFF; //Skill Exp builder += (ushort)0; //AP builder += (uint)0; //AXP builder += (ulong)0; //Unk1 builder += (ulong)0; //Unk2 builder += (ulong)0; //Unk3 builder += (uint)0xFFFFFFFF; builder += (byte)1; builder += hp; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)1; builder += (byte)27; builder += (byte)0; builder += (byte)1; builder += (byte)2; builder += (byte)2; builder += (byte)2; builder += (byte)1; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)0; builder += (byte)1; } client.Send(builder, "SkillToMobs"); }
public static void SkillToMobs(PacketReader packet, PacketBuilder builder, ClientHandler client, EventHandler events) { var map = client.Metadata["map"] as IMap; var mapmobs = (client.Metadata["map"] as IMap).GetSurroundingMobs(client, 3); var mobdata = map.GetMobsData; var skillid = packet.ReadUShort(); var unk = packet.ReadInt(); var unk1 = packet.ReadByte(); var unk2 = packet.ReadUShort(); var unk3 = packet.ReadShort(); var unk4 = packet.ReadByte(); var dmg = packet.ReadUInt(); var unk5 = packet.ReadByte(); var unk6 = packet.ReadShort(); var unk7 = packet.ReadShort(); var unk8 = packet.ReadShort(); var unk9 = packet.ReadShort(); var mobid = packet.ReadShort(); var unk11 = packet.ReadByte(); var unk12 = packet.ReadShort(); var unk13 = packet.ReadShort(); #if DEBUG Log.Notice("SkillID:" + skillid + " SkillSlot:" + unk + " unk1:" + unk1 + " unk2:" + unk2 + " unk3:" + unk3 + " unk4:" + unk4 + " dmg:" + dmg + " unk5:" + unk5 + " unk6:" + unk6 + " unk7:" + unk7 + " unk8:" + unk8 + " unk9:" + unk9 + " MobID:" + mobid + " unk11:" + unk11 + " unk12:" + unk12 + " unk13:" + unk13 + ""); #endif //packet.Skip(6); var attack = packet.ReadUShort(); Character character = client.Metadata["fullchar"] as Character; uint hp = character.stats.curhp; uint mp = character.stats.curmp; SkillLoader s = new SkillLoader(); var skilllist = s.LoadSkillData(skillid); var sid = skilllist.Find(x => x.ID == skillid); var char_atk = (int)client.Metadata["patk"]; if (sid.Type == 1) { char_atk = (int)client.Metadata["patk"]; } if (sid.Type == 2) { char_atk = (int)client.Metadata["matk"]; } var mi = mapmobs.Find(x => x.Id == mobid); var md = mobdata[mi.SId]; uint attack_rate = Convert.ToUInt32(new Random().Next(1, 10)); var normal_atk = char_atk + (sid.Attack + ((sid.Amp / 100) * sid.Attack)); var mobdef = new Random().Next(md.Defense, md.DefRate); var normal_damage = normal_atk - mobdef; var crit_damage = normal_damage + (normal_damage * sid.Critical); var damage = 0; var atack_result = 0; if (attack_rate <= 5) { atack_result = 2; damage = normal_damage; character.stats.exp = character.stats.exp + (ulong)damage * 2; } if (attack_rate == 6) { atack_result = 1; damage = crit_damage; character.stats.exp = character.stats.exp + (ulong)damage * 2; } if (attack_rate == 7) { atack_result = 27; } if (attack_rate >= 8) { atack_result = 21; } //Damage Maked if (damage < md.Defense && damage > 0) { damage = new Random().Next(1, 5); } if (damage >= mi.CurrentHP && damage > 0) { damage = mi.CurrentHP; mi.CurrentHP = 0; //map.DropItem(mi.CurrentPosX, mi.CurrentPosX, 13, 1,1); } else { mi.CurrentHP = mi.CurrentHP - damage; } var exp = character.stats.exp; var skillexp = character.stats.swordrank + sid.Attack; builder.New(0x00AE); { builder += (ushort)skillid; //skillid builder += hp; //Hp builder += mp; //Mp builder += (ushort)0; //SP builder += (ulong)exp; //Exp builder += (ulong)0; //OXP builder += (ulong)skillexp; //SkillEXP builder += new byte[26]; builder += (uint)0xFFFFFFFF; builder += (byte)0; builder += hp; builder += (uint)0; builder += (byte)1; builder += (byte)mobid; builder += (byte)0; builder += (byte)map.ID; builder += (byte)2; builder += (byte)2; builder += (byte)atack_result; builder += (int)damage; builder += (int)mi.CurrentHP; builder += new byte[12]; builder += (byte)1; } client.Send(builder, "SkillToMobs"); if (mi.CurrentHP == 0) { mi.Spawn = Environment.TickCount + md.Respawn * 10; mapmobs.Remove(mi); } }