Jump to content
Close
LeoTK

Website [Modern ACC] War System PHP / Detalhes Da War

Recommended Posts

Salve galera bom eu estou com um problema na minha página php da war ele esta mostrando quase tudo corretamente o único problema que não consigo fazer funcionar é os detalhes da guerra ele não esta mostrando as mortes etc... só mostra a mensagem de retorno caso não tiver mortes porém mesmo fazendo a contagem de mortes no placar ele não mostra nos detalhes as mortes

 

Imagem
ucn8FF0.png

 


ioguild.cpp

 

Spoiler



void IOGuild::frag(Player* player, uint64_t deathId, const DeathList& list, bool score)
{
	War_t war;
	std::stringstream s;
	for(DeathList::const_iterator it = list.begin(); it != list.end(); )
	{
		if(score)
		{
			if(it->isLast())
				war = it->getWar();
		}
		else if(!war.war)
			war = it->getWar();
		Creature* creature = it->getKillerCreature();
		if(it != list.begin())
		{
			++it;
			if(it == list.end())
				s << " and ";
			else
				s << ", ";
		}
		else
			++it;
		s << creature->getName();
	}
	std::string killers = s.str();
	s.str("");
	ChatChannel* channel = NULL;
	if((channel = g_chat.getChannel(player, CHANNEL_GUILD)))
	{
		s << "Guild member " << player->getName() << " was killed by " << killers << ".";
		if(score)
			s << " The new score is " << war.frags[war.type == WAR_GUILD] << ":"
				<< war.frags[war.type] << " frags (limit " << war.limit << ").";
		channel->talk(player, SPEAK_CHANNEL_RA, s.str());
	}
	s.str("");
	if((channel = g_chat.getChannel(list[0].getKillerCreature()->getPlayer(), CHANNEL_GUILD)))
	{
		s << "Opponent " << player->getName() << " was killed by " << killers << ".";
		if(score)
			s << " The new score is " << war.frags[war.type] << ":"
				<< war.frags[war.type == WAR_GUILD] << " frags (limit " << war.limit << ").";
		channel->talk(player, SPEAK_CHANNEL_RA, s.str());
	}
	Database* db = Database::getInstance();
	DBQuery query;
	query << "INSERT INTO `guild_kills` (`guild_id`, `war_id`, `death_id`) VALUES ("
		<< war.ids[war.type] << ", " << war.war << ", " << deathId << ");";
	db->executeQuery(query.str());
}
#endif


 

Página PHP

Spoiler

 


<style type="text/css">
font.details_wars {
color: #ffcc33; 
text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; 
text-decoration:none; font-weight: bold;
}
font.details_wars:hover {
color: #ffcc33; 
text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; 
text-decoration:none; font-weight: bold;
}
</style>
<div class='message'>
<div style="padding-left: 170px; font-size: 16px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;" class='title'>Guerra Das Guildas</div>
<?PHP
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
echo "
<table cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">
<tr background='/templates/naruto/images/tablebg1.png'><td style='text-align: center; font-size: 11px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;' colspan=\"5\"><b>&nbsp;Comandos dentro do jogo</b></td></tr>

<tr><td><TABLE style='text-align: center; font-size: 11px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;' BORDER=0 style='border-color: #f8c300; border: collapse;' CELLPADDING=2 CELLSPACING=2 WIDTH=100%> 
<TR background='/templates/naruto/images/tablebg1.png'><TD><B>Comandos</B></TD><TD><B>Descrição</B></TD><TD><B> Lider</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar guerra, nome da guilda, quantidade de mortes </TD><TD>Enviar uma declaração de guerra<br>
Exemplo: /declarar guerra, uchihas, 100</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar guerra, nome da guilda, quantidade de mortes, aposta em dinheiro, quantidade de dias </TD><TD>Enviar uma declaração de guerra<br>
Exemplo: /declarar guerra, uchihas, 100, 10000, 3</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar aceitar guerra, nome da guilda</TD><TD>Aceitar a declaração de guerra<br>
Exemplo: /declarar aceitar guerra, uchihas</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar rejeitar guerra, nome da guilda</TD><TD>Rejeitar uma declaração de guerra<br>
Exemplo: /declarar rejeitar guerra, uchihas</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar cancelar guerra, nome da guilda</TD><TD>Cancelar declaração de guerra feito a uma guilda<br>
Exemplo: /declarar cancelar guerra, uchihas</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar encerrar guerra, nome da guilda</TD><TD>Atacante: Encerrar guerra instantaneamente<br> Defensor: Encerrar guerra no próximo restart do servidor <br>
Exemplo: /declarar encerrar guerra, uchihas</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/declarar paz, nome da guilda</TD><TD>Atacante: Aceitar paz após a guilda inimiga pedir para encerrar a guerra<br>
Exemplo: /declarar paz, uchihas</TD><TD><B>Sim</B></TD></TR> 

<TR background='/templates/naruto/images/tablebg1.png'><TD>/banco saldo</TD><TD>Banco da guilda, verificar o saldo da guilda</TD><TD><B>Não</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/banco sacar valor</TD><TD>Sacar dinheiro do banco da guilda<br>
Exemplo: /banco sacar 1000</TD><TD><B>Sim</B></TD></TR> 
<TR background='/templates/naruto/images/tablebg1.png'><TD>/banco depositar valor</TD><TD>Depositar um valor no banco da guilda <br>
Exemplo: /banco depositar, 1000</TD><TD><B>Não</B></TD></TR> 


</TABLE></td></tr></table>
<br />
<div align='center'>
<div style='text-align: center; font-size: 11px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;'>Todos os comandos devem ser usado no chat da guilda</div><br>
	<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=90%> 
		<TR style='text-align: center; font-size: 11px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;'> 
			<TD align='center'><img src='".WEBSITE."/templates/naruto/images/flags/kunai1.png' width='13px' height='13px'/> Membros Da Guilda | 
			<img src='".WEBSITE."/templates/naruto/images/flags/kunai2.png' width='13px' height='13px'/> Guilda Inimiga | 
			<img src='".WEBSITE."/templates/naruto/images/flags/kunai3.png' width='13px' height='13px'/> Aliados Ou Outras Guerras</TD> 
		</TR> 
	</TABLE> 
