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

Parcel system

nanduzenho

Member
Joined
Mar 21, 2021
Messages
187
Solutions
1
Reaction score
15
GitHub
nanduzenho
Good afternoon, does anyone know why when i send parcel to a char of the same account, i don't receive the parcel?
My server is Alkurius TFS 1.3
 
you will need to apply these changes:

but you will also need to apply some of these changes:

and you will still have tons of bugs because that datapack have unoptimized code (like the query being executed every time you kill a monster at onGainExperience) and is based in an old downgrade that doesn't contains a lot of fixes
 
you will need to apply these changes:

but you will also need to apply some of these changes:

and you will still have tons of bugs because that datapack have unoptimized code (like the query being executed every time you kill a monster at onGainExperience) and is based in an old downgrade that doesn't contains a lot of fixes
this code has different functions than TFS 1.3
Post automatically merged:

There is not enough information to help him, if you have something else you can share with us it would be great

the package delivery system in official TFS 1.3 works correctly
check this in your sources:
mailbox.cpp
My mailbox.cpp is same
 
@nanduzenho
TFS 1.3 = 10.99 protocol -> has 'inbox' in depot
Alkurius TFS 1.3 = 8.6 protocol -> NO 'inbox' in depot
In TFS, there is a code, that make depot 'not save', if player did not visit depot - to reduce number of database queries.
Your mailbox.cpp add items 'to depot', as it worked on 8.6:
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
and it makes all parcels sent to offline players and player who relog without visiting depot disappear.
You must add code that 'mark depot as visited by player':
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->setLastDepotId(depotId);                                    <<<< HERE
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                tmpPlayer.setLastDepotId(depotId);                                  <<<< HERE
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
 
@nanduzenho
TFS 1.3 = 10.99 protocol -> has 'inbox' in depot
Alkurius TFS 1.3 = 8.6 protocol -> NO 'inbox' in depot
In TFS, there is a code, that make depot 'not save', if player did not visit depot - to reduce number of database queries.
Your mailbox.cpp add items 'to depot', as it worked on 8.6:
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
and it makes all parcels sent to offline players and player who relog without visiting depot disappear.
You must add code that 'mark depot as visited by player':
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->setLastDepotId(depotId);                                    <<<< HERE
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                tmpPlayer.setLastDepotId(depotId);                                  <<<< HERE
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
Thank u!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@nanduzenho
TFS 1.3 = 10.99 protocol -> has 'inbox' in depot
Alkurius TFS 1.3 = 8.6 protocol -> NO 'inbox' in depot
In TFS, there is a code, that make depot 'not save', if player did not visit depot - to reduce number of database queries.
Your mailbox.cpp add items 'to depot', as it worked on 8.6:
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
and it makes all parcels sent to offline players and player who relog without visiting depot disappear.
You must add code that 'mark depot as visited by player':
Code:
    if (player) {
        DepotLocker* depotLocker = player->getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                player->setLastDepotId(depotId);                                    <<<< HERE
                player->onReceiveMail();
                return true;
            }
        }
    } else {
        Player tmpPlayer(nullptr);
        if (!IOLoginData::loadPlayerByName(&tmpPlayer, receiver)) {
            return false;
        }

        DepotLocker* depotLocker = tmpPlayer.getDepotLocker(depotId);
        if (depotLocker) {
            if (g_game.internalMoveItem(item->getParent(), depotLocker, INDEX_WHEREEVER, item, item->getItemCount(), nullptr) == RETURNVALUE_NOERROR) {
                g_game.transformItem(item, item->getID() + 1);
                tmpPlayer.setLastDepotId(depotId);                                  <<<< HERE
                IOLoginData::savePlayer(&tmpPlayer);
                return true;
            }
        }
    }
Bro, it worked, but when it is (sent in parcel with a large amount of items), it doesn't work, the player doesn't receive the parcel...=/
 
Back
Top