參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?t=20786
http://www.rdi.com.tw/modules/mydownloa ... eA&show=10
使用版本:(phpBB 2.0.6)
網站位置:http://w3.cies.tyc.edu.tw/~diber/html/m ... action=eol
帳號 test 密碼 5566
狀況描述: 水怪rpg的蘿莉帝國刑場的路人砍了不失血,但被路人砍反而會失血,不知是那裏有問題,然後也不知要貼那個程式碼上來,先貼兩個
rpg.php
代碼: 選擇全部
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_RPG);
init_userprefs($userdata);
//
// End session management
//
//
// Start of program proper
//
if ( isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action']) )
{
$mode = ( isset($HTTP_GET_VARS['action']) ) ? $HTTP_GET_VARS['action'] : $HTTP_POST_VARS['action'];
if ( $mode == 'menu' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=menu", true));
exit;
}
include($phpbb_root_path . 'rpg/menu.'.$phpEx);
exit;
}
if ( $mode == 'extra' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=extra", true));
exit;
}
include($phpbb_root_path . 'rpg/extra.'.$phpEx);
exit;
}
if ( $mode == 'position' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=position", true));
exit;
}
include($phpbb_root_path . 'rpg/position.'.$phpEx);
exit;
}
if ( $mode == 'items' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=items", true));
exit;
}
include($phpbb_root_path . 'rpg/items.'.$phpEx);
exit;
}
if ( $mode == 'weapons' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=weapons", true));
exit;
}
include($phpbb_root_path . 'rpg/weapons.'.$phpEx);
exit;
}
if ( $mode == 'defend' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=defend", true));
exit;
}
include($phpbb_root_path . 'rpg/defend.'.$phpEx);
exit;
}
if ( $mode == 'magic' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=magic", true));
exit;
}
include($phpbb_root_path . 'rpg/magic.'.$phpEx);
exit;
}
if ( $mode == 'hospital' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=hospital", true));
exit;
}
include($phpbb_root_path . 'rpg/hospital.'.$phpEx);
exit;
}
if ( $mode == 'joinjobs' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=joinjobs", true));
exit;
}
include($phpbb_root_path . 'rpg/joinjobs.'.$phpEx);
exit;
}
if ( $mode == 'dice' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=dice", true));
exit;
}
include($phpbb_root_path . 'rpg/dice.'.$phpEx);
exit;
}
if ( $mode == 'race' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=race", true));
exit;
}
include($phpbb_root_path . 'rpg/race.'.$phpEx);
exit;
}
if ( $mode == 'gamble' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=gamble", true));
exit;
}
include($phpbb_root_path . 'rpg/gamble.'.$phpEx);
exit;
}
if ( $mode == 'bank' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=bank", true));
exit;
}
include($phpbb_root_path . 'rpg/bank.'.$phpEx);
exit;
}
if ( $mode == 'rob' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=rob", true));
exit;
}
include($phpbb_root_path . 'rpg/rob.'.$phpEx);
exit;
}
if ( $mode == 'richer' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=richer", true));
exit;
}
include($phpbb_root_path . 'rpg/richer.'.$phpEx);
exit;
}
if ( $mode == 'eol' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=eol", true));
exit;
}
include($phpbb_root_path . 'rpg/eol.'.$phpEx);
exit;
}
if ( $mode == 'stat' )
{
if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=stat", true));
exit;
}
include($phpbb_root_path . 'rpg/stat.'.$phpEx);
exit;
}
}
else
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("index.$phpEx", true));
exit;
}
?>
代碼: 選擇全部
<?php
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
exit;
}
include($phpbb_root_path . 'rpg/function_rpg.'.$phpEx);
include($phpbb_root_path . 'rpg/function_eol.'.$phpEx);
$returnurl = '<br /><br /><a href="rpg.php?action=eol">返回上一頁</a>';
function PosCompare($a, $b)
{
if ( substr($a, 13) == substr($b, 13) )
{
srand((double)microtime()*1000000);
return rand(0, 1);
}
return ( substr($a, 13) > substr($b, 13) ? 1 : -1 );
}
$template->set_filenames(array(
'menu' => 'rpg_header.tpl',
'body' => 'rpg_eol.tpl')
);
if ( isset($HTTP_POST_VARS['go2escape']) ) // 離開 EOL
{
$sql = "update xoops_users set user_money = floor(user_money * 0.8), user_bank = floor(user_bank * 0.8), rpg_eol_data = concat('0', substring(rpg_eol_data, 2, 2), '000000086') where uid = " . intval($userdata['uid']);
$db->sql_query($sql);
}
if ( isset($HTTP_POST_VARS['go2url']) ) // 設定 EOL 圖檔位置\r
{
$sql = "update xoops_users set rpg_eol_url = '" . $HTTP_POST_VARS['rpg_eol_url'] . "' where uid = " . intval($userdata['uid']);
$db->sql_query($sql);
}
// 取得個人資料
$profiledata = get_userdata(intval($userdata['uid']));
$mydata = $profiledata['rpg_eol_data'];
while (strlen($mydata) < 12)
{
$mydata .= '0';
}
/*
00000000000000000
=== Y 座標
=== X 座標
== MAP_ID <-- 本來要作更多地圖的....算了
= 面對方向 0:下 1:左 2:上 3:右\r
== 使用的代表圖像
= Action Done
*/
$now_y = intval(substr($mydata, -3));
$now_x = intval(substr($mydata, -6, 3));
$map_id = intval(substr($mydata, -8, 2));
$now_dir = intval(substr($mydata, -9, 1));
$now_icon = substr($mydata, -11, 2);
$now_act = intval(substr($mydata, -12, 1));
$eol_url = $profiledata['rpg_eol_url'];
if ( $eol_url == '') $eol_url = 'images/eol';
if ($map_id == 0 && $now_x == 0 && $now_y == 0)
{
$now_y = 86;
$now_dir = 3;
}
// 更換角色\r
if ( isset($HTTP_POST_VARS['change_char']) && isset($HTTP_POST_VARS['char_id']) )
{
$now_icon = $HTTP_POST_VARS['char_id'];
}
// 陣亡列表\r
$dead_list = '';
if ( isset($HTTP_POST_VARS['go2disp']) )
{
$sql = 'delete from xoops_pbb_rpg_event where event_class = 5 and event_time <= ' . (time() - 86400 * 3) . ' and uid = ' . $profiledata['uid'];
$db->sql_query($sql);
$sql = 'select * from xoops_pbb_rpg_event where event_class = 5 and uid = ' . $profiledata['uid'] . ' order by event_time desc limit 0, 30';
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$i = 1;
$dead_list = '<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr><td align="center" class="catLeft"><b><span class="gen">#</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">日期</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">金額</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">備註</span></b></td></tr>';
do
{
$dead_list .= '<tr>
<td align="center" class="row3"><span class="gensmall">' . $i . '</span></td>
<td align="center"><span class="gensmall">' . ($row['event_time'] ? create_date($userdata['user_dateformat'], $row['event_time'], $board_config['board_timezone']) : $lang['Never_last_logon']) . '</span></td>
<td align="right"><span class="gensmall">' . number_format($row['event_money']) . '</span></td>
<td><span class="gensmall">' . $row['event_note'] . '</span></td>
</tr>';
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
$dead_list .= '</table>';
}
}
// 位置列表\r
if ( isset($HTTP_POST_VARS['go2position']) )
{
$allpos = array();
$sql = "select uname, rpg_level, rpg_eol_data from xoops_users where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086' and uid <> " . $profiledata['uid'];
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
if ( intval(substr($row['rpg_eol_data'], -12, 1)) == 0 ) $allpos[] = sprintf("%05d%02d%03d%03d%10s", $row['rpg_level'], substr($row['rpg_eol_data'], -11, 2), substr($row['rpg_eol_data'], -6, 3), substr($row['rpg_eol_data'], -3), '') . $row['uname'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$sql = "select npc_id, npc_name, rpg_level, now_icon, now_x, now_y, rpg_cur_hp, rpg_max_hp, generate_time from xoops_pbb_rpg_npc";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
if ( $row['npc_name'] == '' )
{
$live_time = $row['generate_time'] - ($row['rpg_cur_hp'] == $row['rpg_max_hp'] ? time() - 21600 : time() - 43200);
$live_time = sprintf("/ %02d:%02d:%02d", floor($live_time / 3600), floor( ($live_time % 3600) / 60 ), $live_time % 60);
}
else
{
$live_time = '';
}
$allpos[] = sprintf("%05d%02d%03d%03d%10s", $row['rpg_level'], $row['now_icon'], $row['now_x'], $row['now_y'], $live_time). ($row['npc_name'] == '' ? '路人' . $row['npc_id'] : $row['npc_name']);
}
while ( $row = $db->sql_fetchrow($result) );
unset($live_time);
}
if ( count($allpos) > 0 )
{
usort($allpos, PosCompare);
$i = 1;
$dead_list = '<table width="50%" cellpadding="0" cellspacing="0" border="0" class="forumline">
<tr>
<td align="center" class="catLeft"><b><span class="gen">#</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">對手</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">座標</span></b></td>
<td align="center" class="catLeft"><b><span class="gen">圖像</span></b></td>
</tr>';
for ( $i=0; $i < count($allpos) - 1; $i++ )
{
$dead_list .= '<tr height="32">
<td rowspan="2" align="center" class="row3"><span class="gensmall">' . ($i + 1) . '</span></td>
<td rowspan="2"><span class="gensmall"> ' . substr($allpos[$i], 23) . '</span></td>
<td rowspan="2"><span class="gensmall"> (' . intval(substr($allpos[$i], 7, 3)) . ', ' . intval(substr($allpos[$i], 10, 3)) . ')' . ' LV: ' . intval(substr($allpos[$i], 0, 5)) . ' ' . substr($allpos[$i], 13, 10) . '</span></td>
<td align="center"><img src="' . $eol_url . '/npc/npc' . substr($allpos[$i], 5, 2) . '.00.gif"></td>
</tr>
<tr><td align="center"><img src="' . $eol_url . '/npc/npc' . substr($allpos[$i], 5, 2) . '.01.gif"></td></tr>';
}
$dead_list .= '</table>';
}
$dead_list = '您現在的座標: (' . $now_x . ', ' . $now_y . ')<br />' . $dead_list;
unset($allpos);
}
// 取得地圖資訊,取得欲繪出的左上角座標
if ( intval($HTTP_POST_VARS['next_act']) == 1 && isset($HTTP_POST_VARS['next_x']) && isset($HTTP_POST_VARS['next_y']) )
{
$start_x = intval($HTTP_POST_VARS['next_x']) - 10;
$start_y = intval($HTTP_POST_VARS['next_y']) - 10;
}
else
{
$start_x = $now_x - 10;
$start_y = $now_y - 10;
}
$sql = "select max(map_x) as max_x, max(map_y) as max_y from xoops_pbb_rpg_eol where map_id = $map_id";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($start_x < 0) $start_x = 0;
if ($start_y < 0) $start_y = 0;
if ($start_x > $row['max_x'] - 19) $start_x = $row['max_x'] - 19;
if ($start_y > $row['max_y'] - 19) $start_y = $row['max_y'] - 19;
}
// 判斷按了什麼按鈕,以及取出最大移動範圍
$button_click = 0;
$max_point = 1;
$need_target = false;
if ( isset($HTTP_POST_VARS['go2move']) ) // 移動
{
$button_click = 1;
$max_point = GetMaxPoint($profiledata['uid'], 1);
$other_info = "移動最大有效距離: $max_point";
}
else if ( isset($HTTP_POST_VARS['go2attack']) ) // 攻擊
{
$button_click = 2;
$other_info = "請選擇攻擊目標(只能攻擊週圍的人)";
$need_target = true;
}
else if ( isset($HTTP_POST_VARS['go2skill']) ) // 技能\r
{
$button_click = 3;
$max_point = GetMaxPoint($profiledata['uid'], intval($HTTP_POST_VARS['sp_skill']));
if ( (intval($HTTP_POST_VARS['sp_skill']) >= 112 && intval($HTTP_POST_VARS['sp_skill']) <= 114) ||
(intval($HTTP_POST_VARS['sp_skill']) >= 166 && intval($HTTP_POST_VARS['sp_skill']) <= 170) ||
intval($HTTP_POST_VARS['sp_skill']) == 172 )
{
$need_target = true;
$other_info = "使用技能: " . GetSkillName(intval($HTTP_POST_VARS['sp_skill'])) . ($need_target ? " 技能有效範圍: $max_point" : "");
}
}
$other_info .= ($other_info == "" ? "" : " ") . "您現在的座標: ($now_x, $now_y)";
if ( $now_act > 0 ) $other_info .= " 技能有效回合: $now_act";
// 處理動作
if ( ( isset($HTTP_POST_VARS['next_x']) || isset($HTTP_POST_VARS['next_y']) || isset($HTTP_POST_VARS['next_act']) ||
( isset($HTTP_POST_VARS['go2skill']) && ! $need_target ) )
&& ( intval($HTTP_POST_VARS['next_x']) != $now_x || intval($HTTP_POST_VARS['next_y']) != $now_y ) )
{
if ( ( intval($HTTP_POST_VARS['next_act']) > 1 ) &&
( ($now_y == 86 && $now_x == 0) ||
(intval($HTTP_POST_VARS['next_x']) == 0 && intval($HTTP_POST_VARS['next_y']) == 86) ) )
{
$other_info = '不能在原點或是針對原點作出移動以外的動作!!';
}
else
{
if ( intval($HTTP_POST_VARS['next_act']) != 1 )
{
if ( CheckRefresh(9, intval($userdata['uid']), 10) )
{
message_die(GENERAL_MESSAGE, '為了避免系統負荷過重,請間隔 10 秒再進行動作!!' . $returnurl);
}
}
if ( $now_act > 0 ) $now_act--; // 目前隱身的回合
$other_info = SubmitNext(intval($HTTP_POST_VARS['next_x']), intval($HTTP_POST_VARS['next_y']), (isset($HTTP_POST_VARS['go2skill']) && ! $need_target ? 4 : intval($HTTP_POST_VARS['next_act'])), intval($HTTP_POST_VARS['sp_skill']));
if ( $other_info == 'xxxxx' )
{
message_die(GENERAL_MESSAGE, '您已經陣亡了!!' . $returnurl);
}
$profiledata = get_userdata(intval($userdata['uid']));
}
}
// 頭頂那一格能不能通過,用來決定是否畫貓爪\r
$CanPass = true;
if ( $button_click == 1 )
{
$sql = "select * from xoops_pbb_rpg_eol where map_id = $map_id and map_x = $now_x and map_y = $now_y - 1 and can_not_pass = 1";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$CanPass = false;
}
}
// 取出在附近的人\r
$AroundNPC = array();
$AroundPro = array();
$sql = "select uname, rpg_eol_data, rpg_level, rpg_cur_hp, rpg_max_hp, rpg_cur_mp, rpg_max_mp, rpg_attack, rpg_defense, rpg_magic, rpg_speed from xoops_users where rpg_eol_data is not null and left(right(rpg_eol_data, 8), 2) = $map_id and left(right(rpg_eol_data, 6), 3) >= $start_x and left(right(rpg_eol_data, 6), 3) <= $start_x + 19 and right(rpg_eol_data, 3) >= $start_y and right(rpg_eol_data, 3) <= $start_y + 19 and uid <> " . $profiledata['uid'];
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
// 隱身的人不顯示
if ( intval(substr($row['rpg_eol_data'], -12, 1)) == 0 || (intval(substr($row['rpg_eol_data'], -12, 1)) != 0 &&
(intval(substr($row['rpg_eol_data'], -6, 3)) == $now_x && abs(intval(substr($row['rpg_eol_data'], -3)) - $now_y) == 1) ||
(intval(substr($row['rpg_eol_data'], -3)) == $now_y && abs(intval(substr($row['rpg_eol_data'], -6, 3)) - $now_x) == 1)) )
{
$AroundNPC['x' . intval(substr($row['rpg_eol_data'], -6, 3)) . 'y' . intval(substr($row['rpg_eol_data'], -3))] = $row['rpg_eol_data'];
$AroundPro['x' . intval(substr($row['rpg_eol_data'], -6, 3)) . 'y' . intval(substr($row['rpg_eol_data'], -3))] = $row['uname'] . '
等 級: ' . $row['rpg_level'] . '
H P: ' . $row['rpg_cur_hp'] . ' / ' . $row['rpg_max_hp'] . '
M P: ' . $row['rpg_cur_mp'] . ' / ' . $row['rpg_max_mp'] . '
攻擊力: ' . $row['rpg_attack'] . '
防禦力: ' . $row['rpg_defense'] . '
魔 力: ' . $row['rpg_magic'] . '
速 度: ' . $row['rpg_speed'];
}
}
while ( $row = $db->sql_fetchrow($result) );
}
// NPC
$sql = "select * from xoops_pbb_rpg_npc where map_id = $map_id and now_x >= $start_x and now_x <= $start_x + 19 and now_y >= $start_y and now_y <= $start_y + 19";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$clear_npc = false;
$have_mylv = false;
do
{
$live_time = $row['generate_time'] - ( time() - ($row['rpg_cur_hp'] == $row['rpg_max_hp'] ? 21600 : 43200) );
$live_time = ($row['npc_name'] == '' ? '
出 場: ' . sprintf("%02d:%02d:%02d", floor($live_time / 3600), floor( ($live_time % 3600) / 60 ), $live_time % 60) : '');
$AroundNPC['x' . $row['now_x'] . 'y' . $row['now_y']] =
sprintf("%01d%02d%01d%02d%03d%03d", 0, $row['now_icon'], $row['now_dir'], $row['map_id'], $row['now_x'], $row['now_y']);
$AroundPro['x' . $row['now_x'] . 'y' . $row['now_y']] = ($row['npc_name'] == '' ? '路人' . $row['npc_id'] : $row['npc_name']) . '
等 級: ' . $row['rpg_level'] . '
H P: ' . $row['rpg_cur_hp'] . ' / ' . $row['rpg_max_hp'] . '
' . ($row['npc_name'] != '' ? 'M P: ' . $row['rpg_cur_mp'] . ' / ' . $row['rpg_max_mp'] . '
' : '') . '攻擊力: ' . $row['rpg_attack'] . '
防禦力: ' . $row['rpg_defense'] . '
魔 力: ' . $row['rpg_magic'] . '
速 度: ' . $row['rpg_speed'] . $live_time;
if ( ($row['rpg_cur_hp'] == $row['rpg_max_hp'] && $row['generate_time'] <= time() - 21600) || $row['generate_time'] <= time() - 43200 ) $clear_npc = true;
if ( $row['rpg_level'] == $profiledata['rpg_level'] + 5 ) $have_mylv = true;
}
while ( $row = $db->sql_fetchrow($result) );
unset($live_time);
if ( $clear_npc || !$have_mylv ) GenerateNPC();
unset($clear_npc);
unset($have_mylv);
}
// 產生資料頁面\r
$sql = "select * from xoops_pbb_rpg_eol where map_id = $map_id and map_x >= $start_x and map_x <= $start_x + 19 and map_y >= $start_y and map_y <= $start_y + 19 order by map_y, map_x";
$map_data = '';
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$map_data = '<tr height="32">';
$old_y = $row['map_y'];
do
{
if ( $row['map_y'] != $old_y ) // 換行判斷\r
{
$old_y = $row['map_y'];
$map_data .= '</tr><tr height="32">';
}
$map_data .= '<td width="32" background="' . $eol_url . '/eol' . $row['tile_id'] . '.gif"';
if (($button_click == 1) && (! $AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']]) && (abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point && !$row['can_not_pass'])
{
// 可移動的範圍
// $style_content = 'cursor=\'hand\'; border-Left=\'1 solid blue\';';
// $style_content = 'cursor=\'crosshair\';';
$style_content = 'cursor=\'hand\';';
$map_data .= ' style="' . $style_content . '" onclick="Click4Mouse(1, ' . $row['map_x'] . ', ' . $row['map_y'] . ')" ';
}
if ($now_x == $row['map_x'] && $now_y - 1 == $row['map_y'] )
{
// 目前格子所在的上一格,畫頭頂,順便判斷有沒有其他人或是移動的貓爪\r
if ( $AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']] )
{
// 有人\r
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -11, 2);
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $now_icon . '.' . $now_dir . '0.gif" alt="' . $AroundPro['x' . $row['map_x'] . 'y' . $row['map_y']] . '" style="background-image: url(\'' . $eol_url . '/npc/' . ($need_target ? 'x' : 'n') . 'pc' . $npc_icon . '.' . $npc_dir . '1.gif\'); ';
if ( $need_target )
{
// 有作其它動作,例如攻擊、魔法,要畫邊線
$map_data .= 'cursor=\'crosshair\';" onclick="Click4Mouse(' .
$button_click . ', ' . $row['map_x'] . ', ' . $row['map_y'] . ')';
}
$map_data .= '"></td>';
}
else if ( $button_click == 1 )
{
// 沒人,畫貓爪\r
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $now_icon . '.' . $now_dir . '0.gif" ' . ($CanPass ? 'style="background-image: url(\'images/eol.gif\')"' : '') . '></td>';
}
else
{
// 什麼都沒有
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $now_icon . '.' . $now_dir . '0.gif"></td>';
}
}
else if ($now_x == $row['map_x'] && $now_y == $row['map_y'] )
{
// 自己本身這一格\r
if ($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)])
{
// 剛好站在別人的頭頂
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -11, 2);
$map_data .= ' ><img src="' . $eol_url . '/npc/' . ($need_target ? 'x' : 'n') . 'pc' . $npc_icon . '.' . $npc_dir . '0.gif" alt="' . $profiledata['uname'] . '
等 級: ' . $profiledata['rpg_level'] . '
H P: ' . $profiledata['rpg_cur_hp'] . ' / ' . $profiledata['rpg_max_hp'] . '
M P: ' . $profiledata['rpg_cur_mp'] . ' / ' . $profiledata['rpg_max_mp'] . '
攻擊力: ' . $profiledata['rpg_attack'] . '
防禦力: ' . $profiledata['rpg_defense'] . '
魔 力: ' . $profiledata['rpg_magic'] . '
速 度: ' . $profiledata['rpg_speed'] . '" style="background-image: url(\'' . $eol_url . '/npc/npc' . $now_icon . '.' . $now_dir . '1.gif\')"></td>';
}
else
{
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $now_icon . '.' . $now_dir . '1.gif" alt="' . $profiledata['uname'] . '
等 級: ' . $profiledata['rpg_level'] . '
H P: ' . $profiledata['rpg_cur_hp'] . ' / ' . $profiledata['rpg_max_hp'] . '
M P: ' . $profiledata['rpg_cur_mp'] . ' / ' . $profiledata['rpg_max_mp'] . '
攻擊力: ' . $profiledata['rpg_attack'] . '
防禦力: ' . $profiledata['rpg_defense'] . '
魔 力: ' . $profiledata['rpg_magic'] . '
速 度: ' . $profiledata['rpg_speed'] . '"></td>';
}
}
else if (($button_click == 1) && (! $AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']]) && (! $AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)]) && (abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point && !$row['can_not_pass'])
{
// 這一格沒人,又有按移動
$map_data .= '><img src="images/eol.gif"></td>';
}
else if ($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']]) // 這一格有人\r
{
if ($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)])
{
// 剛好站在某個人的頭上
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -11, 2);
// 先畫這個人的頭\r
$map_data .= ' ><img src="' . $eol_url . '/npc/' . ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] + 1 - $now_y)) <= $max_point) ? 'x' : 'n') . 'pc' . $npc_icon . '.' . $npc_dir . '0.gif" alt="' . $AroundPro['x' . $row['map_x'] . 'y' . $row['map_y']] . '" style="background-image: url(\'' . $eol_url . '/npc/' . ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point) ? 'x' : 'n') . 'pc';
// 再畫這個人的身體
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -11, 2);
$map_data .= $npc_icon . '.' . $npc_dir . '1.gif\')';
// 有作其它動作,例如攻擊、魔法,而且在範圍內,要畫邊線
if ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point) ) $map_data .= '; cursor=\'crosshair\';" onclick="Click4Mouse(' . $button_click . ', ' . $row['map_x'] . ', ' . $row['map_y'] . ')';
}
else
{
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . $row['map_y']], -11, 2);
$map_data .= ' ><img src="' . $eol_url . '/npc/' . ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point) ? 'x' : 'n') . 'pc' . $npc_icon . '.' . $npc_dir . '1.gif" alt="' . $AroundPro['x' . $row['map_x'] . 'y' . $row['map_y']];
// 有作其它動作,例如攻擊、魔法,而且在範圍內,要畫邊線
if ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y)) <= $max_point) ) $map_data .= '"; style="cursor=\'crosshair\';" onclick="Click4Mouse(' . $button_click . ', ' . $row['map_x'] . ', ' . $row['map_y'] . ')';
}
$map_data .= '"></td>';
}
else if ($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1) ])
{
// 這一格是某人的頭頂
$npc_dir = intval(substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -9, 1));
$npc_icon = substr($AroundNPC['x' . $row['map_x'] . 'y' . ($row['map_y'] + 1)], -11, 2);
if (($button_click == 1))
{
// 如果剛好有按移動,而且在範圍內,要把貓爪擋掉
if ( abs($row['map_x'] - $now_x) + abs($row['map_y'] - $now_y) <= $max_point )
{
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $npc_icon . '.' . $npc_dir . '0.gif" style="background-image: url(\'images/eol.gif\')"></td>';
}
else
{
$map_data .= ' ><img src="' . $eol_url . '/npc/npc' . $npc_icon . '.' . $npc_dir . '0.gif"></td>';
}
}
else
{
$map_data .= ' ><img src="' . $eol_url . '/npc/' . ( ($need_target) && ((abs($row['map_x'] - $now_x) + abs($row['map_y'] + 1 - $now_y)) <= $max_point) ? 'x' : 'n') . 'pc' . $npc_icon . '.' . $npc_dir . '0.gif"></td>';
}
}
else
{
$map_data .= '> </td>';
}
}
while ( $row = $db->sql_fetchrow($result) );
$map_data .= '</tr>';
}
if ( $mydata != sprintf("%01d%02d%01d%02d%03d%03d", $now_act, $now_icon, $now_dir, $map_id, $now_x, $now_y) )
{
$mydata = sprintf("%01d%02d%01d%02d%03d%03d", $now_act, $now_icon, $now_dir, $map_id, $now_x, $now_y);
$sql = "update xoops_users set rpg_eol_data = '$mydata' where uid = " . $profiledata['uid'];
$db->sql_query($sql);
}
$button_list = GetButtonList($profiledata['uid'], intval($HTTP_POST_VARS['sp_skill']));
if ( $need_target || $button_click == 1 ) $button_list .= '<input type="hidden" name="next_x" value="' . $now_x . '"> <input type="hidden" name="next_y" value="' . $now_y . '"> <input type="hidden" name="next_act" value="' . $button_click . '">';
// 產生資料頁面\r
$page_title = "水怪大陸 RPG 首頁";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->assign_vars(array(
'USERNAME' => $profiledata['uname'],
'AVATAR_IMG' => GetAvatar($profiledata),
'EOL_MAP' => $map_data,
'DEAD_LIST' => $dead_list,
'RESULT_MSG' => $result_msg,
'BUTTON_CONTROL' => $button_list,
'OTHER_INFORMATION' => $other_info,
'RPG_EOL_URL' => $profiledata['rpg_eol_url'],
'L_NOWMENU' => '蘿莉帝國刑場') );
$template->pparse('menu');
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
unset($AroundNPC);
unset($AroundPro);
unset($button_list);
unset($need_target);
unset($button_click);
unset($sql);
unset($row);
unset($result);
unset($mydata);
unset($now_y);
unset($now_x);
unset($map_id);
unset($now_dir);
unset($now_icon);
unset($now_act);
unset($eol_url);
unset($dead_list);
unset($i);
unset($start_x);
unset($start_y);
unset($max_point);
unset($other_info);
unset($map_data);
\nunset($npc_icon);
unset($npc_dir);
?>