//////////////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN - Upgrade Sub-Conversation Setup
//================================================================================
// By Deva Bryson Winblood.  03/01/2003
//////////////////////////////////////////////////////////////////////////////////
// This will setup the Custom Tokens and other information concerning the
// units current upgrade options.  It will only present those that can be
// purchased at this time.
//////////////////////////////////////////////////////////////////////////////////
// nNUPG = Number of upgrade tokens sent
// Tokens = 501 + = upgrade numbers
// sUPGID# = Upgrade to unit ID
//////////////////////////////////////////////////////////////////////////////////

void main()
{
   object oMe=OBJECT_SELF;
   object oMod=GetModule();
   string sID=GetLocalString(oMe,"sTeamID");
   string sUID;
   if (sID=="DWF"||sID=="UND")
   { //======================= DWARF/UNDEAD
      SetLocalInt(oMe,"nNUPG",1);
      sUID=GetLocalString(oMod,GetTag(OBJECT_SELF)+"_uptag");
      SetLocalString(oMe,"sUPGID1",sUID);
      sUID=GetLocalString(oMod,sUID+"_name");
      SetCustomToken(501,sUID);
   } //======================= DWARF/UNDEAD
   else if (sID=="UNC")
   {  //===========================UNCLEAN
     if (GetTag(oMe)=="UNC1"||GetTag(oMe)=="UNC7"||GetTag(oMe)=="UNC6"||GetTag(oMe)=="UNC13")
     { // Goblin
      SetLocalInt(oMe,"nNUPG",1);
      sUID=GetLocalString(oMod,GetTag(OBJECT_SELF)+"_uptag");
      SetLocalString(oMe,"sUPGID1",sUID);
      sUID=GetLocalString(oMod,sUID+"_name");
      SetCustomToken(501,sUID);
     } // Goblin
     else if (GetTag(oMe)=="UNC5")
     { // Ogre
       SetLocalInt(oMe,"nNUPG",2);
       SetLocalString(oMe,"sUPGID1","UNC6");
       SetCustomToken(501,"Ogre Mage");
       SetLocalString(oMe,"sUPGID2","UNC7");
       SetCustomToken(502,"Ogre Berserker");
     } // Ogre
     else if (GetTag(oMe)=="UNC12")
     { // Troll
       SetLocalInt(oMe,"nNUPG",2);
       SetLocalString(oMe,"sUPGID1","UNC13");
       SetCustomToken(501,"Troll Shaman");
       SetLocalString(oMe,"sUPGID2","UNC14");
       SetCustomToken(502,"Troll Berserker");
     } // Troll
     else if (GetTag(oMe)=="UNC23")
     { // worg
       SetLocalInt(oMe,"nNUPG",1);
       SetLocalString(oMe,"sUPGID1","UNC24");
       SetCustomToken(501,"Goblin Worg Rider");
     } // worg
     else if (GetTag(oMe)=="UNC25")
     { // Troglodyte
       SetLocalInt(oMe,"nNUPG",1);
       SetLocalString(oMe,"sUPGID1","UNC26");
       SetCustomToken(501,"Troglodyte Warrior");
     } // Troglodyte
   }  //==============================UNCLEAN
   else if (sID=="SPID")
   { //===============================SPIDERS
     if(GetTag(oMe)=="SPID3")
     { // Small Spider
       SetLocalInt(oMe,"nNUPG",4);
       SetLocalString(oMe,"sUPGID1","SPID7");
       SetCustomToken(501,"Small Dire Spider");
       SetLocalString(oMe,"sUPGID2","SPID12");
       SetCustomToken(502,"Small Phase Spider");
       SetLocalString(oMe,"sUPGID3","SPID16");
       SetCustomToken(503,"Small Sword Spider");
       SetLocalString(oMe,"sUPGID4","SPID20");
       SetCustomToken(504,"Small Wraith Spider");
     } // Small Spider
   } //===============================SPIDERS
   else
   { // other module
      SetLocalInt(oMe,"nNUPG",1);
      sUID=GetLocalString(oMod,GetTag(OBJECT_SELF)+"_uptag");
      SetLocalString(oMe,"sUPGID1",sUID);
      sUID=GetLocalString(oMod,sUID+"_name");
      SetCustomToken(501,sUID);
   } // other module
}