Permalink
Browse files

Prevent spell casting while strafing/jumping (in addition to moving )…

… if spell is not supposed to be casted while performing these actions. As well bool jumping is no longer undefined.
  • Loading branch information...
neo-mat committed Mar 10, 2012
1 parent bd27eab commit 12100d1a39318aeedf8030275b71695ab0108a31
Showing with 8 additions and 6 deletions.
  1. +4 −4 src/arcemu-world/MovementHandler.cpp
  2. +1 −1 src/arcemu-world/Player.h
  3. +3 −1 src/arcemu-world/Spell.cpp
@@ -361,18 +361,18 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
case MSG_MOVE_START_STRAFE_RIGHT:
_player->strafing = true;
break;
/*case MSG_MOVE_JUMP:
case MSG_MOVE_JUMP:
_player->jumping = true;
break;*/
break;
case MSG_MOVE_STOP:
_player->moving = false;
break;
case MSG_MOVE_STOP_STRAFE:
_player->strafing = false;
break;
/*case MSG_MOVE_FALL_LAND:
case MSG_MOVE_FALL_LAND:
_player->jumping = false;
break;*/
break;
default:
moved = false;
@@ -1474,7 +1474,7 @@ class SERVER_DECL Player : public Unit
void SetSpeeds( uint8 type, float speed );
float GetPlayerSpeed() {return m_runSpeed;}
uint8 m_currentMovement;
bool m_isMoving;
bool m_isMoving; // moving + strafing + jumping
bool moving;
bool strafing;
bool isTurning;
@@ -3086,9 +3086,11 @@ uint8 Spell::CanCast(bool tolerate)
{
uint32 i;
if( ( p_caster != NULL ) && p_caster->moving && ( m_spellInfo->InterruptFlags & CAST_INTERRUPT_ON_MOVEMENT ) )
// Check if spell can be casted while player is moving.
if( ( p_caster != NULL ) && p_caster->m_isMoving && ( m_spellInfo->InterruptFlags & CAST_INTERRUPT_ON_MOVEMENT ) )
return SPELL_FAILED_MOVING;
// Check if spell requires caster to be in combat to be casted.
if(p_caster != NULL && HasCustomFlag(CUSTOM_FLAG_SPELL_REQUIRES_COMBAT) && !p_caster->CombatStatus.IsInCombat())
return SPELL_FAILED_SPELL_UNAVAILABLE;

3 comments on commit 12100d1

@dfighter1985

This comment has been minimized.

Show comment
Hide comment
@dfighter1985

dfighter1985 May 5, 2012

Member

@wester200 No one has deleted your comment, you are just looking at the wrong fork....
Try here: https://github.com/sanctum32/arcemu/commit/12100d1a39318aeedf8030275b71695ab0108a31#commitcomment-1295179

Member

dfighter1985 replied May 5, 2012

@wester200 No one has deleted your comment, you are just looking at the wrong fork....
Try here: https://github.com/sanctum32/arcemu/commit/12100d1a39318aeedf8030275b71695ab0108a31#commitcomment-1295179

@neo-mat

This comment has been minimized.

Show comment
Hide comment
@neo-mat

neo-mat May 6, 2012

Member

@wester200, thanks for heads up, but this issue seems to be really odd, if we go back to using bool moving instead of bool m_isMoving players will be able to cast spells that they are not supposed to while strafing or jumping. We are doing check by InterruptFlags that are set in DBC and by logic code is fine, data in DBC doesn't seem to be.

Note to myself: 3be2ca0#-P0

Member

neo-mat replied May 6, 2012

@wester200, thanks for heads up, but this issue seems to be really odd, if we go back to using bool moving instead of bool m_isMoving players will be able to cast spells that they are not supposed to while strafing or jumping. We are doing check by InterruptFlags that are set in DBC and by logic code is fine, data in DBC doesn't seem to be.

Note to myself: 3be2ca0#-P0

@neo-mat

This comment has been minimized.

Show comment
Hide comment
@neo-mat

neo-mat May 6, 2012

Member

Hm, Ice Lance has Interrupt Flags: 0x0000000F, same as Arcane Explosion for example (that is allowed to be casted while moving/jumping) Maybe adding a check for cast time will be right thing to fix this issue?

Member

neo-mat replied May 6, 2012

Hm, Ice Lance has Interrupt Flags: 0x0000000F, same as Arcane Explosion for example (that is allowed to be casted while moving/jumping) Maybe adding a check for cast time will be right thing to fix this issue?

Please sign in to comment.