commit
8a1b28f04e
|
|
@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,6 +91,7 @@ public class Utils {
|
||||||
String randStr = String.valueOf(stringBuffer);
|
String randStr = String.valueOf(stringBuffer);
|
||||||
return randStr;
|
return randStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对象拷贝 只要实现了Serializable接口都可以
|
* 对象拷贝 只要实现了Serializable接口都可以
|
||||||
* @param obj
|
* @param obj
|
||||||
|
|
@ -116,4 +118,13 @@ public class Utils {
|
||||||
}
|
}
|
||||||
return cloneObj;
|
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 CHOICE_DRAW_CARD = 1102;//心愿抽奖
|
||||||
|
|
||||||
|
int QIMENDUNJIA_DRAW = 1103;//奇门遁甲
|
||||||
|
int QIMENDUNJIA_DRAW_CONSUME = 1104;//奇门遁甲消耗
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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 luckWheel; // 幸运探宝奖池
|
||||||
private com.ljsd.jieling.jbean.LuckWheelMission luckWheelAdvance; // 高级幸运探宝奖池
|
private com.ljsd.jieling.jbean.LuckWheelMission luckWheelAdvance; // 高级幸运探宝奖池
|
||||||
private com.ljsd.jieling.jbean.SubRewardPoolInfo subRewardPoolInfo; // 挖矿奖池
|
private com.ljsd.jieling.jbean.SubRewardPoolInfo subRewardPoolInfo; // 挖矿奖池
|
||||||
|
private Map<Integer,List<Integer>> doubleRewardPoolInfo = new HashMap<>(); // 奇门遁甲奖池
|
||||||
|
|
||||||
public ActivityManager() {
|
public ActivityManager() {
|
||||||
}
|
}
|
||||||
|
|
@ -30,6 +31,7 @@ public final class ActivityManager extends MongoBase {
|
||||||
this.luckWheel = new LuckWheelMission(_o_.luckWheel);
|
this.luckWheel = new LuckWheelMission(_o_.luckWheel);
|
||||||
this.luckWheelAdvance = new LuckWheelMission(_o_.luckWheelAdvance);
|
this.luckWheelAdvance = new LuckWheelMission(_o_.luckWheelAdvance);
|
||||||
this.subRewardPoolInfo = new SubRewardPoolInfo(_o_.subRewardPoolInfo);
|
this.subRewardPoolInfo = new SubRewardPoolInfo(_o_.subRewardPoolInfo);
|
||||||
|
this.doubleRewardPoolInfo = new HashMap<>(_o_.doubleRewardPoolInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, com.ljsd.jieling.jbean.ActivityMission> getActivityMissionMap() {
|
public Map<Integer, com.ljsd.jieling.jbean.ActivityMission> getActivityMissionMap() {
|
||||||
|
|
@ -77,6 +79,14 @@ public final class ActivityManager extends MongoBase {
|
||||||
this.subRewardPoolInfo = subrewardpoolinfo;
|
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
|
@Override
|
||||||
public String toString() {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,7 +23,9 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
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.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.tools.Utils;
|
||||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
|
@ -1675,4 +1677,106 @@ public class ActivityLogic implements IEventHandler{
|
||||||
// 返回奖励信息
|
// 返回奖励信息
|
||||||
return ItemUtil.dropPer(user, reward, BIReason.CHOICE_DRAW_CARD);
|
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,6 +95,7 @@ public interface ActivityType {
|
||||||
int DEMON_TREASURE = 36;//降妖夺宝
|
int DEMON_TREASURE = 36;//降妖夺宝
|
||||||
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
||||||
|
|
||||||
|
int QI_MEN_DUN_JIA = 67;//奇门遁甲
|
||||||
int SUPER_BOX = 69;//惊喜礼盒
|
int SUPER_BOX = 69;//惊喜礼盒
|
||||||
int MISTY_TRIP = 72;//缥缈之旅
|
int MISTY_TRIP = 72;//缥缈之旅
|
||||||
int SUPER_DISCOUNT_SKIN = 73;//特惠神装
|
int SUPER_DISCOUNT_SKIN = 73;//特惠神装
|
||||||
|
|
@ -102,5 +103,4 @@ public interface ActivityType {
|
||||||
|
|
||||||
int SUPERFUND128 = 78;//超值基金128
|
int SUPERFUND128 = 78;//超值基金128
|
||||||
int SUPERFUND328 = 79;//超值基金328
|
int SUPERFUND328 = 79;//超值基金328
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public enum ActivityTypeEnum {
|
||||||
EQUIP_UPLEVEL(ActivityType.EQUIP_UPLEVEL,EquipUpLevelActivity::new),
|
EQUIP_UPLEVEL(ActivityType.EQUIP_UPLEVEL,EquipUpLevelActivity::new),
|
||||||
TA_SUI_LING_XIAO(ActivityType.TA_SUI_LING_XIAO,TaSuiLingXiaoActivity::new),
|
TA_SUI_LING_XIAO(ActivityType.TA_SUI_LING_XIAO,TaSuiLingXiaoActivity::new),
|
||||||
CHOICE_DRAW_CRAD(ActivityType.CHOICE_DRAW_CRAD,ChoiceDrawCardActivity::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),
|
HARD_STAGE_EXERCISE(ActivityType.HARD_STAGE_EXERCISE,HardStageExerciseActivity::new),
|
||||||
SUPER_BOX(ActivityType.SUPER_BOX,SuperBoxActivity::new),
|
SUPER_BOX(ActivityType.SUPER_BOX,SuperBoxActivity::new),
|
||||||
HERO_STAR(ActivityType.HERO_STAR,HeroStarActivity::new),
|
HERO_STAR(ActivityType.HERO_STAR,HeroStarActivity::new),
|
||||||
|
|
|
||||||
|
|
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -107,6 +107,7 @@ public class SSpecialConfig implements BaseConfig {
|
||||||
public static final String UNLOCKCARDWISH = "UnlockCardWish";//解锁钻石心愿抽卡所需要的抽卡次数
|
public static final String UNLOCKCARDWISH = "UnlockCardWish";//解锁钻石心愿抽卡所需要的抽卡次数
|
||||||
public static final String EndlessRespawnItemAndTime ="EndlessRespawnItemAndTime";//每次重置无尽副本提供的九元露数量
|
public static final String EndlessRespawnItemAndTime ="EndlessRespawnItemAndTime";//每次重置无尽副本提供的九元露数量
|
||||||
|
|
||||||
|
public static final String LING_LONG_COST = "LingLongCost";//玲珑宝镜消耗道具ID
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue