• 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.X+ PZ TFS 1.5

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
Does anyone know how to solve this PZ issue? For example, when I try to enable experience sharing anywhere, it doesn't work. Only works in PZ. How do I remove this PZ restriction and allow experience sharing? Can someone help me?
I don't want to be in PZ to enable experience sharing.



I removed that part of PZ and tested it. However, you still need to be in PZ to enable experience sharing. I want to completely remove this restriction.

party.cpp
C++:
SharedExpStatus_t Party::getMemberSharedExperienceStatus(const Player * player) const
{
    if (memberList.empty()) {
        return SHAREDEXP_EMPTYPARTY;
    }

    uint32_t highestLevel = leader->getLevel();
    for (Player* member : memberList) {
        if (member->getLevel() > highestLevel) {
            highestLevel = member->getLevel();
        }
    }

    uint32_t minLevel = static_cast<uint32_t>(std::ceil((static_cast<float>(highestLevel) * 2) / 3));
    if (player->getLevel() < minLevel) {
        return SHAREDEXP_LEVELDIFFTOOLARGE;
    }

    if (!Position::areInRange<30, 30, 1>(leader->getPosition(), player->getPosition())) {
        return SHAREDEXP_TOOFARAWAY;
    }

    if (!player->hasFlag(PlayerFlag_NotGainInFight)) {
        //check if the player has healed/attacked anything recently
        auto it = ticksMap.find(player->getID());
        if (it == ticksMap.end()) {
            return SHAREDEXP_MEMBERINACTIVE;
        }

        uint64_t timeDiff = OTSYS_TIME() - it->second;
        if (timeDiff > static_cast<uint64_t>(g_config.getNumber(ConfigManager::PZ_LOCKED))) {
            return SHAREDEXP_MEMBERINACTIVE;
        }
    }
    return SHAREDEXP_OK;
}
 
Last edited:
Does anyone know how to solve this PZ issue? For example, when I try to enable experience sharing anywhere, it doesn't work. Only works in PZ. How do I remove this PZ restriction and allow experience sharing? Can someone help me?
I don't want to be in PZ to enable experience sharing.



I removed that part of PZ and tested it. However, you still need to be in PZ to enable experience sharing. I want to completely remove this restriction.

C++:
SharedExpStatus_t Party::getMemberSharedExperienceStatus(const Player * player) const
{
    if (memberList.empty()) {
        return SHAREDEXP_EMPTYPARTY;
    }

    uint32_t highestLevel = leader->getLevel();
    for (Player* member : memberList) {
        if (member->getLevel() > highestLevel) {
            highestLevel = member->getLevel();
        }
    }

    uint32_t minLevel = static_cast<uint32_t>(std::ceil((static_cast<float>(highestLevel) * 2) / 3));
    if (player->getLevel() < minLevel) {
        return SHAREDEXP_LEVELDIFFTOOLARGE;
    }

    if (!Position::areInRange<30, 30, 1>(leader->getPosition(), player->getPosition())) {
        return SHAREDEXP_TOOFARAWAY;
    }

    if (!player->hasFlag(PlayerFlag_NotGainInFight)) {
        //check if the player has healed/attacked anything recently
        auto it = ticksMap.find(player->getID());
        if (it == ticksMap.end()) {
            return SHAREDEXP_MEMBERINACTIVE;
        }

        uint64_t timeDiff = OTSYS_TIME() - it->second;
        if (timeDiff > static_cast<uint64_t>(g_config.getNumber(ConfigManager::PZ_LOCKED))) {
            return SHAREDEXP_MEMBERINACTIVE;
        }
    }
    return SHAREDEXP_OK;
}
show the right function
 
Experience sharing is working, yes. When I invite another player to the party, everything is fine. However, when I try to activate the "Enable Share Exp", it doesn't want to activate. I had to go down to the temple or be in a PZ area to activate it. I went back to the same place where I was hunting, you know? I don't want to be in PZ to activate experience sharing. I want it to work with or without PZ, and also with PK or without PK, you know?
 
Experience sharing is working, yes. When I invite another player to the party, everything is fine. However, when I try to activate the "Enable Share Exp", it doesn't want to activate. I had to go down to the temple or be in a PZ area to activate it. I went back to the same place where I was hunting, you know? I don't want to be in PZ to activate experience sharing. I want it to work with or without PZ, and also with PK or without PK, you know?
oh my....

post this function:
playerEnableSharedPartyExperience
 
Solved. It was just removing that line and I tested it without being in PZ. Works well. This was done in the games.cpp file.
XML:
if (!party || (player->hasCondition(CONDITION_INFIGHT) && player->getZone() != ZONE_PROTECTION)) {
 
Last edited:
You have removed this part !party where it checks if player isn't in a party and return? Then players might set shared experience without being in a party using a bot script or something if I am not mistaken.

(C++ isn't my thing), so I'm just guessing.
 
oh my....

post this function:
playerEnableSharedPartyExperience

hey pips, taking advantage of your goodwill, I know it's possible, I didn't even touch it, but if you can give me a little idea, where I need to modify to have shared exp always active without having to activate anything, entered the pt, it has the required level.. already done sharing
 
You have removed this part !party where it checks if player isn't in a party and return? Then players might set shared experience without being in a party using a bot script or something if I am not mistaken.

(C++ isn't my thing), so I'm just guessing.
I removed that line and tested it with a player who wasn't in a group. Experience sharing didn't work for the other player who wasn't in a group, it only works when both are in a group.

When I invited another player to the group and activated the "Enable Share Exp" option, I realized that the leader, who is active and attacking monsters, however, the other player, who is inactive, does not receive the shared experience. It seems to require both players to be active for experience sharing to work. I also put a player in the training area while the leader was hunting, but sharing experience didn't work. It seems that the proximity between the leader and the other player is crucial, and both must attack the same monsters for sharing to work properly. Although the issue appears to be resolved, I'm still not entirely sure.
Post automatically merged:

Can you test to make sure or not and then let me know here please? However, I would like to clarify that I can activate "Enable Share Exp" anywhere, not necessarily in protection zone (PZ) areas, you know what I mean?
Post automatically merged:

Take a look at the video, please.
 
Last edited:
hey pips, taking advantage of your goodwill, I know it's possible, I didn't even touch it, but if you can give me a little idea, where I need to modify to have shared exp always active without having to activate anything, entered the pt, it has the required level.. already done sharing
try just change the default value of
bool sharedExpActive = false;

in party.h
Post automatically merged:

I removed that line and tested it with a player who wasn't in a group. Experience sharing didn't work for the other player who wasn't in a group, it only works when both are in a group.

When I invited another player to the group and activated the "Enable Share Exp" option, I realized that the leader, who is active and attacking monsters, however, the other player, who is inactive, does not receive the shared experience. It seems to require both players to be active for experience sharing to work. I also put a player in the training area while the leader was hunting, but sharing experience didn't work. It seems that the proximity between the leader and the other player is crucial, and both must attack the same monsters for sharing to work properly. Although the issue appears to be resolved, I'm still not entirely sure.
Post automatically merged:

Can you test to make sure or not and then let me know here please? However, I would like to clarify that I can activate "Enable Share Exp" anywhere, not necessarily in protection zone (PZ) areas, you know what I mean?
Post automatically merged:

Take a look at the video, please.

now you have to change the first function you've sent before.

there are the conditions to split exp or not.

if you want no distance limitations, remove:

C++:
    if (!Position::areInRange<30, 30, 1>(leader->getPosition(), player->getPosition())) {
        return SHAREDEXP_TOOFARAWAY;
    }

if you want to remove the 'inactive' limitations, remove:

C++:
    if (!player->hasFlag(PlayerFlag_NotGainInFight)) {
        //check if the player has healed/attacked anything recently
        auto it = ticksMap.find(player->getID());
        if (it == ticksMap.end()) {
            return SHAREDEXP_MEMBERINACTIVE;
        }

        uint64_t timeDiff = OTSYS_TIME() - it->second;
        if (timeDiff > static_cast<uint64_t>(g_config.getNumber(ConfigManager::PZ_LOCKED))) {
            return SHAREDEXP_MEMBERINACTIVE;
        }
    }
 
Last edited:
if (!Position::areInRange<30, 30, 1>(leader->getPosition(), player->getPosition())) { return SHAREDEXP_TOOFARAWAY; }
I already removed that part, everything is ok.
if (!player->hasFlag(PlayerFlag_NotGainInFight)) { //check if the player has healed/attacked anything recently auto it = ticksMap.find(player->getID()); if (it == ticksMap.end()) { return SHAREDEXP_MEMBERINACTIVE; } uint64_t timeDiff = OTSYS_TIME() - it->second; if (timeDiff > static_cast<uint64_t>(g_config.getNumber(ConfigManager::pZ_LOCKED))) { return SHAREDEXP_MEMBERINACTIVE; } }
Here, I wouldn't remove that part. Do you know why? The player can go AFK and still receive shared experience. I prefer the player not to go AFK and go hunting, receiving shared experience normally. I think this is perfectly normal. I didn't notice anything about what Addams said, no group and still sharing experience. I've tested it and found nothing like that.
 
so which would be the requeried changes in order to fix this?
in order to allow players activate shared experience, without checking if they are in fight:
change in game.cpp
from
C++:
void Game::playerEnableSharedPartyExperience(uint32_t playerId, bool sharedExpActive)
{
    Player* player = getPlayerByID(playerId);
    if (!player) {
        return;
    }

    Party* party = player->getParty();
    if (!party || (player->hasCondition(CONDITION_INFIGHT) && player->getZone() != ZONE_PROTECTION)) {
        return;
    }

    party->setSharedExperience(player, sharedExpActive);
}

to:

C++:
void Game::playerEnableSharedPartyExperience(uint32_t playerId, bool sharedExpActive)
{
    Player* player = getPlayerByID(playerId);
    if (!player) {
        return;
    }

    Party* party = player->getParty();
    if (!party) {
        return;
    }

    party->setSharedExperience(player, sharedExpActive);
}
 
try just change the default value of
bool sharedExpActive = false;

in party.h
Post automatically merged:



now you have to change the first function you've sent before.

there are the conditions to split exp or not.

if you want no distance limitations, remove:

C++:
    if (!Position::areInRange<30, 30, 1>(leader->getPosition(), player->getPosition())) {
        return SHAREDEXP_TOOFARAWAY;
    }

if you want to remove the 'inactive' limitations, remove:

C++:
    if (!player->hasFlag(PlayerFlag_NotGainInFight)) {
        //check if the player has healed/attacked anything recently
        auto it = ticksMap.find(player->getID());
        if (it == ticksMap.end()) {
            return SHAREDEXP_MEMBERINACTIVE;
        }

        uint64_t timeDiff = OTSYS_TIME() - it->second;
        if (timeDiff > static_cast<uint64_t>(g_config.getNumber(ConfigManager::PZ_LOCKED))) {
            return SHAREDEXP_MEMBERINACTIVE;
        }
    }
this does not work
 
Back
Top