mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-12 07:36:07 +00:00
show natars attacking in ww ranking by SlimShady95
This commit is contained in:
@@ -150,6 +150,7 @@ class Automation {
|
||||
$this->oasisResoucesProduce();
|
||||
$this->pruneResource();
|
||||
$this->pruneOResource();
|
||||
$this->checkWWAttacks();
|
||||
if(!file_exists("GameEngine/Prevention/culturepoints.txt") or time()-filemtime("GameEngine/Prevention/culturepoints.txt")>10) {
|
||||
$this->culturePoints();
|
||||
}
|
||||
@@ -527,8 +528,9 @@ class Automation {
|
||||
}
|
||||
|
||||
// by SlimShady95 aka Manuel Mannhardt < manuel_mannhardt@web.de >
|
||||
private function startNatarAttack($level, $vid) {
|
||||
global $database;
|
||||
private function startNatarAttack($level, $vid) {
|
||||
global $database;
|
||||
|
||||
// bad, but should work :D
|
||||
// I took the data from my first ww (first .org world)
|
||||
// todo: get the algo from the real travian with the 100 biggest
|
||||
@@ -556,7 +558,7 @@ class Automation {
|
||||
|
||||
25 => array(
|
||||
array(6004, 5977, 7400, 7277, 23, 0),
|
||||
array(152, 499, 220, 58, 37)
|
||||
array(152, 0, 499, 220, 58, 37)
|
||||
),
|
||||
|
||||
30 => array(
|
||||
@@ -649,7 +651,7 @@ class Automation {
|
||||
array(872, 0, 3025, 1338, 317, 208)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// select the troops^^
|
||||
if (isset($troops[$level]))
|
||||
{
|
||||
@@ -659,18 +661,37 @@ class Automation {
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// get the capital village from the natars
|
||||
$query = mysql_query('SELECT `wref` FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = 3 and `capital` = 1 LIMIT 1') or die(mysql_error());
|
||||
$row = mysql_fetch_assoc($query);
|
||||
|
||||
|
||||
// start the attacks
|
||||
$endtime = time() + round((60 * 60 * 24) / SPEED);
|
||||
|
||||
// -.-
|
||||
mysql_query('INSERT INTO `' . TB_PREFIX . 'ww_attacks` (`vid`, `attack_time`) VALUES (' . $vid . ', ' . $endtime . ')');
|
||||
mysql_query('INSERT INTO `' . TB_PREFIX . 'ww_attacks` (`vid`, `attack_time`) VALUES (' . $vid . ', ' . ($endtime + 1) . ')');
|
||||
|
||||
// wave 1
|
||||
$ref = $database->addAttack($row['wref'], 0, $units[0][0], $units[0][1], 0, $units[0][2], $units[0][3], $units[0][4], $units[0][5], 0, 0, 0, 3, 0, 0, 0, 0, 20, 20, 0, 20, 20, 20, 20);
|
||||
$database->addMovement(3, $row['wref'], $vid, $ref, time(), $endtime);
|
||||
|
||||
$ref2 = $database->addAttack($row['wref'], 0, $units[1][0], $units[1][1], 0, $units[1][2], $units[1][3], $units[1][4], $units[1][5], 0, 0, 0, 3, 40, 0, 0, 0, 20, 20, 0, 20, 20, 20, 20);
|
||||
$database->addMovement(3, $row['wref'], $vid, $ref2, time(), $endtime + 1);
|
||||
|
||||
// wave 2
|
||||
$ref2 = $database->addAttack($row['wref'], 0, $units[1][0], $units[1][1], 0, $units[1][2], $units[1][3], $units[1][4], $units[1][5], 0, 0, 0, 3, 40, 0, 0, 0, 20, 20, 0, 20, 20, 20, 20, array('vid' => $vid, 'endtime' => ($endtime + 1)));
|
||||
$database->addMovement(3, $row['wref'], $vid, $ref2, time(), $endtime + 1);
|
||||
}
|
||||
|
||||
private function checkWWAttacks() {
|
||||
$query = mysql_query('SELECT * FROM `' . TB_PREFIX . 'ww_attacks` WHERE `attack_time` <= ' . time());
|
||||
while ($row = mysql_fetch_assoc($query))
|
||||
{
|
||||
// fix for destroyed wws
|
||||
$query2 = mysql_query('UPDATE `' . TB_PREFIX . 'fdata` SET `f90t` = 40 WHERE `vref` = ' . $row['vid']);
|
||||
|
||||
// delete the attack
|
||||
$query3 = mysql_query('DELETE FROM `' . TB_PREFIX . 'ww_attacks` WHERE `vid` = ' . $row['vid'] . ' AND `attack_time` = ' . $row['attack_time']);
|
||||
}
|
||||
}
|
||||
|
||||
private function getPop($tid,$level) {
|
||||
|
||||
+52
-53
@@ -1,53 +1,52 @@
|
||||
<?php
|
||||
if(WW==True){
|
||||
$result = mysql_query("select ".TB_PREFIX."users.id, ".TB_PREFIX."users.username,".TB_PREFIX."users.alliance, ".TB_PREFIX."fdata.wwname, ".TB_PREFIX."fdata.f99, ".TB_PREFIX."vdata.name, ".TB_PREFIX."fdata.vref
|
||||
FROM ".TB_PREFIX."users
|
||||
INNER JOIN ".TB_PREFIX."vdata ON ".TB_PREFIX."users.id = ".TB_PREFIX."vdata.owner
|
||||
INNER JOIN ".TB_PREFIX."fdata ON ".TB_PREFIX."fdata.vref = ".TB_PREFIX."vdata.wref
|
||||
WHERE ".TB_PREFIX."fdata.f99t = 40 ORDER BY ".TB_PREFIX."fdata.f99 Desc ");
|
||||
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="villages" class="row_table_data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="6">
|
||||
Wonder of the world
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Player</td>
|
||||
<td>Name</td>
|
||||
<td>Alliance</td>
|
||||
<td>Level</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead><tbody>
|
||||
<?php
|
||||
$cont = 1;
|
||||
while($row = mysql_fetch_array($result))
|
||||
|
||||
{
|
||||
$ally = $database->getAlliance($row[alliance]);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $cont; $cont++;?>.</td>
|
||||
<td><?php
|
||||
echo "<a href=\"karte.php?d=".$row['vref']."&c=".$generator->getMapCheck($row['vref'])."\">";
|
||||
?>
|
||||
<?php
|
||||
echo "$row[username]";
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $row['wwname'];?></td>
|
||||
<td><a href="allianz.php?aid=<?php echo $ally['id'];?>"><?php echo $ally['tag'];?></a></td>
|
||||
<td><?php echo $row['f99'];?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php }}else{
|
||||
header("Location: statistiken.php");
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (WW == True)
|
||||
{
|
||||
$result = mysql_query("select " . TB_PREFIX . "users.id, " . TB_PREFIX . "users.username," . TB_PREFIX . "users.alliance, " . TB_PREFIX . "fdata.wwname, " . TB_PREFIX . "fdata.f99, " . TB_PREFIX . "vdata.name, " . TB_PREFIX . "fdata.vref
|
||||
FROM " . TB_PREFIX . "users
|
||||
INNER JOIN " . TB_PREFIX . "vdata ON " . TB_PREFIX . "users.id = " . TB_PREFIX . "vdata.owner
|
||||
INNER JOIN " . TB_PREFIX . "fdata ON " . TB_PREFIX . "fdata.vref = " . TB_PREFIX . "vdata.wref
|
||||
WHERE " . TB_PREFIX . "fdata.f99t = 40 ORDER BY " . TB_PREFIX . "fdata.f99 Desc ");
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="villages" class="row_table_data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="7">Wonder of the world</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Player</td>
|
||||
<td>Name</td>
|
||||
<td>Alliance</td>
|
||||
<td>Level</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$cont = 1;
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$ally = $database->getAlliance($row[alliance]);
|
||||
$query = @mysql_query('SELECT * FROM `' . TB_PREFIX . 'ww_attacks` WHERE `vid` = ' . $row['vref'] . ' ORDER BY `attack_time` ASC LIMIT 1');
|
||||
$row2 = @mysql_fetch_assoc($query);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $cont; $cont++; ?>.</td>
|
||||
<td><?php echo "<a href=\"karte.php?d=" . $row['vref'] . "&c=" . $generator->getMapCheck($row['vref']) . "\">"; ?><?php echo $row['username']; ?></a></td>
|
||||
<td><?php echo $row['wwname']; ?></td>
|
||||
<td><a href="allianz.php?aid=<?php echo $ally['id']; ?>"><?php echo $ally['tag']; ?></a></td>
|
||||
<td><?php echo $row['f99']; ?></td>
|
||||
<?php if ($row2['attack_time'] != 0): ?>
|
||||
<td><img src="gpack/travian_default/img/a/att1.gif" title="<?php print date('d.m.Y, H:i:s', $row2['attack_time']); ?>" /></td>
|
||||
<?php else: ?>
|
||||
<td> </td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: statistiken.php");
|
||||
}
|
||||
?>
|
||||
+21
-1
@@ -1437,4 +1437,24 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%password` (
|
||||
`used` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `%prefix%password`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
--
|
||||
-- Table structure for table `%prefix%ww_attacks`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `%PREFIX%ww_attacks` (
|
||||
`vid` int(25) NOT NULL,
|
||||
`attack_time` int(25) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `%prefix%password`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
Reference in New Issue
Block a user