Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,421
- Solutions
- 68
- Reaction score
- 1,074
How can I do this?
This is what I have so far
Server Side: void NetworkMessage::addItem(const Item* item)
Client Side: ItemPtr ProtocolGame::getItem(const InputMessagePtr& msg, int id, bool hasDescription)
When I call getCustomAttribute(key) client side it shows the -1 value for all of them. I just need to know how to get an items custom attribute value.
This is what I have so far
Server Side: void NetworkMessage::addItem(const Item* item)
C++:
// Send custom attributes to client.
Item* tmpItem = item->clone();
add<uint16_t>(CUSTOM_ATTR_LAST - 1); // Send size of custom attributes
for (uint16_t key = CUSTOM_ATTR_RARITY; key < CUSTOM_ATTR_LAST; key++) {
add<uint16_t>(key); // Send key
add<uint64_t>(0); // Send default value
}
delete tmpItem;
Client Side: ItemPtr ProtocolGame::getItem(const InputMessagePtr& msg, int id, bool hasDescription)
C++:
if (g_game.getFeature(Otc::GameItemCustomAttributes)) {
uint16 size = msg->getU16();
for (uint16 i = 0; i < size; ++i) {
uint16 key = msg->getU16();
int64 value = msg->getI64();
item->setCustomAttribute(key, value);
}
}
When I call getCustomAttribute(key) client side it shows the -1 value for all of them. I just need to know how to get an items custom attribute value.
Last edited: