mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user