Jump to content

[Patch] Support for npc on transport


Auntie Mangos

Recommended Posts

I have rewritten the patch.

- Now npc transport coordinates stored in creature table

- Transport functions in player class moved to unit class

- Many code improvements

Revision 10246:

Patch: http://pastebin.com/a4vnHNqG

SQL: http://pastebin.com/HQm412de

Not Working =(

Mi WoW crash

This application has encountered a critical error:

ERROR #132 (0x85100084) Fatal Exception

Program: C:\\Users\\Public\\Games\\World of Warcraft\\WoW.exe

Exception: 0xC00000FD (STACK_OVERFLOW) at 0023:0040BB77

I'm using Mangos 10246

Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

thx so much kid 10, this version of this patch looks much better now.

the Problem I have is that the big ships in icecrown (skybreaker and orgrims hammer) do not seem to be normal transports, the patch doesn't work with them anyway. The NPC stands in the air but doesn't move with the ship. Can anyone give me information about this? :( would be very nice

Link to comment
Share on other sites

Mi WoW crash

What exactly did you do?

the Problem I have is that the big ships in icecrown (skybreaker and orgrims hammer) do not seem to be normal transports, the patch doesn't work with them anyway. The NPC stands in the air but doesn't move with the ship. Can anyone give me information about this? :( would be very nice

I don't know why it shouldn't work with skybreaker and orgrims hammer, I can't test this now, because my wotlk client is broken.

---

At the moment, npcs position updated in transports update() function, I don't know wheter it is right.

I think in this case, movement and npc gossip wouldn't work, because position is constantly updated, and gossip menu will close on position change.

It is also possible to update the global npc position not (only at transport teleport), then it is like player on transports works, and npc movement on transport would be possible I think.

But npc gossip would still not work, because we get the message that the creature is too far away to interact with him.

I must create a function, which calculate the distance between two objects on transport (with object transport position).

And then - I think, npc gossip will be possible on transports too.

Maybe someone can help to find the best way.

Link to comment
Share on other sites

maybe I was wrong and the problem wasn't these two ships..

I tried to add an NPC to another transport ship, but I could not see him ingame.

Perhaps I used wrong values vor transport x,y,z..

I'll be trying to get ingame results.

With your other problem I can not help you for I am not that into mangos yet.

Link to comment
Share on other sites

- Lost code added >.< ._.

- Possible crash fixed

Revision 10246:

Patch: http://pastebin.com/MT64VDN5

SQL: http://pastebin.com/HQm412de

Lost code diff:

--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -270,6 +270,12 @@ void Object::BuildMovementUpdate(ByteBuf
                /*if (((Creature*)unit)->hasUnitState(UNIT_STAT_MOVING))
                    unit->m_movementInfo.SetMovementFlags(MOVEFLAG_FORWARD);*/

+                if (unit->GetTransport())
+                {
+                    unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
+                    unit->m_movementInfo.SetTransportData(unit->GetTransport()->GetGUID(), unit->GetTransOffsetX(), unit->GetTransOffsetY(), unit->GetTransOffsetZ(), unit->GetTransOffsetO(), 0, 0);
+                }
+
                if (((Creature*)unit)->canFly())
                {
                    // (ok) most seem to have this

Possible crash fixed diff:

--- a/src/game/Transports.cpp
+++ b/src/game/Transports.cpp
@@ -469,7 +469,7 @@ void Transport::TeleportTransport(uint32

        (*itr)->RemoveFromWorld();
        (*itr)->SetMap(newMap);
-        newMap->CreatureRelocation(*itr, GetPositionX() + x, GetPositionY() + y, GetPositionZ() + z, (*itr)->GetOrientation());
+        //newMap->CreatureRelocation(*itr, GetPositionX() + x, GetPositionY() + y, GetPositionZ() + z, (*itr)->GetOrientation());
        newMap->Add(*itr);
    }
    SetMap(newMap);

Link to comment
Share on other sites

Thanks for this piece of code, but the problem I have right now (also had it before your latest code fix) ist that players do not move with the ship any more. I guess this is because AddPlayerPessenger is not called when going on a ship.

Please correct me if I am wrong, but I looked through the code and noticed this:

if (player->GetTransport()) then MOVEFLAG_ONTRANSPORT is added to the player

but apart from loading from db at serverstart,

SetTransport() is only called in the block that begins with if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT)). (Both in Movementhandler.cpp).

Do I miss something here?

Cause this looks like the flag depends from having an transport and the other way around it's the same thing.

I feel like I do not understand this right.. how is the server supposed to know that you walked on a transport?

Link to comment
Share on other sites

We get the information from client, see HandleMovementOpcodes() function in MovementHandler.cpp.

There we get movementInfo:

MovementInfo movementInfo;

recv_data >> guid.ReadAsPacked();
recv_data >> movementInfo;

Then we can check:

if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))

And later:

// if we boarded a transport, add us to it
if (plMover && !plMover->GetTransport())
{
   // elevators also cause the client to send MOVEFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
   for (MapManager::TransportSet::const_iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
   {
       if ((*iter)->GetObjectGuid() == movementInfo.GetTransportGuid())
       {
           plMover->SetTransport(*iter);
           (*iter)->AddPlayerPassenger(plMover);
           break;
       }
   }
}

And still later:

plMover->m_movementInfo = movementInfo;

Link to comment
Share on other sites

thx so much kid 10, this version of this patch looks much better now.

the Problem I have is that the big ships in icecrown (skybreaker and orgrims hammer) do not seem to be normal transports, the patch doesn't work with them anyway. The NPC stands in the air but doesn't move with the ship. Can anyone give me information about this? :( would be very nice

Add this:

// transport size limited
-            m_movementInfo.t_x > 50 || m_movementInfo.t_y > 50 || m_movementInfo.t_z > 50)
+            m_movementInfo.t_x > 250 || m_movementInfo.t_y > 250 || m_movementInfo.t_z > 250)

Link to comment
Share on other sites

  • 2 weeks later...

I'd rather kid 10 keep working on his patch so it is done the right way, rather than trying to replace everything with a Trinity patch that needs porting.

Move the Trinity port over to Core Mods for development and testing, then submit it later instead of trying to wedge it in over kid 10's work.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
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