mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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;
|
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)
|
if(!result)
|
||||||
{
|
{
|
||||||
barGoLink bar(1);
|
barGoLink bar(1);
|
||||||
|
|
@ -843,21 +842,27 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
||||||
|
|
||||||
uint32 loguid = fields[0].GetUInt32();
|
uint32 loguid = fields[0].GetUInt32();
|
||||||
uint64 respawn_time = fields[1].GetUInt64();
|
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);
|
CreatureData const* data = sObjectMgr.GetCreatureData(loguid);
|
||||||
if (!data)
|
if (!data)
|
||||||
continue;
|
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)))
|
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// instances loaded early and respawn data must exist only for existed instances (state loaded) or non-instanced maps
|
if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||||
MapPersistentState* state = instanceId
|
continue;
|
||||||
? GetPersistentState(data->mapid, instanceId)
|
|
||||||
: AddPersistentState(mapEntry, 0, REGULAR_DIFFICULTY, 0, false, true);
|
|
||||||
|
|
||||||
|
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true);
|
||||||
if (!state)
|
if (!state)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -880,7 +885,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
||||||
|
|
||||||
uint32 count = 0;
|
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)
|
if(!result)
|
||||||
{
|
{
|
||||||
|
|
@ -902,22 +907,27 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
||||||
|
|
||||||
uint32 loguid = fields[0].GetUInt32();
|
uint32 loguid = fields[0].GetUInt32();
|
||||||
uint64 respawn_time = fields[1].GetUInt64();
|
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);
|
GameObjectData const* data = sObjectMgr.GetGOData(loguid);
|
||||||
if (!data)
|
if (!data)
|
||||||
continue;
|
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)))
|
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// instances loaded early and respawn data must exist only for existed instances (state loaded) or non-instanced maps
|
if(difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||||
MapPersistentState* state = instanceId
|
continue;
|
||||||
? GetPersistentState(data->mapid, instanceId)
|
|
||||||
: AddPersistentState(mapEntry, 0, REGULAR_DIFFICULTY, 0, false, true);
|
|
||||||
|
|
||||||
|
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true);
|
||||||
if (!state)
|
if (!state)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11157"
|
#define REVISION_NR "11158"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue