-
Notifications
You must be signed in to change notification settings - Fork 2
/
_xtense.php
148 lines (122 loc) · 4.76 KB
/
_xtense.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
<?php
if (!defined('IN_SPYOGAME'))
die("Hacking attempt");
global $db, $table_prefix, $user, $xtense_version;
$xtense_version = "2.2";
include_once("mod/oversight/common.php");
// TEST XTENSE2
if (class_exists("Callback")) {
class oversight_Callback extends Callback
{
public $version = '2.3.9';
public function cdr($system)
{
global $io;
if (cdr($system))
return Io::SUCCESS;
else
return Io::ERROR;
}
public function getCallbacks()
{
return array(array('function' => 'oversight', 'type' => 'system'));
}
function oversight($system)
{ global $user_data, $db, $table_prefix;
$players = getAllSurveillance();
$forDebug=array();
$forDebug[]= "Oversight Debug";
$_gal = $system["galaxy"];
$_sys = $system["system"];
$row= 0;
foreach ($system["data"] as $rowContent)
{
//print_r($rowContent);
if (isset($rowContent["player_id"]) && in_array($rowContent["player_id"],$players)) // todo mettre uniquement ceux recherché
{
$forDebug[]= "Insertion de ".$rowContent["player_id"]." => ".$rowContent["player_name"];
$datatime = time();
$fomatDatetime = (int)roundtimestamp($datatime );
$p_activiy=-1;
switch ($rowContent["activity"]) {
case 0:
$p_activiy = roundtimestamp($datatime - (int)(15 * 60));
break;
case -1:
$p_activiy = $fomatDatetime;
break;
default:
$p_activiy = roundtimestamp($datatime - (int)($rowContent["activity"] * 60));
break;
}
$m_activiy=-1;
switch ($rowContent["activityMoon"]) {
case 0:
$m_activiy = roundtimestamp($datatime - (int)(15 * 60));
break;
case -1:
$m_activiy = $fomatDatetime;
break;
default:
$m_activiy = roundtimestamp($datatime - (int)($rowContent["activityMoon"] * 60));
break;
}
$query = " REPLACE INTO ".TABLE_OVERSIGHT ;
$query .= " (coord, datatime, p_activiy_value,p_activiy, m_activiy_value, m_activiy, cdr,sender_id, player_id) ";
$query .= " VALUES ('".$_gal.":".$_sys.":".$row."', '".(int)roundtimestamp($datatime )."', '".$rowContent["activity"]."', '".$p_activiy."' ,'".$rowContent["activityMoon"]."','".$m_activiy."' , '".($rowContent["debris"]["metal"] + $rowContent["debris"]["cristal"] )."', '".$user_data["user_id"]."','".$rowContent["player_id"]."');" ;
$db->sql_query($query);
$forDebug[]=$query;
}
$row++;
}
//print_r($forDebug);
return true;
}
}
//cf doc
// system array
// [galaxy] (int)
// [system] (int)
// [data] (array #15)
// array
// [planet_name] (string)
// [moon] (int) défini par les constantes TYPE_PLANET ou TYPE_MOON Ogame
// [player_name] (string)
// [status] (string)
// [ally_tag] (string)
// [debris] (array)
// [metal] (int) Ogame
// [cristal] (int) Ogame
// [titanium] (int) E-Univers
// [carbon] (int) E-Univers
// [tritium] (int) E-Univers
// [activity] (string) au format du jeu, * ou 37mn par exemple Ogame
//cf print_r
//[data] => Array
//(
//etc
// [12] => Array
// (
// [player_id] => 100881
// [planet_name] => Exia
// [planet_id] => 33631656
// [moon_id] => 33631658
// [moon] => 1
// [player_name] => SetsunaFSeiei
// [status] => v
// [ally_id] => 500762
// [ally_tag] => BISOUS
// [debris] => Array
// (
// [metal] => 0
// [cristal] => 0
// )
// [activity] => -1
// [activityMoon] => -1
// )
//etc
//}
//[galaxy] => 3
//[system] => 38
}
?>