Added Skullkeep Mystic Forge / Combine system., modified to use a single forge and combine for all item types. Added new Magesmith shop & NPC in Town of Ascension. Full compile. Updated release archive.
109 lines
3.5 KiB
Plaintext
109 lines
3.5 KiB
Plaintext
/////::///////////////////////////////////////////////
|
|
/////:: forge_itemsplit - Separate into component properties
|
|
/////:: Modified by Winterknight on 2/18/06
|
|
/////:: Original script written by Asbury
|
|
/////:://////////////////////////////////////////////
|
|
#include "sd_lootsystem"
|
|
|
|
void main()
|
|
{
|
|
//:: Declare major variables.
|
|
effect eTel1 = EffectVisualEffect(VFX_IMP_FROST_L,FALSE);
|
|
effect eTel2 = EffectVisualEffect(VFX_IMP_ELEMENTAL_PROTECTION,FALSE);
|
|
|
|
object oForge = GetNearestObjectByTag("forge_custom",OBJECT_SELF,1);
|
|
object oCombine = GetNearestObjectByTag("forge_combine",OBJECT_SELF,1);
|
|
|
|
object oArea = GetArea(oForge);
|
|
|
|
location lTrig1 = GetLocation(oForge);
|
|
location lTrig2 = GetLocation(oCombine);
|
|
|
|
//:: Get only the first item on forge.
|
|
object oItem = GetFirstItemInInventory(oForge);
|
|
|
|
//:: Must have something in the forge.
|
|
if (!GetIsObjectValid(oItem)) return;
|
|
|
|
//:: Identify item
|
|
if (GetIdentified(oItem)==FALSE) SetIdentified (oItem, TRUE);
|
|
|
|
//:: Check for type for crafting
|
|
string sCraft;
|
|
int nType = GetLocalInt(OBJECT_SELF, "ItemType");
|
|
|
|
if (nType == 1) sCraft = "craftingbelt"; // belts and boots
|
|
else if (nType == 2) sCraft = "craftingshield"; // armor, helm, shield
|
|
else if (nType == 3) sCraft = "craftingdagger"; // melee weapons
|
|
else if (nType == 4) sCraft = "craftingcloak"; // cloaks
|
|
else if (nType == 5) sCraft = "craftingring"; // rings and ammys
|
|
else if (nType == 6) sCraft = "craftingsling"; // bows, x-bows, slings
|
|
else if (nType == 7) sCraft = "craftingdirk"; // thrown and ammo
|
|
//else if (nType == 8) sCraft = "craftingtoken"; // miscellaneous, common
|
|
else sCraft = "craftingtoken"; // anything else
|
|
|
|
itemproperty ipForgeItemIP;
|
|
int nIPDuration, nCheck, nParam1, nIPType;
|
|
ipForgeItemIP = GetFirstItemProperty(oItem);
|
|
|
|
//:: Loop for as long as the ipLoop variable is valid
|
|
while (GetIsItemPropertyValid(ipForgeItemIP))
|
|
{
|
|
nCheck = 0;
|
|
//:: Check for temporary itemprops
|
|
nIPDuration = GetItemPropertyDurationType(ipForgeItemIP);
|
|
|
|
//:: Check to see if we can prevent the unique mithril powers from being removed.
|
|
nParam1 = GetItemPropertySubType(ipForgeItemIP);
|
|
nIPType = GetItemPropertyType(ipForgeItemIP);
|
|
if (nIPType == ITEM_PROPERTY_ONHITCASTSPELL)
|
|
{
|
|
if (nParam1 == 125)
|
|
nCheck = 1;
|
|
}
|
|
if (nIPType == ITEM_PROPERTY_CAST_SPELL)
|
|
{
|
|
if (nParam1 == 329 ||
|
|
nParam1 == 335 ||
|
|
nParam1 == 359 ||
|
|
nParam1 == 537 ||
|
|
nParam1 == 513)
|
|
nCheck = 1;
|
|
}
|
|
if (Random(100) != 1 & nIPDuration == DURATION_TYPE_PERMANENT & nCheck != 1)
|
|
{
|
|
//:: Create receptacle item on Combine
|
|
object oCraft = CreateItemOnObject(sCraft, oCombine);
|
|
if (GetIsObjectValid(oCraft))
|
|
{
|
|
//:: Remove itemprop from item
|
|
RemoveItemProperty(oItem, ipForgeItemIP);
|
|
//:: Add property to crafting item
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ipForgeItemIP, oCraft);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (nCheck == 1)
|
|
{
|
|
SendMessageToPC(GetPCSpeaker(),"Unique powers not removed.");
|
|
}
|
|
else
|
|
{
|
|
SendMessageToPC(GetPCSpeaker(),"An item property was lost during the separation.");
|
|
RemoveItemProperty(oItem, ipForgeItemIP);
|
|
}
|
|
}
|
|
|
|
//:: Next itemproperty on the item
|
|
ipForgeItemIP = GetNextItemProperty(oItem);
|
|
}
|
|
|
|
string sName;
|
|
|
|
sName = ColorString("Disenchanted Item" ,80, 80, 80);
|
|
SetName(oItem, sName);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eTel1,lTrig1,0.0);
|
|
DelayCommand(0.3,ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eTel2, lTrig2, 0.0));
|
|
RecomputeStaticLighting(oArea);
|
|
} |