コード例 #1
0
        public static DiabloItemExtension AddToItem(Item item)
        {
            if (item.GetExtension(ID) is DiabloItemExtension extension)
            {
                Log.Print(item.name + " already has a " + ID + " component!");
                return(extension);
            }

            DiabloItemExtension ext = item.gameObject.AddComponent <DiabloItemExtension>();

            ext.Savable = true;
            ext.m_item  = item;
            return(ext);
        }
コード例 #2
0
        public void UseOnGear(Equipment item, Character character)
        {
            DiabloItemExtension ext = item.GetComponent <DiabloItemExtension>();

            if (this.ParentItem.ItemID != Items.HELLSTONE_OF_ARCANA_ID && !ext.IsValidRandomDrop())
            {
                character.CharacterUI.ShowInfoNotification("This item isn't magical, and therefore most hellstones can't be used on it. ");
                Item back = ItemManager.Instance.GenerateItemNetwork(ParentItem.ItemID);
                back.ChangeParent(character.Inventory.Pouch.transform);
                return;
            }

            var list = CurrencyEffects.ALL[this.ParentItem.ItemID];

            var effect = list.RandomWeighted().Get();

            effect.ChangeItem(item);

            character.CharacterUI.ShowInfoNotification(effect.GetChatNotification());
        }
コード例 #3
0
        public static void Postfix(Item __instance, ref string __result)
        {
            DiabloItemExtension ext = __instance.gameObject.GetComponent <DiabloItemExtension>();

            if (ext != null)
            {
                String suffix = "";
                String prefix = "";

                if (ext.HasSuffix())
                {
                    suffix = " " + ext.suffix.GetAffix().GetName();
                }
                if (ext.HasPrefix())
                {
                    prefix = ext.prefix.GetAffix().GetName() + " ";
                }

                __result = prefix + __result + suffix;
            }
        }
コード例 #4
0
        private void SL_OnPacksLoaded()
        {
            try
            {
                Items = new Items();
                Log.Print("Items created");


                List <Item> correct   = new List <Item>();
                List <Item> incorrect = new List <Item>();


                foreach (Item item in References.RPM_ITEM_PREFABS.Values)
                {
                    if (ItemUtils.IsValidGear(item, true))
                    {
                        correct.Add(item);
                    }
                    else
                    {
                        if (item is Equipment)
                        {
                            incorrect.Add(item);
                        }
                    }
                }
                Log.Debug("Items considered correct gears: ");

                foreach (Item item in correct)
                {
                    UnityEngine.Object.DontDestroyOnLoad(DiabloItemExtension.AddToItem(item));

                    Log.Debug("ID:" + item.ItemID + " Name:" + item.Name + " : Value: " + item.Value + " Durability: " + item.MaxDurability);
                }
                Log.Debug("Items that aren't considered correct gears: ");

                foreach (Item item in incorrect)
                {
                    Log.Debug(item.name + " is an unused gear item. ID: " + item.ItemID);
                }

                Debug.Log("Finished Adding diablo item extension to all gear items.");


                /*
                 * Tag ingredient = TagSourceManager.GetCraftingIngredient(Recipe.CraftingType.Survival);
                 * correct.Where(x=> !x.HasTag(ingredient)).ToList().ForEach(x => x.Tags.Add(ingredient));
                 * Items.GetHellStones().ForEach(x => x.Get().Tags.Add(ingredient));
                 * // adds ingredient tag so they can be added as ingredients
                 */

                Recipes.Init();

                DoTests();
            }
            catch (Exception e)
            {
                Debug.Log("FAILED TO LOAD GRINDWARD!!!");
                Console.Write(e.ToString());
                Crash();
            }
        }