vip校验方法名称修改

back_recharge
wangyuan 2020-01-07 19:24:55 +08:00
parent 9593490df6
commit a0fe74fa22
45 changed files with 5546 additions and 614 deletions

View File

@ -357,8 +357,8 @@ public class InvalidOperException extends TException implements org.apache.thrif
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -420,7 +420,7 @@ public class InvalidOperException extends TException implements org.apache.thrif
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}

View File

@ -914,8 +914,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -985,7 +985,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1232,8 +1232,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -1277,7 +1277,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1664,8 +1664,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -1737,7 +1737,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1993,8 +1993,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -2038,7 +2038,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -2326,8 +2326,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -2381,7 +2381,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -2600,8 +2600,8 @@ public class RPCMatchNotifyIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -2645,7 +2645,7 @@ public class RPCMatchNotifyIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}

View File

@ -708,8 +708,8 @@ public class RPCRequestIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -771,7 +771,7 @@ public class RPCRequestIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1090,8 +1090,8 @@ public class RPCRequestIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
if (success != null) {
success.validate();
}
@ -1147,7 +1147,7 @@ public class RPCRequestIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1532,8 +1532,8 @@ public class RPCRequestIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -1595,7 +1595,7 @@ public class RPCRequestIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
@ -1914,8 +1914,8 @@ public class RPCRequestIFace {
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
if (success != null) {
success.validate();
}
@ -1971,7 +1971,7 @@ public class RPCRequestIFace {
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}

View File

@ -349,8 +349,8 @@ public class Result implements org.apache.thrift.TBase<Result, Result._Fields>,
}
public void validate() throws TException {
// check for required fields
// check for sub-struct validity
// checkAndUpdate for required fields
// checkAndUpdate for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@ -412,7 +412,7 @@ public class Result implements org.apache.thrift.TBase<Result, Result._Fields>,
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
// checkAndUpdate for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}

View File

@ -10,6 +10,7 @@ public enum FightType {
BloodyFight(7), // 血战
MonterFight(8), // 兽潮
TOPFight(9), // 巅峰赛
GuildBossFight(10), // 工会boss
;

View File

@ -264,6 +264,9 @@ function BattleMain.Execute(args, fightData, optionData)
else
resultList.result = BattleLogic.Result
end
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate
--print("result:"..BattleLogic.Result)
addBattleData()

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.core;
import com.ljsd.jieling.core.function.ArenaFunction;
import com.ljsd.jieling.core.function.ChampionFunction;
import com.ljsd.jieling.core.function.EndlessFunction;
import com.ljsd.jieling.core.function.GuildBossFunction;
import com.ljsd.jieling.protocols.MessageTypeProto;
import java.util.HashMap;
@ -54,6 +55,7 @@ public enum FunctionIdEnum {
MessageTypeProto.MessageType.SOUL_RAND_EQUIP_REQUEST_VALUE,
MessageTypeProto.MessageType.SOUL_FORCE_RAND_EQUIP_REQUEST_VALUE),
TopBattle(57,new ChampionFunction()),
GuildBossFight(62,new GuildBossFunction()),
WorkShopTech(101,null,MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE),
WorkShopCreateEquip(102,null),
WorkShopCreateProtectEquip(103,null),
@ -61,7 +63,7 @@ public enum FunctionIdEnum {
;
private int functionId;
private int functionType;
private FunctionManager manager;
private int[] protos;
private static Map<Integer,FunctionIdEnum> functionIdEnumMap = new HashMap<>();
@ -69,20 +71,20 @@ public enum FunctionIdEnum {
static {
FunctionIdEnum[] values = FunctionIdEnum.values();
for(FunctionIdEnum functionIdEnum : values){
functionIdEnumMap.put(functionIdEnum.getFunctionId(),functionIdEnum);
functionIdEnumMap.put(functionIdEnum.getFunctionType(),functionIdEnum);
for(int proto:functionIdEnum.getProtos()){
protoMap.put(proto,functionIdEnum);
}
}
}
private FunctionIdEnum(int functionId, FunctionManager manager,int... protos) {
FunctionIdEnum(int functionType, FunctionManager manager,int... protos) {
this.manager = manager;
this.functionId = functionId;
this.functionType = functionType;
this.protos = protos;
}
public int getFunctionId() {
return functionId;
public int getFunctionType() {
return functionType;
}
public FunctionManager getManager() {

View File

@ -84,7 +84,8 @@ public interface GlobalsDef {
//队伍
int TEAM_ARENA_DEFENSE =101;
int BLOODY_TEAM =701; //血战队伍
int CHAMPION_ATTACK_TEAM =801; //血战队伍
int CHAMPION_ATTACK_TEAM =801; //
int GUILD_BOSS_TEAM =901; //工会boss队伍
//特权解锁类型
int LEVEL_UNLOCK_PRIVILEGE = 1;

View File

@ -231,7 +231,7 @@ public class HandlerLogicThread extends Thread{
if(enumByProto==null){
return true;
}
SGlobalSystemConfig sGlobalSystemConfig = sGlobalSystemConfigMap.get(enumByProto.getFunctionId());
SGlobalSystemConfig sGlobalSystemConfig = sGlobalSystemConfigMap.get(enumByProto.getFunctionType());
return checkOpen(user,sGlobalSystemConfig);
} catch (Exception e) {
e.printStackTrace();

View File

@ -38,5 +38,8 @@ public interface VipPrivilegeType {
int UNLOCK_STAR_EXTRA_REWARD = 506;
int UNLOCK_TRIAL_BOMB_REWARD = 507;
int GUILD_BOSS_CHALLENGE_TIMES = 37; //公会boss挑战次数
int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡
}

View File

@ -0,0 +1,28 @@
package com.ljsd.jieling.core.function;
import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import config.SGuildBossConfig;
import manager.STableManager;
import java.util.Map;
public class GuildBossFunction implements FunctionManager {
@Override
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
int times = timeControllerOfFunction.getTimes();
Map<Integer, SGuildBossConfig> config = STableManager.getConfig(SGuildBossConfig.class);
int id = times%config.size();
if(id == 0){
id = config.size();
}
GuildFightLogic.updateGuildBossInfo(config.get(id));
}
@Override
public void closeAction() throws Exception {
GuildFightLogic.updateGuildBossInfo(null);
}
}

View File

@ -87,7 +87,10 @@ public class RedisKey {
public static final String LEVE_DIFFICULTY_INFO = "LEVE_DIFFICULTY_INFO";
public static final String CHALLENGE_MONSTER_INFO = "CHALLENGE_MONSTER_INFO";
public static final String GUILD_MONSTER_INFO = "GUILD_MONSTER_INFO";
public static final String LEVE_DIFFICULTY_FIGHT = "LEVE_DIFFICULTY_FIGHT";
public static final String GUILD_MONSTER_FIGHT = "GUILD_MONSTER_FIGHT";
public static final String SUDDLENLY_FIGHT = "SUDDLENLY_FIGHT";
public static final String CHALLENGE_MONSTER_ATTACK = "CHALLENGE_MONSTER_ATTACK";

View File

@ -101,6 +101,9 @@ public interface BIReason {
int CHAMPIION_BET_WIN_REWARD = 60 ; // 巅峰赛竞猜赢取
int GUILD_BOSS_FIGHT_BASE_REWARD = 61;//工会boss基础奖励
int GUILD_BOSS_FIGHT_RANDOM_REWARD = 62;//工会boss随机奖励
int CHAMPIONM_EXCHANGE_REWARD = 1050;//巅峰赛兑换奖励

View File

@ -31,7 +31,7 @@ public class SignInHandler extends BaseHandler {
int index = signInRequest.getDayIndex();
SSignInConfig sign = SSignInConfig.getsSignInConfigMap().get(index);
//check cfg
//checkAndUpdate cfg
if (sign == null) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}

View File

@ -54,7 +54,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(proto.getActivityId());
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());
int reson = sGlobalActivity.getType() == 30 ? BIReason.LUCK_WHEEL : BIReason.LUCK_WHEEL_ADVANCE;
//check cost
//checkAndUpdate cost
LuckWheelMission luckWheelMission = user.getActivityManager().getLuckWheel(sGlobalActivity.getType());
int[][] costmap = proto.getRepeated() ? sDialRewardSetting.getMultipleCostItem() : sDialRewardSetting.getCostItem();

View File

@ -45,7 +45,7 @@ public class RefreshLuckWheelRequestHandler extends BaseHandler<PlayerInfoProto.
}
//check cost
//checkAndUpdate cost
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(proto.getActivityId());
int reson = sGlobalActivity.getType()==30? BIReason.LUCK_WHEEL: BIReason.LUCK_WHEEL_ADVANCE;
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());

View File

@ -2,7 +2,6 @@ package com.ljsd.jieling.handler.map;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -43,7 +42,6 @@ import config.*;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
@ -2690,7 +2688,7 @@ public class MapLogic {
}
// TODO 检测重置次数
PlayerManager playerInfoManager = user.getPlayerInfoManager();
if( !PlayerLogic.getInstance().check(user,VipPrivilegeType.TOWER_RESRT_NUM, 1)){
if( !PlayerLogic.getInstance().checkAndUpdate(user,VipPrivilegeType.TOWER_RESRT_NUM, 1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("无重置次数"));
}
mapManager.setTower(MathUtils.resetMethod(mapManager.getHighestTower()));

View File

@ -4,6 +4,7 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.FightInfoProto;
@ -38,7 +39,7 @@ public class FightEndRequestHandler extends BaseHandler {
}else if(type == 6){
MapLogic.getInstance().endMainLevelFight(iSession, frames,fightId,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
}else if(type == 7){
GuildFightLogic.endBossFight(iSession,frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
} else {
// MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.FightInfoProto;
@ -68,7 +69,7 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
}else if(type == 6){
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
} else if(type == 7){
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
GuildFightLogic.startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else {
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong:" + type));
}

View File

@ -26,6 +26,8 @@ public class SweepRightRequestHandler extends BaseHandler{
int targetItemNum = sweepRightRequest.getTargetItemNum();
if (type == 1){ //关卡扫荡
SweepLogic.getInstance().sweepFight(iSession,fightId,sweepTimes,targetItemId,targetItemNum, MessageTypeProto.MessageType.SWEEP_RIGHT_RESPONSE);
}else if(type == 2){ // 工会boss扫荡
}
}
}

View File

@ -32,7 +32,7 @@ public class UpdateQuestionRequestHandler extends BaseHandler<PlayerInfoProto.up
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
if (user.getQuestionManager().getQuestId() != 0) {
//check
//checkAndUpdate
GlobalSystemControl globalSystemControl = GlobalSystemControl.getGlobalSystemControl();
Question question =globalSystemControl.getQuestionMap(String.valueOf(user.getQuestionManager().getQuestId()));
if (null == question) {

View File

@ -2,12 +2,10 @@ package com.ljsd.jieling.logic;
import com.ljsd.GameApplication;
import com.ljsd.IManager;
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
import com.ljsd.jieling.config.json.KTSDKConstans;
import com.ljsd.jieling.config.json.ServerProperties;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.function.FunctionContext;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.handler.map.MapLogic;
@ -16,7 +14,6 @@ import com.ljsd.jieling.logic.activity.FightMainEventHandler;
import com.ljsd.jieling.logic.activity.RemoveEventHeroHandler;
import com.ljsd.jieling.logic.activity.UserLevelEventHandler;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.blood.BloodLogic;
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
import com.ljsd.jieling.logic.dao.ServerConfig;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
@ -36,7 +33,6 @@ import com.ljsd.jieling.netty.cocdex.Tea;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.thread.task.RPCGmServerTask;
@ -49,9 +45,6 @@ import config.SGlobalSystemConfig;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Query;
import util.TimeUtils;
import java.util.*;
@ -93,7 +86,7 @@ public class GlobalDataManaager implements IManager {
Map<Integer, SGlobalSystemConfig> sGlobalSystemConfigMap = STableManager.getConfig(SGlobalSystemConfig.class);
for(Map.Entry<Integer,TimeControllerOfFunction> item : openTimeOfFuntionCache.entrySet()){
SGlobalSystemConfig sGlobalSystemConfig = sGlobalSystemConfigMap.get(item.getKey());
if(sGlobalSystemConfig.getIsIDdSame() == functionIdEnum.getFunctionId()){
if(sGlobalSystemConfig.getIsIDdSame() == functionIdEnum.getFunctionType()){
return item.getValue();
}
}
@ -229,8 +222,8 @@ public class GlobalDataManaager implements IManager {
if(timeControllerOfFunction != null){
ArenaLogic.getInstance().updateArenaSeason(timeControllerOfFunction.getTimes());
}
if(globalSystemControl.getTimeControllerOfFunctionMap().containsKey(FunctionIdEnum.Endless.getFunctionId())){
MapLogic.getInstance().updateEndlessSeason(globalSystemControl.getTimeControllerOfFunctionMap().get(FunctionIdEnum.Endless.getFunctionId()).getTimes());
if(globalSystemControl.getTimeControllerOfFunctionMap().containsKey(FunctionIdEnum.Endless.getFunctionType())){
MapLogic.getInstance().updateEndlessSeason(globalSystemControl.getTimeControllerOfFunctionMap().get(FunctionIdEnum.Endless.getFunctionType()).getTimes());
MapLogic.setEndlessMapId(getEndleeMapIdByLevel());
}
@ -407,6 +400,6 @@ public class GlobalDataManaager implements IManager {
}
public TimeControllerOfFunction getOpenTimeOfFuntionCacheByType(FunctionIdEnum functionIdEnum ) {
return openTimeOfFuntionCache.get(functionIdEnum.getFunctionId());
return openTimeOfFuntionCache.get(functionIdEnum.getFunctionType());
}
}

View File

@ -118,12 +118,12 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
public boolean takeReward(ISession session, int missionId) throws Exception {
User user = UserManager.getUser(session.getUid());
//check cfg
//checkAndUpdate cfg
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
if (sActivityRewardConfig == null || sActivityRewardConfig.getActivityId() != id) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
//check state
//checkAndUpdate state
ActivityManager activityManager = user.getActivityManager();
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
@ -133,7 +133,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
throw new ErrorCodeException(ErrorCode.newDefineCode("活动奖励已经领取"));
}
//take rewards check
//take rewards checkAndUpdate
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
LOGGER.error("the uid={} the misionId={},the missionProgress={},the require is={} ", session.getUid(), sActivityRewardConfig.getId(), activityProgressInfo.getProgrss(), sActivityRewardConfig.getValues());
throw new ErrorCodeException(ErrorCode.newDefineCode("未达到领取条件"));
@ -189,7 +189,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
for (SActivityRewardConfig sActivityRewardConfig : cfgs) {
misssIds.add(sActivityRewardConfig.getId());
}
//check state
//checkAndUpdate state
ActivityManager activityManager = user.getActivityManager();
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
@ -198,7 +198,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
boolean isTake = false;
for (Integer missionId : misssIds) {
//check cfg
//checkAndUpdate cfg
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
if (sActivityRewardConfig == null || sActivityRewardConfig.getActivityId() != id) {
continue;
@ -207,7 +207,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
continue;
}
//take rewards check
//take rewards checkAndUpdate
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
continue;
}

View File

@ -16,8 +16,6 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -671,7 +669,7 @@ public class ActivityLogic implements IEventHandler{
boolean allowedFree = false;
if (randCount == 1) {
allowedFree = PlayerLogic.getInstance().check(user,VipPrivilegeType.FREE_SECRET_RANDOM, 1);
allowedFree = PlayerLogic.getInstance().checkAndUpdate(user,VipPrivilegeType.FREE_SECRET_RANDOM, 1);
}
if (!allowedFree) {
int[][] mainCost = sDifferDemonsBoxSetting.getMainCost();

View File

@ -108,7 +108,7 @@ class ExpectRankActivity extends AbstractActivity {
}
}
//check value
//checkAndUpdate value
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
//sendmail

View File

@ -108,7 +108,7 @@ class ForceRankActivity extends AbstractActivity {
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
continue;
}
//check value
//checkAndUpdate value
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
int[][] values = sActivityRewardConfig.getValues();
if (values[0].length < 3) {

View File

@ -117,7 +117,7 @@ public class LimitRandomCardActivity extends AbstractActivity {
}
}
//check value
//checkAndUpdate value
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
//sendmail

View File

@ -60,7 +60,7 @@ public class LuckyCatActivity extends AbstractActivity {
private void takeLuckCatReward(ISession session, User user) throws Exception {
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
//check activity
//checkAndUpdate activity
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
}
@ -71,7 +71,7 @@ public class LuckyCatActivity extends AbstractActivity {
throw/**/ new ErrorCodeException(ErrorCode.newDefineCode("had taked"));
}
//check cfg
//checkAndUpdate cfg
SLuckyCatConfig sLuckyRewardConfig = SLuckyCatConfig.configMap.get(missionId);
if (sLuckyRewardConfig == null || sLuckyRewardConfig.getActivityId() != id) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
@ -84,7 +84,7 @@ public class LuckyCatActivity extends AbstractActivity {
if (activityProgressInfo.getProgrss() >= SLuckyCatConfig.getMiss2time(missionId)) {
throw new ErrorCodeException(ErrorCode.newDefineCode("had taked"));
}
//check cost
//checkAndUpdate cost
int[][] cost = new int[1][];
int[] temp = new int[2];
temp[0] = sLuckyRewardConfig.getLuckyType();

View File

@ -3,7 +3,6 @@ package com.ljsd.jieling.logic.arena;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey;
@ -37,7 +36,6 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.*;
import config.*;
import manager.STableManager;
import org.luaj.vm2.LuaValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
@ -46,7 +44,6 @@ import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.concurrent.ExecutionException;
public class ArenaLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(ArenaLogic.class);
@ -326,7 +323,7 @@ public class ArenaLogic {
}
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
int battleFree = sArenaSetting.getBattleFree();
if(!PlayerLogic.getInstance().check(user,battleFree,1)){
if(!PlayerLogic.getInstance().checkAndUpdate(user,battleFree,1)){
//校验消耗
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME,enemyInfo.getEnemyId());
if(!enough){

View File

@ -14,6 +14,7 @@ public class GuildMyInfo extends MongoBase {
private int curPos=STableManager.getFigureConfig(CommonStaticConfig.class).getInitPos();//当前位置
private long preMoveTimestamp; //上次更新时间
private int maxBossHurt; //工会boss最高伤害
private int lastHurt; //上一次伤害
public void clearOfLevelGuild(){
path.clear();
curPos = STableManager.getFigureConfig(CommonStaticConfig.class).getInitPos();
@ -84,6 +85,15 @@ public class GuildMyInfo extends MongoBase {
this.maxBossHurt = maxBossHurt;
}
public int getLastHurt() {
return lastHurt;
}
public void setLastHurt(int lastHurt) {
updateString("lastHurt",lastHurt);
this.lastHurt = lastHurt;
}
public List<Integer> getPath() {
return path;
}

View File

@ -2,11 +2,14 @@ package com.ljsd.jieling.logic.family;
import com.ljsd.GameApplication;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
import com.ljsd.jieling.ktbeans.KTGameType;
@ -23,6 +26,7 @@ import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.Family;
@ -34,15 +38,14 @@ import com.ljsd.jieling.util.*;
import config.SGuildLevelConfig;
import config.*;
import manager.STableManager;
import org.luaj.vm2.LuaValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.stream.Collectors;
import static config.SGuildSetting.sGuildSetting;
@ -58,6 +61,9 @@ public class GuildFightLogic {
private static int roundStartTime;
private static int roundEndTime;
private static SGuildBossConfig curSGuildBossConfig; // 为null代表关闭
public static int getStatus() {
return status;
}
@ -1035,35 +1041,74 @@ public class GuildFightLogic {
}
public static void startFight(ISession session) throws Exception {
public static void startFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
if(curSGuildBossConfig == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int uid = session.getUid();
User user = UserManager.getUser(uid);
int teamId = 901;
int teamId = GlobalsDef.GUILD_BOSS_TEAM;
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
}
boolean check = PlayerLogic.getInstance().check(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
if(!check){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType, KTGameType.CHALLENGE_GUILD_BOSS.getIndex(),1);
user.getTeamPosManager().setCurTeamPosId(teamId);
String fightInfo = 1 + "#" + teamId;
String key = RedisKey.getKey(RedisKey.LEVE_DIFFICULTY_INFO, String.valueOf(uid), false);
int monsterId = curSGuildBossConfig.getMonsterId();
String fightInfo =Integer.toString(monsterId);
String key = RedisKey.getKey(RedisKey.GUILD_MONSTER_INFO, String.valueOf(uid), false);
RedisUtil.getInstence().set(key, fightInfo, -1);
//扣除预先道具
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
/* BehaviorUtil.getLevelDifficultyifficuFightInfo(user, FightType.StoryFight,sMainLevelConfig.getMonsterGroup(), teamId, sMainLevelConfig.getRankTime(), fightStartResponse, RedisKey.LEVE_DIFFICULTY_FIGHT);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);*/
BehaviorUtil.getLevelDifficultyifficuFightInfo(user, FightType.GuildBossFight,monsterId, teamId, 90, fightStartResponse, RedisKey.GUILD_MONSTER_FIGHT);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
}
public static void endBossFight(ISession session){
public static void endBossFight(ISession session,String frames, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
String fightKey = RedisKey.getKey(RedisKey.GUILD_MONSTER_INFO, String.valueOf(uid), false);
String fightInfos = (String) RedisUtil.getInstence().get(fightKey);
if (StringUtil.isEmpty(fightInfos)) {
LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
FightEvent fightEvent = new FightEvent(uid, -1, 90,frames, GameFightType.GuildBossFight);
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
//校验结果码 1胜利
int[] checkResult = fightResult.getCheckResult();
int myHurt = 1000;
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
user.getGuildMyInfo().setMaxBossHurt(myHurt);
}
user.getGuildMyInfo().setLastHurt(myHurt);
SGuildBossRewardConfig sGuildBossRewardConfig = SGuildBossRewardConfig.getIndexByHurt(myHurt);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sGuildBossRewardConfig.getReward(), 1, 0, BIReason.GUILD_BOSS_FIGHT_BASE_REWARD);
CommonProto.Drop.Builder randomDrop = ItemUtil.drop(user, sGuildBossRewardConfig.getReward(), 1, 0, BIReason.GUILD_BOSS_FIGHT_RANDOM_REWARD);
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
fightEndResponse.setEnventDrop(drop);
fightEndResponse.setMissionDrop(randomDrop);
fightEndResponse.setEssenceValue(myHurt);
fightEndResponse.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
}
public static void main(String[] args) {
Random random = new Random();
long seed = System.currentTimeMillis();
random.setSeed(seed);
public static void updateGuildBossInfo(SGuildBossConfig sGuildBossConfig){
curSGuildBossConfig = sGuildBossConfig;
}
public static SGuildBossConfig getCurSGuildBossConfig() {
return curSGuildBossConfig;
}
}

View File

@ -63,7 +63,7 @@ public class GuildLogic {
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
Family.GetFamilyInfoResponse.Builder builder = Family.GetFamilyInfoResponse.newBuilder()
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, getMemberType(uid, guildInfo.getMembers())));
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, getMemberType(uid, guildInfo.getMembers()))).setGuildBossId(GuildFightLogic.getCurSGuildBossConfig() == null?0:GuildFightLogic.getCurSGuildBossConfig().getId());
for(Set<Integer> members : guildInfo.getMembers().values()){
for(int uidOfMember : members){

View File

@ -31,7 +31,6 @@ import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.*;
import config.*;
@ -209,7 +208,7 @@ public class CombatLogic {
}else{
String err ="";
if(position == 0){
if(!PlayerLogic.getInstance().check(user,VipPrivilegeType.FAST_MAP_LIMIT,1)) {
if(!PlayerLogic.getInstance().checkAndUpdate(user,VipPrivilegeType.FAST_MAP_LIMIT,1)) {
err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10008,1);
}
}else{

View File

@ -38,6 +38,8 @@ public enum GameFightType {
GuildFight(FightType.GuildFight,new PVPFightHandler(),null),
GuildBossFight(FightType.GuildBossFight,new DefaultOfRedisCacheFightHandler(),RedisKey.GUILD_MONSTER_FIGHT),
;

View File

@ -9,7 +9,6 @@ public class DefaultOfRedisCacheFightHandler implements IFightEventProcesor {
@Override
public FightResult process(FightEvent fightEvent) throws Exception {
System.out.println(this);
int[] fightResult = FightUtil.getFightFromRedis(fightEvent);
return FightResult.newBuilder().setCheckResult(fightResult).build();
}

View File

@ -1,21 +1,18 @@
package com.ljsd.jieling.logic.friend;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.FriendManager;
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.mission.GameEvent;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
@ -530,7 +527,7 @@ public class FriendLogic {
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
}
friendManager.updateGiveMap(friendId,1);
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(check){
friendManager1.updateHaveRewardMap(uid,1);
sendFriendStatedication(uid,friendId,2);
@ -548,7 +545,7 @@ public class FriendLogic {
continue;
}
friendManager.updateGiveMap(friendUserId,1);
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(check){
friendManager1.updateHaveRewardMap(uid,1);
sendFriendStatedication(uid,friendUserId,2);
@ -574,7 +571,7 @@ public class FriendLogic {
List<Integer> friends = friendManager.getFriends();
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
Set<Integer> receieveFriends = new HashSet<>();
if(!check){
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
@ -606,7 +603,7 @@ public class FriendLogic {
continue;
}
if(i++>0){
check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(!check){
break;
}

View File

@ -5,7 +5,6 @@ import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
@ -41,7 +40,6 @@ import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class HeroLogic{
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
@ -233,7 +231,7 @@ public class HeroLogic{
break;
}
if(privilege!=0){
allowFree = PlayerLogic.getInstance().check(user,privilege, perCount);
allowFree = PlayerLogic.getInstance().checkAndUpdate(user,privilege, perCount);
}
if(!allowFree){
boolean enoughCost = false;
@ -568,7 +566,7 @@ public class HeroLogic{
}
}
int size = pokemonoIds.size();
// boolean allowed = user.getPlayerInfoManager().check(VipPrivilegeType.POKEMON_NUM, size);
// boolean allowed = user.getPlayerInfoManager().checkAndUpdate(VipPrivilegeType.POKEMON_NUM, size);
boolean allowed =checkPokeManPos(user,size);
if(!allowed){
return "now allowd";
@ -1603,8 +1601,8 @@ public class HeroLogic{
currentType.put(entry.getKey(),cfg.getType());
}
}
//check same type
//check pos 开启
//checkAndUpdate same type
//checkAndUpdate pos 开启
//条件不足 放过
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
if (!checkPosAccess(soulEquipPos.getPosition(), user, hero)) {

View File

@ -337,7 +337,7 @@ public class WorkShopLogic {
public void createEquipByUser(ISession session,int equipTid, List<Integer> runneIdsList,int nums) throws Exception {
int uid=session.getUid();
User user = UserManager.getUser(uid);
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Adventure.getFunctionId());
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Adventure.getFunctionType());
if (!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
throw new ErrorCodeException(ErrorCode.newDefineCode("未开"));
}

View File

@ -715,7 +715,7 @@ public class PlayerLogic {
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
public boolean check(User user,int privilageTypeId,int updateNum){
public boolean checkAndUpdate(User user, int privilageTypeId, int updateNum){
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
if(privilageTypeId == 0){
return true;
@ -748,6 +748,39 @@ public class PlayerLogic {
}
return false;
}
public boolean check(User user, int privilageTypeId, int checkNum){
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
if(privilageTypeId == 0){
return true;
}
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 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()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
continue;
}
return true;
}
return false;
}
public int getMaxCountByPrivilege(User user,int privilegeId){
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());

View File

@ -1,8 +1,6 @@
package com.ljsd.jieling.logic.store;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
@ -16,7 +14,6 @@ import com.ljsd.jieling.logic.activity.event.GoldEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.*;
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.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
@ -477,9 +474,9 @@ public class StoreLogic {
if(relatedtoVIP == 1){
if(limit == 6){
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
check = PlayerLogic.getInstance().check(user,limit, goodsNum);
check = PlayerLogic.getInstance().checkAndUpdate(user,limit, goodsNum);
}else{
check = PlayerLogic.getInstance().check(user,limit, itemNum);
check = PlayerLogic.getInstance().checkAndUpdate(user,limit, itemNum);
}
}else{
check = limit > buyTimes;
@ -558,7 +555,7 @@ public class StoreLogic {
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
int refreshNum = playerInfoManager.getVipPrivilageValue(refreshPrivilege);
int[][] cost = getCost(refreshNum, 1,sStoreTypeConfig.getRefreshItem(),1,0,0);
if(!PlayerLogic.getInstance().check(user,refreshPrivilege,1)){
if(!PlayerLogic.getInstance().checkAndUpdate(user,refreshPrivilege,1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("over limmit"));
}
boolean result = ItemUtil.itemCost(user, cost, BIReason.STORE_HAND_REFRESH,storeId);

View File

@ -445,6 +445,7 @@ public class CBean2Proto {
.setSoulForce(HeroLogic.getInstance().calTeamTotalForce(user,1,true))
.setHead(user.getPlayerInfoManager().getHead())
.setFrame(user.getPlayerInfoManager().getHeadFrame())
.setMaxBossHurt(user.getGuildMyInfo().getMaxBossHurt())
.build();
}

View File

@ -70,7 +70,7 @@ public class SGuildSetting implements BaseConfig {
public static SGuildSetting sGuildSetting;
private int bossTime;
private int[] bossTime;
private int[][] bossReward;