• 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 1.5 7.72 How to send cancel message after choosing locked outfit

dewral

Veteran OT User
Joined
Dec 4, 2019
Messages
343
Solutions
10
Reaction score
351
Hi guys!
Basicaly i wanted that server send cancel message after you choose outfit you don't own.
This part is responsible for displaying all of outfits.
Tfs 1.5 772

C++:
switch (player->getSex()) {
        case PLAYERSEX_FEMALE: {
            msg.add<uint16_t>(351);
            if (player->isPremium()) {
                msg.add<uint16_t>(365);
            } else {
                msg.add<uint16_t>(357);            
            }

            break;
        }

        case PLAYERSEX_MALE: {
            msg.add<uint16_t>(300);
            if (player->isPremium()) {
                msg.add<uint16_t>(316);
            } else {
                msg.add<uint16_t>(306);
            }

            break;
        }

        default: {
            msg.add<uint16_t>(300);
            msg.add<uint16_t>(351);
        }
    }

    writeToOutputBuffer(msg);
}

Could someone help?
 
Last edited:
Solution
You commented somewhere about this as i remember. There was a lot of code to uncomment to make it work right?
You'll break cip client if you do that, unless you dont use it then its fine to use new protocol outfit window and enable this setting in your otclient.
This could be configurable, to make it easier, but I didn't work on downgrades since some time and I don't know if I'll be.
Hi guys!
Basicaly i wanted that server send cancel message after you choose outfit you don't own.
This part is responsible for displaying all of outfits.

C++:
switch (player->getSex()) {
        case PLAYERSEX_FEMALE: {
            msg.add<uint16_t>(351);
            if (player->isPremium()) {
                msg.add<uint16_t>(365);
            } else {
                msg.add<uint16_t>(357);            
            }

            break;
        }

        case PLAYERSEX_MALE: {
            msg.add<uint16_t>(300);
            if (player->isPremium()) {
                msg.add<uint16_t>(316);
            } else {
                msg.add<uint16_t>(306);
            }

            break;
        }

        default: {
            msg.add<uint16_t>(300);
            msg.add<uint16_t>(351);
        }
    }

    writeToOutputBuffer(msg);
}

Could someone help?
is it even possible to select an outfit that you don't have?
 
You can't choose it, but it's only displaying on outfit window. I just wanna send a message after you hit button that you don't have it unlocked :p

Tried something like that in player.cpp but no result xD
C++:
    if (outfit->unlocked == false);
    sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dont have that outfit.");
    return true;
    }
Post automatically merged:

Solved by this in player.cpp

Below this
C++:
    const Outfit* outfit = Outfits::getInstance().getOutfitByLookType(sex, lookType);
    if (!outfit) {
        return false;
    }

Add this
C++:
    if (!outfit->unlocked) {
    sendTextMessage(MESSAGE_INFO_DESCR, "This outfit is still locked for you!");
        return false;
    }
 
Last edited:
Actually i checked now and it always send that message if in outfits.xml is set to "no".
Im using simple script to add outfit but it still send that message.
Without that change it adds outfit normally.
What im doing wrong here :p
 
7.72 protocol doesn't use outfits.xml, so there is no way to check if outfit is owned.
Do you use new protocol (outfits.xml) or still that range based looktypes?
 
I don't really know how this supposed to work but i know that when i use simple action script to add outfits and i have
Lua:
<outfit id="19" type="1" looktype="317" name="Golden" premium="no" unlocked="no" enabled="yes" />
It adds it normally.

You mean this yes?
C++:
switch (player->getSex()) {
        case PLAYERSEX_FEMALE: {
            msg.add<uint16_t>(351);
            if (player->isPremium()) {
                msg.add<uint16_t>(366);
            } else {
                msg.add<uint16_t>(357);            
            }

            break;
        }

        case PLAYERSEX_MALE: {
            msg.add<uint16_t>(300);
            if (player->isPremium()) {
                msg.add<uint16_t>(317);
            } else {
                msg.add<uint16_t>(306);
            }

            break;
        }

        default: {
            msg.add<uint16_t>(300);
            msg.add<uint16_t>(351);
        }
    }

    writeToOutputBuffer(msg);
}

