Log in

View Full Version : Super simple dragitem to *.gif stripping code


Shin Noir
07-01-2015, 07:30 AM
This is a ack together that takes the latest *.dds files from live (dragitem#.dds) and turns them into item_###.gif files (that reflect the item icon ID). It's total hack, but works.

Requirements: convert
http://www.imagemagick.org/script/convert.php

My version is on a unix based system, but you can easily do windows just changing the convert commands to convert.exe, and any / to \'s.
And cp to copy.

You also need to run php code. (It's a hack!)


<?php
for ($id = 1; $id < 218; $id++) {
echo "$id\n";
if (!file_exists($id)) mkdir($id);
exec("convert dragitem$id.dds -crop 40x40 +repage +adjoin $id/item_%02d.gif");
}

$baseCounter = 500;
if (!file_exists('out')) mkdir('out');

for ($i = 1; $i < 218; $i++) {

$files = scandir($i);

//$row = 1;
$numFiles = 0;

$fileCounter = 0;
$counter = $baseCounter;
foreach ($files as $file) {

if ($file == "." || $file == "..") continue;
if (filesize("$i/$file") < 100) {

continue;
}
$name = $fileCounter+$counter;

//echo "$file = $name";
exec("cp $i/$file out/item_$name.gif");

$fileCounter += 6;

if ($fileCounter >= 31) {
$fileCounter = 0;
$counter++;
}
}
$baseCounter += 36;

}


If you'd rather just get a dump of every item icon let me know.

There's ~7800 icon images