Initial Upload
Initial Upload
This commit is contained in:
84
_module/nss/lod_gpbank_inc.nss
Normal file
84
_module/nss/lod_gpbank_inc.nss
Normal file
@@ -0,0 +1,84 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
// lod_gpbank_inc.nss //
|
||||
// //
|
||||
// Include to be used by the GP Bank for the LoD server //
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Created By :: SoulFlame //
|
||||
// Date Created :: March 23rd, 2005 //
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////
|
||||
// Constants //
|
||||
//////////////////
|
||||
|
||||
const string GP_BANK_DB = "LoD_gpbank";
|
||||
|
||||
//////////////////
|
||||
// Functions //
|
||||
//////////////////
|
||||
|
||||
void DepositGP(object oPC, int iAmount);
|
||||
|
||||
void DepositGP(object oPC, int iAmount)
|
||||
{
|
||||
string sActName = GetPCPlayerName(oPC);
|
||||
int iCurDB, iNewDB;
|
||||
|
||||
iCurDB = GetCampaignInt(GP_BANK_DB, sActName); //Gets current amount from DB
|
||||
|
||||
if (iAmount > GetGold(oPC))
|
||||
{
|
||||
SendMessageToPC(oPC, "You don't have this much gold to deposit.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
iNewDB = iCurDB + iAmount;
|
||||
TakeGoldFromCreature(iAmount, oPC);
|
||||
}
|
||||
|
||||
SetCampaignInt(GP_BANK_DB, sActName, iNewDB); //Stores new amount to DB
|
||||
SendMessageToPC(oPC, "New amount in XP Bank is " + IntToString(iNewDB));
|
||||
}
|
||||
|
||||
|
||||
void WithdrawGP(object oPC, int iAmount);
|
||||
|
||||
void WithdrawGP(object oPC, int iAmount)
|
||||
{
|
||||
string sActName = GetPCPlayerName(oPC);
|
||||
int iCurDB, iNewDB;
|
||||
|
||||
iCurDB = GetCampaignInt(GP_BANK_DB, sActName); //Gets current amount from DB
|
||||
|
||||
if (iAmount > iCurDB)
|
||||
{
|
||||
SendMessageToPC(oPC, "You don't have this much gold to withdraw.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
iNewDB = iCurDB - iAmount;
|
||||
GiveGoldToCreature(oPC, iAmount);
|
||||
}
|
||||
|
||||
if (iNewDB < 0)
|
||||
{
|
||||
SendMessageToPC(oPC, "Result would put DB in negative, cancelling function");
|
||||
return;
|
||||
}
|
||||
|
||||
SetCampaignInt(GP_BANK_DB, sActName, iNewDB); //Stores new amount to DB
|
||||
SendMessageToPC(oPC, "New amount in GP Bank is " + IntToString(iNewDB));
|
||||
}
|
||||
|
||||
// Gets amount of XP available from the Bank
|
||||
void BalanceXP(object oPC);
|
||||
|
||||
void BalanceXP(object oPC)
|
||||
{
|
||||
string sActName = GetPCPlayerName(oPC);
|
||||
int iCurDB = GetCampaignInt(GP_BANK_DB, sActName); //Gets current amount from DB
|
||||
|
||||
SendMessageToPC(oPC, "Current amount in GP Bank is " + IntToString(iCurDB));
|
||||
}
|
||||
Reference in New Issue
Block a user