• 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+ Purse and how to use it properly? Latest TFS 1.3 repo

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
As topic says, how do i:
1. Assign 3 specfic items for example to make it able for the player to put it in and out of the purse.
2. How do i make a check if x or y item is in purse? as purse was removed as a slot, or is the easiest way just to recompile, adding purse as a const_slot?
3. Where do i assign the amount of volume in the purse? as for older TFS 1.3 rep i could manage that in items.xml but it doesnt seem to be like that anymore.

Thanks in advance!
 
Solution
1. you need to mark the item as store item. method: item:setStoreItem(bool storeItem) or mark the item as store item in xml
<attribute key="storeitem" value="true" />
2. simpy by player:getStoreInbox(), its regular container like any other its just virtual
3. you have to edit storeinbox.cpp

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,496
Solutions
113
Reaction score
1,747
1. you need to mark the item as store item. method: item:setStoreItem(bool storeItem) or mark the item as store item in xml
<attribute key="storeitem" value="true" />
2. simpy by player:getStoreInbox(), its regular container like any other its just virtual
3. you have to edit storeinbox.cpp
 
Solution
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
1. you need to mark the item as store item. method: item:setStoreItem(bool storeItem) or mark the item as store item in xml
<attribute key="storeitem" value="true" />
2. simpy by player:getStoreInbox(), its regular container like any other its just virtual
3. you have to edit storeinbox.cpp
Thanks for your repetive help Nekiro, highly appreciated!
 
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
1. you need to mark the item as store item. method: item:setStoreItem(bool storeItem) or mark the item as store item in xml
<attribute key="storeitem" value="true" />
2. simpy by player:getStoreInbox(), its regular container like any other its just virtual
3. you have to edit storeinbox.cpp
When adding the item as storeItem, i can push the item into the container/purse but not out of it, any suggestion?
 

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,496
Solutions
113
Reaction score
1,747
When adding the item as storeItem, i can push the item into the container/purse but not out of it, any suggestion?
Store items cannot be held in other containers than store inbox itself, inbox and depot.
 
OP
OP
Mjmackan

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,234
Solutions
8
Reaction score
111
Location
Sweden
Store items cannot be held in other containers than store inbox itself, inbox and depot.
Something I can do in sources to change this?

I guess change some of these lines might do it?
C++:
ReturnValue StoreInbox::queryAdd(int32_t, const Thing& thing, uint32_t, uint32_t flags, Creature*) const
{
    const Item* item = thing.getItem();
    if (!item) {
        return RETURNVALUE_NOTPOSSIBLE;
    }

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

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

    if (!hasBitSet(FLAG_NOLIMIT, flags)) {
        if (!item->isStoreItem()) {
            return RETURNVALUE_CANNOTMOVEITEMISNOTSTOREITEM;
        }

        const Container* container = item->getContainer();
        if (container && !container->empty()) {
            return RETURNVALUE_ITEMCANNOTBEMOVEDTHERE;
        }
    }

    return RETURNVALUE_NOERROR;
}


Edit:
I solved it, in container.cpp you have this line:

C++:
    // store items can be only moved into depot chest or store inbox
    if (item->isStoreItem() && !dynamic_cast<const DepotChest*>(this)) {
        return RETURNVALUE_ITEMCANNOTBEMOVEDTHERE;
    }
Simply remove it, now you can throw around the item wherever beside on the ground(i dont want that so all good).
 
Last edited:
Top