private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);

            MysticsItemsLimitedArmorBehavior component = self.GetComponent <MysticsItemsLimitedArmorBehavior>();

            if (!component)
            {
                component = self.gameObject.AddComponent <MysticsItemsLimitedArmorBehavior>();
            }
            if (!component.skipItemCheck)
            {
                int itemCount  = self.inventory.GetItemCount(itemDef);
                var difference = itemCount - component.oldItemCount;
                for (var i = 0; i < difference; i++)
                {
                    if (difference > 0)
                    {
                        component.AddStock();
                    }
                    else
                    {
                        component.RemoveStock();
                    }
                }
                component.oldItemCount = itemCount;
            }
        }
Exemple #2
0
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            var InventoryCount = GetCount(self);

            if (InventoryCount > 0)
            {
                var magnetObject = self.GetBody().GetComponentInChildren <MagnetManager>()?.gameObject;
                if (!magnetObject)
                {
#if DEBUG
                    TurboEdition._logger.LogWarning(ItemName + " " + self + "'s body didn't have a MagnetManager, creating one.");
#endif
                    magnetObject = UnityEngine.Object.Instantiate(magnetManager);
                    magnetObject.GetComponent <MagnetManager>().ownerBody = self.GetBody();
                    magnetObject.GetComponent <MagnetManager>().NetLoS    = useLoS;
                    magnetObject.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(self.GetBody().gameObject);
                }
                //we update the radius after creating / finding out is already created
#if DEBUG
                TurboEdition._logger.LogWarning(ItemName + " updating " + self + "'s body MagnetManager, with radius of " + attractInitial + (InventoryCount - 1) * attractStack);
#endif
                magnetObject.GetComponent <MagnetManager>().NetRadius    = attractInitial + ((InventoryCount - 1) * attractStack);
                magnetObject.GetComponent <MagnetManager>().NetDupChance = duplicationInitial + ((InventoryCount - 1) * duplicationStack);
            }
        }
Exemple #3
0
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            if (this.localUser.cachedMaster != self)
            {
                return;
            }
            int count = 0;

            if (self.inventory.GetItemCount(RoR2Content.Items.ChainLightning) > 0 || self.inventory.GetItemCount(DLC1Content.Items.ChainLightningVoid) > 0)
            {
                count++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.EnergizedOnEquipmentUse) > 0)
            {
                count++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.ShockNearby) > 0)
            {
                count++;
            }
            if ((self.inventory.currentEquipmentIndex == RoR2Content.Equipment.TeamWarCry.equipmentIndex ||
                 self.inventory.alternateEquipmentIndex == RoR2Content.Equipment.TeamWarCry.equipmentIndex))
            {
                count++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.Behemoth) > 0)
            {
                count++;
            }
            if (count >= 3)
            {
                Grant();
            }
        }
        private void SummonBotsHook(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);

            SurvivorIndex index = SurvivorIndex.Toolbot;

            if ((self.playerCharacterMasterController != null) && (self.inventory.GetItemCount(Index) > 0) && (self.inventory.GetItemCount(Index) > botToolCount))
            {
                PlayerBotManager.SpawnPlayerbots(self, index, NumT00LBotsSpawned);
                botToolCount = GetCount(self);
            }
        }
        private void SummonBotsHook(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);

            SurvivorIndex index = SurvivorIndex.Captain;

            if ((self.playerCharacterMasterController != null) && (GetCount(self) > 0) && (GetCount(self) > botCapCount))
            {
                PlayerBotManager.SpawnPlayerbots(self, index, NumC4PTNBotsSpawned);
                botCapCount = GetCount(self);
            }
        }
Exemple #6
0
 private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
 {
     if (self.inventory != null)
     {
         var limits = self.GetComponent <InventoryLimits>();
         if (limits != null)
         {
             limits.Count(self.inventory);
         }
     }
     orig(self);
 }
Exemple #7
0
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            if (this.localUser.cachedMaster != self)
            {
                return;
            }
            int count      = Kintsugi.GetConsumedItemCount(self.inventory);
            int totalCount = self.inventory.itemStacks.Sum();

            if (totalCount >= 20 && count > Mathf.CeilToInt((float)totalCount / 2f))
            {
                Grant();
            }
        }
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);

            if (self.hasBody)
            {
                if (self.GetBody().baseNameToken == "PALADIN_NAME")
                {
                    Misc.PaladinSwordController swordComponent = self.GetBody().GetComponent <Misc.PaladinSwordController>();
                    if (swordComponent)
                    {
                        swordComponent.CheckInventory();
                    }
                }
            }
        }
        private void CheckForItem(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            var InventoryCount = GetCount(self);

            if (InventoryCount > 0)
            {
                newCalculatedRadius = CalculateRadiusIncrease(GetUniqueCountFromPlayers(ItemDef, true), GetCountFromPlayers(ItemDef, true));
                if (itemStackingCap != -1)
                {
                    newCalculatedRadius = ReturnRadiusIfCapped(itemStackingCap);
                }
#if DEBUG
                Chat.AddMessage("Turbo Edition: " + ItemName + " item counts, radius, recalculated.");
#endif
            }
        }
Exemple #10
0
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            if (localUser.cachedMaster != self)
            {
                return;
            }
            int matches = 0;

            if (self.inventory.GetItemCount(RoR2Content.Items.Mushroom) > 0)
            {
                matches++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.Tooth) > 0)
            {
                matches++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.TPHealingNova) > 0)
            {
                matches++;
            }
            if (self.inventory.GetItemCount(RoR2Content.Items.Plant) > 0)
            {
                matches++;
            }
            if (ShootToHeal.instance.GetCount(self.inventory) > 0)
            {
                matches++;
            }
            if (self.inventory.currentEquipmentIndex == RoR2Content.Equipment.PassiveHealing.equipmentIndex ||
                self.inventory.alternateEquipmentIndex == RoR2Content.Equipment.PassiveHealing.equipmentIndex)
            {
                matches++;
            }
            if (self.inventory.currentEquipmentIndex == DLC1Content.Equipment.VendingMachine.equipmentIndex ||
                self.inventory.alternateEquipmentIndex == DLC1Content.Equipment.VendingMachine.equipmentIndex)
            {
                matches++;
            }
            if (matches >= 4)
            {
                Grant();
            }
        }
Exemple #11
0
        public void ClearCheck(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);
            if (base.isUserAlive && base.meetsBodyRequirement)
            {
                if (self.netId != null && self.netId == base.localUser.cachedMasterController.master.netId)
                {
                    int itemCount = 0;

                    Inventory inventory = self.inventory;

                    if (inventory.GetItemCount(RoR2Content.Items.ChainLightning) >= 1 || inventory.GetItemCount(DLC1Content.Items.ChainLightningVoid) >= 1)
                    {
                        itemCount += 1;
                    }

                    if (inventory.GetItemCount(RoR2Content.Items.ShockNearby) >= 1)
                    {
                        itemCount += 1;
                    }

                    if (inventory.GetItemCount(RoR2Content.Items.NovaOnLowHealth) >= 1)
                    {
                        itemCount += 1;
                    }

                    if (inventory.GetItemCount(RoR2Content.Items.LightningStrikeOnHit) >= 1)
                    {
                        itemCount += 1;
                    }

                    if (inventory.GetEquipmentIndex() == RoR2Content.Equipment.Lightning.equipmentIndex || inventory.GetEquipmentIndex() == RoR2Content.Equipment.AffixBlue.equipmentIndex || inventory.GetEquipmentIndex() == RoR2Content.Equipment.BFG.equipmentIndex || inventory.GetEquipmentIndex() == RoR2Content.Equipment.QuestVolatileBattery.equipmentIndex)
                    {
                        itemCount += 1;
                    }

                    if (itemCount >= 4)
                    {
                        base.Grant();
                    }
                }
            }
        }
Exemple #12
0
        private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            orig(self);

            if (self.inventory)
            {
                foreach (EquipmentIcon equipment in new List <EquipmentIcon>(this.EquipmentIconDirty.Keys))
                {
                    if (equipment && equipment.targetInventory == self.inventory)
                    {
                        this.EquipmentIconDirty[equipment] = true;
                    }
                }
                foreach (SkillIcon skill in new List <SkillIcon>(SkillIconDirty.Keys))
                {
                    if (skill && skill.playerCharacterMasterController && skill.playerCharacterMasterController.master == self)
                    {
                        this.SkillIconDirty[skill] = true;
                    }
                }
            }
        }
        private void Check(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            if (self)
            {
                if (self.teamIndex == TeamIndex.Player)
                {
                    if (self.inventory)
                    {
                        if (self.GetBody() && self.GetBody().baseNameToken == "PALADIN_NAME")
                        {
                            if (self.inventory.GetItemCount(ItemIndex.NovaOnHeal) > 0 || self.inventory.GetEquipmentIndex() == EquipmentIndex.AffixPoison)
                            {
                                if (base.meetsBodyRequirement)
                                {
                                    base.Grant();
                                }
                            }
                        }
                    }
                }
            }

            orig(self);
        }
Exemple #14
0
        private void Check(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            if (self)
            {
                if (self.teamIndex == TeamIndex.Player)
                {
                    if (self.inventory)
                    {
                        if (self.GetBody() && self.GetBody().baseNameToken == "PALADIN_NAME")
                        {
                            if (self.inventory.GetTotalItemCountOfTier(ItemTier.Lunar) >= 8)
                            {
                                if (base.meetsBodyRequirement)
                                {
                                    base.Grant();
                                }
                            }
                        }
                    }
                }
            }

            orig(self);
        }
Exemple #15
0
        private void Check(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self)
        {
            if (self)
            {
                if (self.teamIndex == TeamIndex.Player)
                {
                    if (self.inventory)
                    {
                        if (self.GetBody() && self.GetBody().baseNameToken == "PALADIN_NAME")
                        {
                            if (self.inventory.GetItemCount(ItemIndex.SiphonOnLowHealth) > 0)
                            {
                                if (base.meetsBodyRequirement)
                                {
                                    base.Grant();
                                }
                            }
                        }
                    }
                }
            }

            orig(self);
        }