//////////////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN - Equalizer - Strip Equip, Gold, etc. Equip generic
//================================================================================
// By Deva Bryson Winblood.  03/02/2003
//////////////////////////////////////////////////////////////////////////////////
#include "prc_inc_racial"

void fnEquip(object oPC)
{
  object oItem;
  int nClass=GetClassByPosition(1,oPC);
  int nAL=GetAlignmentGoodEvil(oPC);
  object oCloth=OBJECT_INVALID;
   DelayCommand(1.0,AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CHEST)));
   oItem=CreateItemOnObject("nw_it_torch001",oPC);
   if (nClass==CLASS_TYPE_DRUID)
   {
     oItem=CreateItemOnObject("nw_wspsc001",oPC); // Sickle
     oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
     oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
   }
   else if (nClass==CLASS_TYPE_FIGHTER||nClass==CLASS_TYPE_RANGER||nClass==CLASS_TYPE_BARBARIAN||
            nClass==CLASS_TYPE_PALADIN)
   {
     oItem=CreateItemOnObject("nw_wswss001",oPC); // Short Sword
     oItem=CreateItemOnObject("nw_aarcl002",oPC); // Studded Leather Armor
     oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
   }
   else if (nClass==CLASS_TYPE_CLERIC)
   {
     oItem=CreateItemOnObject("nw_wblml001",oPC); // Mace
     oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
     oItem=CreateItemOnObject("nw_ashsw001",oPC); // Small Shield
   }
   else if (nClass==CLASS_TYPE_ROGUE||nClass==CLASS_TYPE_BARD)
   {
     oItem=CreateItemOnObject("nw_wswss001",oPC); // Short Sword
     oItem=CreateItemOnObject("nw_aarcl001",oPC); // Leather Armor
     if (nClass==CLASS_TYPE_ROGUE)
      oItem=CreateItemOnObject("nw_it_trap001",oPC); //Minor Spike Trap
     if (nClass=CLASS_TYPE_BARD)
      oItem=CreateItemOnObject("nw_it_mpotion005",oPC); //Potion of Barkskin
   }
   else if (nClass==CLASS_TYPE_SORCERER||nClass==CLASS_TYPE_WIZARD)
   {
     oItem=CreateItemOnObject("nw_wswdg001",oPC); // Dagger
     oItem=CreateItemOnObject("nw_it_sparscr109",oPC); // Scroll of Magic Missile
     oItem=CreateItemOnObject("nw_it_mpotion005",oPC); //Potion of Barkskin
     if (nAL==ALIGNMENT_GOOD)
       oItem=CreateItemOnObject("lightrobes",oPC);
     else if (nAL==ALIGNMENT_NEUTRAL)
       oItem=CreateItemOnObject("redrobes",oPC);
     else if (nAL==ALIGNMENT_EVIL)
       oItem=CreateItemOnObject("darkrobes",oPC);
     oCloth=oItem;
   }
   else if (nClass==CLASS_TYPE_MONK)
   {
     oItem=CreateItemOnObject("nw_wspka001",oPC); // Kama
     oItem=CreateItemOnObject("nw_it_mpotion006",oPC); // Potion of Antidote
     oItem=CreateItemOnObject("nw_it_mpotion005",oPC); //Potion of Barkskin
     if (MyPRCGetRacialType(oPC)==RACIAL_TYPE_HUMAN||MyPRCGetRacialType(oPC)==RACIAL_TYPE_HALFELF)
     { // monks outfit
     if (nAL==ALIGNMENT_GOOD)
       oItem=CreateItemOnObject("lightmonkoutfit",oPC);
     else if (nAL==ALIGNMENT_NEUTRAL)
       oItem=CreateItemOnObject("redmonkoutfit",oPC);
     else if (nAL==ALIGNMENT_EVIL)
       oItem=CreateItemOnObject("darkmonkoutfit",oPC);
     } // monks outfit
     else
       oItem=CreateItemOnObject("nw_cloth016",oPC);
     oCloth=oItem;
   }
   oItem=CreateItemOnObject("nw_it_mpotion001",oPC,5); // Cure light wounds potions
   DelayCommand(2.0,AssignCommand(oPC,ActionEquipMostEffectiveArmor()));
   DelayCommand(2.0,AssignCommand(oPC,ActionEquipMostDamagingMelee()));
   if (oCloth!=OBJECT_INVALID) DelayCommand(2.0,AssignCommand(oPC,ActionEquipItem(oCloth,INVENTORY_SLOT_CHEST)));
}


void main()
{
    object oMe=OBJECT_SELF;
    object oPC=oMe;
    object oItem=GetFirstItemInInventory(oMe);
    int nGold=GetGold(oMe);
    int nKey=GetLocalInt(GetModule(),"nRTSSync");
    SetLocalInt(oPC,"nRTSSync",nKey); // prevent equipment strip if rejoining with link lost character
    TakeGoldFromCreature(nGold,oMe,TRUE);
    SetXP(oMe,0);
    while(oItem!=OBJECT_INVALID)
    { // strip
      DestroyObject(oItem);
      oItem=GetNextItemInInventory(oMe);
    } // strip
   oItem=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
   //DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_ARMS,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
   DestroyObject(oItem);
   oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
   DestroyObject(oItem);
   DelayCommand(2.0,fnEquip(oMe));
}