New Boolean parameter for OnAfterUpdateEncounterState
Now you're able to know if an encounter has been really changed or not (e.g. respawned bosses)
This commit is contained in:
@@ -3090,6 +3090,7 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 dungeonId = 0;
|
uint32 dungeonId = 0;
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
|
for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
|
||||||
{
|
{
|
||||||
@@ -3097,8 +3098,12 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni
|
|||||||
if (encounter->creditType == type && encounter->creditEntry == creditEntry)
|
if (encounter->creditType == type && encounter->creditEntry == creditEntry)
|
||||||
{
|
{
|
||||||
if (source)
|
if (source)
|
||||||
if (InstanceScript* instanceScript = source->GetInstanceScript())
|
if (InstanceScript* instanceScript = source->GetInstanceScript()) {
|
||||||
|
uint32 prevMask = instanceScript->GetCompletedEncounterMask();
|
||||||
instanceScript->SetCompletedEncountersMask((1 << encounter->dbcEntry->encounterIndex)|instanceScript->GetCompletedEncounterMask(), true);
|
instanceScript->SetCompletedEncountersMask((1 << encounter->dbcEntry->encounterIndex)|instanceScript->GetCompletedEncounterMask(), true);
|
||||||
|
if (prevMask != instanceScript->GetCompletedEncounterMask())
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (encounter->lastEncounterDungeon)
|
if (encounter->lastEncounterDungeon)
|
||||||
{
|
{
|
||||||
@@ -3111,7 +3116,7 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni
|
|||||||
// pussywizard:
|
// pussywizard:
|
||||||
LogEncounterFinished(type, creditEntry);
|
LogEncounterFinished(type, creditEntry);
|
||||||
|
|
||||||
sScriptMgr->OnAfterUpdateEncounterState(this, type, creditEntry, source, difficulty_fixed, encounters, dungeonId);
|
sScriptMgr->OnAfterUpdateEncounterState(this, type, creditEntry, source, difficulty_fixed, encounters, dungeonId, updated);
|
||||||
|
|
||||||
if (dungeonId)
|
if (dungeonId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1539,9 +1539,9 @@ void ScriptMgr::OnAfterInitializeLockedDungeons(Player* player)
|
|||||||
FOREACH_SCRIPT(GlobalScript)->OnAfterInitializeLockedDungeons(player);
|
FOREACH_SCRIPT(GlobalScript)->OnAfterInitializeLockedDungeons(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted)
|
void ScriptMgr::OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted, bool updated)
|
||||||
{
|
{
|
||||||
FOREACH_SCRIPT(GlobalScript)->OnAfterUpdateEncounterState(map, type, creditEntry, source, difficulty_fixed, encounters, dungeonCompleted);
|
FOREACH_SCRIPT(GlobalScript)->OnAfterUpdateEncounterState(map, type, creditEntry, source, difficulty_fixed, encounters, dungeonCompleted, updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ScriptMgr::DealDamage(Unit* AttackerUnit, Unit *pVictim, uint32 damage, DamageEffectType damagetype)
|
uint32 ScriptMgr::DealDamage(Unit* AttackerUnit, Unit *pVictim, uint32 damage, DamageEffectType damagetype)
|
||||||
|
|||||||
@@ -1017,7 +1017,7 @@ class GlobalScript : public ScriptObject
|
|||||||
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<uint32, uint32> & /*ap*/) { }
|
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<uint32, uint32> & /*ap*/) { }
|
||||||
|
|
||||||
// Called when a dungeon encounter is updated.
|
// Called when a dungeon encounter is updated.
|
||||||
virtual void OnAfterUpdateEncounterState(Map* /*map*/, EncounterCreditType /*type*/, uint32 /*creditEntry*/, Unit* /*source*/, Difficulty /*difficulty_fixed*/, DungeonEncounterList const* /*encounters*/, uint32 /*dungeonCompleted*/) { }
|
virtual void OnAfterUpdateEncounterState(Map* /*map*/, EncounterCreditType /*type*/, uint32 /*creditEntry*/, Unit* /*source*/, Difficulty /*difficulty_fixed*/, DungeonEncounterList const* /*encounters*/, uint32 /*dungeonCompleted*/, bool /*updated*/) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
// this class can be used to be extended by Modules
|
// this class can be used to be extended by Modules
|
||||||
@@ -1296,7 +1296,7 @@ class ScriptMgr
|
|||||||
void OnItemRoll(Player const* player, LootStoreItem const* LootStoreItem, float &chance, Loot& loot, LootStore const& store);
|
void OnItemRoll(Player const* player, LootStoreItem const* LootStoreItem, float &chance, Loot& loot, LootStore const& store);
|
||||||
void OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData);
|
void OnInitializeLockedDungeons(Player* player, uint8& level, uint32& lockData);
|
||||||
void OnAfterInitializeLockedDungeons(Player* player);
|
void OnAfterInitializeLockedDungeons(Player* player);
|
||||||
void OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted);
|
void OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted, bool updated);
|
||||||
|
|
||||||
|
|
||||||
public: /* Scheduled scripts */
|
public: /* Scheduled scripts */
|
||||||
|
|||||||
Reference in New Issue
Block a user