AOC_PRC8/_module/nss/token_refund.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

52 lines
1.4 KiB
Plaintext

void main()
{
object oPC = GetLastClosedBy();
object oMod = GetModule();
object oItem;
int iSilverCount = 0;
int iGoldCount = 0;
int iBronzeCount = 0;
int iNormCount;
int oGold = 0;
if (GetLocalInt(oMod, "mod_mode")==1)
{
PlaySound("sim_cntresist");
FloatingTextStringOnCreature
("*** This chest is not functional in campaign manager mode ***", oPC);
return;
}
oItem = GetFirstItemInInventory(OBJECT_SELF);
while (GetIsObjectValid(oItem))
{
if ((GetTag(oItem)!="pearl")&&
(GetTag(oItem)!="coin1")&&
(GetTag(oItem)!="coin2")){++iNormCount;}
if (GetTag(oItem)=="pearl") {++iBronzeCount;}
if (GetTag(oItem)=="coin1") {++iGoldCount;}
if (GetTag(oItem)=="coin2") {++iSilverCount;}
oItem = GetNextItemInInventory(OBJECT_SELF);
}
if (iNormCount==0)
{
if ((iSilverCount==0)&&(iGoldCount==0)&&(iBronzeCount==0))return;
oItem = GetFirstItemInInventory(OBJECT_SELF);
while (GetIsObjectValid(oItem))
{
DestroyObject(oItem);
oItem = GetNextItemInInventory(OBJECT_SELF);
}
SetLocked(OBJECT_SELF, TRUE);
oGold = ((iBronzeCount*5000)+(iSilverCount*10000)+(iGoldCount*15000));
DelayCommand(1.0, GiveGoldToCreature(oPC, oGold));
DelayCommand(1.0, PlaySound("it_coins"));
DelayCommand(1.5, SetLocked(OBJECT_SELF, FALSE));
}
else
{
FloatingTextStringOnCreature("Tokens only please!", oPC);
PlaySound("sim_cntresist");
}
}