Entity window adjustments

This commit is contained in:
Akkadius 2018-12-16 01:46:55 -06:00
parent 9c1e14a4ab
commit a7f2eebfdf

View File

@ -29,6 +29,7 @@ std::string commify(const std::string &number)
std::string temp_string; std::string temp_string;
auto string_length = static_cast<int>(number.length()); auto string_length = static_cast<int>(number.length());
int i = 0; int i = 0;
for (i = string_length - 3; i >= 0; i -= 3) { for (i = string_length - 3; i >= 0; i -= 3) {
if (i > 0) { if (i > 0) {
@ -55,7 +56,11 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
} }
if (attribute == "ac") { if (attribute == "ac") {
return commify(std::to_string(mob->GetAC())); if (mob->GetEntityVariable(std::string("modify_stat_max_hp").c_str())) {
scaling_modified = " *";
}
return commify(std::to_string(mob->GetAC())) + scaling_modified;
} }
if (attribute == "atk") { if (attribute == "atk") {
@ -76,7 +81,7 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
} }
if (attribute == "hp_min_max") { if (attribute == "hp_min_max") {
if (mob->GetEntityVariable(std::string("modify_stat_hp").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_max_hp").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
@ -228,7 +233,7 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return std::to_string(mob->compute_tohit(EQEmu::skills::SkillHandtoHand)); return std::to_string(mob->compute_tohit(EQEmu::skills::SkillHandtoHand));
} }
if (attribute == "totalToHit") { if (attribute == "total_to_hit") {
return std::to_string(mob->GetTotalToHit(EQEmu::skills::SkillHandtoHand, 0)); return std::to_string(mob->GetTotalToHit(EQEmu::skills::SkillHandtoHand, 0));
} }
@ -236,7 +241,7 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return std::to_string(mob->compute_defense()); return std::to_string(mob->compute_defense());
} }
if (attribute == "totalDefense") { if (attribute == "total_defense") {
return std::to_string(mob->GetTotalDefense()); return std::to_string(mob->GetTotalDefense());
} }
@ -244,7 +249,7 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return std::to_string(mob->offense(EQEmu::skills::SkillHandtoHand)); return std::to_string(mob->offense(EQEmu::skills::SkillHandtoHand));
} }
if (attribute == "mitigationAC") { if (attribute == "mitigation_ac") {
return std::to_string(mob->GetMitigationAC()); return std::to_string(mob->GetMitigationAC());
} }
@ -281,10 +286,10 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
if (attribute == "emote") { if (attribute == "emote") {
return std::to_string(npc->GetEmoteID()); return std::to_string(npc->GetEmoteID());
} }
if (attribute == "seeInvis") { if (attribute == "see_invis") {
return std::to_string(npc->SeeInvisible()); return std::to_string(npc->SeeInvisible());
} }
if (attribute == "seeInvisUndead") { if (attribute == "see_invis_undead") {
return std::to_string(npc->SeeInvisibleUndead()); return std::to_string(npc->SeeInvisibleUndead());
} }
if (attribute == "faction") { if (attribute == "faction") {
@ -293,16 +298,16 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
if (attribute == "loottable") { if (attribute == "loottable") {
return std::to_string(npc->GetLoottableID()); return std::to_string(npc->GetLoottableID());
} }
if (attribute == "primSkill") { if (attribute == "prim_skill") {
return std::to_string(npc->GetPrimSkill()); return std::to_string(npc->GetPrimSkill());
} }
if (attribute == "secSkill") { if (attribute == "sec_skill") {
return std::to_string(npc->GetSecSkill()); return std::to_string(npc->GetSecSkill());
} }
if (attribute == "meleeTexture1") { if (attribute == "melee_texture_1") {
return std::to_string(npc->GetMeleeTexture1()); return std::to_string(npc->GetMeleeTexture1());
} }
if (attribute == "meleeTexture2") { if (attribute == "melee_texture_2") {
return std::to_string(npc->GetMeleeTexture2()); return std::to_string(npc->GetMeleeTexture2());
} }
if (attribute == "aggrorange") { if (attribute == "aggrorange") {
@ -317,94 +322,94 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
if (attribute == "trackable") { if (attribute == "trackable") {
return std::to_string(npc->IsTrackable()); return std::to_string(npc->IsTrackable());
} }
if (attribute == "spellsid") { if (attribute == "spells_id") {
return std::to_string(npc->GetNPCSpellsID()); return std::to_string(npc->GetNPCSpellsID());
} }
if (attribute == "roamboxMinX") { if (attribute == "roambox_min_x") {
return std::to_string((int)npc->GetRoamboxMinX()); return std::to_string((int)npc->GetRoamboxMinX());
} }
if (attribute == "roamboxMaxX") { if (attribute == "roambox_max_x") {
return std::to_string((int)npc->GetRoamboxMaxX()); return std::to_string((int)npc->GetRoamboxMaxX());
} }
if (attribute == "roamboxMinY") { if (attribute == "roambox_min_y") {
return std::to_string((int)npc->GetRoamboxMinY()); return std::to_string((int)npc->GetRoamboxMinY());
} }
if (attribute == "roamboxMaxY") { if (attribute == "roambox_max_y") {
return std::to_string((int)npc->GetRoamboxMaxY()); return std::to_string((int)npc->GetRoamboxMaxY());
} }
if (attribute == "roamboxMinDelay") { if (attribute == "roambox_min_delay") {
return std::to_string((int)npc->GetRoamboxMinDelay()); return std::to_string((int)npc->GetRoamboxMinDelay());
} }
if (attribute == "roamboxDelay") { if (attribute == "roambox_delay") {
return std::to_string((int)npc->GetRoamboxDelay()); return std::to_string((int)npc->GetRoamboxDelay());
} }
if (attribute == "roamboxDistance") { if (attribute == "roambox_distance") {
return std::to_string((int)npc->GetRoamboxDistance()); return std::to_string((int)npc->GetRoamboxDistance());
} }
if (attribute == "proximityMinX") { if (attribute == "proximity_min_x") {
return std::to_string((int)npc->GetProximityMinX()); return std::to_string((int)npc->GetProximityMinX());
} }
if (attribute == "proximityMaxX") { if (attribute == "proximity_max_x") {
return std::to_string((int)npc->GetProximityMaxX()); return std::to_string((int)npc->GetProximityMaxX());
} }
if (attribute == "proximityMinY") { if (attribute == "proximity_min_y") {
return std::to_string((int)npc->GetProximityMinY()); return std::to_string((int)npc->GetProximityMinY());
} }
if (attribute == "proximityMaxY") { if (attribute == "proximity_max_y") {
return std::to_string((int)npc->GetProximityMaxY()); return std::to_string((int)npc->GetProximityMaxY());
} }
if (attribute == "proximityMinZ") { if (attribute == "proximity_min_z") {
return std::to_string((int)npc->GetProximityMinZ()); return std::to_string((int)npc->GetProximityMinZ());
} }
if (attribute == "proximityMaxZ") { if (attribute == "proximity_max_z") {
return std::to_string((int)npc->GetProximityMaxZ()); return std::to_string((int)npc->GetProximityMaxZ());
} }
if (attribute == "accuracy") { if (attribute == "accuracy") {
return std::to_string((int)npc->GetAccuracyRating()) + scaling_modified; return std::to_string((int)npc->GetAccuracyRating()) + scaling_modified;
} }
if (attribute == "slowMitigation") { if (attribute == "slow_mitigation") {
if (mob->GetEntityVariable(std::string("modify_stat_slow_mitigation").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_slow_mitigation").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return std::to_string((int)npc->GetSlowMitigation()) + scaling_modified; return std::to_string((int)npc->GetSlowMitigation()) + scaling_modified;
} }
if (attribute == "minHit") { if (attribute == "min_hit") {
if (mob->GetEntityVariable(std::string("modify_stat_min_hit").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_min_hit").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return commify(std::to_string((int)npc->GetMinDMG())) + scaling_modified; return commify(std::to_string((int)npc->GetMinDMG())) + scaling_modified;
} }
if (attribute == "maxHit") { if (attribute == "max_hit") {
if (mob->GetEntityVariable(std::string("modify_stat_max_hit").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_max_hit").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return commify(std::to_string((int)npc->GetMaxDMG())) + scaling_modified; return commify(std::to_string((int)npc->GetMaxDMG())) + scaling_modified;
} }
if (attribute == "hpRegen") { if (attribute == "hp_regen") {
if (mob->GetEntityVariable(std::string("modify_stat_hp_regen").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_hp_regen").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return commify(std::to_string((int)npc->GetHPRegen())) + scaling_modified; return commify(std::to_string((int)npc->GetHPRegen())) + scaling_modified;
} }
if (attribute == "attackDelay") { if (attribute == "attack_delay") {
if (mob->GetEntityVariable(std::string("modify_stat_attack_delay").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_attack_delay").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return commify(std::to_string(npc->GetAttackDelay())) + scaling_modified; return commify(std::to_string(npc->GetAttackDelay())) + scaling_modified;
} }
if (attribute == "spellScale") { if (attribute == "spell_scale") {
if (mob->GetEntityVariable(std::string("modify_stat_spell_scale").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_spell_scale").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
return commify(std::to_string((int)npc->GetSpellScale())) + scaling_modified; return commify(std::to_string((int)npc->GetSpellScale())) + scaling_modified;
} }
if (attribute == "healScale") { if (attribute == "heal_scale") {
if (mob->GetEntityVariable(std::string("modify_stat_heal_scale").c_str())) { if (mob->GetEntityVariable(std::string("modify_stat_heal_scale").c_str())) {
scaling_modified = " *"; scaling_modified = " *";
} }
@ -425,19 +430,19 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return commify(std::to_string((int)client->GetShielding())) + " / " + return commify(std::to_string((int)client->GetShielding())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemShieldingCap))); commify(std::to_string((int) RuleI(Character, ItemShieldingCap)));
} }
if (attribute == "spellShielding") { if (attribute == "spell_shielding") {
return commify(std::to_string((int)client->GetSpellShield())) + " / " + return commify(std::to_string((int)client->GetSpellShield())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemSpellShieldingCap))); commify(std::to_string((int) RuleI(Character, ItemSpellShieldingCap)));
} }
if (attribute == "dotShielding") { if (attribute == "dot_shielding") {
return commify(std::to_string((int)client->GetDoTShield())) + " / " + return commify(std::to_string((int)client->GetDoTShield())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemDoTShieldingCap))); commify(std::to_string((int) RuleI(Character, ItemDoTShieldingCap)));
} }
if (attribute == "stunResist") { if (attribute == "stun_resist") {
return commify(std::to_string((int)client->GetStunResist())) + " / " + return commify(std::to_string((int)client->GetStunResist())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemStunResistCap))); commify(std::to_string((int) RuleI(Character, ItemStunResistCap)));
} }
if (attribute == "damageShield") { if (attribute == "damage_shield") {
return commify(std::to_string((int)client->GetDS())) + " / " + return commify(std::to_string((int)client->GetDS())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemDamageShieldCap))); commify(std::to_string((int) RuleI(Character, ItemDamageShieldCap)));
} }
@ -453,15 +458,15 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return commify(std::to_string((int) client->GetAccuracy())) + " / " + return commify(std::to_string((int) client->GetAccuracy())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemAccuracyCap))); commify(std::to_string((int) RuleI(Character, ItemAccuracyCap)));
} }
if (attribute == "combatEffects") { if (attribute == "combat_effects") {
return commify(std::to_string((int) client->GetCombatEffects())) + " / " + return commify(std::to_string((int) client->GetCombatEffects())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemCombatEffectsCap))); commify(std::to_string((int) RuleI(Character, ItemCombatEffectsCap)));
} }
if (attribute == "healAmount") { if (attribute == "heal_amount") {
return commify(std::to_string((int) client->GetHealAmt())) + " / " + return commify(std::to_string((int) client->GetHealAmt())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemHealAmtCap))); commify(std::to_string((int) RuleI(Character, ItemHealAmtCap)));
} }
if (attribute == "spellDmg") { if (attribute == "spell_dmg") {
return commify(std::to_string((int) client->GetSpellDmg())) + " / " + return commify(std::to_string((int) client->GetSpellDmg())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemSpellDmgCap))); commify(std::to_string((int) RuleI(Character, ItemSpellDmgCap)));
} }
@ -469,19 +474,19 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut
return commify(std::to_string((int) client->GetClair())) + " / " + return commify(std::to_string((int) client->GetClair())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemClairvoyanceCap))); commify(std::to_string((int) RuleI(Character, ItemClairvoyanceCap)));
} }
if (attribute == "DSMit") { if (attribute == "ds_mitigation") {
return commify(std::to_string((int) client->GetDSMit())) + " / " + return commify(std::to_string((int) client->GetDSMit())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemDSMitigationCap))); commify(std::to_string((int) RuleI(Character, ItemDSMitigationCap)));
} }
if (attribute == "hpRegen") { if (attribute == "hp_regen") {
return commify(std::to_string((int) client->GetHPRegen())) + " / " + return commify(std::to_string((int) client->GetHPRegen())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemHealthRegenCap))); commify(std::to_string((int) RuleI(Character, ItemHealthRegenCap)));
} }
if (attribute == "manaRegen") { if (attribute == "mana_regen") {
return commify(std::to_string((int) client->GetManaRegen())) + " / " + return commify(std::to_string((int) client->GetManaRegen())) + " / " +
commify(std::to_string((int) RuleI(Character, ItemManaRegenCap))); commify(std::to_string((int) RuleI(Character, ItemManaRegenCap)));
} }
if (attribute == "endRegen") { if (attribute == "end_regen") {
return commify(std::to_string((int) client->CalcEnduranceRegen())) + " / " + return commify(std::to_string((int) client->CalcEnduranceRegen())) + " / " +
commify(std::to_string((int) client->CalcEnduranceRegenCap())); commify(std::to_string((int) client->CalcEnduranceRegenCap()));
} }
@ -541,13 +546,33 @@ inline std::string WriteDisplayInfoSection(
std::string attribute_name = attribute; std::string attribute_name = attribute;
find_replace(attribute_name, "_min_max", std::string(""));
/**
* Translate attribute names with underscores
* "total_to_hit" = "Total To Hit"
*/
if (attribute_name.find('_') != std::string::npos) { if (attribute_name.find('_') != std::string::npos) {
std::vector<std::string> split_string = split(attribute_name, '_'); std::vector<std::string> split_string = split(attribute_name, '_');
attribute_name = split_string[0]; std::string new_attribute_name;
for (std::string &string_value : split_string) {
new_attribute_name += ucfirst(string_value) + " ";
}
attribute_name = new_attribute_name;
} }
/**
* Attribute names less than 4 characters get capitalized
* "hp" = "HP"
*/
if (attribute_name.length() <= 3) { if (attribute_name.length() <= 3) {
attribute_name = str_toupper(attribute_name); attribute_name = str_toupper(attribute_name);
} }
/**
* Attribute names larger than 3 characters get capitalized first letter
* "avoidance" = "Avoidance"
*/
if (attribute_name.length() > 3) { if (attribute_name.length() > 3) {
attribute_name = ucfirst(attribute_name); attribute_name = ucfirst(attribute_name);
} }
@ -653,32 +678,32 @@ void Mob::DisplayInfo(Mob *mob)
std::vector<std::string> calculations = { std::vector<std::string> calculations = {
"tohit", "tohit",
"totalToHit", "total_to_hit",
"defense", "defense",
"totalDefense", "total_defense",
"offense", "offense",
"mitigationAC", "mitigation_ac",
}; };
window_text += WriteDisplayInfoSection(mob, "Calculations", calculations, 1, true); window_text += WriteDisplayInfoSection(mob, "Calculations", calculations, 1, true);
if (mob->IsClient()) { if (mob->IsClient()) {
std::vector<std::string> mods = { std::vector<std::string> mods = {
"hpRegen", "hp_regen",
"manaRegen", "mana_regen",
"endRegen", "end_regen",
"healAmount", "heal_amount",
"spellDmg", "spell_dmg",
"clairvoyance", "clairvoyance",
}; };
window_text += WriteDisplayInfoSection(mob, "Mods", mods, 1, true); window_text += WriteDisplayInfoSection(mob, "Mods", mods, 1, true);
std::vector<std::string> mod_defensive = { std::vector<std::string> mod_defensive = {
"shielding", "shielding",
"spellShielding", "spell_shielding",
"dotShielding", "dot_shielding",
"stunResist", "stun_resist",
"damageShield", "damage_shield",
"DSMit", "ds_mitigation",
"avoidance", "avoidance",
}; };
@ -687,7 +712,7 @@ void Mob::DisplayInfo(Mob *mob)
std::vector<std::string> mod_offensive = { std::vector<std::string> mod_offensive = {
"strikethrough", "strikethrough",
"accuracy", "accuracy",
"combatEffects", "combat_effects",
}; };
window_text += WriteDisplayInfoSection(mob, "Mod Offensive", mod_offensive, 1, true); window_text += WriteDisplayInfoSection(mob, "Mod Offensive", mod_offensive, 1, true);
} }
@ -697,13 +722,13 @@ void Mob::DisplayInfo(Mob *mob)
std::vector<std::string> npc_stats = { std::vector<std::string> npc_stats = {
"accuracy", "accuracy",
"slowMitigation", "slow_mitigation",
"minHit", "min_hit",
"maxHit", "max_hit",
"hpRegen", "hp_regen",
"attackDelay", "attack_delay",
"spellScale", "spell_scale",
"healScale", "heal_scale",
"avoidance", "avoidance",
}; };
@ -720,20 +745,20 @@ void Mob::DisplayInfo(Mob *mob)
"spawngroup", "spawngroup",
"grid", "grid",
"emote", "emote",
"seeInvis", "see_invis",
"seeInvisUndead", "see_invis_undead",
"faction", "faction",
"loottable", "loottable",
"primSkill", "prim_skill",
"secSkill", "sec_skill",
"meleeTexture1", "melee_texture_1",
"meleeTexture2", "melee_texture_2",
"aggrorange", "aggrorange",
"assistrange", "assistrange",
"findable", "findable",
"trackable", "trackable",
"flymode", "flymode",
"spellsid", "spells_id",
"curbuffslots", "curbuffslots",
"maxbuffslots", "maxbuffslots",
}; };
@ -745,13 +770,13 @@ void Mob::DisplayInfo(Mob *mob)
*/ */
if (npc->GetRoamboxMaxX() != 0 && npc->GetRoamboxMinX() != 0) { if (npc->GetRoamboxMaxX() != 0 && npc->GetRoamboxMinX() != 0) {
std::vector<std::string> npc_roambox = { std::vector<std::string> npc_roambox = {
"roamboxMinX", "roambox_min_x",
"roamboxMaxX", "roambox_max_x",
"roamboxMinY", "roambox_min_y",
"roamboxMaxY", "roambox_max_y",
"roamboxMinDelay", "roambox_min_delay",
"roamboxDelay", "roambox_delay",
"roamboxDistance", "roambox_distance",
}; };
window_text += WriteDisplayInfoSection(mob, "Roambox", npc_roambox, 1, true); window_text += WriteDisplayInfoSection(mob, "Roambox", npc_roambox, 1, true);
@ -759,12 +784,12 @@ void Mob::DisplayInfo(Mob *mob)
if (npc->proximity != nullptr) { if (npc->proximity != nullptr) {
std::vector<std::string> npc_proximity = { std::vector<std::string> npc_proximity = {
"proximityMinX", "proximity_min_x",
"proximityMaxX", "proximity_max_x",
"proximityMinY", "proximity_min_y",
"proximityMaxY", "proximity_max_y",
"proximityMinZ", "proximity_min_z",
"proximityMaxZ", "proximity_max_z",
}; };
window_text += WriteDisplayInfoSection(mob, "Proximity", npc_proximity, 1, true); window_text += WriteDisplayInfoSection(mob, "Proximity", npc_proximity, 1, true);