Exemplo n.º 1
0
        public void Randomize(Item item)
        {
            Log.Debug("Randomizing item's affix: " + item.Name);


            ChangeItemStats((Equipment)item, StatChangeType.REMOVE);


            GearType type = ItemUtils.GetGearType(item);

            if (type == null)
            {
                UnityEngine.Debug.Log("Gear Type is null? Aborting suffix generation.");
                return;
            }

            List <A> possible = GetAll().Where(x => x.CanBeOnGearType(type)).ToList();

            if (possible.Count > 0)
            {
                A affix = RandomUtils.WeightedRandom(possible);

                this.id      = affix.GetId();
                this.percent = RollPercent();

                //UnityEngine.Debug.Log("Affix generated succesfully");
            }

            ChangeItemStats((Equipment)item, StatChangeType.ADD);
        }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
        protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
        {
            Character character = _affectedCharacter;

            if (character && character.Inventory && character.Inventory.Pouch)
            {
                List <Item> items = character.Inventory.Pouch.GetContainedItems().Where(x => ItemUtils.IsValidGear(x)).ToList();

                if (items.Count() == 1)
                {
                    UseOnGear((Equipment)items[0], character);
                }
            }
        }