#include "inc_loot_weapons"
// Sub function of GenerateItems
void GenerateMundane(int iNumber, object oContainer, int iMulti);

void GenerateMundane(int iNumber, object oContainer, int iMulti)
    {
    int i,iRoll, iAmount;
    object oItem;
    string sResRef;
    for (i = 1; i <= iNumber * iMulti; i++)
        {
        iRoll = d100();
        iAmount = 1;
        if (iRoll <= 5)        {sResRef = "x1_wmgrenade002";iAmount = d4();}    // Alchemist Fire
        else if (iRoll <= 10)  {sResRef = "x1_wmgrenade001";iAmount = d4(2);}   // Acid
        else if (iRoll <= 12)  {sResRef = "x1_wmgrenade004";iAmount = d4();}    // Choking Powder - SHould be smoke stick
        else if (iRoll <= 18)  {sResRef = "x1_wmgrenade005";iAmount = d4();}    // Holy Water
        else if (iRoll <= 20)  {sResRef = "x1_wmgrenade007";iAmount = d4();}    // Thunder Stones
        else if (iRoll <= 22)   sResRef = "chains001";                          // Chain Shirt
        else if (iRoll <= 27)  {sResRef = "antitoxin"; iAmount = d4();}         // Antitoxin
        else if (iRoll <= 29)  {sResRef = "x1_wmgrenade006";iAmount = d4();}    // Tanglefoot Bags
        else if (iRoll <= 34)   sResRef = "sleather001";                        // Studded Leather
        else if (iRoll <= 39)   sResRef = "nw_wbwsh001";                        // Short Bow
        else if (iRoll <= 43)   sResRef = "breast001";                          // Breastplate
        else if (iRoll <= 48)   sResRef = "banded001";                          // Bandedmail
        else if (iRoll <= 66)   oItem = Table811_14(1);                         // Random Common Weapon
        else if (iRoll <= 68)   oItem = Table811_14(2);                         // Random Uncommon Weapon
        else if (iRoll <= 73)   oItem = Table811_14(3);                         // Random Ranged Weapon
        else if (iRoll <= 83)   sResRef = "nw_wbwln001";                        // Longbow
        else if (iRoll <= 93)   sResRef = "hplate001";                          // Half Plate
        else                    sResRef = "fplate001";                          // Full Plate
        if (!GetIsObjectValid(oItem))
            {
            oItem = CreateItemOnObject(sResRef, oContainer, iAmount);
            SetLocalInt(oItem,"BaseValue",GetGoldPieceValue(oItem));
            }
        }
    }
