mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-21 18:47:14 +00:00
improve farmlist (not 100% but works with raids)
This commit is contained in:
@@ -114,6 +114,13 @@
|
|||||||
return $this->mysql_fetch_all($result);
|
return $this->mysql_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVilWref($x, $y) {
|
||||||
|
$q = "SELECT * FROM " . TB_PREFIX . "wdata where x = $x AND y = $y";
|
||||||
|
$result = mysql_query($q, $this->connection);
|
||||||
|
$dbarray = mysql_fetch_array($result);
|
||||||
|
return $dbarray['id'];
|
||||||
|
}
|
||||||
|
|
||||||
function removeMeSit($uid, $uid2) {
|
function removeMeSit($uid, $uid2) {
|
||||||
$q = "UPDATE " . TB_PREFIX . "users set sit1 = 0 where id = $uid and sit1 = $uid2";
|
$q = "UPDATE " . TB_PREFIX . "users set sit1 = 0 where id = $uid and sit1 = $uid2";
|
||||||
mysql_query($q, $this->connection);
|
mysql_query($q, $this->connection);
|
||||||
@@ -876,6 +883,30 @@
|
|||||||
return mysql_query($q, $this->connection);
|
return mysql_query($q, $this->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getVillageType2($wref) {
|
||||||
|
$q = "SELECT * FROM " . TB_PREFIX . "wdata where id = $wref";
|
||||||
|
//$q = "SELECT * FROM " . TB_PREFIX . "units where id = $wref";
|
||||||
|
$result = mysql_query($q, $this->connection);
|
||||||
|
$dbarray = mysql_fetch_array($result);
|
||||||
|
return $dbarray['oasistype'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFLData($id) {
|
||||||
|
$q = "SELECT * FROM " . TB_PREFIX . "farmlist where id = $id";
|
||||||
|
$result = mysql_query($q, $this->connection);
|
||||||
|
return mysql_fetch_array($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkVilExist($wref) {
|
||||||
|
$q = "SELECT * FROM " . TB_PREFIX . "vdata where wref = '$wref'";
|
||||||
|
$result = mysql_query($q, $this->connection);
|
||||||
|
if(mysql_num_rows($result)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function UpdateEditTopic($id, $title, $cat) {
|
function UpdateEditTopic($id, $title, $cat) {
|
||||||
$q = "UPDATE " . TB_PREFIX . "forum_topic set title = '$title', cat = '$cat' where id = $id";
|
$q = "UPDATE " . TB_PREFIX . "forum_topic set title = '$title', cat = '$cat' where id = $id";
|
||||||
return mysql_query($q, $this->connection);
|
return mysql_query($q, $this->connection);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
class Technology {
|
class Technology {
|
||||||
|
|
||||||
private $unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U0);
|
public $unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U0);
|
||||||
|
|
||||||
public function grabAcademyRes() {
|
public function grabAcademyRes() {
|
||||||
global $village;
|
global $village;
|
||||||
|
|||||||
+243
-31
@@ -16,7 +16,6 @@ while($row = mysql_fetch_array($sql)){
|
|||||||
$lvname = $database->getVillageField($row["wref"], 'name');
|
$lvname = $database->getVillageField($row["wref"], 'name');
|
||||||
if($lwref == $village->wid){
|
if($lwref == $village->wid){
|
||||||
?>
|
?>
|
||||||
<div id="list<?php echo $lid; ?>" class="listEntry">
|
|
||||||
<form action="startRaid.php?id=39&t=99&action=startRaid" method="post">
|
<form action="startRaid.php?id=39&t=99&action=startRaid" method="post">
|
||||||
<input type="hidden" name="action" value="startRaid">
|
<input type="hidden" name="action" value="startRaid">
|
||||||
<input type="hidden" name="a" value="c35">
|
<input type="hidden" name="a" value="c35">
|
||||||
@@ -24,23 +23,21 @@ while($row = mysql_fetch_array($sql)){
|
|||||||
<input type="hidden" name="tribe" value="<?php echo $session->tribe; ?>">
|
<input type="hidden" name="tribe" value="<?php echo $session->tribe; ?>">
|
||||||
<input type="hidden" name="direction" value="asc">
|
<input type="hidden" name="direction" value="asc">
|
||||||
<input type="hidden" name="lid" value="<?php echo $lid; ?>">
|
<input type="hidden" name="lid" value="<?php echo $lid; ?>">
|
||||||
<div class="round spacer listTitle" onclick="Travian.Game.RaidList.toggleList(<?php echo $lid; ?>);">
|
|
||||||
<div class="listTitleText">
|
<div class="listTitleText">
|
||||||
<img alt="del" class="del" src="img/x.gif" onclick="
|
<img alt="del" class="del" src="img/x.gif" onclick="dialog(
|
||||||
'واقعاً حذف شود؟'.dialog(
|
'Are you sure that you want to delete this list?'.
|
||||||
{
|
{
|
||||||
onOkay: function(dialog, contentElement)
|
onOkay: function(dialog, contentElement)
|
||||||
{
|
{
|
||||||
window.location = 'build.php?id=39&t=99&action=deleteList&lid=<?php echo $lid; ?>';
|
window.location = 'build.php?id=39&t=99&action=deleteList&lid=<?php echo $lid; ?>';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
event.stop();
|
event.stop();
|
||||||
">
|
">
|
||||||
<?php echo $lvname; ?> - <?php echo $lname; ?>
|
<?php echo $lvname; ?> - <?php echo $lname; ?>
|
||||||
<img alt="بارگذاری..." class="loading hide" src="img/x.gif" align="absmiddle">
|
<img alt="Loading..." class="loading hide" src="img/x.gif" align="absmiddle">
|
||||||
</div>
|
</div>
|
||||||
<div class="openedClosedSwitch switchOpened">
|
<div class="openedClosedSwitch switchOpened"> </div>
|
||||||
جزئیات </div>
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="listContent ">
|
<div class="listContent ">
|
||||||
@@ -49,11 +46,11 @@ while($row = mysql_fetch_array($sql)){
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="checkbox edit"></td>
|
<td class="checkbox edit"></td>
|
||||||
<td class="village sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'village');">دهکده</td>
|
<td class="village sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'village');">Villiage</td>
|
||||||
<td class="ew sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'ew');">جمعیت</td>
|
<td class="ew sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'ew');">Ew</td>
|
||||||
<td class="distance sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'distance');">فاصله</td>
|
<td class="distance sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'distance');">Distance</td>
|
||||||
<td class="troops sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'troops');">لشکریان</td>
|
<td class="troops sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'troops');">Troops</td>
|
||||||
<td class="lastRaid sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'lastRaid');">آخرین غارت</td>
|
<td class="lastRaid sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'lastRaid');">LastRaid</td>
|
||||||
<td class="action"></td>
|
<td class="action"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -63,7 +60,7 @@ while($row = mysql_fetch_array($sql)){
|
|||||||
$sql2 = mysql_query("SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = $lid ORDER BY distance ASC");
|
$sql2 = mysql_query("SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = $lid ORDER BY distance ASC");
|
||||||
$query2 = mysql_num_rows($sql2);
|
$query2 = mysql_num_rows($sql2);
|
||||||
if($query2 == 0) {
|
if($query2 == 0) {
|
||||||
echo '<td class="noData" colspan="7">هیچ غارتی افزوده نشده است.</td>';
|
echo '<td class="noData" colspan="7">There is no any raid list.</td>';
|
||||||
}else{
|
}else{
|
||||||
while($row = mysql_fetch_array($sql2)){
|
while($row = mysql_fetch_array($sql2)){
|
||||||
$id= $row['id'];$lid = $row['lid'];$towref = $row['towref'];$x = $row['x'];$y = $row['y'];
|
$id= $row['id'];$lid = $row['lid'];$towref = $row['towref'];$x = $row['x'];$y = $row['y'];
|
||||||
@@ -95,7 +92,7 @@ $vdata = $database->getVillage($towref);
|
|||||||
$inc_atts -= 1;
|
$inc_atts -= 1;
|
||||||
}
|
}
|
||||||
if($inc_atts > 0) {
|
if($inc_atts > 0) {
|
||||||
echo '<img class="att2" src="img/x.gif" title="نیروی مهاجم خودی" />';
|
echo '<img class="att2" src="img/x.gif" title="Incoming Attacker" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -106,7 +103,7 @@ $vdata = $database->getVillage($towref);
|
|||||||
if($oasistype != 0){
|
if($oasistype != 0){
|
||||||
?>
|
?>
|
||||||
<span class="coordinates coordinatesWithText">
|
<span class="coordinates coordinatesWithText">
|
||||||
<span class="coordText">آبادی</span>
|
<span class="coordText">Oasis</span>
|
||||||
<span class="coordinatesWrapper">
|
<span class="coordinatesWrapper">
|
||||||
<span class="coordinateY"><?php echo $y; ?>)</span>
|
<span class="coordinateY"><?php echo $y; ?>)</span>
|
||||||
<span class="coordinatePipe">|</span>
|
<span class="coordinatePipe">|</span>
|
||||||
@@ -198,8 +195,7 @@ $vdata = $database->getVillage($towref);
|
|||||||
</td>
|
</td>
|
||||||
<td class="lastRaid">
|
<td class="lastRaid">
|
||||||
<?php
|
<?php
|
||||||
$noticeClass = array("گزارش جاسوسی","پیروزی در حمله بدون تلفات.","پیروزی در حمله با تلفات.","شکست در حمله با تلفات.","پیروزی در دفاع بدون تلفات.","پیروزی در دفاع با تلفات.","شکست در دفاع با تلفات.","شکست در دفاع بدون تلفات","نیروی کمکی","","تاجران بیشتر چوب مبادله کردند.","تاجران بیشتر خشت مبادله کردند.","تاجران بیشتر آهن مبادله کردند.","تاجران بیشتر گندم مبادله کردند.","","حمله به نیروی کمکی");
|
$noticeClass = array("Scout Report","Won as attacker without losses","Won as attacker with losses","Lost as attacker with losses","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Lost as defender without losses","Reinforcement arrived","","Wood Delivered","Clay Delivered","Iron Delivered","Crop Delivered","","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Won scouting as attacker","Lost scouting as attacker","Won scouting as defender","Lost scouting as defender");
|
||||||
|
|
||||||
$limits = "ntype!=4 and ntype!=5 and ntype!=6 and ntype!=7";
|
$limits = "ntype!=4 and ntype!=5 and ntype!=6 and ntype!=7";
|
||||||
$getnotice = mysql_query("SELECT * FROM ".TB_PREFIX."ndata WHERE $limits AND toWref = ".$towref." ORDER BY time DESC Limit 1");
|
$getnotice = mysql_query("SELECT * FROM ".TB_PREFIX."ndata WHERE $limits AND toWref = ".$towref." ORDER BY time DESC Limit 1");
|
||||||
|
|
||||||
@@ -212,13 +208,13 @@ while($row2 = mysql_fetch_array($getnotice)){
|
|||||||
$carry = $dataarray[29];
|
$carry = $dataarray[29];
|
||||||
|
|
||||||
if ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] == 0) {
|
if ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] == 0) {
|
||||||
echo "<img title=\"غنائم: ".$allres." منابع. حداکثر ظرفیت: ".$carry." منابع.\" src=\"img/x.gif\" class=\"carry empty\">";
|
echo "<img title=\"bounty: ".$allres." resouces max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry empty\">";
|
||||||
|
|
||||||
} elseif ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] != $dataarray[29]) {
|
} elseif ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] != $dataarray[29]) {
|
||||||
echo "<img title=\"غنائم: ".$allres." منابع. حداکثر ظرفیت: ".$carry." منابع.\" src=\"img/x.gif\" class=\"carry half\">";
|
echo "<img title=\"bounty: ".$allres." resouces. max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry half\">";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "<img title=\"غنائم: ".$allres." منابع. حداکثر ظرفیت: ".$carry." منابع.\" src=\"img/x.gif\" class=\"carry full\">";
|
echo "<img title=\"bounty: ".$allres." resouces. max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry full\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
$date = $generator->procMtime($row2['time']);
|
$date = $generator->procMtime($row2['time']);
|
||||||
@@ -228,7 +224,7 @@ while($row2 = mysql_fetch_array($getnotice)){
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</td>
|
</td>
|
||||||
<td class="action">
|
<td class="action">
|
||||||
<a class="arrow" href="#" onclick="Travian.Game.RaidList.editSlot(<?php echo $lid; ?>, <?php echo $id; ?>); return false;">ویرایش</a>
|
<a class="arrow" href="#" onclick="Travian.Game.RaidList.editSlot(<?php echo $lid; ?>, <?php echo $id; ?>); return false;">edit</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@@ -240,11 +236,11 @@ while($row2 = mysql_fetch_array($getnotice)){
|
|||||||
</table>
|
</table>
|
||||||
<div class="markAll">
|
<div class="markAll">
|
||||||
<input type="checkbox" id="raidListMarkAll<?php echo $lid; ?>" class="markAll" onclick="Travian.Game.RaidList.markAllSlotsOfAListForRaid(<?php echo $lid; ?>, this.checked);">
|
<input type="checkbox" id="raidListMarkAll<?php echo $lid; ?>" class="markAll" onclick="Travian.Game.RaidList.markAllSlotsOfAListForRaid(<?php echo $lid; ?>, this.checked);">
|
||||||
<label for="raidListMarkAll<?php echo $lid; ?>">انتخاب همه</label>
|
<label for="raidListMarkAll<?php echo $lid; ?>">Select All</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="addSlot">
|
<div class="addSlot">
|
||||||
<button type="button" value="افزودن" onclick="Travian.Game.RaidList.addSlot(<?php echo $lid; ?>);"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">افزودن</div></div></button> </div>
|
<a href="build.php?id=39&t=99&action=showSlot&lid=">Add Raid</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
@@ -263,7 +259,7 @@ for($i=$start;$i<=$end;$i++){
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" value="آغاز غارت"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">آغاز غارت</div></div></button> </div>
|
<button type="submit" value="Start Raid"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Start Raid</div></div></button> </div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -272,28 +268,27 @@ for($i=$start;$i<=$end;$i++){
|
|||||||
<div class="round spacer listTitle" onclick="Travian.Game.RaidList.toggleList(<?php echo $lid; ?>);">
|
<div class="round spacer listTitle" onclick="Travian.Game.RaidList.toggleList(<?php echo $lid; ?>);">
|
||||||
<div class="listTitleText">
|
<div class="listTitleText">
|
||||||
<img alt="del" class="del" src="img/x.gif" onclick="
|
<img alt="del" class="del" src="img/x.gif" onclick="
|
||||||
'واقعاً حذف شود؟'.dialog(
|
'Are you sure that you want to delete this list?'.dialog(
|
||||||
{
|
{
|
||||||
onOkay: function(dialog, contentElement)
|
onOkay: function(dialog, contentElement)
|
||||||
{
|
{
|
||||||
window.location = 'build.php?gid=16&t=99&action=deleteList&lid=<?php echo $lid; ?>';
|
window.location = 'build.php?gid=16&t=99&action=deleteList&lid=<?php echo $lid; ?>';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
event.stop();
|
event.stop();
|
||||||
">
|
">
|
||||||
<?php echo $lvname; ?> - <?php echo $lname; ?>
|
<?php echo $lvname; ?> - <?php echo $lname; ?>
|
||||||
<img alt="بارگذاری..." class="loading hide" src="img/x.gif" align="absmiddle">
|
<img alt="Loading..." class="loading hide" src="img/x.gif" align="absmiddle">
|
||||||
</div>
|
</div>
|
||||||
<div class="openedClosedSwitch switchClosed">جزئیات</div>
|
<div class="openedClosedSwitch switchClosed">Details</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="listContent hide">
|
<div class="listContent hide">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } }?>
|
<?php } }?>
|
||||||
</br>
|
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<a class="arrow" href="build.php?gid=16&t=99&action=addList">» create new list</a>
|
<a class="arrow" href="build.php?gid=16&t=99&action=addList">Create a new list</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -371,3 +366,220 @@ $NUM1++;
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
|
||||||
|
|
||||||
|
$troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10']."";
|
||||||
|
|
||||||
|
if($_POST['x'] && $_POST['y']){
|
||||||
|
$Wref = $database->getVilWref($_POST['y'], $_POST['x']);
|
||||||
|
$type = $database->getVillageType2($Wref);
|
||||||
|
$oasistype = $type['oasistype'];
|
||||||
|
$vdata = $database->getVillage($Wref);
|
||||||
|
}
|
||||||
|
if(!$_POST['x'] && !$_POST['y']){
|
||||||
|
$errormsg .= "Enter coordinates.";
|
||||||
|
}elseif(!$_POST['x'] || !$_POST['y']){
|
||||||
|
$errormsg .= "Enter the correct coordinates.";
|
||||||
|
}elseif($oasistype == 0 && $vdata == 0){
|
||||||
|
$errormsg .= "In this village there are no coordinates.";
|
||||||
|
}elseif($troops == 0){
|
||||||
|
$errormsg .= "No troops has been selected.";
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$Wref = $database->getVilWref($_POST['y'], $_POST['x']);
|
||||||
|
$coor = $database->getCoor($village->wid);
|
||||||
|
|
||||||
|
function getDistance($coorx1, $coory1, $coorx2, $coory2) {
|
||||||
|
$max = 2 * WORLD_MAX + 1;
|
||||||
|
$x1 = intval($coorx1);
|
||||||
|
$y1 = intval($coory1);
|
||||||
|
$x2 = intval($coorx2);
|
||||||
|
$y2 = intval($coory2);
|
||||||
|
$distanceX = min(abs($x2 - $x1), abs($max - abs($x2 - $x1)));
|
||||||
|
$distanceY = min(abs($y2 - $y1), abs($max - abs($y2 - $y1)));
|
||||||
|
$dist = sqrt(pow($distanceX, 2) + pow($distanceY, 2));
|
||||||
|
return round($dist, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$distance = getDistance($coor['x'], $coor['y'], $_POST['y'], $_POST['x']);
|
||||||
|
|
||||||
|
$database->addSlotFarm($_POST['lid'], $Wref, $_POST['x'], $_POST['y'], $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']);
|
||||||
|
|
||||||
|
header("Location: build.php?id=39&t=99");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var targets = {};
|
||||||
|
|
||||||
|
function fillTargets()
|
||||||
|
{
|
||||||
|
var targetId = $('target_id');
|
||||||
|
|
||||||
|
targetId.empty();
|
||||||
|
|
||||||
|
var option = new Element('option',
|
||||||
|
{
|
||||||
|
'html': 'Choose a village'
|
||||||
|
});
|
||||||
|
targetId.insert(option);
|
||||||
|
|
||||||
|
$each(targets[lid], function(data)
|
||||||
|
{
|
||||||
|
var option = new Element('option',
|
||||||
|
{
|
||||||
|
'value': data.did,
|
||||||
|
'html': data.name
|
||||||
|
});
|
||||||
|
targetId.insert(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTargetsByLid()
|
||||||
|
{
|
||||||
|
var lidSelect = $('lid');
|
||||||
|
lid = lidSelect.getSelected()[0].value;
|
||||||
|
|
||||||
|
if (targets[lid])
|
||||||
|
{
|
||||||
|
fillTargets();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Travian.ajax(
|
||||||
|
{
|
||||||
|
data:
|
||||||
|
{
|
||||||
|
cmd: 'raidListTargets',
|
||||||
|
'lid': lid
|
||||||
|
},
|
||||||
|
onSuccess: function(data)
|
||||||
|
{
|
||||||
|
targets[data.lid] = data.targets;
|
||||||
|
fillTargets();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectCoordinates()
|
||||||
|
{
|
||||||
|
var targetId = $('target_id');
|
||||||
|
var did = targetId.getSelected()[0].value;
|
||||||
|
|
||||||
|
if (did == '')
|
||||||
|
{
|
||||||
|
$('xCoordInput').value = '';
|
||||||
|
$('yCoordInput').value = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var array;
|
||||||
|
$each(targets[lid], function(data)
|
||||||
|
{
|
||||||
|
if (data.did == did)
|
||||||
|
{
|
||||||
|
array = data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('xCoordInput').value = array.x;
|
||||||
|
$('yCoordInput').value = array.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var lid = <?php echo $_GET['lid']; ?>;targets[lid] = {};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="raidListSlot">
|
||||||
|
<h4>Add Raid</h4>
|
||||||
|
<font color="#FF0000"><b>
|
||||||
|
<?php echo $errormsg; ?>
|
||||||
|
</b></font>
|
||||||
|
|
||||||
|
<form action="build.php?id=39&t=99&action=showSlot&lid=<?php echo $_GET['lid']; ?>" method="post">
|
||||||
|
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="addSlot">
|
||||||
|
<input type="hidden" name="lid" value="<?php echo $_GET['lid']; ?>">
|
||||||
|
|
||||||
|
|
||||||
|
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||||
|
<tbody><tr>
|
||||||
|
<th>From List</th>
|
||||||
|
<td>
|
||||||
|
<select onchange="getTargetsByLid();" id="lid" name="lid">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysql_query("SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = $session->uid ORDER BY name ASC");
|
||||||
|
while($row = mysql_fetch_array($sql)){
|
||||||
|
$lid = $row["id"];
|
||||||
|
$lname = $row["name"];
|
||||||
|
$lowner = $row["owner"];
|
||||||
|
$lwref = $row["wref"];
|
||||||
|
$lvname = $database->getVillageField($row["wref"], 'name');
|
||||||
|
if($_GET['lid']==$lid){
|
||||||
|
$selected = 'selected=""';
|
||||||
|
}else{ $selected = ''; }
|
||||||
|
echo '<option value="'.$lid.'" '.$selected.'>'.$lvname.' - '.$lname.'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Coordinates:</th>
|
||||||
|
<td class="target">
|
||||||
|
|
||||||
|
<div class="coordinatesInput">
|
||||||
|
<div class="xCoord">
|
||||||
|
<label for="xCoordInput">X:</label>
|
||||||
|
<input value="<?php echo $_POST['y']; ?>" name="y" id="xCoordInput" class="text coordinates y ">
|
||||||
|
</div>
|
||||||
|
<div class="yCoord">
|
||||||
|
<label for="yCoordInput">Y:</label>
|
||||||
|
<input value="<?php echo $_POST['x']; ?>" name="x" id="yCoordInput" class="text coordinates x ">
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
<div class="targetSelect">
|
||||||
|
<label class="lastTargets" for="last_targets">Villiages</label>
|
||||||
|
<select id="target_id" name="target_id" onchange="selectCoordinates()">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql1 = mysql_query("SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = $session->uid ORDER BY name ASC");
|
||||||
|
while($row1 = mysql_fetch_array($sql1)){
|
||||||
|
$lid1 = $row1["id"];
|
||||||
|
$lname1 = $row1["name"];
|
||||||
|
$lowner1 = $row1["owner"];
|
||||||
|
$lwref1 = $row1["wref"];
|
||||||
|
$lvname1 = $database->getVillageField($row1["wref"], 'name');
|
||||||
|
if($_GET['lid']==$lid){
|
||||||
|
$selected = 'selected=""';
|
||||||
|
}else{ $selected = ''; }
|
||||||
|
echo '<option value="'.$lwref1.'" '.$selected1.'>'.$lvname1.'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php include "Templates/goldClub/trooplist.tpl"; ?>
|
||||||
|
|
||||||
|
|
||||||
|
<button type="submit" value="Add" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Add</div></div></button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
<div id="raidListCreate">
|
<div id="raidListCreate">
|
||||||
<h4>ایجاد لیست جدید</h4>
|
<h4>Create a new list</h4>
|
||||||
<form action="build.php?gid=16&t=99" method="post">
|
<form action="build.php?gid=16&t=99" method="post">
|
||||||
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
|
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
|
||||||
<input type="hidden" name="action" value="addList">
|
<input type="hidden" name="action" value="addList">
|
||||||
<table cellpadding="1" cellspacing="1" class="transparent">
|
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<th>
|
<th>
|
||||||
نام: </th>
|
Name: </th>
|
||||||
<td>
|
<td>
|
||||||
<input class="text" id="name" name="name" type="text">
|
<input class="text" id="name" name="name" type="text">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
دهکده: </th>
|
Village: </th>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<select id="did" name="did">
|
<select id="did" name="did">
|
||||||
@@ -35,6 +35,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" value="ایجاد"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">ایجاد</div></div></button>
|
<button type="submit" value="create"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Create</div></div></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+"
|
|||||||
|
|
||||||
var option = new Element('option',
|
var option = new Element('option',
|
||||||
{
|
{
|
||||||
'html': 'دهکدهای انتخاب کنید'
|
'html': 'Select village'
|
||||||
});
|
});
|
||||||
targetId.insert(option);
|
targetId.insert(option);
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+"
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="raidListSlot">
|
<div id="raidListSlot">
|
||||||
<h4>افزودن غارت</h4>
|
<h4>Add Slot</h4>
|
||||||
<font color="#FF0000"><b>
|
<font color="#FF0000"><b>
|
||||||
<?php echo $errormsg; ?>
|
<?php echo $errormsg; ?>
|
||||||
</b></font>
|
</b></font>
|
||||||
@@ -145,7 +145,7 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+"
|
|||||||
|
|
||||||
<table cellpadding="1" cellspacing="1" class="transparent">
|
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<th>لیست فارمها:</th>
|
<th>Farm Name:</th>
|
||||||
<td>
|
<td>
|
||||||
<select onchange="getTargetsByLid();" id="lid" name="lid">
|
<select onchange="getTargetsByLid();" id="lid" name="lid">
|
||||||
<?php
|
<?php
|
||||||
@@ -167,7 +167,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>هدفی انتخاب کنید:</th>
|
<th>Select target:</th>
|
||||||
<td class="target">
|
<td class="target">
|
||||||
|
|
||||||
<div class="coordinatesInput">
|
<div class="coordinatesInput">
|
||||||
@@ -182,9 +182,9 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="targetSelect">
|
<div class="targetSelect">
|
||||||
<label class="lastTargets" for="last_targets">آخرین هدفها:</label>
|
<label class="lastTargets" for="last_targets">Last targets:</label>
|
||||||
<select id="target_id" name="target_id" onchange="selectCoordinates()">
|
<select id="target_id" name="target_id" onchange="selectCoordinates()">
|
||||||
<option value="">دهکدهای انتخاب کنید</option>
|
<option value="">Select village</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
@@ -196,7 +196,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
<?php include "Templates/goldClub/trooplist2.tpl"; ?>
|
<?php include "Templates/goldClub/trooplist2.tpl"; ?>
|
||||||
|
|
||||||
|
|
||||||
<button type="submit" value="ذخیره" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">ذخیره</div></div></button>
|
<button type="submit" value="save" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">save</div></div></button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,13 +16,13 @@ $vdata = $database->getVillage($Wref);
|
|||||||
$troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10']."";
|
$troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10']."";
|
||||||
|
|
||||||
if(!$_POST['x'] && !$_POST['y']){
|
if(!$_POST['x'] && !$_POST['y']){
|
||||||
$errormsg .= "مختصات را وارد کنید.";
|
$errormsg .= "Enter coordinates.";
|
||||||
}elseif(!$_POST['x'] || !$_POST['y']){
|
}elseif(!$_POST['x'] || !$_POST['y']){
|
||||||
$errormsg .= "مختصات را صحیح وارد کنید.";
|
$errormsg .= "Enter the correct coordinates.";
|
||||||
}elseif($oasistype == 0 && $vdata == 0){
|
}elseif($oasistype == 0 && $vdata == 0){
|
||||||
$errormsg .= "در این مختصات دهکده ای وجود ندارد.";
|
$errormsg .= "There is no village on those coordinates.";
|
||||||
}elseif($troops == 0){
|
}elseif($troops == 0){
|
||||||
$errormsg .= "هیچ نیرویی انتخاب نشده.";
|
$errormsg .= "No troops has been selected.";
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$Wref = $database->getVilWref($_POST['y'], $_POST['x']);
|
$Wref = $database->getVilWref($_POST['y'], $_POST['x']);
|
||||||
@@ -61,7 +61,7 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+"
|
|||||||
|
|
||||||
var option = new Element('option',
|
var option = new Element('option',
|
||||||
{
|
{
|
||||||
'html': 'دهکدهای انتخاب کنید'
|
'html': 'Select village'
|
||||||
});
|
});
|
||||||
targetId.insert(option);
|
targetId.insert(option);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+"
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="raidListSlot">
|
<div id="raidListSlot">
|
||||||
<h4>افزودن غارت</h4>
|
<h4>Add Slot</h4>
|
||||||
<font color="#FF0000"><b>
|
<font color="#FF0000"><b>
|
||||||
<?php echo $errormsg; ?>
|
<?php echo $errormsg; ?>
|
||||||
</b></font>
|
</b></font>
|
||||||
@@ -155,7 +155,7 @@ $lid2 = $getlid['lid'];
|
|||||||
|
|
||||||
<table cellpadding="1" cellspacing="1" class="transparent">
|
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<th>لیست فارمها:</th><?php echo $_GET["lid"]; ?>
|
<th>Farm Name:</th><?php echo $_GET["lid"]; ?>
|
||||||
<td>
|
<td>
|
||||||
<select onchange="getTargetsByLid();" id="lid" name="lid">
|
<select onchange="getTargetsByLid();" id="lid" name="lid">
|
||||||
<?php
|
<?php
|
||||||
@@ -175,7 +175,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>هدفی انتخاب کنید:</th>
|
<th>Select target:</th>
|
||||||
<td class="target">
|
<td class="target">
|
||||||
|
|
||||||
<div class="coordinatesInput">
|
<div class="coordinatesInput">
|
||||||
@@ -190,9 +190,9 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="targetSelect">
|
<div class="targetSelect">
|
||||||
<label class="lastTargets" for="last_targets">آخرین هدفها:</label>
|
<label class="lastTargets" for="last_targets">Last targets:</label>
|
||||||
<select id="target_id" name="target_id" onchange="selectCoordinates()">
|
<select id="target_id" name="target_id" onchange="selectCoordinates()">
|
||||||
<option value="">دهکدهای انتخاب کنید</option>
|
<option value="">Select village</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
@@ -204,9 +204,9 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
<?php include "Templates/goldClub/trooplist.tpl"; ?>
|
<?php include "Templates/goldClub/trooplist.tpl"; ?>
|
||||||
|
|
||||||
|
|
||||||
<button type="submit" value="ذخیره" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">ذخیره</div></div></button>
|
<button type="submit" value="save" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Save</div></div></button>
|
||||||
<button type="button" value="حذف" name="delete" id="delete" onclick="return (function(){
|
<button type="button" value="delete" name="delete" id="delete" onclick="return (function(){
|
||||||
('واقعاً حذف شود؟').dialog(
|
('Are you sure that you want to delete this list?').dialog(
|
||||||
{
|
{
|
||||||
onOkay: function(dialog, contentElement)
|
onOkay: function(dialog, contentElement)
|
||||||
{
|
{
|
||||||
@@ -214,6 +214,6 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
})()">
|
})()">
|
||||||
<div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">حذف</div></div></button>
|
<div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Delete</div></div></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
@@ -49,8 +50,10 @@ if($session->goldclub){
|
|||||||
if($_GET['action'] == 'addList') {
|
if($_GET['action'] == 'addList') {
|
||||||
include("Templates/goldClub/farmlist_add.tpl");
|
include("Templates/goldClub/farmlist_add.tpl");
|
||||||
}
|
}
|
||||||
if($_GET['action'] == 'showSlot' && $_GET['lid']) {
|
|
||||||
|
if($_GET['action'] == 'addraid') {
|
||||||
include("Templates/goldClub/farmlist_addraid.tpl");
|
include("Templates/goldClub/farmlist_addraid.tpl");
|
||||||
|
}
|
||||||
}elseif($_GET['action'] == 'showSlot' && $_GET['eid']) {
|
}elseif($_GET['action'] == 'showSlot' && $_GET['eid']) {
|
||||||
include("Templates/goldClub/farmlist_editraid.tpl");
|
include("Templates/goldClub/farmlist_editraid.tpl");
|
||||||
}
|
}
|
||||||
@@ -62,7 +65,6 @@ if($session->goldclub){
|
|||||||
header("Location: build.php?id=39&t=99");
|
header("Location: build.php?id=39&t=99");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['a']) == 533374 && isset($_POST['id']) == 39){
|
if (isset($_POST['a']) == 533374 && isset($_POST['id']) == 39){
|
||||||
$units->Settlers($_POST);
|
$units->Settlers($_POST);
|
||||||
|
|||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
include ("GameEngine/Data/unitdata.php");
|
||||||
|
include ("GameEngine/Database.php");
|
||||||
|
include ("GameEngine/Generator.php");
|
||||||
|
function procDistanceTime2($coor,$thiscoor,$ref,$mode) {
|
||||||
|
$xdistance = ABS($thiscoor['x'] - $coor['x']);
|
||||||
|
if($xdistance > WORLD_MAX) {
|
||||||
|
$xdistance = (2 * WORLD_MAX + 1) - $xdistance;
|
||||||
|
}
|
||||||
|
$ydistance = ABS($thiscoor['y'] - $coor['y']);
|
||||||
|
if($ydistance > WORLD_MAX) {
|
||||||
|
$ydistance = (2 * WORLD_MAX + 1) - $ydistance;
|
||||||
|
}
|
||||||
|
$distance = SQRT(POW($xdistance,2)+POW($ydistance,2));
|
||||||
|
if(!$mode) {
|
||||||
|
if($ref == 1) {
|
||||||
|
$speed = 16;
|
||||||
|
}
|
||||||
|
else if($ref == 2) {
|
||||||
|
$speed = 12;
|
||||||
|
}
|
||||||
|
else if($ref == 3) {
|
||||||
|
$speed = 24;
|
||||||
|
}
|
||||||
|
else if($ref == 300) {
|
||||||
|
$speed = 5;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$speed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$speed = $ref;
|
||||||
|
}
|
||||||
|
return round(($distance/$speed) * 3600 / INCREASE_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
$slots = $_POST['slot'];
|
||||||
|
$lid = $_POST['lid'];
|
||||||
|
$tribe = $_POST['tribe'];
|
||||||
|
$enforce = $database->getEnforceArray($r, 0);
|
||||||
|
$getFLData = $database->getFLData($lid);
|
||||||
|
$unitslist = $database->getFLData($lid);
|
||||||
|
$sql = mysql_query("SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".$lid."");
|
||||||
|
$sql1 = mysql_query("SELECT * FROM ".TB_PREFIX."units WHERE vref = ".$getFLData['wref']);
|
||||||
|
while($row = mysql_fetch_array($sql)){
|
||||||
|
$sid = $row['id'];
|
||||||
|
$wref = $row['towref'];
|
||||||
|
$t1 = $row['t1'];$t2 = $row['t2'];$t3 = $row['t3'];$t4 = $row['t4'];$t5 = $row['t5'];
|
||||||
|
$t6 = $row['t6'];$t7 = $row['t7'];$t8 = $row['t8'];$t9 = $row['t9'];$t10 = $row['t10'];
|
||||||
|
$t11 = 0;
|
||||||
|
if($tribe == 1){ $u = ""; } elseif($tribe == 2){ $u = "1"; } elseif($tribe == 3){ $u = "2"; }elseif($tribe == 4){ $u = "3"; }else {$u = "4"; }
|
||||||
|
if($sql[$u.'1']>=$t1 && $sql[$u.'2']>=$t2 && $sql[$u.'3']>=$t3 && $sql[$u.'4']>=$t4 && $sql[$u.'5']>=$t5 && $sql[$u.'6']>=$t6 && $sql[$u.'7']>=$t7 && $sql[$u.'8']>=$t8 && $sql[$u.'9']>=$t9 && $sql[$u.'10']>=$t10 && $sql['hero']>=$t11){
|
||||||
|
if($slots[$sid]=='on'){
|
||||||
|
$ckey = $generator->generateRandStr(6);
|
||||||
|
$id = $database->addA2b($ckey,time(),$wref,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,4);
|
||||||
|
|
||||||
|
$data = $database->getA2b($ckey, time());
|
||||||
|
|
||||||
|
if($database->checkVilExist($data['to_vid'])){
|
||||||
|
$query1 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = ' . $data['to_vid']);
|
||||||
|
}else{
|
||||||
|
$query1 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'odata` WHERE `wref` = ' . $data['to_vid']);
|
||||||
|
}
|
||||||
|
$data1 = mysql_fetch_assoc($query1);
|
||||||
|
$query2 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = '.$data1['owner']);
|
||||||
|
$data2 = mysql_fetch_assoc($query2);
|
||||||
|
$query11 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = '.$getFLData['wref']);
|
||||||
|
$data11 = mysql_fetch_assoc($query11);
|
||||||
|
$query21 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = '.$data11['owner']);
|
||||||
|
$data21 = mysql_fetch_assoc($query21);
|
||||||
|
|
||||||
|
$eigen = $database->getCoor($getFLData['wref']);
|
||||||
|
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
|
||||||
|
$ander = $database->getCoor($data['to_vid']);
|
||||||
|
$to = array('x'=>$ander['x'], 'y'=>$ander['y']);
|
||||||
|
$start = ($data21['tribe']-1)*10+1;
|
||||||
|
$end = ($data21['tribe']*10);
|
||||||
|
|
||||||
|
$speeds = array();
|
||||||
|
$scout = 1;
|
||||||
|
|
||||||
|
//find slowest unit.
|
||||||
|
for($i=1;$i<=10;$i++){
|
||||||
|
if ($data['u'.$i]){
|
||||||
|
if($data['u'.$i] != '' && $data['u'.$i] > 0){
|
||||||
|
if($unitarray) { reset($unitarray); }
|
||||||
|
$unitarray = $GLOBALS["u".(($tribe-1)*10+$i)];
|
||||||
|
$speeds[] = $unitarray['speed'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$time = procDistanceTime2($from,$to,min($speeds),1);
|
||||||
|
|
||||||
|
$ctar1 = 0;
|
||||||
|
$ctar2 = 0;
|
||||||
|
$abdata = $database->getABTech($getFLData['wref']);
|
||||||
|
$reference = $database->addAttack(($getFLData['wref']),$data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11'],$data['type'],$ctar1,$ctar2,0,$abdata['b1'],$abdata['b2'],$abdata['b3'],$abdata['b4'],$abdata['b5'],$abdata['b6'],$abdata['b7'],$abdata['b8']);
|
||||||
|
$totalunits = $data['u1']+$data['u2']+$data['u3']+$data['u4']+$data['u5']+$data['u6']+$data['u7']+$data['u8']+$data['u9']+$data['u10']+$data['u11'];
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'1'), array($data['u1']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'2'), array($data['u2']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'3'), array($data['u3']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'4'), array($data['u4']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'5'), array($data['u5']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'6'), array($data['u6']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'7'), array($data['u7']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'8'), array($data['u8']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'9'), array($data['u9']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array($u.'10'), array($data['u10']), array(0));
|
||||||
|
$database->modifyUnit($getFLData['wref'], array('hero'), array($data['u11']), array(0));
|
||||||
|
|
||||||
|
$database->addMovement(3,$getFLData['wref'],$data['to_vid'],$reference,0,($time+time()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header("Location: build.php?id=39&t=99");
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user