mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11158] Fixed respawn times loading for instances.
Now MapPersistentState will created for instances at repawn time load if any not expired timers still exist.
This commit is contained in:
parent
85a8a3eed9
commit
654dac1e11
2 changed files with 26 additions and 16 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11157"
|
||||
#define REVISION_NR "11158"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue