예제 #1
0
 /*
  * Create & read config into blacklists.
  */
 private void initConf()
 {
     //Set Language for storing item names as their ingame English locale inside config comments.
     Language.LoadAllFilesForLanguage("EN_US");
     //Loop through itemIndex to generate config entry per item.
     for (ItemIndex ii = ItemIndex.Syringe; ii < ItemIndex.Count; ii++)
     {
         icBanned[(int)ii] = Config.Wrap(
             "Items",
             ii.ToString(),
             Language.GetString(ItemCatalog.GetItemDef(ii).nameToken, "EN_US") + " Default Value = false",
             false
             );
         //Ban item if configured value is true.
         if (icBanned[(int)ii].Value == true)
         {
             iblackList.Add(ii);
         }
     }
     //Loop through EquipmentIndex to generate config entry per item.
     for (EquipmentIndex ei = EquipmentIndex.CommandMissile; ei < EquipmentIndex.Count; ei++)
     {
         ecBanned[(int)ei] = Config.Wrap(
             "Equipment",
             ei.ToString(),
             Language.GetString(EquipmentCatalog.GetEquipmentDef(ei).nameToken, "EN_US") + " Default Value = false",
             false
             );
         //Ban equipment if configured value is true.
         if (ecBanned[(int)ei].Value == true)
         {
             eblackList.Add(ei);
         }
     }
 }
예제 #2
0
        // Token: 0x06000585 RID: 1413 RVA: 0x00017050 File Offset: 0x00015250
        private static void RegisterEquipment(EquipmentIndex equipmentIndex, EquipmentDef equipmentDef)
        {
            equipmentDef.equipmentIndex = equipmentIndex;
            EquipmentCatalog.equipmentDefs[(int)equipmentIndex] = equipmentDef;
            if (equipmentDef.canDrop)
            {
                EquipmentCatalog.equipmentList.Add(equipmentIndex);
            }
            if (equipmentDef.enigmaCompatible)
            {
                EquipmentCatalog.enigmaEquipmentList.Add(equipmentIndex);
            }
            if (equipmentDef.name == null)
            {
                equipmentDef.name = equipmentIndex.ToString();
            }
            string name = equipmentDef.name;
            string arg  = name.ToUpper(CultureInfo.InvariantCulture);

            if (equipmentDef.nameToken == null)
            {
                equipmentDef.nameToken = string.Format(CultureInfo.InvariantCulture, "EQUIPMENT_{0}_NAME", arg);
            }
            if (equipmentDef.descriptionToken == null)
            {
                equipmentDef.descriptionToken = string.Format(CultureInfo.InvariantCulture, "EQUIPMENT_{0}_DESC", arg);
            }
            if (equipmentDef.pickupToken == null)
            {
                equipmentDef.pickupToken = string.Format(CultureInfo.InvariantCulture, "EQUIPMENT_{0}_PICKUP", arg);
            }
            if (equipmentDef.loreToken == null)
            {
                equipmentDef.loreToken = string.Format(CultureInfo.InvariantCulture, "EQUIPMENT_{0}_LORE", arg);
            }
            if (equipmentDef.pickupModelPath == null)
            {
                equipmentDef.pickupModelPath = "Prefabs/NullModel";
            }
            if (equipmentDef.pickupIconPath == null)
            {
                equipmentDef.pickupIconPath = "Textures/ItemIcons/texNullIcon";
            }
            EquipmentCatalog.equipmentNameToIndex[name] = equipmentIndex;
        }
        // Token: 0x060018D8 RID: 6360 RVA: 0x0006AFB8 File Offset: 0x000691B8
        public static RuleDef FromEquipment(EquipmentIndex equipmentIndex)
        {
            EquipmentDef  equipmentDef  = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
            RuleDef       ruleDef       = new RuleDef("Equipment." + equipmentIndex.ToString(), equipmentDef.nameToken);
            RuleChoiceDef ruleChoiceDef = ruleDef.AddChoice("On", null, false);

            ruleChoiceDef.spritePath              = equipmentDef.pickupIconPath;
            ruleChoiceDef.tooltipBodyToken        = equipmentDef.nameToken;
            ruleChoiceDef.unlockableName          = equipmentDef.unlockableName;
            ruleChoiceDef.equipmentIndex          = equipmentIndex;
            ruleChoiceDef.availableInMultiPlayer  = equipmentDef.appearsInMultiPlayer;
            ruleChoiceDef.availableInSinglePlayer = equipmentDef.appearsInSinglePlayer;
            ruleDef.MakeNewestChoiceDefault();
            RuleChoiceDef ruleChoiceDef2 = ruleDef.AddChoice("Off", null, false);

            ruleChoiceDef2.spritePath       = equipmentDef.pickupIconPath;
            ruleChoiceDef2.materialPath     = "Materials/UI/matRuleChoiceOff";
            ruleChoiceDef2.tooltipBodyToken = null;
            return(ruleDef);
        }
