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 org.quartz.impl.StdSchedulerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import taurus.client.NetManager;
|
import taurus.client.NetManager;
|
||||||
|
import taurus.newRobot.AddRoomRobot;
|
||||||
|
|
||||||
import static org.quartz.CronScheduleBuilder.cronSchedule;
|
import static org.quartz.CronScheduleBuilder.cronSchedule;
|
||||||
import static org.quartz.JobBuilder.newJob;
|
import static org.quartz.JobBuilder.newJob;
|
||||||
|
|
@ -128,8 +129,10 @@ public class MainServer extends Extension {
|
||||||
// QingChu qingChu = new QingChu();
|
// QingChu qingChu = new QingChu();
|
||||||
// qingChu.qingchu();
|
// qingChu.qingchu();
|
||||||
|
|
||||||
DoTest doTe = new DoTest();
|
//DoTest doTe = new DoTest();
|
||||||
doTe.doTest();
|
//doTe.doTest();
|
||||||
|
AddRoomRobot addRoomRobot = new AddRoomRobot();
|
||||||
|
addRoomRobot.addRoom();
|
||||||
|
|
||||||
// System.out.println("机器人返回结果: " + s);
|
// System.out.println("机器人返回结果: " + s);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,17 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
int min_value = pid * 10000;
|
int min_value = pid * 10000;
|
||||||
int max_value = pid * 10000 + 9999;
|
int max_value = pid * 10000 + 9999;
|
||||||
String grooms_key = GroupCache.genRoomsKey(groupId);
|
String grooms_key = GroupCache.genRoomsKey(groupId);
|
||||||
|
|
||||||
rooms = jedis.zrevrangeByScore(grooms_key, max_value, min_value);
|
rooms = jedis.zrevrangeByScore(grooms_key, max_value, min_value);
|
||||||
|
int room_size =0;
|
||||||
for (String room : rooms) {
|
for (String room : rooms) {
|
||||||
List<String> room_list = Redis.use("group1_db0").hmget(room, "fake", "status", "round", "id", "times", "players");
|
List<String> room_list = Redis.use("group1_db0").hmget(room, "fake", "status", "round", "id", "times", "players");
|
||||||
|
//获取气氛卓
|
||||||
String fake_json = room_list.get(0);
|
String fake_json = room_list.get(0);
|
||||||
if (fake_json == null) {
|
if (fake_json == null) {
|
||||||
continue;
|
continue;
|
||||||
|
}else{
|
||||||
|
room_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
String status = room_list.get(1);
|
String status = room_list.get(1);
|
||||||
|
|
@ -94,17 +98,18 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String strRound = room_list.get(2);
|
String strRound = room_list.get(2);
|
||||||
if (StringUtil.isEmpty(strRound)) {
|
if (StringUtil.isEmpty(strRound)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int round = Integer.parseInt(strRound);
|
|
||||||
|
|
||||||
|
|
||||||
|
int round = Integer.parseInt(strRound);
|
||||||
String roomId = room_list.get(3);
|
String roomId = room_list.get(3);
|
||||||
if (StringUtil.isEmpty(roomId)) {
|
if (StringUtil.isEmpty(roomId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (round == 0) {
|
if (round == 0) {
|
||||||
roomUpdateEvent(room, groupId, roomId);
|
roomUpdateEvent(room, groupId, roomId);
|
||||||
round++;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String exist = Redis.use("group1_db1").get("robot_exist");
|
String exist = Redis.use("group1_db1").get("robot_exist");
|
||||||
if (StringUtil.isNotEmpty(exist))
|
if (StringUtil.isNotEmpty(exist))
|
||||||
{
|
{
|
||||||
|
|
@ -218,6 +224,19 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
long time = System.currentTimeMillis() / 1000;
|
long time = System.currentTimeMillis() / 1000;
|
||||||
for (String room : rooms) {
|
for (String room : rooms) {
|
||||||
List<String> room_list = Redis.use("group1_db0").hmget(room, "fake", "status", "round", "id", "times", "players", "create_time", "fake_existTime");
|
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);
|
String fake_json = room_list.get(0);
|
||||||
if (fake_json == null)
|
if (fake_json == null)
|
||||||
|
|
@ -236,7 +255,7 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
}
|
}
|
||||||
int round = Integer.parseInt(strRound);
|
int round = Integer.parseInt(strRound);
|
||||||
|
|
||||||
String roomId = room_list.get(3);
|
|
||||||
if(StringUtil.isEmpty(roomId)) {
|
if(StringUtil.isEmpty(roomId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -246,6 +265,9 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int maxRound = Integer.parseInt(maxStrRound);
|
int maxRound = Integer.parseInt(maxStrRound);
|
||||||
if (round == 0) {
|
if (round == 0) {
|
||||||
roomUpdateEvent(room, groupId, roomId);
|
roomUpdateEvent(room, groupId, roomId);
|
||||||
|
|
@ -270,7 +292,8 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean exitGame = false;
|
boolean exitGame = false;
|
||||||
ITArray players = TArray.newFromJsonData(room_list.get(5));
|
|
||||||
|
|
||||||
if (round >= 1)
|
if (round >= 1)
|
||||||
{
|
{
|
||||||
int fake_hp = (int)(Math.random() * 100000);
|
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").srem("used_robot", Integer.toString(player_id));
|
||||||
Redis.use("group1_db1").sadd("free_robot", Integer.toString(player_id));
|
Redis.use("group1_db1").sadd("free_robot", Integer.toString(player_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//清空桌子
|
||||||
GroupPublisherService.delRoomEvt(groupId, roomId);
|
GroupPublisherService.delRoomEvt(groupId, roomId);
|
||||||
jedis.zrem(grooms_key, room);
|
jedis.zrem(grooms_key, room);
|
||||||
Redis.use().hset(room, "status", 3 + "");
|
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);
|
Redis.use("group1_db11").zadd(grooms_key, pid*10000+1101, room_key);
|
||||||
GroupPublisherService.addRoomEvt(groupId, newRoomId);
|
GroupPublisherService.addRoomEvt(groupId, newRoomId);
|
||||||
updateRedisMap(groupId, newRoomId, room_key, roomMap, maxPlayers);
|
updateRedisMap(groupId, newRoomId, room_key, roomMap, maxPlayers);
|
||||||
|
|
||||||
return room_key;
|
return room_key;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -830,6 +856,7 @@ public class UpdatePlayRoomJob implements Job{
|
||||||
userData.putUtfString("password", Utils.getMD5Hash(password));
|
userData.putUtfString("password", Utils.getMD5Hash(password));
|
||||||
long reg_time = System.currentTimeMillis() / 1000;
|
long reg_time = System.currentTimeMillis() / 1000;
|
||||||
userData.putLong("reg_time", reg_time);
|
userData.putLong("reg_time", reg_time);
|
||||||
|
userData.putInt("jiqiren",0);
|
||||||
logger.info("create robot account:"+userData.toJson()+" password:" + password);
|
logger.info("create robot account:"+userData.toJson()+" password:" + password);
|
||||||
int result = DataBase.use().insert("account", userData);
|
int result = DataBase.use().insert("account", userData);
|
||||||
if (result == -1) {
|
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) {
|
public static void main(String[] args) {
|
||||||
HuNanChangSha huNanChangSha = new HuNanChangSha();
|
HuNanChangSha huNanChangSha = new HuNanChangSha();
|
||||||
ITObject params = TObject.newInstance();
|
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<>();
|
List<Integer> hands1 = new ArrayList<>();
|
||||||
hands1.add(209);
|
hands1.add(209);
|
||||||
hands1.add(209);
|
hands1.add(209);
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ public class JiQiRens {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
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)) {
|
if ("66".equalsIgnoreCase(wanfaId)) {
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class jiqiren {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
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();
|
//TaurusClient client1=getClient();
|
||||||
client.connect();
|
client.connect();
|
||||||
mapclient.put(randomKeyFromList, client);
|
mapclient.put(randomKeyFromList, client);
|
||||||
|
|
@ -220,7 +220,7 @@ public class jiqiren {
|
||||||
// client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
|
// client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
|
||||||
}
|
}
|
||||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
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();
|
client.connect();
|
||||||
mapclient.put(randomKeyFromList, client);
|
mapclient.put(randomKeyFromList, client);
|
||||||
}
|
}
|
||||||
|
|
@ -404,7 +404,7 @@ public class jiqiren {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("10".equalsIgnoreCase(wanfaId)) {
|
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.setSession(session);
|
||||||
client.connect();
|
client.connect();
|
||||||
mapclient.put(randomKeyFromList, client);
|
mapclient.put(randomKeyFromList, client);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class lianjiejiqiren {
|
||||||
ITObject param = message.param;
|
ITObject param = message.param;
|
||||||
//回调协议号
|
//回调协议号
|
||||||
String command = message.command;
|
String command = message.command;
|
||||||
|
System.out.println("command: " + command);
|
||||||
//根据玩法id 调用不同的回调
|
//根据玩法id 调用不同的回调
|
||||||
if (StringUtil.isNotEmpty(command)) {
|
if (StringUtil.isNotEmpty(command)) {
|
||||||
if ("66".equalsIgnoreCase(wanfaId)) {//跑的快
|
if ("66".equalsIgnoreCase(wanfaId)) {//跑的快
|
||||||
|
|
@ -585,7 +585,17 @@ public class lianjiejiqiren {
|
||||||
//吃碰杠
|
//吃碰杠
|
||||||
huNanChangSha.actionCard(param, client);
|
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
|
//db0
|
||||||
Jedis jedis22 = Redis.use().getJedis();
|
Jedis jedis22 = Redis.use().getJedis();
|
||||||
//db2
|
//db2
|
||||||
|
|
@ -605,13 +615,13 @@ public class lianjiejiqiren {
|
||||||
if (jedis33.hget(getKey, "pid") != null) {
|
if (jedis33.hget(getKey, "pid") != null) {
|
||||||
String circleId1 = jedis33.hget(getKey, "circleId");
|
String circleId1 = jedis33.hget(getKey, "circleId");
|
||||||
String pid = jedis33.hget(getKey, "pid");
|
String pid = jedis33.hget(getKey, "pid");
|
||||||
|
System.out.println("comds2:2002");
|
||||||
String key = "g{" + circleId1 + "}:play:" + pid;
|
String key = "g{" + circleId1 + "}:play:" + pid;
|
||||||
if (jedis33.hget(getKey, "room_id") != null) {
|
if (jedis33.hget(getKey, "room_id") != null) {
|
||||||
String roomid = jedis33.hget(getKey, "room_id");
|
String roomid = jedis33.hget(getKey, "room_id");
|
||||||
|
|
||||||
String roomKey = "room:" + roomid;
|
String roomKey = "room:" + roomid;
|
||||||
|
System.out.println("comds3:2002");
|
||||||
if (jedis22.hget(roomKey, "players") != null) {
|
if (jedis22.hget(roomKey, "players") != null) {
|
||||||
String players = jedis22.hget(roomKey, "players");
|
String players = jedis22.hget(roomKey, "players");
|
||||||
if (!players.equals("[]")) {
|
if (!players.equals("[]")) {
|
||||||
|
|
@ -619,6 +629,7 @@ public class lianjiejiqiren {
|
||||||
playerIds2 = players.split(",");
|
playerIds2 = players.split(",");
|
||||||
if (playerIds2.length == 1) {
|
if (playerIds2.length == 1) {
|
||||||
if (!pid.equals("0")) {
|
if (!pid.equals("0")) {
|
||||||
|
System.out.println("comds4:2002");
|
||||||
Jedis jedis20 = Redis.use("group1_db11").getJedis();
|
Jedis jedis20 = Redis.use("group1_db11").getJedis();
|
||||||
System.out.println("进入 -------------------------");
|
System.out.println("进入 -------------------------");
|
||||||
jedis20.hincrBy(key, "leftover_robot", 1);
|
jedis20.hincrBy(key, "leftover_robot", 1);
|
||||||
|
|
@ -638,6 +649,7 @@ public class lianjiejiqiren {
|
||||||
jedis33.hset(getKey, "pid", "0");
|
jedis33.hset(getKey, "pid", "0");
|
||||||
jedis33.hset(getKey, "room_id", "0");
|
jedis33.hset(getKey, "room_id", "0");
|
||||||
//退出修改机器人状态
|
//退出修改机器人状态
|
||||||
|
System.out.println("comds5:2002");
|
||||||
jedis33.hset(key, String.valueOf(aid), "0");
|
jedis33.hset(key, String.valueOf(aid), "0");
|
||||||
TaurusClient taurusClient = (TaurusClient) entry.getValue();
|
TaurusClient taurusClient = (TaurusClient) entry.getValue();
|
||||||
taurusClient.send("1005", params, response -> {
|
taurusClient.send("1005", params, response -> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue