diff options
author | Kinzcool <kinzzcool@hotmail.com> | 2015-01-10 18:31:41 -0500 |
---|---|---|
committer | Kinzcool <kinzzcool@hotmail.com> | 2015-01-10 18:31:41 -0500 |
commit | 4d033eaa896db856878b4a39ff0f5082960b201b (patch) | |
tree | 4b0f5ae1b4bafdd872c2a3dfae252ad5fb3bf872 /src | |
parent | 82e5d1889377f95109f560a5fc47e03e99dda03e (diff) |
Core/Entities: Load creature health points from the Gt DBCs
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 12 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.h | 6 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStructure.h | 30 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCfmt.h | 6 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 34 |
5 files changed, 74 insertions, 14 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 783827a4f93..ec97b871ee9 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -117,6 +117,12 @@ GameTable <GtChanceToSpellCritBaseEntry> sGtChanceToSpellCritBaseStore(GtChanceT GameTable <GtChanceToSpellCritEntry> sGtChanceToSpellCritStore(GtChanceToSpellCritfmt); GameTable <GtItemSocketCostPerLevelEntry> sGtItemSocketCostPerLevelStore(GtItemSocketCostPerLevelfmt); GameTable <GtNPCManaCostScalerEntry> sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt); +GameTable <GtNpcTotalHpEntry> sGtNpcTotalHpStore(GtNpcTotalHpfmt); +GameTable <GtNpcTotalHpExp1Entry> sGtNpcTotalHpExp1Store(GtNpcTotalHpExp1fmt); +GameTable <GtNpcTotalHpExp2Entry> sGtNpcTotalHpExp2Store(GtNpcTotalHpExp2fmt); +GameTable <GtNpcTotalHpExp3Entry> sGtNpcTotalHpExp3Store(GtNpcTotalHpExp3fmt); +GameTable <GtNpcTotalHpExp4Entry> sGtNpcTotalHpExp4Store(GtNpcTotalHpExp4fmt); +GameTable <GtNpcTotalHpExp5Entry> sGtNpcTotalHpExp5Store(GtNpcTotalHpExp5fmt); GameTable <GtOCTClassCombatRatingScalarEntry> sGtOCTClassCombatRatingScalarStore(GtOCTClassCombatRatingScalarfmt); GameTable <GtOCTRegenHPEntry> sGtOCTRegenHPStore(GtOCTRegenHPfmt); GameTable <gtOCTHpPerStaminaEntry> sGtOCTHpPerStaminaStore(GtOCTHpPerStaminafmt); @@ -730,6 +736,12 @@ void LoadDBCStores(const std::string& dataPath) LoadGameTable(bad_dbc_files, "ChanceToSpellCrit", sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc");//19342 LoadGameTable(bad_dbc_files, "ItemSocketCostPerLevel", sGtItemSocketCostPerLevelStore, dbcPath, "gtItemSocketCostPerLevel.dbc");//19342 LoadGameTable(bad_dbc_files, "NPCManaCostScaler", sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc");//19342 + LoadGameTable(bad_dbc_files, "NpcTotalHp", sGtNpcTotalHpStore, dbcPath, "gtNpcTotalHp.dbc"); // 19445 + LoadGameTable(bad_dbc_files, "NpcTotalHpExp1", sGtNpcTotalHpExp1Store, dbcPath, "gtNpcTotalHpExp1.dbc"); // 19445 + LoadGameTable(bad_dbc_files, "NpcTotalHpExp2", sGtNpcTotalHpExp2Store, dbcPath, "gtNpcTotalHpExp2.dbc"); // 19445 + LoadGameTable(bad_dbc_files, "NpcTotalHpExp3", sGtNpcTotalHpExp3Store, dbcPath, "gtNpcTotalHpExp3.dbc"); // 19445 + LoadGameTable(bad_dbc_files, "NpcTotalHpExp4", sGtNpcTotalHpExp4Store, dbcPath, "gtNpcTotalHpExp4.dbc"); // 19445 + LoadGameTable(bad_dbc_files, "NpcTotalHpExp5", sGtNpcTotalHpExp5Store, dbcPath, "gtNpcTotalHpExp5.dbc"); // 19445 LoadGameTable(bad_dbc_files, "OCTClassCombatRatingScalar", sGtOCTClassCombatRatingScalarStore, dbcPath, "gtOCTClassCombatRatingScalar.dbc");//19342 LoadGameTable(bad_dbc_files, "OCTHPPerStamina", sGtOCTHpPerStaminaStore, dbcPath, "gtOCTHpPerStamina.dbc");//19342 LoadGameTable(bad_dbc_files, "RegenMPPerSpt", sGtRegenMPPerSptStore, dbcPath, "gtRegenMPPerSpt.dbc");//19342 diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 7bc8dcf5b64..e0d58baa442 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -178,6 +178,12 @@ extern GameTable <GtChanceToSpellCritBaseEntry> sGtChanceToSpellCritBaseStore; extern GameTable <GtChanceToSpellCritEntry> sGtChanceToSpellCritStore; extern GameTable <GtItemSocketCostPerLevelEntry> sGtItemSocketCostPerLevelStore; extern GameTable <GtNPCManaCostScalerEntry> sGtNPCManaCostScalerStore; +extern GameTable <GtNpcTotalHpEntry> sGtNpcTotalHpStore; +extern GameTable <GtNpcTotalHpExp1Entry> sGtNpcTotalHpExp1Store; +extern GameTable <GtNpcTotalHpExp2Entry> sGtNpcTotalHpExp2Store; +extern GameTable <GtNpcTotalHpExp3Entry> sGtNpcTotalHpExp3Store; +extern GameTable <GtNpcTotalHpExp4Entry> sGtNpcTotalHpExp4Store; +extern GameTable <GtNpcTotalHpExp5Entry> sGtNpcTotalHpExp5Store; extern GameTable <GtOCTClassCombatRatingScalarEntry> sGtOCTClassCombatRatingScalarStore; extern GameTable <gtOCTHpPerStaminaEntry> sGtOCTHpPerStaminaStore; extern GameTable <GtRegenMPPerSptEntry> sGtRegenMPPerSptStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 813f7ba4019..0b76ada0b96 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -850,6 +850,36 @@ struct GtNPCManaCostScalerEntry float ratio; }; +struct GtNpcTotalHpEntry +{ + float HP; +}; + +struct GtNpcTotalHpExp1Entry +{ + float HP; +}; + +struct GtNpcTotalHpExp2Entry +{ + float HP; +}; + +struct GtNpcTotalHpExp3Entry +{ + float HP; +}; + +struct GtNpcTotalHpExp4Entry +{ + float HP; +}; + +struct GtNpcTotalHpExp5Entry +{ + float HP; +}; + struct GtChanceToSpellCritEntry { float ratio; diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 3f9f01cab16..7b4e1d00ac6 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -74,6 +74,12 @@ char const GtChanceToSpellCritBasefmt[] = "xf"; char const GtChanceToSpellCritfmt[] = "xf"; char const GtItemSocketCostPerLevelfmt[] = "xf"; char const GtNPCManaCostScalerfmt[] = "xf"; +char const GtNpcTotalHpfmt[] = "xf"; +char const GtNpcTotalHpExp1fmt[] = "xf"; +char const GtNpcTotalHpExp2fmt[] = "xf"; +char const GtNpcTotalHpExp3fmt[] = "xf"; +char const GtNpcTotalHpExp4fmt[] = "xf"; +char const GtNpcTotalHpExp5fmt[] = "xf"; char const GtOCTClassCombatRatingScalarfmt[] = "df"; char const GtOCTRegenHPfmt[] = "f"; //char const GtOCTRegenMPfmt[] = "f"; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 6c29b9a64a9..1bdcb717c35 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -8365,7 +8365,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() { uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 16 - QueryResult result = WorldDatabase.Query("SELECT level, class, basehp0, basehp1, basehp2, basehp3, basehp4, basehp5, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2, damage_exp3, damage_exp4, damage_exp5 FROM creature_classlevelstats"); + QueryResult result = WorldDatabase.Query("SELECT level, class, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2, damage_exp3, damage_exp4, damage_exp5 FROM creature_classlevelstats"); if (!result) { @@ -8384,19 +8384,25 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) TC_LOG_ERROR("sql.sql", "Creature base stats for level %u has invalid class %u", Level, Class); + GtNpcTotalHpEntry const* HpExp0 = sGtNpcTotalHpStore.EvaluateTable(Level - 1, Class - 1); + GtNpcTotalHpExp1Entry const* HpExp1 = sGtNpcTotalHpExp1Store.EvaluateTable(Level - 1, Class - 1); + GtNpcTotalHpExp2Entry const* HpExp2 = sGtNpcTotalHpExp2Store.EvaluateTable(Level - 1, Class - 1); + GtNpcTotalHpExp3Entry const* HpExp3 = sGtNpcTotalHpExp3Store.EvaluateTable(Level - 1, Class - 1); + GtNpcTotalHpExp4Entry const* HpExp4 = sGtNpcTotalHpExp4Store.EvaluateTable(Level - 1, Class - 1); + GtNpcTotalHpExp5Entry const* HpExp5 = sGtNpcTotalHpExp5Store.EvaluateTable(Level - 1, Class - 1); + CreatureBaseStats stats; + stats.BaseHealth[0] = uint32(HpExp0->HP); + stats.BaseHealth[1] = uint32(HpExp1->HP); + stats.BaseHealth[2] = uint32(HpExp2->HP); + stats.BaseHealth[3] = uint32(HpExp3->HP); + stats.BaseHealth[4] = uint32(HpExp4->HP); + stats.BaseHealth[5] = uint32(HpExp5->HP); + for (uint8 i = 0; i < MAX_EXPANSIONS; ++i) { - stats.BaseHealth[i] = fields[2 + i].GetUInt32(); - - if (stats.BaseHealth[i] == 0) - { - TC_LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); - stats.BaseHealth[i] = 1; - } - - stats.BaseDamage[i] = fields[12 + i].GetFloat(); + stats.BaseDamage[i] = fields[6 + i].GetFloat(); if (stats.BaseDamage[i] < 0.0f) { TC_LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid negative base damage[%u] - set to 0.0", Class, Level, i); @@ -8404,11 +8410,11 @@ void ObjectMgr::LoadCreatureClassLevelStats() } } - stats.BaseMana = fields[8].GetUInt32(); - stats.BaseArmor = fields[9].GetUInt32(); + stats.BaseMana = fields[2].GetUInt32(); + stats.BaseArmor = fields[3].GetUInt32(); - stats.AttackPower = fields[10].GetUInt16(); - stats.RangedAttackPower = fields[11].GetUInt16(); + stats.AttackPower = fields[4].GetUInt16(); + stats.RangedAttackPower = fields[5].GetUInt16(); _creatureBaseStatsStore[MAKE_PAIR16(Level, Class)] = stats; |