许愿魂印
parent
07fe5c89ed
commit
c87f0e1864
|
@ -58,6 +58,8 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
|||
user.getHeroManager().updateRandomPoolByType(n,clearMap);
|
||||
}
|
||||
});
|
||||
|
||||
user.getHeroManager().setBeautyBagCardInfoMap(new HashMap<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,6 +77,12 @@ public class HeroManager extends MongoBase {
|
|||
*/
|
||||
private HashMap<Integer,WishDrawCardInfo> wishDrawCardInfoMap = new HashMap<>(3);
|
||||
|
||||
|
||||
/**
|
||||
* 乾坤宝盒-许愿魂印
|
||||
*/
|
||||
private HashMap<Integer,Integer> beautyBagCardInfoMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 抽奖次数记录
|
||||
* key: 招募类型 value: 次数
|
||||
|
@ -402,5 +408,18 @@ public class HeroManager extends MongoBase {
|
|||
wishDrawCardInfoMap.put(key,wishDrawCardInfo);
|
||||
updateString("wishDrawCardInfoMap." + key, wishDrawCardInfo);
|
||||
}
|
||||
|
||||
public HashMap<Integer, Integer> getBeautyBagCardInfoMap() {
|
||||
return beautyBagCardInfoMap;
|
||||
}
|
||||
|
||||
public void setBeautyBagCardInfoMap(HashMap<Integer, Integer> beautyBagCardInfoMap) {
|
||||
this.beautyBagCardInfoMap = beautyBagCardInfoMap;
|
||||
updateString("beautyBagCardInfoMap", beautyBagCardInfoMap);
|
||||
}
|
||||
public void putBeautyBagCardInfoMap(Integer key,Integer val) {
|
||||
this.beautyBagCardInfoMap.put(key,val);
|
||||
updateString("beautyBagCardInfoMap", beautyBagCardInfoMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -391,6 +391,9 @@ public class HeroLogic{
|
|||
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);
|
||||
}else {
|
||||
result = sLotteryRewardConfig.getReward();
|
||||
}
|
||||
|
@ -399,6 +402,38 @@ public class HeroLogic{
|
|||
return result;
|
||||
}
|
||||
|
||||
private int[] BeautyBagDrawCard(User user, SLotteryRewardConfig sLotteryRewardConfig) {
|
||||
int count = SSpecialConfig.getIntegerValue(SSpecialConfig.NUMOFCHOOSEREDSIGN);
|
||||
List<SLotteryRewardConfig> list = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(sLotteryRewardConfig.getPool());
|
||||
if(list==null){
|
||||
return sLotteryRewardConfig.getReward();
|
||||
}
|
||||
|
||||
int index = list.indexOf(sLotteryRewardConfig);
|
||||
if(index>=count){
|
||||
return sLotteryRewardConfig.getReward();
|
||||
}
|
||||
|
||||
if(user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index+1)==false){
|
||||
return sLotteryRewardConfig.getReward();
|
||||
}
|
||||
|
||||
int[] result = new int[2];
|
||||
result[0] = user.getHeroManager().getBeautyBagCardInfoMap().get(index+1);
|
||||
result[1] = sLotteryRewardConfig.getReward()[1];
|
||||
LOGGER.info("抽到了UP---->"+sLotteryRewardConfig.getReward()[0]+"替换为---->"+result[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isActivityBeautyBag(int activityId){
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(activity==null){
|
||||
return false;
|
||||
}
|
||||
|
||||
return activity.getType() == ActivityType.BEAUTY_BAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿抽卡校验
|
||||
* @param user
|
||||
|
@ -658,7 +693,39 @@ public class HeroLogic{
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 修改魂印格子
|
||||
* @param user
|
||||
* @param list
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
public void updateBeautyBagCardInfo(User user, List<CommonProto.beautyBagCardInfo> list) throws ErrorCodeException {
|
||||
HashMap<Integer,Integer> map = new HashMap<>();
|
||||
int count = SSpecialConfig.getIntegerValue(SSpecialConfig.NUMOFCHOOSEREDSIGN);
|
||||
for(CommonProto.beautyBagCardInfo info:list){
|
||||
if(map.containsValue(info.getEquip())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
if(map.containsKey(info.getId())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
SEquipConfig config = STableManager.getConfig(SEquipConfig.class).get(info.getEquip());
|
||||
if(config==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
if(config.getQuality()!=6){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
|
||||
if(info.getId()<1||info.getId()>count){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
map.put(info.getId(),info.getEquip());
|
||||
}
|
||||
|
||||
user.getHeroManager().setBeautyBagCardInfoMap(map);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 每次抽取
|
||||
|
|
|
@ -897,4 +897,21 @@ public class CBean2Proto {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取魂印信息
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.beautyBagCardInfo> getBeautyBagCardInfo(User user){
|
||||
List<CommonProto.beautyBagCardInfo> list = new ArrayList<>();
|
||||
user.getHeroManager().getBeautyBagCardInfoMap().entrySet().forEach(v->{
|
||||
CommonProto.beautyBagCardInfo builder = CommonProto.beautyBagCardInfo.newBuilder()
|
||||
.setId(v.getKey())
|
||||
.setEquip(v.getValue())
|
||||
.build();
|
||||
list.add(builder);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String CARDWISHBLOCKRATE = "CardWishBlockRate";//钻石抽卡心愿单格子命中万分比
|
||||
public static final String UNLOCKCARDWISH = "UnlockCardWish";//解锁钻石心愿抽卡所需要的抽卡次数
|
||||
public static final String EndlessRespawnItemAndTime ="EndlessRespawnItemAndTime";//每次重置无尽副本提供的九元露数量
|
||||
public static final String NUMOFCHOOSEREDSIGN ="NumOfChooseRedSign";//乾坤宝盒选择心愿红色魂印数量
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue