//#include "_persist_01a"
#include "nw_i0_plot"

void CreateAnObject(string sResource, object oPC, int iStackSize);
void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef);
void GetNextItemPossessedBy(object oPC, string sItemTag);
string CraftLookup(string sResRef, int iIngotType);

void main()
{
 object oItem = GetInventoryDisturbItem();
 object oPC = GetLastDisturbed();
 object oSelf = OBJECT_SELF;
 string sTag = GetTag(oItem);
 string sSuccess = "";
 string sFail = "";
 string sItemResRef = "";
 string sItemResRefPoor = "";
 string sItemResRefExceptional = "";
 int iRandom = 0;
 int iSuccess = 0;
 int iSuccess2 = 0;
 int iSkillGain = 0;
 int iComponent1 = 1;
 int iComponent2 = 0;
 int iComponent3 = 0;
 int iComponent1Stackable = 1;
 int iComponent2Stackable = 0;
 int iComponent3Stackable = 0;
 int iStackSize = 0;
 int iCraftStackSize = 0;  // for stackable end products
 int iCraftType = 0;  // default to Weapons for skill check
 int iIngotType = GetLocalInt(oPC,"iUseIngotType");  // get the current ingot type used
 int iIngotMod = iIngotType *25;                     // set the skill modifier for the ingot type used.
 string sComponent1 = "";
 string sComponent2 = "";
 string sComponent3 = "";
 string sComponent1Name = "";
 string sComponent2Name = "";
 string sComponent3Name = "";
 string sComponentResRef = "";
 object oTemp = OBJECT_INVALID;
 object oTool = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);

 if (GetTag(oTool) != "ITEM_SMITHHAMMER_NORMAL") oTool = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
 int iHammerUse = GetLocalInt(oPC,"iHammerUsed");



 if (iIngotType==9) iIngotMod = 90;    // Silver is little easier than Bronze
 if (iIngotType==10) iIngotMod = 175;  // Mithril is hard as Verite
 if (iIngotType==11) iIngotMod = 200;  // Adamantite is hard as Valorite
 if (iIngotType==12) iIngotMod = 150;  // Platinum is hard as Agapite

 if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
  {
   // The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
   // You can replace them with whatever 'no-drop' code you have or comment them out.
   string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
   if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
    return;
   if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
    {
     DestroyObject(oItem);
     SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
     return;
    }
   // End of compatability portion.
   CopyItem(oItem,oPC,TRUE);
   DestroyObject(oItem);
   FloatingTextStringOnCreature("You can only craft by removing pattern tokens from this station.",oPC,FALSE);
  }

 // Check for ingot type switch or non-flagswitch/pattern item
 if (GetStringLeft(GetResRef(oItem),7)!="pattern")
  {
   if (sTag == "SWITCH_IRON"){SetLocalInt(oPC,"iUseIngotType",0);sComponent1 = "Iron";}
   if (sTag == "SWITCH_DULL"){SetLocalInt(oPC,"iUseIngotType",1);sComponent1 = "Dull Copper";}
   if (sTag == "SWITCH_SHADOW"){SetLocalInt(oPC,"iUseIngotType",2);sComponent1 = "Shadow Iron";}
   if (sTag == "SWITCH_COPPER"){SetLocalInt(oPC,"iUseIngotType",3);sComponent1 = "Copper";}
   if (sTag == "SWITCH_BRONZE"){SetLocalInt(oPC,"iUseIngotType",4);sComponent1 = "Bronze";}
   if (sTag == "SWITCH_GOLD"){SetLocalInt(oPC,"iUseIngotType",5);sComponent1 = "Gold";}
   if (sTag == "SWITCH_AGAPITE"){SetLocalInt(oPC,"iUseIngotType",6);sComponent1 = "Agapite";}
   if (sTag == "SWITCH_VERITE"){SetLocalInt(oPC,"iUseIngotType",7);sComponent1 = "Verite";}
   if (sTag == "SWITCH_VALORITE"){SetLocalInt(oPC,"iUseIngotType",8);sComponent1 = "Valorite";}
   if (sTag == "SWITCH_SILVER"){SetLocalInt(oPC,"iUseIngotType",9);sComponent1 = "Silver";}
   if (sTag == "SWITCH_MITHRIL"){SetLocalInt(oPC,"iUseIngotType",10);sComponent1 = "Mithril";}
   if (sTag == "SWITCH_ADAMANTITE"){SetLocalInt(oPC,"iUseIngotType",11);sComponent1 = "Adamantite";}
   if (sTag == "SWITCH_PLATINUM"){SetLocalInt(oPC,"iUseIngotType",12);sComponent1 = "Platinum";}
   if (GetStringLeft(sTag,7)=="SWITCH_")
    {
     FloatingTextStringOnCreature("Re-tooling to use "+sComponent1+" ingots.",oPC,FALSE);
     DestroyObject(oItem);
     //ExecuteScript("_onclose_clear",OBJECT_SELF);
     //ExecuteScript("_open_anvil",OBJECT_SELF);
     string sTagSelf = GetTag(oSelf);
     AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
     AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
    }
   return;
  }
 CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
 DestroyObject(oItem);

 if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
    {
     SendMessageToPC(oPC,"You must wait till the current weapon or armor is completed before starting another.");
     return;
    }

 if (GetTag(oTool) != "ITEM_SMITHHAMMER_NORMAL")
  {
   FloatingTextStringOnCreature("You must have a smithy hammer equipped in order to attempt this craft...",oPC,FALSE);
   return;
  }

 //int iSmithSkill = GetTokenPair(oPC,13,4); // Weaponsmith
 int iSmithSkill = GetCampaignInt("UOACraft","iSmithSkill",oPC);
 int iSmithChance = iSmithSkill;
 //int iArmorSkill = GetTokenPair(oPC,13,5); // ArmorCraft
 int iArmorSkill = GetCampaignInt("UOACraft","iArmorSkill",oPC);
 int iArmorChance = iArmorSkill;

 if (iSmithChance < 350)
  {
   iSmithChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
   iSmithChance = iSmithChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
   iSmithChance = iSmithChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
   iSmithChance = iSmithChance*3;
   if (iSmithChance>350)iSmithChance=350;
   if (iSmithSkill > iSmithChance) iSmithChance=iSmithSkill;
  }
 if (iArmorChance < 350)
  {
   iArmorChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
   iArmorChance = iArmorChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
   iArmorChance = iArmorChance+(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
   iArmorChance = iArmorChance*3;
   if (iArmorChance>350)iArmorChance=350;
   if (iArmorSkill > iArmorChance) iArmorChance=iArmorSkill;
  }

 // Modify skill chance based on ingot type used
 if (iIngotMod >0) iIngotMod = iIngotMod + 250;
 iSmithChance = iSmithChance - iIngotMod;
 iArmorChance = iArmorChance - iIngotMod;

 // Begin Crafting Test
 if (sTag == "P_DAGGER")
  {
   iSmithChance = iSmithChance - 100;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a dagger.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the dagger useless.";
   sItemResRefPoor = CraftLookup("wswdg002",iIngotType);
   sItemResRef = CraftLookup("nw_wswdg001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswdg003",iIngotType);
   iComponent1 = 2;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_SHORTSWORD")
  {
   iSmithChance = iSmithChance-150;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a shortsword.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the shortsword useless.";
   sItemResRefPoor = CraftLookup("wswss002",iIngotType);
   sItemResRef = CraftLookup("nw_wswss001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswss003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_RINGMAIL")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 100;
   sSuccess = "You carefully forge the rings and sew them into the leather backing to make ringmail armor.";
   sFail = "The rings fail to link properly and the leather backing is ruined.";
   sItemResRefPoor = CraftLookup("ringmail001",iIngotType);
   sItemResRef = CraftLookup("ringmail",iIngotType);
   sItemResRefExceptional = CraftLookup("ringmail002",iIngotType);
   iComponent1 = 6;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 2;
  }
 if (sTag == "P_CHAINSHIRT")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 250;
   sSuccess = "You carefully forge the small chain links and link them together to make a chainmail shirt.";
   sFail = "The link pattern for the small chain links is wrong, and the chain shirt is ruined.";
   sItemResRefPoor = CraftLookup("aarcl013",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl012",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl014",iIngotType);
   iComponent1 = 8;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_CHAINMAIL")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 350;
   sSuccess = "You carefully forge the small chain links and link them together with the leather to make chainmail armor.";
   sFail = "The link pattern for the small chain links is wrong, and the chainmail armor is ruined.";
   sItemResRefPoor = CraftLookup("aarcl005",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl004",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl006",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 1;
  }
 if (sTag == "P_SCALEMAIL")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 300;
   sSuccess = "You carefully forge the small metal scales and hook them into the leather to make scale mail armor.";
   sFail = "The scales do not hook properly, and the scale mail armor is ruined.";
   sItemResRefPoor = CraftLookup("aarcl006",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl003",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl007",iIngotType);
   iComponent1 = 8;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 2;
  }
 if (sTag == "P_BREASTPLATE")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 350;
   sSuccess = "You carefully pound the metal into a form-fitting breastplate.";
   sFail = "The metal warps and turns brittle as you try to pound it into a form-fitting shape.";
   sItemResRefPoor = CraftLookup("aarcl011",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl010",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl016",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_BANDEDMAIL")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 400;
   sSuccess = "You carefully forge the small metal bands and fix them into the leather to make banded mail armor.";
   sFail = "The bands do not fix properly, and the banded mail armor is ruined.";
   sItemResRefPoor = CraftLookup("aarcl014",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl011",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl015",iIngotType);
   iComponent1 = 14;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 1;
  }
 if (sTag == "P_SPLINTMAIL")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 400;
   sSuccess = "You carefully forge the small metal plates and fix them into the leather to make splint mail armor.";
   sFail = "The small metal plates are too brittle to fix properly, and the splint mail armor is ruined.";
   sItemResRefPoor = CraftLookup("aarcl018",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl005",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl019",iIngotType);
   iComponent1 = 14;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 2;
  }
 if (sTag == "P_HALFPLATE")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 450;
   sSuccess = "You carefully forge the metal plates and affix the leather to create a suit of half plate armor.";
   sFail = "The metal plates are too brittle to server as armor, and the suit of half plate is ruined.";
   sItemResRefPoor = CraftLookup("aarcl010",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl006",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl017",iIngotType);
   iComponent1 = 20;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 2;
   sComponent3 = "HARDLEATHER_SMALL"; // Small Hardened Leather
   sComponent3Name = "small hardened leathers";
   iComponent3 = 2;
  }
 if (sTag == "P_FULLPLATE")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 500;
   sSuccess = "You carefully forge the metal plates and affix the leather to create a suit of full plate armor.";
   sFail = "The metal plates are too brittle to server as armor, and the suit of full plate is ruined.";
   sItemResRefPoor = CraftLookup("aarcl008",iIngotType);
   sItemResRef = CraftLookup("nw_aarcl007",iIngotType);
   sItemResRefExceptional = CraftLookup("aarcl009",iIngotType);
   iComponent1 = 30;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 3;
   sComponent3 = "HARDLEATHER_MEDIUM"; // Medium Hardened Leather
   sComponent3Name = "medium hardened leathers";
   iComponent3 = 2;
  }
 if (sTag == "P_LONGSWORD")
  {
   iSmithChance = iSmithChance-250;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a longsword.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the longsword useless.";
   sItemResRefPoor = CraftLookup("wswls002",iIngotType);
   sItemResRef = CraftLookup("nw_wswls001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswls003",iIngotType);
   iComponent1 = 6;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_BASTARDSWORD")
  {
   iSmithChance = iSmithChance-350;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a bastard sword.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the bastard sword useless.";
   sItemResRefPoor = CraftLookup("wswbs002",iIngotType);
   sItemResRef = CraftLookup("nw_wswbs001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswbs003",iIngotType);
   iComponent1 = 7;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_GREATSWORD")
  {
   iSmithChance = iSmithChance-400;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a greatsword.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the greatsword useless.";
   sItemResRefPoor = CraftLookup("wswgs002",iIngotType);
   sItemResRef = CraftLookup("nw_wswgs001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswgs003",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_HORSEHAIRHELMET")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 150;
   sSuccess = "You carefully pound the metal plate into the form of a horsehair helmet.";
   sFail = "The metal turns brittle as you pound it, ruining the horsehair helmet.";
   sItemResRefPoor = CraftLookup("arhe005",iIngotType);
   sItemResRef = CraftLookup("nw_arhe004",iIngotType);
   sItemResRefExceptional = CraftLookup("arhe007",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_POTHELMET")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 150;
   sSuccess = "You carefully pound the metal plate into the form of a pot helmet.";
   sFail = "The metal turns brittle as you pound it, ruining the pot helmet.";
   sItemResRefPoor = CraftLookup("arhe002",iIngotType);
   sItemResRef = CraftLookup("nw_arhe001",iIngotType);
   sItemResRefExceptional = CraftLookup("arhe008",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_SPIKEHELMET")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 150;
   sSuccess = "You carefully pound the metal plate into the form of a spike helmet.";
   sFail = "The metal turns brittle as you pound it, ruining the spike helmet.";
   sItemResRefPoor = CraftLookup("arhe003",iIngotType);
   sItemResRef = CraftLookup("nw_arhe002",iIngotType);
   sItemResRefExceptional = CraftLookup("arhe009",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_STAGHELMET")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 150;
   sSuccess = "You carefully pound the metal plate into the form of a stag helmet.";
   sFail = "The metal turns brittle as you pound it, ruining the stag helmet.";
   sItemResRefPoor = CraftLookup("arhe006",iIngotType);
   sItemResRef = CraftLookup("nw_arhe005",iIngotType);
   sItemResRefExceptional = CraftLookup("arhe010",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_WINGEDHELMET")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 150;
   sSuccess = "You carefully pound the metal plate into the form of a winged helmet.";
   sFail = "The metal turns brittle as you pound it, ruining the winged helmet.";
   sItemResRefPoor = CraftLookup("arhe004",iIngotType);
   sItemResRef = CraftLookup("nw_arhe003",iIngotType);
   sItemResRefExceptional = CraftLookup("arhe011",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_SMALLSHIELD")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 250;
   sSuccess = "You carefully craft the metal edges and affix the wooden boards to form a small shield.";
   sFail = "The metal fails to conform to the wooden portion of the shield, ruining both.";
   sItemResRefPoor = CraftLookup("ashsw002",iIngotType);
   sItemResRef = CraftLookup("nw_ashsw001",iIngotType);
   sItemResRefExceptional = CraftLookup("ashsw003",iIngotType);
   iComponent1 = 2;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "WOOD_NORMAL"; // normal wood logs
   sComponent3Name = "normal wood logs";
   iComponent3 = 1;
  }
 if (sTag == "P_MEDIUMSHIELD")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 350;
   sSuccess = "You carefully craft the metal edges and affix the wooden boards to form a large shield.";
   sFail = "The metal fails to conform to the wooden portion of the shield, ruining both.";
   sItemResRefPoor = CraftLookup("ashlw002",iIngotType);
   sItemResRef = CraftLookup("nw_ashlw001",iIngotType);
   sItemResRefExceptional = CraftLookup("ashlw003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
   sComponent3 = "WOOD_NORMAL"; // normal wood logs
   sComponent3Name = "normal wood logs";
   iComponent3 = 2;
  }

 if (sTag == "P_LARGESHIELD")
  {
   iCraftType=1;
   iArmorChance = iArmorChance - 450;
   sSuccess = "You carefully pound and form the metal plate into a tower shield.";
   sFail = "The metal turns brittle as you work it, rendering the shield useless.";
   sItemResRefPoor = CraftLookup("ashto002",iIngotType);
   sItemResRef = CraftLookup("nw_ashto001",iIngotType);
   sItemResRefExceptional = CraftLookup("ashto003",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_MACE")
  {
   iSmithChance = iSmithChance-200;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a mace.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the mace useless.";
   sItemResRefPoor = CraftLookup("wblml002",iIngotType);
   sItemResRef = CraftLookup("nw_wblml001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblml003",iIngotType);
   iComponent1 = 5;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_MORNINGSTAR")
  {
   iSmithChance = iSmithChance-300;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a maorning star.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the morning star useless.";
   sItemResRefPoor = CraftLookup("wblms002",iIngotType);
   sItemResRef = CraftLookup("nw_wblms001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblms003",iIngotType);
   iComponent1 = 6;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
   sComponent3 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent3Name = "small cast molds";
   iComponent3 = 1;
  }
 if (sTag == "P_LIGHTFLAIL")
  {
   iSmithChance = iSmithChance-250;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a light flail.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the light flail useless.";
   sItemResRefPoor = CraftLookup("wblfl002",iIngotType);
   sItemResRef = CraftLookup("nw_wblfl001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblfl003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_HEAVYFLAIL")
  {
   iSmithChance = iSmithChance-350;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a heavy flail.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the heavy flail useless.";
   sItemResRefPoor = CraftLookup("wblfh002",iIngotType);
   sItemResRef = CraftLookup("nw_wblfh001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblfh003",iIngotType);
   iComponent1 = 7;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_LIGHTHAMMER")
  {
   iSmithChance = iSmithChance-250;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a light hammer.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the light hammer useless.";
   sItemResRefPoor = CraftLookup("wblhl002",iIngotType);
   sItemResRef = CraftLookup("nw_wblhl001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblhl003",iIngotType);
   iComponent1 = 5;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_WARHAMMER")
  {
   iSmithChance = iSmithChance-350;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a warhammer.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the warhammer useless.";
   sItemResRefPoor = CraftLookup("wblhw002",iIngotType);
   sItemResRef = CraftLookup("nw_wblhw001",iIngotType);
   sItemResRefExceptional = CraftLookup("wblhw003",iIngotType);
   iComponent1 = 9;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_HANDAXE")
  {
   iSmithChance = iSmithChance-150;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a handaxe.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the handaxe useless.";
   sItemResRefPoor = CraftLookup("waxhn002",iIngotType);
   sItemResRef = CraftLookup("nw_waxhn001",iIngotType);
   sItemResRefExceptional = CraftLookup("waxhn003",iIngotType);
   iComponent1 = 3;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_BATTLEAXE")
  {
   iSmithChance = iSmithChance-150;
   sSuccess = "You carefully heat, fold, and pound the metal into the form of a battleaxe.";
   sFail = "The metal turns brittle as you heat, fold, and pound it, rending the battleaxe useless.";
   sItemResRefPoor = CraftLookup("waxbt002",iIngotType);
   sItemResRef = CraftLookup("nw_waxbt001",iIngotType);
   sItemResRefExceptional = CraftLookup("waxbt003",iIngotType);
   iComponent1 = 7;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_DART")
  {
   iCraftStackSize = 50;
   iSmithChance = iSmithChance-50;
   sSuccess = "You carefully forge the throwing darts.";
   sFail = "The metal fails to cool properly and the throwing darts are ruined.";
   sItemResRefPoor = CraftLookup("wthdt002",iIngotType);
   sItemResRef = CraftLookup("nw_wthdt001",iIngotType);
   sItemResRefExceptional = CraftLookup("wthdt003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_SHURIKEN")
  {
   iCraftStackSize = 50;
   iSmithChance = iSmithChance-50;
   sSuccess = "You carefully forge the shuriken.";
   sFail = "The metal fails to cool properly and the shuriken are ruined.";
   sItemResRefPoor = CraftLookup("wthsh002",iIngotType);
   sItemResRef = CraftLookup("nw_wthsh001",iIngotType);
   sItemResRefExceptional = CraftLookup("wthsh003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_THROWINGAXE")
  {
   iCraftStackSize = 50;
   iSmithChance = iSmithChance-150;
   sSuccess = "You carefully forge the throwing axes.";
   sFail = "The metal fails to cool properly and the throwing axes are ruined.";
   sItemResRefPoor = CraftLookup("wthax002",iIngotType);
   sItemResRef = CraftLookup("nw_wthax001",iIngotType);
   sItemResRefExceptional = CraftLookup("wthax003",iIngotType);
   iComponent1 = 6;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_HALBERD")
  {
   iSmithChance = iSmithChance-400;
   sSuccess = "You carefully forge the halberd blade and affix it to the shaft.";
   sFail = "The metal turns brittle as you attempt to forge and the halberd is ruined.";
   sItemResRefPoor = CraftLookup("wplhb002",iIngotType);
   sItemResRef = CraftLookup("nw_wplhb001",iIngotType);
   sItemResRefExceptional = CraftLookup("wplhb003",iIngotType);
   iComponent1 = 20;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 1;
   sComponent3 = "WOOD_NORMAL"; // Normal wooden log
   sComponent3Name = "normal wooden logs";
   iComponent3 = 1;
  }
 if (sTag == "P_SCYTHE")
  {
   iSmithChance = iSmithChance-400;
   sSuccess = "You carefully forge the scythe blade and affix it to the shaft.";
   sFail = "The metal turns brittle as you attempt to forge and the scythe is ruined.";
   sItemResRefPoor = CraftLookup("wplsc002",iIngotType);
   sItemResRef = CraftLookup("nw_wplsc001",iIngotType);
   sItemResRefExceptional = CraftLookup("wplsc003",iIngotType);
   iComponent1 = 20;
   sComponent2 = "ITEM_LARGECASTMOLD"; // large cast mold
   sComponent2Name = "large cast molds";
   iComponent2 = 1;
   sComponent3 = "WOOD_NORMAL"; // Normal wooden log
   sComponent3Name = "normal wooden logs";
   iComponent3 = 1;
  }
 if (sTag == "P_SPEAR")
  {
   iSmithChance = iSmithChance-300;
   sSuccess = "You carefully forge the spear tip and affix it to the shaft.";
   sFail = "The metal turns brittle as you attempt to forge and the spear is ruined.";
   sItemResRefPoor = CraftLookup("wplss002",iIngotType);
   sItemResRef = CraftLookup("nw_wplss001",iIngotType);
   sItemResRefExceptional = CraftLookup("wplss003",iIngotType);
   iComponent1 = 3;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
   sComponent3 = "WOOD_NORMAL"; // Normal wooden log
   sComponent3Name = "normal wooden logs";
   iComponent3 = 1;
  }
 if (sTag == "P_KAMA")
  {
   iSmithChance = iSmithChance-50;
   sSuccess = "You carefully fold and pound the metal into the form of a kama.";
   sFail = "The metal turns brittle as you attempt to forge and the kama is ruined.";
   sItemResRefPoor = CraftLookup("wspka002",iIngotType);
   sItemResRef = CraftLookup("nw_wspka001",iIngotType);
   sItemResRefExceptional = CraftLookup("wspka003",iIngotType);
   iComponent1 = 3;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_KUKRI")
  {
   iSmithChance = iSmithChance-100;
   sSuccess = "You carefully fold and pound the metal into the form of a kukri.";
   sFail = "The metal turns brittle as you attempt to forge and the kukri is ruined.";
   sItemResRefPoor = CraftLookup("wspku002",iIngotType);
   sItemResRef = CraftLookup("nw_wspku001",iIngotType);
   sItemResRefExceptional = CraftLookup("wspku003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_SICKLE")
  {
   iSmithChance = iSmithChance-150;
   sSuccess = "You carefully fold and pound the metal into the form of a sickle.";
   sFail = "The metal turns brittle as you attempt to forge and the sickle is ruined.";
   sItemResRefPoor = CraftLookup("wspsc002",iIngotType);
   sItemResRef = CraftLookup("nw_wspsc001",iIngotType);
   sItemResRefExceptional = CraftLookup("wspsc003",iIngotType);
   iComponent1 = 4;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_DIREMACE")
  {
   iSmithChance = iSmithChance-450;
   sSuccess = "You carefully fold and pound the metal into the form of a dire mace.";
   sFail = "The metal turns brittle as you attempt to forge and the dire mace is ruined.";
   sItemResRefPoor = CraftLookup("wdbma002",iIngotType);
   sItemResRef = CraftLookup("nw_wdbma001",iIngotType);
   sItemResRefExceptional = CraftLookup("wdbma003",iIngotType);
   iComponent1 = 15;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 2;
  }
 if (sTag == "P_DOUBLEAXE")
  {
   iSmithChance = iSmithChance-450;
   sSuccess = "You carefully fold and pound the metal into the form of a double axe.";
   sFail = "The metal turns brittle as you attempt to forge and the double axe is ruined.";
   sItemResRefPoor = CraftLookup("wdbax002",iIngotType);
   sItemResRef = CraftLookup("nw_wdbax001",iIngotType);
   sItemResRefExceptional = CraftLookup("wdbax003",iIngotType);
   iComponent1 = 15;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 2;
  }
 if (sTag == "P_TWOBLADEDSWORD")
  {
   iSmithChance = iSmithChance-500;
   sSuccess = "You carefully fold and pound the metal into the form of a two-bladed sword.";
   sFail = "The metal turns brittle as you attempt to forge and the two-bladed sword is ruined.";
   sItemResRefPoor = CraftLookup("wdbsw002",iIngotType);
   sItemResRef = CraftLookup("nw_wdbsw001",iIngotType);
   sItemResRefExceptional = CraftLookup("wdbsw003",iIngotType);
   iComponent1 = 25;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 2;
  }
 if (sTag == "P_BULLET")
  {
   iSmithChance = iSmithChance+50;  //Bullets are easy to make
   iCraftStackSize = 99;
   sSuccess = "You carefully forge the bullets.";
   sFail = "The metal fails to cool properly and the bullets are ruined.";
   sItemResRefPoor = CraftLookup("wambu002",iIngotType);
   sItemResRef = CraftLookup("nw_wambu001",iIngotType);
   sItemResRefExceptional = CraftLookup("wambu003",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_ARROWHEAD")
  {
   iSmithChance = iSmithChance - 50;
   iCraftStackSize = 50;
   sSuccess = "You carefully forge the arrowheads.";
   sFail = "The metal fails to cool properly and the arrowheads are ruined.";
   sItemResRefPoor = CraftLookup("arrowhead001",iIngotType);
   sItemResRef = CraftLookup("arrowhead",iIngotType);
   sItemResRefExceptional = CraftLookup("arrowhead002",iIngotType);
   iComponent1 = 5;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_BOLTTIP")
  {
   iSmithChance = iSmithChance - 50;
   iCraftStackSize = 50;
   sSuccess = "You carefully forge the bolt tips.";
   sFail = "The metal fails to cool properly and the bolt tips are ruined.";
   sItemResRefPoor = CraftLookup("arrowhead004",iIngotType);
   sItemResRef = CraftLookup("arrowhead003",iIngotType);
   sItemResRefExceptional = CraftLookup("arrowhead005",iIngotType);
   iComponent1 = 5;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
 if (sTag == "P_METALSTUD")
  {
   iCraftType=1;
   iArmorChance = iArmorChance + 100;  // metal studs are super-easy
   iCraftStackSize = 99;
   sSuccess = "You carefully forge the metal studs.";
   sFail = "The metal fails to cool properly and the metal studs are ruined.";
   sItemResRefPoor = CraftLookup("metalstud001",iIngotType);
   sItemResRef = CraftLookup("metalstud",iIngotType);
   sItemResRefExceptional = CraftLookup("metalstud002",iIngotType);
   iComponent1 = 10;
   sComponent2 = "ITEM_SMALLCASTMOLD"; // small cast mold
   sComponent2Name = "small cast molds";
   iComponent2 = 1;
  }
  if (sTag == "P_KATANA")
  {
   iSmithChance = iSmithChance-350;
   sSuccess = "You carefully fold and pound the metal into the form of a katana.";
   sFail = "The metal turns brittle as you attempt to forge and the katana is ruined.";
   sItemResRefPoor = CraftLookup("wswka002",iIngotType);
   sItemResRef = CraftLookup("nw_wswka001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswka003",iIngotType);
   iComponent1 = 9;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
  if (sTag == "P_RAPIER")
  {
   iSmithChance = iSmithChance-250;
   sSuccess = "You carefully fold and pound the metal into the form of a rapier.";
   sFail = "The metal turns brittle as you attempt to forge and the rapier is ruined.";
   sItemResRefPoor = CraftLookup("wswrp002",iIngotType);
   sItemResRef = CraftLookup("nw_wswrp001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswrp003",iIngotType);
   iComponent1 = 5;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
  if (sTag == "P_SCIMITAR")
  {
   iSmithChance = iSmithChance-300;
   sSuccess = "You carefully fold and pound the metal into the form of a scimitar.";
   sFail = "The metal turns brittle as you attempt to forge and the scimitar is ruined.";
   sItemResRefPoor = CraftLookup("wswsc002",iIngotType);
   sItemResRef = CraftLookup("nw_wswsc001",iIngotType);
   sItemResRefExceptional = CraftLookup("wswsc003",iIngotType);
   iComponent1 = 6;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
  if (sTag == "pattern123")
  {
   iSmithChance = iSmithChance-400;
   sSuccess = "You carefully fold and pound the metal into the form of a great axe.";
   sFail = "The metal turns brittle as you attempt to forge and the great axe is ruined.";
   sItemResRefPoor = CraftLookup("waxgr002",iIngotType);
   sItemResRef = CraftLookup("nw_waxgr001",iIngotType);
   sItemResRefExceptional = CraftLookup("waxgr003",iIngotType);
   iComponent1 = 8;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }
  if (sTag == "pattern124")
  {
   if (GetRacialType(oPC)!=RACIAL_TYPE_DWARF)
    {
     FloatingTextStringOnCreature("You are not a dwarf!  You cannot craft a Dwarven Waraxe!",oPC,FALSE);
     return;
    }
   iSmithChance = iSmithChance-400;
   sSuccess = "You carefully fold and pound the metal into the form of a dwarven waraxe.";
   sFail = "The metal turns brittle as you attempt to forge and the dwarven waraxe is ruined.";
   sItemResRefPoor = CraftLookup("wdwraxe002",iIngotType);
   sItemResRef = CraftLookup("x2_wdwraxe001",iIngotType);
   sItemResRefExceptional = CraftLookup("wdwraxe003",iIngotType);
   iComponent1 = 7;
   sComponent2 = "ITEM_MEDIUMCASTMOLD"; // medium cast mold
   sComponent2Name = "medium cast molds";
   iComponent2 = 1;
  }


 // Set Ingot Tag and name based on ingot selection
 switch (iIngotType)
  {
   case 0:{sComponent1 = "INGOT_IRON";sComponent1Name = "iron ingots";break;}
   case 1:{sComponent1 = "INGOT_DULL";sComponent1Name = "dull copper ingots";break;}
   case 2:{sComponent1 = "INGOT_SHADOW";sComponent1Name = "shadow iron ingots";break;}
   case 3:{sComponent1 = "INGOT_COPPER";sComponent1Name = "copper ingots";break;}
   case 4:{sComponent1 = "INGOT_BRONZE";sComponent1Name = "bronze ingots";break;}
   case 5:{sComponent1 = "INGOT_GOLD";sComponent1Name = "gold ingots";break;}
   case 6:{sComponent1 = "INGOT_AGAPITE";sComponent1Name = "agapite ingots";break;}
   case 7:{sComponent1 = "INGOT_VERITE";sComponent1Name = "verite ingots";break;}
   case 8:{sComponent1 = "INGOT_VALORITE";sComponent1Name = "valorite ingots";break;}
   case 9:{sComponent1 = "INGOT_SILVER";sComponent1Name = "silver ingots";break;}
   case 10:{sComponent1 = "INGOT_MITHRIL";sComponent1Name = "mithril ingots";break;}
   case 11:{sComponent1 = "INGOT_ADAMANTITE";sComponent1Name = "adamantite ingots";break;}
   case 12:{sComponent1 = "INGOT_PLATINUM";sComponent1Name = "platinum ingots";break;}
   default:{FloatingTextStringOnCreature("Error in ingot selection..",oPC,FALSE);return;break;}
  }

 // Check for negative chance due to ingot type and other modifiers
 if (iCraftType==0)
   {
    if (iSmithChance <1)
     {
      FloatingTextStringOnCreature("You do not have the skill needed to craft this.",oPC,FALSE);
      return;
     }
   }
  else
   {
    if (iArmorChance <1)
     {
      FloatingTextStringOnCreature("You do not have the skill needed to craft this.",oPC,FALSE);
      return;
     }
   }

 // check for components
 if (GetNumItems(oPC,sComponent1) < iComponent1)
  {
   FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE);
   return;
  }
 if (iComponent2 > 0)
  {
   if (GetNumItems(oPC,sComponent2) < iComponent2)
    {
     FloatingTextStringOnCreature("You do not have enough "+sComponent2Name+" to do this.",oPC,FALSE);
     return;
    }
  }
 if (iComponent3 > 0)
  {
   if (GetNumItems(oPC,sComponent3) < iComponent3)
    {
     FloatingTextStringOnCreature("You do not have enough "+sComponent3Name+" to do this.",oPC,FALSE);
     return;
    }
  }

// This is extra code.. not needed I think
// if (iArmorChance <1)
//  {
//   if (iCraftType==1)
//    {
//     FloatingTextStringOnCreature("You do not yet possess the skill required to craft this armor.",oPC,FALSE);
//     return;
//    }
//  }
// if (iSmithChance <1)
//  {
//   if (iCraftType==0)
//    {
//     FloatingTextStringOnCreature("You do not yet possess the skill required to craft this weapon.",oPC,FALSE);
//     return;
//    }
//  }


 // visual and audio crafting effects
 AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,12.0));
 if (iCraftType==0)
   {
    if (Random(1000)<500)
      {
       PlaySound("as_cv_smithhamr2");
       DelayCommand(6.0,PlaySound("as_cv_smithhamr2"));
      }
     else
      {
       PlaySound("as_cv_smithhamr1");
       DelayCommand(6.0,PlaySound("as_cv_smithhamr1"));
      }

   }
  else
   {
    PlaySound("as_cv_smithmet2");
    if (Random(1000)<500)
      {
       DelayCommand(6.0,PlaySound("as_cv_smithhamr3"));
      }
     else
      {
       DelayCommand(6.0,PlaySound("as_cv_smithhamr1"));
      }
   }

 // Set Anvil to 'in use'
 SetLocalInt(OBJECT_SELF,"iAmInUse",99);
 DelayCommand(12.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));

 // This snippet of code is cut-n-paste direct from ATS
 // Reason for this is because I had no clue how to assign an increase
 // in the z-axis of the location of the anvil for sparks to display.
 // After reading through this code, it is obvious that vEffecrPos.z
 // is the line which assigns this.  Due to my own ignorance in this issue
 // I have decided to leave this snippet of code intact with this credit to
 // the original ATS script coders, whomever they may have been.

  location locAnvil = GetLocation(OBJECT_SELF);
  vector vEffectPos = GetPositionFromLocation(locAnvil);
  vEffectPos.z += 1.0;
  location locEffect = Location( GetAreaFromLocation(locAnvil), vEffectPos,GetFacingFromLocation(locAnvil) );
  ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect);
  DelayCommand(1.7, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
  DelayCommand(2.4, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
  DelayCommand(3.1, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
  DelayCommand(3.8, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));

  // end of ATS snippet ^^^^
  //


  DelayCommand(4.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE,FALSE),locEffect));
  DelayCommand(5.9,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));
  DelayCommand(7.1,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE,FALSE),locEffect));
  DelayCommand(8.2,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));
  DelayCommand(9.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),locEffect));
  DelayCommand(11.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));


 // Remove all components
 float fPause = 0.0;
 if (iComponent1Stackable != 0)
   {
    oTemp = GetItemPossessedBy(oPC,sComponent1);
    sComponentResRef = GetResRef(oTemp);
    iStackSize = GetNumStackedItems(oTemp);
    DestroyObject(oTemp);
    if (iStackSize < iComponent1)
      {
       iComponent1 = iComponent1 - iStackSize;
       DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef));
      }
     else
      {
       if (iStackSize > iComponent1)
        {
         iStackSize = iStackSize - iComponent1;
         DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
        }
      }
   }
  else
   {
    for (iComponent1; iComponent1>0; iComponent1--)
     {
      fPause = fPause+0.5;
      AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent1)));
     }
   }
 if (sComponent2 != "")
  {
   if (iComponent2Stackable != 0)
     {
      oTemp = GetItemPossessedBy(oPC,sComponent2);
      sComponentResRef = GetResRef(oTemp);
      iStackSize = GetNumStackedItems(oTemp);
      DestroyObject(oTemp);
      if (iStackSize < iComponent2)
        {
         iComponent2 = iComponent2 - iStackSize;
         DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef));
        }
       else
        {
         if (iStackSize > iComponent2)
          {
           iStackSize = iStackSize - iComponent2;
           DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
          }
        }
     }
    else
     {
      for (iComponent2; iComponent2>0; iComponent2--)
       {
        fPause = fPause+0.5;
        AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent2)));
       }
     }
  }
 if (sComponent3 != "")
  {
   if (iComponent3Stackable != 0)
     {
      oTemp = GetItemPossessedBy(oPC,sComponent3);
      sComponentResRef = GetResRef(oTemp);
      iStackSize = GetNumStackedItems(oTemp);
      DestroyObject(oTemp);
      if (iStackSize < iComponent3)
        {
         iComponent3 = iComponent3 - iStackSize;
         DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef));
        }
       else
        {
         if (iStackSize > iComponent3)
          {
           iStackSize = iStackSize - iComponent3;
           DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
          }
        }
     }
    else
     {
      for (iComponent3; iComponent3>0; iComponent3--)
       {
        fPause = fPause +0.5;
        AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent3)));
       }
     }
   }


 // check for success
 if (iCraftType ==0)
   {
    // Adjusted the starting chance down from 1000 to 800 to facilitate more lowend successes
    if (Random(800) <= iSmithChance)
      {
       DelayCommand(8.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),OBJECT_SELF,1.0));
       if (Random(1000)<500)
         {
          DelayCommand(12.0,PlaySound("as_cv_smithwatr2"));
         }
        else
         {
          DelayCommand(12.0,PlaySound("as_cv_smithwatr1"));
         }
       iSuccess = 1;
       iSuccess2 = 1;
       iSmithChance = iSmithChance - 50;
       if (Random(1000) <= iSmithChance) iSuccess2 = iSuccess2+1;
       iSmithChance = iSmithChance-100;
       if (Random(1000) <= iSmithChance) iSuccess2 = iSuccess2+1;
       iSmithChance = iSmithChance + 150;
       if (iCraftStackSize != 0) iSuccess2 =4;
       if (iSuccess2 == 1)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefPoor,oPC,1)));
       if (iSuccess2 == 2)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
       if (iSuccess2 == 3)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefExceptional,oPC,1)));
       AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
       if (Random(1000) >= iSmithSkill)
        {
         if (d10(1)+1 >= iSmithChance/100) iSkillGain = 1;
        }
      }
     else
      {
       AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
       return;
      }
   }
  else
   {
    // Adjusted the starting chance down from 1000 to 800 to facilitate more lowend successes
    if (Random(800) <= iArmorChance)
      {
       iSuccess = 1;
       iSuccess2 = 1;
       iArmorChance = iArmorChance - 50;
       if (Random(1000) <= iArmorChance) iSuccess2 = iSuccess2+1;
       iArmorChance = iArmorChance - 100;
       if (Random(1000) <= iArmorChance) iSuccess2 = iSuccess2+1;
       iArmorChance = iArmorChance+150;
       if (iSuccess2 == 1)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefPoor,oPC,1)));
       if (iSuccess2 == 2)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
       if (iSuccess2 == 3)AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefExceptional,oPC,1)));
       AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
       if (Random(1000) >= iArmorSkill)
        {
         if (d10(1)+1 >= iArmorChance/100) iSkillGain = 1;
        }
      }
     else
      {
       AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
       return;
      }
   }

 // Adjust stacksize for items that have stackable properties (throwing axes, etc)
 if (iCraftStackSize>0)
  {
   int iStackPoor = 0;
   int iStackNormal = 0;
   int iStackExceptional = 0;
   int iQuality = 0;
   string sQuality = "";
   for (iCraftStackSize; iCraftStackSize>0; iCraftStackSize--)
    {
     iQuality = 0;
     if (Random(1000)<= iSmithChance) iQuality++;
     if (Random(1000)<= iSmithChance) iQuality++;
     if (Random(1000)<= iSmithChance) iQuality++;
     if (iQuality==1) iStackPoor++;
     if (iQuality==2) iStackNormal++;
     if (iQuality==3) iStackExceptional++;
    }
   sQuality = "Created - ("+IntToString(iStackPoor)+" Poor) ("+IntToString(iStackNormal)+" Normal) ("+IntToString(iStackExceptional)+" Exceptional)";
   if (iStackPoor >0) AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRefPoor,oPC,iStackPoor)));
   if (iStackNormal>0) AssignCommand(oPC,DelayCommand(12.5,CreateAnObject(sItemResRef,oPC,iStackNormal)));
   if (iStackExceptional>0) AssignCommand(oPC,DelayCommand(13.0,CreateAnObject(sItemResRefExceptional,oPC,iStackExceptional)));
   AssignCommand(oPC,DelayCommand(13.0,FloatingTextStringOnCreature(sQuality,oPC,FALSE)));
  }

 //Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
      if (iSkillGain ==1)
       {
        if (GetLocalInt(oPC,"iSkillGain")!= 0)
          {
           iSkillGain = 0;
          }
         else
          {
           SetLocalInt(oPC,"iSkillGain",99);
           AssignCommand(GetArea(oPC),DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)));
          }
       }




 // Do skill gains
 if (iSkillGain ==1)
  {
   string sOldSkill = "";
   string sOldSkill2 = "";
   if (iCraftType==0)
     {
      iSmithSkill++;
      sOldSkill2 = IntToString(iSmithSkill);
      sOldSkill = "."+GetStringRight(sOldSkill2,1);
      if (iSmithSkill > 9)
        {
         sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
        }
       else
        {
         sOldSkill = "0"+sOldSkill;
        }
      if (iSmithSkill <= 1000)
       {
        //DelayCommand(13.0,SetTokenPair(oPC,13,4,iSmithSkill));
        DelayCommand(13.0,SetCampaignInt("UOACraft","iSmithSkill",iSmithSkill,oPC));
        DelayCommand(13.0,SendMessageToPC(oPC,"========================================="));
        DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in weaponsmithing has gone up!"));
        DelayCommand(13.0,SendMessageToPC(oPC,"Current weaponsmithing skill : "+ sOldSkill+"%"));
        DelayCommand(13.0,SendMessageToPC(oPC,"========================================="));
        if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
       }
     }
    else
     {
      iArmorSkill++;
      sOldSkill2 = IntToString(iArmorSkill);
      sOldSkill = "."+GetStringRight(sOldSkill2,1);
      if (iArmorSkill > 9)
        {
         sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
        }
       else
        {
         sOldSkill = "0"+sOldSkill;
        }
      if (iArmorSkill <= 1000)
       {
        //DelayCommand(13.0,SetTokenPair(oPC,13,5,iArmorSkill));
        DelayCommand(13.0,SetCampaignInt("UOACraft","iArmorSkill",iArmorSkill,oPC));
        DelayCommand(13.0,SendMessageToPC(oPC,"====================================="));
        DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in armorcraft has gone up!"));
        DelayCommand(13.0,SendMessageToPC(oPC,"Current armorcraft skill : "+ sOldSkill+"%"));
        DelayCommand(13.0,SendMessageToPC(oPC,"====================================="));
        if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
       }
     }
  }

 //Check for broken tool
 iHammerUse++;
 if (iHammerUse>60+Random(20))
  {
   AssignCommand(oPC,DelayCommand(10.0,FloatingTextStringOnCreature("Your hammer has broken while crafting..",oPC,FALSE)));
   DestroyObject(oTool,9.5);
   iHammerUse=0;
  }
 SetLocalInt(oPC,"iHammerUsed",iHammerUse);


}

