123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /*
- * 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.client.input;
- import com.iohao.game.action.skeleton.protocol.wrapper.ByteValueList;
- import com.iohao.game.action.skeleton.protocol.wrapper.StringValue;
- import com.iohao.game.action.skeleton.protocol.wrapper.StringValueList;
- import com.iohao.game.action.skeleton.protocol.wrapper.WrapperKit;
- 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.common.provide.kit.JsonKit;
- import com.iohao.mmo.equip.cmd.EquipCmd;
- import com.iohao.mmo.equip.proto.*;
- import lombok.extern.slf4j.Slf4j;
- import java.util.Arrays;
- import java.util.List;
- /**
- * @author 唐斌
- * @date 2023-07-30
- */
- @Slf4j
- public class EquipInputCommandRegion extends AbstractInputCommandRegion {
- @Override
- public void initInputCommand() {
- this.inputCommandCreate.cmd = EquipCmd.cmd;
- this.inputCommandCreate.cmdName = "装备模块";
- request();
- listen();
- }
- private void listen() {
- }
- private void request() {
- InputRequestData inputRequestData;
- // 10-1 获取装备列表信息
- ofCommand(EquipCmd.getEquipList).callback(ByteValueList.class, result -> {
- List<EquipMessage> value = result.toList(EquipMessage.class);
- log.info("装备列表信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("获取装备列表信息");
- // 10-2 查询装备信息
- inputRequestData = () -> {
- ScannerKit.log(() -> log.info("请输入要查询的装备id"));
- String id = ScannerKit.nextLine();
- // 请求参数
- StringValue stringValue = StringValue.of(id);
- return stringValue;
- };
- ofCommand(EquipCmd.getEquip).callback(EquipMessage.class, result -> {
- EquipMessage value = result.getValue();
- log.info("装备属性信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("查询装备信息").setInputRequestData(inputRequestData);
- // 10-3 重新随机基础属性
- inputRequestData = () -> {
- ScannerKit.log(() -> log.info("请输入装备id"));
- String id = ScannerKit.nextLine();
- // 请求参数
- StringValue stringValue = StringValue.of(id);
- return stringValue;
- };
- ofCommand(EquipCmd.resetEquipBasic).callback(EquipShowMessage.class, result -> {
- EquipShowMessage value = result.getValue();
- log.info("装备信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("重新随机装备基础属性").setInputRequestData(inputRequestData);
- // 10-4 重新随机词条
- inputRequestData = () -> {
- ScannerKit.log(() -> log.info("请输入装备id和极品概率增益百分比,格式 [装备id-增益百分比]"));
- String inputValue = ScannerKit.nextLine("1-0.3");
- SplitParam param = new SplitParam(inputValue);
- String id = param.getString(0);
- String excellentRateString = param.getString(1);
- EquipResetMessage equipResetMessage = new EquipResetMessage();
- equipResetMessage.id = id;
- equipResetMessage.excellentRateString = excellentRateString;
- return equipResetMessage;
- };
- ofCommand(EquipCmd.resetEquip).callback(EquipShowMessage.class, result -> {
- EquipShowMessage value = result.getValue();
- log.info("装备属性信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("重新随机词条").setInputRequestData(inputRequestData);
- // 10-5 批量删除装备
- inputRequestData = () -> {
- ScannerKit.log(() -> log.info("请输入要删除的装备id,格式 [装备1id-装备2id]"));
- String ids = ScannerKit.nextLine("1-1");
- List<String> idList = Arrays.asList(ids.split("-"));
- // 请求参数
- StringValueList listValue = WrapperKit.ofListStringValue(idList);
- return listValue;
- };
- ofCommand(EquipCmd.delEquipBatch).callback(EquipMessage.class, result -> {
- EquipMessage value = result.getValue();
- log.info("装备属性信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("批量删除装备").setInputRequestData(inputRequestData);
- // 10-13 根据装备库列表批量随机新的装备
- inputRequestData = () -> {
- ScannerKit.log(() -> log.info(
- "请输入装备库itemTypeId列表,格式 [装备库itemTypeId1-装备库itemTypeId2-装备库itemTypeId3...]"));
- String itemTypeIds = ScannerKit.nextLine("1-1");
- List<String> itemTypeIdList = Arrays.asList(itemTypeIds.split("-"));
- // 请求参数
- StringValueList listValue = WrapperKit.ofListStringValue(itemTypeIdList);
- return listValue;
- };
- ofCommand(EquipCmd.randomEquip).callback(ByteValueList.class, result -> {
- List<EquipShowMessage> value = result.toList(EquipShowMessage.class);
- log.info("装备列表信息 : {}", JsonKit.toJsonString(value));
- }).setDescription("根据装备库列表批量随机新的装备").setInputRequestData(inputRequestData);
- }
- }
|