• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Solved] Sending more tiles to client

Status
Not open for further replies.
It's being picky I guess?
Try this: (Copy both lines)

int32_t x = (pos.x - 10), y = (pos.y - 9), z = (pos.z), width = 22, height = 20, offset = 0, skip = -1
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
 
I've tried this

PHP:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
   msg->AddByte(0x64);
   msg->AddPosition(player->getPosition());
   int32_t x = (pos.x - 10), y = (pos.y - 9), z = (pos.z), width = 22, height = 20, offset = 0, skip = -1;
  GetFloorDescription(msg, x, y, z, width, height, offset, skip);
}
and here's the output

25h1kx2.png


You are right, it is very picky :)
 
Ok! Maybe there is a limit to how much it can send... BUT we can always try this:

PHP:
int32_t x = (pos.x - 10), y = (pos.y - 9), z = (pos.z), width = 40, height = 30, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);

And if that doesn't change ANYTHING at all, I would try this. (yes copy all 4 lines)
PHP:
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t x = (pos.x - 10), y = (pos.y - 10), z = (pos.z), width = 11, height = 11, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
 
Tried the first part and it just moved me to the top left of the map.

I also tried second part, but it returned this error:

PHP:
>..\protocolgame.cpp(3359): error C2374: 'x' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'x'
1>..\protocolgame.cpp(3359): error C2374: 'y' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'y'
1>..\protocolgame.cpp(3359): error C2374: 'z' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'z'
1>..\protocolgame.cpp(3359): error C2374: 'width' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'width'
1>..\protocolgame.cpp(3359): error C2374: 'height' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'height'
1>..\protocolgame.cpp(3359): error C2374: 'offset' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'offset'
1>..\protocolgame.cpp(3359): error C2374: 'skip' : redefinition; multiple initialization
1>  ..\protocolgame.cpp(3355) : see declaration of 'skip'

Error lines (3350 to 3359)

PHP:
---////////////// Add common messages
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
   msg->AddByte(0x64);
   msg->AddPosition(player->getPosition());
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t x = (pos.x - 10), y = (pos.y - 10), z = (pos.z), width = 11, height = 11, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
}

I agree, there does seem to be a limit :eek:
 
PHP:
---////////////// Add common messages
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{msg->AddByte(0x64);msg->AddPosition(player->getPosition());
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t xa = (pos.x - 10), ya = (pos.y - 10), za = (pos.z), widtha = 11, heighta = 11, offseta = 0, skipa = -1;
GetFloorDescription(msg, xa, ya, za, widtha, heighta, offseta, skipa);
}

Just means we need to set seperate Variables for the second entry (like above)
Try that!
 
I've tried the above, here's the result!

mcg37n.png


I've been removed from existence completely!
 
Maybe we need to change something else too.
Change map.h where it has this:
PHP:
    static const int32_t maxViewportX = 18; //min value: maxClientViewportX + 1
     static const int32_t maxViewportY = 18; //min value: maxClientViewportY + 1
     static const int32_t maxClientViewportX = 15;
     static const int32_t maxClientViewportY = 11;

Then set this back:
PHP:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
   msg->put<char>(0x64);
   msg->putPosition(player->getPosition());
   GetMapDescription(pos.x - 15, pos.y - 11, pos.z, 32, 24, msg);
}
 
I've changed the above and I get the standard 18 x 14, however when I move I can only move 1 square then my character is frozen. Another thing to note is my skills panel

6gj0x4.png


Weird!
 
I am pretty sure TFS is SENDING the correct information. Do you think it is possible that OTclient just isn't able to receive it all?

If you try this, it should make a design, testing the limits of OTClient. (If it works)
It's also possible that the msg->put<char>(0x##) helps determine what the client receives. but I can't be sure without learning more about TFS. (Which I'm doing every day)

PHP:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
   msg->put<char>(0x64);
   msg->putPosition(player->getPosition());
   GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);
   msg->put<char>(0x65);
   GetMapDescription(oldPos.x - 8, newPos.y - 6, newPos.z, 18, 1, msg);
   msg->put<char>(0x67);
   GetMapDescription(oldPos.x - 8, newPos.y + 7, newPos.z, 18, 1, msg);
   msg->put<char>(0x66);
   GetMapDescription(newPos.x + 9, newPos.y - 6, newPos.z, 1, 14, msg);
   msg->put<char>(0x68);
   GetMapDescription(newPos.x - 8, newPos.y - 6, newPos.z, 1, 14, msg);
   msg->put<char>(0x65);
   GetMapDescription(oldPos.x - 10, newPos.y - 8, newPos.z, 22, 1, msg);
   msg->put<char>(0x67);
   GetMapDescription(oldPos.x - 10, newPos.y + 9, newPos.z, 22, 1, msg);
   msg->put<char>(0x66);
   GetMapDescription(newPos.x + 11, newPos.y - 8, newPos.z, 1, 18, msg);
   msg->put<char>(0x68);
   GetMapDescription(newPos.x - 10, newPos.y - 8, newPos.z, 1, 18, msg);
}
 
I'm not sure, I've set the width and height in the gameinterface.lua for the client too.. so I'm pretty stumped



I've tried to enter the above, I think my issue might be the version of TFS I'm using - Instead of ->put<char> I have addbyte...

Here's the compile log

1570yg6.png
 
My bad, I had copied a few of these lines from sendMoveCreature.

