• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.5 downgrade 8.6 Server Log

Azerty

Member
Joined
Apr 15, 2022
Messages
150
Solutions
3
Reaction score
10
I migrated to TFS 1.5 recently and I'm noticing some bugs. This time, the server log doesn't show the message when the monster uses health magic. Anyone having this problem too?

HEAL MONSTER.JPG

Game.cpp
Lua:
        int32_t realHealthChange = target->getHealth();
        target->gainHealth(attacker, damage.primary.value);
        realHealthChange = target->getHealth() - realHealthChange;

        if (realHealthChange > 0 && !target->isInGhostMode()) {
            auto damageString = fmt::format("{:d} hitpoint{:s}", realHealthChange, realHealthChange != 1 ? "s" : "");

            std::string spectatorMessage;

            TextMessage message;
            std::ostringstream strHealthChange;
            strHealthChange << realHealthChange;
            addAnimatedText(strHealthChange.str(), targetPos, TEXTCOLOR_MAYABLUE);

            SpectatorVec spectators;
            map.getSpectators(spectators, targetPos, false, true);
            for (Creature* spectator : spectators) {
                if (!spectator) {
                    continue;
                }
                Player* tmpPlayer = spectator->getPlayer();
                if (!tmpPlayer) {
                    continue;
                }
                if (tmpPlayer == attackerPlayer && attackerPlayer != targetPlayer) {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    message.text = fmt::format("You heal {:s} for {:s}.", target->getNameDescription(), damageString);
                } else if (tmpPlayer == targetPlayer) {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    if (!attacker) {
                        message.text = fmt::format("You were healed for {:s}.", damageString);
                    } else if (targetPlayer == attackerPlayer) {
                        message.text = fmt::format("You healed yourself for {:s}.", damageString);
                    } else {
                        message.text = fmt::format("You were healed by {:s} for {:s}.", attacker->getNameDescription(), damageString);
                    }
                } else {
                    message.type = MESSAGE_STATUS_DEFAULT;
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} was healed for {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} healed {:s}self for {:s}.", attacker->getNameDescription(), targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "him") : "it", damageString);
                        } else {
                            spectatorMessage = fmt::format("{:s} healed {:s} for {:s}.", attacker->getNameDescription(), target->getNameDescription(), damageString);
                        }
                        spectatorMessage[0] = std::toupper(spectatorMessage[0]);
                    }
                    message.type = MESSAGE_STATUS_DEFAULT;
                }
                tmpPlayer->sendTextMessage(message);
            }
        }
    }
 
Solution
Did you find a solution? I am also curious..
Yes, in game.cpp change:

Lua:
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} was healed for {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} healed {:s}self for {:s}.", attacker->getNameDescription(), targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "him") : "it", damageString);
                        } else {
                            spectatorMessage = fmt::format("{:s} healed {:s} for {:s}.", attacker->getNameDescription()...
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
150
Solutions
3
Reaction score
10
Did you find a solution? I am also curious..
Yes, in game.cpp change:

Lua:
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} was healed for {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} healed {:s}self for {:s}.", attacker->getNameDescription(), targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "him") : "it", damageString);
                        } else {
                            spectatorMessage = fmt::format("{:s} healed {:s} for {:s}.", attacker->getNameDescription(), target->getNameDescription(), damageString);
                        }
                        spectatorMessage[0] = std::toupper(spectatorMessage[0]);
                    }
                    message.type = MESSAGE_STATUS_DEFAULT;    <<<-------
                }
                tmpPlayer->sendTextMessage(message);
            }
        }
    }

For:
Lua:
                    if (spectatorMessage.empty()) {
                        if (!attacker) {
                            spectatorMessage = fmt::format("{:s} was healed for {:s}.", target->getNameDescription(), damageString);
                        } else if (attacker == target) {
                            spectatorMessage = fmt::format("{:s} healed {:s}self for {:s}.", attacker->getNameDescription(), targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "him") : "it", damageString);
                        } else {
                            spectatorMessage = fmt::format("{:s} healed {:s} for {:s}.", attacker->getNameDescription(), target->getNameDescription(), damageString);
                        }
                        spectatorMessage[0] = std::toupper(spectatorMessage[0]);
                    }
                    message.text = spectatorMessage;   <<<<---------
                }
                tmpPlayer->sendTextMessage(message);
            }
        }
    }
 
Solution

venius

Member
Joined
Dec 27, 2010
Messages
89
Reaction score
9
if (spectatorMessage.empty()) { if (!attacker) { spectatorMessage = fmt::format("{:s} was healed for {:s}.", target->getNameDescription(), damageString); } else if (attacker == target) { spectatorMessage = fmt::format("{:s} healed {:s}self for {:s}.", attacker->getNameDescription(), targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her" : "him") : "it", damageString); } else { spectatorMessage = fmt::format("{:s} healed {:s} for {:s}.", attacker->getNameDescription(), target->getNameDescription(), damageString); } spectatorMessage[0] = std::toupper(spectatorMessage[0]); } message.text = spectatorMessage; <<<<--------- } tmpPlayer->sendTextMessage(message); } } }
Thanks dude!
 
Top