mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
[Quests] Fix issue with Lua encounters loading in certain circumstances (#4378)
* [Quests] Fix issue with Lua encounters loading in certain circumstances * Update quest_parser_collection.cpp * Constant * Move constant * Fix * Update quest_parser_collection.cpp
This commit is contained in:
parent
47ddcb54f1
commit
d01d091b47
@ -31,6 +31,12 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// an encounter can register events before the object is loaded
|
||||||
|
// examples
|
||||||
|
// eq.register_npc_event(Event.death_complete, -1, AllDeath);
|
||||||
|
// eq.register_npc_event(Event.say, -1, All_Say);
|
||||||
|
const std::string ENCOUNTER_NO_ENTITY_ID = "-1";
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern void MapOpcodes();
|
extern void MapOpcodes();
|
||||||
|
|
||||||
@ -116,13 +122,7 @@ bool QuestParserCollection::HasQuestSub(uint32 npc_id, QuestEventID event_id)
|
|||||||
|
|
||||||
bool QuestParserCollection::NPCHasEncounterSub(uint32 npc_id, QuestEventID event_id)
|
bool QuestParserCollection::NPCHasEncounterSub(uint32 npc_id, QuestEventID event_id)
|
||||||
{
|
{
|
||||||
return HasEncounterSub(
|
return HasEncounterSub(event_id, fmt::format("npc_{}", npc_id)) || HasEncounterSub(event_id, "npc_" + ENCOUNTER_NO_ENTITY_ID);
|
||||||
event_id,
|
|
||||||
fmt::format(
|
|
||||||
"npc_{}",
|
|
||||||
npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestParserCollection::HasQuestSubLocal(uint32 npc_id, QuestEventID event_id)
|
bool QuestParserCollection::HasQuestSubLocal(uint32 npc_id, QuestEventID event_id)
|
||||||
@ -234,13 +234,8 @@ bool QuestParserCollection::PlayerHasQuestSubGlobal(QuestEventID event_id)
|
|||||||
|
|
||||||
bool QuestParserCollection::SpellHasEncounterSub(uint32 spell_id, QuestEventID event_id)
|
bool QuestParserCollection::SpellHasEncounterSub(uint32 spell_id, QuestEventID event_id)
|
||||||
{
|
{
|
||||||
return HasEncounterSub(
|
return HasEncounterSub(event_id, fmt::format("spell_{}", spell_id)) ||
|
||||||
event_id,
|
HasEncounterSub(event_id, "spell_" + ENCOUNTER_NO_ENTITY_ID);
|
||||||
fmt::format(
|
|
||||||
"spell_{}",
|
|
||||||
spell_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID event_id)
|
bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID event_id)
|
||||||
@ -272,16 +267,11 @@ bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID event
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestParserCollection::ItemHasEncounterSub(EQ::ItemInstance* inst, QuestEventID event_id)
|
bool QuestParserCollection::ItemHasEncounterSub(EQ::ItemInstance *inst, QuestEventID event_id)
|
||||||
{
|
{
|
||||||
if (inst) {
|
if (inst) {
|
||||||
return HasEncounterSub(
|
return HasEncounterSub(event_id, fmt::format("item_{}", inst->GetID())) ||
|
||||||
event_id,
|
HasEncounterSub(event_id, "item_" + ENCOUNTER_NO_ENTITY_ID);
|
||||||
fmt::format(
|
|
||||||
"item_{}",
|
|
||||||
inst->GetID()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user