📄 ad_battle.php
字号:
<?php
class ad_battle
{
var $base_url;
function ad_battle( )
{
global $IN;
global $root_path;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
switch ( $IN['code'] )
{
case "01" :
$this->options( );
break;
case "02" :
$this->scenes( );
break;
case "03" :
$this->addscenes( );
break;
case "04" :
$this->prune( );
break;
case "10" :
$this->editviewbattles( );
break;
case "11" :
$this->removeviewbattles( );
break;
case "12" :
$this->editscenes( );
break;
case "13" :
$this->removescenes( );
break;
case "20" :
$this->do_options( );
break;
case "21" :
$this->do_scenes( );
break;
case "22" :
$this->do_prune( );
break;
default :
$this->viewbattles( );
break;
}
}
function viewbattles( )
{
global $IN;
global $root_path;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "You may add/edit and remove View Battles below.";
$ADMIN->page_title = "View Battles";
$SKIN->td_header[] = array( "Battle<br>Number", "5%" );
$SKIN->td_header[] = array( "Battle Name", "20%" );
$SKIN->td_header[] = array( "Owner", "10%" );
$SKIN->td_header[] = array( "Owner ID", "5%" );
$SKIN->td_header[] = array( "Opponent", "10%" );
$SKIN->td_header[] = array( "Opponent ID", "5%" );
$SKIN->td_header[] = array( "Battle Password", "10%" );
$SKIN->td_header[] = array( "Battle State", "10%" );
$SKIN->td_header[] = array( "Turn ID", "5%" );
$SKIN->td_header[] = array( "", "5%" );
$SKIN->td_header[] = array( "", "5%" );
$ADMIN->html .= $SKIN->start_table( "Settings" );
$DB->query( "SELECT * from ibf_battle ORDER BY battlenumber" );
while ( $DB->get_num_rows( ) && ( $rpg = $DB->fetch_row( ) ) )
{
$ADMIN->html .= $SKIN->add_td_row( array(
"{$rpg['battlenumber']}",
"<b>{$rpg['battlename']}</b>",
"{$rpg['owner']}",
"{$rpg['ownerid']}",
"{$rpg['opponent']}",
"{$rpg['opponentid']}",
"{$rpg['battlekey']}",
"{$rpg['battlestate']}",
"{$rpg['turnid']}",
"<center><a href='".$SKIN->base_url."&act=battle&code=10&battlenumber={$rpg['battlenumber']}'>Edit</a></center>",
"<center><a href='".$SKIN->base_url."&act=battle&code=11&battlenumber={$rpg['battlenumber']}'>Remove</a></center>"
) );
}
$ADMIN->html .= $SKIN->add_td_basic( );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
function options( )
{
global $IN;
global $root_path;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "You may change the configuration below";
$ADMIN->page_title = "Battles Settings";
$SKIN->td_header[] = array( "", "60%" );
$SKIN->td_header[] = array( "", "40%" );
$ADMIN->html .= $SKIN->start_form( array(
1 => array( "code", "20" ),
2 => array( "act", "battle" )
) );
$ADMIN->html .= $SKIN->start_table( "Settings" );
$DB->query( "SELECT * FROM ibf_battle_options" );
$rpg = $DB->fetch_row( );
$ADMIN->html .= $SKIN->add_td_basic( "Edit Battle Options", "left", "catrow2" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Battle is on</b><br>Turning the battle off will not allow new battles, nor continuation of current battles.",
$SKIN->form_yes_no( "ison", stripslashes( $rpg['ison'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Maximum number of battles</b><br>(0 = infinite)",
$SKIN->form_input( "maxbattles", stripslashes( $rpg['maxbattles'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Battles are private</b>",
$SKIN->form_yes_no( "privacy", stripslashes( $rpg['privacy'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Refresh time to automaticaly refresh battles (in seconds)</b><br>(0 = never refresh)",
$SKIN->form_input( "refreshtime", stripslashes( $rpg['refreshtime'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Last activity time for pruning battles</b><br>604800 = 7*24*3600 = one week",
$SKIN->form_input( "lastactive", stripslashes( $rpg['prunetime'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Post battle results</b>",
$SKIN->form_yes_no( "postresults", stripslashes( $rpg['postresults'] ) )
) );
$cats = array( );
$seen = array( );
$last_cat_id = -1;
$DB->query( "SELECT c.id, c.name, f.id as forum_id, f.subwrap, f.name as forum_name, f.subwrap, f.parent_id, f.category FROM ibf_categories c, ibf_forums f WHERE c.id > 0 ORDER BY c.position, f.position" );
if ( $DB->get_num_rows( ) )
{
while ( $r = $DB->fetch_row( ) )
{
if ( 0 < $r['parent_id'] )
{
}
else
{
if ( $last_cat_id != $r['id'] )
{
$cats[] = array(
"c_".$r['id'],
"Category: ".$r['name']
);
$seen[$r['id']] = 1;
$last_cat_id = $r['id'];
}
if ( !( $r['category'] == $r['id'] ) && !( $r['forum_id'] != $IN['f'] ) )
{
$cats[] = array(
"f_".$r['forum_id'],
"Forum: ".$r['forum_name']
);
}
}
}
}
else
{
$DB->query( "SELECT * from ibf_categories WHERE id > 0" );
while ( $r = $DB->fetch_row( ) )
{
$cats[] = array(
"c_".$r['id'],
"Category: ".$r['name']
);
}
}
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Forum to post the battle results</b>",
$SKIN->form_dropdown( "battleforum", $cats, $real_parent )
) );
$ADMIN->html .= $SKIN->add_td_basic( "Power Level Options", "left", "catrow2" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Do you want a user's power level calculated by and based on their post count?</b><br>A user's power level determines ALL of their stats for the battle.",
$SKIN->form_yes_no( "usepostcount", stripslashes( $rpg['usepostcount'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Power level modifier</b><br>This controls how fast user's gain levels based on their post count.<br>Keep the value between 1 and 5. Integers only.<br>(High number = less exp per post)",
$SKIN->form_input( "exprate", stripslashes( $rpg['exprate'] ) )
) );
$ADMIN->html .= $SKIN->add_td_basic( "Experience Options", "left", "catrow2" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Give experience to users for participating in battles based on the number of turns</b><br>This only works if you decided not to base a user's level off of their posts.",
$SKIN->form_yes_no( "givebattleexp", stripslashes( $rpg['givebattleexp'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Amount of experience to give per turn in battle</b><br>Use this if you selected \"Yes\" for the above question.",
$SKIN->form_input( "expperturn", stripslashes( $rpg['expperturn'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Give experience to users for participating in battles based on the winner of the battle</b><br>This only works if you decided not to base a user's level off of their posts.",
$SKIN->form_yes_no( "givewinexp", stripslashes( $rpg['givewinexp'] ) )
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Amount of experience to give per win in battle</b><br>Use this if you selected \"Yes\" for the above question.",
$SKIN->form_input( "expperwin", stripslashes( $rpg['expperwin'] ) )
) );
$ADMIN->html .= $SKIN->end_form( "Save Changes" );
$ADMIN->html .= $SKIN->end_table( );
$ADMIN->output( );
}
function scenes( )
{
global $IN;
global $root_path;
global $INFO;
global $DB;
global $SKIN;
global $ADMIN;
global $std;
global $MEMBER;
global $GROUP;
$ADMIN->page_detail = "You may add/edit and remove Battle Scenes below.";
$ADMIN->page_title = "Edit Battle Scenes";
$SKIN->td_header[] = array( "View Scene", "5%" );
$SKIN->td_header[] = array( "Name", "50%" );
$SKIN->td_header[] = array( "Icon", "10%" );
$SKIN->td_header[] = array( "", "5%" );
$SKIN->td_header[] = array( "", "5%" );
$ADMIN->html .= $SKIN->start_table( "Settings" );
$DB->query( "SELECT * from ibf_battle_scenes ORDER BY battlesceneid" );
while ( $DB->get_num_rows( ) && ( $rpg = $DB->fetch_row( ) ) )
{
$ADMIN->html .= $SKIN->add_td_row( array(
"<img src=html/rpg/battlescene/{$rpg['icon']} height=100>",
"<b>{$rpg['name']}</b>",
"{$rpg['icon']}",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -