<script type="text/javascript" src="tools/js/tipped.js"></script>
<link rel="stylesheet" type="text/css" href="tools/css/tipped.css"/>
<script>
	$(document).ready(function() {
	    Tipped.create('.item_image');
	});
</script>
{% set rows = 0 %}
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
	<td><img src="{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0"></td>
	<td>
        {{ hook(constant('HOOK_CHARACTERS_BEFORE_INFORMATIONS')) }}
		{% if canEdit %}
			<a href="{{ constant('ADMIN_URL') }}?p=players&id={{ player.getId() }}" title="Edit in Admin Panel" target="_blank">
				<img src="images/edit.png"/>Edit
			</a>
		{% endif %}
		<table border="0" cellspacing="1" cellpadding="4" width="100%">
			{% if config.characters.outfit %}
			<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:{% if player.getLookType() in setting('core.outfit_images_wrong_looktypes') %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ outfit }}" alt="player outfit"/></div>
			{% endif %}

			<tr bgcolor="{{ config.vdarkborder }}">
				<td colspan="2" class="white"><b>Character Information</b></td>
			</tr>

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td width="20%">Name:</td>
				<td>{{ flag|raw }} <span style="color: {% if player.isOnline() %}green{% else %}red{% endif %}"><b>{{ player.getName() }}</b></span>{{ oldName }}</td>
			</tr>

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Sex:</td>
				<td>{{ sex }}</td>
			</tr>

			{% if marriage_enabled %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Marital status:</td>
				<td>{{ marital_status }}</td>
			</tr>
			{% endif %}

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Profession:</td>
				<td>{{ vocation }}</td>
			</tr>

			{% if config.characters.level %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Level:</td>
				<td>{{ player.getLevel() }}</td>
			</tr>
			{% endif %}

			{% if config.characters.experience %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Experience:</td>
				<td>{{ player.getExperience() }}</td>
			</tr>
			{% endif %}

			{% if config.characters.magic_level %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Magic Level:</td>
				<td>{{ player.getMagLevel() }}</td>
			</tr>
			{% endif %}

			{% if frags_enabled %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Frags:</td>
				<td>{{ frags_count }}</td>
			</tr>
			{% endif %}

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Residence:</td>
				<td>{{ town }}</td>
			</tr>

			{% if config.characters.balance %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Balance:</td>
				<td>{{ player.getBalance() }} Gold Coins.</td>
			</tr>
			{% endif %}

			{% if house.found %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>House:</td>
				<td>
					<table border="0">
						<tr>
							<td>{{ house.name ~ house.town ~ house.add }}</td>
							<td>
								<form action="?subtopic=houses&page=view" method="post">
									{{ csrf() }}
									<input type="hidden" name="house" value="{{ house.name }}">
									<input type="image" name="View" alt="View" src="{{ template_path }}/images/global/buttons/sbutton_view.gif" border="0" width="120">
								</form>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			{% endif %}

			{% if guild.rank is not null %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Guild membership:</td>
				<td>{{ guild.rank }} of the {{ guild.link|raw }}</td>
			</tr>
			{% endif %}

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Last login:</td>
				<td>{% if player.getLastLogin() == 0 %}Never logged in.{% else %}{{ player.getLastLogin()|date("M d Y, H:i:s") }} CEST{% endif %}</td>
			</tr>

			{% if config.characters.creation_date %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Created:</td>
				<td>{{ player.getCreated()|date("M d Y, H:i:s") }} CEST</td>
			</tr>
			{% endif %}

			{% if comment is not null %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td valign="top">Comment:</td>
				<td style="word-break: break-all">{{ comment|raw }}</td>
			</tr>
			{% endif %}

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Account Status:</td>
				<td>{% if account.isPremium() %}Premium Account{% else %}Free Account{% endif %}</td>
			</tr>
		</table>
		{{ hook(constant('HOOK_CHARACTERS_AFTER_INFORMATIONS')) }}
		<br/>
		<table border="0" width="100%">
			<tr>
				{{ hook(constant('HOOK_CHARACTERS_BEFORE_SKILLS')) }}

				{% if config.characters.skills %}
				<!-- SKILLS -->
				<td width="30%" valign="top">
					<table border="0" cellspacing="1" cellpadding="4" width="100%">
						<tr bgcolor="{{ config.vdarkborder }}">
							<td colspan="2" class="white"><B>Skills</b></td>
						</tr>
						{% set i = 0 %}
						{% for skill in skills %}
						{% set i = i + 1 %}
						<tr bgcolor="{{ getStyle(i) }}">
							<td valign="top">{{ skill.name }}</td>
							<td>{{ skill.value }}</td>
						</tr>
						{% endfor %}
					</table>
				</td>
				<!-- SKILLS_END -->
				{% endif %}

				{{ hook(constant('HOOK_CHARACTERS_AFTER_SKILLS')) }}

				{% if quests_enabled %}
				<!-- QUESTS -->
				<td width="40%" valign="top">
					<table border="0" cellspacing="1" cellpadding="4" width="100%">
						<tr bgcolor="{{ config.vdarkborder }}">
							<td colspan="2" class="white"><b>Quests</b></td>
						</tr>
						{% set i = 0 %}
						{% for name, done in quests %}
						{% set i = i + 1 %}
						<tr bgcolor="{{ getStyle(i) }}">
							<td valign="top">{{ name }}</TD>
							<td><img src="images/{% if done %}true{% else %}false{% endif %}.png" border="0"/></td>
						</tr>
						{% endfor %}
					</table>
				</td>
				<!-- QUESTS_END -->
				{% endif %}

				{{ hook(constant('HOOK_CHARACTERS_AFTER_QUESTS')) }}

				{% if config.characters.equipment %}
				<!-- EQUIPMENT -->
				<td width="100" valign="top">
					<table border="0" cellspacing="1" cellpadding="4" width="100%">
						<tr bgcolor="{{ config.vdarkborder}}">
							<td colspan="2" class="white"><b>Equipment</b></td>
						</tr>
						<tr bgcolor="{{ getStyle(1) }}">
							<td>
								<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
									<tr>
										<td>
											<table cellspacing="0" style="background: #292929;">
												<tr><td style="border:1px solid #808080;">{{ equipment[2]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[6]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[9]|raw }}</td></tr>
												<tr height="11px"><td>{% if skull is not null %}<img src="images/{{ skull }}.gif">{% endif %}</td></tr>
											</table>
										</td>
										<td>
											<table cellspacing="0" style="background: #292929;">
												<tr><td style="border:1px solid #808080;">{{ equipment[1]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[4]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[7]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[8]|raw }}</td></tr>
											</table>
										</td>
										<td>
											<table cellspacing="0" style="background: #292929;">
												<tr><td style="border:1px solid #808080;">{{ equipment[3]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[5]|raw }}</td></tr><tr><td style="border:1px solid #808080;">{{ equipment[10]|raw }}</td></tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
				<!-- EQUIPMENT_END -->
				{% endif %}

				{{ hook(constant('HOOK_CHARACTERS_AFTER_EQUIPMENT')) }}
			</tr>
		</table>

		{{ hook(constant('HOOK_CHARACTERS_BEFORE_DEATHS')) }}

		{% if deaths|length > 0 %}
		<!-- DEATHS -->
		<br/>
		<table border="0" cellspacing="1" cellpadding="4" width="100%">
			<tr bgcolor="{{ config.vdarkborder }}">
				<td colspan="2" class="white"><b>Character Deaths</b></td>
			</tr>
			{% set i = 0 %}
			{% for death in deaths %}
			<tr bgcolor="{{ getStyle(i) }}">
				<td width="20%" align="center">{{ death.time|date("j M Y, H:i") }}</td>
				<td>{{ death.description|raw }}</td>
			</tr>

			{% set i = i + 1 %}
			{% endfor %}
		</table>
		<!-- DEATHS_END -->
		{% endif %}
		{% if frags|length > 0 %}
		<!-- FRAGS -->
		<br/>
		<table border="0" cellspacing="1" cellpadding="4" width="100%">
			<tr bgcolor="{{ config.vdarkborder }}">
				<td colspan="2" class="white"><b>Victims</b></td>
			</tr>
			{% set i = 0 %}
			{% for frag in frags %}
			<tr bgcolor="{{ getStyle(i) }}">
				<td width="20%" align="center">{{ frag.time|date("j M Y, H:i") }}</td>
				<td>{{ frag.description|raw }} ({% if frag.unjustified %}<span style="color: red; font-size: 10px">Unjustified</span>{% else %}<span style="color: green; font-size: 10px">Justified</span>{% endif %})</td>
			</tr>
			{% set i = i + 1 %}
			{% endfor %}
		</table>
		<!-- FRAGS_END -->
		{% endif %}

		{{ hook(constant('HOOK_CHARACTERS_BEFORE_SIGNATURE')) }}

		{% if setting('core.signature_enabled') %}
		<!-- SIGNATURE -->
		<script type="text/javascript">
			function showSignLinks()
			{
				if(document.getElementById('signLinks').style.display == "none")
				{
					document.getElementById('signLinks').style.display = "inline";
					document.getElementById('signText').innerHTML = "Hide links";
				}
				else
				{
					document.getElementById('signLinks').style.display = "none";
					document.getElementById('signText').innerHTML = "Show links";
				}
			}
		</script>
		<br/>
		<table border="0" cellspacing="1" cellpadding="4" width="100%"><tr bgcolor="{{ config.vdarkborder }}"><td colspan=2 class="white"><b>Signature</b></td></tr>
			<tr bgcolor="{{ config.lightborder }}"><td align="center" valign="top">
				<img src="{{ signature_url }}" alt="Signature for player {{ player.getName() }}">
				<br/>
				<b><a href="#" onclick="showSignLinks(); return false;" id="signText">Show links</a></b>
				<br/>
				<table id="signLinks" style="display: none;">
					<tr>
						<td>Website:</td>
						<td><input type="text" value="<a href=&quot;{{ player_link }}&quot;><img src=&quot;{{ signature_url }}&quot;></a>" style="width: 400px;" onclick="this.select()"></td>
					</tr>
					<tr>
						<td>Forum:</td>
						<td><input type="text" value="[URL={{ player_link }}][IMG]{{ signature_url }}[/IMG][/URL]" style="width: 400px;" onclick="this.select()"></td>
					</tr>
					<tr>
						<td>Direct link:</td>
						<td><input type="text" value="{{ signature_url }}" style="width: 400px;" onclick="this.select()"></td>
					</tr>
				</table>
			</td></tr>
		</table>
		<!-- SIGNATURE_END -->
		{% endif %}
		{{ hook(constant('HOOK_CHARACTERS_AFTER_SIGNATURE')) }}
		{% if not player.isHidden() %}
		{% set rows = 0 %}
		<!-- ACCOUNT_INFORMATION -->
		<br/><br/>
		<table border="0" cellspacing="1" cellpadding="4" width="100%">
			<tr bgcolor="{{ config.vdarkborder }}">
				<td colspan="2" class="white"><b>Account Information</b></td>
			</tr>

			{% set realName = account.getRLName() %}
			{% if realName is not empty %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td width="20%">Real name:</td>
				<td>{{ realName }}</td>
			</tr>
			{% endif %}

			{% set group = player.getGroup() %}
			{% if group.isLoaded() and group.getId() != 1 %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td>Position:</td>
				<td>{{ group.getName()|capitalize }}</td>
			</tr>
			{% endif %}

			{% set realLocation = account.getLocation() %}
			{% if realLocation is not empty %}
			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td width="20%">Location:</td>
				<td>{{ realLocation }}</td>
			</tr>
			{% endif %}

			{% set rows = rows + 1 %}
			<tr bgcolor="{{ getStyle(rows) }}">
				<td width="20%">Created:</td>
				<td>{{ account.getCreated()|date("j F Y, g:i a") }}
					{% if bannedUntil matches '/^\\d+$/' or bannedUntil == '-1' %}
						<span style="color: red">[Banished {% if bannedUntil == '-1' %}forever{% else %}until {{ bannedUntil|date('d F Y, h:s') }}{% endif %}]</span>
					{% else %}
					{{ bannedUntil|raw }}
					{% endif %}
				</td>
			</tr>
		</table>
		<!-- ACCOUNT_INFORMATION_END -->
		{{ hook(constant('HOOK_CHARACTERS_AFTER_ACCOUNT')) }}
		<!-- CHARACTERS_LIST -->
		<br/><br/>
		<table border="0" cellspacing="1" cellpadding="4" width="100%">
			<tr bgcolor="{{ config.vdarkborder }}">
				<td colspan=4 class="white"><b>Characters</b></td>
			</tr>
			<tr bgcolor="{{ config.darkborder }}">
				<td width="62%"><B>Name</b></td>
				<td width="30%"><B>Level</b></td>
				<td width="8%"><b>Status</b></td>
				<td><b>&#160;</b></td>
			</tr>
			{% set i = 0 %}
			{% for player in account_players %}
				{% if not player.isHidden() and (config('characters')['deleted'] or not player.isDeleted()) %}
				{% set i = i + 1 %}
			<tr bgcolor="{{ getStyle(i) }}">
				<td>
					<nobr>{{ i }}.&#160;{{ player.getName() }}{% if player.isDeleted() %}<span style="color: red"> [DELETED]</span>{% endif %}</nobr>
				</td>

				<td>{{ player.getLevel() }} {{ player.getVocationName() }}</td>
				<td>{% if player.isOnline() %}<b><span style="color: green">Online</span></b>{% endif %}</td>
				<td>
					<table border="0" cellspacing="0" cellpadding="0">
						<form action="{{ getLink('characters') }}" method="post">
							{{ csrf() }}
							<tr>
								<td>
									<input type="hidden" name="name" value="{{ player.getName() }}"/>
									{% set button_name = "View" %}
									{{ include('buttons.base.html.twig') }}
								</td>
							</tr>
						</form>
					</table>
				</td>
			</tr>
				{% endif %}
			{% endfor %}
		</table>
		<!-- CHARACTERS_LIST_END -->
		{% endif %}
		{{ hook(constant('HOOK_CHARACTERS_AFTER_CHARACTERS')) }}
		{% if canEdit %}
			<a href="{{ constant('ADMIN_URL') }}?p=players&id={{ player.getId() }}" title="Edit in Admin Panel" target="_blank">
				<img src="images/edit.png"/>Edit
			</a>
		{% endif %}
		</td>
		<td>
			<img src="{{ template_path }}/images/general/blank.gif" width="10" height="1" border="0">
		</td>
	</tr>
</table>
<br/><br/>{{ search_form|raw }}