-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfindUniqueItems.php
122 lines (100 loc) · 2.43 KB
/
findUniqueItems.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
<?php
if (php_sapi_name() != "cli") die("Can only be run from command line!");
require("/home/uesp/secrets/esolog.secrets");
require("esoCommon.php");
$db = new mysqli($uespEsoLogReadDBHost, $uespEsoLogReadUser, $uespEsoLogReadPW, $uespEsoLogDatabase);
if ($db->connect_error) exit("Could not connect to mysql database!");
$VERSION = "";
$items = [];
$result = $db->query("SELECT * FROM minedItemSummary$VERSION WHERE type=1 or type=2;");
if ($result === false) exit("Failed to query minedItemSummary$VERSION table!");
while ($item = $result->fetch_assoc())
{
$id = intval($item['itemId']);
$items[$id] = $item;
}
$count = count($items);
print("Loaded $count armor and weapon records!\n");
function getItemTypeNames($item)
{
$ITEMWEAPONTYPE_TEXTS = array(
1 => "Axe",
2 => "Hammer",
3 => "Sword",
4 => "Greatsword",
5 => "Battle Axe",
6 => "Maul",
8 => "Bow",
9 => "Restoration Staff",
11 => "Dagger",
12 => "Inferno Staff",
13 => "Frost Staff",
14 => "Shield",
15 => "Lightning Staff",
);
$ITEMARMORTYPE_TEXTS = array(
1 => array(
1 => "Hat",
2 => "Necklace",
3 => "Shirt", //Robe
4 => "Epaulets",
8 => "Sash",
9 => "Breeches",
10 => "Shoes",
12 => "Ring",
13 => "Gloves",
),
2 => array(
1 => "Helmet",
2 => "Neckace",
3 => "Jack",
4 => "Arm Cops",
8 => "Belt",
9 => "Guards",
10 => "Boots",
12 => "Ring",
13 => "Bracers",
),
3 => array(
1 => "Helm",
2 => "Necklace",
3 => "Cuirass",
4 => "Pauldron",
8 => "Girdle",
9 => "Greaves",
10 => "Sabatons",
12 => "Ring",
13 => "Gauntlets",
),
);
$type = intval($item['type']);
$weaponType = intval($item['weaponType']);
$armorType = intval($item['armorType']);
$equipType = intval($item['equipType']);
if ($type == 1)
{
$typeName = $ITEMWEAPONTYPE_TEXTS[$weaponType];
if ($typeName == null) return "";
return $typeName;
}
elseif ($type == 2)
{
$typeNames = $ITEMARMORTYPE_TEXTS[$armorType];
if ($typeNames == null) return "";
$typeName = $typeNames[$equipType];
if ($typeName == null) return "";
return $typeName;
}
return "";
}
print("TODO...\n");
foreach ($items as $itemId => $item)
{
$name = $item['name'];
$set = $item['setName'];
$weaponType = $item['weaponType'];
$armorType = $item['armorType'];
$equipType = $item['equipType'];
$typeName = getItemTypeNames($item);
if (preg_match('', $name)) continue;
}