Core/Dungeon Finder: Reset player Locked Dungeons after change level or bind to heroic instance

Note: Actual DF system is not supposed to select a dungeon you are already saved to (core does not support someone to have multiple saves on the same instance)

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-23 06:06:24 +01:00
parent 0c8b07d3e5
commit 067984ba9f
3 changed files with 10 additions and 6 deletions
@@ -416,10 +416,6 @@ bool LFGMgr::RemoveFromQueue(const uint64& guid)
void LFGMgr::InitializeLockedDungeons(Player* plr) void LFGMgr::InitializeLockedDungeons(Player* plr)
{ {
uint64 guid = plr->GetGUID(); uint64 guid = plr->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
if (!cachedLockMap.empty())
return;
uint8 level = plr->getLevel(); uint8 level = plr->getLevel();
uint8 expansion = plr->GetSession()->Expansion(); uint8 expansion = plr->GetSession()->Expansion();
LfgDungeonSet dungeons = GetDungeonsByRandom(0); LfgDungeonSet dungeons = GetDungeonsByRandom(0);
@@ -141,9 +141,9 @@ void LFGScripts::OnInviteMember(Group* group, uint64 guid)
sLFGMgr->Leave(NULL, group); sLFGMgr->Leave(NULL, group);
} }
void LFGScripts::OnLevelChanged(Player* /*player*/, uint8 /*newLevel*/) void LFGScripts::OnLevelChanged(Player* player, uint8 /*newLevel*/)
{ {
// TODO - Invalidate LockStatus from cache sLFGMgr->InitializeLockedDungeons(player);
} }
void LFGScripts::OnLogout(Player* player) void LFGScripts::OnLogout(Player* player)
@@ -163,3 +163,10 @@ void LFGScripts::OnLogin(Player* player)
sLFGMgr->InitializeLockedDungeons(player); sLFGMgr->InitializeLockedDungeons(player);
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group // TODO - Restore LfgPlayerData and send proper status to player if it was in a group
} }
void LFGScripts::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
sLFGMgr->InitializeLockedDungeons(player);
}
@@ -42,4 +42,5 @@ class LFGScripts: public GroupScript, public PlayerScript
void OnLevelChanged(Player* player, uint8 newLevel); void OnLevelChanged(Player* player, uint8 newLevel);
void OnLogout(Player* player); void OnLogout(Player* player);
void OnLogin(Player* player); void OnLogin(Player* player);
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent);
}; };