continue; } // Invalid gump ID if ($gumpid < 10000) { if ($female == 1) { $gumpid += 60000; } else { $gumpid += 50000; } } } else { continue; } // Not wearable } LoadRawGump($gumpindex, $gumpfile, intval($gumpid), $hue, $hues, $gumprawdata); } // Separate name and skill title $nametitle = striphtmlchars($nametitle); if (($i = strpos($nametitle, ",")) !== FALSE) { $name = substr($nametitle, 0, $i); $title = substr($nametitle, $i + 2); } else { $name = $nametitle; $title = ""; } AddText($gumprawdata, $name, $title); CreateGump($gumprawdata); fclose($hues); fclose($tiledata); fclose($gumpfile);
function creategumpart($index, $hue, $show) { if (file_exists("images/gumpart/gumpart_" . $index . "_" . $hue . ".png")) { if ($show == 1) { Header("Content-type: image/png"); header("Content-disposition: inline; filename=gumpart_" . $index . "_" . $hue . ".png"); $img = imagecreatefrompng("images/gumpart/gumpart_" . $index . "_" . $hue . ".png"); $black = imagecolorallocate($img, 0, 0, 0); imagecolortransparent($img, $black); imagepng($img); return; } } $mulpath = "./uofiles/"; $isgump = intval(1); $hues = FALSE; $tiledata = FALSE; $gumpfile = FALSE; $gumpindex = FALSE; $hues = fopen("{$mulpath}hues.mul", "rb"); if ($hues == FALSE) { die("Unable to open hues.mul - ERROR\nDATAEND!"); exit; } $tiledata = fopen("{$mulpath}tiledata.mul", "rb"); if ($tiledata == FALSE) { fclose($hues); die("Unable to open tiledata.mul - ERROR\nDATAEND!"); exit; } $gumpfile = fopen("{$mulpath}gumpart.mul", "rb"); if ($gumpfile == FALSE) { fclose($hues); fclose($tiledata); die("Unable to open gumpart.mul - ERROR\nDATAEND!"); exit; } $gumpindex = fopen("{$mulpath}gumpidx.mul", "rb"); if ($gumpindex == FALSE) { fclose($hues); fclose($tiledata); fclose($gumpfile); die("Unable to open gumpidx.mul - ERROR\nDATAEND!"); exit; } if ($hue < 1 || $hue > 65535) { $hue = 0; } if ($isgump > 0 || $index == 12 || $index == 13) { $isgump = 1; } else { $isgump = 0; } //if ($index > 0x7FFF || $index <= 0 || $hue > 65535 || $hue < 0) // 0x3FFF // continue; if ($isgump == 1) { // Male/Female Gumps or IsGump Param $gumpid = $index; } else { $group = intval($index / 32); $groupidx = $index % 32; fseek($tiledata, 512 * 836 + 1188 * $group + 4 + $groupidx * 37, SEEK_SET); if (feof($tiledata)) { die; } // Read the flags $flags = read_big_to_little_endian($tiledata, 4); if ($flags == -1) { die; } if ($flags & 0x404002) { //0x00400000 fseek($tiledata, 6, SEEK_CUR); $gumpid = read_big_to_little_endian($tiledata, 2); $gumpid = $gumpid & 0xffff; if ($gumpid > 65535 || $gumpid <= 0) { die; } // Invalid gump ID } else { continue; } // Not wearable } LoadRawGump($gumpindex, $gumpfile, intval($gumpid), $hue, $hues, $gumprawdata); CreateGump($gumprawdata, $index, $hue); fclose($hues); fclose($tiledata); fclose($gumpfile); fclose($gumpindex); if ($show == 1) { Header("Content-type: image/png"); header("Content-disposition: inline; filename=gumpart_" . $index . "_" . $hue . ".png"); $img = imagecreatefrompng("images/gumpart/gumpart_" . $index . "_" . $hue . ".png"); $black = imagecolorallocate($img, 0, 0, 0); imagecolortransparent($img, $black); imagepng($img); imagedestroy($img); } return; }