Example #1
0
 // Used via a cheatbutton and at the end of the game, makes every item in
 // the shop inventory unlimited.
 public static void AddUnlimitedEverything()
 {
     foreach (KeyValuePair <InvNames, InvItem> pair in InvData.Data)
     {
         Stock.AddInvItem(pair.Key, -1, true);
     }
 }
Example #2
0
    /// <summary>
    /// The weapons and armor that become available in the shop follow a pattern.
    ///   If an item's Rank is TWO levels LOWER than the StockLevel, 2 copies are added.
    ///   If the Rank is ONE level LOWER than StockLevel, add 1 copy.
    ///   If the Rank is EQUAL to the StockLevel, add 1 copy.
    ///   If the Rank is ONE level higher than the StockLevel, add 0 copies, so that the
    ///     item is displayed, but unavailable for purchase.
    ///   So at StockLevel 3, 2 rank 1 items, 1 rank 2 item, and 1 ranks 3 item are added,
    ///     in addition to what was added at StockLevel 2 and StockLevel 1.
    /// </summary>
    static void AddLeveledWeaponsAndArmorToStock()
    {
        foreach (KeyValuePair <InvNames, InvItem> pair in InvData.Data)
        {
            if (StockLevel >= 3)
            {
                // add 2 rank (level - 2) armor, weapon, each
                if (pair.Value.Rank == StockLevel - 2 &&
                    (pair.Value.Type == InvType.Weapon ||
                     pair.Value.Type == InvType.Armor))
                {
                    Stock.AddInvItem(pair.Key, 2, true);
                } // total (level - 2) is 4
            }

            if (StockLevel >= 2)
            {
                // add 1 rank (level - 1) armor, weapon, each
                if (pair.Value.Rank == StockLevel - 1 &&
                    (pair.Value.Type == InvType.Weapon ||
                     pair.Value.Type == InvType.Armor))
                {
                    Stock.AddInvItem(pair.Key, 1, true);
                } // total (level - 1) is 2
            }

            // add 1 rank (level) armor and weapons, each
            if (pair.Value.Rank == StockLevel &&
                (pair.Value.Type == InvType.Weapon ||
                 pair.Value.Type == InvType.Armor))
            {
                Stock.AddInvItem(pair.Key, 1, true);
            } // total (level) is 1

            // add 0 rank (level + 1) items for viewing
            if (StockLevel < 7) // there are no rank 8 items for viewing
            {
                if (pair.Value.Rank == StockLevel + 1 &&
                    (pair.Value.Type == InvType.Weapon ||
                     pair.Value.Type == InvType.Armor))
                {
                    Stock.AddInvItem(pair.Key, 0, true);
                } // total (level + 1) is 0
            }
        }
    }