29 lines
956 B
Plaintext
29 lines
956 B
Plaintext
|
int MassBountyTurnIn(
|
||
|
object oTarget, // the PC
|
||
|
string sItem, // the item's tag
|
||
|
int xpPer, // how much xp per item
|
||
|
int gpPer) { // how much gp per item
|
||
|
|
||
|
int bountyCount = 0;
|
||
|
// iterate over inventory ONE TIME ONLY and both count and remove the item
|
||
|
// same loop as in GetNumItems() in nw_i0_plot.nss
|
||
|
object oItem = GetFirstItemInInventory(oTarget);
|
||
|
while( GetIsObjectValid(oItem) == TRUE ) {
|
||
|
if( GetTag(oItem) == sItem ){
|
||
|
bountyCount = bountyCount + GetNumStackedItems(oItem);
|
||
|
DestroyObject(oItem);
|
||
|
}
|
||
|
oItem = GetNextItemInInventory(oTarget);
|
||
|
}
|
||
|
if( bountyCount > 0 ) {
|
||
|
GiveXPToCreature(oTarget, bountyCount * xpPer);
|
||
|
GiveGoldToCreature(oTarget, bountyCount * gpPer);
|
||
|
}
|
||
|
|
||
|
// monitor its use? fill in following code
|
||
|
// add a PrintString() to log it
|
||
|
// SendMessageToAllDMs()
|
||
|
|
||
|
return bountyCount;
|
||
|
}
|