mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Entities: Load creature health points from the Gt DBCs
This commit is contained in:
30
sql/updates/world/2015_01_10_07_world.sql
Normal file
30
sql/updates/world/2015_01_10_07_world.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
ALTER TABLE `creature_classlevelstats`
|
||||
DROP `basehp0`,
|
||||
DROP `basehp1`,
|
||||
DROP `basehp2`,
|
||||
DROP `basehp3`,
|
||||
DROP `basehp4`,
|
||||
DROP `basehp5`;
|
||||
|
||||
DELETE FROM `creature_classlevelstats` WHERE `level` BETWEEN 101 AND 105;
|
||||
INSERT INTO `creature_classlevelstats` (`level`, `class`, `basemana`, `basearmor`, `attackpower`, `rangedattackpower`, `damage_base`, `damage_exp1`, `damage_exp2`, `damage_exp3`, `damage_exp4`, `damage_exp5`, `comment`) VALUES
|
||||
(101, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(101, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(101, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(101, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(102, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(102, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(102, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(102, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(103, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(103, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(103, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(103, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(104, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(104, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(104, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(104, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(105, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(105, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(105, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ''),
|
||||
(105, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, '');
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user