[Quest API] Modify GetItemStat() and GetSpellStat() functionality. (#1509)

- Added quest::getitemstat(item_id, stat_identifier) to Perl.
- Added quest::getspellstat(spell_id, stat_identifier, slot) to Perl.
- Added eq.get_item_stat(item_id, stat_identifier) to Lua.
- Added eq.get_spell_stat(spell_id, stat_identifier, slot) to Lua.

Wasn't sure where to put the GetItemStatValue() method so I put it in inventory profile, I can move it wherever is preferred.

These additions will allow people to grab item and spell stat values in plugins without needing a mob object.
This commit is contained in:
Kinglykrab 2021-08-31 02:31:56 -04:00 committed by GitHub
parent 87a4f64ff0
commit fec1b1538e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 523 additions and 450 deletions

View File

@ -190,6 +190,7 @@ namespace EQ
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
static int GetItemStatValue(uint32 item_id, const char* identifier);
protected:
///////////////////////////////
// Protected Methods

View File

@ -1357,3 +1357,116 @@ bool SpellRequiresTarget(int spell_id)
}
return true;
}
int GetSpellStatValue(uint32 spell_id, const char* stat_identifier, uint8 slot)
{
if (!IsValidSpell(spell_id))
return 0;
if (!stat_identifier)
return 0;
if (slot > 0)
slot -= 1;
std::string id = stat_identifier;
for(uint32 i = 0; i < id.length(); ++i) {
id[i] = tolower(id[i]);
}
if (slot < 16) {
if (id == "classes") { return spells[spell_id].classes[slot]; }
else if (id == "deities") { return spells[spell_id].deities[slot]; }
}
if (slot < 12) {
if (id == "base") { return spells[spell_id].base[slot]; }
else if (id == "base2") { return spells[spell_id].base2[slot]; }
else if (id == "max") { return spells[spell_id].max[slot]; }
else if (id == "formula") { return spells[spell_id].formula[slot]; }
else if (id == "effectid") { return spells[spell_id].effectid[slot]; }
}
if (slot < 4) {
if (id == "components") { return spells[spell_id].components[slot]; }
else if (id == "component_counts") { return spells[spell_id].component_counts[slot]; }
else if (id == "NoexpendReagent") { return spells[spell_id].NoexpendReagent[slot]; }
}
if (id == "range") { return static_cast<int32>(spells[spell_id].range); }
else if (id == "aoerange") { return static_cast<int32>(spells[spell_id].aoerange); }
else if (id == "pushback") { return static_cast<int32>(spells[spell_id].pushback); }
else if (id == "pushup") { return static_cast<int32>(spells[spell_id].pushup); }
else if (id == "cast_time") { return spells[spell_id].cast_time; }
else if (id == "recovery_time") { return spells[spell_id].recovery_time; }
else if (id == "recast_time") { return spells[spell_id].recast_time; }
else if (id == "buffdurationformula") { return spells[spell_id].buffdurationformula; }
else if (id == "buffduration") { return spells[spell_id].buffduration; }
else if (id == "AEDuration") { return spells[spell_id].AEDuration; }
else if (id == "mana") { return spells[spell_id].mana; }
//else if (id == "LightType") {stat = spells[spell_id].LightType; } - Not implemented
else if (id == "goodEffect") { return spells[spell_id].goodEffect; }
else if (id == "Activated") { return spells[spell_id].Activated; }
else if (id == "resisttype") { return spells[spell_id].resisttype; }
else if (id == "targettype") { return spells[spell_id].targettype; }
else if (id == "basediff") { return spells[spell_id].basediff; }
else if (id == "skill") { return spells[spell_id].skill; }
else if (id == "zonetype") { return spells[spell_id].zonetype; }
else if (id == "EnvironmentType") { return spells[spell_id].EnvironmentType; }
else if (id == "TimeOfDay") { return spells[spell_id].TimeOfDay; }
else if (id == "CastingAnim") { return spells[spell_id].CastingAnim; }
else if (id == "SpellAffectIndex") { return spells[spell_id].SpellAffectIndex; }
else if (id == "disallow_sit") { return spells[spell_id].disallow_sit; }
//else if (id == "spellanim") {stat = spells[spell_id].spellanim; } - Not implemented
else if (id == "uninterruptable") { return spells[spell_id].uninterruptable; }
else if (id == "ResistDiff") { return spells[spell_id].ResistDiff; }
else if (id == "dot_stacking_exempt") { return spells[spell_id].dot_stacking_exempt; }
else if (id == "RecourseLink") { return spells[spell_id].RecourseLink; }
else if (id == "no_partial_resist") { return spells[spell_id].no_partial_resist; }
else if (id == "short_buff_box") { return spells[spell_id].short_buff_box; }
else if (id == "descnum") { return spells[spell_id].descnum; }
else if (id == "effectdescnum") { return spells[spell_id].effectdescnum; }
else if (id == "npc_no_los") { return spells[spell_id].npc_no_los; }
else if (id == "reflectable") { return spells[spell_id].reflectable; }
else if (id == "bonushate") { return spells[spell_id].bonushate; }
else if (id == "EndurCost") { return spells[spell_id].EndurCost; }
else if (id == "EndurTimerIndex") { return spells[spell_id].EndurTimerIndex; }
else if (id == "IsDisciplineBuff") { return spells[spell_id].IsDisciplineBuff; }
else if (id == "HateAdded") { return spells[spell_id].HateAdded; }
else if (id == "EndurUpkeep") { return spells[spell_id].EndurUpkeep; }
else if (id == "numhitstype") { return spells[spell_id].numhitstype; }
else if (id == "numhits") { return spells[spell_id].numhits; }
else if (id == "pvpresistbase") { return spells[spell_id].pvpresistbase; }
else if (id == "pvpresistcalc") { return spells[spell_id].pvpresistcalc; }
else if (id == "pvpresistcap") { return spells[spell_id].pvpresistcap; }
else if (id == "spell_category") { return spells[spell_id].spell_category; }
else if (id == "can_mgb") { return spells[spell_id].can_mgb; }
else if (id == "dispel_flag") { return spells[spell_id].dispel_flag; }
else if (id == "MinResist") { return spells[spell_id].MinResist; }
else if (id == "MaxResist") { return spells[spell_id].MaxResist; }
else if (id == "viral_targets") { return spells[spell_id].viral_targets; }
else if (id == "viral_timer") { return spells[spell_id].viral_timer; }
else if (id == "NimbusEffect") { return spells[spell_id].NimbusEffect; }
else if (id == "directional_start") { return static_cast<int32>(spells[spell_id].directional_start); }
else if (id == "directional_end") { return static_cast<int32>(spells[spell_id].directional_end); }
else if (id == "not_focusable") { return spells[spell_id].not_focusable; }
else if (id == "suspendable") { return spells[spell_id].suspendable; }
else if (id == "viral_range") { return spells[spell_id].viral_range; }
else if (id == "spellgroup") { return spells[spell_id].spellgroup; }
else if (id == "rank") { return spells[spell_id].rank; }
else if (id == "no_resist") { return spells[spell_id].no_resist; }
else if (id == "CastRestriction") { return spells[spell_id].CastRestriction; }
else if (id == "AllowRest") { return spells[spell_id].AllowRest; }
else if (id == "InCombat") { return spells[spell_id].InCombat; }
else if (id == "OutofCombat") { return spells[spell_id].OutofCombat; }
else if (id == "aemaxtargets") { return spells[spell_id].aemaxtargets; }
else if (id == "no_heal_damage_item_mod") { return spells[spell_id].no_heal_damage_item_mod; }
else if (id == "persistdeath") { return spells[spell_id].persistdeath; }
else if (id == "min_dist") { return static_cast<int32>(spells[spell_id].min_dist); }
else if (id == "min_dist_mod") { return static_cast<int32>(spells[spell_id].min_dist_mod); }
else if (id == "max_dist") { return static_cast<int32>(spells[spell_id].max_dist); }
else if (id == "min_range") { return static_cast<int32>(spells[spell_id].min_range); }
else if (id == "DamageShieldType") { return spells[spell_id].DamageShieldType; }
return 0;
}

