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

88 lines
2.8 KiB
Plaintext

#include "x2_inc_itemprop"
//This is actually the main function.
void script(object oItem, object oPC)
{
int nCurrentApp = GetItemAppearance(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RBICEP);
int nNewApp;
switch (nCurrentApp)
{
case 3: nNewApp = 1; break;
case 4: nNewApp = 3; break;
case 5: nNewApp = 4; break;
case 6: nNewApp = 5; break;
case 7: nNewApp = 6; break;
case 8: nNewApp = 7; break;
case 9: nNewApp = 8; break;
case 10: nNewApp = 9; break;
case 11: nNewApp = 10; break;
case 12: nNewApp = 11; break;
case 13: nNewApp = 12; break;
case 14: nNewApp = 13; break;
case 15: nNewApp = 14; break;
case 30: nNewApp = 15; break;
case 31: nNewApp = 30; break;
case 32: nNewApp = 31; break;
case 54: nNewApp = 32; break;
case 55: nNewApp = 54; break;
case 56: nNewApp = 55; break;
case 57: nNewApp = 56; break;
case 58: nNewApp = 57; break;
case 59: nNewApp = 58; break;
case 60: nNewApp = 59; break;
case 61: nNewApp = 60; break;
case 62: nNewApp = 61; break;
case 101: nNewApp = 62; break;
case 110: nNewApp = 101; break;
case 111: nNewApp = 110; break;
case 121: nNewApp = 111; break;
case 122: nNewApp = 121; break;
case 123: nNewApp = 122; break;
case 124: nNewApp = 123; break;
case 125: nNewApp = 124; break;
case 126: nNewApp = 125; break;
case 127: nNewApp = 126; break;
case 128: nNewApp = 127; break;
case 129: nNewApp = 128; break;
case 130: nNewApp = 129; break;
case 131: nNewApp = 130; break;
case 132: nNewApp = 131; break;
case 133: nNewApp = 132; break;
case 134: nNewApp = 133; break;
case 135: nNewApp = 134; break;
case 136: nNewApp = 135; break;
case 160: nNewApp = 136; break;
case 161: nNewApp = 160; break;
case 186: nNewApp = 161; break;
case 1: nNewApp = 186; break;
default: nNewApp = 0; break;
}
object oModified = CopyItemAndModify(oItem, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_RBICEP, nNewApp, TRUE);
SetItemCursedFlag(oModified, TRUE);
if (oModified != OBJECT_INVALID) DestroyObject(oItem);
ExecuteScript("craft_pcequip", oPC);
return;
}
void main()
{
object oPC = GetPCSpeaker();
int nSlot = 0;
object oItem;
//Check if the item being crafted is equipped
while (nSlot < 18)
{
oItem = GetItemInSlot(nSlot, oPC);
if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; }
nSlot++;
}
//If the item is not equipped, search for it in the inventory
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; }
oItem = GetNextItemInInventory(oPC);
}
}