// Token: 0x0600186E RID: 6254 RVA: 0x000743B4 File Offset: 0x000725B4 private static void RegisterItem(ItemIndex itemIndex, ItemDef itemDef) { itemDef.itemIndex = itemIndex; ItemCatalog.itemDefs[(int)itemIndex] = itemDef; switch (itemDef.tier) { case ItemTier.Tier1: ItemCatalog.tier1ItemList.Add(itemIndex); break; case ItemTier.Tier2: ItemCatalog.tier2ItemList.Add(itemIndex); break; case ItemTier.Tier3: ItemCatalog.tier3ItemList.Add(itemIndex); break; case ItemTier.Lunar: ItemCatalog.lunarItemList.Add(itemIndex); break; } string arg = itemIndex.ToString().ToUpper(); if (itemDef.nameToken == null) { itemDef.nameToken = string.Format(CultureInfo.InvariantCulture, "ITEM_{0}_NAME", arg); } if (itemDef.descriptionToken == null) { itemDef.descriptionToken = string.Format(CultureInfo.InvariantCulture, "ITEM_{0}_DESC", arg); } if (itemDef.pickupToken == null) { itemDef.pickupToken = string.Format(CultureInfo.InvariantCulture, "ITEM_{0}_PICKUP", arg); } if (itemDef.loreToken == null) { itemDef.loreToken = string.Format(CultureInfo.InvariantCulture, "ITEM_{0}_LORE", arg); } if (itemDef.pickupModelPath == null) { itemDef.pickupModelPath = "Prefabs/NullModel"; } if (itemDef.pickupIconPath == null) { itemDef.pickupIconPath = "Textures/ItemIcons/texNullIcon"; } }
public GameObject GetPickupDropletDisplayPrefab() { if (value >= 0) { if (value < TotalItemCount) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)value); string path = null; switch (itemDef.tier) { case ItemTier.Tier1: path = "Prefabs/ItemPickups/Tier1Orb"; break; case ItemTier.Tier2: path = "Prefabs/ItemPickups/Tier2Orb"; break; case ItemTier.Tier3: path = "Prefabs/ItemPickups/Tier3Orb"; break; case ItemTier.Lunar: path = "Prefabs/ItemPickups/LunarOrb"; break; } if (!string.IsNullOrEmpty(path)) { return(Resources.Load <GameObject>(path)); } return(null); } else { if (value < TotalItemCount + TotalEquipmentCount) { return(Resources.Load <GameObject>("Prefabs/ItemPickups/EquipmentOrb")); } if (value < TotalItemCount + TotalEquipmentCount + CoinCount) { return(Resources.Load <GameObject>("Prefabs/ItemPickups/LunarOrb")); } } } return(null); }
// Token: 0x06000D2C RID: 3372 RVA: 0x00041B08 File Offset: 0x0003FD08 public void HighlightItemDisplay(ItemIndex itemIndex) { if (!this.enabledItemDisplays[(int)itemIndex]) { return; } string path = "Prefabs/UI/HighlightTier1Item"; ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (itemDef != null) { switch (itemDef.tier) { case ItemTier.Tier1: path = "Prefabs/UI/HighlightTier1Item"; break; case ItemTier.Tier2: path = "Prefabs/UI/HighlightTier2Item"; break; case ItemTier.Tier3: path = "Prefabs/UI/HighlightTier3Item"; break; case ItemTier.Lunar: path = "Prefabs/UI/HighlightLunarItem"; break; } } for (int i = this.parentedPrefabDisplays.Count - 1; i >= 0; i--) { if (this.parentedPrefabDisplays[i].itemIndex == itemIndex) { GameObject instance = this.parentedPrefabDisplays[i].instance; if (instance) { Renderer componentInChildren = instance.GetComponentInChildren <Renderer>(); if (componentInChildren && this.body) { HighlightRect.CreateHighlight(this.body.gameObject, componentInChildren, Resources.Load <GameObject>(path), -1f, false); } } } } }
// Token: 0x060015BF RID: 5567 RVA: 0x0005CB68 File Offset: 0x0005AD68 public override void OverrideRuleChoices(RuleChoiceMask mustInclude, RuleChoiceMask mustExclude) { base.OverrideRuleChoices(mustInclude, mustExclude); base.ForceChoice(mustInclude, mustExclude, "Difficulty.Normal"); base.ForceChoice(mustInclude, mustExclude, "Misc.StartingMoney.50"); base.ForceChoice(mustInclude, mustExclude, "Misc.StageOrder.Random"); base.ForceChoice(mustInclude, mustExclude, "Misc.KeepMoneyBetweenStages.Off"); for (ArtifactIndex artifactIndex = ArtifactIndex.Command; artifactIndex < ArtifactIndex.Count; artifactIndex++) { RuleDef ruleDef = RuleCatalog.FindRuleDef(artifactIndex.ToString()); RuleChoiceDef ruleChoiceDef = (ruleDef != null) ? ruleDef.FindChoice("Off") : null; if (ruleChoiceDef != null) { base.ForceChoice(mustInclude, mustExclude, ruleChoiceDef); } } ItemIndex itemIndex = ItemIndex.Syringe; ItemIndex itemCount = (ItemIndex)ItemCatalog.itemCount; while (itemIndex < itemCount) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); RuleDef ruleDef2 = RuleCatalog.FindRuleDef("Items." + itemDef.name); RuleChoiceDef ruleChoiceDef2 = (ruleDef2 != null) ? ruleDef2.FindChoice("On") : null; if (ruleChoiceDef2 != null) { base.ForceChoice(mustInclude, mustExclude, ruleChoiceDef2); } itemIndex++; } EquipmentIndex equipmentIndex = EquipmentIndex.CommandMissile; EquipmentIndex equipmentCount = (EquipmentIndex)EquipmentCatalog.equipmentCount; while (equipmentIndex < equipmentCount) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); RuleDef ruleDef3 = RuleCatalog.FindRuleDef("Equipment." + equipmentDef.name); RuleChoiceDef ruleChoiceDef3 = (ruleDef3 != null) ? ruleDef3.FindChoice("On") : null; if (ruleChoiceDef3 != null) { base.ForceChoice(mustInclude, mustExclude, ruleChoiceDef3); } equipmentIndex++; } }
// Token: 0x060018D7 RID: 6359 RVA: 0x0006AF18 File Offset: 0x00069118 public static RuleDef FromItem(ItemIndex itemIndex) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); RuleDef ruleDef = new RuleDef("Items." + itemIndex.ToString(), itemDef.nameToken); RuleChoiceDef ruleChoiceDef = ruleDef.AddChoice("On", null, false); ruleChoiceDef.spritePath = itemDef.pickupIconPath; ruleChoiceDef.tooltipNameToken = itemDef.nameToken; ruleChoiceDef.unlockableName = itemDef.unlockableName; ruleChoiceDef.itemIndex = itemIndex; ruleDef.MakeNewestChoiceDefault(); RuleChoiceDef ruleChoiceDef2 = ruleDef.AddChoice("Off", null, false); ruleChoiceDef2.spritePath = itemDef.pickupIconPath; ruleChoiceDef2.materialPath = "Materials/UI/matRuleChoiceOff"; ruleChoiceDef2.tooltipNameToken = null; return(ruleDef); }
public static List <ItemIndex> GetDefaultDropList(ItemTier itemTier) { var list = new List <ItemIndex>(); for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++) { if (Run.instance.availableItems.HasItem(itemIndex)) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (itemDef.tier == itemTier) { list.Add(itemIndex); } } } return(list); }
// Token: 0x06001B91 RID: 7057 RVA: 0x00081100 File Offset: 0x0007F300 private static int GuessUnlockableSortScore(string unlockableName) { int num = 0; UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName); if (unlockableDef == null) { return(num); } num += 200; ItemDef itemDef = ItemCatalog.allItems.Select(new Func <ItemIndex, ItemDef>(ItemCatalog.GetItemDef)).FirstOrDefault((ItemDef v) => v.unlockableName == unlockableDef.name); if (itemDef != null) { return((int)(num + itemDef.tier)); } num += 200; EquipmentDef equipmentDef = EquipmentCatalog.allEquipment.Select(new Func <EquipmentIndex, EquipmentDef>(EquipmentCatalog.GetEquipmentDef)).FirstOrDefault((EquipmentDef v) => v.unlockableName == unlockableDef.name); if (equipmentDef != null) { if (equipmentDef.isBoss) { return(num + 1); } if (equipmentDef.isLunar) { return(num - 1); } return(num); } else { num += 200; if (SurvivorCatalog.allSurvivorDefs.FirstOrDefault((SurvivorDef v) => v.unlockableName == unlockableDef.name) != null) { return(num); } return(num + 200); } }
protected void CreateItem() { ItemDef itemDef = new RoR2.ItemDef() { name = "ITEM_" + ItemLangTokenName, nameToken = "ITEM_" + ItemLangTokenName + "_NAME", pickupToken = "ITEM_" + ItemLangTokenName + "_NAME", descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION", loreToken = "ITEM_" + ItemLangTokenName + "_LORE", pickupModelPath = ItemModelPath, pickupIconPath = ItemIconPath, hidden = Hidden, tags = ItemTags, canRemove = CanRemove, tier = Tier }; var itemDisplayRuleDict = CreateItemDisplayRules(); Index = ItemAPI.Add(new CustomItem(itemDef, itemDisplayRuleDict)); }
// Token: 0x060005FA RID: 1530 RVA: 0x00018A68 File Offset: 0x00016C68 private static bool IsPickupAllowedForMonsters(PickupIndex pickupIndex) { PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return(false); } ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (itemDef == null) { return(false); } for (int i = 0; i < ArenaMissionController.forbiddenTags.Length; i++) { if (itemDef.ContainsTag(ArenaMissionController.forbiddenTags[i])) { return(false); } } return(true); }
// 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); }
private static extern void orig_RegisterItem(ItemIndex itemIndex, ItemDef itemDef);
public static void RegisterItem(ItemIndex itemIndex, ItemDef itemDef) { orig_RegisterItem(itemIndex, itemDef); }
public void CalculateInvalidInteractables(List <PickupIndex> itemsToDrop) { List <string> tiersPresentKeys = tiersPresent.Keys.ToList(); foreach (string tier in tiersPresentKeys) { tiersPresent[tier] = false; } subsetTiersPresent.Clear(); foreach (string subsetChest in subsetChests) { subsetTiersPresent.Add(subsetChest, new Dictionary <string, bool>()); foreach (string tier in tiersPresentKeys) { subsetTiersPresent[subsetChest].Add(tier, false); } } foreach (PickupIndex pickupIndex in itemsToDrop) { PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef.itemIndex != ItemIndex.None) { if (!Catalogue.scrapItems.ContainsValue(pickupDef.itemIndex)) { if (RoR2.ItemCatalog.tier1ItemList.Contains(pickupDef.itemIndex)) { tiersPresent["tier1"] = true; } else if (RoR2.ItemCatalog.tier2ItemList.Contains(pickupDef.itemIndex)) { tiersPresent["tier2"] = true; } else if (RoR2.ItemCatalog.tier3ItemList.Contains(pickupDef.itemIndex)) { tiersPresent["tier3"] = true; } else if (Catalogue.pearls.Contains(pickupDef.itemIndex)) { tiersPresent["pearl"] = true; } else if (Catalogue.bossItems.Contains(pickupDef.itemIndex)) { tiersPresent["boss"] = true; } else if (RoR2.ItemCatalog.lunarItemList.Contains(pickupDef.itemIndex)) { tiersPresent["lunar"] = true; } if (!RoR2.ItemCatalog.lunarItemList.Contains(pickupDef.itemIndex) && !Catalogue.bossItems.Contains(pickupDef.itemIndex) && !Catalogue.pearls.Contains(pickupDef.itemIndex)) { RoR2.ItemDef itemDef = RoR2.ItemCatalog.GetItemDef(pickupDef.itemIndex); foreach (RoR2.ItemTag itemTag in itemDef.tags) { string interactableName = ""; if (itemTag == RoR2.ItemTag.Damage) { tiersPresent["damage"] = true; interactableName = "CategoryChestDamage"; } else if (itemTag == RoR2.ItemTag.Healing) { tiersPresent["healing"] = true; interactableName = "CategoryChestHealing"; } else if (itemTag == RoR2.ItemTag.Utility) { tiersPresent["utility"] = true; interactableName = "CategoryChestUtility"; } if (subsetChests.Contains(interactableName)) { if (RoR2.ItemCatalog.tier1ItemList.Contains(pickupDef.itemIndex)) { subsetTiersPresent[interactableName]["tier1"] = true; } else if (RoR2.ItemCatalog.tier2ItemList.Contains(pickupDef.itemIndex)) { subsetTiersPresent[interactableName]["tier2"] = true; } else if (RoR2.ItemCatalog.tier3ItemList.Contains(pickupDef.itemIndex)) { subsetTiersPresent[interactableName]["tier3"] = true; } } } } } } else if (pickupDef.equipmentIndex != EquipmentIndex.None) { if (!Catalogue.eliteEquipment.Contains(pickupDef.equipmentIndex)) { RoR2.EquipmentDef equipmentDef = RoR2.EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); if (equipmentDef.isLunar) { tiersPresent["lunar"] = true; } else if (equipmentDef.isBoss) { } else { tiersPresent["equipment"] = true; } } } } List <string> interactableTypeKeys = interactablesTiers.Keys.ToList(); foreach (string interactableType in interactableTypeKeys) { List <string> interactableTypeTierKeys = interactablesTiers[interactableType].Keys.ToList(); foreach (string tier in interactableTypeTierKeys) { interactablesTiers[interactableType][tier] = false; } } foreach (string tier in tiersPresent.Keys) { if (tiersPresent[tier]) { foreach (string interactableType in interactableTypeKeys) { if (interactablesTiers[interactableType].ContainsKey(tier)) { interactablesTiers[interactableType][tier] = true; } } } } List <string> scrapTierKeys = interactablesTiers["Scrapper"].Keys.ToList(); foreach (string tier in scrapTierKeys) { if (interactablesTiers["Scrapper"][tier]) { if (!itemsToDrop.Contains(PickupCatalog.FindPickupIndex(Catalogue.scrapItems[tierConversion[tier]]))) { interactablesTiers["Scrapper"][tier] = false; } } } interactablesInvalid.Clear(); foreach (string interactableType in interactablesTiers.Keys) { bool interactableValid = false; bool allTrue = true; foreach (string tier in interactablesTiers[interactableType].Keys) { if (interactablesTiers[interactableType][tier]) { interactableValid = true; } else { allTrue = false; } } if (!interactableValid || (allTiersMustBePresent.Contains(interactableType) && !allTrue)) { interactablesInvalid.Add(interactableType); } } }
private static void HandlePickupMessage(NetworkMessage netMsg) { Debug.Log("GenericPickupController.HandlePickupMessage: Received pickup message."); ReadOnlyCollection <NotificationQueue> readOnlyInstancesList = NotificationQueue.readOnlyInstancesList; GenericPickupController.PickupMessage pickupMessage = GenericPickupController.pickupMessageInstance; netMsg.ReadMessage <GenericPickupController.PickupMessage>(pickupMessage); GameObject masterGameObject = pickupMessage.masterGameObject; PickupIndex pickupIndex = pickupMessage.pickupIndex; uint pickupQuantity = pickupMessage.pickupQuantity; pickupMessage.Reset(); if (!masterGameObject) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! masterObject is not valid."); return; } CharacterMaster component = masterGameObject.GetComponent <CharacterMaster>(); if (!component) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! master component is not valid."); return; } PlayerCharacterMasterController component2 = component.GetComponent <PlayerCharacterMasterController>(); if (component2) { NetworkUser networkUser = component2.networkUser; if (networkUser) { LocalUser localUser = networkUser.localUser; if (localUser != null) { localUser.userProfile.DiscoverPickup(pickupIndex); } } } for (int i = 0; i < readOnlyInstancesList.Count; i++) { readOnlyInstancesList[i].OnPickup(component, pickupIndex); } CharacterBody body = component.GetBody(); if (!body) { Debug.Log("GenericPickupController.HandlePickupMessage: failed! characterBody is not valid."); } ItemDef itemDef = ItemCatalog.GetItemDef(pickupIndex.itemIndex); if (itemDef != null && itemDef.hidden) { Debug.LogFormat("GenericPickupController.HandlePickupMessage: skipped item {0}, marked hidden.", new object[] { itemDef.nameToken }); return; } Chat.AddPickupMessage(body, pickupIndex.GetPickupNameToken(), pickupIndex.GetPickupColor(), pickupQuantity); if (body) { Util.PlaySound("Play_UI_item_pickup", body.gameObject); } }
private static void Init() { List <PickupDef> list = new List <PickupDef>(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemIndex itemIndex = (ItemIndex)i; ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); PickupDef pickupDef = new PickupDef(); PickupDef pickupDef2 = pickupDef; string str = "ItemIndex."; ItemIndex itemIndex2 = (ItemIndex)i; pickupDef2.internalName = str + itemIndex2.ToString(); pickupDef.itemIndex = itemIndex; pickupDef.displayPrefab = itemDef.pickupModelPrefab; pickupDef.dropletDisplayPrefab = PickupCatalog.< Init > g__GetPickupDropletDisplayPrefabForTier | 11_0 (itemDef.tier); pickupDef.nameToken = itemDef.nameToken; pickupDef.baseColor = ColorCatalog.GetColor(itemDef.colorIndex); pickupDef.darkColor = ColorCatalog.GetColor(itemDef.darkColorIndex); pickupDef.unlockableName = itemDef.unlockableName; pickupDef.interactContextToken = "ITEM_PICKUP_CONTEXT"; pickupDef.isLunar = (itemDef.tier == ItemTier.Lunar); pickupDef.isBoss = (itemDef.tier == ItemTier.Boss); pickupDef.iconTexture = itemDef.pickupIconTexture; list.Add(pickupDef); } GameObject dropletDisplayPrefab = Resources.Load <GameObject>("Prefabs/ItemPickups/EquipmentOrb"); for (int j = 0; j < EquipmentCatalog.equipmentCount; j++) { EquipmentIndex equipmentIndex = (EquipmentIndex)j; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); PickupDef pickupDef3 = new PickupDef(); PickupDef pickupDef4 = pickupDef3; string str2 = "EquipmentIndex."; EquipmentIndex equipmentIndex2 = (EquipmentIndex)j; pickupDef4.internalName = str2 + equipmentIndex2.ToString(); pickupDef3.equipmentIndex = equipmentIndex; pickupDef3.displayPrefab = equipmentDef.pickupModelPrefab; pickupDef3.dropletDisplayPrefab = dropletDisplayPrefab; pickupDef3.nameToken = equipmentDef.nameToken; pickupDef3.baseColor = ColorCatalog.GetColor(equipmentDef.colorIndex); pickupDef3.darkColor = pickupDef3.baseColor; pickupDef3.unlockableName = equipmentDef.unlockableName; pickupDef3.interactContextToken = "EQUIPMENT_PICKUP_CONTEXT"; pickupDef3.isLunar = equipmentDef.isLunar; pickupDef3.isBoss = equipmentDef.isBoss; pickupDef3.iconTexture = equipmentDef.pickupIconTexture; list.Add(pickupDef3); } PickupDef pickupDef5 = new PickupDef(); pickupDef5.internalName = "LunarCoin.Coin0"; pickupDef5.coinValue = 1U; pickupDef5.nameToken = "PICKUP_LUNAR_COIN"; pickupDef5.displayPrefab = Resources.Load <GameObject>("Prefabs/PickupModels/PickupLunarCoin"); pickupDef5.dropletDisplayPrefab = Resources.Load <GameObject>("Prefabs/ItemPickups/LunarOrb"); pickupDef5.baseColor = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem); pickupDef5.darkColor = pickupDef5.baseColor; pickupDef5.interactContextToken = "LUNAR_COIN_PICKUP_CONTEXT"; list.Add(pickupDef5); Action <List <PickupDef> > action = PickupCatalog.modifyPickups; if (action != null) { action(list); } PickupCatalog.SetEntries(list.ToArray()); }