mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
[10198] Partly revert old changes in load instance reset time.
* Its has been added for raid/heroic instances in time adding support MapDifficulty.dbc. Its wrongly assign reset events for each instance instaed use generic event for map/difficulty pair. In result at this event triggering instance can be attempt resetted multiply time. * Also comment this in InstanceResetEvent fields notes
This commit is contained in:
parent
f8efc2b5b3
commit
2284df7868
3 changed files with 9 additions and 16 deletions
|
|
@ -140,10 +140,6 @@ void InstanceResetScheduler::LoadResetTimes()
|
||||||
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
||||||
InstResetTimeMapDiffType instResetTime;
|
InstResetTimeMapDiffType instResetTime;
|
||||||
|
|
||||||
// index instance ids by map/difficulty pairs for fast reset warning send
|
|
||||||
typedef std::multimap<uint32 /*PAIR32(map,difficulty)*/, uint32 /*instanceid*/ > ResetTimeMapDiffInstances;
|
|
||||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
|
||||||
|
|
||||||
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||||
if( result )
|
if( result )
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +151,6 @@ void InstanceResetScheduler::LoadResetTimes()
|
||||||
uint32 mapid = (*result)[1].GetUInt32();
|
uint32 mapid = (*result)[1].GetUInt32();
|
||||||
uint32 difficulty = (*result)[2].GetUInt32();
|
uint32 difficulty = (*result)[2].GetUInt32();
|
||||||
instResetTime[id] = ResetTimeMapDiffType(MAKE_PAIR32(mapid,difficulty), resettime);
|
instResetTime[id] = ResetTimeMapDiffType(MAKE_PAIR32(mapid,difficulty), resettime);
|
||||||
mapDiffResetInstances.insert(ResetTimeMapDiffInstances::value_type(MAKE_PAIR32(mapid,difficulty),id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
@ -229,6 +224,8 @@ void InstanceResetScheduler::LoadResetTimes()
|
||||||
uint32 mapid = PAIR32_LOPART(map_diff_pair);
|
uint32 mapid = PAIR32_LOPART(map_diff_pair);
|
||||||
Difficulty difficulty = Difficulty(PAIR32_HIPART(map_diff_pair));
|
Difficulty difficulty = Difficulty(PAIR32_HIPART(map_diff_pair));
|
||||||
MapDifficulty const* mapDiff = &itr->second;
|
MapDifficulty const* mapDiff = &itr->second;
|
||||||
|
|
||||||
|
// skip mapDiff without global reset time
|
||||||
if (!mapDiff->resetTime)
|
if (!mapDiff->resetTime)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -262,11 +259,7 @@ void InstanceResetScheduler::LoadResetTimes()
|
||||||
if(t - resetEventTypeDelay[type] > now)
|
if(t - resetEventTypeDelay[type] > now)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for(ResetTimeMapDiffInstances::const_iterator in_itr = mapDiffResetInstances.lower_bound(map_diff_pair);
|
ScheduleReset(true, t - resetEventTypeDelay[type], InstanceResetEvent(type, mapid, difficulty, 0));
|
||||||
in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
|
|
||||||
{
|
|
||||||
ScheduleReset(true, t - resetEventTypeDelay[type], InstanceResetEvent(type, mapid, difficulty, in_itr->second));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +305,7 @@ void InstanceResetScheduler::Update()
|
||||||
while(!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
|
while(!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
|
||||||
{
|
{
|
||||||
InstanceResetEvent &event = m_resetTimeQueue.begin()->second;
|
InstanceResetEvent &event = m_resetTimeQueue.begin()->second;
|
||||||
if(event.type == 0)
|
if(event.type == RESET_EVENT_DUNGEON)
|
||||||
{
|
{
|
||||||
// for individual normal instances, max creature respawn + X hours
|
// for individual normal instances, max creature respawn + X hours
|
||||||
m_InstanceSaves._ResetInstance(event.mapid, event.instanceId);
|
m_InstanceSaves._ResetInstance(event.mapid, event.instanceId);
|
||||||
|
|
|
||||||
|
|
@ -135,15 +135,15 @@ enum ResetEventType
|
||||||
all instances of that map reset at the same time */
|
all instances of that map reset at the same time */
|
||||||
struct InstanceResetEvent
|
struct InstanceResetEvent
|
||||||
{
|
{
|
||||||
ResetEventType type :8;
|
ResetEventType type :8; // if RESET_EVENT_DUNGEON then InstanceID == 0 and applied to all instances for pair (map,diff)
|
||||||
Difficulty difficulty :8;
|
Difficulty difficulty :8; // used with mapid used as for select reset for global cooldown instances (instamceid==0 for event)
|
||||||
uint16 mapid;
|
uint16 mapid;
|
||||||
uint32 instanceId;
|
uint32 instanceId; // used for select reset for normal dungeons
|
||||||
|
|
||||||
InstanceResetEvent() : type(RESET_EVENT_DUNGEON), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {}
|
InstanceResetEvent() : type(RESET_EVENT_DUNGEON), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {}
|
||||||
InstanceResetEvent(ResetEventType t, uint32 _mapid, Difficulty d, uint32 _instanceid)
|
InstanceResetEvent(ResetEventType t, uint32 _mapid, Difficulty d, uint32 _instanceid)
|
||||||
: type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {}
|
: type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {}
|
||||||
bool operator == (const InstanceResetEvent& e) { return e.instanceId == instanceId; }
|
bool operator == (const InstanceResetEvent& e) { return e.mapid == mapid && e.difficulty == difficulty && e.instanceId == instanceId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class InstanceSaveManager;
|
class InstanceSaveManager;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10197"
|
#define REVISION_NR "10198"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue