Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
4b2d619df6
|
@ -0,0 +1,104 @@
|
||||||
|
package util;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2019/12/8
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class ProcessUtil {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
ProcessBuilder processBuilder = new ProcessBuilder("C:\\Users\\Administrator\\Desktop\\hotfix.bat");
|
||||||
|
Process process = processBuilder.start();
|
||||||
|
InputStream in = process.getInputStream();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
byte[] re = new byte[1024];
|
||||||
|
while (in.read(re) != -1) {
|
||||||
|
sb.append(new String(re));
|
||||||
|
}
|
||||||
|
String s = sb.toString();
|
||||||
|
String[] split =s.split("\n");
|
||||||
|
sb = new StringBuilder();
|
||||||
|
sb.append("[");
|
||||||
|
for (String s1:split){
|
||||||
|
String[] split1 = s1.split("\\.")[0].split("/");
|
||||||
|
if (split1.length<2){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String className = split1[split1.length-1];
|
||||||
|
String fullName = s1.split("\\.")[0].replace("/",".").split("com.ljsd.")[1];
|
||||||
|
sb.append(new HotClass(className,"com.ljsd."+fullName).toString()).append(",").append("\n");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.lastIndexOf(",")).append("]");
|
||||||
|
HotFix hotFix = new HotFix();
|
||||||
|
hotFix.setVersion("1001");
|
||||||
|
hotFix.setClasses(sb.toString());
|
||||||
|
System.out.println(hotFix.toString());
|
||||||
|
in.close();
|
||||||
|
if (process.isAlive()) {
|
||||||
|
process.waitFor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class HotClass{
|
||||||
|
private String name;
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
public HotClass(String name, String fullName) {
|
||||||
|
this.name = name;
|
||||||
|
this.fullName = fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullName(String fullName) {
|
||||||
|
this.fullName = fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{" +
|
||||||
|
"\"name\":" +"\""+ name +".class\""+
|
||||||
|
",\"fullName\":" +"\""+ fullName +"\"" +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class HotFix{
|
||||||
|
private String version;
|
||||||
|
private String classes;
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClasses() {
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClasses(String classes) {
|
||||||
|
this.classes = classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{" +"\n"+
|
||||||
|
"\"version\":" +"\""+ version + '\"' +",\n"+
|
||||||
|
"\"classes\":" +classes +"\n"+
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -85,15 +85,14 @@ public class NettyGameServer extends AbstractServer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
serverBootstrap.bind(getLocalAddress().getPort()).sync().channel().closeFuture().sync();
|
ChannelFuture channelFuture = serverBootstrap.bind(getLocalAddress().getPort()).sync();
|
||||||
// ChannelFuture channelFuture = serverBootstrap.bind(getLocalAddress().getPort());
|
this.channel = channelFuture.channel();
|
||||||
// this.channel = channelFuture.channel();
|
//同步关闭改异步回调 优雅关闭netty
|
||||||
// channelFuture.sync();
|
this.channel.closeFuture().addListener((ChannelFutureListener) future -> close());
|
||||||
// channelFuture.channel().closeFuture().sync();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ConnectException("close exception", getLocalAddress(), null);
|
throw new ConnectException("close exception", getLocalAddress(), null);
|
||||||
} finally {
|
} finally {
|
||||||
close();
|
// close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ -57,6 +58,23 @@ public class GameApplication {
|
||||||
setRegisterTime();// might loop
|
setRegisterTime();// might loop
|
||||||
GameLogicService.getInstance().onStart();
|
GameLogicService.getInstance().onStart();
|
||||||
NetManager.getInstance().init();
|
NetManager.getInstance().init();
|
||||||
|
|
||||||
|
//控制台gm
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
while(sc.hasNext())
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
String cmd = sc.nextLine();
|
||||||
|
if(cmd.startsWith("//"))
|
||||||
|
{
|
||||||
|
System.out.println("执行命令:" + cmd.substring(2));
|
||||||
|
String cmd2 = cmd.substring(2);
|
||||||
|
GmService.exeCmd(cmd2);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.print("gmException"+e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setRegisterTime() throws Exception {
|
private static void setRegisterTime() throws Exception {
|
||||||
|
|
|
@ -40,6 +40,12 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result idipGm(String reserved, String cmd) throws InvalidOperException, TException {
|
public Result idipGm(String reserved, String cmd) throws InvalidOperException, TException {
|
||||||
|
return exeCmd(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Result exeCmd(String cmd){
|
||||||
|
|
||||||
LOGGER.info("gm________________________"+cmd);
|
LOGGER.info("gm________________________"+cmd);
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
result.setResultCode(-1);
|
result.setResultCode(-1);
|
||||||
|
@ -190,7 +196,6 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
}
|
}
|
||||||
result.setResultCode(0);
|
result.setResultCode(0);
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -64,4 +64,7 @@ public interface Global {
|
||||||
int GMMSG = 4; //gm
|
int GMMSG = 4; //gm
|
||||||
int LUCKWHEEL = 5; //幸运探宝
|
int LUCKWHEEL = 5; //幸运探宝
|
||||||
int LUCKWHEEL_ADVANCE = 6; //高级探宝
|
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.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.SuddenlyBossInfo suddenlyBossInfo = CommonProto.SuddenlyBossInfo.newBuilder().setSuddBossId(mapManager.getSuddenlyBoss()).setEndTime(mapManager.getSuddenlyBossEndTime()).setFindMapId(mapManager.getFindSuddenlyBossMapId()).build();
|
||||||
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
// CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||||
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
|
// .setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
||||||
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
|
// .setVipLevel(playerInfoManager.getVipLevel()).build();
|
||||||
.setVipLevel(playerInfoManager.getVipLevel()).build();
|
|
||||||
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
|
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
|
||||||
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
|
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
|
||||||
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
|
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
|
||||||
|
@ -145,7 +144,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
.addAllGiftGoodsInfo(goodsBagInfo)
|
.addAllGiftGoodsInfo(goodsBagInfo)
|
||||||
.addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
|
.addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
|
||||||
.setSuddenlyBossInfo(suddenlyBossInfo)
|
.setSuddenlyBossInfo(suddenlyBossInfo)
|
||||||
.setVipBaseInfo(vipInfoProto)
|
.addAllVipLeveTake(playerInfoManager.getHadTakeLevelBoxVip())
|
||||||
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
||||||
.addAllRedType(playerInfoManager.getReds())
|
.addAllRedType(playerInfoManager.getReds())
|
||||||
.setRandCount(alreadyCount)
|
.setRandCount(alreadyCount)
|
||||||
|
@ -163,6 +162,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
.setQuestionState(questState)
|
.setQuestionState(questState)
|
||||||
.setSoulEquipPool(equipPool)
|
.setSoulEquipPool(equipPool)
|
||||||
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
|
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
|
||||||
|
.setAmount(rechargeInfo.getSaveAmt())
|
||||||
|
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
|
||||||
.build();
|
.build();
|
||||||
try {
|
try {
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.ljsd.jieling.handler.activity;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2019/12/13
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ActivityPrepareHandler extends BaseHandler<PlayerInfoProto.NextActivityRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.NEXT_ACTIVITY_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, PlayerInfoProto.NextActivityRequest proto) throws Exception {
|
||||||
|
int activityId = proto.getActivityId();
|
||||||
|
ActivityLogic.getInstance().getNextActivityId(iSession,activityId, MessageTypeProto.MessageType.NEXT_ACTIVITY_RESPONSE);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@Deprecated //vip 等级改版
|
||||||
public class VipLevelUpHandler extends BaseHandler {
|
public class VipLevelUpHandler extends BaseHandler {
|
||||||
@Override
|
@Override
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
@ -16,6 +17,6 @@ public class VipLevelUpHandler extends BaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
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;
|
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.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.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
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;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class VipTakeLevelRewardHandler extends BaseHandler {
|
@Deprecated //vip 等级改版
|
||||||
|
public class VipTakeLevelRewardHandler extends BaseHandler<PlayerInfoProto.VipTakeBoxRequest> {
|
||||||
@Override
|
@Override
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
return MessageTypeProto.MessageType.VIP_TAKE_REWARD_REQUEST;
|
return MessageTypeProto.MessageType.VIP_TAKE_REWARD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void processWithProto(ISession iSession, PlayerInfoProto.VipTakeBoxRequest proto) throws Exception {
|
||||||
byte[] bytes = netData.parseClientProtoNetData();
|
int type = proto.getType();
|
||||||
PlayerInfoProto.VipTakeBoxRequest vipTakeBoxRequest = PlayerInfoProto.VipTakeBoxRequest.parseFrom(bytes);
|
// takeVipLevelRewad(iSession,type);
|
||||||
int type = vipTakeBoxRequest.getType();
|
|
||||||
PlayerLogic.getInstance().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);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class GlobalDataManaager implements IManager {
|
||||||
new UserLevelEventHandler();
|
new UserLevelEventHandler();
|
||||||
new RemoveEventHeroHandler();
|
new RemoveEventHeroHandler();
|
||||||
new FightMainEventHandler();
|
new FightMainEventHandler();
|
||||||
ChampionshipLogic.whenStart();
|
// ChampionshipLogic.whenStart();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("e",e);
|
LOGGER.error("e",e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ import util.MathUtils;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1151,5 +1153,28 @@ public class ActivityLogic {
|
||||||
return objects.length>0;
|
return objects.length>0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void getNextActivityId(ISession session, int activityId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByType.get(activityId);
|
||||||
|
if(sGlobalActivities.isEmpty()){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
Function<SGlobalActivity,Integer> function = v->(int)ToolsUtil.getTimeLong(v.getStartTimeLong(),v.getEndTimeLong(),v.getTime(),user.getPlayerInfoManager().getCreateTime(),1);
|
||||||
|
Stream<SGlobalActivity> stream = sGlobalActivities.stream().sorted(Comparator.comparing(function))
|
||||||
|
.filter(v->ToolsUtil.getTimeLong(v.getStartTimeLong(), v.getEndTimeLong(), v.getTime(), user.getPlayerInfoManager().getCreateTime(), 1) > TimeUtils.now());
|
||||||
|
List<SGlobalActivity> collect = stream.collect(Collectors.toList());
|
||||||
|
if(collect.isEmpty()){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
int id = collect.get(0).getId();
|
||||||
|
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||||
|
if(sGlobalActivity==null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
long startTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),user.getPlayerInfoManager().getCreateTime(),1);
|
||||||
|
PlayerInfoProto.NextActivityResponse response = PlayerInfoProto.NextActivityResponse.newBuilder().setId(id).setTime((int)(startTime/1000)).build();
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class ExpectRankActivity extends AbstractActivity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
if (activityMission == null || activityMission.getOpenType() == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int missionId = rank2miss.get(rank);
|
int missionId = rank2miss.get(rank);
|
||||||
|
|
|
@ -5,10 +5,21 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
|
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
|
||||||
|
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||||
|
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.rank.RankContext;
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import config.SActivityRewardConfig;
|
||||||
|
import config.SCHero;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lvxinran
|
* @author lvxinran
|
||||||
|
@ -30,22 +41,36 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
||||||
if(cardEvent.getType()!=3){
|
if(cardEvent.getType()!=3){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(UserManager.getUser(cardEvent.getUid()).getActivityManager().getActivityMissionMap().get(id)==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType());
|
AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType());
|
||||||
int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid())).intValue();
|
int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid())).intValue();
|
||||||
if(scoreById==-1){
|
if(scoreById==-1){
|
||||||
scoreById=0;
|
scoreById=0;
|
||||||
}
|
}
|
||||||
randomRank.addRank(cardEvent.getUid(),scoreById+cardEvent.getScore());
|
randomRank.addRank(cardEvent.getUid(),scoreById+cardEvent.getScore());
|
||||||
|
Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13);
|
||||||
}
|
//
|
||||||
|
Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(), TimeUtils.now()/1000,a[0]);
|
||||||
@Override
|
Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer);
|
||||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore());
|
||||||
return super.takeReward(session, missionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityEnd() throws Exception {
|
public void onActivityEnd() throws Exception {
|
||||||
RedisUtil.getInstence().del(RedisKey.RANDOM_CARD_RANK);
|
RedisUtil.getInstence().del(RedisKey.RANDOM_CARD_RANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
|
||||||
|
activityMission.setValue(activityMission.getValue()+count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
return sActivityRewardConfig.getValues()[0][0]<=activityMission.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,13 @@ public class RandomCardEvent implements IEvent {
|
||||||
private int uid;
|
private int uid;
|
||||||
private int type;
|
private int type;
|
||||||
private int score;
|
private int score;
|
||||||
|
private int[][] heros;
|
||||||
|
|
||||||
public RandomCardEvent(int uid,int type, int score) {
|
public RandomCardEvent(int uid,int type, int score,int[][] heros) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
this.heros = heros;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
@ -39,4 +41,12 @@ public class RandomCardEvent implements IEvent {
|
||||||
public void setUid(int uid) {
|
public void setUid(int uid) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[][] getHeros() {
|
||||||
|
return heros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeros(int[][] heros) {
|
||||||
|
this.heros = heros;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import config.SPrivilegeTypeConfig;
|
||||||
import config.SVipLevelConfig;
|
import config.SVipLevelConfig;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
@ -54,8 +55,6 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
private long loginTime;
|
private long loginTime;
|
||||||
|
|
||||||
private int hadTakeLevelBoxVip; //领取vip等级礼包
|
|
||||||
|
|
||||||
private int hadTakeDailyBoxVip=-1; //领取vip每日礼包
|
private int hadTakeDailyBoxVip=-1; //领取vip每日礼包
|
||||||
|
|
||||||
private int maxForce; //玩家历史最高战力
|
private int maxForce; //玩家历史最高战力
|
||||||
|
@ -63,6 +62,7 @@ public class PlayerManager extends MongoBase {
|
||||||
private Map<Integer,Integer> guidePoints = new HashMap<>();
|
private Map<Integer,Integer> guidePoints = new HashMap<>();
|
||||||
|
|
||||||
private Map<Integer,Integer> vipInfo = new HashMap<>();
|
private Map<Integer,Integer> vipInfo = new HashMap<>();
|
||||||
|
private Set<Integer> vipGoodInfo = new HashSet<>();// 特权商品礼包
|
||||||
|
|
||||||
private Set<Integer> reds = new CopyOnWriteArraySet<>();
|
private Set<Integer> reds = new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
|
@ -254,9 +254,7 @@ public class PlayerManager extends MongoBase {
|
||||||
}
|
}
|
||||||
updateString("vipInfo", vipInfo);
|
updateString("vipInfo", vipInfo);
|
||||||
updateString("vipLevel", vipLevel);
|
updateString("vipLevel", vipLevel);
|
||||||
updateString("hadTakeLevelBoxVip", 0);
|
|
||||||
this.vipLevel = vipLevel;
|
this.vipLevel = vipLevel;
|
||||||
this.hadTakeLevelBoxVip = 0;
|
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel);
|
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel);
|
||||||
PlayerLogic.getInstance().sendVipDailyOrLevlUpReward(user, vipLevel, BIReason.VIP_LEVEL_REWARD);
|
PlayerLogic.getInstance().sendVipDailyOrLevlUpReward(user, vipLevel, BIReason.VIP_LEVEL_REWARD);
|
||||||
|
|
||||||
|
@ -317,13 +315,15 @@ public class PlayerManager extends MongoBase {
|
||||||
this.maxForce = maxForce;
|
this.maxForce = maxForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHadTakeLevelBoxVip() {
|
public Set<Integer> getHadTakeLevelBoxVip() {
|
||||||
return hadTakeLevelBoxVip;
|
return vipGoodInfo;
|
||||||
}
|
}
|
||||||
|
public boolean hadTakeLevelBoxVip(int vipLevel) {
|
||||||
public void setHadTakeLevelBoxVip(int hadTakeLevelBoxVip) {
|
return vipGoodInfo.contains(vipLevel);
|
||||||
updateString("hadTakeLevelBoxVip", hadTakeLevelBoxVip);
|
}
|
||||||
this.hadTakeLevelBoxVip = hadTakeLevelBoxVip;
|
public void setHadTakeLevelBoxVip(int vipLeve) {
|
||||||
|
updateString("vipGoodInfo", vipGoodInfo);
|
||||||
|
vipGoodInfo.add(vipLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHadTakeDailyBoxVip() {
|
public int getHadTakeDailyBoxVip() {
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import util.MathUtils;
|
import util.MathUtils;
|
||||||
import util.StringUtil;
|
import util.StringUtil;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -186,7 +187,10 @@ public class HeroLogic{
|
||||||
heroManager.updateFirstTenth();
|
heroManager.updateFirstTenth();
|
||||||
}
|
}
|
||||||
if(sLotterySetting.getLotteryType()==3){
|
if(sLotterySetting.getLotteryType()==3){
|
||||||
if(!ActivityLogic.getInstance().getActivityStatusByType(user,sLotterySetting.getActivityId())){
|
//活动抽卡校验
|
||||||
|
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(sLotterySetting.getActivityId());
|
||||||
|
long endTimeLong = ToolsUtil.getEndTimeLong(sGlobalActivity.getStartTimeLong(), sGlobalActivity.getEndTimeLong(), sGlobalActivity.getTime(), user.getPlayerInfoManager().getCreateTime(), sGlobalActivity.getGapTime());
|
||||||
|
if(!ActivityLogic.getInstance().getActivityStatusByType(user,sLotterySetting.getActivityId())|| TimeUtils.now()>endTimeLong){
|
||||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +297,7 @@ public class HeroLogic{
|
||||||
dropHeroAndItem[j++] = tenTimesMustGetItem[i];
|
dropHeroAndItem[j++] = tenTimesMustGetItem[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Poster.getPoster().dispatchEvent(new RandomCardEvent(uid,sLotterySetting.getLotteryType(),10*sLotterySetting.getPerCount()));
|
Poster.getPoster().dispatchEvent(new RandomCardEvent(uid,sLotterySetting.getLotteryType(),SSpecialConfig.getIntegerValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_INTEGRAL)*sLotterySetting.getPerCount(),dropHeroAndItem));
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, dropHeroAndItem,BIReason.HERO_RANDOM);
|
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, dropHeroAndItem,BIReason.HERO_RANDOM);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
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);
|
||||||
|
|
|
@ -217,58 +217,33 @@ public class PlayerLogic {
|
||||||
return valueLength;
|
return valueLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void vipLevelUp(ISession session) throws Exception {
|
// public void vipLevelUp(ISession session) throws Exception {
|
||||||
int uid = session.getUid();
|
// int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
// User user = UserManager.getUser(uid);
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
if(playerInfoManager.getHadTakeDailyBoxVip() == -1){
|
//// if(playerInfoManager.getHadTakeDailyBoxVip() == -1){
|
||||||
throw new ErrorCodeException(ErrorCode.NOT_TAKE_VIP_DAILY_REWARD);
|
//// throw new ErrorCodeException(ErrorCode.NOT_TAKE_VIP_DAILY_REWARD);
|
||||||
}
|
//// }
|
||||||
Set<Integer> doingMissionIds = user.getUserMissionManager().getVipMissionIdsType().getDoingMissionIds();
|
//// Set<Integer> doingMissionIds = user.getUserMissionManager().getVipMissionIdsType().getDoingMissionIds();
|
||||||
if(!doingMissionIds.isEmpty()){
|
//// if(!doingMissionIds.isEmpty()){
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("not finfish"));
|
//// 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 {
|
public void userforceChange(ISession iSession, int teamId) throws Exception {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public enum RankEnum {
|
||||||
MAIN_LEVEL_RANK(3,RedisKey.MAIN_LEVEL_RANK, MainLevelRank::new),//param1:通关关卡Id param2:无 param3:无
|
MAIN_LEVEL_RANK(3,RedisKey.MAIN_LEVEL_RANK, MainLevelRank::new),//param1:通关关卡Id param2:无 param3:无
|
||||||
MONSTER_ATTACK_RANK(4,RedisKey.MONSTER_ATTACK_RANK,MonsterAttackRank::new),//param1:兽潮层数 param2:无 param3:无
|
MONSTER_ATTACK_RANK(4,RedisKey.MONSTER_ATTACK_RANK,MonsterAttackRank::new),//param1:兽潮层数 param2:无 param3:无
|
||||||
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK, RandomCardRank::new),//param1:抽取积分 param2:无 param3:无
|
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK, RandomCardRank::new),//param1:抽取积分 param2:无 param3:无
|
||||||
RANDOM_CARD_PERFECT_RANK(11,RedisKey.RANDOM_CARD_PERFECT_RANK,RandomCardPerfectRank::new)
|
RANDOM_CARD_PERFECT_RANK(11,RedisKey.RANDOM_CARD_PERFECT_RANK,RandomCardPerfectRank::new)//param1:时间 param2:英雄tempId param3:uid
|
||||||
;
|
;
|
||||||
private int type;
|
private int type;
|
||||||
private String redisKey;
|
private String redisKey;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.rank.rankImpl;
|
||||||
|
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.rank.IRank;
|
import com.ljsd.jieling.logic.rank.IRank;
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.rank.rankKey.RandomCardSpecialKey;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lvxinran
|
* @author lvxinran
|
||||||
* @date 2019/12/9
|
* @date 2019/12/9
|
||||||
|
@ -10,13 +23,53 @@ public class RandomCardPerfectRank extends AbstractRank {
|
||||||
super(type, redisKey);
|
super(type, redisKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRank(int uid, double... data) {
|
||||||
|
String key = RedisKey.getKey(redisKey,"",false);
|
||||||
|
double[] doubles = new double[3];
|
||||||
|
System.arraycopy(data, 0, doubles, 0, data.length);
|
||||||
|
doubles[2] = uid;
|
||||||
|
// data[0]+"_"+data[1]+"_"+RedisUtil.getInstence().incrementZsetScore()
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String heroKey = gson.toJson(new RandomCardSpecialKey(uid, Double.valueOf(data[1]).intValue(), RedisUtil.getInstence().incr("incr_Card", 1)));
|
||||||
|
RedisUtil.getInstence().zsetAddOne(key, heroKey, getScore(doubles));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String value = data.getValue();
|
||||||
|
RandomCardSpecialKey randomCardSpecialKey = gson.fromJson(value, RandomCardSpecialKey.class);
|
||||||
|
User everyUser = UserManager.getUser(randomCardSpecialKey.getUid(), true);
|
||||||
|
CommonProto.RankInfo everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
|
.setRank(index)
|
||||||
|
.setParam1(getParam1(data.getScore()))
|
||||||
|
.setParam2(randomCardSpecialKey.getHeroId())
|
||||||
|
.setParam3(0)
|
||||||
|
.build();
|
||||||
|
int guildId = everyUser.getPlayerInfoManager().getGuildId();
|
||||||
|
String familyName = "";
|
||||||
|
if(guildId!=0){
|
||||||
|
familyName = GuilidManager.guildInfoMap.get(guildId).getName();
|
||||||
|
}
|
||||||
|
CommonProto.UserRank everyRank = CommonProto.UserRank.newBuilder()
|
||||||
|
.setUid(everyUser.getId())
|
||||||
|
.setUserName(everyUser.getPlayerInfoManager().getNickName())
|
||||||
|
.setHead(everyUser.getPlayerInfoManager().getHead())
|
||||||
|
.setHeadFrame(everyUser.getPlayerInfoManager().getHeadFrame())
|
||||||
|
.setLevel(everyUser.getPlayerInfoManager().getLevel())
|
||||||
|
.setRankInfo(everyRankInfo)
|
||||||
|
.setGuildName(familyName)
|
||||||
|
.build();
|
||||||
|
builder.addRanks(everyRank);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public int[] getDataByScore(double score) {
|
public int[] getDataByScore(double score) {
|
||||||
return new int[0];
|
return new int[]{Double.valueOf(score).intValue()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getScore(double... data) {
|
public double getScore(double... data) {
|
||||||
return 0;
|
return data[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.ljsd.jieling.logic.rank.rankKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2019/12/9
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class RandomCardSpecialKey {
|
||||||
|
private int uid;
|
||||||
|
private int heroId;
|
||||||
|
private long version;
|
||||||
|
|
||||||
|
public void setUid(int uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeroId(int heroId) {
|
||||||
|
this.heroId = heroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(long version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RandomCardSpecialKey(int uid, int heroId, long version) {
|
||||||
|
this.uid = uid;
|
||||||
|
this.heroId = heroId;
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeroId() {
|
||||||
|
return heroId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.RechargeInfo;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
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.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
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.DAILY_RECHARGE,price);
|
||||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,price);
|
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,price);
|
||||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_SUM_DAY, user.getPlayerInfoManager().getRechargedaily());
|
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);
|
buyGoodsTimes.put(goodsId,buyCount);
|
||||||
|
|
|
@ -418,6 +418,11 @@ public class StoreLogic {
|
||||||
Poster.getPoster().dispatchEvent(new GoldEvent(user.getId(),itemNum));
|
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();
|
PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build();
|
||||||
MessageUtil.sendMessage(iSession, 1,msgId, builder, true);
|
MessageUtil.sendMessage(iSession, 1,msgId, builder, true);
|
||||||
}
|
}
|
||||||
|
@ -435,6 +440,18 @@ public class StoreLogic {
|
||||||
LOGGER.info("buyStoreItem==> uid={},itemId={}",user.getId(),itemId);
|
LOGGER.info("buyStoreItem==> uid={},itemId={}",user.getId(),itemId);
|
||||||
return "no goods";
|
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 buyTimes = itemNumMap.get(itemId);
|
||||||
int limit = sStoreConfig.getLimit();
|
int limit = sStoreConfig.getLimit();
|
||||||
int relatedtoVIP = sStoreConfig.getRelatedtoVIP();
|
int relatedtoVIP = sStoreConfig.getRelatedtoVIP();
|
||||||
|
|
|
@ -92,7 +92,11 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(packetNetData.getMsgId()!=MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE)
|
||||||
|
{
|
||||||
|
//聊天请求太多了 过滤掉
|
||||||
LOGGER.info("request={} commond ={}: ", packetNetData.getUserId(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
LOGGER.info("request={} commond ={}: ", packetNetData.getUserId(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||||
|
}
|
||||||
if (packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE ||
|
if (packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE ||
|
||||||
packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE) {
|
packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE) {
|
||||||
if (!onLoginORReLoginRequest(session, packetNetData)) {
|
if (!onLoginORReLoginRequest(session, packetNetData)) {
|
||||||
|
|
|
@ -130,6 +130,9 @@ public class MessageUtil {
|
||||||
|
|
||||||
|
|
||||||
public static void sendIndicationMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
public static void sendIndicationMessage(ISession session, int result, int msgId, GeneratedMessage generatedMessage, boolean flush) {
|
||||||
|
if(null == session){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(session.getFiveReady() == 0){
|
if(session.getFiveReady() == 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,13 @@ public class ToolsUtil {
|
||||||
}
|
}
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
public static long getEndTimeLong(long startTimeLong , long endTimeLong,int time,long createUserTime,int dayOut){
|
||||||
|
long timeLong = getTimeLong(startTimeLong, endTimeLong, time, createUserTime, 2);
|
||||||
|
long endTime = timeLong - TimeUtils.DAY * dayOut;
|
||||||
|
return endTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
|
|
|
@ -59,6 +59,9 @@ public class SCHero implements BaseConfig{
|
||||||
|
|
||||||
private Map<Integer, Map<Integer, ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
|
private Map<Integer, Map<Integer, ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
|
||||||
|
|
||||||
|
private static Map<Integer,SCHero> piecesMap;
|
||||||
|
|
||||||
|
|
||||||
public static class ConsumeMaterialInfo{
|
public static class ConsumeMaterialInfo{
|
||||||
private int groupID;
|
private int groupID;
|
||||||
private int nums;
|
private int nums;
|
||||||
|
@ -150,8 +153,15 @@ public class SCHero implements BaseConfig{
|
||||||
|
|
||||||
}
|
}
|
||||||
sCHero = integerSCHeroMap;
|
sCHero = integerSCHeroMap;
|
||||||
|
piecesMap = new HashMap<>();
|
||||||
|
for(Map.Entry<Integer,SCHero> hero:sCHero.entrySet()){
|
||||||
|
piecesMap.put(hero.getValue().getPiecesId(),hero.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SCHero getHeroByPieceId(int piecesId){
|
||||||
|
return piecesMap.get(piecesId);
|
||||||
|
}
|
||||||
|
|
||||||
public Map<Integer, ConsumeMaterialInfo> getConsumeMaterialInfoOfPositionByStar(int star) {
|
public Map<Integer, ConsumeMaterialInfo> getConsumeMaterialInfoOfPositionByStar(int star) {
|
||||||
return consumeMaterialInfoOfPositionByStar.get(star);
|
return consumeMaterialInfoOfPositionByStar.get(star);
|
||||||
|
|
|
@ -46,6 +46,8 @@ public class SGlobalActivity implements BaseConfig {
|
||||||
|
|
||||||
private int[] foreshow;
|
private int[] foreshow;
|
||||||
|
|
||||||
|
private int gapTime;
|
||||||
|
|
||||||
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
|
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,4 +151,12 @@ public class SGlobalActivity implements BaseConfig {
|
||||||
public int[] getForeshow() {
|
public int[] getForeshow() {
|
||||||
return foreshow;
|
return foreshow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGapTime() {
|
||||||
|
return gapTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -50,6 +50,7 @@ public class SSpecialConfig implements BaseConfig {
|
||||||
public static final String SUNLONG_INTEGRAL = "Sunlong_Integral";//孙龙的宝藏每日积分礼包
|
public static final String SUNLONG_INTEGRAL = "Sunlong_Integral";//孙龙的宝藏每日积分礼包
|
||||||
public static final String SUNLONG_REWARD = "Sunlong_Reward";//孙龙的宝藏礼包\
|
public static final String SUNLONG_REWARD = "Sunlong_Reward";//孙龙的宝藏礼包\
|
||||||
public static final String LAMP_TEXT_SPEED = "lamp_text_speed";//跑马灯速度
|
public static final String LAMP_TEXT_SPEED = "lamp_text_speed";//跑马灯速度
|
||||||
|
public static final String TIME_LIMIT_RECRUITMENT_INTEGRAL = "time_limit_recruitment_integral";//限时抽卡一次积分
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
|
@ -5,11 +5,13 @@ import manager.Table;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Table(name ="VipLevelConfig")
|
@Table(name ="VipLevelConfig")
|
||||||
public class SVipLevelConfig implements BaseConfig {
|
public class SVipLevelConfig implements BaseConfig {
|
||||||
|
|
||||||
private static Map<Integer, SVipLevelConfig> sVipLevelConfigMap;
|
private static Map<Integer, SVipLevelConfig> sVipLevelConfigMap;
|
||||||
|
private static TreeMap<Integer,Integer> money2vip ;
|
||||||
private int vipLevel;
|
private int vipLevel;
|
||||||
|
|
||||||
private int[][] privileges;
|
private int[][] privileges;
|
||||||
|
@ -20,6 +22,8 @@ public class SVipLevelConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[] openRules;
|
private int[] openRules;
|
||||||
|
|
||||||
|
private int moneyLimit;
|
||||||
|
|
||||||
|
|
||||||
private Map<Integer,Integer> privilegeMap;
|
private Map<Integer,Integer> privilegeMap;
|
||||||
|
|
||||||
|
@ -27,6 +31,7 @@ public class SVipLevelConfig implements BaseConfig {
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
Map<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class);
|
Map<Integer, SVipLevelConfig> config = STableManager.getConfig(SVipLevelConfig.class);
|
||||||
|
money2vip = new TreeMap<>();
|
||||||
for(SVipLevelConfig sVipLevelConfig : config.values()){
|
for(SVipLevelConfig sVipLevelConfig : config.values()){
|
||||||
int[][] privileges = sVipLevelConfig.getPrivileges();
|
int[][] privileges = sVipLevelConfig.getPrivileges();
|
||||||
if(privileges!=null&&privileges.length>0){
|
if(privileges!=null&&privileges.length>0){
|
||||||
|
@ -37,13 +42,20 @@ public class SVipLevelConfig implements BaseConfig {
|
||||||
sVipLevelConfig.setPrivilegeMap(privilegeMap);
|
sVipLevelConfig.setPrivilegeMap(privilegeMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
money2vip.put(sVipLevelConfig.getMoneyLimit(),sVipLevelConfig.getVipLevel());
|
||||||
}
|
}
|
||||||
sVipLevelConfigMap =config;
|
sVipLevelConfigMap =config;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, SVipLevelConfig> getsVipLevelConfigMap() {
|
public static Map<Integer, SVipLevelConfig> getsVipLevelConfigMap() {
|
||||||
return sVipLevelConfigMap;
|
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() {
|
public int getVipLevel() {
|
||||||
return vipLevel;
|
return vipLevel;
|
||||||
|
@ -72,4 +84,20 @@ public class SVipLevelConfig implements BaseConfig {
|
||||||
public int[] getOpenRules() {
|
public int[] getOpenRules() {
|
||||||
return openRules;
|
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