back_recharge
parent
b9cc3dec5f
commit
6a6cbaca50
|
|
@ -48,14 +48,21 @@ 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);
|
||||
*/
|
||||
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).
|
||||
setExploreInfo(explorerMapInfo).build(), true);
|
||||
|
||||
}
|
||||
}else{
|
||||
}
|
||||
/*else{
|
||||
CommonProto.Drop.Builder drop = 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(drop).build(), true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,14 +74,15 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
|||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
explorerInfo.setPlayerHp(teamForce);
|
||||
explorerInfo.setEnemyHp(mapMonsterForce);
|
||||
ExplorerMapLogic.singleBattle(user,teamId);
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt()+300);
|
||||
//ExplorerMapLogic.singleBattle(user,teamId);
|
||||
|
||||
//explorer.put(teamId, explorerInfo);
|
||||
CommonProto.ExplorerMapInfo explorerMapInfo = CommonProto.ExplorerMapInfo.newBuilder().
|
||||
setTeamId(teamId).setMapId(mapId).setHp(explorerInfo.getPlayerHp()).
|
||||
setExploreTime(explorerInfo.getSendEndTime()).build();
|
||||
builder.addExploreInfo(explorerMapInfo);
|
||||
user.getPlayerInfoManager().addExplorer(explorerInfo);
|
||||
user.getPlayerInfoManager().addExplorer(explorerInfo, teamId);
|
||||
}
|
||||
//user.getPlayerInfoManager().setExplorer(explorer);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapSendResponse.getNumber(), builder.build(), true);
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ public class ExplorerInfo extends MongoBase {
|
|||
private int playerReliveTime;//玩家复活时间
|
||||
private int enemyHp;//敌人血量
|
||||
private int enemyReliveTime;//敌人复活时间
|
||||
private int batteTime;//战斗时间
|
||||
private List<int[]> dropItem = new ArrayList<>();
|
||||
|
||||
|
||||
public ExplorerInfo() {
|
||||
|
||||
}
|
||||
|
||||
public ExplorerInfo(int mapId, int sendEndTime, int sendTime, int playerHp, int playerReliveTime, int enemyHp, int enemyReliveTime, List<int[]> dropItem) {
|
||||
public ExplorerInfo(int mapId, int sendEndTime, int sendTime, int playerHp, int playerReliveTime, int enemyHp, int enemyReliveTime, int batteTime, List<int[]> dropItem) {
|
||||
this.mapId = mapId;
|
||||
this.sendEndTime = sendEndTime;
|
||||
this.sendTime = sendTime;
|
||||
|
|
@ -29,6 +29,7 @@ public class ExplorerInfo extends MongoBase {
|
|||
this.playerReliveTime = playerReliveTime;
|
||||
this.enemyHp = enemyHp;
|
||||
this.enemyReliveTime = enemyReliveTime;
|
||||
this.batteTime = batteTime;
|
||||
this.dropItem = dropItem;
|
||||
}
|
||||
|
||||
|
|
@ -101,4 +102,13 @@ public class ExplorerInfo extends MongoBase {
|
|||
public void setDropItem(List<int[]> dropItem) {
|
||||
this.dropItem = dropItem;
|
||||
}
|
||||
|
||||
|
||||
public int getBatteTime() {
|
||||
return batteTime;
|
||||
}
|
||||
|
||||
public void setBatteTime(int batteTime) {
|
||||
this.batteTime = batteTime;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1359,10 +1359,10 @@ public class PlayerManager extends MongoBase {
|
|||
return explorer;
|
||||
}
|
||||
|
||||
public void addExplorer(ExplorerInfo explorer) {
|
||||
explorer.init(this.getRootId(), getMongoKey() + ".explorer." + explorer.getMapId());
|
||||
updateString("explorer." + explorer.getMapId(), explorer);
|
||||
this.explorer.put(explorer.getMapId(),explorer);
|
||||
public void addExplorer(ExplorerInfo explorer,int teamId) {
|
||||
explorer.init(this.getRootId(), getMongoKey() + ".explorer." + teamId);
|
||||
updateString("explorer." + teamId, explorer);
|
||||
this.explorer.put(teamId,explorer);
|
||||
}
|
||||
public void setExplorer(Map<Integer, ExplorerInfo> explorer) {
|
||||
this.explorer = explorer;
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@ 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.util.ItemMap;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SExplore;
|
||||
import config.SExploreFight;
|
||||
import config.SRewardGroup;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -45,67 +42,17 @@ public class ExplorerMapLogic {
|
|||
|
||||
//战斗 派遣
|
||||
public static void battle(User user, int mapId, int teamId) {
|
||||
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key2 = RedisKey.getKey(RedisKey.EXPLORER_MAP_PLAYER, String.valueOf(mapId), false);
|
||||
redisUtil.lSet(key2, String.valueOf(user.getId()));
|
||||
}
|
||||
|
||||
public static void battle(User user) {
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void calOfflineReward(User user) throws Exception{
|
||||
|
||||
//计算离线奖励
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
if (explorer == null || explorer.size() == 0) {
|
||||
return;
|
||||
}
|
||||
int offlineTime = (int)(user.getPlayerInfoManager().getOffLineTime()/1000);
|
||||
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()){
|
||||
while (keyVal.getValue().getPlayerReliveTime()< offlineTime && keyVal.getValue().getEnemyReliveTime()< offlineTime){
|
||||
//打完架后 必定有一方没血
|
||||
if(keyVal.getValue().getPlayerHp() == 0){
|
||||
//直接满血复活
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||
if(TimeUtils.nowInt()> keyVal.getValue().getPlayerReliveTime()+300){
|
||||
keyVal.getValue().setPlayerReliveTime(keyVal.getValue().getPlayerReliveTime()+300);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
LOGGER.error("玩家={}复活 时间:",user.getId(),TimeUtils.getTimeStamp2(TimeUtils.now()));
|
||||
}
|
||||
}
|
||||
if(keyVal.getValue().getEnemyHp() == 0){
|
||||
if(TimeUtils.nowInt()> keyVal.getValue().getEnemyReliveTime()+300){
|
||||
keyVal.getValue().setEnemyReliveTime(keyVal.getValue().getEnemyReliveTime()+300);
|
||||
LOGGER.error("复活");
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
LOGGER.error("怪物地图={}复活 时间:",exploreConfig.getId(),TimeUtils.getTimeStamp2(TimeUtils.now()));
|
||||
if (exploreConfig == null) {
|
||||
continue;
|
||||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
}
|
||||
}
|
||||
//打架
|
||||
singleBattle(user,keyVal.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//单场战斗
|
||||
public static void singleBattle(User user, int teamId)throws Exception {
|
||||
ExplorerInfo explorerInfo = user.getPlayerInfoManager().getExplorer().get(teamId);
|
||||
public static void singleBattle(User user, ExplorerInfo explorerInfo, int teamId, int time) throws Exception {
|
||||
if (explorerInfo == null) {
|
||||
return;
|
||||
}
|
||||
//if(explorerInfo.getPlayerHp()!=0 && explorerInfo.getEnemyHp()!=0){
|
||||
while (explorerInfo.getPlayerHp() != 0 && explorerInfo.getEnemyHp() != 0)
|
||||
LOGGER.error("开始战斗");
|
||||
{
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(explorerInfo.getMapId());
|
||||
|
|
@ -119,102 +66,62 @@ public class ExplorerMapLogic {
|
|||
if (exploreFightData == null) {
|
||||
return;
|
||||
}
|
||||
LOGGER.error("探索表id:={}",exploreFightData.getId());
|
||||
LOGGER.error("探索表id:={}", exploreFightData.getId());
|
||||
//掉血比例
|
||||
float reduceRatio = exploreFightData.getLoseFight();
|
||||
//玩家掉血
|
||||
explorerInfo.setPlayerHp(explorerInfo.getPlayerHp() - (int) (teamForce * reduceRatio));
|
||||
LOGGER.error("玩家掉血:=》{}",(int) (explorerInfo.getPlayerHp() * reduceRatio));
|
||||
int reducePlayer = (int) (teamForce * reduceRatio);
|
||||
explorerInfo.setPlayerHp(explorerInfo.getPlayerHp() - reducePlayer);
|
||||
LOGGER.error("玩家掉血:=》{}", (int) (explorerInfo.getPlayerHp() * reduceRatio));
|
||||
//怪物掉血
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp() - (int) (mapMonsterForce * reduceRatio));
|
||||
LOGGER.error("怪物掉血:=》{}",(int) (explorerInfo.getEnemyHp() * reduceRatio));
|
||||
//玩家死亡 设置重生时间
|
||||
if (explorerInfo.getPlayerHp() == 0) {
|
||||
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + 300);
|
||||
LOGGER.error("玩家死亡=》重生时间{}",explorerInfo.getPlayerReliveTime());
|
||||
}
|
||||
//怪物死亡 设置重生时间
|
||||
if (explorerInfo.getEnemyHp() == 0) {
|
||||
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt() + 300);
|
||||
LOGGER.error("怪物死亡=》重生时间={} 掉落id=>{}",explorerInfo.getEnemyReliveTime(),exploreConfig.getReward());
|
||||
//胜利添加掉落
|
||||
/* List<Integer> dropList = explorerInfo.getDropList();
|
||||
if (dropList == null) {
|
||||
dropList = new ArrayList<>();
|
||||
}
|
||||
dropList.add(exploreConfig.getReward());*/
|
||||
int reduceMonster = (int) (mapMonsterForce * reduceRatio);
|
||||
LOGGER.error("怪物掉血:=》{}", (int) (explorerInfo.getEnemyHp() * reduceRatio));
|
||||
//输赢判断
|
||||
if (reducePlayer > reduceMonster) {
|
||||
//怪物赢了 保留血量 下次打
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp() - (reduceMonster));
|
||||
} else {
|
||||
//玩家赢了
|
||||
List<int[]> dropitem = explorerInfo.getDropItem();
|
||||
if (dropitem == null) {
|
||||
dropitem = new ArrayList<>();
|
||||
}
|
||||
Map<Integer,Integer> itemMap = ItemUtil.getItemMapByGroupId(user,new int[]{exploreConfig.getReward()},1,0, BIReason.TA_SUI_LING_XIAO);
|
||||
//dropitem.add(new int[]{exploreConfig.getReward()});
|
||||
List<int[]> addDropitem = itemMap.entrySet().stream().map(n->new int[]{n.getKey(),n.getValue()}).collect(Collectors.toList());
|
||||
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);
|
||||
}
|
||||
//玩家死亡 设置重生时间
|
||||
if (explorerInfo.getPlayerHp() == 0) {
|
||||
if (time == 0) {
|
||||
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + 300);
|
||||
} else {
|
||||
explorerInfo.setPlayerReliveTime(time + 300);
|
||||
}
|
||||
|
||||
LOGGER.error("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
|
||||
}
|
||||
//怪物死亡 设置重生时间
|
||||
if (explorerInfo.getEnemyHp() == 0) {
|
||||
if (time == 0) {
|
||||
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt() + 300);
|
||||
} else {
|
||||
explorerInfo.setEnemyReliveTime(time + 300);
|
||||
}
|
||||
LOGGER.error("怪物死亡=》重生时间={} 掉落id=>{}", explorerInfo.getEnemyReliveTime(), exploreConfig.getReward());
|
||||
}
|
||||
}
|
||||
if (time == 0) {
|
||||
explorerInfo.setBatteTime(TimeUtils.nowInt() + 300);//设置下次战斗时间
|
||||
} else {
|
||||
explorerInfo.setBatteTime(time + 300);//设置下次战斗时间
|
||||
}
|
||||
LOGGER.error("战斗结束");
|
||||
|
||||
}
|
||||
|
||||
//复活怪物 自己血量之类的 在线每分钟监听
|
||||
public void recycleFight() {
|
||||
try {
|
||||
Set<Integer> uids = OnlineUserManager.sessionMap.keySet();
|
||||
for (int uid : uids) {
|
||||
User user = UserManager.getUser(uid);
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
if (explorer == null || explorer.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
List<Integer> delayId = new ArrayList<>();
|
||||
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
|
||||
//到期探索
|
||||
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
|
||||
delayId.add(keyVal.getKey());
|
||||
}
|
||||
//复活
|
||||
//复活玩家
|
||||
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= TimeUtils.nowInt()) {
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
LOGGER.error("复活玩家:");
|
||||
//打架 TODO
|
||||
singleBattle(user, keyVal.getKey());
|
||||
}
|
||||
//复活怪物
|
||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= TimeUtils.nowInt()) {
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
if (exploreConfig == null) {
|
||||
continue;
|
||||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
LOGGER.error("复活怪物:");
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
//打架 TODO
|
||||
singleBattle(user, keyVal.getKey());
|
||||
}
|
||||
}
|
||||
for (int id : delayId) {
|
||||
//到期后发奖励
|
||||
if(explorer.get(id).getDropItem().size() ==0 || explorer.get(id).getDropItem() == null){
|
||||
MailLogic.getInstance().sendMail(uid, "探索失败", "您的队伍X在【地图名称】经过X时X分的探索,未获取到任何奖励,请选择更合适此队伍的地图进行探索。",
|
||||
"", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}else {
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, explorer.get(id).getDropItem().stream().toArray(int[][]::new), BIReason.EXPEDITION_BOX_REWARD);
|
||||
int [][] dropArray= explorer.get(id).getDropItem().stream().toArray(int[][]::new);
|
||||
MailLogic.getInstance().sendMail(uid, "探索奖励", "您的队伍X在【地图名称】经过X时X分的探索,共获得以下奖励,清查收。",
|
||||
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
public static void battle(User user) {
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
|
||||
//explorer.remove(id);
|
||||
}
|
||||
//探索队伍 map <id,(派遣到哪个地图里,派遣的截止时间,玩家,复活时间)>
|
||||
//地图怪物 map<地图id,List<>()地图上所有的怪物(怪物id,刷新时间,血量)>
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -246,6 +153,108 @@ public class ExplorerMapLogic {
|
|||
.build();
|
||||
}
|
||||
|
||||
public void calOfflineReward(User user) throws Exception {
|
||||
//计算离线奖励
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
if (explorer == null || explorer.size() == 0) {
|
||||
return;
|
||||
}
|
||||
//int offlineTime = (int) (user.getPlayerInfoManager().getOffLineTime() / 1000);
|
||||
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
|
||||
int offlineEndTime = 0;
|
||||
if (keyVal.getValue().getSendEndTime() >= TimeUtils.nowInt()) {
|
||||
offlineEndTime = TimeUtils.nowInt();
|
||||
} else {
|
||||
offlineEndTime = keyVal.getValue().getSendEndTime();
|
||||
}
|
||||
if (keyVal.getValue().getBatteTime() + 300 >= offlineEndTime) {
|
||||
continue;
|
||||
}
|
||||
for (int i = keyVal.getValue().getBatteTime() + 300; i < offlineEndTime; i = i + 300) {
|
||||
//复活玩家
|
||||
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= i) {
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
LOGGER.error("复活玩家:");
|
||||
}
|
||||
//复活怪物
|
||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= i) {
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
if (exploreConfig == null) {
|
||||
continue;
|
||||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
LOGGER.error("复活怪物:");
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
}
|
||||
singleBattle(user, keyVal.getValue(), keyVal.getKey(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//复活怪物 自己血量之类的 在线每分钟监听
|
||||
public void recycleFight() {
|
||||
try {
|
||||
Set<Integer> uids = OnlineUserManager.sessionMap.keySet();
|
||||
for (int uid : uids) {
|
||||
User user = UserManager.getUser(uid);
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
if (explorer == null || explorer.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
List<Integer> delayId = new ArrayList<>();
|
||||
for (Map.Entry<Integer, ExplorerInfo> keyVal : explorer.entrySet()) {
|
||||
//探索时间到期
|
||||
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
|
||||
delayId.add(keyVal.getKey());
|
||||
} 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.error("复活玩家:");
|
||||
}
|
||||
//复活怪物
|
||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= TimeUtils.nowInt()) {
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
if (exploreConfig == null) {
|
||||
continue;
|
||||
}
|
||||
LOGGER.error("复活怪物sfasdfas :");
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
}
|
||||
//战斗时间是否到达
|
||||
if (keyVal.getValue().getBatteTime() < TimeUtils.nowInt()) {
|
||||
continue;
|
||||
}
|
||||
singleBattle(user, keyVal.getValue(), keyVal.getKey(), 0);
|
||||
}
|
||||
}
|
||||
for (int id : delayId) {
|
||||
//到期后发奖励
|
||||
if (explorer.get(id).getDropItem().size() == 0 || explorer.get(id).getDropItem() == null) {
|
||||
MailLogic.getInstance().sendMail(uid, "探索失败", "您的队伍X在【地图名称】经过X时X分的探索,未获取到任何奖励,请选择更合适此队伍的地图进行探索。",
|
||||
"", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
} else {
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, explorer.get(id).getDropItem().stream().toArray(int[][]::new), BIReason.EXPEDITION_BOX_REWARD);
|
||||
int[][] dropArray = explorer.get(id).getDropItem().stream().toArray(int[][]::new);
|
||||
MailLogic.getInstance().sendMail(uid, "探索奖励", "您的队伍X在【地图名称】经过X时X分的探索,共获得以下奖励,清查收。",
|
||||
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
//explorer.remove(id);
|
||||
}
|
||||
//探索队伍 map <id,(派遣到哪个地图里,派遣的截止时间,玩家,复活时间)>
|
||||
//地图怪物 map<地图id,List<>()地图上所有的怪物(怪物id,刷新时间,血量)>
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//怪物刷新
|
||||
//邮件结算
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="Explore")
|
||||
|
|
@ -24,10 +25,15 @@ public class SExplore implements BaseConfig {
|
|||
|
||||
private int monsterForce;
|
||||
|
||||
|
||||
public static Map<Integer,SExplore> explore;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
Map<Integer, SExplore> config = STableManager.getConfig(SExplore.class);
|
||||
Map<Integer,SExplore> tempExploreFight = new HashMap<>();
|
||||
for(Map.Entry<Integer, SExplore> entry:config.entrySet()){
|
||||
tempExploreFight.put(entry.getKey(),entry.getValue());
|
||||
}
|
||||
explore = tempExploreFight;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue