• 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.X How to change MAX stamina?

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
I would like to limit stamina for 33 hours instead of 42
Also change green stamina from 42-40 to 33-30

How to do it?
I've search on sources and found all of this:

The only thing i change was here:

from:
Code:
#define STAMINA_MAX (42 * 60 * 60 * 1000)

to:
Code:
#define STAMINA_MAX (33 * 60 * 60 * 1000)

And on config.lua
Code:
    rateStaminaLoss = 1 -- lose 1 stamina in 1 stamina hunting
    rateStaminaGain = 3 -- add 1 stamina in 3 minutes off
    rateStaminaThresholdGain = 12
    staminaRatingLimitTop = 30 * 60
    staminaRatingLimitBottom = 14 * 60
    staminaLootLimit = 14 * 60
    rateStaminaAboveNormal = 1.5
    rateStaminaUnderNormal = 0.5
    staminaThresholdOnlyPremium = false

But i got 3 problems

1- stamina not fill full, it looks like this:


2- xp don't change after 30- (without green bonus)

with this stamina i still got the same XP from rats (18)

3- stamina still green forever




What else should i change?
 
Solution
3-
my otc don't have this stuff, it is too old, i gonna update to a new one
what should i use and why?

2-
i've add this 'staminaSystem = true' in my config.lua but rats still giving 15 xp instead of 150
1. Mehah
2.
This:
C++:
bool Player::rateExperience(double& gainExp, bool fromMonster)
{
    if(hasFlag(PlayerFlag_NotGainExperience) || gainExp <= 0)
        return false;

    if(!fromMonster)
        return true;

    gainExp *= rates[SKILL__LEVEL] * g_game.getExperienceStage(level,
        vocation->getExperienceMultiplier());
    if(!hasFlag(PlayerFlag_HasInfiniteStamina))
    {
        int32_t minutes =...
because you use an obsolete system?, lol

do you have a 8.6 server running or are u just repeating what some other forum members says?
this was officially made by 8.6, it is not a conversion with other bugs, i got 400 hours of uptime by running with this...
different from last year when i try to run a conversion of 1x
i would love to use 1x, but there are no official support, i'll have to put a lot of work to convert the scripts and can got a bad experience as i had in the past

but a config that was there should stop to work just because old?

---

thank you for your big help here
but it is not about the topic, so back to whats matter...


do i understanding something wrong in config.lua?

rateStaminaLoss = 1
each 1 min hunting loss 1 min of stamina
rateStaminaGain = 3
each 3 min off gain 1 min of stamina


rateStaminaThresholdGain = 12
what is it?


colors are change here \/ ? or they are change in somewhere else?
staminaRatingLimitTop = 30 * 60
is this the green stamina? 30+ = green stamina + bonus exp
staminaRatingLimitBottom = 14 * 60
is this when orange stamina ends and go to the red?



staminaLootLimit = 14 * 60
this is when stop to drop loot right?

rateStaminaAboveNormal = 1.5
bonus exp when staminaRatingLimitTop
rateStaminaUnderNormal = 0.5

debuff exp when staminaRatingLimitBottom

staminaThresholdOnlyPremium = false

only premium recive the rateStaminaAboveNormal bonus
 
Last edited:
what do you mean?


no you don't because of compat.lua file

it was not made for 8.6 servers, years ago when i test i had to use a conversion
u mean this: Making migration from 0.4 to 1.x easier · Issue #3111 · otland/forgottenserver (https://github.com/otland/forgottenserver/issues/3111?)
i'll test this 1x again

but back about the topic, i have only 2 stuff to finish my 0.4 server so i can test 1x with no incomplete stuffs on the server

-

my server is 3x, i was killing rats with:
rateStaminaLoss = 200
rateStaminaGain = 6
rateStaminaThresholdGain = 12
staminaRatingLimitTop = 30 * 60
staminaRatingLimitBottom = 14 * 60
staminaLootLimit = 14 * 60
rateStaminaAboveNormal = 10.0
rateStaminaUnderNormal = 0.5
staminaThresholdOnlyPremium = false

why green stamina bonus is not working?
it should be only until 30
why monster exp don't change?
rats is giving 18 of exp with stamina 33-30, 30-15... it not change...

14- of stamina it is giving 9 of exp so debuff is working, buff isn't

what is it:
rateStaminaThresholdGain = 12



is anybody got any idea how to solve this problem?
 
Last edited:
this is so important to me, idk how to do :(
luascript.cpp
C++:
        player->staminaMinutes = std::min<uint16_t>(2520, stamina);
to
C++:
        player->staminaMinutes = std::min<uint16_t>(1980, stamina);

player.h
C++:
        uint16_t staminaMinutes = 2520;
to
C++:
        uint16_t staminaMinutes = 1980;

Anyway i check it on 1.2, i hope you use notepad++, then ctrl+f, find in files and search for 2520, its 42 hours in minutes. Then u will find code for stamina to edit.
 
luascript.cpp
C++:
        player->staminaMinutes = std::min<uint16_t>(2520, stamina);
to
C++:
        player->staminaMinutes = std::min<uint16_t>(1980, stamina);

player.h
C++:
        uint16_t staminaMinutes = 2520;
to
C++:
        uint16_t staminaMinutes = 1980;

Anyway i check it on 1.2, i hope you use notepad++, then ctrl+f, find in files and search for 2520, its 42 hours in minutes. Then u will find code for stamina to edit.

Oh thank you man, i want this so much...

But i didn't find both...
on

There isn't a lot about stamina on the sources:
 
Oh thank you man, i want this so much...

But i didn't find both...
on

There isn't a lot about stamina on the sources:
player.h
Change this:
C++:
#define STAMINA_MAX (42 * 60 * 60 * 1000)
To this:
C++:
#define STAMINA_MAX (33 * 60 * 60 * 1000)

databasemanager.cpp
Change this:
C++:
        case 11:
        {
            std::clog << "> Updating database to version: 12..." << std::endl;
            db->query("UPDATE `players` SET `stamina` = 151200000 WHERE `stamina` > 151200000;");
            db->query("UPDATE `players` SET `loss_experience` = `loss_experience` * 10, `loss_mana` = `loss_mana` * 10, `loss_skills` = `loss_skills` * 10, `loss_items` = `loss_items` * 10;");
            switch(db->getDatabaseEngine())
            {
                case DATABASE_ENGINE_MYSQL:
                {
                    std::string queryList[] = {
                        "ALTER TABLE `players` CHANGE `stamina` `stamina` INT NOT NULL DEFAULT 151200000;",
                        "ALTER TABLE `players` CHANGE `loss_experience` `loss_experience` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_mana` `loss_mana` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_skills` `loss_skills` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_items` `loss_items` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` ADD `loss_containers` INT NOT NULL DEFAULT 100 AFTER `loss_skills`;"
                    };
                    for(uint32_t i = 0; i < sizeof(queryList) / sizeof(std::string); i++)
                        db->query(queryList[i]);

                    break;
                }

                case DATABASE_ENGINE_SQLITE:
                default:
                {
                    //TODO
                    break;
                }
            }

            registerDatabaseConfig("db_version", 12);
            return 12;
        }

To this:
C++:
        case 11:
        {
            std::clog << "> Updating database to version: 12..." << std::endl;
            db->query("UPDATE `players` SET `stamina` = 11880000 WHERE `stamina` > 11880000;");
            db->query("UPDATE `players` SET `loss_experience` = `loss_experience` * 10, `loss_mana` = `loss_mana` * 10, `loss_skills` = `loss_skills` * 10, `loss_items` = `loss_items` * 10;");
            switch(db->getDatabaseEngine())
            {
                case DATABASE_ENGINE_MYSQL:
                {
                    std::string queryList[] = {
                        "ALTER TABLE `players` CHANGE `stamina` `stamina` INT NOT NULL DEFAULT 11880000;",
                        "ALTER TABLE `players` CHANGE `loss_experience` `loss_experience` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_mana` `loss_mana` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_skills` `loss_skills` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_items` `loss_items` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` ADD `loss_containers` INT NOT NULL DEFAULT 100 AFTER `loss_skills`;"
                    };
                    for(uint32_t i = 0; i < sizeof(queryList) / sizeof(std::string); i++)
                        db->query(queryList[i]);

                    break;
                }

                case DATABASE_ENGINE_SQLITE:
                default:
                {
                    //TODO
                    break;
                }
            }

            registerDatabaseConfig("db_version", 12);
            return 12;
        }

configmanager.cpp

Change this:
Code:
    m_confNumber[STAMINA_LIMIT_TOP] = getGlobalNumber("staminaRatingLimitTop", 41 * 60);
    m_confNumber[STAMINA_LIMIT_BOTTOM] = getGlobalNumber("staminaRatingLimitBottom", 14 * 60);

To this:
Code:
    m_confNumber[STAMINA_LIMIT_TOP] = getGlobalNumber("staminaRatingLimitTop", 32 * 60);
    m_confNumber[STAMINA_LIMIT_BOTTOM] = getGlobalNumber("staminaRatingLimitBottom", 14 * 60);

And try test it by creating new character
 
Last edited:
player.h
Change this:
C++:
#define STAMINA_MAX (42 * 60 * 60 * 1000)
To this:
C++:
#define STAMINA_MAX (33 * 60 * 60 * 1000)

databasemanager.cpp
Change this:
C++:
        case 11:
        {
            std::clog << "> Updating database to version: 12..." << std::endl;
            db->query("UPDATE `players` SET `stamina` = 151200000 WHERE `stamina` > 151200000;");
            db->query("UPDATE `players` SET `loss_experience` = `loss_experience` * 10, `loss_mana` = `loss_mana` * 10, `loss_skills` = `loss_skills` * 10, `loss_items` = `loss_items` * 10;");
            switch(db->getDatabaseEngine())
            {
                case DATABASE_ENGINE_MYSQL:
                {
                    std::string queryList[] = {
                        "ALTER TABLE `players` CHANGE `stamina` `stamina` INT NOT NULL DEFAULT 151200000;",
                        "ALTER TABLE `players` CHANGE `loss_experience` `loss_experience` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_mana` `loss_mana` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_skills` `loss_skills` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_items` `loss_items` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` ADD `loss_containers` INT NOT NULL DEFAULT 100 AFTER `loss_skills`;"
                    };
                    for(uint32_t i = 0; i < sizeof(queryList) / sizeof(std::string); i++)
                        db->query(queryList[i]);

                    break;
                }

                case DATABASE_ENGINE_SQLITE:
                default:
                {
                    //TODO
                    break;
                }
            }

            registerDatabaseConfig("db_version", 12);
            return 12;
        }

To this:
C++:
        case 11:
        {
            std::clog << "> Updating database to version: 12..." << std::endl;
            db->query("UPDATE `players` SET `stamina` = 11880000 WHERE `stamina` > 11880000;");
            db->query("UPDATE `players` SET `loss_experience` = `loss_experience` * 10, `loss_mana` = `loss_mana` * 10, `loss_skills` = `loss_skills` * 10, `loss_items` = `loss_items` * 10;");
            switch(db->getDatabaseEngine())
            {
                case DATABASE_ENGINE_MYSQL:
                {
                    std::string queryList[] = {
                        "ALTER TABLE `players` CHANGE `stamina` `stamina` INT NOT NULL DEFAULT 11880000;",
                        "ALTER TABLE `players` CHANGE `loss_experience` `loss_experience` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_mana` `loss_mana` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_skills` `loss_skills` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` CHANGE `loss_items` `loss_items` INT NOT NULL DEFAULT 100;",
                        "ALTER TABLE `players` ADD `loss_containers` INT NOT NULL DEFAULT 100 AFTER `loss_skills`;"
                    };
                    for(uint32_t i = 0; i < sizeof(queryList) / sizeof(std::string); i++)
                        db->query(queryList[i]);

                    break;
                }

                case DATABASE_ENGINE_SQLITE:
                default:
                {
                    //TODO
                    break;
                }
            }

            registerDatabaseConfig("db_version", 12);
            return 12;
        }

configmanager.cpp

Change this:
Code:
    m_confNumber[STAMINA_LIMIT_TOP] = getGlobalNumber("staminaRatingLimitTop", 41 * 60);
    m_confNumber[STAMINA_LIMIT_BOTTOM] = getGlobalNumber("staminaRatingLimitBottom", 14 * 60);

To this:
Code:
    m_confNumber[STAMINA_LIMIT_TOP] = getGlobalNumber("staminaRatingLimitTop", 32 * 60);
    m_confNumber[STAMINA_LIMIT_BOTTOM] = getGlobalNumber("staminaRatingLimitBottom", 14 * 60);

And try test it by creating new character



with your sources changes, a make clean, a new make
then an new character created

with this config.lua
Code:
    rateStaminaLoss = 200
    rateStaminaGain = 6
    rateStaminaThresholdGain = 12
    staminaRatingLimitTop = 30 * 60
    staminaRatingLimitBottom = 14 * 60
    staminaLootLimit = 14 * 60
    rateStaminaAboveNormal = 10.0
    rateStaminaUnderNormal = 0.5
    staminaThresholdOnlyPremium = false

the thing that change was i don't need to use this script when create characters to set 33 stamina (on first items script):
Code:
        -- local fullstamina = 33 * 60 * 1000
        -- setPlayerStamina(cid, fullstamina)


but in game testing

exp recived:
Code:
33-14 stamina
rats gave 18 xp (3x rates)

13:59-00:01 stamina
rats gave 9 xp (3x rates)

stamina bar colors:
Code:
otclient 33:00 stamina starts green and go until 14:00

Code:
tibia client 33:00 stamina starts orange and go orange until 14:00, 13:59 change to red
 
1. Bar is fixed now? 33 hours is max?
staminaRatingLimitTop = 30 * 60, its when green end. At 30 hours start being orange.
staminaRatingLimitBottom = 14 * 60, bellow 14 hours start being red
2.
As i see, Rat give 6 EXP then
rateStaminaAboveNormal = 10.0 - Green Stamina multiple
Orange stamina = 100% with 3x is 18 EXP
rateStaminaUnderNormal = 0.5 This is exp on red stamina, and calculate is (6*3)/2=9
So everything work? :D

And OTClient
modules/game_skills/skills.lua
Change
Lua:
function onStaminaChange(localPlayer, stamina)
  local hours = math.floor(stamina / 60)
  local minutes = stamina
  if minutes < 10 then
    minutes = minutes
  end
  local percent = math.floor(100 * stamina / (42 * 60)) -- max is 42 hours

  setSkillValue('stamina', comma_value(minutes))
  setSkillPercent('stamina', percent, tr('You have %s percent', percent))
end

To

Lua:
function onStaminaChange(localPlayer, stamina)
  local hours = math.floor(stamina / 60)
  local minutes = stamina
  if minutes < 10 then
    minutes = minutes
  end
  local percent = math.floor(100 * stamina / (33 * 60)) -- max is 33 hours

  setSkillValue('stamina', comma_value(minutes))
  setSkillPercent('stamina', percent, tr('You have %s percent', percent))
end

:)
 
1. Bar is fixed now? 33 hours is max?
staminaRatingLimitTop = 30 * 60, its when green end. At 30 hours start being orange.
staminaRatingLimitBottom = 14 * 60, bellow 14 hours start being red
2.
As i see, Rat give 6 EXP then
rateStaminaAboveNormal = 10.0 - Green Stamina multiple
Orange stamina = 100% with 3x is 18 EXP
rateStaminaUnderNormal = 0.5 This is exp on red stamina, and calculate is (6*3)/2=9
So everything work? :D

And OTClient
modules/game_skills/skills.lua
Change
Lua:
function onStaminaChange(localPlayer, stamina)
  local hours = math.floor(stamina / 60)
  local minutes = stamina
  if minutes < 10 then
    minutes = minutes
  end
  local percent = math.floor(100 * stamina / (42 * 60)) -- max is 42 hours

  setSkillValue('stamina', comma_value(minutes))
  setSkillPercent('stamina', percent, tr('You have %s percent', percent))
end

To

Lua:
function onStaminaChange(localPlayer, stamina)
  local hours = math.floor(stamina / 60)
  local minutes = stamina
  if minutes < 10 then
    minutes = minutes
  end
  local percent = math.floor(100 * stamina / (33 * 60)) -- max is 33 hours

  setSkillValue('stamina', comma_value(minutes))
  setSkillPercent('stamina', percent, tr('You have %s percent', percent))
end

:)

1- now players are starting with 33 stamina, this looks working

2- idk why it is not working
looks like exp bonus buff is not working (the debuff is working, after 13:59 it decresse the exp to 0.5)

rats add 5 exp on kill
Code:
<monster name="Rat" nameDescription="a rat" race="blood" experience="5" speed="135" manacost="200">
this 18 is from some creaturescript i had, i turned off that...

but anyways the main problem is when 33-30 stamina rats shouldn't gave 10X more?
i mean, instead of 15, shouldn't add 150?
because of 'rateStaminaAboveNormal = 10.0'
but it is always giving 15...

3- now with this change on OTC 33:00 stamina looks like full stamina (full bar)
but the colors problems still there
there is no orange and red stamina, it is green from 33:00 to 00:00
(this is the small problem)
 
1- now players are starting with 33 stamina, this looks working

2- idk why it is not working
looks like exp bonus buff is not working (the debuff is working, after 13:59 it decresse the exp to 0.5)

rats add 5 exp on kill
Code:
<monster name="Rat" nameDescription="a rat" race="blood" experience="5" speed="135" manacost="200">
this 18 is from some creaturescript i had, i turned off that...

but anyways the main problem is when 33-30 stamina rats shouldn't gave 10X more?
i mean, instead of 15, shouldn't add 150?
because of 'rateStaminaAboveNormal = 10.0'
but it is always giving 15...

3- now with this change on OTC 33:00 stamina looks like full stamina (full bar)
but the colors problems still there
there is no orange and red stamina, it is green from 33:00 to 00:00
(this is the small problem)
Sorry, i have already total custom client and dont have little stuff for "basic tibia", i check basic OTclient files and u must also change
This:
Lua:
  --TODO not all client versions have premium time
  if stamina > 2400 and g_game.getClientVersion() >= 1038 and localPlayer:isPremium() then
      local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("Now you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina > 2400 and g_game.getClientVersion() >= 1038 and not localPlayer:isPremium() then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("You will not gain 50%% more experience because you aren't premium player, now you receive only 1x experience points")
        setSkillPercent('stamina', percent, text, '#89F013')
    elseif stamina > 2400 and g_game.getClientVersion() < 1038 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("If you are premium player, you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina <= 2400 and stamina > 840 then
        setSkillPercent('stamina', percent, tr("You have %s hours and %s minutes left", hours, minutes), 'orange')
    elseif stamina <= 840 and stamina > 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You gain only 50%% experience and you don't may gain loot from monsters")
        setSkillPercent('stamina', percent, text, 'red')
    elseif stamina == 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You don't may receive experience and loot from monsters")
        setSkillPercent('stamina', percent, text, 'black')
    end
end
to this:
Lua:
  --TODO not all client versions have premium time
  if stamina > 1800 and g_game.getClientVersion() >= 1038 and localPlayer:isPremium() then
      local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("Now you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina > 1800 and g_game.getClientVersion() >= 1038 and not localPlayer:isPremium() then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("You will not gain 50%% more experience because you aren't premium player, now you receive only 1x experience points")
        setSkillPercent('stamina', percent, text, '#89F013')
    elseif stamina > 1800 and g_game.getClientVersion() < 1038 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("If you are premium player, you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina <= 1800 and stamina > 840 then
        setSkillPercent('stamina', percent, tr("You have %s hours and %s minutes left", hours, minutes), 'orange')
    elseif stamina <= 840 and stamina > 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You gain only 50%% experience and you don't may gain loot from monsters")
        setSkillPercent('stamina', percent, text, 'red')
    elseif stamina == 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You don't may receive experience and loot from monsters")
        setSkillPercent('stamina', percent, text, 'black')
    end
end

And in config.lua check for sure you have enebale
staminaSystem = true
 
Sorry, i have already total custom client and dont have little stuff for "basic tibia", i check basic OTclient files and u must also change
This:
Lua:
  --TODO not all client versions have premium time
  if stamina > 2400 and g_game.getClientVersion() >= 1038 and localPlayer:isPremium() then
      local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("Now you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina > 2400 and g_game.getClientVersion() >= 1038 and not localPlayer:isPremium() then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("You will not gain 50%% more experience because you aren't premium player, now you receive only 1x experience points")
        setSkillPercent('stamina', percent, text, '#89F013')
    elseif stamina > 2400 and g_game.getClientVersion() < 1038 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("If you are premium player, you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina <= 2400 and stamina > 840 then
        setSkillPercent('stamina', percent, tr("You have %s hours and %s minutes left", hours, minutes), 'orange')
    elseif stamina <= 840 and stamina > 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You gain only 50%% experience and you don't may gain loot from monsters")
        setSkillPercent('stamina', percent, text, 'red')
    elseif stamina == 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You don't may receive experience and loot from monsters")
        setSkillPercent('stamina', percent, text, 'black')
    end
end
to this:
Lua:
  --TODO not all client versions have premium time
  if stamina > 1800 and g_game.getClientVersion() >= 1038 and localPlayer:isPremium() then
      local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("Now you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina > 1800 and g_game.getClientVersion() >= 1038 and not localPlayer:isPremium() then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("You will not gain 50%% more experience because you aren't premium player, now you receive only 1x experience points")
        setSkillPercent('stamina', percent, text, '#89F013')
    elseif stamina > 1800 and g_game.getClientVersion() < 1038 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. '\n' ..
        tr("If you are premium player, you will gain 50%% more experience")
        setSkillPercent('stamina', percent, text, 'green')
    elseif stamina <= 1800 and stamina > 840 then
        setSkillPercent('stamina', percent, tr("You have %s hours and %s minutes left", hours, minutes), 'orange')
    elseif stamina <= 840 and stamina > 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You gain only 50%% experience and you don't may gain loot from monsters")
        setSkillPercent('stamina', percent, text, 'red')
    elseif stamina == 0 then
        local text = tr("You have %s hours and %s minutes left", hours, minutes) .. "\n" ..
        tr("You don't may receive experience and loot from monsters")
        setSkillPercent('stamina', percent, text, 'black')
    end
end

And in config.lua check for sure you have enebale
staminaSystem = true

3-
my otc don't have this stuff, it is too old, i gonna update to a new one
what should i use and why?

2-
i've add this 'staminaSystem = true' in my config.lua but rats still giving 15 xp instead of 150
 
3-
my otc don't have this stuff, it is too old, i gonna update to a new one
what should i use and why?

2-
i've add this 'staminaSystem = true' in my config.lua but rats still giving 15 xp instead of 150
1. Mehah
2.
This:
C++:
bool Player::rateExperience(double& gainExp, bool fromMonster)
{
    if(hasFlag(PlayerFlag_NotGainExperience) || gainExp <= 0)
        return false;

    if(!fromMonster)
        return true;

    gainExp *= rates[SKILL__LEVEL] * g_game.getExperienceStage(level,
        vocation->getExperienceMultiplier());
    if(!hasFlag(PlayerFlag_HasInfiniteStamina))
    {
        int32_t minutes = getStaminaMinutes();
        if(minutes >= g_config.getNumber(ConfigManager::STAMINA_LIMIT_TOP))
        {
            if(isPremium() || !g_config.getNumber(ConfigManager::STAMINA_BONUS_PREMIUM))
                gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_ABOVE);
        }
        else if(minutes < (g_config.getNumber(ConfigManager::STAMINA_LIMIT_BOTTOM)) && minutes > 0)
            gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_UNDER);
        else if(minutes <= 0)
            gainExp = 0;
    }
    else if(isPremium() || !g_config.getNumber(ConfigManager::STAMINA_BONUS_PREMIUM))
        gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_ABOVE);

    return true;
}
To this:
C++:
bool Player::rateExperience(double& gainExp, bool fromMonster)
{
    if(hasFlag(PlayerFlag_NotGainExperience) || gainExp <= 0)
        return false;

    if(!fromMonster)
        return true;

    gainExp *= rates[SKILL__LEVEL] * g_game.getExperienceStage(level,
        vocation->getExperienceMultiplier());
    if(!hasFlag(PlayerFlag_HasInfiniteStamina))
    {
        int32_t minutes = getStaminaMinutes();
        if(minutes >= g_config.getNumber(ConfigManager::STAMINA_LIMIT_TOP))
        {
            if(g_config.getNumber(ConfigManager::STAMINA_BONUS_PREMIUM))
                gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_ABOVE);
        }
        else if(minutes < (g_config.getNumber(ConfigManager::STAMINA_LIMIT_BOTTOM)) && minutes > 0)
            gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_UNDER);
        else if(minutes <= 0)
            gainExp = 0;
    }
    else(g_config.getNumber(ConfigManager::STAMINA_BONUS_PREMIUM))
        gainExp *= g_config.getDouble(ConfigManager::RATE_STAMINA_ABOVE);

    return true;
}
 
Solution
Back
Top