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

847 lines
36 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 iIngotType, int iJewelType);
//string ComponentLookup(int iIngotType, int iJewelType);
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 = 0;
int iComponent2Stackable = 1;
int iComponent3Stackable = 0;
int iStackSize;
int iDifficulty;
string sComponent1 = "";
string sComponent2 = "";
string sComponent3 = "";
string sComponent1Name = "";
string sComponent2Name = "";
string sComponent3Name = "";
string sComponentResRef = "";
object oTemp = OBJECT_INVALID;
int iIngotType = GetLocalInt(oPC,"iUseIngotType"); // get the current ingot type used
int iIngotMod = iIngotType *25;// set the skill modifier for the ingot type used.
//Modifiers for Ingot Type
if (iIngotType==9) iIngotMod = 90; // Silver is little easier than Bronze
if (iIngotType==10) iIngotMod = 175; // Mithril is hard as Verite
if (iIngotType==11) iIngotMod = 200; // Adamantite is hard as Valorite
if (iIngotType==12) iIngotMod = 150; // Platinum is hard as Agapite
if (iIngotMod >0) iIngotMod = iIngotMod + 250;
int iJewelType = GetLocalInt(oPC,"iUseJewelType");
int iJewelMod = 0;
//Modifiers for Gem Type
if (iJewelType>0) iJewelMod = 50;
if (iJewelType>12) iJewelMod = 100;
if (iJewelType>25) iJewelMod = 150;
if (iJewelType>36) iJewelMod = 200;
if (iJewelType>42) iJewelMod = 250;
if (iJewelType>51) iJewelMod = 300;
int iJewelSkill = GetCampaignInt("UOACraft","iJewelSkill",oPC);
int iJewelChance = iJewelSkill;
if (GetInventoryDisturbType()== INVENTORY_DISTURB_TYPE_ADDED)
{
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
// You can replace them with whatever 'no-drop' code you have or comment them out.
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
return;
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
{
DestroyObject(oItem);
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
return;
}
// End of compatability portion.
CopyItem(oItem,oPC,TRUE);
DestroyObject(oItem);
FloatingTextStringOnCreature("You can only craft by removing pattern tokens from this station.",oPC,FALSE);
}
// Check for ingot/gem type switch or non-flagswitch/pattern item
if (GetStringLeft(GetResRef(oItem),7)!="pattern")
{
if (sTag == "SWITCH_IRON"){SetLocalInt(oPC,"iUseIngotType",0);sComponent1 = "Iron";}
if (sTag == "SWITCH_DULL"){SetLocalInt(oPC,"iUseIngotType",1);sComponent1 = "Dull Copper";}
if (sTag == "SWITCH_SHADOW"){SetLocalInt(oPC,"iUseIngotType",2);sComponent1 = "Shadow Iron";}
if (sTag == "SWITCH_COPPER"){SetLocalInt(oPC,"iUseIngotType",3);sComponent1 = "Copper";}
if (sTag == "SWITCH_BRONZE"){SetLocalInt(oPC,"iUseIngotType",4);sComponent1 = "Bronze";}
if (sTag == "SWITCH_GOLD"){SetLocalInt(oPC,"iUseIngotType",5);sComponent1 = "Gold";}
if (sTag == "SWITCH_AGAPITE"){SetLocalInt(oPC,"iUseIngotType",6);sComponent1 = "Agapite";}
if (sTag == "SWITCH_VERITE"){SetLocalInt(oPC,"iUseIngotType",7);sComponent1 = "Verite";}
if (sTag == "SWITCH_VALORITE"){SetLocalInt(oPC,"iUseIngotType",8);sComponent1 = "Valorite";}
if (sTag == "SWITCH_SILVER"){SetLocalInt(oPC,"iUseIngotType",9);sComponent1 = "Silver";}
if (sTag == "SWITCH_MITHRIL"){SetLocalInt(oPC,"iUseIngotType",10);sComponent1 = "Mithril";}
if (sTag == "SWITCH_ADAMANTITE"){SetLocalInt(oPC,"iUseIngotType",11);sComponent1 = "Adamantite";}
if (sTag == "SWITCH_PLATINUM"){SetLocalInt(oPC,"iUseIngotType",12);sComponent1 = "Platinum";}
if (GetStringRight(sTag,4)=="1000")
{
SetLocalInt(oPC,"iUseJewelType",0);
sComponent2 = GetStringRight(GetName(oItem),GetStringLength(GetName(oItem))-4);
FloatingTextStringOnCreature("Preparing to craft without gemstones.",oPC,FALSE);
DestroyObject(oItem);
//ExecuteScript("_onclose_clear",OBJECT_SELF);
//ExecuteScript("_open_anvil",OBJECT_SELF);
string sTagSelf = GetTag(oSelf);
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
}
if (StringToInt(GetStringRight(sTag,3))>99)
{
SetLocalInt(oPC,"iUseJewelType",StringToInt(GetStringRight(sTag,3))-100);
sComponent2 = GetStringRight(GetName(oItem),GetStringLength(GetName(oItem))-4);
FloatingTextStringOnCreature("Preparing to use "+sComponent2+".",oPC,FALSE);
DestroyObject(oItem);
//ExecuteScript("_onclose_clear",OBJECT_SELF);
//ExecuteScript("_open_anvil",OBJECT_SELF);
string sTagSelf = GetTag(oSelf);
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
}
if (GetStringLeft(sTag,7)=="SWITCH_")
{
FloatingTextStringOnCreature("Re-tooling to use "+sComponent1+" ingots.",oPC,FALSE);
DestroyObject(oItem);
//ExecuteScript("_onclose_clear",OBJECT_SELF);
//ExecuteScript("_open_anvil",OBJECT_SELF);
string sTagSelf = GetTag(oSelf);
AssignCommand(oPC,DoPlaceableObjectAction(oSelf,PLACEABLE_ACTION_USE));
AssignCommand(oPC,DelayCommand(1.5,DoPlaceableObjectAction(GetNearestObjectByTag(sTagSelf,oPC,1),PLACEABLE_ACTION_USE)));
}
return;
}
CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem));
DestroyObject(oItem);
//Skill Check Modifier Display for Bugtesting
if (GetStringLeft(GetResRef(oItem),7)=="pattern")
{
SendMessageToPC(oPC,"Jewel Modifier: "+IntToString(iJewelMod));
SendMessageToPC(oPC,"Ingot Modifier: "+IntToString(iIngotMod));
}
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
{
SendMessageToPC(oPC,"You must wait until the current jewelry item is completed before starting another.");
return;
}
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
DelayCommand(14.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
// Set Ingot Tag and name based on ingot selection
switch (iIngotType)
{
case 0:{sComponent2 = "INGOT_IRON";sComponent2Name = "iron ingots";break;}
case 1:{sComponent2 = "INGOT_DULL";sComponent2Name = "dull copper ingots";break;}
case 2:{sComponent2 = "INGOT_SHADOW";sComponent2Name = "shadow iron ingots";break;}
case 3:{sComponent2 = "INGOT_COPPER";sComponent2Name = "copper ingots";break;}
case 4:{sComponent2 = "INGOT_BRONZE";sComponent2Name = "bronze ingots";break;}
case 5:{sComponent2 = "INGOT_GOLD";sComponent2Name = "gold ingots";break;}
case 6:{sComponent2 = "INGOT_AGAPITE";sComponent2Name = "agapite ingots";break;}
case 7:{sComponent2 = "INGOT_VERITE";sComponent2Name = "verite ingots";break;}
case 8:{sComponent2 = "INGOT_VALORITE";sComponent2Name = "valorite ingots";break;}
case 9:{sComponent2 = "INGOT_SILVER";sComponent2Name = "silver ingots";break;}
case 10:{sComponent2 = "INGOT_MITHRIL";sComponent2Name = "mithril ingots";break;}
case 11:{sComponent2 = "INGOT_ADAMANTITE";sComponent2Name = "adamantite ingots";break;}
case 12:{sComponent2 = "INGOT_PLATINUM";sComponent2Name = "platinum ingots";break;}
default:{FloatingTextStringOnCreature("Error in ingot selection..",oPC,FALSE);return;break;}
}
if (iJewelChance < 350)
{
iJewelChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
iJewelChance = iJewelChance+(GetAbilityScore(oPC,ABILITY_WISDOM)*3);
iJewelChance = iJewelChance+(GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
iJewelChance = iJewelChance*3;
if (iJewelChance>350)iJewelChance=350;
if (iJewelSkill > iJewelChance) iJewelChance=iJewelSkill;
}
//Begin Crafting Test
if (sTag == "pattern075")//RINGS
{
//iJewelChance = iJewelChance - 100;
if (iJewelType==0)
{
sSuccess = "You carefully mold the ring, smothing off any rough edges.";
sFail = "The metal shatters the mold as you try to craft the ring..";
sItemResRef = CraftLookup("Ring-Normal",iIngotType,0);
sItemResRefPoor = CraftLookup("Ring-Poor",iIngotType,0);
sItemResRefExceptional = CraftLookup("Ring-Exceptional",iIngotType,0);
sComponent1 = "ITEM_RINGMOLD"; // Ring mold
sComponent1Name = "ring molds";
}
else
{
sSuccess = "You carefully set the stone into the ring mount.";
sFail = "The gemstone shatters in your attempt to set it into the ring setting.";
sItemResRef = CraftLookup("Ring-Exceptional",iIngotType,iJewelType);
sComponent1 = CraftLookup("Ring-Exceptional",iIngotType,0);
sComponent1Name = "exceptional"+GetStringLeft(sComponent2Name,GetStringLength(sComponent2Name)-7)+" rings";
}
iComponent1 = 1; //1 Ring Mold or 1 Ring of selected Type
iComponent2 = 1; //1 Ingot or 1 Exceptional Gem
}
//Begin Crafting Test
if (sTag == "pattern096") //AMULETS
{
iJewelChance = iJewelChance - 100;
if (iJewelType==0)
{
sSuccess = "You carefully mold the amulet, smothing off any rough edges.";
sFail = "The metal shatters the mold as you try to craft the amulet..";
sItemResRef = CraftLookup("Amulet-Normal",iIngotType,0);
sItemResRefPoor = CraftLookup("Amulet-Poor",iIngotType,0);
sItemResRefExceptional = CraftLookup("Amulet-Exceptional",iIngotType,0);
sComponent1 = "ITEM_AMULETMOLD"; // Amulet mold
sComponent1Name = "amulet molds";
}
else
{
sSuccess = "You carefully set the stones into the amulet's mount.";
sFail = "One gemstone shatters in your attempt to set it into the amulet's setting.";
sItemResRef = CraftLookup("Amulet-Exceptional",iIngotType,iJewelType);
sComponent1 = CraftLookup("Amulet-Exceptional",iIngotType,0);
sComponent1Name = "exceptional"+GetStringLeft(sComponent2Name,GetStringLength(sComponent2Name)-9)+" amulets";
}
iComponent1 = 1; //1 Ring Mold or 1 Ring of selected Type
iComponent2 = 2; //2 Ingot or 2 Exceptional Gem
}
//Begin Crafting Test
if (sTag == "pattern097")//NECKLACES
{
iJewelChance = iJewelChance - 50;
if (iJewelType==0)
{
sSuccess = "You carefully mold the necklace, smothing off any rough edges.";
sFail = "The metal shatters the mold as you try to craft the necklace..";
sItemResRef = CraftLookup("Necklace-Normal",iIngotType,0);
sItemResRefPoor = CraftLookup("Necklace-Poor",iIngotType,0);
sItemResRefExceptional = CraftLookup("Necklace-Exceptional",iIngotType,0);
sComponent1 = "ITEM_NECKLACEMOLD"; // Necklace mold
sComponent1Name = "necklace molds";
}
else
{
sSuccess = "You carefully set the stone into the necklace.";
sFail = "The gemstone shatters in your attempt to set it into the necklace.";
sItemResRef = CraftLookup("Necklace-Exceptional",iIngotType,iJewelType);
sComponent1 = CraftLookup("Necklace-Exceptional",iIngotType,0);
sComponent1Name = "exceptional"+GetStringLeft(sComponent2Name,GetStringLength(sComponent2Name)-11)+" necklaces";
}
iComponent1 = 1; //1 Necklace Mold or 1 Necklace of selected Type
iComponent2 = 1; //1 Ingot or 1 Exceptional Gem
}
//Name the gem, if the type is not '0' - or 'No Gem'
switch(iJewelType)
{
case 0:{break;} //Do nothing.. sComponent2 is an ingot.. set earlier
case 1:{sComponent2="GEM_EX_EYEAGATE";sComponent2Name="Expertly Cut Eye Agate";break;}
case 2:{sComponent2="GEM_EX_HEMATITE";sComponent2Name="Expertly Cut Hematite";break;}
case 3:{sComponent2="GEM_EX_AZURITE";sComponent2Name="Expertly Cut Azurite";break;}
case 4:{sComponent2="GEM_EX_BANDEDAGATE";sComponent2Name="Expertly Cut Banded Agate";break;}
case 5:{sComponent2="GEM_EX_BLUEQUARTZ";sComponent2Name="Expertly Cut Blue Quartz";break;}
case 6:{sComponent2="GEM_EX_LAPISLAZULI";sComponent2Name="Expertly Cut Lapis Lazuli";break;}
case 7:{sComponent2="GEM_EX_MALACHITE";sComponent2Name="Expertly Cut Malachite";break;}
case 8:{sComponent2="GEM_EX_MOSSAGATE";sComponent2Name="Expertly Cut Moss Agate";break;}
case 9:{sComponent2="GEM_EX_OBSIDIAN";sComponent2Name="Expertly Cut Obsidian";break;}
case 10:{sComponent2="GEM_EX_RHODOCHROSITE";sComponent2Name="Expertly Cut Rhodochrosite";break;}
case 11:{sComponent2="GEM_EX_TIGEREYE";sComponent2Name="Expertly Cut Tiger Eye";break;}
case 12:{sComponent2="GEM_EX_TURQUOISE";sComponent2Name="Expertly Cut Turquoise";break;}
case 13:{sComponent2="GEM_EX_BLOODSTONE";sComponent2Name="Expertly Cut Bloodtsone";break;}
case 14:{sComponent2="GEM_EX_ONYX";sComponent2Name="Expertly Cut Onyx";break;}
case 15:{sComponent2="GEM_EX_ZIRCON";sComponent2Name="Expertly Cut Zircon";break;}
case 16:{sComponent2="GEM_EX_ROCKCRYSTAL";sComponent2Name="Expertly Cut Rock Crystal";break;}
case 17:{sComponent2="GEM_EX_SARDONYX";sComponent2Name="Expertly Cut Sardonyx";break;}
case 18:{sComponent2="GEM_EX_SMOKYQUARTZ";sComponent2Name="Expertly Cut Smoky Quartz";break;}
case 20:{sComponent2="GEM_EX_STARROSEQUARTZ";sComponent2Name="Expertly Cut Star Rose Quartz";break;}
case 19:{sComponent2="GEM_EX_CARNELIAN";sComponent2Name="Expertly Cut Carnelian";break;}
case 21:{sComponent2="GEM_EX_CHALCENDONY";sComponent2Name="Expertly Cut Chalcendony";break;}
case 22:{sComponent2="GEM_EX_CHRYSOPRASE";sComponent2Name="Expertly Cut Chrysoprase";break;}
case 23:{sComponent2="GEM_EX_CITRINE";sComponent2Name="Expertly Cut Citrine";break;}
case 24:{sComponent2="GEM_EX_JASPER";sComponent2Name="Expertly Cut Jasper";break;}
case 25:{sComponent2="GEM_EX_MOONSTONE";sComponent2Name="Expertly Cut Moonstone";break;}
case 26:{sComponent2="GEM_EX_ALEXANDRITE";sComponent2Name="Expertly Cut Alexandrite";break;}
case 27:{sComponent2="GEM_EX_AMBER";sComponent2Name="Expertly Cut Amber";break;}
case 28:{sComponent2="GEM_EX_AMETHYST";sComponent2Name="Expertly Cut Amethyst";break;}
case 29:{sComponent2="GEM_EX_TOURMALINE";sComponent2Name="Expertly Cut Tourmaline";break;}
case 30:{sComponent2="GEM_EX_WHITEPEARL";sComponent2Name="Expertly Cut White Pearl";break;}
case 31:{sComponent2="GEM_EX_REDSPINEL";sComponent2Name="Expertly Cut Red Spinel";break;}
case 32:{sComponent2="GEM_EX_CORAL";sComponent2Name="Expertly Cut Coral";break;}
case 33:{sComponent2="GEM_EX_REDGARNET";sComponent2Name="Expertly Cut Red Garnet";break;}
case 34:{sComponent2="GEM_EX_CHRYSOBERYL";sComponent2Name="Expertly Cut Chrysoberyl";break;}
case 35:{sComponent2="GEM_EX_JADE";sComponent2Name="Expertly Cut Jade";break;}
case 36:{sComponent2="GEM_EX_JET";sComponent2Name="Expertly Cut Jet";break;}
case 37:{sComponent2="GEM_EX_TOPAZ";sComponent2Name="Expertly Cut Topaz";break;}
case 38:{sComponent2="GEM_EX_PERIDOT";sComponent2Name="Expertly Cut Peridot";break;}
case 39:{sComponent2="GEM_EX_VIOLETGARNET";sComponent2Name="Expertly Cut Viloet Garnet";break;}
case 40:{sComponent2="GEM_EX_BLUESPINEL";sComponent2Name="Expertly Cut Blue Spinel";break;}
case 41:{sComponent2="GEM_EX_AQUAMARINE";sComponent2Name="Expertly Cut Aquamarine";break;}
case 42:{sComponent2="GEM_EX_BLACKPEARL";sComponent2Name="Expertly Cut Black Pearl";break;}
case 43:{sComponent2="GEM_EX_BLACKOPAL";sComponent2Name="Expertly Cut Black Opal";break;}
case 44:{sComponent2="GEM_EX_EMERALD";sComponent2Name="Expertly Cut Emerald";break;}
case 45:{sComponent2="GEM_EX_FIREOPAL";sComponent2Name="Expertly Cut Fire Opal";break;}
case 46:{sComponent2="GEM_EX_OPAL";sComponent2Name="Expertly Cut Opal";break;}
case 47:{sComponent2="GEM_EX_ORIENTALAMETHYST";sComponent2Name="Expertly Cut Oriental Amethyst";break;}
case 48:{sComponent2="GEM_EX_ORIENTALTOPAZ";sComponent2Name="Expertly Cut Oriental Topaz";break;}
case 49:{sComponent2="GEM_EX_STARRUBY";sComponent2Name="Expertly Cut Star Ruby";break;}
case 50:{sComponent2="GEM_EX_STARSAPPHIRE";sComponent2Name="Expertly Cut Star Sapphire";break;}
case 51:{sComponent2="GEM_EX_SAPPHIRE";sComponent2Name="Expertly Cut Sapphire";break;}
case 52:{sComponent2="GEM_EX_BLACKSAPPHIRE";sComponent2Name="Expertly Cut Black Sapphire";break;}
case 53:{sComponent2="GEM_EX_RUBY";sComponent2Name="Expertly Cut Ruby";break;}
case 54:{sComponent2="GEM_EX_ORIENTALEMERALD";sComponent2Name="Expertly Cut Oriental Emerald";break;}
case 55:{sComponent2="GEM_EX_JACINTH";sComponent2Name="Expertly Cut Jacinth";break;}
case 56:{sComponent2="GEM_EX_DIAMOND";sComponent2Name="Expertly Cut Diamond";break;}
default:
}
//Adjust skill chance for item + component difficulties
iJewelChance = iJewelChance - iIngotMod;
iJewelChance = iJewelChance - iJewelMod;
iJewelChance = iJewelChance - iDifficulty;
// 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;
}
}
//Assign Animations and sounds
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,12.0));
PlaySound("as_na_steamshrt2");
AssignCommand(oPC,PlaySound("as_na_branchsnp2"));
DelayCommand(0.5,PlaySound("as_cv_chiseling3"));
DelayCommand(7.0,PlaySound("as_cv_branchsnp2"));
DelayCommand(8.2,PlaySound("as_cv_barglass1"));
DelayCommand(8.9,PlaySound("as_cv_barglass1"));
DelayCommand(9.5,PlaySound("as_cv_barglass1"));
DelayCommand(10.0,PlaySound("as_cv_barglass1"));
DelayCommand(10.5,PlaySound("as_cv_barglass1"));
DelayCommand(11.0,PlaySound("as_cv_barglass1"));
DelayCommand(11.5,PlaySound("as_cv_barglass1"));
// This snippet of code is cut-n-paste direct from ATS
// Reason for this is because I had no clue how to assign an increase
// in the z-axis of the location of the anvil for sparks to display.
// After reading through this code, it is obvious that vEffecrPos.z
// is the line which assigns this. Due to my own ignorance in this issue
// I have decided to leave this snippet of code intact with this credit to
// the original ATS script coders, whomever they may have been.
location locAnvil = GetLocation(OBJECT_SELF);
vector vEffectPos = GetPositionFromLocation(locAnvil);
vEffectPos.z += 1.0;
location locEffect = Location( GetAreaFromLocation(locAnvil), vEffectPos,GetFacingFromLocation(locAnvil) );
ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect);
DelayCommand(1.7, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
DelayCommand(2.4, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
DelayCommand(3.1, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
DelayCommand(3.8, ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_SPARKS_PARRY), locEffect));
// end of ATS snippet ^^^^
//
DelayCommand(4.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_ORANGE,FALSE),locEffect));
DelayCommand(5.9,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));
if (iJewelType==0)
{
DelayCommand(7.1,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),locEffect));
DelayCommand(8.2,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),locEffect));
DelayCommand(9.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_WHITE_BLUE,FALSE),locEffect));
DelayCommand(11.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_ACID,FALSE),locEffect));
}
else
{
DelayCommand(7.1,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPECIAL_RED_ORANGE,FALSE),locEffect));
DelayCommand(8.2,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));
DelayCommand(9.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY,FALSE),locEffect));
DelayCommand(11.6,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_ELECTRICAL,FALSE),locEffect));
}
// Remove all components
float fPause = 0.0;
if (iComponent1Stackable != 0)
{
oTemp = GetItemPossessedBy(oPC,sComponent1);
sComponentResRef = GetResRef(oTemp);
iStackSize = GetNumStackedItems(oTemp);
DestroyObject(oTemp);
if (iStackSize < iComponent1)
{
iComponent1 = iComponent1 - iStackSize;
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef));
}
else
{
if (iStackSize > iComponent1)
{
iStackSize = iStackSize - iComponent1;
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
}
}
}
else
{
for (iComponent1; iComponent1>0; iComponent1--)
{
fPause = fPause+0.5;
AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent1)));
}
}
if (sComponent2 != "")
{
if (iComponent2Stackable != 0)
{
oTemp = GetItemPossessedBy(oPC,sComponent2);
sComponentResRef = GetResRef(oTemp);
iStackSize = GetNumStackedItems(oTemp);
DestroyObject(oTemp);
if (iStackSize < iComponent2)
{
iComponent2 = iComponent2 - iStackSize;
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef));
}
else
{
if (iStackSize > iComponent2)
{
iStackSize = iStackSize - iComponent2;
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
}
}
}
else
{
for (iComponent2; iComponent2>0; iComponent2--)
{
fPause = fPause+0.5;
AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent2)));
}
}
}
if (sComponent3 != "")
{
if (iComponent3Stackable != 0)
{
oTemp = GetItemPossessedBy(oPC,sComponent3);
sComponentResRef = GetResRef(oTemp);
iStackSize = GetNumStackedItems(oTemp);
DestroyObject(oTemp);
if (iStackSize < iComponent3)
{
iComponent3 = iComponent3 - iStackSize;
DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef));
}
else
{
if (iStackSize > iComponent3)
{
iStackSize = iStackSize - iComponent3;
DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize));
}
}
}
else
{
for (iComponent3; iComponent3>0; iComponent3--)
{
fPause = fPause +0.5;
AssignCommand(oPC,DelayCommand(fPause,GetNextItemPossessedBy(oPC,sComponent3)));
}
}
}
if (Random(800)<=iJewelChance)
{
iSuccess = 1;
iSuccess2 = 1;
if (iJewelType==0) //Only for crafting blank rings/etc
{
iJewelChance = iJewelChance - 50;
if (Random(1000) <= iJewelChance) iSuccess2 = iSuccess2+1;
iJewelChance = iJewelChance-100;
if (Random(1000) <= iJewelChance) iSuccess2 = iSuccess2+1;
iJewelChance = iJewelChance + 150;
}
else
{
iSuccess2 = 2; //Corrected for making gem-laden items.. to use the correct sResRef variable.
}
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) >= iJewelSkill)
{
if (d10(1)+1 >= iJewelChance/100) iSkillGain = 1;
}
}
else
{
if (iJewelType==0)
{
DelayCommand(11.8,PlaySound("as_cv_claybreak1"));
}
else
{
DelayCommand(11.8,PlaySound("as_cv_glasbreak1"));
}
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 = "";
iJewelSkill++;
sOldSkill2 = IntToString(iJewelSkill);
sOldSkill = "."+GetStringRight(sOldSkill2,1);
if (iJewelSkill > 9)
{
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
}
else
{
sOldSkill = "0"+sOldSkill;
}
if (iJewelSkill <= 1000)
{
//DelayCommand(13.0,SetTokenPair(oPC,12,4,iJewelSkill));
DelayCommand(13.0,SetCampaignInt("UOACraft","iJewelSkill",iJewelSkill,oPC));
DelayCommand(13.0,SendMessageToPC(oPC,"===================================="));
DelayCommand(13.0,SendMessageToPC(oPC,"Your skill in jewelcraft has gone up!"));
DelayCommand(13.0,SendMessageToPC(oPC,"Current jewelcraft 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 iIngotType, int iJewelType)
{
if (iJewelType==0) //Blank Jewelry
{
switch (iIngotType)
{
case 0:
{
if (sResRef=="Ring-Normal") return "ring_iron_001";
if (sResRef=="Ring-Poor") return "ring_iron_002";
if (sResRef=="Ring-Exceptional") return "ring_iron_003";
if (sResRef=="Amulet-Normal") return "ammy_iron_001";
if (sResRef=="Amulet-Poor") return "ammy_iron_002";
if (sResRef=="Amulet-Exceptional") return "ammy_iron_003";
if (sResRef=="Necklace-Normal") return "neck_iron_001";
if (sResRef=="Necklace-Poor") return "neck_iron_002";
if (sResRef=="Necklace-Exceptional") return "neck_iron_003";
break;
}
case 1:
{
if (sResRef=="Ring-Normal") return "ring_dull_001";
if (sResRef=="Ring-Poor") return "ring_dull_002";
if (sResRef=="Ring-Exceptional") return "ring_dull_003";
if (sResRef=="Amulet-Normal") return "ammy_dull_001";
if (sResRef=="Amulet-Poor") return "ammy_dull_002";
if (sResRef=="Amulet-Exceptional") return "ammy_dull_003";
if (sResRef=="Necklace-Normal") return "neck_dull_001";
if (sResRef=="Necklace-Poor") return "neck_dull_002";
if (sResRef=="Necklace-Exceptional") return "neck_dull_003";
break;
}
case 2:
{
if (sResRef=="Ring-Normal") return "ring_shadow_001";
if (sResRef=="Ring-Poor") return "ring_shadow_002";
if (sResRef=="Ring-Exceptional") return "ring_shadow_003";
if (sResRef=="Amulet-Normal") return "ammy_shadow_001";
if (sResRef=="Amulet-Poor") return "ammy_shadow_002";
if (sResRef=="Amulet-Exceptional") return "ammy_shadow_003";
if (sResRef=="Necklace-Normal") return "neck_shadow_001";
if (sResRef=="Necklace-Poor") return "neck_shadow_002";
if (sResRef=="Necklace-Exceptional") return "neck_shadow_003";
break;
}
case 3:
{
if (sResRef=="Ring-Normal") return "ring_copper_001";
if (sResRef=="Ring-Poor") return "ring_copper_002";
if (sResRef=="Ring-Exceptional") return "ring_copper_003";
if (sResRef=="Amulet-Normal") return "ammy_copper_001";
if (sResRef=="Amulet-Poor") return "ammy_copper_002";
if (sResRef=="Amulet-Exceptional") return "ammy_copper_003";
if (sResRef=="Necklace-Normal") return "neck_copper_001";
if (sResRef=="Necklace-Poor") return "neck_copper_002";
if (sResRef=="Necklace-Exceptional") return "neck_copper_003";
break;
}
case 4:
{
if (sResRef=="Ring-Normal") return "ring_bronze_001";
if (sResRef=="Ring-Poor") return "ring_bronze_002";
if (sResRef=="Ring-Exceptional") return "ring_bronze_003";
if (sResRef=="Amulet-Normal") return "ammy_bronze_001";
if (sResRef=="Amulet-Poor") return "ammy_bronze_002";
if (sResRef=="Amulet-Exceptional") return "ammy_bronze_003";
if (sResRef=="Necklace-Normal") return "neck_bronze_001";
if (sResRef=="Necklace-Poor") return "neck_bronze_002";
if (sResRef=="Necklace-Exceptional") return "neck_bronze_003";
break;
}
case 5:
{
if (sResRef=="Ring-Normal") return "ring_gold_001";
if (sResRef=="Ring-Poor") return "ring_gold_002";
if (sResRef=="Ring-Exceptional") return "ring_gold_003";
if (sResRef=="Amulet-Normal") return "ammy_gold_001";
if (sResRef=="Amulet-Poor") return "ammy_gold_002";
if (sResRef=="Amulet-Exceptional") return "ammy_gold_003";
if (sResRef=="Necklace-Normal") return "neck_gold_001";
if (sResRef=="Necklace-Poor") return "neck_gold_002";
if (sResRef=="Necklace-Exceptional") return "neck_gold_003";
break;
}
case 6:
{
if (sResRef=="Ring-Normal") return "ring_agapite_001";
if (sResRef=="Ring-Poor") return "ring_agapite_002";
if (sResRef=="Ring-Exceptional") return "ring_agapite_003";
if (sResRef=="Amulet-Normal") return "ammy_agapite_001";
if (sResRef=="Amulet-Poor") return "ammy_agapite_002";
if (sResRef=="Amulet-Exceptional") return "ammy_agapite_003";
if (sResRef=="Necklace-Normal") return "neck_agapite_001";
if (sResRef=="Necklace-Poor") return "neck_agapite_002";
if (sResRef=="Necklace-Exceptional") return "neck_agapite_003";
break;
}
case 7:
{
if (sResRef=="Ring-Normal") return "ring_verite_001";
if (sResRef=="Ring-Poor") return "ring_verite_002";
if (sResRef=="Ring-Exceptional") return "ring_verite_003";
if (sResRef=="Amulet-Normal") return "ammy_verite_001";
if (sResRef=="Amulet-Poor") return "ammy_verite_002";
if (sResRef=="Amulet-Exceptional") return "ammy_verite_003";
if (sResRef=="Necklace-Normal") return "neck_verite_001";
if (sResRef=="Necklace-Poor") return "neck_verite_002";
if (sResRef=="Necklace-Exceptional") return "neck_verite_003";
break;
}
case 8:
{
if (sResRef=="Ring-Normal") return "ring_val_001";
if (sResRef=="Ring-Poor") return "ring_val_002";
if (sResRef=="Ring-Exceptional") return "ring_val_003";
if (sResRef=="Amulet-Normal") return "ammy_val_001";
if (sResRef=="Amulet-Poor") return "ammy_val_002";
if (sResRef=="Amulet-Exceptional") return "ammy_val_003";
if (sResRef=="Necklace-Normal") return "neck_val_001";
if (sResRef=="Necklace-Poor") return "neck_val_002";
if (sResRef=="Necklace-Exceptional") return "neck_val_003";
break;
}
case 9:
{
if (sResRef=="Ring-Normal") return "ring_silver_001";
if (sResRef=="Ring-Poor") return "ring_silver_002";
if (sResRef=="Ring-Exceptional") return "ring_silver_003";
if (sResRef=="Amulet-Normal") return "ammy_silver_001";
if (sResRef=="Amulet-Poor") return "ammy_silver_002";
if (sResRef=="Amulet-Exceptional") return "ammy_silver_003";
if (sResRef=="Necklace-Normal") return "neck_silver_001";
if (sResRef=="Necklace-Poor") return "neck_silver_002";
if (sResRef=="Necklace-Exceptional") return "neck_silver_003";
break;
}
case 10:
{
if (sResRef=="Ring-Normal") return "ring_mithril_001";
if (sResRef=="Ring-Poor") return "ring_mithril_002";
if (sResRef=="Ring-Exceptional") return "ring_mithril_003";
if (sResRef=="Amulet-Normal") return "ammy_mithril_001";
if (sResRef=="Amulet-Poor") return "ammy_mithril_002";
if (sResRef=="Amulet-Exceptional") return "ammy_mithril_003";
if (sResRef=="Necklace-Normal") return "neck_mithril_001";
if (sResRef=="Necklace-Poor") return "neck_mithril_002";
if (sResRef=="Necklace-Exceptional") return "neck_mithril_003";
break;
}
case 11:
{
if (sResRef=="Ring-Normal") return "ring_admnt_001";
if (sResRef=="Ring-Poor") return "ring_admnt_002";
if (sResRef=="Ring-Exceptional") return "ring_admnt_003";
if (sResRef=="Amulet-Normal") return "ammy_admnt_001";
if (sResRef=="Amulet-Poor") return "ammy_admnt_002";
if (sResRef=="Amulet-Exceptional") return "ammy_admnt_003";
if (sResRef=="Necklace-Normal") return "neck_admnt_001";
if (sResRef=="Necklace-Poor") return "neck_admnt_002";
if (sResRef=="Necklace-Exceptional") return "neck_admnt_003";
break;
}
case 12:
{
if (sResRef=="Ring-Normal") return "ring_platnum_001";
if (sResRef=="Ring-Poor") return "ring_platnum_002";
if (sResRef=="Ring-Exceptional") return "ring_platnum_003";
if (sResRef=="Amulet-Normal") return "ammy_platnum_001";
if (sResRef=="Amulet-Poor") return "ammy_platnum_002";
if (sResRef=="Amulet-Exceptional") return "ammy_platnum_003";
if (sResRef=="Necklace-Normal") return "neck_platnum_001";
if (sResRef=="Necklace-Poor") return "neck_platnum_002";
if (sResRef=="Necklace-Exceptional") return "neck_platnum_003";
break;
}
default:
{
return "ring_iron_001";
break;
}
}
}
if (iJewelType>0) //Gem-Added to Jewelry
{
//SendMessageToPC(GetFirstPC(),"---------JEWELRY INFORMATION-----------");
string sTempNum = IntToString(100+iJewelType);
string sTempRet;
string sTempRet2;
string sTempRet3;
if (GetStringLeft(sResRef,4)=="Ring") sTempRet2="ring_";
if (GetStringLeft(sResRef,6)=="Amulet") sTempRet2="ammy_";
if (GetStringLeft(sResRef,8)=="Necklace") sTempRet2="neck_";
switch (iIngotType)
{
case 1:{sTempRet = "dull_";break;}
case 2:{sTempRet = "shadow_";break;}
case 3:{sTempRet = "copper_";break;}
case 4:{sTempRet = "bronze_";break;}
case 5:{sTempRet = "gold_";break;}
case 6:{sTempRet = "agapite_";break;}
case 7:{sTempRet = "verite_";break;}
case 8:{sTempRet = "val_";break;}
case 9:{sTempRet = "silver_";break;}
case 10:{sTempRet = "mithril_";break;}
case 11:{sTempRet = "admnt_";break;}
case 12:{sTempRet = "platnum_";break;}
default:{sTempRet = "iron_";break;}
}
sTempRet3=sTempRet2+sTempRet+sTempNum;
//SendMessageToPC(GetFirstPC(),sTempRet3+" -- "+sResRef);
return sTempRet3;
}
return "ring_iron_002"; //An error has occurred.. return least valueable ring
}