mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[12027] Add some VMap LoS checking functions to Map scope
This commit is contained in:
parent
0e0a765312
commit
ea30899db4
6 changed files with 28 additions and 19 deletions
|
|
@ -1935,3 +1935,22 @@ void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId /*=0*/)
|
||||||
if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
|
if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
|
||||||
itr->getSource()->SendDirectMessage(&data);
|
itr->getSource()->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to check if a point is in line of sight from an other point
|
||||||
|
*/
|
||||||
|
bool Map::IsInLineOfSight(float srcX, float srcY, float srcZ, float destX, float destY, float destZ)
|
||||||
|
{
|
||||||
|
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
|
||||||
|
return vMapManager->isInLineOfSight(GetId(), srcX, srcY, srcZ, destX, destY, destZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the hit position and return true if we hit something
|
||||||
|
* otherwise the result pos will be the dest pos
|
||||||
|
*/
|
||||||
|
bool Map::GetObjectHitPos(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, float& resX, float &resY, float& resZ, float pModifyDist)
|
||||||
|
{
|
||||||
|
VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
|
||||||
|
return vMapManager->getObjectHitPos(GetId(), srcX, srcY, srcZ, destX, destY, destZ, resX, resY, resZ, pModifyDist);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,9 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
||||||
void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0);
|
void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0);
|
||||||
void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
|
void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
|
||||||
|
|
||||||
|
// VMap System
|
||||||
|
bool IsInLineOfSight(float srcX, float srcY, float srcZ, float destX, float destY, float destZ);
|
||||||
|
bool GetObjectHitPos(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, float& resX, float &resY, float& resZ, float pModifyDist);
|
||||||
|
|
||||||
// Get Holder for Creature Linking
|
// Get Holder for Creature Linking
|
||||||
CreatureLinkingHolder* GetCreatureLinkingHolder() { return &m_creatureLinkingHolder; }
|
CreatureLinkingHolder* GetCreatureLinkingHolder() { return &m_creatureLinkingHolder; }
|
||||||
|
|
|
||||||
|
|
@ -1101,8 +1101,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const
|
||||||
{
|
{
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
GetPosition(x,y,z);
|
GetPosition(x,y,z);
|
||||||
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
|
return GetMap()->IsInLineOfSight(x, y, z+2.0f, ox, oy, oz+2.0f);
|
||||||
return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D /* = true */) const
|
bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D /* = true */) const
|
||||||
|
|
|
||||||
|
|
@ -8777,10 +8777,10 @@ void Spell::EffectBlock(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
||||||
void Spell::EffectLeapForward(SpellEffectIndex eff_idx)
|
void Spell::EffectLeapForward(SpellEffectIndex eff_idx)
|
||||||
{
|
{
|
||||||
if(unitTarget->IsTaxiFlying())
|
if (unitTarget->IsTaxiFlying())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_spellInfo->rangeIndex == 1) //self range
|
if (m_spellInfo->rangeIndex == 1) // self range
|
||||||
{
|
{
|
||||||
float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx]));
|
float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx]));
|
||||||
|
|
||||||
|
|
@ -8790,14 +8790,8 @@ void Spell::EffectLeapForward(SpellEffectIndex eff_idx)
|
||||||
float ox, oy, oz;
|
float ox, oy, oz;
|
||||||
unitTarget->GetPosition(ox, oy, oz);
|
unitTarget->GetPosition(ox, oy, oz);
|
||||||
|
|
||||||
float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case
|
if (unitTarget->GetMap()->GetObjectHitPos(ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx,fy,fz, -0.5f))
|
||||||
if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(unitTarget->GetMapId(), ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx2,fy2,fz2, -0.5f))
|
|
||||||
{
|
|
||||||
fx = fx2;
|
|
||||||
fy = fy2;
|
|
||||||
fz = fz2;
|
|
||||||
unitTarget->UpdateAllowedPositionZ(fx, fy, fz);
|
unitTarget->UpdateAllowedPositionZ(fx, fy, fz);
|
||||||
}
|
|
||||||
|
|
||||||
unitTarget->NearTeleportTo(fx, fy, fz, unitTarget->GetOrientation(), unitTarget == m_caster);
|
unitTarget->NearTeleportTo(fx, fy, fz, unitTarget->GetOrientation(), unitTarget == m_caster);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10640,13 +10640,7 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee
|
||||||
float fx = ox + dis * vcos;
|
float fx = ox + dis * vcos;
|
||||||
float fy = oy + dis * vsin;
|
float fy = oy + dis * vsin;
|
||||||
float fz = oz;
|
float fz = oz;
|
||||||
float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case
|
GetMap()->GetObjectHitPos(ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx,fy,fz, -0.5f);
|
||||||
if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), ox,oy,oz+0.5f, fx,fy,oz+0.5f,fx2,fy2,fz2, -0.5f))
|
|
||||||
{
|
|
||||||
fx = fx2;
|
|
||||||
fy = fy2;
|
|
||||||
fz = fz2;
|
|
||||||
}
|
|
||||||
UpdateAllowedPositionZ(fx, fy, fz);
|
UpdateAllowedPositionZ(fx, fy, fz);
|
||||||
GetMotionMaster()->MoveJump(fx,fy,fz,horizontalSpeed,max_height);
|
GetMotionMaster()->MoveJump(fx,fy,fz,horizontalSpeed,max_height);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12026"
|
#define REVISION_NR "12027"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue