back_recharge
xuexinpeng 2021-12-29 17:26:42 +08:00
parent 5e811fb9aa
commit 4ea6f544cb
5 changed files with 49 additions and 27 deletions

View File

@ -55,7 +55,9 @@ public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.Explor
}
CommonProto.Drop.Builder dropPro = ItemUtil.drop(user, comDropMap.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST_RETURN);
explorer.get(teamId).getDropMap().clear();
explorer.get(teamId).setDropMap(explorer.get(teamId).getDropMap());
//explorer.get(teamId).setDropMap(explorer.get(teamId).getDropMap());
explorer.remove(teamId);
user.getPlayerInfoManager().setExplorer(explorer);
CommonProto.ExplorerMapInfo explorerMapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(teamId).build();
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapRewardResponse.getNumber(), builder.setDrop(dropPro).
setExploreInfo(explorerMapInfo).build(), true);

View File

@ -43,11 +43,23 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
}
PlayerInfoProto.ExplorerMapSendResponse.Builder builder = PlayerInfoProto.ExplorerMapSendResponse.newBuilder();
List<CommonProto.ExplorerMapSendInfo> reqInfo = proto.getSendDataList();
//Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
//如果派遣时 上面有队伍 派遣失败
for (CommonProto.ExplorerMapSendInfo info : reqInfo) {
int teamId = info.getTeamId();
if(explorer.containsKey(teamId)){
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapSendResponse.getNumber(), builder.build(), true);
return;
}
}
Map<Integer, Integer> map = new HashMap<>();
for (CommonProto.ExplorerMapSendInfo info : reqInfo) {
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(info.getMapId());
map.put(exploreConfig.getCost()[0], info.getTime() * hourMinute * exploreConfig.getCost()[1]);
if(map.containsKey(exploreConfig.getCost()[0])){
map.put(exploreConfig.getCost()[0], info.getTime() * hourMinute * exploreConfig.getCost()[1]+map.get(exploreConfig.getCost()[0]));
}else{
map.put(exploreConfig.getCost()[0], info.getTime() * hourMinute * exploreConfig.getCost()[1]);
}
}
//消耗
if (!ItemUtil.itemCost(user, map.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST, 1)) {

View File

@ -37,11 +37,12 @@ public enum TeamEnum {
FOURCHALLENGE_MORALITY_TEAM(3004,"四灵试炼-道"),
SEVEN_WORLD_TEAM(2101,"七届试炼编队",1,0),
EXPLORE_TEAM_ONE(3101,"探索第一编队",1,0),
EXPLORE_TEAM_TWO(3102,"探索第二编队",1,0),
EXPLORE_TEAM_TREE(3103,"探索第三编队",1,0),
EXPLORE_TEAM_FOUR(3104,"探索第四编队",1,0),
EXPLORE_TEAM_FIVE(3105,"探索第五编队",1,0),
//探索编队
EXPLORE_TEAM_ONE(3101,"1",1,0),
EXPLORE_TEAM_TWO(3102,"2",1,0),
EXPLORE_TEAM_TREE(3103,"3",1,0),
EXPLORE_TEAM_FOUR(3104,"4",1,0),
EXPLORE_TEAM_FIVE(3105,"5",1,0),
;
/**

View File

@ -95,12 +95,12 @@ public class ExplorerMapLogic {
LOGGER.info("怪物赢了:");
sendIndication(user.getId(),explorerInfo,teamId);
} else {
LOGGER.info("玩家赢了:");
Map<Integer, Integer> dropMap = explorerInfo.getDropMap();
if (dropMap == null) {
dropMap = new HashMap<>();
}
Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, exploreConfig.getReward(), 1, 0, BIReason.EXPLORE_MAP_GET);
LOGGER.info("玩家赢了 掉落组=>{}", explorerInfo.getEnemyReliveTime(), exploreConfig.getReward());
for (Map.Entry<Integer, Integer> keyVal : itemMap.entrySet()) {
if (dropMap.containsKey(keyVal.getKey())) {
dropMap.put(keyVal.getKey(), dropMap.get(keyVal.getKey()) + keyVal.getValue());
@ -122,13 +122,13 @@ public class ExplorerMapLogic {
LOGGER.info("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
}
//怪物死亡 设置重生时间
if (explorerInfo.getEnemyHp() != 0) {
if (explorerInfo.getEnemyHp() == 0) {
if (time == 0) {
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt() + exploreConfig.getBattleInterval());
} else {
explorerInfo.setEnemyReliveTime(time + exploreConfig.getBattleInterval());
}
LOGGER.info("怪物死亡=》重生时间{} 掉落=>{}", explorerInfo.getEnemyReliveTime(), exploreConfig.getReward());
LOGGER.info("怪物死亡=》重生时间{}", explorerInfo.getEnemyReliveTime());
}
if (time == 0) {
@ -219,16 +219,19 @@ public class ExplorerMapLogic {
continue;
}
List<Integer> delayId = new ArrayList<>();
List<Integer> deleteMapPlayer = new ArrayList<>(); //地图玩家信息
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
//探索时间到期
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
delayId.add(keyVal.getKey());
deleteMapPlayer.add(keyVal.getValue().getMapId());
} else {
//复活玩家
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= TimeUtils.nowInt()) {
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
keyVal.getValue().setPlayerHp(teamForce);
LOGGER.info("复活玩家:" + uid);
sendIndication(user.getId(),keyVal.getValue(),keyVal.getKey());
}
//复活怪物
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= TimeUtils.nowInt()) {
@ -250,6 +253,24 @@ public class ExplorerMapLogic {
}
}
}
//地图内到期玩家删除
for(int mapId:deleteMapPlayer){
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
String key;
RedisUtil redisUtil = RedisUtil.getInstence();
if (crossGroup == -1) {
key = Integer.toString(mapId);
} else {
//跨服分组
key = Integer.toString(crossGroup) + RedisKey.Delimiter_colon + mapId;
}
Set<String> set = redisUtil.sGet(RedisKey.EXPLORER_MAP_PLAYER + RedisKey.Delimiter_colon + key);
if (set.contains(String.valueOf(user.getId()))) {
long remove = RedisUtil.getInstence().setRemove(RedisKey.EXPLORER_MAP_PLAYER + RedisKey.Delimiter_colon + key, String.valueOf(uid));
LOGGER.info("remove:" + remove);
}
}
//本人探索地图到期
for (int id : delayId) {
if (!explorer.containsKey(id)) {
continue;
@ -277,7 +298,6 @@ public class ExplorerMapLogic {
MailLogic.getInstance().sendMail(uid, title, content,
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
}
int mapId = explorer.get(id).getMapId();
explorer.remove(id);
CommonProto.ExplorerMapInfo mapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(id).build();
ISession sess = OnlineUserManager.sessionMap.get(uid);
@ -286,20 +306,7 @@ public class ExplorerMapLogic {
indication.setExploreInfo(mapInfo);
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
}
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
String key;
RedisUtil redisUtil = RedisUtil.getInstence();
if (crossGroup == -1) {
key = Integer.toString(mapId);
} else {
//跨服分组
key = Integer.toString(crossGroup) + RedisKey.Delimiter_colon + mapId;
}
Set<String> set = redisUtil.sGet(RedisKey.EXPLORER_MAP_PLAYER + RedisKey.Delimiter_colon + key);
if (set.contains(String.valueOf(user.getId()))) {
long remove = RedisUtil.getInstence().setRemove(RedisKey.EXPLORER_MAP_PLAYER + RedisKey.Delimiter_colon + key, String.valueOf(uid));
LOGGER.info("remove:" + remove);
}
}
if (delayId.size() > 0) {
user.getPlayerInfoManager().setExplorer(explorer);

View File

@ -53,7 +53,7 @@ public class SExploreFight implements BaseConfig {
public static SExploreFight getConfigByFightDownAndFightUp(float ratio){
for(SExploreFight data:exploreFight.values()){
if(ratio>= data.fightDown&& data.fightUp<= ratio){
if(ratio>= data.fightDown&& data.fightUp>= ratio){
return data;
}
}