修改pdk 硬文本属性

master
zhouwei 2026-02-25 15:05:32 +08:00
parent cb55f75624
commit 2bc803d031
5 changed files with 43 additions and 26 deletions

View File

@ -6,6 +6,7 @@ public class Config {
public static final String CREATE_ROOM_ROBOT = "create_room_for_robot";
public static final String INIT_CONNECTION = "init_connection";
//==================== Controller协议 ====================
/**
* - robot_mgr to robot_mj_cs
*/
@ -25,4 +26,30 @@ public class Config {
* - robot_mgr to game_mj_cs
*/
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";
}

View File

@ -219,7 +219,7 @@ public class EXGameController extends GameController {
/**
* 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) {
int robotId = params.getInt("robotid");
String roomId = params.getString("roomid");
@ -245,7 +245,7 @@ public class EXGameController extends GameController {
/**
* 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) {
int robotId = params.getInt("robotid");
String roomId = params.getString("roomid");
@ -363,11 +363,11 @@ public class EXGameController extends GameController {
if (robotUser ==null) {
RobotUser robotUserCopy = new RobotUser();
robotUserCopy.setRobotId(robotId);
robotUserCopy.setPassword("123456");
robotUserCopy.setGameHost("8.134.76.43");
robotUserCopy.setGamePort("6841");
robotUserCopy.setRobotGroupid("330800");
robotUserCopy.setRobotPid("66");
robotUserCopy.setPassword(Config.DEFAULT_PASSWORD);
robotUserCopy.setGameHost(Config.GAME_SERVER_HOST);
robotUserCopy.setGamePort(Config.GAME_SERVER_PORT);
robotUserCopy.setRobotGroupid(Config.DEFAULT_GROUP_ID);
robotUserCopy.setRobotPid(Config.DEFAULT_PID);
return robotUserCopy;
}
return robotRoomMapping.get(robotId);

View File

@ -6,18 +6,12 @@ import com.robot.GameController;
import com.robot.MainServer;
import com.robot.data.Player;
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.permanent.TPServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import robot.mj.info.RobotUser;
import taurus.client.NetManager;
import taurus.client.TaurusClient;
import java.util.concurrent.TimeUnit;
import static robot.mj.EXGameController.robotRoomMapping;
@ -41,18 +35,18 @@ public class EXMainServer extends MainServer{
//startConnectionCheckScheduler();
//测试
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);
for(Map.Entry<String, String> entry : maprobot.entrySet()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
//是否创建
RobotUser robotUser = new RobotUser();
robotUser.setRobotId(entry.getKey());
robotUser.setPassword("123456");
robotUser.setGameHost("127.0.0.1");
robotUser.setGamePort("6841");
robotUser.setRobotGroupid("762479");
robotUser.setRobotPid("66");
robotUser.setPassword(Config.DEFAULT_PASSWORD);
robotUser.setGameHost(Config.GAME_SERVER_HOST);
robotUser.setGamePort(Config.GAME_SERVER_PORT);
robotUser.setRobotGroupid(Config.MAIN_GROUP_ID);
robotUser.setRobotPid(Config.DEFAULT_PID);
robotRoomMapping.put(entry.getKey(), robotUser);
}

View File

@ -2,13 +2,10 @@ package robot.mj;
import com.taurus.core.entity.ITArray;
import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TArray;
import com.taurus.core.entity.TObject;
import com.taurus.core.events.Event;
import com.taurus.core.events.IEventListener;
import com.taurus.core.plugin.database.DataBase;
import com.taurus.core.plugin.redis.Redis;
import com.taurus.core.util.ICallback;
import com.taurus.core.util.StringUtil;
import robot.mj.business.AccountBusiness;
import robot.mj.handler.HuNanPaoDeKuai;
@ -19,7 +16,6 @@ import taurus.client.TaurusClient;
import taurus.client.SocketCode;
import redis.clients.jedis.Jedis;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.*;
@ -33,8 +29,8 @@ public class RobotConnectionManager {
private static final Map<String, HuNanPaoDeKuai> huNanPaoDeKuaiInstances = new ConcurrentHashMap<>();
private final EXGameController exGameController;
private final String host="8.134.76.43";
private final int port=6841;
private final String host = Config.GAME_SERVER_HOST;
private final int port = Integer.parseInt(Config.GAME_SERVER_PORT);
public RobotConnectionManager() {

View File

@ -144,7 +144,7 @@ public class RoomCreator {
roomInfo.setRoomId(roomKey);
roomInfo.setGroupId(groupId);
roomInfo.setWanfaId(wanfaId);
roomInfo.setServerIp("8.134.76.43");
roomInfo.setServerIp(Config.GAME_SERVER_HOST);
roomInfo.setServerPort(getGamePortForWanfa(wanfaId));
log.info("成功创建机器人房间: {}, 群组: {}, 玩法: {}", roomKey, groupId, wanfaId);