Advertisement
erinx

skynet quest mod

Sep 19th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 69.51 KB | None | 0 0
  1. <?php
  2. header("Content-type: text/html; charset=utf-8");
  3.  
  4. function genImage($knight, $paladin, $sorc, $druid, $beast, $players, $array){
  5.    
  6.   function imagettfstroketext(&$image, $size, $angle, $x, $y, &$textcolor, &$strokecolor, $fontfile, $text, $px){
  7.     for($c1 = ($x-abs($px)); $c1 <= ($x+abs($px)); $c1++)
  8.     for($c2 = ($y-abs($px)); $c2 <= ($y+abs($px)); $c2++)
  9.     $bg = imagettftext($image, $size, $angle, $c1, $c2, $strokecolor, $fontfile, $text);
  10.     return imagettftext($image, $size, $angle, $x, $y, $textcolor, $fontfile, $text);
  11.   }
  12.    
  13.   $imgpath = 'rpgimg/';
  14.  
  15.   $stackpath = 'http://erin.wtf/stacks/';  
  16.  
  17.   if($players > 2){
  18.     $img = imagecreatetruecolor(323, 340);
  19.   }else{
  20.     $img = imagecreatetruecolor(323, 224);  
  21.   }
  22.   imagesavealpha($img, true);
  23.  
  24.   $trans_colour = imagecolorallocatealpha($img, 203, 203, 203, 0);
  25.   $trans_colourb = imagecolorallocatealpha($img, 100, 100, 100, 0);  
  26.  
  27.   $border = imagecolorallocate($img, 40, 40, 40);
  28.  
  29.   $tile = imagecreatefrompng($imgpath . 'tile3.png');
  30.  
  31.   imagesettile($img, $tile);
  32.  
  33.   if($players > 2){
  34.     imagefilledrectangle($img, 2, 2, 319, 336, IMG_COLOR_TILED);
  35.   }else{
  36.     imagefilledrectangle($img, 2, 2, 319, 220, IMG_COLOR_TILED);
  37.   }
  38.  
  39.   $stroke_color = imagecolorallocate($img, 0, 0, 0);
  40.   $text_color = imagecolorallocate($img, 255, 255, 255);
  41.  
  42.   $posY = 16;
  43.  
  44.   if($array[$knight]['hp'] > 0){
  45.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Knight ' . $knight . '  HP '. $array[$knight]['hp'] . '/' . $array[$knight]['hp_max'], 1);
  46.     $src = imagecreatefrompng($imgpath . 'knight.png');
  47.     imagecopy($img, $src, 0, $posY - 4, 0, 0, 46, 46);
  48.   }else{
  49.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Knight ' . $knight . '  [Dead]', 1);
  50.     $src = imagecreatefrompng($imgpath . 'dead.png');
  51.     imagecopy($img, $src, 16, $posY + 9, 0, 0, 32, 32);  
  52.   }
  53.  
  54.   imagefilledrectangle($img, 54, $posY + 5, 283, $posY + 44, $trans_colourb);
  55.  
  56.   imagefilledrectangle($img, 56, $posY + 7, 91, $posY + 42, $border);
  57.   imagefilledrectangle($img, 58, $posY + 9, 90, $posY + 41, $trans_colourb);  
  58.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_helmet.png');
  59.   imagecopy($img, $src, 58, $posY + 9, 0, 0, 32, 32);
  60.  
  61.   imagefilledrectangle($img, 94, $posY + 7, 129, $posY + 42, $border);
  62.   imagefilledrectangle($img, 96, $posY + 9, 128, $posY + 41, $trans_colourb);  
  63.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_armor.png');
  64.   imagecopy($img, $src, 96, $posY + 9, 0, 0, 32, 32);
  65.    
  66.   imagefilledrectangle($img, 132, $posY + 7, 167, $posY + 42, $border);
  67.   imagefilledrectangle($img, 134, $posY + 9, 166, $posY + 41, $trans_colourb);  
  68.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_legs.png');
  69.   imagecopy($img, $src, 134, $posY + 9, 0, 0, 32, 32);
  70.  
  71.   imagefilledrectangle($img, 170, $posY + 7, 205, $posY + 42, $border);
  72.   imagefilledrectangle($img, 172, $posY + 9, 204, $posY + 41, $trans_colourb);
  73.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_boots.png');
  74.   imagecopy($img, $src, 172, $posY + 9, 0, 0, 32, 32);
  75.  
  76.   imagefilledrectangle($img, 208, $posY + 7, 243, $posY + 42, $border);
  77.   imagefilledrectangle($img, 210, $posY + 9, 242, $posY + 41, $trans_colourb);
  78.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_sword.png');
  79.   imagecopy($img, $src, 210, $posY + 9, 0, 0, 32, 32);
  80.  
  81.   imagefilledrectangle($img, 246, $posY + 7, 281, $posY + 42, $border);
  82.   imagefilledrectangle($img, 248, $posY + 9, 280, $posY + 41, $trans_colourb);
  83.   $src = imagecreatefrompng($imgpath . $array[$knight]['set'] . '_shield.png');
  84.   imagecopy($img, $src, 248, $posY + 9, 0, 0, 32, 32);  
  85.  
  86.   $posY += 59;
  87.  
  88.   if($array[$paladin]['hp'] > 0){
  89.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Paladin ' . $paladin . '  HP '. $array[$paladin]['hp'] . '/' . $array[$paladin]['hp_max'] . '  Mana '. $array[$paladin]['mana'] . '/' . $array[$paladin]['mana_max'], 1);
  90.     $src = imagecreatefrompng($imgpath . 'paladin.png');
  91.     imagecopy($img, $src, 0, $posY - 4, 0, 0, 46, 46);
  92.   }else{
  93.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Paladin ' . $paladin . '  [Dead]', 1);
  94.     $src = imagecreatefrompng($imgpath . 'dead.png');
  95.     imagecopy($img, $src, 16, $posY + 9, 0, 0, 32, 32);
  96.   }
  97.  
  98.   imagefilledrectangle($img, 54, $posY + 5, 283, $posY + 44, $trans_colourb);
  99.  
  100.   imagefilledrectangle($img, 56, $posY + 7, 91, $posY + 42, $border);
  101.   imagefilledrectangle($img, 58, $posY + 9, 90, $posY + 41, $trans_colourb);
  102.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_hood.png');
  103.   imagecopy($img, $src, 58, $posY + 9, 0, 0, 32, 32);
  104.  
  105.   imagefilledrectangle($img, 94, $posY + 7, 129, $posY + 42, $border);
  106.   imagefilledrectangle($img, 96, $posY + 9, 128, $posY + 41, $trans_colourb);  
  107.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_tunic.png');
  108.   imagecopy($img, $src, 96, $posY + 9, 0, 0, 32, 32);
  109.    
  110.   imagefilledrectangle($img, 132, $posY + 7, 167, $posY + 42, $border);
  111.   imagefilledrectangle($img, 134, $posY + 9, 166, $posY + 41, $trans_colourb);  
  112.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_pants.png');
  113.   imagecopy($img, $src, 134, $posY + 9, 0, 0, 32, 32);
  114.  
  115.   imagefilledrectangle($img, 170, $posY + 7, 205, $posY + 42, $border);
  116.   imagefilledrectangle($img, 172, $posY + 9, 204, $posY + 41, $trans_colourb);
  117.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_shoes.png');
  118.   imagecopy($img, $src, 172, $posY + 9, 0, 0, 32, 32);
  119.  
  120.   imagefilledrectangle($img, 208, $posY + 7, 243, $posY + 42, $border);
  121.   imagefilledrectangle($img, 210, $posY + 9, 242, $posY + 41, $trans_colourb);
  122.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_bow.png');
  123.   imagecopy($img, $src, 210, $posY + 9, 0, 0, 32, 32);
  124.  
  125.   imagefilledrectangle($img, 246, $posY + 7, 281, $posY + 42, $border);
  126.   imagefilledrectangle($img, 248, $posY + 9, 280, $posY + 41, $trans_colourb);
  127.   $src = imagecreatefrompng($imgpath . $array[$paladin]['set'] . '_arrow.png');
  128.   imagecopy($img, $src, 248, $posY + 9, 0, 0, 32, 32);
  129.  
  130.   $posY += 59;  
  131.  
  132.  
  133.   if($players > 2){
  134.  
  135.  
  136.   if($array[$sorc]['hp'] > 0){
  137.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Sorcerer ' . $sorc . '  HP '. $array[$sorc]['hp'] . '/' . $array[$sorc]['hp_max'] . '  Mana '. $array[$sorc]['mana'] . '/' . $array[$sorc]['mana_max'], 1);
  138.     $src = imagecreatefrompng($imgpath . 'sorcerer.png');
  139.     imagecopy($img, $src, 0, $posY - 4, 0, 0, 46, 46);
  140.   }else{
  141.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Sorcerer ' . $sorc . '  [Dead]', 1);
  142.     $src = imagecreatefrompng($imgpath . 'dead.png');
  143.     imagecopy($img, $src, 16, $posY + 9, 0, 0, 32, 32);
  144.   }
  145.  
  146.   imagefilledrectangle($img, 54, $posY + 5, 283, $posY + 44, $trans_colourb);
  147.  
  148.   imagefilledrectangle($img, 56, $posY + 7, 91, $posY + 42, $border);
  149.   imagefilledrectangle($img, 58, $posY + 9, 90, $posY + 41, $trans_colourb);
  150.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_cap.png');
  151.   imagecopy($img, $src, 58, $posY + 9, 0, 0, 32, 32);
  152.  
  153.   imagefilledrectangle($img, 94, $posY + 7, 129, $posY + 42, $border);
  154.   imagefilledrectangle($img, 96, $posY + 9, 128, $posY + 41, $trans_colourb);  
  155.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_cape.png');
  156.   imagecopy($img, $src, 96, $posY + 9, 0, 0, 32, 32);
  157.    
  158.   imagefilledrectangle($img, 132, $posY + 7, 167, $posY + 42, $border);
  159.   imagefilledrectangle($img, 134, $posY + 9, 166, $posY + 41, $trans_colourb);  
  160.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_shorts.png');
  161.   imagecopy($img, $src, 134, $posY + 9, 0, 0, 32, 32);
  162.  
  163.   imagefilledrectangle($img, 170, $posY + 7, 205, $posY + 42, $border);
  164.   imagefilledrectangle($img, 172, $posY + 9, 204, $posY + 41, $trans_colourb);
  165.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_slippers.png');
  166.   imagecopy($img, $src, 172, $posY + 9, 0, 0, 32, 32);
  167.  
  168.   imagefilledrectangle($img, 208, $posY + 7, 243, $posY + 42, $border);
  169.   imagefilledrectangle($img, 210, $posY + 9, 242, $posY + 41, $trans_colourb);
  170.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_wand.png');
  171.   imagecopy($img, $src, 210, $posY + 9, 0, 0, 32, 32);
  172.  
  173.   imagefilledrectangle($img, 246, $posY + 7, 281, $posY + 42, $border);
  174.   imagefilledrectangle($img, 248, $posY + 9, 280, $posY + 41, $trans_colourb);
  175.   $src = imagecreatefrompng($imgpath . $array[$sorc]['set'] . '_tome.png');
  176.   imagecopy($img, $src, 248, $posY + 9, 0, 0, 32, 32);
  177.  
  178.   $posY += 59;
  179.  
  180.   if($array[$druid]['hp'] > 0){
  181.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Druid ' . $druid . '  HP '. $array[$druid]['hp'] . '/' . $array[$druid]['hp_max'] . '  Mana '. $array[$druid]['mana'] . '/' . $array[$druid]['mana_max'], 1);
  182.     $src = imagecreatefrompng($imgpath . 'druid.png');
  183.     imagecopy($img, $src, 0, $posY - 4, 0, 0, 46, 46);
  184.   }else{
  185.     imagettfstroketext($img, 8, 0, 6, $posY, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Druid ' . $druid . '  [Dead]', 1);
  186.     $src = imagecreatefrompng($imgpath . 'dead.png');
  187.     imagecopy($img, $src, 16, $posY + 9, 0, 0, 32, 32);
  188.   }
  189.  
  190.   imagefilledrectangle($img, 54, $posY + 5, 283, $posY + 44, $trans_colourb);
  191.  
  192.   imagefilledrectangle($img, 56, $posY + 7, 91, $posY + 42, $border);
  193.   imagefilledrectangle($img, 58, $posY + 9, 90, $posY + 41, $trans_colourb);
  194.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_hat.png');
  195.   imagecopy($img, $src, 58, $posY + 9, 0, 0, 32, 32);
  196.  
  197.   imagefilledrectangle($img, 94, $posY + 7, 129, $posY + 42, $border);
  198.   imagefilledrectangle($img, 96, $posY + 9, 128, $posY + 41, $trans_colourb);  
  199.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_robe.png');
  200.   imagecopy($img, $src, 96, $posY + 9, 0, 0, 32, 32);
  201.    
  202.   imagefilledrectangle($img, 132, $posY + 7, 167, $posY + 42, $border);
  203.   imagefilledrectangle($img, 134, $posY + 9, 166, $posY + 41, $trans_colourb);  
  204.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_kilt.png');
  205.   imagecopy($img, $src, 134, $posY + 9, 0, 0, 32, 32);
  206.  
  207.   imagefilledrectangle($img, 170, $posY + 7, 205, $posY + 42, $border);
  208.   imagefilledrectangle($img, 172, $posY + 9, 204, $posY + 41, $trans_colourb);
  209.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_sandals.png');
  210.   imagecopy($img, $src, 172, $posY + 9, 0, 0, 32, 32);
  211.  
  212.   imagefilledrectangle($img, 208, $posY + 7, 243, $posY + 42, $border);
  213.   imagefilledrectangle($img, 210, $posY + 9, 242, $posY + 41, $trans_colourb);
  214.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_rod.png');
  215.   imagecopy($img, $src, 210, $posY + 9, 0, 0, 32, 32);
  216.  
  217.   imagefilledrectangle($img, 246, $posY + 7, 281, $posY + 42, $border);
  218.   imagefilledrectangle($img, 248, $posY + 9, 280, $posY + 41, $trans_colourb);
  219.   $src = imagecreatefrompng($imgpath . $array[$druid]['set'] . '_book.png');
  220.   imagecopy($img, $src, 248, $posY + 9, 0, 0, 32, 32);
  221.  
  222.   $posY += 59;
  223.  
  224.   }
  225.  
  226.   if($players > 2){
  227.     $xPosition = 94;
  228.     $yPosition = 292;
  229.   }else{
  230.     $xPosition = 94;
  231.     $yPosition = 175;
  232.   }
  233.  
  234.   if($array['monsters'][$beast]['hp'] > 0){
  235.     imagettfstroketext($img, 8, 0, 6, $yPosition - 39, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Monster: ' . ucfirst($beast) . '  HP '. $array['monsters'][$beast]['hp'] . '/' . $array['monsters'][$beast]['hp_max'], 1);
  236.     $src = imagecreatefrompng($imgpath . $array['monsters'][$beast]['img']);
  237.     imagecopy($img, $src, 6, $yPosition - 30, 0, 0, $array['monsters'][$beast]['size'], $array['monsters'][$beast]['size']);    
  238.   }else{
  239.     imagettfstroketext($img, 8, 0, 6, $yPosition - 39, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Monster: ' . ucfirst($beast) . '  [Dead]', 1);
  240.     $src = imagecreatefrompng($imgpath . "dead_" . $array['monsters'][$beast]['img']);
  241.     imagecopy($img, $src, 6, $yPosition - 30, 0, 0, $array['monsters'][$beast]['size'], $array['monsters'][$beast]['size']);
  242.   }
  243.  
  244.   imagefilledrectangle($img, $xPosition - 2, $yPosition - 32, $xPosition + 75, $yPosition - 1, $trans_colourb);
  245.   imagefilledrectangle($img, $xPosition, $yPosition - 18, $xPosition + 73, $yPosition + 7, $border);
  246.   imagefilledrectangle($img, $xPosition + 2, $yPosition - 16, $xPosition + 72, $yPosition - 4, $trans_colourb);
  247.   imagettfstroketext($img, 8, 0, $xPosition + 15, $yPosition - 21, $text_color, $stroke_color, "Tahoma_Bold.ttf", 'Status', 1);
  248.  
  249.   $statuspos = 98;
  250.  
  251.   if($array['monsters'][$beast]['frozen'] == true){
  252.     $src = imagecreatefrompng($imgpath . "frozen.png");
  253.     imagecopy($img, $src, $statuspos, $yPosition - 15, 0, 0, 11, 11);
  254.     $statuspos = $statuspos + 12;    
  255.   }
  256.  
  257.   if($array['monsters'][$beast]['burned'] == true){
  258.     $src = imagecreatefrompng($imgpath . "burned.png");
  259.     imagecopy($img, $src, $statuspos, $yPosition - 15, 0, 0, 11, 11);
  260.     $statuspos = $statuspos + 12;    
  261.   }
  262.  
  263.   if($array['monsters'][$beast]['poisoned'] == true){
  264.     $src = imagecreatefrompng($imgpath . "poisoned.png");
  265.     imagecopy($img, $src, $statuspos, $yPosition - 15, 0, 0, 11, 11);
  266.     $statuspos = $statuspos + 12;    
  267.   }
  268.  
  269.   $ps = intval(intval($array['monsters'][$beast]['loot'])/100);  
  270.   $gs = intval(intval($array['monsters'][$beast]['loot'])%100);
  271.  
  272.   if($ps >= 1){
  273.     imagefilledrectangle($img, $xPosition - 2, $yPosition - 2, $xPosition + 37, $yPosition + 37, $trans_colourb);
  274.     imagefilledrectangle($img, $xPosition, $yPosition, $xPosition + 35, $yPosition + 35, $border);
  275.     imagefilledrectangle($img, $xPosition + 2, $yPosition + 2, $xPosition + 34, $yPosition + 34, $trans_colourb);
  276.     if($ps >= 50){
  277.       $src = imagecreatefrompng($stackpath . 'p-50-100.png');
  278.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  279.       if($ps == 100){
  280.         imagettfstroketext($img, 8, 0, $xPosition + 11, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  281.       }else{
  282.         imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  283.       }
  284.     }else if($ps >= 25){
  285.       $src = imagecreatefrompng($stackpath . 'p-25-49.png');
  286.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  287.       imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  288.     }else if($ps >= 10){
  289.       $src = imagecreatefrompng($stackpath . 'p-10-24.png');
  290.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  291.       imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  292.     }else if($ps >= 5){
  293.       $src = imagecreatefrompng($stackpath . 'p-5-9.png');
  294.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  295.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  296.     }else if($ps == 4){
  297.       $src = imagecreatefrompng($stackpath . 'p-4.png');
  298.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  299.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  300.     }else if($ps == 3){
  301.       $src = imagecreatefrompng($stackpath . 'p-3.png');
  302.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  303.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  304.     }else if($ps == 2){
  305.       $src = imagecreatefrompng($stackpath . 'p-2.png');
  306.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  307.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  308.     }else if($ps == 1){
  309.       $src = imagecreatefrompng($stackpath . 'p-1.png');
  310.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  311.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $ps, 1);
  312.     }
  313.   }
  314.  
  315.   $xPosition += 38;
  316.   imagefilledrectangle($img, $xPosition - 2, $yPosition - 2, $xPosition + 37, $yPosition + 37, $trans_colourb);
  317.   imagefilledrectangle($img, $xPosition, $yPosition, $xPosition + 35, $yPosition + 35, $border);
  318.   imagefilledrectangle($img, $xPosition + 2, $yPosition + 2, $xPosition + 34, $yPosition + 34, $trans_colourb);  
  319.  
  320.   if($gs >= 1){
  321.     if($gs >= 50){
  322.       $src = imagecreatefrompng($stackpath . 'g-50-100.png');
  323.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  324.       if($ps == 100){
  325.         imagettfstroketext($img, 8, 0, $xPosition + 11, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  326.       }else{
  327.         imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  328.       }
  329.     }else if($gs >= 25){
  330.       $src = imagecreatefrompng($stackpath . 'g-25-49.png');
  331.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  332.       imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  333.     }else if($gs >= 10){
  334.       $src = imagecreatefrompng($stackpath . 'g-10-24.png');
  335.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  336.       imagettfstroketext($img, 8, 0, $xPosition + 18, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  337.     }else if($gs >= 5){
  338.       $src = imagecreatefrompng($stackpath . 'g-5-9.png');
  339.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  340.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  341.     }else if($gs == 4){
  342.       $src = imagecreatefrompng($stackpath . 'g-4.png');
  343.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  344.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  345.     }else if($gs == 3){
  346.       $src = imagecreatefrompng($stackpath . 'g-3.png');
  347.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  348.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  349.     }else if($gs == 2){
  350.       $src = imagecreatefrompng($stackpath . 'g-2.png');
  351.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  352.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  353.     }else if($gs == 1){
  354.       $src = imagecreatefrompng($stackpath . 'g-1.png');
  355.       imagecopy($img, $src, $xPosition + 2, $yPosition + 2, 0, 0, 32, 32);
  356.       imagettfstroketext($img, 8, 0, $xPosition + 25, $yPosition + 32, $text_color, $stroke_color, "Tahoma_Bold.ttf", $gs, 1);
  357.     }
  358.   }
  359.  
  360.  
  361.   if($players > 2){
  362.     imagettfstroketext($img, 8, 0, 215, 330, $trans_colour, $stroke_color, "Tahoma_Bold.ttf", '/Animus/ Quest', 1);
  363.   }else{
  364.    imagettfstroketext($img, 8, 0, 215, 214, $trans_colour, $stroke_color, "Tahoma_Bold.ttf", '/Animus/ Quest', 1);
  365.   }
  366.  
  367.  
  368.   imagepng($img, "gameimg.png");   
  369.  
  370.  
  371.   imagecolordeallocate($img, $stroke_color);
  372.   imagecolordeallocate($img, $text_color);  
  373.   imagecolordeallocate($img, $trans_colour);
  374.   imagecolordeallocate($img, $trans_colourb);
  375.   imagecolordeallocate($img, $border);
  376.   imagedestroy($img);  
  377.    
  378. }
  379.  
  380. function postComDraw($thisCom, $thread, $oP, $tkey, $postvideo, $tBoard){
  381.   $chanDomain = '8ch.net';
  382.   $output = '';
  383.   if($oP == true){
  384.     $postSub = '[SKYNET 2.1 OP]';
  385.   }else{
  386.     $postSub = '[SKYNET 2.1]';
  387.   }
  388.   if(!$tBoard || $tBoard == false){
  389.     $tBoard = 'animus';
  390.   }
  391.   $ch = curl_init();
  392.   curl_setopt($ch, CURLOPT_URL, "https://" . $chanDomain . "/post.php");
  393.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  394.   curl_setopt($ch, CURLOPT_POST, true);
  395.   curl_setopt($ch, CURLOPT_REFERER, 'https://' . $chanDomain . '/' . $tBoard . '/res/' . $thread . '.html');
  396.   $data = array(
  397.     'json_response' => '0',
  398.     'post' => 'on',
  399.     'q' => '',
  400.     'board' => $tBoard,
  401.     'name' => "server@erin.wtf ".$tkey,
  402.     'email' => '',
  403.     'password' => '',
  404.     'subject' => $postSub,
  405.     'body' => $thisCom,
  406.   );
  407.  
  408.   if(!$postvideo || $postvideo == false){
  409.     $data['file'] = '@' . realpath('gameimg.png');
  410.   }else{
  411.     $data['embed'] = $postvideo;
  412.   }
  413.  
  414.   if($thread != '0'){
  415.     $data['thread'] = $thread;
  416.   }
  417.   curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  418.   $output .= curl_exec($ch);
  419.   curl_close($ch);
  420.   return $output;
  421. }
  422.  
  423.  
  424.  
  425.  
  426. $moduleText = $post['com'];
  427. $moduleText = strip_tags($moduleText);
  428. $moduleText = explode('skynet.'.$module.': ', $moduleText)[1];
  429. $moduleText = preg_replace('/&gt;/', '>', $moduleText);
  430. $moduleText = preg_replace('/&lt;/', '<', $moduleText);
  431. $moduleText = explode(';', $moduleText)[0];
  432.  
  433. $gamelog = 'skynet_quest.txt';
  434. $currentgame = json_decode(file_get_contents($gamelog), true);
  435.  
  436.  
  437. if($currentgame['knight'] == 'none' && $currentgame['paladin'] == none && $post['trip']){
  438.  
  439.   if($moduleText == 'paladin'){
  440.     $data = array();
  441.     $data['paladin'] = $post['trip'];
  442.     $data['knight'] = 'none';
  443.     file_put_contents($gamelog, json_encode($data));
  444.     $response = postCom(">>" . $post['no'] . PHP_EOL . "Game open." . PHP_EOL . "Please wait for a knight to join.", $net['thread'], false, $net['servKey'], false, false);
  445.   }else if($moduleText == 'knight'){
  446.     $data = array();
  447.     $data['paladin'] = 'none';
  448.     $data['knight'] = $post['trip'];
  449.     file_put_contents($gamelog, json_encode($data));
  450.     $response = postCom(">>" . $post['no'] . PHP_EOL . "Game open." . PHP_EOL . "Please wait for a paladin to join.", $net['thread'], false, $net['servKey'], false, false);
  451.   }else{   
  452.     $response = postCom(">>" . $post['no'] . PHP_EOL . "Please respond with your chosen class." . PHP_EOL . "eg. ''skynet.quest: paladin;'' or ''skynet.quest: knight;''", $net['thread'], false, $net['servKey'], false, false);
  453.   }
  454.        
  455. }else if($currentgame['knight'] == 'none' || $currentgame['paladin'] == none && $post['trip']){
  456.    
  457.   if($currentgame['knight'] == 'none' && $post['trip'] != $currentgame['paladin']){
  458.     $currentgame['knight'] = $post['trip'];
  459.     file_put_contents($gamelog, json_encode($currentgame));
  460.   }else if($currentgame['paladin'] == 'none' && $post['trip'] != $currentgame['knight']){
  461.     $currentgame['paladin'] = $post['trip'];
  462.     file_put_contents($gamelog, json_encode($currentgame));
  463.   }else{
  464.     $response = postCom(">>" . $post['no'] . PHP_EOL . "You cannot play both classes.", $net['thread'], false, $net['servKey'], false, false);
  465.   }
  466.  
  467.   if($currentgame['knight'] != 'none' && $currentgame['paladin'] != 'none'){
  468.    
  469.     $data = array();
  470.  
  471.     $palitrip = $currentgame['paladin'];
  472.  
  473.     $knighttrip = $currentgame['knight'];
  474.  
  475.     $data['dead'] = 0;
  476.  
  477.     $data['paladin'] = $palitrip;
  478.  
  479.     $data['knight'] = $knighttrip;
  480.    
  481.     $data['sorcerer'] = 'xa';
  482.  
  483.     $data['druid'] = 'xa';
  484.  
  485.     $data[$palitrip] = array();
  486.       $data[$palitrip]['class'] = 'paladin';
  487.       $data[$palitrip]['hp_max'] = 100;
  488.       $data[$palitrip]['hp'] = 100;
  489.       $data[$palitrip]['mana_max'] = 125;
  490.       $data[$palitrip]['mana'] = 125;
  491.       $data[$palitrip]['set'] = 'basic';
  492.  
  493.     $data[$knighttrip] = array();
  494.       $data[$knighttrip]['class'] = 'knight';
  495.       $data[$knighttrip]['hp_max'] = 140;
  496.       $data[$knighttrip]['hp'] = 140;
  497.       $data[$knighttrip]['mana_max'] = 0;
  498.       $data[$knighttrip]['mana'] = 0;
  499.       $data[$knighttrip]['set'] = 'basic';
  500.      
  501.      
  502.     $data[$sorctrip] = array();
  503.       $data[$sorctrip]['class'] = 'sorcerer';
  504.       $data[$sorctrip]['hp_max'] = 70;
  505.       $data[$sorctrip]['hp'] = 70;
  506.       $data[$sorctrip]['mana_max'] = 250;
  507.       $data[$sorctrip]['mana'] = 250;
  508.       $data[$sorctrip]['set'] = 'basic';
  509.  
  510.     $data[$druidtrip] = array();
  511.       $data[$druidtrip]['class'] = 'druid';
  512.       $data[$druidtrip]['hp_max'] = 70;
  513.       $data[$druidtrip]['hp'] = 70;
  514.       $data[$druidtrip]['mana_max'] = 250;
  515.       $data[$druidtrip]['mana'] = 250;
  516.       $data[$druidtrip]['set'] = 'basic';
  517.    
  518.     $data['sets'] = array();
  519.       $data['sets']['basic'] = array();
  520.       $data['sets']['basic']['damage'] = 10;
  521.       $data['sets']['basic']['defense'] = 10;
  522.       $data['sets']['basic']['cost'] = 0;  
  523.     $data['sets']['good'] = array();
  524.       $data['sets']['good']['damage'] = 15;
  525.       $data['sets']['good']['defense'] = 15;
  526.       $data['sets']['good']['cost'] = 200;  
  527.     $data['sets']['great'] = array();
  528.       $data['sets']['great']['damage'] = 20;
  529.       $data['sets']['great']['defense'] = 20;
  530.       $data['sets']['great']['cost'] = 400;
  531.    
  532.     $data['spells'] = array();
  533.       $data['spells']['frigo'] = array();  
  534.         $data['spells']['frigo']['damage'] = 0;
  535.         $data['spells']['frigo']['status'] = 'frozen';
  536.         $data['spells']['frigo']['mana'] = 25;  
  537.       $data['spells']['exori'] = array();  
  538.         $data['spells']['exori']['damage'] = 50;
  539.         $data['spells']['exori']['status'] = 'none';
  540.         $data['spells']['exori']['mana'] = 30;  
  541.    
  542.  
  543.     $data['monsters'] = array();
  544.       $data['monsters']['dragon'] = array();
  545.         $data['monsters']['dragon']['hp_max'] = 300;
  546.         $data['monsters']['dragon']['hp'] = 300;
  547.         $data['monsters']['dragon']['max_damage'] = 55;
  548.         $data['monsters']['dragon']['min_damage'] = 15;
  549.         $data['monsters']['dragon']['img'] = 'dragon.png';
  550.         $data['monsters']['dragon']['size'] = 64;
  551.         $data['monsters']['dragon']['frozen'] = false;
  552.         $data['monsters']['dragon']['frozen_turns'] = 0;
  553.         $data['monsters']['dragon']['burned'] = false;
  554.         $data['monsters']['dragon']['burned_turns'] = 0;
  555.         $data['monsters']['dragon']['poisoned'] = false;
  556.         $data['monsters']['dragon']['poisoned_turns'] = 0;
  557.         $data['monsters']['dragon']['immune'] = 'burned';
  558.         $data['monsters']['dragon']['dead'] = false;
  559.         $data['monsters']['dragon']['loot_min'] = 400;
  560.         $data['monsters']['dragon']['loot_max'] = 600;
  561.         $data['monsters']['dragon']['loot'] = 0;
  562.       $data['monsters']['demon'] = array();  
  563.         $data['monsters']['demon']['hp_max'] = 400;
  564.         $data['monsters']['demon']['hp'] = 400;
  565.         $data['monsters']['demon']['max_damage'] = 60;
  566.         $data['monsters']['demon']['min_damage'] = 15;
  567.         $data['monsters']['demon']['img'] = 'demon.png';
  568.         $data['monsters']['demon']['size'] = 64;
  569.         $data['monsters']['demon']['frozen'] = false;
  570.         $data['monsters']['demon']['frozen_turns'] = 0;
  571.         $data['monsters']['demon']['burned'] = false;
  572.         $data['monsters']['demon']['burned_turns'] = 0;
  573.         $data['monsters']['demon']['poisoned'] = false;
  574.         $data['monsters']['demon']['poisoned_turns'] = 0;
  575.         $data['monsters']['demon']['immune'] = 'burned';
  576.         $data['monsters']['demon']['dead'] = false;
  577.         $data['monsters']['demon']['loot_min'] = 600;
  578.         $data['monsters']['demon']['loot_max'] = 1300;
  579.         $data['monsters']['demon']['loot'] = 0;        
  580.       $data['monsters']['braindeath'] = array();  
  581.         $data['monsters']['braindeath']['hp_max'] = 350;
  582.         $data['monsters']['braindeath']['hp'] = 350;
  583.         $data['monsters']['braindeath']['max_damage'] = 60;
  584.         $data['monsters']['braindeath']['min_damage'] = 5;
  585.         $data['monsters']['braindeath']['img'] = 'braindeath.png';
  586.         $data['monsters']['braindeath']['size'] = 64;
  587.         $data['monsters']['braindeath']['frozen'] = false;
  588.         $data['monsters']['braindeath']['frozen_turns'] = 0;
  589.         $data['monsters']['braindeath']['burned'] = false;
  590.         $data['monsters']['braindeath']['burned_turns'] = 0;
  591.         $data['monsters']['braindeath']['poisoned'] = false;
  592.         $data['monsters']['braindeath']['poisoned_turns'] = 0;
  593.         $data['monsters']['braindeath']['immune'] = 'poisoned';
  594.         $data['monsters']['braindeath']['dead'] = false;
  595.         $data['monsters']['braindeath']['loot_min'] = 500;
  596.         $data['monsters']['braindeath']['loot_max'] = 800;
  597.         $data['monsters']['braindeath']['loot'] = 0;
  598.       $data['monsters']['firelord'] = array();  
  599.         $data['monsters']['firelord']['hp_max'] = 400;
  600.         $data['monsters']['firelord']['hp'] = 400;
  601.         $data['monsters']['firelord']['max_damage'] = 50;
  602.         $data['monsters']['firelord']['min_damage'] = 15;
  603.         $data['monsters']['firelord']['img'] = 'lavalord.png';
  604.         $data['monsters']['firelord']['size'] = 64;
  605.         $data['monsters']['firelord']['frozen'] = false;
  606.         $data['monsters']['firelord']['frozen_turns'] = 0;
  607.         $data['monsters']['firelord']['burned'] = false;
  608.         $data['monsters']['firelord']['burned_turns'] = 0;
  609.         $data['monsters']['firelord']['poisoned'] = false;
  610.         $data['monsters']['firelord']['poisoned_turns'] = 0;
  611.         $data['monsters']['firelord']['immune'] = 'burned';
  612.         $data['monsters']['firelord']['dead'] = false;
  613.         $data['monsters']['firelord']['loot_min'] = 600;
  614.         $data['monsters']['firelord']['loot_max'] = 1000;
  615.         $data['monsters']['firelord']['loot'] = 0;
  616.       $data['monsters']['golem'] = array();  
  617.         $data['monsters']['golem']['hp_max'] = 250;
  618.         $data['monsters']['golem']['hp'] = 250;
  619.         $data['monsters']['golem']['max_damage'] = 55;
  620.         $data['monsters']['golem']['min_damage'] = 10;
  621.         $data['monsters']['golem']['img'] = 'golem.png';
  622.         $data['monsters']['golem']['size'] = 64;
  623.         $data['monsters']['golem']['frozen'] = false;
  624.         $data['monsters']['golem']['frozen_turns'] = 0;
  625.         $data['monsters']['golem']['burned'] = false;
  626.         $data['monsters']['golem']['burned_turns'] = 0;
  627.         $data['monsters']['golem']['poisoned'] = false;
  628.         $data['monsters']['golem']['poisoned_turns'] = 0;
  629.         $data['monsters']['golem']['immune'] = 'poisoned';
  630.         $data['monsters']['golem']['dead'] = false;
  631.         $data['monsters']['golem']['loot_min'] = 400;
  632.         $data['monsters']['golem']['loot_max'] = 700;
  633.         $data['monsters']['golem']['loot'] = 0;
  634.       $data['monsters']['icelord'] = array();  
  635.         $data['monsters']['icelord']['hp_max'] = 375;
  636.         $data['monsters']['icelord']['hp'] = 375;
  637.         $data['monsters']['icelord']['max_damage'] = 60;
  638.         $data['monsters']['icelord']['min_damage'] = 10;
  639.         $data['monsters']['icelord']['img'] = 'icelord.png';
  640.         $data['monsters']['icelord']['size'] = 64;
  641.         $data['monsters']['icelord']['frozen'] = false;
  642.         $data['monsters']['icelord']['frozen_turns'] = 0;
  643.         $data['monsters']['icelord']['burned'] = false;
  644.         $data['monsters']['icelord']['burned_turns'] = 0;
  645.         $data['monsters']['icelord']['poisoned'] = false;
  646.         $data['monsters']['icelord']['poisoned_turns'] = 0;
  647.         $data['monsters']['icelord']['immune'] = 'frozen';
  648.         $data['monsters']['icelord']['dead'] = false;
  649.         $data['monsters']['icelord']['loot_min'] = 700;
  650.         $data['monsters']['icelord']['loot_max'] = 1200;
  651.         $data['monsters']['icelord']['loot'] = 0;
  652.        
  653.                
  654.      $selectMonster = array('dragon', 'demon', 'braindeath', 'firelord', 'golem', 'icelord');        
  655.      
  656.      $monster = $selectMonster[array_rand($selectMonster)];
  657.        
  658.      $data['monster'] = $monster;
  659.      
  660.      $data['monsters'][$data['monster']]['loot'] = mt_rand($data['monsters'][$data['monster']]['loot_min'], $data['monsters'][$data['monster']]['loot_max']);
  661.  
  662.     file_put_contents($gamelog, json_encode($data));
  663.    
  664.     $currentgame = json_decode(file_get_contents($gamelog), true);
  665.        
  666.     genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  667.    
  668.     $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "The quest has begun!" . PHP_EOL . "Decide who will attack first." . PHP_EOL . "The knight may use ''skynet.quest: attack;'' to attack." . PHP_EOL . "The paladin may use ''skynet.quest: attack;'' to attack, ''skynet.quest: frigo;'' for a freezing spell, or ''skynet.quest: exori;'' for a damage spell." . PHP_EOL . PHP_EOL . "If either player has money with the Bank of /Animus/, they may upgrade their set." . PHP_EOL . "Use ''skynet.quest: good set;'' to buy the good set for ₲" . $currentgame['sets']['good']['cost'] . ", or ''skynet.quest: great set;'' to buy the great set for ₲" . $currentgame['sets']['great']['cost'] . ".", $net['thread'], false, $net['servKey'], false, $getboard);
  669.    
  670.   }
  671.    
  672. }else if(!$post['trip']){
  673.    
  674.   $response = postCom(">>" . $post['no'] . PHP_EOL . "a tripcode is required to play this game.", $net['thread'], false, $net['servKey'], false, false);
  675.  
  676. }else if($currentgame['knight'] == $post['trip']  && $moduleText == 'good set' || $currentgame['paladin'] == $post['trip'] && $moduleText == 'good set'){
  677.    
  678.   if($currentgame[$post['trip']]['set'] == 'basic'){
  679.     $bankapi = json_decode(file_get_contents('https://erin.wtf/securebank?p=&t='.urlencode($post['trip'])), true);
  680.     if(!$bankapi['error'] && $bankapi['balance'] >= $currentgame['sets']['good']['cost']){
  681.       $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $currentgame['sets']['good']['cost'] . "&p=&t=" . urlencode($post['trip']) . "&r=" . urlencode('!Bank..5Wfo')), true);
  682.       if(!$bankapix['error']){
  683.         $currentgame[$post['trip']]['set'] = 'good';
  684.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  685.         $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You bought the good set for " . $bankapix['formatted'] . ".", $net['thread'], false, $net['servKey'], false, $getboard);
  686.         file_put_contents($gamelog, json_encode($currentgame));
  687.       }else{
  688.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  689.         $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "There was an error:" . PHP_EOL . $bankapix['error'], $net['thread'], false, $net['servKey'], false, $getboard);
  690.         file_put_contents($gamelog, json_encode($currentgame));
  691.       }
  692.     }else{
  693.       genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  694.       $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You can not afford this set!", $net['thread'], false, $net['servKey'], false, $getboard);
  695.       file_put_contents($gamelog, json_encode($currentgame));
  696.     }  
  697.   }else{
  698.     genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  699.     $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "This is no better than your current set.", $net['thread'], false, $net['servKey'], false, $getboard);
  700.     file_put_contents($gamelog, json_encode($currentgame));
  701.   }  
  702. }else if($currentgame['knight'] == $post['trip']  && $moduleText == 'great set' || $currentgame['paladin'] == $post['trip'] && $moduleText == 'great set'){
  703.   if($currentgame[$post['trip']]['set'] == 'basic' || $currentgame[$post['trip']]['set'] == 'good'){
  704.     $bankapi = json_decode(file_get_contents('https://erin.wtf/securebank?p=&t='.urlencode($post['trip'])), true);
  705.     if(!$bankapi['error'] && $bankapi['balance'] >= $currentgame['sets']['great']['cost']){
  706.       $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $currentgame['sets']['great']['cost'] . "&p=&t=" . urlencode($post['trip']) . "&r=" . urlencode('!Bank..5Wfo')), true);
  707.       if(!$bankapix['error']){
  708.         $currentgame[$post['trip']]['set'] = 'great';
  709.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  710.         $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You bought the good set for " . $bankapix['formatted'] . ".", $net['thread'], false, $net['servKey'], false, $getboard);
  711.         file_put_contents($gamelog, json_encode($currentgame));
  712.       }else{
  713.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  714.         $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "There was an error:" . PHP_EOL . $bankapix['error'], $net['thread'], false, $net['servKey'], false, $getboard);
  715.         file_put_contents($gamelog, json_encode($currentgame));
  716.       }
  717.     }else{
  718.       genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  719.       $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You can not afford this set!", $net['thread'], false, $net['servKey'], false, $getboard);
  720.       file_put_contents($gamelog, json_encode($currentgame));
  721.     }  
  722.   }else{
  723.     genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  724.     $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "This is no better than your current set.", $net['thread'], false, $net['servKey'], false, $getboard);
  725.     file_put_contents($gamelog, json_encode($currentgame));
  726.   }  
  727.  
  728. }else if($currentgame['knight'] == $post['trip']){
  729.    
  730.   if($currentgame[$currentgame['knight']]['hp'] > 0){
  731.    
  732.     $statusDamage = 0;
  733.     $statusText = '';
  734.     if($currentgame['monsters'][$currentgame['monster']]['burned'] == true){
  735.       $burnDamage = 20;
  736.       $statusDamage += $burnDamage;
  737.       $currentgame['monsters'][$currentgame['monster']]['burned_turns']--;
  738.       $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $burnDamage;
  739.       $statusText += PHP_EOL . "Burn hurt the " . $currentgame['monster'] . " for " . $burnDamage . ".";
  740.       if($currentgame['monsters'][$currentgame['monster']]['burned_turns'] == 0){
  741.         $currentgame['monsters'][$currentgame['monster']]['burned'] = false;
  742.         $statusText += PHP_EOL . "Burn wore off.";
  743.       }
  744.       file_put_contents($gamelog, json_encode($currentgame));
  745.      
  746.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  747.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  748.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);          $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  749.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  750.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  751.         $data = array();
  752.         $data['paladin'] = 'none';
  753.         $data['knight'] = 'none';
  754.         file_put_contents($gamelog, json_encode($data));
  755.       }
  756.     }
  757.    
  758.     if($currentgame['monsters'][$currentgame['monster']]['poisoned'] == true){
  759.       $poisonDamage = 10*$currentgame['monsters'][$currentgame['monster']]['poisoned_turns'];
  760.       $statusDamage += $poisonDamage;
  761.       $currentgame['monsters'][$currentgame['monster']]['poisoned_turns']--;
  762.       $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $poisonDamage;
  763.       $statusText += PHP_EOL . "Poison hurt the " . $currentgame['monster'] . " for " . $poisonDamage . ".";
  764.       if($currentgame['monsters'][$currentgame['monster']]['poisoned_turns'] == 0){
  765.         $currentgame['monsters'][$currentgame['monster']]['poisoned'] = false;
  766.         $statusText += PHP_EOL . "Poison wore off.";
  767.       }
  768.       file_put_contents($gamelog, json_encode($currentgame));
  769.      
  770.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  771.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  772.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);          $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  773.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  774.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  775.         $data = array();
  776.         $data['paladin'] = 'none';
  777.         $data['knight'] = 'none';
  778.         file_put_contents($gamelog, json_encode($data));
  779.       }  
  780.  
  781.     }
  782.    
  783.     if($currentgame['monsters'][$currentgame['monster']]['hp'] > 0){
  784.     $attackDamage = mt_rand(1, 30) + $currentgame['sets'][$currentgame[$currentgame['knight']]['set']]['damage'];
  785.     $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $attackDamage;
  786.     if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  787.       genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  788.       $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);      $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  789.       $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  790.       $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  791.       $data = array();
  792.       $data['paladin'] = 'none';
  793.       $data['knight'] = 'none';
  794.       file_put_contents($gamelog, json_encode($data));  
  795.     }else{
  796.       if($currentgame['monsters'][$currentgame['monster']]['frozen'] == false){
  797.         $monsterDamage = mt_rand($currentgame['monsters'][$currentgame['monster']]['min_damage'], $currentgame['monsters'][$currentgame['monster']]['max_damage']) - $currentgame['sets'][$currentgame[$currentgame['knight']]['set']]['defense'];
  798.         if($monsterDamage < 0){
  799.           $monsterDamage = 0;  
  800.         }
  801.         $currentgame[$currentgame['knight']]['hp'] = $currentgame[$currentgame['knight']]['hp'] - $monsterDamage;
  802.         if($currentgame[$currentgame['knight']]['hp'] > 0){
  803.           genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  804.           $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your sword for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);
  805.           file_put_contents($gamelog, json_encode($currentgame));
  806.         }else{
  807.           if($currentgame['dead'] == 0){
  808.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  809.             $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your sword for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);
  810.             $currentgame['dead']++;
  811.             file_put_contents($gamelog, json_encode($currentgame));
  812.           }else{
  813.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  814.             $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your sword for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);
  815.             $data = array();
  816.             $data['paladin'] = 'none';
  817.             $data['knight'] = 'none';
  818.             file_put_contents($gamelog, json_encode($data));
  819.           }
  820.         }      
  821.       }else{
  822.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  823.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your sword for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);
  824.         $currentgame['monsters'][$currentgame['monster']]['frozen_turns']--;
  825.         if($currentgame['monsters'][$currentgame['monster']]['frozen_turns'] == 0){
  826.           $currentgame['monsters'][$currentgame['monster']]['frozen'] = false;
  827.           file_put_contents($gamelog, json_encode($currentgame));
  828.           sleep(20);
  829.           genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  830.           $response =  postComDraw("The freezing spell wore off!", $net['thread'], false, $net['servKey'], false, $getboard);
  831.         }
  832.         file_put_contents($gamelog, json_encode($currentgame));
  833.        
  834.       }    
  835.     }  
  836.     }
  837.   }else{
  838.     genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  839.     $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You are already dead!", $net['thread'], false, $net['servKey'], false, $getboard);
  840.   }
  841. }else if($currentgame['paladin'] == $post['trip']){
  842.        
  843.   if($currentgame[$currentgame['paladin']]['hp'] > 0){
  844.        
  845.     $statusDamage = 0;
  846.     $statusText = '';
  847.     if($currentgame['monsters'][$currentgame['monster']]['burned'] == true){
  848.       $burnDamage = 20;
  849.       $statusDamage += $burnDamage;
  850.       $currentgame['monsters'][$currentgame['monster']]['burned_turns']--;
  851.       $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $burnDamage;
  852.       $statusText += PHP_EOL . "Burn hurt the " . $currentgame['monster'] . " for " . $burnDamage . ".";
  853.       if($currentgame['monsters'][$currentgame['monster']]['burned_turns'] == 0){
  854.         $currentgame['monsters'][$currentgame['monster']]['burned'] = false;
  855.         $statusText += PHP_EOL . "Burn wore off.";
  856.       }
  857.       file_put_contents($gamelog, json_encode($currentgame));
  858.      
  859.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  860.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  861.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);          $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  862.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  863.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  864.         $data = array();
  865.         $data['paladin'] = 'none';
  866.         $data['knight'] = 'none';
  867.         file_put_contents($gamelog, json_encode($data));
  868.       }
  869.     }
  870.    
  871.     if($currentgame['monsters'][$currentgame['monster']]['poisoned'] == true){
  872.       $poisonDamage = 10*$currentgame['monsters'][$currentgame['monster']]['poisoned_turns'];
  873.       $statusDamage += $poisonDamage;
  874.       $currentgame['monsters'][$currentgame['monster']]['poisoned_turns']--;
  875.       $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $poisonDamage;
  876.       $statusText += PHP_EOL . "Poison hurt the " . $currentgame['monster'] . " for " . $poisonDamage . ".";
  877.       if($currentgame['monsters'][$currentgame['monster']]['poisoned_turns'] == 0){
  878.         $currentgame['monsters'][$currentgame['monster']]['poisoned'] = false;
  879.         $statusText += PHP_EOL . "Poison wore off.";
  880.       }
  881.       file_put_contents($gamelog, json_encode($currentgame));
  882.      
  883.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  884.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  885.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);          $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  886.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  887.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  888.         $data = array();
  889.         $data['paladin'] = 'none';
  890.         $data['knight'] = 'none';
  891.         file_put_contents($gamelog, json_encode($data));
  892.       }  
  893.  
  894.     }
  895.    
  896.     if($moduleText != 'exori' && $moduleText != 'frigo' && $currentgame['monsters'][$currentgame['monster']]['hp'] > 0){
  897.        
  898.       $attackDamage = mt_rand(1, 20) + $currentgame['sets'][$currentgame[$currentgame['paladin']]['set']]['damage'];
  899.       $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $attackDamage;
  900.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  901.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  902.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);
  903.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  904.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  905.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  906.         $data = array();
  907.         $data['paladin'] = 'none';
  908.         $data['knight'] = 'none';
  909.         file_put_contents($gamelog, json_encode($data));  
  910.       }else{
  911.         if($currentgame['monsters'][$currentgame['monster']]['frozen'] == false){
  912.           $monsterDamage = mt_rand($currentgame['monsters'][$currentgame['monster']]['min_damage'], $currentgame['monsters'][$currentgame['monster']]['max_damage']) - $currentgame['sets'][$currentgame[$currentgame['paladin']]['set']]['defense'];
  913.           if($monsterDamage < 0){
  914.             $monsterDamage = 0;
  915.           }
  916.           $currentgame[$currentgame['paladin']]['hp'] = $currentgame[$currentgame['paladin']]['hp'] - $monsterDamage;
  917.           if($currentgame[$currentgame['paladin']]['hp'] > 0){
  918.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  919.             $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your bow for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);
  920.             file_put_contents($gamelog, json_encode($currentgame));
  921.           }else{
  922.             if($currentgame['dead'] == 0){
  923.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  924.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your bow for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);
  925.               $currentgame['dead']++;
  926.               file_put_contents($gamelog, json_encode($currentgame));
  927.             }else{
  928.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  929.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your bow for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);
  930.               $data = array();
  931.               $data['paladin'] = 'none';
  932.               $data['knight'] = 'none';
  933.               file_put_contents($gamelog, json_encode($data));
  934.             }
  935.           }        
  936.         }else{
  937.           genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  938.           $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your bow for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);
  939.           $currentgame['monsters'][$currentgame['monster']]['frozen_turns']--;
  940.           if($currentgame['monsters'][$currentgame['monster']]['frozen_turns'] == 0){
  941.             $currentgame['monsters'][$currentgame['monster']]['frozen'] = false;
  942.             file_put_contents($gamelog, json_encode($currentgame));
  943.             sleep(20);
  944.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  945.             $response =  postComDraw("The freezing spell wore off!", $net['thread'], false, $net['servKey'], false, $getboard);
  946.           }
  947.           file_put_contents($gamelog, json_encode($currentgame));
  948.        
  949.         }      
  950.       }        
  951.        
  952.     }else if($moduleText == 'exori' && $currentgame['monsters'][$currentgame['monster']]['hp'] > 0){
  953.        
  954.       if($currentgame[$currentgame['paladin']]['mana'] >= $currentgame['spells']['exori']['mana']){
  955.         $attackDamage = $currentgame['spells']['exori']['damage'];
  956.         $currentgame['monsters'][$currentgame['monster']]['hp'] = $currentgame['monsters'][$currentgame['monster']]['hp'] - $attackDamage;
  957.         $currentgame[$currentgame['paladin']]['mana'] = $currentgame[$currentgame['paladin']]['mana'] - $currentgame['spells']['exori']['mana'];
  958.       }else{
  959.         $attackDamage = 'low mana';        
  960.       }
  961.       if($currentgame['monsters'][$currentgame['monster']]['hp'] <= 0){
  962.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  963.         $looted = intval($currentgame['monsters'][$currentgame['monster']]['loot']/2);
  964.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['knight'])), true);
  965.         $bankapix = json_decode(file_get_contents("https://erin.wtf/securetransfer?m=true&a=" . $looted . "&p=&t=" . urlencode('!Bank..5Wfo') . "&r=" . urlencode($currentgame['paladin'])), true);
  966.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The quest is over!" . PHP_EOL . "You have defeated the " . $currentgame['monster'] . "!" . PHP_EOL . "Each adventurer looted ₲" . $looted . " from the corpse.", $net['thread'], false, $net['servKey'], false, $getboard);
  967.         $data = array();
  968.         $data['paladin'] = 'none';
  969.         $data['knight'] = 'none';
  970.         file_put_contents($gamelog, json_encode($data));  
  971.       }else{
  972.         if($currentgame['monsters'][$currentgame['monster']]['frozen'] == false){
  973.           $monsterDamage = mt_rand($currentgame['monsters'][$currentgame['monster']]['min_damage'], $currentgame['monsters'][$currentgame['monster']]['max_damage']) - $currentgame['sets'][$currentgame[$currentgame['paladin']]['set']]['defense'];
  974.           if($monsterDamage < 0){
  975.             $monsterDamage = 0;
  976.           }
  977.           $currentgame[$currentgame['paladin']]['hp'] = $currentgame[$currentgame['paladin']]['hp'] - $monsterDamage;
  978.           if($currentgame[$currentgame['paladin']]['hp'] > 0){
  979.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  980.             if($attackDamage != 'low mana'){
  981.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your exori spell for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);
  982.             }else{
  983.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);  
  984.             }
  985.             file_put_contents($gamelog, json_encode($currentgame));
  986.           }else{
  987.             if($currentgame['dead'] == 0){
  988.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  989.               if($attackDamage != 'low mana'){
  990.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your exori spell for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);
  991.               }else{
  992.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);                  
  993.               }
  994.               $currentgame['dead']++;
  995.               file_put_contents($gamelog, json_encode($currentgame));
  996.             }else{
  997.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  998.               if($attackDamage != 'low mana'){
  999.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your exori spell for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);
  1000.               }else{
  1001.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);                
  1002.               }
  1003.               $data = array();
  1004.               $data['paladin'] = 'none';
  1005.               $data['knight'] = 'none';
  1006.               file_put_contents($gamelog, json_encode($data));
  1007.             }
  1008.           }        
  1009.         }else{
  1010.           genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1011.           if($attackDamage != 'low mana'){
  1012.             $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You attacked the " . $currentgame['monster'] . " with your exori spell for " . $attackDamage . " damage." . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);
  1013.           }else{
  1014.             $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);              
  1015.           }
  1016.           $currentgame['monsters'][$currentgame['monster']]['frozen_turns']--;
  1017.           if($currentgame['monsters'][$currentgame['monster']]['frozen_turns'] == 0){
  1018.             $currentgame['monsters'][$currentgame['monster']]['frozen'] = false;
  1019.             file_put_contents($gamelog, json_encode($currentgame));
  1020.             sleep(20);
  1021.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1022.             $response =  postComDraw("The freezing spell wore off!", $net['thread'], false, $net['servKey'], false, $getboard);
  1023.           }
  1024.           file_put_contents($gamelog, json_encode($currentgame));
  1025.        
  1026.         }      
  1027.       }
  1028.    
  1029.        
  1030.     }else if($moduleText == 'frigo' && $currentgame['monsters'][$currentgame['monster']]['hp'] > 0){
  1031.       if($currentgame[$currentgame['paladin']]['mana'] >= $currentgame['spells']['frigo']['mana'] && $currentgame['monsters'][$currentgame['monster']]['immune'] != 'frozen'){
  1032.         $currentgame['monsters'][$currentgame['monster']]['frozen'] = true;
  1033.         $currentgame['monsters'][$currentgame['monster']]['frozen_turns'] = 3;
  1034.         $currentgame[$currentgame['paladin']]['mana'] = $currentgame[$currentgame['paladin']]['mana'] - $currentgame['spells']['frigo']['mana'];
  1035.         genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1036.         $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "You froze the " . $currentgame['monster'] . " with your frigo spell!", $net['thread'], false, $net['servKey'], false, $getboard);        file_put_contents($gamelog, json_encode($currentgame));
  1037.                        
  1038.       }else{
  1039.        
  1040.         $attackDamage = 'low mana';
  1041.        
  1042.         if($currentgame['monsters'][$currentgame['monster']]['frozen'] == false){
  1043.           $monsterDamage = mt_rand($currentgame['monsters'][$currentgame['monster']]['min_damage'], $currentgame['monsters'][$currentgame['monster']]['max_damage']);
  1044.             $currentgame[$currentgame['paladin']]['hp'] = $currentgame[$currentgame['paladin']]['hp'] - $monsterDamage;
  1045.             if($currentgame[$currentgame['paladin']]['hp'] > 0){
  1046.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1047.               if($attackDamage != 'low mana'){
  1048.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The " . $currentgame['monster'] . " is immune to freezing!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);
  1049.               }else{
  1050.                 $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage.", $net['thread'], false, $net['servKey'], false, $getboard);    
  1051.               }
  1052.               file_put_contents($gamelog, json_encode($currentgame));
  1053.             }else{
  1054.               if($currentgame['dead'] == 0){
  1055.                 genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1056.                 if($attackDamage != 'low mana'){
  1057.                   $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The " . $currentgame['monster'] . " is immune to freezing!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);
  1058.                 }else{
  1059.                   $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!", $net['thread'], false, $net['servKey'], false, $getboard);                
  1060.                 }
  1061.                 $currentgame['dead']++;
  1062.                 file_put_contents($gamelog, json_encode($currentgame));
  1063.               }else{
  1064.                 genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1065.                 if($attackDamage != 'low mana'){
  1066.                   $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The " . $currentgame['monster'] . " is immune to freezing!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);
  1067.                 }else{
  1068.                   $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " attacked you for " . $monsterDamage . " damage, killing you!" . PHP_EOL . "Both fighters are dead!" . PHP_EOL . "The quest is over!", $net['thread'], false, $net['servKey'], false, $getboard);                  
  1069.                 }
  1070.                 $data = array();
  1071.                 $data['paladin'] = 'none';
  1072.                 $data['knight'] = 'none';
  1073.                 file_put_contents($gamelog, json_encode($data));
  1074.               }
  1075.             }      
  1076.           }else{
  1077.             genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1078.             if($attackDamage != 'low mana'){
  1079.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "The " . $currentgame['monster'] . " is immune to freezing!" . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);
  1080.             }else{
  1081.               $response =  postComDraw(">>" . $post['no'] . $statusText . PHP_EOL . "Your mana was too low to cast!" . PHP_EOL . "The " . $currentgame['monster'] . " is still frozen.", $net['thread'], false, $net['servKey'], false, $getboard);            
  1082.             }
  1083.             $currentgame['monsters'][$currentgame['monster']]['frozen_turns']--;
  1084.             if($currentgame['monsters'][$currentgame['monster']]['frozen_turns'] == 0){
  1085.               $currentgame['monsters'][$currentgame['monster']]['frozen'] = false;
  1086.               file_put_contents($gamelog, json_encode($currentgame));
  1087.               sleep(20);
  1088.               genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1089.               $response =  postComDraw("The freezing spell wore off!", $net['thread'], false, $net['servKey'], false, $getboard);
  1090.             }
  1091.             file_put_contents($gamelog, json_encode($currentgame));
  1092.        
  1093.           }    
  1094.         }
  1095.        
  1096.       }    
  1097.    
  1098.   }else{
  1099.     genImage($currentgame['knight'], $currentgame['paladin'], 'xa', 'xb', $currentgame['monster'], 2, $currentgame);
  1100.     $response =  postComDraw(">>" . $post['no'] . PHP_EOL . "You are already dead!", $net['thread'], false, $net['servKey'], false, $getboard);
  1101.   }
  1102.    
  1103.    
  1104. }else{
  1105.   $response = postCom(">>" . $post['no'] . PHP_EOL . "You are not an adventurer in this encounter.", $net['thread'], false, $net['servKey'], false, false);
  1106. }
  1107.  
  1108. $response = json_decode($response, true);
  1109.  
  1110. $net['log'] = json_decode(file_get_contents($net['logFile']), true);
  1111. $thisLog = array();
  1112. $thisLog['time'] = tSmp();
  1113. $thisLog['no'] = $post['no'];
  1114. $thisLog['thread'] = $net['thread'];
  1115. $thisLog['name'] = $post['name'].$post['trip'];
  1116. $thisLog['command'] = 'skynet.' . $module . ': ' . $moduleText . ';';
  1117. $thisLog['response'] = $response['id'];
  1118. $thisLog['board'] = $getboard;
  1119. $net['log'][$post['no']] = $thisLog;
  1120. file_put_contents($net['logFile'], json_encode($net['log']));
  1121. $net['log'] = json_decode(file_get_contents($net['logFile']), true);
  1122.  
  1123. echo '>>' . $response['id'] . '<br>';
  1124. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement