Beispiel #1
0
 public void DbLoaderAdd(IBattleManager battleManager)
 {
     lock (Lock)
     {
         Battles.Add(battleManager.BattleId, battleManager);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Resources"/> class.
        /// </summary>
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            LevelFile.Initialize();
            Fingerprint.Initialize();
            Globals.Initialize();

            if (Constants.Database == DBMS.Mongo)
            {
                Mongo.Initialize();
            }

            Resources.Redis = new Redis();
            Resources.Regex = new Regex("[ ]{2,}", RegexOptions.Compiled);

            Resources.Players = new Players();
            Resources.Clans   = new Clans();
            Resources.Chats   = new Chats();
            Resources.Battles = new Battles();
            Resources.Random  = new XorShift();

            Resources.TCPGateway = new TCPServer();
            Resources.UDPGateway = new UDPServer();

            Resources.Started = true;

            Parser.Initialize();
            EventsHandler.Initialize();
        }
Beispiel #3
0
 public void Remove(IBattleManager battleManager)
 {
     lock (Lock)
     {
         Battles.Remove(battleManager.BattleId);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Stops this instance.
        /// </summary>
        internal void Stop()
        {
            if (!this.Stopped)
            {
                this.Stopped = true;

                if (this.Started)
                {
                    this.Timer.Stop();

                    foreach (LogicClientAvatar avatar in this.Avatars)
                    {
                        new BattleResultMessage(avatar.Connection).Send();
                    }

                    Battles.Remove(this);
                }
                else
                {
                    Debugger.Error("Battle hadn't started when Stop() was called");
                }
            }
            else
            {
                Debugger.Error("Battle already stopped when Stop() was called.");
            }
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Resources"/> class.
        /// </summary>
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            Home.Initialize();
            Fingerprint.Initialize();
            GameDatas.Initialize();

            Resources.Gametools = new GameTools();

            Resources.Redis = new Redis();

            Resources.Players = new Players();
            Resources.Clans   = new Clans();
            Resources.Battles = new Battles();
            Resources.Random  = new XorShift();

            Resources.TCPGateway = new TCPServer();
            Resources.UDPGateway = new UDPServer();

            Resources.Started = true;

            Parser.Initialize();
            EventsHandler.Initialize();
        }
Beispiel #6
0
 public static EventBattle c(Battles battle)
 {
     return(new EventBattle()
     {
         battle = battle
     });
 }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Resources"/> class.
        /// </summary>
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            Home.Initialize();
            Update.Initialize();
            Fingerprint.Initialize();

            Resources.GameSettings = new GameSettings();

            if (Constants.Database == DBMS.Mongo)
            {
                Mongo.Initialize();
            }
            else
            {
                Resources.Redis = new Redis();
            }

            Resources.Players = new Players();
            Resources.Clans   = new Clans();
            Resources.Battles = new Battles();
            Resources.Random  = new XorShift();

            Resources.TCPGateway = new TCPServer();

            Resources.Started = true;

            Parser.Initialize();
            EventsHandler.Initialize();
        }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Resources"/> class.
        /// </summary>
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Resources.Sentry = new Sentry(Constants.SentryAPI, Constants.SentryID, Constants.UseSentry);

#if DEBUG
            Console.WriteLine("Loaded " + Factory.Messages.Count + " messages, " + Factory.Commands.Count + " commands, and " + Factory.Debugs.Count + " debug commands.");
#endif

            Resources.Redis       = new Redis();
            Resources.Parser      = new Parser();
            Resources.Fingerprint = new Fingerprint();
            Resources.CSV         = new CSV();
            Resources.Home        = new Home();
            Resources.Npc         = new NPC();
            Resources.Helpers     = new Helpers();
            Resources.Checker     = new Timers();

            Resources.Players = new Players();
            Resources.Clans   = new Clans();
            Resources.Battles = new Battles();
            Resources.Chats   = new WorldChats();
            Resources.Random  = new XorShift();
            Resources.Cluster = new Cluster();

            Resources.Test = new Test();

            Resources.Gateway  = new TCPServer();
            Resources.UGateway = new UDPServer();

            Resources.Events = new EventsHandler();

            Resources.Started = true;
        }
Beispiel #9
0
        public static void LoadBattles()
        {
            var result = Battles.Import();

            CMOptions.ToConsole("Result: {0}", result.ToString());

            switch (result)
            {
            case DataStoreResult.Null:
            case DataStoreResult.Busy:
            case DataStoreResult.Error:
            {
                if (Battles.HasErrors)
                {
                    CMOptions.ToConsole("Battles database has errors...");

                    Battles.Errors.ForEach(CMOptions.ToConsole);
                }
            }
            break;

            case DataStoreResult.OK:
                CMOptions.ToConsole("Battle count: {0:#,0}", Battles.Count);
                break;
            }
        }
Beispiel #10
0
        public static async void Initialize()
        {
            Logger = new Logger();
            Logger.Log(
                $"Starting [{DateTime.Now.ToLongTimeString()} - {ServerUtils.GetOSName()}]...",
                null);

            Configuration = new Configuration();
            Configuration.Initialize();

            Fingerprint = new Fingerprint();
            Sentry      = new SentryReport();
            Csv         = new Csv();

            UpdateManager = new UpdateManager();

            PlayerDb   = new PlayerDb();
            AllianceDb = new AllianceDb();

            Logger.Log($"Successfully loaded MySql with {await PlayerDb.CountAsync()} player(s) & {await AllianceDb.CountAsync()} clan(s)", null);

            Redis = new Redis();

            Battles   = new Battles();
            Players   = new Players();
            Alliances = new Alliances();

            Leaderboard = new Leaderboard();

            Netty = new NettyService();

            await Task.Run(Netty.RunServerAsync);
        }
Beispiel #11
0
        public static PvPBattle CreateBattle(PvPScenario scenario)
        {
            if (scenario == null)
            {
                return(null);
            }

            PvPBattle battle = scenario.CreateBattle();

            Battles.Add(battle.Serial, battle);
            battle.Init();

            return(battle);
        }
 internal static void Initialize()
 {
     Server_Resources.Classes    = new Classes();
     Server_Resources.Exceptions = new Exceptions();
     Server_Resources.Devices    = new Devices();
     Server_Resources.Players    = new Players();
     Server_Resources.Clans      = new Clans();
     Server_Resources.Battles    = new Battles();
     Server_Resources.Random     = new Random();
     Server_Resources.Region     = new Region();
     Server_Resources.WebAPI     = new WebAPI();
     Server_Resources.Gateway    = new Gateway();
     Server_Resources.Parser     = new Parser();
 }
Beispiel #13
0
        internal async Task EndBattleAsync()
        {
            if (this.Ended)
            {
                return;
            }

            this.Timer.Dispose();
            Task savePlayer = null;
            Task saveHome   = null;

            //Score = Defender.Player;

            if (this.Started)
            {
                this.Replay = await Resources.Battles.Save(this);

                if (!this.Duel)
                {
                    this.Defender.Player.Inbox.Add(new BattleReportStreamEntry(this.Attacker.Player, this, ((long)this.Replay.HighId << 32) | (uint)this.Replay.LowId, 2));
                    this.Attacker.Player.Inbox.Add(new BattleReportStreamEntry(this.Defender.Player, this, ((long)this.Replay.HighId << 32) | (uint)this.Replay.LowId, 7));
                }


                if (this.Commands.Count > 0)
                {
                    savePlayer = Resources.Accounts.SavePlayer(this.Defender.Player);
                    saveHome   = Resources.Accounts.SaveHome(this.Defender.Home);
                }
            }

            for (int i = 0; i < this.Viewers.Count; i++)
            {
                if (this.Viewers[i].Connected)
                {
                    if (this.Viewers[i].GameMode.Level.Player.UserId == this.Defender.Player.UserId)
                    {
                        new OwnHomeDataMessage(this.Viewers[i]).Send();
                    }
                }
            }

            if (saveHome != null && savePlayer != null)
            {
                await Task.WhenAll(saveHome, savePlayer);
            }
            this.Ended = true;
        }
Beispiel #14
0
        /// <summary>
        /// Starts the battle between the two players.
        /// </summary>
        public static Timer InitBattleTimer(Player[] Players, object Locker)
        {
            Timer Timer = new Timer(50 * BattleManager.BATTLE_UPDATE_TICKS);

            Timer.Elapsed += (Ass, Dick) =>
            {
                lock (Locker)
                {
                    for (int I = 0; I < Players.Length; I++)
                    {
                        for (int J = 0; J < BattleManager.BATTLE_UPDATE_TICKS; J++)
                        {
                            Players[I].GameMode.SectorManager.IncreaseTick();
                        }
                    }

                    Players[0].GameMode.SectorManager.Queue.RemoveCommands();

                    int LastTurn = 0;

                    for (int I = 0; I < Players.Length; I++)
                    {
                        LastTurn = Math.Max(LastTurn, Players[I].GameMode.SectorManager.LastClientTurn);
                    }

                    if (Players[0].GameMode.Time > LastTurn + Time.GetSecondsInTicks(5))
                    {
                        if (Players[0].GameMode.Replay != null)
                        {
                            BattleLog BattleLog = new BattleLog(Players[0].GameMode.Battle, Players[0].GameMode.Replay);
                            Battles.Create(BattleLog).Wait();
                            BattleManager.AddReplayToRoyalTv(BattleLog);
                        }

                        for (int I = 0; I < Players.Length; I++)
                        {
                            Players[I].GameMode.SectorManager.EndBattle();
                        }

                        Timer.Dispose();
                    }
                }
            };


            return(Timer);
        }
Beispiel #15
0
        internal static void Initialize()
        {
            Resources.Logger = LogManager.GetCurrentClassLogger(typeof(Resources));

            Factory.Initialize();
            CSV.Initialize();
            LevelFile.Initialize();
            GameEvents.Initialize();
            Globals.Initialize();
            Settings.Initialize();
            Fingerprint.Initialize();

            if (Constants.Database == DBMS.Mongo)
            {
                Mongo.Initialize();
            }

            Resources.Regex = new Regex("[ ]{2,}", RegexOptions.Compiled);
            Resources.Name  = new Regex("^[a-zA-Z0-9- ]*$");

            Resources.Processor = new Processor();

            Resources.Devices   = new Devices();
            Resources.Accounts  = new Accounts();
            Resources.Battles   = new Battles();
            Resources.Clans     = new Clans();
            Resources.Chats     = new Chats();
            Resources.Duels     = new Duels();
            Resources.Random2   = new System.Random(DateTime.UtcNow.ToString().GetHashCode());
            Resources.Random    = new XorShift();
            Resources.Gateway   = new Gateway();
            Resources.StartTime = DateTime.UtcNow;
            Resources.Timers    = new Timers();
            Resources.Started   = true;

            Parser.Initialize();
            EventsHandler.Initialize();


            Console.WriteLine("We loaded " + Factory.Messages.Count + " messages, " + Factory.Commands.Count + " commands, and " + Factory.Debugs.Count + " debug commands.\n");
#if Debug
            Resources.Test = new Test();
#endif
        }
        public void GetScores(PlayerMobile from)
        {
            int battlescore = 0;

            battlescore += Battles.Sum(battle => battle.Value);

            int tournyscore = 0;

            tournyscore += Tournaments.Sum(tourn => tourn.Value);

            int invadescore = 0;

            invadescore += Invasions.Sum(invade => invade.Value);

            from.SendMessage(54, "Your overall score is " + OverallScore);
            from.SendMessage(54, "Your battles score is " + battlescore);
            from.SendMessage(54, "Your tournaments score is " + tournyscore);
            from.SendMessage(54, "Your invasions score is " + invadescore);
        }
Beispiel #17
0
        /// <summary>
        /// Handles the specified <see cref="Message"/>.
        /// </summary>
        /// <param name="Device">The device.</param>
        /// <param name="Message">The message.</param>
        /// <param name="Cancellation">The cancellation.</param>
        public static async Task Handle(Device Device, Message Message, CancellationToken Cancellation)
        {
            var HomeBattleReplayMessage = (HomeBattleReplayMessage)Message;

            if (HomeBattleReplayMessage == null)
            {
                throw new LogicException(typeof(HomeBattleReplayHandler), nameof(HomeBattleReplayMessage) + " == null at Handle(Device, Message, CancellationToken).");
            }

            if (!HomeBattleReplayMessage.ReplayId.IsZero)
            {
                BattleLog BattleLog = await Battles.Get(HomeBattleReplayMessage.ReplayId.HigherInt, HomeBattleReplayMessage.ReplayId.LowerInt);

                if (BattleLog != null)
                {
                    int ChannelIdx = RoyalTvManager.GetChannelArenaData(HomeBattleReplayMessage.ArenaData);

                    if (ChannelIdx != -1)
                    {
                        RoyalTvEntry TvEntry = RoyalTvManager.GetEntryByIdx(ChannelIdx, HomeBattleReplayMessage.ReplayShardId);

                        if (TvEntry != null)
                        {
                            Interlocked.Increment(ref TvEntry.ViewCount);
                        }
                    }

                    byte[] Decompressed = Encoding.UTF8.GetBytes(BattleLog.ReplayJson);
                    byte[] Compressed   = ZLibHelper.CompressCompressableByteArray(Decompressed);

                    Device.NetworkManager.SendMessage(new HomeBattleReplayDataMessage(Compressed));
                }
                else
                {
                    Logging.Info(typeof(HomeBattleReplayHandler), "BattleLog == null at Handle(Device, Message, CancellationToken).");
                }
            }
            else
            {
                Logging.Info(typeof(HomeBattleReplayHandler), "ReplayId.IsZero == true at Handle(Device, Message, CancellationToken).");
            }
        }
Beispiel #18
0
        /// <summary>
        ///     <para>
        ///         Initialize a new instance of the <see cref="ResourcesManager" />
        ///     </para>
        ///     <para>class.</para>
        /// </summary>
        public ResourcesManager()
        {
            m_vDatabase = new DatabaseManager();
            //m_vClients = new ConcurrentDictionary<long, Device>();
            m_vOnlinePlayers = new List <Level>();
            this._Home       = new Home();
            Devices          = new Devices();
            //Players = new Players();
            Clans                 = new Clans();
            Battles               = new Battles();
            Tournaments           = new Tournaments();
            Random                = new Random();
            m_vInMemoryLevels     = new ConcurrentDictionary <long, Level>();
            this.m_vTimerCanceled = false;
            TimerCallback TimerDelegate = this.ReleaseOrphans;
            Timer         TimerItem     = new Timer(TimerDelegate, null, 60000, 60000);

            this.TimerReference = TimerItem;
            Console.WriteLine("The Resources Manager class has been initialized.");
        }
Beispiel #19
0
    /*
     * public void MakeThreeChoice(string name, State st1, State st2, State st3){
     *      /* name = Scene name where you want to return after the choice
     * st1 = choice number 1 for change the state
     * st2 = Choice number 2 for change the state
     *
     *      scene_forChoice = new string[3];
     *      scene_forChoice[0] = name;
     *      scene_forChoice[1] = name;
     *      scene_forChoice[2] = name;
     *
     *      path1 = st1.ToString ();
     *      path2 = st2.ToString ();
     *      path3 = st3.ToString ();
     *
     *      LevelManager.lm.LoadLevel("ThreeChoices");
     *
     * }
     *
     * public void MakeTwoChoice(string name, State st1, State st2){
     *      /* name = Scene name where you want to return after the choice
     * st1 = choice number 1 for change the state
     * st2 = Choice number 2 for change the state
     *
     *      scene_forChoice = new string[2];
     *      scene_forChoice[0] = name;
     *      scene_forChoice[1] = name;
     *
     *      path1 = st1.ToString ();
     *      path2 = st2.ToString ();
     *      LevelManager.lm.LoadLevel("TwoChoices");
     *
     * }
     *
     *
     * public void MakeTwoChoiceGoChallenge(string name, State st1, State st2, int lv){
     *      / name = Scene name where you want to return if you choose 2nd option
     *        st1 = choice number 1 for change the state
     *        st2 = Choice number 2 for change the state
     *        lv = level for the challenge
     *      /
     *      scene_forChoice = new string[2];
     *      scene_forChoice[0] = "Challenge";
     *      scene_forChoice [1] = name;
     *
     *      diceresult = null;
     *      scene_forDice = name;
     *      dice_lv = lv;
     *
     *      path1 = st1.ToString ();
     *      path2 = st2.ToString ();
     *
     *      LevelManager.lm.LoadLevel("TwoChoices");
     *
     * }*/
    #endregion
    //=============================================================
    /// <summary>
    /// Check a given battle state, then return the
    /// number of enemies alive in that state, depending on the dice results.
    /// </summary>
    /// <returns> The <c>int</c> number of enemies still alive in a given state.</returns>
    /// <param name="st"> Name of the <c>enum</c> Battles</param>
    //=============================================================
    public int BattleZumbies(Battles st)
    {
        if (!battle.ContainsKey(st))
        {
            Debug.Log("Error, this battle do not exit");
        }


        if (diceresult == "success")
        {
            diceresult = null;
            battle [st]--;
            num_enemies_A4--;              // subtract one enemy
        }
        else if (diceresult == "fail")
        {
            diceresult = null;              // set result to null
            mystate    = State.dead;
        }

        return(battle[st]);
    }
Beispiel #20
0
        /// <summary>
        /// Initializes the <see cref="Loader"/> class.
        /// </summary>
        internal static void Init()
        {
            if (Loader.Initialized)
            {
                return;
            }

            Loader.Random = new LogicRandom();

            LogicCommandManager.Init();
            MessageManager.Init();

            Fingerprint.Init();
            CSV.Init();
            Globals.Init();

            if (Settings.Database == DBMS.Mongo)
            {
                Mongo.Init();
            }

            Connections.Init();
            Avatars.Init();
            Alliances.Init();
            Battles.Init();

            ServerConnection.Init();
            APIHandler.Init();

            ServerTimers.Init();

            Loader.Initialized = true;

            EventsHandler.Init();
            Tests.Init();
        }
        /// <summary>
        /// Runs this instance.
        /// </summary>
        internal static void Run(params string[] Args)
        {
            if (Program.Initialized == false)
            {
                Environment.Exit(0);
            }

            if (ExitHandler.Exiting)
            {
                return;
            }

            ExitHandler.Exiting = true;

            var WarningsTask = ExitHandler.SetMaintenance();

            var PlayersTask = Players.SaveAll();
            var ClansTask   = Clans.SaveAll();
            var BattlesTask = Battles.SaveAll();

            Task.WaitAll(WarningsTask, PlayersTask, ClansTask, BattlesTask);

            if (Args.Length > 1)
            {
                if (Args[1] == "--force" || Args[1] == "-f")
                {
                    ExitHandler.DisconnectEveryone().Wait();
                    Environment.Exit(0);
                }
            }

            ExitHandler.WaitTillWarnEnd();
            ExitHandler.DisconnectEveryone().Wait();

            Environment.Exit(0);
        }
Beispiel #22
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="seed"></param>
 /// <param name="tab"></param>
 public Grid(int width, int height, int seed, int[,] tab)
 {
     if (width > 0 && width < MAX)
     {
         this.width = width;
     }
     else
     {
         this.width = DEFAULT_WIDTH;
     }
     if (height > 0 && height < MAX)
     {
         this.height = height;
     }
     else
     {
         this.height = DEFAULT_HEIGHT;
     }
     this.seed       = seed;
     this.cells      = new Cell[height, width];
     this.characters = new List <Character>();
     this.battles    = new Battles(this);
     Init(tab);
 }
Beispiel #23
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        internal static void Main()
        {
            Base.Initialize();
            GameDb.Initialize();

            Devices.Initialize();
            Players.Initialize();
            Clans.Initialize();
            Battles.Initialize();
            Leaderboards.Initialize();

            InboxManager.Initialize();
            EventManager.Initialize();
            BattleManager.Initialize();
            RoyalTvManager.Initialize();

            HandlerFactory.Initialize();
            NetworkTcp.Initialize();

            Program.Initialized     = true;
            Console.CancelKeyPress += ConsoleOnCancelKeyPress;

            CommandLine.Initialize();
        }
Beispiel #24
0
        internal override void Execute()
        {
            LogicClientAvatar opponent = Waiting.Dequeue();

            if (opponent != null)
            {
                LogicBattle battle = new LogicBattle(this.Connection.Avatar, opponent)
                {
                    PvPTier = this.Quest
                };

                Battles.Add(battle);

                this.Connection.Avatar.Battle = battle;
                opponent.Battle = battle;

                battle.Start();
            }
            else
            {
                new PvpMatchmakeNotificationMessage(this.Connection).Send();
                Waiting.Enqueue(this.Connection.Avatar);
            }
        }
Beispiel #25
0
 public bool TryGetObjects(uint battleId, out IBattleManager battleManager)
 {
     return(Battles.TryGetValue(battleId, out battleManager));
 }
Beispiel #26
0
 public static bool RemoveBattle(PvPBattle battle)
 {
     return(battle != null && !battle.Deleted && Battles.ContainsKey(battle.Serial) && Battles.Remove(battle.Serial));
 }
        private void CalcBattles()
        {
            Battle             b;
            FormBattle         formBattle;
            FormProgressBattle formProgressBattle = null;

            foreach (Player p in Players)
            {
                p.BattleCalced = false;
            }

            // Бои с монстрами
            foreach (Player p in Players)
            {
                if (p.IsLive)
                {
                    p.PreparingForBattle();

                    // Включить, когда ИИ может выбирать цель
                    //Debug.Assert(p.TargetLair != null);
                    foreach (PlayerLair pl in p.ListFlags)
                    {
                        pl.PreparingForBattle();

                        //Debug.Assert(p.TargetLair.CombatHeroes.Count > 0);

                        bool showForPlayer = p.TypePlayer == TypePlayer.Human;
                        b = new Battle(p, pl, Turn, FormMain.Rnd, showForPlayer);

                        if (showForPlayer)
                        {
                            formBattle = new FormBattle();
                            formBattle.ShowBattle(b);
                            formBattle.Dispose();
                        }
                        else
                        {
                            if (formProgressBattle == null)
                            {
                                formProgressBattle = new FormProgressBattle();
                            }

                            formProgressBattle.SetBattle(b, Players.Count(), p.PlayerIndex + 1);
                        }

                        Battles.Add(b);
                    }
                }
            }

            return;

            int livePlayers = 0;

            foreach (Player p in Players)
            {
                if (p.IsLive)
                {
                    livePlayers++;
                }
            }
            Debug.Assert(livePlayers % 2 == 0);
            int pairs      = (livePlayers / 2) - 1;
            int numberPair = 0;

            foreach (Player p in Players)
            {
                p.BattleCalced = false;
            }

            foreach (Player p in Players)
            {
                if (p.IsLive == true)
                {
                    if (p.BattleCalced == false)
                    {
                        bool showForPlayer = (p.TypePlayer == TypePlayer.Human) || (p.Opponent.TypePlayer == TypePlayer.Human);
                        b = new Battle(p, p.Opponent, Turn, FormMain.Rnd, showForPlayer);

                        if (showForPlayer)
                        {
                            formBattle = new FormBattle();
                            formBattle.ShowBattle(b);
                            formBattle.Dispose();
                        }
                        else
                        {
                            numberPair++;
                            if (formProgressBattle == null)
                            {
                                formProgressBattle = new FormProgressBattle();
                            }

                            formProgressBattle.SetBattle(b, pairs, numberPair);
                        }

                        Battles.Add(b);
                    }
                }
            }

            if (formProgressBattle != null)
            {
                formProgressBattle.Dispose();
            }
        }
Beispiel #28
0
 public static IPvPBattle FindBattleIByID(PvPSerial serial)
 {
     return(Battles.Where(kvp => kvp.Key.Equals(serial)).Select(kvp => kvp.Value).FirstOrDefault());
 }
Beispiel #29
0
 public static bool RemoveBattle(PvPBattle battle)
 {
     return(battle != null && Battles.Remove(battle.Serial));
 }
Beispiel #30
0
 public static PvPBattle FindBattleByID(int uid)
 {
     return(Battles.Where(o => o.Key.ValueHash.Equals(uid)).Select(kvp => kvp.Value).FirstOrDefault());
 }