Esempio n. 1
0
        ///<summary>Registers an equipment with a Beating Embryo enabled config and optionally applies a description append token + config display name (latter will otherwise use equipment name token). Provides optional delegates for all setup/install methods available to internal Embryo hooks.</summary>
        public static void RegisterHook(EquipmentDef equipment, string descAppendToken = null, Func <string> configDisplayNameDelegate = null, Action installHooksDelegate = null, Action uninstallHooksDelegate = null, Action <CharacterBody> addComponentsDelegate = null, Action setupAttributesDelegate = null, Action setupConfigDelegate = null)
        {
            if (equipment == null)
            {
                ClassicItemsPlugin._logger.LogError("Embryo.RegisterHook: cannot register hook for null EquipmentDef. Stack trace as follows:");
                ClassicItemsPlugin._logger.LogError(System.Environment.StackTrace);
            }
            if (Embryo.instance.allHooksInternal.Any(x => x.targetEquipment == equipment))
            {
                ClassicItemsPlugin._logger.LogError($"Embryo.RegisterHook: EquipmentDef {equipment} ({equipment.nameToken}) has already been registered. Stack trace as follows:");
                ClassicItemsPlugin._logger.LogError(System.Environment.StackTrace);
                return;
            }
            var newModule = new DependentEmbryoHook {
                _targetEquipment           = equipment,
                _descriptionAppendToken    = descAppendToken,
                _configDisplayNameDelegate = configDisplayNameDelegate,
                _installHooksDelegate      = installHooksDelegate,
                _uninstallHooksDelegate    = uninstallHooksDelegate,
                _addComponentsDelegate     = addComponentsDelegate,
                _setupAttributesDelegate   = setupAttributesDelegate,
                _setupConfigDelegate       = setupConfigDelegate
            };

            Embryo.instance.allHooksInternal.Add(newModule);
            Embryo.instance.hooksEnabled.Add(newModule, true);
            Embryo.instance.hooksEnabledByDef.Add(newModule.targetEquipment, true);
        }
    public EquipmentDef CreateEquipmentDef()
    {
        Dictionary <string, float> dictionary = new Dictionary <string, float>();

        dictionary.Add(1832607973.ToString(), 300f);
        List <AttributeModifier> list = new List <AttributeModifier>();

        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.INSULATION, (float)TUNING.EQUIPMENT.SUITS.AQUASUIT_INSULATION, STRINGS.EQUIPMENT.PREFABS.AQUA_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.ATHLETICS, (float)TUNING.EQUIPMENT.SUITS.AQUASUIT_ATHLETICS, STRINGS.EQUIPMENT.PREFABS.AQUA_SUIT.NAME, false, false, true));
        list.Add(new AttributeModifier(TUNING.EQUIPMENT.ATTRIBUTE_MOD_IDS.MAX_UNDERWATER_TRAVELCOST, (float)TUNING.EQUIPMENT.SUITS.AQUASUIT_UNDERWATER_TRAVELCOST, STRINGS.EQUIPMENT.PREFABS.AQUA_SUIT.NAME, false, false, true));
        string    id                                = "Aqua_Suit";
        string    sLOT                              = TUNING.EQUIPMENT.SUITS.SLOT;
        SimHashes outputElement                     = SimHashes.Water;
        float     mass                              = (float)TUNING.EQUIPMENT.SUITS.AQUASUIT_MASS;
        string    anim                              = "suit_water_slow_kanim";
        string    sNAPON                            = TUNING.EQUIPMENT.SUITS.SNAPON;
        string    buildOverride                     = "body_water_slow_kanim";
        int       buildOverridePriority             = 6;
        List <AttributeModifier> attributeModifiers = list;

        Tag[] additional_tags = new Tag[1]
        {
            GameTags.Suit
        };
        EquipmentDef equipmentDef = EquipmentTemplates.CreateEquipmentDef(id,sLOT,outputElement,mass,anim,sNAPON,buildOverride,buildOverridePriority,attributeModifiers,null,false,EntityTemplates.CollisionShape.CIRCLE,0.325f,0.325f,additional_tags,null);

        equipmentDef.RecipeDescription = STRINGS.EQUIPMENT.PREFABS.AQUA_SUIT.RECIPE_DESC;
        return(equipmentDef);
    }
