修改pdk 硬文本属性
parent
cb55f75624
commit
2bc803d031
|
|
@ -6,6 +6,7 @@ public class Config {
|
||||||
public static final String CREATE_ROOM_ROBOT = "create_room_for_robot";
|
public static final String CREATE_ROOM_ROBOT = "create_room_for_robot";
|
||||||
public static final String INIT_CONNECTION = "init_connection";
|
public static final String INIT_CONNECTION = "init_connection";
|
||||||
|
|
||||||
|
//==================== Controller协议 ====================
|
||||||
/**
|
/**
|
||||||
* 加入房间 - robot_mgr to robot_mj_cs 的内部协议号
|
* 加入房间 - robot_mgr to robot_mj_cs 的内部协议号
|
||||||
*/
|
*/
|
||||||
|
|
@ -25,4 +26,30 @@ public class Config {
|
||||||
* 加入房间 - robot_mgr to game_mj_cs 的内部协议号
|
* 加入房间 - robot_mgr to game_mj_cs 的内部协议号
|
||||||
*/
|
*/
|
||||||
public static final String JOIN_ROOM_CS = "1002";
|
public static final String JOIN_ROOM_CS = "1002";
|
||||||
|
|
||||||
|
/** Web组加入房间协议 */
|
||||||
|
public static final String WEB_GROUP_JOIN_ROOM = "225";
|
||||||
|
|
||||||
|
/** Web组主动重连协议 */
|
||||||
|
public static final String WEB_GROUP_ACTIVE_RECONNECT = "226";
|
||||||
|
|
||||||
|
//==================== 游戏服务器配置 ====================
|
||||||
|
/** 游戏服务器主机地址 */
|
||||||
|
public static final String GAME_SERVER_HOST = "127.0.0.1";
|
||||||
|
|
||||||
|
/** 游戏服务器端口 */
|
||||||
|
public static final String GAME_SERVER_PORT = "6841";
|
||||||
|
|
||||||
|
/** 默认密码 */
|
||||||
|
public static final String DEFAULT_PASSWORD = "123456";
|
||||||
|
|
||||||
|
/** 默认PID */
|
||||||
|
public static final String DEFAULT_PID = "66";
|
||||||
|
|
||||||
|
/** 默认群组ID */
|
||||||
|
public static final String DEFAULT_GROUP_ID = "330800";
|
||||||
|
|
||||||
|
/** 主要群组ID */
|
||||||
|
public static final String MAIN_GROUP_ID = "762479";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ public class EXGameController extends GameController {
|
||||||
/**
|
/**
|
||||||
* 接收来自web_group的加入房间协议
|
* 接收来自web_group的加入房间协议
|
||||||
*/
|
*/
|
||||||
@ActionKey(value = "225", validate = GameInterceptor.NOT_PLAYER)
|
@ActionKey(value = Config.WEB_GROUP_JOIN_ROOM, validate = GameInterceptor.NOT_PLAYER)
|
||||||
public void webGroup(Session session, ITObject params, int gid) {
|
public void webGroup(Session session, ITObject params, int gid) {
|
||||||
int robotId = params.getInt("robotid");
|
int robotId = params.getInt("robotid");
|
||||||
String roomId = params.getString("roomid");
|
String roomId = params.getString("roomid");
|
||||||
|
|
@ -245,7 +245,7 @@ public class EXGameController extends GameController {
|
||||||
/**
|
/**
|
||||||
* 接收来自web_group的主动重连协议
|
* 接收来自web_group的主动重连协议
|
||||||
*/
|
*/
|
||||||
@ActionKey(value = "226", validate = GameInterceptor.NOT_PLAYER)
|
@ActionKey(value = Config.WEB_GROUP_ACTIVE_RECONNECT, validate = GameInterceptor.NOT_PLAYER)
|
||||||
public void webGroupActive(Session session, ITObject params, int gid) {
|
public void webGroupActive(Session session, ITObject params, int gid) {
|
||||||
int robotId = params.getInt("robotid");
|
int robotId = params.getInt("robotid");
|
||||||
String roomId = params.getString("roomid");
|
String roomId = params.getString("roomid");
|
||||||
|
|
@ -363,11 +363,11 @@ public class EXGameController extends GameController {
|
||||||
if (robotUser ==null) {
|
if (robotUser ==null) {
|
||||||
RobotUser robotUserCopy = new RobotUser();
|
RobotUser robotUserCopy = new RobotUser();
|
||||||
robotUserCopy.setRobotId(robotId);
|
robotUserCopy.setRobotId(robotId);
|
||||||
robotUserCopy.setPassword("123456");
|
robotUserCopy.setPassword(Config.DEFAULT_PASSWORD);
|
||||||
robotUserCopy.setGameHost("8.134.76.43");
|
robotUserCopy.setGameHost(Config.GAME_SERVER_HOST);
|
||||||
robotUserCopy.setGamePort("6841");
|
robotUserCopy.setGamePort(Config.GAME_SERVER_PORT);
|
||||||
robotUserCopy.setRobotGroupid("330800");
|
robotUserCopy.setRobotGroupid(Config.DEFAULT_GROUP_ID);
|
||||||
robotUserCopy.setRobotPid("66");
|
robotUserCopy.setRobotPid(Config.DEFAULT_PID);
|
||||||
return robotUserCopy;
|
return robotUserCopy;
|
||||||
}
|
}
|
||||||
return robotRoomMapping.get(robotId);
|
return robotRoomMapping.get(robotId);
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@ import com.robot.GameController;
|
||||||
import com.robot.MainServer;
|
import com.robot.MainServer;
|
||||||
import com.robot.data.Player;
|
import com.robot.data.Player;
|
||||||
import com.robot.data.Room;
|
import com.robot.data.Room;
|
||||||
import com.taurus.core.entity.ITObject;
|
|
||||||
import com.taurus.core.entity.TObject;
|
|
||||||
import com.taurus.core.plugin.redis.Redis;
|
import com.taurus.core.plugin.redis.Redis;
|
||||||
import com.taurus.permanent.TPServer;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import robot.mj.info.RobotUser;
|
import robot.mj.info.RobotUser;
|
||||||
import taurus.client.NetManager;
|
import taurus.client.NetManager;
|
||||||
import taurus.client.TaurusClient;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static robot.mj.EXGameController.robotRoomMapping;
|
import static robot.mj.EXGameController.robotRoomMapping;
|
||||||
|
|
||||||
|
|
@ -41,18 +35,18 @@ public class EXMainServer extends MainServer{
|
||||||
//startConnectionCheckScheduler();
|
//startConnectionCheckScheduler();
|
||||||
//测试
|
//测试
|
||||||
Jedis jedis2 = Redis.use("group1_db2").getJedis();
|
Jedis jedis2 = Redis.use("group1_db2").getJedis();
|
||||||
String robotskey = "g{"+762479+"}:play:"+66;
|
String robotskey = "g{"+Config.MAIN_GROUP_ID+"}:play:"+ Config.DEFAULT_PID;
|
||||||
Map<String, String> maprobot = jedis2.hgetAll(robotskey);
|
Map<String, String> maprobot = jedis2.hgetAll(robotskey);
|
||||||
for(Map.Entry<String, String> entry : maprobot.entrySet()) {
|
for(Map.Entry<String, String> entry : maprobot.entrySet()) {
|
||||||
System.out.println(entry.getKey() + ":" + entry.getValue());
|
System.out.println(entry.getKey() + ":" + entry.getValue());
|
||||||
//是否创建
|
//是否创建
|
||||||
RobotUser robotUser = new RobotUser();
|
RobotUser robotUser = new RobotUser();
|
||||||
robotUser.setRobotId(entry.getKey());
|
robotUser.setRobotId(entry.getKey());
|
||||||
robotUser.setPassword("123456");
|
robotUser.setPassword(Config.DEFAULT_PASSWORD);
|
||||||
robotUser.setGameHost("127.0.0.1");
|
robotUser.setGameHost(Config.GAME_SERVER_HOST);
|
||||||
robotUser.setGamePort("6841");
|
robotUser.setGamePort(Config.GAME_SERVER_PORT);
|
||||||
robotUser.setRobotGroupid("762479");
|
robotUser.setRobotGroupid(Config.MAIN_GROUP_ID);
|
||||||
robotUser.setRobotPid("66");
|
robotUser.setRobotPid(Config.DEFAULT_PID);
|
||||||
|
|
||||||
robotRoomMapping.put(entry.getKey(), robotUser);
|
robotRoomMapping.put(entry.getKey(), robotUser);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,10 @@ package robot.mj;
|
||||||
|
|
||||||
import com.taurus.core.entity.ITArray;
|
import com.taurus.core.entity.ITArray;
|
||||||
import com.taurus.core.entity.ITObject;
|
import com.taurus.core.entity.ITObject;
|
||||||
import com.taurus.core.entity.TArray;
|
|
||||||
import com.taurus.core.entity.TObject;
|
import com.taurus.core.entity.TObject;
|
||||||
import com.taurus.core.events.Event;
|
import com.taurus.core.events.Event;
|
||||||
import com.taurus.core.events.IEventListener;
|
import com.taurus.core.events.IEventListener;
|
||||||
import com.taurus.core.plugin.database.DataBase;
|
|
||||||
import com.taurus.core.plugin.redis.Redis;
|
import com.taurus.core.plugin.redis.Redis;
|
||||||
import com.taurus.core.util.ICallback;
|
|
||||||
import com.taurus.core.util.StringUtil;
|
import com.taurus.core.util.StringUtil;
|
||||||
import robot.mj.business.AccountBusiness;
|
import robot.mj.business.AccountBusiness;
|
||||||
import robot.mj.handler.HuNanPaoDeKuai;
|
import robot.mj.handler.HuNanPaoDeKuai;
|
||||||
|
|
@ -19,7 +16,6 @@ import taurus.client.TaurusClient;
|
||||||
import taurus.client.SocketCode;
|
import taurus.client.SocketCode;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
|
|
@ -33,8 +29,8 @@ public class RobotConnectionManager {
|
||||||
private static final Map<String, HuNanPaoDeKuai> huNanPaoDeKuaiInstances = new ConcurrentHashMap<>();
|
private static final Map<String, HuNanPaoDeKuai> huNanPaoDeKuaiInstances = new ConcurrentHashMap<>();
|
||||||
private final EXGameController exGameController;
|
private final EXGameController exGameController;
|
||||||
|
|
||||||
private final String host="8.134.76.43";
|
private final String host = Config.GAME_SERVER_HOST;
|
||||||
private final int port=6841;
|
private final int port = Integer.parseInt(Config.GAME_SERVER_PORT);
|
||||||
|
|
||||||
|
|
||||||
public RobotConnectionManager() {
|
public RobotConnectionManager() {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public class RoomCreator {
|
||||||
roomInfo.setRoomId(roomKey);
|
roomInfo.setRoomId(roomKey);
|
||||||
roomInfo.setGroupId(groupId);
|
roomInfo.setGroupId(groupId);
|
||||||
roomInfo.setWanfaId(wanfaId);
|
roomInfo.setWanfaId(wanfaId);
|
||||||
roomInfo.setServerIp("8.134.76.43");
|
roomInfo.setServerIp(Config.GAME_SERVER_HOST);
|
||||||
roomInfo.setServerPort(getGamePortForWanfa(wanfaId));
|
roomInfo.setServerPort(getGamePortForWanfa(wanfaId));
|
||||||
|
|
||||||
log.info("成功创建机器人房间: {}, 群组: {}, 玩法: {}", roomKey, groupId, wanfaId);
|
log.info("成功创建机器人房间: {}, 群组: {}, 玩法: {}", roomKey, groupId, wanfaId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue