• 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] Global depots 10.9+

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
131
Location
Unknown
Has someone already figure out how to make global depots work on TFS 1.x? I'm not asking for a full code but maybe if you know something and would like to share a small part of the code or give ideas.

kInCL1i.png

Code:
A global depot with 17 city-specific boxes accessible from every individual depot will be implemented
    Each Depot Chest will contain 17 Depot Boxes which each correspond to a different city's depot. You can open all of them from any Depot. This also applies to Depot Chests found in Guildhalls.
    The depot, as in all 17 Depot Boxes, can store a combined total of 2,000 items (Free Accounts) or up to 10,000 items (Premium Accounts).
    Travora will exist solely as a platform to facilitate Character World Transfers. The depot on the island is to be removed, but the depot itself will exist in every other town as Depot Box XIII.
Took from tibia.wiki

I looked into the source code and found this.
Code:
depotLocker->__internalAddThing(Item::CreateItem(ITEM_MARKET));

Considering ITEM_MARKET as a const, so If we add for example ITEM_DEPOT1 in const.h and cloning that line using it. There should appear another an item in the locker. But the problem is, how can I assign each town to the depots.

Edit:
The only issue atm is that locker can't handle more than 3 items even if it's vol. 30.
can_t.png


Thanks in advance.
 
Last edited:
LOL!
man to make it work, first, you need to remove your codes from your source, remove in map editor all towns of depots
I'll teach you how create the boxes in the correct order to it work.
then
in player.cpp
Below:
Code:
DepotChest* depotChest = new DepotChest(ITEM_DEPOT);
    depotChest->incrementReferenceCounter();
add:
Code:
    depotChest->internalAddThing(Item::CreateItem(25469)); // id of the last, need to be in this order because the items will be created in the reverse order
    depotChest->internalAddThing(Item::CreateItem(25468)); 
    depotChest->internalAddThing(Item::CreateItem(25467));
    depotChest->internalAddThing(Item::CreateItem(25466));
    depotChest->internalAddThing(Item::CreateItem(25465));
    depotChest->internalAddThing(Item::CreateItem(25464));
    depotChest->internalAddThing(Item::CreateItem(25463));
    depotChest->internalAddThing(Item::CreateItem(25462));
    depotChest->internalAddThing(Item::CreateItem(25461));
    depotChest->internalAddThing(Item::CreateItem(25460));
    depotChest->internalAddThing(Item::CreateItem(25459));
    depotChest->internalAddThing(Item::CreateItem(25458));
    depotChest->internalAddThing(Item::CreateItem(25457));
    depotChest->internalAddThing(Item::CreateItem(25456));
    depotChest->internalAddThing(Item::CreateItem(25455));
    depotChest->internalAddThing(Item::CreateItem(25454));
    depotChest->internalAddThing(Item::CreateItem(25453));
so, you need to put 17 item ids, make sure that the order of the chests start with the last, to be in correct order in depot later
in depotchest.cpp find:

Code:
maxDepotItems = 1500;
then, above it you will put this:
Code:
maxSize = 17;
and change the maxDepotItems to 10000;
like this:
Code:
maxSize = 17;
maxDepotItems = 10000;
done.
 
make the code ignore locker townid, use getTowns instead (idk what is exact name for this function, you should be able to go to declaration from
int LuaScriptInterface::luaGameGetTowns(lua_State* L) in luascript.cpp)
with this data you can create a loop which links depotchests with towns
 
sry for bump, how can I make to ignore towns by depot?
Did all this stuff but in every town I have different depots (can it be done without editing towns in RME?)
 
sry for bump, how can I make to ignore towns by depot?
Did all this stuff but in every town I have different depots (can it be done without editing towns in RME?)

This has to be done somewhere in sources, ignoring DepotIDs. But I guess adding in RME "No Town" is best option though.
 
This actually works like a charm.
LOL!
man to make it work, first, you need to remove your codes from your source, remove in map editor all towns of depots
I'll teach you how create the boxes in the correct order to it work.
then
in player.cpp
Below:
Code:
DepotChest* depotChest = new DepotChest(ITEM_DEPOT);
    depotChest->incrementReferenceCounter();