Esempio n. 3
0
    public EquipmentDef CreateEquipmentDef()
    {
        Dictionary <string, float> InputElementMassMap = new Dictionary <string, float>();

        InputElementMassMap.Add(LightPackConfig.ID, 1);
        InputElementMassMap.Add(BackPackConfig.ID, 1);
        InputElementMassMap.Add(ReBreatherConfig.ID, 1);
        InputElementMassMap.Add(SlicksterShoesConfig.ID, 1);
        InputElementMassMap.Add(StressPackConfig.ID, 1);
        InputElementMassMap.Add("BasicFabric", 1);
        ClothingWearer.ClothingInfo clothingInfo       = new ClothingWearer.ClothingInfo((string)ID, decorMod, 0f, 0f);
        List <AttributeModifier>    AttributeModifiers = new List <AttributeModifier>()
        {
            new AttributeModifier(Db.Get().Attributes.QualityOfLife.Id, (float)CarryAmount, (string)ID, false, false, true),
            new AttributeModifier(Db.Get().Attributes.CarryAmount.Id, (float)CarryAmount, (string)ID, true, false, true),
            new AttributeModifier(Db.Get().Attributes.Athletics.Id, (float)CarryAmount, (string)ID, false, false, true),
            new AttributeModifier(Db.Get().Amounts.Breath.maxAttribute.Id, (float)CarryAmount, (string)ID, false, false, true),
        };
        EquipmentDef equipmentDef1 = EquipmentTemplates.CreateEquipmentDef("OnePack", TUNING.EQUIPMENT.TOOLS.TOOLSLOT, TUNING.EQUIPMENT.VESTS.FABRICATOR, TUNING.EQUIPMENT.VESTS.FUNKY_VEST_FABTIME, SimHashes.Carbon, InputElementMassMap, (float)TUNING.EQUIPMENT.VESTS.FUNKY_VEST_MASS, "vacillator_charge_kanim", (string)null, "body_water_slow_kanim", 4, AttributeModifiers, (string)null, true, EntityTemplates.CollisionShape.RECTANGLE, 0.75f, 0.4f, (Tag[])null);

        equipmentDef1.OnEquipCallBack   = (System.Action <Equippable>)(eq => CoolVestConfig.OnEquipVest(eq, clothingInfo));
        equipmentDef1.RecipeDescription = Recipe_Desc;

        return(equipmentDef1);
    }
Esempio n. 4
0
        /// <summary>
        /// Adjusts Atmo and Jet suit decor.
        /// </summary>
        /// <param name="options">The options for the decor of those suits.</param>
        /// <param name="suit">The suit def to modify.</param>
        internal static void TuneSuits(DecorReimaginedOptions options, EquipmentDef suit)
        {
            var attr = Db.Get().BuildingAttributes;

            suit.AttributeModifiers.Add(new AttributeModifier(attr.Decor.Id, options.
                                                              AtmoSuitDecor, STRINGS.EQUIPMENT.PREFABS.ATMO_SUIT.NAME, false, false, true));
        }
Esempio n. 5
0
    public void RegisterEquipment(IEquipmentConfig config)
    {
        EquipmentDef equipmentDef      = config.CreateEquipmentDef();
        string       id                = equipmentDef.Id;
        string       name              = equipmentDef.Name;
        string       recipeDescription = equipmentDef.RecipeDescription;
        float        mass              = equipmentDef.Mass;
        bool         unitMass          = true;
        KAnimFile    anim              = equipmentDef.Anim;
        string       initialAnim       = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Ore;
        EntityTemplates.CollisionShape collisionShape = equipmentDef.CollisionShape;
        float      width         = equipmentDef.width;
        float      height        = equipmentDef.height;
        bool       isPickupable  = true;
        SimHashes  outputElement = equipmentDef.OutputElement;
        GameObject gameObject    = EntityTemplates.CreateLooseEntity(id, name, recipeDescription, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, outputElement, null);
        Equippable equippable    = gameObject.AddComponent <Equippable>();

        equippable.def = equipmentDef;
        Debug.Assert((Object)equippable.def != (Object)null);
        equippable.slotID = equipmentDef.Slot;
        Debug.Assert(equippable.slot != null);
        config.DoPostConfigure(gameObject);
        Assets.AddPrefab(gameObject.GetComponent <KPrefabID>());
    }
Esempio n. 6
0
        public static void YellowAspectDef(EquipmentDef OriginalAspect, string[] NewLanguageTokens)
        {
            LanguageAPI.Add(OriginalAspect.ToString().ToUpper() + "_NAME", NewLanguageTokens[0]);
            LanguageAPI.Add(OriginalAspect.ToString().ToUpper() + "_PICKUP", NewLanguageTokens[1]);
            LanguageAPI.Add(OriginalAspect.ToString().ToUpper() + "_DESC", NewLanguageTokens[2]);
            LanguageAPI.Add(OriginalAspect.ToString().ToUpper() + "_LORE", NewLanguageTokens[3]);

            if (OriginalAspect != null)
            {
                ItemDef itemDef = ScriptableObject.CreateInstance <ItemDef>();
                itemDef.name = OriginalAspect.name;
                itemDef.tier = AspectsTier.Value;
                itemDef.pickupModelPrefab = OriginalAspect.pickupModelPrefab;
                itemDef.pickupIconSprite  = OriginalAspect.pickupIconSprite;
                itemDef.nameToken         = OriginalAspect.ToString().ToUpper() + "_NAME";
                itemDef.pickupToken       = OriginalAspect.ToString().ToUpper() + "_PICKUP";
                itemDef.descriptionToken  = OriginalAspect.ToString().ToUpper() + "_DESC";
                itemDef.loreToken         = OriginalAspect.ToString().ToUpper() + "_LORE";
                itemDef.tags = new ItemTag[]
                {
                    ItemTag.Utility,
                    WorldUniqueConfig.Value ? ItemTag.Any : ItemTag.WorldUnique
                };
                NewDefsList.Add(itemDef);
                OldDefsList.Add(OriginalAspect);
            }
        }
Esempio n. 7
0
        public BulletTimer()
        {
            var equipDef = new EquipmentDef
            {
                cooldown         = 40f,
                pickupModelPath  = UmbrellaAssets.PrefabBulletTimer,
                pickupIconPath   = UmbrellaAssets.IconBulletTimer,
                nameToken        = EquipNames.BulletTimer,
                descriptionToken = "Bullet Timer",
                pickupToken      = "Bullet Timer",
                canDrop          = true,
                enigmaCompatible = true
            };

            var rule = new ItemDisplayRule
            {
                ruleType       = ItemDisplayRuleType.ParentedPrefab,
                followerPrefab = UmbrellaAssets.BulletTimerPrefab,
                childName      = "Chest",
                localScale     = new Vector3(0.15f, 0.15f, 0.15f),
                localAngles    = new Vector3(0f, 180f, 0f),
                localPos       = new Vector3(-0.35f, -0.1f, 0f)
            };

            var equip = new CustomEquipment(equipDef, new[] { rule });

            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);

            IL.RoR2.Projectile.ProjectileManager.FireProjectileServer += ProjectileManagerOnFireProjectileServer;
            _startTime = float.NaN;
        }
Esempio n. 8
0
        private static void RegisterEquipment()
        {
            EquipmentDef equipmentDef = new EquipmentDef
            {
                name             = "TempestuousRage",
                nameToken        = "LUNAR_AFFIX_NAME",
                pickupToken      = "LUNAR_AFFIX_PICK",
                descriptionToken = "LUNAR_AFFIX_DESC",
                loreToken        = "LUNAR_AFFIX_LORE",
                isBoss           = false,
                isLunar          = true,
                enigmaCompatible = false,
                canDrop          = true,
                colorIndex       = ColorCatalog.ColorIndex.LunarItem,
                cooldown         = 120f,
                pickupIconPath   = "@AffixGen:Assets/AffixGen/AffixLunar.png",
                pickupModelPath  = "@AffixGen:Assets/AffixGen/LunarAffix.prefab"
            };

            ItemDisplayRuleDict ruleDict = new ItemDisplayRuleDict();

            CustomEquipment equipment = new CustomEquipment(equipmentDef, ruleDict);

            index = ItemAPI.Add(equipment);
        }
Esempio n. 9
0
 public static void CreateEquipmentCanBeRandomlyTriggeredOption(EquipmentDef equipmentDef, string section, bool defaultValue)
 {
     ConfigOptions.ConfigurableValue.CreateBool(
         categoryGUID,
         categoryName,
         config,
         section,
         "Can Be Randomly Triggered",
         defaultValue,
         "Can be rolled by the Bottled Chaos item from the Survivors of the Void DLC",
         onChanged: (newValue) =>
     {
         if (equipmentDef)
         {
             equipmentDef.canBeRandomlyTriggered = newValue;
             var list = EquipmentCatalog.randomTriggerEquipmentList;
             if (list != null && equipmentDef._equipmentIndex != EquipmentIndex.None)
             {
                 var contains = list.Contains(equipmentDef.equipmentIndex);
                 if (newValue != contains)
                 {
                     if (contains)
                     {
                         list.Remove(equipmentDef.equipmentIndex);
                     }
                     else
                     {
                         list.Add(equipmentDef.equipmentIndex);
                     }
                 }
             }
         }
     }
         );
 }
Esempio n. 10
0
 public static void CreateEquipmentEnigmaCompatibleOption(EquipmentDef equipmentDef, string section, bool defaultValue)
 {
     ConfigOptions.ConfigurableValue.CreateBool(
         categoryGUID,
         categoryName,
         config,
         section,
         "Enigma Compatible",
         defaultValue,
         "Can be rolled by the Artifact of Enigma",
         onChanged: (newValue) =>
     {
         if (equipmentDef)
         {
             equipmentDef.enigmaCompatible = newValue;
             var list = EquipmentCatalog.enigmaEquipmentList;
             if (list != null && equipmentDef._equipmentIndex != EquipmentIndex.None)
             {
                 var contains = list.Contains(equipmentDef.equipmentIndex);
                 if (newValue != contains)
                 {
                     if (contains)
                     {
                         list.Remove(equipmentDef.equipmentIndex);
                     }
                     else
                     {
                         list.Add(equipmentDef.equipmentIndex);
                     }
                 }
             }
         }
     }
         );
 }
Esempio n. 11
0
        public static EquipmentDef Add(EquipmentTemplate equipmentTemplate, String contentPackIdentifier = null)
        {
            contentPackIdentifier = contentPackIdentifier ?? Assembly.GetCallingAssembly().GetName().Name;
            if (!ContentPacks.assemblyDict.ContainsKey(contentPackIdentifier))
            {
                ContentPacks.assemblyDict[contentPackIdentifier] = Assembly.GetCallingAssembly();
            }
            EquipmentDef equipmentDef = ScriptableObject.CreateInstance <EquipmentDef>();

            equipmentDef.name     = equipmentTemplate.internalName;
            equipmentDef.cooldown = equipmentTemplate.cooldown ?? equipmentDef.cooldown;
            equipmentDef.isLunar  = equipmentTemplate.isLunar ?? equipmentDef.isLunar;
            equipmentDef.isBoss   = equipmentTemplate.isBoss ?? equipmentDef.isBoss;
            equipmentDef.canDrop  = equipmentTemplate.canDrop ?? equipmentDef.canDrop;
            equipmentDef.appearsInSinglePlayer = equipmentTemplate.appearsInSinglePlayer ?? equipmentDef.appearsInSinglePlayer;
            equipmentDef.appearsInMultiPlayer  = equipmentTemplate.appearsInMultiPlayer ?? equipmentDef.appearsInMultiPlayer;
            equipmentDef.enigmaCompatible      = equipmentTemplate.appearsInSinglePlayer ?? equipmentDef.enigmaCompatible;
            equipmentDef.colorIndex            = equipmentTemplate.colorIndex ?? equipmentDef.colorIndex;
            equipmentDef.unlockableDef         = equipmentTemplate.unlockableDef ?? equipmentDef.unlockableDef;
            equipmentDef.passiveBuffDef        = equipmentTemplate.passiveBuffDef ?? equipmentDef.passiveBuffDef;
            equipmentDef.pickupModelPrefab     = equipmentTemplate.prefab ?? equipmentDef.pickupModelPrefab;
            equipmentDef.pickupIconSprite      = equipmentTemplate.icon ?? equipmentDef.pickupIconSprite;
            equipmentDef.nameToken             = $"EQUIPMENT_{equipmentTemplate.internalName.ToUpper()}_NAME";
            equipmentDef.pickupToken           = $"EQUIPMENT_{equipmentTemplate.internalName.ToUpper()}_PICKUP";
            equipmentDef.descriptionToken      = $"EQUIPMENT_{equipmentTemplate.internalName.ToUpper()}_DESC";
            equipmentDef.loreToken             = $"EQUIPMENT_{equipmentTemplate.internalName.ToUpper()}_LORE";


            Languages.AddTokenString(equipmentDef.nameToken, equipmentTemplate.name);
            Languages.AddTokenString(equipmentDef.pickupToken, equipmentTemplate.pickupText);
            Languages.AddTokenString(equipmentDef.descriptionToken, equipmentTemplate.descriptionText);
            Languages.AddTokenString(equipmentDef.loreToken, equipmentTemplate.loreText);

            return(Add(equipmentDef, equipmentTemplate.characterItemDisplayRules, contentPackIdentifier));
        }
        /// <summary>
        /// Add an item to the item pool from a string.
        /// </summary>
        /// <param name="unlockableRewardIdentifier">The AchievementDef.unlockableRewardIdentifier, e.g. "Item.Bear"</param>
        public void AddItemFromString(string unlockableRewardIdentifier)
        {
            string pattern   = @"\w+\."; //this just means "[infinite letters until]."
            bool   equipment = false;

            unlockableRewardIdentifier = Regex.Replace(unlockableRewardIdentifier, pattern, ""); //remove "[infinite letters until]." so we have the itemname remaining

            foreach (EquipmentIndex i in EquipmentCatalog.equipmentList)
            {
                EquipmentDef EqDef           = EquipmentCatalog.GetEquipmentDef(i);
                string       equipmentString = EqDef.name;
                if (unlockableRewardIdentifier == equipmentString)
                {
                    Run.instance.availableEquipment.Add(EquipmentCatalog.FindEquipmentIndex(unlockableRewardIdentifier));
                    equipment = true;
                    break; //So we don't search everything if we already have it
                }
            }
            if (!equipment)                                                                             //it doesn't matter if we try to find itemindex for characters or logs, due to the fact that they won't have the same name as an available item, and will not result in an ItemIndex that we can use
            {
                Run.instance.availableItems.Add(ItemCatalog.FindItemIndex(unlockableRewardIdentifier)); //Add the item from this string into the available items
            }
            Run.instance.BuildDropTable();                                                              //Makes it so that everything we added actually gets put into the game pool so we can get it on the next items, you can see it that old items do not have it with command, but hopefully that won't matter :]
            UpdateDroppedCommandDroplets();
        }
        private static void AmethystAsEquip()
        {
            R2API.AssetPlus.Languages.AddToken("AMETHYST_NAME_TOKEN", "Gigantic Amethyst");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_PICKUP_TOKEN", "<style=cIsUtility>Reset</style> all your cooldowns.");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_DESCRIPTION_TOKEN", "<style=cIsUtility>Reset</style> all your cooldowns on activation.");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_LORE_TOKEN", "I highly suggest handling this thing with some form of protective gear; we're not sure if it has any effects on the human body.");
            EquipmentDef AmethystEquipmentDef = new EquipmentDef
            {
                name             = "AMETHYST_NAME_TOKEN",
                cooldown         = GiganticAmethyst.Cooldown.Value,
                pickupModelPath  = PrefabPath,
                pickupIconPath   = IconPath,
                nameToken        = "AMETHYST_NAME_TOKEN",
                pickupToken      = "AMETHYST_PICKUP_TOKEN",
                descriptionToken = "AMETHYST_DESCRIPTION_TOKEN",
                loreToken        = "AMETHYST_LORE_TOKEN",
                canDrop          = true,
                enigmaCompatible = true
            };

            ItemDisplayRule[] AmethystDisplayRules = null;

            CustomEquipment AmethystEquipment = new CustomEquipment(AmethystEquipmentDef, AmethystDisplayRules);

            AmethystEquipmentIndex = ItemAPI.Add(AmethystEquipment);
        }
Esempio n. 14
0
 public static void GetEquipmentDefs()
 {
     if (!bannedItems.Value.IsNullOrWhiteSpace())
     {
         string[]            subs          = bannedItems.Value.Split(',');
         List <EquipmentDef> equipmentDefs = new List <EquipmentDef>();
         foreach (var sub in subs)
         {
             var itemIndex = ItemCatalog.FindItemIndex(sub);
             if (itemIndex != ItemIndex.None)
             {
                 itemDefs.Add(ItemCatalog.GetItemDef(itemIndex));
             }
         }
         bannedItemDefs = itemDefs.ToArray();
     }
     if (!defaultItem.Value.IsNullOrWhiteSpace())
     {
         var itemIndexDefault = ItemCatalog.FindItemIndex(defaultItem.Value);
         if (itemIndexDefault != ItemIndex.None)
         {
             defaultItemDef = ItemCatalog.GetItemDef(itemIndexDefault);
         }
     }
 }
Esempio n. 15
0
        private static void LeechAsEquip()
        {
            LanguageAPI.Add("MASSIVELEECH_NAME_TOKEN", "Massive Leech");
            LanguageAPI.Add("MASSIVELEECH_PICKUP_TOKEN", "Grant massive life on hit for 10 seconds.Heal will increase with your level up.");
            LanguageAPI.Add("MASSIVELEECH_DESCRIPTION_TOKEN", "For 10 seconds, every hit <style=cIsHealing>heals</style> you for <style=cIsHealing>10 health</style>. Each level will gain <style=cIsHealing>1 extra health</style>.");
            LanguageAPI.Add("MASSIVELEECH_LORE_TOKEN", @"- Shipping Method:  Volatile
- Order Details:  Giant leeches found in the pools of HYPERION-5. Very similar to its counterpart on Earth, but it seems to have developed teeth as well, allowing it to eat meat as well as siphon blood. A few have been spotted to ballon to enormous proportions,up to the size of a small dog. Like the common leech, this has obvious medical implications. You will just have to be extra careful, or you may come back to no patient and a giant bloody leech.
");
            LanguageAPI.Add("MASSIVELEECH_NAME_TOKEN", "庞大水蛭", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_PICKUP_TOKEN", "在10秒内,攻击汲取巨额生命。吸血值随等级上涨。", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_DESCRIPTION_TOKEN", "10秒内,每次攻击<style=cIsHealing>回复10点生命值</style>。人物每提升一级,就额外获得<style=cIsHealing>1点生命值</style>。", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_LORE_TOKEN", @"- 邮寄方式:易挥发
- 订单详细信息:在HYPERION-5的水池中发现了巨型水蛭。 它与地球上的对应物非常相似,但它似乎也有牙齿,可以吃肉和虹吸血。已经发现他们可以按比例放大,甚至可以达到狗的大小。 像普通的水蛭一样,这也具有明显的医学含义。 您只需要格外小心。
", "zh-CN");

            EquipmentDef LeechEquipmentDef = new EquipmentDef
            {
                name             = "MASSIVELEECH_NAME_TOKEN",
                cooldown         = 45f,
                pickupModelPath  = PrefabPath,
                pickupIconPath   = IconPath,
                nameToken        = "MASSIVELEECH_NAME_TOKEN",
                pickupToken      = "MASSIVELEECH_PICKUP_TOKEN",
                descriptionToken = "MASSIVELEECH_DESCRIPTION_TOKEN",
                loreToken        = "MASSIVELEECH_LORE_TOKEN",
                canDrop          = true,
                enigmaCompatible = true
            };

            ItemDisplayRule[] LeechDisplayRules = null;
            CustomEquipment   LeechEquipment    = new CustomEquipment(LeechEquipmentDef, LeechDisplayRules);

            MassiveLeechIndex = ItemAPI.Add(LeechEquipment);
        }
Esempio n. 16
0
        public JestersDice()
        {
            _rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks);

            var equipDef = new EquipmentDef
            {
                cooldown         = 30f,
                pickupModelPath  = UmbrellaAssets.PrefabJestersDice,
                pickupIconPath   = UmbrellaAssets.IconJestersDice,
                pickupToken      = "Jester's Dice",
                nameToken        = EquipNames.JestersDice,
                descriptionToken = "Jester's Dice",
                canDrop          = true,
                enigmaCompatible = true,
                isLunar          = true
            };

            var prefab = UmbrellaAssets.JestersDicePrefab;
            var rule   = new ItemDisplayRule
            {
                ruleType       = ItemDisplayRuleType.ParentedPrefab,
                followerPrefab = prefab,
                childName      = "Chest",
                localScale     = new Vector3(0.15f, 0.15f, 0.15f),
                localAngles    = new Vector3(0f, 180f, 0f),
                localPos       = new Vector3(-0.35f, -0.1f, 0f)
            };

            var equip = new CustomEquipment(equipDef, new[] { rule });

            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);
        }
Esempio n. 17
0
        private static void BiscoLeashAsEquipment()
        {
            BiscoLeashEquipmentDef = new EquipmentDef
            {
                name              = "BiscosLeashEquipment", // its the internal name, no spaces, apostrophes and stuff like that
                cooldown          = 5f,
                pickupModelPrefab = BiscoLeashPrefab,
                pickupIconSprite  = BiscoLeashIcon,
                nameToken         = "BISCOLEASH_NAME", // stylised name
                pickupToken       = "BISCOLEASH_PICKUP",
                descriptionToken  = "BISCOLEASH_DESC",
                loreToken         = "BISCOLEASH_LORE",
                canDrop           = true,
                enigmaCompatible  = false
            };

            var itemDisplayRules = new ItemDisplayRule[1];                         // keep this null if you don't want the item to show up on the survivor 3d model. You can also have multiple rules !

            itemDisplayRules[0].followerPrefab = BiscoLeashPrefab;                 // the prefab that will show up on the survivor
            itemDisplayRules[0].childName      = "Chest";                          // this will define the starting point for the position of the 3d model, you can see what are the differents name available in the prefab model of the survivors
            itemDisplayRules[0].localScale     = new Vector3(0.15f, 0.15f, 0.15f); // scale the model
            itemDisplayRules[0].localAngles    = new Vector3(0f, 180f, 0f);        // rotate the model
            itemDisplayRules[0].localPos       = new Vector3(-0.35f, -0.1f, 0f);   // position offset relative to the childName, here the survivor Chest

            var biscoLeash = new CustomEquipment(BiscoLeashEquipmentDef, itemDisplayRules);

            ItemAPI.Add(biscoLeash);
        }
Esempio n. 18
0
        private static void HandleAspectDisplay(CharacterModel model, EquipmentDef display, EquipmentDef target, ItemDef item)
        {
            ItemMask  list  = model.enabledItemDisplays;
            ItemIndex index = item.itemIndex;

            if (!target)
            {
                return;
            }

            if (display == target)
            {
                if (!list.Contains(index))
                {
                    list.Add(index);
                    DisplayRuleGroup drg = model.itemDisplayRuleSet.GetEquipmentDisplayRuleGroup(target.equipmentIndex);
                    model.InstantiateDisplayRuleGroup(drg, index, EquipmentIndex.None);
                }
            }
            else
            {
                if (list.Contains(index))
                {
                    list.Remove(index);
                    RemoveAspectDisplay(model, index);
                }
            }
        }
        private void CreateTooltip(Transform parent, PickupDef pickupDefinition, int count)
        {
            ItemDef      itemDefinition = ItemCatalog.GetItemDef(pickupDefinition.itemIndex);
            EquipmentDef equipmentDef   = EquipmentCatalog.GetEquipmentDef(pickupDefinition.equipmentIndex);
            bool         isItem         = itemDefinition != null;

            TooltipContent content = new TooltipContent();

            content.titleColor = pickupDefinition.darkColor;
            content.titleToken = isItem ? itemDefinition.nameToken : equipmentDef.nameToken;
            content.bodyToken  = isItem ? itemDefinition.descriptionToken : equipmentDef.descriptionToken;

            if (isItem && ItemStatsMod.enabled)
            {
                CharacterMaster master = PlayerCharacterMasterController.instances[0].master;

                string stats = ItemStatsMod.GetStats(itemDefinition.itemIndex, count, master);

                if (stats != null)
                {
                    content.overrideBodyText = $"{Language.GetString(content.bodyToken)}{stats}";
                }
            }

            TooltipProvider tooltipProvider = parent.gameObject.AddComponent <TooltipProvider>();

            tooltipProvider.SetContent(content);
        }
Esempio n. 20
0
        public static CustomElite TestElite()
        {
            LoadAssets();

            var eliteDef = new EliteDef
            {
                modifierToken = "Cloaky",
                color         = new Color32(255, 105, 180, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = "",
                nameToken        = "Cloaky",
                pickupToken      = "Cloaky",
                descriptionToken = "Cloaky",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, _prefab, _icon, _itemDisplayRules);
            var buff  = new CustomBuff("Affix_Cloaky", buffDef, null);
            var elite = new CustomElite("Cloaky", eliteDef, equip, buff, 1);

            return(elite);
        }
 /// <summary>
 /// Applied after CreateEquipmentDef runs.
 /// </summary>
 internal static void Postfix(EquipmentDef __result)
 {
     if (__result != null && Options != null)
     {
         PUtil.LogDebug("Jet Suit: {0:D}".F(Options.AtmoSuitDecor));
         DecorTuning.TuneSuits(Options, __result);
     }
 }
Esempio n. 22
0
        public CustomEquipment(EquipmentDef equipmentDef, GameObject prefab, Object icon, ItemDisplayRule[] itemDisplayRules)
        {
            EquipmentDef = equipmentDef;
            Prefab       = prefab;
            Icon         = icon;

            ItemDisplayRules = itemDisplayRules;
        }
Esempio n. 23
0
        public StormElitesManager()
        {
            var eliteDef = new EliteDef
            {
                modifierToken = EliteName,
                color         = new Color32(162, 179, 241, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = HailstormAssets.IconStormElite,
                nameToken        = EquipName,
                pickupToken      = "Storm Bringer",
                descriptionToken = "Storm Bringer",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                iconPath  = HailstormAssets.IconStormElite,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]);
            var buff  = new CustomBuff(BuffName, buffDef);
            var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1);

            EliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite);
            BuffIndex  = (BuffIndex)ItemAPI.AddCustomBuff(buff);
            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);
            eliteDef.eliteEquipmentIndex = EquipIndex;
            equipDef.passiveBuff         = BuffIndex;
            buffDef.eliteIndex           = EliteIndex;

            //Storm elites are immune to twisters
            TwisterProjectileController.ImmunityBuff = BuffIndex;
            TornadoLauncher.StormBuff = BuffIndex;

            //Storm elites are tier 2 elites, on the same order as malachites
            //They're a bit less tanky than malachites, but even more dangerous in terms of damage
            var card = new EliteAffixCard
            {
                spawnWeight      = 1.0f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 6.0f,
                healthBoostCoeff = 20.0f,
                eliteType        = EliteIndex,
                isAvailable      = () => Run.instance.loopClearCount > 0,
                onSpawned        = OnSpawned
            };

            //Register the card for spawning if ESO is enabled
            EsoLib.Cards.Add(card);
            Card = card;
        }
Esempio n. 24
0
 /// <summary>
 /// You can omit the index references for the EliteDef, as those will be filled in automatically by the API.
 /// You can retrieve a vanilla EquipmentDef through RoR2Content.Equipments class
 /// Also, don't forget to give it a valid eliteTier so that your custom elite correctly get spawned.
 /// You can also make a totally new tier, by using OverrideCombatDirectorEliteTiers for example.
 /// </summary>
 public CustomElite(string?name, EquipmentDef equipmentDef, Color32 color, string?modifierToken, int eliteTier)
 {
     EliteDef      = ScriptableObject.CreateInstance <EliteDef>();
     EliteDef.name = name;
     EliteDef.eliteEquipmentDef = equipmentDef;
     EliteDef.color             = color;
     EliteDef.modifierToken     = modifierToken;
     EliteTier = eliteTier;
 }
Esempio n. 25
0
 /// <summary>
 /// You can omit giving a value to <see cref="EliteDef.eliteIndex"/>, as it'll be filled in automatically by the game.
 /// For your custom elite to spawn, you need to provide an enumerable of <see cref="CombatDirector.EliteTierDef"/> as second parameter.
 /// The API will then add your <see cref="EliteDef"/> in them.
 /// You can also make a totally new tier, by either
 /// directly modifying the array through <see cref="EliteAPI.GetCombatDirectorEliteTiers"/> and <see cref="EliteAPI.OverrideCombatDirectorEliteTiers"/>
 /// or by using <see cref="EliteAPI.AddCustomEliteTier(CombatDirector.EliteTierDef?)"/>
 /// </summary>
 public CustomElite(string?name, EquipmentDef equipmentDef, Color32 color, string?modifierToken, IEnumerable <CombatDirector.EliteTierDef> eliteTierDefs)
 {
     EliteDef      = ScriptableObject.CreateInstance <EliteDef>();
     EliteDef.name = name;
     EliteDef.eliteEquipmentDef = equipmentDef;
     EliteDef.color             = color;
     EliteDef.modifierToken     = modifierToken;
     EliteTierDefs = eliteTierDefs;
 }
