165 lines
9.7 KiB
Plaintext
165 lines
9.7 KiB
Plaintext
#include "x2_inc_itemprop"
|
|
|
|
//This is actually the main function.
|
|
void script(object oItem, object oPC)
|
|
{
|
|
if (GetLocalString(oPC, "LastProperty") == "EpicHelmet")
|
|
{
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject("anc_it_helm_craf", oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
return;
|
|
}
|
|
if (GetLocalString(oPC, "LastProperty") == "EpicSR")
|
|
{
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject("anc_it_belt_craf", oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
return;
|
|
}
|
|
if (GetLocalString(oPC, "LastProperty") == "EpicAC")
|
|
{
|
|
string sNew;
|
|
string sOld = GetResRef(oItem);
|
|
if (sOld == "anc_it_armor3d") sNew = "NW_CLOTH024"; //Base AC 0
|
|
if (sOld == "anc_it_earmor28") sNew = "NW_AARCL009"; //Base AC 1
|
|
if (sOld == "anc_it_earmor26") sNew = "NW_AARCL001"; //Base AC 2
|
|
if (sOld == "anc_it_earmor17") sNew = "NW_AARCL002"; //Base AC 3
|
|
if (sOld == "anc_it_earmor15") sNew = "NW_AARCL012"; //Base AC 4
|
|
if (sOld == "anc_it_earmor11") sNew = "NW_AARCL004"; //Base AC 5
|
|
if (sOld == "anc_it_earmor9") sNew = "NW_AARCL005"; //Base AC 6
|
|
if (sOld == "anc_it_earmor7") sNew = "NW_AARCL006"; //Base AC 7
|
|
if (sOld == "anc_it_earmor1") sNew = "NW_AARCL007"; //Base AC 8
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject(sNew, oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
|
|
SetIdentified(oNew ,FALSE);
|
|
int nType;
|
|
switch (GetGoldPieceValue(oNew))
|
|
{
|
|
case 1: nType = 0; break; // None
|
|
case 5: nType = 1; break; // Padded
|
|
case 10: nType = 2; break; // Leather
|
|
case 15: nType = 3; break; // Studded Leather / Hide
|
|
case 100: nType = 4; break; // Chain Shirt / Scale Mail
|
|
case 150: nType = 5; break; // Chainmail / Breastplate
|
|
case 200: nType = 6; break; // Splint Mail / Banded Mail
|
|
case 600: nType = 7; break; // Half-Plate
|
|
case 1500: nType = 8; break; // Full Plate
|
|
}
|
|
SetIdentified(oNew, TRUE);
|
|
if (nType == 0) SetLocalString(oNew, "Type", "Cloth");
|
|
else SetLocalString(oNew, "Type", "Armor");
|
|
SetLocalString(oNew, "BaseAC", IntToString(nType));
|
|
|
|
return;
|
|
}
|
|
if (GetLocalString(oPC, "LastProperty") == "Slots") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "AC") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_AC_BONUS, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "SpellResistance") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_SPELL_RESISTANCE, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "DamageReduction") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "DrainImmunity") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, -1, IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN);
|
|
if (GetLocalString(oPC, "LastProperty") == "DiseaseImmunity") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, -1, IP_CONST_IMMUNITYMISC_DISEASE);
|
|
if (GetLocalString(oPC, "LastProperty") == "PoisonImmunity") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, -1, IP_CONST_IMMUNITYMISC_POISON);
|
|
if (GetLocalString(oPC, "LastProperty") == "FearImmunity") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, -1, IP_CONST_IMMUNITYMISC_FEAR);
|
|
if (GetLocalString(oPC, "LastProperty") == "KnockdownImmunity") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, -1, IP_CONST_IMMUNITYMISC_KNOCKDOWN);
|
|
if (GetLocalString(oPC, "LastProperty") == "Regeneration") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_REGENERATION, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "Throws") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "StrengthAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_STR);
|
|
if (GetLocalString(oPC, "LastProperty") == "DexterityAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_DEX);
|
|
if (GetLocalString(oPC, "LastProperty") == "ConstitutionAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_CON);
|
|
if (GetLocalString(oPC, "LastProperty") == "IntelligenceAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_INT);
|
|
if (GetLocalString(oPC, "LastProperty") == "WisdomAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_WIS);
|
|
if (GetLocalString(oPC, "LastProperty") == "CharismaAbility") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ABILITY_BONUS, -1, IP_CONST_ABILITY_CHA);
|
|
if (GetLocalString(oPC, "LastProperty") == "Enhancement") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS, -1);
|
|
if (GetLocalString(oPC, "LastProperty") == "Perform") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_SKILL_BONUS, SKILL_PERFORM);
|
|
if (GetLocalString(oPC, "LastProperty") == "Discipline") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_SKILL_BONUS, SKILL_DISCIPLINE);
|
|
if (GetLocalString(oPC, "LastProperty") == "Resistance")
|
|
{
|
|
if (GetLocalString(oPC, "Parameter") == "Acid") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_ACID);
|
|
if (GetLocalString(oPC, "Parameter") == "Divine") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_DIVINE);
|
|
if (GetLocalString(oPC, "Parameter") == "Sonic") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_SONIC);
|
|
if (GetLocalString(oPC, "Parameter") == "Fire") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_FIRE);
|
|
if (GetLocalString(oPC, "Parameter") == "Cold") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_COLD);
|
|
if (GetLocalString(oPC, "Parameter") == "Electrical") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_ELECTRICAL);
|
|
if (GetLocalString(oPC, "Parameter") == "Negative") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_NEGATIVE);
|
|
if (GetLocalString(oPC, "Parameter") == "Magical") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_MAGICAL);
|
|
if (GetLocalString(oPC, "Parameter") == "Slashing") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_SLASHING);
|
|
if (GetLocalString(oPC, "Parameter") == "Bludgeoning") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_BLUDGEONING);
|
|
if (GetLocalString(oPC, "Parameter") == "Piercing") IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE, -1, IP_CONST_DAMAGETYPE_PIERCING);
|
|
}
|
|
if (GetTag(oItem) == "anc_it_epicsr")
|
|
{
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject("anc_it_esrb_craf", oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
SetLocalString(oPC, "LastProperty", "EpicSR");
|
|
}
|
|
if (GetTag(oItem) == "anc_it_epiche")
|
|
{
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject("it_anc_helm3a", oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
SetIdentified(oNew, TRUE);
|
|
SetLocalString(oPC, "LastProperty", "EpicHelmet");
|
|
}
|
|
if (GetTag(oItem) == "anc_it_epicar")
|
|
{
|
|
string sResRef = GetResRef(oItem);
|
|
DestroyObject(oItem);
|
|
object oNew = CreateItemOnObject(sResRef, oPC);
|
|
SetLocalInt(oNew, "Prototype", TRUE);
|
|
SetItemCursedFlag(oNew, TRUE);
|
|
SetIdentified(oNew, TRUE);
|
|
SetLocalString(oPC, "LastProperty", "EpicAC");
|
|
|
|
SetIdentified(oNew ,FALSE);
|
|
int nType;
|
|
switch (GetGoldPieceValue(oNew))
|
|
{
|
|
case 1: nType = 0; break; // None
|
|
case 5: nType = 1; break; // Padded
|
|
case 10: nType = 2; break; // Leather
|
|
case 15: nType = 3; break; // Studded Leather / Hide
|
|
case 100: nType = 4; break; // Chain Shirt / Scale Mail
|
|
case 150: nType = 5; break; // Chainmail / Breastplate
|
|
case 200: nType = 6; break; // Splint Mail / Banded Mail
|
|
case 600: nType = 7; break; // Half-Plate
|
|
case 1500: nType = 8; break; // Full Plate
|
|
}
|
|
SetIdentified(oNew, TRUE);
|
|
if (nType == 0) SetLocalString(oNew, "Type", "Cloth");
|
|
else SetLocalString(oNew, "Type", "Armor");
|
|
SetLocalString(oNew, "BaseAC", IntToString(nType));
|
|
}
|
|
return;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetPCSpeaker();
|
|
int nSlot = 0;
|
|
object oItem;
|
|
|
|
//Check if the item being crafted is equipped
|
|
while (nSlot < 18)
|
|
{
|
|
oItem = GetItemInSlot(nSlot, oPC);
|
|
if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; }
|
|
nSlot++;
|
|
}
|
|
//If the item is not equipped, search for it in the inventory
|
|
oItem = GetFirstItemInInventory(oPC);
|
|
while (GetIsObjectValid(oItem))
|
|
{
|
|
if (GetLocalInt(oItem, "Prototype") == TRUE) {script(oItem, oPC); return; }
|
|
oItem = GetNextItemInInventory(oPC);
|
|
}
|
|
}
|