D
Deleted member 49793
Guest
I've seen this on here before, but i'm looking for all the creature images in GIFs.
Anyone have it or a link?
Thanks <3
Anyone have it or a link?
Thanks <3
Check Gesiors webserver. he hosts Outfits and everything.I've seen this on here before, but i'm looking for all the creature images in GIFs.
Anyone have it or a link?
Thanks <3
http://outfit-images.ots.me/Check Gesiors webserver. he hosts Outfits and everything.
Hmm.. I can try to make it later.I've seen this on here before, but i'm looking for all the creature images in GIFs.
Anyone have it or a link?
Thanks <3
<?php
$monstersList = [];
if ($zip->open('monster.zip'))
{
for ($i = 0; $i < $zip->numFiles; $i++)
{
$fileName = $zip->getNameIndex($i);
if($fileName != 'monsters.xml')
{
$data = $zip->getFromName($fileName);
if($data)
{
$doc = new DOMDocument();
if($doc->loadXML($data))
{
$monsters = $doc->getElementsByTagName('monster');
$looks = $doc->getElementsByTagName('look');
if(count($monsters) > 0 && count($looks) > 0)
{
$monster = $monsters[0];
$look = $looks[0];
$name = $look->getAttribute('name');
if(empty($name))
{
$errors .= 'Monster without name detected. File: ' . $fileName . '<br />';
continue;
}
$type = (int) $look->getAttribute('type');
if($type > 0)
{
$head = (int) $look->getAttribute('head');
$body = (int) $look->getAttribute('body');
$legs = (int) $look->getAttribute('legs');
$feet = (int) $look->getAttribute('feet');
$addons = (int) $look->getAttribute('addons');
// add creature outfit to list
$monstersList[] = ['img' => 'creature', 'id' => $type, 'head' => $head, 'body' => $body, 'legs' => $legs, 'feet' => $feet, 'addons' => $addons];
}
else
{
$typeEx = (int) $look->getAttribute('typeex');
if($typeEx > 0)
{
// add item outfit
$monstersList[] = ['img' => 'creature', 'id' => $typeEx];
}
else
{
$errors .= $name . ' - invalid outfit or item id value<br />';
continue;
}
}
}
else
{
$errors .= 'Monster without name or look detected. File: ' . $fileName . '<br />';
continue;
}
}
else
{
$errors .= 'Failed to parse XML. File: ' . $fileName . '<br />';
continue;
}
}
}
}
}
echo '<textarea>' . json_encode($monstersList) . '</textarea><br />' . $errors;
Hmm.. I can try to make it later.
Do you want all images for RL tibia monsters [for site like tibia wiki) or all images of your OTS monsters (you send .zip file with monsters folder and script sends you .zip with images)?
-------
EDIT:
I got no time to finish it now. I wrote part of zipped 'monsters' directories parser:
PHP:<?php $monstersList = []; if ($zip->open('monster.zip')) { for ($i = 0; $i < $zip->numFiles; $i++) { $fileName = $zip->getNameIndex($i); if($fileName != 'monsters.xml') { $data = $zip->getFromName($fileName); if($data) { $doc = new DOMDocument(); if($doc->loadXML($data)) { $monsters = $doc->getElementsByTagName('monster'); $looks = $doc->getElementsByTagName('look'); if(count($monsters) > 0 && count($looks) > 0) { $monster = $monsters[0]; $look = $looks[0]; $name = $look->getAttribute('name'); if(empty($name)) { $errors .= 'Monster without name detected. File: ' . $fileName . '<br />'; continue; } $type = (int) $look->getAttribute('type'); if($type > 0) { $head = (int) $look->getAttribute('head'); $body = (int) $look->getAttribute('body'); $legs = (int) $look->getAttribute('legs'); $feet = (int) $look->getAttribute('feet'); $addons = (int) $look->getAttribute('addons'); // add creature outfit to list $monstersList[] = ['img' => 'creature', 'id' => $type, 'head' => $head, 'body' => $body, 'legs' => $legs, 'feet' => $feet, 'addons' => $addons]; } else { $typeEx = (int) $look->getAttribute('typeex'); if($typeEx > 0) { // add item outfit $monstersList[] = ['img' => 'creature', 'id' => $typeEx]; } else { $errors .= $name . ' - invalid outfit or item id value<br />'; continue; } } } else { $errors .= 'Monster without name or look detected. File: ' . $fileName . '<br />'; continue; } } else { $errors .= 'Failed to parse XML. File: ' . $fileName . '<br />'; continue; } } } } } echo '<textarea>' . json_encode($monstersList) . '</textarea><br />' . $errors;
I will try to finish this script tommorow and release gif images of monster.xml generator.
It's my account that I use when I'm not on safe PC (I was at work). I will try to finish it tommorow.Thanks appreciate that. Cool to still see your in the community all these years later
It's my account that I use when I'm not on safe PC (I was at work). I will try to finish it tommorow.
I can put it on ots.me on evening. I will be back in home in around 9 hours. I will try to make monsters gif generator now.
<?php
function endsWith($haystack, $needle) {
// search forward starting from end minus needle length characters
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);
}
$monstersList = [];
$zip = new ZipArchive();
$errors = '<br />ERRORS:<br />';
if ($zip->open('monster.zip') === true)
{
for ($i = 0; $i < $zip->numFiles; $i++)
{
$fileName = $zip->getNameIndex($i);
if(!endsWith($fileName, 'monsters.xml'))
{
$data = $zip->getFromName($fileName);
if($data)
{
$doc = new DOMDocument();
if($doc->loadXML($data))
{
$monsters = $doc->getElementsByTagName('monster');
$looks = $doc->getElementsByTagName('look');
if($monsters->item(0) && $looks->item(0))
{
$monster = $monsters->item(0);
$look = $looks->item(0);
$name = $monster->getAttribute('name');
if(empty($name))
{
$errors .= 'Monster without name detected. File: ' . $fileName . '<br />';
continue;
}
$type = (int) $look->getAttribute('type');
if($type > 0)
{
$head = (int) $look->getAttribute('head');
$body = (int) $look->getAttribute('body');
$legs = (int) $look->getAttribute('legs');
$feet = (int) $look->getAttribute('feet');
$addons = (int) $look->getAttribute('addons');
// add creature outfit to list
$monstersList[] = ['img' => 'creature', 'name' => $name, 'id' => $type, 'head' => $head, 'body' => $body, 'legs' => $legs, 'feet' => $feet, 'addons' => $addons];
}
else
{
$typeEx = (int) $look->getAttribute('typeex');
if($typeEx > 0)
{
// add item outfit
$monstersList[] = ['img' => 'item', 'name' => $name, 'id' => $typeEx];
}
else
{
$errors .= $fileName . ', ' . $name . ' - invalid outfit or item id value<br />';
continue;
}
}
}
else
{
$errors .= 'Monster without name or look detected. File: ' . $fileName . '<br />';
continue;
}
}
else
{
$errors .= 'Failed to parse XML. File: ' . $fileName . '<br />';
continue;
}
}
}
}
}
else
{
$errors .= 'Failed to open ZIP file. Invalid file format?<br />';
}
echo '<textarea style="width:800px;height:200px">' . json_encode($monstersList) . '</textarea><br />' . $errors;
<?php
set_time_limit(300);
$imgFile = tempnam('tmp', 'img');
$zipFile = tempnam('tmp', 'zip');
exit;
function monsterNameToFileName($monsterName)
{
return str_replace(' ', '_', str_replace('.', '_', strtolower($monsterName)));
}
$monstersList = json_decode(file_get_contents('monsters.json'));
$zip = new ZipArchive();
if($zip->open($zipFile, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) === true)
{
foreach($monstersList as $monster)
{
if($monster->img == 'item')
{
$imgPath = 'http://item-images.ots.me/1076/' . $monster->id . '.gif';
$ext = 'gif';
}
else
{
$imgPath = 'http://outfit-images.ots.me/outfit.php?id=' . $monster->id . '&head=' . $monster->head . '&body=' . $monster->body . '&legs=' . $monster->legs . '&feet=' . $monster->feet . '&addons=' . $monster->addons;
$ext = 'png';
}
$content = file_get_contents($imgPath);
if($content !== false)
{
if($ext == 'gif')
{
// change gif [item] to png, all images in same format
/*
$new = imagecreatetruecolor($new_width, $new_height);
$transparent = imagecolorallocatealpha($new, 0, 0, 0, 127);
imagefill($new, 0, 0, $transparent);
imagealphablending($new, true);
*/
}
$zip->addFromString(monsterNameToFileName($monster->name) . '.png', $content);
}
else
{
echo 'Failed to get image of monster ' . $monster->name;
@unlink($imgFile);
@unlink($zipFile);
exit;
}
}
$zip->close();
// dump file
header('Content-Type: application/zip');
header('Content-Length: ' . filesize($zipFile));
header('Content-Disposition: attachment; filename="monster_images.zip"');
readfile($zipFile);
@unlink($imgFile);
@unlink($zipFile);
}
else
{
echo 'Failed to create or open temporary zip file.';
@unlink($imgFile);
@unlink($zipFile);
exit;
}
/*
zip on the fly:
// Prepare File
$file = tempnam("tmp", "zip");
$zip = new ZipArchive();
$zip->open($file, ZipArchive::OVERWRITE);
// Stuff with content
$zip->addFromString('file_name_within_archive.ext', $your_string_data);
$zip->addFile('file_on_server.ext', 'second_file_name_within_archive.ext');
// Close and send to users
$zip->close();
header('Content-Type: application/zip');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename="file.zip"');
readfile($file);
unlink($file);
*/
function monsterNameToFileName($monsterName)
{
return str_replace(' ', '_', str_replace('.', '_', strtolower($monsterName)));
}
I'm uploading right now 10.81 to:Can u host the 10.81 items and outfits to(10.81 xD)?
I did not finish script (needs some style?), but it works:
http://ots.me/get_monsters_images/index.php
put your '/data/monsters' folder in .zip and send it to this site, then click GET ZIP and you will get .zip file with outfit images of monsters in less then minute.
Monsters names are generated from <monster name="xxx" .. > attribute and modified to file names by:
PHP:function monsterNameToFileName($monsterName) { return str_replace(' ', '_', str_replace('.', '_', strtolower($monsterName))); }
-------------
If you want view code/modify it/fix something etc. you can download PHP scripts for it (very simple!):
http://ots.me/get_monsters_images/monsters_images_generator_beta.zip
and host on your home PC.
I'm uploading right now 10.81 to:
http://item-images.ots.me/1081/
so you can use links like (I converted PNG to GIF images):
http://item-images.ots.me/1081/1387.gif
Outfits in 10.81 are same as in 10.79
This code is not acc. maker related. It's just simple images generator script.I use znoteaac though D: