mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 00:46:46 +00:00
[Commands] Consolidate #merchant_close_shop and #merchant_open_shop to #merchantshop (#3433)
* [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
This commit is contained in:
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#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()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user