public static void DoAccept(Client.GameState client) { if (!client.ArenaStatistic.AcceptBox) { if (client.ArenaStatistic.ArenaPoints == 0) return; if (PlayerList.ContainsKey(client.ArenaStatistic.PlayWith)) { if (PlayerList[client.ArenaStatistic.PlayWith].ArenaStatistic.AcceptBox) { QualifierList.QualifierGroup group = new QualifierList.QualifierGroup(client, PlayerList[client.ArenaStatistic.PlayWith]); QualifierList.Groups.Add(group.ID, group); group.Import(); } else { client.ArenaStatistic.AcceptBox = true; } } } }
public static void ArenaSystem_Execute() { #region in-game players var Players = new GameState[PlayerList.Count + 2]; PlayerList.Values.CopyTo(Players, 0); if (Players.Length >= 2) { for (int count = 0; count < Players.Length; count++) { Client.GameState Client = Players[count]; if (Client != null && Client.Entity != null && (!ServerBase.Constants.PKFreeMaps.Contains(Client.Map.ID) || Client.Map.ID == 1005)) { if (Client.InArenaMatch) continue; #region Select players if (Client.ArenaStatistic.Status == Network.GamePackets.ArenaStatistic.WaitingForOpponent) { for (int count2 = count + 1; count2 < Players.Length; count2++) { Client.GameState Client2 = Players[count2]; if (Client2 != null && Client2.Entity != null && (!ServerBase.Constants.PKFreeMaps.Contains(Client2.Map.ID) || Client2.Map.ID == 1005)) { if (Client2.InArenaMatch) continue; if (Client2.ArenaStatistic.Status == Network.GamePackets.ArenaStatistic.WaitingForOpponent) { byte type = 1; int diff = 0; if (Client2.ArenaStatistic.Rank == 0) { diff = (int)Client.ArenaStatistic.ArenaPoints - (int)Client2.ArenaStatistic.ArenaPoints; diff = diff < 0 ? -diff : diff; } else { if (Client.ArenaStatistic.Rank == 0) { diff = (int)Client.ArenaStatistic.ArenaPoints - (int)Client2.ArenaStatistic.ArenaPoints; diff = diff < 0 ? -diff : diff; } else { diff = (int)Client.ArenaStatistic.Rank - (int)Client2.ArenaStatistic.Rank; diff = diff < 0 ? -diff : diff; type = 2; } } if ((type == 1 && diff <= 100) || (type == 2 && diff <= 10)) { Client.ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.WaitingInactive; Client2.ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.WaitingInactive; Client.Send(Client.ArenaStatistic); Client2.Send(Client2.ArenaStatistic); Client.ArenaStatistic.AcceptBoxShow = Client2.ArenaStatistic.AcceptBoxShow = Time32.Now; Client.ArenaStatistic.PlayWith = Client2.ArenaStatistic.EntityID; Client2.ArenaStatistic.PlayWith = Client.ArenaStatistic.EntityID; Client.InArenaMatch = true; Client2.InArenaMatch = true; ArenaSignup sign = new ArenaSignup(); sign.DialogID = ArenaSignup.MainIDs.StartCountDown; sign.Stats = Client.ArenaStatistic; Client.Send(sign.BuildPacket()); sign.Stats = Client2.ArenaStatistic; Client2.Send(sign.BuildPacket()); } } } } } #endregion #region Check for timer else { if (Client != null && Client.ArenaStatistic != null && Time32.Now >= Client.ArenaStatistic.AcceptBoxShow.AddSeconds(60)) { if (Client.ArenaStatistic.PlayWith != 0 && Client.QualifierGroup == null) { Conquer_Online_Server.Client.GameState Client2 = PlayerList[Client.ArenaStatistic.PlayWith]; if (Client2 != null && Client.ArenaStatistic != null) { if (Client2.ArenaStatistic.PlayWith != 0 && Client2.QualifierGroup == null) { if (Client.ArenaStatistic.AcceptBox && Client2.ArenaStatistic.AcceptBox) { Client.ArenaStatistic.AcceptBoxShow = Client2.ArenaStatistic.AcceptBoxShow = Time32.Now; Client.ArenaStatistic.PlayWith = Client2.ArenaStatistic.EntityID; Client2.ArenaStatistic.PlayWith = Client.ArenaStatistic.EntityID; QualifierList.QualifierGroup group = new QualifierList.QualifierGroup(Client, Client2); QualifierList.Groups.Add(group.ID, group); group.Import(); } else { if (Client.QualifierGroup != null && Client2.QualifierGroup != null) return; if (Client.ArenaStatistic.AcceptBox == true) { Win(Client, Client2); } else { if (Client2.ArenaStatistic.AcceptBox) { Win(Client2, Client); } else { if (Client.ArenaStatistic.ArenaPoints > Client2.ArenaStatistic.ArenaPoints) { Win(Client, Client2); } else { Win(Client2, Client); } } } } } } else { Client.ArenaStatistic.PlayWith = 0; Client.ArenaStatistic.AcceptBox = false; } } } } #endregion } } } if (QualifierList.Groups.Count > 0) { QualifierList.QualifierGroup[] GroupsList = QualifierList.Groups.Values.ToArray(); for (int count = 0; count < QualifierList.Groups.Count; count++) { QualifierList.QualifierGroup group = GroupsList[count]; if (Time32.Now > group.CreateTime.AddSeconds(5)) { if (group.Inside) { if (!group.Done) { if (Time32.Now > group.CreateTime.AddMinutes(5) && !group.CanEnd) { group.End(); } } else { if (Time32.Now > group.DoneStamp.AddSeconds(1)) { group.Export(); group.Done = false; } } } } } GroupsList = null; } #endregion #region resseting DateTime Noww = DateTime.Now; TimeSpan Now = Noww.TimeOfDay; if (!DayPassed) if (Now.Hours == 23 && Now.Minutes == 59) DayPassed = true; if (DayPassed) { if (Now.Hours == 0 && Now.Minutes <= 2) { DayPassed = false; foreach (ArenaStatistic stat in ArenaStatistics.Values) { stat.LastSeasonArenaPoints = stat.ArenaPoints; stat.LastSeasonWin = stat.TodayWin; stat.LastSeasonLose = stat.TodayBattles - stat.TodayWin; stat.TodayWin = 0; stat.TodayBattles = 0; stat.CurrentHonor += stat.Rank * 15000; stat.HistoryHonor += stat.Rank * 15000; stat.ArenaPoints = Database.ArenaTable.ArenaPointFill(stat.Level); stat.LastArenaPointFill = DateTime.Now; if (ServerBase.Kernel.GamePool.ContainsKey(stat.EntityID)) { Client.GameState client = ServerBase.Kernel.GamePool[stat.EntityID]; client.Send(stat); } } SaveArenaStats(); YesterdaySort(); } } #endregion }