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

TFS 1.X+ nekiro tfs 1.5 - exchange the item on the floor for the item in the hand

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
128
Location
Brazil
YouTube
caruniawikibr
possibility to pull the item directly from the ground into the character's hand and exchange the items
would anyone know how to fix this?
 
Solution
@Paulix @dewral @bpm91 I fixed this problem by changing the following code in player.cpp

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder && (dynamic_cast<const DepotChest*>(cylinder) || dynamic_cast<const Player*>(cylinder))) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
    }

to

C++:
    //need an exchange with source? (destination item is swapped with...
I'm also interested in this, looks like you can already swap items if they're inside your backpack, it will probably need to edit sources, it might be something related to cylinders, but I've no idea how to fix
 
@Paulix @dewral @bpm91 I fixed this problem by changing the following code in player.cpp

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder && (dynamic_cast<const DepotChest*>(cylinder) || dynamic_cast<const Player*>(cylinder))) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
    }

to

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
}
 
Last edited:
Solution
@Paulix @dewral @bpm91 I fixed this problem by changing the following code in player.cpp

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder && (dynamic_cast<const DepotChest*>(cylinder) || dynamic_cast<const Player*>(cylinder))) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
    }

to

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
}

@Nekiro I made a PR for this if you want to test it out sometime.
Thank you, it worked :D
 
@Paulix @dewral @bpm91 I fixed this problem by changing the following code in player.cpp

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder && (dynamic_cast<const DepotChest*>(cylinder) || dynamic_cast<const Player*>(cylinder))) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
    }

to

C++:
    //need an exchange with source? (destination item is swapped with currently moved item)
    const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
    if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
        const Cylinder* cylinder = item->getTopParent();
        if (cylinder) {
            return RETURNVALUE_NEEDEXCHANGE;
        }
        return RETURNVALUE_NOTENOUGHROOM;
}

@Nekiro I made a PR for this if you want to test it out sometime.
In interested too, thank you
 
Back
Top