Much quicker item parser (335 items in 12ms instead of 2100ms)

Now checking if character is offline before changing gender.
Restructured Admin_shop.php, it will now show pending orders and the whole transaction log.
This commit is contained in:
Stefan Brannfjell
2014-06-17 02:35:48 +02:00
parent 52721610c4
commit d3807bfafe
6 changed files with 116 additions and 74 deletions

View File

@@ -16,6 +16,20 @@ function getItemNameById($id) {
}
}
/* Returns a PHP array $id => 'name'
$items = getItemList();
echo $items[2160]; // Returns 'Crystal Coin'
*/
function getItemList() {
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
$ia = array();
for ($i = 0; $i < count($item_list) - 1; $i++) {
$it = explode('@', $item_list[$i]);
$ia[(int)$it[0]] = ucfirst($it[1]);
}
return $ia;
}
function getItemIdByName($name) {
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));