/*--------------------------------------------------------

Script Name: gc_check_legit
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 2/09/09
----------------------------------------------------------

This is a Starting Conditional Script I've added to
prevent cheating on the forge in the PC Wand Converation.

----------------------------------------------------------*/

#include "gen_forge_config"

int StartingConditional()
{

object oPC = GetPCSpeaker();

int nSlot = GetLocalInt(oPC, "CRAFT_SLOT");
object oCraft = GetItemInSlot(nSlot, oPC);
int nType = GetBaseItemType(oCraft);

int nLvl = GetItemLevel(oCraft);

//Check for Max Properties
int nMaxProps = GetMaxProps(oCraft);
int nMaxDmgs = GetMaxWpnProps(oCraft);

//If item level restriction is turned on (ie. maximum level is set.)
if(ILR==TRUE)
{
 if(nLvl>=nMax)
 {
  FloatingTextStringOnCreature("The item your attempting to forge exceeds the maxmimum level.", oPC, FALSE);
  return TRUE;
 }
}

if(nMaxProps>=MAX_PROPERTIES)
{
 FloatingTextStringOnCreature("the item your attempting to forge has too many properties.", oPC, FALSE);
 return TRUE;
}

if (!GetIsObjectValid(oCraft))
{
 FloatingTextStringOnCreature("You must be wearing the item to craft it!", oPC, FALSE);
 return TRUE;
}

//Do we allow plot items to be forged or not?
if (nPlot == FALSE)
{
 if(GetPlotFlag(oCraft)==TRUE)
 {
  FloatingTextStringOnCreature("You cannot forge a plot item!", oPC, FALSE);
  return TRUE;
 }
}

return FALSE;

//Conditional End
}