Amon_PRC8/_module/nss/s_nodrop_drop.nss
Jaysyn904 c5cffc37af Initial Commit
Initial Commit [v1.01]
2025-04-03 19:00:46 -04:00

81 lines
1.8 KiB
Plaintext

/*
s_nodrop_drop - "No Drop" items (from EQ)
This script prevents a PC from attempting to drop, barter, sell
or place items designated as "No Drop"
To use:
1) Incorporate this script into Module::OnUnAcquireItem. s_unacquireitem,
included with this package, is an example
2) Update the list of Tags in GetIsNoDrop() (in i_tagtests)
to include the items you designate as No-Drop
Author: Scott Thorne
E-mail: Thornex2@wans.net
Updated: Sept 01, 2002
*/
//#include "i_tagtests"
void main()
{
object oItem = GetModuleItemLost();
if (GetIsPC(OBJECT_SELF)) {
string sItemName = GetName(oItem);
object oPossessor = GetItemPossessor(oItem);
switch (GetObjectType(oPossessor)) {
case OBJECT_TYPE_CREATURE:
//Debug("Bartered with a PC or taken by an NPC");
break; /* no action, PC will give it back in OnAcquireItem */
case OBJECT_TYPE_STORE:
//Debug("Sold to a merchant");
ActionTakeItem(oItem, oPossessor);
SendMessageToPC(OBJECT_SELF, "The "+ sItemName + " mysteriously reappears in your pack!");
break;
case OBJECT_TYPE_PLACEABLE:
//Debug("Placed into a container");
ActionTakeItem(oItem, oPossessor);
SendMessageToPC(OBJECT_SELF, "The "+ sItemName + " mysteriously reappears in your pack!");
break;
default:
if (GetIsObjectValid(GetAreaFromLocation(GetLocation(oItem)))) {
//Debug("Dropped on the ground");
ActionDoCommand(SetCommandable(FALSE, OBJECT_SELF));
ActionSpeakString("Oops, I dropped something!");
ActionMoveToObject(oItem, TRUE);
ActionPickUpItem(oItem);
ActionDoCommand(SetCommandable(TRUE, OBJECT_SELF));
} else {
//Debug("In barter window");
/* no action, PC will give it back in OnAcquireItem */
}
} /* switch */
} /* if GetIsPC() */
} /* main() */