예제 #4
0
        // Token: 0x060004F1 RID: 1265 RVA: 0x00013D7C File Offset: 0x00011F7C
        public void ConvertRuntimeValuesToSerializableValues()
        {
            List <ItemDisplayRuleSet.NamedRuleGroup> list = new List <ItemDisplayRuleSet.NamedRuleGroup>();
            int i   = 0;
            int num = Math.Min(this.runtimeItemRuleGroups.Length, 99);

            while (i < num)
            {
                if (this.runtimeItemRuleGroups[i].rules.Length != 0)
                {
                    List <ItemDisplayRuleSet.NamedRuleGroup> list2 = list;
                    ItemDisplayRuleSet.NamedRuleGroup        item  = default(ItemDisplayRuleSet.NamedRuleGroup);
                    ItemIndex itemIndex = (ItemIndex)i;
                    item.name             = itemIndex.ToString();
                    item.displayRuleGroup = this.runtimeItemRuleGroups[i];
                    list2.Add(item);
                }
                i++;
            }
            List <ItemDisplayRuleSet.NamedRuleGroup> list3 = new List <ItemDisplayRuleSet.NamedRuleGroup>();
            int j    = 0;
            int num2 = Math.Min(this.runtimeEquipmentRuleGroups.Length, 34);

            while (j < num2)
            {
                if (this.runtimeEquipmentRuleGroups[j].rules.Length != 0)
                {
                    List <ItemDisplayRuleSet.NamedRuleGroup> list4 = list3;
                    ItemDisplayRuleSet.NamedRuleGroup        item  = default(ItemDisplayRuleSet.NamedRuleGroup);
                    EquipmentIndex equipmentIndex = (EquipmentIndex)j;
                    item.name             = equipmentIndex.ToString();
                    item.displayRuleGroup = this.runtimeEquipmentRuleGroups[j];
                    list4.Add(item);
                }
                j++;
            }
            this.namedItemRuleGroups      = list.ToArray();
            this.namedEquipmentRuleGroups = list3.ToArray();
        }
예제 #5
0
 public override string ToString() => $"DropItemMessage: {(IsItem ? ItemIndex.ToString() : EquipmentIndex.ToString())}";
예제 #6
0
 // Token: 0x06001787 RID: 6023 RVA: 0x0006F864 File Offset: 0x0006DA64
 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);
         }
     }
     for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++)
     {
         RuleDef       ruleDef2       = RuleCatalog.FindRuleDef("Items." + itemIndex.ToString());
         RuleChoiceDef ruleChoiceDef2 = (ruleDef2 != null) ? ruleDef2.FindChoice("On") : null;
         if (ruleChoiceDef2 != null)
         {
             base.ForceChoice(mustInclude, mustExclude, ruleChoiceDef2);
         }
     }
     for (EquipmentIndex equipmentIndex = EquipmentIndex.CommandMissile; equipmentIndex < EquipmentIndex.Count; equipmentIndex++)
     {
         RuleDef       ruleDef3       = RuleCatalog.FindRuleDef("Equipment." + equipmentIndex.ToString());
         RuleChoiceDef ruleChoiceDef3 = (ruleDef3 != null) ? ruleDef3.FindChoice("On") : null;
         if (ruleChoiceDef3 != null)
         {
             base.ForceChoice(mustInclude, mustExclude, ruleChoiceDef3);
         }
     }
 }
예제 #7
0
 // Token: 0x0600193C RID: 6460 RVA: 0x00079024 File Offset: 0x00077224
 static PickupIndex()
 {
     PickupIndex.allPickupNames[0] = "None";
     for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++)
     {
         PickupIndex.allPickupNames[(int)(1 + itemIndex)] = "ItemIndex." + itemIndex.ToString();
     }
     for (EquipmentIndex equipmentIndex = EquipmentIndex.CommandMissile; equipmentIndex < EquipmentIndex.Count; equipmentIndex++)
     {
         PickupIndex.allPickupNames[(int)(79 + equipmentIndex)] = "EquipmentIndex." + equipmentIndex.ToString();
     }
     for (int i = 105; i < 106; i++)
     {
         PickupIndex.allPickupNames[1 + i] = "LunarCoin.Coin" + (i - 105);
     }
     PickupIndex.stringToPickupIndexTable = new Dictionary <string, PickupIndex>();
     for (int j = 0; j < PickupIndex.allPickupNames.Length; j++)
     {
         PickupIndex.stringToPickupIndexTable.Add(PickupIndex.allPickupNames[j], new PickupIndex(j - 1));
     }
 }
예제 #8
0
        private void OnRegisterEquipment(EquipmentCatalog.orig_RegisterEquipment orig, EquipmentIndex equipmentIndex, EquipmentDef equipmentDef)
        {
            if (equipmentDef == null || !equipmentDef.canDrop)
            {
                orig.Invoke(equipmentIndex, equipmentDef);
                return;
            }

            int defTier = equipmentDef.isLunar ? 2 : 1;

            string equipmentNameToken = equipmentDef.nameToken;

            if (equipmentNameToken == null)
            {
                equipmentNameToken = equipmentIndex.ToString();
            }

            string upper = equipmentNameToken.ToUpper(CultureInfo.InvariantCulture);

            foreach (string ch in _invalidConfigChars)
            {
                upper = upper.Replace(ch, string.Empty);
            }

            ConfigWrapper <int> c = Config.Wrap("Equipment Tiers", upper + " tier",
                                                "Tier of this equipment. 0 is no tier, 1 is standard, 2 is lunar", defTier);

            int newTier = c.Value;

            if (newTier == defTier)
            {
                orig.Invoke(equipmentIndex, equipmentDef);
                return;
            }

            switch (newTier)
            {
            case 1:
            {
                equipmentDef.isLunar    = false;
                equipmentDef.colorIndex = ColorCatalog.ColorIndex.Equipment;
                break;
            }

            case 2:
            {
                equipmentDef.isLunar    = true;
                equipmentDef.colorIndex = ColorCatalog.ColorIndex.LunarItem;
                break;
            }

            default:
            {
                equipmentDef.canDrop = false;
                equipmentDef.isLunar = false;     // Don't know if this is needed, but better safe than sorry!
                break;
            }
            }

            Logger.LogInfo("Changing tier of " + upper + ".");

            orig.Invoke(equipmentIndex, equipmentDef);
        }
        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());
        }