Core/Objects: ported and implement custom visibility range functionality for creatures and gameobjects. Gameobjects will now get their visbility range read from their template data while creatures can be modified at will. The initial visbility distance changes has been parsed from MoP difficulty data by Kilyana
This commit is contained in:
1 parent
1c07e94666
commit
7543c45c7c
10 files changed
+157
-47
No files matched your search
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE `creature_addon` ADD COLUMN `visibilityDistanceType` TINYINT UNSIGNED NOT NULL AFTER `meleeAnimKit`;
|
||||
ALTER TABLE `creature_template_addon` ADD COLUMN `visibilityDistanceType` TINYINT UNSIGNED NOT NULL AFTER `meleeAnimKit`;
|
||||
|
||||
-- Set right visibility for creatures
|
||||
UPDATE `creature_template_addon` SET `visibilityDistanceType`=3 WHERE `entry` IN (1284, 1768, 1853, 1908, 2726, 2748, 2754, 3653, 3654, 3669, 3670, 3671, 3673, 3674, 3886, 3887, 3914, 3936, 3943, 3977, 4274, 4275, 4278, 4279, 4714, 4715, 4716, 4718, 4719, 4829, 4830, 4831, 4832, 4854, 4887, 4968, 5359, 5709, 5710, 5711, 5775, 6109, 6193, 6196, 6235, 6243, 6906, 6907, 6908, 6910, 7023, 7079, 7206, 7228, 7267, 7271, 7272, 7273, 7275, 7291, 7361, 7795, 7797, 7800, 7846, 7977, 7999, 8127, 8197, 8198, 8443, 8923, 8929, 8933, 8983, 9016, 9017, 9018, 9019, 9024, 9025, 9027, 9028, 9029, 9030, 9031, 9032, 9033, 9041, 9042, 9156, 9196, 9236, 9237, 9319, 9499, 9502, 9537, 9543, 9568, 9659, 9736, 9816, 9938, 10076, 10162, 10181, 10184, 10220, 10264, 10268, 10339, 10363, 10415, 10429, 10430, 10435, 10436, 10437, 10438, 10439, 10440, 10502, 10503, 10505, 10508, 10516, 10558, 10584, 10596, 10808, 10809, 10811, 10812, 10813, 10826, 10901, 10942, 10997, 11032, 11143, 11261, 11262, 11352, 11380, 11382, 11467, 11486, 11487, 11488, 11489, 11490, 11496, 11501, 11502, 11517, 11518, 11519, 11520, 11583, 11622, 11658, 11659, 11660, 11661, 11662, 11663, 11664, 11665, 11666, 11667, 11668, 11669, 11671, 11673, 11897, 11978, 11981, 11982, 11983, 11988, 12017, 12018, 12056, 12057, 12076, 12098, 12099, 12100, 12101, 12118, 12119, 12129, 12142, 12143, 12201, 12203, 12206, 12225, 12236, 12237, 12243, 12258, 12259, 12264, 12265, 12397, 12422, 12435, 12457, 12458, 12459, 12460, 12461, 12463, 12464, 12465, 12466, 12467, 12468, 12557, 12804, 12806, 13020, 13161, 13178, 13221, 13256, 13280, 13282, 13419, 13596, 13601, 13738, 13976, 13996, 14020, 14261, 14262, 14263, 14264, 14265, 14302, 14310, 14321, 14322, 14323, 14324, 14325, 14326, 14327, 14349, 14352, 14353, 14354, 14401, 14435, 14449, 14453, 14456, 14507, 14509, 14510, 14515, 14517, 14601, 14605, 14661, 14688, 14834, 14861, 14887, 14888, 14889, 14890, 14943, 14944, 14945, 14946, 14947, 14948, 15122, 15185, 15192, 15203, 15204, 15205, 15223, 15226, 15227, 15228, 15229, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15240, 15241, 15242, 15243, 15244, 15245, 15246, 15247, 15248, 15249, 15250, 15251, 15252, 15253, 15254, 15255, 15256, 15257, 15258, 15259, 15262, 15263, 15264, 15275, 15276, 15277, 15299, 15300, 15302, 15305, 15311, 15312, 15318, 15319, 15320, 15322, 15323, 15324, 15325, 15326, 15327, 15329, 15330, 15331, 15332, 15333, 15334, 15335, 15336, 15337, 15338, 15339, 15340, 15341, 15343, 15344, 15345, 15346, 15347, 15348, 15355, 15369, 15370, 15385, 15386, 15387, 15388, 15389, 15390, 15391, 15392, 15393, 15428, 15467, 15471, 15472, 15473, 15481, 15491, 15507, 15509, 15510, 15511, 15514, 15516, 15517, 15521, 15527, 15537, 15538, 15543, 15544, 15546, 15550, 15555, 15571, 15589, 15608, 15628, 15667, 15687, 15688, 15689, 15690, 15691, 15712, 15718, 15725, 15726, 15727, 15728, 15740, 15741, 15742, 15743, 15744, 15772, 15773, 15775, 15776, 15778, 15800, 15802, 15809, 15896, 15904, 15910, 15928, 15929, 15930, 15931, 15932, 15934, 15936, 15952, 15953, 15954, 15956, 15957, 15962, 15963, 15973, 15974, 15975, 15976, 15977, 15978, 15979, 15980, 15981, 15984, 15989, 15990, 16011, 16017, 16018, 16020, 16021, 16022, 16024, 16025, 16026, 16027, 16028, 16029, 16034, 16035, 16038, 16039, 16040, 16041, 16059, 16060, 16061, 16062, 16063, 16064, 16065, 16067, 16097, 16098, 16101, 16102, 16103, 16104, 16125, 16126, 16136, 16137, 16142, 16145, 16146, 16151, 16152, 16154, 16156, 16157, 16158, 16163, 16164, 16165, 16167, 16168, 16172, 16179, 16180, 16181, 16193, 16194, 16215, 16216, 16218, 16243, 16244, 16286, 16290, 16363, 16375, 16386, 16398, 16401, 16421, 16431, 16440, 16446, 16447, 16448, 16449, 16451, 16452, 16453, 16457, 16477, 16488, 16505, 16506, 16524, 16531, 16573, 16598, 16604, 16609, 16697, 16775, 16776, 16777, 16778, 16800, 16801, 16802, 16803, 16807, 16808, 16809, 16861, 16887, 16939, 17007, 17030, 17075, 17076, 17225, 17256, 17257, 17258, 17306, 17307, 17308, 17309, 17310, 17367, 17368, 17369, 17377, 17380, 17381, 17388, 17427, 17435, 17451, 17454, 17461, 17462, 17468, 17470, 17521, 17533, 17534, 17535, 17536, 17537, 17543, 17546, 17547, 17548, 17592, 17602, 17603, 17611, 17621, 17622, 17623, 17645, 17646, 17650, 17652, 17653, 17693, 17711, 17719, 17720, 17725, 17767, 17770, 17772, 17796, 17797, 17798, 17808, 17818, 17826, 17830, 17838, 17839, 17842, 17848, 17852, 17862, 17864, 17871, 17876, 17879, 17880, 17881, 17882, 17888, 17890, 17895, 17897, 17898, 17899, 17905, 17906, 17907, 17908, 17916, 17918, 17941, 17942, 17951, 17965, 17968, 17975, 17976, 17977, 17978, 17980, 17991, 18040, 18041, 18061, 18096, 18099, 18100, 18101, 18102, 18105, 18107, 18168, 18192, 18238, 18242, 18256, 18257, 18258, 18259, 18287, 18338, 18341, 18343, 18344, 18351, 18352, 18371, 18373, 18399, 18409, 18411, 18472, 18473, 18478, 18479, 18497, 18528, 18625, 18667, 18707, 18708, 18726, 18728, 18729, 18731, 18732, 18757, 18759, 18769, 18770, 18778, 18780, 18793, 18794, 18796, 18805, 18806, 18829, 18Line truncated
|
||||
UPDATE `creature_template_addon` SET `visibilityDistanceType`=4 WHERE `entry` IN (90, 392, 832, 1493, 2120, 7024, 14269, 14272, 14824, 22441, 22522, 24019, 24538, 24646, 24647, 24925, 26287, 27447, 27641, 27655, 27656, 27838, 27850, 27881, 27883, 27894, 27992, 27993, 28094, 28312, 28319, 28366, 28586, 29240, 29263, 29308, 29747, 29789, 29790, 30181, 30215, 30246, 30288, 30300, 30476, 30559, 30588, 30589, 30640, 30646, 30649, 30651, 30690, 30699, 30749, 30832, 31047, 31137, 31243, 31400, 31406, 31530, 31565, 31650, 31684, 31702, 31765, 31782, 31811, 31838, 31844, 31869, 32160, 32200, 32254, 32264, 32277, 32305, 32347, 32400, 32473, 32479, 32480, 32482, 32483, 32491, 32511, 32512, 32513, 32518, 32521, 32627, 32629, 32630, 32898, 32906, 32913, 32914, 32915, 32933, 33059, 33060, 33061, 33062, 33063, 33067, 33080, 33090, 33109, 33114, 33139, 33142, 33146, 33167, 33189, 33214, 33216, 33218, 33237, 33264, 33387, 33697, 33814, 33912, 33914, 34006, 34012, 34085, 34086, 34124, 34161, 34164, 34275, 34492, 34494, 34564, 34660, 34776, 34777, 34778, 34793, 34832, 34925, 35069, 35150, 35163, 35335, 35336, 35339, 35377, 35592, 35815, 35827, 35898, 36127, 36140, 36161, 36168, 36231, 36233, 36234, 36283, 36286, 36355, 36356, 36369, 36449, 36510, 36667, 36682, 36689, 36735, 36737, 36804, 36826, 36835, 36846, 36940, 36941, 36966, 37037, 37069, 37126, 37193, 37194, 37203, 37528, 37533, 37534, 37543, 37574, 37804, 37970, 37972, 37973, 38019, 38020, 38021, 38069, 38346, 38368, 38377, 38708, 38806, 38821, 38917, 39039, 39271, 39375, 39382, 39383, 39420, 39607, 39620, 39652, 39661, 39746, 39747, 39751, 39800, 39801, 39802, 39803, 39809, 39810, 39811, 39812, 39813, 39822, 39829, 39830, 39831, 39832, 39859, 39867, 39908, 39913, 39919, 39964, 39966, 40128, 40130, 40178, 40219, 40282, 40309, 40340, 40341, 40370, 40439, 40466, 40484, 40499, 40506, 40600, 40688, 40689, 40785, 40793, 40804, 40805, 40932, 40942, 40999, 41000, 41009, 41010, 41020, 41021, 41022, 41057, 41077, 41083, 41098, 41157, 41270, 41379, 41417, 41418, 41454, 41504, 41548, 41564, 41567, 41568, 41570, 41571, 41574, 41575, 41577, 41582, 41583, 41585, 41587, 41594, 41596, 41597, 41599, 41630, 41632, 41634, 41641, 41642, 41736, 41737, 41738, 41739, 41740, 41741, 41742, 41894, 41895, 41918, 41948, 41955, 41958, 41962, 41963, 41964, 41968, 41969, 41970, 41971, 41972, 41973, 41974, 41975, 41976, 41977, 41978, 41987, 41988, 41997, 41998, 42011, 42016, 42017, 42019, 42020, 42030, 42031, 42036, 42037, 42038, 42055, 42063, 42164, 42181, 42182, 42208, 42215, 42233, 42236, 42261, 42263, 42269, 42305, 42306, 42314, 42317, 42345, 42347, 42363, 42364, 42368, 42369, 42370, 42389, 42393, 42395, 42397, 42398, 42419, 42471, 42551, 42670, 42734, 42807, 42818, 42819, 42820, 42821, 42846, 42847, 42848, 42849, 42992, 42993, 42994, 42995, 42996, 42997, 42998, 43094, 43197, 43217, 43244, 43370, 43409, 43412, 43413, 43414, 43415, 43432, 43433, 43434, 43435, 43450, 43457, 43465, 43466, 43469, 43470, 43473, 43474, 43475, 43476, 43477, 43478, 43496, 43519, 43520, 43641, 43714, 43718, 43734, 43736, 43737, 43744, 43745, 43775, 43781, 43782, 43783, 43784, 43786, 43787, 43788, 43821, 43830, 43831, 43832, 43833, 43834, 43838, 43843, 43864, 43865, 43867, 43908, 43931, 43932, 43933, 44058, 44135, 44136, 44291, 44298, 44367, 44403, 44431, 44434, 44453, 44467, 44471, 44493, 44518, 44534, 44537, 44539, 44641, 44645, 44650, 44652, 44653, 44662, 44687, 44731, 44737, 44764, 44797, 44826, 44828, 44829, 44835, 44885, 44886, 44887, 44888, 44889, 44890, 44891, 44923, 45270, 45275, 45280, 45292, 45301, 45317, 45375, 45376, 45426, 45475, 45479, 45484, 45492, 45532, 45535, 45543, 45561, 45564, 45586, 45643, 45660, 45679, 45680, 45696, 45697, 45764, 45772, 45779, 45790, 45799, 45800, 45803, 45838, 45877, 45886, 45893, 45895, 46003, 46041, 46042, 46052, 46070, 46133, 46134, 46136, 46173, 46191, 46192, 46193, 46194, 46199, 46200, 46201, 46277, 46321, 46345, 46401, 46402, 46416, 46457, 46471, 46484, 46502, 46514, 46515, 46516, 46529, 46531, 46533, 46534, 46535, 46536, 46537, 46538, 46539, 46540, 46541, 46542, 46543, 46544, 46545, 46546, 46547, 46548, 46560, 46596, 46603, 46608, 46657, 46679, 46680, 46719, 46720, 46721, 46722, 46723, 46724, 46725, 46726, 46727, 46728, 46729, 46730, 46731, 46732, 46735, 46746, 46747, 46752, 46774, 46776, 46777, 46778, 46779, 46780, 46781, 46782, 46783, 46784, 46796, 46797, 46798, 46799, 46835, 46842, 46872, 46873, 46875, 46877, 46878, 46879, 46880, 46907, 46949, 47016, 47017, 47019, 47020, 47079, 47092, 47095, 47097, 47100, 47102, 47113, 47114, 47158, 47160, 47186, 47201, 47210, 47221, 47222, 47260, 47287, 47385, 47452, 47455, 47484, 47510, 47513, 47546, 47562, 47594, 47625, 47643, 47656, 47684, 47732, 47743, 47744, 47763, 47766, 47772, 47777, 47789, 47790, 47791, 47792, 47793, 47829, 47867, 47896, 47912, 47916, 47919, 47930, 47959, 47974, 47979, 48011, 48012, 48028, 48029, 48030, 48157, 48168, 48169, 48171, 48193, 48198, 48199, 48202, 48209, 48211, 48214, 48313, 48416, 48428, 48437, 48444,Line truncated
|
||||
UPDATE `creature_template_addon` SET `visibilityDistanceType`=5 WHERE `entry` IN (229, 13116, 13117, 18733, 20000, 24812, 26310, 28243, 28781, 28859, 30342, 30343, 31253, 32295, 32448, 32487, 32492, 32520, 33108, 33143, 33184, 33186, 33212, 33259, 33287, 33293, 33364, 33365, 33366, 33367, 33369, 33370, 33377, 33388, 33425, 33426, 33453, 33805, 33816, 33846, 34144, 34145, 34295, 34515, 34775, 34802, 34929, 34935, 34944, 35273, 35819, 36171, 36177, 36451, 36494, 36597, 36598, 36612, 36616, 36818, 36819, 36820, 36821, 36838, 36839, 36853, 36878, 36913, 36954, 36955, 36994, 36995, 36996, 36997, 37065, 37215, 37490, 37540, 37554, 37593, 37755, 37927, 38146, 38150, 38557, 38558, 38569, 38757, 38855, 38857, 39123, 39217, 39231, 40655, 40728, 40756, 40781, 40987, 40990, 40995, 41178, 41376, 41550, 41551, 41552, 41766, 42015, 42045, 42098, 42122, 42123, 42144, 42172, 42173, 42196, 42202, 42219, 42229, 42251, 42318, 42408, 42409, 42429, 42454, 42455, 42456, 42457, 42458, 42459, 42460, 42461, 42517, 42550, 42565, 42572, 42593, 42595, 42596, 42666, 42667, 42678, 42735, 42737, 42759, 42760, 42774, 42822, 42844, 42851, 42856, 42979, 42980, 42981, 42982, 42999, 43175, 43359, 43382, 43416, 43467, 43468, 43471, 43472, 43516, 43559, 43620, 43639, 43642, 43643, 43644, 43647, 43890, 43968, 43970, 44139, 44140, 44525, 44526, 44527, 44528, 44529, 44530, 44531, 44532, 44533, 44535, 44536, 44538, 44566, 44581, 44744, 44748, 44842, 45030, 45041, 45042, 45051, 45057, 45092, 45144, 45145, 45160, 45181, 45186, 45213, 45246, 45249, 45252, 45281, 45291, 45316, 45319, 45344, 45350, 45423, 45455, 45504, 45507, 45510, 45511, 45590, 45681, 45686, 45693, 45694, 45710, 45737, 45819, 45870, 45871, 45872, 46097, 46099, 46110, 46111, 46115, 46116, 46120, 46275, 46285, 46286, 46287, 46288, 46290, 46291, 46303, 46361, 46418, 46644, 46646, 46661, 46674, 46692, 46717, 46743, 46753, 46767, 46931, 46965, 47034, 47049, 47066, 47305, 47807, 48005, 48051, 48076, 48079, 48084, 48092, 48097, 48165, 48185, 48190, 48196, 48233, 48554, 48572, 48606, 48700, 48852, 48854, 48855, 48977, 48979, 48983, 48992, 48997, 48999, 49001, 49110, 49127, 49145, 49153, 49154, 49168, 49169, 49171, 49188, 49189, 49190, 49192, 49193, 49194, 49200, 49205, 49207, 49210, 49385, 49427, 49454, 49474, 49526, 49529, 49530, 49531, 49542, 49552, 49553, 49560, 49561, 49604, 49618, 49626, 49627, 49685, 49761, 49846, 49911, 50009, 50067, 50254, 50691, 50693, 50694, 50695, 50696, 50697, 50698, 50699, 50700, 51060, 51065, 51089, 51098, 51114, 51132, 51135, 51144, 51228, 51311, 51315, 51316, 51317, 51318, 51319, 51320, 51321, 51322, 51338, 51340, 51435, 51436, 51479, 51480, 51481, 51482, 51483, 51484, 51485, 51486, 51487, 51597, 51598, 51624, 52409, 52558, 52599, 52659, 52696, 52792, 52811, 52829, 52868, 52869, 52895, 52923, 52949, 52951, 53046, 53047, 53194, 53220, 53226, 53227, 53241, 53242, 53250, 53252, 53255, 53272, 53274, 53277, 53278, 53279, 53280, 53282, 53287, 53295, 53298, 53299, 53305, 53306, 53307, 53311, 53312, 53313, 53314, 53315, 53316, 53317, 53318, 53319, 53320, 53321, 53322, 53323, 53324, 53325, 53326, 53330, 53331, 53332, 53333, 53334, 53335, 53336, 53337, 53338, 53339, 53340, 53341, 53342, 53343, 53344, 53345, 53346, 53390, 53394, 53396, 53397, 53439, 53468, 53505, 53518, 53537, 53560, 53615, 53649, 53652, 53655, 53657, 53660, 53663, 53664, 53665, 53666, 53667, 53668, 53669, 53670, 53676, 53678, 53679, 53682, 53683, 53700, 53701, 53715, 53716, 53723, 53738, 53744, 53772, 53785, 53870, 53920, 53925, 53926, 54192, 54199, 54226, 54258, 54260, 54306, 54313, 54421, 54424, 54429, 54432, 54436, 54437, 54439, 54440, 54858, 54859, 54860, 54861, 54863, 54881, 54937, 54946, 54947, 54956, 54957, 54969, 54986, 54994, 54997, 55000, 55002, 55078, 55082, 55091, 55346, 55393, 55394, 55395, 55400, 55700, 55739, 55971, 56071, 56078, 56087, 56099, 56100, 56101, 56102, 56103, 56126, 56167, 56168, 56173, 56188, 56262, 56263, 56307, 56405, 56471, 56475, 56479, 56570, 56584, 56598, 56620, 56638, 56642, 56699, 56703, 56710, 56724, 56844, 56846, 57201, 57479, 57480, 57686, 57693, 57694, 57695, 57696, 57769, 57798, 57962, 58232, 58418);
|
||||
@@ -523,7 +523,7 @@ bool CompareValues(ComparisionType type, T val1, T val2)
|
||||
}
|
||||
|
||||
template<typename E>
|
||||
typename std::underlying_type<E>::type AsUnderlyingType(E enumValue)
|
||||
constexpr typename std::underlying_type<E>::type AsUnderlyingType(E enumValue)
|
||||
{
|
||||
static_assert(std::is_enum<E>::value, "AsUnderlyingType can only be used with enums");
|
||||
return static_cast<typename std::underlying_type<E>::type>(enumValue);
|
||||
|
||||
@@ -2455,6 +2455,10 @@ bool Creature::LoadCreaturesAddon()
|
||||
SetMovementAnimKitId(cainfo->movementAnimKit);
|
||||
SetMeleeAnimKitId(cainfo->meleeAnimKit);
|
||||
|
||||
// Check if visibility distance different
|
||||
if (cainfo->visibilityDistanceType != VisibilityDistanceType::Normal)
|
||||
SetVisibilityDistanceOverride(cainfo->visibilityDistanceType);
|
||||
|
||||
// Load Path
|
||||
if (cainfo->path_id != 0)
|
||||
_waypointPathId = cainfo->path_id;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <cmath>
|
||||
|
||||
struct ItemTemplate;
|
||||
enum class VisibilityDistanceType : uint8;
|
||||
|
||||
enum CreatureFlagsExtra : uint32
|
||||
{
|
||||
@@ -285,6 +286,7 @@ struct CreatureAddon
|
||||
uint16 movementAnimKit;
|
||||
uint16 meleeAnimKit;
|
||||
std::vector<uint32> auras;
|
||||
VisibilityDistanceType visibilityDistanceType;
|
||||
};
|
||||
|
||||
// Vendors
|
||||
|
||||
@@ -337,6 +337,14 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
|
||||
delete linkedGO;
|
||||
}
|
||||
|
||||
// Check if GameObject is Infinite
|
||||
if (m_goInfo->IsInfiniteGameObject())
|
||||
SetVisibilityDistanceOverride(VisibilityDistanceType::Infinite);
|
||||
|
||||
// Check if GameObject is Gigantic
|
||||
if (m_goInfo->IsGiganticGameObject())
|
||||
SetVisibilityDistanceOverride(VisibilityDistanceType::Gigantic);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ struct GameObjectTemplate
|
||||
uint32 closeTextID; //5
|
||||
uint32 ignoredByPathing; //6
|
||||
uint32 conditionID1; //7
|
||||
uint32 DoorisOpaque; //8 Door is Opaque (Disable portal on close), enum { false, true, }; Default: true
|
||||
uint32 GiganticAOI; //9 Gigantic AOI, enum { false, true, }; Default: false
|
||||
uint32 InfiniteAOI; //10 Infinite AOI, enum { false, true, }; Default: false
|
||||
} door;
|
||||
//1 GAMEOBJECT_TYPE_BUTTON
|
||||
struct
|
||||
@@ -62,7 +65,7 @@ struct GameObjectTemplate
|
||||
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
|
||||
uint32 linkedTrap; //3
|
||||
uint32 noDamageImmune; //4 isBattlegroundObject
|
||||
uint32 large; //5
|
||||
uint32 GiganticAOI; //5
|
||||
uint32 openTextID; //6 can be used to replace castBarCaption?
|
||||
uint32 closeTextID; //7
|
||||
uint32 losOK; //8
|
||||
@@ -80,7 +83,7 @@ struct GameObjectTemplate
|
||||
uint32 openTextID; //6 can be used to replace castBarCaption?
|
||||
uint32 losOK; //7
|
||||
uint32 allowMounted; //8 Is usable while on mount/vehicle. (0/1)
|
||||
uint32 large; //9
|
||||
uint32 GiganticAOI; //9
|
||||
uint32 conditionID1; //10
|
||||
} questgiver;
|
||||
//3 GAMEOBJECT_TYPE_CHEST
|
||||
@@ -112,7 +115,7 @@ struct GameObjectTemplate
|
||||
uint32 floatingTooltip; //0
|
||||
uint32 highlight; //1
|
||||
uint32 serverOnly; //2
|
||||
uint32 large; //3
|
||||
uint32 GiganticAOI; //3
|
||||
uint32 floatOnWater; //4
|
||||
int32 questID; //5
|
||||
uint32 conditionID1; //6
|
||||
@@ -130,7 +133,7 @@ struct GameObjectTemplate
|
||||
uint32 startDelay; //7
|
||||
uint32 serverOnly; //8
|
||||
uint32 stealthed; //9
|
||||
uint32 large; //10
|
||||
uint32 GiganticAOI; //10
|
||||
uint32 invisible; //11
|
||||
uint32 openTextID; //12 can be used to replace castBarCaption?
|
||||
uint32 closeTextID; //13
|
||||
@@ -154,7 +157,7 @@ struct GameObjectTemplate
|
||||
uint32 linkedTrapId; //2
|
||||
uint32 serverOnly; //3
|
||||
uint32 questID; //4
|
||||
uint32 large; //5
|
||||
uint32 GiganticAOI; //5
|
||||
uint32 floatingTooltip; //6
|
||||
uint32 floatOnWater; //7
|
||||
uint32 conditionID1; //8
|
||||
@@ -184,7 +187,7 @@ struct GameObjectTemplate
|
||||
uint32 spellId; //10
|
||||
uint32 noDamageImmune; //11
|
||||
uint32 linkedTrapId; //12
|
||||
uint32 large; //13
|
||||
uint32 GiganticAOI; //13
|
||||
uint32 openTextID; //14 can be used to replace castBarCaption?
|
||||
uint32 closeTextID; //15
|
||||
uint32 losOK; //16 isBattlegroundObject
|
||||
@@ -278,7 +281,7 @@ struct GameObjectTemplate
|
||||
uint32 charges; //1
|
||||
uint32 partyOnly; //2
|
||||
uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1)
|
||||
uint32 large; //4
|
||||
uint32 GiganticAOI; //4
|
||||
uint32 conditionID1; //5
|
||||
} spellcaster;
|
||||
//23 GAMEOBJECT_TYPE_MEETINGSTONE
|
||||
@@ -344,7 +347,7 @@ struct GameObjectTemplate
|
||||
uint32 maxSuperiority; //15
|
||||
uint32 minTime; //16
|
||||
uint32 maxTime; //17
|
||||
uint32 large; //18
|
||||
uint32 GiganticAOI; //18
|
||||
uint32 highlight; //19
|
||||
uint32 startingValue; //20
|
||||
uint32 unidirectional; //21
|
||||
@@ -558,6 +561,32 @@ struct GameObjectTemplate
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsInfiniteGameObject() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: return door.InfiniteAOI != 0;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsGiganticGameObject() const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: return door.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_BUTTON: return button.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_GENERIC: return _generic.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_TRAP: return trap.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.GiganticAOI != 0;
|
||||
case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.GiganticAOI != 0;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// From `gameobject_template_addon`
|
||||
|
||||
@@ -56,6 +56,16 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max)] =
|
||||
{
|
||||
DEFAULT_VISIBILITY_DISTANCE,
|
||||
VISIBILITY_DISTANCE_TINY,
|
||||
VISIBILITY_DISTANCE_SMALL,
|
||||
VISIBILITY_DISTANCE_LARGE,
|
||||
VISIBILITY_DISTANCE_GIGANTIC,
|
||||
MAX_VISIBILITY_DISTANCE
|
||||
};
|
||||
|
||||
Object::Object() : m_PackGUID(sizeof(uint64)+1)
|
||||
{
|
||||
m_objectTypeId = TYPEID_OBJECT;
|
||||
@@ -1253,6 +1263,15 @@ void WorldObject::SetFarVisible(bool on)
|
||||
m_isFarVisible = on;
|
||||
}
|
||||
|
||||
void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type)
|
||||
{
|
||||
ASSERT(type < VisibilityDistanceType::Max);
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
m_visibilityDistanceOverride = VisibilityDistances[AsUnderlyingType(type)];
|
||||
}
|
||||
|
||||
void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
|
||||
{
|
||||
if (IsInWorld())
|
||||
@@ -1703,7 +1722,9 @@ float WorldObject::GetGridActivationRange() const
|
||||
|
||||
float WorldObject::GetVisibilityRange() const
|
||||
{
|
||||
if (IsFarVisible() && !ToPlayer())
|
||||
if (IsVisibilityOverriden() && !ToPlayer())
|
||||
return *m_visibilityDistanceOverride;
|
||||
else if (IsFarVisible() && !ToPlayer())
|
||||
return MAX_VISIBILITY_DISTANCE;
|
||||
else
|
||||
return GetMap()->GetVisibilityRange();
|
||||
@@ -1715,7 +1736,9 @@ float WorldObject::GetSightRange(const WorldObject* target) const
|
||||
{
|
||||
if (ToPlayer())
|
||||
{
|
||||
if (target && target->IsFarVisible() && !target->ToPlayer())
|
||||
if (target && target->IsVisibilityOverriden() && !target->ToPlayer())
|
||||
return *target->m_visibilityDistanceOverride;
|
||||
else if (target && target->IsFarVisible() && !target->ToPlayer())
|
||||
return MAX_VISIBILITY_DISTANCE;
|
||||
else if (ToPlayer()->GetCinematicMgr()->IsOnCinematic())
|
||||
return DEFAULT_VISIBILITY_INSTANCE;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "MovementInfo.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Optional.h"
|
||||
#include "PhaseShift.h"
|
||||
#include "Position.h"
|
||||
#include "SharedDefines.h"
|
||||
@@ -443,6 +444,8 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
void setActive(bool isActiveObject);
|
||||
bool IsFarVisible() const { return m_isFarVisible; }
|
||||
void SetFarVisible(bool on);
|
||||
bool IsVisibilityOverriden() const { return m_visibilityDistanceOverride.is_initialized(); }
|
||||
void SetVisibilityDistanceOverride(VisibilityDistanceType type);
|
||||
void SetWorldObject(bool apply);
|
||||
bool IsPermanentWorldObject() const { return m_isWorldObject; }
|
||||
bool IsWorldObject() const;
|
||||
@@ -483,6 +486,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
std::string m_name;
|
||||
bool m_isActive;
|
||||
bool m_isFarVisible;
|
||||
Optional<float> m_visibilityDistanceOverride;
|
||||
const bool m_isWorldObject;
|
||||
ZoneScript* m_zoneScript;
|
||||
|
||||
|
||||
@@ -21,22 +21,39 @@
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
#define CONTACT_DISTANCE 0.5f
|
||||
#define INTERACTION_DISTANCE 5.0f
|
||||
#define ATTACK_DISTANCE 5.0f
|
||||
#define INSPECT_DISTANCE 28.0f
|
||||
#define TRADE_DISTANCE 11.11f
|
||||
#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects
|
||||
#define SIGHT_RANGE_UNIT 50.0f
|
||||
#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents
|
||||
#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
|
||||
#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
|
||||
#define CONTACT_DISTANCE 0.5f
|
||||
#define INTERACTION_DISTANCE 5.0f
|
||||
#define ATTACK_DISTANCE 5.0f
|
||||
#define INSPECT_DISTANCE 28.0f
|
||||
#define TRADE_DISTANCE 11.11f
|
||||
#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects
|
||||
#define SIGHT_RANGE_UNIT 50.0f
|
||||
#define VISIBILITY_DISTANCE_GIGANTIC 400.0f
|
||||
#define VISIBILITY_DISTANCE_LARGE 200.0f
|
||||
#define VISIBILITY_DISTANCE_NORMAL 100.0f
|
||||
#define VISIBILITY_DISTANCE_SMALL 50.0f
|
||||
#define VISIBILITY_DISTANCE_TINY 25.0f
|
||||
#define DEFAULT_VISIBILITY_DISTANCE VISIBILITY_DISTANCE_NORMAL // default visible distance, 100 yards on continents
|
||||
#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
|
||||
#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
|
||||
|
||||
#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
|
||||
#define DEFAULT_COMBAT_REACH 1.5f
|
||||
#define MIN_MELEE_REACH 2.0f
|
||||
#define NOMINAL_MELEE_RANGE 5.0f
|
||||
#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
|
||||
#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
|
||||
#define DEFAULT_COMBAT_REACH 1.5f
|
||||
#define MIN_MELEE_REACH 2.0f
|
||||
#define NOMINAL_MELEE_RANGE 5.0f
|
||||
#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
|
||||
|
||||
enum class VisibilityDistanceType : uint8
|
||||
{
|
||||
Normal = 0,
|
||||
Tiny = 1,
|
||||
Small = 2,
|
||||
Large = 3,
|
||||
Gigantic = 4,
|
||||
Infinite = 5,
|
||||
|
||||
Max
|
||||
};
|
||||
|
||||
enum TempSummonType
|
||||
{
|
||||
|
||||
@@ -555,8 +555,8 @@ void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, auras FROM creature_template_addon");
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_template_addon");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -579,16 +579,17 @@ void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
|
||||
CreatureAddon& creatureAddon = _creatureTemplateAddonStore[entry];
|
||||
|
||||
creatureAddon.path_id = fields[1].GetUInt32();
|
||||
creatureAddon.mount = fields[2].GetUInt32();
|
||||
creatureAddon.bytes1 = fields[3].GetUInt32();
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
creatureAddon.aiAnimKit = fields[6].GetUInt16();
|
||||
creatureAddon.movementAnimKit = fields[7].GetUInt16();
|
||||
creatureAddon.meleeAnimKit = fields[8].GetUInt16();
|
||||
creatureAddon.path_id = fields[1].GetUInt32();
|
||||
creatureAddon.mount = fields[2].GetUInt32();
|
||||
creatureAddon.bytes1 = fields[3].GetUInt32();
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
creatureAddon.aiAnimKit = fields[6].GetUInt16();
|
||||
creatureAddon.movementAnimKit = fields[7].GetUInt16();
|
||||
creatureAddon.meleeAnimKit = fields[8].GetUInt16();
|
||||
creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[9].GetUInt8());
|
||||
|
||||
Tokenizer tokens(fields[9].GetString(), ' ');
|
||||
Tokenizer tokens(fields[10].GetString(), ' ');
|
||||
uint8 i = 0;
|
||||
creatureAddon.auras.resize(tokens.size());
|
||||
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
@@ -645,6 +646,13 @@ void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
creatureAddon.meleeAnimKit = 0;
|
||||
}
|
||||
|
||||
if (creatureAddon.visibilityDistanceType >= VisibilityDistanceType::Max)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid visibilityDistanceType (%u) defined in `creature_template_addon`.",
|
||||
entry, AsUnderlyingType(creatureAddon.visibilityDistanceType));
|
||||
creatureAddon.visibilityDistanceType = VisibilityDistanceType::Normal;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
@@ -1147,8 +1155,8 @@ void ObjectMgr::LoadCreatureAddons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, auras FROM creature_addon");
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_addon");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -1179,15 +1187,16 @@ void ObjectMgr::LoadCreatureAddons()
|
||||
TC_LOG_ERROR("sql.sql", "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
|
||||
}
|
||||
|
||||
creatureAddon.mount = fields[2].GetUInt32();
|
||||
creatureAddon.bytes1 = fields[3].GetUInt32();
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
creatureAddon.aiAnimKit = fields[6].GetUInt16();
|
||||
creatureAddon.movementAnimKit = fields[7].GetUInt16();
|
||||
creatureAddon.meleeAnimKit = fields[8].GetUInt16();
|
||||
creatureAddon.mount = fields[2].GetUInt32();
|
||||
creatureAddon.bytes1 = fields[3].GetUInt32();
|
||||
creatureAddon.bytes2 = fields[4].GetUInt32();
|
||||
creatureAddon.emote = fields[5].GetUInt32();
|
||||
creatureAddon.aiAnimKit = fields[6].GetUInt16();
|
||||
creatureAddon.movementAnimKit = fields[7].GetUInt16();
|
||||
creatureAddon.meleeAnimKit = fields[8].GetUInt16();
|
||||
creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[9].GetUInt8());
|
||||
|
||||
Tokenizer tokens(fields[9].GetString(), ' ');
|
||||
Tokenizer tokens(fields[10].GetString(), ' ');
|
||||
uint8 i = 0;
|
||||
creatureAddon.auras.resize(tokens.size());
|
||||
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
@@ -1244,6 +1253,13 @@ void ObjectMgr::LoadCreatureAddons()
|
||||
creatureAddon.meleeAnimKit = 0;
|
||||
}
|
||||
|
||||
if (creatureAddon.visibilityDistanceType >= VisibilityDistanceType::Max)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid visibilityDistanceType (%u) defined in `creature_addon`.",
|
||||
guid, AsUnderlyingType(creatureAddon.visibilityDistanceType));
|
||||
creatureAddon.visibilityDistanceType = VisibilityDistanceType::Normal;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
Reference in new issue
Block a user