|
@@ -176,7 +176,7 @@ public class Contest {
|
|
|
this.data.contestId, this.prop.desc, this.actors.size());
|
|
|
}
|
|
|
//给其他人推送当前
|
|
|
- this.actors.forEach((id, p) -> {
|
|
|
+ GGame.onlinePlayers.forEach((id, p) -> {
|
|
|
Map<String, Object> map = ProtoUtil.contestInfoToMessage(this);
|
|
|
p.receive(CommonProto.Cmd.GetSignUpNum_VALUE, map);
|
|
|
});
|
|
@@ -345,8 +345,6 @@ public class Contest {
|
|
|
// jsonData.put("recordType", 2);
|
|
|
// jsonData.put("watchType", 4);
|
|
|
cn.hutool.json.JSONObject rule = this.prop.rule;
|
|
|
- jsonData.put("playingTypeOne", rule.get("playingTypeOne"));
|
|
|
- jsonData.put("playingTypeTwo", rule.get("playingTypeTwo"));
|
|
|
jsonData.put("upgradeType", rule.get("upgradeType"));
|
|
|
jsonData.put("flippingType", rule.get("flippingType"));
|
|
|
jsonData.put("advanceType", rule.get("advanceType"));
|
|
@@ -354,26 +352,30 @@ public class Contest {
|
|
|
jsonData.put("voiceType", rule.get("voiceType"));
|
|
|
jsonData.put("recordType", rule.get("recordType"));
|
|
|
jsonData.put("watchType", rule.get("watchType"));
|
|
|
+ jsonData.put("tc", rule.get("levelType")==null?0:rule.get("levelType"));
|
|
|
+ jsonData.put("pv", rule.get("pointsType")==null?0:rule.get("pointsType"));
|
|
|
+ jsonData.put("dv", rule.get("doublingType")==null?0:rule.get("doublingType"));
|
|
|
// 房间id
|
|
|
jsonData.put("roomId", RoomService.getInstance().randomRoomIdByContest());
|
|
|
// 人数模式 2:2人 4:4人
|
|
|
jsonData.put("playerNum", 4);
|
|
|
- // 房间最大局数 分为预赛和决赛
|
|
|
-// jsonData.put("maxRound", this.prop.maxRound);
|
|
|
- if (this.waitingPlayers.size() <= 4) {//决赛
|
|
|
- this.prop.maxRound = this.prop.finalNum;
|
|
|
- } else {
|
|
|
- this.prop.maxRound = this.prop.readyNum;
|
|
|
- }
|
|
|
-
|
|
|
-// jsonData.put("maxRound", this.prop.maxRound);
|
|
|
+ Integer playingTypeOne = (Integer)rule.get("playingTypeOne");
|
|
|
+ Integer playingTypeTwo = (Integer)rule.get("playingTypeTwo");
|
|
|
// 玩法1 1:连续打,2:按局数,3:按时间
|
|
|
- jsonData.put("mode", 2);
|
|
|
- // * 14:A必打 2:J必打 3:8必打 4:5必打
|
|
|
- // * 4:4局 6:6局 8:8局 10:10局
|
|
|
- // * 20:20分钟 30:30分钟 40:40分钟 60:60分钟
|
|
|
- jsonData.put("modev", 1);
|
|
|
-
|
|
|
+ jsonData.put("mode", playingTypeOne);
|
|
|
+ if (playingTypeOne==2){ //按局数
|
|
|
+ // 房间最大局数 分为预赛和决赛
|
|
|
+ if (this.waitingPlayers.size() <= 4) {//决赛
|
|
|
+ this.prop.maxRound = this.prop.finalNum;
|
|
|
+ } else {
|
|
|
+ this.prop.maxRound = this.prop.readyNum;
|
|
|
+ }
|
|
|
+ jsonData.put("modev", this.prop.maxRound);
|
|
|
+ }else {//按时间
|
|
|
+ // * 4:4局 6:6局 8:8局 10:10局
|
|
|
+ // * 20:20分钟 30:30分钟 40:40分钟 60:60分钟
|
|
|
+ jsonData.put("modev", playingTypeTwo);
|
|
|
+ }
|
|
|
// 房间类型 0:好友房 1:官方比赛房
|
|
|
jsonData.put("type", 1);
|
|
|
// 房间玩法类型 1:掼蛋
|
|
@@ -470,6 +472,7 @@ public class Contest {
|
|
|
return;
|
|
|
}
|
|
|
object.put("status", "3");
|
|
|
+ object.put("num", this.actors.size());
|
|
|
object.put("competeId", this.data.contestId);
|
|
|
try {
|
|
|
RabbitMQUtil.sendMessage(object.toString());
|
|
@@ -559,6 +562,16 @@ public class Contest {
|
|
|
map.put("contestInfo", GetContestListHandler.contestInfoList((Player) player));
|
|
|
player.receive(CommonProto.Cmd.GetContestListRes_VALUE, map);
|
|
|
}
|
|
|
+ //发送比赛结束消息
|
|
|
+ cn.hutool.json.JSONObject object = new cn.hutool.json.JSONObject();
|
|
|
+ object.put("type", "updateCompete");
|
|
|
+ object.put("status", "4");
|
|
|
+ object.put("competeId", this.data.contestId);
|
|
|
+ try {
|
|
|
+ RabbitMQUtil.sendMessage(object.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -570,11 +583,6 @@ public class Contest {
|
|
|
*/
|
|
|
private void promotionLv() {
|
|
|
Map<Long, List<Struct.PromotionData>> roomMap = this.data.promotionMap.getOrDefault(this.data.curRound, new HashMap<>());
|
|
|
- // 每个房间需要晋级的人数
|
|
|
- int cnt;
|
|
|
-
|
|
|
- // 首轮按配置表晋级,后面按头游二游晋级
|
|
|
- cnt = this.prop.model == 4 ? 2 : 1;
|
|
|
|
|
|
List<Player> objects = new ArrayList<>();
|
|
|
for (Room room : this.rooms.values()) {
|
|
@@ -621,74 +629,6 @@ public class Contest {
|
|
|
objects.add(tmPlayer);
|
|
|
}
|
|
|
}
|
|
|
-// objects.addAll(list);
|
|
|
- //开始循环
|
|
|
-// for (int i = 1; i <= ((GDRoom) room).data.result.size(); i++) {
|
|
|
-// Player player = ((GDRoom) room).data.result.getOrDefault(i, null);
|
|
|
-// if (player != null) {
|
|
|
-// player.data.roomId = 0;
|
|
|
-//
|
|
|
-// list.add(new Struct.PromotionData(player.getId(), player.data.avatarUrl, player.data.name,0, i, i <= cnt));
|
|
|
-// Map<String, Object> messageMap = new HashMap<>();
|
|
|
-// String message = "";
|
|
|
-// int cmd;
|
|
|
-// if (i <= 2 && this.rooms.size() > 1) {
|
|
|
-// message = "恭喜你晋级下一轮比赛";
|
|
|
-// this.waitingPlayers.add(player.getId());
|
|
|
-// cmd = CommonProto.Cmd.PromotePlayer_VALUE;
|
|
|
-// messageMap.put("message", message);
|
|
|
-// player.receive(cmd, messageMap);
|
|
|
-// } else if (i >= 2 && this.rooms.size() > 1) {
|
|
|
-// message = "很抱歉,您已被淘汰";
|
|
|
-// this.waitingPlayers.remove(player.getId());
|
|
|
-// this.DieOutPlayers.add(player.getId());
|
|
|
-// cmd = CommonProto.Cmd.DieOutPlayer_VALUE;
|
|
|
-// messageMap.put("message", message);
|
|
|
-// player.receive(cmd, messageMap);
|
|
|
-// }
|
|
|
-// if (this.rooms.size() <= 1){
|
|
|
-// HashMap<String, Object> map = new HashMap<>();
|
|
|
-// JSONArray rewards = this.prop.rewards;
|
|
|
-// switch (i) {
|
|
|
-// case 1:
|
|
|
-// processRank(1, player, rewards, map);
|
|
|
-// break;
|
|
|
-// case 2:
|
|
|
-// processRank(2, player, rewards, map);
|
|
|
-// break;
|
|
|
-// case 3:
|
|
|
-// processRank(3, player, rewards, map);
|
|
|
-// break;
|
|
|
-// case 4:
|
|
|
-// processRank(4, player, rewards, map);
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// cmd = CommonProto.Cmd.FirstPlayer_VALUE;
|
|
|
-// map.put("QR", "");
|
|
|
-// // 创建一个Date对象,表示当前时间
|
|
|
-// Date now = new Date();
|
|
|
-// // 定义日期时间格式
|
|
|
-// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-// // 格式化Date对象为字符串
|
|
|
-// String formattedDateTime = formatter.format(now);
|
|
|
-// map.put("date",formattedDateTime);
|
|
|
-// map.put("contestName", this.prop.desc);
|
|
|
-// messageMap.put("message", map);
|
|
|
-// player.receive(cmd, messageMap);
|
|
|
-//
|
|
|
-// cn.hutool.json.JSONObject object = new cn.hutool.json.JSONObject();
|
|
|
-// object.put("type","GetCompeteReward");
|
|
|
-// object.put("userId",player.data.playerId);
|
|
|
-// object.put("competeId",this.data.contestId);
|
|
|
-// object.put("rank",i);
|
|
|
-// try {
|
|
|
-// RabbitMQUtil.sendMessage(object.toString());
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
}
|
|
|
roomMap.put(room.data.roomId, list);
|
|
|
}
|