Esempio n. 26
0
 public static EquipmentDef Add(EquipmentDef equipmentDef, ItemDisplays.CharacterItemDisplayRule[] characterItemDisplayRules = null, String contentPackIdentifier = null)
 {
     contentPackIdentifier = contentPackIdentifier ?? Assembly.GetCallingAssembly().GetName().Name;
     if (!ContentPacks.assemblyDict.ContainsKey(contentPackIdentifier))
     {
         ContentPacks.assemblyDict[contentPackIdentifier] = Assembly.GetCallingAssembly();
     }
     ContentPacks.Packs[contentPackIdentifier].equipmentDefs.Add(equipmentDef);
     ItemDisplays.AddItemDisplayRules(equipmentDef, characterItemDisplayRules);
     return(equipmentDef);
 }
Esempio n. 27
0
        private static void ApplyAspectDisplays(CharacterModel model, bool isDead = false)
        {
            if (!model.itemDisplayRuleSet)
            {
                return;
            }

            EquipmentDef  displayDef = null;
            CharacterBody body       = model.body;

            if (body)
            {
                UpdateBodyEliteDisplay(body, isDead);

                EquipmentDef equipDefFromBody = GetBodyEliteDisplay(body);
                if (equipDefFromBody)
                {
                    displayDef = equipDefFromBody;
                }
            }

            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixLunar, Catalog.Item.ZetAspectLunar);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixPoison, Catalog.Item.ZetAspectPoison);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixHaunted, Catalog.Item.ZetAspectHaunted);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixRed, Catalog.Item.ZetAspectRed);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixBlue, Catalog.Item.ZetAspectBlue);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixWhite, Catalog.Item.ZetAspectWhite);

            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixEarth, Catalog.Item.ZetAspectEarth);
            HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixVoid, Catalog.Item.ZetAspectVoid);

            if (Catalog.SpikeStrip.Enabled)
            {
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixAragonite, Catalog.Item.ZetAspectAragonite);
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixVeiled, Catalog.Item.ZetAspectVeiled);
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixWarped, Catalog.Item.ZetAspectWarped);
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixPlated, Catalog.Item.ZetAspectPlated);
            }

            if (Catalog.GoldenCoastPlus.Enabled)
            {
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixGold, Catalog.Item.ZetAspectGold);
            }

            if (Catalog.Aetherium.Enabled)
            {
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixSanguine, Catalog.Item.ZetAspectSanguine);
            }

            if (Catalog.Bubbet.Enabled)
            {
                HandleAspectDisplay(model, displayDef, Catalog.Equip.AffixSepia, Catalog.Item.ZetAspectSepia);
            }
        }
Esempio n. 28
0
 /// <summary>
 /// Registers an equipment def to the item catalog
 /// </summary>
 /// <param name="equipmentDef">The equipment def you want to register.</param>
 public static void RegisterEquipment(EquipmentDef equipmentDef)
 {
     //Check if the SurvivorDef has already been registered.
     if (EquipmentDefDefinitions.Contains(equipmentDef))
     {
         LogCore.LogE(equipmentDef + " has already been registered, please do not register the same EquipmentDef twice.");
         return;
     }
     //If not, add it to our SurvivorDefinitions
     EquipmentDefDefinitions.Add(equipmentDef);
 }
Esempio n. 29
0
        /// <summary>
        /// Applied to EquipmentTemplates to properly debug missing item anims.
        /// </summary>
        private static void CreateEquipmentDef_Postfix(EquipmentDef __result, string Anim,
                                                       string Id)
        {
            var anim = __result?.Anim;

            if (anim == null)
            {
                Debug.LogWarningFormat("(when looking for KAnim named {0} on equipment {1})",
                                       Anim, Id);
            }
        }
        // Token: 0x060021B4 RID: 8628 RVA: 0x0009EE88 File Offset: 0x0009D088
        public void SetEquipment(EquipmentIndex equipmentIndex)
        {
            EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex);

            this.titleText.token       = equipmentDef.nameToken;
            this.descriptionText.token = equipmentDef.pickupToken;
            if (equipmentDef.pickupIconPath != null)
            {
                this.iconImage.texture = Resources.Load <Texture>(equipmentDef.pickupIconPath);
            }
            this.titleTMP.color = ColorCatalog.GetColor(equipmentDef.colorIndex);
        }