aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-07-05 01:18:57 +0200
committerShauren <shauren.trinity@gmail.com>2015-07-05 01:18:57 +0200
commitd454df54d13b78ff15ac06abf098824a5cfe3dbb (patch)
treef93606692b3efab2e60753ae0cdc450974135727 /src
parent38f982162779c660e5cabd10493daf4a523850dc (diff)
Core/DataStores: Moved SkillTiers to database - it no longer exists in dbc form
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DBCStores.cpp2
-rw-r--r--src/server/game/DataStores/DBCStores.h1
-rw-r--r--src/server/game/DataStores/DBCStructure.h8
-rw-r--r--src/server/game/DataStores/DBCfmt.h1
-rw-r--r--src/server/game/Entities/Player/Player.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp28
-rw-r--r--src/server/game/Globals/ObjectMgr.h16
-rw-r--r--src/server/game/Spells/SpellEffects.cpp2
-rw-r--r--src/server/game/World/World.cpp3
9 files changed, 48 insertions, 15 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 672ee5fc309..ec29c66d4a4 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -199,7 +199,6 @@ DBCStorage <SkillLineEntry> sSkillLineStore(SkillLinefmt);
DBCStorage <SkillLineAbilityEntry> sSkillLineAbilityStore(SkillLineAbilityfmt);
DBCStorage <SkillRaceClassInfoEntry> sSkillRaceClassInfoStore(SkillRaceClassInfofmt);
SkillRaceClassInfoMap SkillRaceClassInfoBySkill;
-DBCStorage <SkillTiersEntry> sSkillTiersStore(SkillTiersfmt);
DBCStorage <SpecializationSpellsEntry> sSpecializationSpellsStore(SpecializationSpellsEntryfmt);
std::unordered_map<uint32, std::vector<SpecializationSpellsEntry const*>> sSpecializationSpellsBySpecStore;
@@ -459,7 +458,6 @@ void LoadDBCStores(const std::string& dataPath)
LOAD_DBC(sSkillLineStore, "SkillLine.dbc");//19116
LOAD_DBC(sSkillLineAbilityStore, "SkillLineAbility.dbc");//19116
LOAD_DBC(sSkillRaceClassInfoStore, "SkillRaceClassInfo.dbc");//19116
- LOAD_DBC(sSkillTiersStore, "SkillTiers.dbc");
LOAD_DBC(sSpecializationSpellsStore, "SpecializationSpells.dbc");
LOAD_DBC(sSpellStore, "Spell.dbc"/*, &CustomSpellEntryfmt, &CustomSpellEntryIndex*/);
LOAD_DBC(sSpellCategoriesStore, "SpellCategories.dbc");//15595
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index 863d6efcba7..28e3ae5d98e 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -240,7 +240,6 @@ extern DBCStorage <ScalingStatDistributionEntry> sScalingStatDistributionStore;
extern DBCStorage <SkillLineEntry> sSkillLineStore;
extern DBCStorage <SkillLineAbilityEntry> sSkillLineAbilityStore;
extern DBCStorage <SkillRaceClassInfoEntry> sSkillRaceClassInfoStore;
-extern DBCStorage <SkillTiersEntry> sSkillTiersStore;
extern SpellEffectScallingByEffectId sSpellEffectScallingByEffectId;
extern DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore;
extern DBCStorage <SpellCategoryEntry> sSpellCategoryStore;
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 8656f01273c..f10e52ca754 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1483,14 +1483,6 @@ struct SkillRaceClassInfoEntry
uint32 SkillTierID; // 7
};
-#define MAX_SKILL_STEP 16
-
-struct SkillTiersEntry
-{
- uint32 ID; // 0
- uint32 Value[MAX_SKILL_STEP]; // 1-16
-};
-
// SpecializationSpells.dbc
struct SpecializationSpellsEntry
{
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index fcad93b4f87..fa1c5fa7d3a 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -136,7 +136,6 @@ char const ScalingStatDistributionfmt[] = "niii";
char const SkillLinefmt[] = "nisxixixx";
char const SkillLineAbilityfmt[] = "niiiiiiiiiiii";
char const SkillRaceClassInfofmt[] = "diiiiiii";
-char const SkillTiersfmt[] = "niiiiiiiiiiiiiiii";
char const SpecializationSpellsEntryfmt[] = "niiix";
char const SpellCastTimefmt[] = "nixx";
char const SpellCategoriesEntryfmt[] = "diiiiiiiii";
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ab7aabf4089..296f7020847 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22843,7 +22843,7 @@ void Player::LearnDefaultSkill(SkillRaceClassInfoEntry const* rcInfo)
if (getClass() == CLASS_DEATH_KNIGHT && skillId == SKILL_FIRST_AID)
rank = 4;
- SkillTiersEntry const* tier = sSkillTiersStore.LookupEntry(rcInfo->SkillTierID);
+ SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcInfo->SkillTierID);
uint16 maxValue = tier->Value[std::max<int32>(rank - 1, 0)];
uint16 skillValue = 1;
if (rcInfo->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index d590f2f9bd7..059eb5304fd 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -7705,6 +7705,32 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
TC_LOG_INFO("server.loading", ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
+void ObjectMgr::LoadSkillTiers()
+{
+ uint32 oldMSTime = getMSTime();
+
+ QueryResult result = WorldDatabase.Query("SELECT ID, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, "
+ " Value11, Value12, Value13, Value14, Value15, Value16 FROM skill_tiers");
+
+ if (!result)
+ {
+ TC_LOG_ERROR("server.loading", ">> Loaded 0 skill max values. DB table `skill_tiers` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 id = fields[0].GetUInt32();
+ SkillTiersEntry& tier = _skillTiers[id];
+ for (uint32 i = 0; i < MAX_SKILL_STEP; ++i)
+ tier.Value[i] = fields[1 + i].GetUInt32();
+
+ } while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u skill max values in %u ms", uint32(_skillTiers.size()), GetMSTimeDiffToNow(oldMSTime));
+}
+
bool ObjectMgr::CheckDeclinedNames(const std::wstring& w_ownname, DeclinedName const& names)
{
// get main part of the name
@@ -7769,7 +7795,7 @@ SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const* rcEntry)
if (!skill)
return SKILL_RANGE_NONE;
- if (sSkillTiersStore.LookupEntry(rcEntry->SkillTierID))
+ if (sObjectMgr->GetSkillTier(rcEntry->SkillTierID))
return SKILL_RANGE_RANK;
if (rcEntry->SkillID == SKILL_RUNEFORGING)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ec3fa29b952..901aa56b431 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -627,6 +627,14 @@ enum SkillRangeType
SKILL_RANGE_NONE // 0..0 always
};
+#define MAX_SKILL_STEP 16
+
+struct SkillTiersEntry
+{
+ uint32 ID; // 0
+ uint32 Value[MAX_SKILL_STEP]; // 1-16
+};
+
SkillRangeType GetSkillRangeType(SkillRaceClassInfoEntry const* rcEntry);
#define MAX_PLAYER_NAME 12 // max allowed by client name length
@@ -1019,6 +1027,7 @@ class ObjectMgr
void LoadPetNames();
void LoadPetNumber();
void LoadFishingBaseSkillLevel();
+ void LoadSkillTiers();
void LoadReputationRewardRate();
void LoadReputationOnKill();
@@ -1053,6 +1062,12 @@ class ObjectMgr
return itr != _fishingBaseForAreaStore.end() ? itr->second : 0;
}
+ SkillTiersEntry const* GetSkillTier(uint32 skillTierId) const
+ {
+ auto itr = _skillTiers.find(skillTierId);
+ return itr != _skillTiers.end() ? &itr->second : nullptr;
+ }
+
void ReturnOrDeleteOldMails(bool serverUp);
CreatureBaseStats const* GetCreatureBaseStats(uint8 level, uint8 unitClass);
@@ -1457,6 +1472,7 @@ class ObjectMgr
typedef std::map<uint32, int32> FishingBaseSkillContainer; // [areaId][base skill level]
FishingBaseSkillContainer _fishingBaseForAreaStore;
+ std::unordered_map<uint32, SkillTiersEntry> _skillTiers;
typedef std::map<uint32, StringVector> HalfNameContainer;
HalfNameContainer _petHalfName0;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 3b0260cb4d9..fdc24750f6e 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2485,7 +2485,7 @@ void Spell::EffectLearnSkill(SpellEffIndex /*effIndex*/)
if (!rcEntry)
return;
- SkillTiersEntry const* tier = sSkillTiersStore.LookupEntry(rcEntry->SkillTierID);
+ SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcEntry->SkillTierID);
if (!tier)
return;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 8c4071f0fda..dee5492dc65 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1735,6 +1735,9 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
+ TC_LOG_INFO("server.loading", "Loading skill tier info...");
+ sObjectMgr->LoadSkillTiers();
+
TC_LOG_INFO("server.loading", "Loading Achievements...");
sAchievementMgr->LoadAchievementReferenceList();
TC_LOG_INFO("server.loading", "Loading Achievement Criteria Modifier trees...");