aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
diff options
context:
space:
mode:
authorDiscover- <amort11@hotmail.com>2014-01-25 16:59:01 +0100
committerDiscover- <amort11@hotmail.com>2014-01-25 16:59:01 +0100
commit6b25c2b4147a237ab07c99dbd3563cedfda2f8fc (patch)
tree9561ac6d0b98ec4f442f29f893050755fd4798b8 /src/server/game/Entities/GameObject
parentc6650ecc7197aab566b30d74f42aff7e2be52bdd (diff)
Core/Gameobjects: Fix an exploit where it was possible to use gameobjects from any distance. Fixes for example picking up the WSG flag from any distance using hacking tools.
Diffstat (limited to 'src/server/game/Entities/GameObject')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp16
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 21d5ba0d21a..578622cbb0b 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -2209,3 +2209,19 @@ void GameObject::GetRespawnPosition(float &x, float &y, float &z, float* ori /*
if (ori)
*ori = GetOrientation();
}
+
+float GameObject::GetInteractionDistance()
+{
+ switch (GetGoType())
+ {
+ /// @todo find out how the client calculates the maximal usage distance to spellless working
+ // gameobjects like guildbanks and mailboxes - 10.0 is a just an abitrary choosen number
+ case GAMEOBJECT_TYPE_GUILD_BANK:
+ case GAMEOBJECT_TYPE_MAILBOX:
+ return 10.0f;
+ case GAMEOBJECT_TYPE_FISHINGHOLE:
+ return 20.0f + CONTACT_DISTANCE; // max spell range
+ default:
+ return INTERACTION_DISTANCE;
+ }
+}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 0ef03723cb4..84abc391bc6 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -830,6 +830,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
float GetStationaryZ() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
float GetStationaryO() const { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
+ float GetInteractionDistance();
+
protected:
bool AIM_Initialize();
void UpdateModel(); // updates model in case displayId were changed