View File

@ -1495,5 +1495,6 @@ int32 GetFuriousBash(uint16 spell_id);
bool IsShortDurationBuff(uint16 spell_id);
bool IsSpellUsableThisZoneType(uint16 spell_id, uint8 zone_type);
const char *GetSpellName(uint16 spell_id);
int GetSpellStatValue(uint32 spell_id, const char* stat_identifier, uint8 slot = 0);
#endif

View File

@ -6839,6 +6839,47 @@ XS(XS__get_data_remaining) {
XSRETURN(1);
}
XS(XS__getitemstat);
XS(XS__getitemstat) {
dXSARGS;
int stat_value;
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::getitemstat(uint32 item_id, string stat_identifier)");
dXSTARG;
uint32 item_id = (uint32) SvUV(ST(0));
std::string stat_identifier = (std::string) SvPV_nolen(ST(1));
stat_value = quest_manager.getitemstat(item_id, stat_identifier);
XSprePUSH;
PUSHi((IV)stat_value);
XSRETURN(1);
}
XS(XS__getspellstat);
XS(XS__getspellstat) {
dXSARGS;
int stat_value;
if (items != 2 && items != 3)
Perl_croak(aTHX_ "Usage: quest::getspellstat(uint32 spell_id, string stat_identifier, uint8 slot)");
dXSTARG;
uint32 spell_id = (uint32) SvUV(ST(0));
std::string stat_identifier = (std::string) SvPV_nolen(ST(1));
uint8 slot = 0;
if (items == 3)
slot = (uint8) SvUV(ST(2));
stat_value = quest_manager.getspellstat(spell_id, stat_identifier, slot);
XSprePUSH;
PUSHi((IV)stat_value);
XSRETURN(1);
}
/*
This is the callback perl will look for to setup the
quest package's XSUBs
@ -7077,6 +7118,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
newXS(strcpy(buf, "getitemname"), XS__getitemname, file);
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
newXS(strcpy(buf, "getitemstat"), XS__getitemstat, file);
newXS(strcpy(buf, "getnpcnamebyid"), XS__getnpcnamebyid, file);
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
newXS(strcpy(buf, "getcharnamebyid"), XS__getcharnamebyid, file);
@ -7091,6 +7133,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "getracename"), XS__getracename, file);
newXS(strcpy(buf, "getspellname"), XS__getspellname, file);
newXS(strcpy(buf, "get_spell_level"), XS__get_spell_level, file);
newXS(strcpy(buf, "getspellstat"), XS__getspellstat, file);
newXS(strcpy(buf, "getskillname"), XS__getskillname, file);
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);

View File

@ -3653,3 +3653,341 @@ std::string EQ::InventoryProfile::GetCustomItemData(int16 slot_id, std::string i
}
return "";
}
int EQ::InventoryProfile::GetItemStatValue(uint32 item_id, const char* identifier) {
const EQ::ItemInstance* inst = database.CreateItem(item_id);
if (!inst)
return 0;
const EQ::ItemData* item = inst->GetItem();
if (!item)
return 0;
if (!identifier)
return 0;
int32 stat = 0;
std::string id = identifier;
for(uint32 i = 0; i < id.length(); ++i) {
id[i] = tolower(id[i]);
}
if (id == "itemclass")
stat = int32(item->ItemClass);
if (id == "id")
stat = int32(item->ID);
if (id == "idfile")
stat = atoi(&item->IDFile[2]);
if (id == "weight")
stat = int32(item->Weight);
if (id == "norent")
stat = int32(item->NoRent);
if (id == "nodrop")
stat = int32(item->NoDrop);
if (id == "size")
stat = int32(item->Size);
if (id == "slots")
stat = int32(item->Slots);
if (id == "price")
stat = int32(item->Price);
if (id == "icon")
stat = int32(item->Icon);
if (id == "loregroup")
stat = int32(item->LoreGroup);
if (id == "loreflag")
stat = int32(item->LoreFlag);
if (id == "pendingloreflag")
stat = int32(item->PendingLoreFlag);
if (id == "artifactflag")
stat = int32(item->ArtifactFlag);
if (id == "summonedflag")
stat = int32(item->SummonedFlag);
if (id == "fvnodrop")
stat = int32(item->FVNoDrop);
if (id == "favor")
stat = int32(item->Favor);
if (id == "guildfavor")
stat = int32(item->GuildFavor);
if (id == "pointtype")
stat = int32(item->PointType);
if (id == "bagtype")
stat = int32(item->BagType);
if (id == "bagslots")
stat = int32(item->BagSlots);
if (id == "bagsize")
stat = int32(item->BagSize);
if (id == "bagwr")
stat = int32(item->BagWR);
if (id == "benefitflag")
stat = int32(item->BenefitFlag);
if (id == "tradeskills")
stat = int32(item->Tradeskills);
if (id == "cr")
stat = int32(item->CR);
if (id == "dr")
stat = int32(item->DR);
if (id == "pr")
stat = int32(item->PR);
if (id == "mr")
stat = int32(item->MR);
if (id == "fr")
stat = int32(item->FR);
if (id == "astr")
stat = int32(item->AStr);
if (id == "asta")
stat = int32(item->ASta);
if (id == "aagi")
stat = int32(item->AAgi);
if (id == "adex")
stat = int32(item->ADex);
if (id == "acha")
stat = int32(item->ACha);
if (id == "aint")
stat = int32(item->AInt);
if (id == "awis")
stat = int32(item->AWis);
if (id == "hp")
stat = int32(item->HP);
if (id == "mana")
stat = int32(item->Mana);
if (id == "ac")
stat = int32(item->AC);
if (id == "deity")
stat = int32(item->Deity);
if (id == "skillmodvalue")
stat = int32(item->SkillModValue);
if (id == "skillmodtype")
stat = int32(item->SkillModType);
if (id == "banedmgrace")
stat = int32(item->BaneDmgRace);
if (id == "banedmgamt")
stat = int32(item->BaneDmgAmt);
if (id == "banedmgbody")
stat = int32(item->BaneDmgBody);
if (id == "magic")
stat = int32(item->Magic);
if (id == "casttime_")
stat = int32(item->CastTime_);
if (id == "reqlevel")
stat = int32(item->ReqLevel);
if (id == "bardtype")
stat = int32(item->BardType);
if (id == "bardvalue")
stat = int32(item->BardValue);
if (id == "light")
stat = int32(item->Light);
if (id == "delay")
stat = int32(item->Delay);
if (id == "reclevel")
stat = int32(item->RecLevel);
if (id == "recskill")
stat = int32(item->RecSkill);
if (id == "elemdmgtype")
stat = int32(item->ElemDmgType);
if (id == "elemdmgamt")
stat = int32(item->ElemDmgAmt);
if (id == "range")
stat = int32(item->Range);
if (id == "damage")
stat = int32(item->Damage);
if (id == "color")
stat = int32(item->Color);
if (id == "classes")
stat = int32(item->Classes);
if (id == "races")
stat = int32(item->Races);
if (id == "maxcharges")
stat = int32(item->MaxCharges);
if (id == "itemtype")
stat = int32(item->ItemType);
if (id == "material")
stat = int32(item->Material);
if (id == "casttime")
stat = int32(item->CastTime);
if (id == "elitematerial")
stat = int32(item->EliteMaterial);
if (id == "herosforgemodel")
stat = int32(item->HerosForgeModel);
if (id == "procrate")
stat = int32(item->ProcRate);
if (id == "combateffects")
stat = int32(item->CombatEffects);
if (id == "shielding")
stat = int32(item->Shielding);
if (id == "stunresist")
stat = int32(item->StunResist);
if (id == "strikethrough")
stat = int32(item->StrikeThrough);
if (id == "extradmgskill")
stat = int32(item->ExtraDmgSkill);
if (id == "extradmgamt")
stat = int32(item->ExtraDmgAmt);
if (id == "spellshield")
stat = int32(item->SpellShield);
if (id == "avoidance")
stat = int32(item->Avoidance);
if (id == "accuracy")
stat = int32(item->Accuracy);
if (id == "charmfileid")
stat = int32(item->CharmFileID);
if (id == "factionmod1")
stat = int32(item->FactionMod1);
if (id == "factionmod2")
stat = int32(item->FactionMod2);
if (id == "factionmod3")
stat = int32(item->FactionMod3);
if (id == "factionmod4")
stat = int32(item->FactionMod4);
if (id == "factionamt1")
stat = int32(item->FactionAmt1);
if (id == "factionamt2")
stat = int32(item->FactionAmt2);
if (id == "factionamt3")
stat = int32(item->FactionAmt3);
if (id == "factionamt4")
stat = int32(item->FactionAmt4);
if (id == "augtype")
stat = int32(item->AugType);
if (id == "ldontheme")
stat = int32(item->LDoNTheme);
if (id == "ldonprice")
stat = int32(item->LDoNPrice);
if (id == "ldonsold")
stat = int32(item->LDoNSold);
if (id == "banedmgraceamt")
stat = int32(item->BaneDmgRaceAmt);
if (id == "augrestrict")
stat = int32(item->AugRestrict);
if (id == "endur")
stat = int32(item->Endur);
if (id == "dotshielding")
stat = int32(item->DotShielding);
if (id == "attack")
stat = int32(item->Attack);
if (id == "regen")
stat = int32(item->Regen);
if (id == "manaregen")
stat = int32(item->ManaRegen);
if (id == "enduranceregen")
stat = int32(item->EnduranceRegen);
if (id == "haste")
stat = int32(item->Haste);
if (id == "damageshield")
stat = int32(item->DamageShield);
if (id == "recastdelay")
stat = int32(item->RecastDelay);
if (id == "recasttype")
stat = int32(item->RecastType);
if (id == "augdistiller")
stat = int32(item->AugDistiller);
if (id == "attuneable")
stat = int32(item->Attuneable);
if (id == "nopet")
stat = int32(item->NoPet);
if (id == "potionbelt")
stat = int32(item->PotionBelt);
if (id == "stackable")
stat = int32(item->Stackable);
if (id == "notransfer")
stat = int32(item->NoTransfer);
if (id == "questitemflag")
stat = int32(item->QuestItemFlag);
if (id == "stacksize")
stat = int32(item->StackSize);
if (id == "potionbeltslots")
stat = int32(item->PotionBeltSlots);
if (id == "book")
stat = int32(item->Book);
if (id == "booktype")
stat = int32(item->BookType);
if (id == "svcorruption")
stat = int32(item->SVCorruption);
if (id == "purity")
stat = int32(item->Purity);
if (id == "backstabdmg")
stat = int32(item->BackstabDmg);
if (id == "dsmitigation")
stat = int32(item->DSMitigation);
if (id == "heroicstr")
stat = int32(item->HeroicStr);
if (id == "heroicint")
stat = int32(item->HeroicInt);
if (id == "heroicwis")
stat = int32(item->HeroicWis);
if (id == "heroicagi")
stat = int32(item->HeroicAgi);
if (id == "heroicdex")
stat = int32(item->HeroicDex);
if (id == "heroicsta")
stat = int32(item->HeroicSta);
if (id == "heroiccha")
stat = int32(item->HeroicCha);
if (id == "heroicmr")
stat = int32(item->HeroicMR);
if (id == "heroicfr")
stat = int32(item->HeroicFR);
if (id == "heroiccr")
stat = int32(item->HeroicCR);
if (id == "heroicdr")
stat = int32(item->HeroicDR);
if (id == "heroicpr")
stat = int32(item->HeroicPR);
if (id == "heroicsvcorrup")
stat = int32(item->HeroicSVCorrup);
if (id == "healamt")
stat = int32(item->HealAmt);
if (id == "spelldmg")
stat = int32(item->SpellDmg);
if (id == "ldonsellbackrate")
stat = int32(item->LDoNSellBackRate);
if (id == "scriptfileid")
stat = int32(item->ScriptFileID);
if (id == "expendablearrow")
stat = int32(item->ExpendableArrow);
if (id == "clairvoyance")
stat = int32(item->Clairvoyance);
// Begin Effects
if (id == "clickeffect")
stat = int32(item->Click.Effect);
if (id == "clicktype")
stat = int32(item->Click.Type);
if (id == "clicklevel")
stat = int32(item->Click.Level);
if (id == "clicklevel2")
stat = int32(item->Click.Level2);
if (id == "proceffect")
stat = int32(item->Proc.Effect);
if (id == "proctype")
stat = int32(item->Proc.Type);
if (id == "proclevel")
stat = int32(item->Proc.Level);
if (id == "proclevel2")
stat = int32(item->Proc.Level2);
if (id == "worneffect")
stat = int32(item->Worn.Effect);
if (id == "worntype")
stat = int32(item->Worn.Type);
if (id == "wornlevel")
stat = int32(item->Worn.Level);
if (id == "wornlevel2")
stat = int32(item->Worn.Level2);
if (id == "focuseffect")
stat = int32(item->Focus.Effect);
if (id == "focustype")
stat = int32(item->Focus.Type);
if (id == "focuslevel")
stat = int32(item->Focus.Level);
if (id == "focuslevel2")
stat = int32(item->Focus.Level2);
if (id == "scrolleffect")
stat = int32(item->Scroll.Effect);
if (id == "scrolltype")
stat = int32(item->Scroll.Type);
if (id == "scrolllevel")
stat = int32(item->Scroll.Level);
if (id == "scrolllevel2")
stat = int32(item->Scroll.Level2);
safe_delete(inst);
return stat;
}

View File

@ -2479,6 +2479,18 @@ std::string lua_get_data_remaining(std::string bucket_name) {
return DataBucket::GetDataRemaining(bucket_name);
}
int lua_get_item_stat(uint32 item_id, std::string stat_identifier) {
return quest_manager.getitemstat(item_id, stat_identifier);
}
int lua_get_spell_stat(uint32 spell_id, std::string stat_identifier) {
return quest_manager.getspellstat(spell_id, stat_identifier);
}
int lua_get_spell_stat(uint32 spell_id, std::string stat_identifier, uint8 slot) {
return quest_manager.getspellstat(spell_id, stat_identifier, slot);
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@ -3049,6 +3061,9 @@ luabind::scope lua_register_general() {
luabind::def("get_inventory_slot_name", &lua_get_inventory_slot_name),
luabind::def("rename", &lua_rename),
luabind::def("get_data_remaining", &lua_get_data_remaining),
luabind::def("get_item_stat", &lua_get_item_stat),
luabind::def("get_spell_stat", (int(*)(uint32,std::string))&lua_get_spell_stat),
luabind::def("get_spell_stat", (int(*)(uint32,std::string,uint8))&lua_get_spell_stat),
/**
* Expansions

View File

@ -4060,343 +4060,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
{
const EQ::ItemInstance* inst = database.CreateItem(itemid);
if (!inst)
return 0;
const EQ::ItemData* item = inst->GetItem();
if (!item)
return 0;
if (!identifier)
return 0;
int32 stat = 0;
std::string id = identifier;
for(uint32 i = 0; i < id.length(); ++i)
{
id[i] = tolower(id[i]);
}
if (id == "itemclass")
stat = int32(item->ItemClass);
if (id == "id")
stat = int32(item->ID);
if (id == "idfile")
stat = atoi(&item->IDFile[2]);
if (id == "weight")
stat = int32(item->Weight);
if (id == "norent")
stat = int32(item->NoRent);
if (id == "nodrop")
stat = int32(item->NoDrop);
if (id == "size")
stat = int32(item->Size);
if (id == "slots")
stat = int32(item->Slots);
if (id == "price")
stat = int32(item->Price);
if (id == "icon")
stat = int32(item->Icon);
if (id == "loregroup")
stat = int32(item->LoreGroup);
if (id == "loreflag")
stat = int32(item->LoreFlag);
if (id == "pendingloreflag")
stat = int32(item->PendingLoreFlag);
if (id == "artifactflag")
stat = int32(item->ArtifactFlag);
if (id == "summonedflag")
stat = int32(item->SummonedFlag);
if (id == "fvnodrop")
stat = int32(item->FVNoDrop);
if (id == "favor")
stat = int32(item->Favor);
if (id == "guildfavor")
stat = int32(item->GuildFavor);
if (id == "pointtype")
stat = int32(item->PointType);
if (id == "bagtype")
stat = int32(item->BagType);
if (id == "bagslots")
stat = int32(item->BagSlots);
if (id == "bagsize")
stat = int32(item->BagSize);
if (id == "bagwr")
stat = int32(item->BagWR);
if (id == "benefitflag")
stat = int32(item->BenefitFlag);
if (id == "tradeskills")
stat = int32(item->Tradeskills);
if (id == "cr")
stat = int32(item->CR);
if (id == "dr")
stat = int32(item->DR);
if (id == "pr")
stat = int32(item->PR);
if (id == "mr")
stat = int32(item->MR);
if (id == "fr")
stat = int32(item->FR);
if (id == "astr")
stat = int32(item->AStr);
if (id == "asta")
stat = int32(item->ASta);
if (id == "aagi")
stat = int32(item->AAgi);
if (id == "adex")
stat = int32(item->ADex);
if (id == "acha")
stat = int32(item->ACha);
if (id == "aint")
stat = int32(item->AInt);
if (id == "awis")
stat = int32(item->AWis);
if (id == "hp")
stat = int32(item->HP);
if (id == "mana")
stat = int32(item->Mana);
if (id == "ac")
stat = int32(item->AC);
if (id == "deity")
stat = int32(item->Deity);
if (id == "skillmodvalue")
stat = int32(item->SkillModValue);
if (id == "skillmodtype")
stat = int32(item->SkillModType);
if (id == "banedmgrace")
stat = int32(item->BaneDmgRace);
if (id == "banedmgamt")
stat = int32(item->BaneDmgAmt);
if (id == "banedmgbody")
stat = int32(item->BaneDmgBody);
if (id == "magic")
stat = int32(item->Magic);
if (id == "casttime_")
stat = int32(item->CastTime_);
if (id == "reqlevel")
stat = int32(item->ReqLevel);
if (id == "bardtype")
stat = int32(item->BardType);
if (id == "bardvalue")
stat = int32(item->BardValue);
if (id == "light")
stat = int32(item->Light);
if (id == "delay")
stat = int32(item->Delay);
if (id == "reclevel")
stat = int32(item->RecLevel);
if (id == "recskill")
stat = int32(item->RecSkill);
if (id == "elemdmgtype")
stat = int32(item->ElemDmgType);
if (id == "elemdmgamt")
stat = int32(item->ElemDmgAmt);
if (id == "range")
stat = int32(item->Range);
if (id == "damage")
stat = int32(item->Damage);
if (id == "color")
stat = int32(item->Color);
if (id == "classes")
stat = int32(item->Classes);
if (id == "races")
stat = int32(item->Races);
if (id == "maxcharges")
stat = int32(item->MaxCharges);
if (id == "itemtype")
stat = int32(item->ItemType);
if (id == "material")
stat = int32(item->Material);
if (id == "casttime")
stat = int32(item->CastTime);
if (id == "elitematerial")
stat = int32(item->EliteMaterial);
if (id == "herosforgemodel")
stat = int32(item->HerosForgeModel);
if (id == "procrate")
stat = int32(item->ProcRate);
if (id == "combateffects")
stat = int32(item->CombatEffects);
if (id == "shielding")
stat = int32(item->Shielding);
if (id == "stunresist")
stat = int32(item->StunResist);
if (id == "strikethrough")
stat = int32(item->StrikeThrough);
if (id == "extradmgskill")
stat = int32(item->ExtraDmgSkill);
if (id == "extradmgamt")
stat = int32(item->ExtraDmgAmt);
if (id == "spellshield")
stat = int32(item->SpellShield);
if (id == "avoidance")
stat = int32(item->Avoidance);
if (id == "accuracy")
stat = int32(item->Accuracy);
if (id == "charmfileid")
stat = int32(item->CharmFileID);
if (id == "factionmod1")
stat = int32(item->FactionMod1);
if (id == "factionmod2")
stat = int32(item->FactionMod2);
if (id == "factionmod3")
stat = int32(item->FactionMod3);
if (id == "factionmod4")
stat = int32(item->FactionMod4);
if (id == "factionamt1")
stat = int32(item->FactionAmt1);
if (id == "factionamt2")
stat = int32(item->FactionAmt2);
if (id == "factionamt3")
stat = int32(item->FactionAmt3);
if (id == "factionamt4")
stat = int32(item->FactionAmt4);
if (id == "augtype")
stat = int32(item->AugType);
if (id == "ldontheme")
stat = int32(item->LDoNTheme);
if (id == "ldonprice")
stat = int32(item->LDoNPrice);
if (id == "ldonsold")
stat = int32(item->LDoNSold);
if (id == "banedmgraceamt")
stat = int32(item->BaneDmgRaceAmt);
if (id == "augrestrict")
stat = int32(item->AugRestrict);
if (id == "endur")
stat = int32(item->Endur);
if (id == "dotshielding")
stat = int32(item->DotShielding);
if (id == "attack")
stat = int32(item->Attack);
if (id == "regen")
stat = int32(item->Regen);
if (id == "manaregen")
stat = int32(item->ManaRegen);
if (id == "enduranceregen")
stat = int32(item->EnduranceRegen);
if (id == "haste")
stat = int32(item->Haste);
if (id == "damageshield")
stat = int32(item->DamageShield);
if (id == "recastdelay")
stat = int32(item->RecastDelay);
if (id == "recasttype")
stat = int32(item->RecastType);
if (id == "augdistiller")
stat = int32(item->AugDistiller);
if (id == "attuneable")
stat = int32(item->Attuneable);
if (id == "nopet")
stat = int32(item->NoPet);
if (id == "potionbelt")
stat = int32(item->PotionBelt);
if (id == "stackable")
stat = int32(item->Stackable);
if (id == "notransfer")
stat = int32(item->NoTransfer);
if (id == "questitemflag")
stat = int32(item->QuestItemFlag);
if (id == "stacksize")
stat = int32(item->StackSize);
if (id == "potionbeltslots")
stat = int32(item->PotionBeltSlots);
if (id == "book")
stat = int32(item->Book);
if (id == "booktype")
stat = int32(item->BookType);
if (id == "svcorruption")
stat = int32(item->SVCorruption);
if (id == "purity")
stat = int32(item->Purity);
if (id == "backstabdmg")
stat = int32(item->BackstabDmg);
if (id == "dsmitigation")
stat = int32(item->DSMitigation);
if (id == "heroicstr")
stat = int32(item->HeroicStr);
if (id == "heroicint")
stat = int32(item->HeroicInt);
if (id == "heroicwis")
stat = int32(item->HeroicWis);
if (id == "heroicagi")
stat = int32(item->HeroicAgi);
if (id == "heroicdex")
stat = int32(item->HeroicDex);
if (id == "heroicsta")
stat = int32(item->HeroicSta);
if (id == "heroiccha")
stat = int32(item->HeroicCha);
if (id == "heroicmr")
stat = int32(item->HeroicMR);
if (id == "heroicfr")
stat = int32(item->HeroicFR);
if (id == "heroiccr")
stat = int32(item->HeroicCR);
if (id == "heroicdr")
stat = int32(item->HeroicDR);
if (id == "heroicpr")
stat = int32(item->HeroicPR);
if (id == "heroicsvcorrup")
stat = int32(item->HeroicSVCorrup);
if (id == "healamt")
stat = int32(item->HealAmt);
if (id == "spelldmg")
stat = int32(item->SpellDmg);
if (id == "ldonsellbackrate")
stat = int32(item->LDoNSellBackRate);
if (id == "scriptfileid")
stat = int32(item->ScriptFileID);
if (id == "expendablearrow")
stat = int32(item->ExpendableArrow);
if (id == "clairvoyance")
stat = int32(item->Clairvoyance);
// Begin Effects
if (id == "clickeffect")
stat = int32(item->Click.Effect);
if (id == "clicktype")
stat = int32(item->Click.Type);
if (id == "clicklevel")
stat = int32(item->Click.Level);
if (id == "clicklevel2")
stat = int32(item->Click.Level2);
if (id == "proceffect")
stat = int32(item->Proc.Effect);
if (id == "proctype")
stat = int32(item->Proc.Type);
if (id == "proclevel")
stat = int32(item->Proc.Level);
if (id == "proclevel2")
stat = int32(item->Proc.Level2);
if (id == "worneffect")
stat = int32(item->Worn.Effect);
if (id == "worntype")
stat = int32(item->Worn.Type);
if (id == "wornlevel")
stat = int32(item->Worn.Level);
if (id == "wornlevel2")
stat = int32(item->Worn.Level2);
if (id == "focuseffect")
stat = int32(item->Focus.Effect);
if (id == "focustype")
stat = int32(item->Focus.Type);
if (id == "focuslevel")
stat = int32(item->Focus.Level);
if (id == "focuslevel2")
stat = int32(item->Focus.Level2);
if (id == "scrolleffect")
stat = int32(item->Scroll.Effect);
if (id == "scrolltype")
stat = int32(item->Scroll.Type);
if (id == "scrolllevel")
stat = int32(item->Scroll.Level);
if (id == "scrolllevel2")
stat = int32(item->Scroll.Level2);
safe_delete(inst);
return stat;
return EQ::InventoryProfile::GetItemStatValue(itemid, identifier);
}
std::string Mob::GetGlobal(const char *varname) {
@ -5805,119 +5469,7 @@ bool Mob::GetSeeInvisible(uint8 see_invis)
int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
{
if (!IsValidSpell(spell_id))
return 0;
if (!identifier)
return 0;
int32 stat = 0;
if (slot > 0)
slot = slot - 1;
std::string id = identifier;
for(uint32 i = 0; i < id.length(); ++i)
{
id[i] = tolower(id[i]);
}
if (slot < 16){
if (id == "classes") {return spells[spell_id].classes[slot]; }
else if (id == "deities") {return spells[spell_id].deities[slot];}
}
if (slot < 12){
if (id == "base") {return spells[spell_id].base[slot];}
else if (id == "base2") {return spells[spell_id].base2[slot];}
else if (id == "max") {return spells[spell_id].max[slot];}
else if (id == "formula") {return spells[spell_id].formula[slot];}
else if (id == "effectid") {return spells[spell_id].effectid[slot];}
}
if (slot < 4){
if (id == "components") { return spells[spell_id].components[slot];}
else if (id == "component_counts") { return spells[spell_id].component_counts[slot];}
else if (id == "NoexpendReagent") {return spells[spell_id].NoexpendReagent[slot];}
}
if (id == "range") {return static_cast<int32>(spells[spell_id].range); }
else if (id == "aoerange") {return static_cast<int32>(spells[spell_id].aoerange);}
else if (id == "pushback") {return static_cast<int32>(spells[spell_id].pushback);}
else if (id == "pushup") {return static_cast<int32>(spells[spell_id].pushup);}
else if (id == "cast_time") {return spells[spell_id].cast_time;}
else if (id == "recovery_time") {return spells[spell_id].recovery_time;}
else if (id == "recast_time") {return spells[spell_id].recast_time;}
else if (id == "buffdurationformula") {return spells[spell_id].buffdurationformula;}
else if (id == "buffduration") {return spells[spell_id].buffduration;}
else if (id == "AEDuration") {return spells[spell_id].AEDuration;}
else if (id == "mana") {return spells[spell_id].mana;}
//else if (id == "LightType") {stat = spells[spell_id].LightType;} - Not implemented
else if (id == "goodEffect") {return spells[spell_id].goodEffect;}
else if (id == "Activated") {return spells[spell_id].Activated;}
else if (id == "resisttype") {return spells[spell_id].resisttype;}
else if (id == "targettype") {return spells[spell_id].targettype;}
else if (id == "basediff") {return spells[spell_id].basediff;}
else if (id == "skill") {return spells[spell_id].skill;}
else if (id == "zonetype") {return spells[spell_id].zonetype;}
else if (id == "EnvironmentType") {return spells[spell_id].EnvironmentType;}
else if (id == "TimeOfDay") {return spells[spell_id].TimeOfDay;}
else if (id == "CastingAnim") {return spells[spell_id].CastingAnim;}
else if (id == "SpellAffectIndex") {return spells[spell_id].SpellAffectIndex; }
else if (id == "disallow_sit") {return spells[spell_id].disallow_sit; }
//else if (id == "spellanim") {stat = spells[spell_id].spellanim; } - Not implemented
else if (id == "uninterruptable") {return spells[spell_id].uninterruptable; }
else if (id == "ResistDiff") {return spells[spell_id].ResistDiff; }
else if (id == "dot_stacking_exempt") {return spells[spell_id].dot_stacking_exempt; }
else if (id == "RecourseLink") {return spells[spell_id].RecourseLink; }
else if (id == "no_partial_resist") {return spells[spell_id].no_partial_resist; }
else if (id == "short_buff_box") {return spells[spell_id].short_buff_box; }
else if (id == "descnum") {return spells[spell_id].descnum; }
else if (id == "effectdescnum") {return spells[spell_id].effectdescnum; }
else if (id == "npc_no_los") {return spells[spell_id].npc_no_los; }
else if (id == "reflectable") {return spells[spell_id].reflectable; }
else if (id == "bonushate") {return spells[spell_id].bonushate; }
else if (id == "EndurCost") {return spells[spell_id].EndurCost; }
else if (id == "EndurTimerIndex") {return spells[spell_id].EndurTimerIndex; }
else if (id == "IsDisciplineBuff") {return spells[spell_id].IsDisciplineBuff; }
else if (id == "HateAdded") {return spells[spell_id].HateAdded; }
else if (id == "EndurUpkeep") {return spells[spell_id].EndurUpkeep; }
else if (id == "numhitstype") {return spells[spell_id].numhitstype; }
else if (id == "numhits") {return spells[spell_id].numhits; }
else if (id == "pvpresistbase") {return spells[spell_id].pvpresistbase; }
else if (id == "pvpresistcalc") {return spells[spell_id].pvpresistcalc; }
else if (id == "pvpresistcap") {return spells[spell_id].pvpresistcap; }
else if (id == "spell_category") {return spells[spell_id].spell_category; }
else if (id == "can_mgb") {return spells[spell_id].can_mgb; }
else if (id == "dispel_flag") {return spells[spell_id].dispel_flag; }
else if (id == "MinResist") {return spells[spell_id].MinResist; }
else if (id == "MaxResist") {return spells[spell_id].MaxResist; }
else if (id == "viral_targets") {return spells[spell_id].viral_targets; }
else if (id == "viral_timer") {return spells[spell_id].viral_timer; }
else if (id == "NimbusEffect") {return spells[spell_id].NimbusEffect; }
else if (id == "directional_start") {return static_cast<int32>(spells[spell_id].directional_start); }
else if (id == "directional_end") {return static_cast<int32>(spells[spell_id].directional_end); }
else if (id == "not_focusable") {return spells[spell_id].not_focusable; }
else if (id == "suspendable") {return spells[spell_id].suspendable; }
else if (id == "viral_range") {return spells[spell_id].viral_range; }
else if (id == "spellgroup") {return spells[spell_id].spellgroup; }
else if (id == "rank") {return spells[spell_id].rank; }
else if (id == "no_resist") {return spells[spell_id].no_resist; }
else if (id == "CastRestriction") {return spells[spell_id].CastRestriction; }
else if (id == "caster_requirement_id") { return spells[spell_id].caster_requirement_id; }
else if (id == "AllowRest") {return spells[spell_id].AllowRest; }
else if (id == "InCombat") {return spells[spell_id].InCombat; }
else if (id == "OutofCombat") {return spells[spell_id].OutofCombat; }
else if (id == "aemaxtargets") {return spells[spell_id].aemaxtargets; }
else if (id == "no_heal_damage_item_mod") {return spells[spell_id].no_heal_damage_item_mod; }
else if (id == "persistdeath") {return spells[spell_id].persistdeath; }
else if (id == "min_dist") {return static_cast<int32>(spells[spell_id].min_dist); }
else if (id == "min_dist_mod") {return static_cast<int32>(spells[spell_id].min_dist_mod); }
else if (id == "max_dist") {return static_cast<int32>(spells[spell_id].max_dist); }
else if (id == "min_range") {return static_cast<int32>(spells[spell_id].min_range); }
else if (id == "DamageShieldType") {return spells[spell_id].DamageShieldType; }
return stat;
return GetSpellStatValue(spell_id, identifier, slot);
}
bool Mob::CanClassEquipItem(uint32 item_id)

View File

@ -4646,4 +4646,12 @@ std::string QuestManager::getinventoryslotname(int16 slot_id) {
return EQ::invslot::GetInvPossessionsSlotName(slot_id);
}
int QuestManager::getitemstat(uint32 item_id, std::string stat_identifier) {
QuestManagerCurrentQuestVars();
return EQ::InventoryProfile::GetItemStatValue(item_id, stat_identifier.c_str());
}
int QuestManager::getspellstat(uint32 spell_id, std::string stat_identifier, uint8 slot) {
QuestManagerCurrentQuestVars();
return GetSpellStatValue(spell_id, stat_identifier.c_str(), slot);
}

View File

@ -384,6 +384,8 @@ public:
std::string getgendername(uint32 gender_id);
std::string getdeityname(uint32 deity_id);
std::string getinventoryslotname(int16 slot_id);
int getitemstat(uint32 item_id, std::string stat_identifier);
int getspellstat(uint32 spell_id, std::string stat_identifier, uint8 slot = 0);
Client *GetInitiator() const;
NPC *GetNPC() const;