Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. $mn = $argv[1];
  3.  
  4. $file1 = array();
  5. $file2 = array();
  6.  
  7. $file1 = file($mn . '.ide');
  8. $file2 = file($mn . '.opl');
  9.  
  10. if (!$file1) return false;
  11. if (!$file2) return false;
  12.  
  13. foreach($file1 as $key => $value){
  14.     list($a1, $b1, $c1, $d1, $e1, $f1, $g1, $h1, $i1, $j1, $k1, $l1, $m1, $n1, $o1, $p1, $q1, $r1, $s1, $t1, $u1, $v1, $w1, $x1, $y1, $z1) = explode(', ', trim($file1[$key], ', '));
  15. }
  16.  
  17. foreach($file2 as $key => $value){
  18.     list($a2, $b2, $c2, $d2, $e2, $f2, $g2, $h2, $i2, $j2, $k2, $l2, $m2, $n2, $o2, $p2, $q2, $r2, $s2, $t2, $u2, $v2, $w2, $x2, $y2, $z2) = explode(', ', trim($file2[$key], ', '));
  19. }
  20.  
  21. $t = '';
  22.  
  23. $g = '$schema';
  24.  
  25. $t .= <<<TXT
  26.         {
  27.             "aabbMin": [
  28.                 {$f1},
  29.                 {$g1},
  30.                 {$h1}
  31.             ],
  32.             "aabbMax": [
  33.                 {$i1},
  34.                 {$j1},
  35.                 {$k1}
  36.             ],
  37.             "centroid": [
  38.                 {$l1},
  39.                 {$m1},
  40.                 {$n1}
  41.             ],
  42.             "radius": {$o1},
  43.             "archetypeName": "{$a1}",
  44.             "txdName": "{$b1}"
  45.         },
  46. TXT;
  47.  
  48. $m = <<<TXT
  49. {$t}
  50.         {
  51.             "position": [
  52.                 {$a2},
  53.                 {$b2},
  54.                 {$c2}  
  55.             ],
  56.             "rotation": [
  57.                 {$d2},
  58.                 {$e2},
  59.                 {$f2},
  60.                 {$g2}
  61.             ],
  62.             "guid": "0",
  63.             "archetypeName": "{$h2}"
  64.         },
  65. TXT;
  66.  
  67. file_put_contents($mn . '.json', $m);
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement