|
@@ -18,17 +18,17 @@
|
|
|
*/
|
|
|
package com.iohao.mmo.bag.client;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.iohao.game.action.skeleton.protocol.wrapper.BoolValue;
|
|
|
import com.iohao.game.external.client.AbstractInputCommandRegion;
|
|
|
import com.iohao.game.external.client.command.InputRequestData;
|
|
|
import com.iohao.game.external.client.kit.ScannerKit;
|
|
|
import com.iohao.game.external.client.kit.SplitParam;
|
|
|
import com.iohao.mmo.bag.ItemIdConst;
|
|
|
+import com.iohao.mmo.bag.client.ext.ClientBagAttr;
|
|
|
+import com.iohao.mmo.bag.client.ext.ItemMessageMap;
|
|
|
import com.iohao.mmo.bag.cmd.BagCmd;
|
|
|
-import com.iohao.mmo.bag.proto.BagItemMessage;
|
|
|
-import com.iohao.mmo.bag.proto.BagMessage;
|
|
|
-import com.iohao.mmo.bag.proto.UseItemMessage;
|
|
|
-import com.iohao.mmo.bag.proto.UseMessage;
|
|
|
+import com.iohao.mmo.bag.proto.*;
|
|
|
import com.iohao.mmo.common.provide.kit.JsonKit;
|
|
|
import com.iohao.mmo.common.snow.SnowKit;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -57,13 +57,13 @@ public class BagInputCommandRegion extends AbstractInputCommandRegion {
|
|
|
ofRequestCommand(BagCmd.incrementItem).request(bagItemMessage);
|
|
|
|
|
|
// 添加一些装备制造书材料
|
|
|
- bagItemMessage = BagInternalHelper.ofBagItemMessage(ItemIdConst.equipWeaponBook_10);
|
|
|
+ bagItemMessage = BagInternalHelper.ofBagItemMessage(ItemIdConst.equipWeaponBook10);
|
|
|
bagItemMessage.quantity = 1;
|
|
|
log.info("添加 {} 【装备-武器】制造书材料 {}", bagItemMessage.quantity, bagItemMessage);
|
|
|
ofRequestCommand(BagCmd.incrementItem).request(bagItemMessage);
|
|
|
|
|
|
// 添加一些装备制造书材料
|
|
|
- bagItemMessage = BagInternalHelper.ofBagItemMessage(ItemIdConst.iron_10);
|
|
|
+ bagItemMessage = BagInternalHelper.ofBagItemMessage(ItemIdConst.iron10);
|
|
|
bagItemMessage.quantity = 1;
|
|
|
log.info("添加 {} 装备-制造材料-铁 {}", bagItemMessage.quantity, bagItemMessage);
|
|
|
ofRequestCommand(BagCmd.incrementItem).request(bagItemMessage);
|
|
@@ -71,8 +71,18 @@ public class BagInputCommandRegion extends AbstractInputCommandRegion {
|
|
|
|
|
|
private void request() {
|
|
|
ofCommand(BagCmd.bag).callback(BagMessage.class, result -> {
|
|
|
+ ItemMessageMap itemMessageMap = clientUser.option(ClientBagAttr.itemMessageMapAttrOption);
|
|
|
+
|
|
|
BagMessage value = result.getValue();
|
|
|
- log.info("{}", JsonKit.toJsonString(value));
|
|
|
+
|
|
|
+ List<JSONObject> list = value.itemMap.values().stream().map(bagItemMessage -> {
|
|
|
+ String itemId = bagItemMessage.itemId;
|
|
|
+ JSONObject bagItemMessageJson = JSONObject.from(bagItemMessage);
|
|
|
+ JSONObject itemMessageJson = itemMessageMap.getItemMessageJSON(itemId);
|
|
|
+ return JsonKit.merge(bagItemMessageJson, itemMessageJson);
|
|
|
+ }).toList();
|
|
|
+
|
|
|
+ log.info("查询玩家背包 {}", JsonKit.toJsonString(list));
|
|
|
}).setDescription("查询玩家背包");
|
|
|
|
|
|
InputRequestData inputRequestData = () -> {
|
|
@@ -161,15 +171,15 @@ public class BagInputCommandRegion extends AbstractInputCommandRegion {
|
|
|
log.info("格式 [制造书物品id-制造铁物品id]");
|
|
|
});
|
|
|
|
|
|
- String defaultValue = ItemIdConst.equipWeaponBook_10 + "-" + ItemIdConst.iron_10;
|
|
|
+ String defaultValue = ItemIdConst.equipWeaponBook10 + "-" + ItemIdConst.iron10;
|
|
|
String inputType = defaultValue;
|
|
|
// inputType = ScannerKit.nextLine(defaultValue);
|
|
|
SplitParam param = new SplitParam(inputType);
|
|
|
|
|
|
- String equipWeaponBook = param.getString(0, ItemIdConst.equipWeaponBook_10);
|
|
|
+ String equipWeaponBook = param.getString(0, ItemIdConst.equipWeaponBook10);
|
|
|
UseItemMessage useItemMessageEquip = BagInternalHelper.ofUseItemMessage(equipWeaponBook);
|
|
|
|
|
|
- String iron = param.getString(1, ItemIdConst.iron_10);
|
|
|
+ String iron = param.getString(1, ItemIdConst.iron10);
|
|
|
UseItemMessage useItemMessageIron = BagInternalHelper.ofUseItemMessage(iron);
|
|
|
|
|
|
return List.of(useItemMessageEquip, useItemMessageIron);
|