// Token: 0x06001357 RID: 4951 RVA: 0x00052D40 File Offset: 0x00050F40 private static int CleanseInventoryServer(Inventory inventory) { int num = 0; for (int i = 0; i < ShrineCleanseBehavior.cleansableItems.Length; i++) { ItemIndex itemIndex = ShrineCleanseBehavior.cleansableItems[i]; int itemCount = inventory.GetItemCount(itemIndex); if (itemCount != 0) { inventory.RemoveItem(itemIndex, itemCount); num += itemCount; } } int num2 = 0; int j = 0; int equipmentSlotCount = inventory.GetEquipmentSlotCount(); while (j < equipmentSlotCount) { EquipmentState equipment = inventory.GetEquipment((uint)j); for (int k = 0; k < ShrineCleanseBehavior.cleansableEquipments.Length; k++) { if (equipment.equipmentIndex == ShrineCleanseBehavior.cleansableEquipments[k]) { inventory.SetEquipment(EquipmentState.empty, (uint)j); num2++; } } j++; } return(num + num2); }
// Token: 0x060019D1 RID: 6609 RVA: 0x0007B5B0 File Offset: 0x000797B0 public static RunReport.PlayerInfo Generate(PlayerCharacterMasterController playerCharacterMasterController) { CharacterMaster characterMaster = playerCharacterMasterController.master; Inventory inventory = characterMaster.inventory; PlayerStatsComponent component = playerCharacterMasterController.GetComponent <PlayerStatsComponent>(); RunReport.PlayerInfo playerInfo = new RunReport.PlayerInfo(); playerInfo.networkUser = playerCharacterMasterController.networkUser; playerInfo.master = characterMaster; playerInfo.bodyIndex = BodyCatalog.FindBodyIndex(characterMaster.bodyPrefab); playerInfo.killerBodyIndex = characterMaster.GetKillerBodyIndex(); StatSheet.Copy(component.currentStats, playerInfo.statSheet); playerInfo.itemAcquisitionOrder = inventory.itemAcquisitionOrder.ToArray(); for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++) { playerInfo.itemStacks[(int)itemIndex] = inventory.GetItemCount(itemIndex); } playerInfo.equipment = new EquipmentIndex[inventory.GetEquipmentSlotCount()]; uint num = 0u; while ((ulong)num < (ulong)((long)playerInfo.equipment.Length)) { playerInfo.equipment[(int)num] = inventory.GetEquipment(num).equipmentIndex; num += 1u; } return(playerInfo); }
// Token: 0x06001356 RID: 4950 RVA: 0x00052CC8 File Offset: 0x00050EC8 private static bool InventoryIsCleansable(Inventory inventory) { for (int i = 0; i < ShrineCleanseBehavior.cleansableItems.Length; i++) { if (inventory.GetItemCount(ShrineCleanseBehavior.cleansableItems[i]) > 0) { return(true); } } int j = 0; int equipmentSlotCount = inventory.GetEquipmentSlotCount(); while (j < equipmentSlotCount) { EquipmentState equipment = inventory.GetEquipment((uint)j); for (int k = 0; k < ShrineCleanseBehavior.cleansableEquipments.Length; k++) { if (equipment.equipmentIndex == ShrineCleanseBehavior.cleansableEquipments[k]) { return(true); } } j++; } return(false); }
// Token: 0x0600117E RID: 4478 RVA: 0x00056D58 File Offset: 0x00054F58 private MageElement GetAwardedElementFromInventory() { Inventory inventory = this.characterBody.inventory; if (inventory) { MageElement mageElement = (MageElement)inventory.GetItemCount(ItemIndex.MageAttunement); if (mageElement >= MageElement.None && mageElement < MageElement.Count) { return(mageElement); } } return(MageElement.None); }
// Token: 0x06000D2B RID: 3371 RVA: 0x00041AD4 File Offset: 0x0003FCD4 public void UpdateItemDisplay(Inventory inventory) { for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++) { if (inventory.GetItemCount(itemIndex) > 0) { this.EnableItemDisplay(itemIndex); } else { this.DisableItemDisplay(itemIndex); } } }
// Token: 0x06001181 RID: 4481 RVA: 0x00056ED0 File Offset: 0x000550D0 public void SetElement(MageElement newElement) { if (!NetworkServer.active) { return; } Inventory inventory = this.characterBody.inventory; if (inventory) { MageElement mageElement = (MageElement)inventory.GetItemCount(ItemIndex.MageAttunement); if (mageElement != newElement) { int count = (int)(newElement - mageElement); inventory.GiveItem(ItemIndex.MageAttunement, count); } } }
//clears inventory, duh. public static void ClearInventory() { if (LocalPlayerInv) { //Loops through every item in ItemIndex enum foreach (string itemName in Enum.GetNames(typeof(ItemIndex))) { ItemIndex itemIndex = (ItemIndex)Enum.Parse(typeof(ItemIndex), itemName); //Convert itemName string to and ItemIndex LocalPlayerInv.ResetItem(itemIndex); int itemCount = LocalPlayerInv.GetItemCount(itemIndex); //If an item exists, delete the whole stack of it if (itemCount >= 0) // Just > doesnt delete from top bar { LocalPlayerInv.RemoveItem(itemIndex, itemCount); LocalPlayerInv.ResetItem(itemIndex); LocalPlayerInv.itemAcquisitionOrder.Remove(itemIndex); } } LocalPlayerInv.SetEquipmentIndex(EquipmentIndex.None); } }
private void ResetInv(RoR2.Inventory inv = null) { foreach (GameObject go in TileList) { Destroy(go); } InvData.Clear(); TileList.Clear(); int team_player = 0; int current_player_items = 0; foreach (var player in PlayerCharacterMasterController.instances) { inv = player.master.GetBody().inventory; var inv_order = (List <ItemIndex>)inv.itemAcquisitionOrder; using (List <ItemIndex> .Enumerator enumerator = (inv_order).GetEnumerator()) { while (enumerator.MoveNext()) { ItemIndex current = enumerator.Current; if (current == ItemIndex.DrizzlePlayerHelper) { continue; } ItemData itemdata = new ItemData(inv.GetItemCount(current), current); float overflowcounter = (Camera.main.aspect >= 2.0) ? 23 : 11; float tile_size_offset = (inv_order.Count < overflowcounter) ? tile_size : tile_size * ((overflowcounter) / inv_order.Count); float modified_horizontal_tile_offset = horizontal_tile_offset - (tile_size - tile_size_offset) / 2; GameObject TileSetup = Instantiate(PersonalTile, ExchangeWindow.transform); TileSetup.GetComponent <RectTransform>().anchoredPosition = new Vector2(tile_size_offset * (current_player_items) + modified_horizontal_tile_offset, vertical_tile_offset - team_player * team_offset_size); int TilePos = TileList.Count; TileSetup.GetComponent <Button>().onClick.AddListener(() => RegisterOffer(TilePos, player.master.GetBody())); InvData.Add(itemdata); TileList.Add(TileSetup); current_player_items++; } } team_player++; current_player_items = 0; } }
static void PreventRevivesShuffle(On.RoR2.ShrineRestackBehavior.orig_AddShrineStack orig, ShrineRestackBehavior self, Interactor interactor) { if (NetworkServer.active) { //Remove revives before shuffling so it doesn't add to the shuffle RoR2.Inventory playerInventory = interactor.GetComponent <CharacterBody>().master.inventory; playerInventory.RemoveItem(RoR2Content.Items.ExtraLife, 9999); playerInventory.RemoveItem(RoR2Content.Items.ExtraLifeConsumed, 9999); //Shuffle orig(self, interactor); //Reshuffle if shuffle landed on a revive item while (playerInventory.GetItemCount(RoR2Content.Items.ExtraLife) != 0 || playerInventory.GetItemCount(RoR2Content.Items.ExtraLife) != 0) { playerInventory.ShrineRestackInventory(Run.instance.treasureRng); } } else { orig(self, interactor); } }
// Token: 0x0600117F RID: 4479 RVA: 0x00056D90 File Offset: 0x00054F90 private MageElement CalcElementToAward() { for (int i = 0; i < MageCalibrationController.elementCounter.Length; i++) { MageCalibrationController.elementCounter[i] = 0; } Inventory inventory = this.characterBody.inventory; if (!inventory) { return(MageElement.None); } List <ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder; for (int j = 0; j < itemAcquisitionOrder.Count; j++) { ItemIndex itemIndex = itemAcquisitionOrder[j]; ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (itemDef.mageElement != MageElement.None) { int num = 0; switch (itemDef.tier) { case ItemTier.Tier1: num = 1; break; case ItemTier.Tier2: num = 2; break; case ItemTier.Tier3: num = 3; break; case ItemTier.Lunar: num = 3; break; } MageCalibrationController.elementCounter[(int)itemDef.mageElement] += num * inventory.GetItemCount(itemIndex); } } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(inventory.currentEquipmentIndex); if (equipmentDef != null && equipmentDef.mageElement != MageElement.None) { MageCalibrationController.elementCounter[(int)equipmentDef.mageElement] += 2; } MageElement result = MageElement.None; int num2 = 0; for (MageElement mageElement = MageElement.Fire; mageElement < MageElement.Count; mageElement += 1) { int num3 = MageCalibrationController.elementCounter[(int)mageElement]; if (num3 > num2) { result = mageElement; num2 = num3; } } if (num2 >= 5) { return(result); } return(MageElement.None); }
// Token: 0x06000A98 RID: 2712 RVA: 0x0002E380 File Offset: 0x0002C580 private void FixedUpdate() { this.UpdateInventory(); if (NetworkServer.active) { this.subcooldownTimer -= Time.fixedDeltaTime; if (this.missileTimer > 0f) { this.missileTimer = Mathf.Max(this.missileTimer - Time.fixedDeltaTime, 0f); } if (this.missileTimer == 0f && this.remainingMissiles > 0) { this.remainingMissiles--; this.missileTimer = 0.125f; this.FireMissile(); } this.UpdateGoldGat(); if (this.bfgChargeTimer > 0f) { this.bfgChargeTimer -= Time.fixedDeltaTime; if (this.bfgChargeTimer < 0f) { Vector3 position = base.transform.position; Ray aimRay = this.GetAimRay(); Transform transform = this.FindActiveEquipmentDisplay(); if (transform) { ChildLocator componentInChildren = transform.GetComponentInChildren <ChildLocator>(); if (componentInChildren) { Transform transform2 = componentInChildren.FindChild("Muzzle"); if (transform2) { aimRay.origin = transform2.position; } } } this.healthComponent.TakeDamageForce(aimRay.direction * -1500f, true, false); ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/BeamSphere"), aimRay.origin, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, this.characterBody.damage * 2f, 0f, Util.CheckRoll(this.characterBody.crit, this.characterBody.master), DamageColorIndex.Item, null, -1f); this.bfgChargeTimer = 0f; } } if (this.equipmentIndex == EquipmentIndex.PassiveHealing != this.passiveHealingFollower) { if (this.equipmentIndex == EquipmentIndex.PassiveHealing) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/HealingFollower"), base.transform.position, Quaternion.identity); this.passiveHealingFollower = gameObject.GetComponent <HealingFollowerController>(); this.passiveHealingFollower.NetworkownerBodyObject = base.gameObject; NetworkServer.Spawn(gameObject); } else { UnityEngine.Object.Destroy(this.passiveHealingFollower.gameObject); this.passiveHealingFollower = null; } } } if (!this.inputBank.activateEquipment.justPressed) { Inventory inventory = this.inventory; if (((inventory != null) ? inventory.GetItemCount(ItemIndex.AutoCastEquipment) : 0) <= 0) { return; } } if (this.hasEffectiveAuthority) { if (NetworkServer.active) { this.ExecuteIfReady(); return; } this.CallCmdExecuteIfReady(); } }
// Token: 0x06001008 RID: 4104 RVA: 0x0004FE58 File Offset: 0x0004E058 public float Heal(float amount, ProcChainMask procChainMask, bool nonRegen = true) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Single RoR2.HealthComponent::Heal(System.Single, RoR2.ProcChainMask, System.Boolean)' called on client"); return(0f); } if (!this.alive || amount <= 0f) { return(0f); } float num = this.health; CharacterMaster characterMaster = null; Inventory inventory = null; bool flag = false; if (this.body) { if (this.body.HasBuff(BuffIndex.RepairMode)) { amount *= 3f; } characterMaster = this.body.master; if (characterMaster) { inventory = characterMaster.inventory; if (inventory && inventory.currentEquipmentIndex == EquipmentIndex.LunarPotion && !procChainMask.HasProc(ProcType.LunarPotionActivation)) { this.potionReserve += amount; return(amount); } if (nonRegen && !procChainMask.HasProc(ProcType.CritHeal) && Util.CheckRoll(this.body.critHeal, characterMaster)) { procChainMask.AddProc(ProcType.CritHeal); flag = true; } } } if (flag) { amount *= 2f; } if (this.increaseHealingCount > 0) { amount *= 1f + (float)this.increaseHealingCount; } if (nonRegen && this.repeatHealComponent && !procChainMask.HasProc(ProcType.RepeatHeal)) { this.repeatHealComponent.healthFractionToRestorePerSecond = 0.1f / (float)this.repeatHealCount; this.repeatHealComponent.AddReserve(amount * (float)(1 + this.repeatHealCount), this.fullHealth); return(0f); } this.Networkhealth = Mathf.Min(this.health + amount, this.fullHealth); if (nonRegen) { HealthComponent.SendHeal(base.gameObject, amount, flag); if (inventory && !procChainMask.HasProc(ProcType.HealNova)) { int itemCount = inventory.GetItemCount(ItemIndex.NovaOnHeal); if (itemCount > 0) { this.devilOrbHealPool = Mathf.Min(this.devilOrbHealPool + amount * (float)itemCount, this.fullCombinedHealth); } } } if (flag) { GlobalEventManager.instance.OnCrit(this.body, characterMaster, amount / this.fullHealth * 10f, procChainMask); } if (nonRegen) { Action <HealthComponent, float> action = HealthComponent.onCharacterHealServer; if (action != null) { action(this, amount); } } return(this.health - num); }
// Token: 0x0600138F RID: 5007 RVA: 0x0005F7EC File Offset: 0x0005D9EC public void OnInteractionBegin(Interactor activator) { if (!this.CanBeAffordedByInteractor(activator)) { return; } CharacterBody component = activator.GetComponent <CharacterBody>(); switch (this.costType) { case CostType.Money: if (component) { CharacterMaster master = component.master; if (master) { master.money -= (uint)this.cost; } } break; case CostType.PercentHealth: { HealthComponent component2 = activator.GetComponent <HealthComponent>(); if (component2) { float health = component2.health; float num = component2.fullHealth * (float)this.cost / 100f; if (health > num) { component2.TakeDamage(new DamageInfo { damage = num, attacker = base.gameObject, position = base.transform.position, damageType = DamageType.BypassArmor }); } } break; } case CostType.Lunar: { NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject); if (networkUser) { networkUser.DeductLunarCoins((uint)this.cost); } break; } case CostType.WhiteItem: case CostType.GreenItem: case CostType.RedItem: { ItemTier itemTier = PurchaseInteraction.CostTypeToItemTier(this.costType); if (component) { Inventory inventory = component.inventory; if (inventory) { ItemIndex itemIndex = ItemIndex.None; ShopTerminalBehavior component3 = base.GetComponent <ShopTerminalBehavior>(); if (component3) { itemIndex = component3.CurrentPickupIndex().itemIndex; } WeightedSelection <ItemIndex> weightedSelection = new WeightedSelection <ItemIndex>(8); foreach (ItemIndex itemIndex2 in ItemCatalog.allItems) { if (itemIndex2 != itemIndex) { int itemCount = inventory.GetItemCount(itemIndex2); if (itemCount > 0 && ItemCatalog.GetItemDef(itemIndex2).tier == itemTier) { weightedSelection.AddChoice(itemIndex2, (float)itemCount); } } } List <ItemIndex> list = new List <ItemIndex>(); int num2 = 0; while (weightedSelection.Count > 0 && num2 < this.cost) { int num3 = weightedSelection.EvaluteToChoiceIndex(this.rng.nextNormalizedFloat); WeightedSelection <ItemIndex> .ChoiceInfo choice = weightedSelection.GetChoice(num3); ItemIndex value = choice.value; int num4 = (int)choice.weight; num4--; if (num4 <= 0) { weightedSelection.RemoveChoice(num3); } else { weightedSelection.ModifyChoiceWeight(num3, (float)num4); } list.Add(value); num2++; } for (int i = num2; i < this.cost; i++) { list.Add(itemIndex); } for (int j = 0; j < list.Count; j++) { ItemIndex itemIndex3 = list[j]; PurchaseInteraction.CreateItemTakenOrb(component.corePosition, base.gameObject, itemIndex3); inventory.RemoveItem(itemIndex3, 1); if (itemIndex3 != itemIndex) { Action <PurchaseInteraction, Interactor> action = PurchaseInteraction.onItemSpentOnPurchase; if (action != null) { action(this, activator); } } } } } break; } } IEnumerable <StatDef> statDefsToIncrement = this.purchaseStatNames.Select(new Func <string, StatDef>(StatDef.Find)); StatManager.OnPurchase <IEnumerable <StatDef> >(component, this.costType, statDefsToIncrement); this.onPurchase.Invoke(activator); this.lastActivator = activator; }
// Token: 0x06000D25 RID: 3365 RVA: 0x000412A8 File Offset: 0x0003F4A8 private void UpdateOverlays() { for (int i = 0; i < this.overlaysCount; i++) { this.currentOverlays[i] = null; } this.overlaysCount = 0; if (this.visibility == VisibilityLevel.Invisible) { return; } EliteIndex eliteIndex = EliteCatalog.IsEquipmentElite(this.inventoryEquipmentIndex); this.myEliteIndex = (int)eliteIndex; if (this.myEliteIndex >= 0) { if (this.body) { AkSoundEngine.SetRTPCValue("eliteEnemy", 1f, this.body.gameObject); } } else if (this.body) { AkSoundEngine.SetRTPCValue("eliteEnemy", 0f, this.body.gameObject); } if (this.body) { bool flag = this.body.HasBuff(BuffIndex.ClayGoo); Inventory inventory = this.body.inventory; this.isGhost = (inventory != null && inventory.GetItemCount(ItemIndex.Ghost) > 0); if (this.body.HasBuff(BuffIndex.RepairMode)) { Material[] array = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array[j] = CharacterModel.repairModeMaterial; } if (this.body.HasBuff(BuffIndex.AttackSpeedOnCrit)) { Material[] array2 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array2[j] = CharacterModel.wolfhatMaterial; } if (this.body.healthComponent && this.body.healthComponent.shield > 0f) { Material[] array3 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array3[j] = CharacterModel.energyShieldMaterial; } if (this.body.HasBuff(BuffIndex.FullCrit)) { Material[] array4 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array4[j] = CharacterModel.fullCritMaterial; } if (this.body.HasBuff(BuffIndex.BeetleJuice)) { Material[] array5 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array5[j] = CharacterModel.beetleJuiceMaterial; } if (this.body.HasBuff(BuffIndex.Immune)) { Material[] array6 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array6[j] = CharacterModel.immuneMaterial; } if (this.body.HasBuff(BuffIndex.Slow80)) { Material[] array7 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array7[j] = CharacterModel.slow80Material; } if (this.body.HasBuff(BuffIndex.Invincibility)) { Material[] array8 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array8[j] = CharacterModel.bellBuffMaterial; } if (flag) { Material[] array9 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array9[j] = CharacterModel.clayGooMaterial; } if (this.body.inventory && this.body.inventory.GetItemCount(ItemIndex.LunarDagger) > 0) { Material[] array10 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array10[j] = CharacterModel.brittleMaterial; } if (this.isGhost) { Material[] array11 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array11[j] = CharacterModel.ghostMaterial; } if (this.body.equipmentSlot) { if (this.body.equipmentSlot.equipmentIndex == EquipmentIndex.AffixGold) { if (!this.goldAffixEffect) { this.goldAffixEffect = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/GoldAffixEffect"), base.transform); ParticleSystem component = this.goldAffixEffect.GetComponent <ParticleSystem>(); SkinnedMeshRenderer skinnedMeshRenderer = null; foreach (CharacterModel.RendererInfo rendererInfo in this.rendererInfos) { if (rendererInfo.renderer is SkinnedMeshRenderer) { skinnedMeshRenderer = (SkinnedMeshRenderer)rendererInfo.renderer; break; } } ParticleSystem.ShapeModule shape = component.shape; if (skinnedMeshRenderer) { shape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer; shape.skinnedMeshRenderer = skinnedMeshRenderer; } } } else if (this.goldAffixEffect) { UnityEngine.Object.Destroy(this.goldAffixEffect); } } if (this.wasPreviouslyClayGooed && !flag) { TemporaryOverlay temporaryOverlay = base.gameObject.AddComponent <TemporaryOverlay>(); temporaryOverlay.duration = 0.6f; temporaryOverlay.animateShaderAlpha = true; temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); temporaryOverlay.destroyComponentOnEnd = true; temporaryOverlay.originalMaterial = CharacterModel.clayGooMaterial; temporaryOverlay.AddToCharacerModel(this); } this.wasPreviouslyClayGooed = this.body.HasBuff(BuffIndex.ClayGoo); } for (int k = 0; k < this.temporaryOverlays.Count; k++) { Material[] array13 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array13[j] = this.temporaryOverlays[k].materialInstance; } this.materialsDirty = true; }