diff --git a/common/string_util.cpp b/common/string_util.cpp index 609841807..59eb0ab83 100644 --- a/common/string_util.cpp +++ b/common/string_util.cpp @@ -72,6 +72,18 @@ const std::string str_tolower(std::string s) return s; } +std::vector split(std::string str_to_split, char delimiter) +{ + std::stringstream ss(str_to_split); + std::string item; + std::vector exploded_values; + while (std::getline(ss, item, delimiter)) { + exploded_values.push_back(item); + } + + return exploded_values; +} + const std::string str_toupper(std::string s) { std::transform( @@ -85,16 +97,16 @@ const std::string ucfirst(std::string s) { std::string output = s; if (!s.empty()) - output[0] = static_cast(toupper(s[0])); + output[0] = static_cast(std::toupper(s[0])); return output; } -const std::string StringFormat(const char* format, ...) +const std::string StringFormat(const char *format, ...) { va_list args; va_start(args, format); - std::string output = vStringFormat(format,args); + std::string output = vStringFormat(format, args); va_end(args); return output; } diff --git a/common/string_util.h b/common/string_util.h index 68c711789..03848813c 100644 --- a/common/string_util.h +++ b/common/string_util.h @@ -27,6 +27,7 @@ const std::string str_tolower(std::string s); const std::string str_toupper(std::string s); const std::string ucfirst(std::string s); +std::vector split(std::string str_to_split, char delimiter); const std::string StringFormat(const char* format, ...); const std::string vStringFormat(const char* format, va_list args); std::vector SplitString(const std::string &s, char delim); diff --git a/zone/mob.h b/zone/mob.h index 120b89539..eac81b177 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -486,6 +486,11 @@ public: inline virtual int32 GetINT() const { return INT + itembonuses.INT + spellbonuses.INT; } inline virtual int32 GetWIS() const { return WIS + itembonuses.WIS + spellbonuses.WIS; } inline virtual int32 GetCHA() const { return CHA + itembonuses.CHA + spellbonuses.CHA; } + inline virtual int32 GetHeroicMR() const { return 0; } + inline virtual int32 GetHeroicFR() const { return 0; } + inline virtual int32 GetHeroicDR() const { return 0; } + inline virtual int32 GetHeroicPR() const { return 0; } + inline virtual int32 GetHeroicCR() const { return 0; } inline virtual int32 GetMR() const { return MR + itembonuses.MR + spellbonuses.MR; } inline virtual int32 GetFR() const { return FR + itembonuses.FR + spellbonuses.FR; } inline virtual int32 GetDR() const { return DR + itembonuses.DR + spellbonuses.DR; } @@ -499,6 +504,13 @@ public: inline StatBonuses* GetItemBonusesPtr() { return &itembonuses; } inline StatBonuses* GetSpellBonusesPtr() { return &spellbonuses; } inline StatBonuses* GetAABonusesPtr() { return &aabonuses; } + inline virtual int32 GetHeroicSTR() const { return 0; } + inline virtual int32 GetHeroicSTA() const { return 0; } + inline virtual int32 GetHeroicDEX() const { return 0; } + inline virtual int32 GetHeroicAGI() const { return 0; } + inline virtual int32 GetHeroicINT() const { return 0; } + inline virtual int32 GetHeroicWIS() const { return 0; } + inline virtual int32 GetHeroicCHA() const { return 0; } inline virtual int32 GetMaxSTR() const { return GetSTR(); } inline virtual int32 GetMaxSTA() const { return GetSTA(); } inline virtual int32 GetMaxDEX() const { return GetDEX(); } @@ -518,6 +530,7 @@ public: inline int32 GetMaxMana() const { return max_mana; } inline int32 GetMana() const { return current_mana; } virtual int32 GetEndurance() const { return 0; } + virtual int32 GetMaxEndurance() const { return 0; } virtual void SetEndurance(int32 newEnd) { return; } int32 GetItemHPBonuses(); int32 GetSpellHPBonuses(); diff --git a/zone/mob_info.cpp b/zone/mob_info.cpp index bb6598641..7dc64b162 100644 --- a/zone/mob_info.cpp +++ b/zone/mob_info.cpp @@ -23,10 +23,32 @@ #include "../common/races.h" #include "../common/say_link.h" +std::string commify(const std::string &number) +{ + std::string temp_string; + + auto string_length = static_cast(number.length()); + int i = 0; + for (i = string_length - 3; i >= 0; i -= 3) { + if (i > 0) { + temp_string = "," + number.substr(static_cast(i), 3) + temp_string; + } + else { + temp_string = number.substr(static_cast(i), 3) + temp_string; + } + } + + if (i < 0) { + temp_string = number.substr(0, static_cast(3 + i)) + temp_string; + } + + return temp_string; +} + inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribute) { if (attribute == "ac") { - return std::to_string(mob->GetAC()); + return commify(std::to_string(mob->GetAC())); } if (attribute == "atk") { @@ -39,71 +61,100 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut endurance = mob->CastToClient()->GetEndurance(); } - return std::to_string(endurance); + return commify(std::to_string(endurance)); } if (attribute == "hp") { - return std::to_string(mob->GetHP()); + return commify(std::to_string(mob->GetHP())); + } + + if (attribute == "hp_min_max") { + return commify(std::to_string(mob->GetHP())) + " / " + commify(std::to_string(mob->GetMaxHP())) + " (" + + std::to_string((int)mob->GetHPRatio()) + "%)"; } if (attribute == "mana") { - return std::to_string(mob->GetMana()); + return commify(std::to_string(mob->GetMana())); + } + + if (attribute == "mp_min_max") { + return commify(std::to_string(mob->GetMana())) + " / " + commify(std::to_string(mob->GetMaxMana())) + " (" + + std::to_string((int)mob->GetManaPercent()) + "%)"; + } + + if (attribute == "end_min_max") { + return commify(std::to_string(mob->GetEndurance())) + " / " + commify(std::to_string(mob->GetMaxEndurance())) + " (" + + std::to_string((int)mob->GetEndurancePercent()) + "%)"; } if (attribute == "str") { - return std::to_string(mob->GetSTR()); + return commify(std::to_string(mob->GetSTR())) + " / " + commify(std::to_string(mob->GetMaxSTR())) + " +" + + commify(std::to_string(mob->GetHeroicSTR())); } if (attribute == "sta") { - return std::to_string(mob->GetSTA()); + return commify(std::to_string(mob->GetSTA())) + " / " + commify(std::to_string(mob->GetMaxSTA())) + " +" + + commify(std::to_string(mob->GetHeroicSTA())); } if (attribute == "dex") { - return std::to_string(mob->GetDEX()); + return commify(std::to_string(mob->GetDEX())) + " / " + commify(std::to_string(mob->GetMaxDEX())) + " +" + + commify(std::to_string(mob->GetHeroicDEX())); } if (attribute == "agi") { - return std::to_string(mob->GetAGI()); + return commify(std::to_string(mob->GetAGI())) + " / " + commify(std::to_string(mob->GetMaxAGI())) + " +" + + commify(std::to_string(mob->GetHeroicAGI())); } if (attribute == "int") { - return std::to_string(mob->GetINT()); + return commify(std::to_string(mob->GetINT())) + " / " + commify(std::to_string(mob->GetMaxINT())) + " +" + + commify(std::to_string(mob->GetHeroicINT())); } if (attribute == "wis") { - return std::to_string(mob->GetWIS()); + return commify(std::to_string(mob->GetWIS())) + " / " + commify(std::to_string(mob->GetMaxWIS())) + " +" + + commify(std::to_string(mob->GetHeroicWIS())); } if (attribute == "cha") { - return std::to_string(mob->GetCHA()); + return commify(std::to_string(mob->GetCHA())) + " / " + commify(std::to_string(mob->GetMaxCHA())) + " +" + + commify(std::to_string(mob->GetHeroicCHA())); } if (attribute == "mr") { - return std::to_string(mob->GetMR()); + return commify(std::to_string(mob->GetMR())) + " / " + commify(std::to_string(mob->GetMaxMR())) + " +" + + commify(std::to_string(mob->GetHeroicMR())); } if (attribute == "cr") { - return std::to_string(mob->GetCR()); + return commify(std::to_string(mob->GetCR())) + " / " + commify(std::to_string(mob->GetMaxCR())) + " +" + + commify(std::to_string(mob->GetHeroicCR())); } if (attribute == "fr") { - return std::to_string(mob->GetFR()); + return commify(std::to_string(mob->GetFR())) + " / " + commify(std::to_string(mob->GetMaxFR())) + " +" + + commify(std::to_string(mob->GetHeroicFR())); } if (attribute == "pr") { - return std::to_string(mob->GetPR()); + return commify(std::to_string(mob->GetPR())) + " / " + commify(std::to_string(mob->GetMaxPR())) + " +" + + commify(std::to_string(mob->GetHeroicPR())); } if (attribute == "dr") { - return std::to_string(mob->GetDR()); + return commify(std::to_string(mob->GetDR())) + " / " + commify(std::to_string(mob->GetMaxDR())) + " +" + + commify(std::to_string(mob->GetHeroicDR())); } if (attribute == "cr") { - return std::to_string(mob->GetCR()); + return commify(std::to_string(mob->GetCR())) + " / " + commify(std::to_string(mob->GetMaxCR())) + " +" + + commify(std::to_string(mob->GetHeroicCR())); } if (attribute == "pr") { - return std::to_string(mob->GetPR()); + return commify(std::to_string(mob->GetPR())) + " / " + commify(std::to_string(mob->GetMaxPR())) + " +" + + commify(std::to_string(mob->GetHeroicPR())); } if (attribute == "cor") { @@ -118,8 +169,9 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut return mob->GetCleanName(); } - if (attribute == "lastname") { - return mob->GetLastName(); + if (attribute == "surname") { + std::string last_name = mob->GetLastName(); + return (last_name.length() > 0 ? mob->GetLastName() : " "); } if (attribute == "race") { @@ -134,6 +186,18 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut return std::to_string(mob->GetLevel()); } + if (attribute == "flymode") { + return std::to_string(mob->GetFlyMode()); + } + + if (attribute == "maxbuffslots") { + return std::to_string(mob->GetMaxBuffSlots()); + } + + if (attribute == "curbuffslots") { + return std::to_string(mob->GetCurrentBuffSlots()); + } + if (mob->IsNPC()) { NPC *npc = mob->CastToNPC(); @@ -150,13 +214,13 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut return std::to_string(npc->GetGender()); } if (attribute == "size") { - return std::to_string(npc->GetSize()); + return std::to_string((int)npc->GetSize()); } if (attribute == "runspeed") { - return std::to_string(npc->GetRunspeed()); + return std::to_string((int)npc->GetRunspeed()); } if (attribute == "walkspeed") { - return std::to_string(npc->GetWalkspeed()); + return std::to_string((int)npc->GetWalkspeed()); } if (attribute == "spawngroup") { return std::to_string(npc->GetSp2()); @@ -167,6 +231,85 @@ inline std::string GetMobAttributeByString(Mob *mob, const std::string &attribut if (attribute == "emote") { return std::to_string(npc->GetEmoteID()); } + if (attribute == "seeInvis") { + return std::to_string(npc->SeeInvisible()); + } + if (attribute == "seeInvisUndead") { + return std::to_string(npc->SeeInvisibleUndead()); + } + if (attribute == "faction") { + return std::to_string(npc->GetNPCFactionID()); + } + if (attribute == "loottable") { + return std::to_string(npc->GetLoottableID()); + } + if (attribute == "primSkill") { + return std::to_string(npc->GetPrimSkill()); + } + if (attribute == "secSkill") { + return std::to_string(npc->GetSecSkill()); + } + if (attribute == "meleeTexture1") { + return std::to_string(npc->GetMeleeTexture1()); + } + if (attribute == "meleeTexture2") { + return std::to_string(npc->GetMeleeTexture2()); + } + if (attribute == "aggrorange") { + return std::to_string((int)npc->GetAggroRange()); + } + if (attribute == "assistrange") { + return std::to_string((int)npc->GetAssistRange()); + } + if (attribute == "findable") { + return std::to_string(npc->IsFindable()); + } + if (attribute == "trackable") { + return std::to_string(npc->IsTrackable()); + } + if (attribute == "spellsid") { + return std::to_string(npc->GetNPCSpellsID()); + } + if (attribute == "roamboxMinX") { + return std::to_string((int)npc->GetRoamboxMinX()); + } + if (attribute == "roamboxMaxX") { + return std::to_string((int)npc->GetRoamboxMaxX()); + } + if (attribute == "roamboxMinY") { + return std::to_string((int)npc->GetRoamboxMinY()); + } + if (attribute == "roamboxMaxY") { + return std::to_string((int)npc->GetRoamboxMaxY()); + } + if (attribute == "roamboxMinDelay") { + return std::to_string((int)npc->GetRoamboxMinDelay()); + } + if (attribute == "roamboxDelay") { + return std::to_string((int)npc->GetRoamboxDelay()); + } + if (attribute == "roamboxDistance") { + return std::to_string((int)npc->GetRoamboxDistance()); + } + if (attribute == "proximityMinX") { + return std::to_string((int)npc->GetProximityMinX()); + } + if (attribute == "proximityMaxX") { + return std::to_string((int)npc->GetProximityMaxX()); + } + if (attribute == "proximityMinY") { + return std::to_string((int)npc->GetProximityMinY()); + } + if (attribute == "proximityMaxY") { + return std::to_string((int)npc->GetProximityMaxY()); + } + if (attribute == "proximityMinZ") { + return std::to_string((int)npc->GetProximityMinZ()); + } + if (attribute == "proximityMaxZ") { + return std::to_string((int)npc->GetProximityMaxZ()); + } + npc->GetNPCEmote(npc->GetEmoteID(), 0); } @@ -223,6 +366,11 @@ inline std::string WriteDisplayInfoSection( } std::string attribute_name = attribute; + + if (attribute_name.find('_') != std::string::npos) { + std::vector split_string = split(attribute_name, '_'); + attribute_name = split_string[0]; + } if (attribute_name.length() <= 3) { attribute_name = str_toupper(attribute_name); } @@ -289,32 +437,28 @@ void Mob::DisplayInfo(Mob *mob) // }; if (this->IsClient()) { - std::string window_text = "*Drag / Maximize Window to see all info

"; + std::string window_text = "*Drag window open vertically to see all
"; Client *client = this->CastToClient(); - std::vector who_attributes = { + std::vector info_attributes = { "name", - "lastname", - }; - window_text += WriteDisplayInfoSection(mob, "Who", who_attributes, 1, false); - - std::vector type_attributes = { "race", + "surname", "class", - "type" }; - window_text += WriteDisplayInfoSection(mob, "Type", type_attributes, 3, true); + window_text += WriteDisplayInfoSection(mob, "Info", info_attributes, 1, false); std::vector basic_attributes = { + "type", "level", - "hp", - "mana", - "end", + "hp_min_max", "ac", - "atk" + "mp_min_max", + "atk", + "end_min_max", }; - window_text += WriteDisplayInfoSection(mob, "Main", basic_attributes, 7, true); + window_text += WriteDisplayInfoSection(mob, "Main", basic_attributes, 1, false); std::vector stat_attributes = { "str", @@ -325,7 +469,7 @@ void Mob::DisplayInfo(Mob *mob) "int", "cha", }; - window_text += WriteDisplayInfoSection(mob, "Statistics", stat_attributes, 7, true); + window_text += WriteDisplayInfoSection(mob, "Statistics", stat_attributes, 1, false); std::vector resist_attributes = { "pr", @@ -336,9 +480,11 @@ void Mob::DisplayInfo(Mob *mob) "cor", "phy", }; - window_text += WriteDisplayInfoSection(mob, "Resists", resist_attributes, 7, true); + window_text += WriteDisplayInfoSection(mob, "Resists", resist_attributes, 1, false); if (mob->IsNPC()) { + NPC *npc = mob->CastToNPC(); + std::vector npc_attributes = { "npcid", "texture", @@ -350,13 +496,60 @@ void Mob::DisplayInfo(Mob *mob) "spawngroup", "grid", "emote", + "seeInvis", + "seeInvisUndead", + "faction", + "loottable", + "primSkill", + "secSkill", + "meleeTexture1", + "meleeTexture2", + "aggrorange", + "assistrange", + "findable", + "trackable", + "flymode", + "spellsid", + "curbuffslots", + "maxbuffslots", }; - window_text += WriteDisplayInfoSection(mob, "NPC Attributes", npc_attributes, 2, true); + + window_text += WriteDisplayInfoSection(mob, "NPC Attributes", npc_attributes, 1, true); + + /** + * Print Roambox + */ + if (npc->GetRoamboxMaxX() != 0 && npc->GetRoamboxMinX() != 0) { + std::vector npc_roambox = { + "roamboxMinX", + "roamboxMaxX", + "roamboxMinY", + "roamboxMaxY", + "roamboxMinDelay", + "roamboxDelay", + "roamboxDistance", + }; + + window_text += WriteDisplayInfoSection(mob, "Roambox", npc_roambox, 1, true); + } + + if (npc->proximity != nullptr) { + std::vector npc_proximity = { + "proximityMinX", + "proximityMaxX", + "proximityMinY", + "proximityMaxY", + "proximityMinZ", + "proximityMaxZ", + }; + + window_text += WriteDisplayInfoSection(mob, "Proximity", npc_proximity, 1, true); + } client->Message(0, " "); - mob->CastToNPC()->QueryLoot(client); + npc->QueryLoot(client); - NPCCommandsMenu(client, mob->CastToNPC()); + NPCCommandsMenu(client, npc); } std::cout << "Window Length: " << window_text.length() << std::endl; @@ -369,7 +562,7 @@ void Mob::DisplayInfo(Mob *mob) EQEmu::popupresponse::MOB_INFO_DISMISS, 0, 100, - 10, + 0, "Snooze", "OK" ); diff --git a/zone/npc.cpp b/zone/npc.cpp index 462feff4f..af992ff80 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -383,6 +383,56 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi AISpellVar.idle_beneficial_chance = static_cast (RuleI(Spells, AI_IdleBeneficialChance)); } +float NPC::GetRoamboxMaxX() const +{ + return roambox_max_x; +} + +float NPC::GetRoamboxMaxY() const +{ + return roambox_max_y; +} + +float NPC::GetRoamboxMinX() const +{ + return roambox_min_x; +} + +float NPC::GetRoamboxMinY() const +{ + return roambox_min_y; +} + +float NPC::GetRoamboxDistance() const +{ + return roambox_distance; +} + +float NPC::GetRoamboxDestinationX() const +{ + return roambox_destination_x; +} + +float NPC::GetRoamboxDestinationY() const +{ + return roambox_destination_y; +} + +float NPC::GetRoamboxDestinationZ() const +{ + return roambox_destination_z; +} + +uint32 NPC::GetRoamboxDelay() const +{ + return roambox_delay; +} + +uint32 NPC::GetRoamboxMinDelay() const +{ + return roambox_min_delay; +} + NPC::~NPC() { AI_Stop(); @@ -2747,4 +2797,45 @@ void NPC::ModifyStatsOnCharm(bool bRemoved) // the rest of the stats aren't cached, so lets just do these two instead of full CalcBonuses() SetAttackTimer(); CalcAC(); +} + + +uint16 NPC::GetMeleeTexture1() const +{ + return d_melee_texture1; +} + +uint16 NPC::GetMeleeTexture2() const +{ + return d_melee_texture2; +} + +float NPC::GetProximityMinX() +{ + return proximity->min_x; +} + +float NPC::GetProximityMaxX() +{ + return proximity->max_x; +} + +float NPC::GetProximityMinY() +{ + return proximity->min_y; +} + +float NPC::GetProximityMaxY() +{ + return proximity->max_y; +} + +float NPC::GetProximityMinZ() +{ + return proximity->min_z; +} + +float NPC::GetProximityMaxZ() +{ + return proximity->max_z; } \ No newline at end of file diff --git a/zone/npc.h b/zone/npc.h index fb5f00b9f..abd34df57 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -320,6 +320,9 @@ public: inline bool IsGuarding() const { return(m_GuardPoint.w != 0); } void SaveGuardSpotCharm(); + uint16 GetMeleeTexture1() const; + uint16 GetMeleeTexture2() const; + void RestoreGuardSpotCharm(); void AI_SetRoambox( @@ -349,6 +352,13 @@ public: inline const uint32 GetNPCSpellsID() const { return npc_spells_id; } inline const uint32 GetNPCSpellsEffectsID() const { return npc_spells_effects_id; } + float GetProximityMinX(); + float GetProximityMaxX(); + float GetProximityMinY(); + float GetProximityMaxY(); + float GetProximityMinZ(); + float GetProximityMaxZ(); + ItemList itemlist; //kathgar - why is this public? Doing other things or I would check the code NPCProximity* proximity; @@ -443,6 +453,17 @@ public: bool IgnoreDespawn() { return ignore_despawn; } + float GetRoamboxMaxX() const; + float GetRoamboxMaxY() const; + float GetRoamboxMinX() const; + float GetRoamboxMinY() const; + float GetRoamboxDistance() const; + float GetRoamboxDestinationX() const; + float GetRoamboxDestinationY() const; + float GetRoamboxDestinationZ() const; + uint32 GetRoamboxDelay() const; + uint32 GetRoamboxMinDelay() const; + std::unique_ptr AIautocastspell_timer; protected: @@ -557,7 +578,8 @@ protected: uint32 equipment[EQEmu::invslot::EQUIPMENT_COUNT]; //this is an array of item IDs uint32 herosforgemodel; //this is the Hero Forge Armor Model (i.e 63 or 84 or 203) - uint16 d_melee_texture1; //this is an item Material value + uint16 d_melee_texture1; + //this is an item Material value uint16 d_melee_texture2; //this is an item Material value (offhand) const char* ammo_idfile; //this determines projectile graphic "IT###" (see item field 'idfile') uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation