mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
- Add #setendurance [Endurance] command to set an NPC or player's endurance to a specified amount, or to max if the amount is greater than their max. - Cleanup #endurance command message and logic.
37 lines
646 B
C++
Executable File
37 lines
646 B
C++
Executable File
#include "../client.h"
|
|
|
|
void command_endurance(Client *c, const Seperator *sep)
|
|
{
|
|
Mob* target = c;
|
|
if (c->GetTarget()) {
|
|
target = c->GetTarget();
|
|
}
|
|
|
|
int endurance = 0;
|
|
if (target->IsClient()) {
|
|
endurance = target->CastToClient()->GetMaxEndurance();
|
|
target->CastToClient()->SetEndurance(endurance);
|
|
} else {
|
|
endurance = target->GetMaxEndurance();
|
|
target->SetEndurance(endurance);
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Set {} to full Endurance ({}).",
|
|
(
|
|
c == target ?
|
|
"yourself" :
|
|
fmt::format(
|
|
"{} ({})",
|
|
target->GetCleanName(),
|
|
target->GetID()
|
|
)
|
|
),
|
|
endurance
|
|
).c_str()
|
|
);
|
|
}
|
|
|