private void WorldTournaments(int time)
#region HeroOFGame [30] if (DateTime.Now.Minute == 30) { HeroOfGame.CheakUp(); } #endregion
public HeroOfGame HeroOfGame = new HeroOfGame();
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using MrHassan.Network.GamePackets; namespace MrHassan.Game.Features.Tournaments { public class HeroOfGame { public HeroOfGame() { open = false; } public void CheakUp() { if (Emprator_Times.Start.HeroOfGame && !open) { Start(); } } uint Secounds = 0; private IDisposable Subscribe; bool open = false; bool SendInvitation = false; public void Start() { if (!open) { Secounds = 0; SendInvitation = false; open = true; Subscribe = World.Subscribe(Work, 1000); } } public void SendMapMessaj(string packet) { var data = new Network.GamePackets.Message(packet, System.Drawing.Color.Yellow, Network.GamePackets.Message.Center); var MapDictionary = Kernel.GamePool.Values.Where(p => p.Entity.MapID == 1507).ToArray(); foreach (var client in MapDictionary) { client.Send(data); } } public int CkeckUPAlive() { int Count = 0; var MapDictionary = Kernel.GamePool.Values.Where(p => p.Entity.MapID == 1507).ToArray(); foreach (var client in MapDictionary) { if (client.Entity.Hitpoints > 0) Count++; } return Count; } public void Close() { open = false; Subscribe.Dispose(); } public void Work(int time) { if (!SendInvitation) { foreach (var client in Kernel.GamePool.Values) { client.MessageBox("Hero OF Game has begun! Would you like to join?", (p) => { if (open) { p.Entity.Teleport(1507, 96, 113); client.Entity.RemoveFlag(Update.Flags.Ride); } }, null, 40); } SendInvitation = true; } else { if (open) { if (Secounds == 30) SendMapMessaj("Hero Of Game will start in 30 Secounds"); else if (Secounds == 40) SendMapMessaj("Hero Of Game will start in 20 Secounds"); else if (Secounds == 50) SendMapMessaj("Hero Of Game will start in 10 Secounds"); else if (Secounds == 55) SendMapMessaj("Hero Of Game will start in 5 Secounds"); else if (Secounds == 58) SendMapMessaj("Hero Of Game will start in 3 Secounds"); else if (Secounds == 60) { var MapDictionary = Kernel.GamePool.Values.Where(p => p.Entity.MapID == 1507).ToArray(); foreach (var client in MapDictionary) { client.Entity.AllowToAttack = true; } SendMapMessaj("Fight !"); } else if (Secounds > 60) { byte[] Messaje = new Network.GamePackets.Message("Alive Entitys : [ " + CkeckUPAlive() + " ]", System.Drawing.Color.Yellow, Network.GamePackets.Message.FirstRightCorner).ToArray(); var MapDictionar = Kernel.GamePool.Values.Where(p => p.Entity.MapID == 1507).ToArray(); foreach (var client in MapDictionar) client.Send(Messaje); if (CkeckUPAlive() == 1) { var client = Kernel.GamePool.Values.SingleOrDefault(p => p.Entity.MapID == 1507 && p.Entity.Hitpoints > 0); if (client != null) { Game.Statue statue = new Statue(client.Entity.SpawnPacket); statue = new Statue(client.Entity.SpawnPacket, 105177, Enums.ConquerAction.Cool, (byte)Enums.ConquerAngle.SouthWest, 309, 244, true); statue = new Statue(client.Entity.SpawnPacket, 105177, Enums.ConquerAction.Wave, (byte)Enums.ConquerAngle.SouthEast, 304, 372, true); client.Entity.ConquerPoints += 4000; client.Entity.BoundCps += 2500; client.Entity.AddTopStatus(Update.Flags2.Top3Trojan, 2, DateTime.Now.AddMinutes(59)); Kernel.SendWorldMessage(new Message("Congratulation " + client.Entity.Name + " win the Hero OF Game, he receice " + rates.heroofgame + " [4000] Conquerpoints & [2.500] CpsBound ", Color.White, Message.BroadcastMessage), Program.Values); Close(); } foreach (var Entity in Kernel.GamePool.Values) { if (Entity.Entity.MapID == 1507) Entity.Entity.Teleport(1002, 301, 278, false); Entity.Entity.AllowToAttack = false; } } else if (CkeckUPAlive() == 0) { Close(); } } Secounds++; } } } } }
public class Start
public static bool HeroOfGame { get { return now.Minute == 30; } }
public static void MessageWeb(string WebSite, GameState clienthoda)
public class rates
public static uint heroofgame;
public static void Load(IniFile IniFile)
heroofgame = IniFile.ReadUInt32("Rates", "heroofgame");
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.Concurrent; namespace MrHassan.Game { public class Statue : Network.Writer { public static ConcurrentDictionary<uint, Statue> Statues = new ConcurrentDictionary<uint, Statue>(); public byte[] SpawnPacket = null; public uint UID; public Statue(byte[] array, uint uid = 105175, uint action = Enums.ConquerAction.Sit, byte facing = (byte)Enums.ConquerAngle.South, ushort xx = 381, ushort yy = 242, bool war = false) { UID = uid; if (war) { do { Statues.Remove(UID); } while (Statues.ContainsKey(UID)); } SpawnPacket = new byte[array.Length]; for (ushort x = 0; x < array.Length; x++) SpawnPacket[x] = array[x]; WriteByte(facing, Game.Entity._Facing, SpawnPacket); WriteUInt32(action, Game.Entity._Action, SpawnPacket); WriteUInt16(1000, Game.Entity._GuildRank, SpawnPacket); WriteUInt32(105175, Game.Entity._UID, SpawnPacket); //clear all flags WriteUInt64(0, Game.Entity._StatusFlag, SpawnPacket); WriteUInt64(0, Game.Entity._StatusFlag2, SpawnPacket); WriteUInt64(0, Game.Entity._StatusFlag2, SpawnPacket); WriteUInt32(0, Game.Entity._Hitpoints, SpawnPacket); WriteUInt32(0, Game.Entity._GuildID, SpawnPacket); X = xx; Y = yy; if (array.Length > 200) { if (!Statues.ContainsKey(UID)) Statues.TryAdd(UID, this); else { Statues[UID] = this; } } foreach (var client in Kernel.GamePool.Values) { if (Kernel.GetDistance(X, Y, client.Entity.X, client.Entity.Y) < 16 && client.Entity.MapID == 1002) { client.Send(this.SpawnPacket); } } } ushort _x, _y; public ushort X { get { return _x; } set { _x = value; WriteUInt16(value, Game.Entity._X, SpawnPacket); } } public ushort Y { get { return _y; } set { _y = value; WriteUInt16(value, Game.Entity._Y, SpawnPacket); } } public static bool operator >(Statue statue, Client.GameState client) { if (!client.Screen.Statue.ContainsKey(statue.UID)) { if (Kernel.GetDistance(statue.X, statue.Y, client.Entity.X, client.Entity.Y) < 16 && client.Entity.MapID == 1002) { if (statue.SpawnPacket.Length > 200)//check if is created! { client.Send(statue.SpawnPacket); return true; } } } return false; } public static bool operator <(Statue statue, Client.GameState client) { if (Kernel.GetDistance(statue.X, statue.Y, client.Entity.X, client.Entity.Y) >= 16 && client.Entity.MapID == 1002) { return true; } return false; } } }