Exemplo n.º 1
0
        public void Stop()
        {
            if (!this.IsRunning)
            {
                return;
            }
            this._notificationsAboutStart = 3;
            this.IsStarted = false;
            WCell.RealmServer.Global.World.Broadcast(string.Format(
                                                         "War in {0} has ended. Light scores {1} vs {2} dark scores.", (object)this.Town,
                                                         (object)this.LightScores, (object)this.DarkScores));
            this.IsRunning = false;
            this.SetNextWarParametrs();
            lock (this.JoinLock)
            {
                foreach (Character character in this.LightScores > this.DarkScores
                    ? this.LightTeam.Values
                    : this.DarkTeam.Values)
                {
                    if (this.MvpCharacter == null)
                    {
                        this.MvpCharacter = character;
                    }
                    else if ((int)this.MvpCharacter.BattlegroundActPoints < (int)character.BattlegroundActPoints)
                    {
                        this.MvpCharacter = character;
                    }
                }

                Asda2BattlegroundHandler.SendWiningFactionInfoResponse(this.Town, this.WiningFactionId,
                                                                       this.MvpCharacter == null ? "[No character]" : this.MvpCharacter.Name);
                if (this.MvpCharacter != null)
                {
                    ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
                    {
                        BattlegroundResultRecord battlegroundResultRecord = new BattlegroundResultRecord(this.Town,
                                                                                                         this.MvpCharacter.Name, this.MvpCharacter.EntityId.Low, this.LightScores, this.DarkScores);
                        battlegroundResultRecord.CreateLater();
                        this.CurrentWarResultRecordGuid = battlegroundResultRecord.Guid;
                        Asda2BattlegroundMgr.ProcessBattlegroundResultRecord(battlegroundResultRecord);
                    }));
                }
                foreach (Character character in this.LightTeam.Values)
                {
                    this.ProcessEndWar(character);
                }
                foreach (Character character in this.DarkTeam.Values)
                {
                    this.ProcessEndWar(character);
                }
                foreach (Asda2WarPoint point in this.Points)
                {
                    point.Status       = Asda2WarPointStatus.NotOwned;
                    point.OwnedFaction = (short)-1;
                    Asda2BattlegroundHandler.SendUpdatePointInfoResponse((IRealmClient)null, point);
                }

                WCell.RealmServer.Global.World.TaskQueue.CallDelayed(60000, new Action(this.KickAll));
            }
        }
Exemplo n.º 2
0
        public static void ProcessBattlegroundResultRecord(BattlegroundResultRecord battlegroundResultRecord)
        {
            var town = (int)battlegroundResultRecord.Town;

            TotalWars[town]++;
            if (battlegroundResultRecord.IsLightWins != null)
            {
                if ((bool)battlegroundResultRecord.IsLightWins)
                {
                    LightWins[town]++;
                }
                else
                {
                    DarkWins[town]++;
                }
            }
        }
Exemplo n.º 3
0
        public static void ProcessBattlegroundResultRecord(BattlegroundResultRecord battlegroundResultRecord)
        {
            int town = (int)battlegroundResultRecord.Town;

            ++Asda2BattlegroundMgr.TotalWars[town];
            if (!battlegroundResultRecord.IsLightWins.HasValue)
            {
                return;
            }
            if (battlegroundResultRecord.IsLightWins.Value)
            {
                ++Asda2BattlegroundMgr.LightWins[town];
            }
            else
            {
                ++Asda2BattlegroundMgr.DarkWins[town];
            }
        }
Exemplo n.º 4
0
        public static void InitBattlegrounds()
        {
            InitTimeEntries();
            AllBattleGrounds.Add(Asda2BattlegroundTown.Alpia, new List <Asda2Battleground>());
            AllBattleGrounds.Add(Asda2BattlegroundTown.Silaris, new List <Asda2Battleground>());
            AllBattleGrounds.Add(Asda2BattlegroundTown.Flamio, new List <Asda2Battleground>());
            AllBattleGrounds.Add(Asda2BattlegroundTown.Aquaton, new List <Asda2Battleground>());
            AddBattleGround(Asda2BattlegroundTown.Alpia);
            AddBattleGround(Asda2BattlegroundTown.Silaris);
            AddBattleGround(Asda2BattlegroundTown.Flamio);
            AddBattleGround(Asda2BattlegroundTown.Aquaton);
            var btgrndreslts = BattlegroundResultRecord.FindAll();

            foreach (var battlegroundResultRecord in btgrndreslts)
            {
                ProcessBattlegroundResultRecord(battlegroundResultRecord);
            }
        }
Exemplo n.º 5
0
        public void Stop()
        {
            if (!IsRunning)
            {
                return;
            }
            _notificationsAboutStart = 3;
            IsStarted = false;
            World.Broadcast(string.Format("ÇáÍÑÈ Ýí {0} ÇäÊåÊ.. äÞÇØ ÇáäæÑ {1} ÖÏ {2} äÞÇØ ÇáÙáÇã", Town, LightScores,
                                          DarkScores));
            IsRunning = false;
            SetNextWarParametrs();
            //Notify players war ended.
            lock (JoinLock)
            {
                //find mvp
                foreach (var character in LightScores > DarkScores ? LightTeam.Values : DarkTeam.Values)
                {
                    if (MvpCharacter == null)
                    {
                        MvpCharacter = character;
                        continue;
                    }
                    if (MvpCharacter.BattlegroundActPoints < character.BattlegroundActPoints)
                    {
                        MvpCharacter = character;
                    }
                }
                Asda2BattlegroundHandler.SendWiningFactionInfoResponse(Town, WiningFactionId,
                                                                       MvpCharacter == null ? "[áÇ ÃÍÏ]" : MvpCharacter.Name);

                if (MvpCharacter != null)
                {
                    //create db records about war

                    RealmServer.IOQueue.AddMessage(() =>
                    {
                        var warResRec = new BattlegroundResultRecord(Town, MvpCharacter.Name, MvpCharacter.EntityId.Low,
                                                                     LightScores, DarkScores);
                        warResRec.CreateLater();
                        CurrentWarResultRecordGuid = warResRec.Guid;
                        Asda2BattlegroundMgr.ProcessBattlegroundResultRecord(warResRec);
                    });
                }
                foreach (var character in LightTeam.Values)
                {
                    ProcessEndWar(character);
                    if (WiningFactionId == 0)
                    {
                        Asda2TitleChecker.OnWinWar(character);
                    }
                    else
                    {
                        Asda2TitleChecker.OnLoseWar(character);
                    }
                }
                foreach (var character in DarkTeam.Values)
                {
                    ProcessEndWar(character);
                    if (WiningFactionId == 1)
                    {
                        Asda2TitleChecker.OnWinWar(character);
                    }
                    else
                    {
                        Asda2TitleChecker.OnLoseWar(character);
                    }
                }
                foreach (var asda2WarPoint in Points)
                {
                    asda2WarPoint.Status       = Asda2WarPointStatus.NotOwned;
                    asda2WarPoint.OwnedFaction = -1;

                    Asda2BattlegroundHandler.SendUpdatePointInfoResponse(null, asda2WarPoint);
                }
                World.TaskQueue.CallDelayed(60000, KickAll);
            }
        }