• 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 0.X ProtocolGame errors

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,458
Solutions
17
Reaction score
175
Location
Brazil
Hello guys,

It's been a few days since I started to experience slight crashes in the game and, occasionally, I receive messages about invalid packages. Could you help me find the problem? My last changes was in the function bellow, adding Life and Mana Leech:

C++:
bool Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, void* data)
{
    int32_t change = 0;
    if(Combat2Var* var = (Combat2Var*)data)
    {
        change = var->change;
        if(!change)
            change = random_range(var->minChange, var->maxChange, DISTRO_NORMAL);
    }

    if(g_game.combatBlockHit(params.combatType, caster, target, change, params.blockedByShield, params.blockedByArmor, params.itemId != 0))
        return false;

    CombatParams _params = params;
    if(_params.element.damage && _params.element.type != COMBAT_NONE)
        g_game.combatBlockHit(_params.element.type, caster, target, _params.element.damage, params.blockedByShield, params.blockedByArmor, params.itemId != 0, true);

    if(caster && caster->getPlayer() && target->getPlayer())
    {
        _params.element.damage /= 2;
        if(change < 0)
            change /= 2;
    }

    Monster* mCaster = NULL;
    Player* pCaster = NULL;

    if(caster)
    {
        pCaster = caster->getPlayer();
        mCaster = caster->getMonster();
    }

    if(pCaster && params.combatType != COMBAT_HEALING)
    {
        std::string value;
        pCaster->getStorage("794750", value);
        int32_t intValue = (int32_t)(atoi(value.c_str()));
        int32_t chance = static_cast<int32_t>(intValue * 0.2);
        if(random_range(1, 100) <= chance)
        {
            int32_t critdamage = pCaster->getCriticalDamage();
            if(critdamage > 0)
                change = static_cast<int32_t>(change + ((change * critdamage) / 100));
            g_game.addMagicEffect(target->getPosition(), MAGIC_EFFECT_STUN); // change here ***
            g_game.addAnimatedText(target->getPosition(), 144, "CRITICAL!");
        }
    }

    if (pCaster && params.combatType != COMBAT_HEALING)
    {
        int32_t Lifeleech = 25;
        int32_t Lifeleechchance = pCaster->getLifeLeechChance() * 0.2;
        int32_t amount = std::abs((int32_t)std::floor((change * (Lifeleech / 100.))));
       
        if (amount > 0 && random_range(1, 100) <= Lifeleechchance)
        {
            g_game.combatChangeHealth(COMBAT_HEALING, pCaster, pCaster, amount);
            g_game.addMagicEffect(pCaster->getPosition(), MAGIC_EFFECT_WRAPS_RED);
        }
    }

    if (pCaster && params.combatType != COMBAT_HEALING)
    {
        int32_t Manaleech = 10;
        int32_t Manaleechchance = pCaster->getManaLeechChance() * 0.2;
        int32_t amount = std::abs((int32_t)std::floor((change * (Manaleech / 100.))));
       
        if (amount > 0 && random_range(1, 100) <= Manaleechchance)
        {
            g_game.combatChangeMana(pCaster, pCaster, amount);
            g_game.addMagicEffect(pCaster->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
            g_game.addAnimatedText(pCaster->getPosition(), 11, "+" + std::to_string(amount));
        }
    }

    if(!g_game.combatChangeHealth(_params, caster, target, change, false))
        return false;

    CombatConditionFunc(caster, target, params, NULL);
    CombatDispelFunc(caster, target, params, NULL);
    return true;
}

I'm receiving this error in client:
ERROR: ProtocolGame parse message exception (836 bytes, 711 unread, last opcode is 0x4e (78), prev opcode is 0x83 (131)): unhandled opcode 78
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 772)

I used ChatGPT to try to translate hex, he give me back a spell name, a character name and a exhausted message.

