mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
* [Commands] Consolidate #merchant_close_shop and #merchant_open_shop to #merchantshop # Notes - `#merchant_close_shop` and `#merchant_open_shop` are now consolidated into `#merchantshop`. - Command now works on any type of merchant instead of just regular merchants. - Can be used on Merchants, Discord Merchants, Adventure Merchants, Norrath's Keepers Merchants, Dark Reign Merchants, and Alternate Currency Merchants. * Update merchantshop.cpp * Update merchantshop.cpp * Update merchantshop.cpp
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() != MERCHANT &&
|
|
m->GetClass() != DISCORD_MERCHANT &&
|
|
m->GetClass() != ADVENTURE_MERCHANT &&
|
|
m->GetClass() != NORRATHS_KEEPERS_MERCHANT &&
|
|
m->GetClass() != DARK_REIGN_MERCHANT &&
|
|
m->GetClass() != ALT_CURRENCY_MERCHANT
|
|
)
|
|
) {
|
|
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()
|
|
);
|
|
}
|
|
|