抽卡显示

master_huanxiang
PC-202302260912\Administrator 2023-07-19 15:26:04 +08:00
parent 66f04a7b46
commit c49ae44705
3 changed files with 32 additions and 32 deletions

View File

@ -131,11 +131,6 @@ public class GetPlayerInfoHandler extends BaseHandler{
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()) .setState(user.getPlayerInfoManager().getPhoneBindInfo().getState())
.build(); .build();
HeroManager heroManager = user.getHeroManager(); HeroManager heroManager = user.getHeroManager();
int alreadyCount =0;
for(Integer id : STableManager.getFigureConfig(HeroStaticConfig.class).getRandomHeroIds()){
int count = Optional.ofNullable(heroManager.getTotalCount().get(id)).orElse(0);
alreadyCount+=count;
}
// 返利 // 返利
GmActivityLogic.zeroUpdateGmActivity(user); GmActivityLogic.zeroUpdateGmActivity(user);
SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1); SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1);
@ -170,7 +165,15 @@ public class GetPlayerInfoHandler extends BaseHandler{
Set<Integer> equipHandBookSet = user.getEquipManager().getEquipHandBook().keySet(); Set<Integer> equipHandBookSet = user.getEquipManager().getEquipHandBook().keySet();
int equipPool = user.getEquipManager().getSoulEquipPool(); int equipPool = user.getEquipManager().getSoulEquipPool();
int vipPrivilageValue = user.getPlayerInfoManager().getVipPrivilageValue(SMazeTreasureSetting.sMazeTreasureSetting.getRefreshVIP()); int vipPrivilageValue = user.getPlayerInfoManager().getVipPrivilageValue(SMazeTreasureSetting.sMazeTreasureSetting.getRefreshVIP());
int randomCount = SLotterySpecialConfig.getLotteryListByDifferentType(7).iterator().next().getCount()- user.getHeroManager().getRandomPoolByType().getOrDefault(11,new HashMap<>()).getOrDefault(7,0); // 英雄抽卡剩余必中
int randomCount = SLotterySpecialConfig.getLotteryListByDifferentType(7)
.iterator().next().getCount() -
user.getHeroManager().getRandomPoolByType().getOrDefault(11,new HashMap<>()).getOrDefault(7,0);
// 法宝抽卡剩余必中
int fabaoRandomCount = SLotterySpecialConfig.getLotteryListByDifferentType(151)
.iterator().next().getCount() -
user.getHeroManager().getRandomPoolByType().getOrDefault(23,new HashMap<>()).getOrDefault(151,0);
List<CommonProto.SixiangxinfaInfo> sixiangxinfaInfos = getSixiangxinfaInfos(heroManager); List<CommonProto.SixiangxinfaInfo> sixiangxinfaInfos = getSixiangxinfaInfos(heroManager);
List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager); List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager);
List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager); List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager);
@ -186,7 +189,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllVipLeveTake(playerInfoManager.getHadTakeLevelBoxVip()) .addAllVipLeveTake(playerInfoManager.getHadTakeLevelBoxVip())
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000)) .setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
.addAllRedType(playerInfoManager.getReds()) .addAllRedType(playerInfoManager.getReds())
.setRandCount(alreadyCount) .setRandCount(fabaoRandomCount)
.addAllHeroHandBook(heroHandBookList).addAllEquipHandBook(equipHandBookSet) .addAllHeroHandBook(heroHandBookList).addAllEquipHandBook(equipHandBookSet)
.addAllGoodsTypeDuration(goodsTypeDurations) .addAllGoodsTypeDuration(goodsTypeDurations)
.setHadBuyTreasure(playerInfoManager.getHadBuyTreasure()) .setHadBuyTreasure(playerInfoManager.getHadBuyTreasure())

View File

