Browse Source

装备半成品

tangbin 1 year ago
parent
commit
678943dcf0
24 changed files with 788 additions and 1 deletions
  1. 1 1
      logic/a-logic-common/src/main/java/com/iohao/mmo/config/MongoConfig.java
  2. 6 0
      logic/all-logic/pom.xml
  3. 38 0
      logic/equip-logic/.gitignore
  4. 41 0
      logic/equip-logic/pom.xml
  5. 61 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/EquipLogicServer.java
  6. 51 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/action/EquipAction.java
  7. 55 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/BasicEquipProperty.java
  8. 41 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/Equip.java
  9. 35 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/mapper/EquipMapper.java
  10. 32 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/repository/EquipRepository.java
  11. 79 0
      logic/equip-logic/src/main/java/com/iohao/mmo/equip/service/EquipService.java
  12. 24 0
      logic/equip-logic/src/test/java/com/iohao/mmo/equip/entity/EquipTest.java
  13. 4 0
      one-application/src/main/java/com/iohao/mmo/OneApplication.java
  14. 4 0
      one-client/src/main/java/com/iohao/mmo/client/CommonClient.java
  15. 2 0
      pom.xml
  16. 6 0
      provide/all-provide/pom.xml
  17. 2 0
      provide/common-provide/src/main/java/com/iohao/mmo/common/provide/cmd/CmdModule.java
  18. 38 0
      provide/equip-provide/.gitignore
  19. 28 0
      provide/equip-provide/pom.xml
  20. 77 0
      provide/equip-provide/src/main/java/com/iohao/mmo/equip/client/EquipInputCommandRegion.java
  21. 39 0
      provide/equip-provide/src/main/java/com/iohao/mmo/equip/cmd/EquipCmd.java
  22. 47 0
      provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/BasicEquipPropertyMessage.java
  23. 39 0
      provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/EquipMessage.java
  24. 38 0
      provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/OfEquipReq.java

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

@@ -37,7 +37,7 @@ public class MongoConfig extends AbstractMongoClientConfiguration {
 
     @Override
     protected String getDatabaseName() {
-        return "test";
+        return "iogame-test";
     }
 
     @Override

+ 6 - 0
logic/all-logic/pom.xml

@@ -44,6 +44,12 @@
             <version>${project.parent.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>equip-logic</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 38 - 0
logic/equip-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

+ 41 - 0
logic/equip-logic/pom.xml

@@ -0,0 +1,41 @@
+<?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>equip-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>equip-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

+ 61 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/EquipLogicServer.java

@@ -0,0 +1,61 @@
+/*
+ * 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.equip;
+
+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.common.logic.server.LogicServerKit;
+import com.iohao.mmo.equip.action.EquipAction;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.experimental.FieldDefaults;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-31
+ */
+@Getter
+@Setter
+@FieldDefaults(level = AccessLevel.PRIVATE)
+public class EquipLogicServer extends AbstractBrokerClientStartup {
+    @Override
+    public BarSkeleton createBarSkeleton() {
+        // 业务框架构建器
+        BarSkeletonBuilder builder = LogicServerKit
+                .createBuilder(EquipAction.class);
+
+        extractedSendDco(builder);
+
+        return builder.build();
+    }
+
+    @Override
+    public BrokerClientBuilder createBrokerClientBuilder() {
+        BrokerClientBuilder builder = LogicServerKit.newBrokerClientBuilder();
+        builder.appName("装备逻辑服");
+        return builder;
+    }
+
+    private static void extractedSendDco(BarSkeletonBuilder builder) {
+
+    }
+}

+ 51 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/action/EquipAction.java

@@ -0,0 +1,51 @@
+package com.iohao.mmo.equip.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.equip.cmd.EquipCmd;
+import com.iohao.mmo.equip.entity.Equip;
+import com.iohao.mmo.equip.mapper.EquipMapper;
+import com.iohao.mmo.equip.proto.EquipMessage;
+import com.iohao.mmo.equip.service.EquipService;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ * @description: 装备属性类
+ */
+@Slf4j
+@Component
+@ActionController(EquipCmd.cmd)
+public class EquipAction {
+
+    @Resource
+    EquipService equipService;
+
+    /**
+     * 初始化装备信息
+     *
+     * @param flowContext flowContext
+     */
+    @ActionMethod(EquipCmd.initEquip)
+    public void internalInitEquip(FlowContext flowContext) {
+        long userId = flowContext.getUserId();
+        // 初始化装备数据,暂时放这
+        equipService.initEquipData();
+    }
+
+    /**
+     * 初始化装备信息
+     *
+     * @param flowContext flowContext
+     */
+    @ActionMethod(EquipCmd.getEquip)
+    public EquipMessage getEquip(FlowContext flowContext, long id) {
+        // 初始化装备数据,暂时放这
+        Equip equip = equipService.ofEquip(id);
+        return EquipMapper.ME.convert(equip);
+    }
+}

+ 55 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/BasicEquipProperty.java

@@ -0,0 +1,55 @@
+/*
+ * 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.equip.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-07-24
+ */
+@Data
+@Document
+@FieldDefaults(level = AccessLevel.PRIVATE)
+public class BasicEquipProperty {
+    @Id
+    String id;
+    /** 体质 */
+    int constitution;
+    /** 魔力 */
+    int magicPower;
+    /** 力量 */
+    int power;
+    /** 耐力 */
+    int endurance;
+    /** 敏捷 */
+    int agile;
+
+}

+ 41 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/entity/Equip.java

@@ -0,0 +1,41 @@
+/*
+ * 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.equip.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;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-26
+ */
+@Data
+@Document
+@FieldDefaults(level = AccessLevel.PRIVATE)
+public class Equip {
+    @Id
+    long id;
+    /** 装备名 */
+    String name;
+    /** 基础属性 */
+    BasicEquipProperty basicEquipProperty;
+}

+ 35 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/mapper/EquipMapper.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.equip.mapper;
+
+import com.iohao.mmo.equip.entity.Equip;
+import com.iohao.mmo.equip.proto.EquipMessage;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ */
+@Mapper
+public interface EquipMapper {
+    EquipMapper ME = Mappers.getMapper(EquipMapper.class);
+
+    EquipMessage convert(Equip equip);
+}

+ 32 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/repository/EquipRepository.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.equip.repository;
+
+import com.iohao.mmo.equip.entity.Equip;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ */
+@Repository
+public interface EquipRepository extends CrudRepository<Equip, Long> {
+
+}

+ 79 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/service/EquipService.java

@@ -0,0 +1,79 @@
+/*
+ * 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.equip.service;
+
+import com.iohao.mmo.equip.entity.BasicEquipProperty;
+import com.iohao.mmo.equip.entity.Equip;
+import com.iohao.mmo.equip.repository.EquipRepository;
+import lombok.AllArgsConstructor;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ * @description: 装备属性实现类
+ */
+@Service
+@AllArgsConstructor
+public class EquipService {
+    final MongoTemplate mongoTemplate;
+    final EquipRepository equipRepository;
+
+    public Equip ofEquip(long id) {
+
+        return  mongoTemplate.findById(id, Equip.class);
+    }
+
+    public Optional<Equip> getById(long primaryKey) {
+        return equipRepository.findById(primaryKey);
+    }
+
+    public void save(Equip equip) {
+        mongoTemplate.save(equip);
+    }
+
+    public void initEquipData() {
+        // 初始化一些英雄数配置,后期将移到 excel 中做。
+
+        Equip equip = new Equip();
+        equip.setId(1000000L);
+        equip.setName("青铜甲");
+
+        BasicEquipProperty basicEquipProperty = getInitBasicEquipProperty();
+        equip.setBasicEquipProperty(basicEquipProperty);
+
+        mongoTemplate.save(equip);
+    }
+
+    private BasicEquipProperty getInitBasicEquipProperty() {
+        BasicEquipProperty basicEquipProperty = new BasicEquipProperty();
+        basicEquipProperty.setConstitution(1000);
+        basicEquipProperty.setMagicPower(120);
+        basicEquipProperty.setPower(110);
+        basicEquipProperty.setEndurance(200);
+        basicEquipProperty.setAgile(20);
+        return basicEquipProperty;
+    }
+}

+ 24 - 0
logic/equip-logic/src/test/java/com/iohao/mmo/equip/entity/EquipTest.java

@@ -0,0 +1,24 @@
+package com.iohao.mmo.equip.entity;
+
+import com.iohao.mmo.equip.service.EquipService;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-26
+ */
+@Slf4j
+@SpringBootTest
+public class EquipTest {
+    @Resource
+    EquipService equipService;
+
+    @Test
+    void testEquip() {
+        equipService.initEquipData();
+    }
+
+}

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

@@ -25,6 +25,7 @@ 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.broker.MyBrokerServer;
+import com.iohao.mmo.equip.EquipLogicServer;
 import com.iohao.mmo.external.MyExternalServer;
 import com.iohao.mmo.level.LevelLogicServer;
 import com.iohao.mmo.login.LoginLogicServer;
@@ -75,6 +76,7 @@ public class OneApplication {
         PersonLogicServer personLogicServer = new PersonLogicServer();
         MapLogicServer mapLogicServer = new MapLogicServer();
         LevelLogicServer levelLogicServer = new LevelLogicServer();
+        EquipLogicServer equipLogicServer = new EquipLogicServer();
 
         // 游戏逻辑服列表
         return List.of(
@@ -86,6 +88,8 @@ public class OneApplication {
                 , mapLogicServer
                 // 等级
                 , levelLogicServer
+                // 装备
+                , 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.equip.client.EquipInputCommandRegion;
 import com.iohao.mmo.level.client.LevelInputCommandRegion;
 import com.iohao.mmo.login.client.LoginInputCommandRegion;
 import com.iohao.mmo.map.client.MapInputCommandRegion;
@@ -53,6 +54,7 @@ public class CommonClient {
         MapInputCommandRegion mapInputCommandRegion = new MapInputCommandRegion();
         PersonInputCommandRegion personInputCommandRegion = new PersonInputCommandRegion();
         LevelInputCommandRegion levelInputCommandRegion = new LevelInputCommandRegion();
+        EquipInputCommandRegion equipInputCommandRegion = new EquipInputCommandRegion();
 
         // 模拟请求数据
         return List.of(
@@ -64,6 +66,8 @@ public class CommonClient {
                 , personInputCommandRegion
                 // 等级相关
                 , levelInputCommandRegion
+                // 装备相关
+                , equipInputCommandRegion
         );
     }
 

+ 2 - 0
pom.xml

@@ -39,6 +39,8 @@
         <module>provide/map-provide</module>
         <module>logic/level-logic</module>
         <module>provide/level-provide</module>
+        <module>logic/equip-logic</module>
+        <module>provide/equip-provide</module>
 
     </modules>
 

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

@@ -48,6 +48,12 @@
             <artifactId>level-provide</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.iohao.mmo</groupId>
+            <artifactId>equip-provide</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 2 - 0
provide/common-provide/src/main/java/com/iohao/mmo/common/provide/cmd/CmdModule.java

@@ -35,4 +35,6 @@ public interface CmdModule {
     int heroCmd = 4;
     /** 等级 */
     int levelCmd = 5;
+    /** 装备 */
+    int equipCmd = 6;
 }

+ 38 - 0
provide/equip-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

+ 28 - 0
provide/equip-provide/pom.xml

@@ -0,0 +1,28 @@
+<?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>equip-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>

+ 77 - 0
provide/equip-provide/src/main/java/com/iohao/mmo/equip/client/EquipInputCommandRegion.java

@@ -0,0 +1,77 @@
+/*
+ * 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.equip.client;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONWriter;
+import com.iohao.game.action.skeleton.protocol.wrapper.LongValue;
+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.equip.cmd.EquipCmd;
+import com.iohao.mmo.equip.proto.EquipMessage;
+import com.iohao.mmo.equip.proto.OfEquipReq;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-07-30
+ */
+@Slf4j
+public class EquipInputCommandRegion extends AbstractInputCommandRegion {
+    @Override
+    public void initInputCommand() {
+        this.inputCommandCreate.cmd = EquipCmd.cmd;
+
+        request();
+
+        listen();
+    }
+
+    private void listen() {
+
+    }
+
+    private void request() {
+        InputRequestData inputRequestData;
+
+        ofCommand(EquipCmd.initEquip).callback(EquipMessage.class, result -> {
+            EquipMessage value = result.getValue();
+            String jsonFormat = JSON.toJSONString(value, JSONWriter.Feature.PrettyFormat);
+        }).setDescription("初始化装备信息");
+
+        // 动态请求参数
+        inputRequestData = () -> {
+            ScannerKit.log(() -> log.info("请输入要查询的装备id"));
+            long equipId = ScannerKit.nextLong(1);
+
+            // 请求参数
+            OfEquipReq ofEquipReq = new OfEquipReq();
+            // 根据装备id获取装备信息
+            ofEquipReq.id = equipId;
+
+            return ofEquipReq;
+        };
+
+        ofCommand(EquipCmd.getEquip).callback(EquipMessage.class, result -> {
+            EquipMessage value = result.getValue();
+            log.info("装备信息 : {}", value);
+        }).setDescription("查询装备信息").setInputRequestData(inputRequestData);;
+    }
+}

+ 39 - 0
provide/equip-provide/src/main/java/com/iohao/mmo/equip/cmd/EquipCmd.java

@@ -0,0 +1,39 @@
+/*
+ * 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.equip.cmd;
+
+import com.iohao.game.action.skeleton.core.CmdInfo;
+import com.iohao.mmo.common.provide.cmd.CmdModule;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ * @description:
+ */
+public interface EquipCmd {
+    int cmd = CmdModule.equipCmd;
+    /** 初始化信息 */
+    int initEquip = 1;
+    /** 得到信息 */
+    int getEquip = 2;
+
+    static CmdInfo getCmdInfo(int subCmd) {
+        return CmdInfo.getCmdInfo(cmd, subCmd);
+    }
+}

+ 47 - 0
provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/BasicEquipPropertyMessage.java

@@ -0,0 +1,47 @@
+/*
+ * 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.equip.proto;
+
+import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
+import lombok.AccessLevel;
+import lombok.ToString;
+import lombok.experimental.FieldDefaults;
+
+/**
+ * 装备基础属性
+ *
+ * @author 唐斌
+ * @date 2023-07-30
+ * @description:
+ */
+@ToString
+@ProtobufClass
+@FieldDefaults(level = AccessLevel.PUBLIC)
+public class BasicEquipPropertyMessage {
+    /** 体质 */
+    int constitution;
+    /** 魔力 */
+    int magicPower;
+    /** 力量 */
+    int power;
+    /** 耐力 */
+    int endurance;
+    /** 敏捷 */
+    int agile;
+}

+ 39 - 0
provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/EquipMessage.java

@@ -0,0 +1,39 @@
+/*
+ * 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.equip.proto;
+
+import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
+import lombok.AccessLevel;
+import lombok.ToString;
+import lombok.experimental.FieldDefaults;
+
+/**
+ * @author 唐斌
+ * @date 2023-07-30
+ * @description:
+ */
+@ToString
+@ProtobufClass
+@FieldDefaults(level = AccessLevel.PUBLIC)
+public class EquipMessage {
+    /** 装备id */
+    long equipId;
+    /** 装备基础属性 */
+    BasicEquipPropertyMessage basicEquipProperty;
+}

+ 38 - 0
provide/equip-provide/src/main/java/com/iohao/mmo/equip/proto/OfEquipReq.java

@@ -0,0 +1,38 @@
+/*
+ * 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.equip.proto;
+
+import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
+import lombok.AccessLevel;
+import lombok.ToString;
+import lombok.experimental.FieldDefaults;
+
+/**
+ * 获取装备
+ *
+ * @author 唐斌
+ * @date 2023-07-31
+ */
+@ToString
+@ProtobufClass
+@FieldDefaults(level = AccessLevel.PUBLIC)
+public class OfEquipReq {
+    /** 装备 id */
+    long id;
+}