|
1
|
|
|
<?php |
|
2
|
|
|
/* zKillboard |
|
3
|
|
|
* Copyright (C) 2012-2015 EVE-KILL Team and EVSCO. |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU Affero General Public License as published by |
|
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
8
|
|
|
* (at your option) any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
* GNU Affero General Public License for more details. |
|
14
|
|
|
* |
|
15
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
16
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17
|
|
|
*/ |
|
18
|
|
|
class Fitting |
|
19
|
|
|
{ |
|
20
|
|
|
public static function EFT($array) |
|
21
|
|
|
{ |
|
22
|
|
|
$eft = ""; |
|
23
|
|
|
$item = ""; |
|
24
|
|
|
if (isset($array["low"])) foreach ($array["low"] as $flags) |
|
25
|
|
|
{ |
|
26
|
|
|
foreach ($flags as $items) |
|
27
|
|
|
{ |
|
28
|
|
|
$item = $items["typeName"] . "\n"; |
|
29
|
|
|
} |
|
30
|
|
|
$eft .= $item; |
|
31
|
|
|
} |
|
32
|
|
|
$eft .= "\n"; |
|
33
|
|
|
$item = ""; |
|
34
|
|
|
if (isset($array["mid"])) foreach ($array["mid"] as $flags) |
|
35
|
|
|
{ |
|
36
|
|
|
$cnt = 0; |
|
37
|
|
|
foreach ($flags as $items) |
|
38
|
|
|
{ |
|
39
|
|
|
if ($cnt == 0) |
|
40
|
|
|
$item = $items["typeName"]; |
|
41
|
|
|
else |
|
42
|
|
|
$item .= "," . $items["typeName"]; |
|
43
|
|
|
$cnt++; |
|
44
|
|
|
} |
|
45
|
|
|
$item .= "\n"; |
|
46
|
|
|
$eft .= $item; |
|
47
|
|
|
} |
|
48
|
|
|
$eft .= "\n"; |
|
49
|
|
|
$item = ""; |
|
50
|
|
|
if (isset($array["high"])) foreach ($array["high"] as $flags) |
|
51
|
|
|
{ |
|
52
|
|
|
$cnt = 0; |
|
53
|
|
|
foreach ($flags as $items) |
|
54
|
|
|
{ |
|
55
|
|
|
if ($cnt == 0) |
|
56
|
|
|
$item = $items["typeName"]; |
|
57
|
|
|
else |
|
58
|
|
|
$item .= "," . $items["typeName"]; |
|
59
|
|
|
$cnt++; |
|
60
|
|
|
} |
|
61
|
|
|
$item .= "\n"; |
|
62
|
|
|
$eft .= $item; |
|
63
|
|
|
} |
|
64
|
|
|
$eft .= "\n"; |
|
65
|
|
|
$item = ""; |
|
66
|
|
|
if (isset($array["rig"])) foreach ($array["rig"] as $flags) |
|
67
|
|
|
{ |
|
68
|
|
|
foreach ($flags as $items) |
|
69
|
|
|
{ |
|
70
|
|
|
$item = $items["typeName"] . "\n"; |
|
71
|
|
|
} |
|
72
|
|
|
$eft .= $item; |
|
73
|
|
|
} |
|
74
|
|
|
$eft .= "\n"; |
|
75
|
|
|
$item = ""; |
|
76
|
|
|
if (isset($array["sub"])) foreach ($array["sub"] as $flags) |
|
77
|
|
|
{ |
|
78
|
|
|
foreach ($flags as $items) |
|
79
|
|
|
{ |
|
80
|
|
|
$item = $items["typeName"] . "\n"; |
|
81
|
|
|
} |
|
82
|
|
|
$eft .= $item; |
|
83
|
|
|
} |
|
84
|
|
|
$eft .= "\n"; |
|
85
|
|
|
$item = ""; |
|
86
|
|
|
if (isset($array["drone"])) foreach ($array["drone"] as $flags) |
|
87
|
|
|
{ |
|
88
|
|
|
foreach ($flags as $items) |
|
89
|
|
|
{ |
|
90
|
|
|
$item .= $items["typeName"] . " x" . $items["qty"] . "\n"; |
|
91
|
|
|
} |
|
92
|
|
|
$eft .= $item; |
|
93
|
|
|
} |
|
94
|
|
|
return trim($eft); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public static function DNA($array = array(), $ship) |
|
98
|
|
|
{ |
|
99
|
|
|
$goodspots = array("High Slots", "SubSystems", "Rigs", "Low Slots", "Mid Slots", "Drone Bay", "Fuel Bay"); |
|
100
|
|
|
$fitArray = array(); |
|
101
|
|
|
$fitString = $ship.":"; |
|
102
|
|
|
|
|
103
|
|
|
foreach($array as $item) |
|
104
|
|
|
{ |
|
105
|
|
|
if (isset($item["flagName"]) && in_array($item["flagName"], $goodspots)) |
|
106
|
|
|
{ |
|
107
|
|
|
if(isset($fitArray[$item["typeID"]])) |
|
108
|
|
|
$fitArray[$item["typeID"]]["count"] = $fitArray[$item["typeID"]]["count"] + ($item["qtyDropped"] + $item["qtyDestroyed"]); |
|
109
|
|
|
else |
|
110
|
|
|
$fitArray[$item["typeID"]] = array("count" => ($item["qtyDropped"] + $item["qtyDestroyed"])); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
foreach($fitArray as $key => $item) |
|
115
|
|
|
{ |
|
116
|
|
|
$fitString .= "$key;".$item["count"].":"; |
|
117
|
|
|
} |
|
118
|
|
|
$fitString .= ":"; |
|
119
|
|
|
return $fitString; |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
|