74 lines
2.5 KiB
Plaintext
74 lines
2.5 KiB
Plaintext
void WandOfDuplication()
|
||
{
|
||
object oPC = GetItemActivator();
|
||
object oArea = GetArea(oPC);
|
||
object oTarget = GetItemActivatedTarget();
|
||
int iTargetType = GetObjectType(oTarget);
|
||
string sAreaTag = GetTag(oArea);
|
||
|
||
object oInventoryItem = OBJECT_INVALID;
|
||
|
||
//check for invalid areas
|
||
if (
|
||
sAreaTag == "RealmsofPerilItemsMuseum" ||
|
||
sAreaTag == "<INSERT INVALID AREA TAG HERE>" ||
|
||
sAreaTag == "<INSERT LAST INVALID AREA TAG HERE>"
|
||
)
|
||
{
|
||
SendMessageToPC(oPC, "You cannot use the wand of duplication in here.");
|
||
SendMessageToAllDMs(GetName(oPC)+ " tried to use the wand of duplication in an invalid area (" + GetName(oArea) + ")");
|
||
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
|
||
return;
|
||
}
|
||
|
||
if (iTargetType == OBJECT_TYPE_ITEM)
|
||
{
|
||
//check for invalid item
|
||
if (GetResRef(oTarget) == "wandofduplicatio")
|
||
{
|
||
SendMessageToPC(oPC, "You cant duplicate the wand of duplication");
|
||
SendMessageToAllDMs(GetName(oPC)+ " tried to duplicate the wand of duplication");
|
||
}
|
||
else
|
||
{
|
||
CreateItemOnObject(GetResRef(oTarget), oPC, GetNumStackedItems(oTarget));
|
||
}
|
||
}
|
||
else if (iTargetType == OBJECT_TYPE_PLACEABLE)
|
||
{
|
||
if (GetHasInventory(oTarget))
|
||
{
|
||
oInventoryItem = GetFirstItemInInventory(oTarget);
|
||
while (oInventoryItem != OBJECT_INVALID)
|
||
{
|
||
if (GetResRef(oInventoryItem) == "wandofduplicatio")
|
||
{
|
||
SendMessageToPC(oPC, "You cant duplicate the wand of duplication");
|
||
SendMessageToAllDMs(GetName(oPC)+ " tried to duplicate the wand of duplication");
|
||
}
|
||
else
|
||
{
|
||
CreateItemOnObject(GetResRef(oInventoryItem), oPC, GetNumStackedItems(oInventoryItem));
|
||
}
|
||
oInventoryItem = GetNextItemInInventory(oTarget);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SendMessageToPC(oPC, GetName(oTarget) + ", is not a valid target for this wand");
|
||
// dont give wand back if the activator is a DM, that happens anyways
|
||
if (GetIsPC(oPC))
|
||
{
|
||
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
|
||
}
|
||
}
|
||
|
||
//if activator is a DM, give the wand back to him
|
||
if (GetIsDM(oPC))
|
||
{
|
||
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
|
||
}
|
||
}
|
||
|
||
|