-
Notifications
You must be signed in to change notification settings - Fork 7
/
getah.php
73 lines (67 loc) · 2.83 KB
/
getah.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
<?php
require("include/html.inc");
function romanic_number($integer, $upcase = true) {
$table = array('M'=>1000, 'CM'=>900, 'D'=>500, 'CD'=>400, 'C'=>100, 'XC'=>90, 'L'=>50, 'XL'=>40, 'X'=>10, 'IX'=>9, 'V'=>5, 'IV'=>4, 'I'=>1);
$return = '';
while($integer > 0) {
foreach($table as $rom=>$arb) {
if($integer >= $arb) {
$integer -= $arb;
$return .= $rom;
break;
}
}
}
return $return;
}
$compiled = array();
if (isset($_GET['id'])) {
$ahid = $_GET['id'];
$compiled["category"] = $ahid;
$sql = "SELECT itemid, name, stackSize FROM `item_basic` WHERE aH = ".$_GET['id']." ORDER BY name";
$tmp = mysqli_query($dcon, $sql);
$items = array();
$count = 0;
while($item = $tmp->fetch_assoc()) {
$items[$count]["itemid"] = intval($item["itemid"]);
$name = ucwords(sqlQuery("SELECT realname FROM `item_info` WHERE itemid = ".$item["itemid"])["realname"]);
/*$name = str_replace("_", " ", $item["name"]);
$name = mb_eregi_replace('\bM{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})\b', "strtoupper('\\0')", $name, 'e');*/
$name = str_replace("The", "the", str_replace("Of", "of", $name));
$items[$count]["itemname"] = $name;
$items[$count]["stack"] = intval($item["stackSize"]);
$level = intval(sqlQuery("SELECT level FROM `item_armor` WHERE itemId = ".$item["itemid"])["level"]);
if (!isset($level))
$level = 0;
$items[$count]["level"] = $level;
$stacked = 0;
if (intval($item["stackSize"]) > 1) {
$stacked = 1;
$stackedprice = sqlQuery("SELECT price FROM `auction_house` WHERE itemid = ".$item["itemid"]." AND seller_name = 'DarkStar' AND buyer_name = 'DarkStar' AND stack = ".$stacked)["price"];
$stackedinstock = sqlQuery("SELECT COUNT(*) FROM `auction_house` WHERE itemid = ".$item["itemid"]." AND seller_name = 'DarkStar' AND buyer_name IS NULL AND stack = 1")["COUNT(*)"];
$items[$count]["stackedinstock"] = $stackedinstock;
if (!isset($stackedprice))
$stackedprice = "0";
$items[$count]["stackedprice"] = number_format($stackedprice);
}
$price = sqlQuery("SELECT price FROM `auction_house` WHERE itemid = ".$item["itemid"]." AND seller_name = 'DarkStar' AND buyer_name = 'DarkStar' AND stack = 0")["price"];
if (!isset($price))
$price = "0";
$items[$count]["price"] = number_format($price);
$instock = sqlQuery("SELECT COUNT(*) FROM `auction_house` WHERE itemid = ".$item["itemid"]." AND seller_name = 'DarkStar' AND buyer_name IS NULL AND stack = 0")["COUNT(*)"];
$items[$count]["instock"] = $instock;
$weapon = sqlQuery("SELECT * FROM `item_weapon` WHERE itemid = ".$item["itemid"]);
$dps = 0;
if ($weapon != null) {
$itemdelay = $weapon["delay"];
$itemdmg = $weapon["dmg"];
$dps = round(($itemdmg * 60 / ($itemdelay) * 100), 2);
}
$items[$count]["dps"] = $dps;
$count++;
}
$compiled["items"] = $items;
}
$json = json_encode($compiled);
echo $json;
?>