コード例 #1
0
 public CustomElite(string name, EliteDef eliteDef, CustomEquipment equipment, CustomBuff buff, int tier = 1)
 {
     Name      = name;
     EliteDef  = eliteDef;
     Equipment = equipment;
     Buff      = buff;
     Tier      = tier;
 }
コード例 #2
0
        /// <summary>
        /// Add a custom equipment item to the list of available items.
        /// Value for EquipmentDef.ItemIndex can be ignored.
        /// If this is called after the EquipmentCatalog inits then this will return false and ignore the custom equipment item.
        /// </summary>
        /// <param name="item">The equipment item to add.</param>
        /// <returns>the EquipmentIndex of your item if added. -1 otherwise</returns>
        public static int AddCustomEquipment(CustomEquipment item)
        {
            if (_equipmentCatalogInitialized)
            {
                R2API.Logger.LogError($"Too late ! Tried to add equipment item: {item.EquipmentDef.nameToken} after the equipment list was created");
                return(-1);
            }

            item.EquipmentDef.equipmentIndex = (EquipmentIndex)OriginalEquipmentCount + CustomEquipmentCount++;
            EquipmentDefinitions.Add(item);
            return((int)item.EquipmentDef.equipmentIndex);
        }