Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[11158] Fixed respawn times loading for instances.

Now MapPersistentState will created for instances at repawn time load if any not expired timers
still exist.
  • Loading branch information...
commit 437792635e924d4b60fd9a8f00366181a9a18633 1 parent dd0f7b2
VladimirMangos authored
Showing with 26 additions and 16 deletions.
  1. +25 −15 src/game/MapPersistentStateMgr.cpp
  2. +1 −1  src/shared/revision_nr.h
40 src/game/MapPersistentStateMgr.cpp
View
@@ -821,8 +821,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
uint32 count = 0;
- QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, instance FROM creature_respawn");
-
+ QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM creature_respawn LEFT JOIN instance ON instance = id");
if(!result)
{
barGoLink bar(1);
@@ -843,21 +842,27 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
uint32 loguid = fields[0].GetUInt32();
uint64 respawn_time = fields[1].GetUInt64();
- uint32 instanceId = fields[2].GetUInt32();
+ uint32 mapId = fields[2].GetUInt32();
+ uint32 instanceId = fields[3].GetUInt32();
+ uint8 difficulty = fields[4].GetUInt8();
+
+ time_t resetTime = (time_t)fields[5].GetUInt64();
CreatureData const* data = sObjectMgr.GetCreatureData(loguid);
if (!data)
continue;
- MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
+ if (mapId != data->mapid)
+ continue;
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
continue;
- // instances loaded early and respawn data must exist only for existed instances (state loaded) or non-instanced maps
- MapPersistentState* state = instanceId
- ? GetPersistentState(data->mapid, instanceId)
- : AddPersistentState(mapEntry, 0, REGULAR_DIFFICULTY, 0, false, true);
+ if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
+ continue;
+ MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true);
if (!state)
continue;
@@ -880,7 +885,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
uint32 count = 0;
- QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, instance FROM gameobject_respawn");
+ QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime FROM gameobject_respawn LEFT JOIN instance ON instance = id");
if(!result)
{
@@ -902,22 +907,27 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
uint32 loguid = fields[0].GetUInt32();
uint64 respawn_time = fields[1].GetUInt64();
- uint32 instanceId = fields[2].GetUInt32();
+ uint32 mapId = fields[2].GetUInt32();
+ uint32 instanceId = fields[3].GetUInt32();
+ uint8 difficulty = fields[4].GetUInt8();
+ time_t resetTime = (time_t)fields[5].GetUInt64();
GameObjectData const* data = sObjectMgr.GetGOData(loguid);
if (!data)
continue;
- MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
+ if (mapId != data->mapid)
+ continue;
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
continue;
- // instances loaded early and respawn data must exist only for existed instances (state loaded) or non-instanced maps
- MapPersistentState* state = instanceId
- ? GetPersistentState(data->mapid, instanceId)
- : AddPersistentState(mapEntry, 0, REGULAR_DIFFICULTY, 0, false, true);
+ if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
+ continue;
+ MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true);
if (!state)
continue;
2  src/shared/revision_nr.h
View
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "11157"
+ #define REVISION_NR "11158"
#endif // __REVISION_NR_H__
Please sign in to comment.
Something went wrong with that request. Please try again.