Core/Misc: Random cleanup

This commit is contained in:
kaelima
2012-03-16 08:57:42 +01:00
parent acb3fde355
commit dce0a7d184
5 changed files with 39 additions and 43 deletions
+6 -10
View File
@@ -14591,9 +14591,9 @@ Player* Unit::GetSpellModOwner() const
} }
///----------Pet responses methods----------------- ///----------Pet responses methods-----------------
void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) void Unit::SendPetCastFail(uint32 spellid, SpellCastResult result)
{ {
if (msg == SPELL_CAST_OK) if (result == SPELL_CAST_OK)
return; return;
Unit* owner = GetCharmerOrOwner(); Unit* owner = GetCharmerOrOwner();
@@ -14601,15 +14601,13 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg)
return; return;
WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1); WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1);
data << uint8(0); // cast count? data << uint8(0); // cast count
data << uint32(spellid); data << uint32(spellid);
data << uint8(msg); data << uint8(result);
// uint32 for some reason
// uint32 for some reason
owner->ToPlayer()->GetSession()->SendPacket(&data); owner->ToPlayer()->GetSession()->SendPacket(&data);
} }
void Unit::SendPetActionFeedback (uint8 msg) void Unit::SendPetActionFeedback(uint8 msg)
{ {
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER) if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -14620,7 +14618,7 @@ void Unit::SendPetActionFeedback (uint8 msg)
owner->ToPlayer()->GetSession()->SendPacket(&data); owner->ToPlayer()->GetSession()->SendPacket(&data);
} }
void Unit::SendPetTalk (uint32 pettalk) void Unit::SendPetTalk(uint32 pettalk)
{ {
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER) if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -17045,8 +17043,6 @@ void Unit::_ExitVehicle(Position const* exitPosition)
else else
pos = *exitPosition; pos = *exitPosition;
AddUnitState(UNIT_STATE_MOVE);
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SetFallInformation(0, GetPositionZ()); ToPlayer()->SetFallInformation(0, GetPositionZ());
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
+1 -2
View File
@@ -499,9 +499,8 @@ enum UnitState
UNIT_STATE_CHASE_MOVE = 0x04000000, UNIT_STATE_CHASE_MOVE = 0x04000000,
UNIT_STATE_FOLLOW_MOVE = 0x08000000, UNIT_STATE_FOLLOW_MOVE = 0x08000000,
UNIT_STATE_UNATTACKABLE = (UNIT_STATE_IN_FLIGHT | UNIT_STATE_ONVEHICLE), UNIT_STATE_UNATTACKABLE = (UNIT_STATE_IN_FLIGHT | UNIT_STATE_ONVEHICLE),
//UNIT_STATE_MOVING = (UNIT_STATE_ROAMING | UNIT_STATE_CHASE),
// for real move using movegen check and stop (except unstoppable flight) // for real move using movegen check and stop (except unstoppable flight)
UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE| UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE , UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE ,
UNIT_STATE_CONTROLLED = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING), UNIT_STATE_CONTROLLED = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING),
UNIT_STATE_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING), UNIT_STATE_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING),
UNIT_STATE_SIGHTLESS = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE), UNIT_STATE_SIGHTLESS = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE),
+1 -1
View File
@@ -424,7 +424,7 @@ void Vehicle::RemovePassenger(Unit* unit)
_me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false); _me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
// only for flyable vehicles // only for flyable vehicles
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_FLYING)) if (unit->IsFlying())
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true); _me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (GetBase()->GetTypeId() == TYPEID_UNIT) if (GetBase()->GetTypeId() == TYPEID_UNIT)
@@ -29,16 +29,15 @@ void IdleMovementGenerator::Initialize(Unit &owner)
Reset(owner); Reset(owner);
} }
void void IdleMovementGenerator::Reset(Unit& owner)
IdleMovementGenerator::Reset(Unit& owner)
{ {
if (owner.HasUnitState(UNIT_STATE_MOVE)) if (!owner.IsStopped())
owner.StopMoving(); owner.StopMoving();
} }
void RotateMovementGenerator::Initialize(Unit& owner) void RotateMovementGenerator::Initialize(Unit& owner)
{ {
if (owner.HasUnitState(UNIT_STATE_MOVE)) if (!owner.IsStopped())
owner.StopMoving(); owner.StopMoving();
if (owner.getVictim()) if (owner.getVictim())
@@ -80,20 +79,17 @@ void RotateMovementGenerator::Finalize(Unit &unit)
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0); unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
} }
void void DistractMovementGenerator::Initialize(Unit& owner)
DistractMovementGenerator::Initialize(Unit& owner)
{ {
owner.AddUnitState(UNIT_STATE_DISTRACTED); owner.AddUnitState(UNIT_STATE_DISTRACTED);
} }
void void DistractMovementGenerator::Finalize(Unit& owner)
DistractMovementGenerator::Finalize(Unit& owner)
{ {
owner.ClearUnitState(UNIT_STATE_DISTRACTED); owner.ClearUnitState(UNIT_STATE_DISTRACTED);
} }
bool bool DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
{ {
if (time_diff > m_timer) if (time_diff > m_timer)
return false; return false;
@@ -102,8 +98,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
return true; return true;
} }
void void AssistanceDistractMovementGenerator::Finalize(Unit &unit)
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
{ {
unit.ClearUnitState(UNIT_STATE_DISTRACTED); unit.ClearUnitState(UNIT_STATE_DISTRACTED);
unit.ToCreature()->SetReactState(REACT_AGGRESSIVE); unit.ToCreature()->SetReactState(REACT_AGGRESSIVE);
@@ -44,11 +44,17 @@ namespace Movement
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data) void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{ {
MoveSplineFlag splineflags = move_spline.splineflags; MoveSplineFlag splineflags = move_spline.splineflags;
/*if (mov.IsBoarded()) /*if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{ {
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << mov.GetTransport()->Owner.GetPackGUID(); if (unit->GetVehicle())
data << int8(mov.m_unused.transport_seat); data << unit->GetVehicle()->GetBase()->GetPackGUID();
else if (unit->GetTransport())
data << unit->GetTransport()->GetPackGUID();
else
data << uint64(0);
data << int8(unit->GetTransSeat());
}*/ }*/
data << uint8(0); data << uint8(0);
@@ -57,9 +63,6 @@ namespace Movement
switch(splineflags & MoveSplineFlag::Mask_Final_Facing) switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
{ {
default:
data << uint8(MonsterMoveNormal);
break;
case MoveSplineFlag::Final_Target: case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget); data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target; data << move_spline.facing.target;
@@ -72,6 +75,9 @@ namespace Movement
data << uint8(MonsterMoveFacingSpot); data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z; data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
break; break;
default:
data << uint8(MonsterMoveNormal);
break;
} }
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done) // add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)