Example #1
0
        static void CharacterThread_Execute()
        {
            Time32 Now = Time32.Now;
            foreach (Client.GameState client in Values)
            {
                if (client.Socket.Connected)
                {
                    if (client.Entity.HandleTiming)
                    {
                        #region Auto Invite Quests

                        #region Donation War
                        if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == 18 && DateTime.Now.Minute == 47 && DateTime.Now.Second == 00)
                        {
                            if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == 18 && DateTime.Now.Minute == 47 && DateTime.Now.Second == 00)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Donation War has Started! You Wana Join?");
                                npc.OptionID = 167;
                                client.Send(npc.ToArray());
                            }
                        }
                        #endregion

                        #region GuildWar Timer
                        if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday && DateTime.Now.Hour >= 13 && DateTime.Now.Minute >= 02 && DateTime.Now.Second == 00)
                        {
                            if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday && DateTime.Now.Hour >= 13 && DateTime.Now.Minute >= 02 && DateTime.Now.Second == 00)
                            {
                                if (!Game.ConquerStructures.Society.GuildWar.IsWar)
                                {
                                    Game.ConquerStructures.Society.GuildWar.Start();
                                    Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "GuildWar has Begin! You Wana Join?");
                                    npc.OptionID = 115;
                                    client.Send(npc.ToArray());
                                }

                                //ServerBase.Kernel.SendWorldMessage(new Message("", System.Drawing.Color.Red, Network.GamePackets.Message.World), ServerBase.Kernel.GamePool.Values);
                            }
                        }
                        if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == 22 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                        {
                            if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == 22 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                            {
                                if (Game.ConquerStructures.Society.GuildWar.IsWar)
                                {
                                    Game.ConquerStructures.Society.GuildWar.End();
                                }
                            }
                        }
                        #endregion

                        #region HoursPkWar GameHackerPM
                        if (DateTime.Now.Minute == 45 && DateTime.Now.Second == 00)
                        {
                            if (DateTime.Now.Minute == 45 && DateTime.Now.Second == 00)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "HoursPK War has Started! You Wana Join?");
                                npc.OptionID = 202;
                                client.Send(npc.ToArray());
                            }
                        }
                        #endregion

                        #region WeaklyPK war

                        #endregion

                        #endregion
                        #region Training points
                        if (client.Entity.HeavenBlessing > 0 && !client.Entity.Dead)
                        {
                            if (Now > client.LastTrainingPointsUp.AddMinutes(10))
                            {
                                client.OnlineTrainingPoints += 10;
                                if (client.OnlineTrainingPoints >= 30)
                                {
                                    client.OnlineTrainingPoints -= 30;
                                    client.IncreaseExperience(client.ExpBall / 100, false);
                                }
                                client.LastTrainingPointsUp = Now;
                                client.Entity.Update(Network.GamePackets.Update.OnlineTraining, client.OnlineTrainingPoints, false);
                            }
                        }
                        #endregion
                        #region Minning
                        if (client.Mining && !client.Entity.Dead)
                        {
                            if (Now >= client.MiningStamp.AddSeconds(2))
                            {
                                client.MiningStamp = Now;
                                Game.ConquerStructures.Mining.Mine(client);
                            }
                        }
                        #endregion
                        #region MentorPrizeSave
                        if (Now > client.LastMentorSave.AddSeconds(5))
                        {
                            Database.KnownPersons.SaveApprenticeInfo(client.AsApprentice);
                            client.LastMentorSave = Now;
                        }
                        #endregion
                        #region Attackable
                        if (client.JustLoggedOn)
                        {
                            client.JustLoggedOn = false;
                            client.ReviveStamp = Now;
                        }
                        if (!client.Attackable)
                        {
                            if (Now > client.ReviveStamp.AddSeconds(5))
                            {
                                client.Attackable = true;
                            }
                        }
                        #endregion
                        #region DoubleExperience
                        if (client.Entity.DoubleExperienceTime > 0)
                        {
                            if (Now > client.Entity.DoubleExpStamp.AddMilliseconds(1000))
                            {
                                client.Entity.DoubleExpStamp = Now;
                                client.Entity.DoubleExperienceTime--;
                            }
                        }
                        #endregion
                        #region HeavenBlessing
                        if (client.Entity.HeavenBlessing > 0)
                        {
                            if (Now > client.Entity.HeavenBlessingStamp.AddMilliseconds(1000))
                            {
                                client.Entity.HeavenBlessingStamp = Now;
                                client.Entity.HeavenBlessing--;
                            }
                        }
                        #endregion
                        #region Enlightment
                        if (client.Entity.EnlightmentTime > 0)
                        {
                            if (Now >= client.Entity.EnlightmentStamp.AddMinutes(1))
                            {
                                client.Entity.EnlightmentStamp = Now;
                                client.Entity.EnlightmentTime--;
                                if (client.Entity.EnlightmentTime % 10 == 0 && client.Entity.EnlightmentTime > 0)
                                    client.IncreaseExperience(Game.Attacking.Calculate.Percent((int)client.ExpBall, .10F), false);
                            }
                        }
                        #endregion
                        #region PKPoints
                        if (Now >= client.Entity.PKPointDecreaseStamp.AddMinutes(5))
                        {
                            client.Entity.PKPointDecreaseStamp = Now;
                            if (client.Entity.PKPoints > 0)
                            {
                                client.Entity.PKPoints--;
                            }
                            else
                                client.Entity.PKPoints = 0;
                        }
                        #endregion
                        #region OverHP
                        if (client.Entity.FullyLoaded)
                        {
                            if (client.Entity.Hitpoints > client.Entity.MaxHitpoints && client.Entity.MaxHitpoints > 1 && !client.Entity.Transformed)
                            {
                                client.Entity.Hitpoints = client.Entity.MaxHitpoints;
                            }
                        }
                        #endregion
                        #region Stamina
                        if (Now > client.Entity.StaminaStamp.AddMilliseconds(500))
                        {
                            if (client.Entity.Vigor < client.Entity.MaxVigor)
                            {
                                client.Entity.Vigor += (ushort)(3 + (client.Entity.Action == Game.Enums.ConquerAction.Sit ? 2 : 0));

                                {
                                    Network.GamePackets.Vigor vigor = new Network.GamePackets.Vigor(true);
                                    vigor.VigorValue = client.Entity.Vigor;
                                    vigor.Send(client);
                                }
                            }
                            if (!client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Ride) && !client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
                            {
                                int limit = 0;
                                if (client.Entity.HeavenBlessing > 0)
                                    limit = 50;
                                if (client.Entity.Stamina != 100 + limit)
                                {
                                    if (client.Entity.Action == Game.Enums.ConquerAction.Sit)
                                    {
                                        if (client.Entity.Stamina <= 93 + limit)
                                        {
                                            client.Entity.Stamina += 7;
                                        }
                                        else
                                        {
                                            if (client.Entity.Stamina != 100 + limit)
                                                client.Entity.Stamina = (byte)(100 + limit);
                                        }
                                    }
                                    else
                                    {
                                        if (client.Entity.Stamina <= 97 + limit)
                                        {
                                            client.Entity.Stamina += 3;
                                        }
                                        else
                                        {
                                            if (client.Entity.Stamina != 100 + limit)
                                                client.Entity.Stamina = (byte)(100 + limit);
                                        }
                                    }
                                }
                                client.Entity.StaminaStamp = Now;
                            }
                        }
                        #endregion
                        #region SoulShackle
                        if (client.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.SoulShackle))
                        {
                            if (Now > client.Entity.ShackleStamp.AddSeconds(90))
                            {
                                client.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.SoulShackle);
                                client.Entity.RemoveFlag2(18014398509481984);
                            }
                        }
                        #endregion
                        #region AzureShield
                        if (client.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.AzureShield))
                        {
                            if (Now > client.Entity.MagicShieldStamp.AddSeconds(client.Entity.MagicShieldTime))
                            {
                                client.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.AzureShield);
                            }
                        }
                        #endregion
                    }
                }
                //else
                //    client.Disconnect();
            }
        }
Example #2
0
        static void ServerStuff_Execute()
        {
            ServerBase.Kernel.Elite_PK_Tournament.SendThis();
            Console.Title = "Source 5620 : " + Program.StartDate.ToString("MM/dd/yyyy hh:mm") + "- Players Online: " + ServerBase.Kernel.GamePool.Count + "||" + Program.PlayerCap + " Votes =" + Kernel.VotePool.Count;
            new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration")
                .Set("GuildID", Game.ConquerStructures.Society.Guild.GuildCounter.Now)
                .Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now)
                .Set("DetainItemUID", Database.DetainedItemTable.Counter.Now).Set("ClanUID", Game.Clans.ClanCount.Now)
                .Where("Server", ServerBase.Constants.ServerName).Execute();
            ServerBase.FrameworkTimer.Dispose();

            if (DateTime.Now > Game.ConquerStructures.Broadcast.LastBroadcast.AddMinutes(1))
            {
                if (Game.ConquerStructures.Broadcast.Broadcasts.Count > 0)
                {
                    Game.ConquerStructures.Broadcast.CurrentBroadcast = Game.ConquerStructures.Broadcast.Broadcasts[0];
                    Game.ConquerStructures.Broadcast.Broadcasts.Remove(Game.ConquerStructures.Broadcast.CurrentBroadcast);
                    Game.ConquerStructures.Broadcast.LastBroadcast = DateTime.Now;
                    ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(Game.ConquerStructures.Broadcast.CurrentBroadcast.Message, "ALLUSERS", Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityName, System.Drawing.Color.Red, Network.GamePackets.Message.BroadcastMessage), ServerBase.Kernel.GamePool.Values);
                }
                else
                    Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityID = 1;
            }

            DateTime Now = DateTime.Now;
            if (DateTime.Now.Hour == 00 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 03 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 06 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 09 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 12 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 15 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 18 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 21 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
            {
                Program.CommandsAI("@save");
            }

            if (Now > LastRandomReset.AddMinutes(30))
            {
                LastRandomReset = Now;
                ServerBase.Kernel.Random = new Random(RandomSeed);
            }
            Today = Now.DayOfWeek;

            if (Now >= RestartDate)
            {
                CommandsAI("@restart");
                ServerStuff.Closed = true;
                return;
            }
            var Values = ServerBase.Kernel.WasInGamePool.Base.ToArray();
            foreach (KeyValuePair<uint, Client.GameState> vals in Values)
            {
                Client.GameState client = vals.Value;
                if (client.Disconnected2 == true)
                    return;
                if (client == null || client.Entity == null || client.Account == null)
                {
                    ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                    return;
                }
                if (!client.Socket.Connected)
                {
                    Database.EntityTable.SaveEntity(client);
                    Database.SkillTable.SaveProficiencies(client);
                    Database.SkillTable.SaveSpells(client);
                    Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                    ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                    Database.EntityTable.UpdateOnlineStatus(client, false);
                }
            }
            foreach (Client.GameState client in Kernel.GamePool.Values)
            {
                client.Account.Save();
                Database.EntityTable.SaveEntity(client);
                Database.SkillTable.SaveProficiencies(client);
                Database.SkillTable.SaveSpells(client);
                Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                //
            }
            #region remove monk buff
            foreach (Client.GameState client in Kernel.GamePool.Values)
            {
                if (client.Entity.Owner.Team != null)
                {
                    foreach (Client.GameState teammate in client.Entity.Owner.Team.Teammates)
                    {
                        if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, teammate.Entity.X, teammate.Entity.Y) > 20)
                        {
                            if (client.Entity.ContainsFlag2(Update.Flags2.TyrantAura))//FendAura
                            {
                                client.Entity.RemoveFlag2(Update.Flags2.TyrantAura);//FendAura
                                client.Entity.Statistics.CriticalStrike -= 200;
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.MetalAura))//MetalAura
                            {
                                client.Entity.RemoveFlag2(Update.Flags2.MetalAura);//MetalAura
                                client.Entity.Statistics.MetalResistance -= 30;
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.WoodAura))//WoodAura
                            {
                                client.Entity.Statistics.WoodResistance -= 30;
                                client.Entity.RemoveFlag2(Update.Flags2.WoodAura);//WoodAura
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.WaterAura))//WaterAura
                            {
                                client.Entity.Statistics.WaterResistance -= 30;
                                client.Entity.RemoveFlag2(Update.Flags2.WaterAura);//WaterAura
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.FireAura))//FireAura
                            {
                                client.Entity.Statistics.FireResistance -= 30;
                                client.Entity.RemoveFlag2(Update.Flags2.FireAura);//FireAura
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.EarthAura))//EarthAura
                            {
                                client.Entity.Statistics.EarthResistance -= 30;
                                client.Entity.RemoveFlag2(Update.Flags2.EarthAura);//EarthAura
                            }
                            if (client.Entity.ContainsFlag2(Update.Flags2.FendAura))//TyrantAura
                            {
                                client.Entity.RemoveFlag2(Update.Flags2.FendAura);//TyrantAura
                                client.Entity.Statistics.Immunity -= 200;

                            }
                            client.Entity.RemoveFlag2(Update.Flags2.FendAura);
                            client.Entity.RemoveFlag2(Update.Flags2.TyrantAura);
                            client.Entity.RemoveFlag2(Update.Flags2.MetalAura);
                            client.Entity.RemoveFlag2(Update.Flags2.WoodAura);
                            client.Entity.RemoveFlag2(Update.Flags2.WaterAura);
                            client.Entity.RemoveFlag2(Update.Flags2.FireAura);
                            client.Entity.RemoveFlag2(Update.Flags2.EarthAura);
                            client.Entity.RemoveFlag2(Update.Flags2.TyrantAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.FendAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.TyrantAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.MetalAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.WoodAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.WaterAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.FireAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.EarthAura);
                            teammate.Entity.RemoveFlag2(Update.Flags2.TyrantAura);
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.TyrantAura))//FendAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.TyrantAura);//FendAura
                                teammate.Entity.Statistics.CriticalStrike -= 200;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.MetalAura))//MetalAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.MetalAura);//MetalAura
                                teammate.Entity.Statistics.MetalResistance -= 30;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.WoodAura))//WoodAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.WoodAura);//WoodAura
                                teammate.Entity.Statistics.WoodResistance -= 30;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.WaterAura))//WaterAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.WaterAura);//WaterAura
                                teammate.Entity.Statistics.WaterResistance -= 30;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.FireAura))//FireAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.FireAura);//FireAura
                                teammate.Entity.Statistics.FireResistance -= 30;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.EarthAura))//EarthAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.EarthAura);//EarthAura
                                teammate.Entity.Statistics.EarthResistance -= 30;
                            }
                            if (teammate.Entity.ContainsFlag2(Update.Flags2.FendAura))//TyrantAura
                            {
                                teammate.Entity.RemoveFlag2(Update.Flags2.FendAura);//TyrantAura
                                teammate.Entity.Statistics.Immunity -= 200;
                            }

                        }
                    }

                }
            }
            #endregion
            if (Game.ConquerStructures.Society.GuildWar.IsWar)
            {
                if (Time32.Now > Game.ConquerStructures.Society.GuildWar.ScoreSendStamp.AddSeconds(3))
                {
                    Game.ConquerStructures.Society.GuildWar.ScoreSendStamp = Time32.Now;
                    Game.ConquerStructures.Society.GuildWar.SendScores();
                }
                if (!Game.ConquerStructures.Society.GuildWar.Flame10th)
                {
                    if (Now >= Game.ConquerStructures.Society.GuildWar.StartTime.AddHours(1).AddMinutes(30))
                    {
                        Game.ConquerStructures.Society.GuildWar.Flame10th = true;
                        ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("You can now go and light the last flame which is near the Pole in GuildWar.", System.Drawing.Color.Orange, Network.GamePackets.Message.Center), ServerBase.Kernel.GamePool.Values);
                    }
                }

            }

            else
            {
                try
                {
                    #region kill connection
                    if (Now.Second >= 0)
                    {
                        MySql.Data.MySqlClient.MySqlConnection conn = DataHolder.MySqlConnection;
                        conn.Close();
                        conn.Dispose();
                        //conn.Open();
                        KillConnections.Kill();

                    }
                    #endregion
                    #region restart lottery
                    try
                    {

                        if (Now.Hour == 00 && Now.Minute == 00)
                        {
                            foreach (Client.GameState clients2 in ServerBase.Kernel.GamePool.Values)
                            {
                                Database.PkWarEvent.QQ(clients2);
                                Database.EntityTable.ResetLottery2(clients2);
                                //CommandsAI("@restart");
                                // ServerStuff.Closed = true;

                                Conquer_Online_Server.Game.ConquerStructures.PlayersVot Vot = new Conquer_Online_Server.Game.ConquerStructures.PlayersVot();
                                Vot.AdressIp = clients2.Account.IP;
                                Vot.Uid = clients2.Entity.UID;
                                Kernel.VotePool.Remove(Vot.AdressIp);
                                Kernel.VotePoolUid.Remove(Vot.Uid);
                                Database.EntityTable.DeletVotes(Vot);
                            }
                        }
                    }
                    catch { }
                    //return;
                    #endregion
                    #region Wethard
                    //foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                    //{

                    //    //Game.Weather.CurrentWeatherBase.Send(client);
                    //    Conquer_Online_Server.Network.GamePackets.Weather weather = new Conquer_Online_Server.Network.GamePackets.Weather(true);
                    //    weather.WeatherType = Conquer_Online_Server.Network.GamePackets.Weather.Snow;
                    //    weather.Direction = 255;
                    //    weather.Appearence = 255;
                    //    weather.Intensity = 255;
                    //    weather.Send(clients);

                    //}
                    #endregion
                    #region Message Timing
                    if (DateTime.Now > m_msgDate.AddMinutes(5))
                    {
                        m_msgDate = DateTime.Now;
                        string Msg = "";
                        switch (m_Counter)
                        {
                            case 0: Msg = "GMs have [GM] or [PM] at the end of their names. Don`t trust anyone claiming to be a GM but not having [GM]/[PM] in their names !"; m_Counter++; break;
                            case 1: Msg = "Help UnknownMan at Market (212,204) to level up quickly"; m_Counter++; break;
                            case 2: Msg = "Trading of game accounts is illegal and may result in the instant banning of the accounts involved in the trading."; m_Counter++; break;
                            case 3: Msg = "you can donate and get Cps or Vip or Items call 01278771180"; m_Counter++; break;
                            case 4: Msg = "If You Need To Be Second Reborn Pirate or Reborn To Pirate You can Call PM  01278771180."; m_Counter++; break;
                            case 5: Msg = "you can call 01278771180 only PM number for more donate."; m_Counter = 0; break;
                            default: return;
                        }
                        Network.PacketHandler.WorldMessage(Msg);
                    }
                    #endregion
                    #region SteedRace New Time XX:30
                    try
                    {

                        if (Now.Minute == 30 && Now.Second == 0)
                        {
                            Program.Steed = true;
                            SteedRaces.SteedRace();
                            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                            foreach (Client.GameState clientss in client)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The SteedRace Started! You Wana Join?");
                                npc.OptionID = 239;
                                clientss.Send(npc.ToArray());
                            }
                            Console.WriteLine2("Steed Race has started. [" + Now.Hour + ":" + Now.Minute + ":" + Now.Second + "]");
                        }
                        if (Now.Minute == 40 && Now.Second == 0)
                        {
                            Program.Steed = false;
                            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                            foreach (Client.GameState clientss in client)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The SteedRace finished! come next time");
                                npc.OptionID = 255;
                                clientss.Send(npc.ToArray());
                            }
                            Console.WriteLine2("Steed Race has finished. [" + Now.Hour + ":" + Now.Minute + ":" + Now.Second + "]");
                        }
                    }
                    catch { }
                    #endregion
                    #region Steed Race Finish
                    foreach (Client.GameState Chaar in ServerBase.Kernel.GamePool.Values)
                    {

                        if (Chaar.Map.ID == 1950)
                        {
                            if (Chaar.Map.ID == 1950 && (Chaar.Entity.X >= 132 && Chaar.Entity.X <= 099) && Chaar.Entity.Y == 099)
                            {
                                SteedRaces.GiveReward(Chaar);
                            }
                            else if (Chaar.Map.ID == 1950 && (Chaar.Entity.X >= 138 && Chaar.Entity.X <= 099) && Chaar.Entity.Y == 100)
                            {
                                SteedRaces.GiveReward(Chaar);
                            }
                            else if (Chaar.Map.ID == 1950 && (Chaar.Entity.X >= 135 && Chaar.Entity.X <= 100) && Chaar.Entity.Y == 100)
                            {
                                SteedRaces.GiveReward(Chaar);
                            }
                            else if (Chaar.Map.ID == 1950 && (Chaar.Entity.X >= 130 && Chaar.Entity.X <= 138) && (Chaar.Entity.Y >= 100 && Chaar.Entity.Y <= 120))
                            {
                                SteedRaces.GiveReward(Chaar);
                            }

                        }
                    }
                    #endregion
                    try
                    {
                        foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                        {
                            if (clients.Entity.ContainsFlag(Update.Flags.Ride) && clients.Entity.MapID == 1950)
                            {
                                return;

                            }
                            else
                            {
                                if (clients.Entity.MapID == 1950)
                                {
                                    clients.Entity.Teleport(1002, 431, 379);
                                }
                                //clients.Entity.srjoin = 0;
                            }
                        }
                    }
                    catch { }
                    #region elitepkp
                    try
                    {
                        foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                        {
                            if (Now.DayOfWeek == DayOfWeek.Monday)
                            {

                                if (Now.Hour == 21 && Now.Minute == 00)
                                {
                                    ServerBase.Kernel.Elite_PK_Tournament.Open();
                                }

                            }
                        }
                    }
                    catch { }
                    #endregion
                    #region GuildWar start Sunday

                    if (Now.DayOfWeek == DayOfWeek.Friday) //Ninja
                    {
                        if (Now.Hour == 12 && Now.Minute == 00)
                        {
                            Database.PkWarEvent.ResetTopDL();
                            Database.PkWarEvent.ResetTopGL();
                        }
                        if (Now.Hour == 18 && Now.Minute == 00)
                        {
                            Game.ConquerStructures.Society.GuildWar.Start();
                            foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                            {
                                clients.Send(new NpcReply(6, "Guild War is about to begin! Will you join it?"));
                            }
                        }

                    }
                    if (Now.DayOfWeek == DayOfWeek.Saturday) //Ninja
                    {
                        if (Now.Hour == 21 && Now.Minute == 00)
                        {
                            Game.ConquerStructures.Society.GuildWar.End();
                        }
                    }

                    #endregion
                    #region Weekly Monday and Thursday
                    try
                    {

                        if (Now.DayOfWeek == DayOfWeek.Monday && Now.Hour == 5 && Now.Minute == 00 && Now.Second == 0 || Now.DayOfWeek == DayOfWeek.Thursday && Now.Hour == 5 && Now.Minute == 00 && Now.Second == 0)
                        {
                            Program.WeeklyPk = true;

                            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                            foreach (Client.GameState clientss in client)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The WeeklyPk Started! You Wana Join?");
                                npc.OptionID = 238;
                                clientss.Send(npc.ToArray());
                            }
                            Console.WriteLine2("WeeklyPk has started. [" + Now.Hour + ":" + Now.Minute + ":" + Now.Second + "]");
                        }
                        if (Now.DayOfWeek == DayOfWeek.Monday && Now.Hour == 5 && Now.Minute == 03 && Now.Second == 0 || Now.DayOfWeek == DayOfWeek.Thursday && Now.Hour == 5 && Now.Minute == 03 && Now.Second == 0)
                        {
                            Program.WeeklyPk = false;
                            Client.GameState[] client = Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                            foreach (Client.GameState clientss in client)
                            {
                                Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "The WeeklyPk finished! come next time");
                                npc.OptionID = 255;
                                clientss.Send(npc.ToArray());
                            }
                            Console.WriteLine2("WeeklyPk Race has finished. [" + Now.Hour + ":" + Now.Minute + ":" + Now.Second + "]");
                        }
                    }
                    catch { }
                    #endregion
                    //#region PkWarEvent Class pk Times
                    //if (Now.DayOfWeek == DayOfWeek.Saturday) //Ninja
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopTrojan();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentNinja();
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarNinja();
                    //        ServerBase.Kernel.PK = true;
                    //    }

                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Sunday) //MOnk
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 25)
                    //    {
                    //        Database.PkWarEvent.ResetTopMonk();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentMonk();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarMonk();
                    //    }

                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Monday)// trojan
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopTrojan();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentTroJan();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarTrojan();
                    //    }
                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Tuesday) // worrior
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopWarrior();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentWarrior();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarWarrior();
                    //    }
                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Wednesday) // archer
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopArcher();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentArcher();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarArcher();
                    //    }
                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Thursday) // water
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopWater();

                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentWater();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarWater();
                    //    }
                    //}
                    //if (Now.DayOfWeek == DayOfWeek.Friday) // fire
                    //{
                    //    if (Now.Hour == 19 && Now.Second == 40)
                    //    {
                    //        Database.PkWarEvent.ResetTopFire();
                    //    }
                    //    if (Now.Hour == 14 && Now.Minute == 00 && Now.Second == 00 || Now.Hour == 22 && Now.Minute == 00 && Now.Second == 00)
                    //    {
                    //        PKTournament.StartTournamentFire();
                    //        ServerBase.Kernel.PK = true;
                    //        Game.ConquerStructures.Society.GuildWar.ClassPkWarFire();
                    //    }

                    //}
                    //#endregion
                    //if (Game.Features.TeamWar.War.Running)
                    //{
                    //    if (Time32.Now > Game.Features.TeamWar.War.LastCheck.AddMinutes(1))
                    //        Game.Features.TeamWar.War.Check();
                    //    if (Game.Features.TeamWar.War.Teams.Count > 0)
                    //    {
                    //        foreach (Game.Features.TeamWar.TeamStruct Teams in Game.Features.TeamWar.War.Teams.Values)
                    //        {
                    //            Teams.Check();
                    //        }
                    //    }
                    //}
                }
                catch { }

            }
        }