I tried also adapting this somehow but got same result :/
Unlocked Outfit TFS 1.2 (https://otland.net/threads/unlocked-outfit-tfs-1-2.238923/)
 
I don't really know how this supposed to work but i know that when i use simple action script to add outfits and i have
Lua:
<outfit id="19" type="1" looktype="317" name="Golden" premium="no" unlocked="no" enabled="yes" />
It adds it normally.

You mean this yes?
C++:
switch (player->getSex()) {
        case PLAYERSEX_FEMALE: {
            msg.add<uint16_t>(351);
            if (player->isPremium()) {
                msg.add<uint16_t>(366);
            } else {
                msg.add<uint16_t>(357);          
            }

            break;
        }

        case PLAYERSEX_MALE: {
            msg.add<uint16_t>(300);
            if (player->isPremium()) {
                msg.add<uint16_t>(317);
            } else {
                msg.add<uint16_t>(306);
            }

            break;
        }

        default: {
            msg.add<uint16_t>(300);
            msg.add<uint16_t>(351);
        }
    }

    writeToOutputBuffer(msg);
}

I tried also adapting this somehow but got same result :/
Unlocked Outfit TFS 1.2 (https://otland.net/threads/unlocked-outfit-tfs-1-2.238923/)
If that second code you posted is your current protocol, then you dont use outfits.xml
 
You commented somewhere about this as i remember. There was a lot of code to uncomment to make it work right?
 
You commented somewhere about this as i remember. There was a lot of code to uncomment to make it work right?
You'll break cip client if you do that, unless you dont use it then its fine to use new protocol outfit window and enable this setting in your otclient.
This could be configurable, to make it easier, but I didn't work on downgrades since some time and I don't know if I'll be.
 
Solution
Yea im using otcv8, will check how 8.0 sources work maybe i will manage :p
Post automatically merged:

Well that tfs 1.5 is good downgrade but needs a little touch :D
Post automatically merged:

You'll break cip client if you do that, unless you dont use it then its fine to use new protocol outfit window and enable this setting in your otclient.
This could be configurable, to make it easier, but I didn't work on downgrades since some time and I don't know if I'll be.
Actually that was easier than i expected :D
2YWbwaA.png

Addons working also now :p
 
Last edited:
Yea im using otcv8, will check how 8.0 sources work maybe i will manage :p
Post automatically merged:

Well that tfs 1.5 is good downgrade but needs a little touch :D
Post automatically merged:


Actually that was easier than i expected :D
2YWbwaA.png

Addons working also now :p
Hi, tried the same uncommented stuff in protocolgame.cpp for addons etc left only mount related code commented on Nekiro's 772 downgrade. I added addons to outfit in object builder and gave player the addons through player:addOutfitAddon.

But i cant tick addons, the buttons are grayed out. Any idea how to fix that ?
1653384678832.png
My protocolgame.cpp
 
It also need to be enabled from client side.

Edit:
You also did wrong protocol game, compare 8.0 protocol game to 7.72
 
Last edited:
Depends what your client is, im using otcv8 and it's easy just enable features.
I don't know what the fix for other otc
 
Depends what your client is, im using otcv8 and it's easy just enable features.
I don't know what the fix for other otc
well im using otcv8 for now since i didnt start with client compiling for now (pain in windows :D) can u tell me where can i enable this feature in otcv8?
 
game/features/features.lua
Enable this under 7.72 version

Lua:
        g_game.enableFeature(GamePlayerAddons)
        g_game.enableFeature(GameNewOutfitProtocol)
 
game/features/features.lua
Enable this under 7.72 version

Lua:
        g_game.enableFeature(GamePlayerAddons)
        g_game.enableFeature(GameNewOutfitProtocol)
Thanks i can see addon now but its glitching for some reason. Cant walk just barely moving items not rendered etc. idk why
1653389008271.png

If i comment out this line: g_game.enableFeature(GameLooktypeU16) I can see the first addon and nothing is glitching but i cant open outfit window.

1653389436129.png

Weird.


Lua:
  if(version >= 770) then
        g_game.enableFeature(GamePlayerAddons)
        g_game.enableFeature(GameLooktypeU16)
        g_game.enableFeature(GameMessageStatements)
        g_game.enableFeature(GameLoginPacketEncryption)
        g_game.enableFeature(GameNewOutfitProtocol)

    end
 
Back
Top