aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-01-24 11:20:30 +0100
committerShauren <shauren.trinity@gmail.com>2011-01-24 11:20:30 +0100
commit464837077ad5621b5f040aa00ef2c49109da795a (patch)
treec97e5e86779a80eef37efbd3027f52aaa02c7a2e /src/server/game/Maps/Map.cpp
parente5b4f8e84d1230419e19d55f23b4fa754db4b5db (diff)
Core/Instances: Implemented hourly instance limit: players are limited to entering 5 instances per hour (account wide limit)
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-xsrc/server/game/Maps/Map.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index cf26daed48a..c4187ff626f 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -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()));
}
}