Líderes
Conteúdo Popular
Exibindo conteúdo com a maior reputação em 09/19/19 em todas áreas
-
[TFS 0.3.6] Campo de visão > Max view Tiles
AngellGreen reagiu a JulianoZN por um tópico no fórum
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); }1 ponto -
Bike
AngellGreen reagiu a Marshmello por uma questão
function onUse(cid, item, fromPosition, itemEx, toPosition) local sBike = 12774 local t = { [12774] = {article='a', name='bike', text='Vou montar na bike!', dtext='Vou sair da bike!', s=5700, condition=bikeCondition, nonMoveable = 16232, movable = 12774 }, } local premium = false function BikeSpeedOn(cid,nSpeed) setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid)) doChangeSpeed(cid,-getCreatureSpeed(cid)) doChangeSpeed(cid,nSpeed) end function BikeSpeedOff(cid) doChangeSpeed(cid,-getCreatureSpeed(cid)) doChangeSpeed(cid,getPlayerStorageValue(cid,sBike)) end if not isPremium(cid) then doPlayerSendCancel(cid, "Vc nao é premium, Vaza.") return true end local v, r = getCreaturePosition(cid), t[item.itemid] local s = r.s local pos = {x = v.x, y = v.y, z = v.z} if r then if getPlayerStorageValue(cid, 25000) == 5 then return end if getPlayerStorageValue(cid, 23000) == 5 then return end if not getPlayerItemCount(cid, item.itemid) then return false end if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then doPlayerSendCancel(cid, "You can't use bike while ride/fly/surf.") return true end if getPlayerStorageValue(cid, s) <= 0 then doCreatureSay(cid, r.text, 19) setPlayerStorageValue(cid, s, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você montou na ' .. r.article .. ' '.. r.name .. '.') BikeSpeedOn(cid,1100) doTransformItem(itemEx,uid, r.nonMoveable) if getPlayerSex(cid) == 1 then doSetCreatureOutfit(cid, {lookType = 2518, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) setPlayerStorageValue(cid, 7200, 1) else doSetCreatureOutfit(cid, {lookType = 2517, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) setPlayerStorageValue(cid, 7200, 1) end elseif getPlayerStorageValue(cid, s) == 1 then doCreatureSay(cid, r.dtext, 19) setPlayerStorageValue(cid, s, 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Você saiu da ' .. r.article .. ' '.. r.name .. '.') BikeSpeedOff(cid) setPlayerStorageValue(cid, 7200, -1) doTransformItem(itemEx,uid, r.movable) return doRemoveCondition(cid, CONDITION_OUTFIT) else return doPlayerSendCancel(cid, 'You can\'t do this.') end else return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.') end end Modifiquei umas linhas na Scripts do ceetros , assim deve funcionar1 ponto
Líderes está configurado para São Paulo/GMT-03:00