back_recharge
parent
5e811fb9aa
commit
4ea6f544cb
|
@ -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);
|
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).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();
|
CommonProto.ExplorerMapInfo explorerMapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(teamId).build();
|
||||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapRewardResponse.getNumber(), builder.setDrop(dropPro).
|
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapRewardResponse.getNumber(), builder.setDrop(dropPro).
|
||||||
setExploreInfo(explorerMapInfo).build(), true);
|
setExploreInfo(explorerMapInfo).build(), true);
|
||||||
|
|
|
@ -43,11 +43,23 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
||||||
}
|
}
|
||||||
PlayerInfoProto.ExplorerMapSendResponse.Builder builder = PlayerInfoProto.ExplorerMapSendResponse.newBuilder();
|
PlayerInfoProto.ExplorerMapSendResponse.Builder builder = PlayerInfoProto.ExplorerMapSendResponse.newBuilder();
|
||||||
List<CommonProto.ExplorerMapSendInfo> reqInfo = proto.getSendDataList();
|
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<>();
|
Map<Integer, Integer> map = new HashMap<>();
|
||||||
for (CommonProto.ExplorerMapSendInfo info : reqInfo) {
|
for (CommonProto.ExplorerMapSendInfo info : reqInfo) {
|
||||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(info.getMapId());
|
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)) {
|
if (!ItemUtil.itemCost(user, map.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).toArray(int[][]::new), BIReason.EXPLORE_MAP_COST, 1)) {
|
||||||
|
|
|
@ -37,11 +37,12 @@ public enum TeamEnum {
|
||||||
FOURCHALLENGE_MORALITY_TEAM(3004,"四灵试炼-道"),
|
FOURCHALLENGE_MORALITY_TEAM(3004,"四灵试炼-道"),
|
||||||
SEVEN_WORLD_TEAM(2101,"七届试炼编队",1,0),
|
SEVEN_WORLD_TEAM(2101,"七届试炼编队",1,0),
|
||||||
|
|
||||||
EXPLORE_TEAM_ONE(3101,"探索第一编队",1,0),
|
//探索编队
|
||||||
EXPLORE_TEAM_TWO(3102,"探索第二编队",1,0),
|
EXPLORE_TEAM_ONE(3101,"1",1,0),
|
||||||
EXPLORE_TEAM_TREE(3103,"探索第三编队",1,0),
|
EXPLORE_TEAM_TWO(3102,"2",1,0),
|
||||||
EXPLORE_TEAM_FOUR(3104,"探索第四编队",1,0),
|
EXPLORE_TEAM_TREE(3103,"3",1,0),
|
||||||
EXPLORE_TEAM_FIVE(3105,"探索第五编队",1,0),
|
EXPLORE_TEAM_FOUR(3104,"4",1,0),
|
||||||
|
EXPLORE_TEAM_FIVE(3105,"5",1,0),
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,12 +95,12 @@ public class ExplorerMapLogic {
|
||||||
LOGGER.info("怪物赢了:");
|
LOGGER.info("怪物赢了:");
|
||||||
sendIndication(user.getId(),explorerInfo,teamId);
|
sendIndication(user.getId(),explorerInfo,teamId);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("玩家赢了:");
|
|
||||||
Map<Integer, Integer> dropMap = explorerInfo.getDropMap();
|
Map<Integer, Integer> dropMap = explorerInfo.getDropMap();
|
||||||
if (dropMap == null) {
|
if (dropMap == null) {
|
||||||
dropMap = new HashMap<>();
|
dropMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, exploreConfig.getReward(), 1, 0, BIReason.EXPLORE_MAP_GET);
|
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()) {
|
for (Map.Entry<Integer, Integer> keyVal : itemMap.entrySet()) {
|
||||||
if (dropMap.containsKey(keyVal.getKey())) {
|
if (dropMap.containsKey(keyVal.getKey())) {
|
||||||
dropMap.put(keyVal.getKey(), dropMap.get(keyVal.getKey()) + keyVal.getValue());
|
dropMap.put(keyVal.getKey(), dropMap.get(keyVal.getKey()) + keyVal.getValue());
|
||||||
|
@ -122,13 +122,13 @@ public class ExplorerMapLogic {
|
||||||
LOGGER.info("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
|
LOGGER.info("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
|
||||||
}
|
}
|
||||||
//怪物死亡 设置重生时间
|
//怪物死亡 设置重生时间
|
||||||
if (explorerInfo.getEnemyHp() != 0) {
|
if (explorerInfo.getEnemyHp() == 0) {
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt() + exploreConfig.getBattleInterval());
|
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt() + exploreConfig.getBattleInterval());
|
||||||
} else {
|
} else {
|
||||||
explorerInfo.setEnemyReliveTime(time + exploreConfig.getBattleInterval());
|
explorerInfo.setEnemyReliveTime(time + exploreConfig.getBattleInterval());
|
||||||
}
|
}
|
||||||
LOGGER.info("怪物死亡=》重生时间{} 掉落=>{}", explorerInfo.getEnemyReliveTime(), exploreConfig.getReward());
|
LOGGER.info("怪物死亡=》重生时间{}", explorerInfo.getEnemyReliveTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time == 0) {
|
if (time == 0) {
|
||||||
|
@ -219,16 +219,19 @@ public class ExplorerMapLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<Integer> delayId = new ArrayList<>();
|
List<Integer> delayId = new ArrayList<>();
|
||||||
|
List<Integer> deleteMapPlayer = new ArrayList<>(); //地图玩家信息
|
||||||
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
|
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
|
||||||
//探索时间到期
|
//探索时间到期
|
||||||
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
|
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
|
||||||
delayId.add(keyVal.getKey());
|
delayId.add(keyVal.getKey());
|
||||||
|
deleteMapPlayer.add(keyVal.getValue().getMapId());
|
||||||
} else {
|
} else {
|
||||||
//复活玩家
|
//复活玩家
|
||||||
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= TimeUtils.nowInt()) {
|
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= TimeUtils.nowInt()) {
|
||||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||||
keyVal.getValue().setPlayerHp(teamForce);
|
keyVal.getValue().setPlayerHp(teamForce);
|
||||||
LOGGER.info("复活玩家:" + uid);
|
LOGGER.info("复活玩家:" + uid);
|
||||||
|
sendIndication(user.getId(),keyVal.getValue(),keyVal.getKey());
|
||||||
}
|
}
|
||||||
//复活怪物
|
//复活怪物
|
||||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= TimeUtils.nowInt()) {
|
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) {
|
for (int id : delayId) {
|
||||||
if (!explorer.containsKey(id)) {
|
if (!explorer.containsKey(id)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -277,7 +298,6 @@ public class ExplorerMapLogic {
|
||||||
MailLogic.getInstance().sendMail(uid, title, content,
|
MailLogic.getInstance().sendMail(uid, title, content,
|
||||||
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||||
}
|
}
|
||||||
int mapId = explorer.get(id).getMapId();
|
|
||||||
explorer.remove(id);
|
explorer.remove(id);
|
||||||
CommonProto.ExplorerMapInfo mapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(id).build();
|
CommonProto.ExplorerMapInfo mapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(id).build();
|
||||||
ISession sess = OnlineUserManager.sessionMap.get(uid);
|
ISession sess = OnlineUserManager.sessionMap.get(uid);
|
||||||
|
@ -286,20 +306,7 @@ public class ExplorerMapLogic {
|
||||||
indication.setExploreInfo(mapInfo);
|
indication.setExploreInfo(mapInfo);
|
||||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
|
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) {
|
if (delayId.size() > 0) {
|
||||||
user.getPlayerInfoManager().setExplorer(explorer);
|
user.getPlayerInfoManager().setExplorer(explorer);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SExploreFight implements BaseConfig {
|
||||||
|
|
||||||
public static SExploreFight getConfigByFightDownAndFightUp(float ratio){
|
public static SExploreFight getConfigByFightDownAndFightUp(float ratio){
|
||||||
for(SExploreFight data:exploreFight.values()){
|
for(SExploreFight data:exploreFight.values()){
|
||||||
if(ratio>= data.fightDown&& data.fightUp<= ratio){
|
if(ratio>= data.fightDown&& data.fightUp>= ratio){
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue