mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
* First push * Final push. * Consolidate zone commands in to one. * Update command.cpp * Remove debug messages. * Test * Add support for sub command status levels. * Update command.cpp * Update client.cpp * Update database_update_manifest.cpp * Update version.h * Update item.cpp * Update version.h * Update database_update_manifest.cpp * Fix command arguments. * Help message. * Update command.cpp * Do DB injection/deletion * Indent * Update server_locked.cpp * Update set.cpp * Lock aliases * Update command_subsettings_repository.h * Update set.cpp * Fix --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
50 lines
1.0 KiB
C++
Executable File
50 lines
1.0 KiB
C++
Executable File
#include "../../client.h"
|
|
|
|
void SetEXP(Client *c, const Seperator *sep)
|
|
{
|
|
const auto arguments = sep->argnum;
|
|
if (arguments < 3 || !sep->IsNumber(3)) {
|
|
c->Message(Chat::White, "Usage: #set exp [aa|exp] [Amount]");
|
|
return;
|
|
}
|
|
|
|
auto t = c;
|
|
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
|
t = c->GetTarget()->CastToClient();
|
|
}
|
|
|
|
const std::string& type = Strings::ToLower(sep->arg[2]);
|
|
|
|
const bool is_aa = Strings::EqualFold(type, "aa");
|
|
const bool is_exp = Strings::EqualFold(type, "exp");
|
|
if (!is_aa && !is_exp) {
|
|
c->Message(Chat::White, "Usage: #set exp [aa|exp] [Amount]");
|
|
return;
|
|
}
|
|
|
|
const uint32 amount = Strings::ToUnsignedInt(sep->arg[3]);
|
|
|
|
if (is_aa) {
|
|
t->SetEXP(
|
|
t->GetEXP(),
|
|
amount
|
|
);
|
|
} else if (is_exp) {
|
|
t->SetEXP(
|
|
amount,
|
|
t->GetAAXP()
|
|
);
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"{} now {} {} {}experience.",
|
|
c->GetTargetDescription(t, TargetDescriptionType::UCYou),
|
|
c == t ? "have" : "has",
|
|
Strings::Commify(amount),
|
|
is_aa ? "AA " : ""
|
|
).c_str()
|
|
);
|
|
}
|