727 lines
21 KiB
Plaintext
727 lines
21 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Scarface's Crafting System V1.0
|
|
//:: sfcs_functs_add
|
|
//::
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
All of the functions to add item properties -
|
|
DO NOT TOUCH!!!
|
|
*/
|
|
//////////////////////////////////////////////////
|
|
|
|
#include "sfcs_functs"
|
|
#include "x2_inc_itemprop"
|
|
|
|
//:: Declair Functions
|
|
void AddACBonus(object oItem);
|
|
void AddAcidBonus(object oItem);
|
|
void AddAttackBonus(object oItem);
|
|
void AddBludgeBonus(object oItem);
|
|
void AddCharismaBonus(object oItem);
|
|
void AddColdBonus(object oItem);
|
|
void AddConBonus(object oItem);
|
|
void AddDexBonus(object oItem);
|
|
void AddDivineBonus(object oItem);
|
|
void AddEnhancementBonus(object oItem);
|
|
void AddFireBonus(object oItem);
|
|
void AddHasteBonus(object oItem);
|
|
void AddHolyAvengerBonus(object oItem);
|
|
void AddKeenBonus(object oItem);
|
|
void AddMagicBonus(object oItem);
|
|
void AddNegativeBonus(object oItem);
|
|
void AddPiercingBonus(object oItem);
|
|
void AddRegenBonus(object oItem);
|
|
void AddSlashingBonus(object oItem);
|
|
void AddSonicBonus(object oItem);
|
|
void AddStrengthBonus(object oItem);
|
|
void AddTrueSeeingBonus(object oItem);
|
|
void AddWisdomBonus(object oItem);
|
|
|
|
//:: Functions
|
|
|
|
void AddACBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("AC +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_AC_BONUS const
|
|
if (iProp < MAX_AC_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_AC_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add AC bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyACBonus(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "AC +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddAcidBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Acid +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ATTACK_BONUS const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add acid bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Acid +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddAttackBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Attack +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ATTACK_BONUS const
|
|
if (iProp < MAX_ATTACK_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ATTACK_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Attack Bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAttackBonus(iProp), 0.0,
|
|
X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Attack +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddBludgeBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Bludgeoning +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ATTACK_BONUS const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add bludg bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_BLUDGEONING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Bludgeoning +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddCharismaBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Charisma +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Charisma bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_CHA,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Charisma +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddColdBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Cold +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ATTACK_BONUS const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add cold damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Cold +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddConBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Constitution +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Constitution bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Constitution +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddDexBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Dexterity +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Dexterity bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_DEX,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Dexterity +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddDivineBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Divine +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ATTACK_BONUS const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add divine damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_DIVINE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Divine +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddEnhancementBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Enhancement +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_ENHANCEMENT_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ENHANCEMENT_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Enhancement
|
|
IPUpgradeWeaponEnhancementBonus(oItem, 1);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Enhancement +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddFireBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Fire +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add fire damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Fire +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddHasteBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Haste");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove haste if valid
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_HASTE, DURATION_TYPE_PERMANENT);
|
|
|
|
// Add Haste
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyHaste(), oItem);
|
|
|
|
// Set local var
|
|
SetLocalString(OBJECT_SELF, sProp, "Haste");
|
|
}
|
|
}
|
|
void AddHolyAvengerBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Holy Avenger");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove holy avenger if valid
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_HOLY_AVENGER, DURATION_TYPE_PERMANENT);
|
|
|
|
// Add holy avenger
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyHolyAvenger(), oItem);
|
|
|
|
// Set local var
|
|
SetLocalString(OBJECT_SELF, sProp, "Holy Avenger");
|
|
}
|
|
}
|
|
void AddKeenBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Keen");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove keen if valid
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_KEEN, DURATION_TYPE_PERMANENT);
|
|
|
|
// Add Keen
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyKeen(), oItem);
|
|
|
|
// Set local var
|
|
SetLocalString(OBJECT_SELF, sProp, "Keen");
|
|
}
|
|
}
|
|
void AddMagicBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Magical +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add magical damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_MAGICAL,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Magical +" + sPropMax);
|
|
}
|
|
}
|
|
}
|
|
void AddNegativeBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Negative +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add negative damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_NEGATIVE,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Negative +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddPiercingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Piercing +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add negative damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_PIERCING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Piercing +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddRegenBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Regeneration +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_REGEN_BONUS const
|
|
if (iProp < MAX_REGEN_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_REGEN_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Regeneration bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyRegeneration(iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Regeneration +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddSlashingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Slashing +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add slashing damage
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SLASHING,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Slashing +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddSonicBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Sonic +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ENHANCEMENT const
|
|
if (iProp < MAX_DAMAGE_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_DAMAGE_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add sonic bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC,
|
|
DamageBonus(iProp)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Sonic +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddStrengthBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Strength +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Strength bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Strength +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddTrueSeeingBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("True Seeing");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Remove True Seeing if valid
|
|
IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_TRUE_SEEING, DURATION_TYPE_PERMANENT);
|
|
|
|
// Add True Seeing
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyTrueSeeing(), oItem);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "True Seeing");
|
|
}
|
|
}
|
|
void AddWisdomBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Wisdom +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Wisdom bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_WIS,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Wisdom +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|
|
void AddIntelligenceBonus(object oItem)
|
|
{
|
|
// Get the correct property slot
|
|
string sProp = GetItemPropertySlot("Intelligence +");
|
|
|
|
if (sProp != "INVALID")
|
|
{
|
|
// Get the property amount
|
|
int iProp = GetLocalInt(OBJECT_SELF, sProp);
|
|
|
|
// Check MAX_ABILITY_BONUS const
|
|
if (iProp < MAX_ABILITY_BONUS)
|
|
{
|
|
iProp++;
|
|
string sPropMax = IntToString(iProp);
|
|
|
|
if (iProp == MAX_ABILITY_BONUS)
|
|
{
|
|
sPropMax += "<có > Max</c>";
|
|
}
|
|
|
|
// Add Intelligence bonus
|
|
IPSafeAddItemProperty(oItem, ItemPropertyAbilityBonus(IP_CONST_ABILITY_INT,
|
|
iProp), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING);
|
|
|
|
// Set local vars
|
|
SetLocalString(OBJECT_SELF, sProp, "Intelligence +" + sPropMax);
|
|
SetLocalInt(OBJECT_SELF, sProp, iProp);
|
|
}
|
|
}
|
|
}
|