Battledale_PRC8/_module/nss/database_inc.nss

72 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

//This is database_inc
const string TRI_PRES_DB = "TRI_PRESTIGE_DATABASE";
// functions
// Returns TRUE if the PC has permission to play the prestige class nClass
// Permission will usually be granted by an NPC trainer
// Any PC who already has a level in the specified class is deemed to have
// permission regardless of whether they have been trained.
int DBGetPrestigePermission (object oPC, int nClass);
// Gives the PC permission to play the prestige class nClass.
// Permission is usually set through a conversation with an NPC trainer
// Setting nPermission to FALSE will remove permission to play the class,
// if it exists currently
void DBSetPrestigePermisson (object oPC, int nClass, int nPermission=TRUE);
int DBGetPrestigePermission (object oPC, int nClass)
{
int nReturn=0;
// If the PC already has a level in the class, nReturn is TRUE
if (GetLevelByClass(nClass, oPC) >= 1)
{
nReturn=1;
}
// Else check the database
else
{
string sClass="PrestigeClass"+IntToString(nClass);
nReturn=GetCampaignInt(TRI_PRES_DB, sClass, oPC);
}
return nReturn;
}
void DBSetPrestigePermisson (object oPC, int nClass, int nPermission=TRUE)
{
string sClass="PrestigeClass"+IntToString(nClass);
SetCampaignInt(TRI_PRES_DB, sClass, nPermission, oPC);
}
//
//
//IWD permission settings
//
//
// Returns TRUE if the PC has permission to go to IWD using the start portal,
// otherwise returns FALSE
int DBGetIWDPermission (object oPC);
// Sets permission to use the starting portal to go straight to IWD
// Permission will be true by default. Set nPermission to FALSE to take permission away
void DBSetIWDPermission (object oPC, int nPermission=TRUE);
// the other functions that are already there
int DBGetIWDPermission (object oPC)
{
int nReturn=0;
// check the database
nReturn=GetCampaignInt(TRI_PRES_DB, "IWD", oPC);
return nReturn;
}
void DBSetIWDPermission (object oPC, int nPermission=TRUE)
{
SetCampaignInt(TRI_PRES_DB, "IWD", nPermission, oPC);
}
//GetLevelByClass(CLASS_TYPE_WEAPON_MASTER, oPC) < 1