Server/DataStore: Implemented Difficulty.dbc and updated Dungeon and Raid difficulties.

Signed-off-by: AriDEV <aridev666@gmail.com>
This commit is contained in:
AriDEV 2018-02-15 11:33:19 +01:00
parent 6d5ebe666b
commit ef5bfbfe46
69 changed files with 624 additions and 492 deletions

View file

@ -1526,7 +1526,8 @@ CREATE TABLE `characters` (
`position_z` float NOT NULL DEFAULT '0',
`map` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier',
`instance_id` int(10) unsigned NOT NULL DEFAULT '0',
`instance_mode_mask` tinyint(3) unsigned NOT NULL DEFAULT '0',
`dungeonDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '1',
`raidDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '14',
`orientation` float NOT NULL DEFAULT '0',
`taximask` text NOT NULL,
`online` tinyint(3) unsigned NOT NULL DEFAULT '0',
@ -1895,8 +1896,8 @@ CREATE TABLE `groups` (
`icon7` int(10) unsigned NOT NULL,
`icon8` int(10) unsigned NOT NULL,
`groupType` tinyint(3) unsigned NOT NULL,
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
`raiddifficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '1',
`raidDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '14',
PRIMARY KEY (`guid`),
KEY `leaderGuid` (`leaderGuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Groups';

View file

@ -0,0 +1,8 @@
ALTER TABLE `characters`
DROP `instance_mode_mask`,
ADD `dungeonDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '1' AFTER `instance_id`,
ADD `raidDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '3' AFTER `dungeonDifficulty`;
ALTER TABLE `groups`
CHANGE `difficulty` `difficulty` tinyint(3) unsigned NOT NULL DEFAULT '1' AFTER `groupType`,
CHANGE `raiddifficulty` `raidDifficulty` tinyint(3) unsigned NOT NULL DEFAULT '14' AFTER `difficulty`;

View file

@ -0,0 +1,3 @@
ALTER TABLE `creature` CHANGE `spawnMask` `spawnMask` int(10) unsigned not null default '1';
ALTER TABLE `gameobject` CHANGE `spawnMask` `spawnMask` int(10) unsigned not null default '1';

View file

@ -106,7 +106,7 @@ ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature),
_isCombatMovementAllowed(true)
{
_isHeroic = me->GetMap()->IsHeroic();
_difficulty = Difficulty(me->GetMap()->GetSpawnMode());
_difficulty = DifficultyID(me->GetMap()->GetSpawnMode());
}
void ScriptedAI::AttackStartNoMove(Unit* who)

View file

@ -294,7 +294,7 @@ struct ScriptedAI : public CreatureAI
}
// return the dungeon or raid difficulty
Difficulty GetDifficulty() const
DifficultyID GetDifficulty() const
{
return _difficulty;
}
@ -302,23 +302,23 @@ struct ScriptedAI : public CreatureAI
// return true for 25 man or 25 man heroic mode
bool Is25ManRaid() const
{
return _difficulty & RAID_DIFFICULTY_MASK_25MAN;
return _difficulty & (DIFFICULTY_25MAN_NORMAL || DIFFICULTY_25MAN_HEROIC || DIFFICULTY_25MAN_LFR);
}
template<class T> inline
const T& DUNGEON_MODE(const T& normal5, const T& heroic10) const
const T& DUNGEON_MODE(const T& normal5, const T& heroic5) const
{
switch (_difficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
case DIFFICULTY_NORMAL:
return normal5;
case DUNGEON_DIFFICULTY_HEROIC:
return heroic10;
case DIFFICULTY_HEROIC:
return heroic5;
default:
break;
}
return heroic10;
return heroic5;
}
template<class T> inline
@ -326,9 +326,9 @@ struct ScriptedAI : public CreatureAI
{
switch (_difficulty)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
case DIFFICULTY_10MAN_NORMAL:
return normal10;
case RAID_DIFFICULTY_25MAN_NORMAL:
case DIFFICULTY_25MAN_NORMAL:
return normal25;
default:
break;
@ -342,13 +342,13 @@ struct ScriptedAI : public CreatureAI
{
switch (_difficulty)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
case DIFFICULTY_10MAN_NORMAL:
return normal10;
case RAID_DIFFICULTY_25MAN_NORMAL:
case DIFFICULTY_25MAN_NORMAL:
return normal25;
case RAID_DIFFICULTY_10MAN_FLEX:
case DIFFICULTY_FLEX:
return flex;
case RAID_DIFFICULTY_25MAN_LFR:
case DIFFICULTY_25MAN_LFR:
return lfr;
default:
break;
@ -362,17 +362,17 @@ struct ScriptedAI : public CreatureAI
{
switch (_difficulty)
{
case RAID_DIFFICULTY_10MAN_NORMAL:
case DIFFICULTY_10MAN_NORMAL:
return normal10;
case RAID_DIFFICULTY_25MAN_NORMAL:
case DIFFICULTY_25MAN_NORMAL:
return normal25;
case RAID_DIFFICULTY_10MAN_HEROIC:
case DIFFICULTY_10MAN_HEROIC:
return heroic10;
case RAID_DIFFICULTY_25MAN_HEROIC:
case DIFFICULTY_25MAN_HEROIC:
return heroic25;
case RAID_DIFFICULTY_10MAN_FLEX:
case DIFFICULTY_FLEX:
return flex;
case RAID_DIFFICULTY_25MAN_LFR:
case DIFFICULTY_25MAN_LFR:
return lfr;
default:
break;
@ -382,7 +382,7 @@ struct ScriptedAI : public CreatureAI
}
private:
Difficulty _difficulty;
DifficultyID _difficulty;
uint32 _evadeCheckCooldown;
bool _isCombatMovementAllowed;
bool _isHeroic;

View file

@ -134,19 +134,19 @@ void LoadDisables()
isFlagInvalid = true;
break;
case MAP_INSTANCE:
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DIFFICULTY_HEROIC))
flags -= DUNGEON_STATUSFLAG_HEROIC;
if (!flags)
isFlagInvalid = true;
break;
case MAP_RAID:
if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, DIFFICULTY_10MAN_HEROIC))
flags -= RAID_STATUSFLAG_10MAN_HEROIC;
if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, DIFFICULTY_25MAN_HEROIC))
flags -= RAID_STATUSFLAG_25MAN_HEROIC;
if (flags & RAID_STATUSFLAG_10MAN_FLEX && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_FLEX))
if (flags & RAID_STATUSFLAG_10MAN_FLEX && !GetMapDifficultyData(entry, DIFFICULTY_FLEX))
flags -= RAID_STATUSFLAG_10MAN_FLEX;
if (flags & RAID_STATUSFLAG_25MAN_LFR && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_LFR))
if (flags & RAID_STATUSFLAG_25MAN_LFR && !GetMapDifficultyData(entry, DIFFICULTY_25MAN_LFR))
flags -= RAID_STATUSFLAG_25MAN_LFR;
if (!flags)
isFlagInvalid = true;
@ -363,21 +363,21 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
if (mapEntry->IsDungeon())
{
uint8 disabledModes = itr->second.flags;
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
DifficultyID targetDifficulty = player->GetDifficulty(mapEntry);
GetDownscaledMapDifficultyData(entry, targetDifficulty);
switch (targetDifficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
case DIFFICULTY_NORMAL:
return disabledModes & DUNGEON_STATUSFLAG_NORMAL;
case DUNGEON_DIFFICULTY_HEROIC:
case DIFFICULTY_HEROIC:
return disabledModes & DUNGEON_STATUSFLAG_HEROIC;
case RAID_DIFFICULTY_10MAN_HEROIC:
case DIFFICULTY_10MAN_HEROIC:
return disabledModes & RAID_STATUSFLAG_10MAN_HEROIC;
case RAID_DIFFICULTY_25MAN_HEROIC:
case DIFFICULTY_25MAN_HEROIC:
return disabledModes & RAID_STATUSFLAG_25MAN_HEROIC;
case RAID_DIFFICULTY_10MAN_FLEX:
return disabledModes & RAID_STATUSFLAG_10MAN_FLEX;
case RAID_DIFFICULTY_25MAN_LFR:
//case DIFFICULTY_10MAN_FLEX:
// return disabledModes & RAID_STATUSFLAG_10MAN_FLEX;
case DIFFICULTY_25MAN_LFR:
return disabledModes & RAID_STATUSFLAG_25MAN_LFR;
}
}

View file

@ -323,56 +323,49 @@ enum AreaFlags
AREA_FLAG_UNK9 = 0x40000000,
};
enum Difficulty
enum DifficultyID : uint8
{
REGULAR_DIFFICULTY = 0,
DUNGEON_DIFFICULTY_NORMAL = 0,
DUNGEON_DIFFICULTY_HEROIC = 1,
DUNGEON_DIFFICULTY_CHALLENGE = 2,
RAID_DIFFICULTY_10MAN_NORMAL = 0,
RAID_DIFFICULTY_25MAN_NORMAL = 1,
RAID_DIFFICULTY_10MAN_HEROIC = 2,
RAID_DIFFICULTY_25MAN_HEROIC = 3,
RAID_DIFFICULTY_10MAN_FLEX = 4,
RAID_DIFFICULTY_25MAN_LFR = 5,
SCENARIO_DIFFICULTY_NORMAL = 0,
SCENARIO_DIFFICULTY_HEROIC = 1
DIFFICULTY_NONE = 0,
DIFFICULTY_NORMAL = 1,
DIFFICULTY_HEROIC = 2,
DIFFICULTY_10MAN_NORMAL = 3,
DIFFICULTY_25MAN_NORMAL = 4,
DIFFICULTY_10MAN_HEROIC = 5,
DIFFICULTY_25MAN_HEROIC = 6,
DIFFICULTY_25MAN_LFR = 7,
DIFFICULTY_CHALLENGE = 8,
DIFFICULTY_40MAN = 9,
DIFFICULTY_SCE_HEROIC = 11,
DIFFICULTY_SCE_NORMAL = 12,
DIFFICULTY_FLEX = 14,
};
#define RAID_DIFFICULTY_MASK_25MAN 1 // since 25man difficulties are 1 and 3, we can check them like that
#define MAX_DUNGEON_DIFFICULTY 3
#define MAX_RAID_DIFFICULTY 6
#define MAX_SCENARIO_DIFFICULTY 2
#define MAX_DIFFICULTY 4 // temp hack Should be 6 but need to finish the DB side.
enum SpawnMask
{
SPAWNMASK_CONTINENT = (1 << REGULAR_DIFFICULTY), // any maps without spawn modes
SPAWNMASK_CONTINENT = (1 << DIFFICULTY_NONE), // any maps without spawn modes
SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL),
SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC),
SPAWNMASK_DUNGEON_CHALLENGE = (1 << DUNGEON_DIFFICULTY_CHALLENGE),
SPAWNMASK_DUNGEON_ALL = (SPAWNMASK_DUNGEON_NORMAL | SPAWNMASK_DUNGEON_HEROIC | SPAWNMASK_DUNGEON_CHALLENGE),
SPAWNMASK_DUNGEON_NORMAL = (1 << DIFFICULTY_NORMAL),
SPAWNMASK_DUNGEON_HEROIC = (1 << DIFFICULTY_HEROIC),
SPAWNMASK_DUNGEON_ALL = (SPAWNMASK_DUNGEON_NORMAL | SPAWNMASK_DUNGEON_HEROIC),
SPAWNMASK_RAID_10MAN_NORMAL = (1 << RAID_DIFFICULTY_10MAN_NORMAL),
SPAWNMASK_RAID_25MAN_NORMAL = (1 << RAID_DIFFICULTY_25MAN_NORMAL),
SPAWNMASK_RAID_10MAN_FLEX = (1 << RAID_DIFFICULTY_10MAN_FLEX),
SPAWNMASK_RAID_25MAN_LFR = (1 << RAID_DIFFICULTY_25MAN_LFR),
SPAWNMASK_RAID_NORMAL_ALL = (SPAWNMASK_RAID_10MAN_NORMAL | SPAWNMASK_RAID_25MAN_NORMAL | SPAWNMASK_RAID_10MAN_FLEX | SPAWNMASK_RAID_25MAN_LFR),
SPAWNMASK_RAID_10MAN_NORMAL = (1 << DIFFICULTY_10MAN_NORMAL),
SPAWNMASK_RAID_25MAN_NORMAL = (1 << DIFFICULTY_25MAN_NORMAL),
SPAWNMASK_RAID_NORMAL_ALL = (SPAWNMASK_RAID_10MAN_NORMAL | SPAWNMASK_RAID_25MAN_NORMAL),
SPAWNMASK_RAID_10MAN_HEROIC = (1 << RAID_DIFFICULTY_10MAN_HEROIC),
SPAWNMASK_RAID_25MAN_HEROIC = (1 << RAID_DIFFICULTY_25MAN_HEROIC),
SPAWNMASK_RAID_10MAN_HEROIC = (1 << DIFFICULTY_10MAN_HEROIC),
SPAWNMASK_RAID_25MAN_HEROIC = (1 << DIFFICULTY_25MAN_HEROIC),
SPAWNMASK_RAID_HEROIC_ALL = (SPAWNMASK_RAID_10MAN_HEROIC | SPAWNMASK_RAID_25MAN_HEROIC),
SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL),
SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL),
SPAWNMASK_SCENARIO_NORMAL = (1 << SCENARIO_DIFFICULTY_NORMAL),
SPAWNMASK_SCENARIO_HEROIC = (1 << SCENARIO_DIFFICULTY_HEROIC),
SPAWNMASK_SCENARIO_ALL = (SCENARIO_DIFFICULTY_NORMAL | SCENARIO_DIFFICULTY_HEROIC)
SPAWNMASK_RAID_25MAN_LFR = (1 << DIFFICULTY_25MAN_LFR),
SPAWNMASK_DUNGEON_CHALLENGE = (1 << DIFFICULTY_CHALLENGE),
// Upgrade Spawnmask to higher interger before uncomment.
//SPAWNMASK_SCENARIO_NORMAL = (1 << DIFFICULTY_SCE_NORMAL),
//SPAWNMASK_SCENARIO_HEROIC = (1 << DIFFICULTY_SCE_HEROIC),
//SPAWNMASK_SCENARIO_ALL = (SCENARIO_DIFFICULTY_NORMAL | SCENARIO_DIFFICULTY_HEROIC)
};
enum FactionTemplateFlags

View file

@ -89,6 +89,7 @@ DBCStorage <CriteriaTreeEntry> sCriteriaTreeStore(CriteriaTreefmt);
uint32 PowersByClass[MAX_CLASSES][MAX_POWERS];
DBCStorage <DestructibleModelDataEntry> sDestructibleModelDataStore(DestructibleModelDatafmt);
DBCStorage <DifficultyEntry> sDifficultyStore(Difficultyfmt);
DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore(DungeonEncounterfmt);
DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt);
DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt);
@ -397,6 +398,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sCriteriaStore, dbcPath, "Criteria.dbc");//18414
LoadDBC(availableDbcLocales, bad_dbc_files, sCriteriaTreeStore, dbcPath, "CriteriaTree.dbc");//18414
LoadDBC(availableDbcLocales, bad_dbc_files, sDestructibleModelDataStore, dbcPath, "DestructibleModelData.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sDifficultyStore, dbcPath, "Difficulty.dbc"); // 18414
LoadDBC(availableDbcLocales, bad_dbc_files, sDungeonEncounterStore, dbcPath, "DungeonEncounter.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityCostsStore, dbcPath, "DurabilityCosts.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sDurabilityQualityStore, dbcPath, "DurabilityQuality.dbc");//15595
@ -483,10 +485,10 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sMapStore, dbcPath, "Map.dbc");//15595
LoadDBC(availableDbcLocales, bad_dbc_files, sMapDifficultyStore, dbcPath, "MapDifficulty.dbc");//15595
// fill data
sMapDifficultyMap[MAKE_PAIR32(0, 0)] = MapDifficulty(0, 0, false);//map 0 is missingg from MapDifficulty.dbc use this till its ported to sql
sMapDifficultyMap[0][0] = MapDifficulty(DIFFICULTY_NONE, 0, 0, false);//map 0 is missingg from MapDifficulty.dbc use this till its ported to sql
for (uint32 i = 0; i < sMapDifficultyStore.GetNumRows(); ++i)
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] > 0);
sMapDifficultyMap[entry->MapId][entry->Difficulty] = MapDifficulty(entry->Difficulty, entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] > 0);
sMapDifficultyStore.Clear();
LoadDBC(availableDbcLocales, bad_dbc_files, sMountCapabilityStore, dbcPath, "MountCapability.dbc");//15595
@ -689,7 +691,7 @@ void LoadDBCStores(const std::string& dataPath)
SpellDifficultyEntry newEntry;
memset(newEntry.SpellID, 0, 4*sizeof(uint32));
for (uint32 x = 0; x < MAX_DIFFICULTY; ++x)
for (uint32 x = 0; x < 4; ++x)
{
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
@ -704,7 +706,7 @@ void LoadDBCStores(const std::string& dataPath)
if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0)//id0-1 must be always set!
continue;
for (uint32 x = 0; x < MAX_DIFFICULTY; ++x)
for (uint32 x = 0; x < 4; ++x)
sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
}
@ -1188,33 +1190,61 @@ std::vector<uint32> const* GetSpecializationSpells(uint32 specializationId)
return NULL;
}
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
MapDifficulty const* GetDefaultMapDifficulty(uint32 mapId)
{
MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId, difficulty));
return itr != sMapDifficultyMap.end() ? &itr->second : NULL;
}
auto itr = sMapDifficultyMap.find(mapId);
if (itr == sMapDifficultyMap.end())
return nullptr;
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
uint32 tmpDiff = difficulty;
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
if (!mapDiff)
if (itr->second.empty())
return nullptr;
for (auto& p : itr->second)
{
if (tmpDiff > RAID_DIFFICULTY_25MAN_NORMAL) // heroic, downscale to normal
tmpDiff -= 2;
else
tmpDiff -= 1; // any non-normal mode for raids like tbc (only one mode)
DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(p.first);
if (!difficulty)
continue;
// pull new data
mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // we are 10 normal or 25 normal
if (!mapDiff)
{
tmpDiff -= 1;
mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // 10 normal
}
if (difficulty->flags & 0x06)
return &p.second;
}
difficulty = Difficulty(tmpDiff);
return &itr->second.begin()->second;
}
MapDifficulty const* GetMapDifficultyData(uint32 mapId, DifficultyID difficulty)
{
auto itr = sMapDifficultyMap.find(mapId);
if (itr == sMapDifficultyMap.end())
return nullptr;
auto diffItr = itr->second.find(difficulty);
if (diffItr == itr->second.end())
return nullptr;
return &diffItr->second;
}
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, DifficultyID &difficulty)
{
DifficultyEntry const* diffEntry = sDifficultyStore.LookupEntry(difficulty);
if (!diffEntry)
return GetDefaultMapDifficulty(mapId);
uint32 tmpDiff = difficulty;
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, DifficultyID(tmpDiff));
while (!mapDiff)
{
tmpDiff = diffEntry->DownscaleID;
diffEntry = sDifficultyStore.LookupEntry(tmpDiff);
if (!diffEntry)
return GetDefaultMapDifficulty(mapId);
// pull new data
mapDiff = GetMapDifficultyData(mapId, DifficultyID(tmpDiff));
}
difficulty = DifficultyID(tmpDiff);
return mapDiff;
}
@ -1441,7 +1471,7 @@ DigsitePOIPolygon const* GetDigsitePOIPolygon(uint32 digsiteId)
}
/// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery)
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty)
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, DifficultyID difficulty)
{
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
{
@ -1449,7 +1479,7 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty)
if (!dungeon)
continue;
if (dungeon->map == int32(mapId) && Difficulty(dungeon->difficulty) == difficulty)
if (dungeon->map == int32(mapId) && DifficultyID(dungeon->difficulty) == difficulty)
return dungeon;
}

View file

@ -72,9 +72,10 @@ uint32 GetSkillIdByClass(uint32 classId);
std::list<uint32> GetSpellsForLevels(uint32 classId, uint32 raceMask, uint32 specializationId, uint32 minLevel, uint32 maxLevel);
std::vector<uint32> const* GetSpecializationSpells(uint32 specializationId);
typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficulty>> MapDifficultyMap;
MapDifficulty const* GetDefaultMapDifficulty(uint32 mapId);
MapDifficulty const* GetMapDifficultyData(uint32 mapId, DifficultyID difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, DifficultyID &difficulty);
uint32 const* /*[MAX_TALENT_TABS]*/ GetClassSpecializations(uint8 classId);
@ -90,7 +91,7 @@ typedef std::map<uint32 /*digsiteId*/, DigsitePOIPolygon> DigsitePOIPolygonConta
DigsitePOIPolygon const* GetDigsitePOIPolygon(uint32 digsiteId);
uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId);
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty);
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, DifficultyID difficulty);
extern SpecializationOverrideSpellsMap sSpecializationOverrideSpellMap;
extern DBCStorage <AchievementEntry> sAchievementStore;
@ -122,6 +123,7 @@ extern DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore;
extern DBCStorage <CriteriaEntry> sCriteriaStore;
extern DBCStorage <CriteriaTreeEntry> sCriteriaTreeStore;
extern DBCStorage <DestructibleModelDataEntry> sDestructibleModelDataStore;
extern DBCStorage <DifficultyEntry> sDifficultyStore;
extern DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore;
extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore;
extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore;

View file

@ -1282,6 +1282,31 @@ struct DestructibleModelDataEntry
//uint32 Unk8;
};
struct DifficultyEntry
{
uint32 DiffID;
uint32 DownscaleID;
uint32 maptype;
//uint32
//uint32
//uint32 SpawnMode;
uint32 flags;
//
//
//
//
//
};
enum diffflag
{
DIFFICULTY_FLAG_CAN_SELECT = 0x04, // Player can select this difficulty in dropdown menu
DIFFICULTY_FLAG_HEROIC = 0x05,
DIFFICULTY_FLAG_DEFAULT = 0x06,
DIFFICULTY_FLAG_CHALLENGE_MODE = 0x0D,
};
struct DungeonEncounterEntry
{
uint32 id; // 0 unique id
@ -2316,7 +2341,7 @@ struct SpellCategoryEntry
struct SpellDifficultyEntry
{
uint32 ID; // 0
int32 SpellID[MAX_DIFFICULTY]; // 1-4 instance modes: 10N, 25N, 10H, 25H or Normal/Heroic if only 1-2 is set, if 3-4 is 0 then Mode-2
int32 SpellID[4]; // 1-4 instance modes: 10N, 25N, 10H, 25H or Normal/Heroic if only 1-2 is set, if 3-4 is 0 then Mode-2
};
struct SpellFocusObjectEntry
@ -2864,9 +2889,11 @@ typedef std::map<uint32, VectorArray> NameGenVectorArraysMap;
// Structures not used for casting to loaded DBC data and not required then packing
struct MapDifficulty
{
MapDifficulty() : resetTime(0), maxPlayers(0), hasErrorMessage(false) { }
MapDifficulty(uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage) : resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) { }
MapDifficulty() : DifficultyID(0), resetTime(0), maxPlayers(0), hasErrorMessage(false) { }
MapDifficulty(uint32 difficultyID, uint32 _resetTime, uint32 _maxPlayers, bool _hasErrorMessage)
: DifficultyID(difficultyID), resetTime(_resetTime), maxPlayers(_maxPlayers), hasErrorMessage(_hasErrorMessage) { }
uint32 DifficultyID;
uint32 resetTime;
uint32 maxPlayers;
bool hasErrorMessage;

View file

@ -54,6 +54,7 @@ char const Criteriafmt[] = "niiiiixxiiii";
char const CriteriaTreefmt[] = "niixiiis";
char const ChrSpecializationfmt[] = "nxiixiiixxxxxx";
char const DestructibleModelDatafmt[] = "ixxixxxixxxixxxixxxxxxxx";
char const Difficultyfmt[] = "niixxxixxxxx";
char const DungeonEncounterfmt[] = "iiixisxxx";
char const DurabilityCostsfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const DurabilityQualityfmt[] = "nf";

View file

@ -396,7 +396,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
else if (dungeon->difficulty > DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, DifficultyID(dungeon->difficulty)))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->minlevel > level)
lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
@ -404,7 +404,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty)))
else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, DifficultyID(dungeon->difficulty)))
{
if (ar->achievement && !player->HasAchieved(ar->achievement))
lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
@ -975,7 +975,7 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
}
grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
grp->SetDungeonDifficulty(DifficultyID(dungeon->difficulty));
uint64 gguid = grp->GetGUID();
SetDungeon(gguid, dungeon->Entry());
SetState(gguid, LFG_STATE_DUNGEON);
@ -1457,7 +1457,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId)
}
// Update achievements
if (dungeon->difficulty == DUNGEON_DIFFICULTY_HEROIC)
if (dungeon->difficulty == DIFFICULTY_HEROIC)
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, 1);
LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->getLevel());
@ -1978,7 +1978,7 @@ bool LFGMgr::selectedRandomLfgDungeon(uint64 guid)
return false;
}
bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty)
bool LFGMgr::inLfgDungeonMap(uint64 guid, uint32 map, DifficultyID difficulty)
{
if (!IS_GROUP_GUID(guid))
guid = GetGroup(guid);

View file

@ -271,11 +271,11 @@ struct LfgPlayerBoot
struct LFGDungeonData
{
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
maxlevel(0), difficulty(DIFFICULTY_NONE), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
{ }
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name), map(dbc->map),
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(DifficultyID(dbc->difficulty)),
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
{ }
@ -287,7 +287,7 @@ struct LFGDungeonData
uint8 group;
uint8 minlevel;
uint8 maxlevel;
Difficulty difficulty;
DifficultyID difficulty;
bool seasonal;
float x, y, z, o;
@ -319,7 +319,7 @@ class LFGMgr
/// Check if given guid applied for random dungeon
bool selectedRandomLfgDungeon(uint64 guid);
/// Check if given guid applied for given map and difficulty. Used to know
bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
bool inLfgDungeonMap(uint64 guid, uint32 map, DifficultyID difficulty);
/// Get selected dungeons
LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
/// Get current lfg state

View file

@ -81,10 +81,10 @@ void LFGPlayerScript::OnLogin(Player* player)
/// @todo - Restore LfgPlayerData and send proper status to player if it was in a group
}
void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
void LFGPlayerScript::OnBindToInstance(Player* player, DifficultyID difficulty, uint32 mapId, bool /*permanent*/)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
if (mapEntry->IsDungeon() && difficulty > DIFFICULTY_NORMAL)
sLFGMgr->InitializeLockedDungeons(player);
}

View file

@ -40,7 +40,7 @@ class LFGPlayerScript : public PlayerScript
void OnLevelChanged(Player* player, uint8 oldLevel);
void OnLogout(Player* player);
void OnLogin(Player* player);
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent);
void OnBindToInstance(Player* player, DifficultyID difficulty, uint32 mapId, bool permanent);
void OnMapChanged(Player* player);
};

View file

@ -267,28 +267,29 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data
return false;
}
// get difficulty 1 mode entry
CreatureTemplate const* cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;)
CreatureTemplate const* cinfo = nullptr;
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(GetMap()->GetSpawnMode());
while (!cinfo && difficultyEntry)
{
// we already have valid Map pointer for current creature!
if (normalInfo->DifficultyEntry[diff - 1])
{
cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
if (cinfo)
break; // template found
int32 idx = CreatureTemplate::DiffToDiffIndex(difficultyEntry->DiffID);
if (idx == -1)
break;
// check and reported at startup, so just ignore (restore normalInfo)
cinfo = normalInfo;
if (normalInfo->DifficultyEntry[idx])
{
cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[idx]);
break;
}
// for instances heroic to normal, other cases attempt to retrieve previous difficulty
if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid())
diff -= 2; // to normal raid difficulty cases
else
--diff;
if (!difficultyEntry->DownscaleID)
break;
difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->DownscaleID);
}
if (!cinfo)
cinfo = normalInfo;
// Initialize loot duplicate count depending on raid difficulty
if (GetMap()->Is25ManRaid())
loot.maxDuplicates = 3;
@ -937,7 +938,7 @@ void Creature::SaveToDB()
SaveToDB(mapId, data->spawnMask, GetPhaseMask());
}
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
void Creature::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask)
{
// update in loaded data
if (!m_DBTableGuid)
@ -1015,7 +1016,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt32(index++, m_DBTableGuid);
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
stmt->setUInt32(index++, spawnMask);
stmt->setUInt32(index++, GetPhaseMask());
stmt->setUInt32(index++, displayId);
stmt->setInt32(index++, int32(GetCurrentEquipmentId()));

View file

@ -76,7 +76,7 @@ enum CreatureFlagsExtra
struct CreatureTemplate
{
uint32 Entry;
uint32 DifficultyEntry[MAX_DIFFICULTY - 1];
uint32 DifficultyEntry[4 - 1];
uint32 KillCredit[MAX_KILL_CREDIT];
uint32 Modelid1;
uint32 Modelid2;
@ -171,6 +171,29 @@ struct CreatureTemplate
// if can tame exotic then can tame any tameable
return canTameExotic || !IsExotic();
}
static int32 DiffToDiffIndex(uint32 difficulty)
{
switch (difficulty)
{
case DIFFICULTY_NONE:
case DIFFICULTY_NORMAL:
case DIFFICULTY_10MAN_NORMAL:
case DIFFICULTY_40MAN:
return -1;
case DIFFICULTY_HEROIC:
case DIFFICULTY_25MAN_NORMAL:
return 0;
case DIFFICULTY_10MAN_HEROIC:
case DIFFICULTY_CHALLENGE:
return 1;
case DIFFICULTY_25MAN_HEROIC:
return 2;
case DIFFICULTY_25MAN_LFR:
default:
return -1;
}
}
};
// Benchmarked: Faster than std::map (insert/find)
@ -261,7 +284,7 @@ struct CreatureData
uint32 curhealth;
uint32 curmana;
uint8 movementType;
uint8 spawnMask;
uint32 spawnMask;
uint32 npcflag;
uint32 unit_flags; // enum UnitFlags mask values
uint32 dynamicflags;
@ -530,7 +553,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
bool LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap = true);
void SaveToDB();
// overriden in Pet
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
virtual void SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask);
virtual void DeleteFromDB(); // overriden in Pet
Loot loot;

View file

@ -48,7 +48,7 @@ class TempSummon : public Creature
virtual void UnSummon(uint32 msTime = 0);
void RemoveFromWorld();
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) { }
void SaveToDB(uint32 /*mapid*/, uint32 /*spawnMask*/, uint32 /*phaseMask*/) { }
Unit* GetSummoner() const;
Creature* GetSummonerCreatureBase() const;
uint64 GetSummonerGUID() const { return m_summonerGUID; }

View file

@ -712,7 +712,7 @@ void GameObject::SaveToDB()
SaveToDB(GetMapId(), data->spawnMask, data->phaseMask);
}
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
void GameObject::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask)
{
const GameObjectTemplate* goI = GetGOInfo();
@ -755,7 +755,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt32(index++, m_DBTableGuid);
stmt->setUInt32(index++, GetEntry());
stmt->setUInt16(index++, uint16(mapid));
stmt->setUInt8(index++, spawnMask);
stmt->setUInt32(index++, spawnMask);
stmt->setUInt32(index++, GetPhaseMask());
stmt->setFloat(index++, GetPositionX());
stmt->setFloat(index++, GetPositionY());

View file

@ -605,7 +605,7 @@ struct GameObjectData
int32 spawntimesecs;
uint32 animprogress;
GOState go_state;
uint8 spawnMask;
uint32 spawnMask;
uint8 artKit;
bool dbData;
};
@ -659,7 +659,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
void SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask);
bool LoadFromDB(uint32 guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
void DeleteFromDB();

View file

@ -157,7 +157,7 @@ class Pet : public Guardian
DeclinedName *m_declinedname;
private:
void SaveToDB(uint32, uint8, uint32) // override of Creature::SaveToDB - must not be called
void SaveToDB(uint32, uint32, uint32) // override of Creature::SaveToDB - must not be called
{
ASSERT(false);
}

View file

@ -814,9 +814,9 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this)
/////////////////// Instance System /////////////////////
m_HomebindTimer = 0;
m_InstanceValid = true;
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
m_InstanceValid = true;
m_dungeonDifficulty = DIFFICULTY_NORMAL;
m_raidDifficulty = DIFFICULTY_10MAN_NORMAL;
m_lastPotionId = 0;
_talentMgr = new PlayerTalentInfo();
@ -951,7 +951,7 @@ void Player::CleanupsBeforeDelete(bool finalCleanup)
Unit::CleanupsBeforeDelete(finalCleanup);
// clean up player-instance binds, may unload some instance saves
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
itr->second.save->RemovePlayer(this);
}
@ -17924,14 +17924,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint32 mapId = fields[15].GetUInt16();
uint32 instanceId = fields[52].GetUInt32();
uint32 dungeonDiff = fields[39].GetUInt8() & 0x0F;
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
dungeonDiff = DUNGEON_DIFFICULTY_NORMAL;
uint32 raidDiff = (fields[39].GetUInt8() >> 4) & 0x0F;
if (raidDiff >= MAX_RAID_DIFFICULTY)
raidDiff = RAID_DIFFICULTY_10MAN_NORMAL;
SetDungeonDifficulty(Difficulty(dungeonDiff)); // may be changed in _LoadGroup
SetRaidDifficulty(Difficulty(raidDiff)); // may be changed in _LoadGroup
SetDungeonDifficulty(CheckLoadedDungeonDifficultyID(DifficultyID(fields[39].GetUInt8())));
SetRaidDifficulty(CheckLoadedRaidDifficultyID(DifficultyID(fields[61].GetUInt8())));
std::string taxi_nodes = fields[38].GetString();
@ -18117,7 +18111,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// fix crash (because of if (Map* map = _FindMap(instanceId)) in MapInstanced::CreateInstance)
if (instanceId)
if (InstanceSave* save = GetInstanceSave(mapId, mapEntry->IsRaid()))
if (InstanceSave* save = GetInstanceSave(mapId))
if (save->GetInstanceId() != instanceId)
instanceId = 0;
}
@ -18172,7 +18166,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
SetMap(map);
StoreRaidMapDifficulty();
//StoreRaidMapDifficulty();
// randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
// this must help in case next save after mass player load after server startup
@ -19444,7 +19438,7 @@ void Player::_LoadGroup(PreparedQueryResult result)
void Player::_LoadBoundInstances(PreparedQueryResult result)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
m_boundInstances[i].clear();
Group* group = GetGroup();
@ -19476,14 +19470,14 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
SF_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d (%s)", GetName().c_str(), GetGUIDLow(), mapId, mapname.c_str());
deleteInstance = true;
}
else if (difficulty >= MAX_DIFFICULTY)
else if (difficulty >= 15)
{
SF_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str());
deleteInstance = true;
}
else
{
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty));
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, DifficultyID(difficulty));
if (!mapDiff)
{
SF_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str());
@ -19509,14 +19503,14 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
}
// since non permanent binds are always solo bind, they can always be reset
if (InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true))
if (InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapId, instanceId, DifficultyID(difficulty), resetTime, !perm, true))
BindToInstance(save, perm, true);
}
while (result->NextRow());
}
}
InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty)
InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, DifficultyID difficulty)
{
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty);
@ -19530,9 +19524,10 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty
return NULL;
}
InstanceSave* Player::GetInstanceSave(uint32 mapid, bool raid)
InstanceSave* Player::GetInstanceSave(uint32 mapid)
{
InstancePlayerBind* pBind = GetBoundInstance(mapid, GetDifficulty(raid));
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
InstancePlayerBind* pBind = GetBoundInstance(mapid, GetDifficulty(mapEntry));
InstanceSave* pSave = pBind ? pBind->save : NULL;
if (!pBind || !pBind->perm)
if (Group* group = GetGroup())
@ -19542,13 +19537,13 @@ InstanceSave* Player::GetInstanceSave(uint32 mapid, bool raid)
return pSave;
}
void Player::UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload)
void Player::UnbindInstance(uint32 mapid, DifficultyID difficulty, bool unload)
{
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
UnbindInstance(itr, difficulty, unload);
}
void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload)
void Player::UnbindInstance(BoundInstancesMap::iterator &itr, DifficultyID difficulty, bool unload)
{
if (itr != m_boundInstances[difficulty].end())
{
@ -19656,14 +19651,14 @@ void Player::SendRaidInfo()
time_t now = time(NULL);
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
if (itr->second.perm)
{
InstanceSave* save = itr->second.save;
bool isHeroic = save->GetDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC || save->GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC;
bool isHeroic = save->GetDifficulty() == DIFFICULTY_10MAN_HEROIC || save->GetDifficulty() == DIFFICULTY_25MAN_HEROIC;
uint32 completedEncounters = 0;
if (Map* map = sMapMgr->FindMap(save->GetMapId(), save->GetInstanceId()))
if (InstanceScript* instanceScript = ((InstanceMap*)map)->GetInstanceScript())
@ -19694,7 +19689,7 @@ void Player::SendSavedInstances()
bool hasBeenSaved = false;
WorldPacket data;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
@ -19714,7 +19709,7 @@ void Player::SendSavedInstances()
if (!hasBeenSaved)
return;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
@ -19734,7 +19729,7 @@ void Player::ConvertInstancesToGroup(Player* player, Group* group, bool switchLe
// copy all binds to the group, when changing leader it's assumed the character
// will not have any solo binds
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
for (BoundInstancesMap::iterator itr = player->m_boundInstances[i].begin(); itr != player->m_boundInstances[i].end();)
{
@ -19745,7 +19740,7 @@ void Player::ConvertInstancesToGroup(Player* player, Group* group, bool switchLe
if (switchLeader && !itr->second.perm)
{
// increments itr in call
player->UnbindInstance(itr, Difficulty(i), false);
player->UnbindInstance(itr, DifficultyID(i), false);
}
else
++itr;
@ -19804,7 +19799,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
if (!leader || !leader->HasAchieved(ar->achievement))
missingAchievement = ar->achievement;
Difficulty target_difficulty = GetDifficulty(mapEntry->IsRaid());
DifficultyID target_difficulty = GetDifficulty(mapEntry);
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(target_map, target_difficulty);
if (LevelMin || LevelMax || missingItem || missingQuest || missingAchievement)
{
@ -19967,7 +19962,8 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_PLAYER_FLAGS));
stmt->setUInt16(index++, (uint16)GetMapId());
stmt->setUInt32(index++, (uint32)GetInstanceId());
stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
stmt->setUInt8(index++, uint8(GetDungeonDifficulty()));
stmt->setUInt8(index++, uint8(GetRaidDifficulty()));
stmt->setFloat(index++, finiteAlways(GetPositionX()));
stmt->setFloat(index++, finiteAlways(GetPositionY()));
stmt->setFloat(index++, finiteAlways(GetPositionZ()));
@ -20077,7 +20073,8 @@ void Player::SaveToDB(bool create /*=false*/)
{
stmt->setUInt16(index++, (uint16)GetMapId());
stmt->setUInt32(index++, (uint32)GetInstanceId());
stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
stmt->setUInt8(index++, uint8(GetDungeonDifficulty()));
stmt->setUInt8(index++, uint8(GetRaidDifficulty()));
stmt->setFloat(index++, finiteAlways(GetPositionX()));
stmt->setFloat(index++, finiteAlways(GetPositionY()));
stmt->setFloat(index++, finiteAlways(GetPositionZ()));
@ -20087,7 +20084,8 @@ void Player::SaveToDB(bool create /*=false*/)
{
stmt->setUInt16(index++, (uint16)GetTeleportDest().GetMapId());
stmt->setUInt32(index++, (uint32)0);
stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
stmt->setUInt8(index++, uint8(GetDungeonDifficulty()));
stmt->setUInt8(index++, uint8(GetRaidDifficulty()));
stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionX()));
stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionY()));
stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetPositionZ()));
@ -21142,7 +21140,7 @@ void Player::SendExplorationExperience(uint32 Area, uint32 Experience)
GetSession()->SendPacket(&data);
}
void Player::SendDungeonDifficulty(bool IsInGroup)
void Player::SendDungeonDifficulty(/*bool IsInGroup*/)
{
WorldPacket data(SMSG_SET_DUNGEON_DIFFICULTY, 4);
data << uint32(GetDungeonDifficulty());
@ -21151,7 +21149,7 @@ void Player::SendDungeonDifficulty(bool IsInGroup)
void Player::SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty)
{
WorldPacket data(MSG_SET_RAID_DIFFICULTY, 4);
WorldPacket data(SMSG_SET_RAID_DIFFICULTY, 4);
data << uint32(forcedDifficulty == -1 ? GetRaidDifficulty() : forcedDifficulty);
GetSession()->SendPacket(&data);
}
@ -21168,7 +21166,9 @@ void Player::ResetInstances(uint8 method, bool isRaid)
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN
// we assume that when the difficulty changes, all instances that can be reset will be
Difficulty diff = GetDifficulty(isRaid);
DifficultyID diff = GetDungeonDifficulty();
if (isRaid)
diff = GetRaidDifficulty();
for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();)
{
@ -21183,7 +21183,7 @@ void Player::ResetInstances(uint8 method, bool isRaid)
if (method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
if (entry->map_type == MAP_RAID || diff == DIFFICULTY_HEROIC)
{
++itr;
continue;
@ -24294,14 +24294,11 @@ void Player::SendInitialPacketsAfterAddToMap()
// raid downscaling - send difficulty to player
if (GetMap()->IsRaid())
{
if (GetMap()->GetDifficulty() != GetRaidDifficulty())
{
StoreRaidMapDifficulty();
SendRaidDifficulty(GetGroup() != NULL, GetStoredRaidDifficulty());
}
DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(GetMap()->GetDifficulty());
SendRaidDifficulty(GetMap()->GetDifficulty());
}
else if (GetRaidDifficulty() != GetStoredRaidDifficulty())
SendRaidDifficulty(GetGroup() != NULL);
else if (GetMap()->IsNonRaidDungeon())
SendDungeonDifficulty();
m_battlePetMgr->SendBattlePetJournal();
m_battlePetMgr->SendBattlePetJournalLock();
@ -24331,7 +24328,7 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8
GetSession()->SendPacket(&data);
}
void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time)
void Player::SendInstanceResetWarning(uint32 mapid, DifficultyID difficulty, uint32 time)
{
// type of warning, based on the time remaining until reset
uint32 type;
@ -26375,6 +26372,38 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
SendEquipError(msg, NULL, NULL, item->itemid);
}
DifficultyID Player::GetDifficulty(MapEntry const* mapEntry) const
{
if (!mapEntry->IsRaid())
return m_dungeonDifficulty;
return m_raidDifficulty;
}
DifficultyID Player::CheckLoadedDungeonDifficultyID(DifficultyID difficulty)
{
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
if (!difficultyEntry)
return DIFFICULTY_NORMAL;
if (difficultyEntry->maptype != MAP_INSTANCE)
return DIFFICULTY_NORMAL;
return difficulty;
}
DifficultyID Player::CheckLoadedRaidDifficultyID(DifficultyID difficulty)
{
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
if (!difficultyEntry)
return DIFFICULTY_10MAN_NORMAL;
if (difficultyEntry->maptype != MAP_RAID)
return DIFFICULTY_10MAN_NORMAL;
return difficulty;
}
uint32 Player::CalculateTalentsPoints() const
{
// 1 talent point for every 15 levels

View file

@ -1408,7 +1408,7 @@ class Player : public Unit, public GridObject<Player>
void SendInitialPacketsBeforeAddToMap();
void SendInitialPacketsAfterAddToMap();
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
void SendInstanceResetWarning(uint32 mapid, DifficultyID difficulty, uint32 time);
bool CanInteractWithQuestGiver(Object* questGiver);
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
@ -2410,34 +2410,13 @@ class Player : public Unit, public GridObject<Player>
return 0;
}
Difficulty GetDifficulty(bool isRaid) const
{
return isRaid ? m_raidDifficulty : m_dungeonDifficulty;
}
Difficulty GetDungeonDifficulty() const
{
return m_dungeonDifficulty;
}
Difficulty GetRaidDifficulty() const
{
return m_raidDifficulty;
}
Difficulty GetStoredRaidDifficulty() const
{
return m_raidMapDifficulty;
} // only for use in difficulty packet after exiting to raid map
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
{
m_dungeonDifficulty = dungeon_difficulty;
}
void SetRaidDifficulty(Difficulty raid_difficulty)
{
m_raidDifficulty = raid_difficulty;
}
void StoreRaidMapDifficulty()
{
m_raidMapDifficulty = GetMap()->GetDifficulty();
}
DifficultyID GetDifficulty(MapEntry const* mapEntry) const;
DifficultyID GetDungeonDifficulty() const { return m_dungeonDifficulty; }
DifficultyID GetRaidDifficulty() const { return m_raidDifficulty; }
void SetDungeonDifficulty(DifficultyID dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
void SetRaidDifficulty(DifficultyID raid_difficulty) { m_raidDifficulty = raid_difficulty; }
static DifficultyID CheckLoadedDungeonDifficultyID(DifficultyID difficulty);
static DifficultyID CheckLoadedRaidDifficultyID(DifficultyID difficulty);
bool UpdateSkill(uint32 skill_id, uint32 step);
bool UpdateSkillPro(uint16 skillId, int32 chance, uint32 step);
@ -2541,7 +2520,7 @@ class Player : public Unit, public GridObject<Player>
void SendAutoRepeatCancel(Unit* target);
void SendExplorationExperience(uint32 Area, uint32 Experience);
void SendDungeonDifficulty(bool IsInGroup);
void SendDungeonDifficulty(/*bool IsInGroup*/);
void SendRaidDifficulty(bool IsInGroup, int32 forcedDifficulty = -1);
void ResetInstances(uint8 method, bool isRaid);
void SendResetInstanceSuccess(uint32 MapId);
@ -3023,15 +3002,15 @@ class Player : public Unit, public GridObject<Player>
uint32 m_HomebindTimer;
bool m_InstanceValid;
// permanent binds and solo binds by difficulty
BoundInstancesMap m_boundInstances [MAX_DIFFICULTY];
InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty);
BoundInstancesMap& GetBoundInstances(Difficulty difficulty)
BoundInstancesMap m_boundInstances [15];
InstancePlayerBind* GetBoundInstance(uint32 mapid, DifficultyID difficulty);
BoundInstancesMap& GetBoundInstances(DifficultyID difficulty)
{
return m_boundInstances [difficulty];
}
InstanceSave* GetInstanceSave(uint32 mapid, bool raid);
void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false);
void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false);
InstanceSave* GetInstanceSave(uint32 mapid);
void UnbindInstance(uint32 mapid, DifficultyID difficulty, bool unload = false);
void UnbindInstance(BoundInstancesMap::iterator &itr, DifficultyID difficulty, bool unload = false);
InstancePlayerBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false);
void BindToInstance();
void SetPendingBind(uint32 instanceId, uint32 bindTimer);
@ -3454,9 +3433,9 @@ class Player : public Unit, public GridObject<Player>
uint32 m_nextSave;
time_t m_speakTime;
uint32 m_speakCount;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Difficulty m_raidMapDifficulty;
DifficultyID m_dungeonDifficulty;
DifficultyID m_raidDifficulty;
DifficultyID m_raidMapDifficulty;
uint32 m_atLoginFlags;

View file

@ -462,7 +462,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.Entry = entry;
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
for (uint8 i = 0; i < 3; ++i)
creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
@ -632,7 +632,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
return;
bool ok = true; // bool to allow continue outside this loop
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
for (uint32 diff = 0; diff < 3 && ok; ++diff)
{
if (!cInfo->DifficultyEntry[diff])
continue;
@ -647,7 +647,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
}
bool ok2 = true;
for (uint32 diff2 = 0; diff2 < MAX_DIFFICULTY - 1 && ok2; ++diff2)
for (uint32 diff2 = 0; diff2 < 3 && ok2; ++diff2)
{
ok2 = false;
if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
@ -1603,8 +1603,8 @@ void ObjectMgr::LoadCreatures()
std::map<uint32, uint32> spawnMasks;
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
if (sMapStore.LookupEntry(i))
for (int k = 0; k < MAX_DIFFICULTY; ++k)
if (GetMapDifficultyData(i, Difficulty(k)))
for (int k = 0; k < 15; ++k)
if (GetMapDifficultyData(i, DifficultyID(k)))
spawnMasks[i] |= (1 << k);
_creatureDataStore.rehash(result->GetRowCount());
@ -1638,7 +1638,7 @@ void ObjectMgr::LoadCreatures()
data.curhealth = fields[12].GetUInt32();
data.curmana = fields[13].GetUInt32();
data.movementType = fields[14].GetUInt8();
data.spawnMask = fields[15].GetUInt8();
data.spawnMask = fields[15].GetUInt32();
data.phaseMask = fields[16].GetUInt32();
int16 gameEvent = fields[17].GetInt8();
uint32 PoolId = fields[18].GetUInt32();
@ -1657,7 +1657,7 @@ void ObjectMgr::LoadCreatures()
SF_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u) spawnMasks[data.mapid]: %u.", guid, data.spawnMask, data.mapid, spawnMasks[data.mapid]);
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
for (uint32 diff = 0; diff < 3 && ok; ++diff)
{
if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
{
@ -1726,8 +1726,8 @@ void ObjectMgr::LoadCreatures()
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
uint32 mask = data->spawnMask;
for (uint32 i = 0; mask != 0; i++, mask >>= 1)
{
if (mask & 1)
{
@ -1740,8 +1740,8 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
{
uint8 mask = data->spawnMask;
for (uint8 i = 0; mask != 0; i++, mask >>= 1)
uint32 mask = data->spawnMask;
for (uint32 i = 0; mask != 0; i++, mask >>= 1)
{
if (mask & 1)
{
@ -1911,8 +1911,8 @@ void ObjectMgr::LoadGameobjects()
std::map<uint32, uint32> spawnMasks;
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
if (sMapStore.LookupEntry(i))
for (int k = 0; k < MAX_DIFFICULTY; ++k)
if (GetMapDifficultyData(i, Difficulty(k)))
for (int k = 0; k < 15; ++k)
if (GetMapDifficultyData(i, DifficultyID(k)))
spawnMasks[i] |= (1 << k);
_gameObjectDataStore.rehash(result->GetRowCount());
@ -4966,9 +4966,9 @@ void ObjectMgr::LoadInstanceEncounters()
if (dungeonEncounter->difficulty == -1)
{
for (uint32 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint32 i = 0; i < 14; ++i)
{
if (GetMapDifficultyData(dungeonEncounter->mapId, Difficulty(i)))
if (GetMapDifficultyData(dungeonEncounter->mapId, DifficultyID(i)))
{
DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR32(dungeonEncounter->mapId, i)];
encounters.push_back(new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));

View file

@ -814,7 +814,7 @@ class ObjectMgr
return NULL;
}
AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
AccessRequirement const* GetAccessRequirement(uint32 mapid, DifficultyID difficulty) const
{
AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty));
if (itr != _accessRequirementStore.end())
@ -874,7 +874,7 @@ class ObjectMgr
VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const;
DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty)
DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, DifficultyID difficulty)
{
UNORDERED_MAP<uint32, DungeonEncounterList>::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR32(mapId, difficulty));
if (itr != _dungeonEncounterStore.end())
@ -1515,8 +1515,8 @@ class ObjectMgr
GraveyardOrientationContainer _graveyardOrientations;
std::set<uint32> _difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
std::set<uint32> _hasDifficultyEntries[MAX_DIFFICULTY - 1]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
std::set<uint32> _difficultyEntries[4 - 1]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
std::set<uint32> _hasDifficultyEntries[4 - 1]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
enum CreatureLinkedRespawnType
{

View file

@ -55,7 +55,7 @@ Loot* Roll::getLoot()
}
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_dungeonDifficulty(DIFFICULTY_NORMAL), m_raidDifficulty(DIFFICULTY_10MAN_NORMAL),
m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0), _readyCheckInProgress(false)
{
@ -84,7 +84,7 @@ Group::~Group()
// it is undefined whether objectmgr (which stores the groups) or instancesavemgr
// will be unloaded first so we must be prepared for both cases
// this may unload some instance saves
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
itr2->second.save->RemoveGroup(this);
@ -113,8 +113,8 @@ bool Group::Create(Player* leader)
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = leaderGuid;
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
m_dungeonDifficulty = DIFFICULTY_NORMAL;
m_raidDifficulty = DIFFICULTY_10MAN_NORMAL;
if (!isBGGroup() && !isBFGroup())
{
@ -181,17 +181,8 @@ void Group::LoadGroupFromDB(Field* fields)
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
uint32 diff = fields[13].GetUInt8();
if (diff >= MAX_DUNGEON_DIFFICULTY)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
else
m_dungeonDifficulty = Difficulty(diff);
uint32 r_diff = fields[14].GetUInt8();
if (r_diff >= MAX_RAID_DIFFICULTY)
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
else
m_raidDifficulty = Difficulty(r_diff);
m_dungeonDifficulty = Player::CheckLoadedDungeonDifficultyID(DifficultyID(fields[13].GetUInt8()));
m_raidDifficulty = Player::CheckLoadedRaidDifficultyID(DifficultyID(fields[14].GetUInt8()));
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
@ -455,7 +446,7 @@ bool Group::AddMember(Player* player)
if (player->GetDungeonDifficulty() != GetDungeonDifficulty())
{
player->SetDungeonDifficulty(GetDungeonDifficulty());
player->SendDungeonDifficulty(true);
player->SendDungeonDifficulty();
}
if (player->GetRaidDifficulty() != GetRaidDifficulty())
{
@ -669,7 +660,7 @@ void Group::ChangeLeader(uint64 newLeaderGuid)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
{
@ -2321,7 +2312,7 @@ void Roll::targetObjectBuildLink()
getTarget()->addLootValidatorRef(this);
}
void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetDungeonDifficulty(DifficultyID difficulty)
{
m_dungeonDifficulty = difficulty;
if (!isBGGroup() && !isBFGroup())
@ -2341,11 +2332,11 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
continue;
player->SetDungeonDifficulty(difficulty);
player->SendDungeonDifficulty(true);
player->SendDungeonDifficulty();
}
}
void Group::SetRaidDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(DifficultyID difficulty)
{
m_raidDifficulty = difficulty;
if (!isBGGroup() && !isBFGroup())
@ -2390,7 +2381,11 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
// we assume that when the difficulty changes, all instances that can be reset will be
Difficulty diff = GetDifficulty(isRaid);
DifficultyID diff = GetDungeonDifficulty();
if (isRaid)
{
diff = GetRaidDifficulty();
}
for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();)
{
@ -2405,7 +2400,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
if (method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
if (entry->map_type == MAP_RAID || diff == DIFFICULTY_HEROIC)
{
++itr;
continue;
@ -2479,9 +2474,7 @@ InstanceGroupBind* Group::GetBoundInstance(Player* player)
InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
{
// Currently spawn numbering not different from map difficulty
Difficulty difficulty = GetDifficulty(aMap->IsRaid());
return GetBoundInstance(difficulty, aMap->GetId());
return GetBoundInstance(aMap->GetEntry());
}
InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
@ -2489,11 +2482,11 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
if (!mapEntry || !mapEntry->IsDungeon())
return NULL;
Difficulty difficulty = GetDifficulty(mapEntry->IsRaid());
DifficultyID difficulty = GetDifficulty(mapEntry);
return GetBoundInstance(difficulty, mapEntry->MapID);
}
InstanceGroupBind* Group::GetBoundInstance(Difficulty difficulty, uint32 mapId)
InstanceGroupBind* Group::GetBoundInstance(DifficultyID difficulty, uint32 mapId)
{
// some instances only have one difficulty
GetDownscaledMapDifficultyData(mapId, difficulty);
@ -2789,21 +2782,24 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
SendUpdate();
}
Difficulty Group::GetDifficulty(bool isRaid) const
DifficultyID Group::GetDifficulty(MapEntry const* mapEntry) const
{
return isRaid ? m_raidDifficulty : m_dungeonDifficulty;
}
if (!mapEntry->IsRaid())
return m_dungeonDifficulty;
Difficulty Group::GetDungeonDifficulty() const
return m_raidDifficulty;
}
/*
DifficultyID Group::GetDungeonDifficulty() const
{
return m_dungeonDifficulty;
}
Difficulty Group::GetRaidDifficulty() const
DifficultyID Group::GetRaidDifficulty() const
{
return m_raidDifficulty;
}
*/
bool Group::isRollLootActive() const
{
return !RollId.empty();
@ -2838,7 +2834,7 @@ void Group::DelinkMember(uint64 guid)
}
}
Group::BoundInstancesMap& Group::GetBoundInstances(Difficulty difficulty)
Group::BoundInstancesMap& Group::GetBoundInstances(DifficultyID difficulty)
{
return m_boundInstances[difficulty];
}

View file

@ -265,12 +265,11 @@ class Group
void SetMemberRole(uint64 guid, uint32 role);
uint32 GetMemberRole(uint64 guid) const;
Difficulty GetDifficulty(bool isRaid) const;
Difficulty GetDungeonDifficulty() const;
Difficulty GetRaidDifficulty() const;
void SetDungeonDifficulty(Difficulty difficulty);
void SetRaidDifficulty(Difficulty difficulty);
uint16 InInstance();
DifficultyID GetDifficulty(MapEntry const* mapEntry) const;
DifficultyID GetDungeonDifficulty() const { return m_dungeonDifficulty; }
DifficultyID GetRaidDifficulty() const { return m_raidDifficulty; }
void SetDungeonDifficulty(DifficultyID difficulty);
void SetRaidDifficulty(DifficultyID difficulty);
bool InCombatToInstance(uint32 instanceId);
void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo);
@ -321,8 +320,8 @@ class Group
InstanceGroupBind* GetBoundInstance(Player* player);
InstanceGroupBind* GetBoundInstance(Map* aMap);
InstanceGroupBind* GetBoundInstance(MapEntry const* mapEntry);
InstanceGroupBind* GetBoundInstance(Difficulty difficulty, uint32 mapId);
BoundInstancesMap& GetBoundInstances(Difficulty difficulty);
InstanceGroupBind* GetBoundInstance(DifficultyID difficulty, uint32 mapId);
BoundInstancesMap& GetBoundInstances(DifficultyID difficulty);
// FG: evil hacks
void BroadcastGroupUpdate(void);
@ -344,8 +343,8 @@ class Group
uint64 m_leaderGuid;
std::string m_leaderName;
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
DifficultyID m_dungeonDifficulty;
DifficultyID m_raidDifficulty;
Battleground* m_bgGroup;
Battlefield* m_bfGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
@ -353,7 +352,7 @@ class Group
ItemQualities m_lootThreshold;
uint64 m_looterGuid;
Rolls RollId;
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
BoundInstancesMap m_boundInstances[15];
uint8* m_subGroupsCounts;
uint64 m_guid;
uint32 m_counter; // used only in SMSG_GROUP_LIST

View file

@ -222,13 +222,11 @@ void GroupMgr::LoadGroups()
}
uint32 diff = fields[4].GetUInt8();
if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
SF_LOG_ERROR("sql.sql", "Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
}
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(diff);
if (!difficultyEntry || difficultyEntry->maptype != mapEntry->map_type)
continue;
InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), (bool)fields[6].GetUInt64(), true);
InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), DifficultyID(diff), time_t(fields[5].GetUInt32()), (bool)fields[6].GetUInt64(), true);
group->BindToInstance(save, fields[3].GetBool(), true);
++count;
}

View file

@ -69,9 +69,9 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
size_t lockoutPos = data.bitwpos();
data.WriteBits(0, 20); // Lockout placeholder
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i));
Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(DifficultyID(i));
for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr)
{
if (itr->second.perm)
@ -840,7 +840,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
uint32 mapId, difficulty;
uint8 toggleExtend;
recvData >> mapId >> difficulty>> toggleExtend;
SF_LOG_DEBUG("network", "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, Difficulty: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off");
SF_LOG_DEBUG("network", "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, DifficultyID: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off");
/*
InstancePlayerBind* instanceBind = _player->GetBoundInstance(mapId, Difficulty(difficulty));
@ -925,7 +925,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
uint64 guid = _player->GetGUID();
SF_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
"] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
"] Map: %u, DifficultyID %u", guid, save->GetMapId(), save->GetDifficulty());
time_t currTime = time(NULL);

View file

@ -919,7 +919,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
pCurrChar->GetMotionMaster()->Initialize();
pCurrChar->SendDungeonDifficulty(false);
pCurrChar->SendDungeonDifficulty();
WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 4 + 4 + 4 + 4 + 4);
data << pCurrChar->GetPositionX();

View file

@ -1794,25 +1794,35 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
{
SF_LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY");
SF_LOG_DEBUG("network", "Received: CMSG_SET_DUNGEON_DIFFICULTY");
uint32 mode;
recvData >> mode;
uint32 Difficulty;
recvData >> Difficulty;
if (mode >= MAX_DUNGEON_DIFFICULTY)
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(Difficulty);
if (!difficultyEntry)
{
SF_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
SF_LOG_DEBUG("network", "%d sent an invalid instance mode %u!",
_player->GetGUIDLow(), Difficulty);
return;
}
if (Difficulty(mode) == _player->GetDungeonDifficulty())
if (difficultyEntry->maptype != MAP_INSTANCE)
{
SF_LOG_DEBUG("network", "%d sent an non-dungeon instance mode %d!",
_player->GetGUIDLow(), difficultyEntry->DiffID);
return;
}
DifficultyID difficulty = DifficultyID(difficultyEntry->DiffID);
if (difficulty == _player->GetDungeonDifficulty())
return;
// cannot reset while in an instance
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
SF_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!",
SF_LOG_DEBUG("network", "player (Name: %s, GUID: %u) tried to reset the instance while player is inside!",
_player->GetName().c_str(), _player->GetGUIDLow());
return;
}
@ -1833,7 +1843,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
if (groupGuy->GetMap()->IsNonRaidDungeon())
{
SF_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!",
SF_LOG_DEBUG("network", "player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!",
_player->GetGUIDLow(), groupGuy->GetName().c_str(), groupGuy->GetGUIDLow());
return;
}
@ -1841,41 +1851,50 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
group->SetDungeonDifficulty(Difficulty(mode));
group->SetDungeonDifficulty(DifficultyID(difficulty));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false);
_player->SetDungeonDifficulty(Difficulty(mode));
_player->SendDungeonDifficulty(true);
_player->SetDungeonDifficulty(DifficultyID(difficulty));
_player->SendDungeonDifficulty();
}
}
void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData)
{
SF_LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY");
SF_LOG_DEBUG("network", "Received: CMSG_SET_RAID_DIFFICULTY");
uint32 mode;
recvData >> mode;
uint32 Difficulty;
recvData >> Difficulty;
if (mode >= MAX_RAID_DIFFICULTY)
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(Difficulty);
if (!difficultyEntry)
{
SF_LOG_DEBUG("network", "%d sent an invalid instance mode %u!",
_player->GetGUIDLow(), Difficulty);
return;
}
if (difficultyEntry->maptype != MAP_RAID)
{
SF_LOG_ERROR("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
SF_LOG_DEBUG("network", "%s sent an non-raid instance mode %u!",
_player->GetGUIDLow(), difficultyEntry->DiffID);
return;
}
DifficultyID difficulty = DifficultyID(difficultyEntry->DiffID);
if (difficulty == _player->GetRaidDifficulty())
return;
// cannot reset while in an instance
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
SF_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
SF_LOG_DEBUG("network", "player %d tried to reset the raid while inside!", _player->GetGUIDLow());
return;
}
if (Difficulty(mode) == _player->GetRaidDifficulty())
return;
Group* group = _player->GetGroup();
if (group)
{
@ -1892,20 +1911,20 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData)
if (groupGuy->GetMap()->IsRaid())
{
SF_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
SF_LOG_DEBUG("network", "player %d tried to reset the raid while inside!", _player->GetGUIDLow());
return;
}
}
// the difficulty is set even if the instances can't be reset
//_player->SendDungeonDifficulty(true);
group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
group->SetRaidDifficulty(Difficulty(mode));
group->SetRaidDifficulty(DifficultyID(difficulty));
}
}
else
{
_player->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true);
_player->SetRaidDifficulty(Difficulty(mode));
_player->SetRaidDifficulty(DifficultyID(difficulty));
}
}

View file

@ -155,7 +155,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena();
if (mInstance)
{
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
DifficultyID diff = GetPlayer()->GetDifficulty(mEntry);
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID, diff))
{
if (mapDiff->resetTime)

View file

@ -67,7 +67,7 @@ InstanceSaveManager::~InstanceSaveManager()
- adding instance into manager
- called from InstanceMap::Add, _LoadBoundInstances, LoadGroups
*/
InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load)
InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, DifficultyID difficulty, time_t resetTime, bool canReset, bool load)
{
if (InstanceSave* old_save = GetInstanceSave(instanceId))
return old_save;
@ -85,7 +85,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
return NULL;
}
if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
if (difficulty >= 14)
{
SF_LOG_ERROR("misc", "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
return NULL;
@ -95,7 +95,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
{
// initialize reset time
// for normal instances if no creatures are killed the instance will reset in two hours
if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL)
if (entry->map_type == MAP_RAID || difficulty > DIFFICULTY_NORMAL)
resetTime = GetResetTimeFor(mapId, difficulty);
else
{
@ -162,7 +162,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
}
}
InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset)
InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, DifficultyID difficulty, time_t resetTime, bool canReset)
: m_resetTime(resetTime), m_instanceid(InstanceId), m_mapid(MapId),
m_difficulty(difficulty), m_canReset(canReset), m_toDelete(false) { }
@ -206,7 +206,7 @@ time_t InstanceSave::GetResetTimeForDB()
{
// only save the reset time for normal instances
const MapEntry* entry = sMapStore.LookupEntry(GetMapId());
if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DIFFICULTY_HEROIC)
return 0;
else
return GetResetTime();
@ -345,7 +345,7 @@ void InstanceSaveManager::LoadResetTimes()
// schedule the reset times
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
if (itr->second.second > now)
ScheduleReset(true, itr->second.second, InstResetEvent(0, PAIR32_LOPART(itr->second.first), Difficulty(PAIR32_HIPART(itr->second.first)), itr->first));
ScheduleReset(true, itr->second.second, InstResetEvent(0, PAIR32_LOPART(itr->second.first), DifficultyID(PAIR32_HIPART(itr->second.first)), itr->first));
}
// load the global respawn times for raid/heroic instances
@ -357,7 +357,7 @@ void InstanceSaveManager::LoadResetTimes()
{
Field* fields = result->Fetch();
uint32 mapid = fields[0].GetUInt16();
Difficulty difficulty = Difficulty(fields[1].GetUInt8());
DifficultyID difficulty = DifficultyID(fields[1].GetUInt8());
uint64 oldresettime = fields[2].GetUInt32();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
@ -379,50 +379,53 @@ void InstanceSaveManager::LoadResetTimes()
// calculate new global reset times for expired instances and those that have never been reset yet
// add the global reset times to the priority queue
for (MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
for (auto& mapDifficultyPair : sMapDifficultyMap)
{
uint32 map_diff_pair = itr->first;
uint32 mapid = PAIR32_LOPART(map_diff_pair);
Difficulty difficulty = Difficulty(PAIR32_HIPART(map_diff_pair));
MapDifficulty const* mapDiff = &itr->second;
if (!mapDiff->resetTime)
continue;
uint32 mapid = mapDifficultyPair.first;
// the reset_delay must be at least one day
uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME))/DAY) * DAY);
if (period < DAY)
period = DAY;
time_t t = GetResetTimeFor(mapid, difficulty);
if (!t)
for (auto& difficultyPair : mapDifficultyPair.second)
{
// initialize the reset time
t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u', '%u', '%u')", mapid, difficulty, (uint32)t);
DifficultyID difficulty = DifficultyID(difficultyPair.first);
MapDifficulty const* mapDiff = &difficultyPair.second;
if (!mapDiff->resetTime)
continue;
// the reset_delay must be at least one day
uint32 period = uint32(((mapDiff->resetTime * sWorld->getRate(RATE_INSTANCE_RESET_TIME)) / DAY) * DAY);
if (period < DAY)
period = DAY;
time_t t = GetResetTimeFor(mapid, difficulty);
if (!t)
{
// initialize the reset time
t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u', '%u', '%u')", mapid, difficulty, (uint32)t);
}
if (t < now)
{
// assume that expired instances have already been cleaned
// calculate the next reset time
t = (t / DAY) * DAY;
t += ((today - t) / period + 1) * period + diff;
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
}
SetResetTimeFor(mapid, difficulty, t);
// schedule the global reset/warning
uint8 type;
for (type = 1; type < 4; ++type)
if (t - ResetTimeDelay[type - 1] > now)
break;
ScheduleReset(true, t - ResetTimeDelay[type - 1], InstResetEvent(type, mapid, difficulty, 0));
ResetTimeMapDiffInstancesBounds range = mapDiffResetInstances.equal_range(MAKE_PAIR32(mapid, difficulty));
for (; range.first != range.second; ++range.first)
ScheduleReset(true, t - ResetTimeDelay[type - 1], InstResetEvent(type, mapid, difficulty, range.first->second));
}
if (t < now)
{
// assume that expired instances have already been cleaned
// calculate the next reset time
t = (t / DAY) * DAY;
t += ((today - t) / period + 1) * period + diff;
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
}
SetResetTimeFor(mapid, difficulty, t);
// schedule the global reset/warning
uint8 type;
for (type = 1; type < 4; ++type)
if (t - ResetTimeDelay[type-1] > now)
break;
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, 0));
ResetTimeMapDiffInstancesBounds range = mapDiffResetInstances.equal_range(map_diff_pair);
for (; range.first != range.second; ++range.first)
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, range.first->second));
}
}
@ -550,7 +553,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
sMapMgr->FreeInstanceId(instanceId);
}
void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime)
void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, DifficultyID difficulty, bool warn, time_t resetTime)
{
// global reset for all instances of the given map
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);

View file

@ -50,7 +50,7 @@ class InstanceSave
- any new instance is being generated
- the first time a player bound to InstanceId logs in
- when a group bound to the instance is loaded */
InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset);
InstanceSave(uint16 MapId, uint32 InstanceId, DifficultyID difficulty, time_t resetTime, bool canReset);
/* Unloaded when m_playerList and m_groupList become empty
or when the instance is reset */
@ -114,7 +114,7 @@ class InstanceSave
/* currently it is possible to omit this information from this structure
but that would depend on a lot of things that can easily change in future */
Difficulty GetDifficulty() const { return m_difficulty; }
DifficultyID GetDifficulty() const { return m_difficulty; }
/* used to flag the InstanceSave as to be deleted, so the caller can delete it */
void SetToDelete(bool toDelete)
@ -134,7 +134,7 @@ class InstanceSave
time_t m_resetTime;
uint32 m_instanceid;
uint32 m_mapid;
Difficulty m_difficulty;
DifficultyID m_difficulty;
bool m_canReset;
bool m_toDelete;
@ -160,12 +160,12 @@ class InstanceSaveManager
struct InstResetEvent
{
uint8 type;
Difficulty difficulty:8;
DifficultyID difficulty:8;
uint16 mapid;
uint16 instanceId;
InstResetEvent() : type(0), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) { }
InstResetEvent(uint8 t, uint32 _mapid, Difficulty d, uint16 _instanceid)
InstResetEvent() : type(0), difficulty(DIFFICULTY_NORMAL), mapid(0), instanceId(0) { }
InstResetEvent(uint8 t, uint32 _mapid, DifficultyID d, uint16 _instanceid)
: type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) { }
bool operator == (const InstResetEvent& e) const { return e.instanceId == instanceId; }
};
@ -174,13 +174,13 @@ class InstanceSaveManager
void LoadInstances();
void LoadResetTimes();
time_t GetResetTimeFor(uint32 mapid, Difficulty d) const
time_t GetResetTimeFor(uint32 mapid, DifficultyID d) const
{
ResetTimeByMapDifficultyMap::const_iterator itr = m_resetTimeByMapDifficulty.find(MAKE_PAIR32(mapid, d));
return itr != m_resetTimeByMapDifficulty.end() ? itr->second : 0;
}
void SetResetTimeFor(uint32 mapid, Difficulty d, time_t t)
void SetResetTimeFor(uint32 mapid, DifficultyID d, time_t t)
{
m_resetTimeByMapDifficulty[MAKE_PAIR32(mapid, d)] = t;
}
@ -193,7 +193,7 @@ class InstanceSaveManager
void Update();
InstanceSave* AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime,
InstanceSave* AddInstanceSave(uint32 mapId, uint32 instanceId, DifficultyID difficulty, time_t resetTime,
bool canReset, bool load = false);
void RemoveInstanceSave(uint32 InstanceId);
static void DeleteInstanceFromDB(uint32 instanceid);
@ -209,7 +209,7 @@ class InstanceSaveManager
static uint16 ResetTimeDelay[];
private:
void _ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime);
void _ResetOrWarnAll(uint32 mapid, DifficultyID difficulty, bool warn, time_t resetTime);
void _ResetInstance(uint32 mapid, uint32 instanceId);
void _ResetSave(InstanceSaveHashMap::iterator &itr);
// used during global instance resets

View file

@ -2734,13 +2734,13 @@ bool InstanceMap::AddPlayerToMap(Player* player)
if (!mapSave)
{
SF_LOG_INFO("maps", "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), DifficultyID(GetSpawnMode()), 0, true);
}
ASSERT(mapSave);
// check for existing instance binds
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode()));
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), DifficultyID(GetSpawnMode()));
if (playerBind && playerBind->perm)
{
// cannot enter other instances if bound permanently
@ -2972,7 +2972,7 @@ void InstanceMap::UnloadAll()
void InstanceMap::SendResetWarnings(uint32 timeLeft) const
{
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(IsRaid()), timeLeft);
itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(GetEntry()), timeLeft);
}
void InstanceMap::SetResetSchedule(bool on)
@ -2983,10 +2983,10 @@ void InstanceMap::SetResetSchedule(bool on)
if (IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
{
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()))
sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), DifficultyID(GetSpawnMode()), GetInstanceId()));
else
SF_LOG_ERROR("maps", "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)",
on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), Difficulty(GetSpawnMode()));
on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), DifficultyID(GetSpawnMode()));
}
}
@ -2995,6 +2995,25 @@ MapDifficulty const* Map::GetMapDifficulty() const
return GetMapDifficultyData(GetId(), GetDifficulty());
}
bool Map::IsHeroic() const
{
if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(i_spawnMode))
{
SF_LOG_DEBUG("maps", "Difficulty Check: Difficulty: %u, SpawnMode: %u", difficulty, i_spawnMode);
switch (i_spawnMode)
{
case DIFFICULTY_10MAN_HEROIC:
case DIFFICULTY_25MAN_HEROIC:
case DIFFICULTY_HEROIC:
return true;
default:
return false;
break;
}
}
return false;
}
uint32 InstanceMap::GetMaxPlayers() const
{
if (MapDifficulty const* mapDiff = GetMapDifficulty())
@ -3003,7 +3022,7 @@ uint32 InstanceMap::GetMaxPlayers() const
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);
MapDifficulty const* normalDiff = GetMapDifficultyData(GetId(), DIFFICULTY_NONE);
return normalDiff ? normalDiff->maxPlayers : 0;
}
}

View file

@ -369,17 +369,18 @@ class Map : public GridRefManager<NGridType>
const char* GetMapName() const;
// have meaning only for instanced map (that have set real difficulty)
Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DIFFICULTY; }
DifficultyID GetDifficulty() const { return DifficultyID(GetSpawnMode()); }
bool IsRegularDifficulty() const { return GetDifficulty() == 0; }
MapDifficulty const* GetMapDifficulty() const;
bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
bool IsRaidOrHeroicDungeon() const { return IsRaid() || i_spawnMode > DUNGEON_DIFFICULTY_NORMAL; }
bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
bool Is25ManRaid() const { return IsRaid() && i_spawnMode & RAID_DIFFICULTY_MASK_25MAN; } // since 25man difficulties are 1 and 3, we can check them like that
bool IsRaidOrHeroicDungeon() const { return IsRaid() || i_spawnMode == DIFFICULTY_HEROIC; }
//bool IsHeroic() const { return IsRaid() ? i_spawnMode == (DIFFICULTY_10MAN_HEROIC || DIFFICULTY_25MAN_HEROIC) : i_spawnMode == DIFFICULTY_HEROIC; }
bool IsHeroic() const;
bool Is25ManRaid() const { return IsRaid() && i_spawnMode & (DIFFICULTY_25MAN_NORMAL || DIFFICULTY_25MAN_HEROIC || DIFFICULTY_25MAN_LFR); } // since 25man difficulties are 1 and 3, we can check them like that
bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }

View file

@ -28,7 +28,7 @@
#include "Group.h"
#include "Player.h"
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL)
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DIFFICULTY_NORMAL)
{
// fill with zero
memset(&GridMapReference, 0, MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_GRIDS*sizeof(uint16));
@ -141,7 +141,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
}
else
{
InstancePlayerBind* pBind = player->GetBoundInstance(GetId(), player->GetDifficulty(IsRaid()));
InstancePlayerBind* pBind = player->GetBoundInstance(GetId(), player->GetDifficulty(GetEntry()));
InstanceSave* pSave = pBind ? pBind->save : NULL;
// the player's permanent player bind is taken into consideration first
@ -173,7 +173,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
// the instance will be created for the first time
newInstanceId = sMapMgr->GenerateInstanceId();
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
DifficultyID diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(GetEntry()) : player->GetDifficulty(GetEntry());
//Seems it is now possible, but I do not know if it should be allowed
//ASSERT(!FindInstanceMap(NewInstanceId));
map = FindInstanceMap(newInstanceId);
@ -185,7 +185,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
return map;
}
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty)
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, DifficultyID difficulty)
{
// load/create a map
std::lock_guard<std::mutex> guard(Lock);
@ -235,7 +235,7 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
if (bracketEntry)
spawnMode = bracketEntry->difficulty;
else
spawnMode = REGULAR_DIFFICULTY;
spawnMode = 0;
BattlegroundMap* map = new BattlegroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode);
ASSERT(map->IsBattlegroundOrArena());

View file

@ -65,7 +65,7 @@ class MapInstanced : public Map
virtual void InitVisibilityDistance();
private:
InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty);
InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, DifficultyID difficulty);
BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg);
InstancedMaps m_InstancedMaps;

View file

@ -111,7 +111,7 @@ Map* MapManager::CreateBaseMap(uint32 id)
map = new MapInstanced(id, i_gridCleanUpDelay);
else
{
map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
map = new Map(id, i_gridCleanUpDelay, 0, DIFFICULTY_NONE);
map->LoadRespawnTimes();
}
@ -165,7 +165,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (!instance)
return false;
Difficulty targetDifficulty = player->GetDifficulty(entry->IsRaid());
DifficultyID targetDifficulty = player->GetDifficulty(entry);
//The player has a heroic mode and tries to enter into instance which has no a heroic mode
MapDifficulty const* mapDiff = GetMapDifficultyData(entry->MapID, targetDifficulty);
if (!mapDiff)
@ -255,7 +255,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
if (entry->IsDungeon() && (!player->GetGroup() || (player->GetGroup() && !player->GetGroup()->isLFGGroup())))
{
uint32 instaceIdToCheck = 0;
if (InstanceSave* save = player->GetInstanceSave(mapid, entry->IsRaid()))
if (InstanceSave* save = player->GetInstanceSave(mapid))
instaceIdToCheck = save->GetInstanceId();
// instanceId can never be 0 - will not be found

View file

@ -215,16 +215,16 @@ bool Quest::IsAutoComplete() const
return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) ? false : (Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE));
}
bool Quest::IsRaidQuest(Difficulty difficulty) const
bool Quest::IsRaidQuest(DifficultyID difficulty) const
{
switch (Type)
{
case QUEST_TYPE_RAID:
return true;
case QUEST_TYPE_RAID_10:
return !(difficulty & RAID_DIFFICULTY_MASK_25MAN);
return difficulty & (DIFFICULTY_10MAN_NORMAL || DIFFICULTY_10MAN_HEROIC);
case QUEST_TYPE_RAID_25:
return difficulty & RAID_DIFFICULTY_MASK_25MAN;
return difficulty & (DIFFICULTY_25MAN_NORMAL || DIFFICULTY_25MAN_HEROIC);
default:
break;
}
@ -232,7 +232,7 @@ bool Quest::IsRaidQuest(Difficulty difficulty) const
return false;
}
bool Quest::IsAllowedInRaid(Difficulty difficulty) const
bool Quest::IsAllowedInRaid(DifficultyID difficulty) const
{
if (IsRaidQuest(difficulty))
return true;

View file

@ -344,8 +344,8 @@ class Quest
bool IsMonthly() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_MONTHLY; }
bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsRaidQuest(Difficulty difficulty) const;
bool IsAllowedInRaid(Difficulty difficulty) const;
bool IsRaidQuest(DifficultyID difficulty) const;
bool IsAllowedInRaid(DifficultyID difficulty) const;
bool IsDFQuest() const { return SpecialFlags & QUEST_SPECIAL_FLAGS_DF_QUEST; }
bool IsRewChoiceItemValid(uint32 itemId) const;
uint32 CalculateHonorGain(uint8 level) const;

View file

@ -1261,7 +1261,7 @@ void ScriptMgr::OnPlayerSave(Player* player)
FOREACH_SCRIPT(PlayerScript)->OnSave(player);
}
void ScriptMgr::OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent)
void ScriptMgr::OnPlayerBindToInstance(Player* player, DifficultyID difficulty, uint32 mapid, bool permanent)
{
FOREACH_SCRIPT(PlayerScript)->OnBindToInstance(player, difficulty, mapid, permanent);
}

View file

@ -753,7 +753,7 @@ class PlayerScript : public UnitScript
virtual void OnSave(Player* /*player*/) { }
// Called when a player is bound to an instance
virtual void OnBindToInstance(Player* /*player*/, Difficulty /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { }
virtual void OnBindToInstance(Player* /*player*/, DifficultyID /*difficulty*/, uint32 /*mapId*/, bool /*permanent*/) { }
// Called when a player switches to a new zone
virtual void OnUpdateZone(Player* /*player*/, uint32 /*newZone*/, uint32 /*newArea*/) { }
@ -1032,7 +1032,7 @@ class ScriptMgr
void OnPlayerCreate(Player* player);
void OnPlayerDelete(uint64 guid);
void OnPlayerSave(Player* player);
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
void OnPlayerBindToInstance(Player* player, DifficultyID difficulty, uint32 mapid, bool permanent);
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
public: /* GuildScript */

View file

@ -363,6 +363,7 @@ void OpcodeTable::InitializeClientTable()
DEFINE_OPCODE_HANDLER(CMSG_SET_PLAYER_DECLINED_NAMES, 0x09E2, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleSetPlayerDeclinedNames ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_PRIMARY_TALENT_TREE, 0x06C6, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandeSetTalentSpecialization ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_PVP, 0x02C5, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleSetPvP ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_RAID_DIFFICULTY, 0x0591, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleSetRaidDifficultyOpcode ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_SELECTION, 0x0740, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleSetSelectionOpcode ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_TAXI_BENCHMARK_MODE, 0x0762, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTaxiBenchmarkOpcode ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(CMSG_SET_TITLE, 0x03C7, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetTitleOpcode ); // 5.4.8 18414
@ -435,8 +436,7 @@ void OpcodeTable::InitializeClientTable()
DEFINE_OPCODE_HANDLER(MSG_MOVE_STOP_SWIM, 0x0950, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(MSG_MOVE_STOP_TURN, 0x1170, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(MSG_MOVE_WORLDPORT_ACK, 0x1FAD, STATUS_TRANSFER, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveWorldportAckOpcode ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(MSG_SET_RAID_DIFFICULTY, 0x0591, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetRaidDifficultyOpcode ); // 5.4.8 18414
//UNHANDLED
DEFINE_OPCODE_HANDLER(CMSG_ADD_VOICE_IGNORE, 0x0000, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
@ -504,6 +504,7 @@ void OpcodeTable::InitializeClientTable()
DEFINE_OPCODE_HANDLER(CMSG_EJECT_PASSENGER, 0x06E7, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_ENABLE_NAGLE, 0x0000, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess);
DEFINE_OPCODE_HANDLER(CMSG_FAR_SIGHT, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleFarSightOpcode);
//DEFINE_OPCODE_HANDLER(CMSG_GM_TICKET_ACKNOWLEDGE_SURVEY, 0x1093, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_GMRESPONSE_RESOLVE, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleGMResponseResolve);
DEFINE_OPCODE_HANDLER(CMSG_GMSURVEY_SUBMIT, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleGMSurveySubmit);
DEFINE_OPCODE_HANDLER(CMSG_GM_REPORT_LAG, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleReportLag);
@ -610,7 +611,6 @@ void OpcodeTable::InitializeClientTable()
DEFINE_OPCODE_HANDLER(CMSG_SET_GUILD_BANK_TEXT, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleSetGuildBankTabText);
DEFINE_OPCODE_HANDLER(CMSG_SET_PET_SLOT, 0x0000, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_SET_PREFERED_CEMETERY, 0x0000, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_SET_RAID_DIFFICULTY, 0x1093, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_SET_RELATIVE_POSITION, 0x0000, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER(CMSG_SET_SAVED_INSTANCE_EXTEND, 0x0000, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleSetSavedInstanceExtend);
DEFINE_OPCODE_HANDLER(CMSG_SET_TRADE_CURRENCY, 0x0C44, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
@ -980,7 +980,7 @@ void OpcodeTable::InitializeServerTable()
DEFINE_OPCODE_HANDLER(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 0x180E, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SET_PLAY_HOVER_ANIM, 0x069F, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SET_PROFICIENCY, 0x1440, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(MSG_SET_RAID_DIFFICULTY, 0x0591, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SET_RAID_DIFFICULTY, 0x0591, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SET_TIME_ZONE_INFORMATION, 0x19C1, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SET_VEHICLE_REC_ID, 0x149F, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_SHOW_TAXI_NODES, 0x1E1A, STATUS_NEVER ); // 5.4.8 18414

View file

@ -687,7 +687,6 @@ enum Opcodes
MSG_QUERY_NEXT_MAIL_TIME,
MSG_RAID_READY_CHECK_FINISHED,
MSG_SAVE_GUILD_EMBLEM,
MSG_SET_RAID_DIFFICULTY,
MSG_START_MOVE_FORWARD,
MSG_VERIFY_CONNECTIVITY,
SMSG_ACCOUNT_CRITERIA_UPDATE,
@ -1021,6 +1020,7 @@ enum Opcodes
SMSG_HOTFIX_NOTIFY,
SMSG_INITIALIZE_FACTIONS,
SMSG_SEND_KNOWN_SPELLS,
SMSG_SET_RAID_DIFFICULTY,
SMSG_SETUP_CURRENCY,
SMSG_INIT_WORLD_STATES,
SMSG_INSPECT,

View file

@ -6071,7 +6071,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (map->IsDungeon())
{
uint32 mapId = m_caster->GetMap()->GetId();
Difficulty difficulty = m_caster->GetMap()->GetDifficulty();
DifficultyID difficulty = m_caster->GetMap()->GetDifficulty();
if (map->IsRaid())
if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty))
if (InstancePlayerBind* casterBind = m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty))

View file

@ -428,7 +428,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
{
// Consumption
case 28865:
damage = (((InstanceMap*)m_caster->GetMap())->GetDifficulty() == REGULAR_DIFFICULTY ? 2750 : 4250);
damage = (((InstanceMap*)m_caster->GetMap())->GetDifficulty() == DIFFICULTY_NONE ? 2750 : 4250);
break;
// percent from health with min
case 25599: // Thundercrash

View file

@ -471,9 +471,9 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
return spellId;
uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
if (mode >= MAX_DIFFICULTY)
if (mode >= 14)
{
SF_LOG_ERROR("spells", "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
SF_LOG_ERROR("spells", "SpellMgr::GetSpellIdForDifficulty: Incorrect DifficultyID for spell %u.", spellId);
return spellId; //return source spell
}
@ -488,7 +488,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
return spellId; //return source spell
}
if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
if (difficultyEntry->SpellID[mode] <= 0 && mode > DIFFICULTY_HEROIC)
{
SF_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2);
mode -= 2;

View file

@ -76,9 +76,9 @@ public:
player = handler->GetSession()->GetPlayer();
uint32 counter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
Player::BoundInstancesMap &binds = player->GetBoundInstances(DifficultyID(i));
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave* save = itr->second.save;
@ -92,9 +92,9 @@ public:
counter = 0;
if (Group* group = player->GetGroup())
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
Group::BoundInstancesMap &binds = group->GetBoundInstances(DifficultyID(i));
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
{
InstanceSave* save = itr->second.save;
@ -133,9 +133,9 @@ public:
return false;
}
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (uint8 i = 0; i < 15; ++i)
{
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
Player::BoundInstancesMap &binds = player->GetBoundInstances(DifficultyID(i));
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
{
InstanceSave* save = itr->second.save;
@ -143,7 +143,7 @@ public:
{
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
player->UnbindInstance(itr, Difficulty(i));
player->UnbindInstance(itr, DifficultyID(i));
counter++;
}
else

View file

@ -337,7 +337,7 @@ public:
// if the player or the player's group is bound to another instance
// the player will not be bound to another one
InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->GetEntry()));
if (!bind)
{
Group* group = _player->GetGroup();

View file

@ -447,7 +447,7 @@ public:
Field* fields = result->Fetch();
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
for (uint8 i = 0; i < 4; ++i)
cInfo->DifficultyEntry[i] = fields[0 + i].GetUInt32();
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)

View file

@ -112,7 +112,7 @@ public:
//THIS GOB IS A TRAP - What shall i do? =(
//Cast it spell? Copyed Heigan method
floorEruption->SendCustomAnim(floorEruption->GetGoAnimProgress());
floorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
floorEruption->CastSpell(NULL, DifficultyID(instance->GetSpawnMode()) == DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
//Get all immediatly nearby floors
std::list<GameObject*> nearFloorList;

View file

@ -148,7 +148,7 @@ class boss_baltharus_the_warborn : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
{
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
{
if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 1)
DoAction(ACTION_CLONE);

View file

@ -380,7 +380,7 @@ class boss_toc_champion_controller : public CreatureScript
vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
uint8 healersSubtracted = 2;
if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
if (_instance->instance->GetSpawnMode() == DIFFICULTY_25MAN_NORMAL || _instance->instance->GetSpawnMode() == DIFFICULTY_25MAN_HEROIC)
healersSubtracted = 1;
for (uint8 i = 0; i < healersSubtracted; ++i)
{
@ -417,7 +417,7 @@ class boss_toc_champion_controller : public CreatureScript
vHealersEntries.erase(vHealersEntries.begin() + pos);
}
if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
if (_instance->instance->GetSpawnMode() == DIFFICULTY_10MAN_NORMAL || _instance->instance->GetSpawnMode() == DIFFICULTY_10MAN_HEROIC)
for (uint8 i = 0; i < 4; ++i)
vOtherEntries.erase(vOtherEntries.begin() + urand(0, vOtherEntries.size() - 1));

View file

@ -186,19 +186,19 @@ class instance_trial_of_the_crusader : public InstanceMapScript
switch (go->GetEntry())
{
case GO_CRUSADERS_CACHE_10:
if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL)
if (instance->GetSpawnMode() == DIFFICULTY_10MAN_NORMAL)
CrusadersCacheGUID = go->GetGUID();
break;
case GO_CRUSADERS_CACHE_25:
if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL)
if (instance->GetSpawnMode() == DIFFICULTY_25MAN_NORMAL)
CrusadersCacheGUID = go->GetGUID();
break;
case GO_CRUSADERS_CACHE_10_H:
if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
if (instance->GetSpawnMode() == DIFFICULTY_10MAN_HEROIC)
CrusadersCacheGUID = go->GetGUID();
break;
case GO_CRUSADERS_CACHE_25_H:
if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
if (instance->GetSpawnMode() == DIFFICULTY_25MAN_HEROIC)
CrusadersCacheGUID = go->GetGUID();
break;
case GO_ARGENT_COLISEUM_FLOOR:
@ -306,7 +306,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
EventStage = 6000;
uint32 tributeChest = 0;
if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
if (instance->GetSpawnMode() == DIFFICULTY_10MAN_HEROIC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_10H_99;
@ -323,7 +323,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
}
}
else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
else if (instance->GetSpawnMode() == DIFFICULTY_25MAN_HEROIC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_25H_99;

View file

@ -81,7 +81,7 @@ enum Shadowmourne
SPELL_THIRST_QUENCHED = 72154,
};
uint32 const vampireAuras[3][MAX_DIFFICULTY] =
uint32 const vampireAuras[3][4] =
{
{70867, 71473, 71532, 71533},
{70879, 71525, 71530, 71531},

View file

@ -285,7 +285,7 @@ class boss_lady_deathwhisper : public CreatureScript
events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE);
events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE);
events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE);
if (GetDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() != DIFFICULTY_10MAN_NORMAL)
events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000);
Talk(SAY_AGGRO);

View file

@ -1151,7 +1151,7 @@ class spell_sindragosa_frost_breath : public SpellScriptLoader
return;
// Check difficulty and quest status
if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
if (!target->GetMap()->Is25ManRaid() || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
return;
// Check if player has Shadow's Edge equipped and not ready for infusion

View file

@ -77,7 +77,7 @@ public:
hasTaunted = false;
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
{
Position pos;
@ -119,7 +119,7 @@ public:
events.ScheduleEvent(EVENT_LOCUST, 90000);
events.ScheduleEvent(EVENT_BERSERK, 600000);
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000, 20000));
}

View file

@ -200,7 +200,7 @@ class npc_faerlina_add : public CreatureScript
void Reset() OVERRIDE
{
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) {
if (GetDifficulty() == DIFFICULTY_10MAN_NORMAL) {
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_BIND, true);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true);
}
@ -208,7 +208,7 @@ class npc_faerlina_add : public CreatureScript
void JustDied(Unit* /*killer*/) OVERRIDE
{
if (_instance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (_instance && GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FAERLINA)))
DoCast(faerlina, SPELL_WIDOWS_EMBRACE);
}

View file

@ -257,7 +257,7 @@ class boss_gothik : public CreatureScript
void DoGothikSummon(uint32 entry)
{
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
{
switch (entry)
{
@ -420,9 +420,9 @@ class boss_gothik : public CreatureScript
case EVENT_SUMMON:
if (waves[waveCount].entry)
{
if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
if ((waves[waveCount].mode == 2) && (GetDifficulty() == DIFFICULTY_25MAN_NORMAL))
DoGothikSummon(waves[waveCount].entry);
else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
else if ((waves[waveCount].mode == 0) && (GetDifficulty() == DIFFICULTY_10MAN_NORMAL))
DoGothikSummon(waves[waveCount].entry);
else if (waves[waveCount].mode == 1)
DoGothikSummon(waves[waveCount].entry);
@ -443,9 +443,9 @@ class boss_gothik : public CreatureScript
if (waves[waveCount].mode == 1)
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
else if ((waves[waveCount].mode == 2) && (GetDifficulty() == DIFFICULTY_25MAN_NORMAL))
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
else if ((waves[waveCount].mode == 0) && (GetDifficulty() == DIFFICULTY_10MAN_NORMAL))
events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
else
events.ScheduleEvent(EVENT_SUMMON, 0);

View file

@ -439,7 +439,7 @@ public:
events.ScheduleEvent(EVENT_DETONATE, urand(30000, 40000));
events.ScheduleEvent(EVENT_FISSURE, urand(10000, 30000));
events.ScheduleEvent(EVENT_BLAST, urand(60000, 120000));
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_CHAIN, urand(30000, 60000));
Phase = 2;
break;

View file

@ -114,7 +114,7 @@ public:
events.ScheduleEvent(EVENT_BALCONY, 110000);
events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000);
events.ScheduleEvent(EVENT_WARRIOR, 30000);
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_BLINK, urand(20000, 40000));
}
}

View file

@ -402,11 +402,11 @@ class instance_naxxramas : public InstanceMapScript
switch (criteria_id)
{
case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man
if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
if (DifficultyID(instance->GetSpawnMode()) == DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
return true;
return false;
case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man
if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
if (DifficultyID(instance->GetSpawnMode()) == DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
return true;
return false;
// Difficulty checks are done on DB.

View file

@ -402,7 +402,7 @@ public:
{
_summonDeaths = value;
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() ==DIFFICULTY_10MAN_NORMAL)
{
if (_summonDeaths == MAX_SUMMONS_PHASE_TWO_10MAN)
{
@ -410,7 +410,7 @@ public:
DoAction(ACTION_HANDLE_P_THREE_INTRO);
}
}
else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
else if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
{
if (_summonDeaths == MAX_SUMMONS_PHASE_TWO_25MAN)
{
@ -860,7 +860,7 @@ public:
if (_arcaneReinforcements)
{
for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++)
for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++)
{
Creature* casterDiskSummon = me->SummonCreature(NPC_HOVER_DISK_CASTER, RangeHoverDisksSpawnPositions[rangeDisks]);
@ -876,7 +876,7 @@ public:
_arcaneReinforcements = false;
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_DELAYED_REINFORCEMENTS, 1*IN_MILLISECONDS, 0, PHASE_TWO);
}
break;
@ -956,7 +956,7 @@ public:
SetPhase(PHASE_THREE, true);
break;
case EVENT_SURGE_OF_POWER_P_THREE:
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
{
if (Unit* tempSurgeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, false, SPELL_RIDE_RED_DRAGON_BUDDY))
{
@ -973,7 +973,7 @@ public:
}
}
}
else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
else if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
{
memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID));
DoCastAOE(SPELL_SURGE_OF_POWER_WARNING_SELECTOR_25, true);
@ -1005,10 +1005,10 @@ public:
Talk(SAY_DEATH);
if (Creature* alexstraszaGiftBoxBunny = me->GetMap()->GetCreature(instance->GetData64(DATA_GIFT_BOX_BUNNY_GUID)))
{
if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(),
HeartOfMagicSpawnPos.GetPositionZ(), HeartOfMagicSpawnPos.GetOrientation(), 0.0f, 0.0f, 0.0f, 1.0f, 0);
else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
else if (GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_25, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(),
HeartOfMagicSpawnPos.GetPositionZ(), HeartOfMagicSpawnPos.GetOrientation(), 0.0f, 0.0f, 0.0f, 1.0f, 0);
}
@ -1808,10 +1808,10 @@ class spell_malygos_arcane_storm : public SpellScriptLoader
{
// Resize list only to objects that are vehicles.
IsCreatureVehicleCheck check(true);
Skyfire::Containers::RandomResizeList(targets, check, (malygos->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 10));
Skyfire::Containers::RandomResizeList(targets, check, (malygos->GetMap()->GetDifficulty() == DIFFICULTY_10MAN_NORMAL ? 4 : 10));
}
else
Skyfire::Containers::RandomResizeList(targets, (malygos->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 10));
Skyfire::Containers::RandomResizeList(targets, (malygos->GetMap()->GetDifficulty() == DIFFICULTY_10MAN_NORMAL ? 4 : 10));
}
void HandleVisual(SpellEffIndex /*effIndex*/)
@ -2492,9 +2492,9 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader
{
if (Creature* target = GetTarget()->ToCreature())
{
if (target->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (target->GetMap()->GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
_alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_10, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
else if (target->GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
else if (target->GetMap()->GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
_alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_25, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
}
}

View file

@ -105,14 +105,14 @@ public:
platformGUID = go->GetGUID();
break;
case GO_FOCUSING_IRIS_10:
if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (instance->GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
{
irisGUID = go->GetGUID();
go->GetPosition(&focusingIrisPosition);
}
break;
case GO_FOCUSING_IRIS_25:
if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (instance->GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
{
irisGUID = go->GetGUID();
go->GetPosition(&focusingIrisPosition);
@ -123,11 +123,11 @@ public:
go->GetPosition(&exitPortalPosition);
break;
case GO_HEART_OF_MAGIC_10:
if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
if (instance->GetDifficulty() == DIFFICULTY_10MAN_NORMAL)
heartOfMagicGUID = go->GetGUID();
break;
case GO_HEART_OF_MAGIC_25:
if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
if (instance->GetDifficulty() == DIFFICULTY_25MAN_NORMAL)
heartOfMagicGUID = go->GetGUID();
break;
}
@ -253,7 +253,7 @@ public:
PowerSparksHandling();
break;
case DATA_RESPAWN_IRIS:
SpawnGameObject(instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? GO_FOCUSING_IRIS_10 : GO_FOCUSING_IRIS_25, focusingIrisPosition);
SpawnGameObject(instance->GetDifficulty() == DIFFICULTY_10MAN_NORMAL ? GO_FOCUSING_IRIS_10 : GO_FOCUSING_IRIS_25, focusingIrisPosition);
break;
}
}

View file

@ -458,10 +458,10 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader
switch (target->GetMap()->GetDifficulty())
{
case RAID_DIFFICULTY_10MAN_NORMAL:
case DIFFICULTY_10MAN_NORMAL:
target->RemoveAura(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
break;
case RAID_DIFFICULTY_25MAN_NORMAL:
case DIFFICULTY_25MAN_NORMAL:
target->RemoveAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue());
break;
default:
@ -538,7 +538,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader
if (!GetOwner()->ToCreature())
return;
uint32 rubbleStalkerEntry = (GetOwner()->GetMap()->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? 33809 : 33942);
uint32 rubbleStalkerEntry = (GetOwner()->GetMap()->GetDifficulty() == DIFFICULTY_NORMAL ? 33809 : 33942);
Creature* rubbleStalker = GetOwner()->FindNearestCreature(rubbleStalkerEntry, 200.0f, true);
if (rubbleStalker)
rubbleStalker->CastSpell(rubbleStalker, SPELL_STONE_GRIP_CANCEL, true);

View file

@ -240,7 +240,7 @@ class boss_razorscale_controller : public CreatureScript
{
case ACTION_HARPOON_BUILD:
events.ScheduleEvent(EVENT_BUILD_HARPOON_1, 50000);
if (me->GetMap()->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL)
if (me->GetMap()->GetSpawnMode() == DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_BUILD_HARPOON_3, 90000);
break;
case ACTION_PLACE_BROKEN_HARPOON:

View file

@ -75,9 +75,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// Start LoginQueryHolder content
PrepareStatement(CHAR_SEL_CHARACTER, "SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeondifficulty, "
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, lfgbonusfaction "
"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, lfgbonusfaction, raiddifficulty "
"FROM characters WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH);
@ -384,16 +384,16 @@ void CharacterDatabaseConnection::DoPrepareStatements()
// Player saving
PrepareStatement(CHAR_INS_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, "
"map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, "
"map, instance_id, dungeondifficulty,raiddifficulty, position_x, position_y, position_z, orientation, "
"taximask, cinematic, "
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, talentTree, "
"extra_flags, stable_slots, at_login, zone, "
"death_expire_time, taxi_path, totalKills, "
"todayKills, yesterdayKills, chosenTitle, watchedFaction, lfgbonusfaction, drunk, health, power1, power2, power3, "
"power4, power5, latency, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels) VALUES "
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?,"
"map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
"map=?,instance_id=?,dungeondifficulty=?,raiddifficulty=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
"logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,talentTree=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
"totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,"
"watchedFaction=?,lfgbonusfaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,latency=?,speccount=?,activespec=?,exploredZones=?,"