渔民小镇 1 anno fa
parent
commit
92893480ed

+ 0 - 1
common/common-core/src/main/java/com/iohao/mmo/common/config/MyGlobalSetting.java

@@ -54,5 +54,4 @@ public class MyGlobalSetting {
         // 编解码设置
         IoGameGlobalSetting.setDataCodec(new JsonDataCodec());
     }
-
 }

+ 0 - 10
logic/equip-logic/src/main/java/com/iohao/mmo/equip/action/EquipTemplateAction.java

@@ -29,16 +29,6 @@ public class EquipTemplateAction {
     @Resource
     EquipTemplateService equipTemplateService;
 
-    /**
-     * 初始化装备库(暂时的方法,后期应从数据文件中读取)
-     *
-     */
-    @ActionMethod(EquipCmd.initEquipTemplate)
-    public void initEquipTemplate() {
-        // 初始化装备数据,暂时放这
-        equipTemplateService.initEquipTemplate();
-    }
-
     /**
      * 获取装备库信息
      *

+ 47 - 0
logic/equip-logic/src/main/java/com/iohao/mmo/equip/config/EquipCommandLineRunner.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.config;
+
+import com.iohao.mmo.equip.entity.EquipTemplate;
+import com.iohao.mmo.equip.service.EquipTemplateService;
+import lombok.AllArgsConstructor;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 渔民小镇
+ * @date 2023-08-28
+ */
+@Component
+@AllArgsConstructor
+public class EquipCommandLineRunner implements CommandLineRunner {
+    final MongoTemplate mongoTemplate;
+    final EquipTemplateService equipTemplateService;
+
+    @Override
+    public void run(String... args) {
+        initConfigExcel();
+    }
+
+    private void initConfigExcel() {
+        mongoTemplate.dropCollection(EquipTemplate.class);
+        equipTemplateService.initEquipTemplate();
+    }
+}

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

@@ -58,7 +58,6 @@ public class OneApplication {
     public static void main(String[] args) {
         SpringApplication.run(OneApplication.class, args);
 
-
         extractedConfig();
 
         // 游戏逻辑服列表
@@ -101,9 +100,9 @@ public class OneApplication {
         // 游戏逻辑服列表
         return List.of(
                 loginLogicServer
-                , personLogicServer
-                , mapLogicServer
-                , levelLogicServer
+//                , personLogicServer
+//                , mapLogicServer
+//                , levelLogicServer
                 , bagLogicServer
                 , mailLogicServer
                 , equipLogicServer
@@ -111,6 +110,7 @@ public class OneApplication {
     }
 
     private static void extractedConfig() {
+        // 统一的默认配置
         MyGlobalSetting.defaultSetting();
     }
 

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

@@ -38,8 +38,6 @@ public interface EquipCmd {
     int resetEquip = 4;
     /** 批量删除装备 */
     int delEquipBatch = 5;
-    /** 初始化装备库 */
-    int initEquipTemplate = 10;
     /** 获取装备库信息 */
     int getEquipTemplate = 12;
     /** 根据装备库随机出一件新的装备 */