• 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!

Fix/Patch Party XP Share Fix TFS 1.2

nugo

Australia OT Mapper
Joined
Apr 1, 2009
Messages
396
Solutions
4
Reaction score
194
Hello OTland

If you are using this version of TFS 1.2

you may or may not notice the calculation to determine shared party XP to be incorrect compared to whats displayed on the RL tibia wikia. This issue is fixed in 1.3 but im sure plenty are still on 1.2 and those needing a fix can get it here. Im not exactly sure at what revision it was fixed but its an issue on the 1.2 release for all those with an old datapack.

Find party.cpp

Find
C++:
void Party::shareExperience(uint64_t experience, Creature* source/* = nullptr*/)
{
    uint32_t shareExperience = static_cast<uint64_t>(std::ceil(((static_cast<double>(experience) / (memberList.size() + 1)) + (static_cast<double>(experience) * extraExpRate))));
    for (Player* member : memberList) {
        member->onGainSharedExperience(shareExperience, source);
    }
    leader->onGainSharedExperience(shareExperience, source);
}

and replace with

C++:
void Party::shareExperience(uint64_t experience, Creature* source/* = nullptr*/)
{
    //M = exp S = partyBonus P = party size C = characterStamina (we can ignore C here)
    //(M * S)
    //-------  * C
    //   P
    //(memberList.size() + 1) because the memeber list doesnt have the leader in it

    //old formula: ((static_cast<double>(experience) \ (memberList.size() + 1)) + (static_cast<double>(experience) * extraExpRate))

    uint32_t shareExperience = static_cast<uint64_t>(std::ceil(((static_cast<double>(experience) * (1.00 + extraExpRate) / (memberList.size() + 1)))));

    for (Player* member : memberList) {
        member->onGainSharedExperience(shareExperience, source);
    }
    leader->onGainSharedExperience(shareExperience, source);
}

This will now make your party shared EXP reflect this formula in the wikia Party (https://tibia.fandom.com/wiki/Party). Credits @Far Carder. Confirmed tested and working on my server.

Cheers

Nugo
 
Last edited:
Firstly, thank you for the share!
I replaced the code just as you said, and received an error upon compiling.

'extraExpRate' Undeclared Identifier.

Looks like this may have been addressed here:
 
Last edited:
How it will act if i have premium exp boost and scroll that gives exp boost and server is on exp boost? Wont it glitch the fuck up?
 
Back
Top