</div>
<br />
<script type=\"text/javascript\"><!--
function show_hide(flip)
{
	var tmp = document.getElementById(flip);
	if(tmp)
		tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
}
--></script>
<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">
<tr>
<div style='text-align: center; font-size: 12px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;'><center><h1>Informações Das Guerras</h1></center></div>
<table style='text-align: center; font-size: 12px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;' width='100%' border='0' cellspacing='1' cellpadding='4'> 
<tr background='/templates/naruto/images/tablebg1.png'> 
<td class='white' width='150'><b>Atacante</b></td> 
<td class='white'><b>Informações</b></td> 
<td class='white' width='150'><b>Defensor</b></td>
</tr>";
$counting = 0;
foreach($SQL->query('SELECT * FROM `guild_wars` WHERE `status` IN (1,4) OR ((`end` >= (UNIX_TIMESTAMP() - 604800) OR `end` = 0) AND `status` IN (0,5));') as $war)
{
	$counting++;
	$a = $ots->createObject('Guild');
	$a->load($war['guild_id']);
	if(!$a->isLoaded())
		continue;
		
	$e = $ots->createObject('Guild');
	$e->load($war['enemy_id']);
	if(!$e->isLoaded())
		continue;
		
	$alogo = $a->getCustomField('id');
	if(empty($alogo) || !file_exists('../../public/guild_logos/' . $alogo))
		$alogo = 'default.gif';
		
	$elogo = $e->getCustomField('id');
	if(empty($elogo) || !file_exists('../../public/guild_logos/' . $elogo))
		$elogo = 'default.gif';
	
	echo "<tr background='/templates/naruto/images/tablebg3.png' style=\"font-size: 12px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;\">
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$a->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$alogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$a->getName()."</center></font></a></td>
<td align=\"center\">";

$date_begin = $war['begin'];
$date_end = $war['end'];

	switch($war['status'])
	{
		case 0:
		{
			echo "<center><b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $date_begin) . " for " . ($date_end > 0 ? (($date_end - $date_begin) / 86400) : "unspecified") . " days. The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.")."<br />Will expire in three days.</center>";
			break;
		}
 
		case 3:
		{
			echo "<center><s>Canceled invitation</s><br />Sent invite on " . date("M d Y, H:i:s", $date_begin) . ", canceled on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}
 
		case 2:
		{
			echo "<center>Rejected invitation<br />Invited on " . date("M d Y, H:i:s", $date_begin) . ", rejected on " . date("M d Y, H:i:s", $date_end) . ".</center>";
			break;
		}

		case 1:
		{
			echo "<center><br /><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br />Began on " . date("M d Y, H:i:s", $date_begin) . ($date_end > 0 ? ", will end up at " . date("M d Y, H:i:s", $date_end) : "") . ".<br />The frag limit is set to " . $war['frags'] . " frags, " . ($war['payment'] > 0 ? "with payment of " . $war['payment'] . " bronze coins." : "without any payment.</center>");
			break;
		}
 
		case 4:
		{
			echo "<center><font size=\"5\"><span style=\"color: red;\">" . $war['guild_kills'] . " </span> : <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span></font><br /><br /><span style=\"color: darkred;\">Pending end</span><br />Began on " . date("M d Y, H:i:s", $war['begin']) . ", signed armstice on " . date("M d Y, H:i:s", $war['end']) . ".<br />Will expire after reaching " . $war['frags'] . " frags. ".($war['payment'] > 0 ? "The payment is set to " . $war['payment'] . " bronze coins." : "There's no payment set.</center>");
			break;
		}
 
		case 5:
		{
			echo "<center><i>Ended</i><br />Began on " . date("M d Y, H:i:s", $date_begin) . ", ended on " . date("M d Y, H:i:s", $date_end) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild_kills'] . " </span> to <span style=\"color: lime;\">" . $war['enemy_kills'] . " </span>.</center>";
			break;
		}
 
		default:
		{
			echo "<center>Unknown, please contact with gamemaster.</center>";
			break;
		}
	}
 
	echo "<br /><br /><a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\"><font class=\"details_wars\"><center>&raquo; Details &laquo;</center></font></a></td>
<td align=\"center\"><center><a href=\"".WEBSITE."/index.php/guilds/view/".$e->getId()."\"><img src=\"".$config['website']."/public/guild_logos/".$elogo."\" width=\"64\" height=\"64\" border=\"0\"/><br /><font class=\"details_wars\">".$e->getName()."</center>	</font></a></td>
</tr>
<tr background='/templates/naruto/images/tablebg3.png' id=\"war-details:" . $war['id'] . "\" style=\"display: none; text-align: center; font-size: 12px; color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;\">
<td colspan=\"3\">";
	if(in_array($war['status'], array(1,4,5))) {
		$deaths = $SQL->query('SELECT `pd`.`id`, `pd`.`date`, `gk`.`guild_id` AS `enemy`, `p`.`name`, `pd`.`level`
FROM `guild_kills` gk
	LEFT JOIN `player_deaths` pd ON `gk`.`death_id` = `pd`.`id`
	LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id`
WHERE `gk`.`war_id` = ' . $war['id'] . ' AND `p`.`deleted` = 0
	ORDER BY `pd`.`date` DESC')->fetchAll();
		if(!empty($deaths)) {
			foreach($deaths as $death) {
				$killers = $SQL->query('SELECT `p`.`name` AS `player_name`, `p`.`deleted` AS `player_exists`, `k`.`war` AS `is_war`
FROM `killers` k
	LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
	LEFT JOIN `players` p ON `p`.`id` = `pk`.`player_id`
WHERE `k`.`death_id` = ' . $death['id'] . '
	ORDER BY `k`.`final_hit` DESC, `k`.`id` ASC')->fetchAll();
				
				$i = 0;
				$count = count($killers); 
				
				$others = false;
				$deathdate = $death['date'];
				echo date("j M Y, H:i", $deathdate) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "green") . ";\"><font size=3>+</font></span>
<a href=\"".WEBSITE."/index.php/character/view/".$death['name']. "\"><b><font class=\"details_wars\">".$death['name']."</font></b></a> ";
				foreach($killers as $killer) {
					$i++;
					if($killer['is_war'] != 0) {
						if($i == 1)
							echo "killed at level <b>".$death['level']."</b> by ";
						else if($i == $count && $others == false)
							echo " e por ";
						else
							echo ", ";
 
						if($killer['player_exists'] == 0)
							echo "<a href=\"".WEBSITE."/index.php/character/view/".$killer['player_name']."\">";
 
						echo '<font class="details_wars">'.$killer['player_name'].'</font>';
						if($killer['player_exists'] == 0)
							echo "</a>";
					}
					else
						$others = true;
 
					if($i == $count) {
						if($others == true)
							echo " e outros";
 
						echo ".<br />";
					}
				}
			}
		}
		else
			echo "<center>Sem mortes nessa guerra</center>";
	}
	else
		echo "<center>Esta guerra ainda não começou</center>";
 
	echo "</td>
</tr>";
}

if($counting == 0) {
	echo "<tr background='/templates/naruto/images/tablebg3.png'>
<td colspan=\"3\" style=\"color: #ffcc33; text-shadow:#000 4px 6px 4px, #000 -1px 1px 2px, #000 1px 1px 2px, #000 -1px -1px 2px; text-decoration:none; font-weight: bold;\"><center>Sem Guerras Ativas</center></td>
</tr>";
 }
echo "</table>";
?>
</div>

 

 

 

 


Edited by LeoTK (see edit history)

Share this post


Link to post
Share on other sites

isso nao é na distro e sim no war.php do site! tenta substituir por outro!


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...