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

Compiling XP Gain Rate (client) TFS 1.2

beenii

Well-Known Member
Joined
Jul 26, 2010
Messages
580
Solutions
1
Reaction score
57
vlMWPW2.png


how add in my sources to work exp gain rate?
 
Code:
msg.add<uint16_t>(100); // base xp gain rate
    msg.add<uint16_t>(0); // xp voucher
    msg.add<uint16_t>(0); // low level bonus
    msg.add<uint16_t>(0); // xp boost
    msg.add<uint16_t>(100); // stamina multiplier (100 = x1.0)

Change 0 to you value.
https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L2835

my sources dont have void ProtocolGame::AddPlayerStats(NetworkMessage& msg)
i try compile function but need add on others files.
have idea how add this function?
 
i have this on: protocolgamebase.cpp

but how get exp of server? for example have in my server, double exp weekend.
 
Change
Code:
msg.add<uint16_t>(100); // base xp gain rate
to
Code:
msg.add<uint16_t>(g_config.getNumber(ConfigManager::RATE_EXPERIENCE)*100); // base xp gain rate
 
In player.lua

Code:
  -- exp card
    local BONUS_EXP_STORAGE = 61398
    local BONUS_EXP_MULT = 1.3
    -- exp card

    local configexp =  {
  ["Monday"] = 1.0,
   ["Tuesday"] = 1.0,
   ["Wednesday"] = 1.0,
   ["Thursday"] = 1.0,
   ["Friday"] = 1.0,
   ["Saturday"] = 2.0,
   ["Sunday"] = 2.0
}


function Player:onGainExperience(source, exp, rawExp)

     if not source or source:isPlayer() then
         return exp
     end
   
     exp = exp * configexp[os.date("%A")]    
   
    -- Soul regeneration
    local vocation = self:getVocation()
    if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
        soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
        self:addCondition(soulCondition)
    end

    -- Apply experience stage multiplier
    exp = exp * Game.getExperienceStage(self:getLevel())
 
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end

   
   -- exp card
 if self:getStorageValue(BONUS_EXP_STORAGE) - os.time() > 0 then
  exp = exp * BONUS_EXP_MULT
 end
    -- exp card

    return exp
end

function Player:onLoseExperience(exp)
    return exp
end


this : exp = exp * configexp[os.date("%A")]
 
It would be great to call
Code:
function Player:onGainExperience
in
Code:
msg.add<uint16_t>(100); // base xp gain rate
 
i compiling for working i need add: PlayerSetStaminaXpBoost() in .lua? etc?
Yep, you need to utilize the 'set' methods you just added to your source code in order to update the value for 'XP Gain Rate'.
 
Yep, you need to utilize the 'set' methods you just added to your source code in order to update the value for 'XP Gain Rate'.

Do you have any examples of how you use it? I understand how to use it, but how would it be more efficient to place them?
 
Back
Top