gm转盘优化2:特权相关内容
parent
731bcc0292
commit
9c459dc23d
|
@ -73,12 +73,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
int token = netData.getToken();
|
int token = netData.getToken();
|
||||||
int msgId = netData.getMsgId();
|
int msgId = netData.getMsgId();
|
||||||
int msgIndex = netData.getIndex();
|
int msgIndex = netData.getIndex();
|
||||||
PlayerInfoProto.GetPlayerInfoRequest getPlayerInfoRequest
|
PlayerInfoProto.GetPlayerInfoRequest getPlayerInfoRequest = PlayerInfoProto.GetPlayerInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||||
= PlayerInfoProto.GetPlayerInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
|
||||||
|
|
||||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||||
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
|
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
|
||||||
|
|
||||||
User user = UserManager.getUser(userId);
|
User user = UserManager.getUser(userId);
|
||||||
QuestionLogic.getInstence().onLogin(user);
|
QuestionLogic.getInstence().onLogin(user);
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
|
@ -199,8 +196,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
}
|
}
|
||||||
// 开服时间戳
|
// 开服时间戳
|
||||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||||
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
|
||||||
.setPlayer(player)
|
.setPlayer(player)
|
||||||
.addAllNewPlayerGuidePoint(list)
|
.addAllNewPlayerGuidePoint(list)
|
||||||
.addAllPrivilege(privilegeList)
|
.addAllPrivilege(privilegeList)
|
||||||
|
|
|
@ -9,10 +9,7 @@ import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.jbean.LuckWheelMission;
|
import com.ljsd.jieling.jbean.LuckWheelMission;
|
||||||
import com.ljsd.jieling.jbean.LuckWheelPosInfo;
|
import com.ljsd.jieling.jbean.LuckWheelPosInfo;
|
||||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
import com.ljsd.jieling.logic.activity.*;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
|
||||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
|
||||||
import com.ljsd.jieling.logic.activity.LuckWheelActivity;
|
|
||||||
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
|
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
@ -48,20 +45,19 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
@Override
|
@Override
|
||||||
public void processWithProto(ISession iSession, PlayerInfoProto.GetLuckWheelRandRewardRequest proto) throws Exception {
|
public void processWithProto(ISession iSession, PlayerInfoProto.GetLuckWheelRandRewardRequest proto) throws Exception {
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(proto.getActivityId());
|
int activityId = proto.getActivityId();
|
||||||
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(activityId);
|
||||||
if (null == abstractActivity) {
|
if (null == abstractActivity) {
|
||||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
}
|
}
|
||||||
if (!(abstractActivity instanceof LuckWheelActivity)) {
|
if (!(abstractActivity instanceof LuckWheelActivity)) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("activity err"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("activity err"));
|
||||||
}
|
}
|
||||||
|
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(activityId);
|
||||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(proto.getActivityId());
|
int reson = getCostBIReason(activityId);
|
||||||
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());
|
|
||||||
int reson = getCostBIReason(sGlobalActivity.getId());
|
|
||||||
|
|
||||||
//checkAndUpdate cost
|
//checkAndUpdate cost
|
||||||
LuckWheelMission luckWheelMission = ActivityLogic.getInstance().getLuckWheel(user.getActivityManager(),sGlobalActivity.getType());
|
LuckWheelMission luckWheelMission = ActivityLogic.getInstance().getLuckWheel(user.getActivityManager(), activityId);
|
||||||
|
|
||||||
int[][] costmap = proto.getRepeated() ? sDialRewardSetting.getMultipleCostItem() : sDialRewardSetting.getCostItem();
|
int[][] costmap = proto.getRepeated() ? sDialRewardSetting.getMultipleCostItem() : sDialRewardSetting.getCostItem();
|
||||||
int[][] realCost = LuckWheelActivity.getCost(luckWheelMission.getRefreshTime(), costmap);
|
int[][] realCost = LuckWheelActivity.getCost(luckWheelMission.getRefreshTime(), costmap);
|
||||||
|
@ -74,7 +70,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
|
|
||||||
int cfgTime = SSpecialConfig.getIntegerValue(SSpecialConfig.LUCKYTURNDAILYLIMIT);
|
int cfgTime = SSpecialConfig.getIntegerValue(SSpecialConfig.LUCKYTURNDAILYLIMIT);
|
||||||
// 普通探宝
|
// 普通探宝
|
||||||
if(sGlobalActivity.getId() == 30){
|
if(activityId == 30){
|
||||||
int luckWheelLimitTime = user.getPlayerInfoManager().getLuckWheelLimitTime();
|
int luckWheelLimitTime = user.getPlayerInfoManager().getLuckWheelLimitTime();
|
||||||
if(luckWheelLimitTime+time>cfgTime){
|
if(luckWheelLimitTime+time>cfgTime){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF,"不可超出每日探宝上限次数!");
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF,"不可超出每日探宝上限次数!");
|
||||||
|
@ -82,7 +78,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
user.getPlayerInfoManager().setLuckWheelLimitTime(luckWheelLimitTime+time);
|
user.getPlayerInfoManager().setLuckWheelLimitTime(luckWheelLimitTime+time);
|
||||||
}
|
}
|
||||||
// 高级探宝
|
// 高级探宝
|
||||||
if(sGlobalActivity.getId() == 31) {
|
if(activityId == 31) {
|
||||||
int luckWheelLimitTime = user.getPlayerInfoManager().getLuckAdvanceWheelLimitTime();
|
int luckWheelLimitTime = user.getPlayerInfoManager().getLuckAdvanceWheelLimitTime();
|
||||||
if(luckWheelLimitTime+time>cfgTime){
|
if(luckWheelLimitTime+time>cfgTime){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF,"不可超出每日探宝上限次数!");
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF,"不可超出每日探宝上限次数!");
|
||||||
|
@ -90,10 +86,11 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
user.getPlayerInfoManager().setLuckAdvanceWheelLimitTime(luckWheelLimitTime+time);
|
user.getPlayerInfoManager().setLuckAdvanceWheelLimitTime(luckWheelLimitTime+time);
|
||||||
}
|
}
|
||||||
// gm转盘
|
// gm转盘
|
||||||
if(sGlobalActivity.getId() == 10701 || sGlobalActivity.getId() == 10702 || sGlobalActivity.getId() == 10703) {
|
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||||
boolean checkAndUpdate = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.SUPER_GM_TURNTABLE_ADD_NUM, time);
|
if(activity.getType() == ActivityType.GM_DIAL) {
|
||||||
|
boolean checkAndUpdate = PlayerLogic.getInstance().checkOrUpPrivilegeId(user, proto.getPrivilegeId(), time, 1);
|
||||||
if(!checkAndUpdate){
|
if(!checkAndUpdate){
|
||||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX, "不可超出每日gm转盘上限次数!");
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF, "不可超出每日gm转盘上限次数!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,11 +118,11 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Dial_Reward_txt",
|
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Dial_Reward_txt",
|
||||||
new Object[]{nameColor, nickName, sItem.getName()},
|
new Object[]{nameColor, nickName, sItem.getName()},
|
||||||
new int[]{0,0,1});
|
new int[]{0,0,1});
|
||||||
int sysType = getMsgType(sGlobalActivity.getId());
|
int sysType = getMsgType(activityId);
|
||||||
ChatLogic.getInstance().sendSysChatMessage(message, sysType, "0", 0, 0, 0, 0, 0);
|
ChatLogic.getInstance().sendSysChatMessage(message, sysType, "0", 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int dropReson = getRewardBIReason(sGlobalActivity.getId());
|
int dropReson = getRewardBIReason(activityId);
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, drops, dropReson);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, drops, dropReson);
|
||||||
|
|
||||||
CommonProto.DialInfo.Builder dialInfo = CommonProto.DialInfo.newBuilder();
|
CommonProto.DialInfo.Builder dialInfo = CommonProto.DialInfo.newBuilder();
|
||||||
|
@ -138,12 +135,12 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
||||||
builder.setLuckTimes(luckWheelPosInfo.getProgrss());
|
builder.setLuckTimes(luckWheelPosInfo.getProgrss());
|
||||||
rewardPosInfoList.add(builder.build());
|
rewardPosInfoList.add(builder.build());
|
||||||
}
|
}
|
||||||
dialInfo.setActivityId(sGlobalActivity.getId());
|
dialInfo.setActivityId(activityId);
|
||||||
|
|
||||||
Poster.getPoster().dispatchEvent(new LuckWheelEvent(user.getId(),sGlobalActivity.getId(),time));
|
Poster.getPoster().dispatchEvent(new LuckWheelEvent(user.getId(),activityId,time));
|
||||||
|
|
||||||
PlayerInfoProto.GetLuckWheelRandRewardResponse.Builder builder = PlayerInfoProto.GetLuckWheelRandRewardResponse.newBuilder();
|
PlayerInfoProto.GetLuckWheelRandRewardResponse.Builder builder = PlayerInfoProto.GetLuckWheelRandRewardResponse.newBuilder();
|
||||||
builder.setActivityId(proto.getActivityId());
|
builder.setActivityId(activityId);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
builder.setDialInfo(dialInfo);
|
builder.setDialInfo(dialInfo);
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.LUCK_WHEEL_TIMES,reson,time);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.LUCK_WHEEL_TIMES,reson,time);
|
||||||
|
|
|
@ -34,18 +34,17 @@ public class RefreshLuckWheelRequestHandler extends BaseHandler<PlayerInfoProto.
|
||||||
@Override
|
@Override
|
||||||
public void processWithProto(ISession iSession, PlayerInfoProto.RefreshLuckWheelRequest proto) throws Exception {
|
public void processWithProto(ISession iSession, PlayerInfoProto.RefreshLuckWheelRequest proto) throws Exception {
|
||||||
User user = UserManager.getUser(iSession.getUid());
|
User user = UserManager.getUser(iSession.getUid());
|
||||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(proto.getActivityId());
|
int activityId = proto.getActivityId();
|
||||||
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityById(activityId);
|
||||||
if (null == abstractActivity) {
|
if (null == abstractActivity) {
|
||||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
}
|
}
|
||||||
if (!(abstractActivity instanceof LuckWheelActivity)) {
|
if (!(abstractActivity instanceof LuckWheelActivity)) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("activity err"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("activity err"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//checkAndUpdate cost
|
//checkAndUpdate cost
|
||||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(proto.getActivityId());
|
int reson = GetLuckWheelRandHandler.getCostBIReason(activityId);
|
||||||
int reson = GetLuckWheelRandHandler.getCostBIReason(sGlobalActivity.getId());
|
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(activityId);
|
||||||
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());
|
|
||||||
if(proto.getIsFree()){
|
if(proto.getIsFree()){
|
||||||
int[][] cost= new int[1][];
|
int[][] cost= new int[1][];
|
||||||
cost[0] = new int[2];
|
cost[0] = new int[2];
|
||||||
|
@ -56,7 +55,7 @@ public class RefreshLuckWheelRequestHandler extends BaseHandler<PlayerInfoProto.
|
||||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
LuckWheelMission luckWheelMission = ActivityLogic.getInstance().getLuckWheel(user.getActivityManager(),sGlobalActivity.getType());
|
LuckWheelMission luckWheelMission = ActivityLogic.getInstance().getLuckWheel(user.getActivityManager(),activityId);
|
||||||
int[][] cost = LuckWheelActivity.getCost(luckWheelMission.getRefreshTime(), sDialRewardSetting.getCost());
|
int[][] cost = LuckWheelActivity.getCost(luckWheelMission.getRefreshTime(), sDialRewardSetting.getCost());
|
||||||
boolean enough = ItemUtil.itemCost(user, cost, reson, 0);
|
boolean enough = ItemUtil.itemCost(user, cost, reson, 0);
|
||||||
if(!enough){
|
if(!enough){
|
||||||
|
@ -65,11 +64,11 @@ public class RefreshLuckWheelRequestHandler extends BaseHandler<PlayerInfoProto.
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理次数
|
// 清理次数
|
||||||
user.getPlayerInfoManager().putGmDialNum(sGlobalActivity.getId(),0);
|
user.getPlayerInfoManager().putGmDialNum(activityId,0);
|
||||||
//random
|
//random
|
||||||
((LuckWheelActivity) abstractActivity).randomReward(user);
|
((LuckWheelActivity) abstractActivity).randomReward(user);
|
||||||
PlayerInfoProto.RefreshLuckWheelResponse.Builder builder = PlayerInfoProto.RefreshLuckWheelResponse.newBuilder();
|
PlayerInfoProto.RefreshLuckWheelResponse.Builder builder = PlayerInfoProto.RefreshLuckWheelResponse.newBuilder();
|
||||||
builder.setDialInfo(LuckWheelActivity.getLuckWheelReward(user,sGlobalActivity.getId()));
|
builder.setDialInfo(LuckWheelActivity.getLuckWheelReward(user,activityId));
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.REFRESH_LUCKWHEEL_RESPONSE_VALUE, builder.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.REFRESH_LUCKWHEEL_RESPONSE_VALUE, builder.build(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -102,11 +102,10 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//战斗
|
//战斗
|
||||||
CommonProto.FightTeamInfo teamInfo ;
|
CommonProto.FightTeamInfo teamInfo;
|
||||||
CommonProto.ArenaEnemy arenaEnemys ;
|
CommonProto.ArenaEnemy arenaEnemys;
|
||||||
CommonProto.ArenaEnemy arenaAttack ;
|
CommonProto.ArenaEnemy arenaAttack;
|
||||||
|
|
||||||
//当前分组
|
//当前分组
|
||||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.ljsd.jieling.jbean;
|
||||||
|
|
||||||
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明:gm活动
|
||||||
|
*
|
||||||
|
* @author ascend
|
||||||
|
* 2022/10/26 11:42:48
|
||||||
|
*/
|
||||||
|
public class GmActivityManager extends MongoBase {
|
||||||
|
private HashMap<String, ActivityProgressInfo> map = new HashMap<>();
|
||||||
|
}
|
|
@ -116,7 +116,7 @@ public enum ActivityTypeEnum {
|
||||||
INFINITE_RESOURCES_PAVILION(ActivityType.INFINITE_RESOURCES_PAVILION, InfiniteResourcesPavilionActivity::new),//无限资源阁
|
INFINITE_RESOURCES_PAVILION(ActivityType.INFINITE_RESOURCES_PAVILION, InfiniteResourcesPavilionActivity::new),//无限资源阁
|
||||||
ALL_PEOPLE_WELFARE(ActivityType.ALL_PEOPLE_WELFARE, AllPeopleWelfareActivity::new),//全民福利
|
ALL_PEOPLE_WELFARE(ActivityType.ALL_PEOPLE_WELFARE, AllPeopleWelfareActivity::new),//全民福利
|
||||||
GIVE_ENDLESS_DRAW(ActivityType.GIVE_ENDLESS_DRAW, GiveEndlessDrawActivity::new),//送无限抽
|
GIVE_ENDLESS_DRAW(ActivityType.GIVE_ENDLESS_DRAW, GiveEndlessDrawActivity::new),//送无限抽
|
||||||
GM_DIAL(ActivityType.GM_DIAL, LuckWheelNormalActivity::new),//gm转盘
|
GM_DIAL(ActivityType.GM_DIAL, GmDialActivity::new),//gm转盘
|
||||||
RECHARGE_FIRST(ActivityType.RECHARGE_FIRST, RechargeFirstActivity::new),//直充购买礼包活动
|
RECHARGE_FIRST(ActivityType.RECHARGE_FIRST, RechargeFirstActivity::new),//直充购买礼包活动
|
||||||
FREE_RECHARGE(ActivityType.FREE_RECHARGE, DefaultEmptyActivity::new),//免费充值,仙充
|
FREE_RECHARGE(ActivityType.FREE_RECHARGE, DefaultEmptyActivity::new),//免费充值,仙充
|
||||||
OPEN_SERVER_COMPETE_RANK(ActivityType.OPEN_SERVER_COMPETE_RANK, OpenServerCompeteRankActivity::new),//开服冲榜
|
OPEN_SERVER_COMPETE_RANK(ActivityType.OPEN_SERVER_COMPETE_RANK, OpenServerCompeteRankActivity::new),//开服冲榜
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import config.SGlobalActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明:gm转盘活动
|
||||||
|
*
|
||||||
|
* @author ascend
|
||||||
|
* 2022/10/26 15:22:27
|
||||||
|
*/
|
||||||
|
public class GmDialActivity extends LuckWheelNormalActivity{
|
||||||
|
|
||||||
|
GmDialActivity(int id) {
|
||||||
|
super(id);
|
||||||
|
Poster.getPoster().listenEvent(this, LuckWheelEvent.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initActivity(User user) throws Exception {
|
||||||
|
super.initActivity(user);
|
||||||
|
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||||
|
if (activity.getPrivilege() != 0){
|
||||||
|
user.getPlayerInfoManager().addVipInfo(activity.getPrivilege());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
package com.ljsd.jieling.logic.activity;
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
import com.ljsd.jieling.jbean.ActivityMission;
|
import com.ljsd.jieling.jbean.*;
|
||||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
|
||||||
import com.ljsd.jieling.jbean.LuckWheelMission;
|
|
||||||
import com.ljsd.jieling.jbean.LuckWheelPosInfo;
|
|
||||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
|
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
@ -72,8 +69,8 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
||||||
* 重置奖励
|
* 重置奖励
|
||||||
*/
|
*/
|
||||||
public void randomReward(User user) {
|
public void randomReward(User user) {
|
||||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
ActivityManager activityManager = user.getActivityManager();
|
||||||
LuckWheelMission luckWheelMission =ActivityLogic.getInstance().getLuckWheel(user.getActivityManager(),sGlobalActivity.getId());
|
LuckWheelMission luckWheelMission =ActivityLogic.getInstance().getLuckWheel(activityManager,id);
|
||||||
Map<Integer, Set<Integer>> posPools = SDialRewardConfig.getsRandPosMap().get(id);
|
Map<Integer, Set<Integer>> posPools = SDialRewardConfig.getsRandPosMap().get(id);
|
||||||
for (int i = 1; i <= posPools.size(); i++) {
|
for (int i = 1; i <= posPools.size(); i++) {
|
||||||
LuckWheelPosInfo luckWheelPosInfo = new LuckWheelPosInfo();
|
LuckWheelPosInfo luckWheelPosInfo = new LuckWheelPosInfo();
|
||||||
|
@ -90,6 +87,7 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
||||||
luckWheelPosInfo.setLuckId(luckId);
|
luckWheelPosInfo.setLuckId(luckId);
|
||||||
luckWheelMission.getPosInfoMap().put(i, luckWheelPosInfo);
|
luckWheelMission.getPosInfoMap().put(i, luckWheelPosInfo);
|
||||||
}
|
}
|
||||||
|
activityManager.putDialRewardInfo(id,luckWheelMission);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CommonProto.DialInfo getLuckWheelReward(User user, int activityId) {
|
public static CommonProto.DialInfo getLuckWheelReward(User user, int activityId) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
* Author: zsx
|
* Author: zsx
|
||||||
* CreateDate: 2019/9/23 15:13
|
* CreateDate: 2019/9/23 15:13
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class LuckWheelAdvancedActivity extends LuckWheelActivity {
|
public class LuckWheelAdvancedActivity extends LuckWheelActivity {
|
||||||
|
|
||||||
public LuckWheelAdvancedActivity(int id) {
|
public LuckWheelAdvancedActivity(int id) {
|
||||||
|
|
|
@ -598,37 +598,38 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVipInfo(int privilageId){
|
public void addVipInfo(int privilegeId){
|
||||||
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||||
if (config==null){
|
if (config==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long maxTime;
|
long maxTime;
|
||||||
VipInfo newVipInfo = new VipInfo();
|
VipInfo newVipInfo = new VipInfo();
|
||||||
if(config.getContinueTime()!=null&&config.getContinueTime().length>0){
|
if(config.getContinueTime()!=null && config.getContinueTime().length>0){
|
||||||
if(vipInfo.containsKey(privilageId)){
|
|
||||||
if(config.getContinueTime()[1]==1&&TimeUtils.nowInt()<vipInfo.get(privilageId).getEffectTime()){
|
if(vipInfo.containsKey(privilegeId)){
|
||||||
if(config.getCondition().length==1&&config.getCondition()[0][0]==0){
|
VipInfo info = vipInfo.get(privilegeId);
|
||||||
return;
|
if(config.getContinueTime()[1]==1 && TimeUtils.nowInt()< info.getEffectTime()){
|
||||||
}else{
|
boolean aBool = config.getCondition().length == 1 && config.getCondition()[0][0] == 0;
|
||||||
newVipInfo.setCount(vipInfo.get(privilageId).getCount()-config.getCondition()[0][1]);
|
if(!aBool){
|
||||||
newVipInfo.setEffectTime(vipInfo.get(privilageId).getEffectTime());
|
newVipInfo.setCount(info.getCount()-config.getCondition()[0][1]);
|
||||||
vipInfo.put(privilageId,newVipInfo);
|
newVipInfo.setEffectTime(info.getEffectTime());
|
||||||
|
vipInfo.put(privilegeId,newVipInfo);
|
||||||
updateString("vipInfo", this.vipInfo);
|
updateString("vipInfo", this.vipInfo);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
maxTime = TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime();
|
maxTime = Math.max(TimeUtils.nowInt(), info.getEffectTime());
|
||||||
maxTime = maxTime+config.getContinueTime()[0];
|
maxTime = maxTime+config.getContinueTime()[0];
|
||||||
}else {
|
}else {
|
||||||
maxTime = TimeUtils.now()/1000+config.getContinueTime()[0];
|
maxTime = TimeUtils.nowInt()+config.getContinueTime()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,0,0,true)/1000);
|
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,0,0,true)/1000);
|
||||||
|
|
||||||
newVipInfo.setEffectTime((int)maxTime);
|
newVipInfo.setEffectTime((int)maxTime);
|
||||||
}
|
}
|
||||||
this.vipInfo.put(privilageId,newVipInfo);
|
this.vipInfo.put(privilegeId,newVipInfo);
|
||||||
updateString("vipInfo", this.vipInfo);
|
updateString("vipInfo", this.vipInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,8 @@ public class UserManager {
|
||||||
playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0);
|
playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0);
|
||||||
playerManager.updateVipInfo(GlobalsDef.GOD_LV_UNLOCK,0);
|
playerManager.updateVipInfo(GlobalsDef.GOD_LV_UNLOCK,0);
|
||||||
playerManager.updateVipInfo(GlobalsDef.RENOWN_LV_UNLOCK,0);
|
playerManager.updateVipInfo(GlobalsDef.RENOWN_LV_UNLOCK,0);
|
||||||
|
playerManager.updateVipInfo(GlobalsDef.BRUSHING_LV_UNLOCK,0);
|
||||||
|
playerManager.updateVipInfo(GlobalsDef.THE_ABSOLUTE_BEGINNING_LV_UNLOCK,0);
|
||||||
playerManager.setNewRechargeInfo(new NewRechargeInfo());
|
playerManager.setNewRechargeInfo(new NewRechargeInfo());
|
||||||
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
|
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
|
||||||
playerManager.setChannel(channel);
|
playerManager.setChannel(channel);
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.ljsd.jieling.logic.item;
|
package com.ljsd.jieling.logic.item;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.Item;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
||||||
import org.springframework.data.mongodb.core.index.CompoundIndexes;
|
import org.springframework.data.mongodb.core.index.CompoundIndexes;
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
import org.springframework.data.mongodb.core.mapping.Document;
|
||||||
import org.springframework.data.mongodb.core.mapping.Field;
|
import org.springframework.data.mongodb.core.mapping.Field;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
@Document(collection="itemLog")
|
@Document(collection="itemLog")
|
||||||
@CompoundIndexes({@CompoundIndex(name = "uid_time_index", def = "{'uid': 1, 'time': 1}")})
|
@CompoundIndexes({@CompoundIndex(name = "uid_time_index", def = "{'uid': 1, 'time': 1}")})
|
||||||
|
@ -43,6 +46,17 @@ public class ItemLog {
|
||||||
this.itemTotalNum = itemTotalNum;
|
this.itemTotalNum = itemTotalNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemLog(User user, int type, int reason, Item item, long itemNum) {
|
||||||
|
this.uid = user.getId();
|
||||||
|
this.type = type;
|
||||||
|
this.level = user.getPlayerInfoManager().getLevel();
|
||||||
|
this.time = String.valueOf(TimeUtils.now());
|
||||||
|
this.reason = reason;
|
||||||
|
this.itemId = item.getItemId();
|
||||||
|
this.itemTotalNum = item.getItemNum();
|
||||||
|
this.itemNum = itemNum;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,13 +711,7 @@ public class PlayerLogic {
|
||||||
CommonProto.TeamOneInfo.Builder oneInfo = null;
|
CommonProto.TeamOneInfo.Builder oneInfo = null;
|
||||||
if(sArenaRobotConfig!=null){
|
if(sArenaRobotConfig!=null){
|
||||||
oneInfo = getYuxuRobotOneInfo(sArenaRobotConfig,info,crossTeamId);
|
oneInfo = getYuxuRobotOneInfo(sArenaRobotConfig,info,crossTeamId);
|
||||||
}else{
|
|
||||||
/*oneInfo = getUserTeamOneInfo(id, crossTeamId);
|
|
||||||
if(UserManager.getUser(id).getFriendManager().getMyApplyFriends().contains(id)){
|
|
||||||
oneInfo.setIsApplyed(1);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
//PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder().setTeamInfo(oneInfo);
|
|
||||||
if (oneInfo != null) {
|
if (oneInfo != null) {
|
||||||
return oneInfo.build();
|
return oneInfo.build();
|
||||||
}
|
}
|
||||||
|
@ -737,22 +731,10 @@ public class PlayerLogic {
|
||||||
if (crossGroup == -1) {
|
if (crossGroup == -1) {
|
||||||
return CommonProto.TeamOneInfo.newBuilder();
|
return CommonProto.TeamOneInfo.newBuilder();
|
||||||
}
|
}
|
||||||
//TODO
|
|
||||||
/*Map<Integer, Integer> groupValues = RedisUtil.getInstence().getMapValues(RedisKey.SERVER_SPLIT_INFO, "", Integer.class, Integer.class);
|
|
||||||
List<Integer> groupList = groupValues.entrySet().stream().filter(n -> n.getValue() == crossGroup).map(keyVal -> keyVal.getKey()).collect(Collectors.toList());
|
|
||||||
int server = new Random().nextInt(groupList.size());*/
|
|
||||||
|
|
||||||
CommonProto.TeamOneInfo.Builder oneInfo = CommonProto.TeamOneInfo.newBuilder()
|
CommonProto.TeamOneInfo.Builder oneInfo = CommonProto.TeamOneInfo.newBuilder()
|
||||||
.setLevel(sArenaRobotConfig.getRobotLevel())
|
.setLevel(sArenaRobotConfig.getRobotLevel())
|
||||||
.setName(sArenaRobotConfig.getRobotName())
|
.setName(sArenaRobotConfig.getRobotName())
|
||||||
.setUid(sArenaRobotConfig.getId()).setCrossTeamScore(sArenaRobotConfig.getMsScroe()).setServerName("");
|
.setUid(sArenaRobotConfig.getId()).setCrossTeamScore(sArenaRobotConfig.getMsScroe()).setServerName("");
|
||||||
|
|
||||||
//CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
|
||||||
if(sArenaRobotConfig.getDifferDemonsId()!=null){
|
|
||||||
// for(int pokenId:sArenaRobotConfig.getDifferDemonsId()){
|
|
||||||
// teamInfo.addPokemonInfos(null);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
//玉虚论道三队伍
|
//玉虚论道三队伍
|
||||||
for(int id :crossTeamId){
|
for(int id :crossTeamId){
|
||||||
int position = 1;
|
int position = 1;
|
||||||
|
@ -1438,119 +1420,166 @@ public class PlayerLogic {
|
||||||
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
|
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测特权
|
||||||
|
* @param user
|
||||||
|
* @param privilegeTypeId
|
||||||
|
* @param checkNum
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public boolean check(User user, int privilegeTypeId, int checkNum){
|
public boolean check(User user, int privilegeTypeId, int checkNum){
|
||||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
return originCheck(user,privilegeTypeId,checkNum,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测并消耗特权
|
||||||
|
* @param user
|
||||||
|
* @param privilegeTypeId
|
||||||
|
* @param updateNum
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean checkAndUpdate(User user, int privilegeTypeId, int updateNum){
|
||||||
|
return originCheck(user,privilegeTypeId,updateNum,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特权原生校验端口
|
||||||
|
* @param user
|
||||||
|
* @param privilegeTypeId
|
||||||
|
* @param updateNum
|
||||||
|
* @param operate 0:检查 1:检查并消耗
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean originCheck(User user, int privilegeTypeId, int updateNum, int operate){
|
||||||
if(privilegeTypeId == 0){
|
if(privilegeTypeId == 0){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeTypeId);
|
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeTypeId);
|
||||||
List<Integer> typePrivileges = new ArrayList<>();
|
|
||||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||||
if(!vipInfo.containsKey(config.getId())){
|
int privilegeId = config.getId();
|
||||||
|
VipInfo info = vipInfo.get(privilegeId);
|
||||||
|
if (info == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
typePrivileges.add(config.getId());
|
if(info.getEffectTime()!=0 && TimeUtils.nowInt()>info.getEffectTime()){
|
||||||
}
|
|
||||||
if(typePrivileges.isEmpty()){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for(Integer privilegeId:typePrivileges){
|
|
||||||
VipInfo info = vipInfo.get(privilegeId);
|
|
||||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int mCount = getMaxCountByPrivilege(user,privilegeId);
|
int mCount = getMaxCountByPrivilege(user,privilegeId);
|
||||||
if(mCount==-1){
|
if(mCount==-1){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.nowInt()>info.getEffectTime())){
|
if(info.getCount()+updateNum > mCount){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (operate == 1){
|
||||||
|
user.getPlayerInfoManager().updateVipPrivilage(privilegeId, updateNum);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkAndUpdate(User user, int privilegeTypeId, int updateNum){
|
/**
|
||||||
boolean check = check(user, privilegeTypeId, updateNum);
|
* 根据特权id检查并消耗特权
|
||||||
if (!check){
|
* @param user
|
||||||
|
* @param privilegeId
|
||||||
|
* @param updateNum
|
||||||
|
* @param operate 0:检查 1:检查并消耗
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean checkOrUpPrivilegeId(User user, int privilegeId, int updateNum, int operate){
|
||||||
|
if(privilegeId == 0){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
|
VipInfo info = vipInfo.get(privilegeId);
|
||||||
|
if (info == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(info.getEffectTime()!=0 && TimeUtils.nowInt()>info.getEffectTime()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int mCount = getMaxCountByPrivilege(user,privilegeId);
|
||||||
|
if(mCount == -1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(info.getCount()+updateNum > mCount){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (operate == 1){
|
||||||
|
user.getPlayerInfoManager().updateVipPrivilage(privilegeId, updateNum);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消耗完所有特权次数
|
||||||
|
* @param user
|
||||||
|
* @param privilegeTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int checkAndConsumeAllPrivilegeTimes(User user, int privilegeTypeId){
|
||||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
if(privilegeTypeId == 0){
|
if(privilegeTypeId == 0){
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeTypeId);
|
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeTypeId);
|
||||||
List<Integer> typePrivileges = new ArrayList<>();
|
|
||||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
|
||||||
if(!vipInfo.containsKey(config.getId())){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
typePrivileges.add(config.getId());
|
|
||||||
}
|
|
||||||
if(typePrivileges.isEmpty()){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for(Integer privilageId:typePrivileges){
|
|
||||||
VipInfo info = vipInfo.get(privilageId);
|
|
||||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int mCount = getMaxCountByPrivilege(user,privilageId);
|
|
||||||
if(mCount==-1){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if((info.getCount()+updateNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
user.getPlayerInfoManager().updateVipPrivilage(privilageId, updateNum);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//消耗完所有特权次数
|
|
||||||
public int checkAndConsumeAllPrivilegeTimes(User user, int privilageTypeId){
|
|
||||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
|
||||||
if(privilageTypeId == 0){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilageTypeId);
|
|
||||||
List<Integer> typePrivileges = new ArrayList<>();
|
|
||||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
|
||||||
if(!vipInfo.containsKey(config.getId())){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
typePrivileges.add(config.getId());
|
|
||||||
}
|
|
||||||
if(typePrivileges.isEmpty()){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int levelUpdateCount = 0;
|
int levelUpdateCount = 0;
|
||||||
for(Integer privilageId:typePrivileges){
|
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||||
VipInfo info = vipInfo.get(privilageId);
|
int privilegeId = config.getId();
|
||||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
VipInfo info = vipInfo.get(privilegeId);
|
||||||
|
if (info == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int mCount = getMaxCountByPrivilege(user,privilageId);
|
if(info.getEffectTime()!=0 && TimeUtils.nowInt()>info.getEffectTime()){
|
||||||
if(mCount==-1){
|
continue;
|
||||||
|
}
|
||||||
|
int mCount = getMaxCountByPrivilege(user,privilegeId);
|
||||||
|
if(mCount == -1){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(info.getCount()>= mCount){
|
if(info.getCount()>= mCount){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
int num = mCount - info.getCount();
|
||||||
continue;
|
user.getPlayerInfoManager().updateVipPrivilage(privilegeId, num);
|
||||||
}
|
|
||||||
levelUpdateCount+=mCount-info.getCount();
|
levelUpdateCount+=num;
|
||||||
user.getPlayerInfoManager().updateVipPrivilage(privilageId, mCount-info.getCount());
|
|
||||||
}
|
}
|
||||||
return levelUpdateCount;
|
return levelUpdateCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据特权类型获取相关特权的上限数量总和
|
||||||
|
* @param user
|
||||||
|
* @param privilegeType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getMaxCountByPrivilegeType(User user ,int privilegeType){
|
||||||
|
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeType);
|
||||||
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
|
int maxCount = 0;
|
||||||
|
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||||
|
int id = config.getId();
|
||||||
|
if(!vipInfo.containsKey(id)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
maxCount += getMaxCountByPrivilege(user,id);
|
||||||
|
}
|
||||||
|
return maxCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据特权id获取最大数量
|
||||||
|
* @param user
|
||||||
|
* @param privilegeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private int getMaxCountByPrivilege(User user,int privilegeId){
|
private int getMaxCountByPrivilege(User user,int privilegeId){
|
||||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
|
||||||
int mCount;
|
|
||||||
int cond = 0;
|
int cond = 0;
|
||||||
switch (sPrivilegeTypeConfig.getUnlockType()){
|
switch (sPrivilegeTypeConfig.getUnlockType()){
|
||||||
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
|
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
|
||||||
|
@ -1582,41 +1611,29 @@ public class PlayerLogic {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilegeId);
|
|
||||||
if(sPrivilegeTypeConfig.getUnlockType()==GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
||||||
mCount = condition.get(0);
|
TreeMap<Integer, Integer> condition = new TreeMap<>(conditionMap.get(privilegeId));
|
||||||
}
|
int mCount;
|
||||||
else if(sPrivilegeTypeConfig.getUnlockType()==GlobalsDef.WEEKCARD_UNLOCK){
|
switch (sPrivilegeTypeConfig.getUnlockType()){
|
||||||
if (cond == -1){
|
case GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE:
|
||||||
mCount = 0;
|
|
||||||
}else {
|
|
||||||
mCount = condition.get(0);
|
mCount = condition.get(0);
|
||||||
}
|
break;
|
||||||
}else {
|
case GlobalsDef.WEEKCARD_UNLOCK:
|
||||||
mCount = condition.floorEntry(cond).getValue();
|
mCount = cond==-1?0:condition.get(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mCount = condition.floorEntry(cond).getValue();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return mCount;
|
return mCount;
|
||||||
}
|
}
|
||||||
public int getMaxCountByPrivilegeType(User user ,int privilegeType){
|
|
||||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeType);
|
|
||||||
List<Integer> typePrivileges = new ArrayList<>();
|
|
||||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
|
||||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
|
||||||
if(!vipInfo.containsKey(config.getId())){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
typePrivileges.add(config.getId());
|
|
||||||
}
|
|
||||||
if(typePrivileges.isEmpty()){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int maxCount = 0;
|
|
||||||
for(Integer privilageId:typePrivileges){
|
|
||||||
maxCount+=getMaxCountByPrivilege(user,privilageId);
|
|
||||||
}
|
|
||||||
return maxCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取月卡信息
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
|
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
|
||||||
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
|
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
|
@ -1642,6 +1659,11 @@ public class PlayerLogic {
|
||||||
return cardInfos;
|
return cardInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理旧月卡
|
||||||
|
* @param user
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public void checkOldMonthCard(User user) throws Exception {
|
public void checkOldMonthCard(User user) throws Exception {
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
if (playerInfoManager.getOldMonthCardMark() == 1){
|
if (playerInfoManager.getOldMonthCardMark() == 1){
|
||||||
|
|
|
@ -774,7 +774,7 @@ public class ItemUtil {
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,(int)itemNum,user);
|
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,(int)itemNum,user);
|
||||||
}
|
}
|
||||||
//日志记录
|
//日志记录
|
||||||
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
|
ItemLogic.getInstance().addItemLog(new ItemLog(user,0,reason,item,itemNum));
|
||||||
}
|
}
|
||||||
//发送装备图鉴修改推送
|
//发送装备图鉴修改推送
|
||||||
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
|
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
|
||||||
|
@ -821,7 +821,7 @@ public class ItemUtil {
|
||||||
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
|
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
|
||||||
List<Integer>changeEquipList=null;
|
List<Integer>changeEquipList=null;
|
||||||
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
|
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
|
||||||
SItem sItem = SItem.getsItemMap().get (entry.getKey());
|
SItem sItem = SItem.getsItemMap().get(entry.getKey());
|
||||||
if (sItem.getItemBaseType()==6){
|
if (sItem.getItemBaseType()==6){
|
||||||
equipManager.addEquipList(entry.getKey());
|
equipManager.addEquipList(entry.getKey());
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ public class ItemUtil {
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,itemNum,user);
|
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,itemNum,user);
|
||||||
}
|
}
|
||||||
//日志记录
|
//日志记录
|
||||||
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
|
ItemLogic.getInstance().addItemLog(new ItemLog(user,0,reason,item,itemNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送装备图鉴修改推送
|
//发送装备图鉴修改推送
|
||||||
|
@ -1170,7 +1170,7 @@ public class ItemUtil {
|
||||||
myItem.setItemNum(myItem.getItemNum() - needCount);
|
myItem.setItemNum(myItem.getItemNum() - needCount);
|
||||||
KtEventUtils.onKtEvent(user, eventType,reason,GlobalsDef.subReason,myItem.getItemId(),needCount,myItem.getItemNum());
|
KtEventUtils.onKtEvent(user, eventType,reason,GlobalsDef.subReason,myItem.getItemId(),needCount,myItem.getItemNum());
|
||||||
}
|
}
|
||||||
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),1,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,myItem.getItemId(),needCount,myItem.getItemNum()));
|
ItemLogic.getInstance().addItemLog(new ItemLog(user,1,reason,myItem,needCount));
|
||||||
|
|
||||||
sendToFront.add(CBean2Proto.getItem(myItem,-1));
|
sendToFront.add(CBean2Proto.getItem(myItem,-1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class SGlobalActivity implements BaseConfig {
|
||||||
|
|
||||||
private int isOpen;
|
private int isOpen;
|
||||||
|
|
||||||
|
private int privilege;
|
||||||
|
|
||||||
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
|
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
|
||||||
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRules;
|
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRules;
|
||||||
|
|
||||||
|
@ -235,4 +237,8 @@ public class SGlobalActivity implements BaseConfig {
|
||||||
public int getIsOpen() {
|
public int getIsOpen() {
|
||||||
return isOpen;
|
return isOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPrivilege() {
|
||||||
|
return privilege;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -24,27 +24,29 @@ public class SPrivilegeTypeConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[] continueTime;
|
private int[] continueTime;
|
||||||
|
|
||||||
private static Map<Integer,SPrivilegeTypeConfig> sPrivilegeTypeConfigMap;
|
private static Map<Integer,SPrivilegeTypeConfig> sPrivilegeTypeConfigMap = new HashMap<>();
|
||||||
|
|
||||||
public static Map<Integer,Map<Integer,Map<Integer,Integer>>> conditionMap;
|
public static Map<Integer,Map<Integer,Map<Integer,Integer>>> conditionMap = new HashMap<>();
|
||||||
|
|
||||||
public static Map<Integer, List<SPrivilegeTypeConfig>> privilegeByType;
|
public static Map<Integer, List<SPrivilegeTypeConfig>> privilegeByType = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
sPrivilegeTypeConfigMap = STableManager.getConfig(SPrivilegeTypeConfig.class);
|
sPrivilegeTypeConfigMap = STableManager.getConfig(SPrivilegeTypeConfig.class);
|
||||||
conditionMap = new HashMap<>();
|
conditionMap = new HashMap<>();
|
||||||
privilegeByType = new HashMap<>();
|
privilegeByType = new HashMap<>();
|
||||||
for (Map.Entry<Integer,SPrivilegeTypeConfig> entry:sPrivilegeTypeConfigMap.entrySet()){
|
for (Map.Entry<Integer,SPrivilegeTypeConfig> entry:sPrivilegeTypeConfigMap.entrySet()){
|
||||||
privilegeByType.computeIfAbsent(entry.getValue().getPrivilegeType(),n->new ArrayList<>()).add(entry.getValue());
|
SPrivilegeTypeConfig value = entry.getValue();
|
||||||
conditionMap.computeIfAbsent(entry.getValue().getUnlockType(),n->new HashMap<>()).computeIfAbsent(entry.getKey(),n->new TreeMap<>());
|
privilegeByType.computeIfAbsent(value.getPrivilegeType(), n->new ArrayList<>()).add(value);
|
||||||
if(entry.getValue().getCondition()!=null){
|
conditionMap.computeIfAbsent(value.getUnlockType(), n->new HashMap<>()).computeIfAbsent(entry.getKey(), n->new TreeMap<>());
|
||||||
for(int[] cond:entry.getValue().getCondition()){
|
if(value.getCondition() == null){
|
||||||
if(entry.getValue().getUnlockType()==2) {
|
continue;
|
||||||
cond[0] = 10_000_000 * (cond[0] % 10) + cond[0];
|
}
|
||||||
}
|
for(int[] cond: value.getCondition()){
|
||||||
conditionMap.get(entry.getValue().getUnlockType()).get(entry.getKey()).put(cond[0],cond[1]);
|
if(value.getUnlockType()==2) {
|
||||||
|
cond[0] = 10_000_000 * (cond[0] % 10) + cond[0];
|
||||||
}
|
}
|
||||||
|
conditionMap.get(value.getUnlockType()).get(entry.getKey()).put(cond[0],cond[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue