mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +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:
parent
3ceb743195
commit
f2ff4245c0
@ -2120,6 +2120,11 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app)
|
||||
(tmp->GetClass() != DISCORD_MERCHANT) && (tmp->GetClass() != NORRATHS_KEEPERS_MERCHANT) && (tmp->GetClass() != DARK_REIGN_MERCHANT)))
|
||||
return;
|
||||
|
||||
if (!tmp->CastToNPC()->IsMerchantOpen()) {
|
||||
tmp->SayString(zone->random.Int(MERCHANT_CLOSED_ONE, MERCHANT_CLOSED_THREE));
|
||||
return;
|
||||
}
|
||||
|
||||
//you have to be somewhat close to them to be properly using them
|
||||
if (DistanceSquared(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2)
|
||||
return;
|
||||
@ -14021,9 +14026,8 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app)
|
||||
if (tmp->Charmed())
|
||||
action = 0;
|
||||
|
||||
// 1199 I don't have time for that now. etc
|
||||
if (!tmp->CastToNPC()->IsMerchantOpen()) {
|
||||
tmp->SayString(zone->random.Int(1199, 1202));
|
||||
tmp->SayString(zone->random.Int(MERCHANT_CLOSED_ONE, MERCHANT_CLOSED_THREE));
|
||||
action = 0;
|
||||
}
|
||||
|
||||
@ -14428,8 +14432,8 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app)
|
||||
|
||||
if (nt) {
|
||||
if (GetGM() || (!nt->IsInvisible(this) && (DistanceSquared(m_Position, nt->GetPosition()) <= TARGETING_RANGE*TARGETING_RANGE))) {
|
||||
if (nt->GetBodyType() == BT_NoTarget2 ||
|
||||
nt->GetBodyType() == BT_Special ||
|
||||
if (nt->GetBodyType() == BT_NoTarget2 ||
|
||||
nt->GetBodyType() == BT_Special ||
|
||||
nt->GetBodyType() == BT_NoTarget) {
|
||||
can_target = false;
|
||||
}
|
||||
|
||||
@ -205,8 +205,7 @@ int command_init(void)
|
||||
command_add("mana", "Fill your or your target's mana", AccountStatus::Guide, command_mana) ||
|
||||
command_add("maxskills", "Maxes skills for you or your player target.", AccountStatus::GMMgmt, command_max_all_skills) ||
|
||||
command_add("memspell", "[Spell ID] [Spell Gem] - Memorize a Spell by ID to the specified Spell Gem for you or your target", AccountStatus::Guide, command_memspell) ||
|
||||
command_add("merchant_close_shop", "Closes a merchant shop", AccountStatus::GMAdmin, command_merchantcloseshop) ||
|
||||
command_add("merchant_open_shop", "Opens a merchants shop", AccountStatus::GMAdmin, command_merchantopenshop) ||
|
||||
command_add("merchantshop", "Closes or opens your target merchant's shop", AccountStatus::GMAdmin, command_merchantshop) ||
|
||||
command_add("modifynpcstat", "[Stat] [Value] - Modifies an NPC's stats temporarily.", AccountStatus::GMLeadAdmin, command_modifynpcstat) ||
|
||||
command_add("motd", "[Message of the Day] - Set Message of the Day (leave empty to have no Message of the Day)", AccountStatus::GMLeadAdmin, command_motd) ||
|
||||
command_add("movechar", "[Character ID|Character Name] [Zone ID|Zone Short Name] - Move an offline character to the specified zone", AccountStatus::Guide, command_movechar) ||
|
||||
@ -1045,8 +1044,7 @@ void command_bot(Client *c, const Seperator *sep)
|
||||
#include "gm_commands/mana.cpp"
|
||||
#include "gm_commands/max_all_skills.cpp"
|
||||
#include "gm_commands/memspell.cpp"
|
||||
#include "gm_commands/merchantcloseshop.cpp"
|
||||
#include "gm_commands/merchantopenshop.cpp"
|
||||
#include "gm_commands/merchantshop.cpp"
|
||||
#include "gm_commands/modifynpcstat.cpp"
|
||||
#include "gm_commands/motd.cpp"
|
||||
#include "gm_commands/movechar.cpp"
|
||||
|
||||
@ -155,8 +155,7 @@ void command_makepet(Client *c, const Seperator *sep);
|
||||
void command_mana(Client *c, const Seperator *sep);
|
||||
void command_max_all_skills(Client *c, const Seperator *sep);
|
||||
void command_memspell(Client *c, const Seperator *sep);
|
||||
void command_merchantcloseshop(Client *c, const Seperator *sep);
|
||||
void command_merchantopenshop(Client *c, const Seperator *sep);
|
||||
void command_merchantshop(Client *c, const Seperator *sep);
|
||||
void command_modifynpcstat(Client *c, const Seperator *sep);
|
||||
void command_motd(Client *c, const Seperator *sep);
|
||||
void command_movechar(Client *c, const Seperator *sep);
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_merchantcloseshop(Client *c, const Seperator *sep)
|
||||
{
|
||||
Mob *merchant = c->GetTarget();
|
||||
if (!merchant || merchant->GetClass() != MERCHANT) {
|
||||
c->Message(Chat::White, "You must target a merchant to close their shop.");
|
||||
return;
|
||||
}
|
||||
|
||||
merchant->CastToNPC()->MerchantCloseShop();
|
||||
}
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_merchantopenshop(Client *c, const Seperator *sep)
|
||||
{
|
||||
Mob *merchant = c->GetTarget();
|
||||
if (!merchant || merchant->GetClass() != MERCHANT) {
|
||||
c->Message(Chat::White, "You must target a merchant to open their shop.");
|
||||
return;
|
||||
}
|
||||
|
||||
merchant->CastToNPC()->MerchantOpenShop();
|
||||
}
|
||||
|
||||
52
zone/gm_commands/merchantshop.cpp
Executable file
52
zone/gm_commands/merchantshop.cpp
Executable file
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
@ -248,6 +248,9 @@
|
||||
#define WONT_SELL_DEEDS5 1170 //I am tolerant by nature..but infidels like you push me past my limit..get out!
|
||||
#define WONT_SELL_DEEDS6 1171 //I cannot abide you or your actions against all that is right..BE GONE!
|
||||
#define AA_POINT 1197 //point
|
||||
#define MERCHANT_CLOSED_ONE 1199 //I don't have time for that now.
|
||||
#define MERCHANT_CLOSED_TWO 1200 //Can't you see I'm doing something here?
|
||||
#define MERCHANT_CLOSED_THREE 1201 //I am not open for business right now.
|
||||
#define AA_POINTS 1215 //points
|
||||
#define SPELL_FIZZLE_OTHER 1218 //%1's spell fizzles!
|
||||
#define MISSED_NOTE_OTHER 1219 //A missed note brings %1's song to a close!
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user