mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
* [Cleanup] Cleanup classes.cpp/classes.h # Notes - Remove unused methods and cleanup logic. * Update classes.cpp * Final push.
53 lines
1.3 KiB
C++
Executable File
53 lines
1.3 KiB
C++
Executable File
#include "../client.h"
|
|
|
|
void command_merchantshop(Client *c, const Seperator *sep)
|
|
{
|
|
const auto m = c->GetTarget();
|
|
if (
|
|
!m ||
|
|
!m->IsNPC() ||
|
|
(
|
|
m->GetClass() != Class::Merchant &&
|
|
m->GetClass() != Class::DiscordMerchant &&
|
|
m->GetClass() != Class::AdventureMerchant &&
|
|
m->GetClass() != Class::NorrathsKeepersMerchant &&
|
|
m->GetClass() != Class::DarkReignMerchant &&
|
|
m->GetClass() != Class::AlternateCurrencyMerchant
|
|
)
|
|
) {
|
|
c->Message(Chat::White, "You must target a merchant.");
|
|
return;
|
|
}
|
|
|
|
const auto arguments = sep->argnum;
|
|
if (!arguments) {
|
|
c->Message(Chat::White, "#merchantshop close - Close your targeted merchant's shop");
|
|
c->Message(Chat::White, "#merchantshop open - Open your targeted merchant's shop");
|
|
return;
|
|
}
|
|
|
|
const bool is_close = !strcasecmp(sep->arg[1], "close");
|
|
const bool is_open = !strcasecmp(sep->arg[1], "open");
|
|
if (!is_close && !is_open) {
|
|
c->Message(Chat::White, "#merchantshop close - Close your targeted merchant's shop");
|
|
c->Message(Chat::White, "#merchantshop open - Open your targeted merchant's shop");
|
|
return;
|
|
}
|
|
|
|
if (is_close) {
|
|
m->CastToNPC()->MerchantCloseShop();
|
|
} else if (is_open) {
|
|
m->CastToNPC()->MerchantOpenShop();
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"{} shop for {}.",
|
|
is_close ? "Closed" : "Opened",
|
|
c->GetTargetDescription(m)
|
|
).c_str()
|
|
);
|
|
}
|
|
|