mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-18 10:42:25 +00:00
[Commands] Cleanup #setadventurepoints Command. (#1901)
- Cleanup message and logic.
This commit is contained in:
parent
6a7782ab8d
commit
7f23c93ce5
@ -324,7 +324,7 @@ int command_init(void)
|
||||
command_add("serverrules", "- Read this server's rules", AccountStatus::Player, command_serverrules) ||
|
||||
command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) ||
|
||||
command_add("setaaxp", "[AA|Group|Raid] [AA Experience] - Set your or your player target's AA Experience by Type", AccountStatus::GMAdmin, command_setaaxp) ||
|
||||
command_add("setadventurepoints", "- Set your or your player target's available adventure points", AccountStatus::GMLeadAdmin, command_set_adventure_points) ||
|
||||
command_add("setadventurepoints", "[Theme] [Points] - Set your or your player target's available Adventure Points by Theme", AccountStatus::GMLeadAdmin, command_set_adventure_points) ||
|
||||
command_add("setaltcurrency", "[Currency ID] [Amount] - Set your or your target's available Alternate Currency by Currency ID", AccountStatus::GMAdmin, command_setaltcurrency) ||
|
||||
command_add("setanim", "[Animation ID (IDs are 0 to 4)] - Set target's appearance to Animation ID", AccountStatus::GMMgmt, command_setanim) ||
|
||||
command_add("setcrystals", "[value] - Set your or your player target's available radiant or ebon crystals", AccountStatus::GMAdmin, command_setcrystals) ||
|
||||
|
||||
@ -1,24 +1,84 @@
|
||||
#include "../client.h"
|
||||
#include "../../common/data_verification.h"
|
||||
|
||||
void command_set_adventure_points(Client *c, const Seperator *sep)
|
||||
{
|
||||
Client *t = c;
|
||||
int arguments = sep->argnum;
|
||||
|
||||
if (
|
||||
!arguments ||
|
||||
!sep->IsNumber(1) ||
|
||||
!sep->IsNumber(2)
|
||||
) {
|
||||
c->Message(Chat::White, "Usage: #setadventurepoints [Theme] [Points]");
|
||||
c->Message(Chat::White, "Valid themes are as follows.");
|
||||
auto theme_map = EQ::constants::GetLDoNThemeMap();
|
||||
for (const auto& theme : theme_map) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Theme {} | {}",
|
||||
theme.first,
|
||||
theme.second
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
c->Message(Chat::White, "Note: Theme 0 splits the points evenly across all Themes.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto target = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
t = c->GetTarget()->CastToClient();
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
if (!sep->arg[1][0]) {
|
||||
c->Message(Chat::White, "Usage: #setadventurepoints [theme] [points]");
|
||||
auto theme_id = std::stoul(sep->arg[1]);
|
||||
if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
|
||||
c->Message(Chat::White, "Valid themes are as follows.");
|
||||
auto theme_map = EQ::constants::GetLDoNThemeMap();
|
||||
for (const auto& theme : theme_map) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Theme {} | {}",
|
||||
theme.first,
|
||||
theme.second
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
c->Message(Chat::White, "Note: Theme 0 splits the points evenly across all Themes.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sep->IsNumber(1) || !sep->IsNumber(2)) {
|
||||
c->Message(Chat::White, "Usage: #setadventurepoints [theme] [points]");
|
||||
return;
|
||||
}
|
||||
auto points = std::stoi(sep->arg[2]);
|
||||
|
||||
c->Message(Chat::White, "Updating adventure points for %s", t->GetName());
|
||||
t->UpdateLDoNPoints(atoi(sep->arg[1]), atoi(sep->arg[2]));
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} for {}.",
|
||||
(
|
||||
theme_id == LDoNThemes::Unused ?
|
||||
fmt::format(
|
||||
"Splitting {} Points Evenly",
|
||||
points
|
||||
) :
|
||||
fmt::format(
|
||||
"Adding {} {} Points",
|
||||
points,
|
||||
EQ::constants::GetLDoNThemeName(theme_id)
|
||||
)
|
||||
),
|
||||
(
|
||||
c == target ?
|
||||
"Yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
|
||||
target->UpdateLDoNPoints(theme_id, points);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user