[GM Commands] Add #takeplatinum (#3690)

* [GM Commands] Add `#takeplatinum`

* Revert database manifest change

* Revert database version change

* Remove duplicated messages

* Remove hint as to why `#takeplatinum` might fail.
This commit is contained in:
JJ 2023-11-18 19:08:48 -05:00 committed by GitHub
parent 93f2bea96e
commit e7761133a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 0 deletions

View File

@ -217,6 +217,7 @@ int command_init(void)
command_add("summonitem", "[itemid] [charges] - Summon an item onto your cursor. Charges are optional.", AccountStatus::GMMgmt, command_summonitem) || command_add("summonitem", "[itemid] [charges] - Summon an item onto your cursor. Charges are optional.", AccountStatus::GMMgmt, command_summonitem) ||
command_add("suspend", "[name] [days] [reason] - Suspend by character name and for specificed number of days", AccountStatus::GMLeadAdmin, command_suspend) || command_add("suspend", "[name] [days] [reason] - Suspend by character name and for specificed number of days", AccountStatus::GMLeadAdmin, command_suspend) ||
command_add("suspendmulti", "[Character Name One|Character Name Two|etc] [Days] [Reason] - Suspend multiple characters by name for specified number of days", AccountStatus::GMLeadAdmin, command_suspendmulti) || command_add("suspendmulti", "[Character Name One|Character Name Two|etc] [Days] [Reason] - Suspend multiple characters by name for specified number of days", AccountStatus::GMLeadAdmin, command_suspendmulti) ||
command_add("takeplatinum", "[Platinum] - Takes specified amount of platinum from you or your player target", AccountStatus::GMMgmt, command_takeplatinum) ||
command_add("task", "(subcommand) - Task system commands", AccountStatus::GMLeadAdmin, command_task) || command_add("task", "(subcommand) - Task system commands", AccountStatus::GMLeadAdmin, command_task) ||
command_add("petname", "[newname] - Temporarily renames your pet. Leave name blank to restore the original name.", AccountStatus::GMAdmin, command_petname) || command_add("petname", "[newname] - Temporarily renames your pet. Leave name blank to restore the original name.", AccountStatus::GMAdmin, command_petname) ||
command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_traindisc) || command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_traindisc) ||
@ -903,6 +904,7 @@ void command_bot(Client *c, const Seperator *sep)
#include "gm_commands/summonitem.cpp" #include "gm_commands/summonitem.cpp"
#include "gm_commands/suspend.cpp" #include "gm_commands/suspend.cpp"
#include "gm_commands/suspendmulti.cpp" #include "gm_commands/suspendmulti.cpp"
#include "gm_commands/takeplatinum.cpp"
#include "gm_commands/task.cpp" #include "gm_commands/task.cpp"
#include "gm_commands/traindisc.cpp" #include "gm_commands/traindisc.cpp"
#include "gm_commands/tune.cpp" #include "gm_commands/tune.cpp"

View File

@ -168,6 +168,7 @@ void command_summonburiedplayercorpse(Client *c, const Seperator *sep);
void command_summonitem(Client *c, const Seperator *sep); void command_summonitem(Client *c, const Seperator *sep);
void command_suspend(Client *c, const Seperator *sep); void command_suspend(Client *c, const Seperator *sep);
void command_suspendmulti(Client *c, const Seperator *sep); void command_suspendmulti(Client *c, const Seperator *sep);
void command_takeplatinum(Client* c, const Seperator* sep);
void command_task(Client *c, const Seperator *sep); void command_task(Client *c, const Seperator *sep);
void command_petname(Client *c, const Seperator *sep); void command_petname(Client *c, const Seperator *sep);
void command_traindisc(Client *c, const Seperator *sep); void command_traindisc(Client *c, const Seperator *sep);

View File

@ -0,0 +1,57 @@
#include "../client.h"
void command_takeplatinum(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments || !sep->IsNumber(1)) { //must be a number
c->Message(Chat::Red, "Usage: #takeplatinum [Platinum]");
return;
}
Client *target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
uint32 platinum = Strings::ToUnsignedInt(sep->arg[1]);
if (!platinum) {
c->Message(Chat::Red, "Usage: #takeplatinum [Platinum]");
return;
}
bool success = target->TakePlatinum(
platinum,
true
);
if (success) {
c->Message(
Chat::White,
fmt::format(
"Subtracted {} from {}.",
Strings::Money(
platinum,
0,
0,
0
),
c->GetTargetDescription(target)
).c_str()
);
}
else {
c->Message(
Chat::Red,
fmt::format(
"Unable to subtract {} from {}.",
Strings::Money(
platinum,
0,
0,
0
),
c->GetTargetDescription(target)
).c_str()
);
}
}