This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rak.php
182 lines (151 loc) · 7.36 KB
/
rak.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing XNova.
*
*/
if (!defined('INSIDE')) {
die("Hacking attempt");
}
if (file_exists(ROOT_PATH . "includes/raketenangriff.php")) {
include(ROOT_PATH . "includes/raketenangriff.php");
} elseif (file_exists("includes/raketenangriff.php")) {
include("./includes/raketenangriff.php");
} elseif (file_exists("../includes/raketenangriff.php")) {
include("../includes/raketenangriff.php");
} else
die('Fatal error!');
if (!defined('QRYLESS') && isset($resource) && !empty($resource[401])) {
$iraks = doquery("SELECT * FROM {{table}} WHERE zeit <= '" . time() . "'", 'iraks');
while ($selected_row = mysqli_fetch_array($iraks)) {
if ($selected_row['zeit'] != '' && $selected_row['galaxy'] != '' && $selected_row['system'] != '' && $selected_row['planet'] != '' && is_numeric($selected_row['owner']) && is_numeric($selected_row['zielid']) && is_numeric($selected_row['anzahl']) && !empty($selected_row['anzahl'])) {
$planetrow = doquery("SELECT * FROM {{table}} WHERE
galaxy = '" . $selected_row['galaxy'] . "' AND
system = '" . $selected_row['system'] . "' AND
planet = '" . $selected_row['planet'] . "'", 'planets');
$select_ziel = doquery("SELECT defence_tech FROM {{table}} WHERE
`uid` = '" . $selected_row['zielid'] . "'", 'users_tech');
$select_owner = doquery("SELECT military_tech FROM {{table}} WHERE
`uid` = '" . $selected_row['owner'] . "'", 'users_tech');
if (mysqli_num_rows($planetrow) != 1 OR mysqli_num_rows($select_ziel) != 1) {
doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
} else {
$verteidiger = mysqli_fetch_array($select_ziel);
$angreifer = mysqli_fetch_array($select_owner);
$planet = mysqli_fetch_array($planetrow);
$ids = array(0 => 401,
1 => 402,
2 => 403,
3 => 404,
4 => 405,
5 => 406,
6 => 407,
7 => 408,
8 => 502,
9 => 503
);
$def =
array(0 => $planet['misil_launcher'], // Raketenwerfer
1 => $planet['small_laser'], // Leichtes Lasergesch�tz
2 => $planet['big_laser'], // Schweres Lasergesch�tz
3 => $planet['gauss_canyon'], // Gau�kanone
4 => $planet['ionic_canyon'], // Ionengesch�tz
5 => $planet['buster_canyon'], // Plasmawerfer
6 => $planet['small_protection_shield'], // Kleine Schildkuppel
7 => $planet['big_protection_shield'], // Gro�e Schildkuppel
8 => $planet['interplanetary_misil'], // Interplanetarrakete
9 => $planet['interceptor_misil'], // Abfangrakete
);
$lang =
array(0 => "Lanceur Missile",
1 => "Canon Magnétique",
2 => "Batterie Electromagnétique",
3 => "Canon de Gauss",
4 => "Lanceur Ionique",
5 => "Lanceur de plasma",
6 => "Petit bouclier",
7 => "Grand bouclier",
8 => "Missiles Intercepteur",
9 => "Missiles Interplanetaire",
10 => "Missiles Intercepteur"
);
$irak = raketenangriff($verteidiger['defence_tech'], $angreifer['military_tech'], $selected_row['anzahl'], $def, $selected_row['primaer']);
$message = '';
if ($planet['interceptor_misil'] >= $selected_row['anzahl']) {
$message = 'Les Missiles Intercepteur adverses ont détruit vos missiles Interplanetaire<br>';
$x = $resource[$ids[9]];
doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $selected_row['anzahl'] . " WHERE id = " . $planet['id'], 'planets');
} else {
if ($planet['interceptor_misil'] > 0) {
$x = $resource[$ids[9]];
doquery("UPDATE {{table}} SET " . $x . " = '0' WHERE id = " . $planet['id'], 'planets');
$message = $planet['interceptor_misil'] . " missiles Interplanetaire ont été interceptés par vos missiles.<br>";
}
foreach ($irak['zerstoert'] as $id => $anzahl) {
if (!empty($anzahl) && $id < 10) {
if ($id != 9)
$message .= $lang[$id] . " (- " . $anzahl . ")<br>";
$x = $resource[$ids[$id]];
doquery("UPDATE {{table}} SET " . $x . " = " . $x . "-" . $anzahl . " WHERE id = " . $planet['id'], 'planets');
}
}
}
$planet_ = doquery("SELECT * FROM {{table}} WHERE
galaxy = '" . $selected_row['galaxy_angreifer'] . "' AND
system = '" . $selected_row['system_angreifer'] . "' AND
planet = '" . $selected_row['planet_angreifer'] . "'", 'planets');
if (mysqli_num_rows($planet_) == 1) {
$array = mysqli_fetch_array($planet_);
$name = $array['name'];
}
$planet_2 = doquery("SELECT * FROM {{table}} WHERE
galaxy = '" . $selected_row['galaxy'] . "' AND
system = '" . $selected_row['system'] . "' AND
planet = '" . $selected_row['planet'] . "'", 'planets');
if (mysqli_num_rows($planet_2) == 1) {
$array = mysqli_fetch_array($planet_2);
$name_deffer = $array['name'];
}
$message_vorlage = 'Une attaque de missiles (' . $selected_row['anzahl'] . ') de ' . $name . ' <a href="galaxy.php?mode=3&galaxy=' . $selected_row['galaxy_angreifer'] . '&system=' . $selected_row['system_angreifer'] . '&planet=' . $selected_row['planet_angreifer'] . '">[' . $selected_row['galaxy_angreifer'] . ':' . $selected_row['system_angreifer'] . ':' . $selected_row['planet_angreifer'] . ']</a>';
$message_vorlage .= 'de la planete ' . $name_deffer . ' <a href="galaxy.php?mode=3&galaxy=' . $selected_row['galaxy'] . '&system=' . $selected_row['system'] . '&planet=' . $selected_row['planet'] . '">[' . $selected_row['galaxy'] . ':' . $selected_row['system'] . ':' . $selected_row['planet'] . ']</a><br><br>';
if (empty($message))
$message = "L ennemis ne possedait pas de défenses, rien n a été détruit !";
doquery("INSERT INTO {{table}} SET
`message_owner`='" . $selected_row['zielid'] . "',
`message_sender`='',
`message_time`=UNIX_TIMESTAMP(),
`message_type`='0',
`message_from`='QG',
`message_subject`='Attaque de MIP',
`message_text`='" . $message_vorlage . $message . "'" , 'messages');
doquery("UPDATE {{table}} SET new_message=new_message+1 WHERE id='" . $selected_row['zielid'] . "'", 'users');
doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
}
} else {
doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
}
}
}