渔民小镇 пре 1 година
родитељ
комит
0eb28344c8

+ 5 - 4
one-client/src/main/java/com/iohao/mmo/client/common/item/ItemNode.java → one-client/src/main/java/com/iohao/mmo/client/common/item/InternalItemTypeConfig.java

@@ -19,10 +19,11 @@
 package com.iohao.mmo.client.common.item;
 
 /**
- * @param itemTypeId 物品 id
- * @param quantity   物品数量
+ * @param itemTypeId  物品类型 id
+ * @param name        物品名
+ * @param description 物品描述
  * @author 渔民小镇
- * @date 2023-08-15
+ * @date 2023-08-22
  */
-public record ItemNode(String itemTypeId, int quantity) {
+record InternalItemTypeConfig(String itemTypeId, String name, String description) {
 }

+ 4 - 5
one-client/src/main/java/com/iohao/mmo/client/common/item/ItemTypeNode.java

@@ -19,11 +19,10 @@
 package com.iohao.mmo.client.common.item;
 
 /**
- * @param itemTypeId  物品类型 id
- * @param name        物品名
- * @param description 物品描述
+ * @param itemTypeId 物品 id
+ * @param quantity   物品数量
  * @author 渔民小镇
- * @date 2023-08-22
+ * @date 2023-08-15
  */
-record ItemTypeNode(String itemTypeId, String name, String description) {
+public record ItemTypeNode(String itemTypeId, int quantity) {
 }

+ 5 - 5
one-client/src/main/java/com/iohao/mmo/client/common/item/ItemTypeNodeKit.java

@@ -33,21 +33,21 @@ import java.util.Map;
  */
 @UtilityClass
 public class ItemTypeNodeKit {
-    final Map<String, ItemTypeNode> map = new HashMap<>();
+    final Map<String, InternalItemTypeConfig> map = new HashMap<>();
 
     public void add(String itemTypeId, String name, String description) {
-        var itemTypeNode = new ItemTypeNode(itemTypeId, name, description);
+        var itemTypeNode = new InternalItemTypeConfig(itemTypeId, name, description);
 
         map.put(itemTypeId, itemTypeNode);
     }
 
-    public String toString(ItemNode itemNode) {
-        var node = map.get(itemNode.itemTypeId());
+    public String toString(ItemTypeNode itemTypeNode) {
+        var node = map.get(itemTypeNode.itemTypeId());
         String line = "\n物品信息:[%s x %s];物品描述:%s";
 
         return String.format(line
                 , node.name()
-                , itemNode.quantity()
+                , itemTypeNode.quantity()
                 , node.description()
         );
     }

+ 3 - 3
one-client/src/main/java/com/iohao/mmo/client/input/CommonInputCommandRegion.java

@@ -22,7 +22,7 @@ import com.iohao.game.action.skeleton.protocol.wrapper.ByteValueList;
 import com.iohao.game.external.client.AbstractInputCommandRegion;
 import com.iohao.mmo.common.provide.cmd.CommonCmd;
 import com.iohao.mmo.client.common.item.ItemTypeNodeKit;
-import com.iohao.mmo.client.common.item.ItemNode;
+import com.iohao.mmo.client.common.item.ItemTypeNode;
 import com.iohao.mmo.common.provide.proto.ShowItemMessage;
 import lombok.extern.slf4j.Slf4j;
 
@@ -51,7 +51,7 @@ public class CommonInputCommandRegion extends AbstractInputCommandRegion {
         }, CommonCmd.broadcastShowItem, "获得新物品");
     }
 
-    ItemNode convert(ShowItemMessage showItemMessage) {
-        return new ItemNode(showItemMessage.itemTypeId, showItemMessage.quantity);
+    ItemTypeNode convert(ShowItemMessage showItemMessage) {
+        return new ItemTypeNode(showItemMessage.itemTypeId, showItemMessage.quantity);
     }
 }

+ 3 - 3
one-client/src/main/java/com/iohao/mmo/client/input/MailInputCommandRegion.java

@@ -27,7 +27,7 @@ import com.iohao.game.external.client.AbstractInputCommandRegion;
 import com.iohao.game.external.client.kit.ScannerKit;
 import com.iohao.mmo.bag.ItemTypeIdConst;
 import com.iohao.mmo.client.common.item.ItemTypeNodeKit;
-import com.iohao.mmo.client.common.item.ItemNode;
+import com.iohao.mmo.client.common.item.ItemTypeNode;
 import com.iohao.mmo.mail.cmd.MailCmd;
 import com.iohao.mmo.mail.kit.InternalMailBuilder;
 import com.iohao.mmo.mail.proto.InternalMailMessage;
@@ -142,8 +142,8 @@ public class MailInputCommandRegion extends AbstractInputCommandRegion {
             arguments = list.toArray();
         }
 
-        ItemNode convert(MailAttachmentMessage attachmentMessage) {
-            return new ItemNode(attachmentMessage.itemTypeId, attachmentMessage.quantity);
+        ItemTypeNode convert(MailAttachmentMessage attachmentMessage) {
+            return new ItemTypeNode(attachmentMessage.itemTypeId, attachmentMessage.quantity);
         }
     }
 }