Initial Commit
Initial Commit
This commit is contained in:
81
_module/nss/craft_reset2.nss
Normal file
81
_module/nss/craft_reset2.nss
Normal file
@@ -0,0 +1,81 @@
|
||||
#include "x2_inc_itemprop"
|
||||
|
||||
//This is actually the main function.
|
||||
void script(object oItem, object oPC)
|
||||
{
|
||||
IPRemoveAllItemProperties(oItem, DURATION_TYPE_TEMPORARY);
|
||||
IPRemoveAllItemProperties(oItem, DURATION_TYPE_PERMANENT);
|
||||
if (GetTag(oItem) == "anc_it_epicsr")
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
object oNew = CreateItemOnObject("anc_it_belt_craf", oPC);
|
||||
SetLocalInt(oNew, "Prototype", TRUE);
|
||||
SetItemCursedFlag(oNew, TRUE);
|
||||
}
|
||||
if (GetTag(oItem) == "anc_it_epiche")
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
object oNew = CreateItemOnObject("anc_it_helm_craf", oPC);
|
||||
SetLocalInt(oNew, "Prototype", TRUE);
|
||||
SetItemCursedFlag(oNew, TRUE);
|
||||
}
|
||||
if (GetTag(oItem) == "anc_it_epicar")
|
||||
{
|
||||
string sNew;
|
||||
string sOld = GetResRef(oItem);
|
||||
if (sOld == "anc_it_armor3d") sNew = "NW_CLOTH024"; //Base AC 0
|
||||
if (sOld == "anc_it_earmor28") sNew = "NW_AARCL009"; //Base AC 1
|
||||
if (sOld == "anc_it_earmor26") sNew = "NW_AARCL001"; //Base AC 2
|
||||
if (sOld == "anc_it_earmor17") sNew = "NW_AARCL002"; //Base AC 3
|
||||
if (sOld == "anc_it_earmor15") sNew = "NW_AARCL012"; //Base AC 4
|
||||
if (sOld == "anc_it_earmor11") sNew = "NW_AARCL004"; //Base AC 5
|
||||
if (sOld == "anc_it_earmor9") sNew = "NW_AARCL005"; //Base AC 6
|
||||
if (sOld == "anc_it_earmor7") sNew = "NW_AARCL006"; //Base AC 7
|
||||
if (sOld == "anc_it_earmor1") sNew = "NW_AARCL007"; //Base AC 8
|
||||
DestroyObject(oItem);
|
||||
object oNew = CreateItemOnObject(sNew, oPC);
|
||||
SetLocalInt(oNew, "Prototype", TRUE);
|
||||
SetItemCursedFlag(oNew, TRUE);
|
||||
|
||||
SetIdentified(oNew ,FALSE);
|
||||
int nType;
|
||||
switch (GetGoldPieceValue(oNew))
|
||||
{
|
||||
case 1: nType = 0; break; // None
|
||||
case 5: nType = 1; break; // Padded
|
||||
case 10: nType = 2; break; // Leather
|
||||
case 15: nType = 3; break; // Studded Leather / Hide
|
||||
case 100: nType = 4; break; // Chain Shirt / Scale Mail
|
||||
case 150: nType = 5; break; // Chainmail / Breastplate
|
||||
case 200: nType = 6; break; // Splint Mail / Banded Mail
|
||||
case 600: nType = 7; break; // Half-Plate
|
||||
case 1500: nType = 8; break; // Full Plate
|
||||
}
|
||||
SetIdentified(oNew, TRUE);
|
||||
if (nType == 0) SetLocalString(oNew, "Type", "Cloth");
|
||||
else SetLocalString(oNew, "Type", "Armor");
|
||||
SetLocalString(oNew, "BaseAC", IntToString(nType));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user