diff options
author | Ovahlord <dreadkiller@gmx.de> | 2023-11-18 00:27:56 +0100 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2023-11-18 00:27:56 +0100 |
commit | a6ec08239c715e83b6120c59df050de6c6ba431d (patch) | |
tree | 52c6af2184369a1bd160ae75d25972b092e6267d | |
parent | 3f27949798ab87030b99bfb3ac94ebb8a3970768 (diff) |
Core/Creatures: ported creature classlevelstats from 335 branch and replaced scaling and content tuning difficulty fields with MinLevel and MaxLevel
-rw-r--r-- | sql/updates/world/3.4.x/2023_11_17_00_world.sql | 429 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 139 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 11 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/CreatureData.h | 30 | ||||
-rw-r--r-- | src/server/game/Entities/Pet/Pet.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 98 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/SharedDefines.h | 4 | ||||
-rw-r--r-- | src/server/game/Server/Packets/CombatLogPacketsCommon.cpp | 25 |
8 files changed, 546 insertions, 201 deletions
diff --git a/sql/updates/world/3.4.x/2023_11_17_00_world.sql b/sql/updates/world/3.4.x/2023_11_17_00_world.sql new file mode 100644 index 00000000000..ccec38034c1 --- /dev/null +++ b/sql/updates/world/3.4.x/2023_11_17_00_world.sql @@ -0,0 +1,429 @@ +UPDATE `creature_template_difficulty` SET `LevelScalingDeltaMax`= 1; +UPDATE `creature_template_difficulty` SET `LevelScalingDeltaMin`= 1; +ALTER TABLE `creature_template_difficulty` + DROP COLUMN `ContentTuningID`, + CHANGE `LevelScalingDeltaMin` `MinLevel` TINYINT DEFAULT 1 NOT NULL, + CHANGE `LevelScalingDeltaMax` `MaxLevel` TINYINT DEFAULT 1 NOT NULL; + +DROP TABLE IF EXISTS `creature_classlevelstats`; + +CREATE TABLE `creature_classlevelstats` ( + `level` tinyint unsigned NOT NULL, + `class` tinyint unsigned NOT NULL, + `basehp0` smallint unsigned NOT NULL DEFAULT '1', + `basehp1` smallint unsigned NOT NULL DEFAULT '1', + `basehp2` smallint unsigned NOT NULL DEFAULT '1', + `basemana` smallint unsigned NOT NULL DEFAULT '0', + `basearmor` smallint unsigned NOT NULL DEFAULT '1', + `attackpower` smallint unsigned NOT NULL DEFAULT '0', + `rangedattackpower` smallint unsigned NOT NULL DEFAULT '0', + `damage_base` float NOT NULL DEFAULT '0', + `damage_exp1` float NOT NULL DEFAULT '0', + `damage_exp2` float NOT NULL DEFAULT '0', + `comment` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`level`,`class`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +/*Data for the table `creature_classlevelstats` */ + +insert into `creature_classlevelstats`(`level`,`class`,`basehp0`,`basehp1`,`basehp2`,`basemana`,`basearmor`,`attackpower`,`rangedattackpower`,`damage_base`,`damage_exp1`,`damage_exp2`,`comment`) values +(1,1,42,42,42,0,7,9,0,0.1321,0.1321,0.1321,NULL), +(1,2,41,41,41,60,23,9,0,0.2381,0.2381,0.2381,NULL), +(1,4,42,42,42,0,23,9,0,0.1321,0.1321,0.1321,NULL), +(1,8,40,40,40,120,5,8,0,0.1781,0.1781,0.1781,NULL), +(2,1,55,55,55,0,8,11,0,0.2888,0.2888,0.2888,NULL), +(2,2,54,54,54,69,26,11,0,0.3119,0.3119,0.3119,NULL), +(2,4,55,55,55,0,26,11,0,0.2888,0.2888,0.2888,NULL), +(2,8,52,52,52,147,16,10,0,0.3233,0.3233,0.3233,NULL), +(3,1,71,71,71,0,33,13,0,0.5547,0.5547,0.5547,NULL), +(3,2,69,69,69,79,33,11,0,0.5952,0.5952,0.5952,NULL), +(3,4,71,71,71,0,33,13,0,0.5547,0.5547,0.5547,NULL), +(3,8,67,67,67,174,28,12,10,0.4793,0.4793,0.4793,NULL), +(4,1,86,86,86,0,68,15,0,0.9435,0.9435,0.9435,NULL), +(4,2,83,83,83,104,69,13,0,0.946,0.946,0.946,NULL), +(4,4,86,86,86,0,69,15,0,0.9435,0.9435,0.9435,NULL), +(4,8,81,81,81,202,57,13,11,0.5714,0.5714,0.5714,NULL), +(5,1,102,102,102,0,111,18,0,1.3708,1.3708,1.3708,NULL), +(5,2,98,98,98,115,112,14,0,1.4567,1.4567,1.4567,NULL), +(5,4,102,102,102,0,112,18,0,1.3708,1.3708,1.3708,NULL), +(5,8,95,95,95,230,93,14,11,0.768,0.768,0.768,NULL), +(6,1,120,120,120,0,165,20,0,2.0661,2.0661,2.0661,NULL), +(6,2,115,115,115,126,165,16,0,2.0933,2.0933,2.0933,NULL), +(6,4,120,120,120,0,165,20,0,2.0661,2.0661,2.0661,NULL), +(6,8,111,111,111,259,139,15,11,1.1985,1.1985,1.1985,NULL), +(7,1,137,137,137,0,230,24,0,2.7669,2.7669,2.7669,NULL), +(7,2,131,131,131,138,230,20,0,2.7273,2.7273,2.7273,NULL), +(7,4,137,137,137,0,230,24,0,2.7669,2.7669,2.7669,NULL), +(7,8,126,126,126,289,194,15,11,2.159,2.159,2.159,NULL), +(8,1,156,156,156,0,306,28,0,3.1993,3.1993,3.1993,NULL), +(8,2,148,148,148,165,307,24,0,3.1076,3.1076,3.1076,NULL), +(8,4,156,156,156,0,307,28,0,3.1993,3.1993,3.1993,NULL), +(8,8,143,143,143,319,265,16,11,2.5217,2.5217,2.5217,NULL), +(9,1,176,176,176,0,387,31,0,3.7038,3.7038,3.7038,NULL), +(9,2,166,166,166,178,396,27,0,3.595,3.595,3.595,NULL), +(9,4,176,176,176,0,396,31,0,3.7038,3.7038,3.7038,NULL), +(9,8,160,160,160,350,339,17,11,3.03,2.99,2.99,NULL), +(10,1,198,198,198,0,463,34,0,4.1084,4.1084,4.1084,NULL), +(10,2,186,186,186,191,502,30,0,3.9604,3.9604,3.9604,NULL), +(10,4,198,198,198,0,502,34,0,4.1084,4.1084,4.1084,NULL), +(10,8,178,178,178,382,423,17,12,3.4451,3.4451,3.4451,NULL), +(11,1,222,222,222,0,528,38,0,4.6996,4.6996,4.6996,NULL), +(11,2,208,208,208,205,528,34,0,4.4552,4.4552,4.4552,NULL), +(11,4,222,222,222,0,528,38,0,4.6996,4.6996,4.6996,NULL), +(11,8,199,199,199,459,447,18,12,3.975,3.975,3.975,NULL), +(12,1,247,247,247,0,562,42,0,5.4601,5.4601,5.4601,NULL), +(12,2,230,230,230,249,562,38,0,5.1436,5.1436,5.1436,NULL), +(12,4,247,247,247,0,562,42,0,5.4601,5.4601,5.4601,NULL), +(12,8,219,219,219,537,475,19,12,4.6771,4.6771,4.6771,NULL), +(13,1,273,273,273,0,596,46,1,5.9359,5.9359,5.9359,NULL), +(13,2,253,253,253,264,562,42,1,5.5674,5.5674,5.5674,NULL), +(13,4,273,273,273,0,562,46,1,5.9359,5.9359,5.9359,NULL), +(13,8,241,241,241,601,509,20,12,5.1513,5.1513,5.1513,NULL), +(14,1,300,300,300,0,630,50,1,6.5895,6.5895,6.5895,NULL), +(14,2,276,276,276,295,630,46,1,6.1568,6.1568,6.1568,NULL), +(14,4,300,300,300,0,630,50,1,6.5895,6.5895,6.5895,NULL), +(14,8,263,263,263,710,523,21,12,5.7241,5.7241,5.7241,NULL), +(15,1,328,328,328,0,665,54,2,7.1981,7.1981,7.1981,NULL), +(15,2,301,301,301,326,665,48,2,6.8211,6.8211,6.8211,NULL), +(15,4,328,328,328,0,665,54,2,7.1981,7.1981,7.1981,NULL), +(15,8,285,285,285,790,559,22,13,6.3298,6.3298,6.3298,NULL), +(16,1,356,356,356,0,700,56,2,7.6697,7.6697,7.6697,NULL), +(16,2,325,325,325,357,700,52,2,7.1374,7.1374,7.1374,NULL), +(16,4,356,356,356,0,700,56,2,7.6697,7.6697,7.6697,NULL), +(16,8,307,307,307,856,589,24,13,6.6051,6.6051,6.6051,NULL), +(17,1,386,386,386,0,734,60,2,8.2225,8.2225,8.2225,NULL), +(17,2,350,350,350,390,734,56,2,7.6355,7.6355,7.6355,NULL), +(17,4,386,386,386,0,734,60,2,8.2225,8.2225,8.2225,NULL), +(17,8,330,330,330,938,617,26,13,7.0485,7.0485,7.0485,NULL), +(18,1,417,417,417,0,768,64,3,8.5452,8.5452,8.5452,NULL), +(18,2,377,377,377,408,768,58,3,8.0339,8.0339,8.0339,NULL), +(18,4,417,417,417,0,768,64,3,8.5452,8.5452,8.5452,NULL), +(18,8,354,354,354,1020,643,27,13,7.4083,7.4083,7.4083,NULL), +(19,1,449,449,449,0,802,68,3,8.9384,8.9384,8.9384,NULL), +(19,2,404,404,404,456,802,60,3,8.611,8.611,8.611,NULL), +(19,4,449,449,449,0,802,68,3,8.9384,8.9384,8.9384,NULL), +(19,8,379,379,379,1118,674,28,13,7.9333,7.9333,7.9333,NULL), +(20,1,484,484,484,0,836,70,4,9.6823,9.6823,9.6823,NULL), +(20,2,433,433,433,490,836,64,4,9.0674,9.0674,9.0674,NULL), +(20,4,484,484,484,0,836,70,4,9.6823,9.6823,9.6823,NULL), +(20,8,405,405,405,1202,701,30,14,8.3382,8.3382,8.3382,NULL), +(21,1,521,521,521,0,872,74,4,9.9677,9.9677,9.9677,NULL), +(21,2,464,464,464,510,872,68,4,9.3169,9.3169,9.3169,NULL), +(21,4,521,521,521,0,872,74,4,9.9677,9.9677,9.9677,NULL), +(21,8,432,432,432,1272,729,32,14,8.5517,8.5517,8.5517,NULL), +(22,1,562,562,562,0,906,78,4,10.4218,10.4218,10.4218,NULL), +(22,2,498,498,498,545,906,71,5,9.7945,9.7945,9.7945,NULL), +(22,4,562,562,562,0,906,78,4,10.4218,10.4218,10.4218,NULL), +(22,8,463,463,463,1357,759,34,14,8.9102,8.9102,8.9102,NULL), +(23,1,605,605,605,0,940,80,5,10.8099,10.8099,10.8099,NULL), +(23,2,533,533,533,581,940,74,5,10.076,10.076,10.076,NULL), +(23,4,605,605,605,0,940,80,5,10.8099,10.8099,10.8099,NULL), +(23,8,494,494,494,1443,786,35,14,9.228,9.228,9.228,NULL), +(24,1,651,651,651,0,975,84,6,11.2419,11.2419,11.2419,NULL), +(24,2,571,571,571,618,975,78,6,10.4619,10.4619,10.4619,NULL), +(24,4,651,651,651,0,975,84,6,11.2419,11.2419,11.2419,NULL), +(24,8,528,528,528,1545,815,36,15,9.6818,9.6818,9.6818,NULL), +(25,1,699,699,699,0,1008,86,6,11.7485,11.7485,11.7485,NULL), +(25,2,610,610,610,655,1008,80,6,10.7857,10.7857,10.7857,NULL), +(25,4,699,699,699,0,1008,86,6,11.7485,11.7485,11.7485,NULL), +(25,8,562,562,562,1633,843,37,15,10.1014,10.1014,10.1014,NULL), +(26,1,750,750,750,0,1043,90,7,12.0453,12.0453,12.0453,NULL), +(26,2,651,651,651,693,1042,84,6,11.1849,11.1849,11.1849,NULL), +(26,4,750,750,750,0,1042,90,7,12.0453,12.0453,12.0453,NULL), +(26,8,598,598,598,1707,871,39,15,10.3246,10.3246,10.3246,NULL), +(27,1,800,800,800,0,1078,92,7,12.6213,12.6213,12.6213,NULL), +(27,2,690,690,690,732,1078,86,7,11.7126,11.7126,11.7126,NULL), +(27,4,800,800,800,0,1078,92,7,12.6213,12.6213,12.6213,NULL), +(27,8,633,633,633,1812,900,40,15,10.804,10.804,10.804,NULL), +(28,1,853,853,853,0,1111,96,8,12.795,12.795,12.795,NULL), +(28,2,732,732,732,756,1110,90,7,11.9663,11.9663,11.9663,NULL), +(28,4,853,853,853,0,1110,96,8,12.795,12.795,12.795,NULL), +(28,8,669,669,669,1977,928,42,15,11.0213,11.0213,11.0213,NULL), +(29,1,905,905,905,0,1145,100,8,13.3432,13.3432,13.3432,NULL), +(29,2,773,773,773,811,1145,94,8,12.352,12.352,12.352,NULL), +(29,4,905,905,905,0,1145,100,8,13.3432,13.3432,13.3432,NULL), +(29,8,704,704,704,2068,957,44,16,11.3608,11.3608,11.3608,NULL), +(30,1,955,955,955,0,1179,102,9,13.9264,13.9264,13.9264,NULL), +(30,2,811,811,811,852,1178,94,8,13.0007,13.0007,13.0007,NULL), +(30,4,955,955,955,0,1178,102,9,13.9264,13.9264,13.9264,NULL), +(30,8,737,737,737,2175,984,44,16,11.9607,11.9607,11.9607,NULL), +(31,1,1006,1006,1006,0,1213,106,9,14.1954,14.1954,14.1954,NULL), +(31,2,850,850,850,878,1213,98,9,13.2348,13.2348,13.2348,NULL), +(31,4,1006,1006,1006,0,1213,106,9,14.1954,14.1954,14.1954,NULL), +(31,8,770,770,770,2253,1012,46,16,12.16,12.16,12.16,NULL), +(32,1,1057,1057,1057,0,1249,108,10,14.696,14.696,14.696,NULL), +(32,2,888,888,888,935,1248,100,9,13.6924,13.6924,13.6924,NULL), +(32,4,1057,1057,1057,0,1248,108,10,14.696,14.696,14.696,NULL), +(32,8,802,802,802,2362,1042,47,16,12.5746,12.5746,12.5746,NULL), +(33,1,1110,1110,1110,0,1281,112,10,14.9914,14.9914,14.9914,NULL), +(33,2,928,928,928,963,1281,104,10,13.9511,13.9511,13.9511,NULL), +(33,4,1110,1110,1110,0,1281,112,10,14.9914,14.9914,14.9914,NULL), +(33,8,835,835,835,2457,1065,49,17,12.7966,12.7966,12.7966,NULL), +(34,1,1163,1163,1163,0,1317,114,11,15.4944,15.4944,15.4944,NULL), +(34,2,967,967,967,1007,1316,106,10,14.4142,14.4142,14.4142,NULL), +(34,4,1163,1163,1163,0,1316,114,11,15.4944,15.4944,15.4944,NULL), +(34,8,867,867,867,2553,1098,50,17,13.2162,13.2162,13.2162,NULL), +(35,1,1220,1220,1220,0,1349,118,11,15.8617,15.8617,15.8617,NULL), +(35,2,1009,1009,1009,1067,1349,110,11,14.7365,14.7365,14.7365,NULL), +(35,4,1220,1220,1220,0,1349,118,11,15.8617,15.8617,15.8617,NULL), +(35,8,902,902,902,2680,1124,52,17,13.497,13.497,13.497,NULL), +(36,1,1277,1277,1277,0,1456,120,12,16.2984,16.2984,16.2984,NULL), +(36,2,1050,1050,1050,1097,1455,112,11,15.1346,15.1346,15.1346,NULL), +(36,4,1277,1277,1277,0,1455,120,12,16.2984,16.2984,16.2984,NULL), +(36,8,935,935,935,2763,1241,53,18,13.8566,13.8566,13.8566,NULL), +(37,1,1336,1336,1336,0,1568,124,12,16.7962,16.7962,16.7962,NULL), +(37,2,1093,1093,1093,1142,1567,116,11,15.5816,15.5816,15.5816,NULL), +(37,4,1336,1336,1336,0,1567,124,12,16.7962,16.7962,16.7962,NULL), +(37,8,970,970,970,2861,1300,54,18,14.367,14.367,14.367,NULL), +(38,1,1395,1395,1395,0,1684,128,13,17.1865,17.1865,17.1865,NULL), +(38,2,1135,1135,1135,1189,1683,120,12,15.9286,15.9286,15.9286,NULL), +(38,4,1395,1395,1395,0,1683,128,13,17.1865,17.1865,17.1865,NULL), +(38,8,1004,1004,1004,2975,1391,56,18,14.6707,14.6707,14.6707,NULL), +(39,1,1459,1459,1459,0,1808,132,13,17.7286,17.7286,17.7286,NULL), +(39,2,1180,1180,1180,1236,1807,124,12,16.4168,16.4168,16.4168,NULL), +(39,4,1459,1459,1459,0,1807,132,13,17.7286,17.7286,17.7286,NULL), +(39,8,1040,1040,1040,3075,1489,58,18,15.1049,15.1049,15.1049,NULL), +(40,1,1524,1524,1524,0,1938,136,14,18.2971,18.2971,18.2971,NULL), +(40,2,1226,1226,1226,1283,1937,128,13,16.9294,16.9294,16.9294,NULL), +(40,4,1524,1524,1524,0,1937,136,14,18.2971,18.2971,18.2971,NULL), +(40,8,1077,1077,1077,3191,1590,60,19,15.5617,15.5617,15.5617,NULL), +(41,1,1585,1585,1585,0,2074,142,15,19.1997,19.1997,19.1997,NULL), +(41,2,1268,1268,1268,1332,2072,132,13,17.8592,17.8592,17.8592,NULL), +(41,4,1585,1585,1585,0,2072,142,15,19.1997,19.1997,19.1997,NULL), +(41,8,1110,1110,1110,3293,1697,62,19,16.4044,16.4044,16.4044,NULL), +(42,1,1651,1651,1651,0,2218,152,15,20.3431,20.3431,20.3431,NULL), +(42,2,1321,1321,1321,1381,2216,142,13,18.8824,18.8824,18.8824,NULL), +(42,4,1651,1651,1651,0,2216,152,15,20.3431,20.3431,20.3431,NULL), +(42,8,1156,1156,1156,3471,1811,67,19,17.3076,17.3076,17.3076,NULL), +(43,1,1716,1716,1716,0,2369,162,16,21.7088,21.7088,21.7088,NULL), +(43,2,1373,1373,1373,1432,2367,152,14,20.1127,20.1127,20.1127,NULL), +(43,4,1716,1716,1716,0,2367,162,16,21.7088,21.7088,21.7088,NULL), +(43,8,1201,1201,1201,3575,1926,71,19,18.5165,18.5165,18.5165,NULL), +(44,1,1782,1782,1782,0,2528,174,16,23.5881,23.5881,23.5881,NULL), +(44,2,1426,1426,1426,1483,2527,166,15,21.6981,21.6981,21.6981,NULL), +(44,4,1782,1782,1782,0,2527,174,16,23.5881,23.5881,23.5881,NULL), +(44,8,1247,1247,1247,3680,2078,78,20,19.9224,19.9224,19.9224,NULL), +(45,1,1848,1848,1848,0,2695,184,17,24.6797,24.6797,24.6797,NULL), +(45,2,1478,1478,1478,1534,2692,172,15,22.9018,22.9018,22.9018,NULL), +(45,4,1848,1848,1848,0,2692,184,17,24.6797,24.6797,24.6797,NULL), +(45,8,1294,1294,1294,3801,2177,81,20,21.0097,21.0097,21.0097,NULL), +(46,1,1919,1919,1919,0,2750,188,17,25.1735,25.1735,25.1735,NULL), +(46,2,1535,1535,1535,1587,2749,176,16,23.3451,23.3451,23.3451,NULL), +(46,4,1919,1919,1919,0,2749,188,17,25.1735,25.1735,25.1735,NULL), +(46,8,1343,1343,1343,3923,2220,83,20,21.4023,21.4023,21.4023,NULL), +(47,1,1990,1990,1990,0,2804,192,18,25.7137,25.7137,25.7137,NULL), +(47,2,1592,1592,1592,1640,2802,180,16,23.9542,23.9542,23.9542,NULL), +(47,4,1990,1990,1990,0,2802,192,18,25.7137,25.7137,25.7137,NULL), +(47,8,1393,1393,1393,4031,2265,85,21,21.9484,21.9484,21.9484,NULL), +(48,1,2062,2062,2062,0,2857,196,19,26.209,26.209,26.209,NULL), +(48,2,1650,1650,1650,1695,2855,184,17,24.401,24.401,24.401,NULL), +(48,4,2062,2062,2062,0,2855,196,19,26.209,26.209,26.209,NULL), +(48,8,1443,1443,1443,4140,2307,87,21,22.3444,22.3444,22.3444,NULL), +(49,1,2138,2138,2138,0,2912,200,19,26.9952,26.9952,26.9952,NULL), +(49,2,1710,1710,1710,1750,2910,188,17,24.9975,24.9975,24.9975,NULL), +(49,4,2138,2138,2138,0,2910,200,19,26.9952,26.9952,26.9952,NULL), +(49,8,1497,1497,1497,4281,2349,89,21,22.8788,22.8788,22.8788,NULL), +(50,1,2215,2215,2215,0,2966,206,20,27.5899,27.5899,27.5899,NULL), +(50,2,1772,1772,1772,1807,2964,194,18,25.5204,25.5204,25.5204,NULL), +(50,4,2215,2215,2215,0,2964,206,20,27.5899,27.5899,27.5899,NULL), +(50,8,1551,1551,1551,4393,2393,91,22,23.4508,23.4508,23.4508,NULL), +(51,1,2292,2292,2292,0,3018,210,20,28.128,28.128,28.128,NULL), +(51,2,1834,1834,1834,1864,3017,198,19,26.0047,26.0047,26.0047,NULL), +(51,4,2292,2292,2292,0,3017,210,20,28.128,28.128,28.128,NULL), +(51,8,1604,1604,1604,4506,2437,93,22,23.8815,23.8815,23.8815,NULL), +(52,1,2371,2371,2371,0,3074,214,21,28.8795,28.8795,28.8795,NULL), +(52,2,1897,1897,1897,1923,3072,202,19,26.6877,26.6877,26.6877,NULL), +(52,4,2371,2371,2371,0,3072,214,21,28.8795,28.8795,28.8795,NULL), +(52,8,1660,1660,1660,4650,2481,95,22,24.4958,24.4958,24.4958,NULL), +(53,1,2453,2453,2453,0,3128,218,22,29.4381,29.4381,29.4381,NULL), +(53,2,1962,1962,1962,1982,3126,206,20,27.1912,27.1912,27.1912,NULL), +(53,4,2453,2453,2453,0,3126,218,22,29.4381,29.4381,29.4381,NULL), +(53,8,1717,1717,1717,4765,2524,97,23,24.9442,24.9442,24.9442,NULL), +(54,1,2533,2533,2533,0,3180,224,22,30.0501,30.0501,30.0501,NULL), +(54,2,2026,2026,2026,2041,3178,210,20,27.8506,27.8506,27.8506,NULL), +(54,4,2533,2533,2533,0,3178,224,22,30.0501,30.0501,30.0501,NULL), +(54,8,1773,1773,1773,4896,2567,99,23,25.5368,25.5368,25.5368,NULL), +(55,1,2614,2614,2614,0,3234,228,23,30.7177,30.7177,30.7177,NULL), +(55,2,2091,2091,2091,2117,3232,214,21,28.4555,28.4555,28.4555,NULL), +(55,4,2614,2614,2614,0,3232,228,23,30.7177,30.7177,30.7177,NULL), +(55,8,1830,1830,1830,5013,2609,101,23,26.079,26.079,26.079,NULL), +(56,1,2699,2699,2699,0,3289,234,23,31.2387,31.2387,31.2387,NULL), +(56,2,2159,2159,2159,2163,3287,220,21,28.9161,28.9161,28.9161,NULL), +(56,4,2699,2699,2699,0,3287,234,23,31.2387,31.2387,31.2387,NULL), +(56,8,1889,1889,1889,5206,2654,104,24,26.4791,26.4791,26.4791,NULL), +(57,1,2784,2784,2784,0,3342,238,24,31.945,31.945,31.945,NULL), +(57,2,2227,2227,2227,2241,3340,224,22,29.5701,29.5701,29.5701,NULL), +(57,4,2784,2784,2784,0,3340,238,24,31.945,31.945,31.945,NULL), +(57,8,1949,1949,1949,5340,2698,106,24,27.0667,27.0667,27.0667,NULL), +(58,1,2871,3989,3989,0,3396,242,25,32.5967,40.2143,40.2143,NULL), +(58,2,2297,3191,3191,2289,3394,228,23,30.1469,34.7143,34.7143,NULL), +(58,4,2871,3989,3989,0,3394,242,25,32.5967,40.2143,40.2143,NULL), +(58,8,2010,2793,2793,5461,2740,107,24,27.6972,37.4048,37.4048,NULL), +(59,1,2961,4142,4142,0,3449,248,25,33.2007,43.2857,43.2857,NULL), +(59,2,2369,3314,3314,2369,3447,234,23,30.6847,49.6442,49.6442,NULL), +(59,4,2961,4142,4142,0,3447,248,25,33.2007,43.2857,43.2857,NULL), +(59,8,2073,2899,2899,5598,2784,110,25,28.1686,46.5537,46.5537,NULL), +(60,1,3052,4979,4979,0,3750,252,26,33.9625,53.4755,53.4755,NULL), +(60,2,2442,3984,3984,2434,3748,238,24,31.3842,55,55,NULL), +(60,4,3052,4979,4979,0,3748,252,26,33.9625,53.4755,53.4755,NULL), +(60,8,2136,3484,3484,5751,3025,112,25,28.7983,50.396,50.396,NULL), +(61,1,3144,5158,5158,0,4047,258,28,34.5714,61.2729,61.2729,NULL), +(61,2,2515,4126,4126,2486,4044,244,25,31.837,58.3279,58.3279,NULL), +(61,4,3144,5158,5158,0,4044,258,28,34.5714,61.2729,61.2729,NULL), +(61,8,2201,3611,3611,5875,3263,115,25,29.3225,53.4807,53.4807,NULL), +(62,1,3237,5341,5341,0,4344,262,30,35.2381,67.4442,67.4442,NULL), +(62,2,2590,4274,4274,2568,4340,246,26,32.6201,62.4676,62.4676,NULL), +(62,4,3237,5341,5341,0,4340,262,30,35.2381,67.4442,67.4442,NULL), +(62,8,2266,3739,3739,6015,3500,116,25,29.917,57.2713,57.2713,NULL), +(63,1,3331,5527,5527,0,4641,268,32,35.775,71.4361,71.4361,NULL), +(63,2,2665,4422,4422,2620,4637,252,27,33.1092,66.121,66.121,NULL), +(63,4,3331,5527,5527,0,4637,268,32,35.9047,71.4361,71.4361,NULL), +(63,8,2332,3870,3870,6156,3736,119,26,30.4646,60.577,60.577,NULL), +(64,1,3427,5715,5715,0,4937,272,33,36.5714,75.9334,75.9334,NULL), +(64,2,2740,4572,4572,2705,4932,256,28,33.7143,70.2568,70.2568,NULL), +(64,4,3427,5715,5715,0,4932,272,33,36.5714,75.9334,75.9334,NULL), +(64,8,2399,4002,4002,6299,3977,121,26,31.0435,64.089,64.089,NULL), +(65,1,3524,5914,5914,0,5234,278,35,37.2381,80.3794,80.3794,NULL), +(65,2,2819,4731,4731,2790,5228,262,29,34.3333,74.3252,74.3252,NULL), +(65,4,3524,5914,5914,0,5228,278,35,37.2381,80.3794,80.3794,NULL), +(65,8,2467,4140,4731,6443,4214,124,26,31.6015,68.0244,69.9742,NULL), +(66,1,3624,6116,6116,0,5531,282,37,37.9047,84.8941,84.8941,NULL), +(66,2,2899,4892,6116,2846,5523,266,29,35.0158,78.472,84.8941,NULL), +(66,4,3624,6116,6116,0,5523,282,37,37.9047,84.8941,84.8941,NULL), +(66,8,2552,4281,4892,6588,4460,125,27,32.1734,72.0499,78.8784,NULL), +(67,1,3728,6326,6326,0,5829,288,39,38.5714,89.6211,94.901,NULL), +(67,2,2982,5060,6326,2933,5821,272,31,35.656,82.7944,94.901,NULL), +(67,4,3728,6326,6326,0,5821,288,39,38.5714,89.6211,94.901,NULL), +(67,8,2610,4429,5060,6749,4710,128,27,32.736,75.9676,87.7826,NULL), +(68,1,3834,6542,6986,0,6126,292,41,39.2381,94.4934,104.527,NULL), +(68,2,3067,5233,6986,2991,6116,276,31,36.3244,87.2677,104.527,NULL), +(68,4,3834,6542,6986,0,6116,292,41,39.2381,94.4934,104.527,NULL), +(68,8,2684,4580,5588,6882,4928,130,27,33.3048,80.1061,96.6868,NULL), +(69,1,3942,6761,7984,0,6423,298,43,39.9047,99.5328,114.153,NULL), +(69,2,3153,5409,7984,3080,6412,282,32,36.974,91.8916,114.153,NULL), +(69,4,3942,6761,7984,0,6412,298,43,39.9047,99.5328,114.153,NULL), +(69,8,2759,4733,6387,7031,5167,133,28,33.8695,84.2722,105.591,NULL), +(70,1,4050,6986,8982,0,6719,304,44,40.5714,104.527,123.779,NULL), +(70,2,3240,5589,8982,3155,6708,286,33,37.6361,96.7364,123.779,NULL), +(70,4,4050,6986,8982,0,6708,304,44,40.5714,104.527,123.779,NULL), +(70,8,2835,4890,7185,7196,5404,135,28,34.4369,88.3402,114.496,NULL), +(71,1,4163,7181,9291,0,7018,308,48,41.2381,106.357,127.382,NULL), +(71,2,3330,5744,9291,3231,7007,290,37,38.2899,98.3977,127.383,NULL), +(71,4,4163,7181,9291,0,7007,308,48,41.2381,106.357,127.382,NULL), +(71,8,2914,5027,7432,7332,5645,137,31,35.0025,92.4034,117.829,NULL), +(72,1,4278,7380,9610,0,7318,314,53,41.9047,108.071,131.091,NULL), +(72,2,3422,5903,9610,3309,7305,296,40,38.9492,99.8571,131.092,NULL), +(72,4,4278,7380,9610,0,7305,314,53,41.9047,108.071,131.091,NULL), +(72,8,2995,5166,7688,7500,5886,140,34,35.5693,96.5068,121.259,NULL), +(73,1,4399,7588,9940,0,7618,320,58,42.5714,118.643,134.908,NULL), +(73,2,3519,6070,9940,3387,7604,302,44,39.6048,101.451,134.908,NULL), +(73,4,4399,7588,9940,0,7604,320,58,42.5714,118.643,134.908,NULL), +(73,8,3098,5311,7952,7654,6126,143,37,36.1353,100.617,124.79,NULL), +(74,1,4524,7804,10282,0,7918,354,63,43.2381,120.434,138.836,NULL), +(74,2,3619,6243,10282,3466,7903,334,48,40.2629,102.955,138.836,NULL), +(74,4,4524,7804,10282,0,7903,354,63,43.2381,120.434,138.836,NULL), +(74,8,3186,5461,8225,7809,6368,158,41,36.7018,104.723,128.423,NULL), +(75,1,4652,8025,10635,0,8219,392,68,43.9047,122.226,142.878,NULL), +(75,2,3722,6420,10635,3561,8204,370,53,40.9193,104.52,142.878,NULL), +(75,4,4652,8025,10635,0,8204,392,68,43.9047,122.226,142.878,NULL), +(75,8,3256,5617,8508,7981,6610,175,45,37.268,108.832,132.162,NULL), +(76,1,4781,8247,11001,0,8520,432,74,44.5713,124.018,147.038,NULL), +(76,2,3825,6602,11001,3643,8503,408,57,41.5757,106.085,147.038,NULL), +(76,4,4781,8247,11001,0,8503,432,74,44.5713,124.018,147.038,NULL), +(76,8,3367,5778,8800,8139,6851,193,49,37.8342,112.941,136.01,NULL), +(77,1,4916,8480,11379,0,8822,478,81,45.2379,125.81,151.319,NULL), +(77,2,3933,6784,11379,3725,8803,452,62,42.2321,107.65,151.319,NULL), +(77,4,4916,8480,11379,0,8803,478,81,45.2379,125.81,151.319,NULL), +(77,8,3462,5945,9103,8313,7094,214,54,38.4004,117.05,139.97,NULL), +(78,1,5052,8715,11770,0,9124,528,88,45.9045,127.602,155.724,NULL), +(78,2,4042,6972,11770,3809,9104,500,68,42.8885,109.215,155.724,NULL), +(78,4,5052,8715,11770,0,9104,528,88,45.9045,127.602,155.724,NULL), +(78,8,3558,6117,9416,8459,7335,236,58,38.9666,121.159,144.045,NULL), +(79,1,5194,8960,12175,0,9426,582,95,46.5711,129.394,160.258,NULL), +(79,2,4155,7167,12175,3893,9405,550,74,43.5449,110.78,160.258,NULL), +(79,4,5194,8960,12175,0,9405,582,95,46.5711,129.394,160.258,NULL), +(79,8,3658,6295,9740,8636,7579,260,64,39.5328,125.268,148.239,NULL), +(80,1,5342,9215,12600,0,9729,642,103,47.2377,131.186,164.924,NULL), +(80,2,4274,7373,12600,3994,9706,608,80,44.2013,112.345,164.924,NULL), +(80,4,5342,9215,12600,0,9706,642,103,47.2377,131.186,164.924,NULL), +(80,8,3739,6478,10080,8814,7822,287,69,40.099,129.377,152.555,NULL), +(81,1,5492,9474,13033,0,10033,708,112,47.9043,132.978,168.974,NULL), +(81,2,4394,7581,13033,4081,10007,670,86,44.8577,113.91,169.095,NULL), +(81,4,5492,9474,13033,0,10007,708,112,47.9043,132.978,168.974,NULL), +(81,8,3870,6667,10486,8979,8102,317,74,40.6652,133.486,156.871,NULL), +(82,1,5647,9741,13481,0,10356,782,121,48.5709,134.77,173.024,NULL), +(82,2,4518,7794,13481,4169,10253,726,91,45.5141,115.475,173.266,NULL), +(82,4,5647,9741,13481,0,10253,782,121,48.5709,134.77,173.024,NULL), +(82,8,3977,6861,10784,9160,8340,350,79,41.2314,137.595,161.187,NULL), +(83,1,5808,10019,13945,0,10673,805,135,49.2375,136.562,177.074,NULL), +(83,2,4646,8012,13945,4258,10573,783,98,46.1705,117.04,177.438,NULL), +(83,4,5808,10019,13945,0,10573,805,135,49.2375,136.562,177.074,NULL), +(83,8,4090,7061,11156,9328,8505,386,84,41.7976,141.704,165.503,NULL), +(84,1,5971,10300,14426,0,10990,828,149,49.9041,138.354,181.124,NULL), +(84,2,4778,8235,14423,4363,10893,840,105,46.8269,118.605,181.61,NULL), +(84,4,5971,10300,14426,0,10893,828,149,49.9041,138.354,181.124,NULL), +(84,8,4195,7266,11602,9512,8670,425,89,42.3638,145.813,169.819,NULL), +(85,1,6141,10595,15498,0,11307,851,163,50.5707,140.146,185.174,NULL), +(85,2,4913,8463,15498,4454,11213,897,112,47.4833,120.17,185.782,NULL), +(85,4,6141,10595,15498,0,11213,851,163,50.5707,140.146,185.174,NULL), +(85,8,4299,7477,12122,9697,8835,467,94,42.93,149.922,174.135,NULL), +(86,1,1,1,1,0,1,0,0,0,0,0,NULL), +(86,2,1,1,1,1,1,0,0,0,0,0,NULL), +(86,4,1,1,1,0,1,0,0,0,0,0,NULL), +(86,8,1,1,1,1,1,0,0,0,0,0,NULL), +(87,1,1,1,1,0,1,0,0,0,0,0,NULL), +(87,2,1,1,1,1,1,0,0,0,0,0,NULL), +(87,4,1,1,1,0,1,0,0,0,0,0,NULL), +(87,8,1,1,1,1,1,0,0,0,0,0,NULL), +(88,1,1,1,1,0,1,0,0,0,0,0,NULL), +(88,2,1,1,16515,4735,1,0,0,0,0,0,NULL), +(88,4,1,1,1,0,1,0,0,0,0,0,NULL), +(88,8,1,1,1,10232,1,0,0,0,0,0,NULL), +(89,1,1,1,1,0,1,0,0,0,0,0,NULL), +(89,2,1,1,1,1,1,0,0,0,0,0,NULL), +(89,4,1,1,1,0,1,0,0,0,0,0,NULL), +(89,8,1,1,1,1,1,0,0,0,0,0,NULL), +(90,1,1,1,1,0,1,0,0,0,0,0,NULL), +(90,2,1,1,1,1,1,0,0,0,0,0,NULL), +(90,4,1,1,1,0,1,0,0,0,0,0,NULL), +(90,8,1,1,1,1,1,0,0,0,0,0,NULL), +(91,1,1,1,1,0,1,0,0,0,0,0,NULL), +(91,2,1,1,1,1,1,0,0,0,0,0,NULL), +(91,4,1,1,1,0,1,0,0,0,0,0,NULL), +(91,8,1,1,1,1,1,0,0,0,0,0,NULL), +(92,1,1,1,1,0,1,0,0,0,0,0,NULL), +(92,2,1,1,1,1,1,0,0,0,0,0,NULL), +(92,4,1,1,1,0,1,0,0,0,0,0,NULL), +(92,8,1,1,1,1,1,0,0,0,0,0,NULL), +(93,1,1,1,1,0,1,0,0,0,0,0,NULL), +(93,2,1,1,1,1,1,0,0,0,0,0,NULL), +(93,4,1,1,1,0,1,0,0,0,0,0,NULL), +(93,8,1,1,1,1,1,0,0,0,0,0,NULL), +(94,1,1,1,1,0,1,0,0,0,0,0,NULL), +(94,2,1,1,1,1,1,0,0,0,0,0,NULL), +(94,4,1,1,1,0,1,0,0,0,0,0,NULL), +(94,8,1,1,1,1,1,0,0,0,0,0,NULL), +(95,1,1,1,1,0,1,0,0,0,0,0,NULL), +(95,2,1,1,1,1,1,0,0,0,0,0,NULL), +(95,4,1,1,1,0,1,0,0,0,0,0,NULL), +(95,8,1,1,1,1,1,0,0,0,0,0,NULL), +(96,1,1,1,1,0,1,0,0,0,0,0,NULL), +(96,2,1,1,1,1,1,0,0,0,0,0,NULL), +(96,4,1,1,1,0,1,0,0,0,0,0,NULL), +(96,8,1,1,1,1,1,0,0,0,0,0,NULL), +(97,1,1,1,1,0,1,0,0,0,0,0,NULL), +(97,2,1,1,1,1,1,0,0,0,0,0,NULL), +(97,4,1,1,1,0,1,0,0,0,0,0,NULL), +(97,8,1,1,1,1,1,0,0,0,0,0,NULL), +(98,1,1,1,1,0,1,0,0,0,0,0,NULL), +(98,2,1,1,1,1,1,0,0,0,0,0,NULL), +(98,4,1,1,1,0,1,0,0,0,0,0,NULL), +(98,8,1,1,1,1,1,0,0,0,0,0,NULL), +(99,1,1,1,1,0,1,0,0,0,0,0,NULL), +(99,2,1,1,1,1,1,0,0,0,0,0,NULL), +(99,4,1,1,1,0,1,0,0,0,0,0,NULL), +(99,8,1,1,1,1,1,0,0,0,0,0,NULL), +(100,1,1,1,1,0,1,0,0,0,0,0,NULL), +(100,2,1,1,1,1,1,0,0,0,0,0,NULL), +(100,4,1,1,1,0,1,0,0,0,0,0,NULL), +(100,8,1,1,1,1,1,0,0,0,0,0,NULL); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 0b09a1a2316..d4f83a03d87 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -253,9 +253,8 @@ CreatureDifficulty const* CreatureTemplate::GetDifficulty(Difficulty difficulty) { DefaultCreatureDifficulty() { - DeltaLevelMin = 0; - DeltaLevelMax = 0; - ContentTuningID = 0; + MinLevel = 1; + MaxLevel = 1; HealthScalingExpansion = 0; HealthModifier = 1.f; ManaModifier = 1.f; @@ -618,17 +617,15 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, if (updateLevel) SelectLevel(); - else if (!IsGuardian()) + + // Do not update guardian stats here - they are handled in Guardian::InitStatsForLevel() + if (!IsGuardian()) { uint32 previousHealth = GetHealth(); UpdateLevelDependantStats(); // We still re-initialize level dependant stats on entry update if (previousHealth > 0) SetHealth(previousHealth); - } - // Do not update guardian stats here - they are handled in Guardian::InitStatsForLevel() - if (!IsGuardian()) - { SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); SetStatFlatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_HOLY])); SetStatFlatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(cInfo->resistance[SPELL_SCHOOL_FIRE])); @@ -1552,25 +1549,23 @@ void Creature::SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDiffic void Creature::SelectLevel() { // Level - ApplyLevelScaling(); - int32 levelWithDelta = m_unitData->ScalingLevelMax + m_unitData->ScalingLevelDelta; - uint8 level = RoundToInterval<int32>(levelWithDelta, 1, STRONG_MAX_LEVEL); - SetLevel(level); - - UpdateLevelDependantStats(); + CreatureDifficulty const* difficulty = GetCreatureDifficulty(); + if (difficulty->MinLevel != difficulty->MaxLevel) + SetLevel(urand(difficulty->MinLevel, difficulty->MaxLevel)); + else + SetLevel(difficulty->MinLevel); } void Creature::UpdateLevelDependantStats() { CreatureTemplate const* cInfo = GetCreatureTemplate(); uint32 rank = IsPet() ? 0 : cInfo->rank; - uint8 level = GetLevel(); - CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(level, cInfo->unit_class); + CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(GetLevel(), cInfo->unit_class); // health float healthmod = _GetHealthMod(rank); - uint32 basehp = GetMaxHealthByLevel(level); + uint32 basehp = stats->GenerateHealth(m_creatureDifficulty); uint32 health = uint32(basehp * healthmod); SetCreateHealth(health); @@ -1595,7 +1590,7 @@ void Creature::UpdateLevelDependantStats() } // damage - float basedamage = GetBaseDamageForLevel(level); + float basedamage = stats->GenerateBaseDamage(m_creatureDifficulty); float weaponBaseMinDamage = basedamage; float weaponBaseMaxDamage = basedamage * 1.5f; @@ -1612,7 +1607,7 @@ void Creature::UpdateLevelDependantStats() SetStatFlatModifier(UNIT_MOD_ATTACK_POWER, BASE_VALUE, stats->AttackPower); SetStatFlatModifier(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, stats->RangedAttackPower); - float armor = GetBaseArmorForLevel(level); + float armor = (float)stats->GenerateArmor(m_creatureDifficulty); /// @todo Why is this treated as uint32 when it's a float? SetStatFlatModifier(UNIT_MOD_ARMOR, BASE_VALUE, armor); } @@ -2946,84 +2941,6 @@ void Creature::AllLootRemovedFromCorpse() m_respawnTime = std::max<time_t>(m_corpseRemoveTime + m_respawnDelay, m_respawnTime); } -bool Creature::HasScalableLevels() const -{ - return m_unitData->ContentTuningID != 0; -} - -void Creature::ApplyLevelScaling() -{ - CreatureDifficulty const* creatureDifficulty = GetCreatureDifficulty(); - - if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(creatureDifficulty->ContentTuningID, 0)) - { - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ScalingLevelMin), levels->MinLevel); - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ScalingLevelMax), levels->MaxLevel); - } - - int32 mindelta = std::min(creatureDifficulty->DeltaLevelMax, creatureDifficulty->DeltaLevelMin); - int32 maxdelta = std::max(creatureDifficulty->DeltaLevelMax, creatureDifficulty->DeltaLevelMin); - int32 delta = mindelta == maxdelta ? mindelta : irand(mindelta, maxdelta); - - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ScalingLevelDelta), delta); - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ContentTuningID), creatureDifficulty->ContentTuningID); -} - -uint64 Creature::GetMaxHealthByLevel(uint8 level) const -{ - CreatureTemplate const* cInfo = GetCreatureTemplate(); - CreatureDifficulty const* creatureDifficulty = GetCreatureDifficulty(); - float baseHealth = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, level, creatureDifficulty->GetHealthScalingExpansion(), creatureDifficulty->ContentTuningID, Classes(cInfo->unit_class), 0); - return std::max(baseHealth * creatureDifficulty->HealthModifier, 1.0f); -} - -float Creature::GetHealthMultiplierForTarget(WorldObject const* target) const -{ - if (!HasScalableLevels()) - return 1.0f; - - uint8 levelForTarget = GetLevelForTarget(target); - if (GetLevel() < levelForTarget) - return 1.0f; - - return double(GetMaxHealthByLevel(levelForTarget)) / double(GetCreateHealth()); -} - -float Creature::GetBaseDamageForLevel(uint8 level) const -{ - CreatureTemplate const* cInfo = GetCreatureTemplate(); - CreatureDifficulty const* creatureDifficulty = GetCreatureDifficulty(); - return sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureAutoAttackDps, level, creatureDifficulty->GetHealthScalingExpansion(), creatureDifficulty->ContentTuningID, Classes(cInfo->unit_class), 0); -} - -float Creature::GetDamageMultiplierForTarget(WorldObject const* target) const -{ - if (!HasScalableLevels()) - return 1.0f; - - uint8 levelForTarget = GetLevelForTarget(target); - - return GetBaseDamageForLevel(levelForTarget) / GetBaseDamageForLevel(GetLevel()); -} - -float Creature::GetBaseArmorForLevel(uint8 level) const -{ - CreatureTemplate const* cInfo = GetCreatureTemplate(); - CreatureDifficulty const* creatureDifficulty = GetCreatureDifficulty(); - float baseArmor = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureArmor, level, creatureDifficulty->GetHealthScalingExpansion(), creatureDifficulty->ContentTuningID, Classes(cInfo->unit_class), 0); - return baseArmor * creatureDifficulty->ArmorModifier; -} - -float Creature::GetArmorMultiplierForTarget(WorldObject const* target) const -{ - if (!HasScalableLevels()) - return 1.0f; - - uint8 levelForTarget = GetLevelForTarget(target); - - return GetBaseArmorForLevel(levelForTarget) / GetBaseArmorForLevel(GetLevel()); -} - uint8 Creature::GetLevelForTarget(WorldObject const* target) const { if (Unit const* unitTarget = target->ToUnit()) @@ -3033,34 +2950,6 @@ uint8 Creature::GetLevelForTarget(WorldObject const* target) const uint8 level = unitTarget->GetLevel() + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF); return RoundToInterval<uint8>(level, 1u, 255u); } - - // If this creature should scale level, adapt level depending of target level - // between UNIT_FIELD_SCALING_LEVEL_MIN and UNIT_FIELD_SCALING_LEVEL_MAX - if (HasScalableLevels()) - { - int32 scalingLevelMin = m_unitData->ScalingLevelMin; - int32 scalingLevelMax = m_unitData->ScalingLevelMax; - int32 scalingLevelDelta = m_unitData->ScalingLevelDelta; - int32 scalingFactionGroup = m_unitData->ScalingFactionGroup; - int32 targetLevel = unitTarget->m_unitData->EffectiveLevel; - if (!targetLevel) - targetLevel = unitTarget->GetLevel(); - - int32 targetLevelDelta = 0; - - if (Player const* playerTarget = target->ToPlayer()) - { - if (scalingFactionGroup && sFactionTemplateStore.AssertEntry(sChrRacesStore.AssertEntry(playerTarget->GetRace())->FactionID)->FactionGroup != scalingFactionGroup) - scalingLevelMin = scalingLevelMax; - - int32 maxCreatureScalingLevel = playerTarget->m_activePlayerData->MaxCreatureScalingLevel; - targetLevelDelta = std::min(maxCreatureScalingLevel > 0 ? maxCreatureScalingLevel - targetLevel : 0, *playerTarget->m_activePlayerData->ScalingPlayerLevelDelta); - } - - int32 levelWithDelta = targetLevel + targetLevelDelta; - int32 level = RoundToInterval(levelWithDelta, scalingLevelMin, scalingLevelMax) + scalingLevelDelta; - return RoundToInterval(level, 1, MAX_LEVEL + 3); - } } return Unit::GetLevelForTarget(target); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 46aa837a386..15902806b85 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -160,19 +160,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma bool isElite() const; bool isWorldBoss() const; - bool HasScalableLevels() const; - void ApplyLevelScaling(); uint8 GetLevelForTarget(WorldObject const* target) const override; - uint64 GetMaxHealthByLevel(uint8 level) const; - float GetHealthMultiplierForTarget(WorldObject const* target) const override; - - float GetBaseDamageForLevel(uint8 level) const; - float GetDamageMultiplierForTarget(WorldObject const* target) const override; - - float GetBaseArmorForLevel(uint8 level) const; - float GetArmorMultiplierForTarget(WorldObject const* target) const override; - bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); } bool IsEvadingAttacks() const { return IsInEvadeMode() || CanNotReachTarget(); } diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h index 949c4ab3fa7..0777e2b69c7 100644 --- a/src/server/game/Entities/Creature/CreatureData.h +++ b/src/server/game/Entities/Creature/CreatureData.h @@ -460,9 +460,8 @@ struct CreatureModel struct CreatureDifficulty { - int16 DeltaLevelMin; - int16 DeltaLevelMax; - int32 ContentTuningID; + uint8 MinLevel; + uint8 MaxLevel; int32 HealthScalingExpansion; float HealthModifier; float ManaModifier; @@ -581,11 +580,30 @@ struct TC_GAME_API CreatureTemplate // Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage). struct TC_GAME_API CreatureBaseStats { - uint32 BaseMana; - uint32 AttackPower; - uint32 RangedAttackPower; + std::array<uint32, CURRENT_EXPANSION + 1> BaseHealth; + uint32 BaseMana = 0; + uint32 BaseArmor = 0; + uint32 AttackPower = 0; + uint32 RangedAttackPower = 0; + std::array<float, CURRENT_EXPANSION + 1> BaseDamage; // Helpers + + uint32 GenerateHealth(CreatureDifficulty const* difficulty) const { return uint32(ceil(BaseHealth[difficulty->GetHealthScalingExpansion()] * difficulty->HealthModifier)); } + + uint32 GenerateMana(CreatureDifficulty const* difficulty) const + { + // Mana can be 0. + if (!BaseMana) + return 0; + + return uint32(ceil(BaseMana * difficulty->ManaModifier)); + } + + uint32 GenerateArmor(CreatureDifficulty const* difficulty) const { return uint32(ceil(BaseArmor * difficulty->ArmorModifier)); } + + float GenerateBaseDamage(CreatureDifficulty const* difficulty) const { return BaseDamage[difficulty->GetHealthScalingExpansion()]; } + static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass); }; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 067b2f6b74f..490cab96296 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -905,15 +905,17 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { // remove elite bonuses included in DB values CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); - ApplyLevelScaling(); + float healthmod = _GetHealthMod(cinfo->rank); + uint32 basehp = stats->GenerateHealth(m_creatureDifficulty); + uint32 health = uint32(basehp * healthmod); + uint32 mana = stats->GenerateMana(m_creatureDifficulty); - CreatureDifficulty const* creatureDifficulty = GetCreatureDifficulty(); - SetCreateHealth(std::max(sDB2Manager.EvaluateExpectedStat(ExpectedStatType::CreatureHealth, petlevel, creatureDifficulty->GetHealthScalingExpansion(), m_unitData->ContentTuningID, Classes(cinfo->unit_class), 0) * creatureDifficulty->HealthModifier * _GetHealthMod(cinfo->rank), 1.0f)); SetCreateMana(stats->BaseMana); SetCreateStat(STAT_STRENGTH, 22); SetCreateStat(STAT_AGILITY, 22); SetCreateStat(STAT_STAMINA, 25); SetCreateStat(STAT_INTELLECT, 28); + SetCreateStat(STAT_SPIRIT, 27); } // Power @@ -1068,7 +1070,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) * should be copied here (or moved to another method or if that function should be called here * or not just for this default case) */ - float basedamage = GetBaseDamageForLevel(petlevel); + CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); + float basedamage = stats->GenerateBaseDamage(m_creatureDifficulty); float weaponBaseMinDamage = basedamage; float weaponBaseMaxDamage = basedamage * 1.5f; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 6820e1a60f3..bfae9397b9a 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -921,13 +921,13 @@ void ObjectMgr::LoadCreatureTemplateDifficulty() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 - QueryResult result = WorldDatabase.Query("SELECT Entry, DifficultyID, LevelScalingDeltaMin, LevelScalingDeltaMax, ContentTuningID, HealthScalingExpansion, " - // 6 7 8 9 10 11 12 + // 0 1 2 3 4 + QueryResult result = WorldDatabase.Query("SELECT Entry, DifficultyID, MinLevel, MaxLevel, HealthScalingExpansion, " + // 5 6 7 8 9 10 11 "HealthModifier, ManaModifier, ArmorModifier, DamageModifier, CreatureDifficultyID, TypeFlags, TypeFlags2, " - // 13 14 15 16 17 + // 12 13 14 15 16 "LootID, PickPocketLootID, SkinLootID, GoldMin, GoldMax," - // 18 19 20 21 22 23 24 25 + // 17 18 19 20 21 22 23 24 "StaticFlags1, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, StaticFlags6, StaticFlags7, StaticFlags8 " "FROM creature_template_difficulty ORDER BY Entry"); @@ -953,29 +953,50 @@ void ObjectMgr::LoadCreatureTemplateDifficulty() } CreatureDifficulty creatureDifficulty; - creatureDifficulty.DeltaLevelMin = fields[2].GetInt16(); - creatureDifficulty.DeltaLevelMax = fields[3].GetInt16(); - creatureDifficulty.ContentTuningID = fields[4].GetInt32(); - creatureDifficulty.HealthScalingExpansion = fields[5].GetInt32(); - creatureDifficulty.HealthModifier = fields[6].GetFloat(); - creatureDifficulty.ManaModifier = fields[7].GetFloat(); - creatureDifficulty.ArmorModifier = fields[8].GetFloat(); - creatureDifficulty.DamageModifier = fields[9].GetFloat(); - creatureDifficulty.CreatureDifficultyID = fields[10].GetInt32(); - creatureDifficulty.TypeFlags = fields[11].GetUInt32(); - creatureDifficulty.TypeFlags2 = fields[12].GetUInt32(); - creatureDifficulty.LootID = fields[13].GetUInt32(); - creatureDifficulty.PickPocketLootID = fields[14].GetUInt32(); - creatureDifficulty.SkinLootID = fields[15].GetUInt32(); - creatureDifficulty.GoldMin = fields[16].GetUInt32(); - creatureDifficulty.GoldMax = fields[17].GetUInt32(); - creatureDifficulty.StaticFlags = CreatureStaticFlagsHolder(CreatureStaticFlags(fields[18].GetUInt32()), CreatureStaticFlags2(fields[19].GetUInt32()), - CreatureStaticFlags3(fields[20].GetUInt32()), CreatureStaticFlags4(fields[21].GetUInt32()), CreatureStaticFlags5(fields[22].GetUInt32()), - CreatureStaticFlags6(fields[23].GetUInt32()), CreatureStaticFlags7(fields[24].GetUInt32()), CreatureStaticFlags8(fields[25].GetUInt32())); + creatureDifficulty.MinLevel = fields[2].GetUInt8(); + creatureDifficulty.MaxLevel = fields[3].GetUInt8(); + creatureDifficulty.HealthScalingExpansion = fields[4].GetInt32(); + creatureDifficulty.HealthModifier = fields[5].GetFloat(); + creatureDifficulty.ManaModifier = fields[6].GetFloat(); + creatureDifficulty.ArmorModifier = fields[7].GetFloat(); + creatureDifficulty.DamageModifier = fields[8].GetFloat(); + creatureDifficulty.CreatureDifficultyID = fields[9].GetInt32(); + creatureDifficulty.TypeFlags = fields[10].GetUInt32(); + creatureDifficulty.TypeFlags2 = fields[11].GetUInt32(); + creatureDifficulty.LootID = fields[12].GetUInt32(); + creatureDifficulty.PickPocketLootID = fields[13].GetUInt32(); + creatureDifficulty.SkinLootID = fields[14].GetUInt32(); + creatureDifficulty.GoldMin = fields[15].GetUInt32(); + creatureDifficulty.GoldMax = fields[16].GetUInt32(); + creatureDifficulty.StaticFlags = CreatureStaticFlagsHolder(CreatureStaticFlags(fields[17].GetUInt32()), CreatureStaticFlags2(fields[18].GetUInt32()), + CreatureStaticFlags3(fields[19].GetUInt32()), CreatureStaticFlags4(fields[20].GetUInt32()), CreatureStaticFlags5(fields[21].GetUInt32()), + CreatureStaticFlags6(fields[22].GetUInt32()), CreatureStaticFlags7(fields[23].GetUInt32()), CreatureStaticFlags8(fields[24].GetUInt32())); // TODO: Check if this still applies creatureDifficulty.DamageModifier *= Creature::_GetDamageMod(itr->second.rank); + if (creatureDifficulty.MinLevel == 0 || creatureDifficulty.MaxLevel == 0) + { + if (creatureDifficulty.MinLevel == 0) + { + TC_LOG_ERROR("sql.sql", "Table `creature_template_difficulty` lists creature (ID: {}) has MinLevel set to 0 but the allowed minimum is 1. Ignored and set to 1.", entry); + creatureDifficulty.MinLevel = 1; + } + + if (creatureDifficulty.MaxLevel == 0) + { + TC_LOG_ERROR("sql.sql", "Table `creature_template_difficulty` lists creature (ID: {}) has MaxLevel set to 0 but the allowed minimum is 1. Ignored and set to 1.", entry); + creatureDifficulty.MaxLevel = 1; + } + } + + if (creatureDifficulty.MinLevel > creatureDifficulty.MaxLevel) + { + TC_LOG_ERROR("sql.sql", "Table `creature_template_difficulty` lists creature (ID: {}) with a higher MinLevel ({}) than MaxLevel ({}). MaxLevel will be set to MinLevel value.", + entry, creatureDifficulty.MinLevel, creatureDifficulty.MaxLevel); + creatureDifficulty.MinLevel = creatureDifficulty.MaxLevel; + } + if (creatureDifficulty.HealthScalingExpansion < EXPANSION_LEVEL_CURRENT || creatureDifficulty.HealthScalingExpansion >= MAX_EXPANSIONS) { TC_LOG_ERROR("sql.sql", "Table `creature_template_difficulty` lists creature (ID: {}) with invalid `HealthScalingExpansion` {}. Ignored and set to 0.", @@ -9957,8 +9978,8 @@ CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unit void ObjectMgr::LoadCreatureClassLevelStats() { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 - QueryResult result = WorldDatabase.Query("SELECT level, class, basemana, attackpower, rangedattackpower FROM creature_classlevelstats"); + + QueryResult result = WorldDatabase.Query("SELECT level, class, basehp0, basehp1, basehp2, basemana, basearmor, attackpower, rangedattackpower, damage_base, damage_exp1, damage_exp2 FROM creature_classlevelstats"); if (!result) { @@ -9979,10 +10000,29 @@ void ObjectMgr::LoadCreatureClassLevelStats() CreatureBaseStats stats; - stats.BaseMana = fields[2].GetUInt32(); + for (uint8 i = 0; i <= CURRENT_EXPANSION; ++i) + { + stats.BaseHealth[i] = fields[2 + i].GetUInt16(); + + if (stats.BaseHealth[i] == 0) + { + TC_LOG_ERROR("sql.sql", "Creature base stats for class {}, level {} has invalid zero base HP[{}] - set to 1", Class, Level, i); + stats.BaseHealth[i] = 1; + } + + stats.BaseDamage[i] = fields[9 + i].GetFloat(); + if (stats.BaseDamage[i] < 0.0f) + { + TC_LOG_ERROR("sql.sql", "Creature base stats for class {}, level {} has invalid negative base damage[{}] - set to 0.0", Class, Level, i); + stats.BaseDamage[i] = 0.0f; + } + } + + stats.BaseMana = fields[5].GetUInt16(); + stats.BaseArmor = fields[6].GetUInt16(); - stats.AttackPower = fields[3].GetUInt16(); - stats.RangedAttackPower = fields[4].GetUInt16(); + stats.AttackPower = fields[7].GetUInt16(); + stats.RangedAttackPower = fields[8].GetUInt16(); _creatureBaseStatsStore[MAKE_PAIR16(Level, Class)] = stats; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 73c902986da..3564b062a61 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -102,7 +102,7 @@ enum Expansions MAX_ACCOUNT_EXPANSIONS }; -#define CURRENT_EXPANSION EXPANSION_DRAGONFLIGHT +#define CURRENT_EXPANSION EXPANSION_WRATH_OF_THE_LICH_KING constexpr uint32 GetMaxLevelForExpansion(uint32 expansion) { @@ -113,7 +113,7 @@ constexpr uint32 GetMaxLevelForExpansion(uint32 expansion) case EXPANSION_THE_BURNING_CRUSADE: return 70; case EXPANSION_WRATH_OF_THE_LICH_KING: - case EXPANSION_CATACLYSM: // since we do support retail accounts, we will make all newer expansions follow the support max level + case EXPANSION_CATACLYSM: // since we do support retail accounts, we will make all newer expansions follow the supported max level case EXPANSION_MISTS_OF_PANDARIA: case EXPANSION_WARLORDS_OF_DRAENOR: case EXPANSION_LEGION: diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp index ea221bb43b3..9bf1696e9cc 100644 --- a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp +++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp @@ -78,7 +78,6 @@ bool ContentTuningParams::GenerateDataForUnits<Creature, Player>(Creature* attac TargetLevel = target->GetLevel(); Expansion = creatureDifficulty->HealthScalingExpansion; TargetScalingLevelDelta = int8(attacker->m_unitData->ScalingLevelDelta); - TargetContentTuningID = creatureDifficulty->ContentTuningID; return true; } @@ -96,14 +95,13 @@ bool ContentTuningParams::GenerateDataForUnits<Player, Creature>(Player* attacke TargetLevel = target->GetLevel(); Expansion = creatureDifficulty->HealthScalingExpansion; TargetScalingLevelDelta = int8(target->m_unitData->ScalingLevelDelta); - TargetContentTuningID = creatureDifficulty->ContentTuningID; return true; } template<> bool ContentTuningParams::GenerateDataForUnits<Creature, Creature>(Creature* attacker, Creature* target) { - Creature* accessor = target->HasScalableLevels() ? target : attacker; + Creature* accessor = attacker; CreatureTemplate const* creatureTemplate = accessor->GetCreatureTemplate(); CreatureDifficulty const* creatureDifficulty = creatureTemplate->GetDifficulty(accessor->GetMap()->GetDifficultyID()); @@ -113,7 +111,6 @@ bool ContentTuningParams::GenerateDataForUnits<Creature, Creature>(Creature* att TargetLevel = target->GetLevel(); Expansion = creatureDifficulty->HealthScalingExpansion; TargetScalingLevelDelta = int8(accessor->m_unitData->ScalingLevelDelta); - TargetContentTuningID = creatureDifficulty->ContentTuningID; return true; } @@ -121,28 +118,8 @@ template<> bool ContentTuningParams::GenerateDataForUnits<Unit, Unit>(Unit* attacker, Unit* target) { if (Player* playerAttacker = attacker->ToPlayer()) - { if (Player* playerTarget = target->ToPlayer()) return GenerateDataForUnits(playerAttacker, playerTarget); - else if (Creature* creatureTarget = target->ToCreature()) - { - if (creatureTarget->HasScalableLevels()) - return GenerateDataForUnits(playerAttacker, creatureTarget); - } - } - else if (Creature* creatureAttacker = attacker->ToCreature()) - { - if (Player* playerTarget = target->ToPlayer()) - { - if (creatureAttacker->HasScalableLevels()) - return GenerateDataForUnits(creatureAttacker, playerTarget); - } - else if (Creature* creatureTarget = target->ToCreature()) - { - if (creatureAttacker->HasScalableLevels() || creatureTarget->HasScalableLevels()) - return GenerateDataForUnits(creatureAttacker, creatureTarget); - } - } return false; } |