Пример #1
0
        private static void LoadMagnifingGlass()
        {
            MagnifingGlassItemDef = new ItemDef
            {
                name = "MagnifyingGlass",
                tier = ItemTier.Tier3,
                pickupModelPrefab = MagnifingGlassPrefab,
                pickupIconSprite  = MagnifingGlassIcon,
                nameToken         = "MAGGLASS_NAME",
                pickupToken       = "MAGGLASS_PICKUP",
                descriptionToken  = "MAGGLASS_DESC",
                loreToken         = "MAGGLASS_LORE",
                tags = new[]
                {
                    ItemTag.AIBlacklist,
                    ItemTag.Utility
                }
            };

            var itemDisplayRules = new ItemDisplayRule[1];

            itemDisplayRules[0].followerPrefab = MagnifingGlassPrefab;
            itemDisplayRules[0].childName      = "Chest";
            itemDisplayRules[0].localScale     = new Vector3(0.15f, 0.15f, 0.15f);
            itemDisplayRules[0].localAngles    = new Vector3(0f, 180f, 0f);
            itemDisplayRules[0].localPos       = new Vector3(-0.35f, -0.1f, 0f);

            var biscoLeash = new R2API.CustomItem(MagnifingGlassItemDef, itemDisplayRules);

            ItemAPI.Add(biscoLeash);
        }
Пример #2
0
        private static void LoadExtMag()
        {
            ExtendedMagItemDef = new ItemDef
            {
                name = "ExtMag",
                tier = ItemTier.Tier2,
                pickupModelPrefab = ExtendedMagPrefab,
                pickupIconSprite  = ExtendedMagIcon,
                nameToken         = "EXTMAG_NAME",
                pickupToken       = "EXTMAG_PICKUP",
                descriptionToken  = "EXTMAG_DESC",
                loreToken         = "EXTMAG_LORE",
                tags = new[]
                {
                    ItemTag.AIBlacklist,
                    ItemTag.Utility
                }
            };

            var itemDisplayRules = new ItemDisplayRule[1];

            itemDisplayRules[0].followerPrefab = ExtendedMagPrefab;
            itemDisplayRules[0].childName      = "Waist";
            itemDisplayRules[0].localScale     = new Vector3(0.15f, 0.15f, 0.15f);
            itemDisplayRules[0].localAngles    = new Vector3(0f, 180f, 0f);
            itemDisplayRules[0].localPos       = new Vector3(-0.35f, -0.1f, 0f);

            var bagoMoney = new R2API.CustomItem(ExtendedMagItemDef, itemDisplayRules);

            ItemAPI.Add(bagoMoney);
        }
Пример #3
0
        private static void AddRitualDagger()
        {
            var RitualDaggerItemDef = new ItemDef
            {
                name             = "RitualDagger", // its the internal name, no spaces, apostrophes and stuff like that
                tier             = ItemTier.Tier1,
                pickupModelPath  = PrefabPath + "dagger.prefab",
                pickupIconPath   = IconPath,
                nameToken        = "RitualDagger_NAME", // stylised name
                pickupToken      = "RitualDagger_PICKUP",
                descriptionToken = "RitualDagger_DESC",
                loreToken        = "RitualDagger_LORE",
                tags             = new[]
                {
                    ItemTag.Utility,
                    ItemTag.Damage
                }
            };

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

            var RitualDagger = new R2API.CustomItem(RitualDaggerItemDef, itemDisplayRules);

            RitualDaggerItemIndex = ItemAPI.Add(RitualDagger); // ItemAPI sends back the ItemIndex of your item
        }
Пример #4
0
        private static void BiscoLeashAsRedTierItem()
        {
            BiscoLeashItemDef = new ItemDef
            {
                name = "BiscosLeash", // its the internal name, no spaces, apostrophes and stuff like that
                tier = ItemTier.Tier3,
                pickupModelPrefab = BiscoLeashPrefab,
                pickupIconSprite  = BiscoLeashIcon,
                nameToken         = "BISCOLEASH_NAME", // stylised name
                pickupToken       = "BISCOLEASH_PICKUP",
                descriptionToken  = "BISCOLEASH_DESC",
                loreToken         = "BISCOLEASH_LORE",
                tags = new[]
                {
                    ItemTag.Utility,
                    ItemTag.Damage
                }
            };

            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 R2API.CustomItem(BiscoLeashItemDef, itemDisplayRules);

            ItemAPI.Add(biscoLeash); // ItemAPI sends back the ItemIndex of your item
        }
Пример #5
0
        private static void AddExtraItemPickupItem()
        {
            var ExtraItemPickupItemDef = new ItemDef
            {
                name             = "ExtraItemPickup",
                tier             = ItemTier.Tier3,
                pickupModelPath  = LuckyItems.ModPrefix + "Assets/Items/OnPickupItem/pickup_item.prefab",
                pickupIconPath   = LuckyItems.ModPrefix + "Assets/Items/OnPickupItem/pickup_item_pic.png",
                nameToken        = "EXTRAITEMPICKUP_NAME",
                pickupToken      = "EXTRAITEMPICKUP_PICKUP",
                descriptionToken = "EXTRAITEMPICKUP_DESC",
                loreToken        = "EXTRAITEMPICKUP_LORE",
                tags             = new[]
                {
                    ItemTag.Utility,
                    ItemTag.AIBlacklist
                }
            };

            ItemDisplayRule[] itemDisplayRules = new ItemDisplayRule[0];

            var ExtraItemPickup = new R2API.CustomItem(ExtraItemPickupItemDef, itemDisplayRules);

            ExtraItemPickupItemIndex = ItemAPI.Add(ExtraItemPickup);
        }
Пример #6
0
        private static void AddExtraShrineRollItem()
        {
            var ExtraShrineRollItemDef = new ItemDef
            {
                name             = "ExtraShrineRoll",
                tier             = ItemTier.Tier2,
                pickupModelPath  = LuckyItems.ModPrefix + "Assets/Items/ShrineItem/shrine_item.prefab",
                pickupIconPath   = LuckyItems.ModPrefix + "Assets/Items/ShrineItem/shrine_item_pic.png",
                nameToken        = "EXTRASHRINEROLL_NAME",
                pickupToken      = "EXTRASHRINEROLL_PICKUP",
                descriptionToken = "EXTRASHRINEROLL_DESC",
                loreToken        = "EXTRASHRINEROLL_LORE",
                tags             = new[]
                {
                    ItemTag.Utility,
                    ItemTag.AIBlacklist
                }
            };

            ItemDisplayRule[] itemDisplayRules = new ItemDisplayRule[0];

            var extraShrineRoll = new R2API.CustomItem(ExtraShrineRollItemDef, itemDisplayRules);

            ExtraShrineRollItemIndex = ItemAPI.Add(extraShrineRoll); // ItemAPI sends back the ItemIndex of your item
        }
Пример #7
0
        private static void garbAsGreenTierItem(ItemDisplayRuleDict nullDisplay)
        {
            var garbItemDef = new ItemDef
            {
                name             = "Garb",
                nameToken        = "CLOAKONKILL_NAME",
                pickupToken      = "CLOAKONKILL_PICKUP",
                descriptionToken = "CLOAKONKILL_DESC",
                loreToken        = "CLOAKONKILL_LORE",
                tier             = ItemTier.Tier2,
                pickupIconPath   = ModPrefix + "Assets/Import/garb/garb.PNG",
                pickupModelPath  = ModPrefix + "Assets/Import/garb/garb.fbx",
                canRemove        = true,
                hidden           = false,
                tags             = new[]
                {
                    ItemTag.Utility,
                    ItemTag.OnKillEffect,
                    ItemTag.AIBlacklist
                }
            };

            var garb = new R2API.CustomItem(garbItemDef, nullDisplay);

            garbItemIndex = ItemAPI.Add(garb);
        }
Пример #8
0
        /*
         * ITEMS
         */
        private static void aPistolAsRedTierItem(ItemDisplayRuleDict nullDisplay)
        {
            var aPistolItemDef = new ItemDef
            {
                // Internally used name
                name = "ArmouredPistol",
                // Name to be assigned for the user to see
                nameToken        = "ARMOURONHIT_NAME",
                pickupToken      = "ARMOURONHIT_PICKUP",
                descriptionToken = "ARMOURONHIT_DESC",
                loreToken        = "ARMOURONHIT_LORE",
                // Item rarity
                tier            = ItemTier.Tier3,
                pickupIconPath  = ModPrefix + "Assets/Import/aPistol/aPistol.png",
                pickupModelPath = ModPrefix + "Assets/Import/aPistol/aPistol.fbx",
                // Used for item upgrades and 3D printers
                canRemove = true,
                // Visible in the top item list
                hidden = false,
                // Item tags, used for identification and searching
                tags = new[]
                {
                    ItemTag.Utility,
                }
            };
            // Add the Items to the R2API
            var aPistol = new R2API.CustomItem(aPistolItemDef, nullDisplay);

            // Create Itemindex variables by adding items to ItemAPI
            aPistolItemIndex = ItemAPI.Add(aPistol);
        }
Пример #9
0
        /// <summary>
        /// Add a custom item to the list of available items.
        /// Value for ItemDef.ItemIndex can be ignored.
        /// If this is called after the ItemCatalog inits then this will return false and ignore the custom item.
        /// </summary>
        /// <param name="item">The item to add.</param>
        /// <returns>the ItemIndex of your item if added. -1 otherwise</returns>
        public static int AddCustomItem(CustomItem item)
        {
            if (_itemCatalogInitialized)
            {
                R2API.Logger.LogError($"Too late ! Tried to add item: {item.ItemDef.nameToken} after the item list was created");
                return(-1);
            }

            item.ItemDef.itemIndex = (ItemIndex)OriginalItemCount + CustomItemCount++;
            ItemDefinitions.Add(item);
            return((int)item.ItemDef.itemIndex);
        }
Пример #10
0
        internal static void Init()
        {
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PocketPrinter.printer"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new AssetBundleResourcesProvider(ModPrefix.TrimEnd(':'), bundle);
                ResourcesAPI.AddProvider(provider);

                PocketPrinterPrefab = bundle.LoadAsset <GameObject>(PrefabPath);
            }

            bool isRedItem = PocketPrinter.FilamentAsRedItem.Value;

            // Register pocket printer as item
            var pocketPrinterItemDef = new ItemDef
            {
                name             = "PocketPrinter",
                tier             = isRedItem ? ItemTier.Tier3 : ItemTier.Tier2,
                pickupModelPath  = PrefabPath,
                pickupIconPath   = isRedItem ? AltIconPath : IconPath,
                nameToken        = "Adaptive Filament",
                pickupToken      = "Duplicates the next item you pick up.\nOnly usable once",
                descriptionToken = "<style=cIsUtility>Turns into a copy</style> of the next item you pick up before being destroyed.",
                loreToken        = "",
                tags             = new[]
                {
                    ItemTag.Utility,
                    ItemTag.AIBlacklist
                }
            };

            // For now, we just won't render it - this might change in the future
            var itemDisplayRules = new ItemDisplayRule[1];
            var pocketPrinter    = new R2API.CustomItem(pocketPrinterItemDef, itemDisplayRules);

            PocketPrinterItemIndex = ItemAPI.Add(pocketPrinter);
        }