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

XP rate gain client

Lokizs

New Member
Joined
Sep 21, 2013
Messages
16
Reaction score
3
I'm trying to put the xp rate gain on the client equal to rl, it only stays at "100%" as in the image below:

vlMWPW2.png

I am using this double xp scroll script
dara\actions\scripts\exp.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(1234) >= os.time() then
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You already have double exp!")
        return true
    end
   
    player:setStorageValue(1234, os.time() + 3600)
    Item(item.uid):remove(1)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You've activated Experience Card.") 
    player:getPosition():sendMagicEffect(15)
    return true
end

And player.lua
Code:
    -- exp card
    local BONUS_EXP_STORAGE = 1234
    local BONUS_EXP_MULT = 2
    -- exp card

function Player:onGainExperience(source, exp, rawExp)

     if not source or source:isPlayer() then
         return exp
     end
       
   
    -- 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
I wanted it to be "150%" with stamina bonus,, "300% with stamina bonus + xp srcoll and" 200xp "with xp scroll. Can anyone help me?

OBS: I'm was looking in sources and find this but idk how use it:

Code:
    msg.add<uint16_t>(player->getBaseXpGain()); // base xp gain rate
    msg.add<uint16_t>(player->getVoucherXpBoost()); // xp voucher
    msg.add<uint16_t>(player->getGrindingXpBoost()); // low level bonus
    msg.add<uint16_t>(player->getStoreXpBoost()); // xp boost
    msg.add<uint16_t>(player->getStaminaXpBoost()); // stamina multiplier (100 = 1.0x)
 
Not sure if you can send it at any time or if you need to resend the stats package;
forgottenserver/protocolgame.cpp at f3f6d54e9bc8c205159b82fba43a8a42b05301bd · otland/forgottenserver · GitHub
forgottenserver/protocolgame.cpp at f3f6d54e9bc8c205159b82fba43a8a42b05301bd · otland/forgottenserver · GitHub

If you change those values to ex a storage value where you store the amount of exp boost and send it to the client it should update.
It's from there the client knows what to display;
Flash-News/Communication.as at 49fdc03cdd84e1f559b6f80b55bb14b6588c5ab4 · comedinha/Flash-News · GitHub
 
Back
Top