This repository was archived by the owner on Jun 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSendFleetBack.php
More file actions
74 lines (64 loc) · 2.67 KB
/
SendFleetBack.php
File metadata and controls
74 lines (64 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* @package xNova
* @version 1.0.x
* @since 1.0.0
* @license http://creativecommons.org/licenses/by-sa/3.0/ CC-BY-SA
* @link http://www.razican.com
* @author Razican <admin@razican.com>
*/
define('INSIDE', TRUE);
define('INSTALL', FALSE);
define('XN_ROOT', realpath('./').'/');
require(XN_ROOT.'global.php');
if (is_numeric($_POST['fleetid']))
{
$fleetid = intval($_POST['fleetid']);
$FleetRow = doquery("SELECT * FROM `{{table}}` WHERE `fleet_id` = '".$fleetid."';", 'fleets', TRUE);
$i = 0;
if ($FleetRow['fleet_owner'] == $user['id'])
{
//now we can call back the ships in maintaing position (2).
if ($FleetRow['fleet_mess'] == 0 OR $FleetRow['fleet_mess'] == 2)
{
if ($FleetRow['fleet_group'] > 0)
{
$Aks = doquery("SELECT teilnehmer FROM `{{table}}` WHERE id = '".$FleetRow['fleet_group']."';", 'aks', TRUE);
if ($Aks['teilnehmer'] == $FleetRow['fleet_owner'] && $FleetRow['fleet_mission'] == 1)
{
doquery("DELETE FROM `{{table}}` WHERE id ='".$FleetRow['fleet_group']."';", 'aks');
doquery("UPDATE `{{table}}` SET `fleet_group` = '0' WHERE `fleet_group` = '".$FleetRow['fleet_group']."';", 'fleets');
}
if ($FleetRow['fleet_mission'] == 2)
{
doquery("UPDATE `{{table}}` SET `fleet_group` = '0' WHERE `fleet_id` = '". $fleetid."';", 'fleets');
}
}
$CurrentFlyingTime = time() - $FleetRow['start_time'];
/*** start fix by jstar ***/
//the fleet time duration between 2 planet, it is equal for go and return when maintaining time=0
$fleetLeght = $FleetRow['fleet_start_time'] - $FleetRow['start_time'];
//the return time when you press "call back ships"
$ReturnFlyingTime =
//if the ships mission is maintaining position and they are already in target pianet
($FleetRow['fleet_end_stay'] && $CurrentFlyingTime > $fleetLeght)
//then the return time is the $fleetLeght + the current time in maintaining position
? $fleetLeght + time()
// else normal mission
: $CurrentFlyingTime + time();
/***end fix by jstar***/
$QryUpdateFleet = "UPDATE `{{table}}` SET ";
$QryUpdateFleet .= "`fleet_start_time` = '".(time() - 1)."', ";
$QryUpdateFleet .= "`fleet_end_stay` = '0', ";
$QryUpdateFleet .= "`fleet_end_time` = '".($ReturnFlyingTime + 1)."', ";
$QryUpdateFleet .= "`fleet_target_owner` = '".$user['id']."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '".$fleetid."';";
doquery($QryUpdateFleet, 'fleets');
}
}
}
header("Location: ".GAMEURL."game.php?page=fleet");
/* End of file SendFleetBack.php */
/* Location: ./SendFleetBack.php */