Jump to content

[Patch] [8076] Walking again...


Auntie Mangos

Recommended Posts

I don't know if it was your patch yad02, but with:

data << uint32(GetTypeId() == TYPEID_PLAYER ? MONSTER_MOVE_WALK : MovementFlags);

works. Maybe it's not related though, don't know.

Yes, it works, but to repeat what Jolan said earlier, this fixes the symptom of the bug, not the cause. And this causes more problems because more than one bug is present here. It is almost always better to fix bugs by removing or editing code than by slapping on more code.

The cause of the problem is the player.StopMoving() in FlightPathMovementGenerator::Finalize . It calls SendMonsterMove, which sets the client's MovementFlags to 0.

Other effects which cause automatic movement or changes in movement (such as Aura::HandleAuraModStun, Aura::HandleAuraModRoot, Spell::EffectDistract, Spell::EffectCharge) have a specific check to prevent StopMoving from being called on players.

In fact, Spell::EffectCharge says after that check:

// Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
m_caster->SendMonsterMove(x, y, z, 0, MONSTER_MOVE_WALK, 1);

but this causes the opposite effect: if you start charging with walking on, when the charge finishes, the client will have run toggled on.

I did not see any adverse effects from the client after removing the StopMoving(). CMSG_MOVE_SPLINE_DONE was still sent to the server after the flight finished, so the client still knows when a flight is over.

Additionally,

player.SetUnitMovementFlags(MONSTER_MOVE_WALK);

is causing channeling spells to be broken because the server then always thinks the player is continually moving. Perhaps a player.RemoveUnitMovementFlag was meant to be used instead? (Even then, I'm not sure this line serves a purpose, since I can't see where the player's UnitMovementFlags is being changed).

diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 71dd525..35e4dce 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -260,9 +260,6 @@ void FlightPathMovementGenerator::Finalize(Player & player)
        player.getHostilRefManager().setOnlineOfflineState(true);
        if(player.pvpInfo.inHostileArea)
            player.CastSpell(&player, 2479, true);
-
-        player.SetUnitMovementFlags(MONSTER_MOVE_WALK);
-        player.StopMoving();
    }
} 

Edit: Still haven't seen any adverse effects from not changing UnitMovementFlags; edited diff.

Link to comment
Share on other sites

  • 38 years later...

This will prevent any forced walk after anything possibly in gameplay, however I'm not completly sure, if any movement flag aside from MOVEMENTFLAG_WALK_MODE is valid for players, currently none is used for them. ( if this is going to be true, source code must completly garrant to grant players correct flags )

For server admins, this patch should do the job, but further development MAY need to do it long way instead... ( thus I am not sure if this is right section, but well.. )

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 49b88eb..80a74af 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -364,7 +364,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
    }

    //Movement Flags (0x0 = walk, 0x100 = run, 0x200 = fly/swim)
-    data << uint32(MovementFlags);
+    data << uint32(GetTypeId() == TYPEID_PLAYER ? MOVEMENTFLAG_WALK_MODE : MovementFlags);

    data << Time;                                           // Time in between points
    data << uint32(1);                                      // 1 single waypoint

EDIT: more info from Ntsc

It may simply be that Creature ignore MOVEMENTFLAG_WALK_MODE and move based on speed. It may be that client only uses the walk mode to decide what speed the player moves at AFTER it re-gains control of player (allowing us to simply send the flag that the client originally sent us). But so far no one has had time to really test it.
Link to comment
Share on other sites

data << uint32(GetTypeId() == TYPEID_PLAYER ? MOVEMENTFLAG_WALK_MODE : MovementFlags);

wait, doesn't this do exactly the oppisite? i mean, doesn't this send walk flag always for players instead of never?

(i might be mistaken because i never understood well that structure with the '?' but if i understood it correctly, when the condition is true then the first parameter after the ? is used...)

Link to comment
Share on other sites

Well as I said in that quote there we probably have the WALK_MODE flag labled wrong. It is probably RUN_MODE.

And as I also said I think that Creatures are not effected by it at all. Only players. Creatures movement animation and speed are based on the time given to them in the movement packet. Distance/Time = Speed.

Link to comment
Share on other sites

Nice quick fix/patch.

I'm still wondering, why this bug happens, as for me, I got 2 Characters on my Test Server (Win XP 32bit),

and did some test flying with 4 Flight Nodes: Orgrimmar, Ratchet,Crossroads, Thunderbluff.

- the first character gets the walking bug on most flights, but ocassionally not, and always when dying.

- the second one walks only after flying between Ratchet <=> Orgrimmar, but every time, and doesn't walk after dying

Difference, with the second one, I used the taxicheat while testing and dying for the first test round.

Their characters taximask should be the same, but actually isnt, but maybe I messed up something there.

The whole behavior also is same as described, even after several relogs, or server restarts, which leads me to the guess, that there could be a bug somewhere when reading or writing things to the database.

Just my 2 cents :-)

Link to comment
Share on other sites

  • 1 month later...

I think thenecromancer's patch fix the symptom , not the cause, furthermore SendMonsterMove() is frequently called, adding logic to it will add load to mangos and may produce unexpected effects.

This patch is more correct IMHO :

Patch for 0.12 branch

From ffc224b254e1c43d84ebad9f1a8467fb5e21094e Mon Sep 17 00:00:00 2001
From: JoLan <[email protected]>
Date: Fri, 16 Jan 2009 09:12:07 +0100
Subject: [PATCH] Fix player walking at the end of some flying transports

---
src/game/WaypointMovementGenerator.cpp |    3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 6406148..7e88469 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -258,8 +258,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
        player.getHostilRefManager().setOnlineOfflineState(true);
        if(player.pvpInfo.inHostileArea)
            player.CastSpell(&player, 2479, true);
-
-        player.SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
+        
        player.StopMoving();
    }
}
-- 
1.6.0.2

Link to comment
Share on other sites

Vladimir : did you test it on a master branch ?
I test at master branch (3.0.3)
ts on a 0.12 brach, walk mode is walk mode, ntsc says it's run mode so perhaps this flag changed between 2.4.3 and 3.x ...

I test another seetings instead drop line in Finalize, but always have same effect: normal walking (not run) after flight. '/' enable run after this correctly.

Link to comment
Share on other sites

bump.

the same problem when you have creature with waypoints ( set to run all the time). For example fight with him, and run away ..creature will come back to first point and change his run mode to walk mode (the only way to keep him running is just kill him -will resp with run mode ;) ).

Hope that someone will fix that :

Sephiroth1983

annoying problem :/

.
Link to comment
Share on other sites

  • 4 months later...
  • 2 weeks later...

Always in 3.1.3 (see one time since mangos switch)

Does :

data << uint32(GetTypeId() == TYPEID_PLAYER ? MOVEMENTFLAG_WALK_MODE : MovementFlags); 

really work ?

In 3.1.3, it should be :

data << uint32(GetTypeId() == TYPEID_PLAYER ? MONSTER_MOVE_WALK : MovementFlags); 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use