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-----------------
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;
Unit* owner = GetCharmerOrOwner();
@@ -14601,15 +14601,13 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg)
return;
WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1);
data << uint8(0); // cast count?
data << uint8(0); // cast count
data << uint32(spellid);
data << uint8(msg);
// uint32 for some reason
// uint32 for some reason
data << uint8(result);
owner->ToPlayer()->GetSession()->SendPacket(&data);
}
void Unit::SendPetActionFeedback (uint8 msg)
void Unit::SendPetActionFeedback(uint8 msg)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -14620,7 +14618,7 @@ void Unit::SendPetActionFeedback (uint8 msg)
owner->ToPlayer()->GetSession()->SendPacket(&data);
}
void Unit::SendPetTalk (uint32 pettalk)
void Unit::SendPetTalk(uint32 pettalk)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
@@ -17045,8 +17043,6 @@ void Unit::_ExitVehicle(Position const* exitPosition)
else
pos = *exitPosition;
AddUnitState(UNIT_STATE_MOVE);
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SetFallInformation(0, GetPositionZ());
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
+1 -2
View File
@@ -499,9 +499,8 @@ enum UnitState
UNIT_STATE_CHASE_MOVE = 0x04000000,
UNIT_STATE_FOLLOW_MOVE = 0x08000000,
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)
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_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING),
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);
// only for flyable vehicles
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
if (unit->IsFlying())
_me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
if (GetBase()->GetTypeId() == TYPEID_UNIT)
@@ -29,16 +29,15 @@ void IdleMovementGenerator::Initialize(Unit &owner)
Reset(owner);
}
void
IdleMovementGenerator::Reset(Unit& owner)
void IdleMovementGenerator::Reset(Unit& owner)
{
if (owner.HasUnitState(UNIT_STATE_MOVE))
if (!owner.IsStopped())
owner.StopMoving();
}
void RotateMovementGenerator::Initialize(Unit& owner)
{
if (owner.HasUnitState(UNIT_STATE_MOVE))
if (!owner.IsStopped())
owner.StopMoving();
if (owner.getVictim())
@@ -80,20 +79,17 @@ void RotateMovementGenerator::Finalize(Unit &unit)
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
}
void
DistractMovementGenerator::Initialize(Unit& owner)
void DistractMovementGenerator::Initialize(Unit& owner)
{
owner.AddUnitState(UNIT_STATE_DISTRACTED);
}
void
DistractMovementGenerator::Finalize(Unit& owner)
void DistractMovementGenerator::Finalize(Unit& owner)
{
owner.ClearUnitState(UNIT_STATE_DISTRACTED);
}
bool
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
bool DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
{
if (time_diff > m_timer)
return false;
@@ -102,8 +98,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
return true;
}
void
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
void AssistanceDistractMovementGenerator::Finalize(Unit &unit)
{
unit.ClearUnitState(UNIT_STATE_DISTRACTED);
unit.ToCreature()->SetReactState(REACT_AGGRESSIVE);
@@ -44,11 +44,17 @@ namespace Movement
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{
MoveSplineFlag splineflags = move_spline.splineflags;
/*if (mov.IsBoarded())
/*if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << mov.GetTransport()->Owner.GetPackGUID();
data << int8(mov.m_unused.transport_seat);
if (unit->GetVehicle())
data << unit->GetVehicle()->GetBase()->GetPackGUID();
else if (unit->GetTransport())
data << unit->GetTransport()->GetPackGUID();
else
data << uint64(0);
data << int8(unit->GetTransSeat());
}*/
data << uint8(0);
@@ -57,21 +63,21 @@ namespace Movement
switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
{
default:
data << uint8(MonsterMoveNormal);
break;
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
data << uint8(MonsterMoveFacingAngle);
data << move_spline.facing.angle;
break;
case MoveSplineFlag::Final_Point:
data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
break;
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
data << uint8(MonsterMoveFacingAngle);
data << move_spline.facing.angle;
break;
case MoveSplineFlag::Final_Point:
data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
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)