Initial Commit
Initial Commit
This commit is contained in:
67
_module/nss/craft_ear.nss
Normal file
67
_module/nss/craft_ear.nss
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "x2_inc_itemprop"
|
||||
|
||||
//This is actually the main function.
|
||||
void script(object oItem, object oPC)
|
||||
{
|
||||
int nValue = GetGoldPieceValue(oItem);
|
||||
string sNew;
|
||||
string sOld = GetTag(oItem);
|
||||
if (sOld == "NW_CLOTH024") sNew = "anc_it_armor3d"; //Base AC 0
|
||||
if (sOld == "NW_AARCL009") sNew = "anc_it_earmor28"; //Base AC 1
|
||||
if (sOld == "NW_AARCL001") sNew = "anc_it_earmor26"; //Base AC 2
|
||||
if (sOld == "NW_AARCL002") sNew = "anc_it_earmor17"; //Base AC 3
|
||||
if (sOld == "NW_AARCL012") sNew = "anc_it_earmor15"; //Base AC 4
|
||||
if (sOld == "NW_AARCL004") sNew = "anc_it_earmor11"; //Base AC 5
|
||||
if (sOld == "NW_AARCL005") sNew = "anc_it_earmor9"; //Base AC 6
|
||||
if (sOld == "NW_AARCL006") sNew = "anc_it_earmor7"; //Base AC 7
|
||||
if (sOld == "NW_AARCL007") sNew = "anc_it_earmor1"; //Base AC 8
|
||||
|
||||
if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS)) {SetLocalInt(oItem, "HasProperties", TRUE); return;}
|
||||
DestroyObject(oItem);
|
||||
object oNew = CreateItemOnObject(sNew, oPC);
|
||||
SetIdentified(oNew, TRUE);
|
||||
SetLocalInt(oNew, "Prototype", TRUE);
|
||||
SetItemCursedFlag(oNew, TRUE);
|
||||
SetLocalString(oPC, "LastProperty", "EpicAC");
|
||||
|
||||
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