示例#1
0
        public void awardBossRewards(ActiveDungeon ad, GameLogic.CharacterType killedBossType, bool wildBoss)
        {
            ad.VisualizableBossRewards = new ActiveDungeon.BossRewards();
            CharacterInstance primaryPlayerCharacter = ad.PrimaryPlayerCharacter;
            Player            owningPlayer           = primaryPlayerCharacter.OwningPlayer;
            int    floor          = ad.Floor;
            double baseCoinReward = App.Binder.ConfigMeta.BossCoinDropCurve(floor, owningPlayer.BossTrain.Active);
            double num3           = owningPlayer.calculateStandardCoinRoll(baseCoinReward, killedBossType, 1);

            ad.VisualizableBossRewards.CoinDropCount = UnityEngine.Random.Range(3, 7);
            ad.VisualizableBossRewards.CoinsPerDrop  = num3 / ((double)ad.VisualizableBossRewards.CoinDropCount);
            bool   isHighestFloor = ad.Floor == owningPlayer.getHighestFloorReached();
            double num4           = App.Binder.ConfigMeta.XpFromBossKill(ad.Floor, isHighestFloor) / ((double)ad.VisualizableBossRewards.CoinDropCount);
            float  num5           = primaryPlayerCharacter.getCharacterTypeXpModifier(killedBossType) + primaryPlayerCharacter.UniversalXpBonus(true);

            num4 += num4 * num5;
            ad.VisualizableBossRewards.XpPerDrop = num4;
            bool flag2 = !ad.hasDungeonModifier(DungeonModifierType.MonsterNoCoins);

            for (int i = 0; i < ad.VisualizableBossRewards.CoinDropCount; i++)
            {
                if (flag2)
                {
                    Vector3?nullable = null;
                    CmdGainResources.ExecuteStatic(owningPlayer, ResourceType.Coin, ad.VisualizableBossRewards.CoinsPerDrop, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", nullable);
                }
                Vector3?worldPt = null;
                CmdGainResources.ExecuteStatic(owningPlayer, ResourceType.Xp, ad.VisualizableBossRewards.XpPerDrop, true, string.Empty, worldPt);
            }
            bool flag3 = false;

            if (!wildBoss)
            {
                flag3 = this.grantRetirementTriggerChestIfAllowed();
            }
            if (!wildBoss && owningPlayer.canRetire())
            {
                Reward reward = owningPlayer.getFirstUnclaimedRetirementTriggerChest();
                ad.VisualizableBossRewards.Tokens = App.Binder.ConfigMeta.RetirementTokenReward(primaryPlayerCharacter, ad.Floor);
                reward.TokenDrops.Add(ad.VisualizableBossRewards.Tokens);
                if (App.Binder.ConfigMeta.BossShouldDropFrenzyPotionAtFloor(ad.Floor))
                {
                    ad.VisualizableBossRewards.FrenzyPotions = 1;
                    reward.FrenzyPotions += ad.VisualizableBossRewards.FrenzyPotions;
                }
            }
            if ((wildBoss || owningPlayer.hasRetired()) || !flag3)
            {
                ad.VisualizableBossRewards.MainDrops.Add(CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.NONE));
                int num7 = owningPlayer.CumulativeRetiredHeroStats.BossesBeat + owningPlayer.ActiveCharacter.HeroStats.BossesBeat;
                if ((owningPlayer.getPerkInstanceCount(PerkType.ChesterChestDrop) > 0) && ((((float)num7) % Mathf.Floor(ConfigPerks.GetBestModifier(PerkType.ChesterChestDrop))) == 0f))
                {
                    ad.VisualizableBossRewards.MainDrops.Add(CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.ChesterChest));
                }
            }
            if ((!wildBoss && owningPlayer.canRetire()) && ConfigMeta.BOSS_ADDITIONAL_DROPS_ENABLED)
            {
                if (flag3 && !owningPlayer.hasRetired())
                {
                    Reward item = CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossAdditionalDropLootTable, owningPlayer, Vector3.zero, killedBossType, ChestType.RewardBoxCommon.ToString(), ChestType.NONE);
                    item.clearContent();
                    item.ShopEntryId = "CoinBundleSmall";
                    double num8 = App.Binder.ConfigMeta.CoinBundleSize(owningPlayer, item.ShopEntryId, 0.0);
                    item.CoinDrops.Add(num8);
                    ad.VisualizableBossRewards.RiggedRewards.Add(item);
                }
                else if (App.Binder.ConfigMeta.BossShouldDropRewardBoxAtFloor(ad.Floor))
                {
                    ad.VisualizableBossRewards.AdditionalDrop = CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossAdditionalDropLootTable, owningPlayer, Vector3.zero, killedBossType, null, ChestType.NONE);
                }
            }
        }