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

[Sabrehaven] No green skull in party

X X X

Newb
Joined
Jul 26, 2015
Messages
146
Reaction score
13
Using Sabrehaven master branch. As title says: when a player is in a party, no matter if you are a leader or member, you don't have a green skull. All other party members have one on your screen, but on each player's screen they don't have a skull:
1699149212546.png
The screenshot is taken from the perspective of the blue player, and he doesnt have a green skull, but the white player does. However, on the white player's PC, from his perspective, he does NOT have a skull himself, and the blue player DOES have a skull.

From what I understand, this function in player.cpp determines when players get a green skull:

C++:
Skulls_t Player::getSkullClient(const Creature* creature) const
{
    if (!creature || g_game.getWorldType() != WORLD_TYPE_PVP) {
        return SKULL_NONE;
    }

    const Player* player = creature->getPlayer();
    if (!player || player->getSkull() != SKULL_NONE) {
        return Creature::getSkullClient(creature);
    }

    if (isInWar(player)) {
        return SKULL_GREEN;
    }

    if (player->hasAttacked(this)) {
        return SKULL_YELLOW;
    }

    if (isPartner(player)) {
        return SKULL_GREEN;
    }
    return Creature::getSkullClient(creature);
}

I have look through any file that references the word "skull" and I cant see anything, I even compared to a different distro that is working and this function is the same, party.cpp is the same...

Thank you
 
Solution
The problem isn't that function, but it is in the same file (player.cpp).

The problem is in the "isPartner" bool:

C++:
bool Player::isPartner(const Player* player) const
{
    // Check if the 'player' is a player or not, if the current player is not in a party,
    // or if 'player' is the same as the current player.
    if (!player || !party || player == this) {
        return false;  // Return false, indicating that 'player' is not a partner.
    }

    // Check if both the current player and 'player' are in the same party.
    return party == player->party;  // Return true if they are in the same party, indicating 'player' is a partner.
}

Basically, he wrote/changed that bool to say "if a player isn't a player, isn't in a party...
The problem isn't that function, but it is in the same file (player.cpp).

The problem is in the "isPartner" bool:

C++:
bool Player::isPartner(const Player* player) const
{
    // Check if the 'player' is a player or not, if the current player is not in a party,
    // or if 'player' is the same as the current player.
    if (!player || !party || player == this) {
        return false;  // Return false, indicating that 'player' is not a partner.
    }

    // Check if both the current player and 'player' are in the same party.
    return party == player->party;  // Return true if they are in the same party, indicating 'player' is a partner.
}

Basically, he wrote/changed that bool to say "if a player isn't a player, isn't in a party, or isn't himself, don't give him the status of 'isPartner'" Well, a player is always himself so it will never give a player the 'isPartner' status, therefore you don't get a green skull.

TL;DR change to:
C++:
bool Player::isPartner(const Player* player) const
{
    // Check if the 'player' is a player or not, if the current player is not in a party
    if (!player || !party) {
        return false;  // Return false, indicating that 'player' is not a partner.
    }

    return party == player->party;
}
 
Solution
Back
Top