*Update to Mangos 6880. Source: Mangos.
*Skip 6878, 6871. *Main change: change cell size, add is3dDistance for IsWithinDistInMap and isVisibleForOrDetect. --HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -211,5 +211,5 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
||||
|
||||
bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const
|
||||
{
|
||||
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f));
|
||||
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||
}
|
||||
|
||||
@@ -1522,7 +1522,7 @@ void Creature::DeleteFromDB()
|
||||
WorldDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const
|
||||
bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
// not in world
|
||||
if(!IsInWorld() || !u->IsInWorld())
|
||||
|
||||
+1
-1
@@ -557,7 +557,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
CreatureSpellCooldowns m_CreatureCategoryCooldowns;
|
||||
uint32 m_GlobalCooldown;
|
||||
|
||||
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const;
|
||||
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance = true) const;
|
||||
bool IsWithinSightDist(Unit const* u) const;
|
||||
bool canStartAttack(Unit const* u) const;
|
||||
float GetAttackDistance(Unit const* pl) const;
|
||||
|
||||
@@ -169,6 +169,6 @@ void DynamicObject::Delay(int32 delaytime)
|
||||
bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const
|
||||
{
|
||||
return IsInWorld() && u->IsInWorld()
|
||||
&& (IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))
|
||||
&& (IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false)
|
||||
|| GetCasterGUID() == u->GetGUID());
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const
|
||||
|
||||
// check distance
|
||||
return IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject() +
|
||||
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f) );
|
||||
(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||
}
|
||||
|
||||
void GameObject::Respawn()
|
||||
|
||||
@@ -43,10 +43,10 @@ class Player;
|
||||
#define MIN_GRID_DELAY MINUTE*1000
|
||||
#define MIN_MAP_UPDATE_DELAY 50
|
||||
|
||||
#define MAX_NUMBER_OF_CELLS 8
|
||||
#define MAX_NUMBER_OF_CELLS 4
|
||||
#define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
|
||||
|
||||
#define CENTER_GRID_CELL_ID 256
|
||||
#define CENTER_GRID_CELL_ID 128
|
||||
#define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
|
||||
|
||||
#define TOTAL_NUMBER_OF_CELLS_PER_MAP (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)
|
||||
|
||||
+7
-3
@@ -1094,14 +1094,18 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
||||
return ( dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDistInMap(const WorldObject* obj, const float dist2compare) const
|
||||
bool WorldObject::IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D) const
|
||||
{
|
||||
if (!obj || !IsInMap(obj)) return false;
|
||||
|
||||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
float dy = GetPositionY() - obj->GetPositionY();
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
float distsq = dx*dx + dy*dy + dz*dz;
|
||||
float distsq = dx*dx + dy*dy;
|
||||
if(is3D)
|
||||
{
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
distsq += dz*dz;
|
||||
}
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float maxdist = dist2compare + sizefactor;
|
||||
|
||||
|
||||
+1
-1
@@ -410,7 +410,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
||||
float GetDistance2d(const float x, const float y) const;
|
||||
float GetDistanceZ(const WorldObject* obj) const;
|
||||
bool IsInMap(const WorldObject* obj) const { return GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); }
|
||||
bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare) const;
|
||||
bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D = true) const;
|
||||
bool IsWithinLOS(const float x, const float y, const float z ) const;
|
||||
bool IsWithinLOSInMap(const WorldObject* obj) const;
|
||||
|
||||
|
||||
+6
-6
@@ -17459,7 +17459,7 @@ void Player::ReportedAfkBy(Player* reporter)
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const
|
||||
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
// Always can see self
|
||||
if (u == this)
|
||||
@@ -17498,24 +17498,24 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) cons
|
||||
// different visible distance checks
|
||||
if(isInFlight()) // what see player in flight
|
||||
{
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(!u->isAlive()) // distance for show body
|
||||
{
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)))
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(u->GetTypeId()==TYPEID_PLAYER) // distance for show player
|
||||
{
|
||||
// Players far than max visible distance for player or not in our map are not visible too
|
||||
if (!at_same_transport && !target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
if (!at_same_transport && !target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else if(u->GetCharmerOrOwnerGUID()) // distance for show pet/charmed
|
||||
{
|
||||
// Pet/charmed far than max visible distance for player or not in our map are not visible too
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))
|
||||
if (!target->IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance))
|
||||
return false;
|
||||
}
|
||||
else // distance for show creature
|
||||
@@ -17523,7 +17523,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) cons
|
||||
// Units far than max visible distance for creature or not in our map are not visible too
|
||||
if (!target->IsWithinDistInMap(u, u->isActive()
|
||||
? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance()))
|
||||
: (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))))
|
||||
: (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1996,7 +1996,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
|
||||
bool HaveAtClient(WorldObject const* u) const { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); }
|
||||
|
||||
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const;
|
||||
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance = true) const;
|
||||
bool IsVisibleInGridForPlayer(Player const* pl) const;
|
||||
bool IsVisibleGloballyFor(Player* pl) const;
|
||||
|
||||
|
||||
+7
-6
@@ -2902,14 +2902,14 @@ void Spell::finish(bool ok)
|
||||
if(!m_caster->IsNonMeleeSpellCasted(false, false, true))
|
||||
m_caster->clearUnitState(UNIT_STAT_CASTING);
|
||||
|
||||
//remove spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
|
||||
// other code related only to successfully finished spells
|
||||
if(!ok)
|
||||
return;
|
||||
|
||||
//remove spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
|
||||
//handle SPELL_AURA_ADD_TARGET_TRIGGER auras
|
||||
Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
|
||||
for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
|
||||
@@ -2958,10 +2958,11 @@ void Spell::finish(bool ok)
|
||||
// Clear combo at finish state
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && NeedsComboPoints(m_spellInfo))
|
||||
{
|
||||
// Not drop combopoints if any miss exist
|
||||
// Not drop combopoints if negative spell and if any miss on enemy exist
|
||||
bool needDrop = true;
|
||||
if (!IsPositiveSpell(m_spellInfo->Id))
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if (ihit->missCondition != SPELL_MISS_NONE)
|
||||
if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID!=m_caster->GetGUID())
|
||||
{
|
||||
needDrop = false;
|
||||
break;
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
#include "SocialMgr.h"
|
||||
#include "Util.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "ScriptCalls.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ScriptCalls.h" // for goober gameobject script
|
||||
|
||||
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||
{
|
||||
@@ -980,9 +980,14 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
}
|
||||
case 37674: // Chaos Blast
|
||||
if(unitTarget)
|
||||
m_caster->CastSpell(unitTarget,37675,true);
|
||||
{
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
int32 basepoints0 = 100;
|
||||
m_caster->CastCustomSpell(unitTarget,37675,&basepoints0,NULL,NULL,true);
|
||||
return;
|
||||
}
|
||||
case 40802: // Mingo's Fortune Generator (Mingo's Fortune Giblets)
|
||||
{
|
||||
// selecting one from Bloodstained Fortune item
|
||||
@@ -2128,7 +2133,7 @@ void Spell::EffectApplyAura(uint32 i)
|
||||
|
||||
// Prayer of Mending (jump animation), we need formal caster instead original for correct animation
|
||||
if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & 0x00002000000000LL))
|
||||
m_caster->CastSpell(unitTarget,41637,true,NULL,Aur,m_originalCasterGUID);
|
||||
m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID);
|
||||
}
|
||||
|
||||
void Spell::EffectUnlearnSpecialization( uint32 i )
|
||||
@@ -2712,6 +2717,9 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
|
||||
|
||||
if (gameObjTarget)
|
||||
{
|
||||
if (Script->GOHello(player, gameObjTarget))
|
||||
return;
|
||||
|
||||
switch (gameObjTarget->GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
@@ -4558,6 +4566,38 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
// by spell id
|
||||
switch(m_spellInfo->Id)
|
||||
{
|
||||
// PX-238 Winter Wondervolt TRAP
|
||||
case 26275:
|
||||
{
|
||||
if( unitTarget->HasAura(26272,0)
|
||||
|| unitTarget->HasAura(26157,0)
|
||||
|| unitTarget->HasAura(26273,0)
|
||||
|| unitTarget->HasAura(26274,0))
|
||||
return;
|
||||
|
||||
uint32 iTmpSpellId;
|
||||
|
||||
switch(urand(0,3))
|
||||
{
|
||||
case 0:
|
||||
iTmpSpellId = 26272;
|
||||
break;
|
||||
case 1:
|
||||
iTmpSpellId = 26157;
|
||||
break;
|
||||
case 2:
|
||||
iTmpSpellId = 26273;
|
||||
break;
|
||||
case 3:
|
||||
iTmpSpellId = 26274;
|
||||
break;
|
||||
}
|
||||
|
||||
unitTarget->CastSpell(unitTarget, iTmpSpellId, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Bending Shinbone
|
||||
case 8856:
|
||||
{
|
||||
|
||||
+16
-12
@@ -6499,17 +6499,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
|
||||
{
|
||||
int32 value2 = CalculateSpellDamage((*i)->GetSpellProto(),2,(*i)->GetSpellProto()->EffectBasePoints[2],this);
|
||||
basepoints0 = value2 * GetMaxPower(POWER_MANA) / 100;
|
||||
|
||||
// Drain Soul
|
||||
triggered_spell_id = 18371;
|
||||
target = this;
|
||||
found = true;
|
||||
CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
return false;
|
||||
break; // fall through to normal cast
|
||||
// Not remove charge (aura removed on death in any cases)
|
||||
// Need for correct work Drain Soul SPELL_AURA_CHANNEL_DEATH_ITEM aura
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -9217,7 +9214,9 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges)
|
||||
if(itr->type == spellInfo->Dispel)
|
||||
return true;
|
||||
|
||||
if( !(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && (spellInfo->Id != 42292)) // unaffected by school immunity
|
||||
if( !(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && // unaffected by school immunity
|
||||
!(spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) // can remove immune (by dispell or immune it)
|
||||
&& (spellInfo->Id != 42292))
|
||||
{
|
||||
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||
for(SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
||||
@@ -9776,14 +9775,15 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
|
||||
return gain;
|
||||
}
|
||||
|
||||
bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) const
|
||||
bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
if(!u)
|
||||
return false;
|
||||
return u->canSeeOrDetect(this, detect, inVisibleList);
|
||||
|
||||
return u->canSeeOrDetect(this, detect, inVisibleList, is3dDistance);
|
||||
}
|
||||
|
||||
bool Unit::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const
|
||||
bool Unit::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -10510,7 +10510,7 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
|
||||
|
||||
bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const
|
||||
{
|
||||
return isVisibleForOrDetect(u,false,inVisibleList);
|
||||
return isVisibleForOrDetect(u, false, inVisibleList, false);
|
||||
}
|
||||
|
||||
uint32 Unit::GetCreatureType() const
|
||||
@@ -12055,6 +12055,10 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply )
|
||||
|
||||
uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime )
|
||||
{
|
||||
// Not apply this to creature casted spells with casttime==0
|
||||
if(CastingTime==0 && GetTypeId()==TYPEID_UNIT && !((Creature*)this)->isPet())
|
||||
return 3500;
|
||||
|
||||
if (CastingTime > 7000) CastingTime = 7000;
|
||||
if (CastingTime < 1500) CastingTime = 1500;
|
||||
|
||||
|
||||
+2
-2
@@ -1206,8 +1206,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void SetVisibility(UnitVisibility x);
|
||||
|
||||
// common function for visibility checks for player/creatures with detection code
|
||||
virtual bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const;
|
||||
bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false) const;
|
||||
virtual bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance = true) const;
|
||||
bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false, bool is3dDistance = true) const;
|
||||
bool canDetectInvisibilityOf(Unit const* u) const;
|
||||
bool canDetectStealthOf(Unit const* u, float distance) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user