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

Cap Bug - OTCv8 7.72 Protocol

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,404
Solutions
17
Reaction score
152
Location
Brazil
How to fix CAP shown in OTCv8? The displayed value is divided by 100, it does not show the player's actual CAP. Using protocol 7.72.

1642817874724.png
Post automatically merged:

Tried this but not work:

 
Last edited:
You should post in the support section
PS: Why grep if you can get mocked on the forum? ¯\(ツ)
 
Gesior.pl helped me to fix on inventory. Anyone can help me to fix on skill tab?

View attachment 64973
I think he wasted his time if you cannot figure it out by now, because you have to do the same thing there.
Also, you should be aware by now that your thread name is wrong too, the issue is your engine, not the client.
 
Last edited:
@potinho modules/game_skills/skills.lua

Change
Code:
function onFreeCapacityChange(localPlayer, freeCapacity)
  setSkillValue('capacity', (freeCapacity))
  checkAlert('capacity', freeCapacity, localPlayer:getTotalCapacity(), 20)
end

To
Code:
function onFreeCapacityChange(localPlayer, freeCapacity)
  setSkillValue('capacity', (freeCapacity*100))
  checkAlert('capacity', freeCapacity, localPlayer:getTotalCapacity(), 20)
end
 
Here fixed for both files, are working for me.

Lua:
function onFreeCapacityChange(player, freeCapacity)
  if not freeCapacity then return end
  -- if freeCapacity > 99 then
  --   freeCapacity = math.floor(freeCapacity * 10) / 10
  -- end
  if freeCapacity > 999 then
    freeCapacity = math.floor(freeCapacity)
  end
  if freeCapacity > 99999 then
    freeCapacity = math.min(9999, math.floor(freeCapacity/1000)) .. "k"
  end
  capLabel:setText(tr('Cap') .. ':\n' .. (freeCapacity * 100))
end

Lua:
function onFreeCapacityChange(localPlayer, freeCapacity)
  setSkillValue('capacity', (freeCapacity * 100))
  checkAlert('capacity', freeCapacity, localPlayer:getTotalCapacity(), 20)
end

function onTotalCapacityChange(localPlayer, totalCapacity)
  checkAlert('capacity', localPlayer:getFreeCapacity(), totalCapacity, 20)
end
 
Here fixed for both files, are working for me.

Lua:
function onFreeCapacityChange(player, freeCapacity)
  if not freeCapacity then return end
  -- if freeCapacity > 99 then
  --   freeCapacity = math.floor(freeCapacity * 10) / 10
  -- end
  if freeCapacity > 999 then
    freeCapacity = math.floor(freeCapacity)
  end
  if freeCapacity > 99999 then
    freeCapacity = math.min(9999, math.floor(freeCapacity/1000)) .. "k"
  end
  capLabel:setText(tr('Cap') .. ':\n' .. (freeCapacity * 100))
end

Lua:
function onFreeCapacityChange(localPlayer, freeCapacity)
  setSkillValue('capacity', (freeCapacity * 100))
  checkAlert('capacity', freeCapacity, localPlayer:getTotalCapacity(), 20)
end

function onTotalCapacityChange(localPlayer, totalCapacity)
  checkAlert('capacity', localPlayer:getFreeCapacity(), totalCapacity, 20)
end
Why are you making him look like an idiot?
There is already 3 answers about that in this thread. He will never learn anything if You give Him copy paste code.
 
Did You even open inventory.lua?
(freeCapacity*100)

haha, you're right man. But I've already tried several formulas. * 100, *10, /10... change the count logic... that's why I asked for the code to see if it was something different.
Mine displays the following behavior.
If the freecap is greater than 1k, it simply fails, showing random values. for example, freecap = 2500, it is shown in the client 700~.

I believe it may be due to communication with the server, Opcode or something like that.
 
haha, you're right man. But I've already tried several formulas. * 100, *10, /10... change the count logic... that's why I asked for the code to see if it was something different.
Mine displays the following behavior.
If the freecap is greater than 1k, it simply fails, showing random values. for example, freecap = 2500, it is shown in the client 700~.

I believe it may be due to communication with the server, Opcode or something like that.
You could use ctrl+t in otclient and see if there's any errors coming up.
 
And You are all big programmers i see 10 people wasting space in the thread for something that would take 3 seconds to post answer this behaviour disgusts me its exactly what i ment about gatekeeping community share your knowledge you are old and gonna die soon there is nobody to speak to in the afterlife about tibia.
Why are you even on this forum just to complain?
You should be happy there is anybody still at this dead hobby.
Post automatically merged:

multiply by 100?
You should post in the support section
PS: Why grep if you can get mocked on the forum? ¯\(ツ)
I think he wasted his time if you cannot figure it out by now, because you have to do the same thing there.
Also, you should be aware by now that your thread name is wrong too, the issue is your engine, not the client.
Thank god you didnt request removal of those posts so we can see who you really are cant even handle 3 lines of code but write 10 of complaints and empty answers for people who do not need to know everything everywhere in spaghetti code.

The same egoistic people will tell those people learn and when those people come up with new feature these big programmers will steal it and rewrite their own way within a day.

Ego ego ego ego ego.

No new people no innovation it has been proved many times none of you are able to think of one cool feature by yourself you need € to think.
Joking Joe Biden GIF by The Democrats
 
Last edited:
And You are all big programmers i see 10 people wasting space in the thread for something that would take 3 seconds to post answer this behaviour disgusts me its exactly what i ment about gatekeeping community share your knowledge you are old and gonna die soon there is nobody to speak to in the afterlife about tibia.
... ??? Expensive beauty. but that's not the point.
look my case, this formulas dont work.

edit:
i found my error, is the packet send by server side.
i edit here:
Lua:
void ProtocolGame::AddPlayerStats(NetworkMessage& msg)
{
    msg.addByte(0xA0);

    msg.add<uint16_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<uint16_t>::max()));
    msg.add<uint16_t>(std::min<int32_t>(player->getMaxHealth(), std::numeric_limits<uint16_t>::max()));
 
    //msg.add<uint16_t>(player->getFreeCapacity());
    msg.add<uint16_t>(player->getFreeCapacity() / 100); <------

and on client side I left that:
Code:
function onFreeCapacityChange(player, freeCapacity)
  if not freeCapacity then return end
  local freeCapacity = freeCapacity * 100
  --if freeCapacity > 99 then
   -- freeCapacity = math.floor(freeCapacity * 10) / 10
  --end
  --if freeCapacity > 999 then
  --  freeCapacity = math.floor(freeCapacity)
  --end
  if freeCapacity > 9999 then
    freeCapacity = math.min(9999, math.floor(freeCapacity/1000)) .. "k"
  end
  capLabel:setText(tr('Cap') .. ':\n' .. freeCapacity)
end

working fine now.
 

Attachments

Last edited:
Back
Top