Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nen = array();
- include_once( 'nen.php' );
- nen_ini();
- include_once ( $nen[ 'root' ]. 'trk tok.php');
- include_once ( $nen[ 'root' ]. 'trk echo.php');
- include_once( $nen[ 'root' ]. 'fasttoc.php' );
- // top of page (title)
- echo '<html><head><title>Roe XAMPP Builder (mkR11)</title></head><body>';
- regex_toc();
- // bottom of page
- echo '</body></html>';
- function regex_toc()
- {
- global $nen;
- // Roe BASIC table of contents
- $toc_index = 0;
- $toc = fasttoc( 'R11-SRC/', array( '.bas', '.BAS' ) );
- $pattern = file_get_contents( $nen[ 'root' ]. 'pcre/R11-ATTK.pattern.pcre' );
- echo '<h3>'.str_replace( "\r\n", "\r\n". '<br>', $pattern ).'</h3>';
- //$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';
- //echo '<h3>'.str_replace( "\r\n", "\r\n". '<br>', $pattern ).'</h3>';
- foreach( $toc as $toc_index => $toc_entry )
- {
- $page = file_get_contents( $nen[ 'root' ] . 'R11-SRC/' . $toc_entry );
- $page2 = '';
- // inject external Roe resources
- preg_match_all($pattern, $page, $cards, PREG_SET_ORDER, 0);
- trk_echo2( 'cards', $cards );
- foreach( $cards as $key => $value )
- {
- if( strlen( $page2 ) > 0 )
- {
- $page2 .= "\r\n";
- }
- $page2 .= $value;
- }
- // save roe source patch to file
- file_put_contents( $nen[ 'root' ] . 'R11-ATTK/' . $toc_entry, $page2 );
- echo '<table style="width:100%;text-align:top;"><tr><th colspan="2">
- <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>';
- echo '<tr><td style="vertical-align:top;width:50%;">';
- echo '<h3>R11-ATTK/'. $toc_entry. '</h3>';
- echo str_replace( "\r\n", "\r\n". '<br>', $page2);
- echo '</td><td style="vertical-align:top;width:50%;">';
- echo '<h3>R11-SRC/'. $toc_entry. '</h3>';
- echo str_replace( "\r\n", "\r\n". '<br>', $page);
- echo '</td></tr>';
- echo '</table>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement