[Commands] Cleanup #showbuffs Command (#3439)

* [Commands] Cleanup #showbuffs Command

# Notes
- Cleaned up messages and logic.
- Removed unnecessary itembonuses/spellbonuses stuff.
- Removed `Mob::ShowBuffList` as it's just a copy of this method.

* Update mob.cpp

* Further cleanup.

* Update mob.cpp

* Update mob.cpp
This commit is contained in:
Alex King 2023-06-25 23:59:47 -04:00 committed by GitHub
parent 050aba65b6
commit ef7a3cae17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 52 additions and 74 deletions

View File

@ -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) int Client::GetQuiverHaste(int delay)
{ {
const EQ::ItemInstance *pi = nullptr; const EQ::ItemInstance *pi = nullptr;

View File

@ -1597,8 +1597,6 @@ public:
void SetInvulnerableEnvironmentDamage(bool val) { invulnerable_environment_damage = val; } void SetInvulnerableEnvironmentDamage(bool val) { invulnerable_environment_damage = val; }
void SetIntoxication(int32 in_intoxication); void SetIntoxication(int32 in_intoxication);
void ShowNumHits(); // work around function for numhits not showing on buffs
void ApplyWeaponsStance(); void ApplyWeaponsStance();
void TogglePassiveAlternativeAdvancement(const AA::Rank &rank, uint32 ability_id); void TogglePassiveAlternativeAdvancement(const AA::Rank &rank, uint32 ability_id);
bool UseTogglePassiveHotkey(const AA::Rank &rank); bool UseTogglePassiveHotkey(const AA::Rank &rank);

View File

@ -10712,7 +10712,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
case PET_HEALTHREPORT: { case PET_HEALTHREPORT: {
if ((mypet->GetPetType() == petAnimation && aabonuses.PetCommands[PetCommand]) || mypet->GetPetType() != petAnimation) { if ((mypet->GetPetType() == petAnimation && aabonuses.PetCommands[PetCommand]) || mypet->GetPetType() != petAnimation) {
MessageString(Chat::PetResponse, PET_REPORT_HP, ConvertArrayF(mypet->GetHPRatio(), val1)); MessageString(Chat::PetResponse, PET_REPORT_HP, ConvertArrayF(mypet->GetHPRatio(), val1));
mypet->ShowBuffList(this); mypet->ShowBuffs(this);
} }
break; break;
} }

View File

@ -294,7 +294,6 @@ int command_init(void)
command_add("setstat", "Sets the stats to a specific value.", AccountStatus::Max, command_setstat) || 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("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("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("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("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) || 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/setxp.cpp"
#include "gm_commands/showbuffs.cpp" #include "gm_commands/showbuffs.cpp"
#include "gm_commands/shownpcgloballoot.cpp" #include "gm_commands/shownpcgloballoot.cpp"
#include "gm_commands/shownumhits.cpp"
#include "gm_commands/showskills.cpp" #include "gm_commands/showskills.cpp"
#include "gm_commands/showspells.cpp" #include "gm_commands/showspells.cpp"
#include "gm_commands/showspellslist.cpp" #include "gm_commands/showspellslist.cpp"

View File

@ -241,7 +241,6 @@ void command_setstartzone(Client *c, const Seperator *sep);
void command_setstat(Client *c, const Seperator *sep); void command_setstat(Client *c, const Seperator *sep);
void command_setxp(Client *c, const Seperator *sep); void command_setxp(Client *c, const Seperator *sep);
void command_showbuffs(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_shownpcgloballoot(Client *c, const Seperator *sep);
void command_showskills(Client *c, const Seperator *sep); void command_showskills(Client *c, const Seperator *sep);
void command_showspells(Client *c, const Seperator *sep); void command_showspells(Client *c, const Seperator *sep);

View File

@ -2,11 +2,11 @@
void command_showbuffs(Client *c, const Seperator *sep) void command_showbuffs(Client *c, const Seperator *sep)
{ {
if (c->GetTarget() == 0) { Mob* t = c;
c->CastToMob()->ShowBuffs(c); if (c->GetTarget()) {
} t = c->GetTarget();
else {
c->GetTarget()->CastToMob()->ShowBuffs(c);
} }
t->ShowBuffs(c);
} }

View File

@ -1,8 +0,0 @@
#include "../client.h"
void command_shownumhits(Client *c, const Seperator *sep)
{
c->ShowNumHits();
return;
}

View File

@ -2321,54 +2321,57 @@ void Mob::DoAnim(const int animation_id, int animation_speed, bool ackreq, eqFil
safe_delete(outapp); safe_delete(outapp);
} }
void Mob::ShowBuffs(Client* client) { void Mob::ShowBuffs(Client* c) {
if(SPDAT_RECORDS <= 0) if (SPDAT_RECORDS <= 0) {
return; 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) { buffs_table = DialogueWindow::Table(buffs_table);
if(SPDAT_RECORDS <= 0)
return;
client->Message(Chat::White, "Buffs on: %s", GetCleanName()); c->SendPopupToClient(
uint32 i; fmt::format(
uint32 buff_count = GetMaxTotalSlots(); "Buffs on {}",
for (i = 0; i < buff_count; i++) { c->GetTargetDescription(this, TargetDescriptionType::UCSelf)
if (IsValidSpell(buffs[i].spellid)) { ).c_str(),
if (spells[buffs[i].spellid].buff_duration_formula == DF_Permanent) buffs_table.c_str()
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);
}
}
} }
void Mob::GMMove(float x, float y, float z, float heading, bool save_guard_spot) { void Mob::GMMove(float x, float y, float z, float heading, bool save_guard_spot) {

View File

@ -812,8 +812,7 @@ public:
uint8 GetArchetype() const; uint8 GetArchetype() const;
void SetZone(uint32 zone_id, uint32 instance_id); void SetZone(uint32 zone_id, uint32 instance_id);
void ShowStats(Client* client); void ShowStats(Client* client);
void ShowBuffs(Client* client); void ShowBuffs(Client* c);
void ShowBuffList(Client* client);
bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc = true); 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 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); bool PlotPositionOnArcBehindTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float distance);