private void LoadData()
    {
        //  Load rare item data
        RareItemDB.Load(ProgramControl.Options.GetOption(OptionData.OptionNames.RSVersion) as RSVersionOption);

        //  Load boss info
        bossInfoDictionary.Load(ProgramControl.Options.GetOptionValue(RSVersionOption.Name()));

        //  Load bosslog dictionary
        bossLogsDictionary.Load(bossInfoDictionary.GetBossIDs());

        SetupItemsDictionary.Setup(sheetID);
    }
Esempio n. 2
0
    public void AddItem()
    {
        //  Get a reference to the selected item
        Item  item = DataController.Instance.itemList.AtIndex(itemDropdown.value);
        ulong itemAmount;// = ulong.Parse(itemAmountInputField.text);

        //  Make sure text field value is in valid range
        if (!ulong.TryParse(itemAmountInputField.text, out itemAmount))
        {
            InputWarningWindow.Instance.OpenWindow($"You must enter a value between 0 and {uint.MaxValue} (or {ushort.MaxValue} for rare items)!");
            itemAmountInputField.text = "";
            return;
        }

        //  Check to ensure proper input
        if (itemAmount > ushort.MaxValue && RareItemDB.IsRare(CacheManager.currentBoss.bossName, item.itemID))
        {
            InputWarningWindow.Instance.OpenWindow($"Rare items are limited to a quantity of {ushort.MaxValue}!");
            itemAmountInputField.text = "";
            return;
        }
        if (itemAmount > uint.MaxValue && !RareItemDB.IsRare(CacheManager.currentBoss.bossName, item.itemID))
        {
            InputWarningWindow.Instance.OpenWindow($"Non-rare items are limited to a quantity of {uint.MaxValue}!");
            itemAmountInputField.text = "";
            return;
        }

        if ((ulong)itemAmount * item.price > ulong.MaxValue)
        {
            InputWarningWindow.Instance.OpenWindow($"Cannot add {itemAmount} {item.itemName}!\nMax loot value is {ulong.MaxValue}.");
            return;
        }

        //  Item is already in the droplist so update our drop object
        if (DataController.Instance.dropList.Exists(item.itemName))
        {
            DataController.Instance.dropList.AddToDrop(item.itemName, (uint)itemAmount);
        }
        //  Item is not yet in the drop list so add it as a new drop
        else
        {
            DataController.Instance.dropList.Add(new ItemSlot(item, (uint)itemAmount));
        }

        itemAmountInputField.text = "";
        //  Jump back to itemdropdown - QoL to make adding lots of items at once easier and accessible using only the keyboard
        itemDropdown.Select();
        DataController.Instance.dropList.Print();
    }
Esempio n. 3
0
 public string GetName()
 {
     return(RareItemDB.GetRareItemName(CacheManager.currentBoss.bossName, itemID));
 }
Esempio n. 4
0
    //  Generate and display our data in UI
    private void GenerateList(int addedItemID)
    {
        listUpdated = true;

        //  Destroy each button and clear the list
        if (dropListButtons.Count > 0)
        {
            foreach (GameObject button in dropListButtons)
            {
                Destroy(button.gameObject);
            }

            dropListButtons.Clear();
        }

        for (int i = 0; i < DataController.Instance.dropList.Count; ++i)
        {
            //  Create and add a button to the list of buttons
            GameObject button = Instantiate(buttonTemplate) as GameObject;
            dropListButtons.Add(button);
            button.SetActive(true);

            ItemSlot itemSlot = DataController.Instance.dropList.AtIndex(in i);

            //  Set drop the button will be linked to (this sets the button text as well)
            button.GetComponent <DropListButton>().SetDrop(in itemSlot, itemSlot.item.itemID == addedItemID);

            //  Set parent so scroll + layout group function properly
            button.transform.SetParent(buttonTemplate.transform.parent, false);

            Image buttonImage = button.GetComponent <Image>();

            //  Set button background color based on normal vs unique/rare drops
            if (RareItemDB.IsRare(CacheManager.currentBoss.bossName, itemSlot.item.itemID))
            {
                buttonImage.color = RAREBACKGROUNDCOLOR;
            }
            else
            {
                buttonImage.color = NORMALBACKGROUNDCOLOR;
            }
        }

        //  Set scrollbar to proper position
        if (addedItemID == -1)
        {
            scrollPosition = 1;
        }
        else
        {
            ItemSlot itemSlot = DataController.Instance.dropList.Find(addedItemID);

            if (itemSlot == null)
            {
                scrollPosition = 1;
            }
            else
            {
                int dropIndex = DataController.Instance.dropList.IndexOf(in itemSlot);

                if (dropIndex == 0)
                {
                    scrollPosition = 1.0f;
                }
                else
                {
                    scrollPosition = (1 - ((float)(dropIndex + 1) / DataController.Instance.dropList.Count));
                }
            }
        }

        StartCoroutine(SetScrollPos());
    }