Archives des forums MMO/MMORPG > Neverwinter Nights > NWN - Maskado > [modif]pwum_functions v0.03
[modif]pwum_functions v0.03
Par RAT le 22/1/2003 à 12:15:26 (#3074684)
////////////////////////////////////
// NOUVELLES FONCTIONS ////
// FAIT PAR RAT POUR PUMA ////
/////////////////////////////////
//*****************************
// FONCTIONS BANQUE
//*****************************
// GESTION DES SET
void SetBanqueOr(string var_name, int var_val, int iExpire=121000000, int iToken=0, int iExtend=0)
{
object umObject = GetLocalObject(GetModule(), "um_object");
int iDate=GetOffsetGameDate(0);
if (iToken < 2 && iExpire < 121000000)
{
if (iExpire < 121000000)
iExpire=GetOffsetGameDate(iExpire);
else
iExpire=GetLocalInt(umObject, "iDefaultExpire");
iToken=iToken+2;
}
if (iDate < iExpire)
{
string storageBuffer = "BNO#" + var_name + "#" + IntToString(var_val) + "#" + IntToString(iExpire) + "#" + IntToString(iToken) + "#" + IntToString(iExtend) + "#";
SetLocalInt(umObject,"BNO_"+ var_name, var_val);
SetLocalInt(umObject,"BNO_"+ var_name + "x", iExpire);
if (iToken==2)
SetLocalInt(umObject,"BNO_"+ var_name + "t", iExtend);
WriteTimestampedLogEntry(storageBuffer);
}
}
void SetBanqueInv(string var_name, string var_val, int iExpire=121000000, int iToken=0, int iExtend=0)
{
var_val=StrReplace("\n","°°",var_val);
object umObject = GetLocalObject(GetModule(), "um_object");
int iDate=GetOffsetGameDate(0);
if (iToken < 2 && iExpire < 121000000)
{
if (iExpire < 121000000)
iExpire=GetOffsetGameDate(iExpire);
else
iExpire=GetLocalInt(umObject, "iDefaultExpire");
iToken=iToken+2;
}
if (iDate < iExpire)
{
string storageBuffer = "BNI#" + var_name + "#" + var_val + "#" + IntToString(iExpire) + "#" + IntToString(iToken) + "#" + IntToString(iExtend) + "#";
SetLocalString(umObject,"BNI_"+ var_name, var_val);
SetLocalInt(umObject,"BNI_"+ var_name + "x", iExpire);
if (iToken==2)
SetLocalInt(umObject,"BNI_"+ var_name + "t", iExtend);
WriteTimestampedLogEntry(storageBuffer);
}
}
// GESTION DES GET
int GetBanqueOr(string var_name)
{
int retVal;
object umObject = GetLocalObject(GetModule(), "um_object");
int iExpire=GetLocalInt(umObject,"BNO_"+ var_name + "x");
int iDate=GetOffsetGameDate(0);
if (iExpire > 0 && iExpire 0)
SetBanqueOr(var_name, retVal, GetOffsetGameDate(iExtend), 2, iExtend);
return(retVal);
}
string GetBanqueInv(string var_name)
{
string retVal;
object umObject = GetLocalObject(GetModule(), "um_object");
int iExpire=GetLocalInt(umObject,"BNI_"+ var_name + "x");
int iDate=GetOffsetGameDate(0);
if (iExpire > 0 && iExpire 0)
SetBanqueInv(var_name, retVal, GetOffsetGameDate(iExtend), 2, iExtend);
retVal=StrReplace("°°","\n",retVal);
return(retVal);
}
// GESTION DES DELETE
void DeleteBanqueOr(string var_name)
{
object umObject = GetLocalObject(GetModule(), "um_object");
DeleteLocalInt(umObject,"BNO_"+ var_name);
DeleteLocalInt(umObject,"BNO_"+ var_name + "x");
DeleteLocalInt(umObject,"BNO_"+ var_name + "t");
WriteTimestampedLogEntry("DNO#" + var_name + "#");
//WriteTimestampedLogEntry("INT#" + var_name + "#");
}
void DeleteBanqueInv(string var_name)
{
object umObject = GetLocalObject(GetModule(), "um_object");
DeleteLocalString(umObject,"BNI_"+ var_name);
DeleteLocalInt(umObject,"BNI_"+ var_name + "x");
DeleteLocalInt(umObject,"BNI_"+ var_name + "t");
WriteTimestampedLogEntry("DNI#" + var_name + "#");
}
JOL Archives 1.0.1
@ JOL / JeuxOnLine