private void SetupHitChance() { if (ProgramControl.Options.GetOptionValue(RSVersionOption.Name()) == "OSRS") { return; } hitChanceController.Setup(); EventManager.Instance.onBossDropdownValueChanged -= SetupHitChance; }
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); }
// Fill our item list with data from Google Doc private void FillItemList() { // Do not re-fill the item list if user is not loading data AND has the BossSync option turned off if ((ProgramState.CurrentState != ProgramState.states.Drops) && !bool.Parse(ProgramControl.Options.GetOptionValue(BossSyncOption.Name()))) { Debug.Log($"Not filling item list"); return; } Debug.Log("filling item list"); itemList.Clear(); itemList.haveRareDropsBeenAdded = false; // Read in the spreadsheet with item data for the new boss SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search (sheetID, (CacheManager.currentBoss.bossName + " " + ProgramControl.Options.GetOptionValue(RSVersionOption.Name()))), itemList.FillItemList); }
public static void Load(RSVersionOption rsVersionOption) { data = new Dictionary <string, List <RareItemStruct> >(); string loadPath = filePath + rsVersionOption.GetValue() + "RareItems.xml"; Debug.Log(loadPath); XmlDocument doc = new XmlDocument(); doc.Load(loadPath); // For each item foreach (XmlNode itemNode in doc.DocumentElement) { // First child should be itemName XmlNode childNode = itemNode.FirstChild; string itemName = childNode.InnerText; if (string.IsNullOrEmpty(itemName = childNode.InnerText)) { throw new System.Exception($"Error: itemName value in RareItems.xml is empty!"); } // Second child should be itemID childNode = childNode.NextSibling; int itemID; if (!int.TryParse(childNode.InnerText, out itemID)) { throw new System.Exception($"Error: could not parse itemID for item {itemName} in RareItems.xml!"); } // Third child should be a ; separated list of bosses this item is dropped from childNode = childNode.NextSibling; string fromBossesLine; if (string.IsNullOrEmpty(fromBossesLine = childNode.InnerText)) { throw new System.Exception($"Error: must be some boss value listed for item {itemName} in RareItems.xml!"); } string[] fromBosses = fromBossesLine.Split(';'); // Construct a RareItemStruct to hold the data RareItemStruct rareItemStruct = new RareItemStruct(itemID, itemName); // Add this struct to each listed boss in the dictionary for (int i = 0; i < fromBosses.Length; ++i) { // Move to next iteration if string is empty if (string.IsNullOrEmpty(fromBosses[i])) { continue; } // Boss hasn't been added as a key yet if (!data.ContainsKey(fromBosses[i])) { data.Add(fromBosses[i], new List <RareItemStruct>() { rareItemStruct }); } // Boss has been added as a key else { List <RareItemStruct> rareItemStructList; if (!data.TryGetValue(fromBosses[i], out rareItemStructList)) { throw new System.Exception($"Null reference exception! Null List<RareItemStruct> for {fromBosses[i]}! in RareItemDB.cs!"); } rareItemStructList.Add(rareItemStruct); } } } Debug.Log(ToString()); }