Get zone/area IDs from vmap data in the liquid update
* Add new method Map::getFullVMapDataForPosition to get area info and liquid info in a single vmap lookup * Use this lookup in Map:: relocation methods to update m_areaId and m_zoneId fields on WorldObject * Adjust GetZoneId/GetAreaId on WorldObject to always return these cached fields * Clean up liquid state handling on Unit and Player * Hand floor's Z coord up through GetFullTerrainStatusForPosition, use it to update a new field in WorldObject, and use that to feed a new GetFloorZ call on WorldObject.
This commit is contained in:
1 parent
c700779949
commit
f8d9d954d1
17 files changed
+315
-145
No files matched your search
@@ -24666,77 +24666,53 @@ void Player::SetOriginalGroup(Group* group, int8 subgroup)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdateUnderwaterState(Map* m, float x, float y, float z)
|
||||
void Player::ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData> const& liquidData)
|
||||
{
|
||||
LiquidData liquid_status;
|
||||
ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status);
|
||||
if (!res)
|
||||
{
|
||||
m_MirrorTimerFlags &= ~(UNDERWATER_INWATER | UNDERWATER_INLAVA | UNDERWATER_INSLIME | UNDERWARER_INDARKWATER);
|
||||
if (_lastLiquid && _lastLiquid->SpellId)
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
|
||||
_lastLiquid = nullptr;
|
||||
if (IsFlying())
|
||||
return;
|
||||
}
|
||||
|
||||
if (uint32 liqEntry = liquid_status.entry)
|
||||
// process liquid auras using generic unit code
|
||||
Unit::ProcessTerrainStatusUpdate(status, liquidData);
|
||||
|
||||
// player specific logic for mirror timers
|
||||
if (status && liquidData)
|
||||
{
|
||||
LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry);
|
||||
if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry)
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
|
||||
if (liquid && liquid->SpellId)
|
||||
// Breath bar state (under water in any liquid type)
|
||||
if (liquidData->type_flags & MAP_ALL_LIQUIDS)
|
||||
{
|
||||
if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER))
|
||||
{
|
||||
if (!HasAura(liquid->SpellId))
|
||||
CastSpell(this, liquid->SpellId, true);
|
||||
}
|
||||
if (status & LIQUID_MAP_UNDER_WATER)
|
||||
m_MirrorTimerFlags |= UNDERWATER_INWATER;
|
||||
else
|
||||
RemoveAurasDueToSpell(liquid->SpellId);
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INWATER;
|
||||
}
|
||||
|
||||
_lastLiquid = liquid;
|
||||
}
|
||||
else if (_lastLiquid && _lastLiquid->SpellId)
|
||||
{
|
||||
RemoveAurasDueToSpell(_lastLiquid->SpellId);
|
||||
_lastLiquid = nullptr;
|
||||
}
|
||||
|
||||
|
||||
// All liquids type - check under water position
|
||||
if (liquid_status.type_flags & (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME))
|
||||
{
|
||||
if (res & LIQUID_MAP_UNDER_WATER)
|
||||
m_MirrorTimerFlags |= UNDERWATER_INWATER;
|
||||
// Fatigue bar state (if not on flight path or transport)
|
||||
if ((liquidData->type_flags & MAP_LIQUID_TYPE_DARK_WATER) && !IsInFlight() && !GetTransport())
|
||||
m_MirrorTimerFlags |= UNDERWARER_INDARKWATER;
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INWATER;
|
||||
}
|
||||
m_MirrorTimerFlags &= ~UNDERWARER_INDARKWATER;
|
||||
|
||||
// Allow travel in dark water on taxi or transport
|
||||
if ((liquid_status.type_flags & MAP_LIQUID_TYPE_DARK_WATER) && !IsInFlight() && !GetTransport())
|
||||
m_MirrorTimerFlags |= UNDERWARER_INDARKWATER;
|
||||
// Lava state (any contact)
|
||||
if (liquidData->type_flags & MAP_LIQUID_TYPE_MAGMA)
|
||||
{
|
||||
if (status & MAP_LIQUID_STATUS_IN_CONTACT)
|
||||
m_MirrorTimerFlags |= UNDERWATER_INLAVA;
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INLAVA;
|
||||
}
|
||||
|
||||
// Slime state (any contact)
|
||||
if (liquidData->type_flags & MAP_LIQUID_TYPE_SLIME)
|
||||
{
|
||||
if (status & MAP_LIQUID_STATUS_IN_CONTACT)
|
||||
m_MirrorTimerFlags |= UNDERWATER_INSLIME;
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INSLIME;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWARER_INDARKWATER;
|
||||
m_MirrorTimerFlags &= ~(UNDERWATER_INWATER | UNDERWATER_INLAVA | UNDERWATER_INSLIME | UNDERWARER_INDARKWATER);
|
||||
|
||||
// in lava check, anywhere in lava level
|
||||
if (liquid_status.type_flags & MAP_LIQUID_TYPE_MAGMA)
|
||||
{
|
||||
if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER | LIQUID_MAP_WATER_WALK))
|
||||
m_MirrorTimerFlags |= UNDERWATER_INLAVA;
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INLAVA;
|
||||
}
|
||||
// in slime check, anywhere in slime level
|
||||
if (liquid_status.type_flags & MAP_LIQUID_TYPE_SLIME)
|
||||
{
|
||||
if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER | LIQUID_MAP_WATER_WALK))
|
||||
m_MirrorTimerFlags |= UNDERWATER_INSLIME;
|
||||
else
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_INSLIME;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetCanParry(bool value)
|
||||
|
||||
Reference in new issue
Block a user