Thanks Half, but the war is not end, I put to 10 frags but does not endEnable guild wars in config.php
https://github.com/Znote/ZnoteAAC/blob/master/config.php#L452
The rest can be handled from ingame. (If you have a server that has war system).
<?php require_once 'engine/init.php';
if ($config['require_login']['guildwars']) protect_page();
if ($config['log_ip']) znote_visitor_insert_detailed_data(3);
if ($config['guildwar_enabled'] === false) {
header('Location: guilds.php');
exit();
}
$isOtx = ($config['CustomVersion'] == 'OTX') ? true : false;
include 'layout/overall/header.php';
if (!empty($_GET['warid'])) {
$warid = (int)$_GET['warid']; // Sanitizing GET.
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $war = get_guild_war($warid);
else if ($config['TFSVersion'] == 'TFS_03') $war = get_guild_war03($warid);
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
if ($war != false) {
// Kills data for this specific war entry
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $kills = get_war_kills($warid);
else if ($config['TFSVersion'] == 'TFS_03') $kills = get_war_kills03($warid);
?>
<h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1>
<?php
// Collecting <ul> data:
$guild1 = $war['guild1'];
$g1c = 0; // kill count
$guild2 = $war['guild2'];
$g2c = 0; // kill count
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
foreach (($kills ? $kills : array()) as $kill) {
if ($kill['killerguild'] == $guild1)
$g1c++;
else
$g2c++;
}
$green = false;
if ($g1c > $g2c) {
$leading = $war['name1'];
$green = true;
} else if ($g2c > $g1c) $leading = $war['name2'];
else $leading = "Tie";
}
?>
<ul class="war_list">
<li>
War status: <?php echo $config['war_status'][$war['status']]; ?>.
</li>
<?php if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { ?>
<li>
Leading guild: <?php echo $leading; ?>.
</li>
<li>
<?php
if ($green)
echo 'Score: <font color="green">'. $g1c .'</font>-<font color="red">'. $g2c .'</font>';
else if ($g1c == $g2c)
echo 'Score: <font color="orange">'. $g1c .'</font>-<font color="orange">'. $g2c .'</font>';
else
echo 'Score: <font color="red">'. $g1c .'</font>-<font color="green">'. $g2c .'</font>';
?>
</li>
<?php } ?>
</ul>
<?php
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
?>
<table id="guildwarTable" class="table table-striped table-hover">
<tr class="yellow">
<th>Killer's guild:</th>
<th>Killer:</th>
<th>Victim:</th>
<th>Time:</th>
</tr>
<?php
foreach (($kills ? $kills : array()) as $kill) {
echo '<tr>';
//echo '<td>'. get_guild_name($kill['killerguild']) .'</td>';
echo '<td><a href="guilds.php?name='. get_guild_name($kill['killerguild']) .'">'. get_guild_name($kill['killerguild']) .'</a></td>';
echo '<td><a href="characterprofile.php?name='. $kill['killer'] .'">'. $kill['killer'] .'</a></td>';
echo '<td><a href="characterprofile.php?name='. $kill['target'] .'">'. $kill['target'] .'</a></td>';
echo '<td>'. getClock($kill['time'], true) .'</td>';
echo '</tr>';
}
?>
</table>
<?php
}
if ($config['TFSVersion'] == 'TFS_03') {
// BORROWED FROM GESIOR (and ported to work on Znote AAC).
$main_content = "";
$deaths = gesior_sql_death($warid);
if($deaths !== false)
{
//die(print_r($deaths));
foreach($deaths as $death)
{
$killers = gesior_sql_killer((int)$death['id']);
$count = count($killers); $i = 0;
$others = false;
$main_content .= date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span>
<a href=\"characterprofile.php?name=" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> ";
foreach($killers as $killer)
{
$i++;
if($killer['is_war'] != 0)
{
if($i == 1)
$main_content .= "killed at level <b>".$death['level']."</b> by ";
else if($i == $count && $others == false)
$main_content .= " and by ";
else
$main_content .= ", ";
if($killer['player_exists'] == 0)
$main_content .= "<a href=\"characterprofile.php?name=".urlencode($killer['player_name'])."\">";
$main_content .= $killer['player_name'];
if($killer['player_exists'] == 0)
$main_content .= "</a>";
}
else
$others = true;
if($i == $count)
{
if($others == true)
$main_content .= " and few others";
$main_content .= ".<br />";
}
}
}
}
else
$main_content .= "<center>There were no frags on this war so far.</center>";
echo $main_content;
// END BORROWED FROM GESIOR
}
}
} else {
// Display current wars.
// Fetch list of wars
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars();
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03();
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
//echo $wardata[0]['name1'];
//die(var_dump($wardata));
if ($wardata != false) {
// kills data
$killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry
foreach ($wardata as $wars) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $killsdata[$wars['id']] = get_war_kills($wars['id']);
else if ($config['TFSVersion'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']);
}
?>
<table id="guildwarViewTable" class="table table-striped table-hover">
<tr class="yellow">
<th>Attacking Guild:</th>
<th>Death Count:</th>
<th>Defending Guild:</th>
</tr>
<?php
foreach ($wardata as $wars) {
$guild_1_kills = 0;
$guild_2_kills = 0;
foreach (($killsdata[$wars['id']] ? $killsdata[$wars['id']] : array()) as $kill) {
if ($isOtx && $kill['guild_id'] == $wars['guild1'] || !$isOtx && $kill['killerguild'] == $wars['guild1'])
$guild_1_kills++;
else
$guild_2_kills++;
}
$url = url("guildwar.php?warid=". $wars['id']);
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
echo '<td>'. $wars['name1'] .'</td>';
echo '<td>'. $guild_1_kills .' - ' . $guild_2_kills . '</td>';
echo '<td>'. $wars['name2'] .'</td>';
echo '</tr>';
}
?>
</table>
<?php
} else {
echo 'There have not been any pending wars on this server.';
}
}
// GET links sample:
// guildwar.php?warid=1
include 'layout/overall/footer.php'; ?>
TFS Version?my guildwar.php
Code:<?php require_once 'engine/init.php'; if ($config['require_login']['guildwars']) protect_page(); if ($config['log_ip']) znote_visitor_insert_detailed_data(3); if ($config['guildwar_enabled'] === false) { header('Location: guilds.php'); exit(); } $isOtx = ($config['CustomVersion'] == 'OTX') ? true : false; include 'layout/overall/header.php'; if (!empty($_GET['warid'])) { $warid = (int)$_GET['warid']; // Sanitizing GET. if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $war = get_guild_war($warid); else if ($config['TFSVersion'] == 'TFS_03') $war = get_guild_war03($warid); else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php"); if ($war != false) { // Kills data for this specific war entry if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $kills = get_war_kills($warid); else if ($config['TFSVersion'] == 'TFS_03') $kills = get_war_kills03($warid); ?> <h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1> <?php // Collecting <ul> data: $guild1 = $war['guild1']; $g1c = 0; // kill count $guild2 = $war['guild2']; $g2c = 0; // kill count if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { foreach (($kills ? $kills : array()) as $kill) { if ($kill['killerguild'] == $guild1) $g1c++; else $g2c++; } $green = false; if ($g1c > $g2c) { $leading = $war['name1']; $green = true; } else if ($g2c > $g1c) $leading = $war['name2']; else $leading = "Tie"; } ?> <ul class="war_list"> <li> War status: <?php echo $config['war_status'][$war['status']]; ?>. </li> <?php if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { ?> <li> Leading guild: <?php echo $leading; ?>. </li> <li> <?php if ($green) echo 'Score: <font color="green">'. $g1c .'</font>-<font color="red">'. $g2c .'</font>'; else if ($g1c == $g2c) echo 'Score: <font color="orange">'. $g1c .'</font>-<font color="orange">'. $g2c .'</font>'; else echo 'Score: <font color="red">'. $g1c .'</font>-<font color="green">'. $g2c .'</font>'; ?> </li> <?php } ?> </ul> <?php if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { ?> <table id="guildwarTable" class="table table-striped table-hover"> <tr class="yellow"> <th>Killer's guild:</th> <th>Killer:</th> <th>Victim:</th> <th>Time:</th> </tr> <?php foreach (($kills ? $kills : array()) as $kill) { echo '<tr>'; //echo '<td>'. get_guild_name($kill['killerguild']) .'</td>'; echo '<td><a href="guilds.php?name='. get_guild_name($kill['killerguild']) .'">'. get_guild_name($kill['killerguild']) .'</a></td>'; echo '<td><a href="characterprofile.php?name='. $kill['killer'] .'">'. $kill['killer'] .'</a></td>'; echo '<td><a href="characterprofile.php?name='. $kill['target'] .'">'. $kill['target'] .'</a></td>'; echo '<td>'. getClock($kill['time'], true) .'</td>'; echo '</tr>'; } ?> </table> <?php } if ($config['TFSVersion'] == 'TFS_03') { // BORROWED FROM GESIOR (and ported to work on Znote AAC). $main_content = ""; $deaths = gesior_sql_death($warid); if($deaths !== false) { //die(print_r($deaths)); foreach($deaths as $death) { $killers = gesior_sql_killer((int)$death['id']); $count = count($killers); $i = 0; $others = false; $main_content .= date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span> <a href=\"characterprofile.php?name=" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> "; foreach($killers as $killer) { $i++; if($killer['is_war'] != 0) { if($i == 1) $main_content .= "killed at level <b>".$death['level']."</b> by "; else if($i == $count && $others == false) $main_content .= " and by "; else $main_content .= ", "; if($killer['player_exists'] == 0) $main_content .= "<a href=\"characterprofile.php?name=".urlencode($killer['player_name'])."\">"; $main_content .= $killer['player_name']; if($killer['player_exists'] == 0) $main_content .= "</a>"; } else $others = true; if($i == $count) { if($others == true) $main_content .= " and few others"; $main_content .= ".<br />"; } } } } else $main_content .= "<center>There were no frags on this war so far.</center>"; echo $main_content; // END BORROWED FROM GESIOR } } } else { // Display current wars. // Fetch list of wars if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars(); else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03(); else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php"); //echo $wardata[0]['name1']; //die(var_dump($wardata)); if ($wardata != false) { // kills data $killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry foreach ($wardata as $wars) { if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $killsdata[$wars['id']] = get_war_kills($wars['id']); else if ($config['TFSVersion'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']); } ?> <table id="guildwarViewTable" class="table table-striped table-hover"> <tr class="yellow"> <th>Attacking Guild:</th> <th>Death Count:</th> <th>Defending Guild:</th> </tr> <?php foreach ($wardata as $wars) { $guild_1_kills = 0; $guild_2_kills = 0; foreach (($killsdata[$wars['id']] ? $killsdata[$wars['id']] : array()) as $kill) { if ($isOtx && $kill['guild_id'] == $wars['guild1'] || !$isOtx && $kill['killerguild'] == $wars['guild1']) $guild_1_kills++; else $guild_2_kills++; } $url = url("guildwar.php?warid=". $wars['id']); echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; echo '<td>'. $wars['name1'] .'</td>'; echo '<td>'. $guild_1_kills .' - ' . $guild_2_kills . '</td>'; echo '<td>'. $wars['name2'] .'</td>'; echo '</tr>'; } ?> </table> <?php } else { echo 'There have not been any pending wars on this server.'; } } // GET links sample: // guildwar.php?warid=1 include 'layout/overall/footer.php'; ?>
TFS 1.2TFS Version?
I think it will end in days not in frags. I have no idea. But i think so. Because it was the same thing when i used Gesior for some days.TFS 1.2
Pending invitationI think it will end in days not in frags. I have no idea. But i think so. Because it was the same thing when i used Gesior for some days.
hm. Any errors on console?Pending invitation
Invited on 01 July 2015 (22:26).
The frag limit is set to 10 frags.
no errors but war not endhm. Any errors on console?
<li>Invite guild to war:<br>
<input type="text" name="warinvite" placeholder="Guild name">
<input type="number" min="10" max="20" name="limit">
<input type="submit" value="Invite Guild">
</li>
</ul>
</form>
<style type="text/css">
form {display: inline;}
#btnspace{margin-left:100px;}
</style>
<table id="guildsTable" class="table table-striped table-hover"><tr class="yellow"><th>Aggressor</th><th>Information</th><th>Enemy</th></tr>
<?php
$i = 0;
$wars = mysql_select_multi("SELECT `guild1`, `guild2`, `name1`, `name2`, `started`, (SELECT `limit` FROM `znote_guild_wars` WHERE `znote_guild_wars`.`id` = `guild_wars`.`id`) AS `limit` FROM `guild_wars` WHERE (`guild1` = '$gid' OR `guild2` = '$gid') AND `status` = 0 ORDER BY `started` DESC");
if (!empty($wars) || $wars !== false) {
foreach($wars as $war) {
$i++;
echo '<tr><td><a href="guilds.php?name='.$war['name1'].'">'.$war['name1'].'</a></td><td>';
echo '<center><b>Pending invitation</b><br />Invited on ' . getClock($war['started'], true) . '.<br />The frag limit is set to ' . $war['limit'] . ' frags.<br />';
if ($war['guild1'] == $gid) {
echo '<br /><form action="" method="post"><input type="hidden" name="cancel_war_invite" value="'.$war['guild2'].'" /><input type="submit" value="Cancel Invitation"></form>';
} else if ($war['guild2'] == $gid) {
echo '<br><form action="" method="post"><input type="hidden" name="accept_war_invite" value="'.$war['guild1'].'" /><input type="submit" value="Accept Invitation"></form>';
echo '<form action="" method="post"><input type="hidden" name="reject_war_invite" value="'.$war['guild1'].'" /><input type="submit" ID="btnspace" value="Reject Invitation"></form>';
}
echo '</center></td><td><a href="guilds.php?name='.$war['name2'].'">'.$war['name2'].'</a></td></tr>';
}
}
if ($i == 0)
echo '<tr><td colspan="3"><center>Currently there are no pending invitations.</center></td></tr>';
echo '</table>';
} } ?>
<?php
change znote_guild_wars ?and u have to change innoDB to myisam in database, otherwise it doesnt want to create the table
Pending invitation i.e the other guy didn't accept? , so war didn't even start
The other guy accepted. The war begins but never endsPending invitation i.e the other guy didn't accept? , so war didn't even start