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

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
What client are you using? If it is OTC I can do it
 

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
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?
 

ond

Legendary OT User
Joined
Mar 24, 2008
Messages
2,683
Reaction score
405
Location
Sweden
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]);
    }
}
 
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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
 
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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:
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
this is how it looks now
36704

and how i want it to be
 

ond

Legendary OT User
Joined
Mar 24, 2008
Messages
2,683
Reaction score
405
Location
Sweden
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:
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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
 

ond

Legendary OT User
Joined
Mar 24, 2008
Messages
2,683
Reaction score
405
Location
Sweden
Well I'd be a son of a gun. I will get back to you if I can remember how it should be.
 

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
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.
 
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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 : )
 

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
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?
 

pink_panther

Member
Joined
Sep 10, 2016
Messages
90
Reaction score
17
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
 

Qbazzz

Pół człowiek, pół litra
Joined
Jul 3, 2009
Messages
82
Reaction score
44
Location
inside the box
8.6 client dont have RUNE flag in dat, I added this feature by client dll.
 
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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.
 
OP
emil92b

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
161
Reaction score
23
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.
 
Top