Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Server o Program
- internal static void RunCode(GameState client)
- {
- System.Threading.Tasks.Task.Factory.StartNew(() =>
- {
- #region Primer NPC
- NpcSpawn mount1 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65820,
- Name = "Reinder",
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(309),
- Y = (ushort)(284),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount1);
- var mount2 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65821,
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(318),
- Y = (ushort)(284),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount2);
- for (int i = 0; i < 12; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mount1.X, mount1.Y, mount2.X, mount2.Y);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mount1.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 313, 285, move);
- Enums.ConquerAngle facing2 = Kernel.GetAngle(mount2.X, mount2.Y, mount1.X, mount1.Y);
- move.Direction = facing2;
- move.UID = mount2.UID;
- Kernel.SendScreen(1002, 313, 285, move);
- }
- System.Threading.Thread.Sleep(1700);
- Network.GamePackets.MsgName update = new MsgName(true);
- update.UID = mount1.UID;
- update.Type = MsgName.Effect;
- update.TextsCount = 1;
- update.Texts.Add("zf2-e233");
- Kernel.SendScreen(1002, 313, 285, update);
- update.UID = mount2.UID;
- Kernel.SendScreen(1002, 313, 285, update);
- MonsterInformation.DropItem(3000316, 313, 285);
- System.Threading.Thread.Sleep(1500);
- #endregion
- #region SegundoNPC
- var mount3 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65822,
- Name = "Reinder",
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(309),
- Y = (ushort)(288),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount3);
- var mount4 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65823,
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(318),
- Y = (ushort)(288),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount4);
- for (int i = 0; i < 12; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mount3.X, mount3.Y, mount4.X, mount4.Y);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mount3.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 314, 288, move);
- Enums.ConquerAngle facing2 = Kernel.GetAngle(mount4.X, mount4.Y, mount3.X, mount3.Y);
- move.Direction = facing2;
- move.UID = mount4.UID;
- Kernel.SendScreen(1002, 314, 288, move);
- }
- System.Threading.Thread.Sleep(1700);
- update.UID = mount3.UID;
- update.Type = MsgName.Effect;
- update.TextsCount = 1;
- update.Texts.Add("zf2-e233");
- Kernel.SendScreen(1002, 314, 288, update);
- update.UID = mount4.UID;
- Kernel.SendScreen(1002, 314, 288, update);
- MonsterInformation.DropItem(3000316, 314, 288);
- System.Threading.Thread.Sleep(1500);
- #endregion
- #region TercerNPC
- var mount5 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65824,
- Mesh = 21470,
- Name = "Reinder",
- Type = Enums.NpcType.Talker,
- X = (ushort)(309),
- Y = (ushort)(290),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount5);
- var mount6 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65825,
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(318),
- Y = (ushort)(290),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount6);
- for (int i = 0; i < 12; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mount5.X, mount5.Y, mount6.X, mount6.Y);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mount5.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 313, 290, move);
- Enums.ConquerAngle facing2 = Kernel.GetAngle(mount6.X, mount6.Y, mount5.X, mount5.Y);
- move.Direction = facing2;
- move.UID = mount6.UID;
- Kernel.SendScreen(1002, 313, 290, move);
- }
- System.Threading.Thread.Sleep(1700);
- update.UID = mount5.UID;
- update.Type = MsgName.Effect;
- update.TextsCount = 1;
- update.Texts.Add("zf2-e233");
- Kernel.SendScreen(1002, 313, 290, update);
- update.UID = mount6.UID;
- Kernel.SendScreen(1002, 313, 290, update);
- MonsterInformation.DropItem(3000316, 313, 290);
- System.Threading.Thread.Sleep(1500);
- #endregion
- #region CuartoNPC
- var mount7 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65827,
- Mesh = 21470,
- Name = "Reinder",
- Type = Enums.NpcType.Talker,
- X = (ushort)(309),
- Y = (ushort)(293),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount7);
- var mount8 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65828,
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(318),
- Y = (ushort)(293),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount8);
- for (int i = 0; i < 12; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mount7.X, mount7.Y, mount8.X, mount8.Y);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mount7.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 314, 294, move);
- Enums.ConquerAngle facing2 = Kernel.GetAngle(mount8.X, mount8.Y, mount7.X, mount7.Y);
- move.Direction = facing2;
- move.UID = mount8.UID;
- Kernel.SendScreen(1002, 314, 294, move);
- }
- System.Threading.Thread.Sleep(1700);
- update.UID = mount7.UID;
- update.Type = MsgName.Effect;
- update.TextsCount = 1;
- update.Texts.Add("zf2-e233");
- Kernel.SendScreen(1002, 314, 294, update);
- update.UID = mount8.UID;
- Kernel.SendScreen(1002, 314, 294, update);
- MonsterInformation.DropItem(3000316, 314, 294);
- System.Threading.Thread.Sleep(1500);
- #endregion
- #region QuintoNPC
- var mount9 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65829,
- Mesh = 21470,
- Name = "Reinder",
- Type = Enums.NpcType.Talker,
- X = (ushort)(309),
- Y = (ushort)(297),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount9);
- var mount10 = new Network.GamePackets.NpcSpawn()
- {
- UID = 65830,
- Mesh = 21470,
- Type = Enums.NpcType.Talker,
- X = (ushort)(318),
- Y = (ushort)(297),
- MapID = 1002,
- };
- Kernel.SendSpawn(mount10);
- for (int i = 0; i < 12; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mount9.X, mount9.Y, mount10.X, mount10.Y);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mount9.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 314, 297, move);
- Enums.ConquerAngle facing2 = Kernel.GetAngle(mount10.X, mount10.Y, mount9.X, mount9.Y);
- move.Direction = facing2;
- move.UID = mount10.UID;
- Kernel.SendScreen(1002, 314, 297, move);
- }
- System.Threading.Thread.Sleep(1700);
- update.UID = mount9.UID;
- update.Type = MsgName.Effect;
- update.TextsCount = 1;
- update.Texts.Add("zf2-e233");
- Kernel.SendScreen(1002, 314, 297, update);
- update.UID = mount10.UID;
- Kernel.SendScreen(1002, 314, 297, update);
- MonsterInformation.DropItem(3000316, 314, 297);
- System.Threading.Thread.Sleep(1500);
- #endregion
- var mountend = new Network.GamePackets.NpcSpawn()
- {
- UID = 65840,
- Mesh = 21480,
- Type = Enums.NpcType.Talker,
- X = (ushort)(313),
- Y = (ushort)(284),
- MapID = 1002,
- };
- Kernel.SendSpawn(mountend);
- for (int i = 0; i < 21; i++)
- {
- Enums.ConquerAngle facing = Kernel.GetAngle(mountend.X, mountend.Y, 313, 300);
- MsgWalk move = new MsgWalk(true);
- move.Direction = facing;
- move.UID = mountend.UID;
- move.GroundMovementType = MsgWalk.Walk;
- Kernel.SendScreen(1002, 313, 290, move);
- }
- System.Threading.Thread.Sleep(1500);
- MonsterInformation.DropItem(3000316, 313, 285);
- System.Threading.Thread.Sleep(1500);
- MonsterInformation.DropItem(3000316, 314, 288);
- System.Threading.Thread.Sleep(1500);
- MonsterInformation.DropItem(3000316, 313, 290);
- System.Threading.Thread.Sleep(1500);
- MonsterInformation.DropItem(3000316, 314, 294);
- System.Threading.Thread.Sleep(1500);
- MonsterInformation.DropItem(3000316, 314, 297);
- mount1.X = mount2.X = mount3.X = mount4.X = mount5.X = mount6.X = mount7.X = mount8.X = mount9.X = mount10.X = mountend.X = 900;
- Kernel.SendScreen(1002, 313, 290, mount1);
- Kernel.SendScreen(1002, 313, 290, mount2);
- Kernel.SendScreen(1002, 313, 290, mount3);
- Kernel.SendScreen(1002, 313, 290, mount4);
- Kernel.SendScreen(1002, 313, 290, mount5);
- Kernel.SendScreen(1002, 313, 290, mount6);
- Kernel.SendScreen(1002, 313, 290, mount7);
- Kernel.SendScreen(1002, 313, 290, mount8);
- Kernel.SendScreen(1002, 313, 290, mount9);
- Kernel.SendScreen(1002, 313, 290, mount10);
- Kernel.SendScreen(1002, 313, 290, mountend);
- });
- }
- =============================================================
- Kernel
- public static void SendScreen(ushort MapID, ushort X, ushort Y, Interfaces.IPacket packet)
- {
- var Values = Server.GamePool;
- foreach (var pClient in Values)
- {
- if (pClient == null) continue;
- if (!pClient.Socket.Alive) continue;
- if (pClient.Player.MapID != MapID) continue;
- if (Kernel.GetDistance(pClient.Player.X, pClient.Player.Y, X, Y) > Constants.pScreenDistance) continue;
- pClient.Send(packet);
- }
- }
- internal static void SendSpawn(Interfaces.IMapObject item)
- {
- foreach (Client.GameState client in Server.GamePool)
- if (client != null)
- if (client.Map.ID == item.MapID)
- if (GetDistance(item.X, item.Y, client.Player.X, client.Player.Y) <= Constants.pScreenDistance)
- item.SendSpawn(client);
- }
- ===============================================================
- MonsterTable
- public static void DropItem(uint ItemID, ushort X, ushort Y)
- {
- var Item = new Network.GamePackets.MsgItemInfo(true);
- Item.ID = ItemID;
- if (Kernel.Maps[1002].SelectCoordonates(ref X, ref Y))
- {
- Item.Color = (Game.Enums.Color)Kernel.Random.Next(4, 8);
- Item.MaximDurability = 65355;
- Item.Durability = Item.MaximDurability;
- Item.MobDropped = true;
- MsgMapItem floorItem = new MsgMapItem(true);
- floorItem.Item = new MsgItemInfo(true);
- floorItem.Item.Color = Item.Color;
- floorItem.Item.Durability = Item.Durability;
- floorItem.Item.ID = Item.ID;
- floorItem.Item.Mode = Game.Enums.ItemMode.Default;
- floorItem.Item.UID = MsgItemInfo.ItemUID.Next;
- floorItem.UID = floorItem.Item.UID;
- floorItem.Item.MobDropped = true;
- floorItem.ItemColor = Item.Color;
- floorItem.ItemID = Item.ID;
- while (Kernel.Maps[1002].Npcs.ContainsKey(floorItem.UID))
- floorItem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
- floorItem.MapID = Kernel.Maps[1002].ID;
- floorItem.MapObjType = Game.MapObjectType.Item;
- floorItem.X = X;
- floorItem.Y = Y;
- floorItem.Type = MsgMapItem.Drop;
- floorItem.OnFloor = Time32.Now;
- Kernel.SendSpawn(floorItem);
- Kernel.Maps[1002].AddFloorItem(floorItem);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement