// Token: 0x06001272 RID: 4722 RVA: 0x0004F7DC File Offset: 0x0004D9DC private void GrantItems(Inventory inventory, List <PickupIndex> list, int types, int stackSize) { for (int i = 0; i < types; i++) { inventory.GiveItem(list[UnityEngine.Random.Range(0, list.Count)].itemIndex, stackSize); } }
private void GrantItem(CharacterBody body, Inventory inventory) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantItem(RoR2.CharacterBody,RoR2.Inventory)' called on client"); return; } inventory.GiveItem(this.pickupIndex.itemIndex, 1); GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), this.pickupIndex); UnityEngine.Object.Destroy(base.gameObject); }
// random items private static void RollItems(string ammount) { try { int num; TextSerialization.TryParseInvariant(ammount, out num); if (num > 0) { WeightedSelection <List <PickupIndex> > weightedSelection = new WeightedSelection <List <PickupIndex> >(8); weightedSelection.AddChoice(Run.instance.availableTier1DropList, 80f); weightedSelection.AddChoice(Run.instance.availableTier2DropList, 19f); weightedSelection.AddChoice(Run.instance.availableTier3DropList, 1f); for (int i = 0; i < num; i++) { List <PickupIndex> list = weightedSelection.Evaluate(UnityEngine.Random.value); LocalPlayerInv.GiveItem(list[UnityEngine.Random.Range(0, list.Count)].itemIndex, 1); } } } catch (ArgumentException) { } }
// 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); } } }