diff --git a/zone/command.cpp b/zone/command.cpp index 94941c85b..6a3098b6e 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -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("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("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("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) || @@ -903,6 +904,7 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/summonitem.cpp" #include "gm_commands/suspend.cpp" #include "gm_commands/suspendmulti.cpp" +#include "gm_commands/takeplatinum.cpp" #include "gm_commands/task.cpp" #include "gm_commands/traindisc.cpp" #include "gm_commands/tune.cpp" diff --git a/zone/command.h b/zone/command.h index 5c06e2c9c..38ae9cbdf 100644 --- a/zone/command.h +++ b/zone/command.h @@ -168,6 +168,7 @@ void command_summonburiedplayercorpse(Client *c, const Seperator *sep); void command_summonitem(Client *c, const Seperator *sep); void command_suspend(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_petname(Client *c, const Seperator *sep); void command_traindisc(Client *c, const Seperator *sep); diff --git a/zone/gm_commands/takeplatinum.cpp b/zone/gm_commands/takeplatinum.cpp new file mode 100644 index 000000000..a5c0a8f3a --- /dev/null +++ b/zone/gm_commands/takeplatinum.cpp @@ -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() + ); + } +}