-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshipActions.php
135 lines (134 loc) · 3.75 KB
/
shipActions.php
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
session_start();
?>
<!doctype html>
<?php
require 'facebookIncludes.php';
?>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>SpaceZoo</title>
<link rel="stylesheet" type="text/css" href="default.css" />
</head>
<body>
<h1 style = "text-align: center;">Space Zoo</h1>
<?php
$user = new UserClass($facebook->getUser());
MainMenuClass::show($user->isAdmin());
if(!$user->isTraveling())
{
$user->updateLocation();
}
?>
<br />
<br />
<br />
<table class="main">
<tr>
<th colspan=2>
Ship Info
</th>
</tr>
<tr>
<td>
Location:
</td>
<td>
<?php echo $user->getXLocation() ?>, <?php echo $user->getYLocation() ?>
</td>
</tr>
<tr>
<td>
Thruster Level:
</td>
<td>
<?php echo $user->getThrusterLevel() ?>
</td>
</tr>
<tr>
<td>
Scanner Level:
</td>
<td>
<?php echo $user->getScannerLevel() ?>
</td>
</tr>
</table>
<br />
<br />
<form name="form1" method="post" action="shipActions.php">
<?php
if(isset($_POST['confirmMove']))
{
$user->moveToLocation($_SESSION['xLocation'], $_SESSION['yLocation']);
}
if($user->isTraveling())
{
?>
<table class="main">
<tr>
<th>
Traveling
</th>
</tr>
<tr>
<td>
You are moving to location <?php echo $user->getStringFutureLocation() ?> and it will take you <?php echo round($user->getTravelMicroTimeLeft()/1000000) ?> seconds longer
</td>
</tr>
</table>
<?php
}
else
{
if(isset($_POST['calculateTrajectory']))
{
$_SESSION['xLocation'] = $_POST['xLocation'];
$_SESSION['yLocation'] = $_POST['yLocation'];
?>
<table class="main">
<tr>
<th>
Confirm Move
</th>
</tr>
<tr>
<td>
Moving to location (<?php echo $_POST['xLocation'] ?>, <?php echo $_POST['yLocation'] ?>) will take <?php echo round($user->calculateTimeToMoveInSeconds($_POST['xLocation'], $_POST['yLocation'])) ?> seconds
</td>
</tr>
<tr>
<td style="text-align: center">
<input type="submit" name="confirmMove" value="Confirm"> <input type="submit" name="cancelMove" value="Cancel">
</td>
</tr>
</table>
<?php
}
else
{
?>
<table class="main">
<tr>
<th>
Move
</th>
</tr>
<tr>
<td>
X Coordinates: <input type="text" name="xLocation"> Y Coordinates: <input type="text" name="yLocation">
</td>
</tr>
<tr>
<td style="text-align: center">
<input type="submit" name="calculateTrajectory" value="Calculate Trajectory">
</td>
</tr>
</table>
<?php
}
}
?>
</form>
</body>
</html>