Example #1
0
        private void onCharacterKilled(CharacterInstance target, CharacterInstance killer, bool critted, SkillType fromSkill)
        {
            Player        player        = GameLogic.Binder.GameState.Player;
            ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;

            if (((killer != null) && !target.IsPlayerCharacter) && (killer.IsPlayerCharacter && !activeDungeon.isTutorialDungeon()))
            {
                Vector3 positionAtTimeOfDeath = target.PositionAtTimeOfDeath;
                if (target.IsBoss && (activeDungeon.ActiveRoom.numberOfBossesAlive() == 0))
                {
                    activeDungeon.LastBossKillWorldPt = positionAtTimeOfDeath;
                }
                else if (!activeDungeon.ActiveRoom.MainBossSummoned)
                {
                    if (!activeDungeon.hasDungeonModifier(DungeonModifierType.MonsterNoCoins))
                    {
                        double baseCoinReward = App.Binder.ConfigMeta.MinionCoinDropCurve(activeDungeon.Floor);
                        double num2           = player.calculateStandardCoinRoll(baseCoinReward, target.Type, 1);
                        CmdGainResources.ExecuteStatic(player, ResourceType.Coin, num2, true, "TRACKING_ID_GAMEPLAY_LOOT_GAIN", new Vector3?(positionAtTimeOfDeath));
                    }
                    CharacterInstance primaryPlayerCharacter = activeDungeon.PrimaryPlayerCharacter;
                    double            amount = App.Binder.ConfigMeta.XpFromMinionKill(activeDungeon.Floor);
                    float             num4   = primaryPlayerCharacter.getCharacterTypeXpModifier(target.Type) + primaryPlayerCharacter.UniversalXpBonus(true);
                    amount += amount * num4;
                    CmdGainResources.ExecuteStatic(player, ResourceType.Xp, amount, true, string.Empty, new Vector3?(positionAtTimeOfDeath));
                    CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.MinionDropLootTable, player, positionAtTimeOfDeath, target.Type, null, ChestType.NONE);
                }
                if (target.IsWildBoss && !target.IsBossClone)
                {
                    GameLogic.Binder.LootSystem.awardBossRewards(activeDungeon, target.Type, true);
                }
            }
        }
        public static void ExecuteStatic()
        {
            Player            player          = GameLogic.Binder.GameState.Player;
            CharacterInstance activeCharacter = player.ActiveCharacter;

            if (player.getFirstUnclaimedRetirementTriggerChest() == null)
            {
                Reward reward2 = new Reward();
                reward2.ChestType = ChestType.RetirementTrigger;
                List <double> list = new List <double>();
                list.Add(App.Binder.ConfigMeta.RetirementTokenReward(activeCharacter, 50));
                reward2.TokenDrops = list;
                Reward item = reward2;
                player.UnclaimedRewards.Add(item);
            }
            CmdRollDropLootTable.ExecuteStatic(App.Binder.ConfigLootTables.BossAdditionalDropLootTable, player, player.ActiveCharacter.PhysicsBody.Transform.position, CharacterType.UNSPECIFIED, ChestType.RewardBoxCommon.ToString(), ChestType.NONE);
        }
Example #3
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);
                }
            }
        }