Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 05/23/19 em todas áreas

  1. Obs: ja tem tutoriais aqui no xtibia porem estão tendo problemas entao vamos lá Antes de começar lembre-se esse codigo nao da de usar o old cliente depois Oque Precisa ? Source do Servidor e Source do OtClient Source usada: Para nao dar bug na hora de subir escada ou desce, aumente o máximo de tiles que poderá ser carregado const.h procure por #define NETWORKMESSAGE_MAXSIZE 15360 mude para #define NETWORKMESSAGE_MAXSIZE valor que voce quer <OBS isso e para a quantidade de pixel será possivel receber sem bugar> #define NETWORKMESSAGE_MAXSIZE 1000000000 --- Valor que coloquei no meu protocalgame.cpp procure por bool ProtocolGame::canSee(uint16_t x, uint16_t y, uint16_t z) const { #ifdef __DEBUG__ if(z < 0 || z >= MAP_MAX_LAYERS) std::cout << "[Warning - ProtocolGame::canSee] Z-value is out of range!" << std::endl; #endif const Position& myPos = player->getPosition(); if(myPos.z <= 7) { //we are on ground level or above (7 -> 0), view is from 7 -> 0 if(z > 7) return false; } else if(myPos.z >= 8 && std::abs(myPos.z - z) > 2) //we are underground (8 -> 15), view is +/- 2 from the floor we stand on return false; //negative offset means that the action taken place is on a lower floor than ourself int32_t offsetz = myPos.z - z; return ((x >= myPos.x - 8 + offsetz) && (x <= myPos.x + 9 + offsetz) && (y >= myPos.y - 6 + offsetz) && (y <= myPos.y + 7 + offsetz)); } Substitua por bool ProtocolGame::canSee(uint16_t x, uint16_t y, uint16_t z) const { #ifdef __DEBUG__ if(z < 0 || z >= MAP_MAX_LAYERS) std::cout << "[Warning - ProtocolGame::canSee] Z-value is out of range!" << std::endl; #endif const Position& myPos = player->getPosition(); if(myPos.z <= 7) { //we are on ground level or above (7 -> 0), view is from 7 -> 0 if(z > 7) return false; } else if(myPos.z >= 8 && std::abs(myPos.z - z) > 2) //we are underground (8 -> 15), view is +/- 2 from the floor we stand on return false; //negative offset means that the action taken place is on a lower floor than ourself int32_t offsetz = myPos.z - z; return ((x >= myPos.x - Map::maxClientViewportX + offsetz) && (x <= myPos.x + (Map::maxClientViewportX+1) + offsetz) && (y >= myPos.y - Map::maxClientViewportY + offsetz) && (y <= myPos.y + (Map::maxClientViewportY+1) + offsetz)); } procure por if(newPos.z > oldPos.z) MoveDownCreature(msg, creature, newPos, oldPos, oldStackpos); else if(newPos.z < oldPos.z) MoveUpCreature(msg, creature, newPos, oldPos, oldStackpos); 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); } } } } Substitua por if(newPos.z > oldPos.z) MoveDownCreature(msg, creature, newPos, oldPos, oldStackpos); else if(newPos.z < oldPos.z) MoveUpCreature(msg, creature, newPos, oldPos, oldStackpos); 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); } } } } Procure por ////////////// Add common messages void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos) { msg->AddByte(0x64); msg->AddPosition(player->getPosition()); GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 18, 14, msg); } Substitua por ////////////// Add common messages void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos) { msg->AddByte(0x64); msg->AddPosition(player->getPosition()); GetMapDescription(pos.x - Map::maxClientViewportX, pos.y - Map::maxClientViewportY, pos.z, (Map::maxClientViewportX+1)*2, (Map::maxClientViewportY+1)*2, msg); } Procure por void ProtocolGame::MoveUpCreature(NetworkMessage_ptr msg, const Creature* creature, const Position& newPos, const Position& oldPos, uint32_t oldStackpos) { if(creature != player) return; msg->AddByte(0xBE); //floor change up if(newPos.z == 7) //going to surface { 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); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } else if(newPos.z > 7) //underground, going one floor up (still underground) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, oldPos.z - 3, 18, 14, 3, skip); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } //moving up a floor up makes us out of sync //west msg->AddByte(0x68); GetMapDescription(oldPos.x - 8, oldPos.y + 1 - 6, newPos.z, 1, 14, msg); //north msg->AddByte(0x65); GetMapDescription(oldPos.x - 8, oldPos.y - 6, newPos.z, 18, 1, msg); } Substitua por void ProtocolGame::MoveUpCreature(NetworkMessage_ptr msg, const Creature* creature, const Position& newPos, const Position& oldPos, uint32_t oldStackpos) { if(creature != player) return; msg->AddByte(0xBE); //floor change up if(newPos.z == 7) //going to surface { 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); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } else if(newPos.z > 7) //underground, going one floor up (still underground) { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - Map::maxClientViewportX, oldPos.y - Map::maxClientViewportY, oldPos.z - 3, (Map::maxClientViewportX+1), (Map::maxClientViewportY+1)*2, 3, skip); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } //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); } Procure por void ProtocolGame::MoveDownCreature(NetworkMessage_ptr msg, const Creature* creature, const Position& newPos, const Position& oldPos, uint32_t oldStackpos) { if(creature != player) return; msg->AddByte(0xBF); //floor change down if(newPos.z == 8) //going from surface to underground { 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); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } else if(newPos.z > oldPos.z && newPos.z > 8 && newPos.z < 14) //going further down { int32_t skip = -1; GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, newPos.z + 2, 18, 14, -3, skip); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } //moving down a floor makes us out of sync //east msg->AddByte(0x66); GetMapDescription(oldPos.x + 9, oldPos.y - 1 - 6, newPos.z, 1, 14, msg); //south msg->AddByte(0x67); GetMapDescription(oldPos.x - 8, oldPos.y + 7, newPos.z, 18, 1, msg); } Substitua por void ProtocolGame::MoveDownCreature(NetworkMessage_ptr msg, const Creature* creature, const Position& newPos, const Position& oldPos, uint32_t oldStackpos) { if(creature != player) return; msg->AddByte(0xBF); //floor change down if(newPos.z == 8) //going from surface to underground { 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); if(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } else if(newPos.z > oldPos.z && newPos.z > 8 && newPos.z < 14) //going further down { 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(skip >= 0) { msg->AddByte(skip); msg->AddByte(0xFF); } } //moving down a floor makes us out of sync //east msg->AddByte(0x66); GetMapDescription(oldPos.x + Map::maxClientViewportX, oldPos.y - (Map::maxClientViewportY-1), newPos.z, 1, (Map::maxClientViewportY+1)*2, msg); //south msg->AddByte(0x67); GetMapDescription(oldPos.x - Map::maxClientViewportX, oldPos.y + Map::maxClientViewportY, newPos.z, (Map::maxClientViewportX+1)*2, 1, msg); } Agora no Map.h Procure por 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; Substitua por static const int32_t maxViewportX = 15; //min value: maxClientViewportX + 1 static const int32_t maxViewportY = 15; //min value: maxClientViewportY + 1 static const int32_t maxClientViewportX = 14; static const int32_t maxClientViewportY = 8; Agora no map.cpp do Otclient Procure por void Map::resetAwareRange() { AwareRange range; range.left = 8; range.top = 6; range.bottom = 7; range.right = 9; setAwareRange(range); } Substitua por { AwareRange range; range.left = 15; //Change this to = maxClientViewportX range.top = 15; //Change this to = maxClientViewportY range.bottom = range.top+1; range.right = range.left+1; setAwareRange(range); } ou por { AwareRange range; range.left = 14; //Change this to = maxClientViewportX range.top = 8; //Change this to = maxClientViewportY range.bottom = range.top+1; range.right = range.left+1; setAwareRange(range); }
    2 pontos
  2. Gengo

    [OtClient] Auto-Loot

    Fala ai galera do xtibia estou aqui trazendo mais um module para o otClient. Esses dias atras estavo jogando pokestorm e me deparei com o autoloot e decidi fazer um parecido com o deles e então pensei porque não trazer para a comunidade? Afinal não vejo muitos modulos de autoloot para otClient o unico que vi foi o autoloot da DxP, porem não é muito intuitivo comparado com modulo da pokestorm, bom sem mais enrolação vamos lá. Feito o download do arquivo, coloque-o na pasta do seu otClient em /modules/ e pronto já é possível "utilizar-lo", porem com algumas exceções de algumas configurações básicas que temos que fazer para poder utilizar-lo com algumas eficiências. 1º Na pasta do seu otClient/data/ crie uma pasta chamada items e coloque o seus arquivos items.otb e items.xml. 2º Vai até a pasta do seu otClient/modules/game_things abre o arquivo things.lua e procure a função load(), e coloque o seguinte: g_things.loadOtb ('/items/items.otb') g_things.loadXml('/items/items.xml') Obs: Não se assustem quando entrarem no client para logar, no inicio vai dar uma travada, mas depois de esperar uns segundos ele normaliza, pois o único problema é que o carregamento dos arquivos dos items eles são demorados. Também é preciso fazer umas configurações rápida na parte do servidor para poder funcionar. Copie e cole esse script e coloque na pasta do servidor em mods/ e de o nome de autoloot.xml Ainda na pasta do seu servidor abre o arquivo /data/creaturescripts/scripts/login.lua e coloque o seguinte script dentro da função onLogin: local loot = '' for i = 1, #getPlayerStorageTable(cid, info.Storages[1]) do loot = loot..getItemInfo(getPlayerStorageTable(cid, info.Storages[1])[i]).clientId..'-'..getItemNameById(getPlayerStorageTable(cid, info.Storages[1])[i])..'@' end doSendPlayerExtendedOpcode(cid, 157, loot) Feito todos os passos corretamente, configurado certo, deve ficar assim no game: Bom espero que tenham entendido e gostado, não sou muito de ficar escrevendo tutorial, até uma próxima. Download Créditos
    1 ponto
  3. Olá EkzTibianos, tenho o prazer de informar que estarei criando conteúdos para uma nova seção! Aulas de Scripting, e conto muito com a sua presença. Se VOCÊ quer aprender LUA de um jeito fácil e descomplicado, junte-se a nós, e venha ver as aulas que vão lhe ensinar a fazer scripts do nível de quest à sistemas bem desenvolvidos. Com a minha ajuda, e talvez a ajuda de membros e equipe, vamos nos prontificar à criar um espaço de suporte na própria seção de aprendizado, para que suas dúvidas em relação à scripting sejam tiradas rápidamente. As aulas irão explicar conteúdos em etapas, cada aula antecessora será uma base para a sucessora, já tenho rascunho de conteúdos da Aula-[0], que irá trabalhar com a velha e chata lógica de programação (extremamente necessária - porém de um jeito diferente) e alguns termos que serão utilizados posteriormente. Também contaremos com Deveres de casa, para que possam por em prática o que aprenderam na aula atual, esses deveres irão render pontos para quem cumprir com sagacidade, que servirão para outra novidade que ainda virá. Estou esperando o feedback de vocês ansiosamente neste tópico, eu vou gostar muito caso tenha uma repercussão boa e que possa ajudar o máximo de pessoas possíveis...
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...