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

Othire premium bonus exp

https://github.com/TwistedScorpio/OTHire/blob/master/source/player.cpp#L4109
I think you will need to edit this function to add something to be like this:

PHP:
void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)
{
    if(fromMonster || g_config.getNumber(ConfigManager::RATES_FOR_PLAYER_KILLING)){
        gainExp = (uint64_t)std::floor(gainExp * getRateValue(LEVEL_EXPERIENCE));
        
        if (fromMonster) {
            gainExp = (uint64_t)std::floor(gainExp * 1.5);
        }
    }
}

The bonus is 1.5 which means 50% bonus, you can set how much you want(like 1.2 if you want 20% bonus).
The bonus will only work if it has been given by a monster = hunt exp. It won't affect exp added by a script or by killing a player.
 
https://github.com/TwistedScorpio/OTHire/blob/master/source/player.cpp#L4109
I think you will need to edit this function to add something to be like this:

PHP:
void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)
{
    if(fromMonster || g_config.getNumber(ConfigManager::RATES_FOR_PLAYER_KILLING)){
        gainExp = (uint64_t)std::floor(gainExp * getRateValue(LEVEL_EXPERIENCE));
 
        if (fromMonster) {
            gainExp = (uint64_t)std::floor(gainExp * 1.5);
        }
    }
}

The bonus is 1.5 which means 50% bonus, you can set how much you want(like 1.2 if you want 20% bonus).
The bonus will only work if it has been given by a monster = hunt exp. It won't affect exp added by a script or by killing a player.

configmanager.h
find this
Code:
CONTAINER_ITEMS_AUTO_STACK,
place this underneath
Code:
RATE_BONUS_FOR_PREM,

configmanager.cpp
find this
Code:
m_confInteger[CONTAINER_ITEMS_AUTO_STACK] = getGlobalBoolean(L, "container_items_auto_stack", false);
place this underneath
Code:
m_confInteger[RATE_BONUS_FOR_PREM] = getGlobalNumber(L, "rate_bonus_for_prem", 1);

find this
Code:
void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)

replace the entire thing with this
Code:
 void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)
{
    if(fromMonster || g_config.getNumber(ConfigManager::RATES_FOR_PLAYER_KILLING)){
        gainExp = (uint64_t)std::floor(gainExp * getRateValue(LEVEL_EXPERIENCE));
   
        if (fromMonster) {
            uint8_t prembonus = g_config.getNumber(ConfigManager::RATE_BONUS_FOR_PREM);
            float bonus = ((getPremiumDays() > 0) ? (prembonus * 0.1) : 0.0);
            gainExp += (uint64_t)std::floor(gainExp * bonus);
        }
    }
}

place this anywhere in config.lua
Code:
-- 1 equals 10%
rate_bonus_for_prem = 1
 
Last edited:
configmanager.h
find this
Code:
CONTAINER_ITEMS_AUTO_STACK,
place this underneath
Code:
RATE_BONUS_FOR_PREM,

configmanager.cpp
find this
Code:
m_confInteger[CONTAINER_ITEMS_AUTO_STACK] = getGlobalBoolean(L, "container_items_auto_stack", false);
place this underneath
Code:
m_confInteger[RATE_BONUS_FOR_PREM] = getGlobalNumber(L, "rate_bonus_for_prem", 1);

find this
Code:
void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)

replace the entire thing with this
Code:
 void Player::getGainExperience(uint64_t& gainExp, bool fromMonster)
{
    if(fromMonster || g_config.getNumber(ConfigManager::RATES_FOR_PLAYER_KILLING)){
        gainExp = (uint64_t)std::floor(gainExp * getRateValue(LEVEL_EXPERIENCE));
  
        if (fromMonster) {
            uint8_t prembonus = g_config.getNumber(ConfigManager::RATE_BONUS_FOR_PREM);
            float bonus = ((getPremiumDays() > 0) ? (prembonus * 0.1) : 0.0);
            gainExp += (uint64_t)std::floor(gainExp * bonus);
        }
    }
}

place this anywhere in config.lua
Code:
-- 1 equals 10%
rate_bonus_for_prem = 1
Nice, you made it way better to modify(now his don't need anymore to edit the sources every time he wants to change the premium bonus).
 
Back
Top