Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 27.87 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using Conquer_Online_Server.Network;
  6. using Conquer_Online_Server.Database;
  7. using Conquer_Online_Server.Network.Sockets;
  8. using Conquer_Online_Server.Network.AuthPackets;
  9. using Conquer_Online_Server.Game;
  10. using System.Collections.Generic;
  11. using System.Runtime.InteropServices;
  12. using System.Text;
  13. using Conquer_Online_Server.Network.GamePackets;
  14. using Conquer_Online_Server.Client;
  15. using System.Diagnostics;
  16. using System.Threading.Tasks;
  17. using System.Threading;
  18. using Conquer_Online_Server;
  19.  
  20. namespace Conquer_Online_Server
  21. {
  22.     class Program
  23.     {
  24.         #region Statics and Def's
  25.         public static Encoding Encoding = ASCIIEncoding.Default;
  26.         [DllImport("user32.dll")]
  27.         public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  28.         [DllImport("user32.dll")]
  29.         public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
  30.         public static bool cycolne = false;
  31.         public static bool cycolne1 = false;
  32.         public static int PlayerCap = 400;
  33.         public static bool ALEXPC = false;
  34.         public static bool NemesisTyrantSpanwed = false;
  35.         public static long MaxOn = 0;
  36.         public static long MaxPlayers = 0;
  37.         public static ServerSocket AuthServer;
  38.         public static bool CpuUsageTimer = true;
  39.         public static MemoryCompressor MCompressor = new MemoryCompressor();
  40.         public static int CpuUse = 0;
  41.         public static ServerSocket GameServer;
  42.         public static Counter EntityUID;
  43.         public static string GameIP;
  44.         public static bool SpookAlive = false;
  45.         public static DayOfWeek Today;
  46.         public static ushort GamePort;
  47.         public static ushort AuthPort;
  48.         public static DateTime StartDate;
  49.         public static bool reseted = false;
  50.         public static uint ScreenColor = 0;
  51.         public static DateTime RestartDate = DateTime.Now.AddHours(24);
  52.         public static bool restarted = false;
  53.         public static bool WarEnd = false;
  54.         public static bool uniquepk = false;
  55.         public static uint mess = 0;
  56.         public static World World;
  57.         public static Client.GameState[] GamePool = new Client.GameState[0];
  58.         public static Client.GameState[] Values = new Client.GameState[0];
  59.         public static VariableVault Vars;
  60.         public static long WeatherType = 0L;
  61.         public static bool TestingMode = false;
  62.         public static bool AllTest = false;
  63.         public static int RandomSeed = 0;
  64.         #endregion
  65.         public static void Main(string[] args)
  66.         {//uda
  67.             Time32 Start = Time32.Now;
  68.             RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2));
  69.             Kernel.Random = new FastRandom(RandomSeed);
  70.             StartDate = DateTime.Now;
  71.             Console.Title = "Conquer Online Server Emulator. Start time: " + StartDate.ToString("dd MM yyyy hh:mm");
  72.             Console.BackgroundColor = ConsoleColor.Red;
  73.             Console.ForegroundColor = ConsoleColor.White;
  74.             Console.WriteLine("-- This source has been writen by Bagu Alexandru. --");
  75.             Console.WriteLine("--     And Edited by Sheko Hex [Shady Khalifa]    --");
  76.             Console.WriteLine("--    Copyright (c) Bagu Alexandru 2008-2016.     --");
  77.             Console.WriteLine("-- Source created with the help of all mighty God.--");
  78.             Console.BackgroundColor = ConsoleColor.Black;
  79.             Console.ForegroundColor = ConsoleColor.White;
  80.             string ConfigFileName = "configuration.ini";
  81.             IniFile IniRates = new IniFile("ServerRates.ini");
  82.             IniFile IniFile = new IniFile(ConfigFileName);
  83.             GameIP = IniFile.ReadString("configuration", "IP");
  84.             GamePort = IniFile.ReadUInt16("configuration", "GamePort");
  85.             AuthPort = IniFile.ReadUInt16("configuration", "AuthPort");
  86.             Constants.ServerName = "Zegor";
  87.             string user, pass, db;
  88.             user = IniFile.ReadString("MySql", "Username");
  89.             pass = IniFile.ReadString("MySql", "Password");
  90.             db = IniFile.ReadString("MySql", "Database");
  91.             #region Database Contacting..
  92.             Database.DataHolder.CreateConnection("localhost", user, pass, db);
  93.             EntityUID = new Counter(0);
  94.             using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
  95.             {
  96.                 cmd.Select("configuration").Where("Server", Constants.ServerName);
  97.                 using (MySqlReader r = new MySqlReader(cmd))
  98.                 {
  99.                     if (r.Read())
  100.                     {
  101.                         Network.GamePackets.UnionPacket.UnionCounter =
  102.                         new Conquer_Online_Server.Counter(r.ReadUInt32("UnionID"));
  103.                         EntityUID = new Counter(r.ReadUInt32("EntityID"));
  104.                         Game.ConquerStructures.Society.Guild.GuildCounter = new Conquer_Online_Server.Counter(r.ReadUInt32("GuildID"));
  105.                         ConquerItem.ItemUID = new Counter(r.ReadUInt32("ItemUID"));
  106.                         Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate");
  107.                         Constants.ExtraSpellRate = r.ReadUInt32("ProficiencyExperienceRate");
  108.                         Constants.ExtraProficiencyRate = r.ReadUInt32("SpellExperienceRate");
  109.                         Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate");
  110.                         Constants.MoneyDropMultiple = r.ReadUInt32("MoneyDropMultiple");
  111.                         Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate");
  112.                         Constants.ConquerPointsDropMultiple = r.ReadUInt32("ConquerPointsDropMultiple");
  113.                         Constants.ItemDropRate = r.ReadUInt32("ItemDropRate");
  114.                         Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~');
  115.                         Constants.WebAccExt = r.ReadString("AccountWebExt");
  116.                         Constants.WebVoteExt = r.ReadString("VoteWebExt");
  117.                         Constants.WebDonateExt = r.ReadString("DonateWebExt");
  118.                         Constants.ServerWebsite = r.ReadString("ServerWebsite");
  119.                         Constants.ServerGMPass = r.ReadString("ServerGMPass");
  120.                         PlayerCap = r.ReadInt32("PlayerCap");
  121.                         Database.EntityVariableTable.Load(0, out Vars);
  122.                     }
  123.                 }
  124.             }
  125.             if (EntityUID.Now == 0)
  126.             {
  127.                 Console.Clear();
  128.                 Console.WriteLine("Database error. Please check your MySQL. Server will now close.");
  129.                 Console.ReadLine();
  130.                 return;
  131.             }
  132.             #endregion
  133.  
  134.             {
  135.                 Console.WriteLine("Loading Server Now.");
  136.                 World = new World();
  137.                 Database.ConquerItemInformation.Load();
  138.                 Database.ConquerItemTable.ClearNulledItems();
  139.                 Database.MonsterInformation.Load();
  140.                 Database.MapsTable.Load();
  141.                 ClientSystem.SoulProtection.Load();
  142.                 Map.CreateTimerFactories();
  143.                 Database.DMaps.Load();
  144.                 InnerPowerTable.LoadDBInformation();
  145.                 InnerPowerTable.Load();
  146.                 PrizeNpcTable.Load();
  147.                 {
  148.                     ClientSystem.Reward.Load();
  149.                     ClientSystem.QuestInfo.Load();
  150.                     Database.helpdesk.LoadRates();
  151.                     Database.VipTable.LoadAllVips();
  152.                     Database.GameUpdatess.LoadRates();
  153.                     Database.SpellTable.Load();
  154.                     Database.ShopFile.Load();
  155.                     Database.HonorShop.Load();
  156.                     Database.RacePointShop.Load();
  157.                     Database.ChampionShop.Load();
  158.                     Database.EShopFile.Load();
  159.                     Database.EShopV2File.Load();
  160.                     StorageManager.Load();
  161.                     Database.AddingInformationTable.Load();
  162.                     Database.LotteryTable.Load();
  163.                     Database.vipLottery.Load();
  164.                     Database.PoketTables.LoadTables();
  165.                     ClientSystem.Roulette.Database.Roulettes.Load();
  166.                     ClientSystem.Way2Heroes.Load();
  167.                     Database.ConquerItemTable.ClearNulledItems();
  168.                     Kernel.QuizShow = new Game.ConquerStructures.QuizShow();
  169.                     Refinery.Load();
  170.                     Values = new Client.GameState[0];
  171.                     Game.ClanWar.Initiate();
  172.                     Game.EliteGuildWar.EliteGwint();
  173.                     Database.Furniture.Load();
  174.                     ClientSystem.House.LoadHouses();
  175.  
  176.                 }
  177.                 Flowers.LoadFlowers();
  178.                 Database.DataHolder.ReadStats();
  179.                 Database.IPBan.Load();
  180.                 Database.JiangHu.LoadStatus();
  181.                 Database.JiangHu.LoadJiangHu();
  182.                 Database.UnionTable.Load();
  183.                 Database.NobilityTable.Load();
  184.                 Database.ArenaTable.Load();
  185.                 Database.TeamArenaTable.Load();
  186.                 Database.ChampionTable.Load();
  187.                 Database.GuildTable.Load();
  188.                 Database.ChiTable.LoadAllChi();
  189.                 Clan.LoadClans();
  190.                 Game.Screen.CreateTimerFactories();
  191.                 Network.Cryptography.AuthCryptography.PrepareAuthCryptography();
  192.                 World.CreateTournaments();
  193.                 World.Init();
  194.  
  195.                 new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Execute();
  196.                 {
  197.                     AuthServer = new ServerSocket();
  198.                     AuthServer.OnClientConnect += AuthServer_OnClientConnect;
  199.                     AuthServer.OnClientReceive += AuthServer_OnClientReceive;
  200.                     AuthServer.OnClientDisconnect += AuthServer_OnClientDisconnect;
  201.                     AuthServer.Enable(AuthPort, GameIP);
  202.                 }
  203.  
  204.  
  205.                 {
  206.                     GameServer = new ServerSocket();
  207.                     GameServer.OnClientConnect += GameServer_OnClientConnect;
  208.                     GameServer.OnClientReceive += GameServer_OnClientReceive;
  209.                     GameServer.OnClientDisconnect += GameServer_OnClientDisconnect;
  210.                     GameServer.Enable(GamePort, GameIP);
  211.                     Console.WriteLine("Auth server online.");
  212.                     Console.WriteLine("Game server online.");
  213.                     _handler += new EventHandler(Handler);
  214.                     SetConsoleCtrlHandler(_handler, true);
  215.                     ClientSystem.Pet.CreateTimerFactories();
  216.                     ClientSystem.AI.CreateTimerFactories();
  217.                     ClientSystem.ClientSystemMob.CreateTimerFactories();
  218.                     var client = new GameState(null);
  219.                     client.Entity = new Entity(EntityFlag.Monster, false);
  220.                     client.Entity.MapID = 1002;
  221.                     Npcs npc = new Npcs(client);
  222.                     var req = new NpcRequest();
  223.                     req.Deserialize(new byte[28]);
  224.                     Npcs.GetDialog(req, client);
  225.                     client = null;
  226.                     Conquer_Online_Server.ServerSystem.Booths.Load();
  227.                 }
  228.                 GameState.LoadBoothingAI();
  229.                 float Time = (Time32.Now - Start).Value;
  230.                 float ServerLoadedTime = Time;
  231.                 Console.WriteLine("Server Is Online Now !");
  232.                 Console.WriteLine(@"On IP : " + GameIP + ":" + AuthPort);
  233.                 Console.WriteLine("Server loaded in " + (ServerLoadedTime‬) + " ms");
  234.                 Console.WriteLine("");
  235.                 Program.MCompressor.Optimize();
  236.                 GC.Collect();
  237.                 WorkConsole();
  238.             }
  239.         }
  240.  
  241.         private static void WorkConsole()
  242.         {
  243.             while (true)
  244.             {
  245.                 try
  246.                 {
  247.                     CommandsAI(Console.ReadLine());
  248.                 }
  249.                 catch (Exception e) { Console.WriteLine(e); }
  250.             }
  251.         }
  252.         public static DateTime LastRandomReset = DateTime.Now;
  253.         public static Network.GamePackets.BlackSpotPacket BlackSpotPacket = new Network.GamePackets.BlackSpotPacket();
  254.         public static bool MyPC = true;
  255.  
  256.         public static void CommandsAI(string command)
  257.         {
  258.             try
  259.             {
  260.                 if (command == null)
  261.                     return;
  262.                 string[] data = command.Split(' ');
  263.                 switch (data[0])
  264.                 {
  265.                    //No Commands For Now
  266.                 }
  267.             }
  268.             catch (Exception e)
  269.             {
  270.                 Console.WriteLine(e.ToString());
  271.             }
  272.         }
  273.         public static void WriteLine(string Line)
  274.         {
  275.             try
  276.             {
  277.                 Console.WriteLine(Line);
  278.             }
  279.             catch { }
  280.         }
  281.         public static void HandleClipboardPacket(string cmd)
  282.         {
  283.             string[] pData = cmd.Split(' ');
  284.             long off = 0, type = 0, val = 0;
  285.             if (pData.Length > 1)
  286.             {
  287.                
  288.                 string[] oData = pData[1].Split(':');
  289.                 if (oData.Length == 3)
  290.                 {
  291.                     off = long.Parse(oData[0]);
  292.                     type = long.Parse(oData[1]);
  293.                     if (oData[2] == "u")
  294.                         val = 1337;
  295.                     else
  296.                         val = long.Parse(oData[2]);
  297.                 }
  298.             }
  299.            
  300.             string[] num = Data.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
  301.             byte[] packet = new byte[num.Length + 8];
  302.             for (int i = 0; i < num.Length; i++)
  303.                 packet[i] = byte.Parse(num[i], System.Globalization.NumberStyles.HexNumber);
  304.             Writer.WriteUInt16((ushort)(packet.Length - 8), 0, packet);
  305.             if (off != 0)
  306.             {
  307.                 switch (type)
  308.                 {
  309.                     case 1:
  310.                         {
  311.                             packet[(int)off] = (byte)val;
  312.                             break;
  313.                         }
  314.                     case 2:
  315.                         {
  316.                             Writer.WriteUInt16((ushort)val, (int)off, packet);
  317.                             break;
  318.                         }
  319.                     case 4:
  320.                         {
  321.                             Writer.WriteUInt32((uint)val, (int)off, packet);
  322.                             break;
  323.                         }
  324.                     case 8:
  325.                         {
  326.                             Writer.WriteUInt64((ulong)val, (int)off, packet);
  327.                             break;
  328.                         }
  329.                 }
  330.             }
  331.             foreach (var client in Program.Values)
  332.             {
  333.                 if (val == 1337 && type == 4)
  334.                     Writer.WriteUInt32(client.Entity.UID, (int)off, packet);
  335.                 client.Send(packet);
  336.             }
  337.         }
  338.         static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
  339.         {
  340.             if (obj.Connector == null)
  341.             {
  342.                 obj.Disconnect();
  343.                 return;
  344.             }
  345.             Client.GameState Client = obj.Connector as Client.GameState;
  346.             if (Client.Exchange)
  347.             {
  348.                 Client.Exchange = false;
  349.                 Client.Action = 1;
  350.                 var crypto = new Network.Cryptography.GameCryptography(System.Text.Encoding.Default.GetBytes(Constants.GameCryptographyKey));
  351.                 byte[] otherData = new byte[length];
  352.                 Array.Copy(buffer, otherData, length);
  353.                 crypto.Decrypt(otherData, length);
  354.  
  355.                 bool extra = false;
  356.                 int pos = 0;
  357.                 if (BitConverter.ToInt32(otherData, length - 140) == 128)//no extra packet
  358.                 {
  359.                     pos = length - 140;
  360.                     Client.Cryptography.Decrypt(buffer, length);
  361.                 }
  362.                 else if (BitConverter.ToInt32(otherData, length - 176) == 128)//extra packet
  363.                 {
  364.                     pos = length - 176;
  365.                     extra = true;
  366.                     Client.Cryptography.Decrypt(buffer, length - 36);
  367.                 }
  368.                 int len = BitConverter.ToInt32(buffer, pos); pos += 4;
  369.                 if (len != 128)
  370.                 {
  371.                     Client.Disconnect();
  372.                     return;
  373.                 }
  374.                 byte[] pubKey = new byte[128];
  375.                 for (int x = 0; x < len; x++, pos++) pubKey[x] = buffer[pos];
  376.  
  377.                 string PubKey = System.Text.Encoding.Default.GetString(pubKey);
  378.                 Client.Cryptography = Client.DHKeyExchange.HandleClientKeyPacket(PubKey, Client.Cryptography);
  379.  
  380.                 if (extra)
  381.                 {
  382.                     byte[] data = new byte[36];
  383.                     Buffer.BlockCopy(buffer, length - 36, data, 0, 36);
  384.                     processData(data, 36, Client);
  385.                 }
  386.             }
  387.             else
  388.             {
  389.                 processData(buffer, length, Client);
  390.             }
  391.         }
  392.         private static void processData(byte[] buffer, int length, Client.GameState Client)
  393.         {
  394.             Client.Cryptography.Decrypt(buffer, length);
  395.             Client.Queue.Enqueue(buffer, length);
  396.             if (Client.Queue.CurrentLength > 1224)
  397.             {
  398.                 Console.WriteLine("[Disconnect]Reason:The packet size is too big. " + Client.Queue.CurrentLength);
  399.                 Client.Disconnect();
  400.                 return;
  401.             }
  402.             while (Client.Queue.CanDequeue())
  403.             {
  404.                 byte[] data = Client.Queue.Dequeue();
  405.                 Network.PacketHandler.HandlePacket(data, Client);
  406.             }
  407.         }
  408.         static void GameServer_OnClientConnect(ClientWrapper obj)
  409.         {
  410.             Client.GameState client = new Client.GameState(obj);
  411.             client.Send(client.DHKeyExchange.CreateServerKeyPacket());
  412.             obj.Connector = client;
  413.         }
  414.         static void GameServer_OnClientDisconnect(ClientWrapper obj)
  415.         {
  416.             if (obj.Connector != null)
  417.                 (obj.Connector as Client.GameState).Disconnect();
  418.             else
  419.                 obj.Disconnect();
  420.         }
  421.         static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
  422.         {
  423.             var player = arg3.Connector as Client.AuthClient;
  424.  
  425.             player.Cryptographer.Decrypt(buffer, length);
  426.  
  427.             player.Queue.Enqueue(buffer, length);
  428.             while (player.Queue.CanDequeue())
  429.             {
  430.                 byte[] packet = player.Queue.Dequeue();
  431.  
  432.                 ushort len = BitConverter.ToUInt16(packet, 0);
  433.                 ushort id = BitConverter.ToUInt16(packet, 2);
  434.                 if (len == 312)
  435.                 {
  436.  
  437.                     player.Info = new Authentication();
  438.                     player.Info.Deserialize(packet);
  439.                     player.Account = new AccountTable(player.Info.Username);
  440.                     msvcrt.msvcrt.srand(player.PasswordSeed);
  441.  
  442.                     Forward Fw = new Forward();
  443.  
  444.  
  445.                     if (player.Account.Password == player.Info.Password && player.Account.exists)
  446.                         Fw.Type = Forward.ForwardType.Ready;
  447.                     else
  448.                         Fw.Type = Forward.ForwardType.InvalidInfo;
  449.  
  450.  
  451.                     if (IPBan.IsBanned(arg3.IP))
  452.                     {
  453.                         Fw.Type = Forward.ForwardType.Banned;
  454.                         player.Send(Fw);
  455.                         return;
  456.                     }
  457.  
  458.                     if (Fw.Type == Network.AuthPackets.Forward.ForwardType.Ready)
  459.                     {
  460.                         Fw.Identifier = player.Account.GenerateKey();
  461.                         Kernel.AwaitingPool[Fw.Identifier] = player.Account;
  462.                         Fw.IP = GameIP;
  463.                         Fw.Port = GamePort;
  464.                     }
  465.  
  466.                     player.Send(Fw);
  467.                 }
  468.             }
  469.         }
  470.  
  471.         static void AuthServer_OnClientDisconnect(ClientWrapper obj)
  472.         {
  473.             obj.Disconnect();
  474.         }
  475.  
  476.         static void AuthServer_OnClientConnect(ClientWrapper obj)
  477.         {
  478.             Client.AuthClient authState;
  479.             obj.Connector = (authState = new Client.AuthClient(obj));
  480.             authState.Cryptographer = new Network.Cryptography.AuthCryptography();
  481.             Network.AuthPackets.PasswordCryptographySeed pcs = new PasswordCryptographySeed();
  482.             pcs.Seed = Kernel.Random.Next();
  483.             authState.PasswordSeed = pcs.Seed;
  484.             authState.Send(pcs);
  485.         }
  486.  
  487.         internal static Client.GameState FindClient(string name)
  488.         {
  489.             return Values.FirstOrDefault(p => p.Entity.Name == name);
  490.         }
  491.         internal static void WriteLine(string p, ushort MsgId, short p_2)
  492.         {
  493.             throw new NotImplementedException();
  494.         }
  495.     }
  496.  
  497.     public class ClientSystem_Times
  498.     {
  499.         public static DateTime now
  500.         {
  501.             get
  502.             {
  503.                 return DateTime.Now;
  504.             }
  505.         }
  506.  
  507.         public class Start
  508.         {
  509.             public static bool KingsTime
  510.             {
  511.                 get
  512.                 {
  513.                     return (now.Hour >= 00 && now.Hour < 24);
  514.                 }
  515.             }
  516.  
  517.             public static bool SkyWar
  518.             {
  519.                 get
  520.                 {
  521.                     return (now.Hour == 1 || now.Hour == 13) && now.Minute == 10 && now.Second == 1;
  522.                 }
  523.             }
  524.  
  525.             public static bool TheTeam
  526.             {
  527.                 get
  528.                 {
  529.                     return (now.Hour == 14 || now.Hour == 2) && now.Minute == 10 && now.Second == 1;
  530.                 }
  531.             }
  532.  
  533.  
  534.             public static bool ClanWar
  535.             {
  536.                 get
  537.                 {
  538.                     return now.Minute == 30;
  539.                 }
  540.             }
  541.             public static bool EliteGW
  542.             {
  543.                 get
  544.                 {
  545.                     return (now.Minute == 0);
  546.                 }
  547.             }
  548.             public static bool SkillTeam
  549.             {
  550.                 get
  551.                 {
  552.                     return (now.Hour == 22) && now.Minute == 1;
  553.                 }
  554.             }
  555.             public static bool TeamPK
  556.             {
  557.                 get
  558.                 {
  559.                     return (now.Hour == 19) && now.Minute == 1;
  560.                 }
  561.             }
  562.  
  563.             public static bool CTF
  564.             {
  565.                 get
  566.                 {
  567.                     return now.Hour == 19;
  568.                 }
  569.             }
  570.             //public static bool TwinWar
  571.             //{
  572.             //    get
  573.             //    {
  574.             //        return (now.Hour == 7 || now.Hour == 19) && now.Minute >= 1;
  575.             //    }
  576.             //}
  577.             public static bool NobiltyWarPole
  578.             {
  579.                 get
  580.                 {
  581.                     return (now.DayOfWeek == DayOfWeek.Wednesday && now.Hour == 23 && now.Minute == 0);
  582.                 }
  583.             }
  584.  
  585.             public static bool GuildPoleWar
  586.             {
  587.                 get
  588.                 {
  589.                     return (now.DayOfWeek == DayOfWeek.Sunday && now.Hour == 21 && now.Minute == 0);
  590.                 }
  591.             }
  592.  
  593.             //public static bool CrossServer
  594.             // {
  595.             //get
  596.             // {
  597.             //   return now.Hour == 22 || now.Hour == 10;
  598.             //}
  599.             // }
  600.             public static bool PoleDomnation
  601.             {
  602.                 get
  603.                 {
  604.                     return (now.DayOfWeek == DayOfWeek.Saturday && now.Hour == 16 && now.Minute == 0);
  605.                 }
  606.             }
  607.  
  608.             public static bool ClanWarArena2
  609.             {
  610.                 get
  611.                 {
  612.                     return (now.Hour == 22 && now.Minute == 25);
  613.                 }
  614.             }
  615.             public static bool ClanWarArena
  616.             {
  617.                 get
  618.                 {
  619.                     return (now.Hour == 22 && now.Minute == 30);
  620.                 }
  621.             }
  622.             public static bool StatuesWar
  623.             {
  624.                 get
  625.                 {
  626.                     return (now.DayOfWeek == DayOfWeek.Thursday && now.Hour == 17 && now.Minute == 0);
  627.                 }
  628.             }
  629.             public static bool GuildScoreWar
  630.             {
  631.                 get
  632.                 {
  633.                     return (now.DayOfWeek == DayOfWeek.Monday && now.Hour == 22 && now.Minute == 0);
  634.                 }
  635.             }
  636.             public static bool ClassWar
  637.             {
  638.                 get
  639.                 {
  640.                     return (now.DayOfWeek == DayOfWeek.Saturday && now.Hour == 21 && now.Minute == 0);
  641.                 }
  642.             }
  643.  
  644.  
  645.  
  646.             ///////////////////////////////////////////////
  647.  
  648.             public static bool HeroOfGame
  649.             {
  650.                 get
  651.                 {
  652.                     return now.Minute == 30;
  653.                 }
  654.             }
  655.             public static bool FBSS
  656.             {
  657.                 get
  658.                 {
  659.                     return now.Minute == 5;
  660.                 }
  661.             }
  662.             public static bool FBSS2
  663.             {
  664.                 get
  665.                 {
  666.                     return now.Minute >= 5 && now.Minute < 7;
  667.                 }
  668.             }
  669.  
  670.             public static int hunterthief = 42;
  671.             public static int dashbash = 46;
  672.  
  673.             public static int chase = 45;
  674.  
  675.             public static int dizzy = 49;
  676.  
  677.             public static bool Nobilty
  678.             {
  679.                 get
  680.                 {
  681.                     return now.Minute >= 20 && now.Minute <= 22;
  682.                 }
  683.             }
  684.  
  685.  
  686.         }
  687.         public class End
  688.         {
  689.             public static bool FBSS
  690.             {
  691.                 get
  692.                 {
  693.                     return now.Minute >= 8 && now.Minute <= 10;
  694.                 }
  695.             }
  696.             public static int hunterthief = 45;
  697.             public static int dashbash = 48;
  698.  
  699.             public static bool Cyclone
  700.             {
  701.                 get
  702.                 {
  703.                     return now.Minute == 29;
  704.                 }
  705.             }
  706.  
  707.             public static int chase = 45;
  708.  
  709.             public static int dizzy2 = 50;
  710.  
  711.             public static bool Nobilty
  712.             {
  713.                 get
  714.                 {
  715.                     return now.Minute >= 23 && now.Minute <= 25;
  716.                 }
  717.             }
  718.             /////////////////////
  719.  
  720.             public static bool EliteGW
  721.             {
  722.                 get
  723.                 {
  724.                     return now.Minute == 30;
  725.                 }
  726.             }
  727.             public static bool ClanWar
  728.             {
  729.                 get
  730.                 {
  731.                     return now.Minute == 00;
  732.                 }
  733.             }
  734.  
  735.         }
  736.  
  737.     }
  738.  
  739.     public class Kernel32
  740.     {
  741.         public delegate bool ConsoleEventHandler(CtrlType sig);
  742.  
  743.         public enum CtrlType
  744.         {
  745.             CTRL_C_EVENT = 0,
  746.             CTRL_BREAK_EVENT = 1,
  747.             CTRL_CLOSE_EVENT = 2,
  748.             CTRL_LOGOFF_EVENT = 5,
  749.             CTRL_SHUTDOWN_EVENT = 6
  750.         }
  751.  
  752.         [DllImport("kernel32.dll")]
  753.         public static extern bool SetConsoleCtrlHandler(ConsoleEventHandler handler, bool add);
  754.     }
  755. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement