抽卡送宝箱
parent
b4f77dd3c3
commit
63d3168ffa
|
@ -73,6 +73,9 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private int openBoxLimits; //单次使用道具上限
|
||||
|
||||
private int[] lotterySecurityReward;
|
||||
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
||||
|
@ -200,4 +203,9 @@ public class SGameSetting implements BaseConfig {
|
|||
public int getOpenBoxLimits() {
|
||||
return openBoxLimits;
|
||||
}
|
||||
|
||||
|
||||
public int[] getLotterySecurityReward() {
|
||||
return lotterySecurityReward;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Table(name ="LotterySetting")
|
||||
public class SLotterySetting implements BaseConfig {
|
||||
|
@ -35,6 +38,7 @@ public class SLotterySetting implements BaseConfig {
|
|||
private int lotteryType;
|
||||
|
||||
private static Map<Integer,SLotterySetting> sLotterySettingByType;
|
||||
public static Set<Integer> randomHeroIds;
|
||||
|
||||
public static Map<Integer, SLotterySetting> getsLotterySettingMap() {
|
||||
return sLotterySettingByType;
|
||||
|
@ -43,7 +47,15 @@ public class SLotterySetting implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sLotterySettingByType = STableManager.getConfig(SLotterySetting.class);
|
||||
Set<Integer> randomHeroIdTmp = new HashSet<>();
|
||||
Map<Integer, SLotterySetting> config = STableManager.getConfig(SLotterySetting.class);
|
||||
for(SLotterySetting sLotterySetting : config.values()){
|
||||
if(sLotterySetting.getLotteryType() == GlobalsDef.RANDOM_LOTTERY_TYPE){
|
||||
randomHeroIdTmp.add(sLotterySetting.getId());
|
||||
}
|
||||
}
|
||||
randomHeroIds = randomHeroIdTmp;
|
||||
sLotterySettingByType = config;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.core;
|
|||
public interface GlobalsDef {
|
||||
String DEFAULT_NAME = "无名妖灵师";
|
||||
|
||||
int RANDOM_LOTTERY_TYPE = 1;
|
||||
|
||||
int MAIL_RED_TYPE = 1; // 邮件红点红点
|
||||
int SHARE_BOSS_RED_TYPE =2; // 分享外敌boss红点
|
||||
int ARENA_CHALLENGE_TYPE =3;// 竞技场防守记录红点
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.config.SLotterySetting;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
|
@ -87,6 +88,14 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
.setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
|
||||
Map<Integer, Integer> totalCountMap = user.getHeroManager().getTotalCount();
|
||||
int alreadyCount =0;
|
||||
for(Integer id : SLotterySetting.randomHeroIds){
|
||||
Integer count = totalCountMap.get(id);
|
||||
if( null!=count){
|
||||
alreadyCount+=count;
|
||||
}
|
||||
}
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||
.setPlayer(player)
|
||||
|
@ -98,6 +107,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setVipBaseInfo(vipInfoProto)
|
||||
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
||||
.addAllRedType(playerInfoManager.getReds())
|
||||
.setRandCount(alreadyCount)
|
||||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
|
|
@ -10,6 +10,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -24,6 +26,7 @@ import com.sun.org.apache.regexp.internal.RE;
|
|||
import org.omg.CORBA.PUBLIC_MEMBER;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.logging.Slf4JLoggingSystem;
|
||||
|
||||
import java.rmi.ServerError;
|
||||
import java.util.*;
|
||||
|
@ -196,6 +199,7 @@ public class HeroLogic {
|
|||
for(Integer count : totalCountMap.values()){
|
||||
totalCount+=count;
|
||||
}
|
||||
|
||||
int j=0;
|
||||
for(int i=0;i<perCount;i++){
|
||||
randCount++;
|
||||
|
@ -211,6 +215,21 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
//1群英招募
|
||||
HeroInfoProto.HeroRandResponse.Builder builder = HeroInfoProto.HeroRandResponse.newBuilder();
|
||||
if(sLotterySetting.getLotteryType() == 1){
|
||||
int[] lotterySecurityReward = SGameSetting.getGameSetting().getLotterySecurityReward();
|
||||
int alreadyCount=0;
|
||||
for(Integer id : SLotterySetting.randomHeroIds){
|
||||
Integer count = totalCountMap.get(id);
|
||||
if( null!=count){
|
||||
alreadyCount+=count;
|
||||
}
|
||||
}
|
||||
if( (alreadyCount + perCount)/lotterySecurityReward[0] > alreadyCount/lotterySecurityReward[0]){
|
||||
builder.setExtraBox(ItemUtil.drop(user, new int[]{lotterySecurityReward[1]},1F,0,BIReason.HERO_RANDOM));
|
||||
}
|
||||
}
|
||||
heroManager.updateRandCount(type,randCount);
|
||||
if(tenTimesMustGetItem!=null){
|
||||
for(int i=0;i<tenTimesMustGetItem.length;i++){
|
||||
|
@ -219,8 +238,8 @@ public class HeroLogic {
|
|||
}
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropHeroAndItem,BIReason.HERO_RANDOM);
|
||||
HeroInfoProto.HeroRandResponse heroRandResponse = HeroInfoProto.HeroRandResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, heroRandResponse, true);
|
||||
builder.setDrop(drop);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
private int getSpecialPoolByRandcount(int type, int randCount) {
|
||||
|
|
Loading…
Reference in New Issue