Merge branch 'master_test_gn' into master_prb_gn
commit
cc6c06f0a7
|
@ -21,37 +21,39 @@ public abstract class GlobalProtocolsManager {
|
|||
public static final Logger LOGGER = LoggerFactory.getLogger(GlobalProtocolsManager.class);
|
||||
private static Map<Integer, gtGBaseHandler> handlers = new HashMap<>();
|
||||
|
||||
//暂时不用了
|
||||
public static void initHandler(String pck,ClassLoader classLoader) {
|
||||
List<Class<?>> handlers = new LinkedList<>();
|
||||
try {
|
||||
try {
|
||||
ClassLoaderHelper.findLocalClass(pck, gtGBaseHandler.class, classLoader, handlers);
|
||||
} catch (RuntimeException e) {
|
||||
LOGGER.info("request unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e));
|
||||
}
|
||||
try {
|
||||
ClassLoaderHelper.findClassJar(pck, gtGBaseHandler.class,classLoader, handlers);
|
||||
} catch (RuntimeException e) {
|
||||
LOGGER.info("request unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e));
|
||||
}
|
||||
|
||||
handlers.forEach(hand ->
|
||||
{
|
||||
gtGBaseHandler baseHandler = null;
|
||||
|
||||
try {
|
||||
baseHandler = (gtGBaseHandler) hand.newInstance();
|
||||
} catch (Exception ex) {
|
||||
LOGGER.info("request unknow Exception {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(ex));
|
||||
}
|
||||
|
||||
if (null != baseHandler) {
|
||||
addHandler(baseHandler);
|
||||
}
|
||||
});
|
||||
} catch (RuntimeException e2) {
|
||||
LOGGER.info("initHandler unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e2));
|
||||
}
|
||||
return;
|
||||
// List<Class<?>> handlers = new LinkedList<>();
|
||||
// try {
|
||||
// try {
|
||||
// ClassLoaderHelper.findLocalClass(pck, gtGBaseHandler.class, classLoader, handlers);
|
||||
// } catch (RuntimeException e) {
|
||||
// LOGGER.info("request unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e));
|
||||
// }
|
||||
// try {
|
||||
// ClassLoaderHelper.findClassJar(pck, gtGBaseHandler.class,classLoader, handlers);
|
||||
// } catch (RuntimeException e) {
|
||||
// LOGGER.info("request unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e));
|
||||
// }
|
||||
//
|
||||
// handlers.forEach(hand ->
|
||||
// {
|
||||
// gtGBaseHandler baseHandler = null;
|
||||
//
|
||||
// try {
|
||||
// baseHandler = (gtGBaseHandler) hand.newInstance();
|
||||
// } catch (Exception ex) {
|
||||
// LOGGER.info("request unknow Exception {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(ex));
|
||||
// }
|
||||
//
|
||||
// if (null != baseHandler) {
|
||||
// addHandler(baseHandler);
|
||||
// }
|
||||
// });
|
||||
// } catch (RuntimeException e2) {
|
||||
// LOGGER.info("initHandler unknow RuntimeException {} ", ErrorPrintUtil.getExceptionStackTraceFileLineAndMethod(e2));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.tools;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -89,8 +90,30 @@ public class Utils {
|
|||
String randStr = String.valueOf(stringBuffer);
|
||||
return randStr;
|
||||
}
|
||||
/**
|
||||
* 对象拷贝 只要实现了Serializable接口都可以
|
||||
* @param obj
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T extends Serializable> T clone(T obj) {
|
||||
T cloneObj = null;
|
||||
try {
|
||||
// 写入字节流
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ObjectOutputStream obs = new ObjectOutputStream(out);
|
||||
obs.writeObject(obj);
|
||||
obs.close();
|
||||
|
||||
|
||||
|
||||
|
||||
// 分配内存,写入原始对象,生成新对象
|
||||
ByteArrayInputStream ios = new ByteArrayInputStream(out.toByteArray());
|
||||
ObjectInputStream ois = new ObjectInputStream(ios);
|
||||
// 返回生成的新对象
|
||||
cloneObj = (T) ois.readObject();
|
||||
ois.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return cloneObj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllSealList(CBean2Proto.getPurpleMansionSealInfo(user))
|
||||
.setDailyredpack(playerInfoManager.getDailyWelfareRedPacket())
|
||||
.setRandomCount(randomCount)
|
||||
.addAllDrawTimes(CBean2Proto.getRandomTypeNums(user))
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/29 14:38
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class GetWishDrawCardInfoHandler extends BaseHandler<HeroInfoProto.choiceWishHeroRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.choiceWishHeroRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, HeroInfoProto.choiceWishHeroRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
if (proto != null && proto.getInfoListCount() > 0){
|
||||
HeroLogic.getInstance().updateWishDrawCardInfo(user,proto.getInfoListList());
|
||||
}
|
||||
|
||||
// 返回
|
||||
List<CommonProto.wishDrawCardInfo> wishCard = CBean2Proto.getWishCard(user);
|
||||
return HeroInfoProto.choiceWishHeroResponse.newBuilder().addAllInfoList(wishCard).build();
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.ShanHeSheJiTuStarEvent;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
|
@ -81,6 +83,11 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
}
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
PlayerInfoProto.HardStageFightResponse.Builder fightStartResponse = PlayerInfoProto.HardStageFightResponse.newBuilder();
|
||||
//山河社稷埋点
|
||||
int logType = nodeConfig.getChapter();
|
||||
int logSectionId = nodeConfig.getSection();
|
||||
int logResult = 0;
|
||||
int logStarNum = 0;
|
||||
//直接发奖励
|
||||
if (nodeConfig.getStageType() == 2) {
|
||||
Map<Integer, HardStageChapter> chapt = user.getHardStageManager().getChapterMap(user);
|
||||
|
@ -90,6 +97,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
node.setState(1);
|
||||
dropList.addAll(HardStageLogic.getFirstRewards(user, nodeConfig));
|
||||
HardStageLogic.updateChapterAndNodeLevel(user,nodeConfig);
|
||||
logResult = 1;
|
||||
}
|
||||
} else if (nodeConfig.getStageType() == 1 || nodeConfig.getStageType() == 3) {
|
||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
||||
|
@ -123,8 +131,6 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
}else {
|
||||
fightStartResponse.setCurrentIsHonour(false);
|
||||
}
|
||||
|
||||
//System.err.print("0:" + resultNum[0] + " 1:" + resultNum[1] + " 2:" + resultNum[2]);
|
||||
int resultCode = (int) fight[0][0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
|
@ -141,7 +147,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
fightStartResponse.setFightData(fightData);
|
||||
FightRecordLogic.getInstance().addRecordMap(user, fightData);
|
||||
if (resultCode == 1) {//通过
|
||||
HardStageLogic.passNode(iSession, nodeConfig, resultNum, dropList);
|
||||
logStarNum = HardStageLogic.passNode(iSession, nodeConfig, resultNum, dropList);
|
||||
//战斗回放
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
// 首次通关记录
|
||||
|
@ -178,6 +184,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
Poster.getPoster().dispatchEvent(new ShanHeSheJiTuStarEvent(iSession.getUid(), 2, starSum));
|
||||
//成就任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.HARSTAGE_STARS,starSum);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP);
|
||||
}
|
||||
//大关卡通过成就+1
|
||||
if(nodeConfig.getStageType() == 1){
|
||||
|
@ -205,5 +212,7 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_FIGHT_START_RESPONSE.getNumber(), fightStartResponse.build(), true);
|
||||
//更新消息
|
||||
HardStageLogic.sendHardStageIndication(user);
|
||||
//埋点数据
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.HARD_STAGE.getType(),logType ,logSectionId ,String.valueOf(logResult) ,logStarNum );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1229,9 +1229,10 @@ public class MapLogic {
|
|||
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
|
||||
if(crossInfo.getStars().contains(STAR_1)){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, mapManager.getCurMapId(), 1,1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP, mapManager.getCurMapId(), 1,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
resetMapInfo(user, needTemporaryItem);
|
||||
return true;
|
||||
|
@ -2004,6 +2005,7 @@ public class MapLogic {
|
|||
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId(),count));
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, mapId,1,count);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.PlAY_STORY, type,count);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP, mapId,1,count);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapSweepResponse.build(), true);
|
||||
|
||||
}
|
||||
|
@ -2206,6 +2208,7 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, fightId,0,1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP, fightId,0,1);
|
||||
// user.getUserMissionManager().gameEvent(user, new LevelEvent(), fightId);
|
||||
}
|
||||
|
||||
|
@ -2308,6 +2311,7 @@ public class MapLogic {
|
|||
fightEndResponse.build();
|
||||
user.getMapManager().setLastMonsterAttack(checkFightId + 1);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MONSTER_ATTACK_LEVEL);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MISTY_TRIP);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
|
||||
String stringValue = SSpecialConfig.getStringValue(SSpecialConfig.DISCOUNT_MONSTER_LEVEL);
|
||||
|
@ -2363,6 +2367,7 @@ public class MapLogic {
|
|||
crossInfoMap.put(i, crossInfo);
|
||||
mapManager.updateCrossInfoMap(i, crossInfo);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, i, 1,1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP, i, 1,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@ public class QuickStartMonsterFighter extends BaseHandler<FightInfoProto.QuickSt
|
|||
|
||||
user.getMapManager().setLastMonsterAttack(fightId + 1);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MONSTER_ATTACK_LEVEL);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MISTY_TRIP);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.QUICK_START_MONSTERFIGHTER_REPONSE_VALUE, builder, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public class Cmd_addholy extends GmRoleAbstract{
|
|||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_HOLY_BAG_INDICATION_VALUE, indication.build(), true);
|
||||
|
||||
getUser().getUserMissionManager().onGameEvent(getUser(), GameEvent.EXPEDITION_TIMES);
|
||||
getUser().getUserMissionManager().onGameEvent(getUser(), GameEvent.MISTY_TRIP);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,8 @@ public enum ReportEventEnum {
|
|||
COMPLETE_TRAVEL(73,"complete_travel",CommonEventHandler.getInstance(),new String[]{"stage_id_travel"}),
|
||||
// 新将来袭
|
||||
TA_SUI_LING_XIAO(74,"tasuilingxiao_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","damage_num","reward_nums_list"}),
|
||||
//山河社稷图
|
||||
HARD_STAGE(75 ,"Sunvo_figure",CommonEventHandler.getInstance(),new String[]{"Sunvo_figure_type","Sunvo_figure_id","combat_results","get_star"}),
|
||||
|
||||
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.activity.RemoveEventHeroHandler;
|
|||
import com.ljsd.jieling.logic.activity.UserLevelEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.redpacket.WelfareRedPackSendHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.ActivityStateChangeHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.BuyGoodsDirectHandler;
|
||||
|
@ -378,13 +379,13 @@ public class GlobalDataManaager implements IManager {
|
|||
}
|
||||
//刷新膜拜信息
|
||||
user.getPlayerInfoManager().setProudInfo(new HashSet<>());
|
||||
|
||||
// 道具刷新
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
|
||||
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),-1));
|
||||
// 心愿格子信息刷新
|
||||
HeroLogic.getInstance().resetWishDrawCardInfoMap(user);
|
||||
}
|
||||
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
|
||||
}
|
||||
|
|
|
@ -1632,17 +1632,18 @@ public class ActivityLogic implements IEventHandler{
|
|||
int count = mission.getV();
|
||||
// up奖励id
|
||||
int upRewardId = mission.getChoiceRewardId();
|
||||
|
||||
// 排序权重map
|
||||
Map<Integer, Integer> weight = new TreeMap<>(SWishActivityPool.weight);
|
||||
// 常驻卡池
|
||||
Map<Integer, SWishActivityPool> poolMap = SWishActivityPool.map;
|
||||
// 根据活动获取本期得全部up信息
|
||||
Map<Integer, int[]> up = SWishActivityUp.upMap.get(activityId);
|
||||
// 根据玩家选取得up奖励id获取详细信息
|
||||
int[] incs = up.get(upRewardId);
|
||||
// 讲up奖励id得权重加入到整个卡池权重中
|
||||
weight.put(weight.size()+1,incs[2]);
|
||||
//拿到当前阵营
|
||||
int camp = incs[4];
|
||||
// 排序权重map
|
||||
Map<Integer, Integer> weight = new TreeMap<>(SWishActivityPool.weight.get(camp));
|
||||
// 常驻卡池
|
||||
Map<Integer, SWishActivityPool> poolMap = SWishActivityPool.map;
|
||||
// 将up奖励id得权重加入到整个卡池权重中
|
||||
weight.put(-1,incs[2]);
|
||||
// 计算总权重
|
||||
int totalWeight = weight.values().stream().mapToInt(Integer::intValue).sum();
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public interface ActivityType {
|
|||
int LUCKY_GET = 63;//福星高照
|
||||
int FIFTEEN_LOGIN = 64;//十五日签到
|
||||
int EQUIP_UPLEVEL = 65;//云游商人
|
||||
int HARD_STAGE_EXERCISE = 68;//山河试炼
|
||||
|
||||
int SUB_ACTIVITY = 8000;//易经宝库
|
||||
int SKIN_RECHARGE_ACTIVITY = 71;
|
||||
|
@ -95,6 +96,8 @@ public interface ActivityType {
|
|||
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
||||
|
||||
int SUPER_BOX = 69;//惊喜礼盒
|
||||
int MISTY_TRIP = 72;//缥缈之旅
|
||||
int SUPER_DISCOUNT_SKIN = 73;//特惠神装
|
||||
int HERO_STAR = 500;
|
||||
|
||||
}
|
||||
|
|
|
@ -72,8 +72,11 @@ public enum ActivityTypeEnum {
|
|||
EQUIP_UPLEVEL(ActivityType.EQUIP_UPLEVEL,EquipUpLevelActivity::new),
|
||||
TA_SUI_LING_XIAO(ActivityType.TA_SUI_LING_XIAO,TaSuiLingXiaoActivity::new),
|
||||
CHOICE_DRAW_CRAD(ActivityType.CHOICE_DRAW_CRAD,ChoiceDrawCardActivity::new),
|
||||
HARD_STAGE_EXERCISE(ActivityType.HARD_STAGE_EXERCISE,HardStageExerciseActivity::new),
|
||||
SUPER_BOX(ActivityType.SUPER_BOX,SuperBoxActivity::new),
|
||||
HERO_STAR(ActivityType.HERO_STAR,HeroStarActivity::new),
|
||||
SUPER_DISCOUNT_SKIN(ActivityType.SUPER_DISCOUNT_SKIN,SuperBoxActivity::new),
|
||||
MISTYTRIP(ActivityType.MISTY_TRIP,MistyTripActivity::new),
|
||||
|
||||
;
|
||||
private int type;
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.HardStageExerciseEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
//暂时不上 先注释
|
||||
public class HardStageExerciseActivity extends AbstractActivity{
|
||||
public HardStageExerciseActivity(int id) {
|
||||
super(id);
|
||||
//Poster.getPoster().listenEvent(this, HardStageExerciseEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if(event instanceof HardStageExerciseEvent){
|
||||
User user = UserManager.getUser(((HardStageExerciseEvent) event).getUid());
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
if(user.getActivityManager().getActivityMissionMap().get(id) == null){
|
||||
return;
|
||||
}
|
||||
//无用 功能线上 活动后上
|
||||
//update(user,((HardStageExerciseEvent) event).getCount());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception{
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
if(user == null){
|
||||
return false;
|
||||
}
|
||||
//checkState(user);
|
||||
//super.takeReward(session,missionId);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 活动结束邮件
|
||||
*/
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
//checkState(user);
|
||||
//super.onActivityEndDealReward(user);
|
||||
}
|
||||
|
||||
//山河社稷功能已上 活动后上 为了保证老玩家这个活动数据正常 特在此容错
|
||||
private void checkState(User user)throws Exception{
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if( null == activityMission){
|
||||
return;
|
||||
}
|
||||
int starSum = HardStageLogic.getHardStageStarsSum(user);
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
if(starSum == item.getValue().getProgrss()){
|
||||
continue;
|
||||
}
|
||||
activityProgressInfo.setProgrss(starSum);
|
||||
activityMission.getActivityMissionMap().put(item.getKey(), activityProgressInfo);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||
import com.ljsd.jieling.logic.activity.event.GoldEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.MistyTripEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.MainLevelManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.main.BeginerTaskIdsType;
|
||||
import com.ljsd.jieling.logic.mission.main.MistyTripMissionType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SGlobalActivity;
|
||||
import config.SJourneyWithWind;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MistyTripActivity extends AbstractActivity {
|
||||
|
||||
public MistyTripActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, MistyTripEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof MistyTripEvent))
|
||||
return;
|
||||
//update(UserManager.getUser(((MistyTripEvent) event).getUserId()),((MistyTripEvent) event).getNum());
|
||||
updataRefeshByMissionId(UserManager.getUser(((MistyTripEvent) event).getUserId()), ((MistyTripEvent) event).getRewardId(), ((MistyTripEvent) event).getNum());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updataRefeshByMissionId (User user, int rewardId,int num){
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if( null == activityMission){
|
||||
return;
|
||||
}
|
||||
//相同类型的更新
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if(!activityProgressInfoMap.containsKey(rewardId)){
|
||||
return;
|
||||
}
|
||||
activityProgressInfoMap.get(rewardId).setProgrss( activityProgressInfoMap.get(rewardId).getProgrss() + num);
|
||||
|
||||
//更新进度
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(sessionByUid, activityMission, null);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
//初始化所有事件 主线关卡 心魔试炼 山河社稷 大闹天宫 最高战力
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP_REFRESH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
long userCreateTime = user.getPlayerInfoManager().getCreateTime();
|
||||
int days = TimeUtils.getSoFarWentDays(userCreateTime, TimeUtils.now())+1;
|
||||
|
||||
SActivityRewardConfig config = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
|
||||
if(config == null){
|
||||
return false;
|
||||
}
|
||||
if(days >= config.getValues()[0][1]){
|
||||
return super.takeReward(session,missionId);
|
||||
}
|
||||
/* if (missionId != -1) {
|
||||
return super.takeReward(session, missionId);
|
||||
}
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
SActivityRewardConfig cfg = SActivityRewardConfig.getsActivityRewardConfigByMissionId(id);
|
||||
int day = cfg.getValues()[0][1];
|
||||
List<Integer> listId = SJourneyWithWind.getsTaskConfigByDay(day);
|
||||
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
MistyTripMissionType mistyTripMissionType = userMissionManager.getMistyTripMissionType();
|
||||
for(int id:listId){
|
||||
if(!mistyTripMissionType.getFinishMissionIds().contains(id)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for(int id:listId){
|
||||
mistyTripMissionType.getRewardedMissionIds().set(id);
|
||||
}
|
||||
mistyTripMissionType.getFinishMissionIds().removeAll(listId);
|
||||
//up miss
|
||||
int[][] reward = cfg.getReward();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
return true;*/
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -120,6 +120,9 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
return;
|
||||
}
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return;
|
||||
}
|
||||
// 计算过去了几天
|
||||
int days = TimeUtils.getSoFarWentDays(start, now)+1;
|
||||
mission.setV(days);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
public class HardStageExerciseEvent implements IEvent{
|
||||
private int uid;
|
||||
private int count;
|
||||
|
||||
public HardStageExerciseEvent(int uid, int count) {
|
||||
this.uid = uid;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 飘渺之旅
|
||||
*/
|
||||
public class MistyTripEvent implements IEvent {
|
||||
|
||||
private int userId;
|
||||
private int rewardId;
|
||||
private int num;
|
||||
|
||||
public MistyTripEvent(int userId, int missionId, int num) {
|
||||
this.userId = userId;
|
||||
this.rewardId = missionId;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getRewardId() {
|
||||
return rewardId;
|
||||
}
|
||||
|
||||
public void setRewardId(int rewardId) {
|
||||
this.rewardId = rewardId;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
|
@ -72,9 +72,33 @@ public class HeroManager extends MongoBase {
|
|||
* 紫府神印
|
||||
*/
|
||||
private Map<Integer,PurpleMansionSeal> purpleMansionSeal = new HashMap<>();
|
||||
/**
|
||||
* 心愿抽卡
|
||||
*/
|
||||
private HashMap<Integer,WishDrawCardInfo> wishDrawCardInfoMap = new HashMap<>(3);
|
||||
|
||||
/**
|
||||
* 抽奖次数记录
|
||||
* key: 招募类型 value: 次数
|
||||
*/
|
||||
private Map<Integer,Integer> randomCountByType = new HashMap<>();
|
||||
|
||||
public Map<Integer, Integer> getRandomCountByType() {
|
||||
return randomCountByType;
|
||||
}
|
||||
|
||||
public void setRandomCountByType(Map<Integer, Integer> randomCountByType) {
|
||||
this.randomCountByType = randomCountByType;
|
||||
updateString("randomCountByType", randomCountByType);
|
||||
}
|
||||
|
||||
public void putRandomCount(int type,int value) {
|
||||
randomCountByType.put(type,value);
|
||||
updateString("randomCountByType."+type, value);
|
||||
}
|
||||
|
||||
public void updateRandCount(int type,int count){
|
||||
updateString("totalCount." + type, count);
|
||||
updateString("totalCount." + type, count);
|
||||
totalCount.put(type,count);
|
||||
}
|
||||
|
||||
|
@ -349,7 +373,34 @@ public class HeroManager extends MongoBase {
|
|||
public void setTaSuiLingXiaoRankForce(int taSuiLingXiaoRankForce) {
|
||||
this.taSuiLingXiaoRankForce = taSuiLingXiaoRankForce;
|
||||
updateString("taSuiLingXiaoRankForce", taSuiLingXiaoRankForce);
|
||||
}
|
||||
|
||||
public HashMap<Integer, WishDrawCardInfo> getWishDrawCardInfoMap() {
|
||||
if (wishDrawCardInfoMap.isEmpty()){
|
||||
initWishDrawCardInfoMap();
|
||||
}
|
||||
return wishDrawCardInfoMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化心愿格子信息
|
||||
*/
|
||||
private void initWishDrawCardInfoMap(){
|
||||
for (int i = 1; i < 4; i++) {
|
||||
wishDrawCardInfoMap.put(i,new WishDrawCardInfo(i,0,0));
|
||||
}
|
||||
updateString("wishDrawCardInfoMap", wishDrawCardInfoMap);
|
||||
}
|
||||
|
||||
public void setWishDrawCardInfoMap(HashMap<Integer, WishDrawCardInfo> wishDrawCardInfoMap) {
|
||||
this.wishDrawCardInfoMap = wishDrawCardInfoMap;
|
||||
updateString("wishDrawCardInfoMap", wishDrawCardInfoMap);
|
||||
}
|
||||
|
||||
public void putWishDrawCardInfoMap(WishDrawCardInfo wishDrawCardInfo) {
|
||||
int key = wishDrawCardInfo.getId();
|
||||
wishDrawCardInfoMap.put(key,wishDrawCardInfo);
|
||||
updateString("wishDrawCardInfoMap." + key, wishDrawCardInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,12 @@ public class Mail extends MongoBase {
|
|||
private long noUseDeleteTime;//已读或已领取邮件删除时间
|
||||
|
||||
private int mailType; //邮件类型 1:系统邮件 2:idip 业务邮件
|
||||
|
||||
private int isTop;//0不置顶 1置顶
|
||||
|
||||
private int markType;//0无类型 1:站内信
|
||||
|
||||
|
||||
public Mail(){
|
||||
|
||||
}
|
||||
|
@ -42,6 +48,21 @@ public class Mail extends MongoBase {
|
|||
this.effectiveTime = effectiveTime ;
|
||||
this.sendName = sendName ;
|
||||
this.mailType = mailType;
|
||||
|
||||
}
|
||||
public Mail(int uid,String head,String content,String mailItem,int sendTime,int effectiveTime,String sendName,int mailType,int isTop,int markType){
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.MAIL, uid);
|
||||
this.roleUid = uid;
|
||||
this.state = Global.MAIL_STATE_NEW;
|
||||
this.head = head;
|
||||
this.content = content;
|
||||
this.mailItem = mailItem;
|
||||
this.sendTime = sendTime;
|
||||
this.effectiveTime = effectiveTime ;
|
||||
this.sendName = sendName ;
|
||||
this.mailType = mailType;
|
||||
this.isTop = isTop;
|
||||
this.markType = markType;
|
||||
}
|
||||
public void setState(int state) throws Exception {
|
||||
updateString("state", state);
|
||||
|
@ -98,4 +119,20 @@ public class Mail extends MongoBase {
|
|||
public void setNoUseDeleteTime(long noUseDeleteTime) {
|
||||
this.noUseDeleteTime = noUseDeleteTime;
|
||||
}
|
||||
|
||||
public int getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(int isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public int getMarkType() {
|
||||
return markType;
|
||||
}
|
||||
|
||||
public void setMarkType(int markType) {
|
||||
this.markType = markType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,9 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private long skyEyeBanTime;
|
||||
|
||||
//是否进行过十连抽
|
||||
private boolean isHasRandomLotteryType;
|
||||
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
@ -1097,4 +1100,13 @@ public class PlayerManager extends MongoBase {
|
|||
this.skyEyeBanTime = skyEyeBanTime;
|
||||
updateString("skyEyeBanTime",skyEyeBanTime);
|
||||
}
|
||||
|
||||
public boolean isHasRandomLotteryType() {
|
||||
return isHasRandomLotteryType;
|
||||
}
|
||||
|
||||
public void setHasRandomLotteryType(boolean hasRandomLotteryType) {
|
||||
this.isHasRandomLotteryType = hasRandomLotteryType;
|
||||
updateString("isHasRandomLotteryType",hasRandomLotteryType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ public class UserMissionManager extends MongoBase {
|
|||
private CowFlySkyMissionType cowFlySkyMissionType = new CowFlySkyMissionType();
|
||||
|
||||
private EndlessMissionType endlessMissionType = new EndlessMissionType();
|
||||
//缥缈之旅
|
||||
private MistyTripMissionType mistyTripMissionType = new MistyTripMissionType();
|
||||
|
||||
//数据累加项
|
||||
private CumulationData cumulationData = new CumulationData();
|
||||
|
@ -74,6 +76,7 @@ public class UserMissionManager extends MongoBase {
|
|||
private CumulationData jadeDynastyCumulationData = new CumulationData();//破阵诛仙日数据
|
||||
private CumulationData jadeDynastyWeekCumulationData = new CumulationData();//破阵诛仙周数据
|
||||
private CumulationData endlessTask = new CumulationData();//无尽副本任务数据
|
||||
private CumulationData mistyTripCumulationData = new CumulationData();//缥缈之旅数据
|
||||
|
||||
/**
|
||||
* 触发任务上身
|
||||
|
@ -233,6 +236,19 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("endlessMissionType", endlessMissionType);
|
||||
updateString("endlessTask", this.endlessTask);
|
||||
|
||||
break;
|
||||
case MISTY_TRIP_REFRESH:
|
||||
//任务开始
|
||||
Set<Integer> journeyWithWind = STableManager.getConfig(SJourneyWithWind.class).keySet();
|
||||
if( mistyTripMissionType.getDoingMissionIds().size()==0 && mistyTripMissionType.getFinishMissionIds().size() == 0){
|
||||
mistyTripMissionType.getDoingMissionIds().clear();
|
||||
mistyTripMissionType.getFinishMissionIds().clear();
|
||||
mistyTripMissionType.getRewardedMissionIds().clear();
|
||||
mistyTripMissionType.getDoingMissionIds().addAll(journeyWithWind);
|
||||
this.mistyTripCumulationData= new CumulationData();
|
||||
updateString("mistyTripMissionType", mistyTripMissionType);
|
||||
updateString("mistyTripCumulationData", this.mistyTripCumulationData);
|
||||
}
|
||||
break;
|
||||
case MISSING_ROOM_REFRESH:
|
||||
//天宫寻宝
|
||||
|
@ -566,6 +582,23 @@ public class UserMissionManager extends MongoBase {
|
|||
|
||||
}
|
||||
|
||||
//缥缈之旅
|
||||
if(!mistyTripMissionType.getDoingMissionIds().isEmpty() ){
|
||||
|
||||
Map<Integer, SEndlessTask> endlessConfig = STableManager.getConfig(SEndlessTask.class);
|
||||
if(endlessConfig!=null&&endlessConfig.size()!=0){
|
||||
CumulationData.Result result= mistyTripCumulationData.updateData(missionType, parm);
|
||||
if(result!=null){
|
||||
mistyTripMissionType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.MISTY_TRIP_MISSION),mistyTripCumulationData);
|
||||
updateString("mistyTripMissionType",mistyTripMissionType);
|
||||
updateString("mistyTripCumulationData",mistyTripCumulationData);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 公用任务类型,累计次数形式
|
||||
CumulationData.Result result = cumulationData.updateData(missionType, parm);
|
||||
if(result!=null){
|
||||
|
@ -808,4 +841,12 @@ public class UserMissionManager extends MongoBase {
|
|||
public CumulationData getEndlessTask() {
|
||||
return endlessTask;
|
||||
}
|
||||
|
||||
public MistyTripMissionType getMistyTripMissionType() {
|
||||
return mistyTripMissionType;
|
||||
}
|
||||
|
||||
public CumulationData getMistyTripCumulationData() {
|
||||
return mistyTripCumulationData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/29 11:11
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class WishDrawCardInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int id;
|
||||
private int heroTid;
|
||||
private int status;
|
||||
|
||||
public WishDrawCardInfo(int id, int heroTid, int status) {
|
||||
this.id = id;
|
||||
this.heroTid = heroTid;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getHeroTid() {
|
||||
return heroTid;
|
||||
}
|
||||
|
||||
public void setHeroTid(int heroTid) {
|
||||
this.heroTid = heroTid;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -216,6 +216,7 @@ public class ExpeditionLogic {
|
|||
//updata lay
|
||||
user.getExpeditionManager().setLay(newlay);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EXPEDITION_TIMES);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISTY_TRIP);
|
||||
return nodeInfos;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.hardStage;
|
|||
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.HardStageExerciseEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -258,15 +260,16 @@ public class HardStageLogic {
|
|||
/**
|
||||
* 通过节点
|
||||
*/
|
||||
public static void passNode(ISession iSession, SHardStage nodeConfig, int[] resultNum, List<Integer> dropList) throws Exception {
|
||||
public static int passNode(ISession iSession, SHardStage nodeConfig, int[] resultNum, List<Integer> dropList) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (user == null) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap(user);
|
||||
HardStageNode node = chapterMap.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
||||
int star = 0;
|
||||
if (node.getType() == 1) {//大节点
|
||||
int star = passReward(user, node, resultNum, dropList);//星级通关奖励
|
||||
star = passReward(user, node, resultNum, dropList);//星级通关奖励
|
||||
chapterMap.get(nodeConfig.getChapter()).addStars(star);
|
||||
if (!node.isHasPass()) {
|
||||
node.setHasPass(true);
|
||||
|
@ -291,8 +294,10 @@ public class HardStageLogic {
|
|||
updateChapterAndNodeLevel(user,nodeConfig);
|
||||
user.getHardStageManager().updateString("chapterMap." + nodeConfig.getChapter(), chapterMap.get(nodeConfig.getChapter()));
|
||||
}
|
||||
|
||||
}
|
||||
sendHardStageIndication(user);
|
||||
return star;
|
||||
}
|
||||
public static void updateChapterAndNodeLevel(User user, SHardStage nodeConfig ){
|
||||
if( nodeConfig.getChapter() >=user.getHardStageManager().getCurChapter()){
|
||||
|
@ -452,6 +457,7 @@ public class HardStageLogic {
|
|||
if(n.getType()== 1){
|
||||
n.setState(7);
|
||||
chapter.addStars(3);
|
||||
Poster.getPoster().dispatchEvent(new HardStageExerciseEvent(user.getId(),3));
|
||||
user.getHardStageManager().updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
//user.getHardStageManager().updateString("chapterMap",user.getHardStageManager().getChapterMap());
|
||||
|
||||
|
|
|
@ -29,15 +29,19 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
|||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
|
||||
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import com.ljsd.jieling.tools.Utils;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.ToolsUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -327,7 +331,7 @@ public class HeroLogic{
|
|||
for(int i = 0 ;i<perCount;i++){
|
||||
int rewardId = randomOne(user, type);
|
||||
SLotteryRewardConfig sLotteryRewardConfig = STableManager.getConfig(SLotteryRewardConfig.class).get(rewardId);
|
||||
resultRandom[i] =sLotteryRewardConfig.getReward();
|
||||
resultRandom[i] = drawCard(user,sLotteryRewardConfig,sLotterySetting);
|
||||
index = i;
|
||||
}
|
||||
//上报抽卡
|
||||
|
@ -358,11 +362,174 @@ public class HeroLogic{
|
|||
fiveStarPushByRandom(user,resultRandom);
|
||||
fiveStarPokemonPushByRandom(user,resultRandom);
|
||||
builder.setDrop(drop);
|
||||
builder.addAllDrawTimes(CBean2Proto.getRandomTypeNums(user));
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
|
||||
// System.out.println(System.currentTimeMillis()-time);
|
||||
|
||||
if(sLotterySetting.getLotteryType() == GlobalsDef.RANDOM_LOTTERY_TYPE && !user.getPlayerInfoManager().isHasRandomLotteryType()&sLotterySetting.getPerCount()!=1){
|
||||
//首次神将召唤 10连抽 给个攻略邮件
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("zhanneixin_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("zhanneixin_content",new Object[]{ user.getPlayerInfoManager().getNickName()},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendSpecialMail(uid,title,content,"",(int) (TimeUtils.now() / 1000),Global.MAIL_EFFECTIVE_TIME,1,1);
|
||||
user.getPlayerInfoManager().setHasRandomLotteryType(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 英雄卡池抽卡封装
|
||||
* @param user
|
||||
* @param sLotteryRewardConfig
|
||||
* @param sLotterySetting
|
||||
* @return
|
||||
*/
|
||||
private int[] drawCard(User user, SLotteryRewardConfig sLotteryRewardConfig, SLotterySetting sLotterySetting){
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 限制次数
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.UNLOCKCARDWISH);
|
||||
// 对应卡池抽奖次数
|
||||
Integer num = heroManager.getRandomCountByType().getOrDefault(sLotterySetting.getLotteryType(),0);
|
||||
// 心愿抽卡
|
||||
int[] result;
|
||||
if (sLotterySetting.getLotteryType() == 1 && num >= value){
|
||||
result = wishDrawCardCheck(user,sLotteryRewardConfig.getReward());
|
||||
}else {
|
||||
result = sLotteryRewardConfig.getReward();
|
||||
}
|
||||
//记录次数
|
||||
heroManager.putRandomCount(sLotterySetting.getLotteryType(),num+1);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿抽卡校验
|
||||
* @param user
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
private int[] wishDrawCardCheck(User user,int[] item){
|
||||
// 查找物品
|
||||
SItem sItem = SItem.getsItemMap().get(item[0]);
|
||||
// 非英雄奖励直接返回
|
||||
if (sItem.getItemType() != GlobalItemType.CARD){
|
||||
return item;
|
||||
}
|
||||
// 非五星英雄
|
||||
SCHero scHero = SCHero.getsCHero().get(item[0]);
|
||||
if (scHero.getStar() < 5){
|
||||
return item;
|
||||
}
|
||||
// 随机权重
|
||||
int totalNum = 10000;
|
||||
int anInt = MathUtils.randomInt(totalNum);
|
||||
// 单个格子权重
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.CARDWISHBLOCKRATE);
|
||||
// 获取玩家现在的心愿格子信息
|
||||
Map<Integer, WishDrawCardInfo> cardInfoMap = user.getHeroManager().getWishDrawCardInfoMap();
|
||||
|
||||
// 计算权重map
|
||||
HashMap<Integer, Integer> map = new HashMap<>(4);
|
||||
for (Integer key : cardInfoMap.keySet()) {
|
||||
if (cardInfoMap.get(key).getStatus() == 1){
|
||||
// 已经抽中得格子去除
|
||||
totalNum-=value;
|
||||
continue;
|
||||
}
|
||||
map.put(key,value);
|
||||
}
|
||||
int sum = map.values().stream().mapToInt(Integer::intValue).sum();
|
||||
// 这里添加得是空格子, key随便填,只要不和之前重复既可. 目前用的总权重数负值当key
|
||||
map.put(-totalNum,totalNum-sum);
|
||||
|
||||
// 遍历权重
|
||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||
if (anInt <= entry.getValue()){
|
||||
// 读取格子信息
|
||||
WishDrawCardInfo cardInfo = cardInfoMap.get(entry.getKey());
|
||||
// null表示未中心愿, 该格子已锁定, 是空格子
|
||||
if (cardInfo == null || cardInfo.getStatus() == 1 || cardInfo.getHeroTid() == 0){
|
||||
return item;
|
||||
}
|
||||
// new int[]
|
||||
int[] result = new int[2];
|
||||
// 赋值物品id和数量
|
||||
result[0] = cardInfo.getHeroTid();
|
||||
result[1] = item[1];
|
||||
// 修改格子信息,入库
|
||||
cardInfo.setStatus(1);
|
||||
user.getHeroManager().putWishDrawCardInfoMap(cardInfo);
|
||||
// 消息推送
|
||||
sendWishCardIndication(user);
|
||||
return result;
|
||||
}
|
||||
// 权重递减
|
||||
anInt-=entry.getValue();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送心愿格子信息到客户端
|
||||
* @param user
|
||||
*/
|
||||
private void sendWishCardIndication(User user){
|
||||
List<CommonProto.wishDrawCardInfo> wishCard = CBean2Proto.getWishCard(user);
|
||||
HeroInfoProto.wishDrawCardIndication.Builder list = HeroInfoProto.wishDrawCardIndication.newBuilder().addAllInfoList(wishCard);
|
||||
MessageUtil.sendIndicationMessage(user.getId(),list.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置心愿格子信息
|
||||
*/
|
||||
public void resetWishDrawCardInfoMap(User user){
|
||||
// 重置状态
|
||||
HashMap<Integer, WishDrawCardInfo> map = user.getHeroManager().getWishDrawCardInfoMap();
|
||||
map.values().forEach(v->v.setStatus(0));
|
||||
user.getHeroManager().setWishDrawCardInfoMap(map);
|
||||
// 推送消息
|
||||
sendWishCardIndication(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改英雄格子
|
||||
* @param user
|
||||
* @param list
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
public void updateWishDrawCardInfo(User user, List<CommonProto.wishDrawCardInfo> list) throws ErrorCodeException {
|
||||
HashMap<Integer, WishDrawCardInfo> map = Utils.clone(user.getHeroManager().getWishDrawCardInfoMap());
|
||||
// 遍历
|
||||
for (CommonProto.wishDrawCardInfo v : list) {
|
||||
WishDrawCardInfo cardInfo = map.get(v.getId());
|
||||
// 英雄未锁定
|
||||
if (cardInfo != null && cardInfo.getStatus() == 0){
|
||||
// 替换英雄
|
||||
cardInfo.setHeroTid(v.getHeroTid());
|
||||
}
|
||||
}
|
||||
|
||||
// 获取已选择英雄的类型set集合
|
||||
Set<Integer> race = new HashSet<>();
|
||||
map.values().forEach(v->{
|
||||
if (v.getHeroTid() != 0){
|
||||
SCHero scHero = SCHero.getsCHero().get(v.getHeroTid());
|
||||
race.add(scHero.getPropertyName());
|
||||
}
|
||||
});
|
||||
|
||||
// 去除空格子后队列的长度
|
||||
List<WishDrawCardInfo> infos = new ArrayList<>(map.values());
|
||||
infos.removeIf(v->v.getHeroTid() == 0);
|
||||
|
||||
// 类型唯一, 如果长度不一致代表有重复类型英雄
|
||||
if (race.size() != infos.size()){
|
||||
throw new ErrorCodeException("有重复类型英雄,替换失败");
|
||||
}
|
||||
// 入库
|
||||
else {
|
||||
user.getHeroManager().setWishDrawCardInfoMap(map);
|
||||
}
|
||||
// 推送消息
|
||||
sendWishCardIndication(user);
|
||||
}
|
||||
|
||||
private void changeRandomItem(User user,int activityId,int[][] random){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
|
|
|
@ -107,6 +107,7 @@ public class MailLogic {
|
|||
cMailList.remove(0);
|
||||
}
|
||||
}
|
||||
Collections.sort(cMailList, Comparator.comparingInt(Mail::getIsTop).reversed());
|
||||
getAllMailProtoList(cMailList,mailList);
|
||||
return mailList;
|
||||
}
|
||||
|
@ -341,6 +342,18 @@ public class MailLogic {
|
|||
LOGGER.error(e.toString()+";sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
}
|
||||
}
|
||||
//发送邮件
|
||||
public void sendSpecialMail(int uid, String title, String content, String reward, int sendTime, int mailEffectiveTime,int isTop ,int markType) throws Exception {
|
||||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS,isTop,markType);
|
||||
user.getMailManager().addMail(mail);
|
||||
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
|
||||
}catch (Exception e){
|
||||
LOGGER.error(e.toString()+";sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*每分钟检测是否有需要发的邮件
|
||||
*/
|
||||
|
|
|
@ -125,4 +125,6 @@ public enum GameEvent {
|
|||
HARSTAGE_NODE,//山河社稷图通关章节
|
||||
|
||||
GUILD_BOSS_ROOM,//公会boos副本
|
||||
MISTY_TRIP_REFRESH,//缥缈之旅刷新
|
||||
MISTY_TRIP,//缥缈之旅
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ public enum GameMisionType {
|
|||
ACHIEVEMISSION(9),
|
||||
JADE_DYNASTY_MISSION(10),//破阵诛仙任务
|
||||
COWFLYSKYMISSION(11),//牛气冲天
|
||||
ENDLESS_MISSION(12)
|
||||
ENDLESS_MISSION(12),
|
||||
MISTY_TRIP_MISSION(13),//缥缈之旅
|
||||
|
||||
;
|
||||
private int type;
|
||||
|
|
|
@ -57,6 +57,7 @@ public class MissionLoigc {
|
|||
getJadeDynastyMission(user, missionList);
|
||||
getCowFlySkyMission(user,missionList);
|
||||
getEndlessMission(user,missionList);
|
||||
getMistyTripMission(user,missionList);
|
||||
PlayerInfoProto.GetMissionResponse build = PlayerInfoProto.GetMissionResponse.newBuilder().addAllUserMissionInfo(missionList).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_MISSION_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
@ -406,6 +407,31 @@ public class MissionLoigc {
|
|||
});
|
||||
}
|
||||
|
||||
public static void getMistyTripMission(User user,List<CommonProto.UserMissionInfo> missionList){
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
MistyTripMissionType dailyMissionIdsType = userMissionManager.getMistyTripMissionType();
|
||||
CumulationData dailyCumulationData = userMissionManager.getMistyTripCumulationData();
|
||||
Set<Integer> doingMissionIds = dailyMissionIdsType.getDoingMissionIds();
|
||||
Set<Integer> finishMissionIds = dailyMissionIdsType.getFinishMissionIds();
|
||||
//Map<Integer, SDailyTasksConfig> config = SDailyTasksConfig.config;
|
||||
|
||||
Map<Integer, SJourneyWithWind> config = STableManager.getConfig(SJourneyWithWind.class);
|
||||
//sJourneyWithWind
|
||||
int dailymissionType = GameMisionType.MISTY_TRIP_MISSION.getType();
|
||||
for(SJourneyWithWind journeyWithWind:config.values()){
|
||||
int state = 2;
|
||||
int missionId = journeyWithWind.getId();
|
||||
int progrss = journeyWithWind.getTaskValue()[1][0];
|
||||
if(doingMissionIds.contains(missionId)){
|
||||
state = 0;
|
||||
progrss = getDoingProgress(user,dailyCumulationData,journeyWithWind.getTaskType(),journeyWithWind.getTaskValue()[0]);
|
||||
}else if(finishMissionIds.contains(missionId)){
|
||||
state = 1;
|
||||
}
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(dailymissionType).setProgress(progrss).build());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取天宫寻宝任务列表
|
||||
* @param user
|
||||
|
|
|
@ -9,8 +9,10 @@ import com.ljsd.jieling.logic.mission.MissionType;
|
|||
public class HardStageStarsDataManager implements BaseDataManager {
|
||||
@Override
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
int nums = (int)parm[0];
|
||||
data.setHardstage_stars(nums);
|
||||
if(parm.length !=0){
|
||||
int nums = (int)parm[0];
|
||||
data.setHardstage_stars(nums);
|
||||
}
|
||||
return new CumulationData.Result(missionType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class MissionEventDistributor {
|
|||
eventProcessor.put(GameEvent.JADE_DYNASTY_WEEK_REFRESH,new JadeDynastyRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.COW_FLY_SKY_REFRESH,new CowFlySkyEventProcess());
|
||||
eventProcessor.put(GameEvent.ENDLESS_MISSION_REFRESH,new EndlessMissionRefreshProcess());
|
||||
eventProcessor.put(GameEvent.MISTY_TRIP_REFRESH,new MistyTripMissionRefreshProcess());//缥缈之旅刷新开始
|
||||
|
||||
List<MissionType> typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.REFRESH_MISSING_ROOM);
|
||||
|
@ -185,6 +186,16 @@ public class MissionEventDistributor {
|
|||
eventEnumListMap.put(GameEvent.ADVENTURE_TAKEREWARD,typeList);
|
||||
eventProcessor.put(GameEvent.ADVENTURE_TAKEREWARD,new CumulationDataEventProcessor());
|
||||
|
||||
//缥缈之旅
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.LEVEL_STORY_PASS);//通关奖励
|
||||
typeList.add(MissionType.HARSTAGE_STARS);//山河社稷累积星数
|
||||
typeList.add(MissionType.MONSTER_ATTACK_LEVEL);//心魔试炼通关层数
|
||||
typeList.add(MissionType.USER_FORCE);//战力
|
||||
typeList.add(MissionType.FINISH_EXPEDITION_HERO_TIMES);//大闹天宫完成次数
|
||||
eventEnumListMap.put(GameEvent.MISTY_TRIP,typeList);
|
||||
eventProcessor.put(GameEvent.MISTY_TRIP,new MistyTripEventProcessor());
|
||||
|
||||
// 领取奖励
|
||||
eventProcessor.put(GameEvent.VIP_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.DAILY_MISSION_REWARD,new RewardEventProcessor());
|
||||
|
@ -519,6 +530,7 @@ public class MissionEventDistributor {
|
|||
missionTypeEnumListMap.put(GameMisionType.JADE_DYNASTY_MISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.COWFLYSKYMISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.ENDLESS_MISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.MISTY_TRIP_MISSION, new ArrayList<>());
|
||||
|
||||
|
||||
} else {
|
||||
|
@ -534,7 +546,7 @@ public class MissionEventDistributor {
|
|||
missionTypeEnumListMap.get(GameMisionType.JADE_DYNASTY_MISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.COWFLYSKYMISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.ENDLESS_MISSION).clear();
|
||||
|
||||
missionTypeEnumListMap.get(GameMisionType.MISTY_TRIP_MISSION).clear();
|
||||
|
||||
}
|
||||
threadMissionChangeList.set(missionTypeEnumListMap);
|
||||
|
@ -573,7 +585,7 @@ public class MissionEventDistributor {
|
|||
if(gameMisionType == GameMisionType.COPYMISSION || gameMisionType == GameMisionType.TREASUREMISSION
|
||||
|| gameMisionType == GameMisionType.SEVENMISSION || gameMisionType == GameMisionType.BLOODYMISSION
|
||||
|| gameMisionType == GameMisionType.ACHIEVEMISSION || gameMisionType == GameMisionType.JADE_DYNASTY_MISSION
|
||||
|| gameMisionType == GameMisionType.COWFLYSKYMISSION||gameMisionType==GameMisionType.ENDLESS_MISSION){
|
||||
|| gameMisionType == GameMisionType.COWFLYSKYMISSION||gameMisionType==GameMisionType.ENDLESS_MISSION||gameMisionType==GameMisionType.MISTY_TRIP_MISSION){
|
||||
progress = missionStateChangeInfo.getProgress();
|
||||
}
|
||||
if(missionState == MissionState.DOING){
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.ljsd.jieling.logic.mission.event;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MistyTripEventProcessor implements BaseGameEventProcessor{
|
||||
@Override
|
||||
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object... parm) throws Exception {
|
||||
List<MissionType> typeList = MissionEventDistributor.eventEnumListMap.get(event);
|
||||
if(parm.length >0){
|
||||
user.getUserMissionManager().calCumulationDataResult(user, MissionType.LEVEL_STORY_PASS ,misionTypeListMap,parm);
|
||||
}else{
|
||||
for (MissionType type : typeList) {
|
||||
//大闹天宫 不计数
|
||||
if(type == MissionType.FINISH_EXPEDITION_HERO_TIMES){
|
||||
continue;
|
||||
}
|
||||
if(type!= MissionType.LEVEL_STORY_PASS ){
|
||||
user.getUserMissionManager().calCumulationDataResult(user,type,misionTypeListMap,parm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.mission.event;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MistyTripMissionRefreshProcess implements BaseGameEventProcessor{
|
||||
|
||||
@Override
|
||||
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object... parm) throws Exception {
|
||||
user.getUserMissionManager().openMission(user,event,misionTypeListMap,parm);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.ljsd.jieling.logic.mission.main;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.MistyTripEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||
import com.ljsd.jieling.logic.mission.MissionState;
|
||||
import com.ljsd.jieling.logic.mission.data.AbstractDataManager;
|
||||
import com.ljsd.jieling.logic.mission.data.BaseDataManager;
|
||||
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
|
||||
import config.SJourneyWithWind;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MistyTripMissionType extends AbstractMissionType{
|
||||
|
||||
@Override
|
||||
public void openMission(User user, int missionId, List<MissionStateChangeInfo> missionTypeEnumList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[][] reward(int missionId) {
|
||||
return new int[0][];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) throws Exception {
|
||||
List<SJourneyWithWind> sTaskConfigs = SJourneyWithWind.getsTaskConfigByTypeMap(result.subType.getMissionTypeValue());
|
||||
if (sTaskConfigs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||
for (SJourneyWithWind sTaskConfig : sTaskConfigs) {
|
||||
int missionId = sTaskConfig.getId();
|
||||
if (!doingMissionIds.contains(missionId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isFinish;
|
||||
int doingProgress = 0 ;
|
||||
BaseDataManager missTypeData = DataManagerDistributor.getMissTypeData(result.subType);
|
||||
if(missTypeData instanceof AbstractDataManager){
|
||||
isFinish=((AbstractDataManager) missTypeData).isFinish(user,cumulationData, sTaskConfig.getTaskValue());
|
||||
}else {
|
||||
//完成
|
||||
doingProgress = MissionLoigc.getDoingProgress(user, cumulationData, sTaskConfig.getTaskType(), sTaskConfig.getTaskValue()[0]);
|
||||
isFinish = doingProgress >= sTaskConfig.getTaskValue()[1][0];
|
||||
|
||||
}
|
||||
|
||||
if (!isFinish) {
|
||||
MissionStateChangeInfo doingInfo = new MissionStateChangeInfo(missionId,
|
||||
MissionState.DOING, doingProgress);
|
||||
boolean flag = false;
|
||||
if(missionStateChangeInfos!=null){
|
||||
for (MissionStateChangeInfo missionStateChangeInfo : missionStateChangeInfos) {
|
||||
if (missionStateChangeInfo.getMissionId() == missionId) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
missionStateChangeInfos.add(doingInfo);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
MissionStateChangeInfo finishInfo = new MissionStateChangeInfo(missionId,
|
||||
MissionState.FINISH, null);
|
||||
Iterator<MissionStateChangeInfo> iterator = missionStateChangeInfos.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MissionStateChangeInfo next = iterator.next();
|
||||
if (next.getMissionId() == missionId) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(doingMissionIds.contains(missionId) && !getFinishMissionIds().contains(missionId)){
|
||||
//更新活动完成进度
|
||||
// 事件分发
|
||||
int rewardId = SJourneyWithWind.config.get(missionId).getRewardId();
|
||||
if(rewardId != 0){
|
||||
Poster.getPoster().dispatchEvent(new MistyTripEvent(user.getId(),rewardId,1));
|
||||
}
|
||||
|
||||
}
|
||||
missionStateChangeInfos.add(finishInfo);
|
||||
doingMissionIds.remove(missionId);
|
||||
getFinishMissionIds().add(missionId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewardMission(int missionId, List<MissionStateChangeInfo> missionTypeEnumListMap) {
|
||||
super.rewardMission(missionId, missionTypeEnumListMap);
|
||||
}
|
||||
}
|
|
@ -323,6 +323,7 @@ public class PlayerLogic {
|
|||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(iSession.getUid()));
|
||||
Poster.getPoster().dispatchEvent(new UserForceChangeEvent(uid,teamForce));
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.USER_FORCE_CHANGE);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MISTY_TRIP);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCERANK,teamForce);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCESTANDARD,teamForce);
|
||||
}
|
||||
|
|
|
@ -13,13 +13,6 @@ public class TowerRank extends AbstractRank {
|
|||
public TowerRank(Integer type,String redisKey){
|
||||
super(type,redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getRank(int uid,String rkey,int page,int rankEndLine) throws Exception {
|
||||
rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
|
||||
return super.getRank(uid,rkey,1, rankEndLine);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public long[] getDataByScore(Double score) {
|
||||
// long[] array = new long [2];
|
||||
|
|
|
@ -460,10 +460,6 @@ public class BuyGoodsNewLogic {
|
|||
result = true;
|
||||
}
|
||||
}else{
|
||||
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||
return true;
|
||||
}
|
||||
if(bag.getType() == RechargeType.timeLimit.getType()){
|
||||
//活动类型特殊处理
|
||||
for(String[] s : configById.getCondition()){
|
||||
|
@ -543,6 +539,15 @@ public class BuyGoodsNewLogic {
|
|||
return bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* setPush礼包初始化数据
|
||||
*/
|
||||
public static void setInitPushInfo(PushWelfareBag bag,SRechargeCommodityNewConfig config){
|
||||
bag.setStartTime(System.currentTimeMillis());
|
||||
bag.setEndTime(System.currentTimeMillis() + bag.getTime() * TimeUtils.HOUR);
|
||||
bag.setOpen(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包到时处理
|
||||
*/
|
||||
|
@ -551,7 +556,7 @@ public class BuyGoodsNewLogic {
|
|||
bag.setLastBuyTime(0);
|
||||
bag.setBuyTimes(0);
|
||||
if(bag.getType() == RechargeType.push.getType()){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||
clearPushBag((PushWelfareBag) bag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,36 +886,26 @@ public class BuyGoodsNewLogic {
|
|||
}else{
|
||||
info.getTempLimitMap().put(bagId,num);
|
||||
}
|
||||
if(isFiveStarBag(bagId) && info.getPushMap().get(bagId) != null){
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
|
||||
if(info.getPushMap().get(bagId) != null){
|
||||
AbstractWelfareBag bag = info.getPushMap().get(bagId);
|
||||
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
|
||||
bag.setStartTime(System.currentTimeMillis());
|
||||
bag.setEndTime(bag.getStartTime() + getTime(bag) * TimeUtils.HOUR);
|
||||
setInitPushInfo((PushWelfareBag) bag,config);
|
||||
if(isFiveStarBag(bagId)){
|
||||
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
|
||||
}
|
||||
}else{
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
|
||||
AbstractWelfareBag bag = initUnitWF(user,config);
|
||||
if(num != 0 && num+hasOpen > info.FIVESTARLIMIT){
|
||||
bag.setLimit(info.FIVESTARLIMIT-hasOpen);
|
||||
}else{
|
||||
bag.setLimit(num);
|
||||
if(isFiveStarBag(bagId)){
|
||||
bag.setLimit(num>info.FIVESTARLIMIT?info.FIVESTARLIMIT:num);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送礼包的结束时间
|
||||
* @param bag
|
||||
* @return
|
||||
* 消除推送礼包
|
||||
*/
|
||||
private static int getTime(AbstractWelfareBag bag){
|
||||
int i = 2;
|
||||
for(String[] s : bag.getCondition()){
|
||||
if(s[0].equals("6")){
|
||||
i = Integer.parseInt(s[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
private static void clearPushBag(PushWelfareBag bag){
|
||||
bag.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,11 +184,6 @@ public class NewRechargeInfo extends MongoBase {
|
|||
updateString("pushMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void removePush(PushWelfareBag bag){
|
||||
pushMap.remove(bag.getModId());
|
||||
removeString(getMongoKey() + ".pushMap."+bag.getModId());
|
||||
}
|
||||
|
||||
public int getMainLineLost() {
|
||||
return mainLineLost;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
setModId(config.getId());
|
||||
setType(config.getOtype());
|
||||
setLimit(config.getLimit());
|
||||
if(config.getOtype() == 4){
|
||||
setLimit(1);
|
||||
}
|
||||
setTimeType(config.getTime());
|
||||
setDailyUpdate(config.getDailyUpdate());
|
||||
setContinueDays(config.getContiueDays());
|
||||
|
|
|
@ -27,12 +27,20 @@ public class PushWelfareBag extends AbstractWelfareBag {
|
|||
public boolean buy() {
|
||||
setBuyTimes(getBuyTimes()+1);
|
||||
if(getLimit()<=getBuyTimes()){
|
||||
setOpen(false);
|
||||
clear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getTime(){
|
||||
public void clear(){
|
||||
setOpen(false);
|
||||
setLimit(1);
|
||||
setBuyTimes(0);
|
||||
setStartTime(0);
|
||||
setEndTime(0);
|
||||
}
|
||||
|
||||
public int getTime(){
|
||||
int i = 2;
|
||||
for(String[] s : getCondition()){
|
||||
if(s[0].equals("6")){
|
||||
|
|
|
@ -272,7 +272,9 @@ public class CBean2Proto {
|
|||
.setEffectiveTime(mail.getEffectiveTime())
|
||||
.setSendTime(mail.getSendTime())
|
||||
.setSendName(mail.getSendName())
|
||||
.setMailType(mail.getMailType());
|
||||
.setMailType(mail.getMailType())
|
||||
.setIsTop(mail.getIsTop())
|
||||
.setMarkType(mail.getMarkType());
|
||||
|
||||
if(!withOutContent){
|
||||
mailProto.setContent(mail.getContent());
|
||||
|
@ -862,4 +864,37 @@ public class CBean2Proto {
|
|||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取心愿格子信息
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.wishDrawCardInfo> getWishCard(User user){
|
||||
List<CommonProto.wishDrawCardInfo> list = new ArrayList<>();
|
||||
user.getHeroManager().getWishDrawCardInfoMap().values().forEach(v->{
|
||||
CommonProto.wishDrawCardInfo builder = CommonProto.wishDrawCardInfo.newBuilder()
|
||||
.setId(v.getId())
|
||||
.setHeroTid(v.getHeroTid())
|
||||
.setStatus(v.getStatus())
|
||||
.build();
|
||||
list.add(builder);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型抽卡总次数
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.randomTypeNum> getRandomTypeNums(User user){
|
||||
List<CommonProto.randomTypeNum> list = new ArrayList<>();
|
||||
Map<Integer, Integer> countByType = user.getHeroManager().getRandomCountByType();
|
||||
for (Map.Entry<Integer, Integer> entry : countByType.entrySet()) {
|
||||
CommonProto.randomTypeNum.Builder builder = CommonProto.randomTypeNum.newBuilder().setType(entry.getKey()).setNum(entry.getValue());
|
||||
list.add(builder.build());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -789,7 +789,7 @@ public class ItemUtil {
|
|||
sendToFront.add(CBean2Proto.getItem(item,-1));
|
||||
if(sItem.getItemType()==GlobalItemType.EQUIP){
|
||||
if(reason!=BIReason.EQUIP_UNLOAD_REWARD&&reason!=BIReason.DECOMPOS_HERO_REWARD&&reason!=BIReason.UPHERO_DECOMPOS_HERO_REWARD){
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_EQUIP,sItem.getId(),itemNum);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_EQUIP,sItem.getId(),(int)itemNum);
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_EQUIP.getType(),sItem.getId(),itemNum,reason);
|
||||
}
|
||||
} else if (sItem.getItemType() == GlobalItemType.SOUL_MARK) {
|
||||
|
|
|
@ -128,7 +128,7 @@ public class MonsterUtil {
|
|||
int[] monsterIds = groupIds[i];
|
||||
List<CommonProto.FightUnitInfo> monsterList = new ArrayList<>();
|
||||
int position=1;
|
||||
/* for (int monsterId : monsterIds) {
|
||||
for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
SMonsterConfig sMonsterConfig = STableManager.getConfig(SMonsterConfig.class).get(monsterId);
|
||||
monsterList.add( CBean2Proto.getMonster(sMonsterConfig, nodeConfig).setPosition(position++).build());
|
||||
|
@ -136,15 +136,15 @@ public class MonsterUtil {
|
|||
position++;
|
||||
}
|
||||
|
||||
}*/
|
||||
for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
monsterList.add(monsterMap.get(monsterId).setPosition(position++).build());
|
||||
}else{
|
||||
position++;
|
||||
}
|
||||
|
||||
}
|
||||
// for (int monsterId : monsterIds) {
|
||||
// if(monsterId!=0){
|
||||
// monsterList.add(monsterMap.get(monsterId).setPosition(position++).build());
|
||||
// }else{
|
||||
// position++;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
map.put(i,monsterList);
|
||||
}
|
||||
return map;
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SEndlessHeroProp implements BaseConfig {
|
|||
|
||||
private int[][] props;
|
||||
|
||||
private int heroRankId;
|
||||
|
||||
private int heroStarId;
|
||||
|
||||
public static Map<Integer,Map<Integer,Long>> propsMap = new HashMap<>();
|
||||
|
@ -83,4 +85,8 @@ public class SEndlessHeroProp implements BaseConfig {
|
|||
public int getHeroStarId() {
|
||||
return heroStarId;
|
||||
}
|
||||
|
||||
public int getHeroRankId() {
|
||||
return heroRankId;
|
||||
}
|
||||
}
|
|
@ -31,6 +31,8 @@ public class SHeroSkin implements BaseConfig {
|
|||
|
||||
private int[] headIcon;
|
||||
|
||||
private int show;
|
||||
|
||||
|
||||
public static Map<Integer,SHeroSkin> skinMapByType;
|
||||
|
||||
|
@ -94,4 +96,8 @@ public class SHeroSkin implements BaseConfig {
|
|||
public int[] getHeadIcon() {
|
||||
return headIcon;
|
||||
}
|
||||
|
||||
public int getShow() {
|
||||
return show;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="JourneyWithWind")
|
||||
public class SJourneyWithWind implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int taskType;
|
||||
|
||||
private int[][] taskValue;
|
||||
|
||||
private int dayNum;
|
||||
|
||||
private int rewardId;
|
||||
|
||||
public static Map<Integer, SJourneyWithWind> config;
|
||||
public static Map<Integer, List<SJourneyWithWind>> sTaskConfigByTypeMap;//<任务类型,data>
|
||||
public static Map<Integer, List<Integer>> sTaskConfigByDay;//<天数,data>
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SJourneyWithWind> configTmp = STableManager.getConfig( SJourneyWithWind.class);
|
||||
Map<Integer, List<SJourneyWithWind>> configListTmp = new HashMap<>();
|
||||
|
||||
Map<Integer, List<Integer>> configListbyDay = new HashMap<>();
|
||||
for(SJourneyWithWind sJourneyWithWind : configTmp.values()){
|
||||
int taskType = sJourneyWithWind.getTaskType();
|
||||
int day = sJourneyWithWind.getDayNum();
|
||||
if(!configListTmp.containsKey(taskType)){
|
||||
configListTmp.put(taskType,new ArrayList<>());
|
||||
}
|
||||
configListTmp.get(taskType).add(sJourneyWithWind);
|
||||
|
||||
if(!configListbyDay.containsKey(day)){
|
||||
configListbyDay.put(day,new ArrayList<>());
|
||||
}
|
||||
configListbyDay.get(day).add(sJourneyWithWind.getId());
|
||||
}
|
||||
config = configTmp;
|
||||
sTaskConfigByTypeMap = configListTmp;
|
||||
sTaskConfigByDay = configListbyDay;
|
||||
}
|
||||
|
||||
public static SJourneyWithWind getSDailyTasksConfigById(int missionId) {
|
||||
return config.get(missionId);
|
||||
}
|
||||
|
||||
public static List<SJourneyWithWind> getsTaskConfigByTypeMap(int missionType) {
|
||||
return sTaskConfigByTypeMap.get(missionType);
|
||||
}
|
||||
|
||||
public static List<Integer> getsTaskConfigByDay(int day) {
|
||||
return sTaskConfigByDay.get(day);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public int[][] getTaskValue() {
|
||||
return taskValue;
|
||||
}
|
||||
|
||||
public int getDayNum() {
|
||||
return dayNum;
|
||||
}
|
||||
|
||||
public int getRewardId() {
|
||||
return rewardId;
|
||||
}
|
||||
}
|
|
@ -54,6 +54,10 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
private String rechargeId5;
|
||||
|
||||
private String rechargeId6;
|
||||
private String rechargeId7;
|
||||
private String rechargeId8;
|
||||
private String rechargeId9;
|
||||
private String rechargeId10;
|
||||
|
||||
private int[] forbid;
|
||||
|
||||
|
@ -174,6 +178,22 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
return rechargeId6;
|
||||
}
|
||||
|
||||
public String getRechargeId7() {
|
||||
return rechargeId7;
|
||||
}
|
||||
|
||||
public String getRechargeId8() {
|
||||
return rechargeId8;
|
||||
}
|
||||
|
||||
public String getRechargeId9() {
|
||||
return rechargeId9;
|
||||
}
|
||||
|
||||
public String getRechargeId10() {
|
||||
return rechargeId10;
|
||||
}
|
||||
|
||||
public String[][] getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String YIJIANGOUMAI = "YiJianGouMai";//一件购买
|
||||
public static final String WELFAREREDPACKET_LIMIT = "RedPackMaxGainNum";//每日领取红包数量上限
|
||||
public static final String SWEEP_ONEKEY = "floodprivilegeid";//一键扫荡
|
||||
|
||||
public static final String CARDWISHBLOCKRATE = "CardWishBlockRate";//钻石抽卡心愿单格子命中万分比
|
||||
public static final String UNLOCKCARDWISH = "UnlockCardWish";//解锁钻石心愿抽卡所需要的抽卡次数
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.*;
|
||||
|
||||
@Table(name ="WishActivityPool")
|
||||
public class SWishActivityPool implements BaseConfig {
|
||||
|
@ -16,17 +14,31 @@ public class SWishActivityPool implements BaseConfig {
|
|||
|
||||
private int getRate;
|
||||
|
||||
public static Map<Integer,Integer> weight = new TreeMap<>();
|
||||
private int camp;
|
||||
|
||||
public static Map<Integer,Map<Integer,Integer>> weight = new TreeMap<>();
|
||||
|
||||
public static Map<Integer,SWishActivityPool> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SWishActivityPool> config = STableManager.getConfig(SWishActivityPool.class);
|
||||
List<Integer> allCamp = new ArrayList<>(10);
|
||||
Map<Integer,Map<Integer,Integer>> mapTemp = new HashMap<>();
|
||||
config.values().forEach(v->{
|
||||
map.put(v.getId(),v);
|
||||
weight.put(v.getId(),v.getGetRate());
|
||||
//weight修改成只有当前卡池和对应权重
|
||||
if(v.getCamp()!=0){
|
||||
mapTemp.putIfAbsent(v.getCamp(),new HashMap<>());
|
||||
mapTemp.get(v.getCamp()).put(v.getId(),v.getGetRate());
|
||||
}else{
|
||||
allCamp.add(v.getId());
|
||||
}
|
||||
});
|
||||
//把通用系的的放进去
|
||||
allCamp.forEach(i->mapTemp.forEach((k,v)->v.put(i,map.get(i).getGetRate())));
|
||||
//最后再赋值
|
||||
weight = mapTemp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,5 +54,7 @@ public class SWishActivityPool implements BaseConfig {
|
|||
return getRate;
|
||||
}
|
||||
|
||||
|
||||
public int getCamp() {
|
||||
return camp;
|
||||
}
|
||||
}
|
|
@ -197,7 +197,7 @@ public class STableManager {
|
|||
LOGGER.error("file not find {}, do not find sheet with {} you need rebuild all sheet by gen sheet tool!", path, tableName);
|
||||
throw new NullPointerException("clazz.null" + clazz.getName());
|
||||
}
|
||||
LOGGER.info("initMap:{}", clazz.getSimpleName());
|
||||
LOGGER.info("initConfig:{}", clazz.getSimpleName());
|
||||
readFileToCache(clazz, map, file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue