generated from Jaysyn/ModuleTemplate
Initial commit
Initial commit
This commit is contained in:
55
_module/nss/oqs_sell_i10.nss
Normal file
55
_module/nss/oqs_sell_i10.nss
Normal file
@@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Olander's and 9Fires' Quest/Commodities/Bounties System
|
||||
// o9f_sell_i10
|
||||
// By Don Anderson
|
||||
// dandersonru@msn.com
|
||||
//
|
||||
// Called from the NPC Commodity Convo
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
object oNPC = OBJECT_SELF;
|
||||
string sNPC = GetTag(oNPC);
|
||||
object oPC = GetPCSpeaker();
|
||||
|
||||
//Normal and Bulk Prices
|
||||
int nNPrice = GetLocalInt(oNPC,"BUY_NORMPRICE" + IntToString(10));
|
||||
int nBPrice = GetLocalInt(oNPC,"BUY_BULKPRICE" + IntToString(10));
|
||||
|
||||
//PC is Selling these
|
||||
string sTag = GetLocalString(oNPC,"TAG" + sNPC + IntToString(10));
|
||||
int nTotal = 0; string sCheck; int nStack = 0;
|
||||
object oItem = GetFirstItemInInventory(oPC);
|
||||
while(GetIsObjectValid(oItem) == TRUE)
|
||||
{
|
||||
sCheck = GetTag(oItem);
|
||||
if(sTag == sCheck)
|
||||
{
|
||||
nStack = GetItemStackSize(oItem);
|
||||
if(nStack > 1) nTotal = nTotal + nStack;
|
||||
else nTotal++;
|
||||
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
|
||||
if(nTotal == 0) SendMessageToPC(oPC,"You have nothing to sell!");
|
||||
|
||||
//Normal Pricing
|
||||
if(nTotal > 0 && nTotal <= 9)
|
||||
{
|
||||
int nTPrice = nTotal * nNPrice;
|
||||
GiveGoldToCreature(oPC,nTPrice);
|
||||
}
|
||||
|
||||
//Bulk Pricing
|
||||
if(nTotal >= 10)
|
||||
{
|
||||
int nTPrice = nTotal * nBPrice;
|
||||
GiveGoldToCreature(oPC,nTPrice);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user