Lurk
Active Member
- Joined
- Dec 4, 2017
- Messages
- 336
- Reaction score
- 48
Hello, I'm using this sources Fir3element/3777 (https://github.com/Fir3element/3777) and this code in
and it was working just fine, that is until a player reached
the mana will also become like that if it's full
chaging everything to
edit: tried compiling as
and got
protocolgame.cpp
Lua:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
msg->AddByte(0xA0);
if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
{
msg->AddU16(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
msg->AddU16(100);
}
else
{
msg->AddU16(0);
msg->AddU16(0);
}
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));
if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0)
{
msg->AddU16(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
msg->AddU16(100);
}
else
{
msg->AddU16(0);
msg->AddU16(0);
}
msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
msg->AddByte(player->getPlayerInfo(PLAYERINFO_SOUL));
msg->AddU16(player->getStaminaMinutes());
}
, now his hp and mana is showing 65k at the health bar2382227 health and 2382227 mana
the mana will also become like that if it's full
chaging everything to
AddU32
would fix this? would there be collateral problems?edit: tried compiling as
Lua:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
msg->put<char>(0xA0);
if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
{
msg->put<uint32_t>(uint32_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
msg->put<uint32_t>(100);
}
else
{
msg->put<uint32_t>(0);
msg->put<uint32_t>(0);
}
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));
if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0)
{
msg->put<uint32_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
msg->put<uint32_t>(100);
}
else
{
msg->put<uint32_t>(0);
msg->put<uint32_t>(0);
}
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT));
msg->put<char>(player->getPlayerInfo(PLAYERINFO_SOUL));
msg->put<uint32_t>(player->getStaminaMinutes()); // VIDA EM PORCENTAGEM
}
and got
Code:
C:\vc15_pack\include\boost/bind/bind.hpp(449): warning C4244: 'argument' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
C:\vc15_pack\include\boost/bind/bind.hpp(895) : see reference to function template instantiation 'R boost::_bi::list4<A1,A2,A3,A4>::eek:perator ()<bool,F,boost::_bi::list0>(boost::_bi::type<T>,F &,A &,long)' being compiled
with
[
R=bool,
A1=boost::_bi::value<Game *>,
A2=boost::_bi::value<uint32_t>,
A3=boost::_bi::value<uint16_t>,
A4=boost::_bi::value<uint16_t>,
F=boost::_mfi::mf3<bool,Game,uint32_t,uint16_t,uint8_t>,
T=bool,
A=boost::_bi::list0
]
C:\vc15_pack\include\boost/bind/bind.hpp(893) : while compiling class template member function 'bool boost::_bi::bind_t<R,F,L>::eek:perator ()(void)'
with
[
R=bool,
F=boost::_mfi::mf3<bool,Game,uint32_t,uint16_t,uint8_t>,
L=boost::_bi::list4<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>>
]
..\protocolgame.cpp(1496) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
with
[
R=bool,
F=boost::_mfi::mf3<bool,Game,uint32_t,uint16_t,uint8_t>,
L=boost::_bi::list4<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>>
]
C:\vc15_pack\include\boost/bind/bind.hpp(662): warning C4244: 'argument' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
C:\vc15_pack\include\boost/bind/bind.hpp(895) : see reference to function template instantiation 'R boost::_bi::list7<A1,A2,A3,A4,A5,A6,A7>::eek:perator ()<bool,F,boost::_bi::list0>(boost::_bi::type<T>,F &,A &,long)' being compiled
with
[
R=bool,
A1=boost::_bi::value<Game *>,
A2=boost::_bi::value<uint32_t>,
A3=boost::_bi::value<uint16_t>,
A4=boost::_bi::value<uint16_t>,
A5=boost::_bi::value<uint16_t>,
A6=boost::_bi::value<bool>,
A7=boost::_bi::value<bool>,
F=boost::_mfi::mf6<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t,bool,bool>,
T=bool,
A=boost::_bi::list0
]
C:\vc15_pack\include\boost/bind/bind.hpp(893) : while compiling class template member function 'bool boost::_bi::bind_t<R,F,L>::eek:perator ()(void)'
with
[
R=bool,
F=boost::_mfi::mf6<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t,bool,bool>,
L=boost::_bi::list7<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<bool>,boost::_bi::value<bool>>
]
..\protocolgame.cpp(1506) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
with
[
R=bool,
F=boost::_mfi::mf6<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t,bool,bool>,
L=boost::_bi::list7<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<bool>,boost::_bi::value<bool>>
]
C:\vc15_pack\include\boost/bind/bind.hpp(662): warning C4244: 'argument' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
C:\vc15_pack\include\boost/bind/bind.hpp(517): warning C4244: 'argument' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
C:\vc15_pack\include\boost/bind/bind.hpp(895) : see reference to function template instantiation 'R boost::_bi::list5<A1,A2,A3,A4,A5>::eek:perator ()<bool,F,boost::_bi::list0>(boost::_bi::type<T>,F &,A &,long)' being compiled
with
[
R=bool,
A1=boost::_bi::value<Game *>,
A2=boost::_bi::value<uint32_t>,
A3=boost::_bi::value<uint16_t>,
A4=boost::_bi::value<uint16_t>,
A5=boost::_bi::value<uint16_t>,
F=boost::_mfi::mf4<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t>,
T=bool,
A=boost::_bi::list0
]
C:\vc15_pack\include\boost/bind/bind.hpp(893) : while compiling class template member function 'bool boost::_bi::bind_t<R,F,L>::eek:perator ()(void)'
with
[
R=bool,
F=boost::_mfi::mf4<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t>,
L=boost::_bi::list5<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>>
]
..\protocolgame.cpp(1514) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
with
[
R=bool,
F=boost::_mfi::mf4<bool,Game,uint32_t,uint16_t,uint8_t,uint8_t>,
L=boost::_bi::list5<boost::_bi::value<Game *>,boost::_bi::value<uint32_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>,boost::_bi::value<uint16_t>>
]
C:\vc15_pack\include\boost/bind/bind.hpp(517): warning C4244: 'argument' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-1_59.lib'
Build FAILED.
Last edited: