|
@@ -79,14 +79,55 @@ class StoreProc {
|
|
|
return self::buyWeapon();
|
|
|
case CmdCode::map_getShopWeapon: # 6430
|
|
|
return self::getShopWeapon();
|
|
|
-
|
|
|
case CmdCode::map_buySupplies: #6431 购买补给品
|
|
|
return self::buySupplies();
|
|
|
-
|
|
|
+ case CmdCode::map_expandStorage: # 6432
|
|
|
+ return self::expandStorage();
|
|
|
+ case CmdCode::map_changeStorage: # 6433
|
|
|
+ return self::changeStorage();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 6432
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public static function changeStorage() {
|
|
|
+ $type = req()->paras[0]; # 1:放入 2移除到背包
|
|
|
+ $index = req()->paras[1]; #放入第几个格子
|
|
|
+ $itemid = req()->paras[2]; # itemid
|
|
|
+
|
|
|
+ $store = ctx()->store(true);
|
|
|
+
|
|
|
+
|
|
|
+ ctx()->store(true)->storage->$key = array();
|
|
|
+ UserProc::updateUserInfo();
|
|
|
+
|
|
|
+ return Resp::ok(array("store"=>$store,));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function expandStorage() {
|
|
|
+ $cost = GameConfig::globalsettings()->expandStorageCost;
|
|
|
+ $list = explode(',', $cost);
|
|
|
+
|
|
|
+ $key = 3;
|
|
|
+ my_Assert(StlUtil::dictHasProperty(!ctx()->store(true)->storage, $key), ErrCode::store_expandStorage);
|
|
|
+
|
|
|
+ if($list[0] == 1){
|
|
|
+ my_Assert(ctx()->base(true)->gold >= $list[1], ErrCode::notenough_gold_msg);
|
|
|
+ ctx()->base(true)->Consume_Gold($list[1]);
|
|
|
+ } elseif ($list[0] == 2) {
|
|
|
+ my_Assert(ctx()->base(true)->cash >= $list[1], ErrCode::notenough_cash_msg);
|
|
|
+ ctx()->base(true)->Consume_Cash($list[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ ctx()->store(true)->storage->$key = array();
|
|
|
+ UserProc::updateUserInfo();
|
|
|
+
|
|
|
+ return Resp::ok(array("storage"=>ctx()->store(true)->storage,));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 6431 购买补给品
|
|
@@ -100,6 +141,8 @@ class StoreProc {
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
|
|
my_Assert($num <= $mo->num, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ my_Assert(ctx()->base(true)->gold >= $mo->cost * $num, ErrCode::notenough_gold_msg);
|
|
|
|
|
|
req()->userInfo->game->base(true)->Consume_Gold($mo->cost * $num);
|
|
|
$goodsStr = $itemid . ',' . $num;
|
|
@@ -137,19 +180,17 @@ class StoreProc {
|
|
|
$type = 0;
|
|
|
|
|
|
$tag = true;
|
|
|
- if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
|
|
|
+ if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
|
|
|
$dic = $store->weaponReward->$npcid;
|
|
|
- foreach ($dic as $k => $list) {
|
|
|
- if (in_array($weaponId, $list)) {
|
|
|
+ foreach ($dic as $k => $list) {
|
|
|
+ if (in_array($weaponId, $list)) {
|
|
|
$tag = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- $tag = false;
|
|
|
}
|
|
|
|
|
|
- my_Assert($tag == false, ErrCode::store_weaponCantBuy);
|
|
|
+ my_Assert($tag == true, ErrCode::store_weaponCantBuy);
|
|
|
|
|
|
$list = GameConfig::shop_weapon_getItemArray($npcid);
|
|
|
$cost = 0;
|
|
@@ -164,7 +205,8 @@ class StoreProc {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
|
|
|
ctx()->base(true)->Consume_Gold($cost);
|
|
|
|
|
|
$store->weaponReward->$npcid->$type[] = $weaponId;
|