Ancordia_PRC8/_module/nss/craft_cancelpr.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

57 lines
3.6 KiB
Plaintext

#include "x2_inc_itemprop"
void main()
{
object oPC = GetPCSpeaker();
//Place any items in the main hand or the off-hand in the inventory
object oCopied;
int nCursed;
if (GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) != OBJECT_INVALID)
{
nCursed = GetItemCursedFlag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC));
oCopied = CopyItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC), oPC, TRUE);
if (oCopied != OBJECT_INVALID) DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC));
if (nCursed == TRUE) SetItemCursedFlag(oCopied, TRUE);
nCursed = FALSE;
}
if (GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC) != OBJECT_INVALID)
{
nCursed = GetItemCursedFlag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC));
oCopied = CopyItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC), oPC, TRUE);
if (oCopied != OBJECT_INVALID) DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC));
if (nCursed == TRUE) SetItemCursedFlag(oCopied, TRUE);
nCursed = FALSE;
}
//The end of this chunk of code
object oItem = GetFirstItemInInventory(oPC);
int nSubType;
while (GetIsObjectValid(oItem))
{
if (GetLocalInt(oItem, "Prototype") == TRUE)
{
//Removing last property added.
if (GetLocalString(oPC, "LastProperty") == "Keen") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_KEEN, -1);
if (GetLocalString(oPC, "LastProperty") == "Critical") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_MASSIVE_CRITICALS, -1);
if (GetLocalString(oPC, "LastProperty") == "Mighty") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_MIGHTY, -1);
if (GetLocalString(oPC, "LastProperty") == "Attack") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ATTACK_BONUS, -1);
if (GetLocalString(oPC, "LastProperty") == "Enhancement") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS, -1);
if (GetLocalString(oPC, "LastProperty") == "Ammo") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION, -1);
if (GetLocalString(oPC, "LastProperty") == "Damage")
{
if (GetLocalString(oPC, "Parameter") == "Acid") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_ACID);
if (GetLocalString(oPC, "Parameter") == "Divine") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_DIVINE);
if (GetLocalString(oPC, "Parameter") == "Sonic") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_SONIC);
if (GetLocalString(oPC, "Parameter") == "Fire") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_FIRE);
if (GetLocalString(oPC, "Parameter") == "Cold") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_COLD);
if (GetLocalString(oPC, "Parameter") == "Electrical") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_ELECTRICAL);
if (GetLocalString(oPC, "Parameter") == "Piercing") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_PIERCING);
if (GetLocalString(oPC, "Parameter") == "Bludgeoning") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_BONUS, -1, IP_CONST_DAMAGETYPE_BLUDGEONING);
}
return;
}
oItem = GetNextItemInInventory(oPC);
}
}