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

130 lines
4.1 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_SIMPLE_MODEL, ITEM_APPR_TYPE_SIMPLE_MODEL );
int nNewApp;
if (GetBaseItemType(oItem) == BASE_ITEM_AMULET)
{
switch (nCurrentApp)
{
case 26: nNewApp = 28; break;
case 56: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_LARGESHIELD) {
switch (nCurrentApp)
{
case 19: nNewApp = 21; break;
case 29: nNewApp = 31; break;
case 33: nNewApp = 41; break;
case 43: nNewApp = 51; break;
case 88: nNewApp = 90; break;
case 96: nNewApp = 11; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_HELMET) {
switch (nCurrentApp)
{
case 32: nNewApp = 47; break;
case 47: nNewApp = 53; break;
case 61: nNewApp = 67; break;
case 68: nNewApp = 107; break;
//case 76: nNewApp = 107; break;
case 107: nNewApp = 1; break;
//case 166: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_BRACER) {
switch (nCurrentApp)
{
case 12: nNewApp = 51; break;
case 60: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_SMALLSHIELD) {
switch (nCurrentApp)
{
case 19: nNewApp = 21; break;
case 25: nNewApp = 31; break;
case 33: nNewApp = 41; break;
case 43: nNewApp = 86; break;
case 88: nNewApp = 11; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_BELT) {
switch (nCurrentApp)
{
case 9: nNewApp = 51; break;
case 58: nNewApp = 238; break;
case 255: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_TOWERSHIELD) {
switch (nCurrentApp)
{
case 13: nNewApp = 21; break;
case 23: nNewApp = 31; break;
case 46: nNewApp = 51; break;
case 51: nNewApp = 55; break;
case 60: nNewApp = 121; break;
case 123: nNewApp = 11; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_RING) {
switch (nCurrentApp)
{
case 37: nNewApp = 46; break;
case 47: nNewApp = 49; break;
case 50: nNewApp = 116; break;
case 120: nNewApp = 122; break;
case 125: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_CLOAK) {
switch (nCurrentApp)
{
case 19: nNewApp = 21; break;
case 21: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
if (GetBaseItemType(oItem) == BASE_ITEM_GLOVES) {
switch (nCurrentApp)
{
case 10: nNewApp = 51; break;
case 60: nNewApp = 62; break;
case 62: nNewApp = 1; break;
default: nNewApp = nCurrentApp+1; break;
} }
object oModified = CopyItemAndModify(oItem, ITEM_APPR_TYPE_SIMPLE_MODEL, ITEM_APPR_TYPE_SIMPLE_MODEL, nNewApp, TRUE);
SetItemCursedFlag(oModified, TRUE);
if (oModified != OBJECT_INVALID) DestroyObject(oItem);
if (GetBaseItemType(oModified) == BASE_ITEM_LARGESHIELD || GetBaseItemType(oModified) == BASE_ITEM_SMALLSHIELD
|| GetBaseItemType(oModified) == BASE_ITEM_TOWERSHIELD) 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);
}
}