master_haizei01
grimm 2024-05-07 11:47:41 +08:00
parent c1ff5f6ec8
commit 0e11a20dc9
2 changed files with 38 additions and 39 deletions

View File

@ -94,18 +94,18 @@ public class AllPeopleWelfareActivity extends AbstractActivity {
}
public static void addValue(int goodId, int count){
String key = RedisUtil.getInstence().getKeyNew(String.valueOf(GameApplication.serverId), RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT);
String key = RedisUtil.getInstence().getKeyNew(RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT, String.valueOf(GameApplication.serverId));
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(goodId), count);
}
public static int getValue(int goodId){
String key = RedisUtil.getInstence().getKeyNew(String.valueOf(GameApplication.serverId), RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT);
String key = RedisUtil.getInstence().getKeyNew(RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT, String.valueOf(GameApplication.serverId));
Double zSetScore = RedisUtil.getInstence().getZSetScoreOrigin(key, String.valueOf(goodId));
return Optional.ofNullable(zSetScore).orElse(0d).intValue();
}
public static Map<Integer, Integer> getAllValue(){
String key = RedisUtil.getInstence().getKeyNew(String.valueOf(GameApplication.serverId), RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT);
String key = RedisUtil.getInstence().getKeyNew(RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT, String.valueOf(GameApplication.serverId));
Set<ZSetOperations.TypedTuple<String>> tuples = RedisUtil.getInstence().getZsetRangeWithScore(key, 0, -1);
HashMap<Integer, Integer> result = new HashMap<>();
Iterator<ZSetOperations.TypedTuple<String>> iterator = tuples.iterator();

View File

@ -9,7 +9,6 @@ import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
import com.ljsd.jieling.logic.dao.ArenaEnemy;
import com.ljsd.jieling.logic.dao.ArenaManager;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mail.MailLogic;
@ -139,42 +138,42 @@ public class CrossYuxulundaoLogic {
/**
*
*/
public void resetSeason(User user) {
PlayerManager player = user.getPlayerInfoManager();
// public void resetSeason(User user) {
// PlayerManager player = user.getPlayerInfoManager();
//
// }
}
public void setMatchRivals(User user) {
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
if (crossGroup == -1) {
return;
}
Set<Integer> robotIds = new HashSet<>(5);
ArenaManager arenaManager = user.getArenaManager();
int curLevel = arenaManager.getCrossYuxulundaoNewLevelId();//当前段位
List<ArenaEnemy> arenaEnemies = new ArrayList<>(); //得存储
Map<Integer, SMServerRankConfig> robotConfigMap = STableManager.getConfig(SMServerRankConfig.class);
if (!robotConfigMap.containsKey(curLevel)) {
return;
}
int[] timePool = robotConfigMap.get(curLevel).getFitRobotPool();
if (arenaManager.getCrossMatchTimes() < timePool[0]) {
//匹配机器人
List<SArenaRobotConfig> robotConfig = STableManager.getConfig(SArenaRobotConfig.class).values().stream().filter(n -> n.getPoolId() == timePool[1]).collect(Collectors.toList());
Collections.shuffle(robotConfig);
robotConfig.subList(0, 0).forEach(n -> robotIds.add(n.getId()));
for (int robot : robotIds) {
arenaEnemies.add(new ArenaEnemy(robot, 1, 0));
}
arenaManager.setCrossMatchTimes(arenaManager.getCrossMatchTimes() + 1);
arenaManager.setArenaEnemies(arenaEnemies);
} else {
//TODO 次数超过后怎么匹配真人 真人不足怎么办 匹配真人的规则
}
}
// public void setMatchRivals(User user) {
// int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
// if (crossGroup == -1) {
// return;
// }
// Set<Integer> robotIds = new HashSet<>(5);
// ArenaManager arenaManager = user.getArenaManager();
// int curLevel = arenaManager.getCrossYuxulundaoNewLevelId();//当前段位
// List<ArenaEnemy> arenaEnemies = new ArrayList<>(); //得存储
//
//
// Map<Integer, SMServerRankConfig> robotConfigMap = STableManager.getConfig(SMServerRankConfig.class);
// if (!robotConfigMap.containsKey(curLevel)) {
// return;
// }
// int[] timePool = robotConfigMap.get(curLevel).getFitRobotPool();
// if (arenaManager.getCrossMatchTimes() < timePool[0]) {
// //匹配机器人
// List<SArenaRobotConfig> robotConfig = STableManager.getConfig(SArenaRobotConfig.class).values().stream().filter(n -> n.getPoolId() == timePool[1]).collect(Collectors.toList());
// Collections.shuffle(robotConfig);
// robotConfig.subList(0, 0).forEach(n -> robotIds.add(n.getId()));
// for (int robot : robotIds) {
// arenaEnemies.add(new ArenaEnemy(robot, 1, 0));
// }
// arenaManager.setCrossMatchTimes(arenaManager.getCrossMatchTimes() + 1);
// arenaManager.setArenaEnemies(arenaEnemies);
// } else {
// //TODO 次数超过后怎么匹配真人 真人不足怎么办 匹配真人的规则
// }
//
// }
/**
*