心愿抽卡完善

back_recharge
duhui 2021-06-30 11:40:37 +08:00
parent a18cdcf1e5
commit 3f1ff48f3a
3 changed files with 18 additions and 1 deletions

View File

@ -218,6 +218,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllSealList(CBean2Proto.getPurpleMansionSealInfo(user)) .addAllSealList(CBean2Proto.getPurpleMansionSealInfo(user))
.setDailyredpack(playerInfoManager.getDailyWelfareRedPacket()) .setDailyredpack(playerInfoManager.getDailyWelfareRedPacket())
.setRandomCount(randomCount) .setRandomCount(randomCount)
.addAllDrawTimes(CBean2Proto.getRandomTypeNums(user))
.build(); .build();
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType()); ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
try { try {

View File

@ -338,7 +338,7 @@ public class HeroLogic{
resultRandom[i] = sLotteryRewardConfig.getReward(); resultRandom[i] = sLotteryRewardConfig.getReward();
} }
//记录次数 //记录次数
heroManager.putRandomCount(sLotterySetting.getLotteryType(),num++); heroManager.putRandomCount(sLotterySetting.getLotteryType(),num+1);
index = i; index = i;
} }
//上报抽卡 //上报抽卡
@ -369,6 +369,7 @@ public class HeroLogic{
fiveStarPushByRandom(user,resultRandom); fiveStarPushByRandom(user,resultRandom);
fiveStarPokemonPushByRandom(user,resultRandom); fiveStarPokemonPushByRandom(user,resultRandom);
builder.setDrop(drop); builder.setDrop(drop);
builder.addAllDrawTimes(CBean2Proto.getRandomTypeNums(user));
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true); MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
// System.out.println(System.currentTimeMillis()-time); // System.out.println(System.currentTimeMillis()-time);
} }

View File

@ -880,4 +880,19 @@ public class CBean2Proto {
}); });
return list; return list;
} }
/**
*
* @param user
* @return
*/
public static List<CommonProto.randomTypeNum> getRandomTypeNums(User user){
List<CommonProto.randomTypeNum> list = new ArrayList<>();
Map<Integer, Integer> countByType = user.getHeroManager().getRandomCountByType();
for (Map.Entry<Integer, Integer> entry : countByType.entrySet()) {
CommonProto.randomTypeNum.Builder builder = CommonProto.randomTypeNum.newBuilder().setType(entry.getKey()).setNum(entry.getValue());
list.add(builder.build());
}
return list;
}
} }