Core/Instances: Implemented hourly instance limit: players are limited to entering 5 instances per hour (account wide limit)
This commit is contained in:
1 parent
e5b4f8e84d
commit
464837077a
10 files changed
+171
-36
No files matched your search
@@ -2283,6 +2283,12 @@ bool InstanceMap::Add(Player *player)
|
||||
// Dungeon only code
|
||||
if (IsDungeon())
|
||||
{
|
||||
Group *group = player->GetGroup();
|
||||
|
||||
// increase current instances (hourly limit)
|
||||
if (!group || !group->isLFGGroup())
|
||||
player->AddInstanceEnterTime(GetInstanceId(), time(NULL));
|
||||
|
||||
// get or create an instance save for the map
|
||||
InstanceSave *mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
|
||||
if (!mapSave)
|
||||
@@ -2304,27 +2310,27 @@ bool InstanceMap::Add(Player *player)
|
||||
}
|
||||
else
|
||||
{
|
||||
Group *pGroup = player->GetGroup();
|
||||
if (pGroup)
|
||||
if (group)
|
||||
{
|
||||
// solo saves should be reset when entering a group
|
||||
InstanceGroupBind *groupBind = pGroup->GetBoundInstance(this);
|
||||
InstanceGroupBind *groupBind = group->GetBoundInstance(this);
|
||||
if (playerBind)
|
||||
{
|
||||
sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
|
||||
if (groupBind) sLog->outError("InstanceMap::Add: the group is bound to the instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
|
||||
sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
|
||||
if (groupBind)
|
||||
sLog->outError("InstanceMap::Add: the group is bound to the instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
|
||||
//ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
// bind to the group or keep using the group save
|
||||
if (!groupBind)
|
||||
pGroup->BindToInstance(mapSave, false);
|
||||
group->BindToInstance(mapSave, false);
|
||||
else
|
||||
{
|
||||
// cannot jump to a different instance without resetting it
|
||||
if (groupBind->save != mapSave)
|
||||
{
|
||||
sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(pGroup->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
|
||||
sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d,%d,%d but he is in group %d which is bound to instance %d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
|
||||
if (mapSave)
|
||||
sLog->outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
|
||||
else
|
||||
@@ -2339,10 +2345,12 @@ bool InstanceMap::Add(Player *player)
|
||||
// players also become permanently bound when they enter
|
||||
if (groupBind->perm)
|
||||
{
|
||||
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
|
||||
data << uint32(0);
|
||||
WorldPacket data(SMSG_INSTANCE_LOCK_WARNING_QUERY, 9);
|
||||
data << uint32(60000);
|
||||
data << uint32(i_data ? i_data->GetCompletedEncounterMask() : 0);
|
||||
data << uint8(0);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
player->BindToInstance(mapSave, true);
|
||||
player->SetPendingBind(mapSave, 60000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2528,8 +2536,10 @@ void InstanceMap::SetResetSchedule(bool on)
|
||||
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(), Difficulty(GetSpawnMode()), 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(), Difficulty(GetSpawnMode()), GetInstanceId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user