EOL 全員位置修改
原本程式碼 eol.php
代碼: 選擇全部
// 陣亡列表\r
$dead_list = '';
if ( isset($HTTP_POST_VARS['go2disp']) )
{
$sql = 'delete from phpbb_rpg_event where event_class = 5 and event_time <= ' . (time() - 86400 * 3) . ' and user_id = ' . $profiledata['user_id'];
$db->sql_query($sql);
$sql = 'select * from phpbb_rpg_event where event_class = 5 and user_id = ' . $profiledata['user_id'] . ' 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 username, rpg_level, rpg_eol_data from phpbb_users where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086' and user_id <> " . $profiledata['user_id'];
$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['username'];
}
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 phpbb_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 high="64" width="64" src="' . $eol_url . '/npc/npc' . substr($allpos[$i], 5, 2) . '.00.gif"></td>
</tr>
<tr><td align="center"><img high="64" width="64" 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);
修改後程式碼 eol.php
[php]<?php
// 位置列表\r
// 計算總頁次\r
$sql = "select count(*) as npc_count from phpbb_rpg_npc";
if ( $result = $db->sql_query($sql) )
{
$row = $db->sql_fetchrow($result);
$page_npc = floor(($row['npc_count'] - 1) / PAGE_EOL) + 1;
}
$sql = "select count(*) as player_count from phpbb_users where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086' and user_id <> " . $profiledata['user_id'];
if ( $result = $db->sql_query($sql) )
{
$row = $db->sql_fetchrow($result);
$page_player = floor(($row['player_count'] - 1) / PAGE_EOL) + 1;
}
$page_count= $page_npc + $page_player;
$start_rec = intval(( isset($HTTP_GET_VARS['count']) ) ? $HTTP_GET_VARS['count'] : $HTTP_POST_VARS['count']);
$player_list = '';
if ( isset($HTTP_POST_VARS['go2position']) )
{
$allpos = array();
$sql = "select username, rpg_level, rpg_eol_data from phpbb_users where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086' limit $start_rec, " . PAGE_EOL;
$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['username'];
}
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 phpbb_rpg_npc limit $start_rec, " . PAGE_EOL;
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($page_count > 0)
{
$player_list .= '<span class="gensmall"><b>頁次:';
for ($i = 1; $i <= $page_count ; $i++)
{
if ($i == (floor($start_rec / PAGE_EOL) + 1) )
{
$player_list .= ' ' . $i;
}
else
{
$player_list .= ' <a href="rpg.php?action=eol_prontera&count=' . (($i - 1) * PAGE_EOL) . '">' . $i . '</a>';
}
}
$palyer_list .= '</span>';
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 = $start_rec + 1;
$player_list .= '<table cellpadding="0" cellspacing="0" border="0"><tr>';
for ( $i=0; $i < count($allpos) - 1; $i++ )
{
$player_list .= '
<td align="center"><span class="gensmall">' . ($i + 1) . '</span></br>
<img high="40" width="40" alt="座標(' . intval(substr($allpos[$i], 7, 3)) . ', ' . intval(substr($allpos[$i], 10, 3)) . ') LV: ' . intval(substr($allpos[$i], 0, 5)) . ' ' . substr($allpos[$i], 13, 10) . '" src="' . $eol_url . '/npc/npc' . substr($allpos[$i], 5, 2) . '.00.gif">
</br><span class="gensmall"> ' . substr($allpos[$i], 23) . '</span></td>
';
}
$player_list .= '</tr></table>';
}
}
$player_list = '您現在的座標: (' . $now_x . ', ' . $now_y . ')<br />' . $player_list;
unset($allpos);
}
?>[/php]
修改以後的圖片
修改以後的結果
並沒有如想像中的1頁抓8個 而是 user 8 npc 8
換頁功能完全失效
此修改是參照 weapons.php
代碼: 選擇全部
// 取得武器列表\r
// 計算總頁次\r
$sql = 'select count(*) as weapon_count from phpbb_rpg_items where in_which_store = 1';
if ( $result = $db->sql_query($sql) )
{
$row = $db->sql_fetchrow($result);
$page_count = floor(($row['weapon_count'] - 1) / PAGE_WEAPONS) + 1;
}
$start_rec = intval(( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : $HTTP_POST_VARS['start']);
$itemlist = '';
$sql = "select * from phpbb_rpg_items where in_which_store = 1 order by item_order limit $start_rec, " . PAGE_WEAPONS;
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($page_count > 0)
{
$itemlist .= '<span class="gensmall"><b>頁次:';
for ($i = 1; $i <= $page_count ; $i++)
{
if ($i == (floor($start_rec / PAGE_WEAPONS) + 1) )
{
$itemlist .= ' ' . $i;
}
else
{
$itemlist .= ' <a href="rpg.php?action=weapons&start=' . (($i - 1) * PAGE_WEAPONS) . '">' . $i . '</a>';
}
}
$itemlist .= '</span>';
}
$i = $start_rec + 1;
$itemlist .= '<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
<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>
<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
{
$itemlist .= '<tr><td class="row3" align="center"><span class="gensmall">' . $i .
'</span></td><td><span class="gensmall">' . $row['item_name'] .
'</span></td><td align="right"><span class="gensmall">';
if ($row['item_spec_price'] > 0)
{
$itemlist .= 'max(' . number_format($row['item_price']) . ',' . $row['item_spec_price'] . '%財產)';
}
else
{
$itemlist .= number_format($row['item_price']);
}
$itemlist .= '</span></td><td><span class="gensmall">' . GetProperties($row) .
'</span></td><td><span class="gensmall">' . GetTypies($row['need_class']) .
'</span></td><td align="center"><span class="gensmall">' . $row['need_level'] .
'</span></td><td align="center"><span class="gensmall"><a href=rpg.php?action=weapons&start=' . $start_rec . '&buy=' .
$row['item_id'] . '>購買</a></span></td></tr>';
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
$itemlist .= '</table>';
}
恭請諸位大德 除錯修改
------------------------------------------------------------------------------
老師可以幫我檢查一下嗎?? 這裡是放棄職業的部分 我一直弄不好\r
$row2 好像搞不對了說\r
[php]<?php
// 放棄
if ( ( isset($HTTP_GET_VARS['cc']) || isset($HTTP_POST_VARS['cc']) ) &&
( isset($HTTP_GET_VARS['co']) || isset($HTTP_POST_VARS['co']) ) )
{
$cid = intval(( isset($HTTP_GET_VARS['cc']) ) ? $HTTP_GET_VARS['cc'] : $HTTP_POST_VARS['cc']);
$oid = intval(( isset($HTTP_GET_VARS['co']) ) ? $HTTP_GET_VARS['co'] : $HTTP_POST_VARS['co']);
$sql = "select i.item_name from phpbb_rpg_items i, phpbb_rpg_owns o
where i.in_which_store = 3 and o.user_id = " . intval($userdata['user_id']) .
" and i.need_class = $cid and i.need_level > $oid and o.item_id = i.item_id";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
message_die(GENERAL_MESSAGE, '在放棄這張職照之前,請先遺忘您所學得的技能: ' . $row['item_name'] . $returnurl);
}
$sql = "select position_class, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
$sql = "delete from phpbb_rpg_medals where user_id = " . intval($userdata['user_id']) .
" and position_class = $cid and position_order = $oid";
$db->sql_query($sql);
$sql = "update phpbb_rpg_medals set last_class = 1 where position_class = $cid and position_order = $oid - 1 and user_id = " . intval($userdata['user_id']);
$db->sql_query($sql);
$sql = "update phpbb_users set user_class = " . $row2['position_class'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set user_nowjob = '" . $row2['position_name'] . "' where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
UpdateRPGProperties(intval($userdata['user_id']));
}
unset($cid);
unset($oid);
}
?>[/php]
---------------------------------------------------------------------
這個mod 整合在水怪裡不知有多好ㄝ
http://www.phpbb.com/phpBB/viewtopic.php?t=121377