• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X health and mana in % bug

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
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());
}
and it was working just fine, that is until a player reached
2382227 health and 2382227 mana
, now his hp and mana is showing 65k at the health bar
1567624415748.png
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:
Solution
That is not caused by script or the HP/MP % code, I think you need to break your health/mana limits through source.
I am not sure how to do it but you'll have to change everything related to health/mana/maxhealth/maxmana in your source files from int32_t to int64_t
Or maybe try this source.
This one you posted above should work properly, I tried it with player/GM, with full HP/Mana and with lowered ones.
Killed myself and tested almost in every way had no issues.
I think you have something else that might be debugging it.
Anyways try compiling with this and tell me if you it still happens
mana and hp working.PNG
mana and hp working properly.PNGhp and mana alright.PNG
 
I think it might be related to my reset system then? all it does is this tho, shouldn't bug but it's the only thing that messes with people's health and it happened to me around the 8th reset
Lua:
        local hp = getCreatureMaxHealth(cid)
        local resethp = hp*(config.percent/100)
        setCreatureMaxHealth(cid, resethp)
        local differencehp = (hp - resethp)
        doCreatureAddHealth(cid, -differencehp)
        local mana = getCreatureMaxMana(cid)
        local resetmana = mana*(config.percent/100)
        setCreatureMaxMana(cid, resetmana)
        local differencemana = (mana - resetmana)
        doCreatureAddMana(cid, -differencemana)

with your code I had this
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>::operator ()<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>::operator ()(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(1495) : 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>::operator ()<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>::operator ()(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(1505) : 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>::operator ()<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>::operator ()(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(1513) : 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.

check this out, loot at the hp (which is full) and the hp bar
1567638885297.png
 
Last edited:
That is not caused by script or the HP/MP % code, I think you need to break your health/mana limits through source.
I am not sure how to do it but you'll have to change everything related to health/mana/maxhealth/maxmana in your source files from int32_t to int64_t
Or maybe try this source.
 
Solution
aight, after much much work and a lot of problems, I got to the final one
Code:
ClCompile:
  protocolgame.cpp
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>::operator ()<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>::operator ()(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>::operator ()<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>::operator ()(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>::operator ()<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>::operator ()(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
ResourceCompile:
  All outputs are up-to-date.
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-1_59.lib'

Build FAILED.
this problem is in protocolgame.cpp, probably in the AddPlayerStats function. I tried everything, the one I had before and originally posted, the one you posted and also the one from the sources you linked, NONE of them worked... currently trying with the one from the sources you linked
C++:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
    msg->put<char>(0xA0);
if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
{
    msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
    msg->put<uint16_t>(100);
}
else
{
    msg->put<uint16_t>(0);
    msg->put<uint16_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<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
    msg->put<uint16_t>(100);
}
else
{
    msg->put<uint16_t>(0);
    msg->put<uint16_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<uint16_t>(player->getStaminaMinutes());
}

edit: I just tried this mix of mine and this guy's code and still got possible loss of data erros and stuf... I even tried changing everything to uint8 but nothing works
C++:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
    msg->put<char>(0xA0);
    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_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<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_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<uint16_t>(player->getStaminaMinutes());
}

the most weird of all is that the errors point to THIS
C++:
void ProtocolGame::parseLookInShop(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookInShop, player->getID(), id, count);
}

void ProtocolGame::parsePlayerPurchase(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    uint16_t amount = msg.get<char>();
    bool ignoreCap = msg.get<char>();
    bool inBackpacks = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerPurchaseItem, player->getID(), id, count, amount, ignoreCap, inBackpacks);
}

void ProtocolGame::parsePlayerSale(NetworkMessage &msg)
{
    uint16_t id = msg.get<uint16_t>();
    uint16_t count = msg.get<char>();
    uint16_t amount = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerSellItem, player->getID(), id, count, amount);
}

and when I change them to this
C++:
void ProtocolGame::parseLookInShop(NetworkMessage &msg)
{
    uint32_t id = msg.get<uint32_t>();
    uint32_t count = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookInShop, player->getID(), id, count);
}

void ProtocolGame::parsePlayerPurchase(NetworkMessage &msg)
{
    uint32_t id = msg.get<uint32_t>();
    uint32_t count = msg.get<char>();
    uint32_t amount = msg.get<char>();
    bool ignoreCap = msg.get<char>();
    bool inBackpacks = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerPurchaseItem, player->getID(), id, count, amount, ignoreCap, inBackpacks);
}

void ProtocolGame::parsePlayerSale(NetworkMessage &msg)
{
    uint32_t id = msg.get<uint32_t>();
    uint32_t count = msg.get<char>();
    uint32_t amount = msg.get<char>();
    addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerSellItem, player->getID(), id, count, amount);
}

I get
Code:
ClCompile:
  protocolgame.cpp
ResourceCompile:
  All outputs are up-to-date.
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-1_59.lib'

Build FAILED.
 
Last edited:
Yes I'm using fir3element's libs, I think the problem is the other changes I've made on the other cpp files since I was compiling just ok before, but I'll try with boost_1_53_0

edit: dunno if I linked it wrong since I didn't find any include folder in my boost_1_53_0, but I included its libs and still got
Code:
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-1_59.lib'

Build FAILED.
 
Last edited:
then I did everything right, still
Code:
ClCompile:
  All outputs are up-to-date.
ResourceCompile:
  All outputs are up-to-date.
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-1_59.lib'

Build FAILED.
Maybe I did something wrong idk... tomorrow I'll try my original sources changing just that AddPlayerStats from protocolgame.cpp to this guy's and see if it fixes the issue, if it doesn't I'll try breaking the hp and mana limit again from the beggining

edit: well somehow I managed to compile at my vps, some of my linkers should be wrong idk, anyway, it worked! also, I had to use that mix of my code with the one from that guy's sources which I'll be again, leaving here if anyone ever needs. Ty mustafa
Lua:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg)
{
    msg->put<char>(0xA0);
    if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0)
    {
        msg->put<uint16_t>(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH)));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_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<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
        msg->put<uint16_t>(100);
    }
    else
    {
        msg->put<uint16_t>(0);
        msg->put<uint16_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<uint16_t>(player->getStaminaMinutes());
}
 
Last edited:
Back
Top