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

Programmer c++ / display charges for runes (inventory)

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
335
Solutions
13
Reaction score
134
Location
Sweden
You wont need modify client, its otb and cpp edit

What I understood from what he said is that he wants to display the Item Charge text at top right corner. Usually this text is displayed at bottom right corner from the inventory slots. How otb would help it?
 
Try exchange these functions with what I posted below:
C++:
void NetworkMessage::addItem(uint16_t id, uint8_t count)
{
    const ItemType& it = Item::items[id];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(count);
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[count & 7]);
    }
}

void NetworkMessage::addItem(const Item* item)
{
    const ItemType& it = Item::items[item->getID()];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[item->getFluidType() & 7]);
    }
}
 
Try exchange these functions with what I posted below:
C++:
void NetworkMessage::addItem(uint16_t id, uint8_t count)
{
    const ItemType& it = Item::items[id];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(count);
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[count & 7]);
    }
}

void NetworkMessage::addItem(const Item* item)
{
    const ItemType& it = Item::items[item->getID()];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[item->getFluidType() & 7]);
    }
}
i already did that part, i need to display the text in the corner of the rune for charges
 
What client are you using? If it is OTC I can do it
default 8.0 client, and my runes in both dat/otb has stackables unselected as they should, the problem is charges not showing from inventory
 
Last edited:
this is how it looks now
36704

and how i want it to be
jdgGUem.png
 
Yeah, I know they have charges but are not stackables. Try this instead:

C++:
void NetworkMessage::addItem(const Item* item)
{
    const ItemType& it = Item::items[item->getID()];

    add<uint16_t>(it.clientId);

    if (it.stackable) {
        addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
    } else if (it.isRune()) {
        addByte(std::min<uint16_t>(100, item->getSubType()));
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[item->getFluidType() & 7]);
    }
}

And in:
C++:
void Item::serializeAttr(PropWriteStream& propWriteStream) const
Change:
C++:
propWriteStream.write<uint16_t>(charges);
To:
C++:
propWriteStream.write<uint8_t>(charges);
 
Last edited:
Yeah, I know they have charges but are not stackables. Try this instead:

C++:
void NetworkMessage::addItem(const Item* item)
{
    const ItemType& it = Item::items[item->getID()];

    add<uint16_t>(it.clientId);

    if (it.stackable) {
        addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
    } else if (it.isRune()) {
        addByte(std::min<uint16_t>(100, item->getSubType()));
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[item->getFluidType() & 7]);
    }
}

And in:
C++:
void Item::serializeAttr(PropWriteStream& propWriteStream) const
Change:
C++:
propWriteStream.write<uint16_t>(charges);
To:
C++:
propWriteStream.write<uint8_t>(charges);
still not showing
 
Well I'd be a son of a gun. I will get back to you if I can remember how it should be.
 
default 8.0 client, and my runes in both dat/otb has stackables unselected as they should, the problem is charges not showing from inventory
I don't know if Tibia client has the support for that. If not, the only way I think it can be done is by editing the .exe and that's not my area of knowledge. Though if u ever wan't to do it in OTC I can help you with that.
 
I don't know if Tibia client has the support for that. If not, the only way I think it can be done is by editing the .exe and that's not my area of knowledge. Though if u ever wan't to do it in OTC I can help you with that.
this is not something custom that i'm after so a client edit should not be necessary, it's how it was in that version just check the screenshot above.

appreciate it, but as of right now i have no interest in otclient, heh : )
 
this is not something custom that i'm after so a client edit should not be necessary, it's how it was in that version just check the screenshot above.

appreciate it, but as of right now i have no interest in otclient, heh : )
oh lol I thought it was like a paint edit haha. Which tibia version is that?
 
Try exchange these functions with what I posted below:
C++:
void NetworkMessage::addItem(uint16_t id, uint8_t count)
{
    const ItemType& it = Item::items[id];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(count);
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[count & 7]);
    }
}

void NetworkMessage::addItem(const Item* item)
{
    const ItemType& it = Item::items[item->getID()];

    add<uint16_t>(it.clientId);

    if (it.stackable || it.isRune()) {
        addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
    } else if (it.isSplash() || it.isFluidContainer()) {
        addByte(fluidMap[item->getFluidType() & 7]);
    }
}

Causes my client to crash when seeing a rune. 7.7 client
 
8.6 client dont have RUNE flag in dat, I added this feature by client dll.
never said anything about 8.6, also not interested in any client modifications nor otc as that's not the issue here. it's clearly server sided.
 
maybe edit the memory address of the offset for numbers in equipment about stacking ? and move literally every number to top right not just for runes unless you make DLL that works like bot scanning ITEM ID's and then prints it differently with an offset
i get what you mean but i'm just not interested in that "fix", since i'm not a fan of client modifications. i also don't see a reason why i would need to edit the client when the feature is already in it, it's just not being used correctly server side.
 
Back
Top