mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[8831] Helper function add and move for diffficulties.
* Use regular naming for 0 spwanmode/difficulty for clean consistence names (used at well known wiki) * Move difficulty related data access from InstancedMap to Map class.
This commit is contained in:
parent
fe1fae46ee
commit
398ca010ca
6 changed files with 33 additions and 30 deletions
|
|
@ -923,7 +923,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//FIXME: work only for instances where max==min for players
|
//FIXME: work only for instances where max==min for players
|
||||||
if(((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
|
if (map->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit)
|
||||||
continue;
|
continue;
|
||||||
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ enum AreaFlags
|
||||||
|
|
||||||
enum Difficulty
|
enum Difficulty
|
||||||
{
|
{
|
||||||
DIFFICULTY_DEFAULT = 0,
|
REGULAR_DEFAULT = 0,
|
||||||
|
|
||||||
DUNGEON_DIFFICULTY_NORMAL = 0,
|
DUNGEON_DIFFICULTY_NORMAL = 0,
|
||||||
DUNGEON_DIFFICULTY_HEROIC = 1,
|
DUNGEON_DIFFICULTY_HEROIC = 1,
|
||||||
|
|
@ -251,7 +251,7 @@ enum Difficulty
|
||||||
|
|
||||||
enum SpawnMask
|
enum SpawnMask
|
||||||
{
|
{
|
||||||
SPAWNMASK_CONTINENT = (1 << DIFFICULTY_DEFAULT),// any any maps without spawn modes
|
SPAWNMASK_REGULAR = (1 << REGULAR_DEFAULT), // any any maps without spawn modes (continents/subway) or in minimal spawnmode
|
||||||
|
|
||||||
SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL),
|
SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL),
|
||||||
SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC),
|
SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC),
|
||||||
|
|
|
||||||
|
|
@ -1127,6 +1127,23 @@ void Map::UnloadAll(bool pForce)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MapDifficulty const* Map::GetMapDifficulty() const
|
||||||
|
{
|
||||||
|
return GetMapDifficultyData(GetId(),GetDifficulty());
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 Map::GetMaxPlayers() const
|
||||||
|
{
|
||||||
|
MapDifficulty const* mapDiff = GetMapDifficulty();
|
||||||
|
return mapDiff ? mapDiff->maxPlayers : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 Map::GetMaxResetDelay() const
|
||||||
|
{
|
||||||
|
MapDifficulty const* mapDiff = GetMapDifficulty();
|
||||||
|
return mapDiff ? mapDiff->resetTime : 0;
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************
|
//*****************************
|
||||||
// Grid function
|
// Grid function
|
||||||
//*****************************
|
//*****************************
|
||||||
|
|
@ -2618,24 +2635,6 @@ void InstanceMap::SetResetSchedule(bool on)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapDifficulty const* InstanceMap::GetMapDifficulty() const
|
|
||||||
{
|
|
||||||
return GetMapDifficultyData(GetId(),GetDifficulty());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 InstanceMap::GetMaxPlayers() const
|
|
||||||
{
|
|
||||||
MapDifficulty const* mapDiff = GetMapDifficulty();
|
|
||||||
return mapDiff ? mapDiff->maxPlayers : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 InstanceMap::GetMaxResetDelay() const
|
|
||||||
{
|
|
||||||
MapDifficulty const* mapDiff = GetMapDifficulty();
|
|
||||||
return mapDiff ? mapDiff->resetTime : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ******* Battleground Instance Maps ******* */
|
/* ******* Battleground Instance Maps ******* */
|
||||||
|
|
||||||
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
|
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
|
||||||
|
|
|
||||||
|
|
@ -362,10 +362,20 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||||
bool CheckGridIntegrity(Creature* c, bool moved) const;
|
bool CheckGridIntegrity(Creature* c, bool moved) const;
|
||||||
|
|
||||||
uint32 GetInstanceId() const { return i_InstanceId; }
|
uint32 GetInstanceId() const { return i_InstanceId; }
|
||||||
uint8 GetSpawnMode() const { return (i_spawnMode); }
|
|
||||||
virtual bool CanEnter(Player* /*player*/) { return true; }
|
virtual bool CanEnter(Player* /*player*/) { return true; }
|
||||||
const char* GetMapName() const;
|
const char* GetMapName() const;
|
||||||
|
|
||||||
|
// have meaning only for instanced map (that have set real difficulty), NOT USE its for BaseMap
|
||||||
|
// _currently_ spawnmode == difficulty, but this can be changes later, so use appropriate spawmmode/difficult functions
|
||||||
|
// for simplify later code support
|
||||||
|
// regular difficulty = continent/dungeon normal/first raid normal difficulty
|
||||||
|
uint8 GetSpawnMode() const { return (i_spawnMode); }
|
||||||
|
Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
|
||||||
|
bool IsRegularDifficulty() const { return GetDifficulty() == REGULAR_DEFAULT; }
|
||||||
|
uint32 GetMaxPlayers() const; // dependent from map difficulty
|
||||||
|
uint32 GetMaxResetDelay() const; // dependent from map difficulty
|
||||||
|
MapDifficulty const* GetMapDifficulty() const; // dependent from map difficulty
|
||||||
|
|
||||||
bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
|
bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
|
||||||
// NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable
|
// NOTE: this duplicate of Instanceable(), but Instanceable() can be changed when BG also will be instanceable
|
||||||
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
|
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
|
||||||
|
|
@ -597,12 +607,6 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
|
||||||
void SendResetWarnings(uint32 timeLeft) const;
|
void SendResetWarnings(uint32 timeLeft) const;
|
||||||
void SetResetSchedule(bool on);
|
void SetResetSchedule(bool on);
|
||||||
|
|
||||||
// have meaning only for instanced map (that have set real difficulty)
|
|
||||||
Difficulty GetDifficulty() const { return Difficulty(GetSpawnMode()); }
|
|
||||||
uint32 GetMaxPlayers() const;
|
|
||||||
uint32 GetMaxResetDelay() const;
|
|
||||||
MapDifficulty const* GetMapDifficulty() const;
|
|
||||||
|
|
||||||
virtual void InitVisibilityDistance();
|
virtual void InitVisibilityDistance();
|
||||||
private:
|
private:
|
||||||
bool m_resetAfterUnload;
|
bool m_resetAfterUnload;
|
||||||
|
|
|
||||||
|
|
@ -2319,7 +2319,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
if (m_target->GetMap()->IsDungeon())
|
if (m_target->GetMap()->IsDungeon())
|
||||||
{
|
{
|
||||||
uint32 spellId = ((InstanceMap*)m_target->GetMap())->GetDifficulty() == DIFFICULTY_DEFAULT ? 44190 : 46163;
|
uint32 spellId = m_target->GetMap()->IsRegularDifficulty() ? 44190 : 46163;
|
||||||
|
|
||||||
m_target->CastSpell(m_target, spellId, true, NULL, this);
|
m_target->CastSpell(m_target, spellId, true, NULL, this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8830"
|
#define REVISION_NR "8831"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue