public void HandlePressedSlotButton(Item.ItemTypes itemTypeOnButton, Loadout.LeftOrRight leftOrRight, int slotNumber, bool playEquipSound = false) { if (playEquipSound) { hubWorldSFX.PlayHubSoundEffect(HubWorldSFX.HubSoundeffect.EquipItem); } else { hubWorldSFX.PlayHubSoundEffect(HubWorldSFX.HubSoundeffect.SelectingInventorySlot); } List <LoadoutSlotBtn> currentLoadoutSlotBtns = GetCurrentLoadoutSlotBtns(); foreach (LoadoutSlotBtn button in currentLoadoutSlotBtns) { if (itemTypeOnButton != button.GetItemType() || leftOrRight != button.GetLeftOrRight() || slotNumber != button.GetSlotNumber()) { button.SetInactive(); } } if (currentFilters.Count != 1 || currentFilters.Count == 1 && currentFilters[0] != itemTypeOnButton) { UpdateFilters(itemTypeOnButton, leftOrRight, slotNumber); SetupInventoryList(); } else { UpdateFilters(itemTypeOnButton, leftOrRight, slotNumber); SetupInventoryList(); //SelectEquippedItemInList(); } }
void OnGUI() { defaultColor = GUI.backgroundColor; if (Items.ItemLibrary.Instance == null) return; library = Items.ItemLibrary.Instance; EditorGUILayout.BeginHorizontal(); currentType = (Item.ItemTypes)EditorGUILayout.EnumPopup(currentType); GUI.backgroundColor = Color.green; if (GUILayout.Button("Add")) library.AddItem(currentType); GUI.backgroundColor = defaultColor; if (GUILayout.Button("Save")) PrefabUtility.ReplacePrefab(library.gameObject, PrefabUtility.GetPrefabParent(library.gameObject), ReplacePrefabOptions.ConnectToPrefab); if (GUILayout.Button("Revert")) PrefabUtility.ResetToPrefabState(library.gameObject); EditorGUILayout.EndHorizontal(); for (int i = library.Items.Count - 1; i >= 0; i--) { Item item = library.Items[i]; if (currentType == item.itemType) { DrawCommonProperties(item); //if (currentType == Item.ItemTypes.Quest) DrawThingProperties((ItemQuest)item); //if (currentType == Item.ItemTypes.WeaponMelee) DrawWeaponProperties((ItemWeaponMelee)item); //if (currentType == Item.ItemTypes.Staff) DrawStaffProperties((ItemWeaponStaff)item); //if (currentType == Item.ItemTypes.Potion) DrawPotionProperties((ItemPotion)item); //if (currentType == Item.ItemTypes.Wearable) DrawWearableProperties((ItemWearable)item); } } }
public void LoadJobFromSave(SaveJob saveJob) { jobName = saveJob.jobName; jobDescription = saveJob.jobDescription; jobType = (Job.JobType)saveJob.jobType; jobArea = (Job.JobArea)saveJob.jobArea; jobDifficulty = saveJob.jobDifficulty; jobIntroText = saveJob.jobIntroText; jobMiddleTextOne = saveJob.jobMiddleTextOne; jobMiddleTextTwo = saveJob.jobMiddleTextTwo; jobEndText = saveJob.jobEndText; rewardItem = (Item.ItemTypes)saveJob.rewardItemType; rewardMoney = saveJob.rewardMoney; mapSize = saveJob.mapSize; isStoryMission = saveJob.isStoryMission; enemyTypes = new List <EnemyType>(); foreach (int enemyTypeId in saveJob.enemyTypes) { enemyTypes.Add((EnemyType)enemyTypeId); } }
// For editor public void AddItem(Item.ItemTypes type) { switch (type) { case Item.ItemTypes.Quest: questItems.Add(new ItemQuest()); break; case Item.ItemTypes.Consumable: break; case Item.ItemTypes.MeleeWeapon: meleeWeapons.Add(new ItemWeaponMelee()); break; case Item.ItemTypes.RangedWeapon: rangedWeapons.Add(new ItemWeaponRanged()); break; case Item.ItemTypes.MagicWeapon: break; case Item.ItemTypes.Wearable: break; default: break; } }
private List <HackerModChip> AddItemsToInventoryToFillEmptySlots(Item.ItemTypes chipType, int amountToCreate) { List <HackerModChip> installs = new List <HackerModChip>(); PlayerData playerData = FindObjectOfType <PlayerData>(); for (int i = 0; i < amountToCreate; i++) { switch (chipType) { case Item.ItemTypes.Wetware: HackerModChip newWetware = CreateInstance <HackerModChip>(); newWetware.SetupChip("JuryRigged QwikThink"); installs.Add(newWetware); playerData.AddToOwnedItems(newWetware); break; case Item.ItemTypes.Software: HackerModChip newSoftware = CreateInstance <HackerModChip>(); newSoftware.SetupChip("Cheap Ghost"); installs.Add(newSoftware); playerData.AddToOwnedItems(newSoftware); break; case Item.ItemTypes.Chipset: HackerModChip newChipset = CreateInstance <HackerModChip>(); newChipset.SetupChip("Salvaged Router"); installs.Add(newChipset); playerData.AddToOwnedItems(newChipset); break; } } return(installs); }
private void ParseItemJson() { items = new List <Item>(); TextAsset itemText = Resources.Load <TextAsset>("Items"); string itemsJson = itemText.text; JSONObject jo = new JSONObject(itemsJson); Debug.Log(jo.list.Count); foreach (var temp in jo.list) { string typeStr = temp["itemType"].str; Item.ItemTypes type = (Item.ItemTypes)System.Enum.Parse(typeof(Item.ItemTypes), typeStr); int id = (int)temp["id"].n; string name = temp["name"].str; Item.QualityTypes qualityType = (Item.QualityTypes)System.Enum.Parse(typeof(Item.QualityTypes), temp["quality"].str); string description = temp["description"].str; int capacity = (int)temp["capacity"].n; int buyPrice = (int)temp["buyPrice"].n; int sellPrice = (int)temp["sellPrice"].n; string spritePath = temp["spritePath"].str; Item item = null; switch (type) { case Item.ItemTypes.Consumable: { int hp = (int)temp["hp"].n; int mp = (int)temp["mp"].n; item = new Consumable(hp, mp, id, name, type, qualityType, description, capacity, buyPrice, sellPrice, spritePath); break; } case Item.ItemTypes.Weapon: { int damage = (int)temp["damage"].n; Weapon.WeaponTypes weaponType = (Weapon.WeaponTypes)System.Enum.Parse(typeof(Weapon.WeaponTypes), temp["weaponType"].str); item = new Weapon(damage, weaponType, id, name, type, qualityType, description, capacity, buyPrice, sellPrice, spritePath); break; } case Item.ItemTypes.Equipment: { int strength = (int)temp["strength"].n; int intellect = (int)temp["intellect"].n; int agility = (int)temp["agility"].n; int stamina = (int)temp["stamina"].n; Equipment.EquipmentTypes equipmentType = (Equipment.EquipmentTypes)System.Enum.Parse(typeof(Equipment.EquipmentTypes), temp["equipmentType"].str); item = new Equipment(strength, intellect, agility, stamina, equipmentType, id, name, type, qualityType, description, capacity, buyPrice, sellPrice, spritePath); break; } case Item.ItemTypes.Material: { item = new Material(id, name, type, qualityType, description, capacity, buyPrice, sellPrice, spritePath); break; } } items.Add(item); } }
private bool DoesSlotTypeContain(ItemSlot itemSlot, Item.ItemTypes itemType) { if (itemSlot.ItemType.Contains(itemType)) { return(true); } return(false); }
void OnGUI() { defaultColor = GUI.backgroundColor; if (ItemsController.Instance == null) { return; } library = ItemsController.Instance; EditorGUILayout.BeginHorizontal(); currentType = (Item.ItemTypes)EditorGUILayout.EnumPopup(currentType); GUI.backgroundColor = Color.green; if (GUILayout.Button("Add")) { library.AddItem(currentType); } GUI.backgroundColor = defaultColor; if (GUILayout.Button("Save")) { PrefabUtility.ReplacePrefab(library.gameObject, PrefabUtility.GetPrefabParent(library.gameObject), ReplacePrefabOptions.ConnectToPrefab); } if (GUILayout.Button("Revert")) { PrefabUtility.ResetToPrefabState(library.gameObject); } EditorGUILayout.EndHorizontal(); for (int i = library.Items.Count - 1; i >= 0; i--) { Item item = library.Items[i]; if (currentType == item.itemType) { DrawCommonProperties(item); if (currentType == Item.ItemTypes.Quest) { DrawThingProperties((ItemQuest)item); } if (currentType == Item.ItemTypes.WeaponMelee) { DrawWeaponProperties((ItemWeaponMelee)item); } if (currentType == Item.ItemTypes.Staff) { DrawStaffProperties((ItemWeaponStaff)item); } if (currentType == Item.ItemTypes.Potion) { DrawPotionProperties((ItemPotion)item); } if (currentType == Item.ItemTypes.Wearable) { DrawWearableProperties((ItemWearable)item); } } } }
/// <summary> /// Create the Passage, must be passed an entrance room and an exit room. /// </summary> public Passage(Room entrance, Room exit) { _entrance = entrance; _exit = exit; _isLocked = false; _unlockable = false; _unlockItem = Item.ItemTypes.GENERIC; _lockedResponse = "It's locked. They thought of everything."; _moveThrough = "Whoosh!"; }
public GameObject HaveToolTypeEquiped(Item.ItemTypes itemType) { foreach (var slot in _slots) { if (DoesSlotTypeContain(slot, itemType)) { if (slot.ItemInstantiationTransform.childCount > 0) { return(slot.ItemInstantiationTransform.GetChild(0).gameObject); } } } return(null); }
public void GenerateJob(int playerLevel) { enemyTypes = new List <EnemyType>(); isStoryMission = false; jobArea = GenerateJobArea(playerLevel); jobType = GenerateJobType(playerLevel); GenerateJobNameAndDescription(); jobDifficulty = GenerateJobDifficulty(playerLevel); mapSize = GenerateMapSize(); rewardItem = GetRandomItemType(); rewardMoney = GetRewardMoneyAmount(); }
public HackerModChip GetEquippedInstallByItemTypeAndSlotNumber(Item.ItemTypes itemType, int slotNumber) { switch (itemType) { case Item.ItemTypes.Chipset: return(uplink.GetChipBySlot(slotNumber)); case Item.ItemTypes.Software: return(rig.GetChipBySlot(slotNumber)); case Item.ItemTypes.Wetware: return(neuralImplant.GetChipBySlot(slotNumber)); } return(uplink.GetChipBySlot(0)); // this will break, as intended. We shouldn't reach this. }
public HackerMod GetEquippedModByItemType(Item.ItemTypes itemType) { switch (itemType) { case Item.ItemTypes.NeuralImplant: return(neuralImplant); case Item.ItemTypes.Rig: return(rig); case Item.ItemTypes.Uplink: return(uplink); } // This should never happen: return(neuralImplant); }
/// <summary> /// Finds and returns all instances of Items in the Inventory with any of the designated ItemTypes. /// </summary> /// <param name="itemTypes">The ItemTypes enum values to look for.</param> /// <returns>An array of all items with any of the designated ItemTypes. If none are found, an empty array.</returns> public Item[] FindItems(Item.ItemCategories itemCategory, Item.ItemTypes itemTypes) { List <Item> itemsToFind = new List <Item>(); //If searching for Key Items, add all Key Items to the list if (itemCategory == Item.ItemCategories.KeyItem) { itemsToFind.AddRange(KeyItems); } else { //Look in the Item list for all Items with these ItemTypes and add them itemsToFind.AddRange(Items.FindAll((item) => UtilityGlobals.ItemTypesHasFlag(item.ItemType, itemTypes) == true)); } return(itemsToFind.ToArray()); }
private string TurnJobTypeIntoDisplayText(Item.ItemTypes rewardType) { switch (rewardType) { case Item.ItemTypes.Arm: return("Arm Mod"); case Item.ItemTypes.Chipset: return("Chipset"); case Item.ItemTypes.Exoskeleton: return("Exoskeleton Mod"); case Item.ItemTypes.Head: return("Head Mod"); case Item.ItemTypes.Leg: return("Leg Mod"); case Item.ItemTypes.NeuralImplant: return("Neural Implant"); case Item.ItemTypes.Rig: return("Rig"); case Item.ItemTypes.Software: return("Software"); case Item.ItemTypes.Torso: return("Torso Mod"); case Item.ItemTypes.Uplink: return("Uplink"); case Item.ItemTypes.Weapon: return("Weapon"); case Item.ItemTypes.Wetware: return("Wetware"); default: return(""); } }
public void PickUpItem(Item item) { Item.ItemTypes itemType = item.GetItemType(); switch (itemType) { case Item.ItemTypes.Armor: character.SetArmor((Armor)item); break; case Item.ItemTypes.Helmet: character.SetHelmet((Helmet)item); break; case Item.ItemTypes.Weapon: character.SetWeapon((Weapon)item); break; } OnItemPickUp.Invoke(item); }
public override Item GetItemOfType(Item.ItemTypes itemTypes) { //If the enemy isn't holding anything, simply return null; if (HeldCollectible == null) { return(null); } //See if the enemy is holding an item Item item = HeldCollectible as Item; //If the enemy is holding an item and the item has the ItemTypes specified, return it if (item != null && UtilityGlobals.ItemTypesHasFlag(item.ItemType, itemTypes) == true) { return(item); } return(null); }
private List <HackerModChip> FillEmptySlotsWithInventoryItems(Item.ItemTypes chipType, int amountNeeded) { List <Item> allItems = FindObjectOfType <PlayerData>().GetPlayerItems(); List <HackerModChip> unequippedModChips = new List <HackerModChip>(); foreach (Item item in allItems) { if (item.IsHackerChipset() && item.GetItemType() == chipType && !IsItemEquipped(item)) { unequippedModChips.Add(item as HackerModChip); } } if (unequippedModChips.Count < amountNeeded) { unequippedModChips.AddRange(AddItemsToInventoryToFillEmptySlots(chipType, amountNeeded - unequippedModChips.Count)); } return(unequippedModChips); }
private void UpdateFilters(Item.ItemTypes clickedBtnType, Loadout.LeftOrRight leftOrRight, int slotNumber) { List <LoadoutSlotBtn> currentButtons = GetCurrentLoadoutSlotBtns(); bool foundActiveBtn = false; foreach (LoadoutSlotBtn button in currentButtons) { if (button.GetIsActive()) { foundActiveBtn = true; } } if (foundActiveBtn) { currentFilters = new List <Item.ItemTypes>(); currentFilters.Add(clickedBtnType); } else { InitialFilterSetup(); } }
public RunnerMod GetEquippedModByItemType(Item.ItemTypes itemType, Loadout.LeftOrRight leftOrRight) { switch (itemType) { case Item.ItemTypes.Arm: if (leftOrRight == Loadout.LeftOrRight.Left) { return(leftArm); } else { return(rightArm); } case Item.ItemTypes.Exoskeleton: return(exoskeletonMod); case Item.ItemTypes.Head: return(headMod); case Item.ItemTypes.Leg: if (leftOrRight == Loadout.LeftOrRight.Left) { return(leftLeg); } else { return(rightLeg); } case Item.ItemTypes.Torso: return(torsoMod); case Item.ItemTypes.Weapon: return(weapon); } // we shouldn't ever hit this... return(weapon); }
public void AddItem(Item.ItemTypes type) { if (type == Item.ItemTypes.Quest) { things.Add(new ItemQuest()); } if (type == Item.ItemTypes.Potion) { potions.Add(new ItemPotion()); } if (type == Item.ItemTypes.Staff) { staffs.Add(new ItemWeaponStaff()); } if (type == Item.ItemTypes.WeaponMelee) { weapons.Add(new ItemWeaponMelee()); } if (type == Item.ItemTypes.Wearable) { wearable.Add(new ItemWearable()); } }
public override Item GetItemOfType(Item.ItemTypes itemTypes) { return(Inventory.Instance.FindItem(Item.ItemCategories.Standard, itemTypes)); }
/// <summary> /// Gets the first item of a particular ItemType that the BattleEntity has. /// </summary> /// <param name="itemTypes">The ItemType enum value. If an item has any of these values, it will be returned.</param> /// <returns></returns> public abstract Item GetItemOfType(Item.ItemTypes itemTypes);
public override Item GetItemOfType(Item.ItemTypes itemTypes) { return(HeldCollectible as Item); }
/// <summary> /// Tells whether a set of ItemTypes has any of the flags in another ItemTypes set. /// </summary> /// <param name="itemTypes">The ItemTypes value.</param> /// <param name="itemTypesFlags">The flags to test.</param> /// <returns>true if any of the flags in itemTypes are in itemTypesFlags, otherwise false.</returns> public static bool ItemTypesHasFlag(Item.ItemTypes itemTypes, Item.ItemTypes itemTypesFlags) { Item.ItemTypes flags = (itemTypes & itemTypesFlags); return(flags != 0); }
// Returns A New Enchant (default is 999 for random) public Enchant GetNewEnchant(Item i, int itemLevel, bool hasFirst = false) { // set the enchant level to the item level level = itemLevel; // set the type by choice or random (-1) type = PickEnchantType(i.GetEnchantTypeNum(), hasFirst); // set the enchants item type i_type = i.itemType; indexA = (int)type; if (i_type == Item.ItemTypes.Weapon) { w_damage = (int)((i.minDamage + i.maxDamage) / 2f); } // If the type is a primary enchant type if (type == EnchantTypes.Primary) { // while the primary enchant is none, keep getting another primary while (ePrimary == Enchant_Database.Primary_Stats_Enchants.None) { ePrimary = Enchant_Database.GetPrimaryEnchant(this, i.GetSpecificEnchantTypeNum(), i.itemQuality); indexB = (int)ePrimary; } } // If the type is a secondary enchant type else if (type == EnchantTypes.Secondary) { // while the secondary enchant is none, keep getting another secondary while (eSecondary == Enchant_Database.Secondary_Stats_Enchants.None) { eSecondary = Enchant_Database.GetSecondaryEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eSecondary; } } // If the type is a tertiary enchant type else if (type == EnchantTypes.Tertiary) { // while the tertiary is none, keep getting a new tertiary enchant while (eTertiary == Enchant_Database.Tertiary_Stats_Enchants.None) { eTertiary = Enchant_Database.GetTertiaryEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eTertiary; } } // If the type is of Teir 1 damage enchant else if (type == EnchantTypes.Damage_T1) { // keep getting another damage enchant of teir 1 while (eT1 == Enchant_Database.Tier1_Damage_Enchants.None) { eT1 = Enchant_Database.GetTierOneDamageEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eT1; } } // If the type is of Teir 2 damage enchant else if (type == EnchantTypes.Damage_T2) { // keep getting another damage enchant of teir 2 while (eT2 == Enchant_Database.Tier2_Damage_Enchants.None) { eT2 = Enchant_Database.GetTierTwoDamageEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eT2; } } // if the type is of Teir 3 damage enchant else if (type == EnchantTypes.Damage_T3) { // keep getting another damage enchant of teir 3 while (eT3 == Enchant_Database.Tier3_Damage_Enchants.None) { eT3 = Enchant_Database.GetTierThreeDamageEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eT3; } } // If the type of enchant is resistance else if (type == EnchantTypes.Resistance) { // Keep getting a resistance enchant until it is not none while (eResistance == Enchant_Database.Resistance_Enchants.None) { eResistance = Enchant_Database.GetResistanceEnchant(this, i.GetSpecificEnchantTypeNum()); indexB = (int)eResistance; } } else { Debug.Log("ERROR :: No enchant type was found (::GetNewEnchant())"); } return(this); }
public void SetEnchantItemType(Item.ItemTypes item_type) { i_type = item_type; }
public Enchant(Item.ItemTypes t = Item.ItemTypes.NONE, EnchantTypes e = EnchantTypes.NONE) { i_type = t; type = e; }
private static List <GridLayout> CalculateSimpleGrid(RectangleF bounds, int rows, int columns, int spacing, Escapes escapeRows, Escapes escapeColumns, float escapeRatio, Item.ItemTypes type) { // do simple spacing within 1 bounds. May be used with rows=1 or cols=1 to work within a row/col or to generate rows/cols // returns list of items in grid SizeF available = new SizeF(Math.Max(3, bounds.Width - (columns + N(escapeColumns) + 1) * spacing), Math.Max(3, bounds.Height - (rows + N(escapeRows) + 1) * spacing)); SizeF cellSize = new SizeF(available.Width / (columns + N(escapeColumns) * escapeRatio), available.Height / (rows + N(escapeRows) * escapeRatio)); // size of standard cell PointF location = new PointF(spacing + bounds.X, spacing + bounds.Y); List <GridLayout> list = new List <GridLayout>(); for (int Y = 0; Y < rows + N(escapeRows); Y++) { location.X = spacing + bounds.X; bool isEscapeRow = Y == 0 && (escapeRows & Escapes.Start) > 0 || Y == rows + N(escapeRows) - 1 && (escapeRows & Escapes.End) > 0; SizeF thisSize = cellSize; thisSize.Height = isEscapeRow ? cellSize.Height * escapeRatio : cellSize.Height; for (int X = 0; X < columns + N(escapeColumns); X++) { bool isEscapeColumn = X == 0 && (escapeColumns & Escapes.Start) > 0 || X == columns + N(escapeColumns) - 1 && (escapeColumns & Escapes.End) > 0; thisSize.Width = isEscapeColumn ? cellSize.Width * escapeRatio : cellSize.Width; list.Add(new GridLayout() { Bounds = new RectangleF(location, thisSize), Type = isEscapeColumn || isEscapeRow ? Item.ItemTypes.IT_Escape : type }); location.X += spacing + thisSize.Width; } location.Y += spacing + thisSize.Height; } return(list); }
public override Item GetItemOfType(Item.ItemTypes itemTypes) { return(null); }
/// <summary> /// Finds and returns the first Item in the Inventory with any of the designated ItemTypes. /// </summary> /// <param name="itemTypes">The ItemTypes enum values to look for.</param> /// <returns>An item with any of the designated ItemTypes. If not found, null.</returns> public Item FindItem(Item.ItemCategories itemCategory, Item.ItemTypes itemTypes) { return(Items.Find((item) => UtilityGlobals.ItemTypesHasFlag(item.ItemType, itemTypes) == true)); }