jargon

Roe Collector Card Game (mk11ATTK)

Sep 24th, 2021
1,090
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $nen = array();
  4. include_once( 'nen.php' );
  5.  
  6. nen_ini();
  7.  
  8. include_once ( $nen[ 'root' ]. 'trk tok.php');
  9. include_once ( $nen[ 'root' ]. 'trk echo.php');
  10. include_once( $nen[ 'root' ]. 'fasttoc.php' );
  11.  
  12. // top of page (title)
  13. echo '<html><head><title>Roe XAMPP Builder (mkR11)</title></head><body>';
  14.  
  15. regex_toc();
  16.  
  17. // bottom of page
  18. echo '</body></html>';
  19.  
  20. function regex_toc()
  21. {
  22.     global $nen;
  23.    
  24.     // Roe BASIC table of contents
  25.     $toc_index = 0;
  26.     $toc = fasttoc( 'R11-SRC/', array( '.bas', '.BAS' ) );
  27.    
  28.     $pattern = file_get_contents( $nen[ 'root' ]. 'pcre/R11-ATTK.pattern.pcre' );
  29.  
  30.     echo '<h3>'.str_replace( "\r\n", "\r\n". '<br>', $pattern ).'</h3>';
  31.    
  32.     //$pattern = '/^(attack|attk)\.{0,1}([a-z0-9]{1,4}):$\R(|^(\s*)(attack|attk)\.{0,1}(pic)\$\ =\ (roe\.)([a-z0-9]{1,4})$)\R(|^(\s*)(attack|attk)\.{0,1}(name)\$\ =\ (roe\.)([a-z0-9]{1,4})$)\R(|^(\s*)(str)\.{0,1}(use)\ =\ (\-{0,1}([0-9\.]+))$)\R(|^(\s*)(ess)\.{0,1}(use)\ =\ (\-{0,1}([0-9\.]+))$)\R(|^(\s*)(attack|attk)\.{0,1}(damage|dmg)\ =\ (\-{0,1}([0-9\.]+))$)\R(|^(\s*)(str)\.{0,1}(damage|dmg)\ =\ (\-{0,1}([0-9\.]+))$)\R(|^(\s*)((GOSUB)\ (battle|batl))$)\R(|^(\s*)IF\ MID\$\(e\$\(tx\ \+\ \(ty\ -\ 1\)\ \*\ AA,\ 2\),\ 1,\ 4\)\ =\ (roe\.)([a-z0-9]{1,4})\ THEN$\R^(\s*)(GOSUB)\ (gone)$\R^(\s*)END\ IF$)\R?^(RETURN)$/m';
  33.    
  34.     //echo '<h3>'.str_replace( "\r\n", "\r\n". '<br>', $pattern ).'</h3>';
  35.        
  36.     foreach( $toc as $toc_index => $toc_entry )
  37.     {
  38.         $page = file_get_contents( $nen[ 'root' ] . 'R11-SRC/' . $toc_entry );
  39.         $page2 = '';
  40.        
  41.         // inject external Roe resources
  42.        
  43.         preg_match_all($pattern, $page, $cards, PREG_SET_ORDER, 0);
  44.         trk_echo2( 'cards', $cards );
  45.        
  46.         foreach( $cards as $key => $value )
  47.         {
  48.             if( strlen( $page2 ) > 0 )
  49.             {
  50.                 $page2 .= "\r\n";
  51.             }
  52.             $page2 .= $value;
  53.         }
  54.            
  55.        
  56.         // save roe source patch to file
  57.         file_put_contents( $nen[ 'root' ] . 'R11-ATTK/' . $toc_entry, $page2 );
  58.        
  59.         echo '<table style="width:100%;text-align:top;"><tr><th colspan="2">
  60.         <span style="alignment:center center;font-size:170%;">Roe Collector Card Game</span><br><span style="alignment:center center;font-size:120%;">Copyright 1997, 2021 Tim Keal</span></th></tr>';
  61.         echo '<tr><td style="vertical-align:top;width:50%;">';
  62.        
  63.         echo '<h3>R11-ATTK/'. $toc_entry. '</h3>';
  64.         echo str_replace( "\r\n", "\r\n". '<br>', $page2);
  65.         echo '</td><td style="vertical-align:top;width:50%;">';
  66.        
  67.         echo '<h3>R11-SRC/'. $toc_entry. '</h3>';
  68.         echo str_replace( "\r\n", "\r\n". '<br>', $page);
  69.         echo '</td></tr>';
  70.    
  71.         echo '</table>';
  72.     }
  73. }
  74.  
  75. ?>
RAW Paste Data