0130
parent
2998452068
commit
cb0703d8b3
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.6.21" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.6.21" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -26,6 +26,7 @@ import org.quartz.SchedulerFactory;
|
|||
import org.quartz.impl.StdSchedulerFactory;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import taurus.client.NetManager;
|
||||
import taurus.newRobot.AddRoomRobot;
|
||||
|
||||
import static org.quartz.CronScheduleBuilder.cronSchedule;
|
||||
import static org.quartz.JobBuilder.newJob;
|
||||
|
|
@ -128,8 +129,10 @@ public class MainServer extends Extension {
|
|||
// QingChu qingChu = new QingChu();
|
||||
// qingChu.qingchu();
|
||||
|
||||
DoTest doTe = new DoTest();
|
||||
doTe.doTest();
|
||||
//DoTest doTe = new DoTest();
|
||||
//doTe.doTest();
|
||||
AddRoomRobot addRoomRobot = new AddRoomRobot();
|
||||
addRoomRobot.addRoom();
|
||||
|
||||
// System.out.println("机器人返回结果: " + s);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -80,13 +80,17 @@ public class UpdatePlayRoomJob implements Job{
|
|||
int min_value = pid * 10000;
|
||||
int max_value = pid * 10000 + 9999;
|
||||
String grooms_key = GroupCache.genRoomsKey(groupId);
|
||||
|
||||
rooms = jedis.zrevrangeByScore(grooms_key, max_value, min_value);
|
||||
int room_size =0;
|
||||
for (String room : rooms) {
|
||||
List<String> room_list = Redis.use("group1_db0").hmget(room, "fake", "status", "round", "id", "times", "players");
|
||||
|
||||
//获取气氛卓
|
||||
String fake_json = room_list.get(0);
|
||||
if (fake_json == null) {
|
||||
continue;
|
||||
}else{
|
||||
room_size++;
|
||||
}
|
||||
|
||||
String status = room_list.get(1);
|
||||
|
|
@ -94,17 +98,18 @@ public class UpdatePlayRoomJob implements Job{
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
String strRound = room_list.get(2);
|
||||
if (StringUtil.isEmpty(strRound)) {
|
||||
continue;
|
||||
}
|
||||
int round = Integer.parseInt(strRound);
|
||||
|
||||
|
||||
int round = Integer.parseInt(strRound);
|
||||
String roomId = room_list.get(3);
|
||||
if (StringUtil.isEmpty(roomId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (round == 0) {
|
||||
roomUpdateEvent(room, groupId, roomId);
|
||||
round++;
|
||||
|
|
@ -112,11 +117,12 @@ public class UpdatePlayRoomJob implements Job{
|
|||
}
|
||||
}
|
||||
|
||||
if (rooms.size() >= gpb.robot_room || rooms.size() >= 20)
|
||||
if (room_size >= gpb.robot_room || rooms.size() >= 20)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
String exist = Redis.use("group1_db1").get("robot_exist");
|
||||
if (StringUtil.isNotEmpty(exist))
|
||||
{
|
||||
|
|
@ -218,6 +224,19 @@ public class UpdatePlayRoomJob implements Job{
|
|||
long time = System.currentTimeMillis() / 1000;
|
||||
for (String room : rooms) {
|
||||
List<String> room_list = Redis.use("group1_db0").hmget(room, "fake", "status", "round", "id", "times", "players", "create_time", "fake_existTime");
|
||||
String roomId = room_list.get(3);
|
||||
ITArray players = TArray.newFromJsonData(room_list.get(5));
|
||||
|
||||
if(players.size()==0) {
|
||||
//清理空桌
|
||||
GroupPublisherService.delRoomEvt(groupId, roomId);
|
||||
jedis.zrem(grooms_key, room);
|
||||
Redis.use().hset(room, "status", 3 + "");
|
||||
Redis.use().hincrBy(room, "cache_ver", 1);
|
||||
Redis.use().expire(room, 20);
|
||||
logger.error("del 空 room:" + roomId + " player:"+room_list.get(5) + " fake_json:");
|
||||
continue;
|
||||
}
|
||||
|
||||
String fake_json = room_list.get(0);
|
||||
if (fake_json == null)
|
||||
|
|
@ -236,7 +255,7 @@ public class UpdatePlayRoomJob implements Job{
|
|||
}
|
||||
int round = Integer.parseInt(strRound);
|
||||
|
||||
String roomId = room_list.get(3);
|
||||
|
||||
if(StringUtil.isEmpty(roomId)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -246,6 +265,9 @@ public class UpdatePlayRoomJob implements Job{
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int maxRound = Integer.parseInt(maxStrRound);
|
||||
if (round == 0) {
|
||||
roomUpdateEvent(room, groupId, roomId);
|
||||
|
|
@ -270,7 +292,8 @@ public class UpdatePlayRoomJob implements Job{
|
|||
}
|
||||
|
||||
boolean exitGame = false;
|
||||
ITArray players = TArray.newFromJsonData(room_list.get(5));
|
||||
|
||||
|
||||
if (round >= 1)
|
||||
{
|
||||
int fake_hp = (int)(Math.random() * 100000);
|
||||
|
|
@ -320,6 +343,8 @@ public class UpdatePlayRoomJob implements Job{
|
|||
Redis.use("group1_db1").srem("used_robot", Integer.toString(player_id));
|
||||
Redis.use("group1_db1").sadd("free_robot", Integer.toString(player_id));
|
||||
}
|
||||
|
||||
//清空桌子
|
||||
GroupPublisherService.delRoomEvt(groupId, roomId);
|
||||
jedis.zrem(grooms_key, room);
|
||||
Redis.use().hset(room, "status", 3 + "");
|
||||
|
|
@ -433,6 +458,7 @@ public class UpdatePlayRoomJob implements Job{
|
|||
Redis.use("group1_db11").zadd(grooms_key, pid*10000+1101, room_key);
|
||||
GroupPublisherService.addRoomEvt(groupId, newRoomId);
|
||||
updateRedisMap(groupId, newRoomId, room_key, roomMap, maxPlayers);
|
||||
|
||||
return room_key;
|
||||
}
|
||||
return null;
|
||||
|
|
@ -830,6 +856,7 @@ public class UpdatePlayRoomJob implements Job{
|
|||
userData.putUtfString("password", Utils.getMD5Hash(password));
|
||||
long reg_time = System.currentTimeMillis() / 1000;
|
||||
userData.putLong("reg_time", reg_time);
|
||||
userData.putInt("jiqiren",0);
|
||||
logger.info("create robot account:"+userData.toJson()+" password:" + password);
|
||||
int result = DataBase.use().insert("account", userData);
|
||||
if (result == -1) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,11 @@
|
|||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\controller\GroupController.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\controller\GroupLogController.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\WebInterceptor.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\MainServer.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\Protocol.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\controller\GroupRoomController.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\job\UpdatePlayRoomJob.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\service\GroupRoomService.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\service\GroupPublisherService.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\service\GroupService.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\main\java\com\group\service\GroupLogService.java
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\test\java\web_group\Main.java
|
||||
D:\robotpro\robot_ceshi\xtserver_anchou\game_web\web_group\src\test\java\web_group\DataClearUtils.java
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.6.21" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1844,7 +1844,7 @@ public class HuNanChangSha {
|
|||
public static void main(String[] args) {
|
||||
HuNanChangSha huNanChangSha = new HuNanChangSha();
|
||||
ITObject params = TObject.newInstance();
|
||||
TaurusClient tc = new TaurusClient("127.0.0.1", "10", TaurusClient.ConnectionProtocol.Tcp);
|
||||
TaurusClient tc = new TaurusClient("8.138.242.190", "10", TaurusClient.ConnectionProtocol.Tcp);
|
||||
List<Integer> hands1 = new ArrayList<>();
|
||||
hands1.add(209);
|
||||
hands1.add(209);
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ public class JiQiRens {
|
|||
}
|
||||
|
||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
||||
client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
client = new TaurusClient("8.138.242.190:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
}
|
||||
//
|
||||
if ("66".equalsIgnoreCase(wanfaId)) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class jiqiren {
|
|||
}
|
||||
|
||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
||||
client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
client = new TaurusClient("8.138.242.190:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
//TaurusClient client1=getClient();
|
||||
client.connect();
|
||||
mapclient.put(randomKeyFromList, client);
|
||||
|
|
@ -220,7 +220,7 @@ public class jiqiren {
|
|||
// client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
}
|
||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
||||
client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
client = new TaurusClient("8.138.242.190:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
client.connect();
|
||||
mapclient.put(randomKeyFromList, client);
|
||||
}
|
||||
|
|
@ -404,7 +404,7 @@ public class jiqiren {
|
|||
}
|
||||
|
||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
||||
client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
client = new TaurusClient("8.138.242.190:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||
// client.setSession(session);
|
||||
client.connect();
|
||||
mapclient.put(randomKeyFromList, client);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class lianjiejiqiren {
|
|||
ITObject param = message.param;
|
||||
//回调协议号
|
||||
String command = message.command;
|
||||
|
||||
System.out.println("command: " + command);
|
||||
//根据玩法id 调用不同的回调
|
||||
if (StringUtil.isNotEmpty(command)) {
|
||||
if ("66".equalsIgnoreCase(wanfaId)) {//跑的快
|
||||
|
|
@ -585,7 +585,17 @@ public class lianjiejiqiren {
|
|||
//吃碰杠
|
||||
huNanChangSha.actionCard(param, client);
|
||||
|
||||
} else if ("2009".equalsIgnoreCase(command)) {
|
||||
}else if("2002".equalsIgnoreCase(command)) {
|
||||
System.out.println("comds:2002");
|
||||
|
||||
ITObject params = TObject.newInstance();
|
||||
client.send("1005", params, response -> {
|
||||
});
|
||||
|
||||
}else if ("2009".equalsIgnoreCase(command)) {
|
||||
|
||||
|
||||
|
||||
//db0
|
||||
Jedis jedis22 = Redis.use().getJedis();
|
||||
//db2
|
||||
|
|
@ -605,13 +615,13 @@ public class lianjiejiqiren {
|
|||
if (jedis33.hget(getKey, "pid") != null) {
|
||||
String circleId1 = jedis33.hget(getKey, "circleId");
|
||||
String pid = jedis33.hget(getKey, "pid");
|
||||
|
||||
System.out.println("comds2:2002");
|
||||
String key = "g{" + circleId1 + "}:play:" + pid;
|
||||
if (jedis33.hget(getKey, "room_id") != null) {
|
||||
String roomid = jedis33.hget(getKey, "room_id");
|
||||
|
||||
String roomKey = "room:" + roomid;
|
||||
|
||||
System.out.println("comds3:2002");
|
||||
if (jedis22.hget(roomKey, "players") != null) {
|
||||
String players = jedis22.hget(roomKey, "players");
|
||||
if (!players.equals("[]")) {
|
||||
|
|
@ -619,6 +629,7 @@ public class lianjiejiqiren {
|
|||
playerIds2 = players.split(",");
|
||||
if (playerIds2.length == 1) {
|
||||
if (!pid.equals("0")) {
|
||||
System.out.println("comds4:2002");
|
||||
Jedis jedis20 = Redis.use("group1_db11").getJedis();
|
||||
System.out.println("进入 -------------------------");
|
||||
jedis20.hincrBy(key, "leftover_robot", 1);
|
||||
|
|
@ -638,6 +649,7 @@ public class lianjiejiqiren {
|
|||
jedis33.hset(getKey, "pid", "0");
|
||||
jedis33.hset(getKey, "room_id", "0");
|
||||
//退出修改机器人状态
|
||||
System.out.println("comds5:2002");
|
||||
jedis33.hset(key, String.valueOf(aid), "0");
|
||||
TaurusClient taurusClient = (TaurusClient) entry.getValue();
|
||||
taurusClient.send("1005", params, response -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue