Fixed CCOH, Fixed starting GP, Fixed DMFI languages, Fix cep weapon appearances, Fixed new player start up system. Added PC deleter. Added ACP 4.1. Full compile. Updated release archive.
873 lines
32 KiB
Plaintext
873 lines
32 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,"iUseClothType");
|
|
int iPenalty = iClothType*300;
|
|
string sComponent1 = "";
|
|
string sComponent2 = "";
|
|
string sComponent3 = "";
|
|
string sComponentPre = "CLOTH_DYED_";
|
|
string sComponent1Name = "";
|
|
string sComponent2Name = "";
|
|
string sComponent3Name = "";
|
|
string sComponentResRef = "";
|
|
object oTemp = OBJECT_INVALID;
|
|
|
|
if (iClothType==0) sComponentPre=sComponentPre+"NORMAL_";
|
|
if (iClothType==1) sComponentPre=sComponentPre+"WOOL_";
|
|
if (iClothType==2) sComponentPre=sComponentPre+"SILK_";
|
|
|
|
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_CLOTH1")
|
|
{
|
|
SetLocalInt(oPC,"iUseClothType",0);
|
|
FloatingTextStringOnCreature("Now using normal cloth...",oPC,FALSE);
|
|
}
|
|
if (sTag == "SWITCH_CLOTH2")
|
|
{
|
|
SetLocalInt(oPC,"iUseClothType",1);
|
|
FloatingTextStringOnCreature("Now using wool cloth...",oPC,FALSE);
|
|
}
|
|
if (sTag == "SWITCH_CLOTH3")
|
|
{
|
|
SetLocalInt(oPC,"iUseClothType",2);
|
|
FloatingTextStringOnCreature("Now using silk cloth...",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;
|
|
}
|
|
|
|
// Default values
|
|
sSuccess = "You carefully cut and sew the cloth to create the clothing.";
|
|
sFail = "You manage to mangle the cloth as you attempt to craft the clothes.";
|
|
iComponent1 = 1;
|
|
sComponent1 = "ITEM_CLOTH_NORMAL"; // Normal Undyed Cloth
|
|
sComponent1Name = "bolts of normal undyed cloth";
|
|
|
|
// Begin Crafting Test
|
|
if (sTag == "P_CLOTHING_ADEPT")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth028",iClothType);
|
|
sItemResRef = CraftLookup("cloth036",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth030",iClothType);
|
|
sComponent1 = sComponentPre+"BROWN"; // Normal Brown Cloth
|
|
sComponent1Name = "bolts of brown dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_ASSASSIN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth018",iClothType);
|
|
sItemResRef = CraftLookup("cloth019",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth020",iClothType);
|
|
sComponent1 = sComponentPre+"BLACK";
|
|
sComponent1Name = "bolts of black dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_BARBARIAN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth016",iClothType);
|
|
sItemResRef = CraftLookup("cloth017",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth027",iClothType);
|
|
sComponent1 = sComponentPre+"BRONZE"; //
|
|
sComponent1Name = "bolts of bronze dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_BARD")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth043",iClothType);
|
|
sItemResRef = CraftLookup("cloth044",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth045",iClothType);
|
|
sComponent1 = sComponentPre+"RUST";
|
|
sComponent1Name = "bolts of rusty dyed cloth"; //
|
|
}
|
|
if (sTag == "P_CLOTHING_COMMONER1") // Commonder's Outfit
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth052",iClothType);
|
|
sItemResRef = CraftLookup("cloth053",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth054",iClothType);
|
|
sComponent1 = sComponentPre+"TAN"; //
|
|
sComponent1Name = "bolts of tan dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_COMMONER2") // Commoner's Tunic
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth061",iClothType);
|
|
sItemResRef = CraftLookup("cloth062",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth063",iClothType);
|
|
sComponent1 = sComponentPre+"DARKBLUE"; //
|
|
sComponent1Name = "bolts of dark blue dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_CONJUR")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth013",iClothType);
|
|
sItemResRef = CraftLookup("cloth014",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth015",iClothType);
|
|
sComponent1 = sComponentPre+"PURPLE"; //
|
|
sComponent1Name = "bolts of purple dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_GLADIATOR")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth012",iClothType);
|
|
sItemResRef = CraftLookup("cloth076",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth077",iClothType);
|
|
sComponent1 = sComponentPre+"CHARCOAL"; //
|
|
sComponent1Name = "bolts of charcoal dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_ILLUSIONIST")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth084",iClothType);
|
|
sItemResRef = CraftLookup("cloth085",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth086",iClothType);
|
|
sComponent1 = sComponentPre+"BLUE"; //
|
|
sComponent1Name = "bolts of blue dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_JESTER")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth093",iClothType);
|
|
sItemResRef = CraftLookup("cloth094",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth095",iClothType);
|
|
sComponent1 = sComponentPre+"CHROMATIC"; //
|
|
sComponent1Name = "bolts of chromatic dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_MONK")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth102",iClothType);
|
|
sItemResRef = CraftLookup("cloth103",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth104",iClothType);
|
|
sComponent1 = sComponentPre+"TAN"; //
|
|
sComponent1Name = "bolts of tan dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_NECROMANCER")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth111",iClothType);
|
|
sItemResRef = CraftLookup("cloth112",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth113",iClothType);
|
|
sComponent1 = sComponentPre+"BLACK"; //
|
|
sComponent1Name = "bolts of black dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_NBLGUARD")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth120",iClothType);
|
|
sItemResRef = CraftLookup("cloth121",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth122",iClothType);
|
|
sComponent1 = sComponentPre+"METALLIC"; //
|
|
sComponent1Name = "bolts of metcallic dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_NOBLE") //Noble's Outfit
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth004",iClothType);
|
|
sItemResRef = CraftLookup("cloth005",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth006",iClothType);
|
|
sComponent1 = sComponentPre+"DARKBLUE"; //
|
|
sComponent1Name = "bolts of dark blue dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_NOBLE2") //Noble's Tunic
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth130",iClothType);
|
|
sItemResRef = CraftLookup("cloth131",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth132",iClothType);
|
|
sComponent1 = sComponentPre+"DARKBLUE"; //
|
|
sComponent1Name = "bolts of dark blue dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_PALADIN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth139",iClothType);
|
|
sItemResRef = CraftLookup("cloth140",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth141",iClothType);
|
|
sComponent1 = sComponentPre+"SMOKE"; //
|
|
sComponent1Name = "bolts of smoky dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_PERFORMER")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth003",iClothType);
|
|
sItemResRef = CraftLookup("cloth148",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth149",iClothType);
|
|
sComponent1 = sComponentPre+"PINK"; //
|
|
sComponent1Name = "bolts of pink dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_PRIEST")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth156",iClothType);
|
|
sItemResRef = CraftLookup("cloth157",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth158",iClothType);
|
|
sComponent1 = sComponentPre+"OLIVE"; //
|
|
sComponent1Name = "bolts of olive dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_ROGUE")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth165",iClothType);
|
|
sItemResRef = CraftLookup("cloth166",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth167",iClothType);
|
|
sComponent1 = sComponentPre+"CHARCOAL"; //
|
|
sComponent1Name = "bolts of charcoal dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_SOLDIER")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth174",iClothType);
|
|
sItemResRef = CraftLookup("cloth175",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth176",iClothType);
|
|
sComponent1 = sComponentPre+"METALLIC"; //
|
|
sComponent1Name = "bolts of metallic dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_SORCERER")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth183",iClothType);
|
|
sItemResRef = CraftLookup("cloth184",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth185",iClothType);
|
|
sComponent1 = sComponentPre+"BLUE"; //
|
|
sComponent1Name = "bolts of blue dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_SQUIRE")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth192",iClothType);
|
|
sItemResRef = CraftLookup("cloth193",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth194",iClothType);
|
|
sComponent1 = sComponentPre+"CHARCOAL"; //
|
|
sComponent1Name = "bolts of charcoal dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_URCHIN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth201",iClothType);
|
|
sItemResRef = CraftLookup("cloth202",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth203",iClothType);
|
|
sComponent1 = "ITEM_CLOTH_NORMAL_RUINED"; //
|
|
if (iClothType==1) sComponent1 = "ITEM_CLOTH_WOOL_RUINED";
|
|
if (iClothType==2) sComponent1 = "ITEM_CLOTH_SILK_RUINED";
|
|
sComponent1Name = "bolts of ruined cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_VAGABOND")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth210",iClothType);
|
|
sItemResRef = CraftLookup("cloth211",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth212",iClothType);
|
|
sComponent1 = "ITEM_CLOTH_NORMAL_RUINED"; //
|
|
if (iClothType==1) sComponent1 = "ITEM_CLOTH_WOOL_RUINED";
|
|
if (iClothType==2) sComponent1 = "ITEM_CLOTH_SILK_RUINED";
|
|
sComponent1Name = "bolts of ruined cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_VETERAN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth219",iClothType);
|
|
sItemResRef = CraftLookup("cloth220",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth221",iClothType);
|
|
sComponent1 = sComponentPre+"OLIVE"; //
|
|
sComponent1Name = "bolts of olive dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_WARRIOR")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth228",iClothType);
|
|
sItemResRef = CraftLookup("cloth229",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth230",iClothType);
|
|
sComponent1 = sComponentPre+"CHARCOAL"; //
|
|
sComponent1Name = "bolts of charcoal dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_WIZARD")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth237",iClothType);
|
|
sItemResRef = CraftLookup("cloth238",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth239",iClothType);
|
|
sComponent1 = sComponentPre+"PURPLE"; //
|
|
sComponent1Name = "bolts of purple dyed cloth";
|
|
}
|
|
if (sTag == "P_CLOTHING_WOODSMAN")
|
|
{
|
|
//iTailorChance = iTailorChance - 200;
|
|
sItemResRefPoor = CraftLookup("cloth002",iClothType);
|
|
sItemResRef = CraftLookup("cloth237",iClothType);
|
|
sItemResRefExceptional = CraftLookup("cloth238",iClothType);
|
|
sComponent1 = sComponentPre+"COPPER"; //
|
|
sComponent1Name = "bolts of copper dyed cloth";
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
|
}
|
|
}
|
|
|
|
iTailorChance = iTailorChance - iPenalty;
|
|
if (iTailorChance<1)
|
|
{
|
|
FloatingTextStringOnCreature("You have no idea how to craft this item from the selected material...",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 Cloth
|
|
{
|
|
// Wool Adept's Tunic
|
|
if (sResRef=="cloth028") return "cloth031";
|
|
if (sResRef=="cloth036") return "cloth029";
|
|
if (sResRef=="cloth030") return "cloth032";
|
|
// Wool Assassin's Garb
|
|
if (sResRef=="cloth018") return "cloth021";
|
|
if (sResRef=="cloth019") return "cloth022";
|
|
if (sResRef=="cloth020") return "cloth023";
|
|
// Wool Barbarian's Outfit
|
|
if (sResRef=="cloth016") return "cloth037";
|
|
if (sResRef=="cloth017") return "cloth038";
|
|
if (sResRef=="cloth027") return "cloth039";
|
|
// Wool Bard's Tunic
|
|
if (sResRef=="cloth043") return "cloth046";
|
|
if (sResRef=="cloth044") return "cloth047";
|
|
if (sResRef=="cloth045") return "cloth048";
|
|
// Wool Commoner's Outfit
|
|
if (sResRef=="cloth052") return "cloth055";
|
|
if (sResRef=="cloth053") return "cloth056";
|
|
if (sResRef=="cloth054") return "cloth057";
|
|
// Wool Commoner's Tunic
|
|
if (sResRef=="cloth061") return "cloth064";
|
|
if (sResRef=="cloth062") return "cloth065";
|
|
if (sResRef=="cloth063") return "cloth066";
|
|
// Wool Conjurer's Robe
|
|
if (sResRef=="cloth013") return "cloth070";
|
|
if (sResRef=="cloth014") return "cloth071";
|
|
if (sResRef=="cloth015") return "cloth072";
|
|
// Wool Gladiator's Outfit
|
|
if (sResRef=="cloth012") return "cloth078";
|
|
if (sResRef=="cloth076") return "cloth079";
|
|
if (sResRef=="cloth077") return "cloth080";
|
|
// Wool Illusionist's Robe
|
|
if (sResRef=="cloth084") return "cloth087";
|
|
if (sResRef=="cloth085") return "cloth088";
|
|
if (sResRef=="cloth086") return "cloth089";
|
|
// Wool Jester's Outfit
|
|
if (sResRef=="cloth093") return "cloth096";
|
|
if (sResRef=="cloth094") return "cloth097";
|
|
if (sResRef=="cloth095") return "cloth098";
|
|
// Wool Monk's Outfit
|
|
if (sResRef=="cloth102") return "cloth105";
|
|
if (sResRef=="cloth103") return "cloth106";
|
|
if (sResRef=="cloth104") return "cloth107";
|
|
// Wool Necromancer's Robe
|
|
if (sResRef=="cloth111") return "cloth114";
|
|
if (sResRef=="cloth112") return "cloth115";
|
|
if (sResRef=="cloth113") return "cloth116";
|
|
// Wool Noble-Guardsman's Tunic
|
|
if (sResRef=="cloth120") return "cloth123";
|
|
if (sResRef=="cloth121") return "cloth124";
|
|
if (sResRef=="cloth122") return "cloth125";
|
|
// Wool Noble's Outfit
|
|
if (sResRef=="cloth004") return "cloth007";
|
|
if (sResRef=="cloth005") return "cloth008";
|
|
if (sResRef=="cloth006") return "cloth009";
|
|
// Wool Noble's Tunic
|
|
if (sResRef=="cloth130") return "cloth133";
|
|
if (sResRef=="cloth131") return "cloth134";
|
|
if (sResRef=="cloth132") return "cloth135";
|
|
// Wool Paladin's Tunic
|
|
if (sResRef=="cloth139") return "cloth142";
|
|
if (sResRef=="cloth140") return "cloth143";
|
|
if (sResRef=="cloth141") return "cloth144";
|
|
// Wool Performer's Outfit
|
|
if (sResRef=="cloth003") return "cloth150";
|
|
if (sResRef=="cloth148") return "cloth151";
|
|
if (sResRef=="cloth149") return "cloth152";
|
|
// Wool Priest's Robe
|
|
if (sResRef=="cloth156") return "cloth159";
|
|
if (sResRef=="cloth157") return "cloth160";
|
|
if (sResRef=="cloth158") return "cloth161";
|
|
// Wool Rogue's Tunic
|
|
if (sResRef=="cloth165") return "cloth168";
|
|
if (sResRef=="cloth166") return "cloth169";
|
|
if (sResRef=="cloth167") return "cloth170";
|
|
// Wool Soldier's Uniform
|
|
if (sResRef=="cloth174") return "cloth177";
|
|
if (sResRef=="cloth175") return "cloth178";
|
|
if (sResRef=="cloth176") return "cloth179";
|
|
// Wool Sorcerer's Robe
|
|
if (sResRef=="cloth183") return "cloth186";
|
|
if (sResRef=="cloth184") return "cloth187";
|
|
if (sResRef=="cloth185") return "cloth188";
|
|
// Wool Squire's Tunic
|
|
if (sResRef=="cloth192") return "cloth195";
|
|
if (sResRef=="cloth193") return "cloth196";
|
|
if (sResRef=="cloth194") return "cloth197";
|
|
// Wool Urchin's Rags
|
|
if (sResRef=="cloth201") return "cloth204";
|
|
if (sResRef=="cloth202") return "cloth205";
|
|
if (sResRef=="cloth203") return "cloth206";
|
|
// Wool Vagabond's Rags
|
|
if (sResRef=="cloth210") return "cloth213";
|
|
if (sResRef=="cloth211") return "cloth214";
|
|
if (sResRef=="cloth212") return "cloth215";
|
|
// Wool Veteran's Outfit
|
|
if (sResRef=="cloth219") return "cloth222";
|
|
if (sResRef=="cloth220") return "cloth223";
|
|
if (sResRef=="cloth221") return "cloth224";
|
|
// Wool Warrior's Tunic
|
|
if (sResRef=="cloth228") return "cloth231";
|
|
if (sResRef=="cloth229") return "cloth232";
|
|
if (sResRef=="cloth230") return "cloth233";
|
|
// Wool Wizard's Robe
|
|
if (sResRef=="cloth237") return "cloth240";
|
|
if (sResRef=="cloth238") return "cloth241";
|
|
if (sResRef=="cloth239") return "cloth242";
|
|
// Wool Woodsman's Outfit
|
|
if (sResRef=="cloth002") return "cloth248";
|
|
if (sResRef=="cloth246") return "cloth249";
|
|
if (sResRef=="cloth247") return "cloth250";
|
|
break;
|
|
}
|
|
case 2: // Silk Cloth
|
|
{
|
|
// Silk Adept's Tunic
|
|
if (sResRef=="cloth028") return "cloth033";
|
|
if (sResRef=="cloth036") return "cloth034";
|
|
if (sResRef=="cloth030") return "cloth035";
|
|
// Silk Assassin's Garb
|
|
if (sResRef=="cloth018") return "cloth024";
|
|
if (sResRef=="cloth019") return "cloth025";
|
|
if (sResRef=="cloth020") return "cloth026";
|
|
// Silk Barbarian's Outfit
|
|
if (sResRef=="cloth016") return "cloth040";
|
|
if (sResRef=="cloth017") return "cloth041";
|
|
if (sResRef=="cloth027") return "cloth042";
|
|
// Silk Bard's Tunic
|
|
if (sResRef=="cloth043") return "cloth049";
|
|
if (sResRef=="cloth044") return "cloth050";
|
|
if (sResRef=="cloth045") return "cloth051";
|
|
// Silk Commoner's Outfit
|
|
if (sResRef=="cloth052") return "cloth058";
|
|
if (sResRef=="cloth053") return "cloth059";
|
|
if (sResRef=="cloth054") return "cloth060";
|
|
// Silk Commoner's Tunic
|
|
if (sResRef=="cloth061") return "cloth067";
|
|
if (sResRef=="cloth062") return "cloth068";
|
|
if (sResRef=="cloth063") return "cloth069";
|
|
// Silk Conjurer's Robe
|
|
if (sResRef=="cloth013") return "cloth073";
|
|
if (sResRef=="cloth014") return "cloth074";
|
|
if (sResRef=="cloth015") return "cloth075";
|
|
// Silk Gladiator's Outfit
|
|
if (sResRef=="cloth012") return "cloth081";
|
|
if (sResRef=="cloth076") return "cloth082";
|
|
if (sResRef=="cloth077") return "cloth083";
|
|
// Silk Illusionist's Robe
|
|
if (sResRef=="cloth084") return "cloth090";
|
|
if (sResRef=="cloth085") return "cloth091";
|
|
if (sResRef=="cloth086") return "cloth092";
|
|
// Silk Jester's Outfit
|
|
if (sResRef=="cloth093") return "cloth099";
|
|
if (sResRef=="cloth094") return "cloth100";
|
|
if (sResRef=="cloth095") return "cloth101";
|
|
// Silk Monk's Outfit
|
|
if (sResRef=="cloth102") return "cloth108";
|
|
if (sResRef=="cloth103") return "cloth109";
|
|
if (sResRef=="cloth104") return "cloth110";
|
|
// Silk Necromancer's Robe
|
|
if (sResRef=="cloth111") return "cloth117";
|
|
if (sResRef=="cloth112") return "cloth118";
|
|
if (sResRef=="cloth113") return "cloth119";
|
|
// Silk Noble-Guardsman's Tunic
|
|
if (sResRef=="cloth120") return "cloth126";
|
|
if (sResRef=="cloth121") return "cloth127";
|
|
if (sResRef=="cloth122") return "cloth128";
|
|
// Silk Noble's Outfit
|
|
if (sResRef=="cloth004") return "cloth010";
|
|
if (sResRef=="cloth005") return "cloth011";
|
|
if (sResRef=="cloth006") return "cloth129";
|
|
// Silk Noble's Tunic
|
|
if (sResRef=="cloth130") return "cloth136";
|
|
if (sResRef=="cloth131") return "cloth137";
|
|
if (sResRef=="cloth132") return "cloth138";
|
|
// Silk Paladin's Tunic
|
|
if (sResRef=="cloth139") return "cloth145";
|
|
if (sResRef=="cloth140") return "cloth146";
|
|
if (sResRef=="cloth141") return "cloth147";
|
|
// Silk Performer's Outfit
|
|
if (sResRef=="cloth003") return "cloth153";
|
|
if (sResRef=="cloth148") return "cloth154";
|
|
if (sResRef=="cloth149") return "cloth155";
|
|
// Silk Priest's Robe
|
|
if (sResRef=="cloth156") return "cloth162";
|
|
if (sResRef=="cloth157") return "cloth163";
|
|
if (sResRef=="cloth158") return "cloth164";
|
|
// Silk Rogue's Tunic
|
|
if (sResRef=="cloth165") return "cloth171";
|
|
if (sResRef=="cloth166") return "cloth172";
|
|
if (sResRef=="cloth167") return "cloth173";
|
|
// Silk Soldier's Uniform
|
|
if (sResRef=="cloth174") return "cloth180";
|
|
if (sResRef=="cloth175") return "cloth181";
|
|
if (sResRef=="cloth176") return "cloth182";
|
|
// Silk Sorcerer's Robe
|
|
if (sResRef=="cloth183") return "cloth189";
|
|
if (sResRef=="cloth184") return "cloth190";
|
|
if (sResRef=="cloth185") return "cloth191";
|
|
// Silk Squire's Tunic
|
|
if (sResRef=="cloth192") return "cloth198";
|
|
if (sResRef=="cloth193") return "cloth199";
|
|
if (sResRef=="cloth194") return "cloth200";
|
|
// Silk Urchin's Rags
|
|
if (sResRef=="cloth201") return "cloth207";
|
|
if (sResRef=="cloth202") return "cloth208";
|
|
if (sResRef=="cloth203") return "cloth209";
|
|
// Silk Vagabond's Rags
|
|
if (sResRef=="cloth210") return "cloth216";
|
|
if (sResRef=="cloth211") return "cloth217";
|
|
if (sResRef=="cloth212") return "cloth218";
|
|
// Silk Veteran's Outfit
|
|
if (sResRef=="cloth219") return "cloth225";
|
|
if (sResRef=="cloth220") return "cloth226";
|
|
if (sResRef=="cloth221") return "cloth227";
|
|
// Silk Warrior's Tunic
|
|
if (sResRef=="cloth228") return "cloth234";
|
|
if (sResRef=="cloth229") return "cloth235";
|
|
if (sResRef=="cloth230") return "cloth236";
|
|
// Silk Wizard's Robe
|
|
if (sResRef=="cloth237") return "cloth243";
|
|
if (sResRef=="cloth238") return "cloth244";
|
|
if (sResRef=="cloth239") return "cloth245";
|
|
// Silk Woodsman's Outfit
|
|
if (sResRef=="cloth002") return "cloth251";
|
|
if (sResRef=="cloth246") return "cloth252";
|
|
if (sResRef=="cloth247") return "cloth253";
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
return sResRef;
|
|
break;
|
|
}
|
|
}
|
|
return sResRef;
|
|
}
|