Merge branch 'master_test_gn' into master_test_gn_mcz
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.javaback_recharge
commit
91080b333b
|
@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
|
@ -90,6 +91,7 @@ public class Utils {
|
|||
String randStr = String.valueOf(stringBuffer);
|
||||
return randStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象拷贝 只要实现了Serializable接口都可以
|
||||
* @param obj
|
||||
|
@ -116,4 +118,13 @@ public class Utils {
|
|||
}
|
||||
return cloneObj;
|
||||
}
|
||||
|
||||
public static int[][] changeList(List<int[]> list){
|
||||
int[][] objects = new int[list.size()][];
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
objects[i] = list.get(i);
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -340,4 +340,7 @@ public interface BIReason {
|
|||
|
||||
int CHOICE_DRAW_CARD = 1102;//心愿抽奖
|
||||
|
||||
int QIMENDUNJIA_DRAW = 1103;//奇门遁甲
|
||||
int QIMENDUNJIA_DRAW_CONSUME = 1104;//奇门遁甲消耗
|
||||
|
||||
}
|
|
@ -225,7 +225,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
//hotfix
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),-1));
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.default_id));
|
||||
// 超值基金,老玩家兼容
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_old_user));
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,0,user);
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGloableWorldLeveCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
@ -270,7 +272,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.UNLOCKCARDWISH);
|
||||
if (num < value){
|
||||
// 修改次数
|
||||
user.getHeroManager().putRandomCount(1,value);
|
||||
user.getHeroManager().putRandomType(1,value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/8 15:40
|
||||
* @Description: 奇门遁甲/玲珑宝阁抽奖
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class GetQiMenDunJiaHitListHandler extends BaseHandler<ActivityProto.qiMenDunJiaHitListRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.qiMenDunJiaHitListRequest;
|
||||
}
|
||||
|
||||
public GeneratedMessage processWithProto(int uid, ActivityProto.qiMenDunJiaHitListRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 获取全部已经抽中的id列表
|
||||
Set<Integer> list = new HashSet<>();
|
||||
Map<Integer, List<Integer>> poolInfo = user.getActivityManager().getDoubleRewardPoolInfo();
|
||||
poolInfo.values().forEach(list::addAll);
|
||||
|
||||
return ActivityProto.qiMenDunJiaHitListResponse.newBuilder().addAllHitList(list).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/8 15:40
|
||||
* @Description: 奇门遁甲/玲珑宝阁抽奖
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class QiMenDunJiaDrawHandler extends BaseHandler<ActivityProto.qiMenDunJiaDrawRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.qiMenDunJiaDrawRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, ActivityProto.qiMenDunJiaDrawRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
return ActivityLogic.getInstance().qiMenDunJiaDraw(user,proto.getActivityId());
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ public final class ActivityManager extends MongoBase {
|
|||
private com.ljsd.jieling.jbean.LuckWheelMission luckWheel; // 幸运探宝奖池
|
||||
private com.ljsd.jieling.jbean.LuckWheelMission luckWheelAdvance; // 高级幸运探宝奖池
|
||||
private com.ljsd.jieling.jbean.SubRewardPoolInfo subRewardPoolInfo; // 挖矿奖池
|
||||
private Map<Integer,List<Integer>> doubleRewardPoolInfo = new HashMap<>(); // 奇门遁甲奖池
|
||||
|
||||
public ActivityManager() {
|
||||
}
|
||||
|
@ -30,6 +31,7 @@ public final class ActivityManager extends MongoBase {
|
|||
this.luckWheel = new LuckWheelMission(_o_.luckWheel);
|
||||
this.luckWheelAdvance = new LuckWheelMission(_o_.luckWheelAdvance);
|
||||
this.subRewardPoolInfo = new SubRewardPoolInfo(_o_.subRewardPoolInfo);
|
||||
this.doubleRewardPoolInfo = new HashMap<>(_o_.doubleRewardPoolInfo);
|
||||
}
|
||||
|
||||
public Map<Integer, com.ljsd.jieling.jbean.ActivityMission> getActivityMissionMap() {
|
||||
|
@ -77,6 +79,14 @@ public final class ActivityManager extends MongoBase {
|
|||
this.subRewardPoolInfo = subrewardpoolinfo;
|
||||
}
|
||||
|
||||
public void setDoubleRewardPoolInfo(Map<Integer, List<Integer>> doubleRewardPoolInfo) {
|
||||
updateString("doubleRewardPoolInfo",doubleRewardPoolInfo);
|
||||
this.doubleRewardPoolInfo = doubleRewardPoolInfo;
|
||||
}
|
||||
|
||||
public Map<Integer, List<Integer>> getDoubleRewardPoolInfo() {
|
||||
return doubleRewardPoolInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.ljsd.jieling.jbean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/8 13:41
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class DoubleRewardPoolInfo{
|
||||
|
||||
/**
|
||||
* 外圈,存储的是已抽中的奖励
|
||||
*/
|
||||
private List<Integer> bigRewardPool = new ArrayList<>();
|
||||
/**
|
||||
* 内圈,存储的是已抽中的奖励
|
||||
*/
|
||||
private List<Integer> smallRewardPool = new ArrayList<>();
|
||||
|
||||
public DoubleRewardPoolInfo() {
|
||||
}
|
||||
|
||||
|
||||
public DoubleRewardPoolInfo(DoubleRewardPoolInfo _o_ ) {
|
||||
this.bigRewardPool = new ArrayList<>(_o_.bigRewardPool);
|
||||
this.smallRewardPool = new ArrayList<>(_o_.smallRewardPool);
|
||||
}
|
||||
|
||||
public List<Integer> getBigRewardPool() {
|
||||
return bigRewardPool;
|
||||
}
|
||||
|
||||
public void setBigRewardPool(List<Integer> bigRewardPool) {
|
||||
this.bigRewardPool = bigRewardPool;
|
||||
}
|
||||
|
||||
public List<Integer> getSmallRewardPool() {
|
||||
return smallRewardPool;
|
||||
}
|
||||
|
||||
public void setSmallRewardPool(List<Integer> smallRewardPool) {
|
||||
this.smallRewardPool = smallRewardPool;
|
||||
}
|
||||
}
|
|
@ -14,8 +14,8 @@ public class Cmd_fightrecord extends GmAbstract {
|
|||
@Override
|
||||
public String exec2(String[] args){
|
||||
// 获取玩家战报系统
|
||||
String sign = Optional.ofNullable(args[0]).orElse("");
|
||||
String content = Optional.ofNullable(args[1]).orElse("");
|
||||
String sign = args.length>0 ? args[0]:"";
|
||||
String content = args.length>1 ? args[1]:"";
|
||||
String result = "";
|
||||
if (sign.equals("delete")){
|
||||
FightRecordLogic.getInstance().delete();
|
||||
|
|
|
@ -382,8 +382,8 @@ public class GlobalDataManaager implements IManager {
|
|||
// 道具刷新
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),-1));
|
||||
// 惊喜礼盒,超值基金,零点逻辑(可以同用一个状态)
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_zero_init));
|
||||
// 心愿格子信息刷新
|
||||
HeroLogic.getInstance().resetWishDrawCardInfoMap(user);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
@Override
|
||||
public void update(User user, int count) {
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if( null == activityMission){
|
||||
if(null == activityMission){
|
||||
return;
|
||||
}
|
||||
updateProgressWithUser(user, activityMission, count);
|
||||
|
@ -114,6 +114,32 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查活动是否完成或者可以领取
|
||||
* @param uid
|
||||
* @param activityId
|
||||
* @param activityMission
|
||||
* @return
|
||||
*/
|
||||
public boolean checkActivityMissionFinishAndTake(int uid,int activityId,ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 领奖默认方法 走统一奖励配置表
|
||||
|
@ -151,7 +177,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
checkAndSetProgress(activityMission, activityProgressInfo, missionId);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (null != sGlobalActivity && ActivityLogic.getInstance().checkActivityMissionFinishAndTaked(session.getUid(),id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
|
||||
if (null != sGlobalActivity && checkActivityMissionFinishAndTake(session.getUid(),id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
|
||||
reSetValue(user);
|
||||
if(sGlobalActivity.getType() != ActivityType.OnlineReward) {
|
||||
ActivityMission newmiss = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
|
@ -162,7 +188,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
}
|
||||
}
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
reportTakeActivityReward(user,reward,missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
|
@ -175,6 +200,12 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
ReportUtil.onReportEvent(user, ReportEventEnum.COMPLETE_ACTIVITY.getType(),String.valueOf(id),String.valueOf(missionId),itemId,itemNum,new Date());
|
||||
}
|
||||
|
||||
protected void reportTakeActivityReward(User user, List<int[][]> reward, int missionId) throws Exception {
|
||||
for (int[][] inits : reward) {
|
||||
reportTakeActivityReward(user,inits,missionId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取所有活动奖励 有的活动是重置类型 迭代处理
|
||||
*/
|
||||
|
@ -346,6 +377,13 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendActivityProgress(User user, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
ISession session = OnlineUserManager.sessionMap.get(user.getId());
|
||||
if (session != null){
|
||||
sendActivityProgress(session,activityMission,filterMissId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setOpenState(User user,int openState){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
|||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.tools.Utils;
|
||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
@ -288,6 +290,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
activityMission.setOpenType(1);
|
||||
activityMission.setV(0);
|
||||
activityMission.setActivityState(ActivityType.OPEN_STATE);
|
||||
activityMission.setCreatTime(TimeUtils.now());
|
||||
}
|
||||
|
||||
public LuckWheelMission getLuckWheel(ActivityManager activityManager, int type) {
|
||||
|
@ -741,37 +744,13 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (activityMission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||
continue;
|
||||
}
|
||||
checkActivityMissionFinishAndTaked(user.getId(),item.getKey(), activityMission);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkActivityMissionFinishAndTaked(int uid,int activityId, ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE) {
|
||||
return false;
|
||||
}
|
||||
if (SGlobalActivity.getsGlobalActivityMap().get(activityId).getType() == ActivityType.TREASURE) {
|
||||
if (missionStatus == ActivityType.HAD_TAKED) {
|
||||
return false;
|
||||
}
|
||||
AbstractActivity activityType = ActivityTypeEnum.getActicityType(item.getKey());
|
||||
if (activityType != null){
|
||||
activityType.checkActivityMissionFinishAndTake(user.getId(),item.getKey(), activityMission);
|
||||
}
|
||||
}
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public int getInitActivityMissionProgress(int activityId) {
|
||||
int defalutProgress = 0;
|
||||
switch (activityId) {
|
||||
|
@ -1698,4 +1677,106 @@ public class ActivityLogic implements IEventHandler{
|
|||
// 返回奖励信息
|
||||
return ItemUtil.dropPer(user, reward, BIReason.CHOICE_DRAW_CARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇门遁甲抽奖
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public ActivityProto.qiMenDunJiaDrawResponse qiMenDunJiaDraw(User user,int activityId) throws Exception {
|
||||
// 道具消耗
|
||||
qiMenConsume(user);
|
||||
// 抽奖逻辑
|
||||
ActivityProto.qiMenDunJiaDrawResponse.Builder response = ActivityProto.qiMenDunJiaDrawResponse.newBuilder();
|
||||
ArrayList<Integer> hits = new ArrayList<>();
|
||||
List<int[]> list = new ArrayList<>();
|
||||
// 根据返回判断是否需要抽外圈
|
||||
boolean result = qiMenRandom(user, 2, list, hits);
|
||||
if (result){
|
||||
// 外圈抽奖
|
||||
qiMenRandom(user, 1, list, hits);
|
||||
// 事件分发
|
||||
Poster.getPoster().dispatchEvent(new QiMenDunJiaEvent(user.getId(),activityId,1));
|
||||
}
|
||||
// 处理奖励
|
||||
int[][] rewards = Utils.changeList(list);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, rewards, BIReason.QIMENDUNJIA_DRAW);
|
||||
|
||||
response.setDrop(drop).addAllIdList(hits);
|
||||
return response.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇门遁甲消耗
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private void qiMenConsume(User user) throws Exception {
|
||||
// 获取抽奖消耗配置
|
||||
int[][] value = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.LING_LONG_COST);
|
||||
// 计算数量
|
||||
int num = (int)MathUtils.calABX(1,value[1]);
|
||||
// 拼装
|
||||
int[][] cost = {{value[0][0], num}};
|
||||
// 消耗验证
|
||||
boolean result = ItemUtil.itemCost(user, cost, BIReason.QIMENDUNJIA_DRAW_CONSUME, 0);
|
||||
if (!result){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"奇门遁甲消耗道具不足!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 奇门遁甲随机奖励
|
||||
* @param user 玩家
|
||||
* @param type 内圈,外圈
|
||||
* @param list 奖励的二维数组
|
||||
* @param hits 抽中的索引id
|
||||
* @return true:需要进行外圈抽奖 false:不需要外圈抽奖
|
||||
*/
|
||||
private boolean qiMenRandom(User user, int type, List<int[]> list, List<Integer> hits){
|
||||
boolean result = false;
|
||||
|
||||
// 根据类型获取卡池
|
||||
List<SLingLongPool> smallPool = new ArrayList<>(SLingLongPool.map.get(type));
|
||||
// 玩家身上记录已抽中的索引id
|
||||
Map<Integer, List<Integer>> doubleRewardPoolInfo = user.getActivityManager().getDoubleRewardPoolInfo();
|
||||
List<Integer> rewardPool = doubleRewardPoolInfo.getOrDefault(type,new ArrayList<>());
|
||||
// 已抽中的去除
|
||||
smallPool.removeIf(v->rewardPool.contains(v.getId()));
|
||||
// 总权重和随机值
|
||||
int totalWeight = smallPool.stream().mapToInt(SLingLongPool::getGetRate).sum();
|
||||
int randomInt = MathUtils.randomInt(totalWeight);
|
||||
|
||||
for (SLingLongPool pool : smallPool) {
|
||||
// 中将
|
||||
if (randomInt <= pool.getGetRate()){
|
||||
// 物品
|
||||
list.add(pool.getItemId());
|
||||
// 中门
|
||||
if (pool.getItemId()[0] == 105){
|
||||
result = true;
|
||||
// 更新数据用,已经抽中的需要记录
|
||||
rewardPool.clear();
|
||||
}else {
|
||||
rewardPool.add(pool.getId());
|
||||
}
|
||||
// 返回给前端的抽中的id
|
||||
hits.add(pool.getId());
|
||||
break;
|
||||
}
|
||||
randomInt -= pool.getGetRate();
|
||||
}
|
||||
|
||||
// 外圈抽奖用,抽中全部
|
||||
if (rewardPool.size() >= SLingLongPool.map.get(type).size()){
|
||||
rewardPool.clear();
|
||||
}
|
||||
|
||||
// 更新数据库
|
||||
doubleRewardPoolInfo.put(type,rewardPool);
|
||||
user.getActivityManager().setDoubleRewardPoolInfo(doubleRewardPoolInfo);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,9 +95,12 @@ public interface ActivityType {
|
|||
int DEMON_TREASURE = 36;//降妖夺宝
|
||||
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
||||
|
||||
int QI_MEN_DUN_JIA = 67;//奇门遁甲
|
||||
int SUPER_BOX = 69;//惊喜礼盒
|
||||
int MISTY_TRIP = 72;//缥缈之旅
|
||||
int SUPER_DISCOUNT_SKIN = 73;//特惠神装
|
||||
int HERO_STAR = 500;
|
||||
|
||||
int SUPERFUND128 = 78;//超值基金128
|
||||
int SUPERFUND328 = 79;//超值基金328
|
||||
}
|
||||
|
|
|
@ -72,12 +72,14 @@ 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),
|
||||
QIMENDUNJIA_DRAW(ActivityType.QI_MEN_DUN_JIA,QiMenDunJiaActivity::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),
|
||||
|
||||
SUPERFUND128(ActivityType.SUPERFUND128,SuperFundActivity::new),//超值基金128
|
||||
SUPERFUND328(ActivityType.SUPERFUND328,SuperFundActivity::new),//超值基金328
|
||||
;
|
||||
private int type;
|
||||
private Function<Integer, AbstractActivity> toActivityFunction;
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
//暂时不上 先注释
|
||||
//山河试炼
|
||||
public class HardStageExerciseActivity extends AbstractActivity{
|
||||
public HardStageExerciseActivity(int id) {
|
||||
super(id);
|
||||
|
@ -41,17 +41,16 @@ public class HardStageExerciseActivity extends AbstractActivity{
|
|||
if(user == null){
|
||||
return false;
|
||||
}
|
||||
//checkState(user);
|
||||
//super.takeReward(session,missionId);
|
||||
return true;
|
||||
checkState(user);
|
||||
return super.takeReward(session,missionId);
|
||||
}
|
||||
/**
|
||||
* 活动结束邮件
|
||||
*/
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
//checkState(user);
|
||||
//super.onActivityEndDealReward(user);
|
||||
checkState(user);
|
||||
super.onActivityEndDealReward(user);
|
||||
}
|
||||
|
||||
//山河社稷功能已上 活动后上 为了保证老玩家这个活动数据正常 特在此容错
|
||||
|
|
|
@ -60,6 +60,7 @@ public class LuckyGetActivity extends AbstractActivity{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
if(missionId!=-1){
|
||||
return super.takeReward(session, missionId);
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.DoubleRewardPoolInfo;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.QiMenDunJiaEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SLingLongPool;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 奇门遁甲活动
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
public class QiMenDunJiaActivity extends AbstractActivity {
|
||||
|
||||
QiMenDunJiaActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, QiMenDunJiaEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
List<SActivityRewardConfig> configs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
List<Integer> list = configs.stream().mapToInt(SActivityRewardConfig::getId).boxed().collect(Collectors.toList());
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, list);
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
// 卡池初始化
|
||||
user.getActivityManager().setDoubleRewardPoolInfo(new HashMap<>());
|
||||
LOGGER.info("奇门遁甲/玲珑宝阁 初始化..."+id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
// 类型验证
|
||||
if (!(event instanceof QiMenDunJiaEvent)) {
|
||||
return;
|
||||
}
|
||||
// 获取信息
|
||||
QiMenDunJiaEvent drawCardEvent = (QiMenDunJiaEvent) event;
|
||||
// 用户
|
||||
User user = UserManager.getUser(drawCardEvent.getUserId());
|
||||
// 更新进度
|
||||
update(user,drawCardEvent.getNum());
|
||||
}
|
||||
|
||||
}
|
|
@ -79,7 +79,7 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
* @param missionMap
|
||||
*/
|
||||
private void giftHandle(User user, int giftId){
|
||||
if (giftId == -1){
|
||||
if (giftId < 0){
|
||||
// 非礼包处理
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.jbean.ActivityManager;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SLuxuryFund;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.security.Key;
|
||||
import java.time.Year;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 超值基金活动
|
||||
*/
|
||||
public class SuperFundActivity extends AbstractActivity {
|
||||
|
||||
SuperFundActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, SuperBoxEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.getOrDefault(id, new HashMap<>());
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>(fundMap.keySet()));
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
LOGGER.info("超值基金初始化...{}",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
// 类型验证
|
||||
if (!(event instanceof SuperBoxEvent)) {
|
||||
return;
|
||||
}
|
||||
// 获取信息
|
||||
SuperBoxEvent event1 = (SuperBoxEvent) event;
|
||||
User user = UserManager.getUser(event1.getUserId());
|
||||
// 老玩家兼容
|
||||
compatibleOldUser(user,event1.getGiftId());
|
||||
// 状态初始化
|
||||
initState(user,event1.getGiftId());
|
||||
// 礼包处理
|
||||
updateValue(user);
|
||||
// 状态刷新
|
||||
updateState(user);
|
||||
// 状态推送
|
||||
sendActivityProgress(user, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包处理
|
||||
* @param user
|
||||
*/
|
||||
private void updateValue(User user) throws Exception {
|
||||
// 活动详情
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null || mission.getV() == 2){
|
||||
// 活动不存在或者已经购买了
|
||||
return;
|
||||
}
|
||||
// 获取活动信息
|
||||
ReceiveWelfareBag bag = getBagInfo(user);
|
||||
// 已购买月卡
|
||||
if (bag.isOpen()){
|
||||
mission.setV(1);
|
||||
}
|
||||
// 已购买基金
|
||||
if (bag.isBought()){
|
||||
mission.setV(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
// activity check
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap =getMissionMap(mission);
|
||||
// 处理状态
|
||||
updateState(user);
|
||||
// 获取奖励
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.get(id);
|
||||
List<int[][]> rewards = new ArrayList<>();
|
||||
infoMap.forEach((k,v)->{
|
||||
// 可以领取得奖励
|
||||
if (v.getProgrss() == 1){
|
||||
SLuxuryFund fund = fundMap.get(k);
|
||||
rewards.add(fund.getReward());
|
||||
// 修改状态
|
||||
v.setState(1);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
// 已领取全部奖励
|
||||
if (rewards.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("活动奖励已经领取"));
|
||||
}
|
||||
// reward
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
// 状态推送
|
||||
sendActivityProgress(session, mission, null);
|
||||
// 打点上报
|
||||
reportTakeActivityReward(user,rewards,missionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改详细奖励状态
|
||||
* @param user
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void updateState(User user) throws Exception {
|
||||
// 获取礼包信息
|
||||
AbstractWelfareBag bag = getBagInfo(user);
|
||||
if (bag.getLastBuyTime() == 0){
|
||||
return;
|
||||
}
|
||||
// 间隔天数,购买当天算第一天,所以需要+1
|
||||
int days = TimeUtils.differentDays(bag.getLastBuyTime(), TimeUtils.getTodayZero())+1;
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 遍历
|
||||
infoMap.forEach((k,v)->{
|
||||
// 已领取得不做处理
|
||||
if (v.getState() == 0){
|
||||
// 满足天数修改状态
|
||||
if (days >= k){
|
||||
v.setProgrss(1);
|
||||
}
|
||||
// 入库
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化状态
|
||||
* @param user
|
||||
* @param gId
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void initState(User user,int gId) throws Exception {
|
||||
if (gId != SuperBoxEvent.fund_zero_init){
|
||||
// 不是零点得逻辑
|
||||
return;
|
||||
}
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 获取已经领取得状态
|
||||
long count = infoMap.values().stream().filter(v -> v.getState() == 1).count();
|
||||
// 全部领取得话
|
||||
if (count == infoMap.size()){
|
||||
// 重置活动信息
|
||||
reSetValue(user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 老玩家兼容
|
||||
* @param user
|
||||
* @param gId
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void compatibleOldUser(User user,int gId) throws Exception {
|
||||
if (gId != SuperBoxEvent.fund_old_user){
|
||||
// 不是老玩家兼容逻辑
|
||||
return;
|
||||
}
|
||||
// 获取礼包信息
|
||||
ReceiveWelfareBag bag = getBagInfo(user);
|
||||
if (bag.getGetRewardTime() == 0){
|
||||
// 未领取过
|
||||
return;
|
||||
}
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 领取得天数
|
||||
int days = TimeUtils.differentDays(bag.getGetRewardTime(), TimeUtils.getTodayZero())+1;
|
||||
// 遍历
|
||||
infoMap.forEach((k,v)->{
|
||||
// 已领取得不做处理
|
||||
if (k >= days){
|
||||
v.setState(1);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reSetValue(User user) throws Exception {
|
||||
// 活动信息重置
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
activityManager.getActivityMissionMap().remove(id);
|
||||
initActivity(user);
|
||||
// 礼包信息重置
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
bagInfo.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动单个页签信息
|
||||
* @param mission
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private Map<Integer, ActivityProgressInfo> getMissionMap(ActivityMission mission) throws Exception{
|
||||
Map<Integer, ActivityProgressInfo> infoMap = Optional.ofNullable(mission).map(ActivityMission::getActivityMissionMap).orElse(new HashMap<>());
|
||||
if (infoMap.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"超值基金活动数据错误:"+id);
|
||||
}
|
||||
return infoMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼包信息
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private ReceiveWelfareBag getBagInfo(User user) throws Exception{
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)Optional.ofNullable(user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap()).map(v -> v.get(id)).orElse(null);
|
||||
if (bag == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"超值基金礼包信息错误:"+id);
|
||||
}
|
||||
return bag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,8 @@ 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.event.ActivityStateChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.VipInfo;
|
||||
|
@ -52,14 +54,12 @@ public class TreasureActivity extends AbstractActivity {
|
|||
id=sRechargeCommodityConfig.getId();
|
||||
}
|
||||
}
|
||||
// user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(id,0);
|
||||
}
|
||||
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_MONTH_REFRESH, sGlobalActivity.getId());
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_WEEK_REFRESH, sGlobalActivity.getId());
|
||||
//戒灵秘宝改为青龙秘宝,只有周任务和月任务 2020.8.14
|
||||
//user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_REFRESH, sGlobalActivity.getId());
|
||||
ActivityMission activityMission = new ActivityMission();
|
||||
activityMission.setActivityState(1);
|
||||
List<Integer> levels = new ArrayList<>(STreasureSunlongConfig.levelTreasureConfigMap.get(id).keySet());
|
||||
|
@ -67,7 +67,6 @@ public class TreasureActivity extends AbstractActivity {
|
|||
levels.remove(0);
|
||||
}
|
||||
ActivityLogic.getInstance().initOtherMission(activityMission,levels);
|
||||
// long endTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),user.getPlayerInfoManager().getCreateTime(), 2) - 24 * 3600 * 1000;
|
||||
user.getActivityManager().getActivityMissionMap().put(sGlobalActivity.getId(), activityMission);
|
||||
PlayerInfoProto.TreasureLevelUpIndication indication = PlayerInfoProto.TreasureLevelUpIndication.newBuilder().setLevel(user.getPlayerInfoManager().getTreasureLevel())
|
||||
.setHadBuy(user.getPlayerInfoManager().getHadBuyTreasure()).build();
|
||||
|
@ -283,4 +282,25 @@ public class TreasureActivity extends AbstractActivity {
|
|||
indication.addAllInfos(privilege);
|
||||
MessageUtil.sendIndicationMessage(sesson, 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid,int activityId,ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE || missionStatus == ActivityType.HAD_TAKED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/5/26 11:05
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class QiMenDunJiaEvent implements IEvent {
|
||||
|
||||
private int userId;
|
||||
private int activityId;
|
||||
private int num;
|
||||
|
||||
public QiMenDunJiaEvent(int userId, int activityId, int num) {
|
||||
this.userId = userId;
|
||||
this.activityId = activityId;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public void setActivityId(int activityId) {
|
||||
this.activityId = activityId;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
|
@ -8,8 +8,21 @@ package com.ljsd.jieling.logic.activity.event;
|
|||
*/
|
||||
public class SuperBoxEvent implements IEvent {
|
||||
|
||||
/**
|
||||
* 默认状态
|
||||
*/
|
||||
public static int default_id = -1;
|
||||
/**
|
||||
* 超值基金, 零点刷新初始化
|
||||
*/
|
||||
public static int fund_zero_init = -2;
|
||||
/**
|
||||
* 超值基金, 老玩家兼容
|
||||
*/
|
||||
public static int fund_old_user = -3;
|
||||
|
||||
private int userId;
|
||||
private int giftId = -1;//礼包id
|
||||
private int giftId = default_id;//礼包id
|
||||
|
||||
public SuperBoxEvent(int userId, int giftId) {
|
||||
this.userId = userId;
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.RemoveHeroEvent;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SSpecialConfig;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -89,6 +83,12 @@ public class HeroManager extends MongoBase {
|
|||
*/
|
||||
private Map<Integer,Integer> randomCountByType = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 心愿专用
|
||||
* key: 招募类型 value:< key: 星级 value: 数量 >
|
||||
*/
|
||||
private Map<Integer, Map<Integer,Integer>> wishCountByStar = new HashMap<>();
|
||||
|
||||
public Map<Integer, Integer> getRandomCountByType() {
|
||||
return randomCountByType;
|
||||
}
|
||||
|
@ -98,12 +98,30 @@ public class HeroManager extends MongoBase {
|
|||
updateString("randomCountByType", randomCountByType);
|
||||
}
|
||||
|
||||
public void putRandomCount(int type,int value) {
|
||||
public void putRandomType(int type,int value) {
|
||||
randomCountByType.put(type,value);
|
||||
updateString("randomCountByType."+type, value);
|
||||
}
|
||||
|
||||
public void updateRandCount(int type,int count){
|
||||
public Map<Integer, Map<Integer, Integer>> getWishCountByStar() {
|
||||
return wishCountByStar;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getWishStar(int type) {
|
||||
return wishCountByStar.getOrDefault(type,new HashMap<>());
|
||||
}
|
||||
|
||||
public void setWishCountByStar(Map<Integer, Map<Integer, Integer>> wishCountByStar) {
|
||||
this.wishCountByStar = wishCountByStar;
|
||||
updateString("wishCountByStar", wishCountByStar);
|
||||
}
|
||||
|
||||
public void putWishStar(int type,Map<Integer,Integer> starMap) {
|
||||
wishCountByStar.put(type,starMap);
|
||||
updateString("wishCountByStar."+type, starMap);
|
||||
}
|
||||
|
||||
public void updateRandCount(int type, int count){
|
||||
updateString("totalCount." + type, count);
|
||||
totalCount.put(type,count);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import manager.STableManager;
|
|||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -101,7 +102,9 @@ public class UserMissionManager extends MongoBase {
|
|||
break;
|
||||
}
|
||||
case DAILY_REFRESH:
|
||||
Set<Integer> missionIds = SDailyTasksConfig.config.keySet();
|
||||
int day = new Date(TimeUtils.now()).getDate();//当月第几天
|
||||
Set<Integer> missionIds = SDailyTasksConfig.config.values().stream().filter(n->day >=n.
|
||||
getViewDateUp()&& day <=n.getViewDataDown()).map(n ->n.getId()).collect(Collectors.toSet());
|
||||
int type = (int) parm[0];
|
||||
if (type == 0) {
|
||||
dailyMissionIdsType.getDoingMissionIds().clear();
|
||||
|
@ -228,7 +231,9 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("cowFlySkyMissionType", cowFlySkyMissionType);
|
||||
break;
|
||||
case ENDLESS_MISSION_REFRESH:
|
||||
Set<Integer> endlessTask = STableManager.getConfig(SEndlessTask.class).keySet();
|
||||
int days = new Date(TimeUtils.now()).getDate();//当月第几天
|
||||
Set<Integer> endlessTask = STableManager.getConfig(SEndlessTask.class).values().stream().filter(n->days >=n.
|
||||
getViewDateUp()&& days <=n.getViewDataDown()).map(n ->n.getId()).collect(Collectors.toSet());
|
||||
endlessMissionType.getDoingMissionIds().clear();
|
||||
endlessMissionType.getFinishMissionIds().clear();
|
||||
endlessMissionType.getRewardedMissionIds().clear();
|
||||
|
|
|
@ -457,7 +457,7 @@ public class HardStageLogic {
|
|||
if(n.getType()== 1){
|
||||
n.setState(7);
|
||||
chapter.addStars(3);
|
||||
Poster.getPoster().dispatchEvent(new HardStageExerciseEvent(user.getId(),3));
|
||||
//Poster.getPoster().dispatchEvent(new HardStageExerciseEvent(user.getId(),3));
|
||||
user.getHardStageManager().updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
//user.getHardStageManager().updateString("chapterMap",user.getHardStageManager().getChapterMap());
|
||||
|
||||
|
|
|
@ -383,25 +383,31 @@ public class HeroLogic{
|
|||
*/
|
||||
private int[] drawCard(User user, SLotteryRewardConfig sLotteryRewardConfig, SLotterySetting sLotterySetting){
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 限制次数
|
||||
// 参数
|
||||
int type = sLotterySetting.getLotteryType();
|
||||
int[] reward = sLotteryRewardConfig.getReward();
|
||||
// 限制满足次数
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.UNLOCKCARDWISH);
|
||||
// 对应卡池抽奖次数
|
||||
Integer num = heroManager.getRandomCountByType().getOrDefault(sLotterySetting.getLotteryType(),0);
|
||||
Integer num = heroManager.getRandomCountByType().getOrDefault(type,0);
|
||||
// 心愿抽卡
|
||||
int[] result;
|
||||
if (sLotterySetting.getLotteryType() == 1 && num >= value){
|
||||
result = wishDrawCardCheck(user,sLotteryRewardConfig.getReward());
|
||||
}else if(sLotterySetting.getLotteryType() == 3&&
|
||||
isActivityBeautyBag(sLotterySetting.getActivityId())){//乾坤宝盒-许愿魂印
|
||||
result = BeautyBagDrawCard(user,sLotteryRewardConfig);
|
||||
if (type == 1 && num >= value){
|
||||
// 钻石抽卡并且次数满足
|
||||
result = wishDrawCardCheck(user,reward,type);
|
||||
} else if(sLotterySetting.getLotteryType() == 3&&
|
||||
isActivityBeautyBag(sLotterySetting.getActivityId())) {//乾坤宝盒-许愿魂印
|
||||
result = BeautyBagDrawCard(user, sLotteryRewardConfig);
|
||||
}else {
|
||||
result = sLotteryRewardConfig.getReward();
|
||||
result = reward;
|
||||
}
|
||||
//记录次数
|
||||
heroManager.putRandomCount(sLotterySetting.getLotteryType(),num+1);
|
||||
//记录卡池抽奖次数
|
||||
heroManager.putRandomType(type,num+result[1]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private int[] BeautyBagDrawCard(User user, SLotteryRewardConfig sLotteryRewardConfig) {
|
||||
int count = SSpecialConfig.getIntegerValue(SSpecialConfig.NUMOFCHOOSEREDSIGN);
|
||||
List<SLotteryRewardConfig> list = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(sLotteryRewardConfig.getPool());
|
||||
|
@ -440,7 +446,7 @@ public class HeroLogic{
|
|||
* @param item
|
||||
* @return
|
||||
*/
|
||||
private int[] wishDrawCardCheck(User user,int[] item){
|
||||
private int[] wishDrawCardCheck(User user,int[] item,int type){
|
||||
// 查找物品
|
||||
SItem sItem = SItem.getsItemMap().get(item[0]);
|
||||
// 非英雄奖励直接返回
|
||||
|
@ -449,45 +455,52 @@ public class HeroLogic{
|
|||
}
|
||||
// 非五星英雄
|
||||
SCHero scHero = SCHero.getsCHero().get(item[0]);
|
||||
if (scHero.getStar() < 5){
|
||||
if (scHero == null || scHero.getStar() < 5){
|
||||
return item;
|
||||
}
|
||||
|
||||
// 更新抽奖次数, 记录卡池
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 获取类型抽奖次数
|
||||
Map<Integer, Integer> randomStar = heroManager.getWishStar(type);
|
||||
// 更新次数
|
||||
int num = heroManager.getWishStar(type).getOrDefault(scHero.getStar(), 0)+1;
|
||||
randomStar.put(scHero.getStar(),num);
|
||||
heroManager.putWishStar(type,randomStar);
|
||||
/* ======================= 中不中心愿 ======================= */
|
||||
// 随机权重
|
||||
int totalNum = 10000;
|
||||
int anInt = MathUtils.randomInt(totalNum);
|
||||
// 单个格子权重
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.CARDWISHBLOCKRATE);
|
||||
// 获取玩家现在的心愿格子信息
|
||||
Map<Integer, WishDrawCardInfo> cardInfoMap = user.getHeroManager().getWishDrawCardInfoMap();
|
||||
// 中将权重值
|
||||
int weight = cardInfoMap.size() * value;
|
||||
// 未中奖
|
||||
if (anInt > weight){
|
||||
// 获取钻石抽奖抽中五星的次数
|
||||
boolean randomBol = (num - 1) % 3 == 0;
|
||||
LOGGER.error("*************************************是否中心愿;num:{},random:{}",num, randomBol);
|
||||
if (!randomBol){
|
||||
// 不到次数,不走心愿
|
||||
return item;
|
||||
}
|
||||
|
||||
/*======================== 中心愿随机奖励 ========================*/
|
||||
|
||||
// 心愿格子信息
|
||||
HashMap<Integer, WishDrawCardInfo> cardInfoMap = user.getHeroManager().getWishDrawCardInfoMap();
|
||||
// 空格子权重
|
||||
int empty = SSpecialConfig.getIntegerValue(SSpecialConfig.CARDWISHBLOCKRATE);
|
||||
// 计算权重map
|
||||
HashMap<Integer, Integer> map = new HashMap<>();
|
||||
for (Integer key : cardInfoMap.keySet()) {
|
||||
if (cardInfoMap.get(key).getStatus() == 1){
|
||||
// 已经抽中得格子去除
|
||||
weight-=value;
|
||||
continue;
|
||||
cardInfoMap.forEach((k,v)->{
|
||||
if (v.getStatus() == 0){
|
||||
if (v.getHeroTid() == 0){
|
||||
// 空格子
|
||||
map.put(k,empty);
|
||||
}else {
|
||||
// 英雄格子
|
||||
int heroWeight = Optional.ofNullable(SCHero.getsCHero().get(v.getHeroTid())).map(SCHero::getWeight).orElse(0);
|
||||
map.put(k,heroWeight);
|
||||
}
|
||||
}
|
||||
map.put(key,value);
|
||||
}
|
||||
|
||||
});
|
||||
// 全部抽中
|
||||
if (map.isEmpty() || weight == 0){
|
||||
if (map.isEmpty()){
|
||||
return item;
|
||||
}
|
||||
|
||||
// 随机权重
|
||||
int weight = map.values().stream().mapToInt(Integer::intValue).sum();
|
||||
int randomInt = MathUtils.randomInt(weight);
|
||||
|
||||
LOGGER.error("*************************************心愿抽奖权重,总权重:{},随机值:{},map:{}",weight,randomInt,map.toString());
|
||||
// 遍历权重
|
||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||
if (randomInt <= entry.getValue()){
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.ljsd.jieling.logic.store;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -44,7 +42,6 @@ import rpc.protocols.CommonProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -84,7 +81,6 @@ public class BuyGoodsNewLogic {
|
|||
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
||||
}
|
||||
dailyRefresh(user);
|
||||
sendDailyMailReward(user);
|
||||
boolean needChange = false;
|
||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
||||
|
@ -179,10 +175,8 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
User user = UserManager.getUser(uid);
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
AbstractWelfareBag bag = null;
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||
bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||
String rewardStr="";
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||
if(bag == null || !bag.buy()){
|
||||
LOGGER.error("购买失败!bag是否为空:{}",bag == null);
|
||||
return resultRes;
|
||||
|
@ -218,9 +212,6 @@ public class BuyGoodsNewLogic {
|
|||
//活动
|
||||
user.getPlayerInfoManager().setRechargedaily(user.getPlayerInfoManager().getRechargedaily()+price);
|
||||
changeActivity(user,price,info);
|
||||
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),config.getId()));
|
||||
}
|
||||
if(!info.getIsFirst()){
|
||||
info.setIsFirst(true);
|
||||
|
@ -240,6 +231,9 @@ public class BuyGoodsNewLogic {
|
|||
notifyPaySuccessFul(uid,goodsId,amount != -999);
|
||||
sendGiftGoodsWithoutJudge(uid);
|
||||
openPush(session,user, PushRechargeType.point_recharge.getType(),goodsId,1);
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),config.getId()));
|
||||
// 更新入库
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
// 扶持订单不需要上报
|
||||
if(price>0 && !orderId.equals("support-order")){
|
||||
|
@ -791,70 +785,6 @@ public class BuyGoodsNewLogic {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每日礼包奖励发送
|
||||
*/
|
||||
public static void sendDailyMailReward(User user) throws Exception{
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<Integer> found1 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_ONE);
|
||||
List<Integer> found2 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_TWO);
|
||||
for(AbstractWelfareBag bag : info.getReceiveMap().values()){
|
||||
for(int id :found1){
|
||||
if(bag.getModId() == id && canReward((ReceiveWelfareBag) bag)){
|
||||
sendReward(user.getId(),id,(ReceiveWelfareBag) bag,GiftGoodsType.FOUND_ONE);
|
||||
}
|
||||
}
|
||||
for(int id :found2){
|
||||
if(bag.getModId() == id && canReward((ReceiveWelfareBag)bag)){
|
||||
sendReward(user.getId(),id,(ReceiveWelfareBag) bag,GiftGoodsType.FOUND_TWO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendReward(int uid,int id,ReceiveWelfareBag bag,int type) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
int getDays = 0;
|
||||
if(bag.getGetRewardTime() != 0){
|
||||
getDays = TimeUtils.differentDays(bag.getLastBuyTime() - TimeUtils.DAY,bag.getGetRewardTime());
|
||||
}else{
|
||||
bag.setGetRewardTime(TimeUtils.getTodayZero() - TimeUtils.DAY);
|
||||
}
|
||||
int canget = TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis());
|
||||
getRewards(uid,id,getDays,canget,bag.getContinueDays());
|
||||
bag.setGetRewardTime(TimeUtils.getTodayZero());
|
||||
}
|
||||
|
||||
public static boolean canReward(ReceiveWelfareBag bag){
|
||||
if(!bag.isOpen()){
|
||||
return false;
|
||||
}
|
||||
if(!bag.isBought()){
|
||||
return false;
|
||||
}
|
||||
if(TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis())<1){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void getRewards(int uid,int type,int startDay,int cDay,int continueDays) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
for(int i = 1;i<=cDay;i++){
|
||||
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
|
||||
if(fund == null){
|
||||
break;
|
||||
}
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
|
||||
String reward = ItemUtil.getMailReward(fund.getreward());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title");
|
||||
String content;
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_"+config.getType()+"_daily_txt",
|
||||
new Object[]{continueDays-startDay-cDay},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(uid,title,content,reward,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
private static void dailyRefresh(User user){
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
if(TimeUtils.differentDays(info.getLastRefreshTime(),System.currentTimeMillis())<1){
|
||||
|
|
|
@ -60,6 +60,8 @@ public class SCHero implements BaseConfig{
|
|||
|
||||
private int maxLevel;
|
||||
|
||||
private int weight;
|
||||
|
||||
private Map<Integer,Integer> secondaryFactorMap;
|
||||
|
||||
private Map<Integer, List<Integer>> skillListByStar;
|
||||
|
@ -348,4 +350,8 @@ public class SCHero implements BaseConfig{
|
|||
public int getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ public class SDailyTasksConfig implements BaseConfig {
|
|||
|
||||
private int[][] mazePoint;//戒灵秘宝积分
|
||||
|
||||
private int viewDateUp;
|
||||
|
||||
private int viewDataDown;
|
||||
|
||||
public static Map<Integer, SDailyTasksConfig> config;
|
||||
public static Map<Integer, List<SDailyTasksConfig>> sTaskConfigByTypeMap;
|
||||
|
||||
|
@ -69,4 +73,12 @@ public class SDailyTasksConfig implements BaseConfig {
|
|||
return mazePoint;
|
||||
}
|
||||
|
||||
|
||||
public int getViewDateUp() {
|
||||
return viewDateUp;
|
||||
}
|
||||
|
||||
public int getViewDataDown() {
|
||||
return viewDataDown;
|
||||
}
|
||||
}
|
|
@ -18,6 +18,9 @@ public class SEndlessTask implements BaseConfig {
|
|||
|
||||
private int[][] mazePoint;
|
||||
|
||||
private int viewDateUp;
|
||||
private int viewDataDown;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -45,5 +48,11 @@ public class SEndlessTask implements BaseConfig {
|
|||
return mazePoint;
|
||||
}
|
||||
|
||||
public int getViewDateUp() {
|
||||
return viewDateUp;
|
||||
}
|
||||
|
||||
public int getViewDataDown() {
|
||||
return viewDataDown;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
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 ="LingLongPool")
|
||||
public class SLingLongPool implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int[] itemId;
|
||||
|
||||
private int getRate;
|
||||
|
||||
private int position;
|
||||
|
||||
/**
|
||||
* key: 内圈外圈id value: 对象list
|
||||
*/
|
||||
public static Map<Integer, List<SLingLongPool>> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SLingLongPool> config = STableManager.getConfig(SLingLongPool.class);
|
||||
config.values().forEach(v->{
|
||||
List<SLingLongPool> longPools = map.getOrDefault(v.getPosition(), new ArrayList<>());
|
||||
longPools.add(v);
|
||||
map.put(v.getPosition(),longPools);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int[] getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public int getGetRate() {
|
||||
return getRate;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -17,25 +17,21 @@ public class SLuxuryFund implements BaseConfig {
|
|||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer,SLuxuryFund> sLuxuryFundByFoundAndDay;
|
||||
|
||||
|
||||
/**
|
||||
* key: type value: < key: day value: SLuxuryFund对象 >
|
||||
*/
|
||||
public static Map<Integer,Map<Integer,SLuxuryFund>> typeMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SLuxuryFund> config = STableManager.getConfig(SLuxuryFund.class);
|
||||
Map<Integer,SLuxuryFund> sLuxuryFundByFoundAndDayTmp = new HashMap<>();
|
||||
config.values().forEach(sLuxuryFund->{
|
||||
sLuxuryFundByFoundAndDayTmp.put(sLuxuryFund.getType()*100 + sLuxuryFund.getDay(),sLuxuryFund);
|
||||
config.values().forEach(v->{
|
||||
Map<Integer, SLuxuryFund> fundMap = typeMap.getOrDefault(v.getType(), new HashMap<>());
|
||||
fundMap.put(v.getDay(),v);
|
||||
typeMap.put(v.getType(),fundMap);
|
||||
});
|
||||
sLuxuryFundByFoundAndDay = sLuxuryFundByFoundAndDayTmp;
|
||||
}
|
||||
|
||||
public static SLuxuryFund getByFoundIdAndDay(int foundId,int day){
|
||||
return sLuxuryFundByFoundAndDay.get(foundId*100+day);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -48,9 +44,8 @@ public class SLuxuryFund implements BaseConfig {
|
|||
return day;
|
||||
}
|
||||
|
||||
public int[][] getreward() {
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -108,6 +108,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String EndlessRespawnItemAndTime ="EndlessRespawnItemAndTime";//每次重置无尽副本提供的九元露数量
|
||||
public static final String NUMOFCHOOSEREDSIGN ="NumOfChooseRedSign";//乾坤宝盒选择心愿红色魂印数量
|
||||
|
||||
public static final String LING_LONG_COST = "LingLongCost";//玲珑宝镜消耗道具ID
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue