public Item SudoRandomItemOut(ItemLoc loc, int[] allowed) { Item randItem = new Item(); List <int> locItems = new List <int> (); for (int i = 0; i < items.Count; i++) // for all items { if (items[i].itemLoc == loc) // if they have the provided location { for (int j = 0; j < allowed.Length; j++) { if (items[i].itemID == allowed[j]) // if the id is allowed { locItems.Add(items[i].itemID); if (items[i].itemID < 8) // if it's basic add it two more times. { locItems.Add(items[i].itemID); locItems.Add(items[i].itemID); } } } } } if (locItems.Count != 0) { int rand = Random.Range(0, locItems.Count); randItem = items[locItems[rand]]; } return(randItem); }
public Item GetArmByLocation(Item item, ItemLoc loc) { if (item.itemLoc == loc) { return(item); } else { if (ArmIsambidextrous(item)) { if (item.itemName == items[item.itemID - 1].itemName) { return(items[item.itemID - 1]); } else { return(items[item.itemID + 1]); } } else { return(new Item()); } } }
public List <Item> ItemsByLocation(ItemLoc loc) { List <Item> itemsOfLoc = new List <Item> (); foreach (Item item in items) { if (item.itemLoc == loc) { itemsOfLoc.Add(item); } } return(itemsOfLoc); }
public Item(int id, string name, string desc, ItemLoc location, ItemType type, int rarity, Sprite[] sprite, int hp, int damage, float speed, float power, bool special) { itemID = id; itemName = name; itemDesc = desc; itemLoc = location; itemType = type; itemRarity = rarity; itemSprite = sprite; itemHitpoints = hp; itemDamage = damage; itemSpeed = speed; itemPower = power; itemSpecial = special; itemSound = new AudioClip[3]; }
public Item(int id, string name, string desc, ItemLoc location, ItemType type, int rarity, Sprite[] sprite, int hp, int damage, float speed, float power, bool special, AnimatorOverrideController anim, AudioClip[] sound) { itemID = id; itemName = name; itemDesc = desc; itemLoc = location; itemType = type; itemRarity = rarity; itemSprite = sprite; itemHitpoints = hp; itemDamage = damage; itemSpeed = speed; itemPower = power; itemSpecial = special; itemAnim = anim; itemSound = sound; }
public JavaScriptResult SaveItemQuan(string tblcell, int ItemID, int LocID, string Q) { string result = ""; decimal Qty = 1; try { Qty = Convert.ToDecimal(Q); } catch { }//just stay at 0 ItemLoc newIL = new ItemLoc { ItemID = ItemID, LocID = LocID, Quantity = Qty }; int ItemLocID = M.SaveItemQuantity(newIL); if (ItemLocID < 1) { result = @" alert('New Item Quantity Save Failed'); "; } result = result + J.MakeItemQCell(ItemID, tblcell); return(JavaScript(result)); }
public Item RandomItemOut(ItemLoc loc) { Item randItem = new Item(); List <int> locItems = new List <int> (); for (int i = 0; i < items.Count; i++) { if (items[i].itemLoc == loc) { locItems.Add(items[i].itemID); if (items[i].itemID < 8) { locItems.Add(items[i].itemID); locItems.Add(items[i].itemID); } } } if (locItems.Count != 0) { int rand = Random.Range(0, locItems.Count); randItem = items[locItems[rand]]; } return(randItem); }
public Item ItemFromJSON(jsonManager.StingItems jsonItem) { ItemLoc newLoc = (ItemLoc)System.Enum.Parse(typeof(ItemLoc), jsonItem.itemLoc); ItemType newType = (ItemType)System.Enum.Parse(typeof(ItemType), jsonItem.itemType); Item item; if (jsonItem.itemAnim != "" && jsonItem.itemSound != "") { item = new Item( jsonItem.itemID, jsonItem.itemName, jsonItem.itemDesc, newLoc, newType, jsonItem.itemRarity, GetSprite(jsonItem.itemSprite), jsonItem.itemHitpoints, jsonItem.itemDamage, jsonItem.itemSpeed, jsonItem.itemPower, jsonItem.itemSpecial, GetAnim(jsonItem.itemAnim), GetSound(jsonItem.itemSound)); } else if (jsonItem.itemAnim != "" && jsonItem.itemSound == "") { item = new Item( jsonItem.itemID, jsonItem.itemName, jsonItem.itemDesc, newLoc, newType, jsonItem.itemRarity, GetSprite(jsonItem.itemSprite), jsonItem.itemHitpoints, jsonItem.itemDamage, jsonItem.itemSpeed, jsonItem.itemPower, jsonItem.itemSpecial, GetAnim(jsonItem.itemAnim)); } else { item = new Item( jsonItem.itemID, jsonItem.itemName, jsonItem.itemDesc, newLoc, newType, jsonItem.itemRarity, GetSprite(jsonItem.itemSprite), jsonItem.itemHitpoints, jsonItem.itemDamage, jsonItem.itemSpeed, jsonItem.itemPower, jsonItem.itemSpecial, GetAnim(jsonItem.itemAnim), GetSound(jsonItem.itemSound)); } return(item); }