试炼本重置功能,任务提交
parent
18b2d6c57a
commit
3a1e16feb6
|
@ -45,7 +45,7 @@ public enum FunctionIdEnum {
|
|||
Talking(14,null),
|
||||
|
||||
Store(20,null),
|
||||
|
||||
Trial(30,new TrialFunction()),
|
||||
Endless(46,new EndlessFunction()),
|
||||
Blood(47,null),
|
||||
ToBeStronger(48,null,MessageTypeProto.MessageType.TO_BE_STRONGER_REQUEST_VALUE),
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/6/8
|
||||
* @discribe
|
||||
*/
|
||||
public class TrialFunction implements FunctionManager {
|
||||
@Override
|
||||
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAction() throws Exception {
|
||||
MapLogic.getInstance().resetTrialInfo();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map;
|
|||
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
|
@ -22,6 +23,7 @@ import com.ljsd.jieling.handler.mission.Mission;
|
|||
import com.ljsd.jieling.ktbeans.KTGameType;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
|
@ -2035,6 +2037,8 @@ public class MapLogic {
|
|||
}else{
|
||||
builder.setStarNum(sChallengeStarBox.getStarNum());
|
||||
}
|
||||
//登录时检测是否需要重置
|
||||
checkTrialReset(user);
|
||||
MapInfoProto.TowerCopyInfo towerCopyInfo = MapInfoProto.TowerCopyInfo.newBuilder()
|
||||
.setTower(mapManager.getTrialInfo().getFloor())
|
||||
.setFightCount(mapManager.getFightCount())
|
||||
|
@ -2042,6 +2046,8 @@ public class MapLogic {
|
|||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
.setMapIntoReset(mapManager.getMapIntoFlag())
|
||||
.setTowerUseTime((int)(mapManager.getCurrTowerTime()/1000))
|
||||
.setKillCount(mapManager.getTrialInfo().getKillCount())
|
||||
.addAllTrialRewardInfo(mapManager.getTrialInfo().getTowerReceivedReward())
|
||||
.build();
|
||||
builder.setTowerCopyInfo(towerCopyInfo);
|
||||
builder.addAllPlayedGenMapId(mapManager.getPlayGenMaps());
|
||||
|
@ -2530,27 +2536,25 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 领取试炼层级奖励
|
||||
* 领取试炼小怪奖励
|
||||
* @param session
|
||||
* @param tower
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getTowerReward(ISession session, int tower , MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void getTowerReward(ISession session, int id , MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
STrialConfig trialConfig = STrialConfig.sTrialConfigMap.get(tower);
|
||||
int[][] floorReward = trialConfig.getFloorReward();
|
||||
if(floorReward.length<1){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("当前层无奖励"));
|
||||
STrialKillConfig config = STableManager.getConfig(STrialKillConfig.class).get(id);
|
||||
Set<Integer> towerReceivedReward = user.getMapManager().getTrialInfo().getTowerReceivedReward();
|
||||
if(towerReceivedReward.contains(id)){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("当前任务已领取过"));
|
||||
}
|
||||
Map<Integer, Integer> towerReceivedReward = user.getMapManager().getTowerReceivedReward();
|
||||
for(Map.Entry<Integer,Integer> entry:towerReceivedReward.entrySet()){
|
||||
if(entry.getKey()==tower){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("当前层已领取过"));
|
||||
}
|
||||
if(user.getMapManager().getTrialInfo().getKillCount()<config.getCount()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, floorReward, BIReason.TOWER_FLOOR_REWARD);
|
||||
user.getMapManager().addTowerReceivedReward(tower);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getBoxReward(), BIReason.TOWER_FLOOR_REWARD);
|
||||
towerReceivedReward.add(id);
|
||||
user.getMapManager().updateTrialRewardInfo(towerReceivedReward);
|
||||
MapInfoProto.TowerRewardResponse towerRewardResponse = MapInfoProto.TowerRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),towerRewardResponse,true);
|
||||
|
||||
|
@ -2845,6 +2849,33 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否需要重置试炼信息
|
||||
*/
|
||||
public void checkTrialReset(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
//判断试炼本是否跨了周期
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.Trial);
|
||||
if(openTimeOfFuntionCacheByType!=null&&openTimeOfFuntionCacheByType.getTimes()!=trialInfo.getTimes()){
|
||||
trialInfo.setAddHpCount(0);
|
||||
trialInfo.setHeroInfo(new HashMap<>());
|
||||
trialInfo.setCurXY(0);
|
||||
trialInfo.setMapInfo(new HashMap<>());
|
||||
trialInfo.setQuitMapId(0);
|
||||
trialInfo.setEnergy(0);
|
||||
trialInfo.setFloor(trialInfo.getFloor()-7>1?trialInfo.getFloor()-7:1);
|
||||
trialInfo.setTimes(openTimeOfFuntionCacheByType.getTimes());
|
||||
if(mapManager.getCurMapId()!=0){
|
||||
if(MapLogic.getInstance().getMap(user) instanceof TowerMap){
|
||||
resetMapInfo(user,false);
|
||||
}
|
||||
}
|
||||
mapManager.setTrialInfo(trialInfo);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 无尽副本赛季更换,用户信息清除
|
||||
* @throws Exception
|
||||
|
@ -2857,6 +2888,16 @@ public class MapLogic {
|
|||
}
|
||||
updateEndlessSeason(0);
|
||||
}
|
||||
/**
|
||||
* 无尽副本赛季更换,用户信息清除
|
||||
* @throws Exception
|
||||
*/
|
||||
public void resetTrialInfo() throws Exception {
|
||||
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
|
||||
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
|
||||
trialClear(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void endLessClear(ISession session) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
@ -2867,6 +2908,15 @@ public class MapLogic {
|
|||
// resetMapInfo(user,false);
|
||||
}
|
||||
}
|
||||
public void trialClear(ISession session) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(mapManager.getCurMapId()!=0){
|
||||
if(getMap(user) instanceof TowerMap)
|
||||
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clearEndlessItem(User user) throws Exception {
|
||||
SEndlessMapConfig config = SEndlessMapConfig.sEndlessMapConfigMap.get(MapLogic.getEndlessMapId());
|
||||
|
|
|
@ -773,6 +773,12 @@ public class MapManager extends MongoBase {
|
|||
return trialInfo;
|
||||
}
|
||||
|
||||
public void setTrialInfo(TrialInfo trialInfo){
|
||||
this.trialInfo = trialInfo;
|
||||
updateString("trialInfo",trialInfo);
|
||||
|
||||
}
|
||||
|
||||
public void setTrialFloor(int floor){
|
||||
trialInfo.setFloor(floor);
|
||||
updateString("trialInfo",trialInfo);
|
||||
|
@ -807,6 +813,14 @@ public class MapManager extends MongoBase {
|
|||
trialInfo.setAddHpCount(count+trialInfo.getAddHpCount());
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void updateTrialRewardInfo(Set<Integer> rewardInfo){
|
||||
trialInfo.setTowerReceivedReward(rewardInfo);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void updateTrialKillCount(int count){
|
||||
trialInfo.setKillCount(count);
|
||||
updateString("trialInfo.killCount",count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,12 +17,6 @@ public class TrialInfo {
|
|||
//默认一层
|
||||
private int floor = 1;
|
||||
|
||||
private boolean autoFight;
|
||||
|
||||
private boolean autoAddHp;
|
||||
|
||||
private boolean autoGetItem;
|
||||
|
||||
private int energy;
|
||||
//进入副本英雄信息
|
||||
private Map<String,TrailHero> heroInfo = new HashMap<>(5);
|
||||
|
@ -35,8 +29,22 @@ public class TrialInfo {
|
|||
|
||||
private int quitMapId;
|
||||
|
||||
private int times;
|
||||
|
||||
private Map<Integer, Cell> mapInfo = new HashMap<>();
|
||||
|
||||
private int killCount;
|
||||
|
||||
private Set<Integer> towerReceivedReward = new HashSet<>();
|
||||
|
||||
public Set<Integer> getTowerReceivedReward() {
|
||||
return towerReceivedReward;
|
||||
}
|
||||
|
||||
public void setTowerReceivedReward(Set<Integer> towerReceivedReward) {
|
||||
this.towerReceivedReward = towerReceivedReward;
|
||||
}
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
@ -45,30 +53,6 @@ public class TrialInfo {
|
|||
this.floor = floor;
|
||||
}
|
||||
|
||||
public boolean isAutoFight() {
|
||||
return autoFight;
|
||||
}
|
||||
|
||||
public void setAutoFight(boolean autoFight) {
|
||||
this.autoFight = autoFight;
|
||||
}
|
||||
|
||||
public boolean isAutoAddHp() {
|
||||
return autoAddHp;
|
||||
}
|
||||
|
||||
public void setAutoAddHp(boolean autoAddHp) {
|
||||
this.autoAddHp = autoAddHp;
|
||||
}
|
||||
|
||||
public boolean isAutoGetItem() {
|
||||
return autoGetItem;
|
||||
}
|
||||
|
||||
public void setAutoGetItem(boolean autoGetItem) {
|
||||
this.autoGetItem = autoGetItem;
|
||||
}
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
@ -124,4 +108,20 @@ public class TrialInfo {
|
|||
public void setQuitMapId(int quitMapId) {
|
||||
this.quitMapId = quitMapId;
|
||||
}
|
||||
|
||||
public int getTimes() {
|
||||
return times;
|
||||
}
|
||||
|
||||
public void setTimes(int times) {
|
||||
this.times = times;
|
||||
}
|
||||
|
||||
public int getKillCount() {
|
||||
return killCount;
|
||||
}
|
||||
|
||||
public void setKillCount(int killCount) {
|
||||
this.killCount = killCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,9 @@ public class TowerMap extends AbstractMap {
|
|||
if(teamId!= GlobalsDef.TRIAL_TEAM){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
//进图时检测是否需要重置
|
||||
MapLogic.getInstance().checkTrialReset(UserManager.getUser(uid));
|
||||
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
int curFloor = trialInfo.getFloor();
|
||||
|
@ -387,6 +390,7 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
remainHp = checkResult[2];
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
mapManager.updateTrialKillCount(trialInfo.getKillCount()+1);
|
||||
}
|
||||
//生成传送门,需要在删点之后
|
||||
if(createCell!=null){
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TrialKillConfig")
|
||||
public class STrialKillConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int count;
|
||||
|
||||
private int[][] boxReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public int[][] getBoxReward() {
|
||||
return boxReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue