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

Hover-Mouse Item Information

Is anybody kind enough to share?
If not, I'll understand - no pressure.
 
HGD0jML.png

To make it you have many options.
You can create as many values as you have in item or you can put all into one string in server's protocol, so you're sending it to client.
It would be effective to know when it is worth sending other values than clientID, so have a clear mind and don't send unnecessary information, e.g. for items on the floor.
Then in OTClient you're parsing it, it's a getItem function in OTClient's protocolgameparse.cpp.
Remember that you have to create the same values you're sending or one string, like me (in OTClient's item.cpp of course).
Create then appropriate function to set and get the string or few int values.
The most important will be "get" function because you have to bind the function to lua with
Code:
g_lua.bindClassMemberFunction<Item>
in OTClient's luafunctions.cpp.
Well, the rest is just a simple lua related to the OTClient's tooltip, so everyone can handle it.
 
My sending function looks like this:
Code:
void ProtocolGame::sendItemAttributes(const uint16_t clientId, const ItemAttributesMap& itemAttributesMap)
{
    NetworkMessage_ptr msg = getOutputBuffer();
    if(!msg)
        return;

    TRACK_MESSAGE(msg);

    msg->AddByte(SEND_ITEM_ATTRIBUTES);
    msg->AddU16(clientId);
    msg->AddByte(itemAttributesMap.size());
 
    for(ItemAttributesMap::const_iterator it = itemAttributesMap.begin(); it != itemAttributesMap.end(); ++it)
    {
        msg->AddU16((*it).id);
        if((*it).isString())
        {
            msg->AddByte(SEND_TRUE);
            msg->AddString((*it).getString());
        }
        else if((*it).isNumber())
        {
            msg->AddByte(SEND_FALSE);
            msg->AddU32((*it).getNumber());
        }
    
        msg->AddByte((*it).variableType);
    }
}
 
Back
Top