W pliku protocolgame.cpp zamieniamy ca?a funkcj? AddPlayerStats na:
msg->put<char>(0xA0);
//msg->put<uint16_t>(player->getHealth());
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
msg->put((uint16_t)std::ceil(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
msg->put((uint16_t)100);
msg->put<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
uint64_t experience = player->getExperience();
if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp
msg->put<uint32_t>(0x7FFFFFFF);
else
msg->put<uint32_t>(experience);
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
msg->put((uint16_t)std::ceil(player->getMana() * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)));
msg->put((uint16_t)100);
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_SOUL));
msg->put<uint16_t>(player->getStaminaMinutes());
musisz stworzyc source z silkniak sowjego bo inaczje teog nierzrobisz, moze ktos ci pomoze ale malo tu osob pomocnych prfzy tymjesst troche roboty, nie mowie tylkotym skrypcie ale i o innych systemach na 7.6a co je?li nie mam pliku protocolgame.cpp?
@up
Polecam zalogowa? si? na account managera
@up
[CPP]msg->put((uint16_t)std::ceil(player->getMana() * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA))); [/CPP]
Account Manager ma 0 many. Dzielenie przez zero jest niemo?liwe.
Daj czyst? funkcj? AddPlayerStats to zrobi? i przy okazji dodam do tematu.
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
msg->put<char>(0xA0);
//msg->put<uint16_t>(player->getHealth());
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH));
//msg->put((uint16_t)std::ceil((float)player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH), 1)));
msg->put((uint16_t)std::ceil((float)player->getHealth() * 100 / std::max(player->getMaxHealth(), 1)));
msg->put((uint16_t)100);
msg->put<uint32_t>(uint32_t(player->getFreeCapacity() * 100));
uint64_t experience = player->getExperience();
if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp
msg->put<uint32_t>(0x7FFFFFFF);
else
msg->put<uint32_t>(experience);
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_LEVEL));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT));
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA));
//msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MAXMANA));
//msg->put((uint16_t)std::ceil(player->getMana() * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)));
msg->put((uint16_t)std::ceil((float)player->getMana() * 100 / std::max(player->getMaxMana(), 1)));
msg->put((uint16_t)100);
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_SOUL));
msg->put<uint16_t>(player->getStaminaMinutes());
}