56 lines
1.7 KiB
Plaintext
56 lines
1.7 KiB
Plaintext
#include "nbde_inc"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastSpeaker();
|
|
string sName = GetName(oPC);
|
|
string sLeft = GetStringLeft(sName,4);
|
|
string sCampName = "BankGold_" + sLeft;
|
|
object oCurrentPC = GetLocalObject(OBJECT_SELF, "CurrentPC");
|
|
int iPattern = GetListenPatternNumber();
|
|
int iGold, iCampGold;
|
|
switch(iPattern)
|
|
{
|
|
case 1234:
|
|
{
|
|
if(oPC != oCurrentPC) return;
|
|
iGold = StringToInt(GetMatchedSubstring(0));
|
|
iCampGold = NBDE_GetCampaignInt(sCampName, "GOLD");
|
|
if(iGold > iCampGold)
|
|
{
|
|
FloatingTextStringOnCreature("You don't have that much in the bank!", oPC, FALSE);
|
|
return;
|
|
}
|
|
GiveGoldToCreature(oPC, iGold);
|
|
iCampGold-=iGold;
|
|
NBDE_SetCampaignInt(sCampName, "GOLD", iCampGold);
|
|
SetListening(OBJECT_SELF, FALSE);
|
|
break;
|
|
}
|
|
case 5678:
|
|
{
|
|
if(oPC != oCurrentPC) return;
|
|
iGold = StringToInt(GetMatchedSubstring(0));
|
|
if(GetGold(oPC) < iGold||iGold == 0)
|
|
{
|
|
FloatingTextStringOnCreature("That amount of gold is too much or too little", oPC, FALSE);
|
|
return; //ignores high values
|
|
}
|
|
TakeGoldFromCreature(iGold, oPC, TRUE); // destroys the gold
|
|
iCampGold = NBDE_GetCampaignInt(sCampName, "GOLD");
|
|
iCampGold+=iGold;
|
|
NBDE_SetCampaignInt(sCampName, "GOLD", iCampGold);
|
|
SetListening(OBJECT_SELF, FALSE);
|
|
break;
|
|
}
|
|
case -1:
|
|
{
|
|
BeginConversation();
|
|
break;
|
|
}
|
|
}
|
|
|
|
NBDE_FlushCampaignDatabase(sCampName);
|
|
}
|
|
|