public void pak_SpawnNpc(CPlayer thisclient, CNpc thisnpc) { thisnpc.NpcInfo.CharID = mServer.GetMobID(); OutPak.Clear(); OutPak.SetShort(172, 0); OutPak.SetShort(0x0364, 4); OutPak.SetShort(30000, 6); OutPak.SetShort(thisnpc.Position.pCurrent.x, 12); OutPak.SetShort(thisnpc.Position.pCurrent.y, 14); OutPak.SetShort(thisnpc.NpcInfo.CharID, 16); XmlDocument doc = new XmlDocument(); try { doc.Load(String.Format("./Data/Npc/{0}", thisnpc.NpcFile)); } catch (Exception ex) { Core.CLog(String.Format("Error: {0}", ex.Message)); } XmlNode root = doc.DocumentElement; XmlNodeList list = root.SelectNodes("/npc/inventory/item"); OutPak.SetString(root.Attributes.Item(0).Value, 18); if (int.Parse(root.Attributes.Item(2).Value).Equals(0)) { OutPak.SetShort(120, 30); } OutPak.SetShort(int.Parse(root.Attributes.Item(1).Value), 34); for (int i = 0; i < list.Count; i++) { int slotnum = int.Parse(list.Item(i).Attributes.Item(0).Value); CItem thisitem = new CItem(); thisitem.ItemID = int.Parse(list.Item(i).Attributes.Item(1).Value); thisitem.EF1 = int.Parse(list.Item(i).Attributes.Item(2).Value); thisitem.EFV1 = int.Parse(list.Item(i).Attributes.Item(3).Value); thisitem.EF2 = int.Parse(list.Item(i).Attributes.Item(4).Value); thisitem.EFV2 = int.Parse(list.Item(i).Attributes.Item(5).Value); thisitem.EF3 = int.Parse(list.Item(i).Attributes.Item(6).Value); thisitem.EFV3 = int.Parse(list.Item(i).Attributes.Item(7).Value); OutPak.SetShort(thisclient.GetItemIDwRefine(thisitem), (2 * slotnum) + 36); OutPak.SetByte(thisclient.GetAnctCode(thisitem), slotnum + 131); } OutPak.SetShort(thisnpc.NpcInfo.CharID, 66); OutPak.SetShort(int.Parse(root.Attributes.Item(3).Value), 100); OutPak.SetByte(1, 102); OutPak.SetByte(int.Parse(root.Attributes.Item(2).Value), 106); OutPak.SetShort(4, 107); // Move Speed OutPak.SetShort(100, 108); OutPak.SetShort(100, 110); OutPak.SetShort(100, 112); OutPak.SetShort(100, 114); OutPak.SetShort(int.Parse(root.Attributes.Item(4).Value), 116); OutPak.SetShort(int.Parse(root.Attributes.Item(5).Value), 118); OutPak.SetShort(int.Parse(root.Attributes.Item(6).Value), 120); OutPak.SetShort(int.Parse(root.Attributes.Item(7).Value), 122); OutPak.SetShort(0, 128); // Spawn Effect 2=tele effect thisclient.Client.encdec.Encrypt(OutPak, OutPak.dataBuffer, 172, thisclient.Client.Hash); thisclient.Client.SendPacket(OutPak, 172); }
public void pak_SpawnChar(CPlayer thisclient, CPlayer otherclient) { OutPak.Clear(); OutPak.SetShort(172, 0); OutPak.SetShort(0x0364, 4); OutPak.SetShort(30000, 6); OutPak.SetShort(otherclient.Position.pCurrent.x, 12); OutPak.SetShort(otherclient.Position.pCurrent.y, 14); OutPak.SetShort(otherclient.Session.ClientID, 16); OutPak.SetString(otherclient.CharInfo.CharName, 18); OutPak.SetShort(otherclient.CharInfo.ChaosPts, 30); OutPak.SetShort(otherclient.CharInfo.BodyID, 34); for (int i = 0; i < 15; i++) { OutPak.SetShort(thisclient.GetItemIDwRefine(otherclient.Inventory[i]), (2 * i) + 36); OutPak.SetByte(thisclient.GetAnctCode(otherclient.Inventory[i]), i + 131); } OutPak.SetShort(otherclient.Session.ClientID, 66); OutPak.SetShort(otherclient.CharInfo.cLevel, 100); OutPak.SetShort(4, 107); // Move Speed OutPak.SetShort(otherclient.Stats.mHP, 108); OutPak.SetShort(otherclient.Stats.mMP, 110); OutPak.SetShort(otherclient.Stats.cHP, 112); OutPak.SetShort(otherclient.Stats.cMP, 114); OutPak.SetShort(otherclient.Stats.STR, 116); OutPak.SetShort(otherclient.Stats.INT, 118); OutPak.SetShort(otherclient.Stats.DEX, 120); OutPak.SetShort(otherclient.Stats.CON, 122); OutPak.SetShort(0, 128); // Spawn Effect 2=tele effect thisclient.Client.encdec.Encrypt(OutPak, OutPak.dataBuffer, 172, thisclient.Client.Hash); thisclient.Client.SendPacket(OutPak, 172); }