/*
* 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 .
*/
package com.iohao.mmo.client;
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.bag.client.ItemInputCommandRegion;
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;
import com.iohao.mmo.person.client.PersonInputCommandRegion;
import java.util.List;
/**
* @author 渔民小镇
* @date 2023-07-21
*/
public class CommonClient {
static void start(long userId) {
// 客户端的用户(玩家)
ClientUser clientUser = new DefaultClientUser();
clientUser.setJwt(String.valueOf(userId));
List inputCommandRegions = listInputCommandRegion();
// 启动模拟客户端
new ClientRunOne()
.setClientUser(clientUser)
.setInputCommandRegions(inputCommandRegions)
.startup();
}
private static List listInputCommandRegion() {
LoginInputCommandRegion loginInputCommandRegion = new LoginInputCommandRegion();
MapInputCommandRegion mapInputCommandRegion = new MapInputCommandRegion();
PersonInputCommandRegion personInputCommandRegion = new PersonInputCommandRegion();
LevelInputCommandRegion levelInputCommandRegion = new LevelInputCommandRegion();
BagInputCommandRegion bagInputCommandRegion = new BagInputCommandRegion();
ItemInputCommandRegion itemInputCommandRegion = new ItemInputCommandRegion();
EquipInputCommandRegion equipInputCommandRegion = new EquipInputCommandRegion();
// 模拟请求数据
return List.of(
// 登录
loginInputCommandRegion
// 地图
// , mapInputCommandRegion
// 人物、英雄
// , personInputCommandRegion
// 等级相关
, levelInputCommandRegion
// 物品
, itemInputCommandRegion
// 背包
, bagInputCommandRegion
// 装备相关
, equipInputCommandRegion
);
}
}