* Added support for using a lookup table for creature mana / health

* As long as creature level, class, and the proper expansion they are from are
* set in creature_template, you will have 100% accurate health and mana.
* Research and base stats table done by Malcrom -- THANK YOU!
* Original patch by Kudlaty -- THANK YOU!
* Updated and enhanced by Machiavelli - THANK YOU!
* Optimizations by w12x, MrSmite, and XTZGZoReX -- THANK YOU!
* Final code updating for current rev by XTZGZoReX -- THANK YOU!

--HG--
branch : trunk
This commit is contained in:
Brian
2009-12-20 20:23:18 -07:00
parent c4ac6323b0
commit 5300226fee
11 changed files with 1107 additions and 33 deletions
@@ -0,0 +1,474 @@
-- Table structure for table `creature_classlevelstats`
DROP TABLE IF EXISTS `creature_classlevelstats`;
CREATE TABLE `creature_classlevelstats` (
`exp` tinyint(1) NOT NULL,
`class` tinyint(1) NOT NULL,
`level` tinyint(1) NOT NULL,
`basehp` smallint(2) NOT NULL,
`basemana` smallint(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `creature_classlevelstats` (`exp`,`class`,`level`,`basehp`,`basemana`) VALUES
(0,1,1,42,0),
(0,1,2,55,0),
(0,1,3,71,0),
(0,1,4,86,0),
(0,1,5,102,0),
(0,1,6,120,0),
(0,1,7,137,0),
(0,1,8,156,0),
(0,1,9,176,0),
(0,1,10,198,0),
(0,1,11,222,0),
(0,1,12,247,0),
(0,1,13,273,0),
(0,1,14,300,0),
(0,1,15,328,0),
(0,1,16,356,0),
(0,1,17,386,0),
(0,1,18,417,0),
(0,1,19,449,0),
(0,1,20,484,0),
(0,1,21,521,0),
(0,1,22,562,0),
(0,1,23,605,0),
(0,1,24,651,0),
(0,1,25,699,0),
(0,1,26,750,0),
(0,1,27,800,0),
(0,1,28,853,0),
(0,1,29,905,0),
(0,1,30,955,0),
(0,1,31,1006,0),
(0,1,32,1057,0),
(0,1,33,1110,0),
(0,1,34,1163,0),
(0,1,35,1220,0),
(0,1,36,1277,0),
(0,1,37,1336,0),
(0,1,38,1395,0),
(0,1,39,1459,0),
(0,1,40,1524,0),
(0,1,41,1585,0),
(0,1,42,1651,0),
(0,1,43,1716,0),
(0,1,44,1782,0),
(0,1,45,1848,0),
(0,1,46,1919,0),
(0,1,47,1990,0),
(0,1,48,2061,0),
(0,1,49,2138,0),
(0,1,50,2215,0),
(0,1,51,2292,0),
(0,1,52,2371,0),
(0,1,53,2453,0),
(0,1,54,2533,0),
(0,1,55,2614,0),
(0,1,56,2699,0),
(0,1,57,2784,0),
(0,1,58,2871,0),
(0,1,59,2961,0),
(0,1,60,3052,0),
(0,1,61,3144,0),
(0,1,62,3237,0),
(0,1,63,3331,0),
(0,1,64,0,0),
(0,1,65,3524,0),
(0,1,66,0,0),
(0,1,67,3728,0),
(0,1,68,3834,0),
(0,1,69,0,0),
(0,1,70,4050,0),
(0,1,71,4163,0),
(0,1,72,4278,0),
(0,1,73,0,0),
(0,1,74,0,0),
(0,1,75,4652,0),
(0,1,76,0,0),
(0,1,77,4916,0),
(0,1,78,5052,0),
(0,1,79,0,0),
(0,1,80,5342,0),
(0,1,81,5496,0),
(0,1,82,0,0),
(0,1,83,5808,0),
(1,1,58,3989,0),
(1,1,59,4142,0),
(1,1,60,4979,0),
(1,1,61,5158,0),
(1,1,62,5341,0),
(1,1,63,5527,0),
(1,1,64,5715,0),
(1,1,65,5914,0),
(1,1,66,6116,0),
(1,1,67,6326,0),
(1,1,68,6542,0),
(1,1,69,6761,0),
(1,1,70,6986,0),
(1,1,71,7181,0),
(1,1,72,7380,0),
(1,1,73,7580,0),
(2,1,68,6986,0),
(2,1,69,7984,0),
(2,1,70,8982,0),
(2,1,71,9291,0),
(2,1,72,9610,0),
(2,1,73,9940,0),
(2,1,74,10282,0),
(2,1,75,10635,0),
(2,1,76,11001,0),
(2,1,77,11379,0),
(2,1,78,11770,0),
(2,1,79,12175,0),
(2,1,80,12600,0),
(2,1,81,13033,0),
(2,1,82,13481,0),
(2,1,83,13945,0),
(0,2,1,41,60),
(0,2,2,54,69),
(0,2,3,69,79),
(0,2,4,83,104),
(0,2,5,98,115),
(0,2,6,115,126),
(0,2,7,131,138),
(0,2,8,148,165),
(0,2,9,166,178),
(0,2,10,186,191),
(0,2,11,208,205),
(0,2,12,230,249),
(0,2,13,253,264),
(0,2,14,276,295),
(0,2,15,301,326),
(0,2,16,325,357),
(0,2,17,350,390),
(0,2,18,377,408),
(0,2,19,404,456),
(0,2,20,433,490),
(0,2,21,464,510),
(0,2,22,498,544),
(0,2,23,533,581),
(0,2,24,571,618),
(0,2,25,610,655),
(0,2,26,651,693),
(0,2,27,690,732),
(0,2,28,732,756),
(0,2,29,773,811),
(0,2,30,811,852),
(0,2,31,850,878),
(0,2,32,888,935),
(0,2,33,928,963),
(0,2,34,967,1007),
(0,2,35,1009,1067),
(0,2,36,1050,1097),
(0,2,37,1093,1142),
(0,2,38,1135,1186),
(0,2,39,1180,1236),
(0,2,40,1226,1283),
(0,2,41,1268,1332),
(0,2,42,1321,1381),
(0,2,43,1373,1432),
(0,2,44,1426,1483),
(0,2,45,1478,1534),
(0,2,46,1535,1587),
(0,2,47,1592,1640),
(0,2,48,1650,1695),
(0,2,49,1710,1750),
(0,2,50,1772,1807),
(0,2,51,1834,1864),
(0,2,52,1897,1923),
(0,2,53,1962,1982),
(0,2,54,2026,2041),
(0,2,55,2091,2117),
(0,2,56,2159,2163),
(0,2,57,2227,2241),
(0,2,58,2297,2289),
(0,2,59,2369,2369),
(0,2,60,2442,2434),
(0,2,61,2515,2486),
(0,2,62,2590,2568),
(0,2,63,2665,2620),
(0,2,64,0,2705),
(0,2,65,2819,2790),
(0,2,66,0,2846),
(0,2,67,2982,2933),
(0,2,68,3067,2991),
(0,2,69,0,3080),
(0,2,70,3240,3155),
(0,2,71,3330,3231),
(0,2,72,3422,3309),
(0,2,73,0,3387),
(0,2,74,0,3466),
(0,2,75,3722,3561),
(0,2,76,0,3643),
(0,2,77,3933,3725),
(0,2,78,4042,3809),
(0,2,79,0,3893),
(0,2,80,4274,3994),
(0,2,81,4394,4081),
(0,2,82,0,4169),
(0,2,83,0,4258),
(1,2,58,3191,2289),
(1,2,59,3314,2369),
(1,2,60,3984,2434),
(1,2,61,4126,2486),
(1,2,62,4274,2568),
(1,2,63,4422,2620),
(1,2,64,4572,2705),
(1,2,65,4731,2790),
(1,2,66,4892,2846),
(1,2,67,5060,2933),
(1,2,68,5233,2991),
(1,2,69,5409,3080),
(1,2,70,5589,3155),
(1,2,71,5744,3231),
(1,2,72,5900,3309),
(1,2,73,6070,3387),
(2,2,68,6986,2991),
(2,2,69,7984,3080),
(2,2,70,8982,3155),
(2,2,71,9291,3231),
(2,2,72,9610,3309),
(2,2,73,9940,3387),
(2,2,74,10282,3466),
(2,2,75,10635,3561),
(2,2,76,11001,3643),
(2,2,77,11379,3725),
(2,2,78,11770,3809),
(2,2,79,12175,3893),
(2,2,80,12600,3994),
(2,2,81,13033,4081),
(2,2,82,13481,4169),
(2,2,83,13945,4258),
(0,4,1,42,0),
(0,4,2,55,0),
(0,4,3,71,0),
(0,4,4,86,0),
(0,4,5,102,0),
(0,4,6,120,0),
(0,4,7,137,0),
(0,4,8,156,0),
(0,4,9,176,0),
(0,4,10,198,0),
(0,4,11,222,0),
(0,4,12,247,0),
(0,4,13,273,0),
(0,4,14,300,0),
(0,4,15,328,0),
(0,4,16,356,0),
(0,4,17,386,0),
(0,4,18,417,0),
(0,4,19,484,0),
(0,4,20,531,0),
(0,4,21,573,0),
(0,4,22,617,0),
(0,4,23,664,0),
(0,4,24,713,0),
(0,4,25,734,0),
(0,4,26,787,0),
(0,4,27,840,0),
(0,4,28,869,0),
(0,4,29,905,0),
(0,4,30,955,0),
(0,4,31,1006,0),
(0,4,32,1057,0),
(0,4,33,1110,0),
(0,4,34,1163,0),
(0,4,35,1220,0),
(0,4,36,1277,0),
(0,4,37,1336,0),
(0,4,38,1395,0),
(0,4,39,1459,0),
(0,4,40,1524,0),
(0,4,41,1585,0),
(0,4,42,1651,0),
(0,4,43,1716,0),
(0,4,44,1782,0),
(0,4,45,1848,0),
(0,4,46,1919,0),
(0,4,47,1990,0),
(0,4,48,2062,0),
(0,4,49,2138,0),
(0,4,50,2215,0),
(0,4,51,2292,0),
(0,4,52,2371,0),
(0,4,53,2453,0),
(0,4,54,2533,0),
(0,4,55,2614,0),
(0,4,56,2699,0),
(0,4,57,2784,0),
(0,4,58,2871,0),
(0,4,59,2961,0),
(0,4,60,3052,0),
(0,4,61,3186,0),
(0,4,62,3237,0),
(0,4,63,3331,0),
(0,4,64,0,0),
(0,4,65,3524,0),
(0,4,66,0,0),
(0,4,67,3728,0),
(0,4,68,3834,0),
(0,4,69,0,0),
(0,4,70,4050,0),
(0,4,71,4163,0),
(0,4,72,4278,0),
(0,4,73,0,0),
(0,4,74,0,0),
(0,4,75,4652,0),
(0,4,76,0,0),
(0,4,77,4916,0),
(0,4,78,5052,0),
(0,4,79,0,0),
(0,4,80,5342,0),
(0,4,81,5496,0),
(0,4,82,0,0),
(0,4,83,0,0),
(1,4,58,3989,0),
(1,4,59,4142,0),
(1,4,60,4979,0),
(1,4,61,5158,0),
(1,4,62,5341,0),
(1,4,63,5527,0),
(1,4,64,5715,0),
(1,4,65,5914,0),
(1,4,66,6116,0),
(1,4,67,6326,0),
(1,4,68,6542,0),
(1,4,69,6761,0),
(1,4,70,6986,0),
(1,4,71,7181,0),
(1,4,72,7380,0),
(1,4,73,7580,0),
(2,4,68,6986,0),
(2,4,69,7984,0),
(2,4,70,8982,0),
(2,4,71,9291,0),
(2,4,72,9610,0),
(2,4,73,9940,0),
(2,4,74,10282,0),
(2,4,75,10635,0),
(2,4,76,11001,0),
(2,4,77,11379,0),
(2,4,78,11770,0),
(2,4,79,12175,0),
(2,4,80,12600,0),
(2,4,81,13033,0),
(2,4,82,13481,0),
(2,4,83,13945,0),
(0,8,1,40,120),
(0,8,2,0,0),
(0,8,3,67,174),
(0,8,4,81,202),
(0,8,5,95,230),
(0,8,6,111,259),
(0,8,7,126,289),
(0,8,8,143,319),
(0,8,9,160,350),
(0,8,10,178,382),
(0,8,11,199,459),
(0,8,12,219,537),
(0,8,13,241,601),
(0,8,14,263,710),
(0,8,15,285,790),
(0,8,16,307,856),
(0,8,17,330,938),
(0,8,18,354,1020),
(0,8,19,379,1118),
(0,8,20,405,1202),
(0,8,21,432,1272),
(0,8,22,463,1357),
(0,8,23,494,1443),
(0,8,24,528,1545),
(0,8,25,562,1633),
(0,8,26,598,1707),
(0,8,27,633,1812),
(0,8,28,669,1977),
(0,8,29,704,2068),
(0,8,30,737,2175),
(0,8,31,770,2253),
(0,8,32,802,2362),
(0,8,33,835,2457),
(0,8,34,867,2553),
(0,8,35,902,2680),
(0,8,36,935,2763),
(0,8,37,970,2861),
(0,8,38,1004,2975),
(0,8,39,1040,3075),
(0,8,40,1077,3191),
(0,8,41,1110,3293),
(0,8,42,1156,3471),
(0,8,43,1201,3575),
(0,8,44,1247,3680),
(0,8,45,1294,3801),
(0,8,46,1343,3923),
(0,8,47,1393,4031),
(0,8,48,1443,4140),
(0,8,49,1497,4281),
(0,8,50,1551,4393),
(0,8,51,1604,4506),
(0,8,52,1660,4650),
(0,8,53,1717,4765),
(0,8,54,1773,4896),
(0,8,55,1830,5013),
(0,8,56,1889,5206),
(0,8,57,1949,5340),
(0,8,58,2010,5461),
(0,8,59,2073,5598),
(0,8,60,2136,5751),
(0,8,61,2201,5875),
(0,8,62,2266,6015),
(0,8,63,2332,6156),
(0,8,64,0,6229),
(0,8,65,2467,6443),
(0,8,66,0,6588),
(0,8,67,2610,6749),
(0,8,68,2684,6882),
(0,8,69,0,7031),
(0,8,70,2835,7196),
(0,8,71,2914,7332),
(0,8,72,2995,7500),
(0,8,73,0,7654),
(0,8,74,0,7809),
(0,8,75,3257,7981),
(0,8,76,0,8139),
(0,8,77,0,8313),
(0,8,78,0,8459),
(0,8,79,0,8636),
(0,8,80,0,8814),
(0,8,81,0,8979),
(0,8,82,0,9160),
(0,8,83,0,9325),
(1,8,58,2793,5461),
(1,8,59,2899,5598),
(1,8,60,3484,5751),
(1,8,61,3611,5875),
(1,8,62,3739,6015),
(1,8,63,3870,6156),
(1,8,64,4000,6229),
(1,8,65,4140,6443),
(1,8,66,4281,6588),
(1,8,67,4429,6749),
(1,8,68,4580,6882),
(1,8,69,4733,7031),
(1,8,70,4890,7196),
(1,8,71,5027,7332),
(1,8,72,5166,7500),
(1,8,73,5311,7654),
(2,8,68,5588,6882),
(2,8,69,6387,7031),
(2,8,70,7185,7196),
(2,8,71,7432,7332),
(2,8,72,7688,7500),
(2,8,73,7952,7654),
(2,8,74,8225,7809),
(2,8,75,8508,7981),
(2,8,76,8800,8139),
(2,8,77,9103,8313),
(2,8,78,9416,8459),
(2,8,79,9740,8636),
(2,8,80,10080,8814),
(2,8,81,10486,8979),
(2,8,82,10784,9160),
(2,8,83,11156,9325);
@@ -0,0 +1,7 @@
ALTER TABLE `creature_template` ADD `exp` smallint(2) NOT NULL DEFAULT 0 AFTER `IconName`;
ALTER TABLE `creature_template` DROP `minhealth`;
ALTER TABLE `creature_template` DROP `maxhealth`;
ALTER TABLE `creature_template` DROP `minmana`;
ALTER TABLE `creature_template` DROP `maxmana`;
ALTER TABLE `creature_template` CHANGE `unk16` `Health_mod` FLOAT;
ALTER TABLE `creature_template` CHANGE `unk17` `Mana_mod` FLOAT;
+475
View File
@@ -878,6 +878,481 @@ LOCK TABLES `creature_ai_texts` WRITE;
/*!40000 ALTER TABLE `creature_ai_texts` ENABLE KEYS */;
UNLOCK TABLES;
-- Table structure for table `creature_classlevelstats`
DROP TABLE IF EXISTS `creature_classlevelstats`;
CREATE TABLE `creature_classlevelstats` (
`exp` tinyint(1) NOT NULL,
`class` tinyint(1) NOT NULL,
`level` tinyint(1) NOT NULL,
`basehp` smallint(2) NOT NULL,
`basemana` smallint(2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `creature_classlevelstats` (`exp`,`class`,`level`,`basehp`,`basemana`) VALUES
(0,1,1,42,0),
(0,1,2,55,0),
(0,1,3,71,0),
(0,1,4,86,0),
(0,1,5,102,0),
(0,1,6,120,0),
(0,1,7,137,0),
(0,1,8,156,0),
(0,1,9,176,0),
(0,1,10,198,0),
(0,1,11,222,0),
(0,1,12,247,0),
(0,1,13,273,0),
(0,1,14,300,0),
(0,1,15,328,0),
(0,1,16,356,0),
(0,1,17,386,0),
(0,1,18,417,0),
(0,1,19,449,0),
(0,1,20,484,0),
(0,1,21,521,0),
(0,1,22,562,0),
(0,1,23,605,0),
(0,1,24,651,0),
(0,1,25,699,0),
(0,1,26,750,0),
(0,1,27,800,0),
(0,1,28,853,0),
(0,1,29,905,0),
(0,1,30,955,0),
(0,1,31,1006,0),
(0,1,32,1057,0),
(0,1,33,1110,0),
(0,1,34,1163,0),
(0,1,35,1220,0),
(0,1,36,1277,0),
(0,1,37,1336,0),
(0,1,38,1395,0),
(0,1,39,1459,0),
(0,1,40,1524,0),
(0,1,41,1585,0),
(0,1,42,1651,0),
(0,1,43,1716,0),
(0,1,44,1782,0),
(0,1,45,1848,0),
(0,1,46,1919,0),
(0,1,47,1990,0),
(0,1,48,2061,0),
(0,1,49,2138,0),
(0,1,50,2215,0),
(0,1,51,2292,0),
(0,1,52,2371,0),
(0,1,53,2453,0),
(0,1,54,2533,0),
(0,1,55,2614,0),
(0,1,56,2699,0),
(0,1,57,2784,0),
(0,1,58,2871,0),
(0,1,59,2961,0),
(0,1,60,3052,0),
(0,1,61,3144,0),
(0,1,62,3237,0),
(0,1,63,3331,0),
(0,1,64,0,0),
(0,1,65,3524,0),
(0,1,66,0,0),
(0,1,67,3728,0),
(0,1,68,3834,0),
(0,1,69,0,0),
(0,1,70,4050,0),
(0,1,71,4163,0),
(0,1,72,4278,0),
(0,1,73,0,0),
(0,1,74,0,0),
(0,1,75,4652,0),
(0,1,76,0,0),
(0,1,77,4916,0),
(0,1,78,5052,0),
(0,1,79,0,0),
(0,1,80,5342,0),
(0,1,81,5496,0),
(0,1,82,0,0),
(0,1,83,5808,0),
(1,1,58,3989,0),
(1,1,59,4142,0),
(1,1,60,4979,0),
(1,1,61,5158,0),
(1,1,62,5341,0),
(1,1,63,5527,0),
(1,1,64,5715,0),
(1,1,65,5914,0),
(1,1,66,6116,0),
(1,1,67,6326,0),
(1,1,68,6542,0),
(1,1,69,6761,0),
(1,1,70,6986,0),
(1,1,71,7181,0),
(1,1,72,7380,0),
(1,1,73,7580,0),
(2,1,68,6986,0),
(2,1,69,7984,0),
(2,1,70,8982,0),
(2,1,71,9291,0),
(2,1,72,9610,0),
(2,1,73,9940,0),
(2,1,74,10282,0),
(2,1,75,10635,0),
(2,1,76,11001,0),
(2,1,77,11379,0),
(2,1,78,11770,0),
(2,1,79,12175,0),
(2,1,80,12600,0),
(2,1,81,13033,0),
(2,1,82,13481,0),
(2,1,83,13945,0),
(0,2,1,41,60),
(0,2,2,54,69),
(0,2,3,69,79),
(0,2,4,83,104),
(0,2,5,98,115),
(0,2,6,115,126),
(0,2,7,131,138),
(0,2,8,148,165),
(0,2,9,166,178),
(0,2,10,186,191),
(0,2,11,208,205),
(0,2,12,230,249),
(0,2,13,253,264),
(0,2,14,276,295),
(0,2,15,301,326),
(0,2,16,325,357),
(0,2,17,350,390),
(0,2,18,377,408),
(0,2,19,404,456),
(0,2,20,433,490),
(0,2,21,464,510),
(0,2,22,498,544),
(0,2,23,533,581),
(0,2,24,571,618),
(0,2,25,610,655),
(0,2,26,651,693),
(0,2,27,690,732),
(0,2,28,732,756),
(0,2,29,773,811),
(0,2,30,811,852),
(0,2,31,850,878),
(0,2,32,888,935),
(0,2,33,928,963),
(0,2,34,967,1007),
(0,2,35,1009,1067),
(0,2,36,1050,1097),
(0,2,37,1093,1142),
(0,2,38,1135,1186),
(0,2,39,1180,1236),
(0,2,40,1226,1283),
(0,2,41,1268,1332),
(0,2,42,1321,1381),
(0,2,43,1373,1432),
(0,2,44,1426,1483),
(0,2,45,1478,1534),
(0,2,46,1535,1587),
(0,2,47,1592,1640),
(0,2,48,1650,1695),
(0,2,49,1710,1750),
(0,2,50,1772,1807),
(0,2,51,1834,1864),
(0,2,52,1897,1923),
(0,2,53,1962,1982),
(0,2,54,2026,2041),
(0,2,55,2091,2117),
(0,2,56,2159,2163),
(0,2,57,2227,2241),
(0,2,58,2297,2289),
(0,2,59,2369,2369),
(0,2,60,2442,2434),
(0,2,61,2515,2486),
(0,2,62,2590,2568),
(0,2,63,2665,2620),
(0,2,64,0,2705),
(0,2,65,2819,2790),
(0,2,66,0,2846),
(0,2,67,2982,2933),
(0,2,68,3067,2991),
(0,2,69,0,3080),
(0,2,70,3240,3155),
(0,2,71,3330,3231),
(0,2,72,3422,3309),
(0,2,73,0,3387),
(0,2,74,0,3466),
(0,2,75,3722,3561),
(0,2,76,0,3643),
(0,2,77,3933,3725),
(0,2,78,4042,3809),
(0,2,79,0,3893),
(0,2,80,4274,3994),
(0,2,81,4394,4081),
(0,2,82,0,4169),
(0,2,83,0,4258),
(1,2,58,3191,2289),
(1,2,59,3314,2369),
(1,2,60,3984,2434),
(1,2,61,4126,2486),
(1,2,62,4274,2568),
(1,2,63,4422,2620),
(1,2,64,4572,2705),
(1,2,65,4731,2790),
(1,2,66,4892,2846),
(1,2,67,5060,2933),
(1,2,68,5233,2991),
(1,2,69,5409,3080),
(1,2,70,5589,3155),
(1,2,71,5744,3231),
(1,2,72,5900,3309),
(1,2,73,6070,3387),
(2,2,68,6986,2991),
(2,2,69,7984,3080),
(2,2,70,8982,3155),
(2,2,71,9291,3231),
(2,2,72,9610,3309),
(2,2,73,9940,3387),
(2,2,74,10282,3466),
(2,2,75,10635,3561),
(2,2,76,11001,3643),
(2,2,77,11379,3725),
(2,2,78,11770,3809),
(2,2,79,12175,3893),
(2,2,80,12600,3994),
(2,2,81,13033,4081),
(2,2,82,13481,4169),
(2,2,83,13945,4258),
(0,4,1,42,0),
(0,4,2,55,0),
(0,4,3,71,0),
(0,4,4,86,0),
(0,4,5,102,0),
(0,4,6,120,0),
(0,4,7,137,0),
(0,4,8,156,0),
(0,4,9,176,0),
(0,4,10,198,0),
(0,4,11,222,0),
(0,4,12,247,0),
(0,4,13,273,0),
(0,4,14,300,0),
(0,4,15,328,0),
(0,4,16,356,0),
(0,4,17,386,0),
(0,4,18,417,0),
(0,4,19,484,0),
(0,4,20,531,0),
(0,4,21,573,0),
(0,4,22,617,0),
(0,4,23,664,0),
(0,4,24,713,0),
(0,4,25,734,0),
(0,4,26,787,0),
(0,4,27,840,0),
(0,4,28,869,0),
(0,4,29,905,0),
(0,4,30,955,0),
(0,4,31,1006,0),
(0,4,32,1057,0),
(0,4,33,1110,0),
(0,4,34,1163,0),
(0,4,35,1220,0),
(0,4,36,1277,0),
(0,4,37,1336,0),
(0,4,38,1395,0),
(0,4,39,1459,0),
(0,4,40,1524,0),
(0,4,41,1585,0),
(0,4,42,1651,0),
(0,4,43,1716,0),
(0,4,44,1782,0),
(0,4,45,1848,0),
(0,4,46,1919,0),
(0,4,47,1990,0),
(0,4,48,2062,0),
(0,4,49,2138,0),
(0,4,50,2215,0),
(0,4,51,2292,0),
(0,4,52,2371,0),
(0,4,53,2453,0),
(0,4,54,2533,0),
(0,4,55,2614,0),
(0,4,56,2699,0),
(0,4,57,2784,0),
(0,4,58,2871,0),
(0,4,59,2961,0),
(0,4,60,3052,0),
(0,4,61,3186,0),
(0,4,62,3237,0),
(0,4,63,3331,0),
(0,4,64,0,0),
(0,4,65,3524,0),
(0,4,66,0,0),
(0,4,67,3728,0),
(0,4,68,3834,0),
(0,4,69,0,0),
(0,4,70,4050,0),
(0,4,71,4163,0),
(0,4,72,4278,0),
(0,4,73,0,0),
(0,4,74,0,0),
(0,4,75,4652,0),
(0,4,76,0,0),
(0,4,77,4916,0),
(0,4,78,5052,0),
(0,4,79,0,0),
(0,4,80,5342,0),
(0,4,81,5496,0),
(0,4,82,0,0),
(0,4,83,0,0),
(1,4,58,3989,0),
(1,4,59,4142,0),
(1,4,60,4979,0),
(1,4,61,5158,0),
(1,4,62,5341,0),
(1,4,63,5527,0),
(1,4,64,5715,0),
(1,4,65,5914,0),
(1,4,66,6116,0),
(1,4,67,6326,0),
(1,4,68,6542,0),
(1,4,69,6761,0),
(1,4,70,6986,0),
(1,4,71,7181,0),
(1,4,72,7380,0),
(1,4,73,7580,0),
(2,4,68,6986,0),
(2,4,69,7984,0),
(2,4,70,8982,0),
(2,4,71,9291,0),
(2,4,72,9610,0),
(2,4,73,9940,0),
(2,4,74,10282,0),
(2,4,75,10635,0),
(2,4,76,11001,0),
(2,4,77,11379,0),
(2,4,78,11770,0),
(2,4,79,12175,0),
(2,4,80,12600,0),
(2,4,81,13033,0),
(2,4,82,13481,0),
(2,4,83,13945,0),
(0,8,1,40,120),
(0,8,2,0,0),
(0,8,3,67,174),
(0,8,4,81,202),
(0,8,5,95,230),
(0,8,6,111,259),
(0,8,7,126,289),
(0,8,8,143,319),
(0,8,9,160,350),
(0,8,10,178,382),
(0,8,11,199,459),
(0,8,12,219,537),
(0,8,13,241,601),
(0,8,14,263,710),
(0,8,15,285,790),
(0,8,16,307,856),
(0,8,17,330,938),
(0,8,18,354,1020),
(0,8,19,379,1118),
(0,8,20,405,1202),
(0,8,21,432,1272),
(0,8,22,463,1357),
(0,8,23,494,1443),
(0,8,24,528,1545),
(0,8,25,562,1633),
(0,8,26,598,1707),
(0,8,27,633,1812),
(0,8,28,669,1977),
(0,8,29,704,2068),
(0,8,30,737,2175),
(0,8,31,770,2253),
(0,8,32,802,2362),
(0,8,33,835,2457),
(0,8,34,867,2553),
(0,8,35,902,2680),
(0,8,36,935,2763),
(0,8,37,970,2861),
(0,8,38,1004,2975),
(0,8,39,1040,3075),
(0,8,40,1077,3191),
(0,8,41,1110,3293),
(0,8,42,1156,3471),
(0,8,43,1201,3575),
(0,8,44,1247,3680),
(0,8,45,1294,3801),
(0,8,46,1343,3923),
(0,8,47,1393,4031),
(0,8,48,1443,4140),
(0,8,49,1497,4281),
(0,8,50,1551,4393),
(0,8,51,1604,4506),
(0,8,52,1660,4650),
(0,8,53,1717,4765),
(0,8,54,1773,4896),
(0,8,55,1830,5013),
(0,8,56,1889,5206),
(0,8,57,1949,5340),
(0,8,58,2010,5461),
(0,8,59,2073,5598),
(0,8,60,2136,5751),
(0,8,61,2201,5875),
(0,8,62,2266,6015),
(0,8,63,2332,6156),
(0,8,64,0,6229),
(0,8,65,2467,6443),
(0,8,66,0,6588),
(0,8,67,2610,6749),
(0,8,68,2684,6882),
(0,8,69,0,7031),
(0,8,70,2835,7196),
(0,8,71,2914,7332),
(0,8,72,2995,7500),
(0,8,73,0,7654),
(0,8,74,0,7809),
(0,8,75,3257,7981),
(0,8,76,0,8139),
(0,8,77,0,8313),
(0,8,78,0,8459),
(0,8,79,0,8636),
(0,8,80,0,8814),
(0,8,81,0,8979),
(0,8,82,0,9160),
(0,8,83,0,9325),
(1,8,58,2793,5461),
(1,8,59,2899,5598),
(1,8,60,3484,5751),
(1,8,61,3611,5875),
(1,8,62,3739,6015),
(1,8,63,3870,6156),
(1,8,64,4000,6229),
(1,8,65,4140,6443),
(1,8,66,4281,6588),
(1,8,67,4429,6749),
(1,8,68,4580,6882),
(1,8,69,4733,7031),
(1,8,70,4890,7196),
(1,8,71,5027,7332),
(1,8,72,5166,7500),
(1,8,73,5311,7654),
(2,8,68,5588,6882),
(2,8,69,6387,7031),
(2,8,70,7185,7196),
(2,8,71,7432,7332),
(2,8,72,7688,7500),
(2,8,73,7952,7654),
(2,8,74,8225,7809),
(2,8,75,8508,7981),
(2,8,76,8800,8139),
(2,8,77,9103,8313),
(2,8,78,9416,8459),
(2,8,79,9740,8636),
(2,8,80,10080,8814),
(2,8,81,10486,8979),
(2,8,82,10784,9160),
(2,8,83,11156,9325);
--
-- Table structure for table `creature_equip_template`
--
@@ -1585,8 +1585,9 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI
IsViper = false;
//We have to reload the states from db for summoned guardians
m_creature->SetMaxHealth(Info->maxhealth);
m_creature->SetHealth(Info->maxhealth);
BaseHealthManaPair pair = m_creature->GenerateHealthMana();
m_creature->SetMaxHealth(pair.first);
m_creature->SetHealth(pair.second);
m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg);
m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg);
+9 -7
View File
@@ -1033,14 +1033,13 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
SetLevel(level);
float rellevel = maxlevel == minlevel ? 0 : (float(level - minlevel))/(maxlevel - minlevel);
BaseHealthManaPair pair = objmgr.GenerateCreatureStats(level, cinfo);
// health
float healthmod = _GetHealthMod(rank);
uint32 minhealth = std::min(cinfo->maxhealth, cinfo->minhealth);
uint32 maxhealth = std::max(cinfo->maxhealth, cinfo->minhealth);
uint32 health = uint32(healthmod * (minhealth + uint32(rellevel*(maxhealth - minhealth))));
uint32 basehp = pair.first;
uint32 health = uint32(basehp * healthmod);
SetCreateHealth(health);
SetMaxHealth(health);
@@ -1048,9 +1047,7 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
ResetPlayerDamageReq();
// mana
uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);
uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);
uint32 mana = minmana + uint32(rellevel*(maxmana - minmana));
uint32 mana = pair.second;
SetCreateMana(mana);
SetMaxPower(POWER_MANA, mana); //MAX Mana
@@ -2320,3 +2317,8 @@ time_t Creature::GetLinkedCreatureRespawnTime() const
return 0;
}
BaseHealthManaPair Creature::GenerateHealthMana()
{
return objmgr.GenerateCreatureStats(getLevel(), GetCreatureInfo());
}
+35 -6
View File
@@ -81,10 +81,7 @@ struct CreatureInfo
uint32 GossipMenuId;
uint32 minlevel;
uint32 maxlevel;
uint32 minhealth;
uint32 maxhealth;
uint32 minmana;
uint32 maxmana;
uint32 expansion;
uint32 armor;
uint32 faction_A;
uint32 faction_H;
@@ -129,8 +126,8 @@ struct CreatureInfo
char const* AIName;
uint32 MovementType;
uint32 InhabitType;
float unk16;
float unk17;
float ModHealth;
float ModMana;
bool RacialLeader;
uint32 questItems[6];
uint32 movementId;
@@ -165,6 +162,35 @@ struct CreatureInfo
}
};
// Defines base stats for creatures (used to calculate HP/mana).
struct CreatureBaseStats
{
uint8 Expansion;
uint8 Class;
uint32 Level;
uint32 BaseHealth;
uint32 BaseMana;
// Helpers
uint32 GenerateHealth(uint32 level, CreatureInfo const* info) const
{
return uint32((BaseHealth * info->ModHealth) + 0.5f);
}
uint32 GenerateMana(uint32 level, CreatureInfo const* info) const
{
// Mana can be 0.
if (!BaseMana)
return 0;
return uint32((BaseMana * info->ModMana) + 0.5f);
}
};
typedef std::list<CreatureBaseStats> CreatureBaseStatsList;
typedef std::pair<uint32, uint32> BaseHealthManaPair;
struct CreatureLocale
{
std::vector<std::string> Name;
@@ -625,6 +651,9 @@ class TRINITY_DLL_SPEC Creature : public Unit
void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
// Provided for script access.
BaseHealthManaPair GenerateHealthMana();
static float _GetDamageMod(int32 Rank);
float m_SightDistance, m_CombatDistance;
+91 -14
View File
@@ -1296,24 +1296,12 @@ void ObjectMgr::LoadCreatures()
}
}
if(cInfo->RegenHealth && data.curhealth < cInfo->minhealth)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`RegenHealth`=1 and low current health (%u), `creature_template`.`minhealth`=%u.",guid,data.id,data.curhealth, cInfo->minhealth );
data.curhealth = cInfo->minhealth;
}
if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
if(!mapEntry || !mapEntry->IsDungeon())
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",guid,data.id);
}
if(data.curmana < cInfo->minmana)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with low current mana (%u), `creature_template`.`minmana`=%u.",guid,data.id,data.curmana, cInfo->minmana );
data.curmana = cInfo->minmana;
}
if(data.spawndist < 0.0f)
{
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.",guid,data.id );
@@ -1494,6 +1482,9 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, f
if(!cInfo)
return 0;
uint32 level = cInfo->minlevel == cInfo->maxlevel ? cInfo->minlevel : urand(cInfo->minlevel, cInfo->maxlevel); // Only used for extracting creature base stats
BaseHealthManaPair pair = objmgr.GenerateCreatureStats(level, cInfo);
uint32 guid = GenerateLowGuid(HIGHGUID_UNIT);
CreatureData& data = NewOrExistCreatureData(guid);
data.id = entry;
@@ -1507,8 +1498,8 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 team, uint32 mapId, float x, f
data.spawntimesecs = spawntimedelay;
data.spawndist = 0;
data.currentwaypoint = 0;
data.curhealth = cInfo->maxhealth;
data.curmana = cInfo->maxmana;
data.curhealth = pair.first;
data.curmana = pair.second;
data.is_dead = false;
data.movementType = cInfo->MovementType;
data.spawnMask = 1;
@@ -8936,6 +8927,92 @@ void ObjectMgr::RemoveGMTicket(uint64 ticketGuid, int64 source, bool permanently
RemoveGMTicket(ticket, source, permanently);
}
CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 expansion, uint8 unitClass, uint32 level)
{
for (CreatureBaseStatsList::const_iterator it = m_creatureBaseStatsList.begin(); it != m_creatureBaseStatsList.end(); ++it)
{
CreatureBaseStats const& stats = (*it);
if (stats.Expansion == expansion && stats.Class == unitClass && stats.Level == level)
return &stats;
}
return NULL;
}
BaseHealthManaPair ObjectMgr::GenerateCreatureStats(uint32 level, CreatureInfo const* info)
{
uint32 health = 1;
uint32 mana = 1;
CreatureBaseStats const* stats = GetCreatureBaseStats(info->expansion, info->unit_class, level);
if (!stats)
{
sLog.outError("Could not find base stats for creature entry %u (base stats level %u)", info->Entry, level);
}
else
{
health = stats->GenerateHealth(level, info);
mana = stats->GenerateMana(level, info);
}
return BaseHealthManaPair(health, mana);
}
void ObjectMgr::LoadCreatureClassLevelStats()
{
QueryResult *result = WorldDatabase.Query("SELECT exp, class, level, basehp, basemana FROM creature_classlevelstats");
if (!result)
{
barGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
uint32 counter = 0;
do
{
Field *fields = result->Fetch();
CreatureBaseStats stats = CreatureBaseStats();
stats.Expansion = fields[0].GetUInt8();
stats.Class = fields[1].GetUInt8();
stats.Level = fields[2].GetUInt32();
stats.BaseHealth = fields[3].GetUInt32();
stats.BaseMana = fields[4].GetUInt32();
if (stats.Level > MAX_LEVEL)
{
sLog.outErrorDb("Creature base stats for expansion %u, class %u has invalid level %u (max is %u) - set to %u",
stats.Expansion, stats.Class, stats.Level, MAX_LEVEL, DEFAULT_MAX_LEVEL);
stats.Level = DEFAULT_MAX_LEVEL;
}
if (!stats.Class || ((1 << (stats.Class-1)) & CLASSMASK_ALL_CREATURES) == 0)
sLog.outErrorDb("Creature base stats for expansion %u, level %u has invalid class %u",
stats.Expansion, stats.Level, stats.Class);
if (stats.BaseHealth < 1)
{
sLog.outErrorDb("Creature base stats for expansion %u, class %u, level %u has invalid zero base HP - set to 1",
stats.Expansion, stats.Class, stats.Level);
stats.BaseHealth = 1;
}
m_creatureBaseStatsList.push_back(stats);
bar.step();
++counter;
}
while (result->NextRow());
sLog.outString();
sLog.outString( ">> Loaded %u creature base stats.", counter);
}
bool ObjectMgr::CheckDB() const
{
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(28511);
+6
View File
@@ -576,6 +576,7 @@ class ObjectMgr
bool LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value);
bool LoadTrinityStrings() { return LoadTrinityStrings(WorldDatabase,"trinity_string",MIN_TRINITY_STRING_ID,MAX_TRINITY_STRING_ID); }
void LoadDbScriptStrings();
void LoadCreatureClassLevelStats();
void LoadCreatureLocales();
void LoadCreatureTemplates();
void LoadCreatures();
@@ -649,6 +650,9 @@ class ObjectMgr
void ReturnOrDeleteOldMails(bool serverUp);
CreatureBaseStats const* GetCreatureBaseStats(uint8 expansion, uint8 unitClass, uint32 level);
BaseHealthManaPair GenerateCreatureStats(uint32 level, CreatureInfo const* info);
void SetHighestGuids();
uint32 GenerateLowGuid(HighGuid guidhigh);
uint32 GenerateArenaTeamId();
@@ -1009,6 +1013,8 @@ class ObjectMgr
MailLevelRewardMap m_mailLevelRewardMap;
CreatureBaseStatsList m_creatureBaseStatsList;
typedef std::map<uint32,PetLevelInfo*> PetLevelInfoMap;
// PetLevelInfoMap[creature_id][level]
PetLevelInfoMap petInfo; // [creature_id][level]
+2 -2
View File
@@ -193,8 +193,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
data << uint32(ci->Modelid2); // Modelid2
data << uint32(ci->Modelid3); // Modelid3
data << uint32(ci->Modelid4); // Modelid4
data << float(ci->unk16); // unk
data << float(ci->unk17); // unk
data << float(ci->ModHealth); // dmg/hp modifier
data << float(ci->ModMana); // dmg/mana modifier
data << uint8(ci->RacialLeader);
for (uint32 i = 0; i < 6; ++i)
data << uint32(ci->questItems[i]); // itemId[6], quest drop
+3
View File
@@ -1375,6 +1375,9 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Points Of Interest Data...");
objmgr.LoadPointsOfInterest();
sLog.outString("Loading Creature Base Stats...");
objmgr.LoadCreatureClassLevelStats();
sLog.outString("Loading Creature Data...");
objmgr.LoadCreatures();
+2 -2
View File
@@ -27,8 +27,8 @@ extern DatabasePostgre WorldDatabase;
extern DatabaseMysql WorldDatabase;
#endif
const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis";
const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii";
const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiis";
const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiiiliiii";
const char CreatureDataAddonInfofmt[]="iiiiiiis";
const char CreatureModelfmt[]="iffbi";
const char CreatureInfoAddonInfofmt[]="iiiiiiis";