jo3bingham
Excellent OT User
Prologue
I want to preface this post by making a few statements:
What do you mean an easier way to teleport? What could be easier than opening RME, finding the location, copying the coordinates, and using a talkaction in the client to teleport there?! Well, along with the 2017 Winter Update (11.50) CipSoft added a new client packet called
Packet Structure and Use
The opcode for this client packet is
Notes
I want to preface this post by making a few statements:
- I am, more-or-less, out of the OT development circuit. What I mean to say is, while I'm not actively working on a server, or actively engaging in the community, I still visit the forums and try to help those who seek out my advice. And now I've decided to give back to the community even more by way of providing game mechanics that no server uses, or, at least, hasn't been made public (to my knowledge). So expect more of these posts in the future.
- I still sit down after every "major" update that CipSoft has to work out new packets, and changes to any existing ones. This is how the OX team was/is able to keep our map up-to-date (among other things). Yes, that means that I have every packet structure worked out as of the latest version (which is currently 12.3x). Even though I'm no longer working on a server, I still like to do this for personal reasons (I find it fun). For those interested, our tracking software is not based on SharpMapTracker. I wrote a new API upon .NET Core which allows it to be much faster than SMT, and cross-platform. I won't go into more detail here, but I'm happy to answer any questions for those interested. HOWEVER, neither the API, nor the code, will be made available to anyone (not even for a price), so please don't ask.
What do you mean an easier way to teleport? What could be easier than opening RME, finding the location, copying the coordinates, and using a talkaction in the client to teleport there?! Well, along with the 2017 Winter Update (11.50) CipSoft added a new client packet called
Teleport
. Obviously, with a name like that, I was quite curious as to what this packet was for, and, more importantly, how to trigger it. To be fair, it took me quite some time to figure it out, and only because I had an "aha!" moment that led to it. I remembered that you could hold down the Shift key and then left-click with your mouse on the Cyclopedia map to walk to that position. So I started playing with key combinations until my API alerted me that it finally had an instance of the Teleport
packet. The combination? Ctrl+Shift+Left-Click. Oh, and this also works with the minimap as well.Packet Structure and Use
The opcode for this client packet is
0x73
, and the only data it contains is the coordinates of the position you clicked at:
C++:
void ProtocolGame::parsePacket(NetworkMessage& msg)
{
...
case 0x73: parseTeleport(msg); break;
...
}
void ProtocolGame::parseTeleport(NetworkMessage& msg)
{
auto pos = msg.getPosition();
addGameTask(&Game::playerTeleport, player->getID(), pos);
}
C++:
void Game::playerTeleport(uint32_t playerId, const Position& pos)
{
auto* player = getPlayerById(playerId);
if (!player || !player->isAccessPlayer()) {
return;
}
auto ret = g_game.internalTeleport(player, pos, false);
if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret);
}
}
Notes
- This only works on 11.50 clients and newer.
- This works with both the Cyclopedia map and the minimap. Obviously, using the Cyclopedia map will only work on your server if you're using an RL map AND your coordinates are 1:1. I'm sure it's possible to create your own Cyclopedia map based on your server and force the client to load it instead, but I've never done it.
- The code example above doesn't contain the function definitions for the corresponding header files. If you don't know how to do that yourself then you need to learn C++ before you go any further.
Last edited: