game2005api/webapp/mt/Item.php
2021-11-22 13:31:53 +08:00

41 lines
829 B
PHP

<?php
namespace mt;
use phpcommon;
class Item {
public static function get($id)
{
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
}
public static function getOldItem($id)
{
$meta = self::get($id);
if (!$meta) {
return null;
}
$item = array();
foreach ($meta as $key => $val) {
$item[$key] = $val;
}
$item['type'] = $item['fuction'];
$item['price'] = $item['gold'];
$item['dprice'] = $item['diamond_price'];
return $item;
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('item@item.php');
}
return self::$metaList;
}
protected static $metaList;
}