underewar 32 #1 Posted March 3, 2019 Efeito: caractestica da vida, agora indicada como %(percent) Como Usar: Substiruiremos a função inteira de do playerstats dentro do protocolgame.cpp caso seja nas versões e tfs 0.3.6.1. Para tibia 7.6 editaremos o protocol76game.cpp Spoiler Over the years various variations and different miracles have been made, only 4 lines should look different in the function. TFS MASTER c++ code Spoiler void ProtocolGame::AddPlayerStats(NetworkMessage& msg) { msg.addByte(0xA0); msg.add<uint16_t>(std::floor(player->getHealth() * 100.f / player->getMaxHealth())); msg.add<uint16_t>(100); msg.add<uint32_t>(player->getFreeCapacity()); msg.add<uint32_t>(player->getCapacity()); msg.add<uint64_t>(player->getExperience()); msg.add<uint16_t>(player->getLevel()); msg.addByte(player->getLevelPercent()); msg.add<uint16_t>(100); // base xp gain rate msg.add<uint16_t>(0); // xp voucher msg.add<uint16_t>(0); // low level bonus msg.add<uint16_t>(0); // xp boost msg.add<uint16_t>(100); // stamina multiplier (100 = x1.0) msg.add<uint16_t>(std::floor(player->getMana() * 100.f / std::max<uint32_t>(player->getMaxMana(), 1))); msg.add<uint16_t>(100); msg.addByte(std::min<uint32_t>(player->getMagicLevel(), std::numeric_limits<uint8_t>::max())); msg.addByte(std::min<uint32_t>(player->getBaseMagicLevel(), std::numeric_limits<uint8_t>::max())); msg.addByte(player->getMagicLevelPercent()); msg.addByte(player->getSoul()); msg.add<uint16_t>(player->getStaminaMinutes()); msg.add<uint16_t>(player->getBaseSpeed() / 2); Condition* condition = player->getCondition(CONDITION_REGENERATION); msg.add<uint16_t>(condition ? condition->getTicks() / 1000 : 0x00); msg.add<uint16_t>(player->getOfflineTrainingTime() / 60 / 1000); msg.add<uint16_t>(0); // xp boost time (seconds) msg.addByte(0); // enables exp boost in the store } TFS 1.0 - 1.2 c++ code Spoiler void ProtocolGame::AddPlayerStats(NetworkMessage& msg) { msg.AddByte(0xA0); msg.add<uint16_t>(std::floor(player->getHealth() * 100.f / player->getPlayerInfo(PLAYERINFO_MAXHEALTH))); msg.add<uint16_t>(100); msg.add<uint32_t>(uint32_t(player->getFreeCapacity() * 100)); msg.add<uint32_t>(uint32_t(player->getCapacity() * 100)); msg.add<uint64_t>(player->getExperience()); msg.add<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL)); msg.AddByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT)); msg.add<uint16_t>(std::floor(player->getMana() * 100.f / std::max<uint32_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA), 1))); msg.add<uint16_t>(100); msg.AddByte(std::min<uint32_t>(0xFF, player->getMagicLevel())); msg.AddByte(std::min<uint32_t>(0xFF, player->getBaseMagicLevel())); msg.AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT)); msg.AddByte(player->getPlayerInfo(PLAYERINFO_SOUL)); msg.add<uint16_t>(player->getStaminaMinutes()); msg.add<uint16_t>(player->getBaseSpeed() / 2); Condition* condition = player->getCondition(CONDITION_REGENERATION); msg.add<uint16_t>(condition ? condition->getTicks() / 1000 : 0x00); msg.add<uint16_t>(player->getOfflineTrainingTime() / 60 / 1000); } TFS 0.3.6.1 Você precisa remover o espaço de PLAYERINFO_MAXMANA se aparecer algum erro, ou algo fora do comun - não é minha culpa c++code Spoiler void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg) { msg->AddByte(0xA0); msg->AddU16((uint16_t)std::floor(player->getHealth() * 100.f / getPlayerInfo(PLAYERINFO_MAXHEALTH))); msg->AddU16(100); msg->AddU32(uint32_t(player->getFreeCapacity() * 100)); uint64_t experience = player->getExperience(); if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp msg->AddU32(0x7FFFFFFF); else msg->AddU32(experience); msg->AddU16(player->getPlayerInfo(PLAYERINFO_LEVEL)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT)); msg->AddU16((uint16_t)std::floor(player->getMana() * 100.f / std::max<uint32_t>(getPlayerInfo(PLAYERINFO_MAXMAN A), 1))); msg->AddU16(100); msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_SOUL)); msg->AddU16(player->getStaminaMinutes()); } para versões 7.6-7.9 Spoiler void Protocol76::AddPlayerStats(NetworkMessage &msg,const Player *player) { msg.AddByte(0xA0); msg.AddU16((uint16_t)std::floor(player->getHealth() * 100.f / std::max<uint32_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH), 1))); msg.AddU16(100); msg.AddU16((unsigned short)std::floor(player->getFreeCapacity())); #ifdef YUR_HIGH_LEVELS if (player->getPlayerInfo(PLAYERINFO_LEVEL) > 65535) { msg.AddU32(player->getPlayerInfo(PLAYERINFO_LEVEL)); msg.AddU16(0); } else if (player->getExperience() > 2000000000L) { msg.AddU32(0); msg.AddU16(player->getPlayerInfo(PLAYERINFO_LEVEL)); } else { msg.AddU32((unsigned long)player->getExperience()); msg.AddU16(player->getPlayerInfo(PLAYERINFO_LEVEL)); } #else msg.AddU32(player->getExperience()); msg.AddU16(player->getPlayerInfo(PLAYERINFO_LEVEL)); #endif //YUR_HIGH_LEVELS msg.AddByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT)); msg.AddU16((uint16_t)std::floor(player->getMana() * 100.f / std::max<uint32_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA), 1))); msg.AddU16(100); msg.AddByte(player->getMagicLevel()); msg.AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT)); msg.AddByte(player->getPlayerInfo(PLAYERINFO_SOUL)); } Códigos criados em 02/12/2017 Acredito que todas as versões estejam ai. Imagens: Antes : Depois : 1 Majesty reacted to this Share this post Link to post
Majesty 1,755 #2 Posted March 3, 2019 Muito obrigado pela sua contribuição, seu tópico de conteúdo foi aprovado! Nós do OTServ Brasil agradecemos, seu conteúdo com certeza ajudará a muitos outros. Você recebeu +1 REP! Share this post Link to post