add:
Code:
    depotChest->internalAddThing(Item::CreateItem(25469)); // id of the last, need to be in this order because the items will be created in the reverse order
    depotChest->internalAddThing(Item::CreateItem(25468));
    depotChest->internalAddThing(Item::CreateItem(25467));
    depotChest->internalAddThing(Item::CreateItem(25466));
    depotChest->internalAddThing(Item::CreateItem(25465));
    depotChest->internalAddThing(Item::CreateItem(25464));
    depotChest->internalAddThing(Item::CreateItem(25463));
    depotChest->internalAddThing(Item::CreateItem(25462));
    depotChest->internalAddThing(Item::CreateItem(25461));
    depotChest->internalAddThing(Item::CreateItem(25460));
    depotChest->internalAddThing(Item::CreateItem(25459));
    depotChest->internalAddThing(Item::CreateItem(25458));
    depotChest->internalAddThing(Item::CreateItem(25457));
    depotChest->internalAddThing(Item::CreateItem(25456));
    depotChest->internalAddThing(Item::CreateItem(25455));
    depotChest->internalAddThing(Item::CreateItem(25454));
    depotChest->internalAddThing(Item::CreateItem(25453));
so, you need to put 17 item ids, make sure that the order of the chests start with the last, to be in correct order in depot later
in depotchest.cpp find:

Code:
maxDepotItems = 1500;
then, above it you will put this:
Code:
maxSize = 17;
and change the maxDepotItems to 10000;
like this:
Code:
maxSize = 17;
maxDepotItems = 10000;
done.
 
Let's say we are using 8.6 depots, there is 1 locker and 1 depot chest inside this. If you make twice of depot chests, and you put one item to one of them, it will show on both of them. How can you make them individuals? Each of two can contain different items.
 
My solution:
- Keep Town ID for houses cleaning
- Posibility to use legacy depot for players - some bots cannot work with new one - based on storage

Code:
DepotChest* Player::getDepotChest(uint32_t depotId, bool autoCreate)
{
    auto it = depotChests.find(depotId);
    if (it != depotChests.end()) {
        return it->second;
    }

    if (!autoCreate) {
        return nullptr;
    }

    DepotChest *depotChest;
    if (depotId == DEPOT_BOXES_DEPOT) {
        depotChest = new DepotChest(ITEM_DEPOT);
        depotChest->setDepotId(depotId);
        depotChest->useThing2();
        depotChest->setMaxSize(17);
        depotChest->setMaxDepotItems(18);
        depotChests[depotId] = depotChest;
        for (int i = 17; i >= 1; i--) {
            DepotChest *depotBox = getDepotChest(i, true);
            depotChest->__internalAddThing(depotBox);
        }
    } else {
        uint16_t itemId = ITEM_DEPOT;
        int32_t oldDepotSystem = 0;
        getStorageValue(36, oldDepotSystem);
        if (depotId >= 1 && depotId <= 17 && oldDepotSystem != 1) {
            itemId = 25462 + depotId;
        }
        depotChest = new DepotChest(itemId);
        depotChest->setDepotId(depotId);
        depotChest->useThing2();
        depotChest->setMaxDepotItems(maxDepotItems);
        depotChests[depotId] = depotChest;
    }
    return depotChest;
}

DepotLocker* Player::getDepotLocker(uint32_t depotId)
{
    auto it = depotLockerMap.find(depotId);
    if (it != depotLockerMap.end()) {
        inbox->setParent(it->second);
        return it->second;
    }

    DepotLocker* depotLocker = new DepotLocker(ITEM_LOCKER1);
    depotLocker->setDepotId(depotId);
    depotLocker->__internalAddThing(Item::CreateItem(ITEM_MARKET));
    depotLocker->__internalAddThing(inbox);
    int32_t oldDepotSystem = 0;
    getStorageValue(36, oldDepotSystem);
    if (depotId >= 0 && depotId <= 17 && oldDepotSystem != 1) {
        depotLocker->__internalAddThing(getDepotChest(DEPOT_BOXES_DEPOT, true));
    } else {
        depotLocker->__internalAddThing(getDepotChest(depotId, true));
    }
    depotLockerMap[depotId] = depotLocker;
    return depotLocker;
}
 
Back
Top