Skip to content

Commit

Permalink
Add support for Naxxramas slime debuff (#1479)
Browse files Browse the repository at this point in the history
* Rough attempt at adding support for Naxxramas slime debuff
This liquid system. I have no words.

* Simplify
  • Loading branch information
StadenElysium authored and Gemt committed Jul 14, 2017
1 parent 0243747 commit a91999f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game/Maps/GridMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,9 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
{
uint32 liquidFlagType = 0;
if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_type))
{
liquidFlagType = 1 << liq->Type;
}

data->level = liquid_level;
data->depth_level = ground_level;
Expand All @@ -1029,7 +1031,7 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
}
else if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
{
GridMapLiquidData map_data;
GridMapLiquidData map_data{};
GridMapLiquidStatus map_result = gmap->getLiquidStatus(x, y, z, ReqLiquidType, &map_data);
// Not override LIQUID_MAP_ABOVE_WATER with LIQUID_MAP_NO_WATER:
if (map_result != LIQUID_MAP_NO_WATER && (map_data.level > ground_level))
Expand Down
27 changes: 27 additions & 0 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18601,6 +18601,7 @@ void Player::UpdateUnderwaterState()
{
GridMapLiquidData liquid_status;
GridMapLiquidStatus res = GetMap()->GetTerrain()->getLiquidStatus(GetPositionX(), GetPositionY(), GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);

if (!res)
{
m_MirrorTimerFlags &= ~(UNDERWATER_INWATER | UNDERWATER_INLAVA | UNDERWATER_INSLIME | UNDERWATER_INDARKWATER);
Expand Down Expand Up @@ -18641,6 +18642,32 @@ void Player::UpdateUnderwaterState()
else
m_MirrorTimerFlags &= ~UNDERWATER_INSLIME;
}

// cast any spells associated with this liquid type (only used in Naxxramas)
if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(liquid_status.entry))
{
SpellEntry const *spellInfo = sSpellMgr.GetSpellEntry(liq->SpellId);

if (spellInfo)
{
SpellAuraHolder *holder = CreateSpellAuraHolder(spellInfo, this, nullptr);

for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
uint8 eff = spellInfo->Effect[i];
if (eff >= TOTAL_SPELL_EFFECTS)
continue;
if (IsAreaAuraEffect(eff) ||
eff == SPELL_EFFECT_APPLY_AURA ||
eff == SPELL_EFFECT_PERSISTENT_AREA_AURA)
{
Aura *aur = CreateAura(spellInfo, SpellEffectIndex(i), NULL, holder, this);
holder->AddAura(aur, SpellEffectIndex(i));
}
}
AddSpellAuraHolder(holder);
}
}
}

void Player::SetCanParry(bool value)
Expand Down

0 comments on commit a91999f

Please sign in to comment.