• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

C++ [OTX 2] Game::playerRequestOutfit running slow

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,493
Solutions
17
Reaction score
187
Location
Brazil
I dont know why its happening, there's something can i do to improve this? Appearly exhaust its not being applied correctly.

C++:
bool Game::playerRequestOutfit(uint32_t playerId)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved())
        return false;

    if(player->hasCondition(CONDITION_EXHAUST, 4))
    {
        player->sendTextMessage(MSG_STATUS_SMALL, "You have to wait a while.");
        return false;
    }

    if(Condition* conditionoutfit = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, 300, 0, false, 4))
        player->addCondition(conditionoutfit);

    player->sendOutfitWindow();
    return true;
}

bool Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved())
        return false;

    if(player->hasCondition(CONDITION_EXHAUST, 4))
    {
        player->sendTextMessage(MSG_STATUS_SMALL, "You have to wait a while.");
        return false;
    }

    if(Condition* conditionoutfit = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, 1000, 0, false, 4))
        player->addCondition(conditionoutfit);

    if(!player->changeOutfit(outfit, true))
        return false;

    player->setIdleTime(0);
    if(!player->hasCondition(CONDITION_OUTFIT, -1))
        internalCreatureChangeOutfit(player, outfit);

    return true;
}

I've changed both EXHAUST to 3000 (3 sec) but still running slow when player will change outfit.

image.png
 
Back
Top