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 { } } }
public static void SavePlayersVot(PlayersVot PlayerVot) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("VoteIp").Insert("ID", PlayerVot.Uid).Insert("IP", PlayerVot.AdressIp).Execute(); }
public static void DeletVotes(PlayersVot PlayerVot) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE).Delete("VoteIp", "ID", PlayerVot.Uid).And("IP", PlayerVot.AdressIp); cmd.Execute(); }
public static void LoadPlayersVots() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("VoteIp"); MySqlReader d = new MySqlReader(cmd); while (d.Read()) { PlayersVot Vot = new PlayersVot(); Vot.Uid = d.ReadUInt32("ID"); Vot.AdressIp = d.ReadString("IP"); if (!Kernel.VotePool.ContainsKey(Vot.AdressIp)) Kernel.VotePool.Add(Vot.AdressIp, Vot); if (!Kernel.VotePoolUid.ContainsKey(Vot.Uid)) Kernel.VotePoolUid.Add(Vot.Uid, Vot); } }