void CreateAnObject(string sResource, object oPC, int iStackSize)
 {
  CreateItemOnObject(sResource,oPC,iStackSize);
  return;
 }

void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef)
 {
  object oTemp = GetItemPossessedBy(oPC,sItemTag);
  int iStackCount = GetNumStackedItems(oTemp);
  int iTemp = iCount - iStackCount;
  iStackCount = iStackCount-iCount;
  DestroyObject(oTemp);
  if (iStackCount > 0)
   {
    SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount));
    DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount));
   }
  // this next line *should* recursively call this function if the number of
  // stacked items does not meet the required number of items to be destroyed.
  if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef));
  return;
 }

void GetNextItemPossessedBy(object oPC, string sItemTag)
 {
  object oTemp = GetItemPossessedBy(oPC,sItemTag);
  DestroyObject(oTemp);
  return;
 }

string CraftLookup(string sResRef, int iIngotType)
 {
  switch (iIngotType)
   {
    case 0:
     {
      return sResRef;
      break;
     }
    case 1:
     {
      //Dull Copper Dagger
      if (sResRef=="wswdg002") return "wswdg005";
      if (sResRef=="nw_wswdg001") return "wswdg004";
      if (sResRef=="wswdg003") return "wswdg006";
      //Dull Copper ShortSword
      if (sResRef=="wswss002") return "wswss005";
      if (sResRef=="nw_wswss001") return "wswss004";
      if (sResRef=="wswss003") return "wswss006";
      //Dull Copper Bullet
      if (sResRef=="wambu002") return "wambu005";
      if (sResRef=="nw_wambu001") return "wambu004";
      if (sResRef=="wambu003") return "wambu006";
      //Dull Copper Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead007";
      if (sResRef=="arrowhead") return "arrowhead006";
      if (sResRef=="arrowhead002")  return "arrowhead008";
      //Dull Copper Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead043";
      if (sResRef=="arrowhead003") return "arrowhead042";
      if (sResRef=="arrowhead005") return "arrowhead044";
      //Dull Copper Metal Stud
      if (sResRef=="metalstud001") return "metalstud004";
      if (sResRef=="metalstud") return "metalstud003";
      if (sResRef=="metalstud002") return "metalstud005";
      //Dull Copper Throwing Dart
      if (sResRef=="wthdt002") return "wthdt005";
      if (sResRef=="nw_wthdt001") return "wthdt004";
      if (sResRef=="wthdt003") return "wthdt006";
      //Dull Copper Shuriken
      if (sResRef=="wthsh002") return "wthsh005";
      if (sResRef=="nw_wthsh001") return "wthsh004";
      if (sResRef=="wthsh003") return "wthsh006";
      //Dull Copper Throwing Axe
      if (sResRef=="wthax002") return "wthax005";
      if (sResRef=="nw_wthax001") return "wthax004";
      if (sResRef=="wthax003") return "wthax006";
      //Dull Copper Handaxe
      if (sResRef=="waxhn002") return "waxhn005";
      if (sResRef=="nw_waxhn001") return "waxhn004";
      if (sResRef=="waxhn003") return "waxhn006";
      //Dull Copper Battleaxe
      if (sResRef=="waxbt002") return "waxbt005";
      if (sResRef=="nw_waxbt001") return "waxbt004";
      if (sResRef=="waxbt003") return "waxbt006";
      //Dull Copper Light Flail
      if (sResRef=="wblfl002") return "wblfl005";
      if (sResRef=="nw_wblfl001") return "wblfl004";
      if (sResRef=="wblfl003") return "wblfl006";
      //Dull Copper Heavy Flail
      if (sResRef=="wblfh002") return "wblfh005";
      if (sResRef=="nw_wblfh001") return "wblfh004";
      if (sResRef=="wblfh003") return "wblfh006";
      //Dull Copper Light Hammer
      if (sResRef=="wblhl002") return "wblhl005";
      if (sResRef=="nw_wblhl001") return "wblhl004";
      if (sResRef=="wblhl003") return "wblhl006";
      //Dull Copper Warhammer
      if (sResRef=="wblhw002") return "wblhw005";
      if (sResRef=="nw_wblhw001") return "wblhw004";
      if (sResRef=="wblhw003") return "wblhw006";
      //Dull Copper Mace
      if (sResRef=="wblml002") return "wblml005";
      if (sResRef=="nw_wblml001") return "wblml004";
      if (sResRef=="wblml003") return "wblml006";
      //Dull Copper Morningstar
      if (sResRef=="wblms002") return "wblms005";
      if (sResRef=="nw_wblms001") return "wblms004";
      if (sResRef=="wblms003") return "wblms006";
      //Dull Copper Basterd Sword
      if (sResRef=="wswbs002") return "wswbs005";
      if (sResRef=="nw_wswbs001") return "wswbs004";
      if (sResRef=="wswbs003") return "wswbs006";
      //Dull Copper Greatsword
      if (sResRef=="wswgs002") return "wswgs005";
      if (sResRef=="nw_wswgs001") return "wswgs004";
      if (sResRef=="wswgs003") return "wswgs006";
      //Dull Copper Longsword
      if (sResRef=="wswls002") return "wswls005";
      if (sResRef=="nw_wswls001") return "wswls004";
      if (sResRef=="wswls003") return "wswls006";
      //Dull Copper Katana
      if (sResRef=="wswka002") return "wswka005";
      if (sResRef=="nw_wswka001") return "wswka004";
      if (sResRef=="wswka003") return "wswka006";
      //Dull Copper Rapier
      if (sResRef=="wswrp002") return "wswrp005";
      if (sResRef=="nw_wswrp001") return "wswrp004";
      if (sResRef=="wswrp003") return "wswrp006";
      //Dull Copper Scimitar
      if (sResRef=="wswsc002") return "wswsc005";
      if (sResRef=="nw_wswsc001") return "wswsc004";
      if (sResRef=="wswsc003") return "wswsc006";
      //Dull Copper Kama
      if (sResRef=="wspka002") return "wspka005";
      if (sResRef=="nw_wspka001") return "wspka004";
      if (sResRef=="wspka003") return "wspka006";
      //Dull Copper Kukri
      if (sResRef=="wspku002") return "wspku005";
      if (sResRef=="nw_wspku001") return "wspku004";
      if (sResRef=="wspku003") return "wspku006";
      //Dull Copper Sickle
      if (sResRef=="wspsc002") return "wspsc005";
      if (sResRef=="nw_wspsc001") return "wspsc004";
      if (sResRef=="wspsc003") return "wspsc006";
      //Dull Copper Dire Mace
      if (sResRef=="wdbma002") return "wdbma005";
      if (sResRef=="nw_wdbma001") return "wdbma004";
      if (sResRef=="wdbma003") return "wdbma006";
      //Dull Copper Double Axe
      if (sResRef=="wdbax002") return "wdbax005";
      if (sResRef=="nw_wdbax001") return "wdbax004";
      if (sResRef=="wdbax003") return "wdbax006";
      //Dull Copper Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw005";
      if (sResRef=="nw_wdbsw001") return "wdbsw004";
      if (sResRef=="wdbsw003") return "wdbsw006";
      //Dull Copper Halberd
      if (sResRef=="wplhb002") return "wplhb005";
      if (sResRef=="nw_wplhb001") return "wplhb004";
      if (sResRef=="wplhb003") return "wplhb006";
      //Dull Copper Scythe
      if (sResRef=="wplsc002") return "wplsc005";
      if (sResRef=="nw_wplsc001") return "wplsc004";
      if (sResRef=="wplsc003") return "wplsc006";
      //Dull Copper Spear
      if (sResRef=="wplss002") return "wplss005";
      if (sResRef=="nw_wplss001") return "wplss004";
      if (sResRef=="wplss003") return "wplss006";
      //Dull Copper Small Shield
      if (sResRef=="ashsw002") return "ashsw005";
      if (sResRef=="nw_ashsw001") return "ashsw004";
      if (sResRef=="ashsw003") return "ashsw006";
      //Dull Copper Large Shield
      if (sResRef=="ashlw002") return "ashlw005";
      if (sResRef=="nw_ashlw001") return "ashlw004";
      if (sResRef=="ashlw003") return "ashlw006";
      //Dull Copper Tower Shield
      if (sResRef=="ashto002") return "ashto005";
      if (sResRef=="nw_ashto001") return "ashto004";
      if (sResRef=="ashto003") return "ashto006";
      //Dull Copper Horsehair Helmet
      if (sResRef=="arhe005") return "arhe013";
      if (sResRef=="nw_arhe004") return "arhe012";
      if (sResRef=="arhe007") return "arhe014";
      //Dull Copper Pot Helmet
      if (sResRef=="arhe002") return "arhe049";
      if (sResRef=="nw_arhe001") return "arhe048";
      if (sResRef=="arhe008") return "arhe050";
      //Dull Copper Spike Helmet
      if (sResRef=="arhe003") return "arhe085";
      if (sResRef=="nw_arhe002") return "arhe084";
      if (sResRef=="arhe009") return "arhe086";
      //Dull Copper Stag Helmet
      if (sResRef=="arhe006") return "arhe121";
      if (sResRef=="nw_arhe005") return "arhe120";
      if (sResRef=="arhe010") return "arhe122";
      //Dull Copper Winged Helmet
      if (sResRef=="arhe004") return "arhe157";
      if (sResRef=="nw_arhe003") return "arhe156";
      if (sResRef=="arhe011") return "arhe158";
      //Dull Copper Ringmail
      if (sResRef=="ringmail001") return "ringmail004";
      if (sResRef=="ringmail") return "ringmail003";
      if (sResRef=="ringmail002") return "ringmail005";
      //Dull Copper Chain Shirt
      if (sResRef=="aarcl013") return "aarcl021";
      if (sResRef=="nw_aarcl012") return "aarcl020";
      if (sResRef=="aarcl014") return "aarcl022";
      //Dull Copper Breastplate
      if (sResRef=="aarcl011") return "aarcl057";
      if (sResRef=="nw_aarcl010") return "aarcl056";
      if (sResRef=="aarcl016") return "aarcl058";
      //Dull Copper Chainmail
      if (sResRef=="aarcl005") return "aarcl093";
      if (sResRef=="nw_aarcl004") return "aarcl092";
      if (sResRef=="aarcl006") return "aarcl094";
      //Dull Copper Scale Mail
      if (sResRef=="aarcl006") return "aarcl129";
      if (sResRef=="nw_aarcl003") return "aarcl128";
      if (sResRef=="aarcl007") return "aarcl130";
      //Dull Copper Banded Mail
      if (sResRef=="aarcl014") return "aarcl165";
      if (sResRef=="nw_aarcl011") return "aarcl164";
      if (sResRef=="aarcl015") return "aarcl166";
      //Dull Copper Splint Mail
      if (sResRef=="aarcl018") return "aarcl201";
      if (sResRef=="nw_aarcl005") return "aarcl200";
      if (sResRef=="aarcl019") return "aarcl202";
      //Dull Copper Half Plate
      if (sResRef=="aarcl010") return "aarcl237";
      if (sResRef=="nw_aarcl006") return "aarcl236";
      if (sResRef=="aarcl017") return "aarcl238";
      //Dull Copper Full Plate
      if (sResRef=="aarcl008") return "aarcl273";
      if (sResRef=="nw_aarcl007") return "aarcl272";
      if (sResRef=="aarcl009") return "aarcl274";
      //Dull Copper Great Axe
      if (sResRef=="waxgr002") return "waxgr005";
      if (sResRef=="nw_waxgr001") return "waxgr004";
      if (sResRef=="waxgr003") return "waxgr006";
      //Dull Copper Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe005";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe004";
      if (sResRef=="wdwraxe003") return "wdwraxe006";
      break;
     }
    case 2:
     {
      //Shadow Iron Dagger
      if (sResRef=="wswdg002") return "wswdg008";
      if (sResRef=="nw_wswdg001") return "wswdg007";
      if (sResRef=="wswdg003") return "wswdg009";
      //Shadow Iron ShortSword
      if (sResRef=="wswss002") return "wswss008";
      if (sResRef=="nw_wswss001") return "wswss007";
      if (sResRef=="wswss003") return "wswss009";
      //Shadow Iron Bullet
      if (sResRef=="wambu002") return "wambu008";
      if (sResRef=="nw_wambu001") return "wambu007";
      if (sResRef=="wambu003") return "wambu009";
      //Shadow Iron Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead010";
      if (sResRef=="arrowhead") return "arrowhead009";
      if (sResRef=="arrowhead002")  return "arrowhead011";
      //Shadow Iron Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead046";
      if (sResRef=="arrowhead003") return "arrowhead045";
      if (sResRef=="arrowhead005") return "arrowhead047";
      //Shadow Iron Metal Stud
      if (sResRef=="metalstud001") return "metalstud007";
      if (sResRef=="metalstud") return "metalstud006";
      if (sResRef=="metalstud002") return "metalstud008";
      //Shadow Iron Throwing Dart
      if (sResRef=="wthdt002") return "wthdt008";
      if (sResRef=="nw_wthdt001") return "wthdt007";
      if (sResRef=="wthdt003") return "wthdt009";
      //Shadow Iron Shuriken
      if (sResRef=="wthsh002") return "wthsh008";
      if (sResRef=="nw_wthsh001") return "wthsh007";
      if (sResRef=="wthsh003") return "wthsh009";
      //Shadow Iron Throwing Axe
      if (sResRef=="wthax002") return "wthax008";
      if (sResRef=="nw_wthax001") return "wthax007";
      if (sResRef=="wthax003") return "wthax009";
      //Shadow Iron Handaxe
      if (sResRef=="waxhn002") return "waxhn008";
      if (sResRef=="nw_waxhn001") return "waxhn007";
      if (sResRef=="waxhn003") return "waxhn009";
      //Shadow Iron Battleaxe
      if (sResRef=="waxbt002") return "waxbt008";
      if (sResRef=="nw_waxbt001") return "waxbt007";
      if (sResRef=="waxbt003") return "waxbt009";
      //Shadow Iron Light Flail
      if (sResRef=="wblfl002") return "wblfl008";
      if (sResRef=="nw_wblfl001") return "wblfl007";
      if (sResRef=="wblfl003") return "wblfl009";
      //Shadow Iron Heavy Flail
      if (sResRef=="wblfh002") return "wblfh008";
      if (sResRef=="nw_wblfh001") return "wblfh007";
      if (sResRef=="wblfh003") return "wblfh009";
      //Shadow Iron Light Hammer
      if (sResRef=="wblhl002") return "wblhl008";
      if (sResRef=="nw_wblhl001") return "wblhl007";
      if (sResRef=="wblhl003") return "wblhl009";
      //Shadow Iron Warhammer
      if (sResRef=="wblhw002") return "wblhw008";
      if (sResRef=="nw_wblhw001") return "wblhw007";
      if (sResRef=="wblhw003") return "wblhw009";
      //Shadow Iron Mace
      if (sResRef=="wblml002") return "wblml008";
      if (sResRef=="nw_wblml001") return "wblml007";
      if (sResRef=="wblml003") return "wblml009";
      //Shadow Iron Morningstar
      if (sResRef=="wblms002") return "wblms008";
      if (sResRef=="nw_wblms001") return "wblms007";
      if (sResRef=="wblms003") return "wblms009";
      //Shadow Iron Basterd Sword
      if (sResRef=="wswbs002") return "wswbs008";
      if (sResRef=="nw_wswbs001") return "wswbs007";
      if (sResRef=="wswbs003") return "wswbs009";
      //Shadow Iron Greatsword
      if (sResRef=="wswgs002") return "wswgs008";
      if (sResRef=="nw_wswgs001") return "wswgs007";
      if (sResRef=="wswgs003") return "wswgs009";
      //Shadow Iron Longsword
      if (sResRef=="wswls002") return "wswls008";
      if (sResRef=="nw_wswls001") return "wswls007";
      if (sResRef=="wswls003") return "wswls009";
      //Shadow Iron Katana
      if (sResRef=="wswka002") return "wswka008";
      if (sResRef=="nw_wswka001") return "wswka007";
      if (sResRef=="wswka003") return "wswka009";
      //Shadow Iron Rapier
      if (sResRef=="wswrp002") return "wswrp008";
      if (sResRef=="nw_wswrp001") return "wswrp007";
      if (sResRef=="wswrp003") return "wswrp009";
      //Shadow Iron Scimitar
      if (sResRef=="wswsc002") return "wswsc008";
      if (sResRef=="nw_wswsc001") return "wswsc007";
      if (sResRef=="wswsc003") return "wswsc009";
      //Shadow Iron Kama
      if (sResRef=="wspka002") return "wspka008";
      if (sResRef=="nw_wspka001") return "wspka007";
      if (sResRef=="wspka003") return "wspka009";
      //Shadow Iron Kukri
      if (sResRef=="wspku002") return "wspku008";
      if (sResRef=="nw_wspku001") return "wspku007";
      if (sResRef=="wspku003") return "wspku009";
      //Shadow Iron Sickle
      if (sResRef=="wspsc002") return "wspsc008";
      if (sResRef=="nw_wspsc001") return "wspsc007";
      if (sResRef=="wspsc003") return "wspsc009";
      //Shadow Iron Dire Mace
      if (sResRef=="wdbma002") return "wdbma008";
      if (sResRef=="nw_wdbma001") return "wdbma007";
      if (sResRef=="wdbma003") return "wdbma009";
      //Shadow Iron Double Axe
      if (sResRef=="wdbax002") return "wdbax008";
      if (sResRef=="nw_wdbax001") return "wdbax007";
      if (sResRef=="wdbax003") return "wdbax009";
      //Shadow Iron Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw008";
      if (sResRef=="nw_wdbsw001") return "wdbsw007";
      if (sResRef=="wdbsw003") return "wdbsw009";
      //Shadow Iron Halberd
      if (sResRef=="wplhb002") return "wplhb008";
      if (sResRef=="nw_wplhb001") return "wplhb007";
      if (sResRef=="wplhb003") return "wplhb009";
      //Shadow Iron Scythe
      if (sResRef=="wplsc002") return "wplsc008";
      if (sResRef=="nw_wplsc001") return "wplsc007";
      if (sResRef=="wplsc003") return "wplsc009";
      //Shadow Iron Spear
      if (sResRef=="wplss002") return "wplss008";
      if (sResRef=="nw_wplss001") return "wplss007";
      if (sResRef=="wplss003") return "wplss009";
      //Shadow Iron Small Shield
      if (sResRef=="ashsw002") return "ashsw008";
      if (sResRef=="nw_ashsw001") return "ashsw007";
      if (sResRef=="ashsw003") return "ashsw009";
      //Shadow Iron Large Shield
      if (sResRef=="ashlw002") return "ashlw008";
      if (sResRef=="nw_ashlw001") return "ashlw007";
      if (sResRef=="ashlw003") return "ashlw009";
      //Shadow Iron Tower Shield
      if (sResRef=="ashto002") return "ashto008";
      if (sResRef=="nw_ashto001") return "ashto007";
      if (sResRef=="ashto003") return "ashto009";
      //Shadow Iron Horsehair Helmet
      if (sResRef=="arhe005") return "arhe016";
      if (sResRef=="nw_arhe004") return "arhe015";
      if (sResRef=="arhe007") return "arhe017";
      //Shadow Iron Pot Helmet
      if (sResRef=="arhe002") return "arhe052";
      if (sResRef=="nw_arhe001") return "arhe051";
      if (sResRef=="arhe008") return "arhe053";
      //Shadow Iron Spike Helmet
      if (sResRef=="arhe003") return "arhe088";
      if (sResRef=="nw_arhe002") return "arhe087";
      if (sResRef=="arhe009") return "arhe089";
      //Shadow Iron Stag Helmet
      if (sResRef=="arhe006") return "arhe124";
      if (sResRef=="nw_arhe005") return "arhe123";
      if (sResRef=="arhe010") return "arhe125";
      //Shadow Iron Winged Helmet
      if (sResRef=="arhe004") return "arhe160";     //fix
      if (sResRef=="nw_arhe003") return "arhe159";
      if (sResRef=="arhe011") return "arhe161";
      //Shadow Iron Ringmail
      if (sResRef=="ringmail001") return "ringmail007";
      if (sResRef=="ringmail") return "ringmail006";
      if (sResRef=="ringmail002") return "ringmail008";
      //Shadow Iron Chain Shirt
      if (sResRef=="aarcl013") return "aarcl024";
      if (sResRef=="nw_aarcl012") return "aarcl023";
      if (sResRef=="aarcl014") return "aarcl025";
      //Shadow Iron Breastplate
      if (sResRef=="aarcl011") return "aarcl060";
      if (sResRef=="nw_aarcl010") return "aarcl059";
      if (sResRef=="aarcl016") return "aarcl061";
      //Shadow Iron Chainmail
      if (sResRef=="aarcl005") return "aarcl096";
      if (sResRef=="nw_aarcl004") return "aarcl095";
      if (sResRef=="aarcl006") return "aarcl097";
      //Shadow Iron Scale Mail
      if (sResRef=="aarcl006") return "aarcl132";
      if (sResRef=="nw_aarcl003") return "aarcl131";
      if (sResRef=="aarcl007") return "aarcl133";
      //Shadow Iron Banded Mail
      if (sResRef=="aarcl014") return "aarcl168";
      if (sResRef=="nw_aarcl011") return "aarcl167";
      if (sResRef=="aarcl015") return "aarcl169";
      //Shadow Iron Splint Mail
      if (sResRef=="aarcl018") return "aarcl204";
      if (sResRef=="nw_aarcl005") return "aarcl203";
      if (sResRef=="aarcl019") return "aarcl205";
      //Shadow Iron Half Plate
      if (sResRef=="aarcl010") return "aarcl240";
      if (sResRef=="nw_aarcl006") return "aarcl239";
      if (sResRef=="aarcl017") return "aarcl241";
      //Shadow Iron Full Plate
      if (sResRef=="aarcl008") return "aarcl276";
      if (sResRef=="nw_aarcl007") return "aarcl275";
      if (sResRef=="aarcl009") return "aarcl277";
      //Shadow Iron Great Axe
      if (sResRef=="waxgr002") return "waxgr008";
      if (sResRef=="nw_waxgr001") return "waxgr007";
      if (sResRef=="waxgr003") return "waxgr009";
      //Shadow Iron Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe008";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe007";
      if (sResRef=="wdwraxe003") return "wdwraxe009";
      break;
     }
    case 3:
     {
      //Copper Dagger
      if (sResRef=="wswdg002") return "wswdg011";
      if (sResRef=="nw_wswdg001") return "wswdg010";
      if (sResRef=="wswdg003") return "wswdg012";
      //Copper ShortSword
      if (sResRef=="wswss002") return "wswss011";
      if (sResRef=="nw_wswss001") return "wswss010";
      if (sResRef=="wswss003") return "wswss012";
      //Copper Bullet
      if (sResRef=="wambu002") return "wambu011";
      if (sResRef=="nw_wambu001") return "wambu010";
      if (sResRef=="wambu003") return "wambu012";
      //Copper Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead013";
      if (sResRef=="arrowhead") return "arrowhead012";
      if (sResRef=="arrowhead002")  return "arrowhead014";
      //Copper Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead049";
      if (sResRef=="arrowhead003") return "arrowhead048";
      if (sResRef=="arrowhead005") return "arrowhead050";
      //Copper Metal Stud
      if (sResRef=="metalstud001") return "metalstud010";
      if (sResRef=="metalstud") return "metalstud009";
      if (sResRef=="metalstud002") return "metalstud011";
      //Copper Throwing Dart
      if (sResRef=="wthdt002") return "wthdt011";
      if (sResRef=="nw_wthdt001") return "wthdt010";
      if (sResRef=="wthdt003") return "wthdt012";
      //Copper Shuriken
      if (sResRef=="wthsh002") return "wthsh011";
      if (sResRef=="nw_wthsh001") return "wthsh010";
      if (sResRef=="wthsh003") return "wthsh012";
      //Copper Throwing Axe
      if (sResRef=="wthax002") return "wthax011";
      if (sResRef=="nw_wthax001") return "wthax010";
      if (sResRef=="wthax003") return "wthax012";
      //Copper Handaxe
      if (sResRef=="waxhn002") return "waxhn011";
      if (sResRef=="nw_waxhn001") return "waxhn010";
      if (sResRef=="waxhn003") return "waxhn012";
      //Copper Battleaxe
      if (sResRef=="waxbt002") return "waxbt011";
      if (sResRef=="nw_waxbt001") return "waxbt010";
      if (sResRef=="waxbt003") return "waxbt012";
      //Copper Light Flail
      if (sResRef=="wblfl002") return "wblfl011";
      if (sResRef=="nw_wblfl001") return "wblfl010";
      if (sResRef=="wblfl003") return "wblfl012";
      //Copper Heavy Flail
      if (sResRef=="wblfh002") return "wblfh011";
      if (sResRef=="nw_wblfh001") return "wblfh010";
      if (sResRef=="wblfh003") return "wblfh012";
      //Copper Light Hammer
      if (sResRef=="wblhl002") return "wblhl011";
      if (sResRef=="nw_wblhl001") return "wblhl010";
      if (sResRef=="wblhl003") return "wblhl012";
      //Copper Warhammer
      if (sResRef=="wblhw002") return "wblhw011";
      if (sResRef=="nw_wblhw001") return "wblhw010";
      if (sResRef=="wblhw003") return "wblhw012";
      //Copper Mace
      if (sResRef=="wblml002") return "wblml011";
      if (sResRef=="nw_wblml001") return "wblml010";
      if (sResRef=="wblml003") return "wblml012";
      //Copper Morningstar
      if (sResRef=="wblms002") return "wblms011";
      if (sResRef=="nw_wblms001") return "wblms010";
      if (sResRef=="wblms003") return "wblms012";
      //Copper Basterd Sword
      if (sResRef=="wswbs002") return "wswbs011";
      if (sResRef=="nw_wswbs001") return "wswbs010";
      if (sResRef=="wswbs003") return "wswbs012";
      //Copper Greatsword
      if (sResRef=="wswgs002") return "wswgs011";
      if (sResRef=="nw_wswgs001") return "wswgs010";
      if (sResRef=="wswgs003") return "wswgs012";
      //Copper Longsword
      if (sResRef=="wswls002") return "wswls011";
      if (sResRef=="nw_wswls001") return "wswls010";
      if (sResRef=="wswls003") return "wswls012";
      //Copper Katana
      if (sResRef=="wswka002") return "wswka011";
      if (sResRef=="nw_wswka001") return "wswka010";
      if (sResRef=="wswka003") return "wswka012";
      //Copper Rapier
      if (sResRef=="wswrp002") return "wswrp011";
      if (sResRef=="nw_wswrp001") return "wswrp010";
      if (sResRef=="wswrp003") return "wswrp012";
      //Copper Scimitar
      if (sResRef=="wswsc002") return "wswsc011";
      if (sResRef=="nw_wswsc001") return "wswsc010";
      if (sResRef=="wswsc003") return "wswsc012";
      //Copper Kama
      if (sResRef=="wspka002") return "wspka011";
      if (sResRef=="nw_wspka001") return "wspka010";
      if (sResRef=="wspka003") return "wspka012";
      //Copper Kukri
      if (sResRef=="wspku002") return "wspku011";
      if (sResRef=="nw_wspku001") return "wspku010";
      if (sResRef=="wspku003") return "wspku012";
      //Copper Sickle
      if (sResRef=="wspsc002") return "wspsc011";
      if (sResRef=="nw_wspsc001") return "wspsc010";
      if (sResRef=="wspsc003") return "wspsc012";
      //Copper Dire Mace
      if (sResRef=="wdbma002") return "wdbma011";
      if (sResRef=="nw_wdbma001") return "wdbma010";
      if (sResRef=="wdbma003") return "wdbma012";
      //Copper Double Axe
      if (sResRef=="wdbax002") return "wdbax011";
      if (sResRef=="nw_wdbax001") return "wdbax010";
      if (sResRef=="wdbax003") return "wdbax012";
      //Copper Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw011";
      if (sResRef=="nw_wdbsw001") return "wdbsw010";
      if (sResRef=="wdbsw003") return "wdbsw012";
      //Copper Halberd
      if (sResRef=="wplhb002") return "wplhb011";
      if (sResRef=="nw_wplhb001") return "wplhb010";
      if (sResRef=="wplhb003") return "wplhb012";
      //Copper Scythe
      if (sResRef=="wplsc002") return "wplsc011";
      if (sResRef=="nw_wplsc001") return "wplsc010";
      if (sResRef=="wplsc003") return "wplsc012";
      //Copper Spear
      if (sResRef=="wplss002") return "wplss011";
      if (sResRef=="nw_wplss001") return "wplss010";
      if (sResRef=="wplss003") return "wplss012";
      //Copper Small Shield
      if (sResRef=="ashsw002") return "ashsw011";
      if (sResRef=="nw_ashsw001") return "ashsw010";
      if (sResRef=="ashsw003") return "ashsw012";
      //Copper Large Shield
      if (sResRef=="ashlw002") return "ashlw011";
      if (sResRef=="nw_ashlw001") return "ashlw010";
      if (sResRef=="ashlw003") return "ashlw012";
      //Copper Tower Shield
      if (sResRef=="ashto002") return "ashto011";
      if (sResRef=="nw_ashto001") return "ashto010";
      if (sResRef=="ashto003") return "ashto012";
      //Copper Horsehair Helmet
      if (sResRef=="arhe005") return "arhe019";
      if (sResRef=="nw_arhe004") return "arhe018";
      if (sResRef=="arhe007") return "arhe020";
      //Copper Pot Helmet
      if (sResRef=="arhe002") return "arhe055";
      if (sResRef=="nw_arhe001") return "arhe054";
      if (sResRef=="arhe008") return "arhe056";
      //Copper Spike Helmet
      if (sResRef=="arhe003") return "arhe091";
      if (sResRef=="nw_arhe002") return "arhe090";
      if (sResRef=="arhe009") return "arhe092";
      //Copper Stag Helmet
      if (sResRef=="arhe006") return "arhe127";
      if (sResRef=="nw_arhe005") return "arhe126";
      if (sResRef=="arhe010") return "arhe128";
      //Copper Winged Helmet
      if (sResRef=="arhe004") return "arhe163";
      if (sResRef=="nw_arhe003") return "arhe162";
      if (sResRef=="arhe011") return "arhe164";
      //Copper Ringmail
      if (sResRef=="ringmail001") return "ringmail010";
      if (sResRef=="ringmail") return "ringmail009";
      if (sResRef=="ringmail002") return "ringmail011";
      //Copper Chain Shirt
      if (sResRef=="aarcl013") return "aarcl027";
      if (sResRef=="nw_aarcl012") return "aarcl026";
      if (sResRef=="aarcl014") return "aarcl028";
      //Copper Breastplate
      if (sResRef=="aarcl011") return "aarcl063";
      if (sResRef=="nw_aarcl010") return "aarcl062";
      if (sResRef=="aarcl016") return "aarcl064";
      //Copper Chainmail
      if (sResRef=="aarcl005") return "aarcl099";
      if (sResRef=="nw_aarcl004") return "aarcl098";
      if (sResRef=="aarcl006") return "aarcl100";
      //Copper Scale Mail
      if (sResRef=="aarcl006") return "aarcl135";
      if (sResRef=="nw_aarcl003") return "aarcl134";
      if (sResRef=="aarcl007") return "aarcl136";
      //Copper Banded Mail
      if (sResRef=="aarcl014") return "aarcl171";
      if (sResRef=="nw_aarcl011") return "aarcl170";
      if (sResRef=="aarcl015") return "aarcl172";
      //Copper Splint Mail
      if (sResRef=="aarcl018") return "aarcl207";
      if (sResRef=="nw_aarcl005") return "aarcl206";
      if (sResRef=="aarcl019") return "aarcl208";
      //Copper Half Plate
      if (sResRef=="aarcl010") return "aarcl243";
      if (sResRef=="nw_aarcl006") return "aarcl242";
      if (sResRef=="aarcl017") return "aarcl244";
      //Copper Full Plate
      if (sResRef=="aarcl008") return "aarcl279";
      if (sResRef=="nw_aarcl007") return "aarcl278";
      if (sResRef=="aarcl009") return "aarcl280";
      //Copper Great Axe
      if (sResRef=="waxgr002") return "waxgr011";
      if (sResRef=="nw_waxgr001") return "waxgr010";
      if (sResRef=="waxgr003") return "waxgr012";
      //Copper Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe011";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe010";
      if (sResRef=="wdwraxe003") return "wdwraxe012";
      break;
     }
    case 4:
     {
      //Bronze Dagger
      if (sResRef=="wswdg002") return "wswdg014";
      if (sResRef=="nw_wswdg001") return "wswdg013";
      if (sResRef=="wswdg003") return "wswdg015";
      //Bronze ShortSword
      if (sResRef=="wswss002") return "wswss014";
      if (sResRef=="nw_wswss001") return "wswss013";
      if (sResRef=="wswss003") return "wswss015";
      //Bronze Bullet
      if (sResRef=="wambu002") return "wambu014";
      if (sResRef=="nw_wambu001") return "wambu013";
      if (sResRef=="wambu003") return "wambu015";
      //Bronze Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead016";
      if (sResRef=="arrowhead") return "arrowhead015";
      if (sResRef=="arrowhead002")  return "arrowhead017";
      //Bronze Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead052";
      if (sResRef=="arrowhead003") return "arrowhead051";
      if (sResRef=="arrowhead005") return "arrowhead053";
      //Bronze Metal Stud
      if (sResRef=="metalstud001") return "metalstud013";
      if (sResRef=="metalstud") return "metalstud012";
      if (sResRef=="metalstud002") return "metalstud014";
      //Bronze Throwing Dart
      if (sResRef=="wthdt002") return "wthdt014";
      if (sResRef=="nw_wthdt001") return "wthdt013";
      if (sResRef=="wthdt003") return "wthdt015";
      //Bronze Shuriken
      if (sResRef=="wthsh002") return "wthsh014";
      if (sResRef=="nw_wthsh001") return "wthsh013";
      if (sResRef=="wthsh003") return "wthsh015";
      //Bronze Throwing Axe
      if (sResRef=="wthax002") return "wthax014";
      if (sResRef=="nw_wthax001") return "wthax013";
      if (sResRef=="wthax003") return "wthax015";
      //Bronze Handaxe
      if (sResRef=="waxhn002") return "waxhn014";
      if (sResRef=="nw_waxhn001") return "waxhn013";
      if (sResRef=="waxhn003") return "waxhn015";
      //Bronze Battleaxe
      if (sResRef=="waxbt002") return "waxbt014";
      if (sResRef=="nw_waxbt001") return "waxbt013";
      if (sResRef=="waxbt003") return "waxbt015";
      //Bronze Light Flail
      if (sResRef=="wblfl002") return "wblfl014";
      if (sResRef=="nw_wblfl001") return "wblfl013";
      if (sResRef=="wblfl003") return "wblfl015";
      //Bronze Heavy Flail
      if (sResRef=="wblfh002") return "wblfh014";
      if (sResRef=="nw_wblfh001") return "wblfh013";
      if (sResRef=="wblfh003") return "wblfh015";
      //Bronze Light Hammer
      if (sResRef=="wblhl002") return "wblhl014";
      if (sResRef=="nw_wblhl001") return "wblhl013";
      if (sResRef=="wblhl003") return "wblhl015";
      //Bronze Warhammer
      if (sResRef=="wblhw002") return "wblhw014";
      if (sResRef=="nw_wblhw001") return "wblhw013";
      if (sResRef=="wblhw003") return "wblhw015";
      //Bronze Mace
      if (sResRef=="wblml002") return "wblml014";
      if (sResRef=="nw_wblml001") return "wblml013";
      if (sResRef=="wblml003") return "wblml015";
      //Bronze Morningstar
      if (sResRef=="wblms002") return "wblms014";
      if (sResRef=="nw_wblms001") return "wblms013";
      if (sResRef=="wblms003") return "wblms015";
      //Bronze Basterd Sword
      if (sResRef=="wswbs002") return "wswbs014";
      if (sResRef=="nw_wswbs001") return "wswbs013";
      if (sResRef=="wswbs003") return "wswbs015";
      //Bronze Greatsword
      if (sResRef=="wswgs002") return "wswgs014";
      if (sResRef=="nw_wswgs001") return "wswgs013";
      if (sResRef=="wswgs003") return "wswgs015";
      //Bronze Longsword
      if (sResRef=="wswls002") return "wswls014";
      if (sResRef=="nw_wswls001") return "wswls013";
      if (sResRef=="wswls003") return "wswls015";
      //Bronze Katana
      if (sResRef=="wswka002") return "wswka014";
      if (sResRef=="nw_wswka001") return "wswka013";
      if (sResRef=="wswka003") return "wswka015";
      //Bronze Rapier
      if (sResRef=="wswrp002") return "wswrp014";
      if (sResRef=="nw_wswrp001") return "wswrp013";
      if (sResRef=="wswrp003") return "wswrp015";
      //Bronze Scimitar
      if (sResRef=="wswsc002") return "wswsc014";
      if (sResRef=="nw_wswsc001") return "wswsc013";
      if (sResRef=="wswsc003") return "wswsc015";
      //Bronze Kama
      if (sResRef=="wspka002") return "wspka014";
      if (sResRef=="nw_wspka001") return "wspka013";
      if (sResRef=="wspka003") return "wspka015";
      //Bronze Kukri
      if (sResRef=="wspku002") return "wspku014";
      if (sResRef=="nw_wspku001") return "wspku013";
      if (sResRef=="wspku003") return "wspku015";
      //Bronze Sickle
      if (sResRef=="wspsc002") return "wspsc014";
      if (sResRef=="nw_wspsc001") return "wspsc013";
      if (sResRef=="wspsc003") return "wspsc015";
      //Bronze Dire Mace
      if (sResRef=="wdbma002") return "wdbma014";
      if (sResRef=="nw_wdbma001") return "wdbma013";
      if (sResRef=="wdbma003") return "wdbma015";
      //Bronze Double Axe
      if (sResRef=="wdbax002") return "wdbax014";
      if (sResRef=="nw_wdbax001") return "wdbax013";
      if (sResRef=="wdbax003") return "wdbax015";
      //Bronze Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw014";
      if (sResRef=="nw_wdbsw001") return "wdbsw013";
      if (sResRef=="wdbsw003") return "wdbsw015";
      //Bronze Halberd
      if (sResRef=="wplhb002") return "wplhb014";
      if (sResRef=="nw_wplhb001") return "wplhb013";
      if (sResRef=="wplhb003") return "wplhb015";
      //Bronze Scythe
      if (sResRef=="wplsc002") return "wplsc014";
      if (sResRef=="nw_wplsc001") return "wplsc013";
      if (sResRef=="wplsc003") return "wplsc015";
      //Bronze Spear
      if (sResRef=="wplss002") return "wplss014";
      if (sResRef=="nw_wplss001") return "wplss013";
      if (sResRef=="wplss003") return "wplss015";
      //Bronze Small Shield
      if (sResRef=="ashsw002") return "ashsw014";
      if (sResRef=="nw_ashsw001") return "ashsw013";
      if (sResRef=="ashsw003") return "ashsw015";
      //Bronze Large Shield
      if (sResRef=="ashlw002") return "ashlw014";
      if (sResRef=="nw_ashlw001") return "ashlw013";
      if (sResRef=="ashlw003") return "ashlw015";
      //Bronze Tower Shield
      if (sResRef=="ashto002") return "ashto014";
      if (sResRef=="nw_ashto001") return "ashto013";
      if (sResRef=="ashto003") return "ashto015";
      //Bronze Horsehair Helmet
      if (sResRef=="arhe005") return "arhe022";
      if (sResRef=="nw_arhe004") return "arhe021";
      if (sResRef=="arhe007") return "arhe023";
      //Bronze Pot Helmet
      if (sResRef=="arhe002") return "arhe058";
      if (sResRef=="nw_arhe001") return "arhe057";
      if (sResRef=="arhe008") return "arhe059";
      //Bronze Spike Helmet
      if (sResRef=="arhe003") return "arhe094";
      if (sResRef=="nw_arhe002") return "arhe093";
      if (sResRef=="arhe009") return "arhe095";
      //Bronze Stag Helmet
      if (sResRef=="arhe006") return "arhe130";
      if (sResRef=="nw_arhe005") return "arhe129";
      if (sResRef=="arhe010") return "arhe131";
      //Bronze Winged Helmet
      if (sResRef=="arhe004") return "arhe166";
      if (sResRef=="nw_arhe003") return "arhe165";
      if (sResRef=="arhe011") return "arhe167";
      //Bronze Ringmail
      if (sResRef=="ringmail001") return "ringmail013";
      if (sResRef=="ringmail") return "ringmail012";
      if (sResRef=="ringmail002") return "ringmail014";
      //Bronze Chain Shirt
      if (sResRef=="aarcl013") return "aarcl030";
      if (sResRef=="nw_aarcl012") return "aarcl029";
      if (sResRef=="aarcl014") return "aarcl031";
      //Bronze Breastplate
      if (sResRef=="aarcl011") return "aarcl066";
      if (sResRef=="nw_aarcl010") return "aarcl065";
      if (sResRef=="aarcl016") return "aarcl067";
      //Bronze Chainmail
      if (sResRef=="aarcl005") return "aarcl102";
      if (sResRef=="nw_aarcl004") return "aarcl101";
      if (sResRef=="aarcl006") return "aarcl103";
      //Bronze Scale Mail
      if (sResRef=="aarcl006") return "aarcl138";
      if (sResRef=="nw_aarcl003") return "aarcl137";
      if (sResRef=="aarcl007") return "aarcl139";
      //Bronze Banded Mail
      if (sResRef=="aarcl014") return "aarcl174";
      if (sResRef=="nw_aarcl011") return "aarcl173";
      if (sResRef=="aarcl015") return "aarcl175";
      //Bronze Splint Mail
      if (sResRef=="aarcl018") return "aarcl210";
      if (sResRef=="nw_aarcl005") return "aarcl209";
      if (sResRef=="aarcl019") return "aarcl211";
      //Bronze Half Plate
      if (sResRef=="aarcl010") return "aarcl246";
      if (sResRef=="nw_aarcl006") return "aarcl245";
      if (sResRef=="aarcl017") return "aarcl247";
      //Bronze Full Plate
      if (sResRef=="aarcl008") return "aarcl282";
      if (sResRef=="nw_aarcl007") return "aarcl281";
      if (sResRef=="aarcl009") return "aarcl283";
      //Bronze Great Axe
      if (sResRef=="waxgr002") return "waxgr014";
      if (sResRef=="nw_waxgr001") return "waxgr013";
      if (sResRef=="waxgr003") return "waxgr015";
      //Bronze Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe014";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe013";
      if (sResRef=="wdwraxe003") return "wdwraxe015";
      break;
     }
    case 5:
     {
      //Gold Dagger
      if (sResRef=="wswdg002") return "wswdg017";
      if (sResRef=="nw_wswdg001") return "wswdg016";
      if (sResRef=="wswdg003") return "wswdg018";
      //Gold ShortSword
      if (sResRef=="wswss002") return "wswss017";
      if (sResRef=="nw_wswss001") return "wswss016";
      if (sResRef=="wswss003") return "wswss018";
      //Gold Bullet
      if (sResRef=="wambu002") return "wambu017";
      if (sResRef=="nw_wambu001") return "wambu016";
      if (sResRef=="wambu003") return "wambu018";
      //Gold Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead019";
      if (sResRef=="arrowhead") return "arrowhead018";
      if (sResRef=="arrowhead002")  return "arrowhead020";
      //Gold Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead055";
      if (sResRef=="arrowhead003") return "arrowhead054";
      if (sResRef=="arrowhead005") return "arrowhead056";
      //Gold Metal Stud
      if (sResRef=="metalstud001") return "metalstud016";
      if (sResRef=="metalstud") return "metalstud015";
      if (sResRef=="metalstud002") return "metalstud017";
      //Gold Throwing Dart
      if (sResRef=="wthdt002") return "wthdt017";
      if (sResRef=="nw_wthdt001") return "wthdt016";
      if (sResRef=="wthdt003") return "wthdt018";
      //Gold Shuriken
      if (sResRef=="wthsh002") return "wthsh017";
      if (sResRef=="nw_wthsh001") return "wthsh016";
      if (sResRef=="wthsh003") return "wthsh018";
      //Gold Throwing Axe
      if (sResRef=="wthax002") return "wthax017";
      if (sResRef=="nw_wthax001") return "wthax016";
      if (sResRef=="wthax003") return "wthax018";
      //Gold Handaxe
      if (sResRef=="waxhn002") return "waxhn017";
      if (sResRef=="nw_waxhn001") return "waxhn016";
      if (sResRef=="waxhn003") return "waxhn018";
      //Gold Battleaxe
      if (sResRef=="waxbt002") return "waxbt017";
      if (sResRef=="nw_waxbt001") return "waxbt016";
      if (sResRef=="waxbt003") return "waxbt018";
      //Gold Light Flail
      if (sResRef=="wblfl002") return "wblfl017";
      if (sResRef=="nw_wblfl001") return "wblfl016";
      if (sResRef=="wblfl003") return "wblfl018";
      //Gold Heavy Flail
      if (sResRef=="wblfh002") return "wblfh017";
      if (sResRef=="nw_wblfh001") return "wblfh016";
      if (sResRef=="wblfh003") return "wblfh018";
      //Gold Light Hammer
      if (sResRef=="wblhl002") return "wblhl017";
      if (sResRef=="nw_wblhl001") return "wblhl016";
      if (sResRef=="wblhl003") return "wblhl018";
      //Gold Warhammer
      if (sResRef=="wblhw002") return "wblhw017";
      if (sResRef=="nw_wblhw001") return "wblhw016";
      if (sResRef=="wblhw003") return "wblhw018";
      //Gold Mace
      if (sResRef=="wblml002") return "wblml017";
      if (sResRef=="nw_wblml001") return "wblml016";
      if (sResRef=="wblml003") return "wblml018";
      //Gold Morningstar
      if (sResRef=="wblms002") return "wblms017";
      if (sResRef=="nw_wblms001") return "wblms016";
      if (sResRef=="wblms003") return "wblms018";
      //Gold Basterd Sword
      if (sResRef=="wswbs002") return "wswbs017";
      if (sResRef=="nw_wswbs001") return "wswbs016";
      if (sResRef=="wswbs003") return "wswbs018";
      //Gold Greatsword
      if (sResRef=="wswgs002") return "wswgs017";
      if (sResRef=="nw_wswgs001") return "wswgs016";
      if (sResRef=="wswgs003") return "wswgs018";
      //Gold Longsword
      if (sResRef=="wswls002") return "wswls017";
      if (sResRef=="nw_wswls001") return "wswls016";
      if (sResRef=="wswls003") return "wswls018";
      //Gold Katana
      if (sResRef=="wswka002") return "wswka017";
      if (sResRef=="nw_wswka001") return "wswka016";
      if (sResRef=="wswka003") return "wswka018";
      //Gold Rapier
      if (sResRef=="wswrp002") return "wswrp017";
      if (sResRef=="nw_wswrp001") return "wswrp016";
      if (sResRef=="wswrp003") return "wswrp018";
      //Gold Scimitar
      if (sResRef=="wswsc002") return "wswsc017";
      if (sResRef=="nw_wswsc001") return "wswsc016";
      if (sResRef=="wswsc003") return "wswsc018";
      //Gold Kama
      if (sResRef=="wspka002") return "wspka017";
      if (sResRef=="nw_wspka001") return "wspka016";
      if (sResRef=="wspka003") return "wspka018";
      //Gold Kukri
      if (sResRef=="wspku002") return "wspku017";
      if (sResRef=="nw_wspku001") return "wspku016";
      if (sResRef=="wspku003") return "wspku018";
      //Gold Sickle
      if (sResRef=="wspsc002") return "wspsc017";
      if (sResRef=="nw_wspsc001") return "wspsc016";
      if (sResRef=="wspsc003") return "wspsc018";
      //Gold Dire Mace
      if (sResRef=="wdbma002") return "wdbma017";
      if (sResRef=="nw_wdbma001") return "wdbma016";
      if (sResRef=="wdbma003") return "wdbma018";
      //Gold Double Axe
      if (sResRef=="wdbax002") return "wdbax017";
      if (sResRef=="nw_wdbax001") return "wdbax016";
      if (sResRef=="wdbax003") return "wdbax018";
      //Gold Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw017";
      if (sResRef=="nw_wdbsw001") return "wdbsw016";
      if (sResRef=="wdbsw003") return "wdbsw018";
      //Gold Halberd
      if (sResRef=="wplhb002") return "wplhb017";
      if (sResRef=="nw_wplhb001") return "wplhb016";
      if (sResRef=="wplhb003") return "wplhb018";
      //Gold Scythe
      if (sResRef=="wplsc002") return "wplsc017";
      if (sResRef=="nw_wplsc001") return "wplsc016";
      if (sResRef=="wplsc003") return "wplsc018";
      //Gold Spear
      if (sResRef=="wplss002") return "wplss017";
      if (sResRef=="nw_wplss001") return "wplss016";
      if (sResRef=="wplss003") return "wplss018";
      //Gold Small Shield
      if (sResRef=="ashsw002") return "ashsw017";
      if (sResRef=="nw_ashsw001") return "ashsw016";
      if (sResRef=="ashsw003") return "ashsw018";
      //Gold Large Shield
      if (sResRef=="ashlw002") return "ashlw017";
      if (sResRef=="nw_ashlw001") return "ashlw016";
      if (sResRef=="ashlw003") return "ashlw018";
      //Gold Tower Shield
      if (sResRef=="ashto002") return "ashto017";
      if (sResRef=="nw_ashto001") return "ashto016";
      if (sResRef=="ashto003") return "ashto018";
      //Gold Horsehair Helmet
      if (sResRef=="arhe005") return "arhe025";
      if (sResRef=="nw_arhe004") return "arhe024";
      if (sResRef=="arhe007") return "arhe026";
      //Gold Pot Helmet
      if (sResRef=="arhe002") return "arhe061";
      if (sResRef=="nw_arhe001") return "arhe060";
      if (sResRef=="arhe008") return "arhe062";
      //Gold Spike Helmet
      if (sResRef=="arhe003") return "arhe097";
      if (sResRef=="nw_arhe002") return "arhe096";
      if (sResRef=="arhe009") return "arhe098";
      //Gold Stag Helmet
      if (sResRef=="arhe006") return "arhe133";
      if (sResRef=="nw_arhe005") return "arhe132";
      if (sResRef=="arhe010") return "arhe134";
      //Gold Winged Helmet
      if (sResRef=="arhe004") return "arhe169";
      if (sResRef=="nw_arhe003") return "arhe168";
      if (sResRef=="arhe011") return "arhe170";
      //Gold Ringmail
      if (sResRef=="ringmail001") return "ringmail016";
      if (sResRef=="ringmail") return "ringmail015";
      if (sResRef=="ringmail002") return "ringmail017";
      //Gold Chain Shirt
      if (sResRef=="aarcl013") return "aarcl033";
      if (sResRef=="nw_aarcl012") return "aarcl032";
      if (sResRef=="aarcl014") return "aarcl034";
      //Gold Breastplate
      if (sResRef=="aarcl011") return "aarcl069";
      if (sResRef=="nw_aarcl010") return "aarcl068";
      if (sResRef=="aarcl016") return "aarcl070";
      //Gold Chainmail
      if (sResRef=="aarcl005") return "aarcl105";
      if (sResRef=="nw_aarcl004") return "aarcl104";
      if (sResRef=="aarcl006") return "aarcl106";
      //Gold Scale Mail
      if (sResRef=="aarcl006") return "aarcl141";
      if (sResRef=="nw_aarcl003") return "aarcl140";
      if (sResRef=="aarcl007") return "aarcl142";
      //Gold Banded Mail
      if (sResRef=="aarcl014") return "aarcl177";
      if (sResRef=="nw_aarcl011") return "aarcl176";
      if (sResRef=="aarcl015") return "aarcl178";
      //Gold Splint Mail
      if (sResRef=="aarcl018") return "aarcl213";
      if (sResRef=="nw_aarcl005") return "aarcl212";
      if (sResRef=="aarcl019") return "aarcl214";
      //Gold Half Plate
      if (sResRef=="aarcl010") return "aarcl249";
      if (sResRef=="nw_aarcl006") return "aarcl248";
      if (sResRef=="aarcl017") return "aarcl250";
      //Gold Full Plate
      if (sResRef=="aarcl008") return "aarcl285";
      if (sResRef=="nw_aarcl007") return "aarcl284";
      if (sResRef=="aarcl009") return "aarcl286";
      //Gold Great Axe
      if (sResRef=="waxgr002") return "waxgr017";
      if (sResRef=="nw_waxgr001") return "waxgr016";
      if (sResRef=="waxgr003") return "waxgr018";
      //Gold Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe017";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe016";
      if (sResRef=="wdwraxe003") return "wdwraxe018";
      break;
     }
    case 6:
     {
      //Agapite Dagger
      if (sResRef=="wswdg002") return "wswdg020";
      if (sResRef=="nw_wswdg001") return "wswdg019";
      if (sResRef=="wswdg003") return "wswdg021";
      //Agapite ShortSword
      if (sResRef=="wswss002") return "wswss020";
      if (sResRef=="nw_wswss001") return "wswss019";
      if (sResRef=="wswss003") return "wswss021";
      //Agapite Bullet
      if (sResRef=="wambu002") return "wambu020";
      if (sResRef=="nw_wambu001") return "wambu019";
      if (sResRef=="wambu003") return "wambu021";
      //Agapite Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead022";
      if (sResRef=="arrowhead") return "arrowhead021";
      if (sResRef=="arrowhead002")  return "arrowhead023";
      //Agapite Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead058";
      if (sResRef=="arrowhead003") return "arrowhead057";
      if (sResRef=="arrowhead005") return "arrowhead059";
      //Agapite Metal Stud
      if (sResRef=="metalstud001") return "metalstud037";
      if (sResRef=="metalstud") return "metalstud018";
      if (sResRef=="metalstud002") return "metalstud038";
      //Agapite Throwing Dart
      if (sResRef=="wthdt002") return "wthdt020";
      if (sResRef=="nw_wthdt001") return "wthdt019";
      if (sResRef=="wthdt003") return "wthdt021";
      //Agapite Shuriken
      if (sResRef=="wthsh002") return "wthsh020";
      if (sResRef=="nw_wthsh001") return "wthsh019";
      if (sResRef=="wthsh003") return "wthsh021";
      //Agapite Throwing Axe
      if (sResRef=="wthax002") return "wthax020";
      if (sResRef=="nw_wthax001") return "wthax019";
      if (sResRef=="wthax003") return "wthax021";
      //Agapite Handaxe
      if (sResRef=="waxhn002") return "waxhn020";
      if (sResRef=="nw_waxhn001") return "waxhn019";
      if (sResRef=="waxhn003") return "waxhn021";
      //Agapite Battleaxe
      if (sResRef=="waxbt002") return "waxbt020";
      if (sResRef=="nw_waxbt001") return "waxbt019";
      if (sResRef=="waxbt003") return "waxbt021";
      //Agapite Light Flail
      if (sResRef=="wblfl002") return "wblfl020";
      if (sResRef=="nw_wblfl001") return "wblfl019";
      if (sResRef=="wblfl003") return "wblfl021";
      //Agapite Heavy Flail
      if (sResRef=="wblfh002") return "wblfh020";
      if (sResRef=="nw_wblfh001") return "wblfh019";
      if (sResRef=="wblfh003") return "wblfh021";
      //Agapite Light Hammer
      if (sResRef=="wblhl002") return "wblhl020";
      if (sResRef=="nw_wblhl001") return "wblhl019";
      if (sResRef=="wblhl003") return "wblhl021";
      //Agapite Warhammer
      if (sResRef=="wblhw002") return "wblhw020";
      if (sResRef=="nw_wblhw001") return "wblhw019";
      if (sResRef=="wblhw003") return "wblhw021";
      //Agapite Mace
      if (sResRef=="wblml002") return "wblml020";
      if (sResRef=="nw_wblml001") return "wblml019";
      if (sResRef=="wblml003") return "wblml021";
      //Agapite Morningstar
      if (sResRef=="wblms002") return "wblms020";
      if (sResRef=="nw_wblms001") return "wblms019";
      if (sResRef=="wblms003") return "wblms021";
      //Agapite Basterd Sword
      if (sResRef=="wswbs002") return "wswbs020";
      if (sResRef=="nw_wswbs001") return "wswbs019";
      if (sResRef=="wswbs003") return "wswbs021";
      //Agapite Greatsword
      if (sResRef=="wswgs002") return "wswgs020";
      if (sResRef=="nw_wswgs001") return "wswgs019";
      if (sResRef=="wswgs003") return "wswgs021";
      //Agapite Longsword
      if (sResRef=="wswls002") return "wswls020";
      if (sResRef=="nw_wswls001") return "wswls019";
      if (sResRef=="wswls003") return "wswls021";
      //Agapite Katana
      if (sResRef=="wswka002") return "wswka020";
      if (sResRef=="nw_wswka001") return "wswka019";
      if (sResRef=="wswka003") return "wswka021";
      //Agapite Rapier
      if (sResRef=="wswrp002") return "wswrp020";
      if (sResRef=="nw_wswrp001") return "wswrp019";
      if (sResRef=="wswrp003") return "wswrp021";
      //Agapite Scimitar
      if (sResRef=="wswsc002") return "wswsc020";
      if (sResRef=="nw_wswsc001") return "wswsc019";
      if (sResRef=="wswsc003") return "wswsc021";
      //Agapite Kama
      if (sResRef=="wspka002") return "wspka020";
      if (sResRef=="nw_wspka001") return "wspka019";
      if (sResRef=="wspka003") return "wspka021";
      //Agapite Kukri
      if (sResRef=="wspku002") return "wspku020";
      if (sResRef=="nw_wspku001") return "wspku019";
      if (sResRef=="wspku003") return "wspku021";
      //Agapite Sickle
      if (sResRef=="wspsc002") return "wspsc020";
      if (sResRef=="nw_wspsc001") return "wspsc019";
      if (sResRef=="wspsc003") return "wspsc021";
      //Agapite Dire Mace
      if (sResRef=="wdbma002") return "wdbma020";
      if (sResRef=="nw_wdbma001") return "wdbma019";
      if (sResRef=="wdbma003") return "wdbma021";
      //Agapite Double Axe
      if (sResRef=="wdbax002") return "wdbax020";
      if (sResRef=="nw_wdbax001") return "wdbax019";
      if (sResRef=="wdbax003") return "wdbax021";
      //Agapite Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw020";
      if (sResRef=="nw_wdbsw001") return "wdbsw019";
      if (sResRef=="wdbsw003") return "wdbsw021";
      //Agapite Halberd
      if (sResRef=="wplhb002") return "wplhb020";
      if (sResRef=="nw_wplhb001") return "wplhb019";
      if (sResRef=="wplhb003") return "wplhb021";
      //Agapite Scythe
      if (sResRef=="wplsc002") return "wplsc020";
      if (sResRef=="nw_wplsc001") return "wplsc019";
      if (sResRef=="wplsc003") return "wplsc021";
      //Agapite Spear
      if (sResRef=="wplss002") return "wplss020";
      if (sResRef=="nw_wplss001") return "wplss019";
      if (sResRef=="wplss003") return "wplss021";
      //Agapite Small Shield
      if (sResRef=="ashsw002") return "ashsw020";
      if (sResRef=="nw_ashsw001") return "ashsw019";
      if (sResRef=="ashsw003") return "ashsw021";
      //Agapite Large Shield
      if (sResRef=="ashlw002") return "ashlw020";
      if (sResRef=="nw_ashlw001") return "ashlw019";
      if (sResRef=="ashlw003") return "ashlw021";
      //Agapite Tower Shield
      if (sResRef=="ashto002") return "ashto020";
      if (sResRef=="nw_ashto001") return "ashto019";
      if (sResRef=="ashto003") return "ashto021";
      //Agapite Horsehair Helmet
      if (sResRef=="arhe005") return "arhe028";
      if (sResRef=="nw_arhe004") return "arhe027";
      if (sResRef=="arhe007") return "arhe029";
      //Agapite Pot Helmet
      if (sResRef=="arhe002") return "arhe064";
      if (sResRef=="nw_arhe001") return "arhe063";
      if (sResRef=="arhe008") return "arhe065";
      //Agapite Spike Helmet
      if (sResRef=="arhe003") return "arhe100";
      if (sResRef=="nw_arhe002") return "arhe099";
      if (sResRef=="arhe009") return "arhe101";
      //Agapite Stag Helmet
      if (sResRef=="arhe006") return "arhe136";
      if (sResRef=="nw_arhe005") return "arhe135";
      if (sResRef=="arhe010") return "arhe137";
      //Agapite Winged Helmet
      if (sResRef=="arhe004") return "arhe172";
      if (sResRef=="nw_arhe003") return "arhe171";
      if (sResRef=="arhe011") return "arhe173";
      //Agapite Ringmail
      if (sResRef=="ringmail001") return "ringmail019";
      if (sResRef=="ringmail") return "ringmail018";
      if (sResRef=="ringmail002") return "ringmail020";
      //Agapite Chain Shirt
      if (sResRef=="aarcl013") return "aarcl036";
      if (sResRef=="nw_aarcl012") return "aarcl035";
      if (sResRef=="aarcl014") return "aarcl037";
      //Agapite Breastplate
      if (sResRef=="aarcl011") return "aarcl072";
      if (sResRef=="nw_aarcl010") return "aarcl071";
      if (sResRef=="aarcl016") return "aarcl073";
      //Agapite Chainmail
      if (sResRef=="aarcl005") return "aarcl108";
      if (sResRef=="nw_aarcl004") return "aarcl107";
      if (sResRef=="aarcl006") return "aarcl109";
      //Agapite Scale Mail
      if (sResRef=="aarcl006") return "aarcl144";
      if (sResRef=="nw_aarcl003") return "aarcl143";
      if (sResRef=="aarcl007") return "aarcl145";
      //Agapite Banded Mail
      if (sResRef=="aarcl014") return "aarcl180";
      if (sResRef=="nw_aarcl011") return "aarcl179";
      if (sResRef=="aarcl015") return "aarcl181";
      //Agapite Splint Mail
      if (sResRef=="aarcl018") return "aarcl216";
      if (sResRef=="nw_aarcl005") return "aarcl215";
      if (sResRef=="aarcl019") return "aarcl217";
      //Agapite Half Plate
      if (sResRef=="aarcl010") return "aarcl252";
      if (sResRef=="nw_aarcl006") return "aarcl251";
      if (sResRef=="aarcl017") return "aarcl253";
      //Agapite Full Plate
      if (sResRef=="aarcl008") return "aarcl288";
      if (sResRef=="nw_aarcl007") return "aarcl287";
      if (sResRef=="aarcl009") return "aarcl289";
      //Agapite Great Axe
      if (sResRef=="waxgr002") return "waxgr020";
      if (sResRef=="nw_waxgr001") return "waxgr019";
      if (sResRef=="waxgr003") return "waxgr021";
      //Agapite Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe020";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe019";
      if (sResRef=="wdwraxe003") return "wdwraxe021";
      break;
     }
    case 7:
     {
      //Verite Dagger
      if (sResRef=="wswdg002") return "wswdg023";
      if (sResRef=="nw_wswdg001") return "wswdg022";
      if (sResRef=="wswdg003") return "wswdg024";
      //Verite ShortSword
      if (sResRef=="wswss002") return "wswss023";
      if (sResRef=="nw_wswss001") return "wswss022";
      if (sResRef=="wswss003") return "wswss024";
      //Verite Bullet
      if (sResRef=="wambu002") return "wambu023";
      if (sResRef=="nw_wambu001") return "wambu022";
      if (sResRef=="wambu003") return "wambu024";
      //Verite Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead025";
      if (sResRef=="arrowhead") return "arrowhead024";
      if (sResRef=="arrowhead002")  return "arrowhead026";
      //Verite Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead061";
      if (sResRef=="arrowhead003") return "arrowhead060";
      if (sResRef=="arrowhead005") return "arrowhead062";
      //Verite Metal Stud
      if (sResRef=="metalstud001") return "metalstud020";
      if (sResRef=="metalstud") return "metalstud019";
      if (sResRef=="metalstud002") return "metalstud021";
      //Verite Throwing Dart
      if (sResRef=="wthdt002") return "wthdt023";
      if (sResRef=="nw_wthdt001") return "wthdt022";
      if (sResRef=="wthdt003") return "wthdt024";
      //Verite Shuriken
      if (sResRef=="wthsh002") return "wthsh023";
      if (sResRef=="nw_wthsh001") return "wthsh022";
      if (sResRef=="wthsh003") return "wthsh024";
      //Verite Throwing Axe
      if (sResRef=="wthax002") return "wthax023";
      if (sResRef=="nw_wthax001") return "wthax022";
      if (sResRef=="wthax003") return "wthax024";
      //Verite Handaxe
      if (sResRef=="waxhn002") return "waxhn023";
      if (sResRef=="nw_waxhn001") return "waxhn022";
      if (sResRef=="waxhn003") return "waxhn024";
      //Verite Battleaxe
      if (sResRef=="waxbt002") return "waxbt023";
      if (sResRef=="nw_waxbt001") return "waxbt022";
      if (sResRef=="waxbt003") return "waxbt024";
      //Verite Light Flail
      if (sResRef=="wblfl002") return "wblfl023";
      if (sResRef=="nw_wblfl001") return "wblfl022";
      if (sResRef=="wblfl003") return "wblfl024";
      //Verite Heavy Flail
      if (sResRef=="wblfh002") return "wblfh023";
      if (sResRef=="nw_wblfh001") return "wblfh022";
      if (sResRef=="wblfh003") return "wblfh024";
      //Verite Light Hammer
      if (sResRef=="wblhl002") return "wblhl023";
      if (sResRef=="nw_wblhl001") return "wblhl022";
      if (sResRef=="wblhl003") return "wblhl024";
      //Verite Warhammer
      if (sResRef=="wblhw002") return "wblhw023";
      if (sResRef=="nw_wblhw001") return "wblhw022";
      if (sResRef=="wblhw003") return "wblhw024";
      //Verite Mace
      if (sResRef=="wblml002") return "wblml023";
      if (sResRef=="nw_wblml001") return "wblml022";
      if (sResRef=="wblml003") return "wblml024";
      //Verite Morningstar
      if (sResRef=="wblms002") return "wblms023";
      if (sResRef=="nw_wblms001") return "wblms022";
      if (sResRef=="wblms003") return "wblms024";
      //Verite Basterd Sword
      if (sResRef=="wswbs002") return "wswbs023";
      if (sResRef=="nw_wswbs001") return "wswbs022";
      if (sResRef=="wswbs003") return "wswbs024";
      //Verite Greatsword
      if (sResRef=="wswgs002") return "wswgs023";
      if (sResRef=="nw_wswgs001") return "wswgs022";
      if (sResRef=="wswgs003") return "wswgs024";
      //Verite Longsword
      if (sResRef=="wswls002") return "wswls023";
      if (sResRef=="nw_wswls001") return "wswls022";
      if (sResRef=="wswls003") return "wswls024";
      //Verite Katana
      if (sResRef=="wswka002") return "wswka023";
      if (sResRef=="nw_wswka001") return "wswka022";
      if (sResRef=="wswka003") return "wswka024";
      //Verite Rapier
      if (sResRef=="wswrp002") return "wswrp023";
      if (sResRef=="nw_wswrp001") return "wswrp022";
      if (sResRef=="wswrp003") return "wswrp024";
      //Verite Scimitar
      if (sResRef=="wswsc002") return "wswsc023";
      if (sResRef=="nw_wswsc001") return "wswsc022";
      if (sResRef=="wswsc003") return "wswsc024";
      //Verite Kama
      if (sResRef=="wspka002") return "wspka023";
      if (sResRef=="nw_wspka001") return "wspka022";
      if (sResRef=="wspka003") return "wspka024";
      //Verite Kukri
      if (sResRef=="wspku002") return "wspku023";
      if (sResRef=="nw_wspku001") return "wspku022";
      if (sResRef=="wspku003") return "wspku024";
      //Verite Sickle
      if (sResRef=="wspsc002") return "wspsc023";
      if (sResRef=="nw_wspsc001") return "wspsc022";
      if (sResRef=="wspsc003") return "wspsc024";
      //Verite Dire Mace
      if (sResRef=="wdbma002") return "wdbma023";
      if (sResRef=="nw_wdbma001") return "wdbma022";
      if (sResRef=="wdbma003") return "wdbma024";
      //Verite Double Axe
      if (sResRef=="wdbax002") return "wdbax023";
      if (sResRef=="nw_wdbax001") return "wdbax022";
      if (sResRef=="wdbax003") return "wdbax024";
      //Verite Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw023";
      if (sResRef=="nw_wdbsw001") return "wdbsw022";
      if (sResRef=="wdbsw003") return "wdbsw024";
      //Verite Halberd
      if (sResRef=="wplhb002") return "wplhb023";
      if (sResRef=="nw_wplhb001") return "wplhb022";
      if (sResRef=="wplhb003") return "wplhb024";
      //Verite Scythe
      if (sResRef=="wplsc002") return "wplsc023";
      if (sResRef=="nw_wplsc001") return "wplsc022";
      if (sResRef=="wplsc003") return "wplsc024";
      //Verite Spear
      if (sResRef=="wplss002") return "wplss023";
      if (sResRef=="nw_wplss001") return "wplss022";
      if (sResRef=="wplss003") return "wplss024";
      //Verite Small Shield
      if (sResRef=="ashsw002") return "ashsw023";
      if (sResRef=="nw_ashsw001") return "ashsw022";
      if (sResRef=="ashsw003") return "ashsw024";
      //Verite Large Shield
      if (sResRef=="ashlw002") return "ashlw023";
      if (sResRef=="nw_ashlw001") return "ashlw022";
      if (sResRef=="ashlw003") return "ashlw024";
      //Verite Tower Shield
      if (sResRef=="ashto002") return "ashto023";
      if (sResRef=="nw_ashto001") return "ashto022";
      if (sResRef=="ashto003") return "ashto024";
      //Verite Horsehair Helmet
      if (sResRef=="arhe005") return "arhe031";
      if (sResRef=="nw_arhe004") return "arhe030";
      if (sResRef=="arhe007") return "arhe032";
      //Verite Pot Helmet
      if (sResRef=="arhe002") return "arhe067";
      if (sResRef=="nw_arhe001") return "arhe066";
      if (sResRef=="arhe008") return "arhe068";
      //Verite Spike Helmet
      if (sResRef=="arhe003") return "arhe103";
      if (sResRef=="nw_arhe002") return "arhe102";
      if (sResRef=="arhe009") return "arhe104";
      //Verite Stag Helmet
      if (sResRef=="arhe006") return "arhe139";
      if (sResRef=="nw_arhe005") return "arhe138";
      if (sResRef=="arhe010") return "arhe140";
      //Verite Winged Helmet
      if (sResRef=="arhe004") return "arhe175";
      if (sResRef=="nw_arhe003") return "arhe174";
      if (sResRef=="arhe011") return "arhe176";
      //Verite Ringmail
      if (sResRef=="ringmail001") return "ringmail022";
      if (sResRef=="ringmail") return "ringmail021";
      if (sResRef=="ringmail002") return "ringmail023";
      //Verite Chain Shirt
      if (sResRef=="aarcl013") return "aarcl039";
      if (sResRef=="nw_aarcl012") return "aarcl038";
      if (sResRef=="aarcl014") return "aarcl040";
      //Verite Breastplate
      if (sResRef=="aarcl011") return "aarcl075";
      if (sResRef=="nw_aarcl010") return "aarcl074";
      if (sResRef=="aarcl016") return "aarcl076";
      //Verite Chainmail
      if (sResRef=="aarcl005") return "aarcl111";
      if (sResRef=="nw_aarcl004") return "aarcl110";
      if (sResRef=="aarcl006") return "aarcl112";
      //Verite Scale Mail
      if (sResRef=="aarcl006") return "aarcl147";
      if (sResRef=="nw_aarcl003") return "aarcl146";
      if (sResRef=="aarcl007") return "aarcl148";
      //Verite Banded Mail
      if (sResRef=="aarcl014") return "aarcl183";
      if (sResRef=="nw_aarcl011") return "aarcl182";
      if (sResRef=="aarcl015") return "aarcl184";
      //Verite Splint Mail
      if (sResRef=="aarcl018") return "aarcl219";
      if (sResRef=="nw_aarcl005") return "aarcl218";
      if (sResRef=="aarcl019") return "aarcl220";
      //Verite Half Plate
      if (sResRef=="aarcl010") return "aarcl255";
      if (sResRef=="nw_aarcl006") return "aarcl254";
      if (sResRef=="aarcl017") return "aarcl256";
      //Verite Full Plate
      if (sResRef=="aarcl008") return "aarcl291";
      if (sResRef=="nw_aarcl007") return "aarcl290";
      if (sResRef=="aarcl009") return "aarcl292";
      //Verite Great Axe
      if (sResRef=="waxgr002") return "waxgr023";
      if (sResRef=="nw_waxgr001") return "waxgr022";
      if (sResRef=="waxgr003") return "waxgr024";
      //Verite Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe023";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe022";
      if (sResRef=="wdwraxe003") return "wdwraxe024";
      break;
     }
    case 8:
     {
      //Valorite Dagger
      if (sResRef=="wswdg002") return "wswdg026";
      if (sResRef=="nw_wswdg001") return "wswdg025";
      if (sResRef=="wswdg003") return "wswdg027";
      //Valorite ShortSword
      if (sResRef=="wswss002") return "wswss026";
      if (sResRef=="nw_wswss001") return "wswss025";
      if (sResRef=="wswss003") return "wswss027";
      //Valorite Bullet
      if (sResRef=="wambu002") return "wambu026";
      if (sResRef=="nw_wambu001") return "wambu025";
      if (sResRef=="wambu003") return "wambu027";
      //Valorite Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead028";
      if (sResRef=="arrowhead") return "arrowhead027";
      if (sResRef=="arrowhead002")  return "arrowhead029";
      //Valorite Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead064";
      if (sResRef=="arrowhead003") return "arrowhead063";
      if (sResRef=="arrowhead005") return "arrowhead065";
      //Valorite Metal Stud
      if (sResRef=="metalstud001") return "metalstud023";
      if (sResRef=="metalstud") return "metalstud022";
      if (sResRef=="metalstud002") return "metalstud024";
      //Valorite Throwing Dart
      if (sResRef=="wthdt002") return "wthdt026";
      if (sResRef=="nw_wthdt001") return "wthdt025";
      if (sResRef=="wthdt003") return "wthdt027";
      //Valorite Shuriken
      if (sResRef=="wthsh002") return "wthsh026";
      if (sResRef=="nw_wthsh001") return "wthsh025";
      if (sResRef=="wthsh003") return "wthsh027";
      //Valorite Throwing Axe
      if (sResRef=="wthax002") return "wthax026";
      if (sResRef=="nw_wthax001") return "wthax025";
      if (sResRef=="wthax003") return "wthax027";
      //Valorite Handaxe
      if (sResRef=="waxhn002") return "waxhn026";
      if (sResRef=="nw_waxhn001") return "waxhn025";
      if (sResRef=="waxhn003") return "waxhn027";
      //Valorite Battleaxe
      if (sResRef=="waxbt002") return "waxbt026";
      if (sResRef=="nw_waxbt001") return "waxbt025";
      if (sResRef=="waxbt003") return "waxbt027";
      //Valorite Light Flail
      if (sResRef=="wblfl002") return "wblfl026";
      if (sResRef=="nw_wblfl001") return "wblfl025";
      if (sResRef=="wblfl003") return "wblfl027";
      //Valorite Heavy Flail
      if (sResRef=="wblfh002") return "wblfh026";
      if (sResRef=="nw_wblfh001") return "wblfh025";
      if (sResRef=="wblfh003") return "wblfh027";
      //Valorite Light Hammer
      if (sResRef=="wblhl002") return "wblhl026";
      if (sResRef=="nw_wblhl001") return "wblhl025";
      if (sResRef=="wblhl003") return "wblhl027";
      //Valorite Warhammer
      if (sResRef=="wblhw002") return "wblhw026";
      if (sResRef=="nw_wblhw001") return "wblhw025";
      if (sResRef=="wblhw003") return "wblhw027";
      //Valorite Mace
      if (sResRef=="wblml002") return "wblml026";
      if (sResRef=="nw_wblml001") return "wblml025";
      if (sResRef=="wblml003") return "wblml027";
      //Valorite Morningstar
      if (sResRef=="wblms002") return "wblms026";
      if (sResRef=="nw_wblms001") return "wblms025";
      if (sResRef=="wblms003") return "wblms027";
      //Valorite Basterd Sword
      if (sResRef=="wswbs002") return "wswbs026";
      if (sResRef=="nw_wswbs001") return "wswbs025";
      if (sResRef=="wswbs003") return "wswbs027";
      //Valorite Greatsword
      if (sResRef=="wswgs002") return "wswgs026";
      if (sResRef=="nw_wswgs001") return "wswgs025";
      if (sResRef=="wswgs003") return "wswgs027";
      //Valorite Longsword
      if (sResRef=="wswls002") return "wswls026";
      if (sResRef=="nw_wswls001") return "wswls025";
      if (sResRef=="wswls003") return "wswls027";
      //Valorite Katana
      if (sResRef=="wswka002") return "wswka026";
      if (sResRef=="nw_wswka001") return "wswka025";
      if (sResRef=="wswka003") return "wswka027";
      //Valorite Rapier
      if (sResRef=="wswrp002") return "wswrp026";
      if (sResRef=="nw_wswrp001") return "wswrp025";
      if (sResRef=="wswrp003") return "wswrp027";
      //Valorite Scimitar
      if (sResRef=="wswsc002") return "wswsc026";
      if (sResRef=="nw_wswsc001") return "wswsc025";
      if (sResRef=="wswsc003") return "wswsc027";
      //Valorite Kama
      if (sResRef=="wspka002") return "wspka026";
      if (sResRef=="nw_wspka001") return "wspka025";
      if (sResRef=="wspka003") return "wspka027";
      //Valorite Kukri
      if (sResRef=="wspku002") return "wspku026";
      if (sResRef=="nw_wspku001") return "wspku025";
      if (sResRef=="wspku003") return "wspku027";
      //valorite Sickle
      if (sResRef=="wspsc002") return "wspsc026";
      if (sResRef=="nw_wspsc001") return "wspsc025";
      if (sResRef=="wspsc003") return "wspsc027";
      //Valorite Dire Mace
      if (sResRef=="wdbma002") return "wdbma026";
      if (sResRef=="nw_wdbma001") return "wdbma025";
      if (sResRef=="wdbma003") return "wdbma027";
      //Valorite Double Axe
      if (sResRef=="wdbax002") return "wdbax026";
      if (sResRef=="nw_wdbax001") return "wdbax025";
      if (sResRef=="wdbax003") return "wdbax027";
      //Valorite Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw026";
      if (sResRef=="nw_wdbsw001") return "wdbsw025";
      if (sResRef=="wdbsw003") return "wdbsw027";
      //Valorite Halberd
      if (sResRef=="wplhb002") return "wplhb026";
      if (sResRef=="nw_wplhb001") return "wplhb025";
      if (sResRef=="wplhb003") return "wplhb027";
      //Valorite Scythe
      if (sResRef=="wplsc002") return "wplsc026";
      if (sResRef=="nw_wplsc001") return "wplsc025";
      if (sResRef=="wplsc003") return "wplsc027";
      //Valorite Spear
      if (sResRef=="wplss002") return "wplss026";
      if (sResRef=="nw_wplss001") return "wplss025";
      if (sResRef=="wplss003") return "wplss027";
      //Valorite Small Shield
      if (sResRef=="ashsw002") return "ashsw026";
      if (sResRef=="nw_ashsw001") return "ashsw025";
      if (sResRef=="ashsw003") return "ashsw039";
      //Valorite Large Shield
      if (sResRef=="ashlw002") return "ashlw026";
      if (sResRef=="nw_ashlw001") return "ashlw025";
      if (sResRef=="ashlw003") return "ashlw027";
      //Valorite Tower Shield
      if (sResRef=="ashto002") return "ashto026";
      if (sResRef=="nw_ashto001") return "ashto025";
      if (sResRef=="ashto003") return "ashto027";
      //Valorite Horsehair Helmet
      if (sResRef=="arhe005") return "arhe034";
      if (sResRef=="nw_arhe004") return "arhe033";
      if (sResRef=="arhe007") return "arhe035";
      //Valorite Pot Helmet
      if (sResRef=="arhe002") return "arhe070";
      if (sResRef=="nw_arhe001") return "arhe069";
      if (sResRef=="arhe008") return "arhe071";
      //Valorite Spike Helmet
      if (sResRef=="arhe003") return "arhe106";
      if (sResRef=="nw_arhe002") return "arhe105";
      if (sResRef=="arhe009") return "arhe107";
      //Valorite Stag Helmet
      if (sResRef=="arhe006") return "arhe142";
      if (sResRef=="nw_arhe005") return "arhe141";
      if (sResRef=="arhe010") return "arhe143";
      //Valorite Winged Helmet
      if (sResRef=="arhe004") return "arhe178";
      if (sResRef=="nw_arhe003") return "arhe177";
      if (sResRef=="arhe011") return "arhe179";
      //Valorite Ringmail
      if (sResRef=="ringmail001") return "ringmail025";
      if (sResRef=="ringmail") return "ringmail024";
      if (sResRef=="ringmail002") return "ringmail026";
      //Valorite Chain Shirt
      if (sResRef=="aarcl013") return "aarcl042";
      if (sResRef=="nw_aarcl012") return "aarcl041";
      if (sResRef=="aarcl014") return "aarcl043";
      //Valorite Breastplate
      if (sResRef=="aarcl011") return "aarcl078";
      if (sResRef=="nw_aarcl010") return "aarcl077";
      if (sResRef=="aarcl016") return "aarcl079";
      //Valorite Chainmail
      if (sResRef=="aarcl005") return "aarcl114";
      if (sResRef=="nw_aarcl004") return "aarcl113";
      if (sResRef=="aarcl006") return "aarcl115";
      //Valorite Scale Mail
      if (sResRef=="aarcl006") return "aarcl150";
      if (sResRef=="nw_aarcl003") return "aarcl149";
      if (sResRef=="aarcl007") return "aarcl151";
      //Valorite Banded Mail
      if (sResRef=="aarcl014") return "aarcl186";
      if (sResRef=="nw_aarcl011") return "aarcl185";
      if (sResRef=="aarcl015") return "aarcl187";
      //Valorite Splint Mail
      if (sResRef=="aarcl018") return "aarcl222";
      if (sResRef=="nw_aarcl005") return "aarcl221";
      if (sResRef=="aarcl019") return "aarcl223";
      //Valorite Half Plate
      if (sResRef=="aarcl010") return "aarcl258";
      if (sResRef=="nw_aarcl006") return "aarcl257";
      if (sResRef=="aarcl017") return "aarcl259";
      //Valorite Full Plate
      if (sResRef=="aarcl008") return "aarcl294";
      if (sResRef=="nw_aarcl007") return "aarcl293";
      if (sResRef=="aarcl009") return "aarcl295";
      //Valorite Great Axe
      if (sResRef=="waxgr002") return "waxgr026";
      if (sResRef=="nw_waxgr001") return "waxgr025";
      if (sResRef=="waxgr003") return "waxgr027";
      //Valorite Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe026";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe025";
      if (sResRef=="wdwraxe003") return "wdwraxe027";
      break;
     }
    case 9:
     {
      //Silver Dagger
      if (sResRef=="wswdg002") return "wswdg029";
      if (sResRef=="nw_wswdg001") return "wswdg028";
      if (sResRef=="wswdg003") return "wswdg030";
      //Silver ShortSword
      if (sResRef=="wswss002") return "wswss029";
      if (sResRef=="nw_wswss001") return "wswss028";
      if (sResRef=="wswss003") return "wswss030";
      //Silver Bullet
      if (sResRef=="wambu002") return "wambu029";
      if (sResRef=="nw_wambu001") return "wambu028";
      if (sResRef=="wambu003") return "wambu030";
      //Silver Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead031";
      if (sResRef=="arrowhead") return "arrowhead030";
      if (sResRef=="arrowhead002")  return "arrowhead032";
      //Silver Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead067";
      if (sResRef=="arrowhead003") return "arrowhead066";
      if (sResRef=="arrowhead005") return "arrowhead068";
      //Silver Metal Stud
      if (sResRef=="metalstud001") return "metalstud026";
      if (sResRef=="metalstud") return "metalstud025";
      if (sResRef=="metalstud002") return "metalstud027";
      //Silver Throwing Dart
      if (sResRef=="wthdt002") return "wthdt029";
      if (sResRef=="nw_wthdt001") return "wthdt028";
      if (sResRef=="wthdt003") return "wthdt030";
      //Silver Shuriken
      if (sResRef=="wthsh002") return "wthsh029";
      if (sResRef=="nw_wthsh001") return "wthsh028";
      if (sResRef=="wthsh003") return "wthsh030";
      //Silver Throwing Axe
      if (sResRef=="wthax002") return "wthax029";
      if (sResRef=="nw_wthax001") return "wthax028";
      if (sResRef=="wthax003") return "wthax030";
      //Silver Handaxe
      if (sResRef=="waxhn002") return "waxhn029";
      if (sResRef=="nw_waxhn001") return "waxhn028";
      if (sResRef=="waxhn003") return "waxhn030";
      //Silver Battleaxe
      if (sResRef=="waxbt002") return "waxbt029";
      if (sResRef=="nw_waxbt001") return "waxbt028";
      if (sResRef=="waxbt003") return "waxbt030";
      //Silver Light Flail
      if (sResRef=="wblfl002") return "wblfl029";
      if (sResRef=="nw_wblfl001") return "wblfl028";
      if (sResRef=="wblfl003") return "wblfl030";
      //Silver Heavy Flail
      if (sResRef=="wblfh002") return "wblfh029";
      if (sResRef=="nw_wblfh001") return "wblfh028";
      if (sResRef=="wblfh003") return "wblfh030";
      //Silver Light Hammer
      if (sResRef=="wblhl002") return "wblhl029";
      if (sResRef=="nw_wblhl001") return "wblhl028";
      if (sResRef=="wblhl003") return "wblhl030";
      //Silver Warhammer
      if (sResRef=="wblhw002") return "wblhw029";
      if (sResRef=="nw_wblhw001") return "wblhw028";
      if (sResRef=="wblhw003") return "wblhw030";
      //Silver Mace
      if (sResRef=="wblml002") return "wblml029";
      if (sResRef=="nw_wblml001") return "wblml028";
      if (sResRef=="wblml003") return "wblml030";
      //Silver Morningstar
      if (sResRef=="wblms002") return "wblms029";
      if (sResRef=="nw_wblms001") return "wblms028";
      if (sResRef=="wblms003") return "wblms030";
      //Silver Basterd Sword
      if (sResRef=="wswbs002") return "wswbs029";
      if (sResRef=="nw_wswbs001") return "wswbs028";
      if (sResRef=="wswbs003") return "wswbs030";
      //Silver Greatsword
      if (sResRef=="wswgs002") return "wswgs029";
      if (sResRef=="nw_wswgs001") return "wswgs028";
      if (sResRef=="wswgs003") return "wswgs030";
      //Silver Longsword
      if (sResRef=="wswls002") return "wswls029";
      if (sResRef=="nw_wswls001") return "wswls028";
      if (sResRef=="wswls003") return "wswls030";
      //Silver Katana
      if (sResRef=="wswka002") return "wswka029";
      if (sResRef=="nw_wswka001") return "wswka028";
      if (sResRef=="wswka003") return "wswka030";
      //Silver Rapier
      if (sResRef=="wswrp002") return "wswrp029";
      if (sResRef=="nw_wswrp001") return "wswrp028";
      if (sResRef=="wswrp003") return "wswrp030";
      //Silver Scimitar
      if (sResRef=="wswsc002") return "wswsc029";
      if (sResRef=="nw_wswsc001") return "wswsc028";
      if (sResRef=="wswsc003") return "wswsc030";
      //Silver Kama
      if (sResRef=="wspka002") return "wspka029";
      if (sResRef=="nw_wspka001") return "wspka028";
      if (sResRef=="wspka003") return "wspka030";
      //Silver Kukri
      if (sResRef=="wspku002") return "wspku029";
      if (sResRef=="nw_wspku001") return "wspku028";
      if (sResRef=="wspku003") return "wspku030";
      //Silver Sickle
      if (sResRef=="wspsc002") return "wspsc029";
      if (sResRef=="nw_wspsc001") return "wspsc028";
      if (sResRef=="wspsc003") return "wspsc030";
      //Silver Dire Mace
      if (sResRef=="wdbma002") return "wdbma029";
      if (sResRef=="nw_wdbma001") return "wdbma028";
      if (sResRef=="wdbma003") return "wdbma030";
      //Silver Double Axe
      if (sResRef=="wdbax002") return "wdbax029";
      if (sResRef=="nw_wdbax001") return "wdbax028";
      if (sResRef=="wdbax003") return "wdbax030";
      //Silver Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw029";
      if (sResRef=="nw_wdbsw001") return "wdbsw028";
      if (sResRef=="wdbsw003") return "wdbsw030";
      //Silver Halberd
      if (sResRef=="wplhb002") return "wplhb029";
      if (sResRef=="nw_wplhb001") return "wplhb028";
      if (sResRef=="wplhb003") return "wplhb030";
      //Silver Scythe
      if (sResRef=="wplsc002") return "wplsc029";
      if (sResRef=="nw_wplsc001") return "wplsc028";
      if (sResRef=="wplsc003") return "wplsc030";
      //Silver Spear
      if (sResRef=="wplss002") return "wplss029";
      if (sResRef=="nw_wplss001") return "wplss028";
      if (sResRef=="wplss003") return "wplss030";
      //Silver Small Shield
      if (sResRef=="ashsw002") return "ashsw028";
      if (sResRef=="nw_ashsw001") return "ashsw027";
      if (sResRef=="ashsw003") return "ashsw029";
      //Silver Large Shield
      if (sResRef=="ashlw002") return "ashlw029";
      if (sResRef=="nw_ashlw001") return "ashlw028";
      if (sResRef=="ashlw003") return "ashlw030";
      //Silver Tower Shield
      if (sResRef=="ashto002") return "ashto029";
      if (sResRef=="nw_ashto001") return "ashto028";
      if (sResRef=="ashto003") return "ashto030";
      //Silver Horsehair Helmet
      if (sResRef=="arhe005") return "arhe037";
      if (sResRef=="nw_arhe004") return "arhe036";
      if (sResRef=="arhe007") return "arhe038";
      //Silver Pot Helmet
      if (sResRef=="arhe002") return "arhe073";
      if (sResRef=="nw_arhe001") return "arhe072";
      if (sResRef=="arhe008") return "arhe074";
      //Silver Spike Helmet
      if (sResRef=="arhe003") return "arhe109";
      if (sResRef=="nw_arhe002") return "arhe108";
      if (sResRef=="arhe009") return "arhe110";
      //Silver Stag Helmet
      if (sResRef=="arhe006") return "arhe145";
      if (sResRef=="nw_arhe005") return "arhe144";
      if (sResRef=="arhe010") return "arhe146";
      //Silver Winged Helmet
      if (sResRef=="arhe004") return "arhe181";
      if (sResRef=="nw_arhe003") return "arhe180";
      if (sResRef=="arhe011") return "arhe182";
      //Silver Ringmail
      if (sResRef=="ringmail001") return "ringmail028";
      if (sResRef=="ringmail") return "ringmail027";
      if (sResRef=="ringmail002") return "ringmail029";
      //Silver Chain Shirt
      if (sResRef=="aarcl013") return "aarcl045";
      if (sResRef=="nw_aarcl012") return "aarcl044";
      if (sResRef=="aarcl014") return "aarcl046";
      //Silver Breastplate
      if (sResRef=="aarcl011") return "aarcl081";
      if (sResRef=="nw_aarcl010") return "aarcl080";
      if (sResRef=="aarcl016") return "aarcl082";
      //Silver Chainmail
      if (sResRef=="aarcl005") return "aarcl117";
      if (sResRef=="nw_aarcl004") return "aarcl116";
      if (sResRef=="aarcl006") return "aarcl118";
      //Silver Scale Mail
      if (sResRef=="aarcl006") return "aarcl153";
      if (sResRef=="nw_aarcl003") return "aarcl152";
      if (sResRef=="aarcl007") return "aarcl154";
      //Silver Banded Mail
      if (sResRef=="aarcl014") return "aarcl189";
      if (sResRef=="nw_aarcl011") return "aarcl188";
      if (sResRef=="aarcl015") return "aarcl190";
      //Silver Splint Mail
      if (sResRef=="aarcl018") return "aarcl225";
      if (sResRef=="nw_aarcl005") return "aarcl224";
      if (sResRef=="aarcl019") return "aarcl226";
      //Silver Half Plate
      if (sResRef=="aarcl010") return "aarcl261";
      if (sResRef=="nw_aarcl006") return "aarcl260";
      if (sResRef=="aarcl017") return "aarcl262";
      //Silver Full Plate
      if (sResRef=="aarcl008") return "aarcl297";
      if (sResRef=="nw_aarcl007") return "aarcl296";
      if (sResRef=="aarcl009") return "aarcl298";
      //Silver Great Axe
      if (sResRef=="waxgr002") return "waxgr029";
      if (sResRef=="nw_waxgr001") return "waxgr028";
      if (sResRef=="waxgr003") return "waxgr030";
      //Silver Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe029";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe028";
      if (sResRef=="wdwraxe003") return "wdwraxe030";
      break;
     }
    case 10:
     {
      //Mithril Dagger
      if (sResRef=="wswdg002") return "wswdg032";
      if (sResRef=="nw_wswdg001") return "wswdg031";
      if (sResRef=="wswdg003") return "wswdg033";
      //Mithril ShortSword
      if (sResRef=="wswss002") return "wswss032";
      if (sResRef=="nw_wswss001") return "wswss031";
      if (sResRef=="wswss003") return "wswss033";
      //Mithril Bullet
      if (sResRef=="wambu002") return "wambu032";
      if (sResRef=="nw_wambu001") return "wambu031";
      if (sResRef=="wambu003") return "wambu033";
      //Mithril Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead034";
      if (sResRef=="arrowhead") return "arrowhead033";
      if (sResRef=="arrowhead002")  return "arrowhead035";
      //Mithril Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead070";
      if (sResRef=="arrowhead003") return "arrowhead069";
      if (sResRef=="arrowhead005") return "arrowhead071";
      //Mithril Metal Stud
      if (sResRef=="metalstud001") return "metalstud029";
      if (sResRef=="metalstud") return "metalstud028";
      if (sResRef=="metalstud002") return "metalstud030";
      //Mithril Throwing Dart
      if (sResRef=="wthdt002") return "wthdt032";
      if (sResRef=="nw_wthdt001") return "wthdt031";
      if (sResRef=="wthdt003") return "wthdt033";
      //Mithril Shuriken
      if (sResRef=="wthsh002") return "wthsh032";
      if (sResRef=="nw_wthsh001") return "wthsh031";
      if (sResRef=="wthsh003") return "wthsh033";
      //Mithril Throwing Axe
      if (sResRef=="wthax002") return "wthax032";
      if (sResRef=="nw_wthax001") return "wthax031";
      if (sResRef=="wthax003") return "wthax033";
      //Mithril Handaxe
      if (sResRef=="waxhn002") return "waxhn032";
      if (sResRef=="nw_waxhn001") return "waxhn031";
      if (sResRef=="waxhn003") return "waxhn033";
      //Mithril Battleaxe
      if (sResRef=="waxbt002") return "waxbt032";
      if (sResRef=="nw_waxbt001") return "waxbt031";
      if (sResRef=="waxbt003") return "waxbt033";
      //Mithril Light Flail
      if (sResRef=="wblfl002") return "wblfl032";
      if (sResRef=="nw_wblfl001") return "wblfl031";
      if (sResRef=="wblfl003") return "wblfl033";
      //Mithril Heavy Flail
      if (sResRef=="wblfh002") return "wblfh032";
      if (sResRef=="nw_wblfh001") return "wblfh031";
      if (sResRef=="wblfh003") return "wblfh033";
      //Mithril Light Hammer
      if (sResRef=="wblhl002") return "wblhl032";
      if (sResRef=="nw_wblhl001") return "wblhl031";
      if (sResRef=="wblhl003") return "wblhl033";
      //Mithril Warhammer
      if (sResRef=="wblhw002") return "wblhw032";
      if (sResRef=="nw_wblhw001") return "wblhw031";
      if (sResRef=="wblhw003") return "wblhw033";
      //Mithril Mace
      if (sResRef=="wblml002") return "wblml032";
      if (sResRef=="nw_wblml001") return "wblml031";
      if (sResRef=="wblml003") return "wblml033";
      //Mithril Morningstar
      if (sResRef=="wblms002") return "wblms032";
      if (sResRef=="nw_wblms001") return "wblms031";
      if (sResRef=="wblms003") return "wblms033";
      //Mithril Basterd Sword
      if (sResRef=="wswbs002") return "wswbs032";
      if (sResRef=="nw_wswbs001") return "wswbs031";
      if (sResRef=="wswbs003") return "wswbs033";
      //Mithril Greatsword
      if (sResRef=="wswgs002") return "wswgs032";
      if (sResRef=="nw_wswgs001") return "wswgs031";
      if (sResRef=="wswgs003") return "wswgs033";
      //Mithril Longsword
      if (sResRef=="wswls002") return "wswls032";
      if (sResRef=="nw_wswls001") return "wswls031";
      if (sResRef=="wswls003") return "wswls033";
      //Mithril Katana
      if (sResRef=="wswka002") return "wswka032";
      if (sResRef=="nw_wswka001") return "wswka031";
      if (sResRef=="wswka003") return "wswka033";
      //Mithril Rapier
      if (sResRef=="wswrp002") return "wswrp032";
      if (sResRef=="nw_wswrp001") return "wswrp031";
      if (sResRef=="wswrp003") return "wswrp033";
      //Mithril Scimitar
      if (sResRef=="wswsc002") return "wswsc032";
      if (sResRef=="nw_wswsc001") return "wswsc031";
      if (sResRef=="wswsc003") return "wswsc033";
      //Mithril Kama
      if (sResRef=="wspka002") return "wspka032";
      if (sResRef=="nw_wspka001") return "wspka031";
      if (sResRef=="wspka003") return "wspka033";
      //Mithril Kukri
      if (sResRef=="wspku002") return "wspku032";
      if (sResRef=="nw_wspku001") return "wspku031";
      if (sResRef=="wspku003") return "wspku033";
      //Mithril Sickle
      if (sResRef=="wspsc002") return "wspsc032";
      if (sResRef=="nw_wspsc001") return "wspsc031";
      if (sResRef=="wspsc003") return "wspsc033";
      //Mithril Dire Mace
      if (sResRef=="wdbma002") return "wdbma032";
      if (sResRef=="nw_wdbma001") return "wdbma031";
      if (sResRef=="wdbma003") return "wdbma033";
      //Mithril Double Axe
      if (sResRef=="wdbax002") return "wdbax032";
      if (sResRef=="nw_wdbax001") return "wdbax031";
      if (sResRef=="wdbax003") return "wdbax033";
      //Mithril Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw032";
      if (sResRef=="nw_wdbsw001") return "wdbsw031";
      if (sResRef=="wdbsw003") return "wdbsw033";
      //Mithril Halberd
      if (sResRef=="wplhb002") return "wplhb032";
      if (sResRef=="nw_wplhb001") return "wplhb031";
      if (sResRef=="wplhb003") return "wplhb033";
      //Mithril Scythe
      if (sResRef=="wplsc002") return "wplsc032";
      if (sResRef=="nw_wplsc001") return "wplsc031";
      if (sResRef=="wplsc003") return "wplsc033";
      //Mithril Spear
      if (sResRef=="wplss002") return "wplss032";
      if (sResRef=="nw_wplss001") return "wplss031";
      if (sResRef=="wplss003") return "wplss033";
      //Mithril Small Shield
      if (sResRef=="ashsw002") return "ashsw031";
      if (sResRef=="nw_ashsw001") return "ashsw030";
      if (sResRef=="ashsw003") return "ashsw032";
      //Mithril Large Shield
      if (sResRef=="ashlw002") return "ashlw032";
      if (sResRef=="nw_ashlw001") return "ashlw031";
      if (sResRef=="ashlw003") return "ashlw033";
      //Mithril Tower Shield
      if (sResRef=="ashto002") return "ashto032";
      if (sResRef=="nw_ashto001") return "ashto031";
      if (sResRef=="ashto003") return "ashto033";
      //Mithril Horsehair Helmet
      if (sResRef=="arhe005") return "arhe040";
      if (sResRef=="nw_arhe004") return "arhe039";
      if (sResRef=="arhe007") return "arhe041";
      //Mithril Pot Helmet
      if (sResRef=="arhe002") return "arhe076";
      if (sResRef=="nw_arhe001") return "arhe075";
      if (sResRef=="arhe008") return "arhe077";
      //Mithril Spike Helmet
      if (sResRef=="arhe003") return "arhe112";
      if (sResRef=="nw_arhe002") return "arhe111";
      if (sResRef=="arhe009") return "arhe113";
      //Mithril Stag Helmet
      if (sResRef=="arhe006") return "arhe148";
      if (sResRef=="nw_arhe005") return "arhe147";
      if (sResRef=="arhe010") return "arhe149";
      //Mithril Winged Helmet
      if (sResRef=="arhe004") return "arhe184";
      if (sResRef=="nw_arhe003") return "arhe183";
      if (sResRef=="arhe011") return "arhe185";
      //Mithril Ringmail
      if (sResRef=="ringmail001") return "ringmail031";
      if (sResRef=="ringmail") return "ringmail030";
      if (sResRef=="ringmail002") return "ringmail032";
      //Mithril Chain Shirt
      if (sResRef=="aarcl013") return "aarcl048";
      if (sResRef=="nw_aarcl012") return "aarcl047";
      if (sResRef=="aarcl014") return "aarcl049";
      //Mithril Breastplate
      if (sResRef=="aarcl011") return "aarcl084";
      if (sResRef=="nw_aarcl010") return "aarcl083";
      if (sResRef=="aarcl016") return "aarcl085";
      //Mithril Chainmail
      if (sResRef=="aarcl005") return "aarcl120";
      if (sResRef=="nw_aarcl004") return "aarcl119";
      if (sResRef=="aarcl006") return "aarcl121";
      //Mithril Scale Mail
      if (sResRef=="aarcl006") return "aarcl156";
      if (sResRef=="nw_aarcl003") return "aarcl155";
      if (sResRef=="aarcl007") return "aarcl157";
      //Mithril Banded Mail
      if (sResRef=="aarcl014") return "aarcl192";
      if (sResRef=="nw_aarcl011") return "aarcl191";
      if (sResRef=="aarcl015") return "aarcl193";
      //Mithril Splint Mail
      if (sResRef=="aarcl018") return "aarcl228";
      if (sResRef=="nw_aarcl005") return "aarcl227";
      if (sResRef=="aarcl019") return "aarcl229";
      //Mithril Half Plate
      if (sResRef=="aarcl010") return "aarcl264";
      if (sResRef=="nw_aarcl006") return "aarcl263";
      if (sResRef=="aarcl017") return "aarcl265";
      //Mithril Full Plate
      if (sResRef=="aarcl008") return "aarcl300";
      if (sResRef=="nw_aarcl007") return "aarcl299";
      if (sResRef=="aarcl009") return "aarcl301";
      //Mithril Great Axe
      if (sResRef=="waxgr002") return "waxgr035";
      if (sResRef=="nw_waxgr001") return "waxgr034";
      if (sResRef=="waxgr003") return "waxgr036";
      //Mithril Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe035";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe034";
      if (sResRef=="wdwraxe003") return "wdwraxe036";
      break;
     }
    case 11:
     {
      //Adamantite Dagger
      if (sResRef=="wswdg002") return "wswdg035";
      if (sResRef=="nw_wswdg001") return "wswdg034";
      if (sResRef=="wswdg003") return "wswdg036";
      //Adamantite ShortSword
      if (sResRef=="wswss002") return "wswss035";
      if (sResRef=="nw_wswss001") return "wswss034";
      if (sResRef=="wswss003") return "wswss036";
      //Adamantite Bullet
      if (sResRef=="wambu002") return "wambu035";
      if (sResRef=="nw_wambu001") return "wambu034";
      if (sResRef=="wambu003") return "wambu036";
      //Adamantite Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead037";
      if (sResRef=="arrowhead") return "arrowhead036";
      if (sResRef=="arrowhead002")  return "arrowhead038";
      //Adamantite Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead073";
      if (sResRef=="arrowhead003") return "arrowhead072";
      if (sResRef=="arrowhead005") return "arrowhead074";
      //Adamantite Metal Stud   //32 & 33
      if (sResRef=="metalstud001") return "metalstud032";
      if (sResRef=="metalstud") return "metalstud031";
      if (sResRef=="metalstud002") return "metalstud033";
      //Adamantite Throwing Dart
      if (sResRef=="wthdt002") return "wthdt035";
      if (sResRef=="nw_wthdt001") return "wthdt034";
      if (sResRef=="wthdt003") return "wthdt036";
      //Adamantite Shuriken
      if (sResRef=="wthsh002") return "wthsh035";
      if (sResRef=="nw_wthsh001") return "wthsh034";
      if (sResRef=="wthsh003") return "wthsh036";
      //Adamantite Throwing Axe
      if (sResRef=="wthax002") return "wthax035";
      if (sResRef=="nw_wthax001") return "wthax034";
      if (sResRef=="wthax003") return "wthax036";
      //Adamantite Handaxe
      if (sResRef=="waxhn002") return "waxhn035";
      if (sResRef=="nw_waxhn001") return "waxhn034";
      if (sResRef=="waxhn003") return "waxhn036";
      //Adamantite Battleaxe
      if (sResRef=="waxbt002") return "waxbt035";
      if (sResRef=="nw_waxbt001") return "waxbt034";
      if (sResRef=="waxbt003") return "waxbt036";
      //Adamantite Light Flail
      if (sResRef=="wblfl002") return "wblfl035";
      if (sResRef=="nw_wblfl001") return "wblfl034";
      if (sResRef=="wblfl003") return "wblfl036";
      //Adamantite Heavy Flail
      if (sResRef=="wblfh002") return "wblfh035";
      if (sResRef=="nw_wblfh001") return "wblfh034";
      if (sResRef=="wblfh003") return "wblfh036";
      //Adamantite Light Hammer
      if (sResRef=="wblhl002") return "wblhl035";
      if (sResRef=="nw_wblhl001") return "wblhl034";
      if (sResRef=="wblhl003") return "wblhl036";
      //Adamantite Warhammer
      if (sResRef=="wblhw002") return "wblhw035";
      if (sResRef=="nw_wblhw001") return "wblhw034";
      if (sResRef=="wblhw003") return "wblhw036";
      //Adamantite Mace
      if (sResRef=="wblml002") return "wblml035";
      if (sResRef=="nw_wblml001") return "wblml034";
      if (sResRef=="wblml003") return "wblml036";
      //Adamantite Morningstar
      if (sResRef=="wblms002") return "wblms035";
      if (sResRef=="nw_wblms001") return "wblms034";
      if (sResRef=="wblms003") return "wblms036";
      //Adamantite Basterd Sword
      if (sResRef=="wswbs002") return "wswbs035";
      if (sResRef=="nw_wswbs001") return "wswbs034";
      if (sResRef=="wswbs003") return "wswbs036";
      //Adamantite Greatsword
      if (sResRef=="wswgs002") return "wswgs035";
      if (sResRef=="nw_wswgs001") return "wswgs034";
      if (sResRef=="wswgs003") return "wswgs036";
      //Adamantite Longsword
      if (sResRef=="wswls002") return "wswls035";
      if (sResRef=="nw_wswls001") return "wswls034";
      if (sResRef=="wswls003") return "wswls036";
      //Adamantite Katana
      if (sResRef=="wswka002") return "wswka035";
      if (sResRef=="nw_wswka001") return "wswka034";
      if (sResRef=="wswka003") return "wswka036";
      //Adamantite Rapier
      if (sResRef=="wswrp002") return "wswrp035";
      if (sResRef=="nw_wswrp001") return "wswrp034";
      if (sResRef=="wswrp003") return "wswrp036";
      //Adamantite Scimitar
      if (sResRef=="wswsc002") return "wswsc035";
      if (sResRef=="nw_wswsc001") return "wswsc034";
      if (sResRef=="wswsc003") return "wswsc036";
      //Adamantite Kama
      if (sResRef=="wspka002") return "wspka035";
      if (sResRef=="nw_wspka001") return "wspka034";
      if (sResRef=="wspka003") return "wspka036";
      //Adamantite Kukri
      if (sResRef=="wspku002") return "wspku035";
      if (sResRef=="nw_wspku001") return "wspku034";
      if (sResRef=="wspku003") return "wspku036";
      //Adamantite Sickle
      if (sResRef=="wspsc002") return "wspsc035";
      if (sResRef=="nw_wspsc001") return "wspsc034";
      if (sResRef=="wspsc003") return "wspsc036";
      //Adamantite Dire Mace
      if (sResRef=="wdbma002") return "wdbma035";
      if (sResRef=="nw_wdbma001") return "wdbma034";
      if (sResRef=="wdbma003") return "wdbma036";
      //Adamantite Double Axe
      if (sResRef=="wdbax002") return "wdbax035";
      if (sResRef=="nw_wdbax001") return "wdbax034";
      if (sResRef=="wdbax003") return "wdbax036";
      //Adamantite Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw035";
      if (sResRef=="nw_wdbsw001") return "wdbsw034";
      if (sResRef=="wdbsw003") return "wdbsw036";
      //Adamantite Halberd
      if (sResRef=="wplhb002") return "wplhb035";
      if (sResRef=="nw_wplhb001") return "wplhb034";
      if (sResRef=="wplhb003") return "wplhb036";
      //Adamantite Scythe
      if (sResRef=="wplsc002") return "wplsc035";
      if (sResRef=="nw_wplsc001") return "wplsc034";
      if (sResRef=="wplsc003") return "wplsc036";
      //Adamantite Spear
      if (sResRef=="wplss002") return "wplss035";
      if (sResRef=="nw_wplss001") return "wplss034";
      if (sResRef=="wplss003") return "wplss036";
      //Adamantite Small Shield
      if (sResRef=="ashsw002") return "ashsw034";
      if (sResRef=="nw_ashsw001") return "ashsw033";
      if (sResRef=="ashsw003") return "ashsw035";
      //Adamantite Large Shield
      if (sResRef=="ashlw002") return "ashlw035";
      if (sResRef=="nw_ashlw001") return "ashlw034";
      if (sResRef=="ashlw003") return "ashlw036";
      //Adamantite Tower Shield
      if (sResRef=="ashto002") return "ashto035";
      if (sResRef=="nw_ashto001") return "ashto034";
      if (sResRef=="ashto003") return "ashto036";
      //Adamantite Horsehair Helmet
      if (sResRef=="arhe005") return "arhe043";
      if (sResRef=="nw_arhe004") return "arhe042";
      if (sResRef=="arhe007") return "arhe044";
      //Adamantite Pot Helmet
      if (sResRef=="arhe002") return "arhe079";
      if (sResRef=="nw_arhe001") return "arhe078";
      if (sResRef=="arhe008") return "arhe080";
      //Adamantite Spike Helmet
      if (sResRef=="arhe003") return "arhe115";
      if (sResRef=="nw_arhe002") return "arhe114";
      if (sResRef=="arhe009") return "arhe116";
      //Adamantite Stag Helmet
      if (sResRef=="arhe006") return "arhe151";
      if (sResRef=="nw_arhe005") return "arhe150";
      if (sResRef=="arhe010") return "arhe152";
      //Adamantite Winged Helmet
      if (sResRef=="arhe004") return "arhe187";
      if (sResRef=="nw_arhe003") return "arhe186";
      if (sResRef=="arhe011") return "arhe188";
      //Adamantite Ringmail
      if (sResRef=="ringmail001") return "ringmail034";
      if (sResRef=="ringmail") return "ringmail033";
      if (sResRef=="ringmail002") return "ringmail035";
      //Adamantite Chain Shirt
      if (sResRef=="aarcl013") return "aarcl051";
      if (sResRef=="nw_aarcl012") return "aarcl050";
      if (sResRef=="aarcl014") return "aarcl052";
      //Adamantite Breastplate
      if (sResRef=="aarcl011") return "aarcl087";
      if (sResRef=="nw_aarcl010") return "aarcl086";
      if (sResRef=="aarcl016") return "aarcl088";
      //Adamantite Chainmail
      if (sResRef=="aarcl005") return "aarcl123";
      if (sResRef=="nw_aarcl004") return "aarcl122";
      if (sResRef=="aarcl006") return "aarcl124";
      //Adamantite Scale Mail
      if (sResRef=="aarcl006") return "aarcl159";
      if (sResRef=="nw_aarcl003") return "aarcl158";
      if (sResRef=="aarcl007") return "aarcl160";
      //Adamantite Banded Mail
      if (sResRef=="aarcl014") return "aarcl195";
      if (sResRef=="nw_aarcl011") return "aarcl194";
      if (sResRef=="aarcl015") return "aarcl196";
      //Adamantite Splint Mail
      if (sResRef=="aarcl018") return "aarcl231";
      if (sResRef=="nw_aarcl005") return "aarcl230";
      if (sResRef=="aarcl019") return "aarcl232";
      //Adamantite Half Plate
      if (sResRef=="aarcl010") return "aarcl267";
      if (sResRef=="nw_aarcl006") return "aarcl266";
      if (sResRef=="aarcl017") return "aarcl268";
      //Adamantite Full Plate
      if (sResRef=="aarcl008") return "aarcl303";
      if (sResRef=="nw_aarcl007") return "aarcl302";
      if (sResRef=="aarcl009") return "aarcl304";
      //Adamantite Great Axe
      if (sResRef=="waxgr002") return "waxgr038";
      if (sResRef=="nw_waxgr001") return "waxgr037";
      if (sResRef=="waxgr003") return "waxgr039";
      //Adamantite Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe038";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe037";
      if (sResRef=="wdwraxe003") return "wdwraxe039";
      break;
     }
    case 12:
     {
      //Platinum Dagger
      if (sResRef=="wswdg002") return "wswdg038";
      if (sResRef=="nw_wswdg001") return "wswdg037";
      if (sResRef=="wswdg003") return "wswdg039";
      //Platinum ShortSword
      if (sResRef=="wswss002") return "wswss038";
      if (sResRef=="nw_wswss001") return "wswss037";
      if (sResRef=="wswss003") return "wswss039";
      //Platinum Bullet
      if (sResRef=="wambu002") return "wambu036";
      if (sResRef=="nw_wambu001") return "wambu037";
      if (sResRef=="wambu003") return "wambu039";
      //Platinum Arrowhead
      if (sResRef=="arrowhead001") return "arrowhead040";
      if (sResRef=="arrowhead") return "arrowhead039";
      if (sResRef=="arrowhead002")  return "arrowhead041";
      //Platinum Bolt-Tip
      if (sResRef=="arrowhead004") return "arrowhead076";
      if (sResRef=="arrowhead003") return "arrowhead075";
      if (sResRef=="arrowhead005") return "arrowhead077";
      //Platinum Metal Stud
      if (sResRef=="metalstud001") return "metalstud035";
      if (sResRef=="metalstud") return "metalstud034";  //35 & 36
      if (sResRef=="metalstud002") return "metalstud036";
      //Platinum Throwing Dart
      if (sResRef=="wthdt002") return "wthdt038";
      if (sResRef=="nw_wthdt001") return "wthdt037";
      if (sResRef=="wthdt003") return "wthdt039";
      //Platinum Shuriken
      if (sResRef=="wthsh002") return "wthsh038";
      if (sResRef=="nw_wthsh001") return "wthsh037";
      if (sResRef=="wthsh003") return "wthsh039";
      //Platinum Throwing Axe
      if (sResRef=="wthax002") return "wthax038";
      if (sResRef=="nw_wthax001") return "wthax037";
      if (sResRef=="wthax003") return "wthax039";
      //Platinum Handaxe
      if (sResRef=="waxhn002") return "waxhn038";
      if (sResRef=="nw_waxhn001") return "waxhn037";
      if (sResRef=="waxhn003") return "waxhn039";
      //Platinum Battleaxe
      if (sResRef=="waxbt002") return "waxbt038";
      if (sResRef=="nw_waxbt001") return "waxbt037";
      if (sResRef=="waxbt003") return "waxbt039";
      //Platinum Light Flail
      if (sResRef=="wblfl002") return "wblfl038";
      if (sResRef=="nw_wblfl001") return "wblfl037";
      if (sResRef=="wblfl003") return "wblfl039";
      //Platinum Heavy Flail
      if (sResRef=="wblfh002") return "wblfh038";
      if (sResRef=="nw_wblfh001") return "wblfh037";
      if (sResRef=="wblfh003") return "wblfh039";
      //Platinum Light Hammer
      if (sResRef=="wblhl002") return "wblhl038";
      if (sResRef=="nw_wblhl001") return "wblhl037";
      if (sResRef=="wblhl003") return "wblhl039";
      //Platinum Warhammer
      if (sResRef=="wblhw002") return "wblhw038";
      if (sResRef=="nw_wblhw001") return "wblhw037";
      if (sResRef=="wblhw003") return "wblhw039";
      //Platinum Mace
      if (sResRef=="wblml002") return "wblml038";
      if (sResRef=="nw_wblml001") return "wblml037";
      if (sResRef=="wblml003") return "wblml039";
      //Platinum Morningstar
      if (sResRef=="wblms002") return "wblms038";
      if (sResRef=="nw_wblms001") return "wblms037";
      if (sResRef=="wblms003") return "wblms039";
      //Platinum Basterd Sword
      if (sResRef=="wswbs002") return "wswbs038";
      if (sResRef=="nw_wswbs001") return "wswbs037";
      if (sResRef=="wswbs003") return "wswbs039";
      //Platinum Greatsword
      if (sResRef=="wswgs002") return "wswgs038";
      if (sResRef=="nw_wswgs001") return "wswgs037";
      if (sResRef=="wswgs003") return "wswgs039";
      //Platinum Longsword
      if (sResRef=="wswls002") return "wswls038";
      if (sResRef=="nw_wswls001") return "wswls037";
      if (sResRef=="wswls003") return "wswls039";
      //Platinum Katana
      if (sResRef=="wswka002") return "wswka038";
      if (sResRef=="nw_wswka001") return "wswka037";
      if (sResRef=="wswka003") return "wswka039";
      //Platinum Rapier
      if (sResRef=="wswrp002") return "wswrp038";
      if (sResRef=="nw_wswrp001") return "wswrp037";
      if (sResRef=="wswrp003") return "wswrp039";
      //Platinum Scimitar
      if (sResRef=="wswsc002") return "wswsc038";
      if (sResRef=="nw_wswsc001") return "wswsc037";
      if (sResRef=="wswsc003") return "wswsc039";
      //Platinum Kama
      if (sResRef=="wspka002") return "wspka038";
      if (sResRef=="nw_wspka001") return "wspka037";
      if (sResRef=="wspka003") return "wspka039";
      //Platinum Kukri
      if (sResRef=="wspku002") return "wspku038";
      if (sResRef=="nw_wspku001") return "wspku037";
      if (sResRef=="wspku003") return "wspku039";
      //Platinum Sickle
      if (sResRef=="wspsc002") return "wspsc038";
      if (sResRef=="nw_wspsc001") return "wspsc037";
      if (sResRef=="wspsc003") return "wspsc039";
      //Platinum Dire Mace
      if (sResRef=="wdbma002") return "wdbma038";
      if (sResRef=="nw_wdbma001") return "wdbma037";
      if (sResRef=="wdbma003") return "wdbma039";
      //Platinum Double Axe
      if (sResRef=="wdbax002") return "wdbax038";
      if (sResRef=="nw_wdbax001") return "wdbax037";
      if (sResRef=="wdbax003") return "wdbax039";
      //Platinum Two-Bladed Sword
      if (sResRef=="wdbsw002") return "wdbsw038";
      if (sResRef=="nw_wdbsw001") return "wdbsw037";
      if (sResRef=="wdbsw003") return "wdbsw039";
      //Platinum Halberd
      if (sResRef=="wplhb002") return "wplhb038";
      if (sResRef=="nw_wplhb001") return "wplhb037";
      if (sResRef=="wplhb003") return "wplhb039";
      //Platinum Scythe
      if (sResRef=="wplsc002") return "wplsc038";
      if (sResRef=="nw_wplsc001") return "wplsc037";
      if (sResRef=="wplsc003") return "wplsc039";
      //Platinum Spear
      if (sResRef=="wplss002") return "wplss038";
      if (sResRef=="nw_wplss001") return "wplss037";
      if (sResRef=="wplss003") return "wplss039";
      //Platinum Small Shield
      if (sResRef=="ashsw002") return "ashsw037";
      if (sResRef=="nw_ashsw001") return "ashsw036";
      if (sResRef=="ashsw003") return "ashsw038";
      //Platinum Large Shield
      if (sResRef=="ashlw002") return "ashlw038";
      if (sResRef=="nw_ashlw001") return "ashlw037";
      if (sResRef=="ashlw003") return "ashlw039";
      //Platinum Tower Shield
      if (sResRef=="ashto002") return "ashto038";
      if (sResRef=="nw_ashto001") return "ashto037";
      if (sResRef=="ashto003") return "ashto039";
      //Platinum Horsehair Helmet
      if (sResRef=="arhe005") return "arhe046";
      if (sResRef=="nw_arhe004") return "arhe045";
      if (sResRef=="arhe007") return "arhe047";
      //Platinum Pot Helmet
      if (sResRef=="arhe002") return "arhe082";
      if (sResRef=="nw_arhe001") return "arhe081";
      if (sResRef=="arhe008") return "arhe083";
      //Platinum Spike Helmet
      if (sResRef=="arhe003") return "arhe118";
      if (sResRef=="nw_arhe002") return "arhe117";
      if (sResRef=="arhe009") return "arhe119";
      //Platinum Stag Helmet
      if (sResRef=="arhe006") return "arhe154";
      if (sResRef=="nw_arhe005") return "arhe153";
      if (sResRef=="arhe010") return "arhe155";
      //Platinum Winged Helmet
      if (sResRef=="arhe004") return "arhe190";
      if (sResRef=="nw_arhe003") return "arhe189";
      if (sResRef=="arhe011") return "arhe191";
      //Platinum Ringmail
      if (sResRef=="ringmail001") return "ringmail037";
      if (sResRef=="ringmail") return "ringmail036";
      if (sResRef=="ringmail002") return "ringmail038";
      //Platinum Chain Shirt
      if (sResRef=="aarcl013") return "aarcl054";
      if (sResRef=="nw_aarcl012") return "aarcl053";
      if (sResRef=="aarcl014") return "aarcl055";
      //Platinum Breastplate
      if (sResRef=="aarcl011") return "aarcl090";
      if (sResRef=="nw_aarcl010") return "aarcl089";
      if (sResRef=="aarcl016") return "aarcl091";
      //Platinum Chainmail
      if (sResRef=="aarcl005") return "aarcl126";
      if (sResRef=="nw_aarcl004") return "aarcl125";
      if (sResRef=="aarcl006") return "aarcl127";
      //Platinum Scale Mail
      if (sResRef=="aarcl006") return "aarcl162";
      if (sResRef=="nw_aarcl003") return "aarcl161";
      if (sResRef=="aarcl007") return "aarcl163";
      //Platinum Banded Mail
      if (sResRef=="aarcl014") return "aarcl198";
      if (sResRef=="nw_aarcl011") return "aarcl197";
      if (sResRef=="aarcl015") return "aarcl199";
      //Platinum Splint Mail
      if (sResRef=="aarcl018") return "aarcl234";
      if (sResRef=="nw_aarcl005") return "aarcl233";
      if (sResRef=="aarcl019") return "aarcl235";
      //Platinum Half Plate
      if (sResRef=="aarcl010") return "aarcl270";
      if (sResRef=="nw_aarcl006") return "aarcl269";
      if (sResRef=="aarcl017") return "aarcl271";
      //Platinum Full Plate
      if (sResRef=="aarcl008") return "aarcl306";
      if (sResRef=="nw_aarcl007") return "aarcl305";
      if (sResRef=="aarcl009") return "aarcl307";
      //Platinum Great Axe
      if (sResRef=="waxgr002") return "waxgr032";
      if (sResRef=="nw_waxgr001") return "waxgr031";
      if (sResRef=="waxgr003") return "waxgr033";
      //Platinum Dwarven WarAxe
      if (sResRef=="wdwraxe002") return "wdwraxe032";
      if (sResRef=="x2_wdwraxe001") return "wdwraxe031";
      if (sResRef=="wdwraxe003") return "wdwraxe033";
      break;
     }
    default:{return "null";break;}
   }
  return "null";
 }