Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[CHRTMS]GD Character Generation Files.

may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
Jesus. It's your birthday. Honestly.. Jesus this was a painful as poop to accomplish but manage to do it.. Anyways these are the generation files I made to get the JSON based Character GD I released earlier. These files are generated differently depending on what they are. Like I said before these arent 100% the best way or the 100% generated of the GD. There should be little mistakes here and there and coordinate mistakes but 90% of them are correct. I did get extremely bored and a bit stressed doing this so you may see like "colorful" variable names in these files like League of Legend names or "LegendOfKorra" and what not. Hope you enjoy these files and gl trying to understand some(like weapons lol).

Tested on: v.149

I won't update this since I'm done working on this, too time consuming and hair pulling on the trail and errors.

Instructions:
XkyXZRJ - [CHRTMS]GD Character Generation Files. - RaGEZONE Forums
  • Set your folder like this
  • Dump the XML using
  • To export XML select the type(click Accessory, Weapon) then go to "Tools" > "Export Selection" > "XML" > "Classic"
  • Accessory folder is where you dumped your XML files.(name the folder based on what the generation file variable "$dir" is focused on in the generation files)
  • Create a folder named oraios"$dir".(ex. oraiosAccessory, oraiosHair, etc.)(this is where your newly generated JSON files are going to get dumped)
  • index.php is the generation file(in this case the script below this)
  • run this script via localhost
  • give it time to run(the utmost time would be 3-4 minutes for weapons)
  • A new folder should be created containing the JSON files
Accessory:
PHP:
<?php 
	ini_set('max_execution_time', 14000);
	$dir = 'Accessory/';
	$storage = [];
	foreach(array_slice(scandir($dir), 2) as $id) {
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		if(!isset($info['imgdir'][0]) || $id === '01022048.img.xml') {
			continue;
		}
		foreach($info['imgdir'] as $img) {
			if($img['@attributes']['name'] === 'default') {
				$cache = $img['canvas'];
				if(isset($img['canvas'][0])) {
					$cache = $cache[0];
				}
				$z = isset($cache['string'][0]) ? $cache['string'][0]  : $cache['string'];
				$storage['x'] = -($cache['vector']['@attributes']['x'] + $cache['imgdir'][0]['@attributes']['x']);
				$storage['y'] = -($cache['vector']['@attributes']['y'] + $cache['imgdir'][0]['@attributes']['y']);
				$storage['z'] = $z['@attributes']['value'];
				if(isset($cache['string'][0])) {
					$source = explode('/', $cache['string'][1]['@attributes']['value']);
					$xml = simplexml_load_file($dir.$source[2].'.xml');
					$assist = json_decode(json_encode($xml), true)['imgdir'];
					foreach($assist as $img2) {
						if($img2['@attributes']['name'] === $source[3]) {
							$short = $source[count($source) - 1] === 'iconRaw' ? $img2['canvas'][1] : (count($source) === 6 ? $img2['imgdir'][0]['canvas'] : $img2['canvas']);
							$storage['data'] = $short['@attributes']['basedata'];
							break 2;
						}
					}
				} else {
					$storage['data'] = $cache['@attributes']['basedata'];
					break;
				}
			}
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
                $storage = [];
	}
?>
Cap:
There should be one error warning when this is done executing just ignore it, one of the xml items is broken(thanks nexon)
PHP:
<?php
//error_reporting(0);
ini_set('max_execution_time', 14000);
$dir = 'Cap/';
//00020000.img.xml has a string error.


if ($handle = opendir($dir)) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            // Collect Data
			$info = [];
			$xml = simplexml_load_file($dir.$entry);
			$array = json_decode(json_encode($xml), true);
			$standimages = ['01003862', '01003492', '01003493', '01003494', '01003495', '01003496'];
			$default = ['default', 'default0', '0'];
			$useless = ['default2', 'default3', 'default4', 'default5', 'default6', 'default7', 'default8', 'default9', 'default10', 'defaultPront','1', '2', '3', '4', 'default_N', 'defaultAni', 'defaultacc'];//idk about the last one.
			$piece = ['defaultAc', 'defaultAC', 'defaultBack', 'acc', 'defaultB', 'defaultTail', 'default1'];//tail might be extra.
			$default = ['default', 'default0', '0'];
			$transparent = ['01002186', '01003271', '01003276', '01003900', '01004037', '01003843', '01003848', '01003849', '01003850', '01003851', '01003852', '01004059', '01004040', '01004041', '01004041', '01004042', '01004043', '01004044'];
			if(in_array( substr($entry, 0, -8), $transparent )) {
				continue;
			}
			if(in_array($array['imgdir'][1]['@attributes']['name'], $default)) {
				
				$loc = $array['imgdir'][1]['canvas'];//one item with this broken(01003862)
				
				//Ac or Belowbody
				if(!empty($loc) && array_key_exists(1, $loc)) {//meh too lazy to fix that one item
					foreach($loc as $canvas) {
						$which = '';//head
						if(in_array($canvas['@attributes']['name'], $useless)) {
							continue;
						} else if(in_array($canvas['@attributes']['name'], $piece)) {
							$which = 'ac_';
						} else if($canvas['@attributes']['name'] == 'defaultBelowBody' || $canvas['@attributes']['name'] == 'defaultback') {
							$which = 'bb_';
						} else if(in_array($canvas['@attributes']['name'], $default)) {//head
							$which = '';//head
						}
						$info[$which.'x'] = -($canvas['vector']['@attributes']['x'] + $canvas['imgdir'][0]['@attributes']['x']);
						$info[$which.'y'] = -($canvas['vector']['@attributes']['y'] + $canvas['imgdir'][0]['@attributes']['y']);
						//source
						if(array_key_exists(1, $canvas['string']) && array_key_exists('name', $canvas['string'][1]['@attributes']) && $canvas['string'][1]['@attributes']['name'] == 'source') {
							$id = preg_replace("/[^0-9]/",'', $canvas['string'][1]['@attributes']['value']);
							if(strlen($id) != 8) {
								$id = substr($id, 0 , -1);
							}
							$xml = simplexml_load_file($dir.$id.'.img.xml');
							$assist = json_decode(json_encode($xml), true);
							
							if($assist['imgdir'][1]['@attributes']['name'] == 'default') {
								if(array_key_exists(1, $assist['imgdir'][1]['canvas'])) {
									$info[$which.'data'] = $assist['imgdir'][1]['canvas'][0]['@attributes']['basedata'];
								} else {//needed??
									$info[$which.'data'] = $assist['imgdir'][1]['canvas']['@attributes']['basedata'];
								}
							} else {
								foreach($assist['imgdir'] as $stances) {
									if($stances['@attributes']['name'] == 'default') {
										if(array_key_exists(1, $stances['canvas'])) {
											$info[$which.'data'] = $stances['canvas'][0]['@attributes']['basedata'];
										} else {//needed??
											$info[$which.'data'] = $stances['canvas']['@attributes']['basedata'];
										}
										
									}
								}
							}
							$info['vslot'] = !array_key_Exists('string', $assist['imgdir'][0]) ? 'H1' : $assist['imgdir'][0]['string'][1]['@attributes']['value'];
						} else {
							$info[$which.'data'] = $canvas['@attributes']['basedata'];
							$info['vslot'] = !array_key_Exists('string', $array['imgdir'][0]) ? 'H1' : $array['imgdir'][0]['string'][1]['@attributes']['value'];
						}
					}
				} else {
					if($loc['@attributes']['width'] == 1 && in_array(substr($entry, 0, -8), $standimages )) {
						foreach($array['imgdir'] as $lissandra) {
							if($lissandra['@attributes']['name'] == 'stand1') {
								//print_r($lissandra['imgdir'][0]['canvas'].' - '.$entry.'<br />');
								$info['x'] = -($lissandra['imgdir'][0]['canvas']['vector']['@attributes']['x'] + (array_key_exists('imgdir', $lissandra['imgdir'][0]['canvas']) ? $lissandra['imgdir'][0]['canvas']['imgdir'][0]['@attributes']['x']: 0));
								$info['y'] = -($lissandra['imgdir'][0]['canvas']['vector']['@attributes']['y'] + (array_key_exists('imgdir', $lissandra['imgdir'][0]['canvas']) ? $lissandra['imgdir'][0]['canvas']['imgdir'][0]['@attributes']['y']: 0));
								$info['data'] = $lissandra['imgdir'][0]['canvas']['@attributes']['basedata'];
								$info['vslot'] = !array_key_Exists('string', $array['imgdir'][0]) ? 'H1' : $array['imgdir'][0]['string'][1]['@attributes']['value'];
								break;
							}
						}
						
					} else {
					
					$info['x'] = -($loc['vector']['@attributes']['x'] + (array_key_exists('imgdir', $loc) ? $loc['imgdir'][0]['@attributes']['x']: 0));
					$info['y'] = -($loc['vector']['@attributes']['y'] + (array_key_exists('imgdir', $loc) ? $loc['imgdir'][0]['@attributes']['y']: 0));
					//source should be done outside these loops so i dont need 2 of them..
					if(array_key_exists('string', $loc) && array_key_exists(1, $loc['string']) && array_key_exists('name', $loc['string'][1]['@attributes']) && $loc['string'][1]['@attributes']['name'] == 'source') {
							$id2 = preg_replace("/[^0-9]/",'', $loc['string'][1]['@attributes']['value']);
							//01002785.img.xml weekly event has an extra number added from path to source.
							if(strlen($id2) != 8) {
								$id2 = substr($id2, 0 , -1);
							}
							$xml = simplexml_load_file($dir.$id2.'.img.xml');
							$assist = json_decode(json_encode($xml), true);
							
							if($id2 == '01002785'){//weekly has 2 extra imgdir
								$info['data'] = $assist['imgdir'][1]['imgdir'][0]['imgdir'][1]['canvas']['@attributes']['basedata'];
							} else if(array_key_exists(1, $assist['imgdir'][1]['canvas'])) {
								$info['data'] = $assist['imgdir'][1]['canvas'][0]['@attributes']['basedata'];
							} else {
								$info['data'] = $assist['imgdir'][1]['canvas']['@attributes']['basedata'];
							}
							$info['vslot'] = !array_key_Exists('string', $assist['imgdir'][0]) ? 'H1' : $assist['imgdir'][0]['string'][1]['@attributes']['value'];
						} else {
							$info['data'] = $loc['@attributes']['basedata'];
							$info['vslot'] = !array_key_Exists('string', $array['imgdir'][0]) ? 'H1' : $array['imgdir'][0]['string'][1]['@attributes']['value'];
						}
				}
				}
			} else {
				//if default isnt first, check all the imdir for it just in case (01003399)
				foreach($array['imgdir'] as $stances) {
					
					if($stances['@attributes']['name'] == 'default') {
						if(array_key_exists(1, $stances['canvas'])) {
							foreach($stances['canvas'] as $alistar) {
								
								if(in_array($alistar['@attributes']['name'], $useless)) {
									continue;
								} else if(in_array($alistar['@attributes']['name'], $piece)) {
									
									$which = 'ac_';
								} else if($alistar['@attributes']['name'] == 'defaultBelowBody' || $alistar['@attributes']['name'] == 'defaultback') {
									$which = 'bb_';
								} else if(in_array($alistar['@attributes']['name'], $default)) {//head
									$which = '';//head
								}
								$info[$which.'x'] = -($alistar['vector']['@attributes']['x'] + (array_key_exists('imgdir', $alistar) ? $alistar['imgdir'][0]['@attributes']['x']: 0));
								$info[$which.'y'] = -($alistar['vector']['@attributes']['y'] + (array_key_exists('imgdir', $alistar) ? $alistar['imgdir'][0]['@attributes']['y']: 0));
								$info[$which.'data'] = $alistar['@attributes']['basedata'];
								$info['vslot'] = !array_key_Exists('string', $array['imgdir'][0]) ? 'H1' : $array['imgdir'][0]['string'][1]['@attributes']['value'];
							}
						} else {//needed??
						
							
							$info['x'] = -($stances['canvas']['vector']['@attributes']['x'] + (array_key_exists('imgdir', $stances['canvas']) ? $stances['canvas']['imgdir'][0]['@attributes']['x']: 0));
							$info['y'] = -($stances['canvas']['vector']['@attributes']['y'] + (array_key_exists('imgdir', $stances['canvas']) ? $stances['canvas']['imgdir'][0]['@attributes']['y']: 0));
							$info['data'] = $stances['canvas']['@attributes']['basedata'];
							$info['vslot'] = !array_key_Exists('string', $array['imgdir'][0]) ? 'H1' : $array['imgdir'][0]['string'][1]['@attributes']['value'];
						}
					}
				}
			}
			
			
			$file = fopen('oraiosCap/'.substr($entry, 0, -8).'.json', 'w');
			fwrite($file, json_encode($info, JSON_UNESCAPED_SLASHES));
			fclose($file);
				
        }
    }
    closedir($handle);
}
print_r('done');
?>
Cape:
PHP:
<?php 
	ini_set('max_execution_time', 14000);
	$dir = 'Cape/';
	$img = [];
	$storage = [];
	$broken = ['01102174', '01102376', '01102377', '01102378', '01102385', '01102386', '01102420', '01102450', '01102451', '01102452', '01102453', '01102466', '01102487', '01102491', '01102532', '01102511', '01102513', '01102537', '01102546', '01102547', '01102548', '01102550', '01102551', '01102572', '01102575', '01102576', '01102587', '01102588', '01102589', '01102609', '01102610', '01102611', '01102583', '01102608', '01102616', '01102617', '01102619', '01102620', '01102621', '01102624', '01102629', '01102630', '01102643', '01102644'];
	foreach(array_slice(scandir($dir), 2) as $id) {
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		if(!isset($info['imgdir'][0]) || in_array(substr($id, 0, 8), $broken)) {
			continue;
		}
		$count = count($info['imgdir']);
		for($x = 0; $x < $count; $img[$info['imgdir'][$x]['@attributes']['name']] = $x, $x++);
		for($i = 1; $i < 3; $i++) {
			if(isset ($img['stand'.$i])) {
				$cache = $info['imgdir'][$img['stand'.$i]]['imgdir'][0];
				if(isset($cache[0]) || isset($cache['uol'])) {//uol == capearm as well
					if(isset($cache['uol'])) {
						if(isset($cache['uol'][0])) {
							$which = $cache['uol'][0];
						} else {
							$which = $cache['uol'];
						}
					}	else {
						$which = $cache[0];
					}
					$split = explode('/', $which['@attributes']['value']);
					if(count($split) === 5) {
						$cache = $info['imgdir'][$img[$split[2]]]['imgdir'][0]['canvas'];
					}
				} else {
					$cache = $cache['canvas'];
				}
				if(!isset($cache[0])) {//capearm
					$cache = [$cache];
				}
				foreach($cache as $part) {
					if(!isset($part['imgdir'])) {
						echo $id;
						die;
					}
					$name = str_replace('cape', '', $part['@attributes']['name']);
					$z = isset($part['string'][1]) ? [true, $part['string'][0]] : [false, $part['string']];
					$storage["x{$name}_".$i] = -($part['vector']['@attributes']['x'] + $part['imgdir'][0]['@attributes']['x']);
					$storage["y{$name}_".$i] = -($part['vector']['@attributes']['y'] + $part['imgdir'][0]['@attributes']['y']);
					$storage['z_'.$i] = $z[1]['@attributes']['value'];
					//source
					if($z[0]) {
						$source = explode('/',  $part['string'][1]['@attributes']['value']);
						if(count($source) != 6) {
							echo $id;
							die;
						}
						if($source[2] === substr($id, 0, 12)) {
							$assist = $info['imgdir'];
						} else  {
							$xml = simplexml_load_file($dir.$source[2].'.xml');
							$assist = json_decode(json_encode($xml), true)['imgdir'];
						}
						foreach($assist as $imgdir) {
							if($imgdir['@attributes']['name'] === $source[3]) {
								$shorten = $imgdir['imgdir'][0]['canvas'];
								if(isset($shorten[0])) {
									$shorten = $shorten[$source[4]];
								}
								$storage["data{$name}_".$i] = $shorten['@attributes']['basedata'];
								break;
							}
						}
					} else {
						$storage["data{$name}_".$i] = $part['@attributes']['basedata'];
					}
				}
			}
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
		$storage = [];
	}
?>
Coat:
PHP:
<?php 
	ini_set('max_execution_time', 14000);
	$dir = 'Coat/';
	$storage=[];
	foreach(array_slice(scandir($dir), 2) as $id) {
		if($id === '01102380.img.xml') {
			continue;
		}
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		foreach($info['imgdir'] as $img) {
			for($i=1; $i < 3; $i++) {
				if($img['@attributes']['name'] === 'stand'.$i) {
					$arr =['mail', 'mailArm'];
					$cache = $img['imgdir'][0]['canvas'];
					if(!isset($cache[0])) {
						$cache = [$cache];
					}
					foreach($cache as $canvas) {
						foreach($arr as $name) {
							if($canvas['@attributes']['name'] === $name) {
								$storage['x'.$i.$canvas['@attributes']['name']] = -($canvas['vector']['@attributes']['x'] + $canvas['imgdir'][0]['@attributes']['x']);
								$storage['y'.$i.$canvas['@attributes']['name']] = -($canvas['vector']['@attributes']['y'] + $canvas['imgdir'][0]['@attributes']['y']);
								if(isset($canvas['string'][0])) {
									$source = explode('/', $canvas['string'][1]['@attributes']['value']);
									//Character/Cap/01001055.img/default/defaultAc
									if(count($source) === 6) {
										if($id == $source[2].'.xml') {
											$loop = $info['imgdir'];
										} else {
											$ext = simplexml_load_file($dir.$source[2].'.xml');
											$loop = json_decode(json_encode($ext), true)['imgdir'];
										}
										foreach($loop as $img) {
											if($img['@attributes']['name'] === $source[3]) {
												$short = $img['imgdir'][$source[4]]['canvas'];
												if(!isset($short[0])) {
													$short = [$short];
												}
												foreach($short as $canvas2) {
													if($canvas2['@attributes']['name'] === $source[5]) {
														$storage['data'.$i.$canvas['@attributes']['name']] = $canvas2['@attributes']['basedata'];
														break 2;
													}
												}
											}
										}
									}
								} else {
									$storage['data'.$i.$canvas['@attributes']['name']] = $canvas['@attributes']['basedata'];
								}
							}
						}
					}
				}
			}
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
	}
?>
Face:
PHP:
<?php

ini_set('max_execution_time', 14000);
//00020000.img.xml has a string error.
$dir = 'Face/face/';
if ($handle = opendir($dir)) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            // Collect Data
			$info = [];
			$xml = simplexml_load_file($dir.$entry);
			$array = json_decode(json_encode($xml), true);
			
			if($array['imgdir'][1]['@attributes']['name'] == 'default') {
				$loc = $array['imgdir'][1]['canvas'];
				$info['x'] = -$loc['vector']['@attributes']['x']-$loc['imgdir'][0]['@attributes']['x'];//offset
				$info['y'] = -$loc['vector']['@attributes']['y']-$loc['imgdir'][0]['@attributes']['y'];//offset
				$info['wid'] = $loc['@attributes']['width'];
				$info['hei'] = $loc['@attributes']['height'];
					
				if(array_key_exists(1, $loc['string'])) {
					$id = preg_replace('/[^0-9]/', '', $loc['string'][1]['@attributes']['value']);
					$xml = simplexml_load_file($dir.$id.'.img.xml');
					$assist = json_decode(json_encode($xml), true);
					$info['data'] = $assist['imgdir'][1]['canvas']['@attributes']['basedata'];
				} else {
					$info['data'] = $loc['@attributes']['basedata'];
				}
					
				$file = fopen('oraiosFace/'.substr($entry, 0, -8).'.json', 'w');
				fwrite($file, json_encode($info, JSON_UNESCAPED_SLASHES));
				fclose($file);
			}	
        }
    }
    closedir($handle);
}
echo "Done";
?>
Glove:
PHP:
<?php 
	ini_set('max_execution_time', 14000);
	$dir = 'Glove/';
	$storage = [];
	$skip = '01082102.img.xml';
	foreach(array_slice(scandir($dir), 2) as $id) {
		if($id === $skip){
			continue;
		}
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		foreach($info['imgdir'] as $img) {
			for($i=1; $i < 3; $i++) {
				if($img['@attributes']['name'] === 'stand'.$i) {
					$cache = $img['imgdir'][0]['canvas'];
					if(!isset($cache[0])) {
						$cache = [$cache];
					}
					$arr =[['lGlove', 'Left'], ['rGlove', 'Right']];
					foreach($cache as $canvas) {
						foreach($arr as $name) {
							if($canvas['@attributes']['name'] === $name[0]) {
								$storage['x'.$name[1].$i] = -($canvas['vector']['@attributes']['x'] + $canvas['imgdir'][0]['@attributes']['x']);
								$storage['y'.$name[1].$i] = -($canvas['vector']['@attributes']['y'] + $canvas['imgdir'][0]['@attributes']['y']);
								if(isset($canvas['string'][0])) {
									$source = explode('/', $canvas['string'][1]['@attributes']['value']);
									if(count($source) === 6) {
										if($id == $source[2].'.xml') {
											$loop = $info['imgdir'];
										} else {
											$ext = simplexml_load_file($source[1].'/'.$source[2].'.xml');
											$loop = json_decode(json_encode($ext), true)['imgdir'];
										}
										foreach($loop as $img) {
											if($img['@attributes']['name'] === $source[3]) {
												$short = $img['imgdir'][$source[4]]['canvas'];
												if(!isset($short[0])) {
													$short = [$short];
												}
												foreach($short as $canvas2) {
													if($canvas2['@attributes']['name'] === $source[5]) {
														$storage['data'.$name[1].$i] = $canvas2['@attributes']['basedata'];
														break 2;
													}
												}
											}
										}
									}
								} else {
									$storage['data'.$name[1].$i] = $canvas['@attributes']['basedata'];
								}
							}
						}
					}
				}
			}
			
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
		$storage = [];//previous data is passed on
	}
?>
Hair:
PHP:
<?php
//error_reporting(0);
ini_set('max_execution_time', 14000);
$dir = 'Hair/';
 
//broken hairshade = 00033150

if ($handle = opendir($dir)) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
		
			$xml = simplexml_load_file($dir.$entry);
			$array = json_decode(json_encode($xml), true);
			$text = "";
			foreach($array['imgdir'] as $imgdir) {
				if($imgdir['@attributes']['name'] == 'default') {
					//multiple ovrbody etc.
					if(array_key_exists(1, $imgdir['canvas'])) {
						$type = $imgdir['canvas'];
						for($i=0, $key = ''; $i < count($type); $i++) {
							if($type[$i]['@attributes']['name'] == 'hair'){
								$key = "";
							} else if($type[$i]['@attributes']['name'] == 'hairOverHead'){
								$key = "oHead_";
							} else if($type[$i]['@attributes']['name'] == 'hairBelowBody'){
								$key = "bBody_";
							}
							$text[$key.'wid'] = $type[$i]['@attributes']['width'];
							$text[$key.'hei'] = $type[$i]['@attributes']['height'];
							$text[$key.'x'] = -($type[$i]['vector']['@attributes']['x'] + $type[$i]['imgdir'][0]['@attributes']['x']);//offset 0?
							$text[$key.'y'] = -($type[$i]['vector']['@attributes']['y'] + $type[$i]['imgdir'][0]['@attributes']['y']);//offset 0??
						
							
							if(array_key_exists(1, $type[$i]['string']) && array_key_exists('name', $type[$i]['string'][1]['@attributes']) && $type[$i]['string'][1]['@attributes']['name'] == 'source') {
								$id = preg_replace("/[^0-9]/",'', $type[$i]['string'][1]['@attributes']['value']);
								if(strlen($id) != 8) {
									$id = substr($id, 0 , -1);
								}
								if(in_array($id.'.img.xml', scandir($dir))) {
									$xml = simplexml_load_file($dir.$id.'.img.xml');
									$assistance = json_decode(json_encode($xml), true);
									foreach($assistance['imgdir'] as $ext) {
										if($ext['@attributes']['name'] == 'default') {
											$text[$key.'bdata'] = $ext['canvas'][$i]['@attributes']['basedata'];
											break;
										}
									}
									if(empty($text[$key.'bdata'])) {	
										print_r($id.'<br />');
									}
								}
							} else {
								$text[$key.'bdata'] = $type[$i]['@attributes']['basedata'];	
							}
						}
					} else {
						for ($i = 0, $oraios=[['hair', ''], ['hairOverHead', 'oHead_'], ['hairBelowBody', 'bBody_']]; $i < 3; $i++) {
							if($array['imgdir'][1]['canvas']['@attributes']['name'] == $oraios[$i][0]) {
								$text[$oraios[$i][1].'wid'] = $array['imgdir'][1]['canvas']['@attributes']['width'];
								$text[$oraios[$i][1].'hei'] = $array['imgdir'][1]['canvas']['@attributes']['height'];
								$text[$oraios[$i][1].'x'] = -($array['imgdir'][1]['canvas']['vector']['@attributes']['x'] + $array['imgdir'][1]['canvas']['imgdir'][0]['@attributes']['x']);
								$text[$oraios[$i][1].'y'] = -($array['imgdir'][1]['canvas']['vector']['@attributes']['y'] + $array['imgdir'][1]['canvas']['imgdir'][0]['@attributes']['y']);
								$text[$oraios[$i][1].'bdata'] = $array['imgdir'][1]['canvas']['@attributes']['basedata'];	
							}
						}
					}
				
					//hairshade.
					if(array_key_exists('imgdir', $imgdir) && array_key_exists('canvas', $imgdir['imgdir'])) {//some have the imgdir but empty so check the canvas
						$data = $imgdir['imgdir']['canvas'];
					
						if(array_key_exists(0, $imgdir['imgdir']['canvas'])) {
							$data = $data[0];
						}
						if(array_key_exists(2, $data['string']) && $data['string'][2]['@attributes']['name'] == 'source') { // add a check for 2 sources.
							$id2 = substr(preg_replace("/[^0-9]/",'', $data['string'][2]['@attributes']['value']), 0, -1);//why does it have an extra 0?
							if(strlen($id2) != 8) {
								$id2 = substr($id2, 0 , -1);
							}
							if(in_array($id2.'.img.xml', scandir($dir))) {
								$xml2 = simplexml_load_file($dir.$id2.'.img.xml');
								$assistance2 = json_decode(json_encode($xml2), true);
								foreach($assistance2['imgdir'] as $pls) {
									if($pls['@attributes']['name'] == 'default') {
										$shrt = $pls['imgdir']['canvas'];
										if(array_key_exists(0, $shrt)) {
											$shrt = $shrt[0];
										}
										$text['shade_wid'] = $shrt['@attributes']['width'];
										$text['shade_hei'] = $shrt['@attributes']['height'];
										$text['shade_x'] = -($shrt['vector']['@attributes']['x']);//$pls['imgdir']['canvas']['imgdir']['vector']['@attributes']['x']
										$text['shade_y'] = -($shrt['vector']['@attributes']['y']);// $pls['imgdir']['canvas']['imgdir']['vector']['@attributes']['x']
										$text['shade_bdata'] = $shrt['@attributes']['basedata'];//attritude
										break;
									}
								}
							}
						} else if(isset($data['vector']['@attributes'])) {
							//not sharing hairshades.
							$text['shade_wid'] = $data['@attributes']['width'];
							$text['shade_hei'] = $data['@attributes']['height'];
							$text['shade_x'] = -$data['vector']['@attributes']['x'];
							$text['shade_y'] = -$data['vector']['@attributes']['y'];
							$text['shade_bdata'] = $data['@attributes']['basedata'];
							break;
						} else {
							echo "undefined: {$entry} <br />";
							continue;
						}					
					}
					break;
				}
			}
			$file = fopen('oraiosHair/'.substr($entry, 0, -8).'.json', 'w');
			fwrite($file, json_encode($text, JSON_UNESCAPED_SLASHES));
			fclose($file);
		
        }
    }
    closedir($handle);
}
?>
Longcoat:
PHP:
<?php 
	ini_set('max_execution_time', 14000);
	$dir = 'Longcoat/';
	$storage=[];
	foreach(array_slice(scandir($dir), 2) as $id) {
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		foreach($info['imgdir'] as $img) {
			for($i=1; $i < 3; $i++) {
				if($img['@attributes']['name'] === 'stand'.$i) {
					$arr =['mail', 'mailArm'];
					$cache = $img['imgdir'][0]['canvas'];
					if(!isset($cache[0])) {
						$cache = [$cache];
					}
					foreach($cache as $canvas) {
						foreach($arr as $name) {
							if($canvas['@attributes']['name'] === $name) {
								$storage['x'.$i.$canvas['@attributes']['name']] = -($canvas['vector']['@attributes']['x'] + $canvas['imgdir'][0]['@attributes']['x']);
								$storage['y'.$i.$canvas['@attributes']['name']] = -($canvas['vector']['@attributes']['y'] + $canvas['imgdir'][0]['@attributes']['y']);
								if(isset($canvas['string'][0])) {
									$source = explode('/', $canvas['string'][1]['@attributes']['value']);
									//Character/Cap/01001055.img/default/defaultAc
									if(count($source) === 6) {
										if($id == $source[2].'.xml') {
											$loop = $info['imgdir'];
										} else {
											$ext = simplexml_load_file($source[1].'/'.$source[2].'.xml');
											$loop = json_decode(json_encode($ext), true)['imgdir'];
										}
										foreach($loop as $img) {
											if($img['@attributes']['name'] === $source[3]) {
												$short = $img['imgdir'][$source[4]]['canvas'];
												if(!isset($short[0])) {
													$short = [$short];
												}
												foreach($short as $canvas2) {
													if($canvas2['@attributes']['name'] === $source[5]) {
														$storage['data'.$i.$canvas['@attributes']['name']] = $canvas2['@attributes']['basedata'];
														break 2;
													}
												}
											}
										}
										//Character/Cap/01001055.img/default/defaultAc
									} else if(count($source) === 5) {
										echo $id.'- lolol<br />';
										unset($storage['x'.$i.$canvas['@attributes']['name']]);
										unset($storage['y'.$i.$canvas['@attributes']['name']]);
									} else {
										echo $id;
										die;
									}
								} else {
									$storage['data'.$i.$canvas['@attributes']['name']] = $canvas['@attributes']['basedata'];
								}
							}
						}
					}
				}
			}
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
	}
	//print_r(json_encode($storage, JSON_UNESCAPED_SLASHES));
?>

pants:
PHP:
<?php
 //error_reporting(0);
 ini_set('max_execution_time', 14000);
 
 $info = [];
 $dir = 'Pants/';
 $files = array_slice(scandir($dir),2);
 foreach($files as $id) {
	$braum = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
	
	$count =  count($braum['imgdir']);
	for($i=0; $i < $count; $i++) {
		if($braum['imgdir'][$i]['@attributes']['name'] == 'stand1') {
			$cache = $braum['imgdir'][$i]['imgdir'][0]['canvas'];
			$info['x'] = -($cache['vector']['@attributes']['x'] + $cache['imgdir'][0]['@attributes']['x']);
			$info['y'] = -($cache['vector']['@attributes']['y'] + $cache['imgdir'][0]['@attributes']['y']);
			$info['wid'] = $cache['@attributes']['width'];
			$info['hei'] = $cache['@attributes']['height'];
			if(array_key_exists('string', $cache) && array_key_exists(1, $cache['string']) && $cache['string'][1]['@attributes']['name'] == 'source') {
				$id2 = substr(preg_replace("/[^0-9]/",'', $cache['string'][1]['@attributes']['value']), 0 , -2);		
				$data2 = simplexml_load_file($dir.$id2.'.img.xml');
				$teemo = json_decode(json_encode($data2), true);
				$info['data'] = $teemo['imgdir'][3]['imgdir'][0]['canvas']['@attributes']['basedata'];		
			} else {
				$info['data'] = $cache['@attributes']['basedata'];
			}
			break;
		}
	}
	$file = fopen('oraiosPants/'.substr($id, 0, -8).'.json', 'w');
	fwrite($file, json_encode($info, JSON_UNESCAPED_SLASHES));
	fclose($file);
 }
 
?>
Shield:
PHP:
<?php
 //error_reporting(0);
 ini_set('max_execution_time', 14000);
 
 $info = [];
 $dir = 'Shield/';
 $files = array_slice(scandir($dir),2);
 
 if (!file_exists('oraios'.$dir)) {
    mkdir('oraios'.$dir, 0777, true);
 }
 
 foreach($files as $id) {
	$braum = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
	$count =  count($braum['imgdir']);
	if($count == 4) continue;
	for($i=0; $i < $count; $i++) {
		if($braum['imgdir'][$i]['@attributes']['name'] == 'stand1') {
			$cache = $braum['imgdir'][$i]['imgdir'][0]['canvas'];
			$leona = $cache['@attributes'];
			$string = $cache['string'];
			if(array_key_exists(0, $string)) {
				$yasuo = json_decode(json_encode(simplexml_load_file($dir.substr(preg_replace("/[^0-9]/",'', $string[1]['@attributes']['value']), 0 , -2).'.img.xml')), true);
				$leona = $yasuo['imgdir'][$i]['imgdir'][0]['canvas']['@attributes'];
				$string = $string[0];
			}
			$info['x'] = -($cache['vector']['@attributes']['x'] + $cache['imgdir'][0]['@attributes']['x']);
			$info['y'] = -($cache['vector']['@attributes']['y'] + $cache['imgdir'][0]['@attributes']['y']);
			$info['z'] = $string['@attributes']['value'];
			$info['wid'] = $leona['width'];
			$info['hei'] = $leona['height'];
			$info['data'] = $leona['basedata'];
			continue;
		}
	}
	$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
	fwrite($file, json_encode($info, JSON_UNESCAPED_SLASHES));
	fclose($file);
 }
 
?>
Shoes:
PHP:
<?php
 //error_reporting(0);
 ini_set('max_execution_time', 14000);
 
 $info = [];
 $dir = 'Shoes/';
 $files = array_slice(scandir($dir), 2);
 foreach($files as $id) {
	$broken = ['01072013', '01072153', '01072360'];//last one is broken
	if(in_array(substr($id, 0, -8), $broken)) {
		continue;
	}
	$braum = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
	
	if($braum['imgdir'][3]['@attributes']['name'] == 'stand1') {
		$cache = $braum['imgdir'][3]['imgdir'][0]['canvas'];
		if(array_key_exists(1, $cache)) {
			for($i=0; $i < count($cache); $i++) {
				$store = '';
				if($cache[$i]['@attributes']['name'] == 'shoes') {
					$store = '';
				} else if($cache[$i]['@attributes']['name'] == 'shoesBack') {
					$store = 'back_';
				} else {
					print_r('unknown: '.$what['@attributes']['name'].' -- '.$id);
				}
				$info[$store.'x'] = -($cache[$i]['vector']['@attributes']['x'] + $cache[$i]['imgdir'][0]['@attributes']['x']);
				$info[$store.'y'] = -($cache[$i]['vector']['@attributes']['y'] + $cache[$i]['imgdir'][0]['@attributes']['y']);
				$info[$store.'wid'] = $cache[$i]['@attributes']['width'];
				$info[$store.'hei'] = $cache[$i]['@attributes']['height'];		
				if(array_key_exists('string', $cache[$i]) && array_key_exists(1, $cache[$i]['string']) && $cache[$i]['string'][1]['@attributes']['name'] == 'source') {
					$id2 = preg_replace("/[^0-9]/",'', $cache[$i]['string'][1]['@attributes']['value']);
					if(strlen($id2) != 8) {
						$id2 = substr($id2, 0 , -2);
					}
					$data2 = simplexml_load_file($dir.$id2.'.img.xml');
					$teemo = json_decode(json_encode($data2), true);
					$info[$store.'data'] = $teemo['imgdir'][3]['imgdir'][0]['canvas'][$i]['@attributes']['basedata'];//bugged?
				} else {
					$info[$store.'data'] = $cache[$i]['@attributes']['basedata'];
				}
			}
		} else {
		
		$info['x'] = -($cache['vector']['@attributes']['x'] + $cache['imgdir'][0]['@attributes']['x']);
		$info['y'] = -($cache['vector']['@attributes']['y'] + $cache['imgdir'][0]['@attributes']['y']);
		$info['wid'] = $cache['@attributes']['width'];
		$info['hei'] = $cache['@attributes']['height'];
		
		if(array_key_exists('string', $cache) && array_key_exists(1, $cache['string']) && $cache['string'][1]['@attributes']['name'] == 'source') {
			$id2 = explode('/', $cache['string'][1]['@attributes']['value']);
			$data2 = simplexml_load_file($dir.$id2[2].'.xml');
			$teemo = json_decode(json_encode($data2), true)['imgdir'];
			foreach($teemo as $dita) {
				if($dita['@attributes']['name'] === $id2[3]) {
					if($id2[count($id2)-1] == 'icon') {
						$short = $teemo[0]['canvas'][0];
					} else {
						$short = $dita['imgdir'][0]['canvas'];
					}
					$info['data'] = $short['@attributes']['basedata'];
					break;
				}
			}
			
		} else {
			$info['data'] = $cache['@attributes']['basedata'];
		}
		}
	} else {
		
	}
	
	$file = fopen('oraiosShoes/'.substr($id, 0, -8).'.json', 'w');
	fwrite($file, json_encode($info, JSON_UNESCAPED_SLASHES));
	fclose($file);
 }
 
?>
Skin:
Dump the images not the XML in harepacker.
PHP:
<?php
	ini_set('max_execution_time', 14000);

	$bodyparts = [
		['stand1Body', 'stand1.0.body'],
		['stand1Arm', 'stand1.0.arm'],
		['stand2Body', 'stand2.0.body'],
		['stand2Arm', 'stand2.0.arm'],
		['stand2Hand', 'stand2.0.hand']
	];
	print_r($bodyparts[1][1]);
	$headparts = [
		['head', 'stand1.0.head'], 
		['ear', 'stand1.0.ear']
	];
	foreach (range(2000, 2014) as $id) {
		$bodyDict = "Skin/0000{$id}.img/";
		$headDict = "Skin/0001{$id}.img/";
		$storage = null;
		if(file_exists ($bodyDict)) {
			for($i=0; $i < count($bodyparts); $i++) {
				$img = $bodyDict.$bodyparts[$i][1].'.png';
				if($fp = fopen($img,"rb", 0)) { 
					$code = fread($fp, filesize($img)); 
					fclose($fp);
					$storage[$bodyparts[$i][0]] = str_replace("\r\n", '', chunk_split(base64_encode($code)));
				}
			}
		}
		if(file_exists ($headDict)) {
			for($j=0; $j < count($headparts); $j++) {
				$img2 = $headDict.$headparts[$j][1].'.png';
				if($fp = fopen($img2,"rb", 0)) { 
					$code = fread($fp, filesize($img2)); 
					fclose($fp);
					$storage[$headparts[$j][0]] = str_replace("\r\n", '', chunk_split(base64_encode($code)));
				}
			}
		}
		if(!empty($storage)) {
			$file = fopen("oraiosSkin/0000{$id}.json", 'w');
			fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
			fclose($file);
		}			
	}
?>
Weapon:
PHP:
<?php 

	ini_set('max_execution_time', 14000);
	$dir = 'Weapon/';
	$storage=[];
	$transparent = ['01342069', '01392000', '01502000', '01512000', '01690100', '01690101', '01690102', '01690103', '01690104', '01690105', '01690106', '01690107', '01690108', '01690109'];
	$testing = false;
	$amount = 0;
	if (!file_exists('oraios'.$dir) && !$testing) {
		mkdir('oraios'.$dir, 0777, true);
	}
	//$id2 = '01322188.img.xml';
	foreach(array_slice(scandir($dir), 2) as $id) {
		$isCash = -1;
		$info = json_decode(json_encode(simplexml_load_file($dir.$id)), true);
		$itemID = substr($id, 0, 8);
		if(isset($info['imgdir'][0]) && !in_array($itemID, $transparent)) {
			if(isset($info['imgdir'][0]['int'])) {
				foreach ($info['imgdir'][0]['int'] as $detail) {
					if($detail['@attributes']['name'] === 'cash') {
						$isCash = (int) $detail['@attributes']['value'];
						break;
					}
				}
			} else if (is_numeric($info['imgdir'][1]['@attributes']['name'])) {
				$isCash = 1;
			} else if (!is_numeric($info['imgdir'][1]['@attributes']['name'])) {
				$isCash = 0;
			}
		} else {
			continue;
		}
		
		if($isCash === 0 || $isCash === -1) {
			foreach($info['imgdir'] as $img) {
				for($i=1; $i < 3; $i++) {//stand
					if($img['@attributes']['name'] === 'stand'.$i) {
						$coord = [12, 6];
						if($i === 2) {
							$coord = [5, -1];
						}
						//uol
						if(!isset($img['imgdir'][0]['canvas'])) {
							echo $id;
							die;
						}
						$shorten = isset($img['imgdir'][0]['canvas'][0]) ? $img['imgdir'][0]['canvas'][0] : $img['imgdir'][0]['canvas'];
						if($shorten['@attributes']['name'] === 'weapon' || $shorten['@attributes']['name'] === 'shield') {
							$hasSource = isset($shorten['string'][0]) ? 1 : 0;
							$z = $hasSource ? $shorten['string'][0] : $shorten['string'];
							$storage['x_'.$i] = -($shorten['vector']['@attributes']['x'] + $shorten['imgdir'][0]['@attributes']['x'])  + ($shorten['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);//coordinate variable here
							$storage['y_'.$i] = -($shorten['vector']['@attributes']['y'] + $shorten['imgdir'][0]['@attributes']['y'])  + ($shorten['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
							$storage['z_'.$i] = $z['@attributes']['value'];
							if($hasSource) {
								$source = explode('/', $shorten['string'][1]['@attributes']['value']);
								$stance = $source[2 + (count($source) === 6 ? 1 : 0)];
								$stance_frame = $source[3 + (count($source) === 6 ? 1 : 0)];
								if (count($source) === 5) { // strpos($source, $itemID) !== false
									$assist = $info;
								} else if (count($source) === 6) {
									$sourceID = substr(preg_replace('/[^0-9]/','',  $source[2]), 0, 8);
									$ext = simplexml_load_file($dir.$sourceID.'.img.xml');
									$assist = json_decode(json_encode($ext), true);
								}
								
								$count = count($assist['imgdir']);
								for ($x=0; $x < $count; $x++) {
								if(!isset($assist['imgdir'][$x])) {
									echo $id;
									die;
								}
									if($assist['imgdir'][$x]['@attributes']['name'] === $stance) {
										$name = $x;
										break;
									}
								}
								if(count($assist['imgdir'][$name]['imgdir']) == 2 && !isset($assist['imgdir'][$name]['imgdir'][0])) {//attribute + canvas
									$shorten2 = $assist['imgdir'][$name]['imgdir']['canvas'];
								} else {
									foreach($assist['imgdir'][$name]['imgdir'] as $imgdir) {
										if($imgdir['@attributes']['name'] == $stance_frame) {
											$shorten2 = isset($imgdir['canvas'][0]) ? $imgdir['canvas'][0] : $imgdir['canvas'];
											break;
										}
									}
								}
								if($shorten['vector']['@attributes']['x'] !== $shorten2['vector']['@attributes']['x']) {
									$storage['x_'.$i] = -($shorten2['vector']['@attributes']['x'] + $shorten2['imgdir'][0]['@attributes']['x'])  + ($shorten2['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);
									$storage['y_'.$i] = -($shorten2['vector']['@attributes']['y'] + $shorten2['imgdir'][0]['@attributes']['y'])  + ($shorten2['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
									$storage['z_'.$i] = $shorten2['string']['@attributes']['value'];
								}
								$storage['data_'.$i] = $shorten2['@attributes']['basedata'];
							} else {
								$storage['data_'.$i] = $shorten['@attributes']['basedata'];
							}
						}
					}
				}
			}
		} else if($isCash === 1) {
			$information = [];
			$getid = -1;
			$children = ['imgdir', 'uol'];
			foreach($info['imgdir'] as $nximg) {//find the stances
				$getid++;
				for($o=0; $o < 2; $o++) {
					if(isset($nximg[$children[$o]]) && !isset($information[0]) || isset($nximg[$children[$o]]) && !isset($information[1])) {
						$count = count($nximg[$children[$o]]);
						for($i=0; $i < $count; $i++) {
							if(!isset($nximg[$children[$o]][0])) continue;
							$pos = $nximg[$children[$o]][$i]; 
							if($pos['@attributes']['name'] === 'stand1' && !array_key_exists(0, $information)) {
								$information[0] = [$getid, $i, $children[$o], 1];
							} else if($pos['@attributes']['name'] === 'stand2' && !array_key_exists(1, $information)) {
								$information[1] = [$getid, $i, $children[$o], 2];
							}
							if(count($information) === 2) {
								break 3;
							}
						}
					}
				}
			}
			foreach($information as $stanceData) {
				$tiny = $info['imgdir'][$stanceData[0]];
				for($j=0; $j < 2; $j++) {
					if(isset($tiny[$children[$j]][$stanceData[1]])) {
						$imgName = $tiny[$children[$j]][$stanceData[1]];//this
					} else {
						continue;
					}
					if($imgName['@attributes']['name'] === 'stand'.$stanceData[3]) {
						$coord = [12, 6];
						if($stanceData[3] == 2) {
							$coord = [5, -1];
						}
						if($stanceData[2] == 'imgdir') {
							$imgName = $imgName['imgdir'][0];
						}
						if($stanceData[2] == 'imgdir' && isset($imgName['canvas'])) {
							$cut = isset($imgName['canvas'][0]) ? $imgName['canvas'][0] : $imgName['canvas'];
							$z2 = array_key_exists(0, $cut['string']) ? $cut['string'][0] : $cut['string'];
							$storage['x_'.$stanceData[3]] = -($cut['vector']['@attributes']['x'] + $cut['imgdir'][0]['@attributes']['x'])  + ($cut['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);
							$storage['y_'.$stanceData[3]] = -($cut['vector']['@attributes']['y'] + $cut['imgdir'][0]['@attributes']['x'])  + ($cut['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
							$storage['z_'.$stanceData[3]] = $z2['@attributes']['value'];
							if(isset ($cut['string'][0])) {
								$assistInfo = explode('/', $cut['string'][1]['@attributes']['value']);
								if(count($assistInfo) == 6) {
									$legendOfKorra = [$assistInfo[2], $assistInfo[3], $assistInfo[4]];//NON-NX
								} else if(count($assistInfo) == 7) {
									$legendOfKorra = [$assistInfo[2], $assistInfo[3], $assistInfo[4], $assistInfo[5]];//NX
								}
								$assistFile = simplexml_load_file($dir.$legendOfKorra[0].'.xml');
								$assistXML = json_decode(json_encode($assistFile), true);
								foreach($assistXML['imgdir'] as $names) {
									if($names['@attributes']['name'] === $legendOfKorra[1]) {
										if(isset($names['imgdir']['canvas'])) {
											$split = $names['imgdir']['canvas'];
											if($cut['vector']['@attributes']['y'] !== $split['vector']['@attributes']['y']) {
												$storage['x_'.$stanceData[3]] = -($split['vector']['@attributes']['x'] + $split['imgdir'][0]['@attributes']['x'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);
												$storage['y_'.$stanceData[3]] = -($split['vector']['@attributes']['y'] + $split['imgdir'][0]['@attributes']['y'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
												
												$zAssist = isset($split['string'][0]) ? $split['string'][0] : $split['string'];
												$storage['z_'.$stanceData[3]] = $zAssist['@attributes']['value'];
											}
											$storage['data_'.$stanceData[3]] = $split['@attributes']['basedata'];	
										} else {
											foreach($names['imgdir'] as $assistNXStance) {
												if($assistNXStance['@attributes']['name'] === $legendOfKorra[2]) {
													if(isset($legendOfKorra[3]) && isset($assistNXStance['imgdir'])) {
														if(isset($assistNXStance['imgdir']['canvas'])) {//attrib and one imgdir.
															$split = $assistNXStance['imgdir']['canvas'];//img dir 0 == legendofkorra3
														} else {
															$split = $assistNXStance['imgdir'][$legendOfKorra[3]]['canvas'];
														}
													} else if(isset($assistNXStance['canvas'])) {//no nx
														$split = $assistNXStance['canvas'];
													}
													$split = isset($split[0]) ? $split[0] : $split;//split[1] is effects.
													if($cut['vector']['@attributes']['y'] !== $split['vector']['@attributes']['y']) {
														$storage['x_'.$stanceData[3]] = -($split['vector']['@attributes']['x'] + $split['imgdir'][0]['@attributes']['x'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);
														$storage['y_'.$stanceData[3]] = -($split['vector']['@attributes']['y'] + $split['imgdir'][0]['@attributes']['y'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
														$storage['z_'.$stanceData[3]] = $split['string']['@attributes']['value'];
													}
													$storage['data_'.$stanceData[3]] = $split['@attributes']['basedata'];
												}
											}
										}
									}
								}
							} else {
								$storage['data_'.$stanceData[3]] = $cut['@attributes']['basedata'];
							}
							continue 2;
						} else if($stanceData[2] == 'uol' || $stanceData[2] == 'imgdir' && isset($imgName['uol'])) {//??
							$fullLoc = null;
							if($stanceData[2] == 'imgdir' && isset($imgName['uol'])) {
								$source_loc = explode('/', $imgName['uol'][0]['@attributes']['value']);//this
								if(count($source_loc) == 5) {//../../alert/1/weapon
									$fullLoc = [$stanceData[0], $source_loc[2], $source_loc[3], false];//same id, stance, frame, name of weapon ever needed?
								} else if(count($source_loc) == 7) {//../../../40/stabO1/1/weapon
									$fullLoc = [$source_loc[3], $source_loc[4], $source_loc[5], true];//same id, stance, frame, name of weapon ever needed?
								} else {
									echo ' new count'.$id;
									die;
								}
								
							} else {
								$source_loc = explode('/', $imgName['@attributes']['value']);//this
								if(count($source_loc) == 1) {//../alert/1/weapon
									$fullLoc = [$stanceData[0], $source_loc[0], 0, false];//same id, stance, frame, name of weapon ever needed?
								} else if(count($source_loc) == 3) {
									$fullLoc = [$source_loc[1], $source_loc[2], 0, true];//../40/stand2
								} else {
									print_r('new count uol'.$id);
									die;
								}
								
							}
							if(!$fullLoc[3]) {
								$loop = $info['imgdir'][$fullLoc[0]];
							} else {
								foreach($info['imgdir'] as $nxImg) {
									if($nxImg['@attributes']['name'] == $fullLoc[0]) {
										$loop = $nxImg;
										break;
									}
								}
							}
							if(!isset($loop['imgdir'][0]) && !isset($loop['imgdir']['imgdir'])) {//hmm
								$loop['imgdir'] = [$loop];
							} else if(isset($loop['imgdir']['imgdir'])) {
								$loop['imgdir'] = [$loop['imgdir']];
							}
							foreach($loop['imgdir'] as $nxStance) {
								if($nxStance['@attributes']['name'] === $fullLoc[1]) {
									$canvas = $nxStance['imgdir'][$fullLoc[2]]['canvas'];
									if(isset($canvas[0])) {
										$canvas = $canvas[0];
									}
									$storage['x_'.$stanceData[3]] = -($canvas['vector']['@attributes']['x'] + $canvas['imgdir'][0]['@attributes']['x'])  + ($canvas['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0] : 0);//-7 for stand 21
									$storage['y_'.$stanceData[3]] = -($canvas['vector']['@attributes']['y'] + $canvas['imgdir'][0]['@attributes']['y'])  + ($canvas['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
									$zAssist = isset($canvas['string'][0]) ? $canvas['string'][0] : $canvas['string'];
									$storage['z_'.$stanceData[3]] = $zAssist['@attributes']['value'];
									//has Source
									if(isset($canvas['string'][0])) {
										$source_loc2 = explode('/', $canvas['string'][1]['@attributes']['value']);
										$nxFile = simplexml_load_file($dir.$source_loc2[2].'.xml');
										$assist = json_decode(json_encode($nxFile), true);
										foreach($assist['imgdir'] as $assistNX) {
											if($assistNX['@attributes']['name'] === $source_loc2[3]) {
												foreach($assistNX['imgdir'] as $assistNXStance) {
													if($assistNXStance['@attributes']['name'] === $source_loc2[4]) {
														if(!isset($assistNXStance['imgdir']) && isset($assistNXStance['canvas'])) {
															$split = $assistNXStance['canvas'];
														} else {
															$split = $assistNXStance['imgdir'][$source_loc2[5]]['canvas'];
														}
														$split = isset($split[0]) ? $split[0] : $split;
														if($canvas['vector']['@attributes']['y'] !== $split['vector']['@attributes']['y']) {
															$storage['x_'.$stanceData[3]] = -($split['vector']['@attributes']['x'] + $split['imgdir'][0]['@attributes']['x'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[0]: 0);
															$storage['y_'.$stanceData[3]] = -($split['vector']['@attributes']['y'] + $split['imgdir'][0]['@attributes']['y'])  + ($split['imgdir'][0]['@attributes']['name'] == 'hand' ? $coord[1]: 0);
															$storage['z_'.$stanceData[3]] = $split['string']['@attributes']['value'];
														}
														//z
														$storage['data_'.$stanceData[3]] = $split['@attributes']['basedata'];
														break 4;// maybe 5
													}
												}
											}
										}
									} else {
										//Z
										$storage['data_'.$stanceData[3]] = $canvas['@attributes']['basedata'];
										break 2;
									}	
								}
							}
						}
					}
				}
			}
		} else {
			echo 'wtf is that'.$id;
			die;
			
		}
		$file = fopen('oraios'.$dir.substr($id, 0, -8).'.json', 'w');
		fwrite($file, json_encode($storage, JSON_UNESCAPED_SLASHES));
		fclose($file);
		$amount++;
		
	}
	echo $amount;
	//print_r(json_encode($storage, JSON_UNESCAPED_SLASHES));
?>
Conclusion:
  • Dual bow doesn't work
  • Some coordinate arent working
  • Some weapons don't show(very few)
  • You can modify the face generation to get multiple faces just add another if statement below the if statement of "Default"
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
Mar 25, 2013
Messages
138
Reaction score
4
I'm getting an multiple errors when using this.
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
Mind posting the xml of "01010000" for me?
 
Junior Spellweaver
Joined
Mar 25, 2013
Messages
138
Reaction score
4
Oh, this happens for like, ALL files, but sure. I also tried Hair as well.
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606
Give me a second to check something really quick


Alright forgot to mention which export method to use lol, in harepacker when exporting use the "Classic" option not the "private server" one. I'll modify the instructions in a minute to make it more clear, also forgot to add more vital step, thanks for reporting this.
69fcZKa - [CHRTMS]GD Character Generation Files. - RaGEZONE Forums

Update:
-Improved instruction and added missing steps
-Clean caching issues in Accessory
-rename dump folder from "rHair" to "oraiosHair"
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
Mar 25, 2013
Messages
138
Reaction score
4

This comes up, but i still get the json files. Btw will you be updating MapleByte with the new json ranking? I enjoyed MapleByte a lot. If not, how can i implement it into MapleBit?
 
may web.very maple.pls.
Loyal Member
Joined
Aug 12, 2009
Messages
1,810
Reaction score
606

This comes up, but i still get the json files. Btw will you be updating MapleByte with the new json ranking? I enjoyed MapleByte a lot. If not, how can i implement it into MapleBit?
There is some index errors sometimes because some xml files are either broken or haven't coded it(highly doubt since I tested everything in Accessory). As for the site I'm not coding it anymore since I don't have enough time and already deleted everything this was the only thing holding me back from deleting everything and I already released it so. Idk about the maplebit implementation since I uninstalled wamp, but it shouldnt be too hard to figure it out :) this gives you the GD so it's easy for you to implement it to existing ranking aside from my json GD ranking, just alter someones ranking to convert the XML to JSOn reading and it should be fine. Good luck :)
 
Junior Spellweaver
Joined
Mar 25, 2013
Messages
138
Reaction score
4
There is some index errors sometimes because some xml files are either broken or haven't coded it(highly doubt since I tested everything in Accessory). As for the site I'm not coding it anymore since I don't have enough time and already deleted everything this was the only thing holding me back from deleting everything and I already released it so. Idk about the maplebit implementation since I uninstalled wamp, but it shouldnt be too hard to figure it out :) this gives you the GD so it's easy for you to implement it to existing ranking aside from my json GD ranking, just alter someones ranking to convert the XML to JSOn reading and it should be fine. Good luck :)

Okay, sounds good! Thank you very much for all the help.
 
Last edited:
Back
Top