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

TFS 1.5 PZ Icon Not Showing [ICON_PIGEON]

L0FIC

Active Member
Joined
May 29, 2024
Messages
71
Reaction score
45
Hello Guys,

Using TFS 1.5 (7.72) and Otcv8 client, and i can't get the Protection Zone (Dove/Pigeon) icon to show when I enter protection zones.

In player.cpp this part was previously commented out (ICON_PIGEON), i removed the comments and recompiled and restarted the server, but alas... Still not showing.

LUA:
uint16_t Player::getClientIcons() const
{
    uint16_t icons = 0;
    for (Condition* condition : conditions) {
        if (!isSuppress(condition->getType())) {
            icons |= condition->getIcons();
        }
    }

    if (pzLocked) {
        icons |= ICON_REDSWORDS;
    }

  
    if (tile && tile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        icons |= ICON_PIGEON;

        /* Don't show ICON_SWORDS if player is in protection zone.
        if (hasBitSet(ICON_SWORDS, icons)) {
            icons &= ~ICON_SWORDS;
        }*/
    }

    // Game client debugs with 10 or more icons
    // so let's prevent that from happening.
    std::bitset<20> icon_bitset(static_cast<uint64_t>(icons));
    for (size_t pos = 0, bits_set = icon_bitset.count(); bits_set >= 10; ++pos) {
        if (icon_bitset[pos]) {
            icon_bitset.reset(pos);
            --bits_set;
        }
    }
    return icon_bitset.to_ulong();
}

I also double checked the const.h definitions for the icons and tried changing uint16_t for uint32_t in the relevant source and header files (protocolgame and conditions as well I believe), did not work either.

I have tried compiling TFS 1.4 [10.98] and running with my otclient and THEN IT WORKS. What makes me confused is that this tells us it's not client related, but the only source files in both tfs 1.4 and 1.5 that have icon_pigeon are const.h and player.cpp.
I tried the code from TFS1.4 in my TFS 1.5 source files, but still no luck.. what does this mean?

I did a lot of testing client side anyways although the troubleshooting points towards server side sources. I could get the PZ icon to show if I added it to show instead of "SWORDS" when attacking a monster for example, so the issue seems to be with the "Condition" itself although PZ is not really a condition in the same manner as Haste or Poisoned or Burned etc..

Thankful for any help!


Best,
Z
 

Attachments

Last edited:
Of course lil bro, the above IS source edits XD

Question is more how to do it properly!
review in the code of the server 10.98 all thing related to pigdeon icon and add into your server, youll have to check and review many files, its not like you'll gonna paste a copy a portion of code and youll get it working
 
Yes I tried adding the stuff from TFS 1.4 but obviously I failed.. would be thankful if someone has a working commit!
 
Hello Guys,

Using TFS 1.5 (7.72) and Otcv8 client, and i can't get the Protection Zone (Dove/Pigeon) icon to show when I enter protection zones.

In player.cpp this part was previously commented out (ICON_PIGEON), i removed the comments and recompiled and restarted the server, but alas... Still not showing.

LUA:
uint16_t Player::getClientIcons() const
{
    uint16_t icons = 0;
    for (Condition* condition : conditions) {
        if (!isSuppress(condition->getType())) {
            icons |= condition->getIcons();
        }
    }

    if (pzLocked) {
        icons |= ICON_REDSWORDS;
    }

 
    if (tile && tile->hasFlag(TILESTATE_PROTECTIONZONE)) {
        icons |= ICON_PIGEON;

        /* Don't show ICON_SWORDS if player is in protection zone.
        if (hasBitSet(ICON_SWORDS, icons)) {
            icons &= ~ICON_SWORDS;
        }*/
    }

    // Game client debugs with 10 or more icons
    // so let's prevent that from happening.
    std::bitset<20> icon_bitset(static_cast<uint64_t>(icons));
    for (size_t pos = 0, bits_set = icon_bitset.count(); bits_set >= 10; ++pos) {
        if (icon_bitset[pos]) {
            icon_bitset.reset(pos);
            --bits_set;
        }
    }
    return icon_bitset.to_ulong();
}

I also double checked the const.h definitions for the icons and tried changing uint16_t for uint32_t in the relevant source and header files (protocolgame and conditions as well I believe), did not work either.

I have tried compiling TFS 1.4 [10.98] and running with my otclient and THEN IT WORKS. What makes me confused is that this tells us it's not client related, but the only source files in both tfs 1.4 and 1.5 that have icon_pigeon are const.h and player.cpp.
I tried the code from TFS1.4 in my TFS 1.5 source files, but still no luck.. what does this mean?

I did a lot of testing client side anyways although the troubleshooting points towards server side sources. I could get the PZ icon to show if I added it to show instead of "SWORDS" when attacking a monster for example, so the issue seems to be with the "Condition" itself although PZ is not really a condition in the same manner as Haste or Poisoned or Burned etc..

Thankful for any help!


Best,
Z
Did you manage to solve it?
 
Nope.. I would have shared the solution if I did - promise!
I was trying to find the reason too, I didn't find it, I imagine that the solution is the "name" of the variable, which in OTClient is "Pz", but I didn't test it.
 
I’ll sit down to this soon and try to figure it out. I’ll be digging into the following files: player.cpp, condition.h, condition.cpp, game.cpp, const.h.

I'm in the process of compiling :D
 
Last edited:
I’ll sit down to this soon and try to figure it out. I’ll be digging into the following files: player.cpp, condition.h, condition.cpp, game.cpp, const.h.

I'm in the process of compiling :D
Ok, I'm waiting, but I still think the problem is in the OTclient v8 part.
 
in console
LUA:
DEBUG: Player Bbnd is in PZ. Sending the icon!
DEBUG: Icons sent to the client: 256

Yes, the issue lies on the client side.
 
Just want to remind you guys of my original post. I tried compiling TFS 1.4, and running it with the same client, and then it worked.
So i'm not as positive that the issue lies on client side.
 
look at the sendIcons() functions for the 772 downgrade.
It is sending the icons as a byte(2^8) but the pigeon is 2^14 so it is getting cut off.

The ICON_REDSWORDS and loop at the end should probably be commented out as well since they will have no significance.

Anyways, send over the icons as at least a uint16 to the client and make sure the client is expecting a uint16 and you should be good.
 
Back
Top