Task【ID1005229】【特权调整】
parent
de89214bb4
commit
530fc08267
|
|
@ -64,4 +64,7 @@ public interface Global {
|
|||
int GMMSG = 4; //gm
|
||||
int LUCKWHEEL = 5; //幸运探宝
|
||||
int LUCKWHEEL_ADVANCE = 6; //高级探宝
|
||||
|
||||
|
||||
int VIPSTORID = 20; //vip商店id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,10 +94,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
}
|
||||
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getPlayerInfoManager().getMapId(), user.getMapManager().getCurMapId(),user.getMapManager());
|
||||
CommonProto.SuddenlyBossInfo suddenlyBossInfo = CommonProto.SuddenlyBossInfo.newBuilder().setSuddBossId(mapManager.getSuddenlyBoss()).setEndTime(mapManager.getSuddenlyBossEndTime()).setFindMapId(mapManager.getFindSuddenlyBossMapId()).build();
|
||||
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
.setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||
// CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||
// .setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
// .setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
|
||||
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
|
||||
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
|
||||
|
|
@ -145,7 +144,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllGiftGoodsInfo(goodsBagInfo)
|
||||
.addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
|
||||
.setSuddenlyBossInfo(suddenlyBossInfo)
|
||||
.setVipBaseInfo(vipInfoProto)
|
||||
.addAllVipLeveTake(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
||||
.addAllRedType(playerInfoManager.getReds())
|
||||
.setRandCount(alreadyCount)
|
||||
|
|
@ -163,6 +162,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setQuestionState(questState)
|
||||
.setSoulEquipPool(equipPool)
|
||||
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
|
||||
.setAmount(rechargeInfo.getSaveAmt())
|
||||
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Deprecated //vip 等级改版
|
||||
public class VipLevelUpHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
|
@ -16,6 +17,6 @@ public class VipLevelUpHandler extends BaseHandler {
|
|||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
PlayerLogic.getInstance().vipLevelUp(iSession);
|
||||
// PlayerLogic.getInstance().vipLevelUp(iSession);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.ljsd.jieling.handler.vip;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SVipLevelConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class VipTakeDailyHandler extends BaseHandler<PlayerInfoProto.VipTakeDilyRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.VIP_TAKE_DAILY_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, PlayerInfoProto.VipTakeDilyRequest proto) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(playerInfoManager.getVipLevel());
|
||||
if(null ==sVipLevelConfig){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
if(playerInfoManager.getHadTakeDailyBoxVip() != -1 ){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the vip daily reward"));
|
||||
}
|
||||
playerInfoManager.setHadTakeDailyBoxVip(playerInfoManager.getVipLevel());
|
||||
int[][] rewards= sVipLevelConfig.getVipBoxDailyReward();
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards, BIReason.TAKE_VIP_DAILY_REWARD);
|
||||
PlayerInfoProto.VipTakeDilyResponse build = PlayerInfoProto.VipTakeDilyResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_TAKE_DAILY_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +1,62 @@
|
|||
package com.ljsd.jieling.handler.vip;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SVipLevelConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class VipTakeLevelRewardHandler extends BaseHandler {
|
||||
@Deprecated //vip 等级改版
|
||||
public class VipTakeLevelRewardHandler extends BaseHandler<PlayerInfoProto.VipTakeBoxRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.VIP_TAKE_REWARD_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.VipTakeBoxRequest vipTakeBoxRequest = PlayerInfoProto.VipTakeBoxRequest.parseFrom(bytes);
|
||||
int type = vipTakeBoxRequest.getType();
|
||||
PlayerLogic.getInstance().takeVipLevelRewad(iSession,type);
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.VipTakeBoxRequest proto) throws Exception {
|
||||
int type = proto.getType();
|
||||
// takeVipLevelRewad(iSession,type);
|
||||
}
|
||||
|
||||
|
||||
// private void takeVipLevelRewad(ISession session,int type) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
// int reson=-1;
|
||||
// SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(playerInfoManager.getVipLevel());
|
||||
// int[][] rewards=null;
|
||||
// if(type == 1){
|
||||
// if(playerInfoManager.getHadTakeLevelBoxVip() == 1 ){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the vip level reward"));
|
||||
// }
|
||||
// playerInfoManager.setHadTakeLevelBoxVip(1);
|
||||
// rewards = sVipLevelConfig.getVipBoxReward();
|
||||
// reson = BIReason.TAKE_VIP_LEVEL_REWARD;
|
||||
// }else if(type == 2){
|
||||
// if(playerInfoManager.getHadTakeDailyBoxVip() != -1 || playerInfoManager.getHadTakeLevelBoxVip() == 0 ){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the vip daily reward"));
|
||||
// }
|
||||
// playerInfoManager.setHadTakeDailyBoxVip(playerInfoManager.getVipLevel());
|
||||
// rewards = sVipLevelConfig.getVipBoxDailyReward();
|
||||
// reson = BIReason.TAKE_VIP_DAILY_REWARD;
|
||||
// }
|
||||
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards,reson);
|
||||
// PlayerInfoProto.VipTakeBoxResponse build = PlayerInfoProto.VipTakeBoxResponse.newBuilder().setDrop(drop).build();
|
||||
// MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,build,true);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import config.SPrivilegeTypeConfig;
|
|||
import config.SVipLevelConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
|
@ -54,8 +55,6 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private long loginTime;
|
||||
|
||||
private int hadTakeLevelBoxVip; //领取vip等级礼包
|
||||
|
||||
private int hadTakeDailyBoxVip=-1; //领取vip每日礼包
|
||||
|
||||
private int maxForce; //玩家历史最高战力
|
||||
|
|
@ -63,6 +62,7 @@ public class PlayerManager extends MongoBase {
|
|||
private Map<Integer,Integer> guidePoints = new HashMap<>();
|
||||
|
||||
private Map<Integer,Integer> vipInfo = new HashMap<>();
|
||||
private Set<Integer> vipGoodInfo = new HashSet<>();// 特权商品礼包
|
||||
|
||||
private Set<Integer> reds = new CopyOnWriteArraySet<>();
|
||||
|
||||
|
|
@ -254,9 +254,7 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
updateString("vipInfo", vipInfo);
|
||||
updateString("vipLevel", vipLevel);
|
||||
updateString("hadTakeLevelBoxVip", 0);
|
||||
this.vipLevel = vipLevel;
|
||||
this.hadTakeLevelBoxVip = 0;
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel);
|
||||
PlayerLogic.getInstance().sendVipDailyOrLevlUpReward(user, vipLevel, BIReason.VIP_LEVEL_REWARD);
|
||||
|
||||
|
|
@ -317,13 +315,15 @@ public class PlayerManager extends MongoBase {
|
|||
this.maxForce = maxForce;
|
||||
}
|
||||
|
||||
public int getHadTakeLevelBoxVip() {
|
||||
return hadTakeLevelBoxVip;
|
||||
public Set<Integer> getHadTakeLevelBoxVip() {
|
||||
return vipGoodInfo;
|
||||
}
|
||||
|
||||
public void setHadTakeLevelBoxVip(int hadTakeLevelBoxVip) {
|
||||
updateString("hadTakeLevelBoxVip", hadTakeLevelBoxVip);
|
||||
this.hadTakeLevelBoxVip = hadTakeLevelBoxVip;
|
||||
public boolean hadTakeLevelBoxVip(int vipLevel) {
|
||||
return vipGoodInfo.contains(vipLevel);
|
||||
}
|
||||
public void setHadTakeLevelBoxVip(int vipLeve) {
|
||||
updateString("vipGoodInfo", vipGoodInfo);
|
||||
vipGoodInfo.add(vipLevel);
|
||||
}
|
||||
|
||||
public int getHadTakeDailyBoxVip() {
|
||||
|
|
|
|||
|
|
@ -217,58 +217,33 @@ public class PlayerLogic {
|
|||
return valueLength;
|
||||
}
|
||||
|
||||
public void vipLevelUp(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
if(playerInfoManager.getHadTakeDailyBoxVip() == -1){
|
||||
throw new ErrorCodeException(ErrorCode.NOT_TAKE_VIP_DAILY_REWARD);
|
||||
}
|
||||
Set<Integer> doingMissionIds = user.getUserMissionManager().getVipMissionIdsType().getDoingMissionIds();
|
||||
if(!doingMissionIds.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("not finfish"));
|
||||
}
|
||||
// public void vipLevelUp(ISession session) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
//// if(playerInfoManager.getHadTakeDailyBoxVip() == -1){
|
||||
//// throw new ErrorCodeException(ErrorCode.NOT_TAKE_VIP_DAILY_REWARD);
|
||||
//// }
|
||||
//// Set<Integer> doingMissionIds = user.getUserMissionManager().getVipMissionIdsType().getDoingMissionIds();
|
||||
//// if(!doingMissionIds.isEmpty()){
|
||||
//// throw new ErrorCodeException(ErrorCode.newDefineCode("not finfish"));
|
||||
//// }
|
||||
//
|
||||
// int vipLevel = playerInfoManager.getVipLevel();
|
||||
// playerInfoManager.updateVipInfo(user,vipLevel+1);
|
||||
// CombatLogic.getInstance().getNewAdventureReward(user, true);
|
||||
//// List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
|
||||
//// MissionLoigc.getVipMission(user,missionList);
|
||||
//// CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||
//// .setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
//// .setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
//// .setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||
//// PlayerInfoProto.VipLevelUpResponse.Builder builder = PlayerInfoProto.VipLevelUpResponse.newBuilder().addAllUserMissionInfo(missionList);
|
||||
//// builder.setVipBaseInfo(vipInfoProto);
|
||||
//// MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_LEVELUP_RESPONSE_VALUE,builder.build(),true);
|
||||
// }
|
||||
|
||||
int vipLevel = playerInfoManager.getVipLevel();
|
||||
playerInfoManager.updateVipInfo(user,vipLevel+1);
|
||||
CombatLogic.getInstance().getNewAdventureReward(user, true);
|
||||
List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
|
||||
MissionLoigc.getVipMission(user,missionList);
|
||||
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||
.setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||
PlayerInfoProto.VipLevelUpResponse.Builder builder = PlayerInfoProto.VipLevelUpResponse.newBuilder().addAllUserMissionInfo(missionList);
|
||||
builder.setVipBaseInfo(vipInfoProto);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_LEVELUP_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
public void takeVipLevelRewad(ISession session,int type) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
int reson=-1;
|
||||
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(playerInfoManager.getVipLevel());
|
||||
int[][] rewards=null;
|
||||
if(type == 1){
|
||||
if(playerInfoManager.getHadTakeLevelBoxVip() == 1 ){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the vip level reward"));
|
||||
}
|
||||
playerInfoManager.setHadTakeLevelBoxVip(1);
|
||||
rewards = sVipLevelConfig.getVipBoxReward();
|
||||
reson = BIReason.TAKE_VIP_LEVEL_REWARD;
|
||||
}else if(type == 2){
|
||||
if(playerInfoManager.getHadTakeDailyBoxVip() != -1 || playerInfoManager.getHadTakeLevelBoxVip() == 0 ){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the vip daily reward"));
|
||||
}
|
||||
playerInfoManager.setHadTakeDailyBoxVip(playerInfoManager.getVipLevel());
|
||||
rewards = sVipLevelConfig.getVipBoxDailyReward();
|
||||
reson = BIReason.TAKE_VIP_DAILY_REWARD;
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards,reson);
|
||||
PlayerInfoProto.VipTakeBoxResponse build = PlayerInfoProto.VipTakeBoxResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
|
||||
public void userforceChange(ISession iSession, int teamId) throws Exception {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.event.SecretEvent;
|
|||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
|
@ -199,6 +200,17 @@ public class BuyGoodsLogic {
|
|||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.DAILY_RECHARGE,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_SUM_DAY, user.getPlayerInfoManager().getRechargedaily());
|
||||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||
|
||||
//vip 等级更新和推送
|
||||
int newLeve= SVipLevelConfig.getsVipLevel(rechargeInfo.getSaveAmt());
|
||||
if(user.getPlayerInfoManager().getVipLevel()!=newLeve){
|
||||
user.getPlayerInfoManager().updateVipInfo(user,newLeve);
|
||||
CombatLogic.getInstance().getNewAdventureReward(user, true);
|
||||
}
|
||||
PlayerInfoProto.RefreshRechargeIndication.Builder builder = PlayerInfoProto.RefreshRechargeIndication.newBuilder();
|
||||
builder.setAmount(rechargeInfo.getSaveAmt());
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.REFRESH_RECHARGE_INDICATION_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
buyGoodsTimes.put(goodsId,buyCount);
|
||||
|
|
|
|||
|
|
@ -418,6 +418,11 @@ public class StoreLogic {
|
|||
Poster.getPoster().dispatchEvent(new GoldEvent(user.getId(),itemNum));
|
||||
}
|
||||
|
||||
if(storeId==Global.VIPSTORID){
|
||||
int vipLeve = user.getPlayerInfoManager().getVipLevel();
|
||||
user.getPlayerInfoManager().getHadTakeLevelBoxVip().add(vipLeve);
|
||||
}
|
||||
|
||||
PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession, 1,msgId, builder, true);
|
||||
}
|
||||
|
|
@ -435,6 +440,18 @@ public class StoreLogic {
|
|||
LOGGER.info("buyStoreItem==> uid={},itemId={}",user.getId(),itemId);
|
||||
return "no goods";
|
||||
}
|
||||
|
||||
if(storeId==Global.VIPSTORID){
|
||||
int vipLeve = user.getPlayerInfoManager().getVipLevel();
|
||||
if(vipLeve<(sStoreConfig.getStoreId()-1)){
|
||||
return "vip leve limit";
|
||||
}
|
||||
// if(user.getPlayerInfoManager().getHadTakeLevelBoxVip().contains(vipLeve)){
|
||||
// return "vip time limit 1";
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
int buyTimes = itemNumMap.get(itemId);
|
||||
int limit = sStoreConfig.getLimit();
|
||||
int relatedtoVIP = sStoreConfig.getRelatedtoVIP();
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ public class MessageUtil {
|
|||
|
||||
|
||||
public static void sendIndicationMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
||||
if(null == session){
|
||||
return;
|
||||
}
|
||||
if(session.getFiveReady() == 0){
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ import manager.Table;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@Table(name ="VipLevelConfig")
|
||||
public class SVipLevelConfig implements BaseConfig {
|
||||
|
||||
private static Map<Integer, SVipLevelConfig> sVipLevelConfigMap;
|
||||
private static TreeMap<Integer,Integer> money2vip ;
|
||||
private int vipLevel;
|
||||
|
||||
private int[][] privileges;
|
||||
|
|
@ -20,6 +22,8 @@ public class SVipLevelConfig implements BaseConfig {
|
|||
|
||||
private int[] openRules;
|
||||
|
||||
private int moneyLimit;
|
||||
|
||||
|
||||
private Map<Integer,Integer> privilegeMap;
|
||||
|
||||
|
|
@ -27,6 +31,7 @@ public class SVipLevelConfig implements BaseConfig {
|
|||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class);
|
||||
money2vip = new TreeMap<>();
|
||||
for(SVipLevelConfig sVipLevelConfig : config.values()){
|
||||
int[][] privileges = sVipLevelConfig.getPrivileges();
|
||||
if(privileges!=null&&privileges.length>0){
|
||||
|
|
@ -37,13 +42,20 @@ public class SVipLevelConfig implements BaseConfig {
|
|||
sVipLevelConfig.setPrivilegeMap(privilegeMap);
|
||||
|
||||
}
|
||||
money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel());
|
||||
}
|
||||
sVipLevelConfigMap =config;
|
||||
|
||||
}
|
||||
|
||||
public static Map<Integer, SVipLevelConfig> getsVipLevelConfigMap() {
|
||||
return sVipLevelConfigMap;
|
||||
}
|
||||
//根据钱返回当前特权等级
|
||||
public static int getsVipLevel(int money) {
|
||||
Map.Entry<Integer,Integer> entry = money2vip.ceilingEntry(money);
|
||||
return entry==null?money2vip.lastEntry().getValue():entry.getValue();
|
||||
}
|
||||
|
||||
public int getVipLevel() {
|
||||
return vipLevel;
|
||||
|
|
@ -72,4 +84,20 @@ public class SVipLevelConfig implements BaseConfig {
|
|||
public int[] getOpenRules() {
|
||||
return openRules;
|
||||
}
|
||||
|
||||
public int getMoneyLimit() {
|
||||
return moneyLimit;
|
||||
}
|
||||
|
||||
public void setMoneyLimit(int moneyLimit) {
|
||||
this.moneyLimit = moneyLimit;
|
||||
}
|
||||
|
||||
public static TreeMap<Integer, Integer> getMoney2vip() {
|
||||
return money2vip;
|
||||
}
|
||||
|
||||
public static void setMoney2vip(TreeMap<Integer, Integer> money2vip) {
|
||||
SVipLevelConfig.money2vip = money2vip;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue