Ejemplo n.º 1
0
        private void ProcessEndWar(Character character)
        {
            ++character.Stunned;
            GlobalHandler.SendFightingModeChangedResponse(character.Client, character.SessionId, (int)character.AccId,
                                                          (short)-1);
            if (this.MvpCharacter != null)
            {
                ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
                                                                                       new BattlegroundCharacterResultRecord(this.CurrentWarResultRecordGuid, character.Name,
                                                                                                                             character.EntityId.Low, (int)character.BattlegroundActPoints, character.BattlegroundKills,
                                                                                                                             character.BattlegroundDeathes).CreateLater()));
            }
            int honorPoints = this.WiningFactionId == 2
                ? 0
                : CharacterFormulas.CalcHonorPoints(character.Level, character.BattlegroundActPoints,
                                                    this.LightScores > this.DarkScores, character.BattlegroundDeathes, character.BattlegroundKills,
                                                    this.MvpCharacter == character, this.Town);
            short honorCoins = this.WiningFactionId == 2
                ? (short)0
                : (short)((double)honorPoints / (double)CharacterFormulas.HonorCoinsDivider);

            if (character.BattlegroundActPoints < (short)5)
            {
                character.BattlegroundActPoints = (short)5;
            }
            if (honorPoints <= 0)
            {
                honorPoints = 1;
            }
            if (honorCoins <= (short)0)
            {
                honorCoins = (short)1;
            }
            Asda2Item asda2Item = (Asda2Item)null;

            if (honorCoins > (short)0)
            {
                int num = (int)character.Asda2Inventory.TryAdd(20614, (int)honorCoins, true, ref asda2Item,
                                                               new Asda2InventoryType?(), (Asda2Item)null);
                Log.Create(Log.Types.ItemOperations, LogSourceType.Character, character.EntryId)
                .AddAttribute("source", 0.0, "honor_coins_for_bg").AddItemAttributes(asda2Item, "")
                .AddAttribute("amount", (double)honorCoins, "").Write();
            }

            int bonusExp = this.WiningFactionId == 2
                ? 0
                : (int)((double)XpGenerator.GetBaseExpForLevel(character.Level) *
                        (double)character.BattlegroundActPoints / 2.5);

            character.GainXp(bonusExp, "battle_ground", false);
            character.Asda2HonorPoints += honorPoints;
            AchievementProgressRecord progressRecord = character.Achievements.GetOrCreateProgressRecord(20U);

            if (character.FactionId == (FactionId)this.WiningFactionId)
            {
                switch (++progressRecord.Counter)
                {
                case 5:
                    character.DiscoverTitle(Asda2TitleId.Challenger125);
                    break;

                case 10:
                    character.GetTitle(Asda2TitleId.Challenger125);
                    break;

                case 25:
                    character.DiscoverTitle(Asda2TitleId.Winner126);
                    break;

                case 50:
                    character.GetTitle(Asda2TitleId.Winner126);
                    break;

                case 75:
                    character.DiscoverTitle(Asda2TitleId.Champion127);
                    break;

                case 100:
                    character.GetTitle(Asda2TitleId.Champion127);
                    break;

                case 250:
                    character.DiscoverTitle(Asda2TitleId.Conqueror128);
                    break;

                case 500:
                    character.GetTitle(Asda2TitleId.Conqueror128);
                    break;
                }

                progressRecord.SaveAndFlush();
            }

            character.Resurrect();
            character.Map.CallDelayed(500,
                                      (Action)(() => Asda2BattlegroundHandler.SendWarEndedResponse(character.Client,
                                                                                                   (byte)this.WiningFactionId,
                                                                                                   this.LightScores > this.DarkScores ? this.LightScores : this.DarkScores,
                                                                                                   this.LightScores > this.DarkScores ? this.DarkScores : this.LightScores, honorPoints, honorCoins,
                                                                                                   (long)bonusExp, this.MvpCharacter == null ? "" : this.MvpCharacter.Name)));
            Asda2BattlegroundHandler.SendWarEndedOneResponse(character.Client,
                                                             (IEnumerable <Asda2Item>) new List <Asda2Item>()
            {
                asda2Item
            });
            character.SendWarMsg("You will automaticly teleported to town in 1 minute.");
        }
Ejemplo n.º 2
0
        private void ProcessEndWar(Character character)
        {
            character.Stunned++;
            GlobalHandler.SendFightingModeChangedResponse(character.Client, character.SessionId, (int)character.AccId, -1);
            //create db record
            if (MvpCharacter != null)
            {
                RealmServer.IOQueue.AddMessage(() =>
                {
                    var rec = new BattlegroundCharacterResultRecord(CurrentWarResultRecordGuid, character.Name,
                                                                    character.EntityId.Low, character.BattlegroundActPoints,
                                                                    character.BattlegroundKills,
                                                                    character.BattlegroundDeathes);
                    rec.CreateLater();
                });
            }
            var honorPoints = WiningFactionId == 2
              ? 0
              : CharacterFormulas.CalcHonorPoints(character.Level, character.BattlegroundActPoints,
                                                  LightScores > DarkScores,
                                                  character.BattlegroundDeathes,
                                                  character.BattlegroundKills, MvpCharacter == character, Town);
            var honorCoins = (short)(WiningFactionId == 2 ? 0 : (honorPoints / CharacterFormulas.HonorCoinsDivider));

            if (character.BattlegroundActPoints < 5)
            {
                character.BattlegroundActPoints = 5;
            }
            if (honorPoints <= 0)
            {
                honorPoints = 1;
            }
            if (honorCoins <= 0)
            {
                honorCoins = 1;
            }
            Asda2Item itemCoins = null;

            if (honorCoins > 0)
            {
                character.Asda2Inventory.TryAdd(
                    20614, honorCoins,
                    true, ref itemCoins);
                Log.Create(Log.Types.ItemOperations, LogSourceType.Character, character.EntryId)
                .AddAttribute("source", 0, "honor_coins_for_bg")
                .AddItemAttributes(itemCoins)
                .AddAttribute("amount", honorCoins)
                .Write();
            }
            var bonusExp = WiningFactionId == 2
              ? 0
              : (int)((float)XpGenerator.GetBaseExpForLevel(character.Level) * character.BattlegroundActPoints / 2.5);

            character.GainXp(bonusExp, "battle_ground");

            character.Asda2HonorPoints += honorPoints;
            Asda2BattlegroundHandler.SendWarEndedResponse(character.Client, (byte)WiningFactionId,
                                                          LightScores > DarkScores ? LightScores : DarkScores,
                                                          LightScores > DarkScores ? DarkScores : LightScores, honorPoints,
                                                          honorCoins, bonusExp, MvpCharacter == null ? "" : MvpCharacter.Name);
            Asda2BattlegroundHandler.SendWarEndedOneResponse(character.Client, new List <Asda2Item> {
                itemCoins
            });
            character.SendWarMsg("ÓæÝ íÊã ÅÑÓÇáß Åáì ÇáãÏíäÉ ÈÚÏ 1 ÏÞíÞÉ ãä ÇáÇä.");
        }