Core/Datastores: refactor DBC storage helpers to use a class and fixed no pch build

This commit is contained in:
Ovahlord committed 2020-03-18 15:24:25 +01:00
1 parent 7797c6a0ad
commit f1f00c3ec3
43 files changed
+461 -461

No files matched your search

@@ -1482,8 +1482,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId);
if (!phase)
if (!sPhaseStore.LookupEntry(phaseId))
{
TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_ID uses invalid phaseid %u for creature %u, skipped", phaseId, e.entryOrGuid);
return false;
@@ -1501,7 +1500,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
if (!phaseGroup && GetPhasesForGroup(phaseGroup))
if (!sDBCManager.GetPhasesForGroup(phaseGroup))
{
TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_SET_INGAME_PHASE_GROUP uses invalid phase group id %u for creature %u, skipped", phaseGroup, e.entryOrGuid);
return false;
@@ -924,7 +924,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid
if (it != bgDataStore.end())
{
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->getLevel());
if (bracketEntry)
{
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
@@ -818,7 +818,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
return;
}
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id);
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id);
if (!bracketEntry)
{
TC_LOG_ERROR("bg.battleground", "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id);
+4 -4
View File
@@ -137,11 +137,11 @@ void LoadDisables()
break;
case MAP_INSTANCE:
case MAP_RAID:
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
if (flags & DUNGEON_STATUSFLAG_HEROIC && !sDBCManager.GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
flags -= DUNGEON_STATUSFLAG_HEROIC;
if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !sDBCManager.GetMapDifficultyData(entry, RAID_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 && !sDBCManager.GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
flags -= RAID_STATUSFLAG_25MAN_HEROIC;
if (!flags)
isFlagInvalid = true;
@@ -355,7 +355,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
{
uint8 disabledModes = itr->second.flags;
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
GetDownscaledMapDifficultyData(entry, targetDifficulty);
sDBCManager.GetDownscaledMapDifficultyData(entry, targetDifficulty);
switch (targetDifficulty)
{
case DUNGEON_DIFFICULTY_NORMAL:
+6
View File
@@ -34,6 +34,12 @@ DB2Storage<KeyChainEntry> sKeyChainStore("KeyChain.db2", KeyChainfmt,
typedef std::list<std::string> DB2StoreProblemList;
DB2Manager& DB2Manager::Instance()
{
static DB2Manager instance;
return instance;
}
uint32 DB2FilesCount = 0;
template<class T>
+1 -5
View File
@@ -44,11 +44,7 @@ class TC_GAME_API DB2Manager
public:
typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap;
static DB2Manager& Instance()
{
static DB2Manager instance;
return instance;
}
static DB2Manager& Instance();
void LoadStores(std::string const& dataPath);
DB2StorageBase const* GetStorage(uint32 type) const;
+39 -286
View File
@@ -268,6 +268,12 @@ typedef std::list<std::string> StoreProblemList;
uint32 DBCFileCount = 0;
DBCManager& DBCManager::Instance()
{
static DBCManager instance;
return instance;
}
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename)
{
TC_LOG_ERROR("misc", "Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
@@ -320,7 +326,7 @@ inline void LoadDBC(uint32& availableDbcLocales, StoreProblemList& errors, DBCSt
}
}
void LoadDBCStores(const std::string& dataPath)
void DBCManager::LoadStores(const std::string& dataPath)
{
uint32 oldMSTime = getMSTime();
@@ -800,12 +806,12 @@ void LoadDBCStores(const std::string& dataPath)
TC_LOG_INFO("server.loading", ">> Initialized %d DBC data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
}
std::string const& GetRandomCharacterName(uint8 race, uint8 gender)
std::string const& DBCManager::GetRandomCharacterName(uint8 race, uint8 gender)
{
return Trinity::Containers::SelectRandomContainerElement(sGenNameVectoArraysMap[race].stringVectorArray[gender]);
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
SimpleFactionsList const* DBCManager::GetFactionTeamList(uint32 faction)
{
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
if (itr != sFactionTeamMap.end())
@@ -814,7 +820,7 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction)
return nullptr;
}
char const* GetPetName(uint32 petfamily, uint32 /*dbclang*/)
char const* DBCManager::GetPetName(uint32 petfamily, uint32 /*dbclang*/)
{
if (!petfamily)
return nullptr;
@@ -824,7 +830,7 @@ char const* GetPetName(uint32 petfamily, uint32 /*dbclang*/)
return pet_family->Name ? pet_family->Name : nullptr;
}
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
TalentSpellPos const* DBCManager::GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if (itr == sTalentSpellPosMap.end())
@@ -833,7 +839,7 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
return &itr->second;
}
uint32 GetTalentSpellCost(uint32 spellId)
uint32 DBCManager::GetTalentSpellCost(uint32 spellId)
{
if (TalentSpellPos const* pos = GetTalentSpellPos(spellId))
return pos->rank+1;
@@ -841,7 +847,7 @@ uint32 GetTalentSpellCost(uint32 spellId)
return 0;
}
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
WMOAreaTableEntry const* DBCManager::GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
{
auto i = sWMOAreaInfoByTripple.find(WMOAreaTableKey(int16(rootid), int8(adtid), groupid));
if (i != sWMOAreaInfoByTripple.end())
@@ -850,19 +856,19 @@ WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid
return nullptr;
}
char const* GetRaceName(uint8 race, uint8 /*locale*/)
char const* DBCManager::GetRaceName(uint8 race, uint8 /*locale*/)
{
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race);
return raceEntry ? raceEntry->Name : nullptr;
}
char const* GetClassName(uint8 class_, uint8 /*locale*/)
char const* DBCManager::GetClassName(uint8 class_, uint8 /*locale*/)
{
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
return classEntry ? classEntry->Name : nullptr;
}
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
uint32 DBCManager::GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases
return mapid;
@@ -873,7 +879,7 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
return mapid;
}
uint32 GetMaxLevelForExpansion(uint32 expansion)
uint32 DBCManager::GetMaxLevelForExpansion(uint32 expansion)
{
switch (expansion)
{
@@ -895,7 +901,7 @@ uint32 GetMaxLevelForExpansion(uint32 expansion)
Used only for calculate xp gain by content lvl.
Calculation on Gilneas and group maps of LostIslands calculated as CONTENT_1_60.
*/
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
ContentLevels DBCManager::GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid, zoneId);
if (mapid < 2)
@@ -919,7 +925,7 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
}
}
bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
bool DBCManager::IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
if (requiredTotemCategoryId == 0)
return true;
@@ -939,7 +945,7 @@ bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTo
return (itemEntry->TotemCategoryMask & reqEntry->TotemCategoryMask) == reqEntry->TotemCategoryMask;
}
void Zone2MapCoordinates(float& x, float& y, uint32 zone)
void DBCManager::Zone2MapCoordinates(float& x, float& y, uint32 zone)
{
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
@@ -952,7 +958,7 @@ void Zone2MapCoordinates(float& x, float& y, uint32 zone)
y = y * ((maEntry->LocRight - maEntry->LocLeft) / 100) + maEntry->LocLeft; // client y coord from top to down
}
void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
void DBCManager::Map2ZoneCoordinates(float& x, float& y, uint32 zone)
{
WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);
@@ -965,13 +971,13 @@ void Map2ZoneCoordinates(float& x, float& y, uint32 zone)
std::swap(x, y); // client have map coords swapped
}
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
MapDifficulty const* DBCManager::GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
{
MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId, difficulty));
return itr != sMapDifficultyMap.end() ? &itr->second : nullptr;
}
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
MapDifficulty const* DBCManager::GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
uint32 tmpDiff = difficulty;
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
@@ -995,7 +1001,7 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
return mapDiff;
}
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
PvPDifficultyEntry const* DBCManager::GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
{
PvPDifficultyEntry const* maxEntry = nullptr; // used for level > max listed level case
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
@@ -1019,7 +1025,7 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
return maxEntry;
}
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
PvPDifficultyEntry const* DBCManager::GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
{
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
@@ -1029,12 +1035,12 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundB
return nullptr;
}
uint32 const* GetTalentTabPages(uint8 cls)
uint32 const* DBCManager::GetTalentTabPages(uint8 cls)
{
return sTalentTabPages[cls];
}
std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree)
std::vector<uint32> const* DBCManager::GetTalentTreePrimarySpells(uint32 talentTree)
{
TalentTreePrimarySpellsMap::const_iterator itr = sTalentTreePrimarySpellsMap.find(talentTree);
if (itr == sTalentTreePrimarySpellsMap.end())
@@ -1043,7 +1049,7 @@ std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree)
return &itr->second;
}
uint32 GetLiquidFlags(uint32 liquidType)
uint32 DBCManager::GetLiquidFlags(uint32 liquidType)
{
if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquidType))
return 1 << liq->SoundBank;
@@ -1051,7 +1057,7 @@ uint32 GetLiquidFlags(uint32 liquidType)
return 0;
}
CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender)
CharStartOutfitEntry const* DBCManager::GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender)
{
std::map<uint32, CharStartOutfitEntry const*>::const_iterator itr = sCharStartOutfitMap.find(race | (class_ << 8) | (gender << 16));
if (itr == sCharStartOutfitMap.end())
@@ -1060,7 +1066,7 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui
return itr->second;
}
CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color)
CharSectionsEntry const* DBCManager::GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color)
{
std::pair<CharSectionsMap::const_iterator, CharSectionsMap::const_iterator> eqr = sCharSectionMap.equal_range(uint32(genType) | uint32(gender << 8) | uint32(race << 16));
for (CharSectionsMap::const_iterator itr = eqr.first; itr != eqr.second; ++itr)
@@ -1072,7 +1078,7 @@ CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType
return nullptr;
}
uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId)
uint32 DBCManager::GetPowerIndexByClass(uint32 powerType, uint32 classId)
{
return PowersByClass[classId][powerType];
}
@@ -1230,7 +1236,7 @@ uint32 ScalingStatValuesEntry::GetDPSAndDamageMultiplier(uint32 subClass, bool i
}
/// 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* DBCManager::GetLFGDungeon(uint32 mapId, Difficulty difficulty)
{
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
{
@@ -1245,7 +1251,7 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty)
return nullptr;
}
uint32 GetDefaultMapLight(uint32 mapId)
uint32 DBCManager::GetDefaultMapLight(uint32 mapId)
{
for (int32 i = sLightStore.GetNumRows(); i >= 0; --i)
{
@@ -1260,7 +1266,7 @@ uint32 GetDefaultMapLight(uint32 mapId)
return 0;
}
SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_)
SkillRaceClassInfoEntry const* DBCManager::GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_)
{
SkillRaceClassInfoBounds bounds = SkillRaceClassInfoBySkill.equal_range(skill);
for (SkillRaceClassInfoMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
@@ -1276,7 +1282,7 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u
return nullptr;
}
std::vector<uint32> const* GetPhasesForGroup(uint32 group)
std::vector<uint32> const* DBCManager::GetPhasesForGroup(uint32 group)
{
auto itr = sPhasesByGroup.find(group);
if (itr != sPhasesByGroup.end())
@@ -1284,7 +1290,7 @@ std::vector<uint32> const* GetPhasesForGroup(uint32 group)
return nullptr;
}
ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale)
ResponseCodes DBCManager::ValidateName(std::wstring const& name, LocaleConstant locale)
{
if (locale >= TOTAL_LOCALES)
return RESPONSE_FAILURE;
@@ -1301,13 +1307,13 @@ ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale)
return CHAR_NAME_SUCCESS;
}
EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender)
EmotesTextSoundEntry const* DBCManager::FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender)
{
auto itr = sEmotesTextSoundMap.find(EmotesTextSoundKey(emote, race, gender));
return itr != sEmotesTextSoundMap.end() ? itr->second : nullptr;
}
uint32 GetParentSpellCategoryId(uint32 childCategory)
uint32 DBCManager::GetParentSpellCategoryId(uint32 childCategory)
{
// Weekly profession reset linking
switch (childCategory)
@@ -1324,7 +1330,7 @@ uint32 GetParentSpellCategoryId(uint32 childCategory)
return 0;
}
bool IsInArea(uint32 objectAreaId, uint32 areaId)
bool DBCManager::IsInArea(uint32 objectAreaId, uint32 areaId)
{
do
{
@@ -1340,256 +1346,3 @@ bool IsInArea(uint32 objectAreaId, uint32 areaId)
return false;
}
uint32 ItemTemplate::GetEffectiveArmor(Player const* owner) const
{
if (GetQuality() > ITEM_QUALITY_ARTIFACT)
return 0;
uint32 level = GetBaseItemLevel();
if (owner)
{
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (maxItemLevel != 0 && level > maxItemLevel)
level = maxItemLevel;
}
if (GetClass() != ITEM_CLASS_ARMOR || GetSubClass() != ITEM_SUBCLASS_ARMOR_SHIELD)
{
ItemArmorQualityEntry const* armorQuality = sItemArmorQualityStore.LookupEntry(level);
ItemArmorTotalEntry const* armorTotal = sItemArmorTotalStore.LookupEntry(level);
if (!armorQuality || !armorTotal)
return 0;
uint32 invType = GetInventoryType();
if (invType == INVTYPE_ROBE)
invType = INVTYPE_CHEST;
ArmorLocationEntry const* location = sArmorLocationStore.LookupEntry(invType);
if (!location)
return 0;
if (GetSubClass() < ITEM_SUBCLASS_ARMOR_CLOTH || GetSubClass() > ITEM_SUBCLASS_ARMOR_PLATE)
return 0;
return uint32(armorQuality->Qualitymod[GetQuality()] * armorTotal->Value[GetSubClass() - ITEM_SUBCLASS_ARMOR_CLOTH] * location->Value[GetSubClass() - ITEM_SUBCLASS_ARMOR_CLOTH] + 0.5f);
}
ItemArmorShieldEntry const* shield = sItemArmorShieldStore.LookupEntry(level);
if (!shield)
return 0;
return uint32(shield->Quality[GetQuality()] + 0.5f);
}
bool ItemTemplate::GetWeaponDamage(Player const* owner, float& minValue, float& maxValue, float& dps) const
{
minValue = maxValue = 0.0f;
if (GetClass() != ITEM_CLASS_WEAPON || GetQuality() > ITEM_QUALITY_ARTIFACT)
return false;
uint32 level = GetBaseItemLevel();
if (owner)
{
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (maxItemLevel != 0 && level > maxItemLevel)
level = maxItemLevel;
}
DBCStorage<ItemDamageEntry>* store = nullptr;
switch (GetInventoryType())
{
case INVTYPE_AMMO:
store = &sItemDamageAmmoStore;
break;
case INVTYPE_2HWEAPON:
if (GetFlags2() & ITEM_FLAG2_CASTER_WEAPON)
store = &sItemDamageTwoHandCasterStore;
else
store = &sItemDamageTwoHandStore;
break;
case INVTYPE_RANGED:
case INVTYPE_THROWN:
case INVTYPE_RANGEDRIGHT:
switch (GetSubClass())
{
case ITEM_SUBCLASS_WEAPON_WAND:
store = &sItemDamageWandStore;
break;
case ITEM_SUBCLASS_WEAPON_THROWN:
store = &sItemDamageThrownStore;
break;
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
store = &sItemDamageRangedStore;
break;
default:
return false;
}
break;
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
if (GetFlags2() & ITEM_FLAG2_CASTER_WEAPON)
store = &sItemDamageOneHandCasterStore;
else
store = &sItemDamageOneHandStore;
break;
default:
return false;
}
if (!store)
return false;
ItemDamageEntry const* damageInfo = store->LookupEntry(level);
if (!damageInfo)
return false;
dps = damageInfo->Quality[GetQuality()];
float avgDamage = GetDelay() * damageInfo->Quality[GetQuality()] * 0.001f;
float scaled_stat = std::floor((GetStatScalingFactor() * 0.5f + 1.f) * avgDamage + 0.5f);
if (GetDelay() && GetArmorDamageModifier() != 0.f)
{
float invMsDelay = 1000.0f / float(GetDelay());
float v16 = (invMsDelay * ((1.f - (GetStatScalingFactor() * 0.5f)) * avgDamage)) + GetArmorDamageModifier();
v16 = std::max(v16, 1.f);
minValue = (1.0f / invMsDelay) * v16;
maxValue = (1.0f / invMsDelay) * (((1000.f / float(GetDelay())) * scaled_stat) + GetArmorDamageModifier());
}
else
{
maxValue = scaled_stat;
minValue = (1.f - (GetStatScalingFactor() * 0.5f)) * avgDamage;
}
return true;
}
uint32 GetItemScalingModifier(uint32 maxIlvl, ItemQualities quality, InventoryType invType)
{
// Believe it or not, yes
uint32 suffixFactor = -1;
switch (invType)
{
// Items of that type don`t have points
case INVTYPE_NON_EQUIP:
case INVTYPE_BAG:
case INVTYPE_TABARD:
case INVTYPE_AMMO:
case INVTYPE_QUIVER:
case INVTYPE_RELIC:
break;
// Select point coefficient
case INVTYPE_HEAD:
case INVTYPE_BODY:
case INVTYPE_CHEST:
case INVTYPE_LEGS:
case INVTYPE_2HWEAPON:
case INVTYPE_ROBE:
suffixFactor = 0;
break;
case INVTYPE_SHOULDERS:
case INVTYPE_WAIST:
case INVTYPE_FEET:
case INVTYPE_HANDS:
case INVTYPE_TRINKET:
suffixFactor = 1;
break;
case INVTYPE_NECK:
case INVTYPE_WRISTS:
case INVTYPE_FINGER:
case INVTYPE_SHIELD:
case INVTYPE_CLOAK:
case INVTYPE_HOLDABLE:
suffixFactor = 2;
break;
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
suffixFactor = 3;
break;
case INVTYPE_RANGED:
case INVTYPE_THROWN:
case INVTYPE_RANGEDRIGHT:
suffixFactor = 4;
break;
}
if (suffixFactor > 4)
return 0;
RandomPropertiesPointsEntry const* randPropEntry = sRandomPropertiesPointsStore.LookupEntry(maxIlvl);
if (!randPropEntry)
return 0;
switch (quality)
{
case ITEM_QUALITY_UNCOMMON:
return randPropEntry->UncommonPropertiesPoints[suffixFactor];
case ITEM_QUALITY_RARE:
return randPropEntry->RarePropertiesPoints[suffixFactor];
case ITEM_QUALITY_EPIC:
case ITEM_QUALITY_LEGENDARY:
return randPropEntry->EpicPropertiesPoints[suffixFactor];
default:
return 0;
}
return 0;
}
uint32 ItemTemplate::GetStatValue(uint32 index, Player const* owner /*= nullptr*/) const
{
if (!owner)
return GetItemStatValue(index);
ScalingStatDistributionEntry const* ssd = GetScalingStatDistribution() ? sScalingStatDistributionStore.LookupEntry(GetScalingStatDistribution()) : nullptr;
// req. check at equip, but allow use for extended range if range limit max level, set proper level
uint32 ssdLevel = owner->getLevel();
if (ssd && ssdLevel > ssd->Maxlevel)
ssdLevel = ssd->Maxlevel;
if (ssd && ssdLevel < ssd->Minlevel)
ssdLevel = ssd->Minlevel;
if (ssdLevel < 1)
ssdLevel = 1;
ScalingStatValuesEntry const* ssv = ssd ? sScalingStatValuesStore.LookupEntry(ssdLevel) : nullptr;
uint32 statBaseValue = 0;
if (ssd && ssv)
{
if (ssd->StatID[index] < 0)
return 0; // What do we do ?
statBaseValue = ssv->GetStatMultiplier(GetInventoryType()) * ssd->Bonus[index] / 10000;
}
else
{
statBaseValue = GetItemStatValue(index);
uint32 itemLevel = GetBaseItemLevel();
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (!maxItemLevel || maxItemLevel >= itemLevel) // TODO: This might work if >=. Check.
return statBaseValue;
float minScaler = GetItemScalingModifier(GetBaseItemLevel(), ItemQualities(GetQuality()), ::InventoryType(GetInventoryType()));
float maxScaler = GetItemScalingModifier(maxItemLevel, ItemQualities(GetQuality()), ::InventoryType(GetInventoryType()));
if (maxScaler != 0.f && minScaler != 0.f)
{
float statAllocation = GetItemStatAllocation(index) * maxScaler * 0.0001f;
return std::ceil(statAllocation - ((maxScaler / minScaler) * GetItemStatSocketCostMultiplier(index)));
}
}
return statBaseValue;
}
+42 -54
View File
@@ -33,62 +33,9 @@ enum LocaleConstant : uint8;
#endif
typedef std::list<uint32> SimpleFactionsList;
TC_GAME_API SimpleFactionsList const* GetFactionTeamList(uint32 faction);
TC_GAME_API char const* GetPetName(uint32 petfamily, uint32 dbclang);
TC_GAME_API uint32 GetTalentSpellCost(uint32 spellId);
TC_GAME_API TalentSpellPos const* GetTalentSpellPos(uint32 spellId);
TC_GAME_API char const* GetRaceName(uint8 race, uint8 locale);
TC_GAME_API char const* GetClassName(uint8 class_, uint8 locale);
TC_GAME_API WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid);
TC_GAME_API uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
std::string const& GetRandomCharacterName(uint8 race, uint8 gender);
uint32 GetMaxLevelForExpansion(uint32 expansion);
TC_GAME_API ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
TC_GAME_API bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
TC_GAME_API void Zone2MapCoordinates(float &x, float &y, uint32 zone);
TC_GAME_API void Map2ZoneCoordinates(float &x, float &y, uint32 zone);
typedef std::map<uint32/*pair32(map, diff)*/, MapDifficulty> MapDifficultyMap;
TC_GAME_API MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
TC_GAME_API MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
TC_GAME_API uint32 const* /*[MAX_TALENT_TABS]*/ GetTalentTabPages(uint8 cls);
std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree);
TC_GAME_API uint32 GetLiquidFlags(uint32 liquidType);
TC_GAME_API PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
TC_GAME_API PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
TC_GAME_API CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender);
TC_GAME_API CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color);
uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId);
TC_GAME_API bool IsInArea(uint32 objectAreaId, uint32 areaId);
TC_GAME_API LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty);
uint32 GetDefaultMapLight(uint32 mapId);
TC_GAME_API std::vector<uint32> const* GetPhasesForGroup(uint32 group);
typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoMap;
typedef std::pair<SkillRaceClassInfoMap::iterator, SkillRaceClassInfoMap::iterator> SkillRaceClassInfoBounds;
TC_GAME_API SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_);
TC_GAME_API ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale);
TC_GAME_API EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender);
TC_GAME_API uint32 GetParentSpellCategoryId(uint32 childCategory);
TC_GAME_API extern DBCStorage <AchievementEntry> sAchievementStore;
TC_GAME_API extern DBCStorage <AnimKitEntry> sAnimKitStore;
@@ -261,6 +208,47 @@ TC_GAME_API extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore;
TC_GAME_API extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
TC_GAME_API extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
TC_GAME_API void LoadDBCStores(const std::string& dataPath);
class TC_GAME_API DBCManager
{
public:
static DBCManager& Instance();
void LoadStores(const std::string& dataPath);
SimpleFactionsList const* GetFactionTeamList(uint32 faction);
static char const* GetPetName(uint32 petfamily, uint32 dbclang);
uint32 GetTalentSpellCost(uint32 spellId);
TalentSpellPos const* GetTalentSpellPos(uint32 spellId);
static char const* GetRaceName(uint8 race, uint8 locale);
static char const* GetClassName(uint8 class_, uint8 locale);
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid);
static uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId);
std::string const& GetRandomCharacterName(uint8 race, uint8 gender);
static uint32 GetMaxLevelForExpansion(uint32 expansion);
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
void Zone2MapCoordinates(float &x, float &y, uint32 zone);
void Map2ZoneCoordinates(float &x, float &y, uint32 zone);
MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty);
MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty);
uint32 const* /*[MAX_TALENT_TABS]*/ GetTalentTabPages(uint8 cls);
std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree);
static uint32 GetLiquidFlags(uint32 liquidType);
static uint32 GetDefaultMapLight(uint32 mapId);
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender);
CharSectionsEntry const* GetCharSectionEntry(uint8 race, CharSectionType genType, uint8 gender, uint8 type, uint8 color);
uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId);
static bool IsInArea(uint32 objectAreaId, uint32 areaId);
static LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty);
std::vector<uint32> const* GetPhasesForGroup(uint32 group);
SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_);
ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale);
EmotesTextSoundEntry const* FindTextSoundEmoteFor(uint32 emote, uint32 race, uint32 gender);
static uint32 GetParentSpellCategoryId(uint32 childCategory);
};
#define sDBCManager DBCManager::Instance()
#endif
@@ -1783,7 +1783,7 @@ float Creature::GetAttackDistance(Unit const* player) const
float maxRadius = (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO));
float minRadius = (5.0f * sWorld->getRate(RATE_CREATURE_AGGRO));
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
uint8 expansionMaxLevel = uint8(GetMaxLevelForExpansion(GetCreatureTemplate()->expansion));
uint8 expansionMaxLevel = uint8(DBCManager::GetMaxLevelForExpansion(GetCreatureTemplate()->expansion));
uint32 playerLevel = player->getLevel();
uint32 creatureLevel = getLevel();
@@ -17,6 +17,7 @@
#include "DBCStores.h"
#include "DB2Stores.h"
#include "Player.h"
#include "World.h"
#include "ItemTemplate.h"
@@ -111,3 +112,255 @@ uint32 ItemTemplate::GetSkill() const
return 0;
}
}
uint32 GetItemScalingModifier(uint32 maxIlvl, ItemQualities quality, InventoryType invType)
{
// Believe it or not, yes
uint32 suffixFactor = -1;
switch (invType)
{
// Items of that type don`t have points
case INVTYPE_NON_EQUIP:
case INVTYPE_BAG:
case INVTYPE_TABARD:
case INVTYPE_AMMO:
case INVTYPE_QUIVER:
case INVTYPE_RELIC:
break;
// Select point coefficient
case INVTYPE_HEAD:
case INVTYPE_BODY:
case INVTYPE_CHEST:
case INVTYPE_LEGS:
case INVTYPE_2HWEAPON:
case INVTYPE_ROBE:
suffixFactor = 0;
break;
case INVTYPE_SHOULDERS:
case INVTYPE_WAIST:
case INVTYPE_FEET:
case INVTYPE_HANDS:
case INVTYPE_TRINKET:
suffixFactor = 1;
break;
case INVTYPE_NECK:
case INVTYPE_WRISTS:
case INVTYPE_FINGER:
case INVTYPE_SHIELD:
case INVTYPE_CLOAK:
case INVTYPE_HOLDABLE:
suffixFactor = 2;
break;
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
suffixFactor = 3;
break;
case INVTYPE_RANGED:
case INVTYPE_THROWN:
case INVTYPE_RANGEDRIGHT:
suffixFactor = 4;
break;
}
if (suffixFactor > 4)
return 0;
RandomPropertiesPointsEntry const* randPropEntry = sRandomPropertiesPointsStore.LookupEntry(maxIlvl);
if (!randPropEntry)
return 0;
switch (quality)
{
case ITEM_QUALITY_UNCOMMON:
return randPropEntry->UncommonPropertiesPoints[suffixFactor];
case ITEM_QUALITY_RARE:
return randPropEntry->RarePropertiesPoints[suffixFactor];
case ITEM_QUALITY_EPIC:
case ITEM_QUALITY_LEGENDARY:
return randPropEntry->EpicPropertiesPoints[suffixFactor];
default:
return 0;
}
return 0;
}
uint32 ItemTemplate::GetStatValue(uint32 index, Player const* owner /*= nullptr*/) const
{
if (!owner)
return GetItemStatValue(index);
ScalingStatDistributionEntry const* ssd = GetScalingStatDistribution() ? sScalingStatDistributionStore.LookupEntry(GetScalingStatDistribution()) : nullptr;
// req. check at equip, but allow use for extended range if range limit max level, set proper level
uint32 ssdLevel = owner->getLevel();
if (ssd && ssdLevel > ssd->Maxlevel)
ssdLevel = ssd->Maxlevel;
if (ssd && ssdLevel < ssd->Minlevel)
ssdLevel = ssd->Minlevel;
if (ssdLevel < 1)
ssdLevel = 1;
ScalingStatValuesEntry const* ssv = ssd ? sScalingStatValuesStore.LookupEntry(ssdLevel) : nullptr;
uint32 statBaseValue = 0;
if (ssd && ssv)
{
if (ssd->StatID[index] < 0)
return 0; // What do we do ?
statBaseValue = ssv->GetStatMultiplier(GetInventoryType()) * ssd->Bonus[index] / 10000;
}
else
{
statBaseValue = GetItemStatValue(index);
uint32 itemLevel = GetBaseItemLevel();
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (!maxItemLevel || maxItemLevel >= itemLevel) // TODO: This might work if >=. Check.
return statBaseValue;
float minScaler = GetItemScalingModifier(GetBaseItemLevel(), ItemQualities(GetQuality()), ::InventoryType(GetInventoryType()));
float maxScaler = GetItemScalingModifier(maxItemLevel, ItemQualities(GetQuality()), ::InventoryType(GetInventoryType()));
if (maxScaler != 0.f && minScaler != 0.f)
{
float statAllocation = GetItemStatAllocation(index) * maxScaler * 0.0001f;
return std::ceil(statAllocation - ((maxScaler / minScaler) * GetItemStatSocketCostMultiplier(index)));
}
}
return statBaseValue;
}
uint32 ItemTemplate::GetEffectiveArmor(Player const* owner) const
{
if (GetQuality() > ITEM_QUALITY_ARTIFACT)
return 0;
uint32 level = GetBaseItemLevel();
if (owner)
{
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (maxItemLevel != 0 && level > maxItemLevel)
level = maxItemLevel;
}
if (GetClass() != ITEM_CLASS_ARMOR || GetSubClass() != ITEM_SUBCLASS_ARMOR_SHIELD)
{
ItemArmorQualityEntry const* armorQuality = sItemArmorQualityStore.LookupEntry(level);
ItemArmorTotalEntry const* armorTotal = sItemArmorTotalStore.LookupEntry(level);
if (!armorQuality || !armorTotal)
return 0;
uint32 invType = GetInventoryType();
if (invType == INVTYPE_ROBE)
invType = INVTYPE_CHEST;
ArmorLocationEntry const* location = sArmorLocationStore.LookupEntry(invType);
if (!location)
return 0;
if (GetSubClass() < ITEM_SUBCLASS_ARMOR_CLOTH || GetSubClass() > ITEM_SUBCLASS_ARMOR_PLATE)
return 0;
return uint32(armorQuality->Qualitymod[GetQuality()] * armorTotal->Value[GetSubClass() - ITEM_SUBCLASS_ARMOR_CLOTH] * location->Value[GetSubClass() - ITEM_SUBCLASS_ARMOR_CLOTH] + 0.5f);
}
ItemArmorShieldEntry const* shield = sItemArmorShieldStore.LookupEntry(level);
if (!shield)
return 0;
return uint32(shield->Quality[GetQuality()] + 0.5f);
}
bool ItemTemplate::GetWeaponDamage(Player const* owner, float& minValue, float& maxValue, float& dps) const
{
minValue = maxValue = 0.0f;
if (GetClass() != ITEM_CLASS_WEAPON || GetQuality() > ITEM_QUALITY_ARTIFACT)
return false;
uint32 level = GetBaseItemLevel();
if (owner)
{
uint32 maxItemLevel = owner->GetUInt32Value(UNIT_FIELD_MAXITEMLEVEL);
if (maxItemLevel != 0 && level > maxItemLevel)
level = maxItemLevel;
}
DBCStorage<ItemDamageEntry>* store = nullptr;
switch (GetInventoryType())
{
case INVTYPE_AMMO:
store = &sItemDamageAmmoStore;
break;
case INVTYPE_2HWEAPON:
if (GetFlags2() & ITEM_FLAG2_CASTER_WEAPON)
store = &sItemDamageTwoHandCasterStore;
else
store = &sItemDamageTwoHandStore;
break;
case INVTYPE_RANGED:
case INVTYPE_THROWN:
case INVTYPE_RANGEDRIGHT:
switch (GetSubClass())
{
case ITEM_SUBCLASS_WEAPON_WAND:
store = &sItemDamageWandStore;
break;
case ITEM_SUBCLASS_WEAPON_THROWN:
store = &sItemDamageThrownStore;
break;
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
store = &sItemDamageRangedStore;
break;
default:
return false;
}
break;
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
if (GetFlags2() & ITEM_FLAG2_CASTER_WEAPON)
store = &sItemDamageOneHandCasterStore;
else
store = &sItemDamageOneHandStore;
break;
default:
return false;
}
if (!store)
return false;
ItemDamageEntry const* damageInfo = store->LookupEntry(level);
if (!damageInfo)
return false;
dps = damageInfo->Quality[GetQuality()];
float avgDamage = GetDelay() * damageInfo->Quality[GetQuality()] * 0.001f;
float scaled_stat = std::floor((GetStatScalingFactor() * 0.5f + 1.f) * avgDamage + 0.5f);
if (GetDelay() && GetArmorDamageModifier() != 0.f)
{
float invMsDelay = 1000.0f / float(GetDelay());
float v16 = (invMsDelay * ((1.f - (GetStatScalingFactor() * 0.5f)) * avgDamage)) + GetArmorDamageModifier();
v16 = std::max(v16, 1.f);
minValue = (1.0f / invMsDelay) * v16;
maxValue = (1.0f / invMsDelay) * (((1000.f / float(GetDelay())) * scaled_stat) + GetArmorDamageModifier());
}
else
{
maxValue = scaled_stat;
minValue = (1.f - (GetStatScalingFactor() * 0.5f)) * avgDamage;
}
return true;
}
+3 -3
View File
@@ -1371,7 +1371,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
newspell.active = active;
// talent: unlearn all other talent ranks (high and low)
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
if (TalentSpellPos const* talentPos = sDBCManager.GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -1442,7 +1442,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
if (newspell.active == ACT_ENABLED)
ToggleAutocast(spellInfo, true);
uint32 talentCost = GetTalentSpellCost(spellId);
uint32 talentCost = sDBCManager.GetTalentSpellCost(spellId);
if (talentCost)
{
int32 free_points = GetMaxTalentPointsForLevel(getLevel());
@@ -1540,7 +1540,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
RemoveAurasDueToSpell(spell_id);
uint32 talentCost = GetTalentSpellCost(spell_id);
uint32 talentCost = sDBCManager.GetTalentSpellCost(spell_id);
if (talentCost > 0)
{
if (m_usedTalentCount > talentCost)
+32 -32
View File
@@ -583,7 +583,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
addActionButton(action_itr->button, action_itr->action, action_itr->type);
// original items
if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender))
if (CharStartOutfitEntry const* oEntry = sDBCManager.GetCharStartOutfitEntry(createInfo->Race, createInfo->Class, createInfo->Gender))
{
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
{
@@ -3017,7 +3017,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
PlayerTalentMap::iterator itr = GetTalentMap(spec)->find(spellId);
if (itr != GetTalentMap(spec)->end())
itr->second->state = PLAYERSPELL_UNCHANGED;
else if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
else if (TalentSpellPos const* talentPos = sDBCManager.GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -3218,7 +3218,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
if (!disabled_case) // skip new spell adding if spell already known (disabled spells case)
{
// talent: unlearn all other talent ranks (high and low)
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
if (TalentSpellPos const* talentPos = sDBCManager.GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -3308,7 +3308,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
return false;
}
uint32 talentCost = GetTalentSpellCost(spellId);
uint32 talentCost = sDBCManager.GetTalentSpellCost(spellId);
// cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned)
// note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive
@@ -3533,7 +3533,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// unlearn non talent higher ranks (recursive)
if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
{
if (HasSpell(nextSpell) && !GetTalentSpellPos(nextSpell))
if (HasSpell(nextSpell) && !sDBCManager.GetTalentSpellPos(nextSpell))
RemoveSpell(nextSpell, disabled, false);
}
//unlearn spells dependent from recently removed spells
@@ -3576,7 +3576,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
RemovePetAura(petSpell);
// free talent points
uint32 talentCosts = GetTalentSpellCost(spell_id);
uint32 talentCosts = sDBCManager.GetTalentSpellCost(spell_id);
if (talentCosts > 0 && giveTalentPoints)
{
if (talentCosts < GetUsedTalentCount())
@@ -3836,10 +3836,10 @@ bool Player::ResetTalents(bool no_cost)
}
// Remove spec specific spells
uint32 const* talentTabs = GetTalentTabPages(getClass());
uint32 const* talentTabs = sDBCManager.GetTalentTabPages(getClass());
for (uint32 i = 0; i < MAX_TALENT_TABS; ++i)
{
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentTabs[i]))
if (std::vector<uint32> const* specSpells = sDBCManager.GetTalentTreePrimarySpells(talentTabs[i]))
for (size_t j = 0; j < specSpells->size(); ++j)
RemoveSpell(specSpells->at(j), true);
@@ -5576,7 +5576,7 @@ void Player::GiveXpForGather(uint32 const& skillId)
else
level = getLevel() + 3;
uint32 xp = Trinity::XP::BaseGain(level, areaEntry->LevelRangeMax, GetContentLevelsForMapAndZone(GetMapId(), zoneId)) * 2;
uint32 xp = Trinity::XP::BaseGain(level, areaEntry->LevelRangeMax, sDBCManager.GetContentLevelsForMapAndZone(GetMapId(), zoneId)) * 2;
if (!xp || levelDiff >= 20)
return;
@@ -5707,7 +5707,7 @@ void Player::UpdateSkillsForLevel()
continue;
uint32 pskill = itr->first;
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(pskill, getRace(), getClass());
SkillRaceClassInfoEntry const* rcEntry = sDBCManager.GetSkillRaceClassInfo(pskill, getRace(), getClass());
if (!rcEntry)
continue;
@@ -5741,7 +5741,7 @@ void Player::UpdateWeaponsSkillsToMaxSkillsForLevel()
continue;
uint32 pskill = itr->first;
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(pskill, getRace(), getClass());
SkillRaceClassInfoEntry const* rcEntry = sDBCManager.GetSkillRaceClassInfo(pskill, getRace(), getClass());
if (!rcEntry)
continue;
@@ -5771,7 +5771,7 @@ void Player::InitializeSkillFields()
uint32 i = 0;
for (SkillLineEntry const* skillLine : sSkillLineStore)
{
if (GetSkillRaceClassInfo(skillLine->ID, getRace(), getClass()))
if (sDBCManager.GetSkillRaceClassInfo(skillLine->ID, getRace(), getClass()))
{
SetSkillLineId(i, skillLine->ID);
mSkillStatus.insert(SkillStatusMap::value_type(skillLine->ID, SkillStatusData(i, SKILL_UNCHANGED)));
@@ -6498,11 +6498,11 @@ void Player::RewardOnKill(Unit* victim, float rate)
Map const* map = GetMap();
if (map->IsNonRaidDungeon())
{
if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty()))
if (LFGDungeonEntry const* dungeon = DBCManager::GetLFGDungeon(map->GetId(), map->GetDifficulty()))
{
// WotLK and Cataclysm dungeons only grant championing reputation when being in max level dungeons and fighting for a expansion related faction
uint8 expansion = GetExpansionForFaction(GetChampioningFaction());
if (dungeon->Target_level == GetMaxLevelForExpansion(dungeon->ExpansionLevel) && expansion)
if (dungeon->Target_level == DBCManager::GetMaxLevelForExpansion(dungeon->ExpansionLevel) && expansion)
{
if (expansion == dungeon->ExpansionLevel)
ChampioningFaction = GetChampioningFaction();
@@ -10406,7 +10406,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
if (item && IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
if (item && DBCManager::IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
return true;
}
@@ -10419,7 +10419,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
for (uint32 j = 0; j < bag->GetBagSize(); ++j)
{
item = GetUseableItemByPos(i, j);
if (item && IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
if (item && sDBCManager.IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
return true;
}
}
@@ -19148,7 +19148,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
}
else
{
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty));
MapDifficulty const* mapDiff = sDBCManager.GetMapDifficultyData(mapId, Difficulty(difficulty));
if (!mapDiff)
{
TC_LOG_ERROR("entities.player", "Player::_LoadBoundInstances: player '%s' (%s) has bind to not existed difficulty %d instance for map %u (%s)",
@@ -19186,7 +19186,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty, bool withExpired)
{
// some instances only have one difficulty
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty);
MapDifficulty const* mapDiff = sDBCManager.GetDownscaledMapDifficultyData(mapid, difficulty);
if (!mapDiff)
return nullptr;
@@ -19466,7 +19466,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
bool heroicExclusive = ar->heroicExclusive;
Difficulty target_difficulty = GetDifficulty(mapEntry->IsRaid());
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(target_map, target_difficulty);
MapDifficulty const* mapDiff = sDBCManager.GetDownscaledMapDifficultyData(target_map, target_difficulty);
if (!mapDiff)
return false;
@@ -23839,7 +23839,7 @@ void Player::ResetSpells(bool myClassOnly)
// skip spells with first rank learned as talent (and all talents then also)
uint32 firstRank = spellInfo->GetFirstRankSpell()->Id;
if (GetTalentSpellCost(firstRank) > 0)
if (sDBCManager.GetTalentSpellCost(firstRank) > 0)
continue;
// skip broken spells
@@ -23893,7 +23893,7 @@ void Player::LearnDefaultSkills()
void Player::LearnDefaultSkill(uint32 skillId, uint16 rank)
{
SkillRaceClassInfoEntry const* rcInfo = GetSkillRaceClassInfo(skillId, getRace(), getClass());
SkillRaceClassInfoEntry const* rcInfo = sDBCManager.GetSkillRaceClassInfo(skillId, getRace(), getClass());
if (!rcInfo)
return;
@@ -24458,7 +24458,7 @@ bool Player::IsSpellFitByClassAndRace(uint32 spell_id) const
continue;
// skip wrong class and race skill saved in SkillRaceClassInfo.dbc
if (!GetSkillRaceClassInfo(_spell_idx->second->SkillLine, getRace(), getClass()))
if (!sDBCManager.GetSkillRaceClassInfo(_spell_idx->second->SkillLine, getRace(), getClass()))
continue;
return true;
@@ -25890,7 +25890,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
uint16 value = fields[1].GetUInt16();
uint16 max = fields[2].GetUInt16();
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skill, getRace(), getClass());
SkillRaceClassInfoEntry const* rcEntry = sDBCManager.GetSkillRaceClassInfo(skill, getRace(), getClass());
if (!rcEntry)
{
TC_LOG_ERROR("entities.player", "Player::_LoadSkills: Player '%s' (%s, Race: %u, Class: %u) has forbidden skill %u for his race/class combination",
@@ -26254,7 +26254,7 @@ bool Player::LearnTalent(uint32 talentId, uint32 talentRank)
if (!GetPrimaryTalentTree(GetActiveSpec()))
{
SetPrimaryTalentTree(GetActiveSpec(), talentInfo->TabID);
std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentInfo->TabID);
std::vector<uint32> const* specSpells = sDBCManager.GetTalentTreePrimarySpells(talentInfo->TabID);
if (specSpells)
for (size_t i = 0; i < specSpells->size(); ++i)
LearnSpell(specSpells->at(i), false);
@@ -26511,7 +26511,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
*data << uint8(talentIdCount); // [PH], talentIdCount
// find class talent tabs (all players have 3 talent tabs)
uint32 const* talentTabIds = GetTalentTabPages(getClass());
uint32 const* talentTabIds = sDBCManager.GetTalentTabPages(getClass());
for (uint8 i = 0; i < MAX_TALENT_TABS; ++i)
{
@@ -27097,8 +27097,8 @@ void Player::ActivateSpec(uint8 spec)
// Remove spec specific spells
for (uint32 i = 0; i < MAX_TALENT_TABS; ++i)
{
uint32 const* talentTabs = GetTalentTabPages(getClass());
std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentTabs[i]);
uint32 const* talentTabs = sDBCManager.GetTalentTabPages(getClass());
std::vector<uint32> const* specSpells = sDBCManager.GetTalentTreePrimarySpells(talentTabs[i]);
if (specSpells)
for (size_t i = 0; i < specSpells->size(); ++i)
RemoveSpell(specSpells->at(i), true);
@@ -27150,7 +27150,7 @@ void Player::ActivateSpec(uint8 spec)
}
}
std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetPrimaryTalentTree(GetActiveSpec()));
std::vector<uint32> const* specSpells = sDBCManager.GetTalentTreePrimarySpells(GetPrimaryTalentTree(GetActiveSpec()));
if (specSpells)
for (size_t i = 0; i < specSpells->size(); ++i)
LearnSpell(specSpells->at(i), false);
@@ -28318,9 +28318,9 @@ bool Player::ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 ha
{
// Check skin color
// For Skin type is always 0
if (CharSectionsEntry const* entry = GetCharSectionEntry(race, SECTION_TYPE_SKIN, gender, 0, skinColor))
if (CharSectionsEntry const* entry = sDBCManager.GetCharSectionEntry(race, SECTION_TYPE_SKIN, gender, 0, skinColor))
{ // Skin Color defined as Face color, too, we check skin & face in one pass
if (CharSectionsEntry const* entry2 = GetCharSectionEntry(race, SECTION_TYPE_FACE, gender, faceID, skinColor))
if (CharSectionsEntry const* entry2 = sDBCManager.GetCharSectionEntry(race, SECTION_TYPE_FACE, gender, faceID, skinColor))
{
// Check DeathKnight exclusive
if (((entry->Flags & SECTION_FLAG_DEATH_KNIGHT) || (entry2->Flags & SECTION_FLAG_DEATH_KNIGHT)) && class_ != CLASS_DEATH_KNIGHT)
@@ -28338,7 +28338,7 @@ bool Player::ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 ha
bool excludeCheck = (race == RACE_TAUREN) || (race == RACE_DRAENEI) || (gender == GENDER_FEMALE && race != RACE_NIGHTELF && race != RACE_UNDEAD_PLAYER);
// Check Hair
if (CharSectionsEntry const* entry = GetCharSectionEntry(race, SECTION_TYPE_HAIR, gender, hairID, hairColor))
if (CharSectionsEntry const* entry = sDBCManager.GetCharSectionEntry(race, SECTION_TYPE_HAIR, gender, hairID, hairColor))
{
if ((entry->Flags & SECTION_FLAG_DEATH_KNIGHT) && class_ != CLASS_DEATH_KNIGHT)
return false;
@@ -28347,7 +28347,7 @@ bool Player::ValidateAppearance(uint8 race, uint8 class_, uint8 gender, uint8 ha
if (!excludeCheck)
{
if (CharSectionsEntry const* entry2 = GetCharSectionEntry(race, SECTION_TYPE_FACIAL_HAIR, gender, facialStyle, hairColor))
if (CharSectionsEntry const* entry2 = sDBCManager.GetCharSectionEntry(race, SECTION_TYPE_FACIAL_HAIR, gender, facialStyle, hairColor))
{
if ((entry2->Flags & SECTION_FLAG_DEATH_KNIGHT) && class_ != CLASS_DEATH_KNIGHT)
return false;
+2 -2
View File
@@ -8386,7 +8386,7 @@ MountCapabilityEntry const* Unit::GetMountCapability(uint32 mountType) const
GetMap()->GetEntry()->ParentMapID != mountCapability->ReqMapID)
continue;
if (mountCapability->ReqAreaID && !IsInArea(areaId, mountCapability->ReqAreaID))
if (mountCapability->ReqAreaID && !DBCManager::IsInArea(areaId, mountCapability->ReqAreaID))
continue;
if (mountCapability->ReqSpellAuraID && !HasAura(mountCapability->ReqSpellAuraID))
@@ -10237,7 +10237,7 @@ uint32 Unit::GetPowerIndex(uint32 powerType) const
classId = CLASS_ROGUE;
}
return GetPowerIndexByClass(powerType, classId);
return sDBCManager.GetPowerIndexByClass(powerType, classId);
}
int32 Unit::GetCreatePowers(Powers power) const
+14 -14
View File
@@ -1954,7 +1954,7 @@ void ObjectMgr::LoadCreatures()
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)))
if (sDBCManager.GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
PhaseShift phaseShift;
@@ -2093,7 +2093,7 @@ void ObjectMgr::LoadCreatures()
data.phaseUseFlags &= ~PHASE_USE_FLAGS_INVERSE;
}
if (data.phaseGroup && !GetPhasesForGroup(data.phaseGroup))
if (data.phaseGroup && !sDBCManager.GetPhasesForGroup(data.phaseGroup))
{
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
@@ -2300,7 +2300,7 @@ void ObjectMgr::LoadGameObjects()
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)))
if (sDBCManager.GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
PhaseShift phaseShift;
@@ -2409,7 +2409,7 @@ void ObjectMgr::LoadGameObjects()
data.phaseUseFlags &= ~PHASE_USE_FLAGS_INVERSE;
}
if (data.phaseGroup && !GetPhasesForGroup(data.phaseGroup))
if (data.phaseGroup && !sDBCManager.GetPhasesForGroup(data.phaseGroup))
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with non-existing `phasegroup` (%u) set, `phasegroup` set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
@@ -3270,7 +3270,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3
for (uint32 gender = 0; gender < GENDER_NONE; ++gender)
{
if (CharStartOutfitEntry const* entry = GetCharStartOutfitEntry(race_, class_, gender))
if (CharStartOutfitEntry const* entry = sDBCManager.GetCharStartOutfitEntry(race_, class_, gender))
{
bool found = false;
for (uint8 x = 0; x < MAX_OUTFIT_ITEMS; ++x)
@@ -3504,7 +3504,7 @@ void ObjectMgr::LoadPlayerInfo()
{
if (classMask == 0 || ((1 << (classIndex - 1)) & classMask))
{
if (!GetSkillRaceClassInfo(skill.SkillId, raceIndex, classIndex))
if (!sDBCManager.GetSkillRaceClassInfo(skill.SkillId, raceIndex, classIndex))
continue;
if (PlayerInfo* info = _playerInfo[raceIndex][classIndex])
@@ -4528,7 +4528,7 @@ void ObjectMgr::LoadQuests()
qinfo->_rewardDisplaySpell = 0; // no spell reward will display for this quest
}
else if (GetTalentSpellCost(qinfo->_rewardDisplaySpell))
else if (sDBCManager.GetTalentSpellCost(qinfo->_rewardDisplaySpell))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->_rewardDisplaySpell, qinfo->_rewardDisplaySpell);
@@ -4554,7 +4554,7 @@ void ObjectMgr::LoadQuests()
qinfo->_rewardSpell = 0; // no spell will be cast on player
}
else if (GetTalentSpellCost(qinfo->_rewardSpell))
else if (sDBCManager.GetTalentSpellCost(qinfo->_rewardSpell))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->_rewardSpell, qinfo->_rewardSpell);
@@ -5662,7 +5662,7 @@ void ObjectMgr::LoadInstanceEncounters()
{
for (uint32 i = 0; i < MAX_DIFFICULTY; ++i)
{
if (GetMapDifficultyData(dungeonEncounter->MapID, Difficulty(i)))
if (sDBCManager.GetMapDifficultyData(dungeonEncounter->MapID, Difficulty(i)))
{
DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR32(dungeonEncounter->MapID, i)];
encounters.push_back(new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
@@ -7395,7 +7395,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) const
if (!cinfo)
return std::string();
char const* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
char const* petname = DBCManager::GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale());
if (petname)
return std::string(petname);
else
@@ -8164,7 +8164,7 @@ ResponseCodes ObjectMgr::CheckPlayerName(std::string const& name, LocaleConstant
if (wname[i] == wname[i-1] && wname[i] == wname[i-2])
return CHAR_NAME_THREE_CONSECUTIVE;
return ValidateName(wname, locale);
return sDBCManager.ValidateName(wname, locale);
}
bool ObjectMgr::IsValidCharterName(const std::string& name)
@@ -8202,7 +8202,7 @@ PetNameInvalidReason ObjectMgr::CheckPetName(const std::string& name, LocaleCons
if (!isValidString(wname, strictMask, false))
return PET_NAME_MIXED_LANGUAGES;
switch (ValidateName(wname, locale))
switch (sDBCManager.ValidateName(wname, locale))
{
case CHAR_NAME_PROFANE:
return PET_NAME_PROFANE;
@@ -8691,7 +8691,7 @@ void ObjectMgr::LoadTrainers()
continue;
}
if (GetTalentSpellCost(spell.SpellId))
if (sDBCManager.GetTalentSpellCost(spell.SpellId))
{
TC_LOG_ERROR("sql.sql", "Table `trainer_spell` references non-existing spell (SpellId: %u) which is a talent, for TrainerId %u, ignoring", spell.SpellId, trainerId);
continue;
@@ -9901,7 +9901,7 @@ bool PhaseInfoStruct::IsAllowedInArea(uint32 areaId) const
{
return std::any_of(Areas.begin(), Areas.end(), [areaId](uint32 areaToCheck)
{
return IsInArea(areaId, areaToCheck);
return DBCManager::IsInArea(areaId, areaToCheck);
});
}
+3 -3
View File
@@ -2162,7 +2162,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
if (!reference)
return ERR_BATTLEGROUND_JOIN_FAILED;
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bgOrTemplate->GetMapId(), reference->getLevel());
if (!bracketEntry)
return ERR_BATTLEGROUND_JOIN_FAILED;
@@ -2183,7 +2183,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
if (member->GetTeam() != team)
return ERR_BATTLEGROUND_JOIN_TIMED_OUT;
// not in the same battleground level braket, don't let join
PvPDifficultyEntry const* memberBracketEntry = GetBattlegroundBracketByLevel(bracketEntry->MapID, member->getLevel());
PvPDifficultyEntry const* memberBracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bracketEntry->MapID, member->getLevel());
if (memberBracketEntry != bracketEntry)
return ERR_BATTLEGROUND_JOIN_RANGE_INDEX;
// don't let join rated matches if the arena team id doesn't match
@@ -2439,7 +2439,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::GetBoundInstance(Difficulty difficulty, uint32 mapId)
{
// some instances only have one difficulty
GetDownscaledMapDifficultyData(mapId, difficulty);
sDBCManager.GetDownscaledMapDifficultyData(mapId, difficulty);
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapId);
if (itr != m_boundInstances[difficulty].end())
@@ -141,7 +141,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
return;
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
return;
@@ -499,7 +499,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
bgTypeId = bg->GetTypeID();
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
return;
@@ -674,7 +674,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
continue;
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
continue;
@@ -719,7 +719,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
BattlegroundTypeId bgTypeId = bg->GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
return;
@@ -2410,7 +2410,7 @@ void WorldSession::HandleRandomizeCharNameOpcode(WorldPacket& recvData)
return;
}
std::string const& name = GetRandomCharacterName(race, gender);
std::string const& name = sDBCManager.GetRandomCharacterName(race, gender);
WorldPacket data(SMSG_RANDOMIZE_CHAR_NAME, 10);
data.WriteBit(0); // unk
data.WriteBits(name.size(), 7);
+1 -1
View File
@@ -174,7 +174,7 @@ void WorldSession::HandleMoveWorldportAck()
{
// check if this instance has a reset time and send it to player if so
Difficulty diff = newMap->GetDifficulty();
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->ID, diff))
if (MapDifficulty const* mapDiff = sDBCManager.GetMapDifficultyData(mEntry->ID, diff))
{
if (mapDiff->resetTime)
{
+1 -1
View File
@@ -115,7 +115,7 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recvData)
uint32 skillId;
recvData >> skillId;
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skillId, GetPlayer()->getRace(), GetPlayer()->getClass());
SkillRaceClassInfoEntry const* rcEntry = sDBCManager.GetSkillRaceClassInfo(skillId, GetPlayer()->getRace(), GetPlayer()->getClass());
if (!rcEntry || !(rcEntry->Flags & SKILL_FLAG_UNLEARNABLE))
return;
@@ -355,7 +355,7 @@ void InstanceSaveManager::LoadResetTimes()
Difficulty difficulty = Difficulty(fields[1].GetUInt8());
uint64 oldresettime = fields[2].GetUInt64();
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
MapDifficulty const* mapDiff = sDBCManager.GetMapDifficultyData(mapid, difficulty);
if (!mapDiff)
{
TC_LOG_ERROR("misc", "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
@@ -443,7 +443,7 @@ void InstanceSaveManager::LoadResetTimes()
time_t InstanceSaveManager::GetSubsequentResetTime(uint32 mapid, Difficulty difficulty, time_t resetTime) const
{
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
MapDifficulty const* mapDiff = sDBCManager.GetMapDifficultyData(mapid, difficulty);
if (!mapDiff || !mapDiff->resetTime)
{
TC_LOG_ERROR("misc", "InstanceSaveManager::GetSubsequentResetTime: not valid difficulty or no reset delay for map %u", mapid);
@@ -504,7 +504,7 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev
void InstanceSaveManager::ForceGlobalReset(uint32 mapId, Difficulty difficulty)
{
if (!GetDownscaledMapDifficultyData(mapId, difficulty))
if (!sDBCManager.GetDownscaledMapDifficultyData(mapId, difficulty))
return;
// remove currently scheduled reset times
ScheduleReset(false, 0, InstResetEvent(1, mapId, difficulty, 0));
+4 -4
View File
@@ -281,7 +281,7 @@ m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
m_VisibilityNotifyPeriod(DEFAULT_VISIBILITY_NOTIFY_PERIOD),
m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()),
i_gridExpiry(expiry),
i_scriptLock(false), _respawnCheckTimer(0), _defaultLight(GetDefaultMapLight(id))
i_scriptLock(false), _respawnCheckTimer(0), _defaultLight(DBCManager::GetDefaultMapLight(id))
{
if (_parent)
{
@@ -2609,7 +2609,7 @@ uint32 Map::GetAreaId(PhaseShift const& phaseShift, float x, float y, float z) c
if (hasVmapArea && G3D::fuzzyGe(z, vmapZ - GROUND_HEIGHT_TOLERANCE) && (G3D::fuzzyLt(z, gridMapHeight - GROUND_HEIGHT_TOLERANCE) || vmapZ > gridMapHeight))
{
// wmo found
if (WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId))
if (WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(rootId, adtId, groupId))
areaId = wmoEntry->AreaTableID;
if (!areaId)
@@ -2771,7 +2771,7 @@ void Map::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, float x,
{
data.areaInfo = boost::in_place(vmapData.areaInfo->adtId, vmapData.areaInfo->rootId, vmapData.areaInfo->groupId, vmapData.areaInfo->mogpFlags);
// wmo found
WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(vmapData.areaInfo->rootId, vmapData.areaInfo->adtId, vmapData.areaInfo->groupId);
WMOAreaTableEntry const* wmoEntry = sDBCManager.GetWMOAreaTableEntryByTripple(vmapData.areaInfo->rootId, vmapData.areaInfo->adtId, vmapData.areaInfo->groupId);
data.outdoors = (vmapData.areaInfo->mogpFlags & 0x8) != 0;
if (wmoEntry)
{
@@ -4140,7 +4140,7 @@ void InstanceMap::SetResetSchedule(bool on)
MapDifficulty const* Map::GetMapDifficulty() const
{
return GetMapDifficultyData(GetId(), GetDifficulty());
return sDBCManager.GetMapDifficultyData(GetId(), GetDifficulty());
}
bool Map::Instanceable() const
+2 -2
View File
@@ -218,7 +218,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
}
// some instances only have one difficulty
GetDownscaledMapDifficultyData(GetId(), difficulty);
sDBCManager.GetDownscaledMapDifficultyData(GetId(), difficulty);
TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal");
@@ -245,7 +245,7 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
TC_LOG_DEBUG("maps", "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId());
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel());
PvPDifficultyEntry const* bracketEntry = sDBCManager.GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel());
uint8 spawnMode;
+1 -1
View File
@@ -168,7 +168,7 @@ Map::EnterState MapManager::PlayerCannotEnter(uint32 mapid, Player* player, bool
// Cannot enter instance if MapDifficulty data for highest available difficulty does not exist
Difficulty targetDifficulty = player->GetDifficulty(entry->IsRaid());
MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(entry->ID, targetDifficulty);
MapDifficulty const* mapDiff = sDBCManager.GetDownscaledMapDifficultyData(entry->ID, targetDifficulty);
if (!mapDiff)
return Map::CANNOT_ENTER_DIFFICULTY_UNAVAILABLE;
+1 -1
View File
@@ -478,7 +478,7 @@ void TransportMgr::SpawnContinentTransports()
if (phaseGroupId)
{
if (!GetPhasesForGroup(phaseGroupId))
if (!sDBCManager.GetPhasesForGroup(phaseGroupId))
{
TC_LOG_ERROR("sql.sql", "Table `transports` have transport (GUID: %u Entry: %u) with `phaseGroup` %u does not exist, set to 0", guid, entry, phaseGroupId);
phaseGroupId = 0;
+1 -1
View File
@@ -180,7 +180,7 @@ namespace Trinity
{
float xpMod = 1.0f;
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
gain = BaseGain(player->getLevel(), u->getLevel(), sDBCManager.GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
if (gain && creature)
{
+5 -5
View File
@@ -96,7 +96,7 @@ void PhasingHandler::RemovePhase(WorldObject* object, uint32 phaseId, bool updat
void PhasingHandler::AddPhaseGroup(WorldObject* object, uint32 phaseGroupId, bool updateVisibility)
{
std::vector<uint32> const* phasesInGroup = GetPhasesForGroup(phaseGroupId);
std::vector<uint32> const* phasesInGroup = sDBCManager.GetPhasesForGroup(phaseGroupId);
if (!phasesInGroup)
return;
@@ -119,7 +119,7 @@ void PhasingHandler::AddPhaseGroup(WorldObject* object, uint32 phaseGroupId, boo
void PhasingHandler::RemovePhaseGroup(WorldObject* object, uint32 phaseGroupId, bool updateVisibility)
{
std::vector<uint32> const* phasesInGroup = GetPhasesForGroup(phaseGroupId);
std::vector<uint32> const* phasesInGroup = sDBCManager.GetPhasesForGroup(phaseGroupId);
if (!phasesInGroup)
return;
@@ -263,7 +263,7 @@ void PhasingHandler::OnAreaChange(WorldObject* object)
}
for (AuraEffect const* aurEff : unit->GetAuraEffectsByType(SPELL_AURA_PHASE_GROUP))
if (std::vector<uint32> const* phasesInGroup = GetPhasesForGroup(uint32(aurEff->GetMiscValueB())))
if (std::vector<uint32> const* phasesInGroup = sDBCManager.GetPhasesForGroup(uint32(aurEff->GetMiscValueB())))
for (uint32 phaseId : *phasesInGroup)
changed = phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), nullptr) || changed;
@@ -356,7 +356,7 @@ void PhasingHandler::OnConditionChange(WorldObject* object)
for (AuraEffect const* aurEff : unit->GetAuraEffectsByType(SPELL_AURA_PHASE_GROUP))
{
if (std::vector<uint32> const* phasesInGroup = GetPhasesForGroup(uint32(aurEff->GetMiscValueB())))
if (std::vector<uint32> const* phasesInGroup = sDBCManager.GetPhasesForGroup(uint32(aurEff->GetMiscValueB())))
{
for (uint32 phaseId : *phasesInGroup)
{
@@ -442,7 +442,7 @@ void PhasingHandler::InitDbPhaseShift(PhaseShift& phaseShift, uint8 phaseUseFlag
if (phaseId)
phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), nullptr);
else if (std::vector<uint32> const* phasesInGroup = GetPhasesForGroup(phaseGroupId))
else if (std::vector<uint32> const* phasesInGroup = sDBCManager.GetPhasesForGroup(phaseGroupId))
for (uint32 phaseInGroup : *phasesInGroup)
phaseShift.AddPhase(phaseInGroup, GetPhaseFlags(phaseInGroup), nullptr);
+2 -2
View File
@@ -308,7 +308,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
{
float spillOverRepOut = float(standing);
// check for sub-factions that receive spillover
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
SimpleFactionsList const* flist = sDBCManager.GetFactionTeamList(factionEntry->ID);
// if has no sub-factions, check for factions with same parent
if (!flist && factionEntry->ParentFactionID && factionEntry->ParentFactionMod[1] != 0.0f)
{
@@ -323,7 +323,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
}
else // spill to "sister" factions
{
flist = GetFactionTeamList(factionEntry->ParentFactionID);
flist = sDBCManager.GetFactionTeamList(factionEntry->ParentFactionID);
}
}
}
+1 -1
View File
@@ -2232,7 +2232,7 @@ void Spell::EffectLearnSkill(SpellEffIndex effIndex)
return;
uint32 skillid = m_spellInfo->Effects[effIndex].MiscValue;
SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(skillid, unitTarget->getRace(), unitTarget->getClass());
SkillRaceClassInfoEntry const* rcEntry = sDBCManager.GetSkillRaceClassInfo(skillid, unitTarget->getRace(), unitTarget->getClass());
if (!rcEntry)
return;
+1 -1
View File
@@ -351,7 +351,7 @@ void SpellHistory::StartCooldown(SpellInfo const* spellInfo, uint32 itemId, Spel
SpellCategoryEntry const* categoryEntry = sSpellCategoryStore.AssertEntry(categoryId);
if (categoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_EXPIRES_AT_DAILY_RESET)
{
uint32 parentCategoryId = GetParentSpellCategoryId(categoryEntry->ID);
uint32 parentCategoryId = DBCManager::GetParentSpellCategoryId(categoryEntry->ID);
SpellCategoryEntry const* parentCategory = sSpellCategoryStore.LookupEntry(parentCategoryId);
if (parentCategory && parentCategory->UsesPerWeek)
+2 -2
View File
@@ -1586,7 +1586,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
{
// talents that learn spells can have stance requirements that need ignore
// (this requirement only for client-side stance show in talent description)
if (GetTalentSpellCost(Id) > 0 &&
if (sDBCManager.GetTalentSpellCost(Id) > 0 &&
(Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL || Effects[1].Effect == SPELL_EFFECT_LEARN_SPELL || Effects[2].Effect == SPELL_EFFECT_LEARN_SPELL))
return SPELL_CAST_OK;
@@ -1662,7 +1662,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
// continent limitation (virtual continent)
if (HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
{
uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
uint32 v_map = sDBCManager.GetVirtualMapForMapAndZone(map_id, zone_id);
MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
if (!mapEntry || mapEntry->ExpansionID < 1 || !mapEntry->IsContinent())
+3 -3
View File
@@ -1117,7 +1117,7 @@ void SpellMgr::LoadSpellLearnSpells()
continue;
}
if (GetTalentSpellCost(node.spell))
if (sDBCManager.GetTalentSpellCost(node.spell))
{
TC_LOG_ERROR("sql.sql", "The spell %u listed in `spell_learn_spell` attempts learning talent spell %u, skipped.", spell_id, node.spell);
continue;
@@ -1155,7 +1155,7 @@ void SpellMgr::LoadSpellLearnSpells()
// talent or passive spells or skill-step spells auto-cast and not need dependent learning,
// pet teaching spells must not be dependent learning (cast)
// other required explicit dependent learning
dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
dbc_node.autoLearned = entry->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET || sDBCManager.GetTalentSpellCost(spell) > 0 || entry->IsPassive() || entry->HasEffect(SPELL_EFFECT_SKILL_STEP);
SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(spell);
@@ -5703,7 +5703,7 @@ void SpellMgr::LoadSpellInfoCorrections()
}
// Passive talent auras cannot target pets
if (spellInfo->IsPassive() && GetTalentSpellCost(i))
if (spellInfo->IsPassive() && sDBCManager.GetTalentSpellCost(i))
if (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
spellInfo->Effects[j].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER);
if (spellInfo->Effects[j].TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE || spellInfo->Effects[j].TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CONE)
@@ -128,7 +128,7 @@ void CharacterDatabaseCleaner::CleanCharacterSkills()
bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id)
{
return sSpellMgr->GetSpellInfo(spell_id) && !GetTalentSpellPos(spell_id);
return sSpellMgr->GetSpellInfo(spell_id) && !sDBCManager.GetTalentSpellPos(spell_id);
}
void CharacterDatabaseCleaner::CleanCharacterSpell()
+4 -3
View File
@@ -40,6 +40,7 @@
#include "CreatureTextMgr.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DBCStores.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "GameObjectModel.h"
@@ -1600,7 +1601,7 @@ void World::SetInitialWorldSettings()
///- Initialize VMapManager function pointers (to untangle game/collision circular deps)
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
{
vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags;
vmmgr2->GetLiquidFlagsPtr = &DBCManager::GetLiquidFlags;
vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
}
@@ -1649,9 +1650,9 @@ void World::SetInitialWorldSettings()
LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%d'", server_type, realm_zone, realm.Id.Realm); // One-time query
///- Load the DBC files
///- Load the DBC/DB2 files
TC_LOG_INFO("server.loading", "Initialize data stores...");
LoadDBCStores(m_dataPath);
sDBCManager.LoadStores(m_dataPath);
sDB2Manager.LoadStores(m_dataPath);
TC_LOG_INFO("misc", "Loading hotfix info...");
+2 -2
View File
@@ -1539,7 +1539,7 @@ public:
handler->PSendSysMessage("Invalid difficulty %d - specify in range [0,%d).", difficulty, MAX_RAID_DIFFICULTY);
return false;
}
if (difficulty >= 0 && !GetMapDifficultyData(mEntry->ID, Difficulty(difficulty)))
if (difficulty >= 0 && !sDBCManager.GetMapDifficultyData(mEntry->ID, Difficulty(difficulty)))
{
handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->MapName[LOCALE_enUS]);
return true;
@@ -1550,7 +1550,7 @@ public:
handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->MapName[LOCALE_enUS]);
for (uint8 diff = (mEntry->IsRaid() ? 0 : 1); diff < (mEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY); ++diff)
{
if (GetMapDifficultyData(mEntry->ID, Difficulty(diff)))
if (sDBCManager.GetMapDifficultyData(mEntry->ID, Difficulty(diff)))
{
handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff, mEntry->MapName[LOCALE_enUS]);
sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(diff));
+1 -1
View File
@@ -323,7 +323,7 @@ public:
return false;
}
Zone2MapCoordinates(x, y, zoneEntry->ID);
sDBCManager.Zone2MapCoordinates(x, y, zoneEntry->ID);
if (!MapManager::IsValidMapCoord(zoneEntry->ContinentID, x, y))
{
+3 -3
View File
@@ -115,7 +115,7 @@ public:
else
targetPlayer->LearnSpell(spell, false);
if (GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id))
if (sDBCManager.GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id))
targetPlayer->SendTalentsInfoData(false);
return true;
@@ -172,7 +172,7 @@ public:
continue;
// skip spells with first rank learned as talent (and all talents then also)
if (GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id) > 0)
if (sDBCManager.GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id) > 0)
continue;
// skip broken spells
@@ -467,7 +467,7 @@ public:
else
handler->SendSysMessage(LANG_FORGET_SPELL);
if (GetTalentSpellCost(spellId))
if (sDBCManager.GetTalentSpellCost(spellId))
target->SendTalentsInfoData(false);
return true;
+1 -1
View File
@@ -503,7 +503,7 @@ public:
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
bool talent = sDBCManager.GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
+2 -2
View File
@@ -771,7 +771,7 @@ public:
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
uint32 talentCost = sDBCManager.GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = spellInfo->IsPassive();
@@ -843,7 +843,7 @@ public:
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
uint32 talentCost = sDBCManager.GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = spellInfo->IsPassive();
+3 -3
View File
@@ -250,7 +250,7 @@ public:
float zoneX = object->GetPositionX();
float zoneY = object->GetPositionY();
Map2ZoneCoordinates(zoneX, zoneY, zoneId);
sDBCManager.Map2ZoneCoordinates(zoneX, zoneY, zoneId);
Map const* map = object->GetMap();
float groundZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
@@ -1822,8 +1822,8 @@ public:
handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_HIGH, level);
// Output XI. LANG_PINFO_CHR_RACE
raceStr = GetRaceName(raceid, locale);
classStr = GetClassName(classid, locale);
raceStr = DBCManager::GetRaceName(raceid, locale);
classStr = DBCManager::GetClassName(classid, locale);
handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetTrinityString(LANG_CHARACTER_GENDER_MALE) : handler->GetTrinityString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str());
// Output XII. LANG_PINFO_CHR_ALIVE
@@ -17,13 +17,15 @@
#include "dragon_soul.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h"
#include "GameObject.h"
#include "Group.h"
#include "InstanceScript.h"
#include "Map.h"
#include "MotionMaster.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "Optional.h"
#include "ObjectAccessor.h"
#include "PassiveAI.h"
#include "PhasingHandler.h"
#include "Player.h"
@@ -19,6 +19,7 @@
#define DEF_DRAGONSOUL_H
#include "Define.h"
#include "Creature.h"
#define DataHeader "DS"
#define DSScriptName "instance_dragon_soul"
@@ -15,8 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "dragon_soul.h"
ObjectData const creatureData[] =
+1 -1
View File
@@ -3959,7 +3959,7 @@ public:
if (Player* target = GetHitUnit()->ToPlayer())
{
target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN);
if (EmotesTextSoundEntry const* soundEntry = FindTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender()))
if (EmotesTextSoundEntry const* soundEntry = sDBCManager.FindTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender()))
target->PlayDistanceSound(soundEntry->ID);
}
}