Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'console_hack.php';
- require_once '_library_init.php';
- $smarty = new Smarty();
- $smarty->setConfigDir( $_SERVER['DOCUMENT_ROOT']);
- if(!is_dir($_SERVER['DOCUMENT_ROOT'] . '/cache'))
- mkdir($_SERVER['DOCUMENT_ROOT'] . '/cache');
- $smarty->setCacheDir( $_SERVER['DOCUMENT_ROOT'] . '/cache');
- if(!is_dir($_SERVER['DOCUMENT_ROOT'] . '/cache/templates'))
- mkdir($_SERVER['DOCUMENT_ROOT'] . '/cache/templates');
- $smarty->setCompileDir($_SERVER['DOCUMENT_ROOT'] . '/cache/templates');
- // add before current plugins directory:
- $pluginsDirs = $smarty->getPluginsDir();
- if(!is_dir($_SERVER['DOCUMENT_ROOT'] . '/plugins'))
- mkdir($_SERVER['DOCUMENT_ROOT'] . '/plugins');
- array_unshift($pluginsDirs, $_SERVER['DOCUMENT_ROOT'] . '/plugins');
- $smarty->setPluginsDir($pluginsDirs);
- $smarty->force_compile = defined('TEST_FORCE_COMPILE') ? TEST_FORCE_COMPILE : true;
- $smarty->registerFilter('pre',
- function($tpl_source, Smarty_Internal_Template $template)
- {
- $stack = stristr($tpl_source, '__HALT' . '_COMPILER');
- $tpl = substr($stack, strpos($stack, '?'.'>') + 2);
- return $tpl ?: $tpl_source;
- }
- );
- $smarty->left_delimiter = '<![CDATA[';
- $smarty->right_delimiter = ']]>';
- $smarty->assign('equip', array(
- 'helmet',
- 'chestplate',
- 'leggings',
- 'boots',
- ));
- $smarty->assign('wield', array('equipped',));
- $smarty->display(__FILE__);
- __halt_compiler();
- ?><?xml version="1.0" encoding="UTF-8"?>
- <config>
- <lines at="topleft">
- <line>
- <str>Day {day}, </str>
- <if>
- <var>daytime</var>
- <str>$2</str>
- <str>$4</str>
- </if>
- <str>{mctime}$r</str>
- </line>
- <line>
- <str>Light: </str>
- <max>
- <var>light</var>
- <num>7.5</num>
- <str>$e</str>
- <str>$c</str>
- </max>
- <var>light</var>
- <str>$r / </str>
- <max>
- <var>lightfeet</var>
- <num>7.5</num>
- <str>$e</str>
- <str>$c</str>
- </max>
- <var>lightfeet</var>
- <str>$r</str>
- </line>
- <line>
- <str> </str>
- </line>
- <![CDATA[foreach $equip as $item]]>
- <line>
- <if>
- <equal>
- <var><![CDATA[$item]]>name</var>
- <str/>
- </equal>
- <str/>
- <concat>
- <str>{<![CDATA[$item]]>icon} {<![CDATA[$item]]>name} </str>
- <if>
- <greater>
- <var><![CDATA[$item]]>damageleft</var>
- <num>0</num>
- </greater>
- <op>
- <str>gt</str>
- <pct>
- <var><![CDATA[$item]]>damageleft</var>
- <var><![CDATA[$item]]>maxdamage</var>
- </pct>
- <num>50</num> <num>20</num> <num>10</num>
- <str>$e</str> <str>$6</str> <str>$c</str> <str>$4</str>
- </op>
- </if>
- <max>
- <var><![CDATA[$item]]>damageleft</var>
- <num>0.5</num>
- <str>{<![CDATA[$item]]>damageleft}$r / $e{<![CDATA[$item]]>maxdamage}</str>
- <str/>
- </max>
- </concat>
- </if>
- </line>
- <![CDATA[/foreach]]>
- <line>
- <if>
- <and>
- <![CDATA[foreach $equip as $item]]>
- <equal><str/><var><![CDATA[$item]]>name</var></equal>
- <![CDATA[/foreach]]>
- </and>
- <str/>
- <str> </str>
- </if>
- </line>
- <![CDATA[foreach $wield as $item]]>
- <line>
- <if>
- <equal>
- <var><![CDATA[$item]]>name</var>
- <str/>
- </equal>
- <str/>
- <concat>
- <str>{<![CDATA[$item]]>icon} {<![CDATA[$item]]>name} </str>
- <if>
- <greater>
- <var><![CDATA[$item]]>damageleft</var>
- <num>0</num>
- </greater>
- <op>
- <str>gt</str>
- <pct>
- <var><![CDATA[$item]]>damageleft</var>
- <var><![CDATA[$item]]>maxdamage</var>
- </pct>
- <num>50</num> <num>20</num> <num>10</num> <num>0</num>
- <str>$e</str> <str>$6</str> <str>$c</str> <str>$4</str>
- <str/>
- </op>
- </if>
- <max>
- <var><![CDATA[$item]]>damageleft</var>
- <num>0.5</num>
- <str>{<![CDATA[$item]]>damageleft}$r / $e{<![CDATA[$item]]>maxdamage}</str>
- <str/>
- </max>
- </concat>
- </if>
- </line>
- <![CDATA[/foreach]]>
- <line>
- <if>
- <equal>
- <var>equippedname</var>
- <str/>
- </equal>
- <str/>
- <str> </str>
- </if>
- </line>
- <![CDATA[for $i=0 to 15]]>
- <line>
- <if>
- <var>potionnegative<![CDATA[$i]]></var>
- <str>$c</str>
- </if>
- <op>
- <str>eq</str>
- <str/>
- <var>potioneffect<![CDATA[$i]]></var>
- <str/>
- <str>{potionicon<![CDATA[$i]]>} {potioneffect<![CDATA[$i]]>}$r </str>
- </op>
- <max>
- <var>potiondurationticks<![CDATA[$i]]></var>
- <num>10</num>
- <str>{yellow}{potionduration<![CDATA[$i]]>}{reset}</str>
- <str/>
- </max>
- </line>
- <![CDATA[/for]]> </lines>
- </config>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement