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

80 lines
1.9 KiB
Plaintext

/*
s_nodrop_pickup - "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::OnAcquireItem. s_acquireitem,
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 = GetModuleItemAcquired();
string sItemName = GetName(oItem);
object oOwner = GetLocalObject(oItem, "ND_OWNER");
string sOwnerName = GetName(oOwner);
//object oPossessor = GetItemPossessor(oItem);
string sPossessorName = GetName(OBJECT_SELF);
if (!GetIsPC(oOwner)) {
if (GetIsPC(OBJECT_SELF)) {
//Debug("Branding no-drop item " + sItemName + " to " + sPossessorName);
SetLocalObject(oItem, "ND_OWNER", OBJECT_SELF);
} else {
//Debug("No-drop item " + sItemName + " picked up by NPC " + sPossessorName);
DeleteLocalObject(oItem, "ND_OWNER"); /* Clear ownership */
}
} else {
if (sOwnerName != sPossessorName) {
if (GetIsPC(OBJECT_SELF)) {
//Debug("PC returning no-drop item " + sItemName + ", belongs to " + sOwnerName);
ActionDoCommand(SetCommandable(FALSE));
ActionDoCommand(ClearAllActions());
ActionJumpToObject(oOwner);
ActionGiveItem(oItem, oOwner);
ActionDoCommand(SetCommandable(TRUE));
SendMessageToPC(OBJECT_SELF, "The " + sItemName + " mysteriously vanishes from your pack!");
} else {
//Debug("NPC took no-drop item");
DeleteLocalObject(oItem, "ND_OWNER"); /* Clear ownership */
}
} else {
//Debug("Re-acquiring own no-drop item " + sItemName);
/* No action, re-acquiring own item */
}
} /* if */
} /* main() */