2024-06-14 10:48:20 -04:00
|
|
|
#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 GetComponent(int iWoodType);
|
|
|
|
string GetComponentName(int iWoodType);
|
|
|
|
string CraftLookup(string sResRef, int iWoodType);
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
object oSelf = OBJECT_SELF;
|
|
|
|
object oItem = GetInventoryDisturbItem();
|
|
|
|
object oPC = GetLastDisturbed();
|
|
|
|
string sTag = GetTag(oItem);
|
|
|
|
string sSuccess = "";
|
|
|
|
string sFail = "";
|
|
|
|
string sItemResRef = "";
|
|
|
|
string sItemResRefPoor = "";
|
|
|
|
string sItemResRefExceptional = "";
|
|
|
|
int iRandom = 0;
|
|
|
|
int iSuccess = 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 iWoodType = GetLocalInt(oPC,"iUseThisWood"); // Credit to Lau3 for reporting this spacing error "iUseThis Wood".
|
|
|
|
int iPenalty = iWoodType*10;
|
|
|
|
int iDifficulty = 0;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GetStringLeft(GetResRef(oItem),10)=="flagswitch")
|
|
|
|
{
|
|
|
|
if (sTag == "SWITCH_WOOD1") SetLocalInt(oPC,"iUseThisWood",0);
|
|
|
|
if (sTag == "SWITCH_WOOD2") SetLocalInt(oPC,"iUseThisWood",1);
|
|
|
|
if (sTag == "SWITCH_WOOD3") SetLocalInt(oPC,"iUseThisWood",2);
|
|
|
|
if (sTag == "SWITCH_WOOD4") SetLocalInt(oPC,"iUseThisWood",3);
|
|
|
|
if (sTag == "SWITCH_WOOD5") SetLocalInt(oPC,"iUseThisWood",4);
|
|
|
|
if (sTag == "SWITCH_WOOD6") SetLocalInt(oPC,"iUseThisWood",5);
|
|
|
|
if (sTag == "SWITCH_WOOD7") SetLocalInt(oPC,"iUseThisWood",6);
|
|
|
|
if (sTag == "SWITCH_WOOD8") SetLocalInt(oPC,"iUseThisWood",7);
|
|
|
|
if (sTag == "SWITCH_WOOD9") SetLocalInt(oPC,"iUseThisWood",8);
|
|
|
|
if (sTag == "SWITCH_WOOD10") SetLocalInt(oPC,"iUseThisWood",9);
|
|
|
|
if (sTag == "SWITCH_WOOD11") SetLocalInt(oPC,"iUseThisWood",10);
|
|
|
|
if (sTag == "SWITCH_WOOD12") SetLocalInt(oPC,"iUseThisWood",11);
|
|
|
|
if (sTag == "SWITCH_WOOD13") SetLocalInt(oPC,"iUseThisWood",12);
|
|
|
|
if (sTag == "SWITCH_WOOD14") SetLocalInt(oPC,"iUseThisWood",13);
|
|
|
|
if (sTag == "SWITCH_WOOD15") SetLocalInt(oPC,"iUseThisWood",14);
|
|
|
|
if (sTag == "SWITCH_WOOD16") SetLocalInt(oPC,"iUseThisWood",15);
|
|
|
|
if (sTag == "SWITCH_WOOD17") SetLocalInt(oPC,"iUseThisWood",16);
|
|
|
|
if (sTag == "SWITCH_WOOD18") SetLocalInt(oPC,"iUseThisWood",17);
|
|
|
|
if (sTag == "SWITCH_WOOD19") SetLocalInt(oPC,"iUseThisWood",18);
|
|
|
|
string sWoodMessage = "Switching wood types. now set to "+GetStringLowerCase(GetName(oItem))+".";
|
|
|
|
FloatingTextStringOnCreature(sWoodMessage,oPC,FALSE);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GetStringLeft(GetResRef(oItem),7)!="pattern") return;
|
|
|
|
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
|
|
|
|
DestroyObject(oItem);
|
|
|
|
|
|
|
|
if (GetItemPossessedBy(oPC,"Carpenters_Tools")==OBJECT_INVALID)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC,"You must have carpenters tools in order to create anything here.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC,"You must wait till the current club, quarterstaff, or torch is completed before starting another.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-09-16 23:40:48 -04:00
|
|
|
int iCarpentrySkill = GetCampaignInt("UOACraft","iCarpentrySkill",oPC);
|
2024-06-14 10:48:20 -04:00
|
|
|
int iCarpentryChance = iCarpentrySkill;
|
|
|
|
|
|
|
|
|
|
|
|
if (GetItemPossessedBy(oPC,"NoDrop_SkillLogBook")==OBJECT_INVALID)
|
|
|
|
{
|
|
|
|
CreateItemOnObject("skilllogbook",oPC,1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iCarpentryChance < 350)
|
|
|
|
{
|
|
|
|
iCarpentryChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
|
|
|
|
iCarpentryChance = iCarpentryChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
|
|
|
iCarpentryChance = iCarpentryChance+(GetAbilityScore(oPC,ABILITY_CONSTITUTION)*2);
|
|
|
|
iCarpentryChance = iCarpentryChance*3;
|
|
|
|
if (iCarpentryChance>350)iCarpentryChance=350;
|
|
|
|
if (iCarpentrySkill > iCarpentryChance) iCarpentryChance=iCarpentrySkill;
|
|
|
|
}
|
|
|
|
|
|
|
|
iCarpentryChance = iCarpentryChance - iPenalty;
|
|
|
|
|
|
|
|
|
|
|
|
if (sTag == "pattern103") //club
|
|
|
|
{
|
|
|
|
iPenalty=200;
|
|
|
|
sSuccess = "You successfully form and shape the wood into a club.";
|
|
|
|
sFail = "You are unable to shape and form the wood properly, and the club is ruined.";
|
|
|
|
sItemResRefPoor = CraftLookup("wblcl002",iWoodType);
|
|
|
|
sItemResRef = CraftLookup("nw_wblcl001",iWoodType);
|
|
|
|
sItemResRefExceptional = CraftLookup("wblcl003",iWoodType);
|
|
|
|
sComponent1 = GetComponent(iWoodType);
|
|
|
|
iComponent1 = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sTag == "pattern104") //quarterstaff
|
|
|
|
{
|
|
|
|
iPenalty = 300;
|
|
|
|
sSuccess = "You successfully form and shape the wood into a quarterstaff.";
|
|
|
|
sFail = "You are unable to shape and form the wood properly, and the quarterstaff is ruined.";
|
|
|
|
sItemResRefPoor = CraftLookup("wdbqs002",iWoodType);
|
|
|
|
sItemResRef = CraftLookup("nw_wdbqs001",iWoodType);
|
|
|
|
sItemResRefExceptional = CraftLookup("wdbqs003",iWoodType);
|
|
|
|
sComponent1 = GetComponent(iWoodType);
|
|
|
|
iComponent1 = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sTag == "pattern109") //torches
|
|
|
|
{
|
|
|
|
iDifficulty = -50; //bonus of 5.0 skill to make torches
|
|
|
|
sSuccess = "You successfully form and shape the wood, combining the straw and tar into torches.";
|
|
|
|
sFail = "You are unable to create the torches, instead causing a sticky mess.";
|
|
|
|
sItemResRef = "nw_it_torch001";
|
|
|
|
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
|
|
|
iComponent1 = 1;
|
|
|
|
sComponent2 = "ITEM_STRAW"; //Bundle of Straw
|
|
|
|
iComponent2 = 1;
|
|
|
|
sComponent3 = "_UOA_BOTTLE_TAR"; //Bottle of Tar
|
|
|
|
iComponent3 = 1;
|
|
|
|
iComponent3Stackable=1;
|
|
|
|
sComponent1Name="normal wood";
|
|
|
|
sComponent2Name="bundles of straw";
|
|
|
|
sComponent3Name="bottles of tar";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sTag == "pattern117") //Wine Cask
|
|
|
|
{
|
|
|
|
iDifficulty = 400;
|
|
|
|
sSuccess = "You successfully form and shape the wood into an empty wine cask.";
|
|
|
|
sFail = "The wood warps, rendering the wine cask unuseable.";
|
|
|
|
sItemResRef = "item_cask_001"; //empty wine cask
|
|
|
|
sItemResRefPoor = sItemResRef;
|
|
|
|
sItemResRefExceptional = sItemResRef;
|
|
|
|
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
2024-09-16 23:40:48 -04:00
|
|
|
iComponent1 = 8;
|
2024-06-14 10:48:20 -04:00
|
|
|
sComponent1Name="normal wood";
|
|
|
|
}
|
|
|
|
if (sTag == "pattern118") //Beer barrel
|
|
|
|
{
|
|
|
|
iDifficulty = 450;
|
|
|
|
sSuccess = "You successfully form and shape the wood into an empty beer barrel.";
|
|
|
|
sFail = "The wood warps, rendering the beer barrel unuseable.";
|
|
|
|
sItemResRef = "item_cask_002"; //empty wine cask
|
|
|
|
sItemResRefPoor = sItemResRef;
|
|
|
|
sItemResRefExceptional = sItemResRef;
|
|
|
|
sComponent1 = "WOOD_NORMAL"; //Normal Wood
|
|
|
|
iComponent1 = 8;
|
|
|
|
sComponent1Name="normal wood";
|
|
|
|
}
|
|
|
|
if (sTag == "pattern119") //Mead barrel
|
|
|
|
{
|
|
|
|
iDifficulty = 400;
|
|
|
|
sSuccess = "You successfully form and shape the wood into an empty mead barrel.";
|
|
|
|
sFail = "The wood warps, rendering the mead barrel unuseable.";
|
|
|
|
sItemResRef = "item_cask_003"; //empty wine cask
|
|
|
|
sItemResRefPoor = sItemResRef;
|
|
|
|
sItemResRefExceptional = sItemResRef;
|
|
|
|
sComponent1 = "WOOD_MAPLE"; //Maple Wood
|
|
|
|
iComponent1 = 8;
|
|
|
|
sComponent1Name="maple wood";
|
|
|
|
}
|
|
|
|
if (sTag == "pattern120") //Whiskey barrel
|
|
|
|
{
|
|
|
|
iDifficulty = 200;
|
|
|
|
sSuccess = "You successfully form and shape the wood into an empty whiskey barrel.";
|
|
|
|
sFail = "The wood warps, rendering the whiskey barrel unuseable.";
|
|
|
|
sItemResRef = "item_cask_004"; //empty wine cask
|
|
|
|
sItemResRefPoor = sItemResRef;
|
|
|
|
sItemResRefExceptional = sItemResRef;
|
|
|
|
sComponent1 = "WOOD_OAK"; //Maple Wood
|
|
|
|
iComponent1 = 8;
|
|
|
|
sComponent1Name="oak wood";
|
|
|
|
}
|
|
|
|
if (sTag == "pattern121") //Rum barrel
|
|
|
|
{
|
|
|
|
iDifficulty = 300;
|
|
|
|
sSuccess = "You successfully form and shape the wood into an empty rum barrel.";
|
|
|
|
sFail = "The wood warps, rendering the rum barrel unuseable.";
|
|
|
|
sItemResRef = "item_cask_005"; //empty wine cask
|
|
|
|
sItemResRefPoor = sItemResRef;
|
|
|
|
sItemResRefExceptional = sItemResRef;
|
|
|
|
sComponent1 = "WOOD_OAK"; //Maple Wood
|
|
|
|
iComponent1 = 8;
|
|
|
|
sComponent2 = "_UOA_BOTTLE_TAR"; //Bottle of Tar
|
|
|
|
iComponent2 = 1;
|
|
|
|
iComponent2Stackable=1;
|
|
|
|
sComponent1Name="oak wood";
|
|
|
|
sComponent2Name="bottles of tar";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sTag=="pattern103")sComponent1Name = GetComponentName(iWoodType);
|
|
|
|
if (sTag=="pattern104")sComponent1Name = GetComponentName(iWoodType);
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove all components
|
|
|
|
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--)
|
|
|
|
{
|
|
|
|
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--)
|
|
|
|
{
|
|
|
|
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--)
|
|
|
|
{
|
|
|
|
GetNextItemPossessedBy(oPC,sComponent3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
iCarpentryChance = iCarpentryChance - iDifficulty;
|
|
|
|
if (iCarpentryChance <1) iCarpentryChance = 1;
|
|
|
|
|
|
|
|
PlaySound("as_cv_sawing1");
|
|
|
|
DelayCommand(3.0,PlaySound("as_cv_sawing1"));
|
|
|
|
DelayCommand(6.0,PlaySound("as_cv_sawing2"));
|
|
|
|
DelayCommand(9.0,PlaySound("as_cv_hammering1"));
|
|
|
|
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,13.0));
|
|
|
|
|
|
|
|
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
|
|
|
DelayCommand(13.1,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
|
|
|
|
|
|
|
|
|
|
|
iRandom = Random(1000);
|
|
|
|
if (iRandom <= iCarpentryChance)
|
|
|
|
{
|
|
|
|
iSuccess = 1;
|
|
|
|
int iSuccess2 = 1;
|
|
|
|
if (sTag!="pattern109") // non-torches
|
|
|
|
{
|
|
|
|
iCarpentryChance = iCarpentryChance - 50;
|
|
|
|
if (Random(1000) <= iCarpentryChance) iSuccess2 = iSuccess2+1;
|
|
|
|
iCarpentryChance = iCarpentryChance-100;
|
|
|
|
if (Random(1000) <= iCarpentryChance) iSuccess2 = iSuccess2+1;
|
|
|
|
iCarpentryChance = iCarpentryChance + 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)));
|
|
|
|
}
|
|
|
|
if (sTag=="pattern109") //torches
|
|
|
|
{
|
|
|
|
AssignCommand(oPC,DelayCommand(12.0,CreateAnObject(sItemResRef,oPC,1)));
|
|
|
|
AssignCommand(oPC,DelayCommand(12.1,CreateAnObject(sItemResRef,oPC,1)));
|
|
|
|
AssignCommand(oPC,DelayCommand(12.2,CreateAnObject(sItemResRef,oPC,1)));
|
|
|
|
AssignCommand(oPC,DelayCommand(12.3,CreateAnObject(sItemResRef,oPC,1)));
|
|
|
|
AssignCommand(oPC,DelayCommand(12.4,CreateAnObject(sItemResRef,oPC,1)));
|
|
|
|
}
|
|
|
|
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)));
|
|
|
|
if (Random(1000) >= iCarpentrySkill)
|
|
|
|
{
|
|
|
|
if (d10(1)+1 >= iCarpentryChance/100) iSkillGain = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AssignCommand(oPC,DelayCommand(12.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (iSkillGain ==1)
|
|
|
|
{
|
|
|
|
string sOldSkill = "";
|
|
|
|
string sOldSkill2 = "";
|
|
|
|
iCarpentrySkill++;
|
|
|
|
sOldSkill2 = IntToString(iCarpentrySkill);
|
|
|
|
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
|
|
|
if (iCarpentrySkill > 9)
|
|
|
|
{
|
|
|
|
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sOldSkill = "0"+sOldSkill;
|
|
|
|
}
|
|
|
|
if (iCarpentrySkill <= 1000)
|
|
|
|
{
|
2024-09-16 23:40:48 -04:00
|
|
|
DelayCommand(13.0,SetCampaignInt("UOACraft","iCarpentrySkill",iCarpentrySkill,oPC));
|
2024-06-14 10:48:20 -04:00
|
|
|
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
|
|
|
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in carpentry has gone up!"));
|
|
|
|
DelayCommand(13.0,SendMessageToPC(oPC,"Current carpentry skill : "+ sOldSkill+"%"));
|
|
|
|
DelayCommand(13.0,SendMessageToPC(oPC,"==================================="));
|
|
|
|
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(12.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ensure at least 1 respawn 10 minutes after used...
|
|
|
|
//this is to prevent a broken placeable that is used, with a 'in use' delay
|
|
|
|
//which would cancel the respawn
|
|
|
|
if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99)
|
|
|
|
{
|
|
|
|
SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99);
|
|
|
|
DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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 GetComponent(int iWoodType)
|
|
|
|
{
|
|
|
|
switch (iWoodType)
|
|
|
|
{
|
|
|
|
case 1:{return "WOOD_OLIVE"; break;}
|
|
|
|
case 2:{return "WOOD_WILLOW"; break;}
|
|
|
|
case 3:{return "WOOD_PINE"; break;}
|
|
|
|
case 4:{return "WOOD_FIR"; break;}
|
|
|
|
case 5:{return "WOOD_MANGROVE"; break;}
|
|
|
|
case 6:{return "WOOD_CHERRY"; break;}
|
|
|
|
case 7:{return "WOOD_MAPLE"; break;}
|
|
|
|
case 8:{return "WOOD_ALMOND"; break;}
|
|
|
|
case 9:{return "WOOD_HICKORY"; break;}
|
|
|
|
case 10:{return "WOOD_BIRCH"; break;}
|
|
|
|
case 11:{return "WOOD_ELDER"; break;}
|
|
|
|
case 12:{return "WOOD_WALNUT"; break;}
|
|
|
|
case 13:{return "WOOD_ELM"; break;}
|
|
|
|
case 14:{return "WOOD_MAHOGANY"; break;}
|
|
|
|
case 15:{return "WOOD_OAK"; break;}
|
|
|
|
case 16:{return "WOOD_YEW"; break;}
|
|
|
|
case 17:{return "WOOD_REDWOOD"; break;}
|
|
|
|
case 18:{return "WOOD_IRONWOOD"; break;}
|
|
|
|
default:{return "WOOD_NORMAL"; break;}
|
|
|
|
}
|
|
|
|
return "WOOD_NORMAL";
|
|
|
|
}
|
|
|
|
|
|
|
|
string GetComponentName(int iWoodType)
|
|
|
|
{
|
|
|
|
switch (iWoodType)
|
|
|
|
{
|
|
|
|
case 1:{return "olive branches"; break;}
|
|
|
|
case 2:{return "willow branches"; break;}
|
|
|
|
case 3:{return "pine logs"; break;}
|
|
|
|
case 4:{return "fir logs"; break;}
|
|
|
|
case 5:{return "mangrove logs"; break;}
|
|
|
|
case 6:{return "cherry logs"; break;}
|
|
|
|
case 7:{return "maple logs"; break;}
|
|
|
|
case 8:{return "almond logs"; break;}
|
|
|
|
case 9:{return "hickory logs"; break;}
|
|
|
|
case 10:{return "birch logs"; break;}
|
|
|
|
case 11:{return "elder logs"; break;}
|
|
|
|
case 12:{return "walnut logs"; break;}
|
|
|
|
case 13:{return "elm logs"; break;}
|
|
|
|
case 14:{return "mahogany logs"; break;}
|
|
|
|
case 15:{return "oak logs"; break;}
|
|
|
|
case 16:{return "yew branches"; break;}
|
|
|
|
case 17:{return "redwood"; break;}
|
|
|
|
case 18:{return "ironwood"; break;}
|
|
|
|
default:{return "normal logs"; break;}
|
|
|
|
}
|
|
|
|
return "normal logs";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string CraftLookup(string sResRef, int iWoodType)
|
|
|
|
{
|
|
|
|
if (GetStringLeft(sResRef,9)=="item_cask") return sResRef;
|
|
|
|
switch (iWoodType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
return sResRef;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
// Olive Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl005";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl004";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl006";
|
|
|
|
// Olive Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs005";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs004";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs006";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
// Willow Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl008";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl007";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl009";
|
|
|
|
// Willow Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs008";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs007";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs009";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
// Pine Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl011";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl010";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl012";
|
|
|
|
// Pine Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs011";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs010";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs012";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
// Fir Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl014";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl013";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl015";
|
|
|
|
// Fir Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs014";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs013";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs015";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 5:
|
|
|
|
{
|
|
|
|
// Mangrove Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl017";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl016";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl018";
|
|
|
|
// Mangrove Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs017";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs016";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs018";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6:
|
|
|
|
{
|
|
|
|
// Cherry Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl020";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl019";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl021";
|
|
|
|
// Cherry Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs020";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs019";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs021";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 7:
|
|
|
|
{
|
|
|
|
// Maple Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl023";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl022";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl024";
|
|
|
|
// Maple Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs023";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs022";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs024";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 8:
|
|
|
|
{
|
|
|
|
// Almond Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl026";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl025";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl027";
|
|
|
|
// Almond Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs026";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs025";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs027";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 9:
|
|
|
|
{
|
|
|
|
// Hickory Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl029";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl028";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl030";
|
|
|
|
// Hickory Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs029";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs028";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs030";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 10:
|
|
|
|
{
|
|
|
|
// Birch Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl032";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl031";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl033";
|
|
|
|
// Birch Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs032";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs031";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs033";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 11:
|
|
|
|
{
|
|
|
|
// Elder Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl035";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl034";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl036";
|
|
|
|
// Elder Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs035";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs034";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs036";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 12:
|
|
|
|
{
|
|
|
|
// Walnut Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl038";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl037";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl039";
|
|
|
|
// Walnut Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs038";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs037";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs039";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 13:
|
|
|
|
{
|
|
|
|
// Elm Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl041";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl040";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl042";
|
|
|
|
// Elm Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs041";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs040";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs042";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 14:
|
|
|
|
{
|
|
|
|
// Mahogany Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl044";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl043";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl045";
|
|
|
|
// Mahogany Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs044";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs043";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs045";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 15:
|
|
|
|
{
|
|
|
|
// Oak Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl047";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl046";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl048";
|
|
|
|
// Oak Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs047";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs046";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs048";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 16:
|
|
|
|
{
|
|
|
|
// Yew Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl050";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl049";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl051";
|
|
|
|
// Yew Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs050";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs049";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs051";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 17:
|
|
|
|
{
|
|
|
|
// Redwood Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl053";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl052";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl054";
|
|
|
|
// Redwood Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs053";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs052";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs054";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 18:
|
|
|
|
{
|
|
|
|
// Ironwood Club
|
|
|
|
if (sResRef=="wblcl002") return "wblcl056";
|
|
|
|
if (sResRef=="nw_wblcl001") return "wblcl055";
|
|
|
|
if (sResRef=="wblcl003") return "wblcl057";
|
|
|
|
// Ironwood Quarterstaff
|
|
|
|
if (sResRef=="wdbqs002") return "wdbqs056";
|
|
|
|
if (sResRef=="nw_wdbqs001") return "wdbqs055";
|
|
|
|
if (sResRef=="wdbqs003") return "wdbqs057";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
return sResRef;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sResRef;
|
|
|
|
}
|