• 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.1+] Read player outfits, addons and mounts

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,955
Solutions
98
Reaction score
3,350
Location
Poland
GitHub
gesior
Someone asked me how to display player outfits, addons and mounts on 'characters' page. I didn't prepare whole script, but I wrote PHP code to read that data from database with Gesior2012:

PHP:
<?php
define('PSTRG_RESERVED_RANGE_START', 10000000);
define('PSTRG_OUTFITS_RANGE_START', PSTRG_RESERVED_RANGE_START + 1000);
define('PSTRG_OUTFITS_RANGE_SIZE', 500);
define('PSTRG_MOUNTS_RANGE_START', PSTRG_RESERVED_RANGE_START + 2001);
define('PSTRG_MOUNTS_CURRENTMOUNT', PSTRG_MOUNTS_RANGE_START + 10);

$outfits = [];
$mounts = [];

$player = new Player(1);
$playerStorages = $player->getStorages();

for($key = PSTRG_OUTFITS_RANGE_START + 1; $key < PSTRG_OUTFITS_RANGE_START + PSTRG_OUTFITS_RANGE_SIZE; $key++)
{
   if (isset($playerStorages[$key])) {
       $value = $playerStorages[$key];
       $outfitType = ($value & 0xFFFF0000) >> 16;
       $outfitAddonToImageGenerator = ($value & 0x0000FFFF);
       $outfitHasAddon1 = ($value & 0x0000FFFF & 1) > 0;
       $outfitHasAddon2 = ($value & 0x0000FFFF & 2) > 0;
       $outfits[] = [
           'look_type' => $outfitType,
           'look_addon' => $outfitAddonToImageGenerator,
           'has_addon_1' => $outfitHasAddon1,
           'has_addon_2' => $outfitHasAddon2,
       ];
   } else {
       break;
   }
}

for ($mountId = 1; $mountId < 300; $mountId++) {
   $tmpMountId = $mountId - 1;
   $key = PSTRG_MOUNTS_RANGE_START + ($tmpMountId / 31);

   if (isset($playerStorages[$key])) {
       if(((1 << ($tmpMountId % 31)) & $playerStorages[$key]) != 0) {
           $mounts[] = $mountId;
       }
   }
}

echo '<pre>';
var_dump($outfits);
var_dump($mounts);
echo '</pre>';
You can pass these values to Outfit Generator script to show outfit images with addons/mounts.
 
Someone asked me how to display player outfits, addons and mounts on 'characters' page. I didn't prepare whole script, but I wrote PHP code to read that data from database with Gesior2012:

PHP:
<?php
define('PSTRG_RESERVED_RANGE_START', 10000000);
define('PSTRG_OUTFITS_RANGE_START', PSTRG_RESERVED_RANGE_START + 1000);
define('PSTRG_OUTFITS_RANGE_SIZE', 500);
define('PSTRG_MOUNTS_RANGE_START', PSTRG_RESERVED_RANGE_START + 2001);
define('PSTRG_MOUNTS_CURRENTMOUNT', PSTRG_MOUNTS_RANGE_START + 10);

$outfits = [];
$mounts = [];

$player = new Player(1);
$playerStorages = $player->getStorages();

for($key = PSTRG_OUTFITS_RANGE_START + 1; $key < PSTRG_OUTFITS_RANGE_START + PSTRG_OUTFITS_RANGE_SIZE; $key++)
{
   if (isset($playerStorages[$key])) {
       $value = $playerStorages[$key];
       $outfitType = ($value & 0xFFFF0000) >> 16;
       $outfitAddonToImageGenerator = ($value & 0x0000FFFF);
       $outfitHasAddon1 = ($value & 0x0000FFFF & 1) > 0;
       $outfitHasAddon2 = ($value & 0x0000FFFF & 2) > 0;
       $outfits[] = [
           'look_type' => $outfitType,
           'look_addon' => $outfitAddonToImageGenerator,
           'has_addon_1' => $outfitHasAddon1,
           'has_addon_2' => $outfitHasAddon2,
       ];
   } else {
       break;
   }
}

for ($mountId = 1; $mountId < 300; $mountId++) {
   $tmpMountId = $mountId - 1;
   $key = PSTRG_MOUNTS_RANGE_START + ($tmpMountId / 31);

   if (isset($playerStorages[$key])) {
       if(((1 << ($tmpMountId % 31)) & $playerStorages[$key]) != 0) {
           $mounts[] = $mountId;
       }
   }
}

echo '<pre>';
var_dump($outfits);
var_dump($mounts);
echo '</pre>';
You can pass these values to Outfit Generator script to show outfit images with addons/mounts.

how we can generate the .png files for outfits folder?
 
how we can generate the .png files for outfits folder?
You can generate your outfits from .spr/.dat with OTClient or use my ready to use online generator:
Tibia Outfit Images Generator 10.92
There are outfits from version around 11.53 as I remember (last version before 'new client').

You just need to add parameters to address:
http://outfit-images.ots.me/animate...&body=12&legs=23&feet=31&mount=36&direction=2
and it will return:
outfit.php
 
Back
Top