mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
Core/Movement
* Implemented a generic way of sending movement packets depending on who controls the unit (player or server controlled) * Added possibility to specify extra elements in movement packets (such as speed, extra passenger guid, collision height and similar) without having to add a special element only for these * Removed Unit::SendMovementFlagUpdate as it was something working only in 3.3.5a and earlier (no serverside HEARTBEAT opcode exists now)
This commit is contained in:
@@ -185,10 +185,11 @@ public:
|
||||
|
||||
std::string argstr = (char*)args;
|
||||
|
||||
Player* target = handler->GetSession()->GetPlayer();
|
||||
if (!*args)
|
||||
{
|
||||
argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
|
||||
if (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK))
|
||||
argstr = (target->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
|
||||
if (target->GetCommandStatus(CHEAT_WATERWALK))
|
||||
argstr = "off";
|
||||
else
|
||||
argstr = "on";
|
||||
@@ -196,15 +197,17 @@ public:
|
||||
|
||||
if (argstr == "off")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_WATERWALK);
|
||||
handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(false); // OFF
|
||||
target->SetCommandStatusOff(CHEAT_WATERWALK);
|
||||
target->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||
target->SendMovementWaterWalking(); // OFF
|
||||
handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
|
||||
return true;
|
||||
}
|
||||
else if (argstr == "on")
|
||||
{
|
||||
handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_WATERWALK);
|
||||
handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(true); // ON
|
||||
target->SetCommandStatusOn(CHEAT_WATERWALK);
|
||||
target->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||
target->SendMovementWaterWalking(); // ON
|
||||
handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1331,7 +1331,15 @@ public:
|
||||
target->SetExtraUnitMovementFlags(moveFlagsExtra);
|
||||
}
|
||||
|
||||
target->SendMovementFlagUpdate();
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
target->DestroyForNearbyPlayers(); // Force new SMSG_UPDATE_OBJECT:CreateObject
|
||||
else
|
||||
{
|
||||
WorldPacket data(SMSG_PLAYER_MOVE);
|
||||
target->WriteMovementInfo(data);
|
||||
target->SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,15 @@ public:
|
||||
|
||||
WorldPacket data;
|
||||
if (strncmp(args, "on", 3) == 0)
|
||||
target->SendMovementSetCanFly(true);
|
||||
{
|
||||
target->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
target->SendMovementCanFlyChange();
|
||||
}
|
||||
else if (strncmp(args, "off", 4) == 0)
|
||||
target->SendMovementSetCanFly(false);
|
||||
{
|
||||
target->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||
target->SendMovementCanFlyChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
|
||||
@@ -1001,10 +1001,7 @@ public:
|
||||
{
|
||||
case 1:
|
||||
if (Unit* car = Unit::GetCreature(*me, carGUID))
|
||||
{
|
||||
me->SetInFront(car);
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
me->SetFacingToObject(car);
|
||||
Talk(SAY_SCARLET_MINER_0);
|
||||
SetRun(true);
|
||||
IntroTimer = 4000;
|
||||
@@ -1013,8 +1010,7 @@ public:
|
||||
case 17:
|
||||
if (Unit* car = Unit::GetCreature(*me, carGUID))
|
||||
{
|
||||
me->SetInFront(car);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingToObject(car);
|
||||
car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1);
|
||||
car->StopMoving();
|
||||
car->RemoveAura(SPELL_CART_DRAG);
|
||||
|
||||
@@ -297,8 +297,7 @@ class npc_harrison_jones : public CreatureScript
|
||||
if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
|
||||
{
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
me->SetInFront(player);
|
||||
me->SendMovementFlagUpdate(true);
|
||||
me->SetFacingToObject(player);
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
Talk(SAY_HARRISON_0);
|
||||
_gongEvent = GONG_EVENT_1;
|
||||
|
||||
@@ -242,8 +242,7 @@ public:
|
||||
{
|
||||
case 4:
|
||||
SetEscortPaused(true);
|
||||
me->SetOrientation(1.775791f);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingTo(1.775791f);
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
Talk(SAY_MORRIDUNE_2);
|
||||
break;
|
||||
|
||||
@@ -479,17 +479,15 @@ public:
|
||||
switch (uiWaypoint)
|
||||
{
|
||||
case 0:
|
||||
me->SetOrientation(5.81f);
|
||||
me->SetFacingTo(5.81f);
|
||||
break;
|
||||
case 1:
|
||||
me->SetOrientation(4.60f);
|
||||
me->SetFacingTo(4.60f);
|
||||
break;
|
||||
case 2:
|
||||
me->SetOrientation(2.79f);
|
||||
me->SetFacingTo(2.79f);
|
||||
break;
|
||||
}
|
||||
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,10 +191,7 @@ public:
|
||||
return;
|
||||
|
||||
if (uiPointId == 1)
|
||||
{
|
||||
me->SetOrientation(ORIENTATION);
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
me->SetFacingTo(ORIENTATION);
|
||||
}
|
||||
|
||||
void DoSummonGrandChampion(uint32 uiBoss)
|
||||
|
||||
@@ -300,8 +300,7 @@ class boss_devourer_of_souls : public CreatureScript
|
||||
DoCast(me, SPELL_WAILING_SOULS_STARTING);
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
{
|
||||
me->SetOrientation(me->GetAngle(target));
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingTo(me->GetAngle(target));
|
||||
DoCast(me, SPELL_WAILING_SOULS_BEAM);
|
||||
}
|
||||
|
||||
@@ -327,8 +326,7 @@ class boss_devourer_of_souls : public CreatureScript
|
||||
|
||||
case EVENT_WAILING_SOULS_TICK:
|
||||
beamAngle += beamAngleDiff;
|
||||
me->SetOrientation(beamAngle);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingTo(beamAngle);
|
||||
me->StopMoving();
|
||||
|
||||
DoCast(me, SPELL_WAILING_SOULS);
|
||||
|
||||
@@ -205,7 +205,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
|
||||
minchar->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
|
||||
minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
|
||||
minchar->SetCanFly(false);
|
||||
minchar->SendMovementFlagUpdate();
|
||||
minchar->RemoveAllAuras();
|
||||
minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f);
|
||||
}
|
||||
@@ -238,7 +237,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
|
||||
me->SetDisableGravity(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
|
||||
me->SetCanFly(true);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos);
|
||||
}
|
||||
}
|
||||
@@ -318,7 +316,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
|
||||
me->SetDisableGravity(false);
|
||||
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
|
||||
me->SetCanFly(false);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
if (Unit* victim = me->SelectVictim())
|
||||
AttackStart(victim);
|
||||
@@ -445,7 +442,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
|
||||
me->SetDisableGravity(true);
|
||||
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
|
||||
me->SetCanFly(true);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->GetMotionMaster()->MovePoint(POINT_AIR, airPos);
|
||||
break;
|
||||
case EVENT_AIR_FLY_DOWN:
|
||||
|
||||
@@ -294,7 +294,6 @@ class boss_sapphiron : public CreatureScript
|
||||
case EVENT_LIFTOFF:
|
||||
Talk(EMOTE_AIR_PHASE);
|
||||
me->SetDisableGravity(true);
|
||||
me->SendMovementFlagUpdate();
|
||||
events.ScheduleEvent(EVENT_ICEBOLT, 1500);
|
||||
_iceboltCount = RAID_MODE(2, 3);
|
||||
return;
|
||||
@@ -339,7 +338,6 @@ class boss_sapphiron : public CreatureScript
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
|
||||
Talk(EMOTE_GROUND_PHASE);
|
||||
me->SetDisableGravity(false);
|
||||
me->SendMovementFlagUpdate();
|
||||
events.ScheduleEvent(EVENT_GROUND, 1500);
|
||||
return;
|
||||
case EVENT_GROUND:
|
||||
|
||||
@@ -325,8 +325,7 @@ public:
|
||||
break;
|
||||
case 7:
|
||||
Talk(SAY_SVALA_INTRO_2);
|
||||
me->SetOrientation(1.58f);
|
||||
me->SendMovementFlagUpdate();
|
||||
me->SetFacingTo(1.58f);
|
||||
arthas->SetVisible(false);
|
||||
++introPhase;
|
||||
introTimer = 13800;
|
||||
|
||||
@@ -2358,10 +2358,7 @@ public:
|
||||
me->StopMoving();
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
{
|
||||
me->SetInFront(player);
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
me->SetFacingToObject(player);
|
||||
uiEventTimer = 3000;
|
||||
uiEventPhase = 1;
|
||||
}
|
||||
@@ -2411,10 +2408,7 @@ public:
|
||||
case NPC_SALTY_JOHN_THORPE:
|
||||
Talk(SAY_HIDDEN_CULTIST_4);
|
||||
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
|
||||
{
|
||||
me->SetInFront(player);
|
||||
me->SendMovementFlagUpdate();
|
||||
}
|
||||
me->SetFacingToObject(player);
|
||||
uiEventTimer = 3000;
|
||||
uiEventPhase = 3;
|
||||
break;
|
||||
|
||||
@@ -1372,8 +1372,7 @@ public:
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
creature->CastSpell(player, SPELL_QUEST_CREDIT, true);
|
||||
CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (creature->AI()))->m_uiPhase = 1;
|
||||
creature->SetInFront(player);
|
||||
creature->SendMovementFlagUpdate();
|
||||
creature->SetFacingToObject(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2293,8 +2293,7 @@ class spell_item_unusual_compass : public SpellScriptLoader
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->SetOrientation(frand(0.0f, 62832.0f) / 10000.0f);
|
||||
caster->SendMovementFlagUpdate(true);
|
||||
caster->SetFacingTo(frand(0.0f, 62832.0f) / 10000.0f);
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
Reference in New Issue
Block a user