mirror of
https://github.com/mangosfour/server.git
synced 2025-12-28 22:37:04 +00:00
[7141] Implement heroic raid instance mode support.
* Heroic mode player amount for instances in DB. Can be used for any instances but added for heroic raid instance. * Output transfer error at max playrs limit. * FIXME notes ;) for raid required implementing store 2 reset time and do global reset for 2 modes. But currently raid have inmmap entry data same reset time for both cases. * Update instances list where mounts allowed. * Simplify and fix code for SMSG_RAID_INSTANCE_INFO. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
2a891a8c92
commit
f26d6151c8
11 changed files with 87 additions and 52 deletions
|
|
@ -449,7 +449,7 @@ void InstanceSaveManager::LoadResetTimes()
|
|||
// add the global reset times to the priority queue
|
||||
for(uint32 i = 0; i < sInstanceTemplate.MaxEntry; i++)
|
||||
{
|
||||
InstanceTemplate* temp = (InstanceTemplate*)objmgr.GetInstanceTemplate(i);
|
||||
InstanceTemplate const* temp = objmgr.GetInstanceTemplate(i);
|
||||
if(!temp) continue;
|
||||
// only raid/heroic maps have a global reset time
|
||||
const MapEntry* entry = sMapStore.LookupEntry(temp->map);
|
||||
|
|
@ -578,7 +578,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
|
|||
{
|
||||
// global reset for all instances of the given map
|
||||
// note: this isn't fast but it's meant to be executed very rarely
|
||||
Map *map = (MapInstanced*)MapManager::Instance().GetBaseMap(mapid);
|
||||
Map const *map = MapManager::Instance().GetBaseMap(mapid);
|
||||
if(!map->Instanceable())
|
||||
return;
|
||||
uint64 now = (uint64)time(NULL);
|
||||
|
|
@ -586,7 +586,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
|
|||
if(!warn)
|
||||
{
|
||||
// this is called one minute before the reset time
|
||||
InstanceTemplate* temp = (InstanceTemplate*)objmgr.GetInstanceTemplate(mapid);
|
||||
InstanceTemplate const* temp = objmgr.GetInstanceTemplate(mapid);
|
||||
if(!temp || !temp->reset_delay)
|
||||
{
|
||||
sLog.outError("InstanceSaveManager::ResetOrWarnAll: no instance template or reset delay for map %d", mapid);
|
||||
|
|
|
|||
|
|
@ -1528,10 +1528,10 @@ bool InstanceMap::CanEnter(Player *player)
|
|||
}
|
||||
|
||||
// cannot enter if the instance is full (player cap), GMs don't count
|
||||
InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
|
||||
if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers)
|
||||
uint32 maxPlayers = GetMaxPlayers();
|
||||
if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= maxPlayers)
|
||||
{
|
||||
sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName());
|
||||
sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
|
||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1824,6 +1824,14 @@ void InstanceMap::SetResetSchedule(bool on)
|
|||
}
|
||||
}
|
||||
|
||||
uint32 InstanceMap::GetMaxPlayers() const
|
||||
{
|
||||
InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
|
||||
if(!iTemplate)
|
||||
return 0;
|
||||
return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
|
||||
}
|
||||
|
||||
/* ******* Battleground Instance Maps ******* */
|
||||
|
||||
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ struct InstanceTemplate
|
|||
uint32 levelMin;
|
||||
uint32 levelMax;
|
||||
uint32 maxPlayers;
|
||||
uint32 reset_delay;
|
||||
uint32 maxPlayersHeroic;
|
||||
uint32 reset_delay; // FIX ME: now exist normal/heroic raids with possible different time of reset.
|
||||
float startLocX;
|
||||
float startLocY;
|
||||
float startLocZ;
|
||||
|
|
@ -364,6 +365,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
|
|||
bool CanEnter(Player* player);
|
||||
void SendResetWarnings(uint32 timeLeft) const;
|
||||
void SetResetSchedule(bool on);
|
||||
uint32 GetMaxPlayers() const;
|
||||
private:
|
||||
bool m_resetAfterUnload;
|
||||
bool m_unloadWhenEmpty;
|
||||
|
|
|
|||
|
|
@ -4336,14 +4336,20 @@ void ObjectMgr::LoadInstanceTemplate()
|
|||
else if(!entry->HasResetTime())
|
||||
continue;
|
||||
|
||||
//FIXME: now exist heroic instance, normal/heroic raid instances
|
||||
// entry->resetTimeHeroic store reset time for both heroic mode instance (raid and non-raid)
|
||||
// entry->resetTimeRaid store reset time for normal raid only
|
||||
// for current state entry->resetTimeRaid == entry->resetTimeHeroic in case raid instances with heroic mode.
|
||||
// but at some point wee need implement reset time dependen from raid insatance mode
|
||||
if(temp->reset_delay == 0)
|
||||
{
|
||||
// use defaults from the DBC
|
||||
if(entry->SupportsHeroicMode())
|
||||
if(entry->resetTimeHeroic) // for both raid and non raids, read above
|
||||
{
|
||||
temp->reset_delay = entry->resetTimeHeroic / DAY;
|
||||
}
|
||||
else if (entry->resetTimeRaid && entry->map_type == MAP_RAID)
|
||||
// for normal raid only
|
||||
{
|
||||
temp->reset_delay = entry->resetTimeRaid / DAY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15288,29 +15288,29 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
|
|||
|
||||
void Player::SendRaidInfo()
|
||||
{
|
||||
uint32 counter = 0;
|
||||
|
||||
WorldPacket data(SMSG_RAID_INSTANCE_INFO, 4);
|
||||
|
||||
uint32 counter = 0, i;
|
||||
for(i = 0; i < TOTAL_DIFFICULTIES; i++)
|
||||
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
|
||||
if(itr->second.perm) counter++;
|
||||
size_t p_counter = data.wpos();
|
||||
data << uint32(counter); // placeholder
|
||||
|
||||
data << counter;
|
||||
for(i = 0; i < TOTAL_DIFFICULTIES; i++)
|
||||
for(int i = 0; i < TOTAL_DIFFICULTIES; ++i)
|
||||
{
|
||||
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
|
||||
{
|
||||
if(itr->second.perm)
|
||||
{
|
||||
InstanceSave *save = itr->second.save;
|
||||
data << (save->GetMapId());
|
||||
data << (uint32)(save->GetResetTime() - time(NULL));
|
||||
data << save->GetInstanceId();
|
||||
data << uint32(counter);
|
||||
counter--;
|
||||
data << uint32(save->GetMapId());
|
||||
data << uint32(save->GetResetTime() - time(NULL));
|
||||
data << uint32(save->GetInstanceId());
|
||||
data << uint32(save->GetDifficulty());
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put<uint32>(p_counter,counter);
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue