<?php $load = 'c4'; $events = array(); $f = file('./data/events_'.$load.'.txt'); foreach($f as $line) { $c = explode('|', trim($line)); $events[$c[0]][$c[1]] = $c[2]; } $vars = array(); $f = file('./data/vars_'.$load.'.txt'); foreach($f as $line) { $c = explode('|', trim($line)); $vars[$c[0]][$c[1]] = $c[2]; } $functions = array(); $f = file('./data/functions_'.$load.'.txt'); foreach($f as $line) { $c = explode('|', trim($line)); $functions[$c[0]] = explode(',', $c[1]); } $handlers = array(); $f = file('./data/handlers_'.$load.'.txt'); foreach($f as $line) { $c = explode('|', trim($line)); $handlers[$c[1]] = $c[2]; } $f = file('./data/item_pch.txt'); foreach($f as $line) { $c = explode('=', trim($line)); $params['item'][trim($c[1])] = str_replace(']', '', str_replace('[', '', trim($c[0]))); } ?>
<?php include("function.php"); $orig = "ai.obj"; $oh = fopen($orig, 'r'); if (!$oh) { print "can't open AI.obj.\n"; die; } if (!$hmmpf = (ord(fread($oh, 2)) == 255)) { fseek($oh, 0); } print "this will take some time :P\n"; $line = 0; $path = './decompiled/'; $fh = fopen($path.'ai.nasc', 'w'); @fputs($fh, copyright()."\r\n"); $gh = fopen($path.'npc_definitions.txt', 'w'); while(!feof($oh)) { $row = trim(fgets($oh)); if ($hmmpf) { $tmp = $row; $row = ''; for ($i = 0; $i < strlen($tmp); $i += 2) $row .= $tmp[$i]; } $row = str_replace(' ', ' ', $row); if(strlen($row)!=0){ $ai[$line] = $row; if($row == 'class_end'){ if(count($ai) == 2){ $data = explode(' ', trim($ai[0])); print('Processing: '.$data[2]); @fputs($gh, "class ".$data[2]." : ".$data[4]."\r\n{\r\n}\r\n\r\n"); print(" [ Completed ]\r\n"); $line = 0; } else { process_class($ai); $line = 0; } unset($ai); unset($data); unset($incompatibility); } else $line++; } } fclose($fh); fclose($gh); fclose($oh); ?>