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

C++ hasMarketAttributes

theduck

Member
Joined
Dec 6, 2018
Messages
246
Reaction score
20
Code:
bool Item::hasMarketAttributes() const
{
    if (attributes == nullptr) {
        return true;
    }

    for (const auto& attr : attributes->getList()) {
        if (attr.type == ITEM_ATTRIBUTE_CHARGES) {
            uint16_t charges = static_cast<uint16_t>(attr.value.integer);
            if (charges != items[id].charges) {
                return false;
            }
        } else if (attr.type == ITEM_ATTRIBUTE_DURATION) {
            uint32_t duration = static_cast<uint32_t>(attr.value.integer);
            if (duration != getDefaultDuration()) {
                return false;
            }
        } else {
            return false;
        }
    }

    if (items[id].imbuingSlots > 0) {
        for (uint8_t slot = 0; slot < items[id].imbuingSlots; slot++) {
            Item* item = const_cast<Item*>(this);
            uint32_t info = item->getImbuement(slot);
            if (info >> 8 != 0) {
                return false;
            }
        }
    }

    return true;
}

I have a problem with items that are having their attributes cleaned up by Imbuement.
the market does not recognize them after they are without the attributes
 
Back
Top