• 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.4] Party Share Bonus

secondlife

Member
Joined
Aug 1, 2009
Messages
298
Reaction score
23
Hi guys!

I'm using @Mkalo's party group share experience for tfs 0.4: https://otland.net/threads/is-possible-check-sharing-exp.243688/page-2#post-2366196

My problem is that, i have new vocations (for example: Knight, Elite Knight and Legendary Knight// Druid, Elder Druid, Alchemist etc). I would like to know how i can limit the maximum experience bonus obtained to 100%, because if i put 5 different vocations (Ex: Elite Knight, Elder Druid, Master Sorcerer, Royal Paladin and one Alchemist) in the party (ex: 25% per vocation), the experience gained goes to 125%. I would like to make the maximum bonus at 100%, even if they have more than 4 different vocations in the same party.

Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false};
    if(Party* party = this->getParty()) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    bonus += 0.25;
                    }
            }
        }
    }
    return bonus;
}

Many thanks!
 
Solution
If you installed it as described, then it should still work if your vocations xml is correctly configured and demotions work, because the "getBaseVoc" should recursively follow the demotion chain to the bottom. So Apocalypse Bastard, Spawn of Goku and R63 Thanos 17th knight promotion or whatever is still a knight to that function. Unless you added a lot more chains than default 4 base vocs, it shouldn't really get out of hand.

I'd probably solve this like so if I had that many vocation chains:

C++:
double Player::getPartyBonus() {
    double multiplier = 1;
    double benefit = 0.25;
    bool vocations[] = {
        false, // Rook
        false, false, false, false, false, // Players, maybe new vocation tree?
        false...
Code:
double Player::getPartyBonus() {
    double bonus = 1;
    bool vocations[] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false};
    if(Party* party = this->getParty()) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    if(bonus < 2) {
                        bonus += 0.25;
                    }
                }
            }
        }
    }
    return bonus;
}

Try this
 
If you installed it as described, then it should still work if your vocations xml is correctly configured and demotions work, because the "getBaseVoc" should recursively follow the demotion chain to the bottom. So Apocalypse Bastard, Spawn of Goku and R63 Thanos 17th knight promotion or whatever is still a knight to that function. Unless you added a lot more chains than default 4 base vocs, it shouldn't really get out of hand.

I'd probably solve this like so if I had that many vocation chains:

C++:
double Player::getPartyBonus() {
    double multiplier = 1;
    double benefit = 0.25;
    bool vocations[] = {
        false, // Rook
        false, false, false, false, false, // Players, maybe new vocation tree?
        false, false, false, false, false, // Atomic new baselines at 4th promotion so a plateau of no backsliding?
        false, false, // Convergent Demigod paths?
        false // Something else? Did you create getBaseVoc() correctly? Is your vocations.xml sane?
    };
    if(Party* party = this->getParty()) {
        if(party->isSharedExperienceEnabled() && party->isSharedExperienceActive()) {
            PlayerVector list = party->getMembers();
            list.push_back(party->getLeader());
            for(PlayerVector::const_iterator it = list.begin(); it != list.end(); ++it) {
                uint32_t vocId = (*it)->getBaseVoc();
                if(!vocations[vocId]) {
                    vocations[vocId] = true;
                    multiplier += std::max(benefit, 0.10);
                    benefit += -0.05;
                }
            }
        }
    }
    return multiplier;
}

1 1.25
2 1.45
3 1.60
4 1.70
5 1.80
6 1.90
7 2.00

The previous reply would work if you just want to clamp to 2.0, just change the < 2 to < 1.75
 
Solution
Back
Top