ProtocolGame parse message exception (836 bytes, 711 unread, last opcode is 0x4e (78), prev opcode is 0x83 (131), proto: 772): unhandled opcode 78
48 03 40 03 b4 17 12 00 59 6f 75 20 61 72 65 20 65 78 68 61 75 73 74 65 64 2e 83 86 03 a6 05 07 03 83 86 03 a1 05 07 12 83 84 03 a2 05 07 12 83 85 03 a2 05 07 12 83 86 03 a2 05 07 12 83 87 03 a2 05 07 12 83 88 03 a2 05 07 12 83 83 03 a3 05 07 12 83 84 03 a3 05 07 12 83 85 03 a3 05 07 12 83 86 03 a3 05 07 12 83 87 03 a3 05 07 12 83 88 03 a3 05 07 12
83 89 03 a3 05 4e 28
4e a8 95 f5 8e 9e 12 83 83 03 a4 05 07 12 83 84 03 a4 05 07 12 83 85 03 a4 05 07 12 83 86 03 a4 05 07 12 83 87 03 a4 05 07 12 83 88 03 a4 05 07 12 83 89 03 a4 05 07 12 83 8a 03 a4 05 07 12 83 82 03 a5 05 07 12 83 83 03 a5 05 07 12 83 84 03 a5 05 07 12 83 85 18 4c 9b 84 19 4d ce d1 a5 05 07 12 83 87 03 a5 05 07 12 83 88 03 a5 05 07 12 83 89 03 a5 05 07 12 83 8a 03 a5 05 07 12 83 81 03 a6 05 07 12 83 82 03 a6 05 07 12 83 83 03 a6 05 07 12 83 84 03 a6 05 07 12 8c 15 00 00 10 64 a0 1a 18 1a 18 55 25 93 bc 2c 36 05 00 00 00 51 04 1e d0 75 b1 80 8a 5e c8 84 86 03 a6 05 07 12 05 00 2b 31 30 30 39 83 86 03 a6 05 07 0e a0 1a 18 1a 18 55 25 93 bc 2c 36 05 00 00 00 51 04 1e 64 77 b1 80 8a 5e c8 83 86 03 a6 05 07 0d 84 86 03 a6 05 07 0b 04 00 2b 34 30 34 8c e1 01 01 40 3c 8c e1 01 01 40 3c 83 85 03 a6 05 07 01 84 85 03 a6 05 07 6c 04 00 34 30 33 33 83 85 03 a6 05 07 12 83 86 03 a6 05 07 12 83 87 03 a6 05 07 12 83 88 03 a6 05 07 12 83 89 03 a6 05 07 12 83 8a 03 a6 05 07 12 83 8b 03 a6 05 07 12 83 82 03 a7 05 07 12 83 83 03 a7 05 07 12 83 84 03 a7 05 07 12 8c e5 01 01 40 27 8c e5 01 01 40 27 83 85 03 a7 05 07 01 84 85 03 a7 05 07 6c 04 00 34 37 30 35 83 85 03 a7 05 07 12 8c 8f 02 01 40 00 8c 8f 02 01 40 00 83 86 03 a7 05 07 01 84 86 03 a7 05 07 6c 04 00 33 37 37 39 83 86 03 a7 05 07 12 83 87 03 a7 05 07 12 83 88 03 a7 05 07 12 83 89 03 a7 05 07 12 83 8a 03 a7 05 07 12 83 82 03 a8 05 07 12 83 83 03 a8 05 07 12 83 84 03 a8 05 07 12 83 85 03 a8 05 07 12 83 86 03 a8 05 07 12 83 87 03 a8 05 07 12 83 88 03 a8 05 07 12 83 89 03 a8 05 07 12 83 8a 03 a8 05 07 12 83 83 03 a9 05 07 12 83 84 03 a9 05 07 12 83 85 03 a9 05 07 12 8c 90 02 01 40 2a 8c 90 02 01 40 2a 83 86 03 a9 05 07 01 84 86 03 a9 05 07 6c 05 00 31 31 31 30 31 83 86 03 a9 05 07 12 83 87 03 a9 05 07 12 83 88 03 a9 05 07 12 83 89 03 a9 05 07 12 83 84 03 aa 05 07 12 83 85 03 aa 05 07 12 83 86 03 aa 05 07 12 83 87 03 aa 05 07 12 83 88 03 aa 05 07 12 83 86 03 ab 05 07 12 a0 1a 18 1a 18 55 25 93 bc 2c 36 05 00 00 00 51 04 1e b4 72 b1 80 8a 5e c8 aa 00 00 00 00 07 00 43 6e 70 6a 6f 74 6f 10 86 03 a6 05 07 13 00 65 78 65 76 6f 20 67 72 61 6e 20 6d 61 73 20 6d 6f 72 74
 
Last edited:
not sure, maybe just this line
replace:
C++:
if(caster && caster->getPlayer() && target->getPlayer())

to:
C++:
if(caster && caster->getPlayer() && target && target->getPlayer())
 
not sure, maybe just this line
replace:
C++:
if(caster && caster->getPlayer() && target->getPlayer())

to:
C++:
if(caster && caster->getPlayer() && target && target->getPlayer())
I will try, thanks for reply!

not sure, maybe just this line
replace:
C++:
if(caster && caster->getPlayer() && target->getPlayer())

to:
C++:
if(caster && caster->getPlayer() && target && target->getPlayer())
Its not this, received error again:

ERROR: ProtocolGame parse message exception (38 bytes, 25 unread, last opcode is 0x16 (22), prev opcode is 0x8c (140)): InputMessage eof reached
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 772)


Code:
ProtocolGame parse message exception (38 bytes, 25 unread, last opcode is 0x16 (22), prev opcode is 0x8c (140), proto: 772): InputMessage eof reached
28 00 22 00
8c 9f 7c 00 40 64
16 a0 8c a5 a8 a5 0d 60 a0 60 f0 0a 55 c8 ae 86 01 b0 aa ca 4b f6 ed 72 74 3a 69 9a
 
Last edited:
I dont know if make sense, but after i remove:

C++:
g_game.addMagicEffect(pCaster->getPosition(), MAGIC_EFFECT_WRAPS_RED);
and
C++:
g_game.addMagicEffect(pCaster->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);                
g_game.addAnimatedText(pCaster->getPosition(), 11, "+" + std::to_string(amount)); // Add this line

Errors appear to not been generated anymore, this make sense? Why those lines may generate a packet problem with client?
 
0x83 is magic effect packet, you should check your serverside protocolgame and compare ::sendmagiceffect with your clientside parsemagiceffect, probably ur server sending more or diffrent data than client try to read
 
0x83 is magic effect packet, you should check your serverside protocolgame and compare ::sendmagiceffect with your clientside parsemagiceffect, probably ur server sending more or diffrent data than client try to read
So make sense i stop to receive more errors removing effects from code in combat.cpp? May be a problem send to client 2 magic effects at same time, besides another effects, like monster spells, exhausted, etc...
 
So make sense i stop to receive more errors removing effects from code in combat.cpp? May be a problem send to client 2 magic effects at same time, besides another effects, like monster spells, exhausted, etc...
dont neet to remove, just check if other effects display properly, use spell or something and check if everything looks ok or if u get error when u use spell with effect
 
I realize a different behavior at this moment, the ground on player SQM change at this hunt, i made a video:

And sometimes i got this error:
Code:
ERROR: no thing at pos:1495 965 5, stackpos:2
at:
    [C++]: ?getMappedThing@ProtocolGame@@QAE?AV?$shared_object_ptr@VThing@@@stdext@@ABV?$shared_object_ptr@VInputMessage@@@3@@Z
ERROR: no thing
at:
    [C++]: ?parseTileRemoveThing@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
 
And sometimes i got this error:
Code:
ERROR: no thing at pos:1495 965 5, stackpos:2
at:
    [C++]: ?getMappedThing@ProtocolGame@@QAE?AV?$shared_object_ptr@VThing@@@stdext@@ABV?$shared_object_ptr@VInputMessage@@@3@@Z
ERROR: no thing
at:
    [C++]: ?parseTileRemoveThing@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z

not working properly extended op codes.
 
I'm still stucked on that. Yesterday i got a new error message:

ProtocolGame parse message exception (429 bytes, 402 unread, last opcode is 0x65 (101), prev opcode is 0x6d (109), proto: 772): unable to create item with invalid id 48896

Strange thing is: i dont have an item with 48896 ID, my last item is ID 6338
 
Back
Top