mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7922] Implement param2 for ACTION_T_COMBAT_MOVEMENT for allow control start/stop melee combat state for creature at start/stop movement in combat.
Also small fix for avoid unexpected set pet speed to owner speed for non-player case. In player case this hack speed setting still required.
This commit is contained in:
parent
c678263bb0
commit
79dab3dae5
6 changed files with 30 additions and 14 deletions
|
|
@ -530,10 +530,12 @@ This is commonly used in combination with EVENT_T_RANGE and ACTION_T_COMBAT_MOVE
|
||||||
21 = ACTION_T_COMBAT_MOVEMENT:
|
21 = ACTION_T_COMBAT_MOVEMENT:
|
||||||
------------------------------
|
------------------------------
|
||||||
Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before.
|
Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before.
|
||||||
|
Parameter 2: If non-zero, then stop melee combat state (if param1=0) or start melee combat state (if param1!=0) and creature in combat with selected target.
|
||||||
|
|
||||||
This action controls whether or not the creature will always move towards its target.
|
This action controls whether or not the creature will always move towards its target.
|
||||||
NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values. (0 = Stop Movement, 1 = Start Movement)
|
NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values. (0 = Stop Movement, 1 = Start Movement)
|
||||||
This is commonly used with EVENT_T_RANGE and ACTION_T_AUTO_ATTACK for NPC's who engage in Ranged Comabt (Either Spells or Ranged Attacks)
|
This is commonly used with EVENT_T_RANGE and ACTION_T_AUTO_ATTACK for NPC's who engage in Ranged Comabt (Either Spells or Ranged Attacks)
|
||||||
|
Parameter 2 specialy used for ranged combat proper client side visual show ranged weapon in proper state.
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
22 = ACTION_T_SET_PHASE:
|
22 = ACTION_T_SET_PHASE:
|
||||||
|
|
|
||||||
|
|
@ -578,11 +578,19 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
MeleeEnabled = action.auto_attack.state != 0;
|
MeleeEnabled = action.auto_attack.state != 0;
|
||||||
break;
|
break;
|
||||||
case ACTION_T_COMBAT_MOVEMENT:
|
case ACTION_T_COMBAT_MOVEMENT:
|
||||||
|
// ignore no affect case
|
||||||
|
if(CombatMovementEnabled==(action.combat_movement.state!=0))
|
||||||
|
return;
|
||||||
|
|
||||||
CombatMovementEnabled = action.combat_movement.state != 0;
|
CombatMovementEnabled = action.combat_movement.state != 0;
|
||||||
|
|
||||||
//Allow movement (create new targeted movement gen only if idle)
|
//Allow movement (create new targeted movement gen only if idle)
|
||||||
if (CombatMovementEnabled)
|
if (CombatMovementEnabled)
|
||||||
{
|
{
|
||||||
|
if(action.combat_movement.melee && m_creature->isInCombat())
|
||||||
|
if(Unit* victim = m_creature->getVictim())
|
||||||
|
m_creature->SendMeleeAttackStart(victim);
|
||||||
|
|
||||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
|
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
m_creature->GetMotionMaster()->Clear(false);
|
m_creature->GetMotionMaster()->Clear(false);
|
||||||
|
|
@ -590,11 +598,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
|
|
||||||
{
|
{
|
||||||
m_creature->GetMotionMaster()->Clear(false);
|
if(action.combat_movement.melee && m_creature->isInCombat())
|
||||||
m_creature->GetMotionMaster()->MoveIdle();
|
if(Unit* victim = m_creature->getVictim())
|
||||||
m_creature->StopMoving();
|
m_creature->SendMeleeAttackStop(victim);
|
||||||
|
|
||||||
|
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
|
||||||
|
{
|
||||||
|
m_creature->GetMotionMaster()->Clear(false);
|
||||||
|
m_creature->GetMotionMaster()->MoveIdle();
|
||||||
|
m_creature->StopMoving();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_PHASE:
|
case ACTION_T_SET_PHASE:
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ struct CreatureEventAI_Action
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 state; // 0 = stop combat based movement, anything else continue attacking
|
uint32 state; // 0 = stop combat based movement, anything else continue attacking
|
||||||
|
uint32 melee; // if set: at stop send melee combat stop if in combat, use for terminate melee fighting state for switch to ranged
|
||||||
} combat_movement;
|
} combat_movement;
|
||||||
// ACTION_T_SET_PHASE = 22
|
// ACTION_T_SET_PHASE = 22
|
||||||
struct
|
struct
|
||||||
|
|
|
||||||
|
|
@ -2317,7 +2317,7 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
|
||||||
return (100.0f - LvlPenalty) * LvlFactor / 100.0f;
|
return (100.0f - LvlPenalty) * LvlFactor / 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SendAttackStart(Unit* pVictim)
|
void Unit::SendMeleeAttackStart(Unit* pVictim)
|
||||||
{
|
{
|
||||||
WorldPacket data( SMSG_ATTACKSTART, 8 + 8 );
|
WorldPacket data( SMSG_ATTACKSTART, 8 + 8 );
|
||||||
data << uint64(GetGUID());
|
data << uint64(GetGUID());
|
||||||
|
|
@ -2327,7 +2327,7 @@ void Unit::SendAttackStart(Unit* pVictim)
|
||||||
DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" );
|
DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SendAttackStop(Unit* victim)
|
void Unit::SendMeleeAttackStop(Unit* victim)
|
||||||
{
|
{
|
||||||
if(!victim)
|
if(!victim)
|
||||||
return;
|
return;
|
||||||
|
|
@ -7244,7 +7244,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) )
|
if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) )
|
||||||
{
|
{
|
||||||
addUnitState(UNIT_STAT_MELEE_ATTACKING);
|
addUnitState(UNIT_STAT_MELEE_ATTACKING);
|
||||||
SendAttackStart(victim);
|
SendMeleeAttackStart(victim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -7285,7 +7285,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
resetAttackTimer(OFF_ATTACK);
|
resetAttackTimer(OFF_ATTACK);
|
||||||
|
|
||||||
if(meleeAttack)
|
if(meleeAttack)
|
||||||
SendAttackStart(victim);
|
SendMeleeAttackStart(victim);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -7314,7 +7314,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/)
|
||||||
((Creature*)this)->SetNoSearchAssistance(false);
|
((Creature*)this)->SetNoSearchAssistance(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendAttackStop(victim);
|
SendMeleeAttackStop(victim);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -7505,7 +7505,7 @@ void Unit::SetPet(Pet* pet)
|
||||||
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
|
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
|
||||||
|
|
||||||
// FIXME: hack, speed must be set only at follow
|
// FIXME: hack, speed must be set only at follow
|
||||||
if(pet)
|
if(pet && GetTypeId()==TYPEID_PLAYER)
|
||||||
for(int i = 0; i < MAX_MOVE_TYPE; ++i)
|
for(int i = 0; i < MAX_MOVE_TYPE; ++i)
|
||||||
pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
|
pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -921,6 +921,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
void CombatStopWithPets(bool includingCast = false);
|
void CombatStopWithPets(bool includingCast = false);
|
||||||
Unit* SelectNearbyTarget() const;
|
Unit* SelectNearbyTarget() const;
|
||||||
bool hasNegativeAuraWithInterruptFlag(uint32 flag);
|
bool hasNegativeAuraWithInterruptFlag(uint32 flag);
|
||||||
|
void SendMeleeAttackStop(Unit* victim);
|
||||||
|
void SendMeleeAttackStart(Unit* pVictim);
|
||||||
|
|
||||||
void addUnitState(uint32 f) { m_state |= f; }
|
void addUnitState(uint32 f) { m_state |= f; }
|
||||||
bool hasUnitState(const uint32 f) const { return (m_state & f); }
|
bool hasUnitState(const uint32 f) const { return (m_state & f); }
|
||||||
|
|
@ -1548,9 +1550,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
uint32 m_regenTimer;
|
uint32 m_regenTimer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SendAttackStop(Unit* victim); // only from AttackStop(Unit*)
|
|
||||||
void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
|
|
||||||
|
|
||||||
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
|
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
|
||||||
bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
||||||
bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7921"
|
#define REVISION_NR "7922"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue