back_recharge
parent
8f0010b1be
commit
87bcc6d5d7
|
@ -1428,7 +1428,7 @@ public class RedisUtil {
|
|||
RedisKey.CROSS_YUXULUNDAO_RANK.equals(type)||RedisKey.CROSS_YUXULUNDAO_ROBOT_INFO.equals(type)||
|
||||
RedisKey.CROSS_YUXULUNDAO_RECORD.equals(type)|| RedisKey.CROSS_YUXULUNDAO_RANK_PERSON.equals(type)
|
||||
||RedisKey.CROSS_LINGMAISECRET_INFO.equals(type)||RedisKey.CROSS_LINGMAISECRET_RECORD.equals(type)
|
||||
||RedisKey.CROSS_LINGMAI_RANK_PERSON.equals(type)
|
||||
||RedisKey.CROSS_LINGMAI_RANK_PERSON.equals(type)||RedisKey.EXPLORER_MAP_PLAYER.equals(type)
|
||||
) {
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
int [][] drop = new int[1][2];
|
||||
drop[0][0]=exploreConfig.getCost()[0];
|
||||
drop[0][1]=exploreConfig.getCost()[1]*min;
|
||||
/*MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索,以下为尚未消耗的晶石,请查收。",
|
||||
MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索,以下为尚未消耗的晶石,请查收。",
|
||||
StringUtil.parseArrayToString(drop), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapInfoResponse.getNumber(), builder.build(), true);
|
||||
*/
|
||||
//MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapInfoResponse.getNumber(), builder.build(), true);
|
||||
|
||||
CommonProto.ExplorerMapInfo explorerMapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(teamId).build();
|
||||
CommonProto.Drop.Builder dropPro = ItemUtil.drop(user, explorer.get(teamId).getDropItem().stream().toArray(int[][]::new), BIReason.EXPEDITION_BOX_REWARD);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapInfoResponse.getNumber(), builder.setDrop(dropPro).
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
|||
int time = info.getTime() * hourSecond;
|
||||
//TODO 消耗
|
||||
//TODO redis
|
||||
/*RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String rkey;
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
String key;
|
||||
|
@ -59,8 +59,11 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
|||
//rkey = RedisUtil.getInstence().getKey(RedisKey.EXPLORER_MAP_PLAYER, key);
|
||||
List<String> list = redisUtil.lGet(RedisKey.EXPLORER_MAP_PLAYER, key, 0, -1);
|
||||
if(!list.contains(String.valueOf(user.getId()))){
|
||||
redisUtil.lSet(key, String.valueOf(user.getId()));
|
||||
}*/
|
||||
//String key2 = RedisKey.getKey(RedisKey.EXPLORER_MAP_PLAYER, key, false);
|
||||
redisUtil.lSet(RedisKey.EXPLORER_MAP_PLAYER+ RedisKey.Delimiter_colon +key, String.valueOf(user.getId()));
|
||||
redisUtil.lRemove()
|
||||
|
||||
}
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(mapId);
|
||||
if (exploreConfig == null) {
|
||||
continue;
|
||||
|
@ -74,7 +77,7 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
|||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
explorerInfo.setPlayerHp(teamForce);
|
||||
explorerInfo.setEnemyHp(mapMonsterForce);
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt()+300);
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt()+60);
|
||||
//ExplorerMapLogic.singleBattle(user,teamId);
|
||||
|
||||
//explorer.put(teamId, explorerInfo);
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setSendEndTime(int sendEndTime) {
|
||||
updateString("sendEndTime", sendEndTime);
|
||||
this.sendEndTime = sendEndTime;
|
||||
}
|
||||
|
||||
|
@ -57,6 +58,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
if(playerHp<0){
|
||||
playerHp = 0;
|
||||
}
|
||||
updateString("playerHp", playerHp);
|
||||
this.playerHp = playerHp;
|
||||
}
|
||||
|
||||
|
@ -65,6 +67,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setPlayerReliveTime(int playerReliveTime) {
|
||||
updateString("playerReliveTime", playerReliveTime);
|
||||
this.playerReliveTime = playerReliveTime;
|
||||
}
|
||||
|
||||
|
@ -76,6 +79,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
if(enemyHp<0){
|
||||
enemyHp = 0;
|
||||
}
|
||||
updateString("enemyHp", enemyHp);
|
||||
this.enemyHp = enemyHp;
|
||||
}
|
||||
|
||||
|
@ -84,6 +88,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setEnemyReliveTime(int enemyReliveTime) {
|
||||
updateString("enemyReliveTime", enemyReliveTime);
|
||||
this.enemyReliveTime = enemyReliveTime;
|
||||
}
|
||||
|
||||
|
@ -92,6 +97,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setSendTime(int sendTime) {
|
||||
updateString("sendTime", sendTime);
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
|
@ -100,6 +106,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setDropItem(List<int[]> dropItem) {
|
||||
updateString("dropItem", dropItem);
|
||||
this.dropItem = dropItem;
|
||||
}
|
||||
|
||||
|
@ -109,6 +116,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
}
|
||||
|
||||
public void setBatteTime(int batteTime) {
|
||||
updateString("batteTime", batteTime);
|
||||
this.batteTime = batteTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.ljsd.jieling.logic.explorerMap;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.ExplorerInfo;
|
||||
|
@ -12,13 +14,16 @@ import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SExplore;
|
||||
import config.SExploreFight;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -72,14 +77,15 @@ public class ExplorerMapLogic {
|
|||
//玩家掉血
|
||||
int reducePlayer = (int) (teamForce * reduceRatio);
|
||||
explorerInfo.setPlayerHp(explorerInfo.getPlayerHp() - reducePlayer);
|
||||
LOGGER.error("玩家掉血:=》{}", (int) (explorerInfo.getPlayerHp() * reduceRatio));
|
||||
LOGGER.error("玩家掉血:=》{},剩余血量-》{}", reducePlayer,explorerInfo.getPlayerHp());
|
||||
//怪物掉血
|
||||
int reduceMonster = (int) (mapMonsterForce * reduceRatio);
|
||||
LOGGER.error("怪物掉血:=》{}", (int) (explorerInfo.getEnemyHp() * reduceRatio));
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp() - (reduceMonster));
|
||||
LOGGER.error("怪物掉血:=》{},剩余血量-》{}", reduceMonster,explorerInfo.getEnemyHp());
|
||||
//输赢判断
|
||||
if (reducePlayer > reduceMonster) {
|
||||
//怪物赢了 保留血量 下次打
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp() - (reduceMonster));
|
||||
LOGGER.error("怪物赢了:");
|
||||
} else {
|
||||
//玩家赢了
|
||||
List<int[]> dropitem = explorerInfo.getDropItem();
|
||||
|
@ -89,6 +95,7 @@ public class ExplorerMapLogic {
|
|||
Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, new int[]{exploreConfig.getReward()}, 1, 0, BIReason.TA_SUI_LING_XIAO);
|
||||
List<int[]> addDropitem = itemMap.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).collect(Collectors.toList());
|
||||
dropitem.addAll(addDropitem);
|
||||
explorerInfo.setDropItem(dropitem);
|
||||
}
|
||||
//玩家死亡 设置重生时间
|
||||
if (explorerInfo.getPlayerHp() == 0) {
|
||||
|
@ -111,10 +118,11 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
}
|
||||
if (time == 0) {
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt() + 300);//设置下次战斗时间
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt() + 60);//设置下次战斗时间
|
||||
} else {
|
||||
explorerInfo.setBatteTime(time + 300);//设置下次战斗时间
|
||||
explorerInfo.setBatteTime(time + 60);//设置下次战斗时间
|
||||
}
|
||||
user.getPlayerInfoManager().addExplorer(explorerInfo, teamId);
|
||||
LOGGER.error("战斗结束");
|
||||
|
||||
}
|
||||
|
@ -227,10 +235,12 @@ public class ExplorerMapLogic {
|
|||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
}
|
||||
//战斗时间是否到达
|
||||
if (keyVal.getValue().getBatteTime() < TimeUtils.nowInt()) {
|
||||
if (keyVal.getValue().getBatteTime() > TimeUtils.nowInt()) {
|
||||
continue;
|
||||
}
|
||||
singleBattle(user, keyVal.getValue(), keyVal.getKey(), 0);
|
||||
if(keyVal.getValue().getEnemyHp()!=0&&keyVal.getValue().getPlayerHp()!=0){
|
||||
singleBattle(user, keyVal.getValue(), keyVal.getKey(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int id : delayId) {
|
||||
|
@ -244,10 +254,35 @@ public class ExplorerMapLogic {
|
|||
MailLogic.getInstance().sendMail(uid, "探索奖励", "您的队伍X在【地图名称】经过X时X分的探索,共获得以下奖励,清查收。",
|
||||
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
//explorer.remove(id);
|
||||
explorer.remove(id);
|
||||
CommonProto.ExplorerMapInfo mapInfo = CommonProto.ExplorerMapInfo.newBuilder().setTeamId(id).build();
|
||||
ISession sess = OnlineUserManager.sessionMap.get(uid);
|
||||
if (sess != null){
|
||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, mapInfo, true);
|
||||
}
|
||||
|
||||
//
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
String key;
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
if (crossGroup == -1) {
|
||||
key = Integer.toString(explorer.get(id).getMapId());
|
||||
}else{
|
||||
//跨服分组
|
||||
key =Integer.toString(crossGroup) + RedisKey.Delimiter_colon + explorer.get(id).getMapId();
|
||||
}
|
||||
//rkey = RedisUtil.getInstence().getKey(RedisKey.EXPLORER_MAP_PLAYER, key);
|
||||
List<String> list = redisUtil.lGet(RedisKey.EXPLORER_MAP_PLAYER, key, 0, -1);
|
||||
if(list.contains(String.valueOf(user.getId()))){
|
||||
long remove = RedisUtil.getInstence().setRemove(RedisKey.EXPLORER_MAP_PLAYER+ RedisKey.Delimiter_colon +key, String.valueOf(uid));
|
||||
}
|
||||
}
|
||||
if(delayId.size()>0){
|
||||
user.getPlayerInfoManager().setExplorer(explorer);
|
||||
}
|
||||
//探索队伍 map <id,(派遣到哪个地图里,派遣的截止时间,玩家,复活时间)>
|
||||
//地图怪物 map<地图id,List<>()地图上所有的怪物(怪物id,刷新时间,血量)>
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue