Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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());
         }
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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];
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }