Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yurots high exp stats patch #4

Open
divinity76 opened this issue Feb 20, 2021 · 0 comments
Open

yurots high exp stats patch #4

divinity76 opened this issue Feb 20, 2021 · 0 comments

Comments

@divinity76
Copy link
Owner

divinity76 commented Feb 20, 2021

Tibia 7.6 use int32 for experience (actually the protocol use uint32 but the client use int32), which can only show exp up to level 507.. back in those days, the highest level player on all of Tibia was Setzer Gambler at like lvl 200, iirc.. someone reaching 500+ was unthinkable back then.

lvl <507: show real exp
lvl <5052: show exp/1000
lvl <23445: show exp/100_000
lvl <50510: show exp in millions
lvl < 2000000000: show level as exp
lvl >=2000000000: give up, just show 0 exp 0 lvl (i dont' think the YurOTS engine is capable of reaching lvl 2000000000 anyway...)

in void Protocol76::AddPlayerStats(NetworkMessage &msg,const Player *player)

    const auto level = (player->getPlayerInfo(PLAYERINFO_LEVEL));
    if(level < 507){
        // show real exp
        msg.AddU32(uint32_t(player->getExperience()));
        msg.AddU16(uint16_t(level));
    } else if(level < 5052){
        // show in exp in 1000
        msg.AddU32(uint32_t(player->getExperience()/1000));
        msg.AddU16(uint16_t(level));
    }else if(level < 23445){
        // show in exp in 100_000
        msg.AddU32(uint32_t(player->getExperience()/100000));
        msg.AddU16(uint16_t(level));
    }else if (level < 50510){
        // show exp in millions
        msg.AddU32(uint32_t(player->getExperience()/1000000));
        msg.AddU16(uint16_t(level));
    }else if(level < 2000000000){
        // show level as exp
        msg.AddU32(uint32_t(level));
        msg.AddU16(0);
    }else{
        // above lvl 2000000000 ... give up, just show 0 lvl 0 exp
        msg.AddU32(0);
        msg.addU16(0);
    }
@divinity76 divinity76 changed the title yurots high exp patch yurots high exp stats patch Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant