• 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+ Prefix + Name

GOD Jose

New Member
Joined
Jul 10, 2008
Messages
21
Reaction score
1
Location
Mexico
Hello Otlanders

I'm looking the best way to implement this "prefix" for each vocation.

Note: Can be applied for other things like loyalty, or some stuff to show.

Code:
Example:
Character Name: Demos

With prefix should be
Character Name: [RP] Demos


This kind of prefix used to be old war servers, so I want it back into TFS 1.0+

Depending on your choice, please share which files should be modified.
 
protocolgame.cpp, ProtocolGame::AddCreature

replace this:
C++:
if (known) {
        msg.add<uint16_t>(0x62);
        msg.add<uint32_t>(creature->getID());
    } else {
        msg.add<uint16_t>(0x61);
        msg.add<uint32_t>(remove);
        msg.add<uint32_t>(creature->getID());
        msg.AddByte(creatureType);
        msg.AddString(creature->getName());
    }
with this:
C++:
if (known) {
        msg.add<uint16_t>(0x62);
        msg.add<uint32_t>(creature->getID());
    } else {
        msg.add<uint16_t>(0x61);
        msg.add<uint32_t>(remove);
        msg.add<uint32_t>(creature->getID());
        msg.AddByte(creatureType);
        const Player* player = creature->getPlayer();
        if (player) {
            static std::vector<std::string> vocation_prefixes = {"[S]", "[D]", "[P]", "[K]", "[MS]", "[ED]", "[RP]", "[EK]"};
            uint16_t vocation_id = player->getVocation()->getId();
            if (vocation_id < vocation_prefixes.size()) {
                msg.AddString(vocation_prefixes[vocation_id] + " " + creature->getName())
            } else {
                msg.AddString(creature->getName());
            }
        } else {
            msg.AddString(creature->getName());
        }
    }

the vocations should go in order inside of the vocation_prefixes vector
 
Back
Top