Core/Misc: Defined a few fields in Map.dbc and rewritten InstanceMap::GetMaxPlayers to match what the client does to determine max players

This commit is contained in:
Shauren
2014-03-30 15:42:05 +02:00
parent 7630b3c627
commit b949d0b982
5 changed files with 18 additions and 18 deletions
+5
View File
@@ -319,6 +319,11 @@ enum MapTypes // Lua_IsInInstance
MAP_ARENA = 4 // arena
};
enum MapFlags
{
MAP_FLAG_DYNAMIC_DIFFICULTY = 0x100
};
enum AbilytyLearnType
{
ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1,
+6 -4
View File
@@ -1296,7 +1296,7 @@ struct MapEntry
uint32 MapID; // 0
//char* internalname; // 1 unused
uint32 map_type; // 2
//uint32 unk_330; // 3
uint32 Flags; // 3
// 4 0 or 1 for battlegrounds (not arenas)
char* name[16]; // 5-20
// 21 name flags, unused
@@ -1306,14 +1306,14 @@ struct MapEntry
//char* allianceIntro[16]; // 40-55 text for PvP Zones
// 56 intro text flags
uint32 multimap_id; // 57
// 58
//float BattlefieldMapIconScale; // 58
int32 entrance_map; // 59 map_id of entrance map
float entrance_x; // 60 entrance x coordinate (if exist single entry)
float entrance_y; // 61 entrance y coordinate (if exist single entry)
// 62 -1, 0 and 720
//uint32 TimeOfDayOverride; // 62 -1, 0 and 720
uint32 addon; // 63 (0-original maps, 1-tbc addon)
uint32 unk_time; // 64 some kind of time?
//uint32 maxPlayers; // 65 max players
uint32 maxPlayers; // 65 max players, fallback if not present in MapDifficulty.dbc
// Helpers
uint32 Expansion() const { return addon; }
@@ -1341,6 +1341,8 @@ struct MapEntry
{
return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571;
}
bool IsDynamicDifficultyMap() const { return Flags & MAP_FLAG_DYNAMIC_DIFFICULTY; }
};
struct MapDifficultyEntry
+1 -1
View File
@@ -83,7 +83,7 @@ char const LightEntryfmt[] = "nifffxxxxxxxxxx";
char const LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
char const MailTemplateEntryfmt[] = "nxxxxxxxxxxxxxxxxxssssssssssssssssx";
char const MapEntryfmt[] = "nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiix";
char const MapEntryfmt[] = "nxiixssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiii";
char const MapDifficultyEntryfmt[] = "diisxxxxxxxxxxxxxxxxiix";
char const MovieEntryfmt[] = "nxx";
char const OverrideSpellDatafmt[] = "niiiiiiiiiix";
+1 -1
View File
@@ -22798,7 +22798,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
// SMSG_INSTANCE_DIFFICULTY
data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4+4);
data << uint32(GetMap()->GetDifficulty());
data << uint32(GetMap()->IsRaid() && GetMap()->IsHeroic()); // Raid dynamic difficulty
data << uint32(GetMap()->GetEntry()->IsDynamicDifficultyMap() && GetMap()->IsHeroic()); // Raid dynamic difficulty
GetSession()->SendPacket(&data);
SendInitialSpells();
+5 -12
View File
@@ -3183,18 +3183,11 @@ MapDifficulty const* Map::GetMapDifficulty() const
uint32 InstanceMap::GetMaxPlayers() const
{
if (MapDifficulty const* mapDiff = GetMapDifficulty())
{
if (mapDiff->maxPlayers || IsRegularDifficulty()) // Normal case (expect that regular difficulty always have correct maxplayers)
return mapDiff->maxPlayers;
else // DBC have 0 maxplayers for heroic instances with expansion < 2
{ // The heroic entry exists, so we don't have to check anything, simply return normal max players
MapDifficulty const* normalDiff = GetMapDifficultyData(GetId(), REGULAR_DIFFICULTY);
return normalDiff ? normalDiff->maxPlayers : 0;
}
}
else // I'd rather ASSERT(false);
return 0;
MapDifficulty const* mapDiff = GetMapDifficulty();
if (mapDiff && mapDiff->maxPlayers)
return mapDiff->maxPlayers;
return GetEntry()->maxPlayers;
}
uint32 InstanceMap::GetMaxResetDelay() const