<?php

include($phpbb_root_path . 'rpg/function_rpg.'.$phpEx);


if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
	exit;
}

$returnurl = '<br /><br /><a href="rpg.php?action=extra">返回上一頁</a>';

$template->set_filenames(array(
	'menu' => 'rpg_header.tpl',
	'body' => 'rpg_extra.tpl')
);

// 取得個人資料
$profiledata = get_userdata(intval($userdata['uid']));

$extrainfo = '';

$sql = 'SELECT s.setting_value2, p.* FROM xoops_pbb_rpg_setting s, xoops_pbb_rpg_position p WHERE s.setting_id = 1 AND s.setting_value1 = p.position_class ORDER BY p.position_class, p.position_order';
if ( $result = $db->sql_query($sql) )
{
	if ( $row = $db->sql_fetchrow($result) )
	{
		$extrainfo = '<table class="forumline" width="95%" 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>
				</tr>';
		$posclass = -1;
		do
		{
			if ($posclass != $row['position_class'])
			{
				$i = 1;
				$posclass = $row['position_class'];
			}
			$extrainfo .= '<tr><td class="row3"><span class="gensmall">';
			if ($i == 1)
			{
				$extrainfo .= $row['setting_value2'];
			}
			$extrainfo .= '</span></td>
					<td align="center"><span class="gensmall">' . $i . '</span>
					<td><span class="gensmall">' . $row['position_name'] . '</span>
					<td><span class="gensmall">' . GetProperties($row) . '</span>
					<td align="right"><span class="gensmall">' . $row['position_fee'] . '</span></td></tr>';
			$i++;
		}
		while ( $row = $db->sql_fetchrow($result) );
		$extrainfo .= '';
	}
}

// 產生資料頁面
$page_title = "水怪大陸 RPG 首頁";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->assign_vars(array(
	'USERNAME' => $profiledata['uname'],
	'AVATAR_IMG' => GetAvatar($profiledata),
	'RPG_EXTRA_INFO' => $extrainfo,
	'L_NOWMENU' => '職業屬性一覽') );

$template->pparse('menu');
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>