[8828] Independent instance reset time for different difficulties.

* Store reset time for map/difficulty pairs.
* Use DBC data for reset time and max players instead `instance_template` fields (dropped)
  for each existed map/difficulty pair.
* Fix some "heroic" related checks in spells/etc.
This commit is contained in:
VladimirMangos 2009-11-18 09:58:10 +03:00
parent 70fb82b262
commit 37ba6623bb
19 changed files with 149 additions and 124 deletions

View file

@ -2610,22 +2610,32 @@ void InstanceMap::SetResetSchedule(bool on)
// only for normal instances
// the reset time is only scheduled when there are no payers inside
// it is assumed that the reset time will rarely (if ever) change while the reset is scheduled
if(IsDungeon() && !HavePlayers() && !IsRaid() && !IsHeroic())
if(IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
{
InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId());
if(!save) sLog.outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, no save available for instance %d of %d", on ? "on" : "off", GetInstanceId(), GetId());
else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), GetInstanceId()));
else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
}
}
MapDifficulty const* InstanceMap::GetMapDifficulty() const
{
return GetMapDifficultyData(GetId(),GetDifficulty());
}
uint32 InstanceMap::GetMaxPlayers() const
{
InstanceTemplate const* iTemplate = ObjectMgr::GetInstanceTemplate(GetId());
if(!iTemplate)
return 0;
return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
MapDifficulty const* mapDiff = GetMapDifficulty();
return mapDiff ? mapDiff->maxPlayers : 0;
}
uint32 InstanceMap::GetMaxResetDelay() const
{
MapDifficulty const* mapDiff = GetMapDifficulty();
return mapDiff ? mapDiff->resetTime : 0;
}
/* ******* Battleground Instance Maps ******* */
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
@ -3560,4 +3570,3 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
ASSERT(0);
return 0;
}