Added #reloadmerchants for zone-based merchant refreshing.

This commit is contained in:
Kinglykrab 2018-01-27 18:19:48 -05:00
parent 6ed3301110
commit 8e9fa38197
4 changed files with 20 additions and 0 deletions

View File

@ -317,6 +317,7 @@ int command_init(void)
command_add("reloadallrules", "Executes a reload of all rules.", 80, command_reloadallrules) ||
command_add("reloademote", "Reloads NPC Emotes", 80, command_reloademote) ||
command_add("reloadlevelmods", nullptr, 255, command_reloadlevelmods) ||
command_add("reloadmerchants", nullptr, 255, command_reloadmerchants) ||
command_add("reloadperlexportsettings", nullptr, 255, command_reloadperlexportsettings) ||
command_add("reloadqst", " - Clear quest cache (any argument causes it to also stop all timers)", 150, command_reloadqst) ||
command_add("reloadrulesworld", "Executes a reload of all rules in world specifically.", 80, command_reloadworldrules) ||
@ -2996,6 +2997,11 @@ void command_reloadworld(Client *c, const Seperator *sep)
safe_delete(pack);
}
void command_reloadmerchants(Client *c, const Seperator *sep) {
zone->ReloadMerchants();
c->Message(15, "Reloading merchants.");
}
void command_reloadlevelmods(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == 0)

View File

@ -224,6 +224,7 @@ void command_reloadaa(Client *c, const Seperator *sep);
void command_reloadallrules(Client *c, const Seperator *sep);
void command_reloademote(Client* c, const Seperator *sep);
void command_reloadlevelmods(Client *c, const Seperator *sep);
void command_reloadmerchants(Client *c, const Seperator *sep);
void command_reloadperlexportsettings(Client *c, const Seperator *sep);
void command_reloadqst(Client *c, const Seperator *sep);
void command_reloadstatic(Client *c, const Seperator *sep);

View File

@ -2272,6 +2272,18 @@ void Zone::ReloadWorld(uint32 Option){
}
}
void Zone::ReloadMerchants() {
std::list<NPC*> npc_list;
entity_list.GetNPCList(npc_list);
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
NPC* npc = *itr;
if (npc->MerchantType != 0) {
zone->LoadNewMerchantData(npc->MerchantType);
}
}
}
void Zone::LoadTickItems()
{
tick_items.clear();

View File

@ -209,6 +209,7 @@ public:
void LoadAlternateCurrencies();
void LoadNPCEmotes(LinkedList<NPC_Emote_Struct*>* NPCEmoteList);
void ReloadWorld(uint32 Option);
void ReloadMerchants();
Map* zonemap;
WaterMap* watermap;