Aschbourne_PRC8/_module/nss/_craft_tailor.nss
Jaysyn904 f5ffe7d0b9 Module commit
Module commit.
2024-06-14 10:48:20 -04:00

978 lines
37 KiB
Plaintext

//#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 iClothType);
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 iClothType = GetLocalInt(oPC,"iUseLeatherType");
string sComponent1 = "";
string sComponent2 = "";
string sComponent3 = "";
string sComponent1Name = "";
string sComponent2Name = "";
string sComponent3Name = "";
string sComponentResRef = "";
object oTemp = OBJECT_INVALID;
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);
}
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
DestroyObject(oItem);
if (GetItemPossessedBy(oPC,"ITEM_SEWINGKIT")==OBJECT_INVALID)
{
SendMessageToPC(oPC,"You must have a sewing kit in order to make anything here.");
return;
}
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
{
SendMessageToPC(oPC,"You must wait till the current crafted item is completed before starting another.");
return;
}
if (sTag == "SWITCH_LEATHER1")
{
SetLocalInt(oPC,"iUseLeatherType",0);
FloatingTextStringOnCreature("Now using normal leather...",oPC,FALSE);
}
if (sTag == "SWITCH_LEATHER2")
{
SetLocalInt(oPC,"iUseLeatherType",1);
FloatingTextStringOnCreature("Now using black leather...",oPC,FALSE);
}
if (sTag == "SWITCH_LEATHER3")
{
SetLocalInt(oPC,"iUseLeatherType",2);
FloatingTextStringOnCreature("Now using white leather...",oPC,FALSE);
}
if (GetStringLeft(sTag,7)=="SWITCH_")
{
DestroyObject(oItem);
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;
}
//int iTailorSkill = GetTokenPair(oPC,13,9);
int iTailorSkill = GetCampaignInt("UOACraft","iTailorSkill",oPC);
int iTailorChance = iTailorSkill;
if (iTailorChance < 350)
{
iTailorChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
iTailorChance = iTailorChance+(GetAbilityScore(oPC,ABILITY_STRENGTH)*3);
iTailorChance = iTailorChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*2);
iTailorChance = iTailorChance*3;
if (iTailorChance>350)iTailorChance=350;
if (iTailorSkill > iTailorChance) iTailorChance=iTailorSkill;
}
// Begin Crafting Test
if (sTag == "P_LEATHER")
{
iTailorChance = iTailorChance - 300;
sSuccess = "You carefully cut and sew the leather to create leather armor.";
sFail = "You manage to mangle the leather in your attempt to craft leather armor.";
sItemResRefPoor = CraftLookup("aarcl002",iClothType);
sItemResRef = CraftLookup("nw_aarcl001",iClothType);
sItemResRefExceptional = CraftLookup("aarcl003",iClothType);
iComponent1 = 2;
sComponent1 = "SOFTLEATHER_LARGE"; // Soft Leather - Large
sComponent1Name = "large soft leathers";
}
if (sTag == "P_PADDED")
{
iTailorChance = iTailorChance - 200;
sSuccess = "You carefully cut and sew the leather and cloth to create padded armor.";
sFail = "You manage to mangle the cloth and leather as you attempt to craft the armor.";
sItemResRefPoor = CraftLookup("aarcl308",iClothType);
sItemResRef = CraftLookup("nw_aarcl001",iClothType);
sItemResRefExceptional = CraftLookup("aarcl309",iClothType);
iComponent1 = 1;
sComponent1 = "SOFTLEATHER_LARGE"; // Soft Leather - Large
sComponent1Name = "large soft leathers";
iComponent2 = 1;
sComponent2 = "ITEM_CLOTH_NORMAL"; // Normal Undyed Cloth
sComponent2Name = "bolts of normal undyed cloth";
}
if (sTag == "P_STUDDED")
{
iTailorChance = iTailorChance - 500;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl310",iClothType);
sItemResRef = CraftLookup("nw_aarcl002",iClothType);
sItemResRefExceptional = CraftLookup("aarcl311",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_NORMAL"; // Normal Metal Studs - Iron
sComponent2Name = "metal studs";
}
if (sTag == "P_DULLSTUDDED")
{
iTailorChance = iTailorChance - 520;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl316",iClothType);
sItemResRef = CraftLookup("aarcl315",iClothType);
sItemResRefExceptional = CraftLookup("aarcl317",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_DULL"; // Normal Metal Studs - Dull
sComponent2Name = "dull copper metal studs";
}
if (sTag == "P_SHADOWSTUDDED")
{
iTailorChance = iTailorChance - 540;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl320",iClothType);
sItemResRef = CraftLookup("aarcl319",iClothType);
sItemResRefExceptional = CraftLookup("aarcl321",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_SHADOW"; // Normal Metal Studs - Shadow Iron
sComponent2Name = "shadow iron metal studs";
}
if (sTag == "P_COPPERSTUDDED")
{
iTailorChance = iTailorChance - 560;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl324",iClothType);
sItemResRef = CraftLookup("aarcl323",iClothType);
sItemResRefExceptional = CraftLookup("aarcl325",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_COPPER"; // Normal Metal Studs - Copper
sComponent2Name = "copper metal studs";
}
if (sTag == "P_BRONZESTUDDED")
{
iTailorChance = iTailorChance - 580;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl328",iClothType);
sItemResRef = CraftLookup("aarcl327",iClothType);
sItemResRefExceptional = CraftLookup("aarcl329",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_BRONZE"; // Normal Metal Studs - Bronze
sComponent2Name = "bronze metal studs";
}
if (sTag == "P_GOLDSTUDDED")
{
iTailorChance = iTailorChance - 600;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl360",iClothType);
sItemResRef = CraftLookup("aarcl359",iClothType);
sItemResRefExceptional = CraftLookup("aarcl361",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_GOLD"; // Normal Metal Studs - Gold
sComponent2Name = "gold metal studs";
}
if (sTag == "P_AGAPITESTUDDED")
{
iTailorChance = iTailorChance - 650;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl332",iClothType);
sItemResRef = CraftLookup("aarcl331",iClothType);
sItemResRefExceptional = CraftLookup("aarcl333",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_AGAPITE"; // Normal Metal Studs - Agapite
sComponent2Name = "agapite metal studs";
}
if (sTag == "P_VERITESTUDDED")
{
iTailorChance = iTailorChance - 700;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl336",iClothType);
sItemResRef = CraftLookup("aarcl335",iClothType);
sItemResRefExceptional = CraftLookup("aarcl337",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_VERITE"; // Normal Metal Studs - Verite
sComponent2Name = "verite metal studs";
}
if (sTag == "P_VALORITESTUDDED")
{
iTailorChance = iTailorChance - 750;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl340",iClothType);
sItemResRef = CraftLookup("aarcl339",iClothType);
sItemResRefExceptional = CraftLookup("aarcl341",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_VALORITE"; // Normal Metal Studs - Valorite
sComponent2Name = "valorite metal studs";
}
if (sTag == "P_SILVERSTUDDED")
{
iTailorChance = iTailorChance - 520;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl344",iClothType);
sItemResRef = CraftLookup("aarcl343",iClothType);
sItemResRefExceptional = CraftLookup("aarcl345",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_SILVER"; // Normal Metal Studs - Silver
sComponent2Name = "silver metal studs";
}
if (sTag == "P_MITHRILSTUDDED")
{
iTailorChance = iTailorChance - 700;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl348",iClothType);
sItemResRef = CraftLookup("aarcl347",iClothType);
sItemResRefExceptional = CraftLookup("aarcl349",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_MITHRIL"; // Normal Metal Studs - Mithril
sComponent2Name = "mithril metal studs";
}
if (sTag == "P_ADAMANTITESTUDDED")
{
iTailorChance = iTailorChance - 750;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl352",iClothType);
sItemResRef = CraftLookup("aarcl351",iClothType);
sItemResRefExceptional = CraftLookup("aarcl353",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_ADAMANTITE"; // Normal Metal Studs - Adamantite
sComponent2Name = "adamantite metal studs";
}
if (sTag == "P_PLATINUMSTUDDED")
{
iTailorChance = iTailorChance - 650;
sSuccess = "You carefully cut and sew the leather and fasten the metal studs to create studded leather armor.";
sFail = "The studded armor is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("aarcl356",iClothType);
sItemResRef = CraftLookup("aarcl355",iClothType);
sItemResRefExceptional = CraftLookup("aarcl357",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 99;
iComponent2Stackable = 1;
sComponent2 = "ITEM_N_METALSTUD_PLATINUM"; // Normal Metal Studs - Platinum
sComponent2Name = "platinum metal studs";
}
if (sTag == "P_SMALLBAG")
{
iTailorChance = iTailorChance - 510;
sSuccess = "You carefully cut and sew the leather to create a small bag.";
sFail = "The small bag is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("item_bag002",iClothType);
sItemResRef = CraftLookup("item_bag001",iClothType);
sItemResRefExceptional = CraftLookup("item_bag003",iClothType);
iComponent1 = 1;
sComponent1 = "HARDLEATHER_SMALL"; // Hard Leather - Small
sComponent1Name = "small hardened leathers";
iComponent2 = 2;
sComponent2 = "SOFTLEATHER_SMALL"; // Soft Leather - Small
sComponent2Name = "small softened leather";
}
if (sTag == "P_MEDIUMBAG")
{
iTailorChance = iTailorChance - 625;
sSuccess = "You carefully cut and sew the leather to create a medium bag.";
sFail = "The medium bag is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("item_bag011",iClothType);
sItemResRef = CraftLookup("item_bag010",iClothType);
sItemResRefExceptional = CraftLookup("item_bag012",iClothType);
iComponent1 = 1;
sComponent1 = "HARDLEATHER_MEDIUM"; // Hard Leather - Medium
sComponent1Name = "medium hardened leathers";
iComponent2 = 2;
sComponent2 = "SOFTLEATHER_MEDIUM"; // Soft Leather - Medium
sComponent2Name = "medium softened leather";
}
if (sTag == "P_LARGEBAG")
{
iTailorChance = iTailorChance - 750;
sSuccess = "You carefully cut and sew the leather to create a large bag.";
sFail = "The large bag is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("item_bag020",iClothType);
sItemResRef = CraftLookup("item_bag019",iClothType);
sItemResRefExceptional = CraftLookup("item_bag021",iClothType);
iComponent1 = 1;
sComponent1 = "HARDLEATHER_LARGE"; // Hard Leather - Large
sComponent1Name = "large hardened leathers";
iComponent2 = 2;
sComponent2 = "SOFTLEATHER_LARGE"; // Soft Leather - Large
sComponent2Name = "large softened leather";
}
if (sTag == "P_LEATHERGLOVES")
{
iTailorChance = iTailorChance - 400;
sSuccess = "You carefully cut and sew the leather to create a pair of leather gloves.";
sFail = "The leather gloves are ruined in your attempt to craft them.";
sItemResRefPoor = CraftLookup("gloves002",iClothType);
sItemResRef = CraftLookup("gloves001",iClothType);
sItemResRefExceptional = CraftLookup("gloves003",iClothType);
iComponent1 = 4;
sComponent1 = "SOFTLEATHER_TINY"; // Soft Leather - TINY
sComponent1Name = "tiny softened leathers";
}
if (sTag == "P_LEATHERBELT")
{
iTailorChance = iTailorChance - 550;
sSuccess = "You carefully cut and sew the leather to create a leather belt.";
sFail = "The leather belt is ruined in your attempt to craft it.";
sItemResRefPoor = CraftLookup("belt002",iClothType);
sItemResRef = CraftLookup("belt001",iClothType);
sItemResRefExceptional = CraftLookup("belt003",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_SMALL"; // Hard Leather - Small
sComponent1Name = "small hardened leathers";
}
if (sTag == "P_SOFTBOOTS")
{
iTailorChance = iTailorChance - 450;
sSuccess = "You carefully cut and sew the leather to create a pair of soft leather boots.";
sFail = "The boots are ruined in your attempt to craft them.";
sItemResRefPoor = CraftLookup("boots002",iClothType);
sItemResRef = CraftLookup("boots001",iClothType);
sItemResRefExceptional = CraftLookup("boots003",iClothType);
iComponent1 = 2;
sComponent1 = "SOFTLEATHER_MEDIUM"; // Soft Leather - Medium
sComponent1Name = "medium softened leathers";
iComponent2 = 2;
sComponent2 = "HARDLEATHER_TINY"; // Hard Leather - Tiny
sComponent2Name = "tiny hardened leathers";
}
if (sTag == "P_HARDBOOTS")
{
iTailorChance = iTailorChance - 575;
sSuccess = "You carefully cut and sew the leather to create a pair of hard leather boots.";
sFail = "The boots are ruined in your attempt to craft them.";
sItemResRefPoor = CraftLookup("boots011",iClothType);
sItemResRef = CraftLookup("boots010",iClothType);
sItemResRefExceptional = CraftLookup("boots012",iClothType);
iComponent1 = 2;
sComponent1 = "HARDLEATHER_MEDIUM"; // Hard Leather - Medium
sComponent1Name = "medium hardened leathers";
iComponent2 = 2;
sComponent2 = "HARDLEATHER_TINY"; // Hard Leather - Tiny
sComponent2Name = "tiny hardened leathers";
}
if (iClothType==1)
{
if (sComponent1=="HARDLEATHER_LARGE")
{
sComponent1Name = "large hardened black leathers";
sComponent1 = "HARDLEATHER_LARGEBLACK";
}
if (sComponent1=="SOFTLEATHER_LARGE")
{
sComponent1Name = "large softened black leathers";
sComponent1 = "SOFTLEATHER_LARGEBLACK";
}
if (sComponent1=="HARDLEATHER_SMALL")
{
sComponent1Name = "small hardened black leathers";
sComponent1 = "HARDLEATHER_SMALLBLACK";
}
if (sComponent2=="SOFTLEATHER_SMALL")
{
sComponent2Name = "small softened black leathers";
sComponent2 = "SOFTLEATHER_SMALLBLACK";
}
if (sComponent1=="HARDLEATHER_MEDIUM")
{
sComponent1Name = "medium hardened black leathers";
sComponent1 = "HARDLEATHER_MEDIUMBLACK";
}
if (sComponent2=="SOFTLEATHER_MEDIUM")
{
sComponent2Name = "medium softened black leathers";
sComponent2 = "SOFTLEATHER_MEDIUMBLACK";
}
if (sComponent2=="SOFTLEATHER_LARGE")
{
sComponent2Name = "large softened black leathers";
sComponent2 = "SOFTLEATHER_LARGEBLACK";
}
if (sComponent1=="SOFTLEATHER_TINY")
{
sComponent1Name = "tiny softened black leathers";
sComponent1 = "SOFTLEATHER_TINYBLACK";
}
if (sComponent2=="HARDLEATHER_TINY")
{
sComponent2Name = "tiny hardened black leathers";
sComponent2 = "HARDLEATHER_TINYBLACK";
}
}
if (iClothType==2)
{
if (sComponent1=="HARDLEATHER_LARGE")
{
sComponent1Name = "large hardened white leathers";
sComponent1 = "HARDLEATHER_LARGEWHITE";
}
if (sComponent1=="SOFTLEATHER_LARGE")
{
sComponent1Name = "large softened white leathers";
sComponent1 = "SOFTLEATHER_LARGEWHITE";
}
if (sComponent1=="HARDLEATHER_SMALL")
{
sComponent1Name = "small hardened white leathers";
sComponent1 = "HARDLEATHER_SMALLWHITE";
}
if (sComponent2=="SOFTLEATHER_SMALL")
{
sComponent2Name = "small softened white leathers";
sComponent2 = "SOFTLEATHER_SMALLWHITE";
}
if (sComponent1=="HARDLEATHER_MEDIUM")
{
sComponent1Name = "medium hardened white leathers";
sComponent1 = "HARDLEATHER_MEDIUMWHITE";
}
if (sComponent2=="SOFTLEATHER_MEDIUM")
{
sComponent2Name = "medium softened white leathers";
sComponent2 = "SOFTLEATHER_MEDIUMWHITE";
}
if (sComponent2=="SOFTLEATHER_LARGE")
{
sComponent2Name = "large softened white leathers";
sComponent2 = "SOFTLEATHER_LARGEWHITE";
}
if (sComponent1=="SOFTLEATHER_TINY")
{
sComponent1Name = "tiny softened white leathers";
sComponent1 = "SOFTLEATHER_TINYWHITE";
}
if (sComponent2=="HARDLEATHER_TINY")
{
sComponent2Name = "tiny hardened white leathers";
sComponent2 = "HARDLEATHER_TINYWHITE";
}
}
// 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;
}
}
// Set Tailor Desk to 'in use'
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
DelayCommand(12.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
// 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)));
}
}
}
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,12.0));
AssignCommand(oPC,PlaySound("as_cv_shopmetal1"));
AssignCommand(oPC,DelayCommand(3.0,PlaySound("as_cv_shopmetal1")));
AssignCommand(oPC,DelayCommand(6.0,PlaySound("as_cv_shopmetal1")));
AssignCommand(oPC,DelayCommand(9.0,PlaySound("as_cv_shopmetal1")));
PlaySound("as_na_grassmove3");
DelayCommand(6.0,PlaySound("as_na_grassmove3"));
if (Random(800)<=iTailorChance)
{
iSuccess = 1;
iSuccess2 = 1;
iTailorChance = iTailorChance - 50;
if (Random(1000) <= iTailorChance) iSuccess2 = iSuccess2+1;
iTailorChance = iTailorChance-100;
if (Random(1000) <= iTailorChance) iSuccess2 = iSuccess2+1;
iTailorChance = iTailorChance + 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) >= iTailorSkill)
{
if (d10(1)+1 >= iTailorChance/100) iSkillGain = 1;
}
}
else
{
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,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);
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
}
}
// Do skill gains
if (iSkillGain ==1)
{
string sOldSkill = "";
string sOldSkill2 = "";
iTailorSkill++;
sOldSkill2 = IntToString(iTailorSkill);
sOldSkill = "."+GetStringRight(sOldSkill2,1);
if (iTailorSkill > 9)
{
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
}
else
{
sOldSkill = "0"+sOldSkill;
}
if (iTailorSkill <= 1000)
{
//DelayCommand(13.0,SetTokenPair(oPC,13,9,iTailorSkill));
DelayCommand(13.0,SetCampaignInt("UOACraft","iTailorSkill",iTailorSkill,oPC));
DelayCommand(13.0,SendMessageToPC(oPC,"===================================="));
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in tailoring has gone up!"));
DelayCommand(13.0,SendMessageToPC(oPC,"Current tailoring skill : "+ sOldSkill+"%"));
DelayCommand(13.0,SendMessageToPC(oPC,"===================================="));
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
}
}
}
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 iClothType)
{
switch (iClothType)
{
case 1:
{
//Normal Studded Black Leather
if (sResRef=="aarcl310") return "aarcl364";
if (sResRef=="nw_aarcl002") return "aarcl363";
if (sResRef=="aarcl311") return "aarcl365";
//Dull Copper Studded Black Leather
if (sResRef=="aarcl316") return "aarcl367";
if (sResRef=="aarcl315") return "aarcl366";
if (sResRef=="aarcl317") return "aarcl368";
//Shadow Iron Studded Black Leather
if (sResRef=="aarcl320") return "aarcl370";
if (sResRef=="aarcl319") return "aarcl369";
if (sResRef=="aarcl321") return "aarcl371";
//Copper Studded Black Leather
if (sResRef=="aarcl324") return "aarcl373";
if (sResRef=="aarcl323") return "aarcl372";
if (sResRef=="aarcl325") return "aarcl374";
//Bronze Studded Black Leather
if (sResRef=="aarcl328") return "aarcl376";
if (sResRef=="aarcl327") return "aarcl375";
if (sResRef=="aarcl329") return "aarcl377";
//Gold Studded Black Leather
if (sResRef=="aarcl360") return "aarcl379";
if (sResRef=="aarcl359") return "aarcl378";
if (sResRef=="aarcl361") return "aarcl380";
//Agapite Studded Black Leather
if (sResRef=="aarcl332") return "aarcl382";
if (sResRef=="aarcl331") return "aarcl381";
if (sResRef=="aarcl333") return "aarcl383";
//Verite Studded Black Leather
if (sResRef=="aarcl336") return "aarcl385";
if (sResRef=="aarcl335") return "aarcl384";
if (sResRef=="aarcl337") return "aarcl386";
//Valorite Studded Black Leather
if (sResRef=="aarcl340") return "aarcl388";
if (sResRef=="aarcl339") return "aarcl387";
if (sResRef=="aarcl341") return "aarcl389";
//Silver Studded Black Leather
if (sResRef=="aarcl344") return "aarcl391";
if (sResRef=="aarcl343") return "aarcl390";
if (sResRef=="aarcl345") return "aarcl392";
//Mithril Studded Black Leather
if (sResRef=="aarcl348") return "aarcl394";
if (sResRef=="aarcl347") return "aarcl393";
if (sResRef=="aarcl349") return "aarcl395";
//Adamantite Studded Black Leather
if (sResRef=="aarcl352") return "aarcl397";
if (sResRef=="aarcl351") return "aarcl396";
if (sResRef=="aarcl353") return "aarcl398";
//Platinum Studded Black Leather
if (sResRef=="aarcl356") return "aarcl400";
if (sResRef=="aarcl355") return "aarcl399";
if (sResRef=="aarcl357") return "aarcl401";
//Black Leather Armor
if (sResRef=="aarcl002") return "aarcl442";
if (sResRef=="nw_aarcl001") return "aarcl441";
if (sResRef=="aarcl003") return "aarcl443";
//Black Padded Armor
if (sResRef=="aarcl308") return "aarcl448";
if (sResRef=="nw_aarcl001") return "aarcl447";
if (sResRef=="aarcl309") return "aarcl449";
//Small Black Leather Bag
if (sResRef=="item_bag002") return "item_bag005";
if (sResRef=="item_bag001") return "item_bag004";
if (sResRef=="item_bag003") return "item_bag006";
//Medium Black Leather Bag
if (sResRef=="item_bag011") return "item_bag014";
if (sResRef=="item_bag010") return "item_bag013";
if (sResRef=="item_bag012") return "item_bag015";
//Large Black Leather Bag
if (sResRef=="item_bag020") return "item_bag023";
if (sResRef=="item_bag019") return "item_bag022";
if (sResRef=="item_bag021") return "item_bag024";
//Black Leather Gloves
if (sResRef=="gloves002") return "gloves005";
if (sResRef=="gloves001") return "gloves004";
if (sResRef=="gloves003") return "gloves006";
//Black Leather Belt
if (sResRef=="belt002") return "belt005";
if (sResRef=="belt001") return "belt004";
if (sResRef=="belt003") return "belt006";
//Soft Black Leather Boots
if (sResRef=="boots002") return "boots005";
if (sResRef=="boots001") return "boots004";
if (sResRef=="boots003") return "boots006";
//Hard Black Leather Boots
if (sResRef=="boots011") return "boots014";
if (sResRef=="boots010") return "boots013";
if (sResRef=="boots012") return "boots015";
break;
}
case 2:
{
//Normal Studded White Leather
if (sResRef=="aarcl310") return "aarcl403";
if (sResRef=="nw_aarcl002") return "aarcl402";
if (sResRef=="aarcl311") return "aarcl404";
//Dull Copper Studded White Leather
if (sResRef=="aarcl316") return "aarcl406";
if (sResRef=="aarcl315") return "aarcl405";
if (sResRef=="aarcl317") return "aarcl407";
//Shadow Iron Studded White Leather
if (sResRef=="aarcl320") return "aarcl409";
if (sResRef=="aarcl319") return "aarcl408";
if (sResRef=="aarcl321") return "aarcl410";
//Copper Studded White Leather
if (sResRef=="aarcl324") return "aarcl412";
if (sResRef=="aarcl323") return "aarcl411";
if (sResRef=="aarcl325") return "aarcl413";
//Bronze Studded White Leather
if (sResRef=="aarcl328") return "aarcl415";
if (sResRef=="aarcl327") return "aarcl414";
if (sResRef=="aarcl329") return "aarcl416";
//Gold Studded White Leather
if (sResRef=="aarcl360") return "aarcl418";
if (sResRef=="aarcl359") return "aarcl417";
if (sResRef=="aarcl361") return "aarcl419";
//Agapite Studded White Leather
if (sResRef=="aarcl332") return "aarcl421";
if (sResRef=="aarcl331") return "aarcl420";
if (sResRef=="aarcl333") return "aarcl422";
//Verite Studded White Leather
if (sResRef=="aarcl336") return "aarcl424";
if (sResRef=="aarcl335") return "aarcl423";
if (sResRef=="aarcl337") return "aarcl425";
//Valorite Studded White Leather
if (sResRef=="aarcl340") return "aarcl427";
if (sResRef=="aarcl339") return "aarcl426";
if (sResRef=="aarcl341") return "aarcl428";
//Silver Studded White Leather
if (sResRef=="aarcl344") return "aarcl430";
if (sResRef=="aarcl343") return "aarcl429";
if (sResRef=="aarcl345") return "aarcl431";
//Mithril Studded White Leather
if (sResRef=="aarcl348") return "aarcl433";
if (sResRef=="aarcl347") return "aarcl432";
if (sResRef=="aarcl349") return "aarcl434";
//Adamantite Studded White Leather
if (sResRef=="aarcl352") return "aarcl436";
if (sResRef=="aarcl351") return "aarcl435";
if (sResRef=="aarcl353") return "aarcl437";
//Platinum Studded White Leather
if (sResRef=="aarcl356") return "aarcl439";
if (sResRef=="aarcl355") return "aarcl438";
if (sResRef=="aarcl357") return "aarcl440";
//White Leather Armor
if (sResRef=="aarcl002") return "aarcl445";
if (sResRef=="nw_aarcl001") return "aarcl444";
if (sResRef=="aarcl003") return "aarcl446";
//White Padded Armor
if (sResRef=="aarcl308") return "aarcl451";
if (sResRef=="nw_aarcl001") return "aarcl450";
if (sResRef=="aarcl309") return "aarcl452";
//Small White Leather Bag
if (sResRef=="item_bag002") return "item_bag008";
if (sResRef=="item_bag001") return "item_bag007";
if (sResRef=="item_bag003") return "item_bag009";
//Medium White Leather Bag
if (sResRef=="item_bag011") return "item_bag017";
if (sResRef=="item_bag010") return "item_bag016";
if (sResRef=="item_bag012") return "item_bag018";
//Large White Leather Bag
if (sResRef=="item_bag020") return "item_bag026";
if (sResRef=="item_bag019") return "item_bag025";
if (sResRef=="item_bag021") return "item_bag027";
//White Leather Gloves
if (sResRef=="gloves002") return "gloves008";
if (sResRef=="gloves001") return "gloves007";
if (sResRef=="gloves003") return "gloves009";
//White Leather Belt
if (sResRef=="belt002") return "belt008";
if (sResRef=="belt001") return "belt007";
if (sResRef=="belt003") return "belt009";
//Soft White Leather Boots
if (sResRef=="boots002") return "boots008";
if (sResRef=="boots001") return "boots007";
if (sResRef=="boots003") return "boots009";
//Hard White Leather Boots
if (sResRef=="boots011") return "boots017";
if (sResRef=="boots010") return "boots016";
if (sResRef=="boots012") return "boots018";
break;
}
default:
{
return sResRef;
break;
}
}
return sResRef;
}