|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* The MIT License (MIT) |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright (c) 2016 Robert Sardinia |
|
6
|
|
|
* |
|
7
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
9
|
|
|
* in the Software without restriction, including without limitation the rights |
|
10
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
12
|
|
|
* furnished to do so, subject to the following conditions: |
|
13
|
|
|
* |
|
14
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
15
|
|
|
* copies or substantial portions of the Software. |
|
16
|
|
|
* |
|
17
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
19
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
20
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
21
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
22
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
23
|
|
|
* SOFTWARE. |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
use discord\discord; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Class siloFull |
|
30
|
|
|
* @property towerRace |
|
31
|
|
|
*/ |
|
32
|
|
|
class siloFull |
|
|
|
|
|
|
33
|
|
|
{ |
|
34
|
|
|
public $config; |
|
35
|
|
|
public $discord; |
|
36
|
|
|
public $logger; |
|
37
|
|
|
protected $keyID; |
|
38
|
|
|
protected $vCode; |
|
39
|
|
|
protected $prefix; |
|
40
|
|
|
private $toDiscordChannel; |
|
41
|
|
|
private $guild; |
|
42
|
|
|
private $towerRace; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param $config |
|
46
|
|
|
* @param $discord |
|
47
|
|
|
* @param $logger |
|
48
|
|
|
*/ |
|
49
|
|
View Code Duplication |
public function init($config, $discord, $logger) |
|
|
|
|
|
|
50
|
|
|
{ |
|
51
|
|
|
$this->config = $config; |
|
52
|
|
|
$this->discord = $discord; |
|
53
|
|
|
$this->logger = $logger; |
|
54
|
|
|
$this->guild = $config['bot']['guild']; |
|
55
|
|
|
$this->toDiscordChannel = $config['plugins']['siloFull']['channelID']; |
|
56
|
|
|
$this->keyID = $config['plugins']['siloFull']['keyID']; |
|
57
|
|
|
$this->vCode = $config['plugins']['siloFull']['vCode']; |
|
58
|
|
|
$this->towerRace = $config['plugins']['siloFull']['towerRace']; |
|
59
|
|
|
$lastCheck = getPermCache("siloLastChecked{$this->keyID}"); |
|
60
|
|
|
if ($lastCheck === NULL) { |
|
61
|
|
|
// Schedule it for right now if first run |
|
62
|
|
|
setPermCache("siloLastChecked{$this->keyID}", time() - 5); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* |
|
68
|
|
|
*/ |
|
69
|
|
|
public function tick() |
|
70
|
|
|
{ |
|
71
|
|
|
// What was the servers last reported state |
|
72
|
|
|
$lastStatus = getPermCache('serverState'); |
|
73
|
|
|
if ($lastStatus === 'online') { |
|
74
|
|
|
$lastChecked = getPermCache("siloLastChecked{$this->keyID}"); |
|
75
|
|
|
$keyID = $this->keyID; |
|
76
|
|
|
$vCode = $this->vCode; |
|
77
|
|
|
if ($lastChecked <= time()) { |
|
78
|
|
|
$this->logger->addInfo("siloFull: Checking API Key {$keyID} for full silos"); |
|
79
|
|
|
$this->checkTowers($keyID, $vCode); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
private function checkTowers($keyID, $vCode) |
|
85
|
|
|
{ |
|
86
|
|
|
|
|
87
|
|
|
$url = "https://api.eveonline.com/corp/AssetList.xml.aspx?keyID={$keyID}&vCode={$vCode}"; |
|
88
|
|
|
$xml = makeApiRequest($url); |
|
89
|
|
|
$siloCount = 0; |
|
90
|
|
|
$towerMulti = 0; |
|
91
|
|
|
$towerFull = 20000; |
|
92
|
|
|
$cleanFull = number_format($towerFull); |
|
93
|
|
View Code Duplication |
if ($this->towerRace === 1) { |
|
|
|
|
|
|
94
|
|
|
$towerMulti = 0.50; |
|
95
|
|
|
$towerFull = 30000; |
|
96
|
|
|
$cleanFull = number_format($towerFull); |
|
97
|
|
|
} |
|
98
|
|
View Code Duplication |
if ($this->towerRace === 2) { |
|
|
|
|
|
|
99
|
|
|
$towerMulti = 1; |
|
100
|
|
|
$towerFull = 40000; |
|
101
|
|
|
$cleanFull = number_format($towerFull); |
|
102
|
|
|
} |
|
103
|
|
|
foreach ($xml->result->rowset->row as $structures) { |
|
104
|
|
|
//Check silos |
|
105
|
|
|
if ($structures->attributes()->typeID == 14343) { |
|
106
|
|
|
if (isset($structures->rowset->row)) { |
|
107
|
|
|
foreach ($structures->rowset->row as $silo) { |
|
108
|
|
|
$moonGoo = $silo->attributes()->typeID; |
|
109
|
|
|
switch ($moonGoo) { |
|
110
|
|
View Code Duplication |
case 16634: |
|
|
|
|
|
|
111
|
|
|
$typeName = apiTypeName(16634); |
|
112
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
113
|
|
|
$towerWarn = 180000 + (180000 * $towerMulti); |
|
114
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
115
|
|
|
$siloID = $structures->attributes()->itemID; |
|
116
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
117
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
118
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
119
|
|
|
//Check if silo has been checked before |
|
120
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
121
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
122
|
|
|
continue 2; |
|
123
|
|
|
} |
|
124
|
|
|
$gooVolume = 0.1; |
|
125
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
126
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
127
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
128
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
129
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
130
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
131
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
132
|
|
|
continue 2; |
|
133
|
|
|
} |
|
134
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
135
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
136
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
137
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
138
|
|
|
// Send the msg to the channel; |
|
139
|
|
|
$channelID = $this->toDiscordChannel; |
|
140
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
141
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
142
|
|
|
$siloCount++; |
|
143
|
|
|
} |
|
144
|
|
|
break; |
|
145
|
|
View Code Duplication |
case 16643: |
|
|
|
|
|
|
146
|
|
|
$typeName = apiTypeName(16643); |
|
147
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
148
|
|
|
$towerWarn = 45000 + (45000 * $towerMulti); |
|
149
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
150
|
|
|
$siloID = $structures->attributes()->itemID; |
|
151
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
152
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
153
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
154
|
|
|
//Check if silo has been checked before |
|
155
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
156
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
157
|
|
|
continue 2; |
|
158
|
|
|
} |
|
159
|
|
|
$gooVolume = 0.4; |
|
160
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
161
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
162
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
163
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
164
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
165
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
166
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
167
|
|
|
continue 2; |
|
168
|
|
|
} |
|
169
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
170
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
171
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
172
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
173
|
|
|
// Send the msg to the channel; |
|
174
|
|
|
$channelID = $this->toDiscordChannel; |
|
175
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
176
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
177
|
|
|
$siloCount++; |
|
178
|
|
|
} |
|
179
|
|
|
break; |
|
180
|
|
View Code Duplication |
case 16647: |
|
|
|
|
|
|
181
|
|
|
$typeName = apiTypeName(16647); |
|
182
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
183
|
|
|
$towerWarn = 22500 + (22500 * $towerMulti); |
|
184
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
185
|
|
|
$siloID = $structures->attributes()->itemID; |
|
186
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
187
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
188
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
189
|
|
|
//Check if silo has been checked before |
|
190
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
191
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
192
|
|
|
continue 2; |
|
193
|
|
|
} |
|
194
|
|
|
$gooVolume = 0.8; |
|
195
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
196
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
197
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
198
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
199
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
200
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
201
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
202
|
|
|
continue 2; |
|
203
|
|
|
} |
|
204
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
205
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
206
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
207
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
208
|
|
|
// Send the msg to the channel; |
|
209
|
|
|
$channelID = $this->toDiscordChannel; |
|
210
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
211
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
212
|
|
|
$siloCount++; |
|
213
|
|
|
} |
|
214
|
|
|
break; |
|
215
|
|
View Code Duplication |
case 16641: |
|
|
|
|
|
|
216
|
|
|
$typeName = apiTypeName(16641); |
|
217
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
218
|
|
|
$towerWarn = 30000 + (30000 * $towerMulti); |
|
219
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
220
|
|
|
$siloID = $structures->attributes()->itemID; |
|
221
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
222
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
223
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
224
|
|
|
//Check if silo has been checked before |
|
225
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
226
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
227
|
|
|
continue 2; |
|
228
|
|
|
} |
|
229
|
|
|
$gooVolume = 0.6; |
|
230
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
231
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
232
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
233
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
234
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
235
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
236
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
237
|
|
|
continue 2; |
|
238
|
|
|
} |
|
239
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
240
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
241
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
242
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
243
|
|
|
// Send the msg to the channel; |
|
244
|
|
|
$channelID = $this->toDiscordChannel; |
|
245
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
246
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
247
|
|
|
$siloCount++; |
|
248
|
|
|
} |
|
249
|
|
|
break; |
|
250
|
|
View Code Duplication |
case 16640: |
|
|
|
|
|
|
251
|
|
|
$typeName = apiTypeName(16640); |
|
252
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
253
|
|
|
$towerWarn = 45000 + (45000 * $towerMulti); |
|
254
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
255
|
|
|
$siloID = $structures->attributes()->itemID; |
|
256
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
257
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
258
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
259
|
|
|
//Check if silo has been checked before |
|
260
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
261
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
262
|
|
|
continue 2; |
|
263
|
|
|
} |
|
264
|
|
|
$gooVolume = 0.4; |
|
265
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
266
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
267
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
268
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
269
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
270
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
271
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
272
|
|
|
continue 2; |
|
273
|
|
|
} |
|
274
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
275
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
276
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
277
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
278
|
|
|
// Send the msg to the channel; |
|
279
|
|
|
$channelID = $this->toDiscordChannel; |
|
280
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
281
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
282
|
|
|
$siloCount++; |
|
283
|
|
|
} |
|
284
|
|
|
break; |
|
285
|
|
View Code Duplication |
case 16635: |
|
|
|
|
|
|
286
|
|
|
$typeName = apiTypeName(16635); |
|
287
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
288
|
|
|
$towerWarn = 180000 + (180000 * $towerMulti); |
|
289
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
290
|
|
|
$siloID = $structures->attributes()->itemID; |
|
291
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
292
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
293
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
294
|
|
|
//Check if silo has been checked before |
|
295
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
296
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
297
|
|
|
continue 2; |
|
298
|
|
|
} |
|
299
|
|
|
$gooVolume = 0.1; |
|
300
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
301
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
302
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
303
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
304
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
305
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
306
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
307
|
|
|
continue 2; |
|
308
|
|
|
} |
|
309
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
310
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
311
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
312
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
313
|
|
|
// Send the msg to the channel; |
|
314
|
|
|
$channelID = $this->toDiscordChannel; |
|
315
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
316
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
317
|
|
|
$siloCount++; |
|
318
|
|
|
} |
|
319
|
|
|
break; |
|
320
|
|
View Code Duplication |
case 16648: |
|
|
|
|
|
|
321
|
|
|
$typeName = apiTypeName(16648); |
|
322
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
323
|
|
|
$towerWarn = 22500 + (22500 * $towerMulti); |
|
324
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
325
|
|
|
$siloID = $structures->attributes()->itemID; |
|
326
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
327
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
328
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
329
|
|
|
//Check if silo has been checked before |
|
330
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
331
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
332
|
|
|
continue 2; |
|
333
|
|
|
} |
|
334
|
|
|
$gooVolume = 0.8; |
|
335
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
336
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
337
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
338
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
339
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
340
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
341
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
342
|
|
|
continue 2; |
|
343
|
|
|
} |
|
344
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
345
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
346
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
347
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
348
|
|
|
// Send the msg to the channel; |
|
349
|
|
|
$channelID = $this->toDiscordChannel; |
|
350
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
351
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
352
|
|
|
$siloCount++; |
|
353
|
|
|
} |
|
354
|
|
|
break; |
|
355
|
|
View Code Duplication |
case 16633: |
|
|
|
|
|
|
356
|
|
|
$typeName = apiTypeName(16633); |
|
357
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
358
|
|
|
$towerWarn = 180000 + (180000 * $towerMulti); |
|
359
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
360
|
|
|
$siloID = $structures->attributes()->itemID; |
|
361
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
362
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
363
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
364
|
|
|
//Check if silo has been checked before |
|
365
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
366
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
367
|
|
|
continue 2; |
|
368
|
|
|
} |
|
369
|
|
|
$gooVolume = 0.1; |
|
370
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
371
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
372
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
373
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
374
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
375
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
376
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
377
|
|
|
continue 2; |
|
378
|
|
|
} |
|
379
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
380
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
381
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
382
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
383
|
|
|
// Send the msg to the channel; |
|
384
|
|
|
$channelID = $this->toDiscordChannel; |
|
385
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
386
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
387
|
|
|
$siloCount++; |
|
388
|
|
|
} |
|
389
|
|
|
break; |
|
390
|
|
View Code Duplication |
case 16646: |
|
|
|
|
|
|
391
|
|
|
$typeName = apiTypeName(16646); |
|
392
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
393
|
|
|
$towerWarn = 22500 + (22500 * $towerMulti); |
|
394
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
395
|
|
|
$siloID = $structures->attributes()->itemID; |
|
396
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
397
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
398
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
399
|
|
|
//Check if silo has been checked before |
|
400
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
401
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
402
|
|
|
continue 2; |
|
403
|
|
|
} |
|
404
|
|
|
$gooVolume = 0.8; |
|
405
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
406
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
407
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
408
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
409
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
410
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
411
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
412
|
|
|
continue 2; |
|
413
|
|
|
} |
|
414
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
415
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
416
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
417
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
418
|
|
|
// Send the msg to the channel; |
|
419
|
|
|
$channelID = $this->toDiscordChannel; |
|
420
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
421
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
422
|
|
|
$siloCount++; |
|
423
|
|
|
} |
|
424
|
|
|
break; |
|
425
|
|
View Code Duplication |
case 16651: |
|
|
|
|
|
|
426
|
|
|
$typeName = apiTypeName(16651); |
|
427
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
428
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
429
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
430
|
|
|
$siloID = $structures->attributes()->itemID; |
|
431
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
432
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
433
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
434
|
|
|
//Check if silo has been checked before |
|
435
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
436
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
437
|
|
|
continue 2; |
|
438
|
|
|
} |
|
439
|
|
|
$gooVolume = 1; |
|
440
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
441
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
442
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
443
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
444
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
445
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
446
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
447
|
|
|
continue 2; |
|
448
|
|
|
} |
|
449
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
450
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
451
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
452
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
453
|
|
|
// Send the msg to the channel; |
|
454
|
|
|
$channelID = $this->toDiscordChannel; |
|
455
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
456
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
457
|
|
|
$siloCount++; |
|
458
|
|
|
} |
|
459
|
|
|
break; |
|
460
|
|
View Code Duplication |
case 16650: |
|
|
|
|
|
|
461
|
|
|
$typeName = apiTypeName(16650); |
|
462
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
463
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
464
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
465
|
|
|
$siloID = $structures->attributes()->itemID; |
|
466
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
467
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
468
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
469
|
|
|
//Check if silo has been checked before |
|
470
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
471
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
472
|
|
|
continue 2; |
|
473
|
|
|
} |
|
474
|
|
|
$gooVolume = 1; |
|
475
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
476
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
477
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
478
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
479
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
480
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
481
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
482
|
|
|
continue 2; |
|
483
|
|
|
} |
|
484
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
485
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
486
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
487
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
488
|
|
|
// Send the msg to the channel; |
|
489
|
|
|
$channelID = $this->toDiscordChannel; |
|
490
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
491
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
492
|
|
|
$siloCount++; |
|
493
|
|
|
} |
|
494
|
|
|
break; |
|
495
|
|
View Code Duplication |
case 16644: |
|
|
|
|
|
|
496
|
|
|
$typeName = apiTypeName(16644); |
|
497
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
498
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
499
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
500
|
|
|
$siloID = $structures->attributes()->itemID; |
|
501
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
502
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
503
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
504
|
|
|
//Check if silo has been checked before |
|
505
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
506
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
507
|
|
|
continue 2; |
|
508
|
|
|
} |
|
509
|
|
|
$gooVolume = 1; |
|
510
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
511
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
512
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
513
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
514
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
515
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
516
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
517
|
|
|
continue 2; |
|
518
|
|
|
} |
|
519
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
520
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
521
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
522
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
523
|
|
|
// Send the msg to the channel; |
|
524
|
|
|
$channelID = $this->toDiscordChannel; |
|
525
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
526
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
527
|
|
|
$siloCount++; |
|
528
|
|
|
} |
|
529
|
|
|
break; |
|
530
|
|
View Code Duplication |
case 16652: |
|
|
|
|
|
|
531
|
|
|
$typeName = apiTypeName(16652); |
|
532
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
533
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
534
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
535
|
|
|
$siloID = $structures->attributes()->itemID; |
|
536
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
537
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
538
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
539
|
|
|
//Check if silo has been checked before |
|
540
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
541
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
542
|
|
|
continue 2; |
|
543
|
|
|
} |
|
544
|
|
|
$gooVolume = 1; |
|
545
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
546
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
547
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
548
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
549
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
550
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
551
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
552
|
|
|
continue 2; |
|
553
|
|
|
} |
|
554
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
555
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
556
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
557
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
558
|
|
|
// Send the msg to the channel; |
|
559
|
|
|
$channelID = $this->toDiscordChannel; |
|
560
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
561
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
562
|
|
|
$siloCount++; |
|
563
|
|
|
} |
|
564
|
|
|
break; |
|
565
|
|
View Code Duplication |
case 16639: |
|
|
|
|
|
|
566
|
|
|
$typeName = apiTypeName(16639); |
|
567
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
568
|
|
|
$towerWarn = 45000 + (45000 * $towerMulti); |
|
569
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
570
|
|
|
$siloID = $structures->attributes()->itemID; |
|
571
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
572
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
573
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
574
|
|
|
//Check if silo has been checked before |
|
575
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
576
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
577
|
|
|
continue 2; |
|
578
|
|
|
} |
|
579
|
|
|
$gooVolume = 0.4; |
|
580
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
581
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
582
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
583
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
584
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
585
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
586
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
587
|
|
|
continue 2; |
|
588
|
|
|
} |
|
589
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
590
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
591
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
592
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
593
|
|
|
// Send the msg to the channel; |
|
594
|
|
|
$channelID = $this->toDiscordChannel; |
|
595
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
596
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
597
|
|
|
$siloCount++; |
|
598
|
|
|
} |
|
599
|
|
|
break; |
|
600
|
|
View Code Duplication |
case 16636: |
|
|
|
|
|
|
601
|
|
|
$typeName = apiTypeName(16636); |
|
602
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
603
|
|
|
$towerWarn = 180000 + (180000 * $towerMulti); |
|
604
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
605
|
|
|
$siloID = $structures->attributes()->itemID; |
|
606
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
607
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
608
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
609
|
|
|
//Check if silo has been checked before |
|
610
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
611
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
612
|
|
|
continue 2; |
|
613
|
|
|
} |
|
614
|
|
|
$gooVolume = 0.1; |
|
615
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
616
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
617
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
618
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
619
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
620
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
621
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
622
|
|
|
continue 2; |
|
623
|
|
|
} |
|
624
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
625
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
626
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
627
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
628
|
|
|
// Send the msg to the channel; |
|
629
|
|
|
$channelID = $this->toDiscordChannel; |
|
630
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
631
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
632
|
|
|
$siloCount++; |
|
633
|
|
|
} |
|
634
|
|
|
break; |
|
635
|
|
View Code Duplication |
case 16649: |
|
|
|
|
|
|
636
|
|
|
$typeName = apiTypeName(16649); |
|
637
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
638
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
639
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
640
|
|
|
$siloID = $structures->attributes()->itemID; |
|
641
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
642
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
643
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
644
|
|
|
//Check if silo has been checked before |
|
645
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
646
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
647
|
|
|
continue 2; |
|
648
|
|
|
} |
|
649
|
|
|
$gooVolume = 1; |
|
650
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
651
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
652
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
653
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
654
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
655
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
656
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
657
|
|
|
continue 2; |
|
658
|
|
|
} |
|
659
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
660
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
661
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
662
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
663
|
|
|
// Send the msg to the channel; |
|
664
|
|
|
$channelID = $this->toDiscordChannel; |
|
665
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
666
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
667
|
|
|
$siloCount++; |
|
668
|
|
|
} |
|
669
|
|
|
break; |
|
670
|
|
View Code Duplication |
case 16653: |
|
|
|
|
|
|
671
|
|
|
$typeName = apiTypeName(16653); |
|
672
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
673
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
674
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
675
|
|
|
$siloID = $structures->attributes()->itemID; |
|
676
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
677
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
678
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
679
|
|
|
//Check if silo has been checked before |
|
680
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
681
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
682
|
|
|
continue 2; |
|
683
|
|
|
} |
|
684
|
|
|
$gooVolume = 1; |
|
685
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
686
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
687
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
688
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
689
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
690
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
691
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
692
|
|
|
continue 2; |
|
693
|
|
|
} |
|
694
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
695
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
696
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
697
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
698
|
|
|
// Send the msg to the channel; |
|
699
|
|
|
$channelID = $this->toDiscordChannel; |
|
700
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
701
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
702
|
|
|
$siloCount++; |
|
703
|
|
|
} |
|
704
|
|
|
break; |
|
705
|
|
View Code Duplication |
case 16638: |
|
|
|
|
|
|
706
|
|
|
$typeName = apiTypeName(16638); |
|
707
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
708
|
|
|
$towerWarn = 45000 + (45000 * $towerMulti); |
|
709
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
710
|
|
|
$siloID = $structures->attributes()->itemID; |
|
711
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
712
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
713
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
714
|
|
|
//Check if silo has been checked before |
|
715
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
716
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
717
|
|
|
continue 2; |
|
718
|
|
|
} |
|
719
|
|
|
$gooVolume = 0.4; |
|
720
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
721
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
722
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
723
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
724
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
725
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
726
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
727
|
|
|
continue 2; |
|
728
|
|
|
} |
|
729
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
730
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
731
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
732
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
733
|
|
|
// Send the msg to the channel; |
|
734
|
|
|
$channelID = $this->toDiscordChannel; |
|
735
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
736
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
737
|
|
|
$siloCount++; |
|
738
|
|
|
} |
|
739
|
|
|
break; |
|
740
|
|
View Code Duplication |
case 16637: |
|
|
|
|
|
|
741
|
|
|
$typeName = apiTypeName(16637); |
|
742
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
743
|
|
|
$towerWarn = 45000 + (45000 * $towerMulti); |
|
744
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
745
|
|
|
$siloID = $structures->attributes()->itemID; |
|
746
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
747
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
748
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
749
|
|
|
//Check if silo has been checked before |
|
750
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
751
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
752
|
|
|
continue 2; |
|
753
|
|
|
} |
|
754
|
|
|
$gooVolume = 0.4; |
|
755
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
756
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
757
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
758
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
759
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
760
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
761
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
762
|
|
|
continue 2; |
|
763
|
|
|
} |
|
764
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
765
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
766
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
767
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
768
|
|
|
// Send the msg to the channel; |
|
769
|
|
|
$channelID = $this->toDiscordChannel; |
|
770
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
771
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
772
|
|
|
$siloCount++; |
|
773
|
|
|
} |
|
774
|
|
|
break; |
|
775
|
|
View Code Duplication |
case 16642: |
|
|
|
|
|
|
776
|
|
|
$typeName = apiTypeName(16642); |
|
777
|
|
|
$systemName = systemName($structures->attributes()->locationID); |
|
778
|
|
|
$towerWarn = 18000 + (18000 * $towerMulti); |
|
779
|
|
|
if ($silo->attributes()->quantity >= $towerWarn) { |
|
780
|
|
|
$siloID = $structures->attributes()->itemID; |
|
781
|
|
|
$lastAmount = getPermCache("silo{$siloID}Amount"); |
|
782
|
|
|
$gooAmount = $silo->attributes()->quantity; |
|
783
|
|
|
$gooDifference = $gooAmount - $lastAmount; |
|
784
|
|
|
//Check if silo has been checked before, and if it's an input silo ignore |
|
785
|
|
|
if (!isset($lastAmount) || $gooDifference < 0) { |
|
786
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
787
|
|
|
continue 2; |
|
788
|
|
|
} |
|
789
|
|
|
$gooVolume = 1; |
|
790
|
|
|
$gooCurrent = $gooAmount * $gooVolume; |
|
791
|
|
|
$cleanNumber = number_format($gooCurrent); |
|
792
|
|
|
$msg = "**{$typeName} Silo Nearing Capacity**\n"; |
|
793
|
|
|
if ($gooCurrent === $towerFull && $lastAmount === $gooCurrent) { |
|
|
|
|
|
|
794
|
|
|
$msg = "**{$typeName} Silo Full**\n"; |
|
795
|
|
|
} elseif ($gooCurrent === $towerFull && $lastAmount !== $gooCurrent) { |
|
|
|
|
|
|
796
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
797
|
|
|
continue 2; |
|
798
|
|
|
} |
|
799
|
|
|
setPermCache("silo{$siloID}Amount", $gooAmount); |
|
800
|
|
|
$msg .= "**System: **{$systemName}\n"; |
|
801
|
|
|
$msg .= "**Capacity: **{$cleanNumber}/{$cleanFull}m3\n"; |
|
802
|
|
|
$this->logger->addInfo("siloFull: {$typeName} Silo nearing capacity in {$systemName}"); |
|
803
|
|
|
// Send the msg to the channel; |
|
804
|
|
|
$channelID = $this->toDiscordChannel; |
|
805
|
|
|
queueMessage($msg, $channelID, $this->guild); |
|
806
|
|
|
$this->logger->addInfo('siloFull: Silo Alert queued'); |
|
807
|
|
|
$siloCount++; |
|
808
|
|
|
} |
|
809
|
|
|
break; |
|
810
|
|
|
} |
|
811
|
|
|
} |
|
812
|
|
|
} |
|
813
|
|
|
} |
|
814
|
|
|
} |
|
815
|
|
|
$cached = $xml->cachedUntil[0]; |
|
816
|
|
|
$baseUnix = strtotime($cached); |
|
817
|
|
|
$cacheClr = $baseUnix - 13500; |
|
818
|
|
View Code Duplication |
if ($cacheClr <= time()) { |
|
|
|
|
|
|
819
|
|
|
$weirdTime = time() + 21700; |
|
820
|
|
|
$cacheTimer = gmdate('Y-m-d H:i:s', $weirdTime); |
|
821
|
|
|
setPermCache("siloLastChecked{$keyID}", $weirdTime); |
|
822
|
|
|
} else { |
|
823
|
|
|
$cacheTimer = gmdate('Y-m-d H:i:s', $cacheClr); |
|
824
|
|
|
setPermCache("siloLastChecked{$keyID}", $cacheClr); |
|
825
|
|
|
} |
|
826
|
|
|
$this->logger->addInfo("siloFull: Silo Check Complete Next Check At {$cacheTimer}"); |
|
827
|
|
|
return null; |
|
828
|
|
|
} |
|
829
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.