diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/sql/Updates/r125_trinity.sql | 2 | ||||
-rw-r--r-- | src/game/Object.cpp | 16 | ||||
-rw-r--r-- | src/game/Object.h | 10 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/bindings/scripts/sql/Updates/r125_trinity.sql b/src/bindings/scripts/sql/Updates/r125_trinity.sql index bceb8dfe4c3..946d50f3939 100644 --- a/src/bindings/scripts/sql/Updates/r125_trinity.sql +++ b/src/bindings/scripts/sql/Updates/r125_trinity.sql @@ -1,4 +1,4 @@ -update creature_template set speed='0.01' scriptname='mob_toxic_sporebat' WHERE entry=22140;
+update creature_template set speed='0.01',scriptname='mob_toxic_sporebat' WHERE entry=22140;
update creature_template SET scriptname='npc_overlord_morghor' WHERE entry=23139;
update creature_template SET scriptname='npc_lord_illidan_stormrage' WHERE entry=22083;
update creature_template SET scriptname='npc_yarzill_the_merc' WHERE entry=23141;
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 08fbb5a868b..304320f8acf 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1488,7 +1488,17 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, { GetNearPoint2D(x,y,distance2d+searcher_size,absAngle); - z = GetPositionZ(); - - UpdateGroundPositionZ(x,y,z); + z = GetPositionZ(); + + UpdateGroundPositionZ(x,y,z); +} + +void WorldObject::GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const +{ + float object_size = obj->GetObjectSize();//here we use object_size to determine the angle offset, the bigger object the smaller angle offset, then this makes mob move naturally in visual. + //let assume 12.0f is the max size for object to have 0 angle offset. + float angle_offset_ratio = 1 - object_size/12.0f; + if (angle_offset_ratio < 0.05) angle_offset_ratio = 0.05; + // angle to face `obj` to `this`plus a random angle offset(from -90 degree to 90 degree)*angle_offset_ratio using distance from distance2dMin to distance2dMax includes size of `obj` + GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI_2 - M_PI * rand_norm()) * angle_offset_ratio); } diff --git a/src/game/Object.h b/src/game/Object.h index 9b6b805d53e..2fea4cefaa5 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -372,15 +372,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object // angle to face `obj` to `this` using distance includes size of `obj` GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj )); } - void GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const - { - float object_size = obj->GetObjectSize();//here we use object_size to determine the angle offset, the bigger object the smaller angle offset, then this makes mob move naturally in visual. - //let assume 12.0f is the max size for object to have 0 angle offset. - float angle_offset_ratio = 1 - object_size/12.0f; - if (angle_offset_ratio < 0.05) angle_offset_ratio = 0.05; - // angle to face `obj` to `this`plus a random angle offset(from -90 degree to 90 degree)*angle_offset_ratio using distance from distance2dMin to distance2dMax includes size of `obj` - GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI_2 - M_PI * rand_norm()) * angle_offset_ratio); - } + void GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const; float GetObjectSize() const { |