@ -23,8 +23,11 @@ public class HeroManager extends MongoBase {
*/ */
private Map<String, Hero> heroMap= new HashMap<>(); private Map<String, Hero> heroMap= new HashMap<>();
private Map<Integer, Integer> totalCount= new HashMap<>(); /**
* keyMergePool
* keyDifferentType
* value
*/
private Map<Integer, Map<Integer, Integer>> randomPoolByType = new HashMap<>(); private Map<Integer, Map<Integer, Integer>> randomPoolByType = new HashMap<>();
private Map<Integer,Integer> mustRandomCount= new HashMap<>(); private Map<Integer,Integer> mustRandomCount= new HashMap<>();
@ -313,12 +316,6 @@ public class HeroManager extends MongoBase {
updateString("likableSendTime", _sendTime); updateString("likableSendTime", _sendTime);
} }
public void updateRandCount(int type, int count){
updateString("totalCount." + type, count);
totalCount.put(type,count);
}
public void updateRandomPoolByType(int type,Map<Integer,Integer> map){ public void updateRandomPoolByType(int type,Map<Integer,Integer> map){
randomPoolByType.put(type,map); randomPoolByType.put(type,map);
updateString("randomPoolByType." + type, map); updateString("randomPoolByType." + type, map);
@ -386,10 +383,6 @@ public class HeroManager extends MongoBase {
return heroMap; return heroMap;
} }
public Map<Integer, Integer> getTotalCount() {
return totalCount;
}
public void addHeroHandBook(int heroId,int star){ public void addHeroHandBook(int heroId,int star){
if(heroHandBook.containsKey(heroId)&&heroHandBook.get(heroId)>=star){ if(heroHandBook.containsKey(heroId)&&heroHandBook.get(heroId)>=star){
return; return;
@ -597,11 +590,6 @@ public class HeroManager extends MongoBase {
// return purpleMansionSeal; 2022-4-20 策划需求关闭紫府神印功能 // return purpleMansionSeal; 2022-4-20 策划需求关闭紫府神印功能
} }
public void setPurpleMansionSeal(Map<Integer, PurpleMansionSeal> purpleMansionSeal) {
this.purpleMansionSeal = purpleMansionSeal;
updateString("purpleMansionSeal", purpleMansionSeal);
}
public void putPurpleMansionSeal(PurpleMansionSeal seal) { public void putPurpleMansionSeal(PurpleMansionSeal seal) {
purpleMansionSeal.put(seal.getSealId(),seal); purpleMansionSeal.put(seal.getSealId(),seal);
updateString("purpleMansionSeal", purpleMansionSeal); updateString("purpleMansionSeal", purpleMansionSeal);

View File

@ -255,6 +255,9 @@ public class HeroLogic {
throw new ErrorCodeException("已抽取今日最大次数"); throw new ErrorCodeException("已抽取今日最大次数");
} }
HeroManager heroManager = user.getHeroManager(); HeroManager heroManager = user.getHeroManager();
if (heroManager == null){
throw new ErrorCodeException("玩家信息异常");
}
if (type == 11 && heroManager.getFirstTenth() == 0) { if (type == 11 && heroManager.getFirstTenth() == 0) {
heroManager.updateFirstTenth(); heroManager.updateFirstTenth();
} }
@ -269,7 +272,7 @@ public class HeroLogic {
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN); throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
} }
} }
if (heroManager != null && heroManager.getHeroMap() != null) { if (heroManager.getHeroMap() != null) {
//只有抽英雄才校验 //只有抽英雄才校验
if (sLotterySetting.getGainType() == 1 && heroManager.getHeroMap().size() + perCount > STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getHeroNumlimit()) { if (sLotterySetting.getGainType() == 1 && heroManager.getHeroMap().size() + perCount > STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getHeroNumlimit()) {
throw new ErrorCodeException(ErrorCode.HERO_MAX); throw new ErrorCodeException(ErrorCode.HERO_MAX);
@ -347,16 +350,23 @@ public class HeroLogic {
} }
Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(), sLotterySetting.getActivityId(), heroManager.getRandomPoolByType().get(sLotterySetting.getMergePool()), sLotterySetting.getPerCount())); Poster.getPoster().dispatchEvent(new RandomCardEvent(user.getId(), sLotterySetting.getActivityId(), heroManager.getRandomPoolByType().get(sLotterySetting.getMergePool()), sLotterySetting.getPerCount()));
// //1群英招募
HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder(); HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder();
// 英雄卡池类型
if (sLotterySetting.getLotteryType() == 1) { if (sLotterySetting.getLotteryType() == 1) {
Poster.getPoster().dispatchEvent(new HeroRandomEvent(uid, perCount)); Poster.getPoster().dispatchEvent(new HeroRandomEvent(uid, perCount));
List<SLotterySpecialConfig> lotteryListByDifferentType = SLotterySpecialConfig.getLotteryListByDifferentType(7); int heroRandomCount = SLotterySpecialConfig.getLotteryListByDifferentType(7)
if (lotteryListByDifferentType.size() == 1) { .iterator().next().getCount() -
SLotterySpecialConfig next = lotteryListByDifferentType.iterator().next(); user.getHeroManager().getRandomPoolByType().getOrDefault(11,new HashMap<>()).getOrDefault(7,0);
builder.setMustCount(next.getCount() - heroManager.getRandomPoolByType().get(sLotterySetting.getMergePool()).getOrDefault(7, 0)); builder.setMustCount(heroRandomCount);
}
} }
// 法宝卡池类型
if (sLotterySetting.getLotteryType() == 4){
int fabaoRandomCount = SLotterySpecialConfig.getLotteryListByDifferentType(151)
.iterator().next().getCount() -
user.getHeroManager().getRandomPoolByType().getOrDefault(23,new HashMap<>()).getOrDefault(151,0);
builder.setFabaoMustCount(fabaoRandomCount);
}
user.getUserMissionManager().onGameEvent(user, GameEvent.RANDOM_HERO, sLotterySetting.getLotteryType(), perCount); user.getUserMissionManager().onGameEvent(user, GameEvent.RANDOM_HERO, sLotterySetting.getLotteryType(), perCount);
if (sLotterySetting.getLotteryType() == 11) { if (sLotterySetting.getLotteryType() == 11) {
//只记录新将招募次数 //只记录新将招募次数
@ -365,7 +375,6 @@ public class HeroLogic {
if (sLotterySetting.getActivityId() == 8201) { if (sLotterySetting.getActivityId() == 8201) {
Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(), 0)); Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(), 0));
} }
heroManager.updateRandCount(type, perCount);
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, resultRandom, BIReason.HERO_RANDOM); CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, resultRandom, BIReason.HERO_RANDOM);
fiveStarPushByRandom(user, resultRandom); fiveStarPushByRandom(user, resultRandom);
fiveStarPokemonPushByRandom(user, resultRandom); fiveStarPokemonPushByRandom(user, resultRandom);