Advertisement
XConquer

Evento Navidad

Dec 24th, 2020
1,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 15.43 KB | None | 0 0
  1. Server o Program
  2.  
  3.  internal static void RunCode(GameState client)
  4.         {
  5.             System.Threading.Tasks.Task.Factory.StartNew(() =>
  6.             {
  7.                 #region Primer NPC
  8.                 NpcSpawn mount1 = new Network.GamePackets.NpcSpawn()
  9.                 {
  10.                     UID = 65820,
  11.                     Name = "Reinder",
  12.                     Mesh = 21470,
  13.                     Type = Enums.NpcType.Talker,
  14.                     X = (ushort)(309),
  15.                     Y = (ushort)(284),
  16.                     MapID = 1002,
  17.                 };
  18.                 Kernel.SendSpawn(mount1);
  19.                 var mount2 = new Network.GamePackets.NpcSpawn()
  20.                 {
  21.                     UID = 65821,
  22.                     Mesh = 21470,
  23.                     Type = Enums.NpcType.Talker,
  24.                     X = (ushort)(318),
  25.                     Y = (ushort)(284),
  26.                     MapID = 1002,
  27.                 };
  28.                 Kernel.SendSpawn(mount2);
  29.                 for (int i = 0; i < 12; i++)
  30.                 {
  31.                     Enums.ConquerAngle facing = Kernel.GetAngle(mount1.X, mount1.Y, mount2.X, mount2.Y);
  32.                     MsgWalk move = new MsgWalk(true);
  33.                     move.Direction = facing;
  34.                     move.UID = mount1.UID;
  35.                     move.GroundMovementType = MsgWalk.Walk;
  36.                     Kernel.SendScreen(1002, 313, 285, move);
  37.                     Enums.ConquerAngle facing2 = Kernel.GetAngle(mount2.X, mount2.Y, mount1.X, mount1.Y);
  38.                     move.Direction = facing2;
  39.                     move.UID = mount2.UID;
  40.                     Kernel.SendScreen(1002, 313, 285, move);
  41.                 }
  42.                 System.Threading.Thread.Sleep(1700);
  43.                 Network.GamePackets.MsgName update = new MsgName(true);
  44.                 update.UID = mount1.UID;
  45.                 update.Type = MsgName.Effect;
  46.                 update.TextsCount = 1;
  47.                 update.Texts.Add("zf2-e233");
  48.                 Kernel.SendScreen(1002, 313, 285, update);
  49.                 update.UID = mount2.UID;
  50.                 Kernel.SendScreen(1002, 313, 285, update);
  51.                 MonsterInformation.DropItem(3000316, 313, 285);
  52.                 System.Threading.Thread.Sleep(1500);
  53.  
  54.  
  55.                 #endregion
  56.                 #region SegundoNPC
  57.                 var mount3 = new Network.GamePackets.NpcSpawn()
  58.                 {
  59.                     UID = 65822,
  60.                     Name = "Reinder",
  61.                     Mesh = 21470,
  62.                     Type = Enums.NpcType.Talker,
  63.                     X = (ushort)(309),
  64.                     Y = (ushort)(288),
  65.                     MapID = 1002,
  66.                 };
  67.                 Kernel.SendSpawn(mount3);
  68.                 var mount4 = new Network.GamePackets.NpcSpawn()
  69.                 {
  70.                     UID = 65823,
  71.                     Mesh = 21470,
  72.                     Type = Enums.NpcType.Talker,
  73.                     X = (ushort)(318),
  74.                     Y = (ushort)(288),
  75.                     MapID = 1002,
  76.                 };
  77.                 Kernel.SendSpawn(mount4);
  78.                 for (int i = 0; i < 12; i++)
  79.                 {
  80.                     Enums.ConquerAngle facing = Kernel.GetAngle(mount3.X, mount3.Y, mount4.X, mount4.Y);
  81.                     MsgWalk move = new MsgWalk(true);
  82.                     move.Direction = facing;
  83.                     move.UID = mount3.UID;
  84.                     move.GroundMovementType = MsgWalk.Walk;
  85.                     Kernel.SendScreen(1002, 314, 288, move);
  86.                     Enums.ConquerAngle facing2 = Kernel.GetAngle(mount4.X, mount4.Y, mount3.X, mount3.Y);
  87.                     move.Direction = facing2;
  88.                     move.UID = mount4.UID;
  89.                     Kernel.SendScreen(1002, 314, 288, move);
  90.                 }
  91.                 System.Threading.Thread.Sleep(1700);
  92.                 update.UID = mount3.UID;
  93.                 update.Type = MsgName.Effect;
  94.                 update.TextsCount = 1;
  95.                 update.Texts.Add("zf2-e233");
  96.                 Kernel.SendScreen(1002, 314, 288, update);
  97.                 update.UID = mount4.UID;
  98.                 Kernel.SendScreen(1002, 314, 288, update);
  99.                 MonsterInformation.DropItem(3000316, 314, 288);
  100.                 System.Threading.Thread.Sleep(1500);
  101.                 #endregion
  102.                 #region TercerNPC
  103.                 var mount5 = new Network.GamePackets.NpcSpawn()
  104.                 {
  105.                     UID = 65824,
  106.                     Mesh = 21470,
  107.                     Name = "Reinder",
  108.                     Type = Enums.NpcType.Talker,
  109.                     X = (ushort)(309),
  110.                     Y = (ushort)(290),
  111.                     MapID = 1002,
  112.                 };
  113.                 Kernel.SendSpawn(mount5);
  114.                 var mount6 = new Network.GamePackets.NpcSpawn()
  115.                 {
  116.                     UID = 65825,
  117.                     Mesh = 21470,
  118.                     Type = Enums.NpcType.Talker,
  119.                     X = (ushort)(318),
  120.                     Y = (ushort)(290),
  121.                     MapID = 1002,
  122.                 };
  123.                 Kernel.SendSpawn(mount6);
  124.                 for (int i = 0; i < 12; i++)
  125.                 {
  126.                     Enums.ConquerAngle facing = Kernel.GetAngle(mount5.X, mount5.Y, mount6.X, mount6.Y);
  127.                     MsgWalk move = new MsgWalk(true);
  128.                     move.Direction = facing;
  129.                     move.UID = mount5.UID;
  130.                     move.GroundMovementType = MsgWalk.Walk;
  131.                     Kernel.SendScreen(1002, 313, 290, move);
  132.                     Enums.ConquerAngle facing2 = Kernel.GetAngle(mount6.X, mount6.Y, mount5.X, mount5.Y);
  133.                     move.Direction = facing2;
  134.                     move.UID = mount6.UID;
  135.                     Kernel.SendScreen(1002, 313, 290, move);
  136.                 }
  137.                 System.Threading.Thread.Sleep(1700);
  138.                 update.UID = mount5.UID;
  139.                 update.Type = MsgName.Effect;
  140.                 update.TextsCount = 1;
  141.                 update.Texts.Add("zf2-e233");
  142.                 Kernel.SendScreen(1002, 313, 290, update);
  143.                 update.UID = mount6.UID;
  144.                 Kernel.SendScreen(1002, 313, 290, update);
  145.                 MonsterInformation.DropItem(3000316, 313, 290);
  146.                 System.Threading.Thread.Sleep(1500);
  147.                 #endregion
  148.                 #region CuartoNPC
  149.                 var mount7 = new Network.GamePackets.NpcSpawn()
  150.                 {
  151.                     UID = 65827,
  152.                     Mesh = 21470,
  153.                     Name = "Reinder",
  154.                     Type = Enums.NpcType.Talker,
  155.                     X = (ushort)(309),
  156.                     Y = (ushort)(293),
  157.                     MapID = 1002,
  158.                 };
  159.                 Kernel.SendSpawn(mount7);
  160.                 var mount8 = new Network.GamePackets.NpcSpawn()
  161.                 {
  162.                     UID = 65828,
  163.                     Mesh = 21470,
  164.                     Type = Enums.NpcType.Talker,
  165.                     X = (ushort)(318),
  166.                     Y = (ushort)(293),
  167.                     MapID = 1002,
  168.                 };
  169.                 Kernel.SendSpawn(mount8);
  170.                 for (int i = 0; i < 12; i++)
  171.                 {
  172.                     Enums.ConquerAngle facing = Kernel.GetAngle(mount7.X, mount7.Y, mount8.X, mount8.Y);
  173.                     MsgWalk move = new MsgWalk(true);
  174.                     move.Direction = facing;
  175.                     move.UID = mount7.UID;
  176.                     move.GroundMovementType = MsgWalk.Walk;
  177.                     Kernel.SendScreen(1002, 314, 294, move);
  178.                     Enums.ConquerAngle facing2 = Kernel.GetAngle(mount8.X, mount8.Y, mount7.X, mount7.Y);
  179.                     move.Direction = facing2;
  180.                     move.UID = mount8.UID;
  181.                     Kernel.SendScreen(1002, 314, 294, move);
  182.                 }
  183.                 System.Threading.Thread.Sleep(1700);
  184.                 update.UID = mount7.UID;
  185.                 update.Type = MsgName.Effect;
  186.                 update.TextsCount = 1;
  187.                 update.Texts.Add("zf2-e233");
  188.                 Kernel.SendScreen(1002, 314, 294, update);
  189.                 update.UID = mount8.UID;
  190.                 Kernel.SendScreen(1002, 314, 294, update);
  191.                 MonsterInformation.DropItem(3000316, 314, 294);
  192.                 System.Threading.Thread.Sleep(1500);
  193.  
  194.  
  195.                 #endregion
  196.                 #region QuintoNPC
  197.                 var mount9 = new Network.GamePackets.NpcSpawn()
  198.                 {
  199.                     UID = 65829,
  200.                     Mesh = 21470,
  201.                     Name = "Reinder",
  202.                     Type = Enums.NpcType.Talker,
  203.                     X = (ushort)(309),
  204.                     Y = (ushort)(297),
  205.                     MapID = 1002,
  206.                 };
  207.                 Kernel.SendSpawn(mount9);
  208.                 var mount10 = new Network.GamePackets.NpcSpawn()
  209.                 {
  210.                     UID = 65830,
  211.                     Mesh = 21470,
  212.                     Type = Enums.NpcType.Talker,
  213.                     X = (ushort)(318),
  214.                     Y = (ushort)(297),
  215.                     MapID = 1002,
  216.                 };
  217.                 Kernel.SendSpawn(mount10);
  218.                 for (int i = 0; i < 12; i++)
  219.                 {
  220.                     Enums.ConquerAngle facing = Kernel.GetAngle(mount9.X, mount9.Y, mount10.X, mount10.Y);
  221.                     MsgWalk move = new MsgWalk(true);
  222.                     move.Direction = facing;
  223.                     move.UID = mount9.UID;
  224.                     move.GroundMovementType = MsgWalk.Walk;
  225.                     Kernel.SendScreen(1002, 314, 297, move);
  226.                     Enums.ConquerAngle facing2 = Kernel.GetAngle(mount10.X, mount10.Y, mount9.X, mount9.Y);
  227.                     move.Direction = facing2;
  228.                     move.UID = mount10.UID;
  229.                     Kernel.SendScreen(1002, 314, 297, move);
  230.                 }
  231.                 System.Threading.Thread.Sleep(1700);
  232.                 update.UID = mount9.UID;
  233.                 update.Type = MsgName.Effect;
  234.                 update.TextsCount = 1;
  235.                 update.Texts.Add("zf2-e233");
  236.                 Kernel.SendScreen(1002, 314, 297, update);
  237.                 update.UID = mount10.UID;
  238.                 Kernel.SendScreen(1002, 314, 297, update);
  239.                 MonsterInformation.DropItem(3000316, 314, 297);
  240.                 System.Threading.Thread.Sleep(1500);
  241.                 #endregion
  242.                 var mountend = new Network.GamePackets.NpcSpawn()
  243.                 {
  244.                     UID = 65840,
  245.                     Mesh = 21480,
  246.                     Type = Enums.NpcType.Talker,
  247.                     X = (ushort)(313),
  248.                     Y = (ushort)(284),
  249.                     MapID = 1002,
  250.                 };
  251.                 Kernel.SendSpawn(mountend);
  252.                 for (int i = 0; i < 21; i++)
  253.                 {
  254.                     Enums.ConquerAngle facing = Kernel.GetAngle(mountend.X, mountend.Y, 313, 300);
  255.                     MsgWalk move = new MsgWalk(true);
  256.                     move.Direction = facing;
  257.                     move.UID = mountend.UID;
  258.                     move.GroundMovementType = MsgWalk.Walk;
  259.                     Kernel.SendScreen(1002, 313, 290, move);
  260.  
  261.                 }
  262.                 System.Threading.Thread.Sleep(1500);
  263.                 MonsterInformation.DropItem(3000316, 313, 285);
  264.                 System.Threading.Thread.Sleep(1500);
  265.                 MonsterInformation.DropItem(3000316, 314, 288);
  266.                 System.Threading.Thread.Sleep(1500);
  267.                 MonsterInformation.DropItem(3000316, 313, 290);
  268.                 System.Threading.Thread.Sleep(1500);
  269.                 MonsterInformation.DropItem(3000316, 314, 294);
  270.                 System.Threading.Thread.Sleep(1500);
  271.                 MonsterInformation.DropItem(3000316, 314, 297);
  272.                 mount1.X = mount2.X = mount3.X = mount4.X = mount5.X = mount6.X = mount7.X = mount8.X = mount9.X = mount10.X = mountend.X = 900;
  273.  
  274.  
  275.                 Kernel.SendScreen(1002, 313, 290, mount1);
  276.                 Kernel.SendScreen(1002, 313, 290, mount2);
  277.                 Kernel.SendScreen(1002, 313, 290, mount3);
  278.                 Kernel.SendScreen(1002, 313, 290, mount4);
  279.                 Kernel.SendScreen(1002, 313, 290, mount5);
  280.                 Kernel.SendScreen(1002, 313, 290, mount6);
  281.                 Kernel.SendScreen(1002, 313, 290, mount7);
  282.                 Kernel.SendScreen(1002, 313, 290, mount8);
  283.                 Kernel.SendScreen(1002, 313, 290, mount9);
  284.                 Kernel.SendScreen(1002, 313, 290, mount10);
  285.                 Kernel.SendScreen(1002, 313, 290, mountend);
  286.  
  287.             });
  288.         }
  289.  
  290. =============================================================
  291. Kernel
  292.  
  293.  public static void SendScreen(ushort MapID, ushort X, ushort Y, Interfaces.IPacket packet)
  294.         {
  295.             var Values = Server.GamePool;
  296.             foreach (var pClient in Values)
  297.             {
  298.                 if (pClient == null) continue;
  299.                 if (!pClient.Socket.Alive) continue;
  300.                 if (pClient.Player.MapID != MapID) continue;
  301.                 if (Kernel.GetDistance(pClient.Player.X, pClient.Player.Y, X, Y) > Constants.pScreenDistance) continue;
  302.                 pClient.Send(packet);
  303.             }
  304.         }
  305.         internal static void SendSpawn(Interfaces.IMapObject item)
  306.         {
  307.             foreach (Client.GameState client in Server.GamePool)
  308.                 if (client != null)
  309.                     if (client.Map.ID == item.MapID)
  310.                         if (GetDistance(item.X, item.Y, client.Player.X, client.Player.Y) <= Constants.pScreenDistance)
  311.                             item.SendSpawn(client);
  312.         }
  313. ===============================================================
  314. MonsterTable
  315.    public static void DropItem(uint ItemID, ushort X, ushort Y)
  316.         {
  317.             var Item = new Network.GamePackets.MsgItemInfo(true);
  318.             Item.ID = ItemID;
  319.             if (Kernel.Maps[1002].SelectCoordonates(ref X, ref Y))
  320.             {
  321.                 Item.Color = (Game.Enums.Color)Kernel.Random.Next(4, 8);
  322.                 Item.MaximDurability = 65355;
  323.                 Item.Durability = Item.MaximDurability;
  324.                 Item.MobDropped = true;
  325.                 MsgMapItem floorItem = new MsgMapItem(true);
  326.                 floorItem.Item = new MsgItemInfo(true);
  327.                 floorItem.Item.Color = Item.Color;
  328.                 floorItem.Item.Durability = Item.Durability;
  329.                 floorItem.Item.ID = Item.ID;
  330.                 floorItem.Item.Mode = Game.Enums.ItemMode.Default;
  331.                 floorItem.Item.UID = MsgItemInfo.ItemUID.Next;
  332.                 floorItem.UID = floorItem.Item.UID;
  333.  
  334.                 floorItem.Item.MobDropped = true;
  335.                 floorItem.ItemColor = Item.Color;
  336.                 floorItem.ItemID = Item.ID;
  337.                 while (Kernel.Maps[1002].Npcs.ContainsKey(floorItem.UID))
  338.                     floorItem.UID = Network.GamePackets.MsgMapItem.FloorUID.Next;
  339.  
  340.                 floorItem.MapID = Kernel.Maps[1002].ID;
  341.                 floorItem.MapObjType = Game.MapObjectType.Item;
  342.                 floorItem.X = X;
  343.                 floorItem.Y = Y;
  344.                 floorItem.Type = MsgMapItem.Drop;
  345.                 floorItem.OnFloor = Time32.Now;
  346.                 Kernel.SendSpawn(floorItem);
  347.                 Kernel.Maps[1002].AddFloorItem(floorItem);
  348.             }
  349.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement