mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -2257,9 +2257,9 @@ LiquidData const Map::GetLiquidData(uint32 phaseMask, float x, float y, float z,
|
||||
// Get position delta
|
||||
if (delta > collisionHeight)
|
||||
liquidData.Status = LIQUID_MAP_UNDER_WATER;
|
||||
if (delta > 0.0f)
|
||||
else if (delta > 0.0f)
|
||||
liquidData.Status = LIQUID_MAP_IN_WATER;
|
||||
if (delta > -0.1f)
|
||||
else if (delta > -0.1f)
|
||||
liquidData.Status = LIQUID_MAP_WATER_WALK;
|
||||
else
|
||||
liquidData.Status = LIQUID_MAP_ABOVE_WATER;
|
||||
@@ -2440,6 +2440,14 @@ float Map::GetWaterLevel(float x, float y) const
|
||||
|
||||
bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_VMAP_BLIZZLIKE_PVP_LOS))
|
||||
{
|
||||
if (IsBattlegroundOrArena())
|
||||
{
|
||||
ignoreFlags = VMAP::ModelIgnoreFlags::Nothing;
|
||||
}
|
||||
}
|
||||
|
||||
if ((checks & LINEOFSIGHT_CHECK_VMAP) && !VMAP::VMapFactory::createOrGetVMapMgr()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2, ignoreFlags))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -316,6 +316,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
uint32 processedPackets = 0;
|
||||
time_t currentTime = GameTime::GetGameTime().count();
|
||||
|
||||
constexpr uint32 MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE = 150;
|
||||
|
||||
while (m_Socket && _recvQueue.next(packet, updater))
|
||||
{
|
||||
OpcodeClient opcode = static_cast<OpcodeClient>(packet->GetOpcode());
|
||||
@@ -358,6 +360,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
else
|
||||
processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
|
||||
break;
|
||||
case STATUS_TRANSFER:
|
||||
if (_player && !_player->IsInWorld() && AntiDOS.EvaluateOpcode(*packet, currentTime))
|
||||
@@ -372,6 +376,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
else
|
||||
processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
|
||||
break;
|
||||
case STATUS_AUTHED:
|
||||
if (m_inQueue) // prevent cheating
|
||||
@@ -389,6 +395,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
sScriptMgr->OnPacketReceived(this, *packet);
|
||||
}
|
||||
else
|
||||
processedPackets = MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE; // break out of packet processing loop
|
||||
break;
|
||||
case STATUS_NEVER:
|
||||
LOG_ERROR("network.opcode", "Received not allowed opcode {} from {}",
|
||||
@@ -440,7 +448,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
deletePacket = true;
|
||||
|
||||
#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 150
|
||||
processedPackets++;
|
||||
|
||||
//process only a max amout of packets in 1 Update() call.
|
||||
|
||||
@@ -1407,19 +1407,214 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
}
|
||||
case TARGET_DEST_CASTER_FRONT_LEAP:
|
||||
{
|
||||
Unit* unitCaster = m_caster->ToUnit();
|
||||
if (!unitCaster)
|
||||
float distance = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
Map* map = m_caster->GetMap();
|
||||
uint32 mapid = m_caster->GetMapId();
|
||||
uint32 phasemask = m_caster->GetPhaseMask();
|
||||
float collisionHeight = m_caster->GetCollisionHeight();
|
||||
float destx = 0.0f, desty = 0.0f, destz = 0.0f, ground = 0.0f, startx = 0.0f, starty = 0.0f, startz = 0.0f, starto = 0.0f;
|
||||
|
||||
Position pos;
|
||||
Position lastpos;
|
||||
m_caster->GetPosition(startx, starty, startz, starto);
|
||||
pos.Relocate(startx, starty, startz, starto);
|
||||
destx = pos.GetPositionX() + distance * cos(pos.GetOrientation());
|
||||
desty = pos.GetPositionY() + distance * sin(pos.GetOrientation());
|
||||
|
||||
ground = map->GetHeight(phasemask, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
|
||||
|
||||
bool isCasterInWater = m_caster->IsInWater();
|
||||
if (!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) || (pos.GetPositionZ() - ground < distance))
|
||||
{
|
||||
break;
|
||||
float tstX = 0.0f, tstY = 0.0f, tstZ = 0.0f, prevX = 0.0f, prevY = 0.0f, prevZ = 0.0f;
|
||||
float tstZ1 = 0.0f, tstZ2 = 0.0f, tstZ3 = 0.0f, destz1 = 0.0f, destz2 = 0.0f, destz3 = 0.0f, srange = 0.0f, srange1 = 0.0f, srange2 = 0.0f, srange3 = 0.0f;
|
||||
float maxtravelDistZ = 2.65f;
|
||||
float overdistance = 0.0f;
|
||||
float totalpath = 0.0f;
|
||||
float beforewaterz = 0.0f;
|
||||
bool inwater = false;
|
||||
bool wcol = false;
|
||||
const float step = 2.0f;
|
||||
const uint8 numChecks = ceil(fabs(distance / step));
|
||||
const float DELTA_X = (destx - pos.GetPositionX()) / numChecks;
|
||||
const float DELTA_Y = (desty - pos.GetPositionY()) / numChecks;
|
||||
int j = 1;
|
||||
for (; j < (numChecks + 1); j++)
|
||||
{
|
||||
prevX = pos.GetPositionX() + (float(j - 1) * DELTA_X);
|
||||
prevY = pos.GetPositionY() + (float(j - 1) * DELTA_Y);
|
||||
tstX = pos.GetPositionX() + (float(j) * DELTA_X);
|
||||
tstY = pos.GetPositionY() + (float(j) * DELTA_Y);
|
||||
|
||||
if (j < 2)
|
||||
{
|
||||
prevZ = pos.GetPositionZ();
|
||||
}
|
||||
else
|
||||
{
|
||||
prevZ = tstZ;
|
||||
}
|
||||
|
||||
tstZ = map->GetHeight(phasemask, tstX, tstY, prevZ + maxtravelDistZ, true);
|
||||
ground = tstZ;
|
||||
|
||||
if (!isCasterInWater)
|
||||
{
|
||||
if (map->IsInWater(phasemask, tstX, tstY, tstZ, collisionHeight))
|
||||
{
|
||||
if (!(beforewaterz != 0.0f))
|
||||
{
|
||||
beforewaterz = prevZ;
|
||||
}
|
||||
tstZ = beforewaterz;
|
||||
srange = sqrt((tstY - prevY) * (tstY - prevY) + (tstX - prevX) * (tstX - prevX));
|
||||
//TC_LOG_ERROR("server", "(start was from land) step in water , number of cycle = %i , distance of step = %f, total path = %f, Z = %f", j, srange, totalpath, tstZ);
|
||||
}
|
||||
}
|
||||
else if (map->IsInWater(phasemask, tstX, tstY, tstZ, collisionHeight))
|
||||
{
|
||||
prevZ = pos.GetPositionZ();
|
||||
tstZ = pos.GetPositionZ();
|
||||
srange = sqrt((tstY - prevY) * (tstY - prevY) + (tstX - prevX) * (tstX - prevX));
|
||||
|
||||
inwater = true;
|
||||
if (inwater && (fabs(tstZ - ground) < 2.0f))
|
||||
{
|
||||
wcol = true;
|
||||
//TC_LOG_ERROR("server", "step in water with collide and use standart check (for continue way after possible collide), number of cycle = %i ", j);
|
||||
}
|
||||
|
||||
// if (j < 2)
|
||||
// TC_LOG_ERROR("server", "(start in water) step in water, number of cycle = %i , distance of step = %f, total path = %f", j, srange, totalpath);
|
||||
// else
|
||||
// TC_LOG_ERROR("server", "step in water, number of cycle = %i , distance of step = %f, total path = %f", j, srange, totalpath);
|
||||
}
|
||||
|
||||
bool IsInWater = map->IsInWater(phasemask, tstX, tstY, tstZ, collisionHeight);
|
||||
if ((!IsInWater && tstZ != beforewaterz) || wcol) // second safety check z for blink way if on the ground
|
||||
{
|
||||
if (inwater && !IsInWater)
|
||||
inwater = false;
|
||||
|
||||
// highest available point
|
||||
tstZ1 = map->GetHeight(phasemask, tstX, tstY, prevZ + maxtravelDistZ, true, 25.0f);
|
||||
// upper or floor
|
||||
tstZ2 = map->GetHeight(phasemask, tstX, tstY, prevZ, true, 25.0f);
|
||||
//lower than floor
|
||||
tstZ3 = map->GetHeight(phasemask, tstX, tstY, prevZ - maxtravelDistZ / 2, true, 25.0f);
|
||||
|
||||
//distance of rays, will select the shortest in 3D
|
||||
srange1 = sqrt((tstY - prevY) * (tstY - prevY) + (tstX - prevX) * (tstX - prevX) + (tstZ1 - prevZ) * (tstZ1 - prevZ));
|
||||
//TC_LOG_ERROR("server", "step = %i, distance of ray1 = %f", j, srange1);
|
||||
srange2 = sqrt((tstY - prevY) * (tstY - prevY) + (tstX - prevX) * (tstX - prevX) + (tstZ2 - prevZ) * (tstZ2 - prevZ));
|
||||
//TC_LOG_ERROR("server", "step = %i, distance of ray2 = %f", j, srange2);
|
||||
srange3 = sqrt((tstY - prevY) * (tstY - prevY) + (tstX - prevX) * (tstX - prevX) + (tstZ3 - prevZ) * (tstZ3 - prevZ));
|
||||
//TC_LOG_ERROR("server", "step = %i, distance of ray3 = %f", j, srange3);
|
||||
|
||||
if (srange1 < srange2)
|
||||
{
|
||||
tstZ = tstZ1;
|
||||
srange = srange1;
|
||||
}
|
||||
else if (srange3 < srange2)
|
||||
{
|
||||
tstZ = tstZ3;
|
||||
srange = srange3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tstZ = tstZ2;
|
||||
srange = srange2;
|
||||
}
|
||||
|
||||
//TC_LOG_ERROR("server", "step on ground, number of cycle = %i , distance of step = %f, total path = %f", j, srange, totalpath);
|
||||
}
|
||||
|
||||
destx = tstX;
|
||||
desty = tstY;
|
||||
destz = tstZ;
|
||||
|
||||
totalpath += srange;
|
||||
|
||||
if (totalpath > distance)
|
||||
{
|
||||
overdistance = totalpath - distance;
|
||||
//TC_LOG_ERROR("server", "total path > than distance in 3D , need to move back a bit for save distance, total path = %f, overdistance = %f", totalpath, overdistance);
|
||||
}
|
||||
|
||||
bool col = VMAP::VMapFactory::createOrGetVMapMgr()->GetObjectHitPos(mapid, prevX, prevY, prevZ + 0.5f, tstX, tstY, tstZ + 0.5f, tstX, tstY, tstZ, -0.5f);
|
||||
// check dynamic collision
|
||||
bool dcol = m_caster->GetMap()->GetObjectHitPos(phasemask, prevX, prevY, prevZ + 0.5f, tstX, tstY, tstZ + 0.5f, tstX, tstY, tstZ, -0.5f);
|
||||
|
||||
// collision occured
|
||||
if (col || dcol || (overdistance > 0.0f && !map->IsInWater(phasemask, tstX, tstY, ground, collisionHeight)) || (fabs(prevZ - tstZ) > maxtravelDistZ && (tstZ > prevZ)))
|
||||
{
|
||||
if ((overdistance > 0.0f) && (overdistance < step))
|
||||
{
|
||||
destx = prevX + overdistance * cos(pos.GetOrientation());
|
||||
desty = prevY + overdistance * sin(pos.GetOrientation());
|
||||
//TC_LOG_ERROR("server", "(collision) collision occured 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
// move back a bit
|
||||
destx = tstX - (0.6 * cos(pos.GetOrientation()));
|
||||
desty = tstY - (0.6 * sin(pos.GetOrientation()));
|
||||
//TC_LOG_ERROR("server", "(collision) collision occured 2");
|
||||
}
|
||||
|
||||
// highest available point
|
||||
destz1 = map->GetHeight(phasemask, destx, desty, prevZ + maxtravelDistZ, true, 25.0f);
|
||||
// upper or floor
|
||||
destz2 = map->GetHeight(phasemask, destx, desty, prevZ, true, 25.0f);
|
||||
//lower than floor
|
||||
destz3 = map->GetHeight(phasemask, destx, desty, prevZ - maxtravelDistZ / 2, true, 25.0f);
|
||||
|
||||
//distance of rays, will select the shortest in 3D
|
||||
srange1 = sqrt((desty - prevY) * (desty - prevY) + (destx - prevX) * (destx - prevX) + (destz1 - prevZ) * (destz1 - prevZ));
|
||||
srange2 = sqrt((desty - prevY) * (desty - prevY) + (destx - prevX) * (destx - prevX) + (destz2 - prevZ) * (destz2 - prevZ));
|
||||
srange3 = sqrt((desty - prevY) * (desty - prevY) + (destx - prevX) * (destx - prevX) + (destz3 - prevZ) * (destz3 - prevZ));
|
||||
|
||||
if (srange1 < srange2)
|
||||
destz = destz1;
|
||||
else if (srange3 < srange2)
|
||||
destz = destz3;
|
||||
else
|
||||
destz = destz2;
|
||||
|
||||
if (inwater && destz < prevZ && !wcol)
|
||||
destz = prevZ;
|
||||
//TC_LOG_ERROR("server", "(collision) destZ rewrited in prevZ");
|
||||
|
||||
break;
|
||||
}
|
||||
// we have correct destz now
|
||||
}
|
||||
//}
|
||||
|
||||
lastpos.Relocate(destx, desty, destz + 0.5f, pos.GetOrientation());
|
||||
dest = SpellDestination(lastpos);
|
||||
}
|
||||
else
|
||||
{
|
||||
float z = pos.GetPositionZ();
|
||||
bool col = VMAP::VMapFactory::createOrGetVMapMgr()->GetObjectHitPos(mapid, pos.GetPositionX(), pos.GetPositionY(), z + 0.5f, destx, desty, z + 0.5f, destx, desty, z, -0.5f);
|
||||
// check dynamic collision
|
||||
bool dcol = m_caster->GetMap()->GetObjectHitPos(phasemask, pos.GetPositionX(), pos.GetPositionY(), z + 0.5f, destx, desty, z + 0.5f, destx, desty, z, -0.5f);
|
||||
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(unitCaster);
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
// collision occured
|
||||
if (col || dcol)
|
||||
{
|
||||
// move back a bit
|
||||
destx = destx - (0.6 * cos(pos.GetOrientation()));
|
||||
desty = desty - (0.6 * sin(pos.GetOrientation()));
|
||||
}
|
||||
|
||||
Position pos = dest._position;
|
||||
|
||||
unitCaster->MovePositionToFirstCollision(pos, dist, angle);
|
||||
dest.Relocate(pos);
|
||||
lastpos.Relocate(destx, desty, z, pos.GetOrientation());
|
||||
dest = SpellDestination(lastpos);
|
||||
//float range = sqrt((desty - pos.GetPositionY())*(desty - pos.GetPositionY()) + (destx - pos.GetPositionX())*(destx - pos.GetPositionX()));
|
||||
//TC_LOG_ERROR("server", "Blink number 2, in falling but at a hight, distance of blink = %f", range);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -4257,6 +4257,19 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
spellInfo->AttributesEx3 |= SPELL_ATTR3_SUPRESS_TARGET_PROCS;
|
||||
});
|
||||
|
||||
// Everlasting Affliction
|
||||
ApplySpellFix({ 47422 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->SchoolMask = SPELL_SCHOOL_MASK_SHADOW;
|
||||
});
|
||||
|
||||
// Flametongue Weapon (Passive) (Rank 6)
|
||||
ApplySpellFix({ 16312 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->Attributes |= SPELL_ATTR0_PASSIVE;
|
||||
spellInfo->DurationEntry = sSpellDurationStore.LookupEntry(21);
|
||||
});
|
||||
|
||||
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
|
||||
{
|
||||
SpellInfo* spellInfo = mSpellInfoMap[i];
|
||||
|
||||
@@ -175,6 +175,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_ALLOW_JOIN_BG_AND_LFG,
|
||||
CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS,
|
||||
CONFIG_LEAVE_GROUP_ON_LOGOUT,
|
||||
CONFIG_VMAP_BLIZZLIKE_PVP_LOS,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -1298,6 +1298,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
bool enableLOS = sConfigMgr->GetOption<bool>("vmap.enableLOS", true);
|
||||
bool enableHeight = sConfigMgr->GetOption<bool>("vmap.enableHeight", true);
|
||||
bool enablePetLOS = sConfigMgr->GetOption<bool>("vmap.petLOS", true);
|
||||
m_bool_configs[CONFIG_VMAP_BLIZZLIKE_PVP_LOS] = sConfigMgr->GetOption<bool>("vmap.BlizzlikePvPLOS", true);
|
||||
|
||||
if (!enableHeight)
|
||||
LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
|
||||
|
||||
@@ -1157,29 +1157,6 @@ class spell_class_call_polymorph : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
class aura_class_call_berserk : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(aura_class_call_berserk);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_WARRIOR_BERSERK });
|
||||
}
|
||||
|
||||
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
target->CastSpell(target, SPELL_WARRIOR_BERSERK);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(aura_class_call_berserk::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_corrupted_totems : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_corrupted_totems);
|
||||
@@ -1314,7 +1291,6 @@ void AddSC_boss_nefarian()
|
||||
RegisterSpellScript(aura_class_call_wild_magic);
|
||||
RegisterSpellScript(aura_class_call_siphon_blessing);
|
||||
RegisterSpellScript(spell_class_call_polymorph);
|
||||
RegisterSpellScript(aura_class_call_berserk);
|
||||
RegisterSpellScript(spell_corrupted_totems);
|
||||
RegisterSpellScript(spell_shadowblink);
|
||||
RegisterSpellScript(spell_spawn_drakonid);
|
||||
|
||||
@@ -373,8 +373,6 @@ public:
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
return;
|
||||
|
||||
events2.Update(diff);
|
||||
switch (events2.ExecuteEvent())
|
||||
{
|
||||
|
||||
@@ -385,6 +385,13 @@ vmap.enableHeight = 1
|
||||
|
||||
vmap.petLOS = 1
|
||||
|
||||
# vmap.BlizzlikePvPLOS
|
||||
# Description: Check line of sight for battleground and arena gameobjects and other doodads (such as WSG treestumps).
|
||||
# Default: 1 - (Enabled, players will be able to fire spells through treestumps and other objects).
|
||||
# 0 - (Disabled, players will NOT be able to fire spells through treestumps and other objects).
|
||||
|
||||
vmap.BlizzlikePvPLOS = 1
|
||||
|
||||
#
|
||||
# vmap.enableIndoorCheck
|
||||
# Description: VMap based indoor check to remove outdoor-only auras (mounts etc.).
|
||||
|
||||
Reference in New Issue
Block a user