private bool ItemIsValid(PickupObject item) { CompanionItem companion = item.GetComponent <CompanionItem>(); MulticompanionItem multiCompanion = item.GetComponent <MulticompanionItem>(); BankMaskItem clownCompanion = item.GetComponent <BankMaskItem>(); PlayerOrbitalItem orbitalItem = item.GetComponent <PlayerOrbitalItem>(); IounStoneOrbitalItem GuonStone = item.GetComponent <IounStoneOrbitalItem>(); if ((companion != null) || (multiCompanion != null) || (clownCompanion != null) || (orbitalItem != null && GuonStone == null) || OverridePossibleItems.Contains(item.PickupObjectId)) { if (!BannedItems.Contains(item.PickupObjectId)) { if (item.DisplayName != "Magic Lamp") { return(true); } else { return(false); } } else { return(false); } } else { //ETGModConsole.Log("Companion Component: " + (companion != null) + "\nMultiCompanionItem Component: " + (multiCompanion != null) + "\nOrbitalItem Component: " + (orbitalItem != null) + "\nIsGuonStone: " + (GuonStone != null) + " (Should be false)" + "\nOverrideItem: " + (OverridePossibleItems.Contains(item.PickupObjectId))); return(false); } }
private void RandomizeItems() { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?")) { return; } int[] validItems = Randomizer.GetRandomItemList(); int ctr = 0; Util.Shuffle(validItems); bool specialOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize only special marts?", "Will leave regular necessities intact."); int start = specialOnly ? 8 : 0; for (int i = start; i < CB_Location.Items.Count; i++) { CB_Location.SelectedIndex = i; for (int r = 0; r < dgv.Rows.Count; r++) { int currentItem = Array.IndexOf(itemlist, dgv.Rows[r].Cells[1].Value); if (CHK_XItems.Checked && XItems.Contains(currentItem)) { continue; } if (BannedItems.Contains(currentItem)) { continue; } dgv.Rows[r].Cells[1].Value = itemlist[validItems[ctr++]]; if (ctr <= validItems.Length) { continue; } Util.Shuffle(validItems); ctr = 0; } } WinFormsUtil.Alert("Randomized!"); }