Olá galera do xtibia, vim aqui trazendo de outro forum um tutorial de como aumentar a capacidade da visão do player, por exemplo, o alcance da vista do player é X quadrados Por Y de quadrados, e vc quer aumentar essa visão ou abaixar, ela, tipo da mais zoom ou diminuir o zoom do jogo. esse sistema requer as sources do server e as sources do otclient. mas tem um problema, n conseguir traduzir esse tutorial e nem conseguir colocar ele no meu server, então vim trazer o tutorial e ao mesmo tempo venho pedir a um scripter ou programador para ajudar a traduzir e fazer rodar esse sistema, vi nos comentários do forum que o sistema ta funcionando direito, então devo ter errado algo para n pegar aqui, por isso peço a ajuda de vcs. esse sistema foi feito para o tfs 1.0 e para o tfs 0.3.6, sendo que acho que tem uma parte para o tfs 1.0 e outra parte separada para o tfs 0.3.6, acho que por isso que deu errado aqui, devo ter colocado coisas a mais ou faltou coisas para eu colocar. em fim, vamos lá.
This is a tutorial showing how to add more tiles to the OTClient window. (Make the screen bigger)
This is actually a bigger problem than it should be, because TFS doesn't use maxViewPort everywhere it should. So lets change that first!
I will do this for TFS 1.0, since it is basically the same edits for TFS 0.3.6, and maybe i'll learn something doing it for TFS 1.0.
Most of our edits (almost all of them) will be in protocalgame.cpp
First we need to edit:
bool ProtocolGame::canSee(int32_t x, int32_t y, int32_t z) const
Change This:
if ((x >= myPos.getX() - 8 + offsetz) && (x <= myPos.getX() + 9 + offsetz) && (y >= myPos.getY() - 6 + offsetz) && (y <= myPos.getY() + 7 + offsetz)) {
To This:
if ((x >= myPos.getX() - Map::maxClientViewportX + offsetz) && (x <= myPos.getX() + (Map::maxClientViewportX+1) + offsetz) && (y >= myPos.getY() - Map::maxClientViewportY + offsetz) && (y <= myPos.getY() + (Map::maxClientViewportY+1) + offsetz)) {
Then in:
void ProtocolGame::sendMapDescription(const Position& pos)
Change This:
GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 18, 14, msg);
To This:
GetMapDescription(pos.x - Map::maxClientViewportX, pos.y - Map::maxClientViewportY, pos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, msg);
Then in:
void ProtocolGame::sendMoveCreature(const Creature* creature, const Position& newPos, int32_t newStackPos, const Position& oldPos, int32_t oldStackPos, bool teleport)
Change This:
if (oldPos.y > newPos.y) { // north, for old x msg.AddByte(0x65); GetMapDescription(oldPos.x - 8, newPos.y - 6, newPos.z, 18, 1, msg); } else if (oldPos.y < newPos.y) { // south, for old x msg.AddByte(0x67); GetMapDescription(oldPos.x - 8, newPos.y + 7, newPos.z, 18, 1, msg); } if (oldPos.x < newPos.x) { // east, [with new y] msg.AddByte(0x66); GetMapDescription(newPos.x + 9, newPos.y - 6, newPos.z, 1, 14, msg); } else if (oldPos.x > newPos.x) { // west, [with new y] msg.AddByte(0x68); GetMapDescription(newPos.x - 8, newPos.y - 6, newPos.z, 1, 14, msg); }
To This:
if (oldPos.y > newPos.y) { // north, for old x msg.AddByte(0x65); GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, 1, msg); } else if (oldPos.y < newPos.y) { // south, for old x msg.AddByte(0x67); GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y + (Map::maxClientViewportY+1), newPos.z, (Map::maxClientViewportX+1)*2, 1, msg); } if (oldPos.x < newPos.x) { // east, [with new y] msg.AddByte(0x66); GetMapDescription(newPos.x + (Map::maxClientViewportX+1), newPos.y - Map::maxClientViewportY, newPos.z, 1, (Map::maxClientViewportY+1)*2, msg); } else if (oldPos.x > newPos.x) { // west, [with new y] msg.AddByte(0x68); GetMapDescription(newPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z, 1, (Map::maxClientViewportY+1)*2, msg); }
Then in:
void ProtocolGame::MoveUpCreature(NetworkMessage& msg, const Creature* creature, const Position& newPos, const Position& oldPos)
Change This:
if (newPos.z == 7) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 5, 18, 14, 3, skip); //(floor 7 and 6 already set) GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 4, 18, 14, 4, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 3, 18, 14, 5, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 2, 18, 14, 6, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 1, 18, 14, 7, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 0, 18, 14, 8, skip);
To This:
if (newPos.z == 7) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 5, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 3, skip); //(floor 7 and 6 already set) GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 4, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 4, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 3, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 5, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 6, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 1, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 7, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, 0, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 8, skip);
And Change This:
else if (newPos.z > 7) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, oldPos.getZ() - 3, 18, 14, 3, skip);
To This:
else if (newPos.z > 7) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, oldPos.getZ() - 3, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, 3, skip);
And Change This:
//moving up a floor up makes us out of sync //west msg.AddByte(0x68); GetMapDescription(oldPos.x - 8, oldPos.y - 5, newPos.z, 1, 14, msg); //north msg.AddByte(0x65); GetMapDescription(oldPos.x - 8, oldPos.y - 6, newPos.z, 18, 1, msg);
To This:
//moving up a floor up makes us out of sync //west msg.AddByte(0x68); GetMapDescription(oldPos.x - Map::maxClientViewportX, oldPos.y - (Map::maxClientViewportY-1), newPos.z, 1, (Map::maxClientViewportY+1)*2, msg); //north msg.AddByte(0x65); GetMapDescription(oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, 1, msg);
Then in:
void ProtocolGame::MoveDownCreature(NetworkMessage& msg, const Creature* creature, const Position& newPos, const Position& oldPos)
Change This:
//going from surface to underground if (newPos.z == 8) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z, 18, 14, -1, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 1, 18, 14, -2, skip); GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 2, 18, 14, -3, skip);
To This:
//going from surface to underground if (newPos.z == 8) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -1, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 1, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -2, skip); GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -3, skip);
And Change This:
//going further down else if (newPos.z > oldPos.z && newPos.z > 8 && newPos.z < 14) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 2, 18, 14, -3, skip);
To This:
//going further down else if (newPos.z > oldPos.z && newPos.z > 8 && newPos.z < 14) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, newPos.z + 2, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, -3, skip);
If you are using 0.3.6 then you will also need to change this:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos) { msg->put<char>(0x64); msg->putPosition(player->getPosition()); GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 18, 14, msg); }
To This:
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos) { msg->put<char>(0x64); msg->putPosition(player->getPosition()); GetMapDescription(pos.x - Map::maxClientViewportX, pos.y - Map::maxClientViewportY, pos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, msg); }
And I think that is all for protocolgame.cpp.
Now in map.h you can change these numbers to whatever you desire:
static const int32_t maxViewportX = 11; //min value: maxClientViewportX + 1 static const int32_t maxViewportY = 11; //min value: maxClientViewportY + 1 static const int32_t maxClientViewportX = 8; static const int32_t maxClientViewportY = 6;
Generally:
The maxClientViewport is how far the client can see.
and maxViewport is how far monsters see.
Then under map.cpp in the OTClient:
Change these:
void Map::resetAwareRange() { AwareRange range; range.left = 8; range.top = 6; range.bottom = 7; range.right = 9; setAwareRange(range); }
To This:
{ AwareRange range; range.left = 8; //Change this to = maxClientViewportX range.top = 6; //Change this to = maxClientViewportY range.bottom = range.top+1; range.right = range.left+1; setAwareRange(range); }
I think this should all work, if you have any issues PLEASE post them so I can correct problems with this tutorial.
If you have errors, please post both your protocolgame.cpp from TFS and map.cpp from OTClient. (So I can make sure you did it right before I look into it myself)
Fim do tutorial.
bem como todos já sabem, o tutorial ta todo em inglês, por isso peço a ajuda de vcs para traduzir ele, eu quis postar esse tutorial pq achei ele legal e interessante, ele serve para aumentar ou diminuir a visão do player, vou deixar alguns prints, achei interessante pq tem gente que quer remover aquelas barrinhas laterais do otclient e quer aumentar a visão do player sem da zoom na interface do otclient, e dependendo do server que essa pessoa usar, a vista do player fica preta dos lados quando ele anda, esse tutorial serve exatamente para isso, para aumentar o alcance da visão. denovo, peço a ajuda de alguém que traduza o tutorial do modo certo. obrigado.
Prints