olá estou aqui com uma grande duvida, eu encontrei 1 site compativel com meu ot xml para versão 7.92 de tibia, porém estou com o problema de que meu site não está marcando a cidade onde o player mora acredito que falta alguma coisa, e eu gostaria muito que alguem me ajudasse até mesmo por que é uma coisa facil para quem entende de web designe, ^^
o script é este:
<?php include ('top.inc.php');?>
<h2>Procura de Personagem:</h2>
<?php
$char = $_REQUEST['char'];
$char = trim($char);
$guild_file = $dirdata . "guilds.xml";
$g = fopen($guild_file, "r");
$guild_contents = fread($g, filesize($guild_file));
$guild_tags = explode("<", $guild_contents);
$found = 0;
foreach($guild_tags as $guild_tag) {
if (substr($guild_tag, 0, 5) == "guild" && $found != 1) {
if ($temppos = stristr($guild_tag, "name=\"")) {
$temp = explode("\"", $temppos);
$guild_name = $temp[1];
}
}
if (substr($guild_tag, 0, 6) == "member") {
if ($temppos = stristr($guild_tag, "name=\"$char")) {
$temp = explode("\"", $temppos);
$member_name = $temp[1];
$found = 1;
}
}
}
if ($found == 0) {
$guild_name = 'None';
}
$guild_file = $dirdata . "guilds.xml";
$g = fopen($guild_file, "r");
$guild_contents = fread($g, filesize($guild_file));
$guild_tags = explode("<", $guild_contents);
$found = 0;
foreach($guild_tags as $guild_tag)
{
if (substr($guild_tag, 0, 5) == "guild" && $found != 1)
{
if ($temppos = stristr($guild_tag, "name=\""))
{
$temp = explode("\"", $temppos);
$guild_name = "<a href='guild.php?guild=$temp[1]'>$temp[1]</a>";
}
}
if (substr($guild_tag, 0, 6) == "member")
{
if ($temppos = stristr($guild_tag, "name=\"$char"))
{
$temp = explode("\"", $temppos);
$member_name = $temp[1];
$found = 1;
}
}
}
if ($found == 0)
{
$guild_name = 'Nenhuma';
}
$file = "$dirplayer$char.xml";
$f = @fopen($file, "r");
if (!$char)
{
}
else if (!$f)
{
print("<h2><b>O Personagem $char Não foi Encontrado!</h2>");
} else
{
$contents = fread($f, filesize($file));
$tags = explode("<", $contents);
$name = "";
$level = 0;
$magic_level = 0;
$voc = 0;
$town = 0;
$lastlogin = 0;
$skills = array(0, 0, 0, 0, 0, 0);
$reason = "";
$deletion = 0;
$bantime = "";
$banned = 0;
$time = "";
$namelock = 0;
foreach($tags as $tag)
{
if(substr($tag, 0, 3) == "ban") {
if($temppos = stristr($tag, "reason=\"")) {
$temp = explode("\"", $temppos);
$reason = $temp[1];
}
if($temppos = stristr($tag, "deleted=\"")) {
$temp = explode("\"", $temppos);
$deletion = $temp[1];
}
if($temppos = stristr($tag, "banrealtime=\"")) {
$temp = explode("\"", $temppos);
$bantime = $temp[1];
}
if($temppos = stristr($tag, "banned=\"")) {
$temp = explode("\"", $temppos);
$banned = $temp[1];
}
}
if (substr($tag, 0, 6) == "player")
{
if ($temppos = stristr($tag, "name=\""))
{
$temp = explode("\"", $temppos);
$name = $temp[1];
}
if ($temppos = stristr($tag, "level=\""))
{
$temp = explode("\"", $temppos);
$level = $temp[1];
}
if($temppos = stristr($tag, "namelock=\"")) {
$temp = explode("\"", $temppos);
$namelock = $temp[1];
}
if ($temppos = stristr($tag, "maglevel=\""))
{
$temp = explode("\"", $temppos);
$magic_level = $temp[1];
}
if ($temppos = stristr($tag, "voc=\""))
{
$temp = explode("\"", $temppos);
$voc = $temp[1];
}
if ($temppos = stristr($tag, "promoted=\""))
{
$temp = explode("\"", $temppos);
$promo = $temp[1];
}
if ($temppos = stristr($tag, "sex=\""))
{
$temp = explode("\"", $temppos);
$sex = $temp[1];
}
if ($temppos = stristr($tag, "lastlogin=\""))
{
$temp = explode("\"", $temppos);
$lastlogin = $temp[1];
}
if ($temppos = stristr($tag, "access=\""))
{
$temp = explode("\"", $temppos);
$access = $temp[1];
}
}
if (substr($tag, 0, 6) == "temple")
{
if ($temppos = stristr($tag, "x=\""))
{
$temp = explode("\"", $temppos);
$town = $temp[1];
}
}
if (substr($tag, 0, 6) == "skill ")
{
if ($temppos = stristr($tag, "skillid=\""))
{
$temp = explode("\"", $temppos);
$tempid = $temp[1];
}
if ($temppos = stristr($tag, "level=\""))
{
$temp = explode("\"", $temppos);
$templvl = $temp[1];
}
if ($tempid && $templvl) {
$skills[$tempid] = $templvl;
}
}
if (substr($tag, 0, 5) == "death")
{
if ($temppos = stristr($tag, "name=\""))
{
$temp = explode("\"", $temppos);
$tempname = $temp[1];
}
if ($temppos = stristr($tag, "level=\""))
{
$temp = explode("\"", $temppos);
$templvl = $temp[1];
}
if ($time = stristr($tag, "time=\""))
{
$temp = explode("\"", $time);
$time = $temp[1];
}
if ($time==0)
$time = "00:00";
else
$time = date ('d M Y, H:i:s',$time);
if ($tempname && $templvl)
{
if (file_exists("$dirmonster$tempname.xml"))
{
$deathtext[] = " $templvl para o Monstro $tempname em ($time)";
}
elseif (file_exists("$dirplayer$tempname.xml"))
{
$deathtext[] = "$templvl Para o Jogador <a href=\"character.php?char=$tempname\">$tempname</a> em ($time)";
}
else
{
$deathtext[] = "$templvl para $tempname em ($time)";
}
}
}
}
print("<h3>Informações do Personagem:</h3>");
print("<table cellSpacing=1 cellPadding=2 width=450px><tr>");
print("<tr><td width=150px>Nome:</td><td width=300px>$name<br/></td></tr>");
$charsex = array("Feminino", "Masculino");
print("<tr><td width=150px>Sexo:</td><td width=300px>$charsex[$sex]<br></td></tr>");
if ($promo == 0)
$vocations = array("Sem Vocação", "Sorcerer", "Druid", "Archer", "Knight", "Master Sorcerer", "Elder Druid", "Royal Archer", "Elite Knight", "Wyzard", "Cleric", "Ranger", "Slayer", "Dark Wyzard", "Elemental Cleric", "Elven Ranger", "Dragon Slayer");
if ($promo == 1)
$vocations = array("Sem Vocação", "Master Sorcerer", "Elder Druid", "Royal Paladin", "Elite Knight");
print("<tr><td width=150px>Vocação:</td><td width=300px>$vocations[$voc]<br></td></tr>");
print("<tr><td width=150px>Level:</td><td width=300px>$level<br/></td></tr>");
print("<tr><td width=150px>Magic Level:</td><td width=300px>$magic_level<br/></td></tr>");
print("<tr><td width=150px>Mundo:</td><td width=300px>$world<br/></td></tr>");
if ($town == 500)
$twn = 0;
$towns = array("Rook Gaard", "Carlin", "Tirith", "Edron", "Bree", "Raccoon");
print("<tr><td width=150px>Mora Em:</td><td width=300px>$towns[$twn]<br/></td></tr>");
print("<tr><td width=150px>Pertence a Guild:</td><td width=300px>$guild_name<br/></td></tr>");
if ($lastlogin==0)
$logindate = "Nunca se Conectou";
else
$logindate = date ('d M Y, H:i:s A',$lastlogin);
print("<tr><td width=150px>Ultimo Login:</td><td width=300px>$logindate<br/></td></tr>");
print("</table>");
print("<h3>Informações da Conta:</h3>");
print("<table cellSpacing=1 cellPadding=4 width=450px><tr>");
if($bans) {
print("<b>Banished:</b> <br><font color=#FF0000>$bans</font><br><br>");
}
//print("<br><br>Debug<br>bann = $bann <br>deleted = $deleted<br> reason = $reason");
if($banned > 0) {
if($deletion > 0)
print("<tr><td width=150px>Banished:</td><td width=300px><font color=red>Banished until deletion <br>because of $reason.</font><br/></td></tr>");
else
print("<tr><td width=150px>Banished:</td><td width=300px><font color=red>Banished until $bantime <br>because of $reason.</font><br/></td></tr>");
}
$position = array("Player", "<b><font color=red>Tutor</font></b>", "<b><font color=red>Counsellor</font></b>", "<b><font color=red>Gamemaster</font></b>", "<b><font color=red>Senior Gamemaster</font></b>", "<b><font color=red>God</font></b>");
print("<tr><td width=150px>Posição:</td><td width=300px>$position[$access]</td></tr>");
print("</table>");
if ($deathtext)
{
print("<h3>Ultimas Mortes:</h3>");
foreach($deathtext as $temp) {
print("<tr>Morreu no level $temp.<br>");
}
print("<br/><br/>");
}
}
?>
<form method="get" action="<?=$PHP_SELF?>">
<h3>Procurar Personagem:</h3>
Nome: <input type="text" name="char" maxlength="20"/> <input type="submit" value="Procurar"/></td></tr>
</table>
</form>
<?php include ('menu.inc.php');?>
aparentemente o problema está nesta parte, acredito que está faltando algo:
if ($town == 500)
$twn = 0;
$towns = array("Rook Gaard", "Carlin", "Tirith", "Edron", "Bree", "Raccoon");
print("<tr><td width=150px>Mora Em:</td><td width=300px>$towns[$twn]<br/></td></tr>");
e outro que eu também achei estranho ou o de criar personagens ele veio configurado para apenas dar vocação e sexo ao player, ele não está colocando no player o spawn nem o temple. itens não precisa pois eu coloquei quest no começo para dar itens.
o script da criação de players é este:
<?
error_reporting(0);
session_start();
include ("top.inc.php");
$acc = "";
$pass = "";
$acc = $_SESSION['account'];
$pass = $_SESSION['password'];
if ($acc != "" && $acc != null && $pass != "" && $pass != null) {
?>
<?
$result = $_GET['result'];
if (isset($result) && $result != "" && $result != null) {
if ($result == "char_failed") {
$error = $_GET['error'];
if (isset($error) && $error == "exists") {
echo "<h2>Desculpe:</h2><p>Já Existe um personagem com este nome. Por favor Tente outro.</p>";
} else if (isset($error) && $error == "malformed_name") {
echo "<h2>Desculpe:</h2><p>O nome de personagem não é válido. ele não pode conter simbolos como pontos acentos nem traços apenas espaço e letras são permitidos. Por Favor tente outro Nome.</p>";
} else if (isset($error) && $error == "wrong_length") {
echo "<h2>Desculpe:</h2><p>O nome de personagem não é válido. ele não pode conter menos de 2 letras e nem mais que 20 letras. Por favor tente outro nome.</p>";
} else {
echo "<h2>Warning:</h2><p>An unknown error was returned: $error. If this happens again, please contact a gamemaster.</p>";
}
} else {
echo "<h2>Error:</h2><p>Unknown contents of the result varibale.</p>";
}
}
?>
<h2>Crie um Personagem:</h2>
<form action="savenewchar.php" method="POST">
<h3>Nome:</h3>
<p><input type="text" maxlength="20" name="name" class="textfield"><font color="red"><i> (O nome deve conter de 2 a 20 letras)</i></font></p>
<h3>Vocação:</h3>
<input type="radio" name="voc" value="0" style="border: 0;" checked> Começa sem Vocação
<h3>Sex:</h3>
<input type="radio" name="sex" value="1" style="border: 0;" checked> Masculino
<input type="radio" name="sex" value="0" style="border: 0;"> Feminino
<p><input type="submit" value="Criar Personagem"></p>
<?
}
include ("menu.inc.php");
?>
qualquer um dos 2 scripts sendo arrumados estará me ajudando muito e eu darei com certeza um REP+
e agradecerei muito também ^^
abraços
estarei no aguardo.