mirror of
https://github.com/mangosfour/server.git
synced 2025-12-29 16:37:04 +00:00
Rebase resync
This commit is contained in:
parent
a0797532e8
commit
1997c1e903
3106 changed files with 11118 additions and 627576 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/**
|
||||
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -344,6 +344,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
{
|
||||
time_t now = time(NULL);
|
||||
time_t today = (now / DAY) * DAY;
|
||||
time_t nextWeek = today + (7 * DAY);
|
||||
|
||||
// NOTE: Use DirectPExecute for tables that will be queried later
|
||||
|
||||
|
|
@ -457,6 +458,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
if (!mapDiff->resetTime)
|
||||
continue;
|
||||
|
||||
// only raid/heroic maps have a global reset time
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
|
||||
if (!mapEntry || !mapEntry->IsDungeon())
|
||||
continue;
|
||||
|
|
@ -470,7 +472,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','" UI64FMTD "')", mapid, difficulty, (uint64)t);
|
||||
}
|
||||
|
||||
if (t < now)
|
||||
if (t < now || t > nextWeek)
|
||||
{
|
||||
// assume that expired instances have already been cleaned
|
||||
// calculate the next reset time
|
||||
|
|
@ -979,14 +981,22 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
|||
if (!data)
|
||||
continue;
|
||||
|
||||
if (mapId != data->mapid)
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
if (!mapEntry)
|
||||
continue;
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
|
||||
continue;
|
||||
if (instanceId) // In instance - mapId must be data->mapid and mapEntry must be Instanceable
|
||||
{
|
||||
if (mapId != data->mapid || !mapEntry->Instanceable())
|
||||
continue;
|
||||
}
|
||||
else // Not in instance, mapEntry must not be Instanceable
|
||||
{
|
||||
if (mapEntry->Instanceable())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||
if (difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY + 1 : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||
continue;
|
||||
|
||||
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true, true, completedEncounters);
|
||||
|
|
@ -996,7 +1006,6 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
|||
state->SetCreatureRespawnTime(loguid, time_t(respawn_time));
|
||||
|
||||
++count;
|
||||
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
|
|
@ -1046,14 +1055,22 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
|||
if (!data)
|
||||
continue;
|
||||
|
||||
if (mapId != data->mapid)
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||
if (!mapEntry)
|
||||
continue;
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
|
||||
continue;
|
||||
if (instanceId) // In instance - mapId must be data->mapid and mapEntry must be Instanceable
|
||||
{
|
||||
if (mapId != data->mapid || !mapEntry->Instanceable())
|
||||
continue;
|
||||
}
|
||||
else // Not in instance, mapEntry must not be Instanceable
|
||||
{
|
||||
if (mapEntry->Instanceable())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||
if (difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY + 1 : (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)))
|
||||
continue;
|
||||
|
||||
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true, true, completedEncounters);
|
||||
|
|
@ -1063,7 +1080,6 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
|||
state->SetGORespawnTime(loguid, time_t(respawn_time));
|
||||
|
||||
++count;
|
||||
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue