mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 08:26:36 +00:00
[Quests] Cleanup Quest Parser Logic (#4025)
* [Quests] Cleanup Quest Parser Logic # Notes - Consolidate duplicated code into loops to make it easier to read and easier to add on to. # Images * Update quest_parser_collection.cpp * Push * Push * Update embperl.cpp * Push * Additional cleanup, use File::Exists utility * Range based loops * Update embparser.cpp * Cleanup * Update embparser.cpp --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
+161
-70
@@ -59,33 +59,66 @@ public:
|
||||
QuestParserCollection();
|
||||
~QuestParserCollection();
|
||||
|
||||
void RegisterQuestInterface(QuestInterface *qi, std::string ext);
|
||||
void UnRegisterQuestInterface(QuestInterface *qi, std::string ext);
|
||||
void RegisterQuestInterface(QuestInterface* qi, std::string ext);
|
||||
void ClearInterfaces();
|
||||
void AddVar(std::string name, std::string val);
|
||||
void Init();
|
||||
void ReloadQuests(bool reset_timers = true);
|
||||
void RemoveEncounter(const std::string name);
|
||||
void RemoveEncounter(const std::string& name);
|
||||
|
||||
bool HasQuestSub(uint32 npcid, QuestEventID evt);
|
||||
bool PlayerHasQuestSub(QuestEventID evt);
|
||||
bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt);
|
||||
bool ItemHasQuestSub(EQ::ItemInstance *itm, QuestEventID evt);
|
||||
bool BotHasQuestSub(QuestEventID evt);
|
||||
bool HasQuestSub(uint32 npc_id, QuestEventID event_id);
|
||||
bool PlayerHasQuestSub(QuestEventID event_id);
|
||||
bool SpellHasQuestSub(uint32 spell_id, QuestEventID event_id);
|
||||
bool ItemHasQuestSub(EQ::ItemInstance* inst, QuestEventID event_id);
|
||||
bool BotHasQuestSub(QuestEventID event_id);
|
||||
|
||||
int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers = nullptr);
|
||||
int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers = nullptr);
|
||||
int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers = nullptr);
|
||||
int EventSpell(QuestEventID evt, Mob* mob, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers = nullptr);
|
||||
int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers = nullptr);
|
||||
int EventNPC(
|
||||
QuestEventID event_id,
|
||||
NPC* npc,
|
||||
Mob* init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers = nullptr
|
||||
);
|
||||
|
||||
int EventPlayer(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers = nullptr
|
||||
);
|
||||
|
||||
int EventItem(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
EQ::ItemInstance* inst,
|
||||
Mob* mob,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers = nullptr
|
||||
);
|
||||
|
||||
int EventSpell(
|
||||
QuestEventID event_id,
|
||||
Mob* mob,
|
||||
Client* client,
|
||||
uint32 spell_id,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers = nullptr
|
||||
);
|
||||
|
||||
int EventEncounter(
|
||||
QuestEventID event_id,
|
||||
std::string encounter_name,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers = nullptr
|
||||
);
|
||||
|
||||
int EventBot(
|
||||
QuestEventID evt,
|
||||
QuestEventID event_id,
|
||||
Bot *bot,
|
||||
Mob *init,
|
||||
std::string data,
|
||||
@@ -117,32 +150,63 @@ public:
|
||||
void LoadPerlEventExportSettings(PerlEventExportSettings* s);
|
||||
|
||||
private:
|
||||
bool HasQuestSubLocal(uint32 npcid, QuestEventID evt);
|
||||
bool HasQuestSubGlobal(QuestEventID evt);
|
||||
bool NPCHasEncounterSub(uint32 npc_id, QuestEventID evt);
|
||||
bool PlayerHasQuestSubLocal(QuestEventID evt);
|
||||
bool PlayerHasQuestSubGlobal(QuestEventID evt);
|
||||
bool PlayerHasEncounterSub(QuestEventID evt);
|
||||
bool SpellHasEncounterSub(uint32 spell_id, QuestEventID evt);
|
||||
bool ItemHasEncounterSub(EQ::ItemInstance* item, QuestEventID evt);
|
||||
bool HasEncounterSub(QuestEventID evt, const std::string& package_name);
|
||||
bool BotHasQuestSubLocal(QuestEventID evt);
|
||||
bool BotHasQuestSubGlobal(QuestEventID evt);
|
||||
bool HasQuestSubLocal(uint32 npc_id, QuestEventID event_id);
|
||||
bool HasQuestSubGlobal(QuestEventID event_id);
|
||||
bool NPCHasEncounterSub(uint32 npc_id, QuestEventID event_id);
|
||||
bool PlayerHasQuestSubLocal(QuestEventID event_id);
|
||||
bool PlayerHasQuestSubGlobal(QuestEventID event_id);
|
||||
bool PlayerHasEncounterSub(QuestEventID event_id);
|
||||
bool SpellHasEncounterSub(uint32 spell_id, QuestEventID event_id);
|
||||
bool ItemHasEncounterSub(EQ::ItemInstance* inst, QuestEventID event_id);
|
||||
bool HasEncounterSub(QuestEventID event_id, const std::string& package_name);
|
||||
bool BotHasQuestSubLocal(QuestEventID event_id);
|
||||
bool BotHasQuestSubGlobal(QuestEventID event_id);
|
||||
|
||||
int EventNPCLocal(
|
||||
QuestEventID event_id,
|
||||
NPC* npc,
|
||||
Mob* init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int EventNPCGlobal(
|
||||
QuestEventID event_id,
|
||||
NPC* npc,
|
||||
Mob* init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int EventPlayerLocal(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int EventPlayerGlobal(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
|
||||
int EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
|
||||
int EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
|
||||
int EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<std::any> *extra_pointers);
|
||||
int EventBotLocal(
|
||||
QuestEventID evt,
|
||||
QuestEventID event_id,
|
||||
Bot *bot,
|
||||
Mob *init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
int EventBotGlobal(
|
||||
QuestEventID evt,
|
||||
QuestEventID event_id,
|
||||
Bot *bot,
|
||||
Mob *init,
|
||||
std::string data,
|
||||
@@ -150,47 +214,74 @@ private:
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename);
|
||||
QuestInterface *GetQIByGlobalNPCQuest(std::string &filename);
|
||||
QuestInterface *GetQIByPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIByGlobalPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIBySpellQuest(uint32 spell_id, std::string &filename);
|
||||
QuestInterface *GetQIByItemQuest(std::string item_script, std::string &filename);
|
||||
QuestInterface *GetQIByEncounterQuest(std::string encounter_name, std::string &filename);
|
||||
QuestInterface *GetQIByBotQuest(std::string &filename);
|
||||
QuestInterface *GetQIByGlobalBotQuest(std::string &filename);
|
||||
QuestInterface* GetQIByNPCQuest(uint32 npc_id, std::string& filename);
|
||||
QuestInterface* GetQIByGlobalNPCQuest(std::string& filename);
|
||||
QuestInterface* GetQIByPlayerQuest(std::string& filename);
|
||||
QuestInterface* GetQIByGlobalPlayerQuest(std::string& filename);
|
||||
QuestInterface* GetQIBySpellQuest(uint32 spell_id, std::string& filename);
|
||||
QuestInterface* GetQIByItemQuest(std::string item_script, std::string& filename);
|
||||
QuestInterface* GetQIByEncounterQuest(std::string encounter_name, std::string& filename);
|
||||
QuestInterface* GetQIByBotQuest(std::string& filename);
|
||||
QuestInterface* GetQIByGlobalBotQuest(std::string& filename);
|
||||
|
||||
int DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers);
|
||||
int DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers);
|
||||
int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers);
|
||||
int DispatchEventSpell(QuestEventID evt, Mob* mob, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers);
|
||||
int DispatchEventBot(
|
||||
QuestEventID evt,
|
||||
Bot *bot,
|
||||
Mob *init,
|
||||
int DispatchEventNPC(
|
||||
QuestEventID event_id,
|
||||
NPC* npc,
|
||||
Mob* init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int DispatchEventPlayer(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int DispatchEventItem(
|
||||
QuestEventID event_id,
|
||||
Client* client,
|
||||
EQ::ItemInstance* inst,
|
||||
Mob* mob,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int DispatchEventSpell(
|
||||
QuestEventID event_id,
|
||||
Mob* mob,
|
||||
Client* client,
|
||||
uint32 spell_id,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
int DispatchEventBot(
|
||||
QuestEventID event_id,
|
||||
Bot* bot,
|
||||
Mob* init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any>* extra_pointers
|
||||
);
|
||||
|
||||
std::map<uint32, QuestInterface*> _interfaces;
|
||||
std::map<uint32, std::string> _extensions;
|
||||
std::list<QuestInterface*> _load_precedence;
|
||||
std::map<uint32, std::string> _extensions;
|
||||
std::list<QuestInterface*> _load_precedence;
|
||||
|
||||
//0x00 = Unloaded
|
||||
//0xFFFFFFFF = Failed to Load
|
||||
std::map<uint32, uint32> _npc_quest_status;
|
||||
uint32 _global_npc_quest_status;
|
||||
uint32 _player_quest_status;
|
||||
uint32 _global_player_quest_status;
|
||||
uint32 _bot_quest_status;
|
||||
uint32 _global_bot_quest_status;
|
||||
std::map<uint32, uint32> _spell_quest_status;
|
||||
std::map<uint32, uint32> _item_quest_status;
|
||||
std::map<uint32, uint32> _npc_quest_status;
|
||||
uint32 _global_npc_quest_status;
|
||||
uint32 _player_quest_status;
|
||||
uint32 _global_player_quest_status;
|
||||
uint32 _bot_quest_status;
|
||||
uint32 _global_bot_quest_status;
|
||||
std::map<uint32, uint32> _spell_quest_status;
|
||||
std::map<uint32, uint32> _item_quest_status;
|
||||
std::map<std::string, uint32> _encounter_quest_status;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user