diff --git a/zone/client.cpp b/zone/client.cpp index 4f9a362bf..be557ff09 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8531,17 +8531,6 @@ void Client::ExpeditionSay(const char *str, int ExpID) { } -void Client::ShowNumHits() -{ - uint32 buffcount = GetMaxTotalSlots(); - for (uint32 buffslot = 0; buffslot < buffcount; buffslot++) { - const Buffs_Struct &curbuff = buffs[buffslot]; - if (IsValidSpell(curbuff.spellid) && curbuff.hit_number) - Message(0, "You have %d hits left on %s", curbuff.hit_number, GetSpellName(curbuff.spellid)); - } - return; -} - int Client::GetQuiverHaste(int delay) { const EQ::ItemInstance *pi = nullptr; diff --git a/zone/client.h b/zone/client.h index eb144e2c9..95ce22526 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1597,8 +1597,6 @@ public: void SetInvulnerableEnvironmentDamage(bool val) { invulnerable_environment_damage = val; } void SetIntoxication(int32 in_intoxication); - void ShowNumHits(); // work around function for numhits not showing on buffs - void ApplyWeaponsStance(); void TogglePassiveAlternativeAdvancement(const AA::Rank &rank, uint32 ability_id); bool UseTogglePassiveHotkey(const AA::Rank &rank); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 97fb2c21e..86c6297e5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -10712,7 +10712,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) case PET_HEALTHREPORT: { if ((mypet->GetPetType() == petAnimation && aabonuses.PetCommands[PetCommand]) || mypet->GetPetType() != petAnimation) { MessageString(Chat::PetResponse, PET_REPORT_HP, ConvertArrayF(mypet->GetHPRatio(), val1)); - mypet->ShowBuffList(this); + mypet->ShowBuffs(this); } break; } diff --git a/zone/command.cpp b/zone/command.cpp index c6027d565..4ccca0a5b 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -294,7 +294,6 @@ int command_init(void) command_add("setstat", "Sets the stats to a specific value.", AccountStatus::Max, command_setstat) || command_add("setxp", "[value] - Set your or your player target's experience", AccountStatus::GMAdmin, command_setxp) || command_add("showbuffs", "List buffs active on your target or you if no target", AccountStatus::Guide, command_showbuffs) || - command_add("shownumhits", "Shows buffs numhits for yourself.", AccountStatus::Player, command_shownumhits) || command_add("shownpcgloballoot", "Show global loot entries for your target NPC", AccountStatus::Guide, command_shownpcgloballoot) || command_add("showskills", "[Start Skill ID] [All] - Show the values of your or your player target's skills in a popup 50 at a time, use 'all' as second argument to show non-usable skill's values", AccountStatus::Guide, command_showskills) || command_add("showspells", "[disciplines|spells] - Show your or your target's memorized spells or learned disciplines", AccountStatus::GMAdmin, command_showspells) || @@ -1133,7 +1132,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/setxp.cpp" #include "gm_commands/showbuffs.cpp" #include "gm_commands/shownpcgloballoot.cpp" -#include "gm_commands/shownumhits.cpp" #include "gm_commands/showskills.cpp" #include "gm_commands/showspells.cpp" #include "gm_commands/showspellslist.cpp" diff --git a/zone/command.h b/zone/command.h index d9afa131f..023948370 100644 --- a/zone/command.h +++ b/zone/command.h @@ -241,7 +241,6 @@ void command_setstartzone(Client *c, const Seperator *sep); void command_setstat(Client *c, const Seperator *sep); void command_setxp(Client *c, const Seperator *sep); void command_showbuffs(Client *c, const Seperator *sep); -void command_shownumhits(Client *c, const Seperator *sep); void command_shownpcgloballoot(Client *c, const Seperator *sep); void command_showskills(Client *c, const Seperator *sep); void command_showspells(Client *c, const Seperator *sep); diff --git a/zone/gm_commands/showbuffs.cpp b/zone/gm_commands/showbuffs.cpp index bd8e558d6..16626df19 100755 --- a/zone/gm_commands/showbuffs.cpp +++ b/zone/gm_commands/showbuffs.cpp @@ -2,11 +2,11 @@ void command_showbuffs(Client *c, const Seperator *sep) { - if (c->GetTarget() == 0) { - c->CastToMob()->ShowBuffs(c); - } - else { - c->GetTarget()->CastToMob()->ShowBuffs(c); + Mob* t = c; + if (c->GetTarget()) { + t = c->GetTarget(); } + + t->ShowBuffs(c); } diff --git a/zone/gm_commands/shownumhits.cpp b/zone/gm_commands/shownumhits.cpp deleted file mode 100755 index b8b06867b..000000000 --- a/zone/gm_commands/shownumhits.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "../client.h" - -void command_shownumhits(Client *c, const Seperator *sep) -{ - c->ShowNumHits(); - return; -} - diff --git a/zone/mob.cpp b/zone/mob.cpp index e8220cf4b..6e60ba31c 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2321,54 +2321,57 @@ void Mob::DoAnim(const int animation_id, int animation_speed, bool ackreq, eqFil safe_delete(outapp); } -void Mob::ShowBuffs(Client* client) { - if(SPDAT_RECORDS <= 0) +void Mob::ShowBuffs(Client* c) { + if (SPDAT_RECORDS <= 0) { return; - client->Message(Chat::White, "Buffs on: %s", GetName()); - uint32 i; - uint32 buff_count = GetMaxTotalSlots(); - for (i=0; i < buff_count; i++) { - if (IsValidSpell(buffs[i].spellid)) { - if (spells[buffs[i].spellid].buff_duration_formula == DF_Permanent) - client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name); - else - client->Message(Chat::White, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining); + } + std::string buffs_table; + + buffs_table += DialogueWindow::TableRow( + fmt::format( + "{}{}{}{}{}", + DialogueWindow::TableCell("Slot"), + DialogueWindow::TableCell("Spell"), + DialogueWindow::TableCell("Spell ID"), + DialogueWindow::TableCell("Duration"), + DialogueWindow::TableCell("Hits") + ) + ); + + for (auto i = 0; i < GetMaxTotalSlots(); i++) { + const auto spell_id = buffs[i].spellid; + const auto buff_duration_formula = spells[spell_id].buff_duration_formula; + if (IsValidSpell(spell_id)) { + const auto is_permanent = ( + buff_duration_formula == DF_Aura || + buff_duration_formula == DF_Permanent + ); + + const auto time = Strings::SecondsToTime(buffs[i].ticsremaining * 6); + + buffs_table += DialogueWindow::TableRow( + fmt::format( + "{}{}{}{}{}", + DialogueWindow::TableCell(std::to_string(i)), + DialogueWindow::TableCell(GetSpellName(spell_id)), + DialogueWindow::TableCell(Strings::Commify(spell_id)), + DialogueWindow::TableCell(is_permanent ? "Permanent" : time), + DialogueWindow::TableCell(std::to_string(buffs[i].hit_number)) + ) + ); } } - if (IsClient()){ - client->Message(Chat::White, "itembonuses:"); - client->Message(Chat::White, "Atk:%i Ac:%i HP(%i):%i Mana:%i", itembonuses.ATK, itembonuses.AC, itembonuses.HPRegen, itembonuses.HP, itembonuses.Mana); - client->Message(Chat::White, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i", - itembonuses.STR,itembonuses.STA,itembonuses.DEX,itembonuses.AGI,itembonuses.INT,itembonuses.WIS,itembonuses.CHA); - client->Message(Chat::White, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i", - itembonuses.MR,itembonuses.FR,itembonuses.CR,itembonuses.PR,itembonuses.DR); - client->Message(Chat::White, "DmgShield:%i Haste:%i", itembonuses.DamageShield, itembonuses.haste ); - client->Message(Chat::White, "spellbonuses:"); - client->Message(Chat::White, "Atk:%i Ac:%i HP(%i):%i Mana:%i", spellbonuses.ATK, spellbonuses.AC, spellbonuses.HPRegen, spellbonuses.HP, spellbonuses.Mana); - client->Message(Chat::White, "Str:%i Sta:%i Dex:%i Agi:%i Int:%i Wis:%i Cha:%i", - spellbonuses.STR,spellbonuses.STA,spellbonuses.DEX,spellbonuses.AGI,spellbonuses.INT,spellbonuses.WIS,spellbonuses.CHA); - client->Message(Chat::White, "SvMagic:%i SvFire:%i SvCold:%i SvPoison:%i SvDisease:%i", - spellbonuses.MR,spellbonuses.FR,spellbonuses.CR,spellbonuses.PR,spellbonuses.DR); - client->Message(Chat::White, "DmgShield:%i Haste:%i", spellbonuses.DamageShield, spellbonuses.haste ); - } -} -void Mob::ShowBuffList(Client* client) { - if(SPDAT_RECORDS <= 0) - return; + buffs_table = DialogueWindow::Table(buffs_table); - client->Message(Chat::White, "Buffs on: %s", GetCleanName()); - uint32 i; - uint32 buff_count = GetMaxTotalSlots(); - for (i = 0; i < buff_count; i++) { - if (IsValidSpell(buffs[i].spellid)) { - if (spells[buffs[i].spellid].buff_duration_formula == DF_Permanent) - client->Message(Chat::White, " %i: %s: Permanent", i, spells[buffs[i].spellid].name); - else - client->Message(Chat::White, " %i: %s: %i tics left", i, spells[buffs[i].spellid].name, buffs[i].ticsremaining); - } - } + c->SendPopupToClient( + fmt::format( + "Buffs on {}", + c->GetTargetDescription(this, TargetDescriptionType::UCSelf) + ).c_str(), + buffs_table.c_str() + ); } void Mob::GMMove(float x, float y, float z, float heading, bool save_guard_spot) { diff --git a/zone/mob.h b/zone/mob.h index 1762d913d..2ae3723d3 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -812,8 +812,7 @@ public: uint8 GetArchetype() const; void SetZone(uint32 zone_id, uint32 instance_id); void ShowStats(Client* client); - void ShowBuffs(Client* client); - void ShowBuffList(Client* client); + void ShowBuffs(Client* c); bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc = true); bool PlotPositionOnArcInFrontOfTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float distance, float min_deg = 5.0f, float max_deg = 150.0f); bool PlotPositionOnArcBehindTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float distance);