diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index d0086c17..359cf096 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -28,8 +28,13 @@ class BagController extends BaseAuthedController { public function itemList() { + $itemList = Bag::all(); + $itemDtoList = array(); + foreach ($itemList as $item) { + array_push($itemDtoList, Bag::toDto($item)); + } $this->_rspData(array( - 'item_list' => Bag::all(), + 'item_list' => $itemDtoList, )); } diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index fc425d62..b048e357 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -154,7 +154,7 @@ class GunController extends BaseAuthedController { ) ); } - Break; + break; case V_ITEM_DIAMOND: { $costItems = array( @@ -178,7 +178,7 @@ class GunController extends BaseAuthedController { return; } $baseAttrs = mt\Item::getBaseAttrs($itemMeta); - $baseAttrs = mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs()); + mt\AttrHelper::mergeAttr($baseAttrs, Bag::getAttrs()); $attrs = emptyReplace(json_decode($gunDb['rand_attr'], true), array()); $ret = mt\GunLevel::addRandAttr($nextLevelMeta, $baseAttrs, $attrs); if (!$ret) { diff --git a/webapp/models/Bag.php b/webapp/models/Bag.php index f8f83cb8..bc834406 100644 --- a/webapp/models/Bag.php +++ b/webapp/models/Bag.php @@ -64,7 +64,7 @@ class Bag extends BaseModel { ), function ($row) use(&$itemList) { if ($row['item_num'] > 0) { - array_push($itemList, Bag::toDto($row)); + array_push($itemList, $row); } } ); @@ -76,8 +76,8 @@ class Bag extends BaseModel { $items = self::all(); $attrs = array(); foreach ($items as $item) { - $dbAttrs = emptyReplace(json_decode($row['rand_attr'], true), array()); - mt\mergeAttr($attrs, $dbAttrs); + $dbAttrs = emptyReplace(json_decode($item['rand_attr'], true), array()); + mt\AttrHelper::mergeAttr($attrs, $dbAttrs); } return $attrs; } diff --git a/webapp/mt/GunLevel.php b/webapp/mt/GunLevel.php index b119f508..5bcc55e7 100644 --- a/webapp/mt/GunLevel.php +++ b/webapp/mt/GunLevel.php @@ -20,7 +20,7 @@ class GunLevel { return getXVal(self::$qualityLevelHash, $quality . '_' . $level, null); } - public static function addRandAttr($levelMeta, $baseAttrs, &$attrs) + public static function addRandAttr($levelMeta, $baseAttrs, &$dbAttrs) { $nums = explode(':', $levelMeta['rand_attrs_num']); $num = rand($nums[0], $nums[1]);