REO-EE/_module/nss/portrait_include.nss
Jaysyn904 f82740bbbd Initial commit
Initial commit
2024-02-22 13:22:03 -05:00

49 lines
1.4 KiB
Plaintext

//////////////////////////////////////////////////
// HEAD AND PORTRAIT CUSTOMIZATION INCLUDE FILE //
//////////////////////////////////////////////////
// Portrait Menu file: "portrait_menu"
// Head Menu file: "head_menu"
#include "aps_include"
///////////////
// CONSTANTS //
///////////////
// Name of the portrait look up table in MySQL
const string PORTRAIT_MYSQL_TABLE = "portrait_lookup";
// Name of the variable which tracks the number of valid portraits available
// This value is set on module load
const string PORTRAIT_COUNT = "PORTRAIT_COUNT";
// Number of heads which can be selected from this menu.
// You have to hard code it because there's no 2DA file which references the heads.
const int HEAD_COUNT = 202;
////////////////
// PROTOTYPES //
////////////////
// Call this on Module OnLoad. It will store the number of valid portraits
// as a variable on the module. It is later referenced by the portrait selection
// menu. This prevents constant calls to the database which may result in lag.
void PORTRAIT_OnModuleLoad();
///////////////
// FUNCTIONS //
///////////////
void PORTRAIT_OnModuleLoad()
{
object oModule = OBJECT_SELF;
string sSQL = "SELECT MAX(ID) FROM " + PORTRAIT_MYSQL_TABLE;
SQLExecDirect(sSQL);
if(SQLFetch() == SQL_SUCCESS)
{
SetLocalInt(oModule, PORTRAIT_COUNT, StringToInt(SQLGetData(1)));
}
}
// Error checking
//void main(){}