• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Inbox

Il Knight

Veteran OT User
Joined
Dec 1, 2014
Messages
678
Solutions
7
Reaction score
352
Location
Spain
Hello! how i can allow players move items to Inbox (normal inbox) i want to use the Inbox instead of depot.

Imbox.cpp
Code:
Inbox::Inbox(uint16_t type) : Container(type, 30, false, true) {}

ReturnValue Inbox::queryAdd(int32_t, const Thing& thing, uint32_t,
        uint32_t flags, Creature*) const
{
    if (!hasBitSet(FLAG_NOLIMIT, flags)) {
        return RETURNVALUE_CONTAINERNOTENOUGHROOM;
    }

    const Item* item = thing.getItem();
    if (!item) {
        return RETURNVALUE_NOTPOSSIBLE;
    }

    if (item == this) {
        return RETURNVALUE_THISISIMPOSSIBLE;
    }

    if (!item->isPickupable()) {
        return RETURNVALUE_CANNOTPICKUP;
    }

    return RETURNVALUE_NOERROR;
}

void Inbox::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t)
{
    Cylinder* parent = getParent();
    if (parent != nullptr) {
        parent->postAddNotification(thing, oldParent, index, LINK_PARENT);
    }
}

void Inbox::postRemoveNotification(Thing* thing, const Cylinder* newParent, int32_t index, cylinderlink_t)
{
    Cylinder* parent = getParent();
    if (parent != nullptr) {
        parent->postRemoveNotification(thing, newParent, index, LINK_PARENT);
    }
}

Cylinder* Inbox::getParent() const
{
    if (parent) {
        return parent->getParent();
    }
    return nullptr;
}

thanks in advance.
 

Similar threads

Back
Top