//:://///////////////////////////////////////////// //:: Name: pv_utils //::////////////////////////////////////////////// /* Stuff :P */ //::////////////////////////////////////////////// #include "pv_db_functions" #include "pv_config_param" // Creates the Vendor in the place the Contract was activated void DoPlayerVendor(object oPlayerActivated); // Sets the chosen item by the player in the conversation window void ChooseItem(int iNumItem); // Gets the properties in the currently chosen item string GetItemProperties(object oItem); void DoPlayerVendor(object oPlayerActivated) { object oModule = GetModule(); object oNPCMerchant; int bHasVendor = GetLocalInt(oPlayerActivated, "PV_HAS_VENDOR"); if (!bHasVendor || PV_ALLOW_MORE_THAN_ONE_MERCHANT) { oNPCMerchant = CreateObject(OBJECT_TYPE_CREATURE, "playervendor00" + IntToString(Random(10)), GetLocation(oPlayerActivated)); SetLocalObject(oNPCMerchant, "PV_MERCHANT_OWNER", oPlayerActivated); SetLocalString(oNPCMerchant, "PV_OWNER_NAME", GetName(oPlayerActivated)); SetLocalInt (oNPCMerchant, "PV_CURRENT_PAGE_NUMBER", 1); SetLocalInt(oPlayerActivated, "PV_HAS_VENDOR", TRUE); LoadItemPricesFromDatabase(oPlayerActivated, oNPCMerchant); } else { FloatingTextStringOnCreature ("You can only have one merchant at a time!", oPlayerActivated, FALSE); } } void ChooseItem(int iNumItem) { object oNPCMerchant = OBJECT_SELF; object oItem = GetLocalObject(oNPCMerchant, "PV_BACKPACK_ITEM_NUM_"+IntToString(iNumItem)); SetLocalObject(oNPCMerchant, "PV_ITEM_CHOSEN", oItem); SetLocalInt(oNPCMerchant, "PV_CONVO_OPTION_CHOSEN", iNumItem); SetCustomToken(15013, GetName(oItem)); SetCustomToken(15014, IntToString( GetLocalInt(oNPCMerchant, "PV_ITEM_PRICE" + GetName(oItem)) )); SetCustomToken(15015, IntToString(GetNumStackedItems(oItem))); SetCustomToken(15016, GetItemProperties(oItem)); } string GetItemProperties(object oItem) { string sProperties = ""; if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ABILITY_BONUS)) { sProperties = sProperties + "Ability Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS)) { sProperties = sProperties + "AC Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP)) { sProperties = sProperties + "AC Bonus vs. Alignment Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE)) { sProperties = sProperties + "AC Bonus vs. Damage Type\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP)) { sProperties = sProperties + "AC Bonus vs. Racial Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT)) { sProperties = sProperties + "AC Bonus vs. Alignment\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS)) { sProperties = sProperties + "Attack Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP)) { sProperties = sProperties + "Attack Bonus vs. Alignment Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP)) { sProperties = sProperties + "Attack Bonusvs. Racial Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT)) { sProperties = sProperties + "Attack Bonus vs. Alignment\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_BASE_ITEM_WEIGHT_REDUCTION)) { sProperties = sProperties + "Weight Reduction\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_BONUS_FEAT)) { sProperties = sProperties + "Bonus Feat\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N)) { sProperties = sProperties + "Bonus Spell Slot\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_CAST_SPELL)) { sProperties = sProperties + "Cast Spell\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS)) { sProperties = sProperties + "Damage Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP)) { sProperties = sProperties + "Damage Bonus vs. Alignment Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP)) { sProperties = sProperties + "Damage Bonus vs. Racial Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT)) { sProperties = sProperties + "Damage Bonus vs. Alignment\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_REDUCTION)) { sProperties = sProperties + "Damage Reduction\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_RESISTANCE)) { sProperties = sProperties + "Damage Resistance\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_VULNERABILITY)) { sProperties = sProperties + "Damage Vulnerability\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DARKVISION)) { sProperties = sProperties + "Darkvision\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ABILITY_SCORE)) { sProperties = sProperties + "Decreased Ability\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_AC)) { sProperties = sProperties + "Decreased AC\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER)) { sProperties = sProperties + "Decreased Attack Modifier\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_DAMAGE)) { sProperties = sProperties + "Decreased Damage\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER)) { sProperties = sProperties + "Decreased Enhancement Modifier\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS)) { sProperties = sProperties + "Decreased Saving Throws\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC)) { sProperties = sProperties + "Decreased Specific Saving Throw\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DECREASED_SKILL_MODIFIER)) { sProperties = sProperties + "Decreased Skill Modifier\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCED_CONTAINER_REDUCED_WEIGHT)) { sProperties = sProperties + "Enhanced Container Reduced Weight\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS)) { sProperties = sProperties + "Enhancement Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP)) { sProperties = sProperties + "Enhancement Bonus vs. Alignment Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP)) { sProperties = sProperties + "Enhancement Bonus vs. Racial Group\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT)) { sProperties = sProperties + "Enhancement Bonus vs. Alignment\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_EXTRA_MELEE_DAMAGE_TYPE)) { sProperties = sProperties + "Extra Melee Damage Type\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_EXTRA_RANGED_DAMAGE_TYPE)) { sProperties = sProperties + "Extra Ranged Damage Type\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_FREEDOM_OF_MOVEMENT)) { sProperties = sProperties + "Freedom of Movement\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_HASTE)) { sProperties = sProperties + "Haste\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_HOLY_AVENGER)) { sProperties = sProperties + "Holy Avenger\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE)) { sProperties = sProperties + "Immunity Damage Type\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS)) { sProperties = sProperties + "Immunity Miscellaneous\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL)) { sProperties = sProperties + "Immunity Specific Spell\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL)) { sProperties = sProperties + "Immunity Spell School\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL)) { sProperties = sProperties + "Immunity Spell Level\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_IMPROVED_EVASION)) { sProperties = sProperties + "Improved Evasion\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_KEEN)) { sProperties = sProperties + "Keen\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_LIGHT)) { sProperties = sProperties + "Light\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_MASSIVE_CRITICALS)) { sProperties = sProperties + "Massive Criticals\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_MIGHTY)) { sProperties = sProperties + "Mighty\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_MIND_BLANK)) { sProperties = sProperties + "Mind Blank\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_MONSTER_DAMAGE)) { sProperties = sProperties + "Monster Damage\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_NO_DAMAGE)) { sProperties = sProperties + "No Damage\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES)) { sProperties = sProperties + "On Hit\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_ON_MONSTER_HIT)) { sProperties = sProperties + "On Monster Hit\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_POISON)) { sProperties = sProperties + "Poison\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION)) { sProperties = sProperties + "Regeneration\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_REGENERATION_VAMPIRIC)) { sProperties = sProperties + "Vampiric Regeneration\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_SAVING_THROW_BONUS)) { sProperties = sProperties + "Saving Throw Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC)) { sProperties = sProperties + "Specific Saving Throw Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_SKILL_BONUS)) { sProperties = sProperties + "Skill Bonus\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_SPELL_RESISTANCE)) { sProperties = sProperties + "Spell Resistance\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_THIEVES_TOOLS)) { sProperties = sProperties + "Thieves Tools\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRAP)) { sProperties = sProperties + "Trap\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_TRUE_SEEING)) { sProperties = sProperties + "True Seeing\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_TURN_RESISTANCE)) { sProperties = sProperties + "Turn Resistance\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_UNLIMITED_AMMUNITION)) { sProperties = sProperties + "Unlimited Ammo\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_USE_LIMITATION_ALIGNMENT_GROUP)) { sProperties = sProperties + "Alignment Group Use Limitation\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_USE_LIMITATION_CLASS)) { sProperties = sProperties + "Class Use Limitation\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE)) { sProperties = sProperties + "Racial Use Limitation\n"; } if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_USE_LIMITATION_SPECIFIC_ALIGNMENT)) { sProperties = sProperties + "Alignment Use Limitation\n"; } return (sProperties == "") ? "This item has no special properties\n" : sProperties; }