探索 测试 不扣消耗

back_recharge
xuexinpeng 2021-12-28 14:33:23 +08:00
parent 6b07593757
commit 3c5f29e2e5
7 changed files with 69 additions and 26 deletions

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl; import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.explorerMap.ExplorerMapLogic;
import com.ljsd.jieling.logic.mail.MailLogic; import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.logic.player.PlayerLogic;
@ -263,6 +264,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
StoreLogic.reloadStoreInfo(user,7);//重载功能商店 StoreLogic.reloadStoreInfo(user,7);//重载功能商店
List<CommonProto.PracticeSkillInfo>practiceSkillInfos=getPracticeSkillInfos(heroManager); List<CommonProto.PracticeSkillInfo>practiceSkillInfos=getPracticeSkillInfos(heroManager);
List<CommonProto.FaBaoSoulInfo>faBaoSoulInfos=getFaBaoSoulInfos(heroManager); List<CommonProto.FaBaoSoulInfo>faBaoSoulInfos=getFaBaoSoulInfos(heroManager);
//挂机探索
ExplorerMapLogic.getInstance().calOfflineReward(user);
// 开服时间戳 // 开服时间戳
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime()); long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse

View File

@ -18,6 +18,8 @@ import rpc.protocols.PlayerInfoProto;
import util.StringUtil; import util.StringUtil;
import util.TimeUtils; import util.TimeUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.ExplorerMapRewardRequest> { public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.ExplorerMapRewardRequest> {
@ -45,15 +47,21 @@ public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.Explor
if(exInfo.getSendEndTime()> TimeUtils.nowInt()){ if(exInfo.getSendEndTime()> TimeUtils.nowInt()){
int min = (exInfo.getSendEndTime() - TimeUtils.nowInt())/60; int min = (exInfo.getSendEndTime() - TimeUtils.nowInt())/60;
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(exInfo.getMapId()); SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(exInfo.getMapId());
int [][] drop = new int[1][2]; int [] drop = new int[2];
drop[0][0]=exploreConfig.getCost()[0]; drop[0]=exploreConfig.getCost()[0];
drop[0][1]=exploreConfig.getCost()[1]*min; drop[1]=exploreConfig.getCost()[1]*min;
MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索以下为尚未消耗的晶石请查收。", /*MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索以下为尚未消耗的晶石请查收。",
StringUtil.parseArrayToString(drop), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME); StringUtil.parseArrayToString(drop), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);*/
List<int[]> comDrop =new ArrayList<int[]>();
comDrop.add(drop);
comDrop.addAll(explorer.get(teamId).getDropItem());
//CommonProto.Drop.Builder returnReward = ItemUtil.drop(user, drop, BIReason.EXPEDITION_BOX_REWARD);
//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.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); 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). explorer.get(teamId).getDropItem().clear();
explorer.get(teamId).setDropItem(explorer.get(teamId).getDropItem());
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ExplorerMapRewardResponse.getNumber(), builder.setDrop(dropPro).
setExploreInfo(explorerMapInfo).build(), true); setExploreInfo(explorerMapInfo).build(), true);
} }
} }

View File

