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

2 BUGs OTclient 7x

willdu

Active Member
Joined
Mar 11, 2017
Messages
91
Reaction score
25
I play 8.6 and 7.4~7.772 on otclient

But in versions 7x i got 2 bugs that dont have on 8.6

Someone could help me to fix it?

1- CAP showing wrong:

Lvl 8 with no items... in my OTclient showing:
4.7 CAP, but i have more
406qqsj.png


When I equip the katana look my cap, get down to 4.39
But katana was 31.00... So the wrong is cap showing, not cap
FnEg74i.png


It happen in all OTs i play 7x (i play 5 ots)

2- Stairs despairs after someone/something get damage or die upside
If i get damaged or attack someone/somecreature upside a stair, this stair simple desapairs...
It's too strange, look i attack this dwarf 2 times and he transform the ladder:
pSXBxjD.png

ofMfUh1.png


But after looking the SQM show me stair:
2iZoQpI.png


Anybody know how to fix this 2 or one of this?
 
1. It is because cap 470.00 oz is displayed as cap dividen by 100 which equals 4.70.
470.00 - 31.00 = 439.00 which is displayed as 4.39 in OTC.
To fix that, easiest way is to multiple free capacity by 100:

modules/game_healthinfo/healthinfo.lua
Code:
function onFreeCapacityChange(player, freeCapacity)
   capLabel:setText(tr('Cap') .. ': ' .. (freeCapacity * 100))
end
 
1. It is because cap 470.00 oz is displayed as cap dividen by 100 which equals 4.70.
470.00 - 31.00 = 439.00 which is displayed as 4.39 in OTC.
To fix that, easiest way is to multiple free capacity by 100:

modules/game_healthinfo/healthinfo.lua
Code:
function onFreeCapacityChange(player, freeCapacity)
   capLabel:setText(tr('Cap') .. ': ' .. (freeCapacity * 100))
end

It's not work to well...
Like i said i got this problem only in servers 7x...
Servers 8x+ there is not this errors

So if i put * 100... It could fix 7x but bug 8x
You know?

I tried to put it:
Code:
function onFreeCapacityChange(player, freeCapacity)
  if(version <= 772) then
    capLabel:setText(tr('Cap') .. ': ' .. (freeCapacity * 100))
  else if(version > 772) then
    capLabel:setText(tr('Cap') .. ': ' .. (freeCapacity))
  end
end

But it's bug.. health/mana bar from my otclient
 
Try this:
Lua:
function onFreeCapacityChange(player, freeCapacity)
    if g_game.getClientVersion() <= 772 then
        capLabel:setText(tr('Cap') .. ': ' .. freeCapacity * 100)
    elseif g_game.getClientVersion() > 772 then
        capLabel:setText(tr('Cap') .. ': ' .. freeCapacity)
    end
end
 
Try this:
Lua:
function onFreeCapacityChange(player, freeCapacity)
    if g_game.getClientVersion() <= 772 then
        capLabel:setText(tr('Cap') .. ': ' .. freeCapacity * 100)
    elseif g_game.getClientVersion() > 772 then
        capLabel:setText(tr('Cap') .. ': ' .. freeCapacity)
    end
end

Thank you it's fix my logic...
But did you know why not showing the right CAP?

For example...
On tibia client i have 147.49
On otclient show a number like 147

Not a double like should be... I tried to set freeCapacity * 100.0 but still the same problem!
 
Because for version < 7.72? OTClient convert normal capacity value to other like 471.7 -> 4.71. And we lost full value, in LUA it's all what we may do (this script). This problem it's possible to full solve only in C++.
Add this problem to github repository (issues). Maybe someone fix it.
Issues · edubart/otclient · GitHub
 
Hello.
This is not a problem with OTClient.
It's a matter of incorrect old code that needs to be improved.

I worked on my engine for a long time.
Maybe some code from my engine will help someone:

In Game::addThing
C++:
                if(item->isSplash()){
                    if(tile->splash){
                        uint8_t oldStackPos = tile->getThingStackPos(tile->splash);
                        Item* oldSplash = tile->splash;

                        oldSplash->isRemoved = true;
                        FreeThing(oldSplash);

                        tile->splash = item;

                        sendUpdateThing(NULL, pos, item, oldStackPos);
                    }
                    else
                    {
                        tile->splash = item;
                        sendAddThing(NULL,pos,tile->splash);
                        updateItemsTile(pos);
                    }
                    needsToAdd = false;
                }
Check also if you have in Tile::addThing:
C++:
            if(item->isSplash()){
                //remove old splash if exists
                ItemVector::iterator it;
                for(it = topItems.begin(); it != topItems.end(); ++it){
                    Item* oldSplash = *it;
                    if(oldSplash->isSplash()){
                        removeThing(oldSplash);
                        oldSplash->releaseThing();
                        break;
                    }
                }
            }
            else
            {
                topItems.push_back(item);
            }

I made a function - updateItemsTile, it's updating items on the tile, not entire tile (without ground).
If you don't know how to write it - you can probably use updateTile.
 
Hello.
This is not a problem with OTClient.
It's a matter of incorrect old code that needs to be improved.

I worked on my engine for a long time.
Maybe some code from my engine will help someone:

In Game::addThing
C++:
                if(item->isSplash()){
                    if(tile->splash){
                        uint8_t oldStackPos = tile->getThingStackPos(tile->splash);
                        Item* oldSplash = tile->splash;

                        oldSplash->isRemoved = true;
                        FreeThing(oldSplash);

                        tile->splash = item;

                        sendUpdateThing(NULL, pos, item, oldStackPos);
                    }
                    else
                    {
                        tile->splash = item;
                        sendAddThing(NULL,pos,tile->splash);
                        updateItemsTile(pos);
                    }
                    needsToAdd = false;
                }
Check also if you have in Tile::addThing:
C++:
            if(item->isSplash()){
                //remove old splash if exists
                ItemVector::iterator it;
                for(it = topItems.begin(); it != topItems.end(); ++it){
                    Item* oldSplash = *it;
                    if(oldSplash->isSplash()){
                        removeThing(oldSplash);
                        oldSplash->releaseThing();
                        break;
                    }
                }
            }
            else
            {
                topItems.push_back(item);
            }

I made a function - updateItemsTile, it's updating items on the tile, not entire tile (without ground).
If you don't know how to write it - you can probably use updateTile.
can you point me out where these should be placed? im facing these error in my distribution, im tried adding lua code into otcv8 but nothig seems to change the cap values are displayed
Post automatically merged:

Thank you it's fix my logic...
But did you know why not showing the right CAP?

For example...
On tibia client i have 147.49
On otclient show a number like 147

Not a double like should be... I tried to set freeCapacity * 100.0 but still the same problem!
did you figured out how to solve this?
 
Last edited:
Back
Top