///////////////PLOT ITEM CONTROL SWITCH///////////////////

//Set this to FALSE to NOT allow Plot items to be crafted.
const int nPlot = FALSE; //Default = TRUE (allow plot items)

////////////////COST CONTROL SWITCH////////////////////////
//This is the control of the cost of crafting..
// 0.01 = 1% / 0.1 = 10 % / 1.5 = 150% / 3.0 = 300%
//Set the float below to the % you want crafting to cost..
//This is NOT per D&D Rules, adjust it to suit your module.

const float fMC = 1.0; // 1.0 = normal cost (default)

//NOTE: 740,000 = The Max Forge Cost (To add 1 Property)
//& 1000 = The Minimum Forge Cost. (To add 1 Property)
//Item's current level and the property chosen effects cost

//NOTE: Max cost averages around 400-600,000 Gold
// (If the property selected isn't very powerful.)

///////////////MAX ITEM LEVEL CONTROL SWITCH///////////////

//To turn on max item level restriction type TRUE Below
const int ILR = FALSE; //(default = FALSE ~ No Item Level Restriction)

//Set the # below to the max level allowed to be crafted.
//NOTE: Level is calculated BEFORE modifications, so if you
//set this to 20 and the player adds a powerful property to
//say a level 19 item, it could become a level 21-25 item!
//Therefore, make sure you keep this in mind when adjusting!
//NOTE: (2 - 39 = Are the Acceptable Settings)

const int nMax = 60; //39 = Default (Maximum Setting)

///////////////////////////////////////////////////////////
//Set the Max Properties that any item should ever have

const int MAX_PROPERTIES = 12; //This CANNOT be 0!

//Set the max Weapon Damage Bonuses / Weapon
//Note: this does not take into account for Dmg Bonus vs Alignments / etc.

const int MAX_DAMAGES = 9; //1-9 is the acceptable range


//////////////////////////////////////////////////////////////////////////
//////////////WARNING: DON'T TOUCH ANYTHING BELOW!!//////////////////////
////////////////////////////////////////////////////////////////////////

//PROTOTYPE DEFINED
int GetMaxProps(object oItem)
{
 int nProps = 0;
 itemproperty iProp;
 iProp = GetFirstItemProperty(oItem);
 while(GetIsItemPropertyValid(iProp))
 {
  nProps +=1;
  iProp = GetNextItemProperty(oItem);
 }

return nProps;

}

//PROTOTYPE DEFINED
int GetMaxWpnProps(object oItem)
{
 int nProps = 0;
 itemproperty iProp;
 int iType;

 iProp = GetFirstItemProperty(oItem);
 while(GetIsItemPropertyValid(iProp))
 {
  iType = GetItemPropertyType(iProp);
  if(iType == ITEM_PROPERTY_DAMAGE_BONUS)
  {
   nProps +=1;
  }
  iProp = GetNextItemProperty(oItem);
 }

 return nProps;
}


//PROTOTYPE DEFINED
int GetItemLevel(object oCraft)
{

 //The Currrent Gold Piece Value of the Item..
int nCost1 = GetGoldPieceValue(oCraft);
int gp = nCost1;
int nGp;
int nLevel;
    //Return the level..
    if (gp<1000)
        nLevel= 1;
    if (gp>1000 && gp<1500)
        nLevel= 2;
    if (gp>1499 && gp<2500)
        nLevel= 3;
    if (gp>2499 && gp<3500)
        nLevel= 4;
    if (gp>3499 && gp<5000)
        nLevel= 5;
    if (gp>4999 && gp<7000)
        nLevel= 6;
    if (gp>6999 && gp<9000)
        nLevel= 7;
    if (gp>8999 && gp<12000)
        nLevel= 8;
    if (gp>11999 && gp<15000)
        nLevel= 9;
    if (gp>14999 && gp<20000)
        nLevel= 10;
    if (gp>19999 && gp<25000)
        nLevel= 11;
    if (gp>24999 && gp<30000)
        nLevel= 12;
    if (gp>29999 && gp<35000)
        nLevel= 13;
    if (gp>34999 && gp<40000)
        nLevel= 14;
    if (gp>39999 && gp<50000)
        nLevel= 15;
    if (gp>49999 && gp<65000)
        nLevel= 16;
    if (gp>64000 && gp<75000)
        nLevel= 17;
    if (gp>74999 && gp<90000)
        nLevel= 18;
    if (gp>89999 && gp>110000)
        nLevel= 19;
    if (gp>109999 && gp<130000)
        nLevel= 20;
    if (gp>129999 && gp<250000)
        nLevel= 21;
    if (gp>249999 && gp<500000)
        nLevel= 22;
    if (gp>499999 && gp<750000)
        nLevel= 23;
    if (gp>749999 && gp<1000000)
        nLevel= 24;
    if (gp>999999 && gp<1200000)
        nLevel = 25;
    if (gp>1999999 && gp<1400000)
        nLevel = 26;
    if (gp>1399999 && gp<1600000)
        nLevel = 27;
    if (gp>1599999 && gp<1800000)
        nLevel = 28;
    if (gp>1799999 && gp<2000000)
        nLevel = 29;
    if (gp>1999999 && gp<2200000)
        nLevel = 30;
    if (gp>2199999 && gp<2400000)
        nLevel = 31;
    if (gp>2399999 && gp<2600000)
        nLevel = 32;
    if (gp>2599999 && gp<2800000)
        nLevel = 33;
    if (gp>2799999 && gp<3000000)
        nLevel = 34;
    if (gp>2999999 && gp<3200000)
        nLevel = 35;
    if (gp>3199999 && gp<3400000)
        nLevel = 36;
    if (gp>3399999 && gp<3600000)
        nLevel = 37;
    if (gp>3599999 && gp<3800000)
        nLevel = 38;
    if (gp>3799999 && gp<4000000)
        nLevel = 39;
    if (gp>3999999)
        nLevel = 40;

return nLevel;

}