@ -199,7 +199,7 @@ public class PlayerManager extends MongoBase {
//玩家抽取到的五星次数,目前只应用于招募基金使用 //玩家抽取到的五星次数,目前只应用于招募基金使用
private int getFiveStarHeroNum; private int getFiveStarHeroNum;
//探索 //探索
private Map<Integer,ExplorerInfo> explorer = new HashMap<>(); private Map<Integer,ExplorerInfo> explorer = new HashMap<>(); //<teamId,队伍数据>

View File

@ -67,6 +67,18 @@ public enum TeamEnum {
Arrays.stream(TeamEnum.values()).forEach(v->enumMap.putIfAbsent(v.getTeamId(),v)); Arrays.stream(TeamEnum.values()).forEach(v->enumMap.putIfAbsent(v.getTeamId(),v));
} }
/**
*
* @param teamId
* @return
*/
public static TeamEnum getEnumByteamId(int teamId){
TeamEnum anEnum = enumMap.get(teamId);
if (anEnum == null){
return null;
}
return anEnum;
}
/** /**
* *
* @param teamId * @param teamId

View File

@ -9,6 +9,7 @@ import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic; import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
import com.ljsd.jieling.logic.dao.ExplorerInfo; import com.ljsd.jieling.logic.dao.ExplorerInfo;
import com.ljsd.jieling.logic.dao.TeamEnum;
import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.cross.CSPlayer; import com.ljsd.jieling.logic.dao.cross.CSPlayer;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
@ -20,6 +21,7 @@ import com.ljsd.jieling.util.MessageUtil;
import config.SErrorCodeEerverConfig; import config.SErrorCodeEerverConfig;
import config.SExplore; import config.SExplore;
import config.SExploreFight; import config.SExploreFight;
import config.SSpecialConfig;
import manager.STableManager; import manager.STableManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -93,12 +95,13 @@ public class ExplorerMapLogic {
} }
//玩家死亡 设置重生时间 //玩家死亡 设置重生时间
if (explorerInfo.getPlayerHp() == 0) { if (explorerInfo.getPlayerHp() == 0) {
int reliveTime= SSpecialConfig.getIntegerValue(SSpecialConfig.EXPLORERE_LIVETIME);
reliveTime=300;
if (time == 0) { if (time == 0) {
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + 300); explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + reliveTime);
} else { } else {
explorerInfo.setPlayerReliveTime(time + 300); explorerInfo.setPlayerReliveTime(time + reliveTime);
} }
LOGGER.error("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime()); LOGGER.error("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
} }
//怪物死亡 设置重生时间 //怪物死亡 设置重生时间
@ -108,7 +111,7 @@ public class ExplorerMapLogic {
if (dropitem == null) { if (dropitem == null) {
dropitem = new ArrayList<>(); dropitem = new ArrayList<>();
} }
Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, new int[]{exploreConfig.getReward()}, 1, 0, BIReason.EXPLORE_MAP_GET); Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, exploreConfig.getReward(), 1, 0, BIReason.EXPLORE_MAP_GET);
List<int[]> addDropitem = itemMap.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).collect(Collectors.toList()); List<int[]> addDropitem = itemMap.entrySet().stream().map(n -> new int[]{n.getKey(), n.getValue()}).collect(Collectors.toList());
dropitem.addAll(addDropitem); dropitem.addAll(addDropitem);
explorerInfo.setDropItem(dropitem); explorerInfo.setDropItem(dropitem);
@ -119,7 +122,6 @@ public class ExplorerMapLogic {
explorerInfo.setEnemyReliveTime(time + 300); explorerInfo.setEnemyReliveTime(time + 300);
} }
LOGGER.error("玩家死亡=》重生时间{} 掉落=>{}", explorerInfo.getEnemyReliveTime(),exploreConfig.getReward()); LOGGER.error("玩家死亡=》重生时间{} 掉落=>{}", explorerInfo.getEnemyReliveTime(),exploreConfig.getReward());
} }
} }
if (time == 0) { if (time == 0) {
@ -248,15 +250,30 @@ public class ExplorerMapLogic {
} }
} }
for (int id : delayId) { for (int id : delayId) {
if(!explorer.containsKey(id)){
continue;
}
//到期后发奖励 //到期后发奖励
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(explorer.get(id).getMapId());
if(exploreConfig == null){
continue;
}
String teamName = TeamEnum.getEnumByteamId(id).getRemarks();
String mapName = exploreConfig.getName();
int hour =explorer.get(id).getSendTime()/3600;
if (explorer.get(id).getDropItem().size() == 0 || explorer.get(id).getDropItem() == null) { if (explorer.get(id).getDropItem().size() == 0 || explorer.get(id).getDropItem() == null) {
//String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("MsRankContent",new Object[]{(i + 1)},new int[0],"#"); LOGGER.error("到期啥都没得到发邮件");
MailLogic.getInstance().sendMail(uid, "探索失败", "您的队伍在%经过%时%分的探索,未获取到任何奖励,请选择更合适此队伍的地图进行探索。", String title = SErrorCodeEerverConfig.getI18NMessage("explorefail_mail_title");
String content = SErrorCodeEerverConfig.getFormatMessage("explorefail_mail_txt", new Object[]{teamName,mapName,hour});
MailLogic.getInstance().sendMail(uid, title, content,
"", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME); "", TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
} else { } else {
CommonProto.Drop.Builder drop = ItemUtil.drop(user, explorer.get(id).getDropItem().stream().toArray(int[][]::new), BIReason.EXPEDITION_BOX_REWARD); LOGGER.error("到期发邮件");
String title = SErrorCodeEerverConfig.getI18NMessage("exploresuccess_mail_title");
String content = SErrorCodeEerverConfig.getFormatMessage("exploresuccess_mail_txt", new Object[]{teamName,mapName,hour});
//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); int[][] dropArray = explorer.get(id).getDropItem().stream().toArray(int[][]::new);
MailLogic.getInstance().sendMail(uid, "探索奖励", "您的队伍X在【地图名称】经过X时X分的探索共获得以下奖励清查收。", 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(); int mapId = explorer.get(id).getMapId();

View File

@ -3,7 +3,6 @@ package config;
import manager.STableManager; import manager.STableManager;
import manager.Table; import manager.Table;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Table(name ="Explore") @Table(name ="Explore")
@ -11,6 +10,8 @@ public class SExplore implements BaseConfig {
private int id; private int id;
private String name;
private int map; private int map;
private int level; private int level;
@ -19,21 +20,16 @@ public class SExplore implements BaseConfig {
private int battleInterval; private int battleInterval;
private int reward; private int[] reward;
private int[] cost; private int[] cost;
private int monsterForce; private int monsterForce;
public static Map<Integer,SExplore> explore;
@Override @Override
public void init() throws Exception { 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;
} }
@ -41,6 +37,10 @@ public class SExplore implements BaseConfig {
return id; return id;
} }
public String getName() {
return name;
}
public int getMap() { public int getMap() {
return map; return map;
} }
@ -57,7 +57,7 @@ public class SExplore implements BaseConfig {
return battleInterval; return battleInterval;
} }
public int getReward() { public int[] getReward() {
return reward; return reward;
} }

View File

@ -127,6 +127,8 @@ public class SSpecialConfig implements BaseConfig {
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长 public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性 public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
public static final String EXPLORERE_LIVETIME = "ExploreReliveTime";//探索时我方阵亡后复活时长
@Override @Override
public void init() throws Exception { public void init() throws Exception {