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

PHP PHP Outfitter - But with Tibia's new outfit codes?

222222

Intermediate OT User
Joined
Jul 3, 2007
Messages
207
Reaction score
145
I stumbled upon this thread from a few years ago:

I wonder, is there any way to make it work with Tibia's new outfit codes?
When you open the outfit window in real Tibia after the summer update, there are a few new buttons to generate an outfit / color code.
And then it generates a Base64 code like this:

Outfit + Colors:
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEVqZmlyc3RBZGRPbvRiaWQYgGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA

Just the colors:
pGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEU

My request is to be able to pass these into the GET parameter of the outfitter script, as seen above in the other thread.

Example:

I also have no clue how to export the latest outfits from the new Tibia client. But I'd honestly just be satisfied with the regular free+premium outfits. I need it for a project that I am working on.

1626790318541.png
 
Solution
@222222
I got first version of 'code reader'
Number parsing:
Code:
(bytes) -> (number value)
below 24 -> value
24, 5 -> 5
25, 1, 23 -> 1 * 256 + 23 = 279
PHP class and example code that reads mount and outfit data:
Code:
<?php

class OutfitCodeReader
{
    /** @var resource */
    private $data;
    /** @var array */
    private $outfitData = [];
    /** @var array */
    private $mountData = [];

    /**
     * @param string $code
     */
    public function parseOutfitData($code)
    {
        $this->mountData = [];
        $this->outfitData = [];

        try {
            $base64Code = base64_decode($code);
            $this->data = fopen('php://memory', 'wb+');
            fwrite($this->data, $base64Code)...
Tibiawiki has something like that. Didn't see which scripting language they're using though.
 
It isn't in PHP it seems...? Just JavaScript. I'd like to do this in PHP.
Also, how do I even get the outfit images? I didn't see any download for it on that page.
Post automatically merged:

I've solved most of the stuff so far, managed to put a background image for my outfit and generate the outfits. But, I need a way to convert CipSoft's Base64(?) outfit code into chunks so I can divide it into like "body", "torso", "legs", "detail", "id".

This is an example of Citizen outfit+color:
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEVqZmlyc3RBZGRPbvRiaWQYgGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA

When I decode that as a Base64 string, I just get this:
�emount�ecolor�fdetaildheaddlegsetorsobiddname`foutfit�ecolor�fdetailLdheadNdlegs:etorsoEjfirstAddOn�bid�ksecondAddOn�fsummon�bid

I can see the words like "detail", "head", "legs"... in it. But... the actual values are just... question marks.
Did anyone figure out how to read these values?
 
Last edited:
use another decoder
they're probably using the bytes between words as numbers

Tried the one built-in to JavaScript and in PHP. Still nothing, same results.

Here is the old default outfit, citizen.

Male:
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEVqZmlyc3RBZGRPbvRiaWQYgGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA

Female:
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEVqZmlyc3RBZGRPbvRiaWQYiGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA

Notice the difference I highlighted. Just a single letter.
 
here you can see the output without the weird symbols
after separating words from bytes, you'll obtain a kind of structure

can't paste it as a text because it breaks post editor so I'll post an image
1626796649503.png

you can use another website to get binary values:

and this to translate:
 
Not able to use the binary converter. Forbidden characters in the decoded base64 string.
What options did you use on all sites?
 
default ones, just remove enter at the end of the textfield

knowing colour ids and outfit looktypes and analysing the differences between generated outfits should give you enough information to figure out the encoding
 
default ones, just remove enter at the end of the textfield

knowing colour ids and outfit looktypes and analysing the differences between generated outfits should give you enough information to figure out the encoding

I tried exactly what you said but nothing works.

I paste this:
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYTGRoZWFkGE5kbGVncxg6ZXRvcnNvGEVqZmlyc3RBZGRPbvRiaWQYgGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA

Into this:

Result:
¤emount¢ecolor¤fdetaildheaddlegsetorsobiddname`foutfit¤ecolor¤fdetailLdheadNdlegs:etorsoEjfirstAddOnôbidksecondAddOnôfsummon¡bid

I then paste that, into this:
And get error.

7mJ4nQD.png


So idk how it can work for you?
What is the end result after you decoded everything?

Can u take images on each page cus I must be doing something wrong?
 
base64 to binary here: Base64 to binary: Encode and decode bytes online (https://cryptii.com/pipes/base64-to-binary)

you can copy the output to view the text here: Binary to Text Converter | Binary Translator (https://www.rapidtables.com/convert/number/binary-to-ascii.html)

the thing I suspect is that the text uses 8 bits for characters, but a different amount of bits for other data. It can be any amount between 2 and 16 (most likely 4 bits and if you get numbers like 10 decimal, try reading in reverse order or try reading it as hex in 0-ff range).
 
I didn't fully decode it.

Save a few outfits with slight differences and use this thread as a reference to figure out how they code the looktypes and colours.
 
I made code to print 'code' as bytes on website and compare them easily:
PHP:
<?php

$codes = [
    'Mage outfit, no mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYhGV0b3JzbxiEamZpcnN0QWRkT270YmlkGIJrc2Vjb25kQWRkT270ZnN1bW1vbqFiaWQA',
    'Paladin outfit, with store moun' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkGQJzZG5hbWVgZm91dGZpdKRlY29sb3KkZmRldGFpbABkaGVhZABkbGVncxiEZXRvcnNvGIRqZmlyc3RBZGRPbvRiaWQYgWtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA',
    'Retro knight (store outfit), no mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYhGV0b3JzbxiEamZpcnN0QWRkT270YmlkGQPKa3NlY29uZEFkZE9u9GZzdW1tb26hYmlkAA',
    'Retro knight (store outfit), with mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkGQJzZG5hbWVgZm91dGZpdKRlY29sb3KkZmRldGFpbABkaGVhZABkbGVncxiEZXRvcnNvGIRqZmlyc3RBZGRPbvRiaWQZA8prc2Vjb25kQWRkT270ZnN1bW1vbqFiaWQA',
];

foreach ($codes as $name => $code) {
    $data = base64_decode($code);

    // skip mount part
//    $data = explode('name', $data, 2)[1];

    echo '<table style="width:100px;float:left">';
    echo '<tr style="height:100px"><td colspan="3">' . $name . '</td></tr>';
    foreach (str_split($data, 1) as $k => $v) {
        echo '<tr>';
        echo '<td>' . $k . '</td>';
        echo '<td>' . ord($v) . '</td>';
        echo '<td>' . $v . '</td>';
        echo '</tr>';
    }
    echo '</table>';
}
First things I found out:
1626944931968.png
Tibia colors 'view': https://ots.me/colors

Numbers notation:
1 byte: '0' = 0
2 bytes: '24' and 'byte value' = byte value
3 bytes: '25' and 2 bytes 'value' = byte1 * 256 + byte2
Anyone know 'retro knight outfit' ID in 12.70 client? From calculation it's 3*256+202 = 970, am I right?
 
Last edited:
I made code to print 'code' as bytes on website and compare them easily:
PHP:
<?php

$codes = [
    'Mage outfit, no mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYhGV0b3JzbxiEamZpcnN0QWRkT270YmlkGIJrc2Vjb25kQWRkT270ZnN1bW1vbqFiaWQA',
    'Paladin outfit, with store moun' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkGQJzZG5hbWVgZm91dGZpdKRlY29sb3KkZmRldGFpbABkaGVhZABkbGVncxiEZXRvcnNvGIRqZmlyc3RBZGRPbvRiaWQYgWtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZAA',
    'Retro knight (store outfit), no mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYhGV0b3JzbxiEamZpcnN0QWRkT270YmlkGQPKa3NlY29uZEFkZE9u9GZzdW1tb26hYmlkAA',
    'Retro knight (store outfit), with mount' => 'pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkGQJzZG5hbWVgZm91dGZpdKRlY29sb3KkZmRldGFpbABkaGVhZABkbGVncxiEZXRvcnNvGIRqZmlyc3RBZGRPbvRiaWQZA8prc2Vjb25kQWRkT270ZnN1bW1vbqFiaWQA',
];

foreach ($codes as $name => $code) {
    $data = base64_decode($code);

    // skip mount part
//    $data = explode('name', $data, 2)[1];

    echo '<table style="width:100px;float:left">';
    echo '<tr style="height:100px"><td colspan="3">' . $name . '</td></tr>';
    foreach (str_split($data, 1) as $k => $v) {
        echo '<tr>';
        echo '<td>' . $k . '</td>';
        echo '<td>' . ord($v) . '</td>';
        echo '<td>' . $v . '</td>';
        echo '</tr>';
    }
    echo '</table>';
}
First things I found out:
View attachment 60517
Tibia colors 'view': http://ots.me/colors

Here is an example of Retro Knight:

PqOD85H.png


Base64 (Outfit + Colors):
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwYXmRoZWFkGHxkbGVncxgmZXRvcnNvGHJqZmlyc3RBZGRPbvRiaWQZA8prc2Vjb25kQWRkT270ZnN1bW1vbqFiaWQA

Base64 (Colors):
pGZkZXRhaWwYXmRoZWFkGHxkbGVncxgmZXRvcnNvGHI

JSON file:
JSON:
        {
            "mount": {
                "color": {
                    "detail": 0,
                    "head": 0,
                    "legs": 0,
                    "torso": 0
                },
                "id": 0
            },
            "name": "RetroTest",
            "outfit": {
                "color": {
                    "detail": 94,
                    "head": 124,
                    "legs": 38,
                    "torso": 114
                },
                "firstAddOn": false,
                "id": 970,
                "secondAddOn": false
            },
            "summon": {
                "id": 0
            }
        }
Post automatically merged:

Yes, it is 970.
 
Try with male citizen first, it's 128 and compare it with 129
I got mount ID, outfit ID and colors. Only thing missing is addon enabled/disabled. In JSON there is true/false. In base64 there is value '244' for 'false'. I just need to know what is there when it's 'true'.
 
Anyone here with premium on RL Tibia that has addons ?? :D
I'll try ask someone in English chat if they can send me their code.

@Gesior.pl
How did you get the outfit+colors ?
Post automatically merged:

@Gesior.pl

I asked a player with addon.
This is what I got:

Citizen (Female)
Addon 1+2

pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYJmV0b3JzbwxqZmlyc3RBZGRPbvViaWQYiGtzZWNvbmRBZGRPbvVmc3VtbW9uoWJpZBkFVg

Addon 1 only
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYJmV0b3JzbwxqZmlyc3RBZGRPbvViaWQYiGtzZWNvbmRBZGRPbvRmc3VtbW9uoWJpZBkFVg

Addon 2 only
pGVtb3VudKJlY29sb3KkZmRldGFpbABkaGVhZABkbGVncwBldG9yc28AYmlkAGRuYW1lYGZvdXRmaXSkZWNvbG9ypGZkZXRhaWwAZGhlYWQAZGxlZ3MYJmV0b3JzbwxqZmlyc3RBZGRPbvRiaWQYiGtzZWNvbmRBZGRPbvVmc3VtbW9uoWJpZBkFVg

It should look like these colors, but with female outfit and addons.
yoY5WS4.png
 
Last edited:
Back
Top