探索 测试 不扣消耗
parent
6b07593757
commit
3c5f29e2e5
|
@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
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.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
|
@ -263,6 +264,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
StoreLogic.reloadStoreInfo(user,7);//重载功能商店
|
||||
List<CommonProto.PracticeSkillInfo>practiceSkillInfos=getPracticeSkillInfos(heroManager);
|
||||
List<CommonProto.FaBaoSoulInfo>faBaoSoulInfos=getFaBaoSoulInfos(heroManager);
|
||||
//挂机探索
|
||||
ExplorerMapLogic.getInstance().calOfflineReward(user);
|
||||
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
|
|
|
@ -18,6 +18,8 @@ import rpc.protocols.PlayerInfoProto;
|
|||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.ExplorerMapRewardRequest> {
|
||||
|
@ -45,15 +47,21 @@ public class ExplorerMapRewardHandler extends BaseHandler<PlayerInfoProto.Explor
|
|||
if(exInfo.getSendEndTime()> TimeUtils.nowInt()){
|
||||
int min = (exInfo.getSendEndTime() - TimeUtils.nowInt())/60;
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(exInfo.getMapId());
|
||||
int [][] drop = new int[1][2];
|
||||
drop[0][0]=exploreConfig.getCost()[0];
|
||||
drop[0][1]=exploreConfig.getCost()[1]*min;
|
||||
MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索,以下为尚未消耗的晶石,请查收。",
|
||||
StringUtil.parseArrayToString(drop), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
int [] drop = new int[2];
|
||||
drop[0]=exploreConfig.getCost()[0];
|
||||
drop[1]=exploreConfig.getCost()[1]*min;
|
||||
/*MailLogic.getInstance().sendMail(uid, "探索返还晶石", "您提前结束了队伍X在【地图名称】中的探索,以下为尚未消耗的晶石,请查收。",
|
||||
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);
|
||||
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).
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class PlayerManager extends MongoBase {
|
|||
//玩家抽取到的五星次数,目前只应用于招募基金使用
|
||||
private int getFiveStarHeroNum;
|
||||
//探索
|
||||
private Map<Integer,ExplorerInfo> explorer = new HashMap<>();
|
||||
private Map<Integer,ExplorerInfo> explorer = new HashMap<>(); //<teamId,队伍数据>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,18 @@ public enum TeamEnum {
|
|||
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
|
||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -20,6 +21,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
|||
import config.SErrorCodeEerverConfig;
|
||||
import config.SExplore;
|
||||
import config.SExploreFight;
|
||||
import config.SSpecialConfig;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -93,12 +95,13 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
//玩家死亡 设置重生时间
|
||||
if (explorerInfo.getPlayerHp() == 0) {
|
||||
int reliveTime= SSpecialConfig.getIntegerValue(SSpecialConfig.EXPLORERE_LIVETIME);
|
||||
reliveTime=300;
|
||||
if (time == 0) {
|
||||
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + 300);
|
||||
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt() + reliveTime);
|
||||
} else {
|
||||
explorerInfo.setPlayerReliveTime(time + 300);
|
||||
explorerInfo.setPlayerReliveTime(time + reliveTime);
|
||||
}
|
||||
|
||||
LOGGER.error("玩家死亡=》重生时间{}", explorerInfo.getPlayerReliveTime());
|
||||
}
|
||||
//怪物死亡 设置重生时间
|
||||
|
@ -108,7 +111,7 @@ public class ExplorerMapLogic {
|
|||
if (dropitem == null) {
|
||||
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());
|
||||
dropitem.addAll(addDropitem);
|
||||
explorerInfo.setDropItem(dropitem);
|
||||
|
@ -119,7 +122,6 @@ public class ExplorerMapLogic {
|
|||
explorerInfo.setEnemyReliveTime(time + 300);
|
||||
}
|
||||
LOGGER.error("玩家死亡=》重生时间{} 掉落=>{}", explorerInfo.getEnemyReliveTime(),exploreConfig.getReward());
|
||||
|
||||
}
|
||||
}
|
||||
if (time == 0) {
|
||||
|
@ -248,15 +250,30 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
}
|
||||
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) {
|
||||
//String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("MsRankContent",new Object[]{(i + 1)},new int[0],"#");
|
||||
MailLogic.getInstance().sendMail(uid, "探索失败", "您的队伍在%经过%时%分的探索,未获取到任何奖励,请选择更合适此队伍的地图进行探索。",
|
||||
LOGGER.error("到期啥都没得到发邮件");
|
||||
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);
|
||||
} 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);
|
||||
MailLogic.getInstance().sendMail(uid, "探索奖励", "您的队伍X在【地图名称】经过X时X分的探索,共获得以下奖励,清查收。",
|
||||
MailLogic.getInstance().sendMail(uid, title, content,
|
||||
StringUtil.parseArrayToString(dropArray), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
int mapId = explorer.get(id).getMapId();
|
||||
|
|
|
@ -3,7 +3,6 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="Explore")
|
||||
|
@ -11,6 +10,8 @@ public class SExplore implements BaseConfig {
|
|||
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
private int map;
|
||||
|
||||
private int level;
|
||||
|
@ -19,21 +20,16 @@ public class SExplore implements BaseConfig {
|
|||
|
||||
private int battleInterval;
|
||||
|
||||
private int reward;
|
||||
private int[] reward;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,6 +37,10 @@ public class SExplore implements BaseConfig {
|
|||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getMap() {
|
||||
return map;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class SExplore implements BaseConfig {
|
|||
return battleInterval;
|
||||
}
|
||||
|
||||
public int getReward() {
|
||||
public int[] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
|
||||
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
|
||||
|
||||
public static final String EXPLORERE_LIVETIME = "ExploreReliveTime";//探索时我方阵亡后复活时长
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue