Bladeren bron

Merge remote-tracking branch 'origin/main' into main

# Conflicts:
#	logic/all-logic/pom.xml
#	one-application/src/main/java/com/iohao/mmo/OneApplication.java
#	one-client/src/main/java/com/iohao/mmo/client/CommonClient.java
#	pom.xml
#	provide/all-provide/pom.xml
#	provide/common-provide/src/main/java/com/iohao/mmo/common/provide/cmd/CmdModule.java
toby 1 jaar geleden
bovenliggende
commit
948ddad8d7
36 gewijzigde bestanden met toevoegingen van 1081 en 22 verwijderingen
  1. 5 2
      common/common-core/src/main/java/com/iohao/mmo/common/config/GameCode.java
  2. 4 0
      common/common-core/src/main/java/com/iohao/mmo/common/snow/SnowKit.java
  3. 1 0
      logic/a-logic-common/src/main/java/com/iohao/mmo/config/MongoConfig.java
  4. 12 2
      logic/all-logic/pom.xml
  5. 38 0
      logic/bag-logic/.gitignore
  6. 34 0
      logic/bag-logic/pom.xml
  7. 54 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/BagLogicServer.java
  8. 96 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/action/BagAction.java
  9. 42 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/entity/Bag.java
  10. 72 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/entity/BagItem.java
  11. 44 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/mapper/BagMapper.java
  12. 32 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/repository/BagRepository.java
  13. 105 0
      logic/bag-logic/src/main/java/com/iohao/mmo/bag/service/BagService.java
  14. 38 0
      logic/item-logic/.gitignore
  15. 34 0
      logic/item-logic/pom.xml
  16. 35 0
      logic/item-logic/src/main/java/com/iohao/mmo/item/action/ItemAction.java
  17. 0 7
      logic/level-logic/src/main/java/com/iohao/mmo/level/LevelLogicServer.java
  18. 2 2
      logic/level-logic/src/main/java/com/iohao/mmo/level/action/LevelAction.java
  19. 2 2
      logic/map-logic/src/main/java/com/iohao/mmo/map/action/MapAction.java
  20. 1 1
      logic/person-logic/src/main/java/com/iohao/mmo/person/action/PersonAction.java
  21. 4 0
      one-application/src/main/java/com/iohao/mmo/OneApplication.java
  22. 4 0
      one-client/src/main/java/com/iohao/mmo/client/CommonClient.java
  23. 6 2
      pom.xml
  24. 13 1
      provide/all-provide/pom.xml
  25. 38 0
      provide/bag-provide/.gitignore
  26. 27 0
      provide/bag-provide/pom.xml
  27. 102 0
      provide/bag-provide/src/main/java/com/iohao/mmo/bag/client/BagInputCommandRegion.java
  28. 42 0
      provide/bag-provide/src/main/java/com/iohao/mmo/bag/cmd/BagCmd.java
  29. 42 0
      provide/bag-provide/src/main/java/com/iohao/mmo/bag/proto/BagItemMessage.java
  30. 40 0
      provide/bag-provide/src/main/java/com/iohao/mmo/bag/proto/BagMessage.java
  31. 6 0
      provide/common-provide/pom.xml
  32. 5 1
      provide/common-provide/src/main/java/com/iohao/mmo/common/provide/cmd/CmdModule.java
  33. 38 0
      provide/item-provide/.gitignore
  34. 27 0
      provide/item-provide/pom.xml
  35. 34 0
      provide/item-provide/src/main/java/com/iohao/mmo/item/cmd/ItemCmd.java
  36. 2 2
      provide/level-provide/src/main/java/com/iohao/mmo/level/cmd/LevelCmd.java

+ 5 - 2
common/common-core/src/main/java/com/iohao/mmo/common/config/GameCode.java

@@ -32,9 +32,12 @@ import lombok.experimental.FieldDefaults;
 public enum GameCode implements MsgExceptionInfo {
 
     /** 地图不存在 */
-    MAP_NOT_EXIST(1, "地图不存在"),
+    mapNotExist(1, "地图不存在"),
     /** 升级错误,经验值不足 */
-    UP_LEVEL_ERROR(2, "升级错误,经验值不足");
+    upLevelError(2, "升级错误,经验值不足"),
+    /** 数量不足 */
+    quantityNotEnough(3, "数量不足"),
+    ;
 
     /** 消息码 */
     final int code;

+ 4 - 0
common/common-core/src/main/java/com/iohao/mmo/common/snow/SnowKit.java

@@ -41,4 +41,8 @@ public class SnowKit {
     public long next() throws IdGeneratorException {
         return idGenerator.next();
     }
+
+    public String nextToString() {
+        return String.valueOf(next());
+    }
 }

+ 1 - 0
logic/a-logic-common/src/main/java/com/iohao/mmo/config/MongoConfig.java

@@ -33,6 +33,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
  */
 @Configuration
 @EnableMongoAuditing
+//@EnableMongoRepositories
 public class MongoConfig extends AbstractMongoClientConfiguration {
 
     @Override

+ 12 - 2
logic/all-logic/pom.xml

@@ -31,7 +31,6 @@
             <version>${project.parent.version}</version>
         </dependency>
 
-
         <dependency>
             <groupId>com.iohao.mmo</groupId>
             <artifactId>map-logic</artifactId>
@@ -44,6 +43,17 @@
             <version>${project.parent.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>item-logic</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>bag-logic</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
         <dependency>
             <groupId>com.iohao.mmo</groupId>
             <artifactId>equip-logic</artifactId>
@@ -52,4 +62,4 @@
 
     </dependencies>
 
-</project>
+</project>

+ 38 - 0
logic/bag-logic/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 34 - 0
logic/bag-logic/pom.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.iohao.mmo</groupId>
+        <artifactId>game</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>bag-logic</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <!-- 游戏逻辑服通用模块 -->
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>a-logic-common</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>bag-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 54 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/BagLogicServer.java

@@ -0,0 +1,54 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag;
+
+import com.iohao.game.action.skeleton.core.BarSkeleton;
+import com.iohao.game.action.skeleton.core.BarSkeletonBuilder;
+import com.iohao.game.bolt.broker.client.AbstractBrokerClientStartup;
+import com.iohao.game.bolt.broker.core.client.BrokerClientBuilder;
+import com.iohao.mmo.bag.action.BagAction;
+import com.iohao.mmo.common.logic.server.LogicServerKit;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+public class BagLogicServer extends AbstractBrokerClientStartup {
+    @Override
+    public BarSkeleton createBarSkeleton() {
+        // 业务框架构建器
+        BarSkeletonBuilder builder = LogicServerKit
+                .createBuilder(BagAction.class);
+
+        extractedSendDco(builder);
+
+        return builder.build();
+    }
+
+    @Override
+    public BrokerClientBuilder createBrokerClientBuilder() {
+        BrokerClientBuilder builder = LogicServerKit.newBrokerClientBuilder();
+        builder.appName("背包逻辑服");
+        return builder;
+    }
+
+    private void extractedSendDco(BarSkeletonBuilder builder) {
+
+    }
+}

+ 96 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/action/BagAction.java

@@ -0,0 +1,96 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.action;
+
+import com.iohao.game.action.skeleton.annotation.ActionController;
+import com.iohao.game.action.skeleton.annotation.ActionMethod;
+import com.iohao.game.action.skeleton.core.flow.FlowContext;
+import com.iohao.mmo.bag.cmd.BagCmd;
+import com.iohao.mmo.bag.entity.Bag;
+import com.iohao.mmo.bag.entity.BagItem;
+import com.iohao.mmo.bag.mapper.BagMapper;
+import com.iohao.mmo.bag.proto.BagItemMessage;
+import com.iohao.mmo.bag.proto.BagMessage;
+import com.iohao.mmo.bag.service.BagService;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Component;
+
+/**
+ * 背包
+ *
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Component
+@ActionController(BagCmd.cmd)
+public class BagAction {
+    @Resource
+    BagService bagService;
+
+    /**
+     * 查询玩家背包
+     *
+     * @return 背包
+     */
+    @ActionMethod(BagCmd.bag)
+    public BagMessage getBag(FlowContext flowContext) {
+        long userId = flowContext.getUserId();
+        Bag bag = bagService.ofBag(userId);
+
+        return BagMapper.ME.convert(bag);
+    }
+
+    /**
+     * 往背包添加(增加)物品
+     *
+     * @param bagItemMessage 物品
+     * @param flowContext    flowContext
+     * @return 当前物品的最新信息
+     */
+    @ActionMethod(BagCmd.incrementItem)
+    public BagItemMessage internalIncrementItem(BagItemMessage bagItemMessage, FlowContext flowContext) {
+        long userId = flowContext.getUserId();
+
+        BagItem bagItem = BagMapper.ME.convert(bagItemMessage);
+
+        bagItem = bagService.incrementItem(bagItem, userId);
+        BagMapper.ME.to(bagItem, bagItemMessage);
+
+        return bagItemMessage;
+    }
+
+    /**
+     * 从背包减少物品
+     *
+     * @param bagItemMessage 物品
+     * @param flowContext    flowContext
+     * @return 当前物品的最新信息
+     */
+    @ActionMethod(BagCmd.decrementItem)
+    public BagItemMessage internalDecrementItem(BagItemMessage bagItemMessage, FlowContext flowContext) {
+        long userId = flowContext.getUserId();
+
+        BagItem bagItem = BagMapper.ME.convert(bagItemMessage);
+
+        bagItem = bagService.decrementItem(bagItem, userId);
+        BagMapper.ME.to(bagItem, bagItemMessage);
+
+        return bagItemMessage;
+    }
+}

+ 42 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/entity/Bag.java

@@ -0,0 +1,42 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.entity;
+
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.experimental.FieldDefaults;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+import java.util.Map;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Data
+@Document
+@FieldDefaults(level = AccessLevel.PRIVATE)
+public class Bag {
+    /** userId */
+    @Id
+    long id;
+    /** 背包物品 */
+    Map<String, BagItem> itemMap;
+}

+ 72 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/entity/BagItem.java

@@ -0,0 +1,72 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.entity;
+
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.experimental.FieldDefaults;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+import java.util.Objects;
+
+/**
+ * 背包物品
+ * <pre>
+ *
+ * </pre>
+ *
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Data
+@Document
+@FieldDefaults(level = AccessLevel.PRIVATE)
+public class BagItem {
+    /**
+     * 背包物品 id
+     * <pre>
+     *     如果 id 与 itemId 一致
+     *     表示物品可叠加,比如一些药品可叠加存放
+     *
+     *     如果 id 与 itemId 不一致
+     *     表示物品不可叠加,每一件物品都需要分开存放;
+     *     比如,装备、品质不同的药品等。
+     * </pre>
+     */
+    @Id
+    String id;
+    /** 物品 id */
+    String itemId;
+    /** 物品数量 */
+    int quantity;
+
+    public void addQuantity(int quantity) {
+        this.quantity += quantity;
+    }
+
+    /**
+     * 是否一个仓库
+     *
+     * @return true 表示类似仓库,物品可以叠加存放
+     */
+    public boolean isStash() {
+        return Objects.equals(id, itemId);
+    }
+}

+ 44 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/mapper/BagMapper.java

@@ -0,0 +1,44 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.mapper;
+
+import com.iohao.mmo.bag.entity.Bag;
+import com.iohao.mmo.bag.entity.BagItem;
+import com.iohao.mmo.bag.proto.BagItemMessage;
+import com.iohao.mmo.bag.proto.BagMessage;
+import org.mapstruct.Mapper;
+import org.mapstruct.MappingTarget;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Mapper
+public interface BagMapper {
+    BagMapper ME = Mappers.getMapper(BagMapper.class);
+
+    BagMessage convert(Bag bag);
+
+    BagItemMessage convert(BagItem bagItem);
+
+    BagItem convert(BagItemMessage bagItemMessage);
+
+    void to(BagItem bagItem, @MappingTarget BagItemMessage bagItemMessage);
+}

+ 32 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/repository/BagRepository.java

@@ -0,0 +1,32 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.repository;
+
+import com.iohao.mmo.bag.entity.Bag;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Repository
+public interface BagRepository extends CrudRepository<Bag, Long> {
+
+}

+ 105 - 0
logic/bag-logic/src/main/java/com/iohao/mmo/bag/service/BagService.java

@@ -0,0 +1,105 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.service;
+
+import com.iohao.game.action.skeleton.core.exception.ActionErrorEnum;
+import com.iohao.mmo.bag.entity.Bag;
+import com.iohao.mmo.bag.entity.BagItem;
+import com.iohao.mmo.bag.repository.BagRepository;
+import com.iohao.mmo.common.config.GameCode;
+import lombok.AllArgsConstructor;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Service
+@AllArgsConstructor
+public class BagService {
+    final MongoTemplate mongoTemplate;
+    final BagRepository bagRepository;
+
+    public Bag ofBag(long userId) {
+
+        Optional<Bag> bagOptional = bagRepository.findById(userId);
+        if (bagOptional.isPresent()) {
+            return bagOptional.get();
+        }
+
+        Bag bag = new Bag();
+        bag.setId(userId);
+        bag.setItemMap(new HashMap<>());
+
+        bagRepository.save(bag);
+
+        return bag;
+    }
+
+    public BagItem incrementItem(BagItem incrementItem, long userId) {
+        Bag bag = ofBag(userId);
+        Map<String, BagItem> itemMap = bag.getItemMap();
+
+        String bagItemId = incrementItem.getId();
+        BagItem bagItem = itemMap.get(bagItemId);
+
+        int quantity = incrementItem.getQuantity();
+        if (Objects.isNull(bagItem)) {
+            bagItem = incrementItem;
+            itemMap.put(bagItemId, bagItem);
+            bagItem.setQuantity(0);
+        }
+
+        // 通过 itemType 来判断,背包物品是否可叠加
+        if (bagItem.isStash()) {
+            bagItem.addQuantity(quantity);
+        } else {
+            bagItem.setQuantity(1);
+        }
+
+        bagRepository.save(bag);
+
+        return bagItem;
+    }
+
+    public BagItem decrementItem(BagItem decrementItem, long userId) {
+        Bag bag = ofBag(userId);
+        Map<String, BagItem> itemMap = bag.getItemMap();
+
+        // 查询背包物品
+        String bagItemId = decrementItem.getId();
+        BagItem bagItem = itemMap.get(bagItemId);
+        ActionErrorEnum.dataNotExist.assertNonNull(bagItem);
+
+        // 数量检测
+        int quantity = decrementItem.getQuantity();
+        GameCode.quantityNotEnough.assertTrue(bagItem.getQuantity() >= quantity);
+
+        bagItem.addQuantity(-quantity);
+
+        return bagItem;
+    }
+
+}

+ 38 - 0
logic/item-logic/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 34 - 0
logic/item-logic/pom.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.iohao.mmo</groupId>
+        <artifactId>game</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>item-logic</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <!-- 游戏逻辑服通用模块 -->
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>a-logic-common</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>item-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 35 - 0
logic/item-logic/src/main/java/com/iohao/mmo/item/action/ItemAction.java

@@ -0,0 +1,35 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.item.action;
+
+import com.iohao.game.action.skeleton.annotation.ActionController;
+import com.iohao.game.action.skeleton.core.flow.FlowContext;
+import com.iohao.mmo.item.cmd.ItemCmd;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@ActionController(ItemCmd.cmd)
+public class ItemAction {
+    public void consumer(FlowContext flowContext) {
+        long userId = flowContext.getUserId();
+
+    }
+}

+ 0 - 7
logic/level-logic/src/main/java/com/iohao/mmo/level/LevelLogicServer.java

@@ -24,18 +24,11 @@ import com.iohao.game.bolt.broker.client.AbstractBrokerClientStartup;
 import com.iohao.game.bolt.broker.core.client.BrokerClientBuilder;
 import com.iohao.mmo.common.logic.server.LogicServerKit;
 import com.iohao.mmo.level.action.LevelAction;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.experimental.FieldDefaults;
 
 /**
  * @author 渔民小镇
  * @date 2023-07-30
  */
-@Getter
-@Setter
-@FieldDefaults(level = AccessLevel.PRIVATE)
 public class LevelLogicServer extends AbstractBrokerClientStartup {
     @Override
     public BarSkeleton createBarSkeleton() {

+ 2 - 2
logic/level-logic/src/main/java/com/iohao/mmo/level/action/LevelAction.java

@@ -68,7 +68,7 @@ public class LevelAction {
         // 推送经验值给玩家
         LevelMessage levelMessage = LevelMapper.ME.convert(level);
         BroadcastContext broadcastContext = BrokerClientHelper.getBroadcastContext();
-        CmdInfo cmdInfo = LevelCmd.getCmdInfo(LevelCmd.personAddExp);
+        CmdInfo cmdInfo = LevelCmd.of(LevelCmd.personAddExp);
         broadcastContext.broadcast(cmdInfo, levelMessage, userId);
     }
 
@@ -117,7 +117,7 @@ public class LevelAction {
         // 检测经验是否足够
         int configExp = personLevelConfig.getExp();
         long exp = level.getExp();
-        GameCode.UP_LEVEL_ERROR.assertTrue(exp >= configExp);
+        GameCode.upLevelError.assertTrue(exp >= configExp);
 
         //  达到升级条件
         level.addExp(-configExp);

+ 2 - 2
logic/map-logic/src/main/java/com/iohao/mmo/map/action/MapAction.java

@@ -75,10 +75,10 @@ public class MapAction {
     @ActionMethod(MapCmd.enterMap)
     public EnterMapMessage enterMap(EnterMapReq enterMapReq, MyFlowContext flowContext) {
         long mapId = enterMapReq.mapId;
-        GameCode.MAP_NOT_EXIST.assertTrueThrows(mapId != 1);
+        GameCode.mapNotExist.assertTrueThrows(mapId != 1);
 
         MapRoom room = roomService.getRoom(mapId);
-        GameCode.MAP_NOT_EXIST.assertNonNull(room);
+        GameCode.mapNotExist.assertNonNull(room);
 
         long userId = flowContext.getUserId();
         MapPlayer player = room.getPlayerById(userId);

+ 1 - 1
logic/person-logic/src/main/java/com/iohao/mmo/person/action/PersonAction.java

@@ -77,7 +77,7 @@ public class PersonAction {
         // 等级
         CompletableFuture<LevelMessage> future = CompletableFuture.supplyAsync(() -> {
             // 路由:这个路由是将要访问逻辑服的路由(表示你将要去的地方)
-            CmdInfo ofLevelCmd = LevelCmd.getCmdInfo(LevelCmd.ofLevel);
+            CmdInfo ofLevelCmd = LevelCmd.of(LevelCmd.ofLevel);
             // 游戏逻辑服通讯上下文
             InvokeModuleContext invokeModuleContext = BrokerClientHelper.getInvokeModuleContext();
             // 根据路由信息来请求其他子服务器(其他逻辑服)的数据

+ 4 - 0
one-application/src/main/java/com/iohao/mmo/OneApplication.java

@@ -24,6 +24,7 @@ import com.iohao.game.bolt.broker.server.BrokerServer;
 import com.iohao.game.external.core.ExternalServer;
 import com.iohao.game.external.core.config.ExternalGlobalConfig;
 import com.iohao.game.external.core.netty.simple.NettyRunOne;
+import com.iohao.mmo.bag.BagLogicServer;
 import com.iohao.mmo.broker.MyBrokerServer;
 import com.iohao.mmo.equip.EquipLogicServer;
 import com.iohao.mmo.external.MyExternalServer;
@@ -76,6 +77,7 @@ public class OneApplication {
         PersonLogicServer personLogicServer = new PersonLogicServer();
         MapLogicServer mapLogicServer = new MapLogicServer();
         LevelLogicServer levelLogicServer = new LevelLogicServer();
+        BagLogicServer bagLogicServer = new BagLogicServer();
         EquipLogicServer equipLogicServer = new EquipLogicServer();
 
         // 游戏逻辑服列表
@@ -88,6 +90,8 @@ public class OneApplication {
                 , mapLogicServer
                 // 等级
                 , levelLogicServer
+                // 背包
+                , bagLogicServer
                 // 装备
                 , equipLogicServer
         );

+ 4 - 0
one-client/src/main/java/com/iohao/mmo/client/CommonClient.java

@@ -22,6 +22,7 @@ import com.iohao.game.external.client.InputCommandRegion;
 import com.iohao.game.external.client.join.ClientRunOne;
 import com.iohao.game.external.client.user.ClientUser;
 import com.iohao.game.external.client.user.DefaultClientUser;
+import com.iohao.mmo.bag.client.BagInputCommandRegion;
 import com.iohao.mmo.equip.client.EquipInputCommandRegion;
 import com.iohao.mmo.level.client.LevelInputCommandRegion;
 import com.iohao.mmo.login.client.LoginInputCommandRegion;
@@ -54,6 +55,7 @@ public class CommonClient {
         MapInputCommandRegion mapInputCommandRegion = new MapInputCommandRegion();
         PersonInputCommandRegion personInputCommandRegion = new PersonInputCommandRegion();
         LevelInputCommandRegion levelInputCommandRegion = new LevelInputCommandRegion();
+        BagInputCommandRegion bagInputCommandRegion = new BagInputCommandRegion();
         EquipInputCommandRegion equipInputCommandRegion = new EquipInputCommandRegion();
 
         // 模拟请求数据
@@ -66,6 +68,8 @@ public class CommonClient {
                 , personInputCommandRegion
                 // 等级相关
                 , levelInputCommandRegion
+                // 背包
+                , bagInputCommandRegion
                 // 装备相关
                 , equipInputCommandRegion
         );

+ 6 - 2
pom.xml

@@ -39,6 +39,10 @@
         <module>provide/map-provide</module>
         <module>logic/level-logic</module>
         <module>provide/level-provide</module>
+        <module>logic/item-logic</module>
+        <module>provide/item-provide</module>
+        <module>logic/bag-logic</module>
+        <module>provide/bag-provide</module>
         <module>logic/equip-logic</module>
         <module>provide/equip-provide</module>
 
@@ -54,7 +58,7 @@
         <encoding>UTF-8</encoding>
 
         <!-- 项目版本 -->
-        <ioGame.version>17.1.50</ioGame.version>
+        <ioGame.version>17.1.51</ioGame.version>
         <spring-boot.version>3.1.2</spring-boot.version>
         <!-- lombok 消除冗长的 Java 代码 https://mvnrepository.com/artifact/org.projectlombok/lombok -->
         <lombok.version>1.18.24</lombok.version>
@@ -168,4 +172,4 @@
         </plugins>
     </build>
 
-</project>
+</project>

+ 13 - 1
provide/all-provide/pom.xml

@@ -49,6 +49,18 @@
             <version>${project.parent.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>item-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>bag-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>com.iohao.mmo</groupId>
             <artifactId>equip-provide</artifactId>
@@ -56,4 +68,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>

+ 38 - 0
provide/bag-provide/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 27 - 0
provide/bag-provide/pom.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.iohao.mmo</groupId>
+        <artifactId>game</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>bag-provide</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>common-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 102 - 0
provide/bag-provide/src/main/java/com/iohao/mmo/bag/client/BagInputCommandRegion.java

@@ -0,0 +1,102 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.client;
+
+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.mmo.bag.cmd.BagCmd;
+import com.iohao.mmo.bag.proto.BagItemMessage;
+import com.iohao.mmo.bag.proto.BagMessage;
+import com.iohao.mmo.common.snow.SnowKit;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@Slf4j
+public class BagInputCommandRegion extends AbstractInputCommandRegion {
+    @Override
+    public void initInputCommand() {
+        this.inputCommandCreate.cmd = BagCmd.cmd;
+        request();
+    }
+
+    private void request() {
+        ofCommand(BagCmd.bag).callback(BagMessage.class, result -> {
+            BagMessage value = result.getValue();
+            log.info("value : {}", value);
+        }).setDescription("查询玩家背包");
+
+        InputRequestData inputRequestData = () -> {
+            ScannerKit.log(() -> log.info("输入【1】表示添加一个可叠加的物品。"));
+            String inputType = ScannerKit.nextLine("1");
+
+            String id = "1";
+            String itemId = "1";
+
+            if (!"1".equals(inputType)) {
+                id = SnowKit.nextToString();
+            }
+
+            BagItemMessage bagItemMessage = new BagItemMessage();
+            bagItemMessage.id = id;
+            bagItemMessage.itemId = itemId;
+            bagItemMessage.quantity = 1;
+
+            ScannerKit.log(() -> log.info("{}", bagItemMessage));
+
+            return bagItemMessage;
+        };
+
+        ofCommand(BagCmd.incrementItem).callback(BagItemMessage.class, result -> {
+            var value = result.getValue();
+            log.info("value : {}", value);
+            // 重新查询一次背包
+            ofRequestCommand(BagCmd.bag).request();
+        }).setDescription("往背包添加(增加)物品").setInputRequestData(inputRequestData);
+
+        inputRequestData = () -> {
+            ScannerKit.log(() -> log.info("输入需要减少的物品信息,格式 [背包物品id-数量]"));
+            String inputType = ScannerKit.nextLine("1-1");
+
+            String[] split = inputType.split("-");
+
+            String id = split[0];
+            int quantity = Integer.parseInt(split[1]);
+
+            BagItemMessage bagItemMessage = new BagItemMessage();
+            bagItemMessage.id = id;
+            bagItemMessage.quantity = quantity;
+
+            ScannerKit.log(() -> log.info("{}", bagItemMessage));
+
+            return bagItemMessage;
+        };
+
+        ofCommand(BagCmd.decrementItem).callback(BagItemMessage.class, result -> {
+            var value = result.getValue();
+            log.info("value : {}", value);
+
+            // 重新查询一次背包
+            ofRequestCommand(BagCmd.bag).request();
+        }).setDescription("从背包减少物品").setInputRequestData(inputRequestData);
+    }
+}

+ 42 - 0
provide/bag-provide/src/main/java/com/iohao/mmo/bag/cmd/BagCmd.java

@@ -0,0 +1,42 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.cmd;
+
+import com.iohao.game.action.skeleton.core.CmdInfo;
+import com.iohao.mmo.common.provide.cmd.CmdModule;
+
+/**
+ * 背包
+ *
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+public interface BagCmd {
+    int cmd = CmdModule.bagCmd;
+    /** 背包列表 */
+    int bag = 1;
+    /** 添加物品 */
+    int incrementItem = 2;
+    /** 减少物品 */
+    int decrementItem = 3;
+
+    static CmdInfo of(int subCmd) {
+        return CmdInfo.of(cmd, subCmd);
+    }
+}

+ 42 - 0
provide/bag-provide/src/main/java/com/iohao/mmo/bag/proto/BagItemMessage.java

@@ -0,0 +1,42 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.proto;
+
+import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
+import lombok.AccessLevel;
+import lombok.ToString;
+import lombok.experimental.FieldDefaults;
+
+/**
+ * 背包物品
+ *
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@ToString
+@ProtobufClass
+@FieldDefaults(level = AccessLevel.PUBLIC)
+public class BagItemMessage {
+    /** 背包物品 id */
+    String id;
+    /** 物品 id */
+    String itemId;
+    /** 物品数量 */
+    int quantity;
+}

+ 40 - 0
provide/bag-provide/src/main/java/com/iohao/mmo/bag/proto/BagMessage.java

@@ -0,0 +1,40 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.bag.proto;
+
+import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
+import lombok.AccessLevel;
+import lombok.ToString;
+import lombok.experimental.FieldDefaults;
+
+import java.util.Map;
+
+/**
+ * 背包
+ *
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+@ToString
+@ProtobufClass
+@FieldDefaults(level = AccessLevel.PUBLIC)
+public class BagMessage {
+    /** 背包物品 */
+    Map<String, BagItemMessage> itemMap;
+}

+ 6 - 0
provide/common-provide/pom.xml

@@ -38,5 +38,11 @@
             <artifactId>fastjson2</artifactId>
             <version>2.0.38</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>common-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 5 - 1
provide/common-provide/src/main/java/com/iohao/mmo/common/provide/cmd/CmdModule.java

@@ -35,6 +35,10 @@ public interface CmdModule {
     int heroCmd = 4;
     /** 等级 */
     int levelCmd = 5;
+    /** 物品 */
+    int itemCmd = 6;
+    /** 背包 */
+    int bagCmd = 7;
     /** 装备 */
-    int equipCmd = 6;
+    int equipCmd = 8;
 }

+ 38 - 0
provide/item-provide/.gitignore

@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store

+ 27 - 0
provide/item-provide/pom.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.iohao.mmo</groupId>
+        <artifactId>game</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>item-provide</artifactId>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>common-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 34 - 0
provide/item-provide/src/main/java/com/iohao/mmo/item/cmd/ItemCmd.java

@@ -0,0 +1,34 @@
+/*
+ * ioGame
+ * Copyright (C) 2021 - 2023  渔民小镇 (262610965@qq.com、luoyizhu@gmail.com) . All Rights Reserved.
+ * # iohao.com . 渔民小镇
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.iohao.mmo.item.cmd;
+
+import com.iohao.game.action.skeleton.core.CmdInfo;
+import com.iohao.mmo.common.provide.cmd.CmdModule;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-04
+ */
+public interface ItemCmd {
+    int cmd = CmdModule.itemCmd;
+
+    static CmdInfo of(int subCmd) {
+        return CmdInfo.of(cmd, subCmd);
+    }
+}

+ 2 - 2
provide/level-provide/src/main/java/com/iohao/mmo/level/cmd/LevelCmd.java

@@ -36,7 +36,7 @@ public interface LevelCmd {
     /** 得到等级信息,没有则创建 */
     int ofLevel = 4;
 
-    static CmdInfo getCmdInfo(int subCmd) {
-        return CmdInfo.getCmdInfo(cmd, subCmd);
+    static CmdInfo of(int subCmd) {
+        return CmdInfo.of(cmd, subCmd);
     }
 }