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

Add "exhaust" for PlayerMoveUpContainer

Pabox Cavieres

Dovux Online owner
Joined
May 12, 2008
Messages
571
Reaction score
9
Location
Caracas/Venezuela
I want add 3 seconds for "Game::playerMoveUpContainer"

This is the funcion:

Code:
void Game::playerMoveUpContainer(uint32_t playerId, uint8_t cid)
{
    Player* player = getPlayerByID(playerId);
    if (!player) {
        return;
    }

    Container* container = player->getContainerByID(cid);
    if (!container) {
        return;
    }

    Container* parentContainer = dynamic_cast<Container*>(container->getRealParent());
    if (!parentContainer) {
        Tile* tile = container->getTile();
        if (!tile) {
            return;
        }
    }

    bool hasParent = (dynamic_cast<const Container*>(parentContainer->getParent()) != nullptr);
    player->addContainer(cid, parentContainer);
    player->sendContainer(cid, parentContainer, hasParent, player->getContainerIndex(cid));
}

My game.cpp :
http://pastebin.com/RUpYcLyW
 
You don't add a delay to this method to create a delay of time, you add time to the calling function, however the function calling this method does not have a delay argument.
Code:
void ProtocolGame::parseUpArrowContainer(NetworkMessage& msg)
{
    uint8_t cid = msg.getByte();
    addGameTask(&Game::playerMoveUpContainer, player->getID(), cid);
}

If you want to add a delay then you need to use addGameTaskTimed instead of addGameTask.
Please note that the argument list is (uint32_t delay, Callable function, Args&&... args) instead of (Callable function, Args&&... args)
 
Back
Top Bottom