Aschbourne_PRC8/_module/nss/_craft_tan_oven.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

481 lines
15 KiB
Plaintext

//#include "_persist_01a"
#include "nw_i0_plot"
#include "aps_include"
void CreateAnObject(string sResource, object oPC);
void GetNextItemPossessedBy(object oPC, string sItemTag);
object CreatePlaceable(string sObject, location lPlace, float fDuration);
void main()
{
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
{
if (GetLastDisturbed() == OBJECT_SELF)
{
DestroyObject(GetInventoryDisturbItem());
return;
}
return;
}
object oPC = GetLastDisturbed();
object oItem = GetInventoryDisturbItem();
// 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.
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
{
CopyItem(oItem,oPC,TRUE);
SendMessageToPC(oPC,"You must wait till the pelt in the oven is done before starting another.");
DestroyObject(oItem);
return;
}
string sItemTag = GetTag(oItem);
string sPeltResRef = "";
string sPeltFailResRef = "";
if (GetStringLeft(sItemTag,5) != "PELT_")
{
CopyItem(oItem,oPC,TRUE);
FloatingTextStringOnCreature("You cannot cure this item!",oPC,FALSE);
DestroyObject(oItem);
return;
}
//int iTanChance = GetTokenPair(oPC,14,9);
//int iTanSkill = iTanChance;
int iTanSkill = GetPersistentInt(oPC,"iCureSkill","UOACraft");
int iTanChance = iTanSkill;
int iKindling = 1;
int iSalt = 1;
string sPeltSuccess;
string sPeltFail;
if (iTanChance <350)
{
iTanChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*3;
iTanChance = iTanChance + GetAbilityScore(oPC,ABILITY_INTELLIGENCE) + GetAbilityScore(oPC,ABILITY_WISDOM);
iTanChance = iTanChance * 6;
if (iTanChance >350) iTanChance = 350;
if (iTanSkill > iTanChance) iTanChance = iTanSkill;
}
if (sItemTag == "PELT_BROWNBEAR")
{
iSalt = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the brown bear pelt.";
sPeltFail = "You fail to cure the brown bear pelt.";
}
if (sItemTag == "PELT_BLACKBEAR")
{
iSalt = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured011";
sPeltFailResRef = "cured026";
sPeltSuccess = "You carefully cure the black bear pelt.";
sPeltFail = "You fail to cure the black bear pelt.";
}
if (sItemTag == "PELT_GRIZZLYBEAR")
{
iSalt = 3;
iKindling = 2;
iTanChance = iTanChance - 550;
sPeltResRef = "cured013";
sPeltFailResRef = "cured028";
sPeltSuccess = "You carefully cure the grizzly bear pelt.";
sPeltFail = "You fail to cure the grizzly bear pelt.";
}
if (sItemTag == "PELT_POLARBEAR")
{
iSalt = 3;
iKindling = 2;
iTanChance = iTanChance - 650;
sPeltResRef = "cured015";
sPeltFailResRef = "cured030";
sPeltSuccess = "You carefully cure the polar bear pelt.";
sPeltFail = "You fail to cure the polar bear pelt.";
}
if (sItemTag == "PELT_DIREBEAR")
{
iSalt = 3;
iKindling = 2;
iTanChance = iTanChance - 600;
sPeltResRef = "cured013";
sPeltFailResRef = "cured028";
sPeltSuccess = "You carefully cure the dire bear pelt.";
sPeltFail = "You fail to cure the dire bear pelt.";
}
if (sItemTag == "PELT_ANCIENTDIREBEAR")
{
iSalt = 3;
iKindling = 2;
iTanChance = iTanChance - 700;
sPeltResRef = "cured014";
sPeltFailResRef = "cured029";
sPeltSuccess = "You carefully cure the ancient dire bear pelt.";
sPeltFail = "You fail to cure the ancient dire bear pelt.";
}
if (sItemTag == "PELT_DOG")
{
iTanChance = iTanChance - 100;
sPeltResRef = "cured004";
sPeltFailResRef = "cured019";
sPeltSuccess = "You carefully cure the dog pelt.";
sPeltFail = "You fail to cure the dog pelt.";
}
if (sItemTag == "PELT_WOLF")
{
iTanChance = iTanChance - 200;
sPeltResRef = "cured007";
sPeltFailResRef = "cured022";
sPeltSuccess = "You carefully cure the wolf pelt.";
sPeltFail = "You fail to cure the wolf pelt.";
}
if (sItemTag == "PELT_WORG")
{
iTanChance = iTanChance - 250;
sPeltResRef = "cured008";
sPeltFailResRef = "cured023";
sPeltSuccess = "You carefully cure the worg pelt.";
sPeltFail = "You fail to cure the worg pelt.";
}
if (sItemTag == "PELT_DIREWOLF")
{
iSalt = 2;
iTanChance = iTanChance - 450;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the dire wolf pelt.";
sPeltFail = "You fail to cure the dire wolf pelt.";
}
if (sItemTag == "PELT_WINTERWOLF")
{
iSalt = 2;
iKindling = 2;
iTanChance = iTanChance - 300;
sPeltResRef = "cured009";
sPeltFailResRef = "cured024";
sPeltSuccess = "You carefully cure the winter wolf pelt.";
sPeltFail = "You fail to cure the winter wolf pelt.";
}
if (sItemTag == "PELT_COUGAR")
{
iSalt = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the cougar pelt.";
sPeltFail = "You fail to cure the cougar pelt.";
}
if (sItemTag == "PELT_CRAGCAT")
{
iSalt = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured009";
sPeltFailResRef = "cured024";
sPeltSuccess = "You carefully cure the crag cat pelt.";
sPeltFail = "You fail to cure the crag cat pelt.";
}
if (sItemTag == "PELT_PANTHER")
{
iSalt = 2;
iKindling = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured008";
sPeltFailResRef = "cured023";
sPeltSuccess = "You carefully cure the panther pelt.";
sPeltFail = "You fail to cure the panther pelt.";
}
if (sItemTag == "PELT_MALARPANTHER")
{
iSalt = 3;
iKindling=2;
iTanChance = iTanChance - 550;
sPeltResRef = "cured011";
sPeltFailResRef = "cured026";
sPeltSuccess = "You carefully cure the malar panther pelt.";
sPeltFail = "You fail to cure the malar panther pelt.";
}
if (sItemTag == "PELT_LION")
{
iSalt = 2;
iKindling = 2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the lion pelt.";
sPeltFail = "You fail to cure the lion pelt.";
}
if (sItemTag == "PELT_LEOPARD")
{
iSalt=2;
iTanChance = iTanChance - 350;
sPeltResRef = "cured007";
sPeltFailResRef = "cured022";
sPeltSuccess = "You carefully cure the leopard pelt.";
sPeltFail = "You fail to cure the leopard pelt.";
}
if (sItemTag == "PELT_JAGUAR")
{
iSalt=2;
iTanChance = iTanChance - 400;
sPeltResRef = "cured008";
sPeltFailResRef = "cured023";
sPeltSuccess = "You carefully cure the jaguar pelt.";
sPeltFail = "You fail to cure the jaguar pelt.";
}
if (sItemTag == "PELT_DIRETIGER")
{
iSalt=2;
iKindling=2;
iTanChance = iTanChance - 500;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the dire tiger pelt.";
sPeltFail = "You fail to cure the dire tiger pelt.";
}
if (sItemTag == "PELT_BADGER")
{
sPeltResRef = "cured003";
sPeltFailResRef = "cured018";
sPeltSuccess = "You carefully cure the badger pelt.";
sPeltFail = "You fail to cure the badger pelt.";
}
if (sItemTag == "PELT_BAT")
{
sPeltResRef = "cured002";
sPeltFailResRef = "cured017";
sPeltSuccess = "You carefully cure the bat pelt.";
sPeltFail = "You fail to cure the bat pelt.";
}
if (sItemTag == "PELT_COW")
{
iSalt=2;
iTanChance = iTanChance - 400;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the cow pelt.";
sPeltFail = "You fail to cure the cow pelt.";
}
if (sItemTag == "PELT_DEER")
{
iTanChance = iTanChance - 100;
sPeltResRef = "cured004";
sPeltFailResRef = "cured019";
sPeltSuccess = "You carefully cure the deer pelt.";
sPeltFail = "You fail to cure the deer pelt.";
}
if (sItemTag == "PELT_DIREBADGER")
{
iSalt=2;
iTanChance = iTanChance - 200;
sPeltResRef = "cured006";
sPeltFailResRef = "cured021";
sPeltSuccess = "You carefully cure the dire badger pelt.";
sPeltFail = "You fail to cure the dire badger pelt.";
}
if (sItemTag == "PELT_DIRERAT")
{
iTanChance = iTanChance - 150;
sPeltResRef = "cured005";
sPeltFailResRef = "cured020";
sPeltSuccess = "You carefully cure the dire rat pelt.";
sPeltFail = "You fail to cure the dire rat pelt.";
}
if (sItemTag == "PELT_RAT")
{
//iSalt = 3; //remove this
//iKindling = 3;
sPeltResRef = "cured001";
sPeltFailResRef = "cured016";
sPeltSuccess = "You carefully cure the rat pelt.";
sPeltFail = "You fail to cure the rat pelt.";
}
if (sItemTag == "PELT_OX")
{
iSalt=2;
iKindling=2;
iTanChance = iTanChance - 300;
sPeltResRef = "cured010";
sPeltFailResRef = "cured025";
sPeltSuccess = "You carefully cure the ox pelt.";
sPeltFail = "You fail to cure the ox pelt.";
}
if (sItemTag == "PELT_WHITESTAG")
{
iSalt=2;
iKindling=2;
iTanChance = iTanChance - 400;
sPeltResRef = "cured012";
sPeltFailResRef = "cured027";
sPeltSuccess = "You carefully cure the white stag pelt.";
sPeltFail = "You fail to cure the white stag pelt.";
}
if (iTanChance < 1)
{
FloatingTextStringOnCreature("You have no idea how to cure this pelt.",oPC,FALSE);
CopyItem(oItem,oPC,TRUE);
DestroyObject(oItem);
return;
}
if (GetNumItems(oPC,"ITEM_KINDLING") < iKindling)
{
FloatingTextStringOnCreature("You do not have enough kindling to cure this pelt.",oPC,FALSE);
CopyItem(oItem,oPC,TRUE);
DestroyObject(oItem);
return;
}
if (GetNumItems(oPC,"ITEM_TANNERSSALT") < iSalt)
{
FloatingTextStringOnCreature("You do not have enough tanner's salt to cure this pelt.",oPC,FALSE);
CopyItem(oItem,oPC,TRUE);
DestroyObject(oItem);
return;
}
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
DelayCommand(8.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
object oTemp = OBJECT_INVALID;
oTemp = GetItemPossessedBy(oPC,"ITEM_TANNERSSALT");
DestroyObject(oTemp);
oTemp = GetItemPossessedBy(oPC,"ITEM_KINDLING");
DestroyObject(oTemp);
if (iSalt>1) DelayCommand(1.0,GetNextItemPossessedBy(oPC,"ITEM_TANNERSSALT"));
if (iSalt>2) DelayCommand(2.0,GetNextItemPossessedBy(oPC,"ITEM_TANNERSSALT"));
if (iSalt>3) DelayCommand(3.0,GetNextItemPossessedBy(oPC,"ITEM_TANNERSSALT"));
if (iKindling>1) DelayCommand(4.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
if (iKindling>2) DelayCommand(5.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
if (iKindling>3) DelayCommand(6.0,GetNextItemPossessedBy(oPC,"ITEM_KINDLING"));
AssignCommand(oPC,PlaySound("al_cv_firebowl1"));
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,6.0));
//PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,6.0);
location lSelf = GetLocation(OBJECT_SELF);
float fSelf = GetFacing(OBJECT_SELF)+180.0;
vector vSelf = GetPosition(OBJECT_SELF);
object oArea = GetArea(OBJECT_SELF);
vector vFire;
int vDirection;
vFire = vSelf + (AngleToVector(fSelf) * 0.7);
location lFire = Location(oArea,vFire,fSelf);
object oFire = CreatePlaceable("plc_flamemedium", lFire, 6.0);
DelayCommand(3.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),GetLocation(oFire),6.0));
AssignCommand(oFire,PlaySound("as_na_steamlong1"));
int iRandom = Random(1000);
int iSuccess = 0;
int iSkillGain = 0;
if (iRandom < iTanChance)
{
iSuccess = 1;
}
DelayCommand(6.0,DestroyObject(oItem));
if (iSuccess == 1)
{
DelayCommand(6.0,FloatingTextStringOnCreature(sPeltSuccess,oPC,FALSE));
DelayCommand(6.0,CreateAnObject(sPeltResRef,oPC));
iRandom = Random(1000);
if (iRandom >= iTanSkill)
{
if (d10(1)+1 >= iTanChance/100) iSkillGain = 1;
}
}
else
{
DelayCommand(6.0,FloatingTextStringOnCreature(sPeltFail,oPC,FALSE));
if (Random(1000) <= iTanSkill)
{
DelayCommand(7.0,FloatingTextStringOnCreature("You manage to recover the ruined pelt....",oPC,FALSE));
DelayCommand(7.0,CreateAnObject(sPeltFailResRef,oPC));
}
}
//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 = "";
iTanSkill++;
sOldSkill2 = IntToString(iTanSkill);
sOldSkill = "."+GetStringRight(sOldSkill2,1);
if (iTanSkill > 9)
{
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
}
else
{
sOldSkill = "0"+sOldSkill;
}
if (iTanSkill <= 1000)
{
//DelayCommand(6.0,SetTokenPair(oPC,14,9,iTanSkill));
DelayCommand(6.0,SetPersistentInt(oPC,"iCureSkill",iTanSkill,0,"UOACraft"));
DelayCommand(6.0,SendMessageToPC(oPC,"================================="));
DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in curing has gone up!"));
DelayCommand(6.0,SendMessageToPC(oPC,"Current curing skill : "+ sOldSkill+"%"));
DelayCommand(6.0,SendMessageToPC(oPC,"================================="));
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
}
}
}
void CreateAnObject(string sResource, object oPC)
{
CreateItemOnObject(sResource,oPC,1);
return;
}
void GetNextItemPossessedBy(object oPC, string sItemTag)
{
object oTemp = GetItemPossessedBy(oPC,sItemTag);
DestroyObject(oTemp);
return;
}
object CreatePlaceable(string sObject, location lPlace, float fDuration)
{
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
if (fDuration != 0.0)
DestroyObject(oPlaceable,fDuration);
return oPlaceable;
}