aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/3.3.5/2018_99_99_99_world.sql12
-rw-r--r--src/common/Utilities/Util.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp4
-rw-r--r--src/server/game/Entities/Creature/CreatureData.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp4
-rw-r--r--src/server/game/Entities/GameObject/GameObjectData.h16
-rw-r--r--src/server/game/Entities/Object/Object.cpp27
-rw-r--r--src/server/game/Entities/Object/Object.h4
-rw-r--r--src/server/game/Entities/Object/ObjectDefines.h37
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp46
-rw-r--r--src/server/worldserver/worldserver.conf.dist6
11 files changed, 129 insertions, 31 deletions
diff --git a/sql/updates/world/3.3.5/2018_99_99_99_world.sql b/sql/updates/world/3.3.5/2018_99_99_99_world.sql
new file mode 100644
index 00000000000..ced34a86be0
--- /dev/null
+++ b/sql/updates/world/3.3.5/2018_99_99_99_world.sql
@@ -0,0 +1,12 @@
+ALTER TABLE `creature_addon`
+ ADD COLUMN `visibilityDistanceType` TINYINT UNSIGNED NOT NULL AFTER `emote`;
+
+ALTER TABLE `creature_template_addon`
+ ADD COLUMN `visibilityDistanceType` TINYINT UNSIGNED NOT NULL AFTER `emote`;
+
+-- 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, 18831, 18832, 18834, 18835, 18836, 18847, 18848, 18925, 18928, 18932, 18945, 18946, 19044, 19214, 19215, 19218, 19219, 19220, 19224, 19260, 19291, 19292, 19336, 19358, 19359, 19382, 19389, 19397, 19398, 19399, 19400, 19427, 19433, 19514, 19516, 19551, 19554, 19565, 19568, 19577, 19622, 19710, 19851, 19870, 19872, 19873, 19874, 19875, 19876, 19878, 19918, 19922, 19927, 19934, 19950, 19951, 20031, 20032, 20033, 20034, 20035, 20036, 20037, 20038, 20039, 20040, 20041, 20042, 20043, 20044, 20045, 20046, 20047, 20048, 20049, 20050, 20051, 20052, 20060, 20062, 20063, 20064, 20075, 20129, 20132, 20142, 20216, 20243, 20454, 20555, 20600, 20769, 20776, 20870, 20885, 20886, 20898, 20899, 20900, 20904, 20905, 20908, 20909, 20910, 20911, 20912, 20923, 20977, 21035, 21075, 21091, 21101, 21102, 21104, 21122, 21140, 21148, 21153, 21154, 21159, 21166, 21170, 21174, 21181, 21187, 21212, 21213, 21214, 21215, 21216, 21217, 21219, 21222, 21224, 21225, 21226, 21227, 21228, 21251, 21268, 21269, 21270, 21271, 21272, 21273, 21274, 21315, 21338, 21350, 21351, 21362, 21364, 21404, 21456, 21466, 21467, 21497, 21514, 21648, 21657, 21685, 21686, 21687, 21688, 21689, 21690, 21697, 21698, 21785, 21801, 21806, 21812, 21845, 21857, 21862, 21865, 21873, 21874, 21875, 21913, 21920, 21931, 21932, 21933, 21958, 21964, 21965, 21966, 21976, 21984, 22009, 22035, 22036, 22055, 22056, 22064, 22067, 22077, 22085, 22089, 22112, 22119, 22120, 22122, 22128, 22140, 22146, 22196, 22207, 22210, 22268, 22274, 22290, 22293, 22295, 22296, 22299, 22332, 22335, 22360, 22389, 22404, 22405, 22406, 22409, 22418, 22422, 22448, 22509, 22517, 22841, 22844, 22845, 22846, 22847, 22848, 22849, 22852, 22853, 22854, 22855, 22856, 22859, 22869, 22871, 22873, 22874, 22875, 22876, 22877, 22878, 22879, 22880, 22881, 22882, 22883, 22884, 22885, 22887, 22898, 22910, 22917, 22942, 22945, 22947, 22948, 22949, 22950, 22951, 22952, 22953, 22954, 22956, 22957, 22960, 22961, 22962, 22964, 22973, 22980, 22988, 22996, 22997);
+
+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, 34085, 34086, 34161, 34164, 34275, 34564, 34660, 34776, 34777, 34778, 34793, 34925, 35069, 35335, 35336, 35339, 35377, 36168, 36355, 36356, 36510, 36737, 36804, 36940, 36941, 36966, 37037, 37069, 37126, 37193, 37194, 37528, 37533, 37534, 37543, 37574, 37970, 37972, 37973, 38019, 38020, 38021, 39271, 39420, 39746, 39747, 39751, 40506);
+
+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, 34515, 34775, 34802, 34929, 34935, 34944, 35273, 35819, 36171, 36494, 36597, 36598, 36612, 36838, 36839, 36853, 36913, 36954, 36955, 37215, 37540, 37554, 37593, 37755, 38557, 38558, 38569, 38757, 38857, 39123, 39217, 39231);
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index f378d457648..78019885d99 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -503,7 +503,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);
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 371b588e5e8..06a74ea1c79 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2478,6 +2478,10 @@ bool Creature::LoadCreaturesAddon()
if (cainfo->emote != 0)
SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote);
+ // Check if visibility distance different
+ if (cainfo->visibilityDistanceType != VisibilityDistanceType::Normal)
+ SetVisibilityDistanceOverride(cainfo->visibilityDistanceType);
+
// Load Path
if (cainfo->path_id != 0)
_waypointPathId = cainfo->path_id;
diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h
index dae19fbf326..c08b2ae86a6 100644
--- a/src/server/game/Entities/Creature/CreatureData.h
+++ b/src/server/game/Entities/Creature/CreatureData.h
@@ -29,6 +29,7 @@
#include <cmath>
struct ItemTemplate;
+enum class VisibilityDistanceType : uint8;
// EnumUtils: DESCRIBE THIS
enum CreatureFlagsExtra : uint32
@@ -312,6 +313,7 @@ struct CreatureAddon
uint32 bytes2;
uint32 emote;
std::vector<uint32> auras;
+ VisibilityDistanceType visibilityDistanceType;
};
// Vendors
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 8ae536497f4..bae468c329c 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -399,6 +399,10 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
delete linkedGO;
}
+ // Check if GameObject is Large
+ if (goinfo->IsLargeGameObject())
+ SetVisibilityDistanceOverride(VisibilityDistanceType::Large);
+
return true;
}
diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h
index b27e004289b..ecb5ba8e684 100644
--- a/src/server/game/Entities/GameObject/GameObjectData.h
+++ b/src/server/game/Entities/GameObject/GameObjectData.h
@@ -571,6 +571,22 @@ struct GameObjectTemplate
}
}
+ bool IsLargeGameObject() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_BUTTON: return button.large != 0;
+ case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.large != 0;
+ case GAMEOBJECT_TYPE_GENERIC: return _generic.large != 0;
+ case GAMEOBJECT_TYPE_TRAP: return trap.large != 0;
+ case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.large != 0;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.large != 0;
+ case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.large != 0;
+ case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.large != 0;
+ default: return false;
+ }
+ }
+
void InitializeQueryData();
WorldPacket BuildQueryData(LocaleConstant loc) const;
};
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 3909f76cd67..5087279adc0 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -47,6 +47,16 @@
#include "World.h"
#include <G3D/Vector3.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;
@@ -1022,6 +1032,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())
@@ -1459,7 +1478,9 @@ float WorldObject::GetGridActivationRange() const
float WorldObject::GetVisibilityRange() const
{
- if (IsFarVisible() && !ToPlayer())
+ if (IsVisibilityOverridden() && !ToPlayer())
+ return *m_visibilityDistanceOverride;
+ else if (IsFarVisible() && !ToPlayer())
return MAX_VISIBILITY_DISTANCE;
else
return GetMap()->GetVisibilityRange();
@@ -1471,7 +1492,9 @@ float WorldObject::GetSightRange(WorldObject const* target) const
{
if (ToPlayer())
{
- if (target && target->IsFarVisible() && !target->ToPlayer())
+ if (target && target->IsVisibilityOverridden() && !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;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index db707fac897..7b13276a7f8 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -28,6 +28,7 @@
#include "MovementInfo.h"
#include "ObjectDefines.h"
#include "ObjectGuid.h"
+#include "Optional.h"
#include "Position.h"
#include "SharedDefines.h"
#include "SpellDefines.h"
@@ -479,6 +480,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 IsVisibilityOverridden() const { return m_visibilityDistanceOverride.is_initialized(); }
+ void SetVisibilityDistanceOverride(VisibilityDistanceType type);
void SetWorldObject(bool apply);
bool IsPermanentWorldObject() const { return m_isWorldObject; }
bool IsWorldObject() const;
@@ -519,6 +522,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
std::string m_name;
bool m_isActive;
bool m_isFarVisible;
+ Optional<float> m_visibilityDistanceOverride;
bool const m_isWorldObject;
ZoneScript* m_zoneScript;
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index ca6a55913e2..0a4faeb1281 100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -21,16 +21,21 @@
#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_PLAYER_BOUNDING_RADIUS 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
#define DEFAULT_PLAYER_COMBAT_REACH 1.5f
@@ -38,6 +43,18 @@
#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
{
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index df4cdc346c2..b267c52aa32 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -487,8 +487,8 @@ void ObjectMgr::LoadCreatureTemplateAddons()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6
- QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, auras FROM creature_template_addon");
+ // 0 1 2 3 4 5 6 7
+ QueryResult result = WorldDatabase.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_template_addon");
if (!result)
{
@@ -511,13 +511,14 @@ 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.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.visibilityDistanceType = VisibilityDistanceType(fields[6].GetUInt8());
- Tokenizer tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[7].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
@@ -556,6 +557,13 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.emote = 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());
@@ -983,8 +991,8 @@ void ObjectMgr::LoadCreatureAddons()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6
- QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, auras FROM creature_addon");
+ // 0 1 2 3 4 5 6 7
+ QueryResult result = WorldDatabase.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, visibilityDistanceType, auras FROM creature_addon");
if (!result)
{
@@ -1015,12 +1023,13 @@ 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.mount = fields[2].GetUInt32();
+ creatureAddon.bytes1 = fields[3].GetUInt32();
+ creatureAddon.bytes2 = fields[4].GetUInt32();
+ creatureAddon.emote = fields[5].GetUInt32();
+ creatureAddon.visibilityDistanceType = VisibilityDistanceType(fields[6].GetUInt8());
- Tokenizer tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[7].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
@@ -1059,6 +1068,13 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.emote = 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());
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 99b888c9ff2..eb31fc4da9a 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -2117,15 +2117,15 @@ Visibility.GroupMode = 1
# Visibility.Distance.Instances
# Visibility.Distance.BGArenas
# Description: Visibility distance to see other players or gameobjects.
-# Visibility on continents on retail ~90 yards. In BG/Arenas ~533.
+# Visibility on continents on retail ~100 yards. In BG/Arenas ~533.
# For instances default ~170.
# Max limited by grid size: 533.33333
# Min limit is max aggro radius (45) * Rate.Creature.Aggro
-# Default: 90 - (Visibility.Distance.Continents)
+# Default: 100 - (Visibility.Distance.Continents)
# 170 - (Visibility.Distance.Instances)
# 533 - (Visibility.Distance.BGArenas)
-Visibility.Distance.Continents = 90
+Visibility.Distance.Continents = 100
Visibility.Distance.Instances = 170
Visibility.Distance.BGArenas = 533