• 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++ [TFS 0.4] Create New Depot without depot chest

magista

RL name " Amir reda "
Joined
Jul 22, 2011
Messages
157
Solutions
1
Reaction score
21
Location
Egypt
I am creating Boss Reward chest for 8.6 OTS which autoloots certian bosses and send the reward to certain Depot, Almost evrything is perfect asi created new depot [different item id from normal depot] for a dummy town and send the parcel to this town depot but the problem is i need to make this depot without the depot chest which is inside the depot 1689949203811.png also i need to block players to add any item to the depots which i send the boss reward too.
 
Solution
in sources, Search player.cpp Player::getDepot
and replace whit this
remember PUTYOURDEPOTID change to Depot Town for not create depot
and if your depot exist u need remove from database (player_depotitems) 2594 of this depot
C++:
Depot* Player::getDepot(uint32_t depotId, bool autoCreateDepot)
{
    DepotMap::iterator it = depots.find(depotId);
    if(it != depots.end())
        return it->second.first;

    //create a new depot?
    if(autoCreateDepot)
    {
        Item* locker = Item::CreateItem(ITEM_LOCKER);
        if(Container* container = locker->getContainer())
        {
            if(Depot* depot = container->getDepot())
            {
                if(depotId != PUTYOURDEPOTID){...
in sources, Search player.cpp Player::getDepot
and replace whit this
remember PUTYOURDEPOTID change to Depot Town for not create depot
and if your depot exist u need remove from database (player_depotitems) 2594 of this depot
C++:
Depot* Player::getDepot(uint32_t depotId, bool autoCreateDepot)
{
    DepotMap::iterator it = depots.find(depotId);
    if(it != depots.end())
        return it->second.first;

    //create a new depot?
    if(autoCreateDepot)
    {
        Item* locker = Item::CreateItem(ITEM_LOCKER);
        if(Container* container = locker->getContainer())
        {
            if(Depot* depot = container->getDepot())
            {
                if(depotId != PUTYOURDEPOTID){
                container->__internalAddThing(Item::CreateItem(ITEM_DEPOT));
                }
                addDepot(depot, depotId);
                std::clog << "create: Creating a new depot with id: " << depotId <<
            ", for player: " << getName() << std::endl;
                return depot;
            }
        }

        g_game.freeThing(locker);
        std::clog << "Failure: Creating a new depot with id: " << depotId <<
            ", for player: " << getName() << std::endl;
    }

    return NULL;
}
 
Solution
in sources, Search player.cpp Player::getDepot
and replace whit this
remember PUTYOURDEPOTID change to Depot Town for not create depot
and if your depot exist u need remove from database (player_depotitems) 2594 of this depot
C++:
Depot* Player::getDepot(uint32_t depotId, bool autoCreateDepot)
{
    DepotMap::iterator it = depots.find(depotId);
    if(it != depots.end())
        return it->second.first;

    //create a new depot?
    if(autoCreateDepot)
    {
        Item* locker = Item::CreateItem(ITEM_LOCKER);
        if(Container* container = locker->getContainer())
        {
            if(Depot* depot = container->getDepot())
            {
                if(depotId != PUTYOURDEPOTID){
                container->__internalAddThing(Item::CreateItem(ITEM_DEPOT));
                }
                addDepot(depot, depotId);
                std::clog << "create: Creating a new depot with id: " << depotId <<
            ", for player: " << getName() << std::endl;
                return depot;
            }
        }

        g_game.freeThing(locker);
        std::clog << "Failure: Creating a new depot with id: " << depotId <<
            ", for player: " << getName() << std::endl;
    }

    return NULL;
}
It works, Thank you very much
 
Back
Top