PHP:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
  msg->put<char>(0x64);
  msg->putPosition(player->getPosition());
  GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);
  msg->put<char>(0x65);
  GetMapDescription(oldPos.x - 8, pos.y - 6, pos.z, 18, 1, msg);
  msg->put<char>(0x67);
  GetMapDescription(oldPos.x - 8, pos.y + 7, pos.z, 18, 1, msg);
  msg->put<char>(0x66);
  GetMapDescription(pos.x + 9, pos.y - 6, pos.z, 1, 14, msg);
  msg->put<char>(0x68);
  GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 1, 14, msg);
  msg->put<char>(0x65);
  GetMapDescription(oldPos.x - 10, pos.y - 8, pos.z, 22, 1, msg);
  msg->put<char>(0x67);
  GetMapDescription(oldPos.x - 10, pos.y + 9, pos.z, 22, 1, msg);
  msg->put<char>(0x66);
  GetMapDescription(pos.x + 11, pos.y - 8, pos.z, 1, 18, msg);
  msg->put<char>(0x68);
  GetMapDescription(pos.x - 10, pos.y - 8, pos.z, 1, 18, msg);
}

I corrected the newPos.
 
Oh and I'm sure AddByte is the same as put<char>
 
Not a problem, seems oldPos is giving the same result :( Didn't expect this to be as troublesome as it is! Ah, good to know about put<char> :)
 
dno't use oldPos, just pos works, that is what the position is defined as "pos"
 
Noted :)

Here's the results

2r5xgtu.png


Seems like it is taking the values from the first line
 
Here's something interesting:

1zxpij4.png


I logged into the tile just 1 square to the north west of where i'm standing (that's where the login animation appeared) but look at the number of tiles...

19 on the bottom row and 15 going down.

This was just randomly entering in a value on the first line

Replaced:

PHP:
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);

with

PHP:
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 132, msg);

I know it's a bit excessive! But It might be on the right track.

Again, the map is just all tiles.. don't know why it missed out the rest!
 
I can read the script, and I know HOW it is SUPPOSED to work.
Here is how it works:
1) Find Starting Tile: (This would be the first 3 pos.x, pos.y, pos.z)
So in GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 132, msg);
It should grab, your position, minus 1 X and 1 Y, so it should grab the tile directly northwest of your starting position.

2)Get X Repeats: (This would be how many columns of tiles you wanted it to draw)
So in GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 132, msg);
It should grab the number 2.

3)Get Y Repearts: (This would be how many tiles should be drawn in each column)
So in GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 132, msg);
It should grab the number 132.

This means, it should have drawn 2 columns with 132 tiles in EACH column.

Your screen, DOES NOT show this lol. It actually is so random that it should be theoretically impossible to draw with the scripts we used.

Like, from all our testing, the only thing that draws correctly is the normal GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 18, 14, msg);

Everything else goes absolute nuts.
 
By the way, if your character is a GM character that can use /a (teleport tile) or /t to go to temple, every time you teleport it will run the script we are editing again. so you could test.

Also since I noticed all your skills were negative I looked up when these are added to the client:
Interestingly enough~~~

PHP:
void ProtocolGame::sendAddCreature(const Creature* creature, const Position& pos, uint32_t stackpos)
{
   if(!canSee(creature))
     return;

   if(!g_game.isSightClear(player->getPosition(), pos, false))
     return;
   
   NetworkMessage_ptr msg = getOutputBuffer();
   if(!msg)
     return;

   TRACK_MESSAGE(msg);
   if(creature != player)
   {
     AddTileCreature(msg, pos, stackpos, creature);
     return;
   }

   msg->put<char>(0x17);
   msg->put<uint32_t>(player->getID());
   msg->put<uint16_t>(0x32); // beat duration (50)

   msg->putDouble(Creature::speedA, 3);
   msg->putDouble(Creature::speedB, 3);
   msg->putDouble(Creature::speedC, 3);

   msg->put<char>(player->hasFlag(PlayerFlag_CanReportBugs));

   sendEnterWorld();

   AddMapDescription(msg, pos);
   for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i)
     AddInventoryItem(msg, (slots_t)i, player->getInventoryItem((slots_t)i));

   AddPlayerStats(msg);
   AddPlayerSkills(msg);

   LightInfo lightInfo;
   g_game.getWorldLightInfo(lightInfo);

   AddWorldLight(msg, lightInfo);
   AddCreatureLight(msg, creature);

   player->sendIcons();

   //Need to fix this so normal players can't see ghosted staff
   for(VIPMap::iterator it = player->VIPList.begin(); it != player->VIPList.end(); ++it)
   {
     std::string vipName;
     if(IOLoginData::getInstance()->getNameByGuid((*it).first, vipName))
     {
       VipStatus_t vipStatus;
       if(Player* tmpPlayer = g_game.getPlayerByName(vipName))
         vipStatus = player->canSeeCreature(tmpPlayer) ? VIPSTATUS_ONLINE : VIPSTATUS_OFFLINE;
       else
         vipStatus = VIPSTATUS_OFFLINE;

       sendVIP((*it).first, vipName, (*it).second.description, (*it).second.icon, (*it).second.notify, vipStatus);
     }
   }
}

(IT is added after it draws the screen, which means WE are causing an error when drawing bigger maps, so that the client never receives the rest of this script, therefor all skills are -1)
 
Status
Not open for further replies.
Back
Top