Skip to content

Commit

Permalink
Core/Spells: Fixed fishing broken in a recent commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Jun 8, 2013
1 parent cd24f85 commit f8d9a8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
21 changes: 20 additions & 1 deletion src/server/game/Spells/Spell.cpp
Expand Up @@ -1414,7 +1414,26 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
float x, y, z, angle;
angle = (float)rand_norm() * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle);
m_targets.SetDst(x, y, z, m_caster->GetOrientation());

float ground = z;
float liquidLevel = m_caster->GetMap()->GetWaterOrGroundLevel(x, y, z, &ground);
if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
{
SendCastResult(SPELL_FAILED_NOT_HERE);
SendChannelUpdate(0);
finish(false);
return;
}

if (ground + 0.75 > liquidLevel)
{
SendCastResult(SPELL_FAILED_TOO_SHALLOW);
SendChannelUpdate(0);
finish(false);
return;
}

m_targets.SetDst(x, y, liquidLevel, m_caster->GetOrientation());
return;
}
default:
Expand Down
18 changes: 1 addition & 17 deletions src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -5290,25 +5290,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
}

Map* cMap = m_caster->GetMap();
if (goinfo->type == GAMEOBJECT_TYPE_FISHINGNODE || goinfo->type == GAMEOBJECT_TYPE_FISHINGHOLE)
{
LiquidData liqData;
if (!cMap->IsInWater(fx, fy, fz + 1.f/* -0.5f */, &liqData)) // Hack to prevent fishing bobber from failing to land on fishing hole
{ // but this is not proper, we really need to ignore not materialized objects
SendCastResult(SPELL_FAILED_NOT_HERE);
SendChannelUpdate(0);
return;
}

// replace by water level in this case
//fz = cMap->GetWaterLevel(fx, fy);
fz = liqData.level;
}
// if gameobject is summoning object, it should be spawned right on caster's position
else if (goinfo->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL)
{
if (goinfo->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL)
m_caster->GetPosition(fx, fy, fz);
}

GameObject* pGameObj = new GameObject;

Expand Down

1 comment on commit f8d9a8d

@devastates
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gj 👍

Please sign in to comment.