特权修改
parent
b7a8b65530
commit
92ccef4f64
|
@ -30,6 +30,7 @@ import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
import com.ljsd.jieling.logic.rank.RankContext;
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
|
@ -2150,7 +2151,7 @@ public class MapLogic {
|
||||||
// .setRank(rank++)
|
// .setRank(rank++)
|
||||||
// .setTotalForce(userTmp.getPlayerInfoManager().getMaxForce())
|
// .setTotalForce(userTmp.getPlayerInfoManager().getMaxForce())
|
||||||
// .setHeadFrame(playerInfoManager.getHeadFrame()));
|
// .setHeadFrame(playerInfoManager.getHeadFrame()));
|
||||||
// }
|
//// }
|
||||||
// Collections.sort(mainLevelRankInfoList, new Comparator<CommonProto.MainLevelRankInfo.Builder>() {
|
// Collections.sort(mainLevelRankInfoList, new Comparator<CommonProto.MainLevelRankInfo.Builder>() {
|
||||||
// @Override
|
// @Override
|
||||||
// public int compare(CommonProto.MainLevelRankInfo.Builder o1, CommonProto.MainLevelRankInfo.Builder o2) {
|
// public int compare(CommonProto.MainLevelRankInfo.Builder o1, CommonProto.MainLevelRankInfo.Builder o2) {
|
||||||
|
@ -2164,7 +2165,7 @@ public class MapLogic {
|
||||||
// return o1.getRank()-o2.getRank();
|
// return o1.getRank()-o2.getRank();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// rank =1;
|
//// rank =1;
|
||||||
// int myRank =-1;
|
// int myRank =-1;
|
||||||
// int uid = session.getUid();
|
// int uid = session.getUid();
|
||||||
// for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
|
// for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
|
||||||
|
@ -2689,7 +2690,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
// TODO 检测重置次数
|
// TODO 检测重置次数
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
if( !playerInfoManager.check(VipPrivilegeType.TOWER_RESRT_NUM, 1)){
|
if( !PlayerLogic.getInstance().check(user,VipPrivilegeType.TOWER_RESRT_NUM, 1)){
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无重置次数"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("无重置次数"));
|
||||||
}
|
}
|
||||||
playerInfoManager.updateVipPrivilage(VipPrivilegeType.TOWER_RESRT_NUM,1);
|
playerInfoManager.updateVipPrivilage(VipPrivilegeType.TOWER_RESRT_NUM,1);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
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.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||||
|
@ -633,7 +634,7 @@ public class ActivityLogic implements IEventHandler{
|
||||||
|
|
||||||
boolean allowedFree = false;
|
boolean allowedFree = false;
|
||||||
if (randCount == 1) {
|
if (randCount == 1) {
|
||||||
allowedFree = user.getPlayerInfoManager().check(VipPrivilegeType.FREE_SECRET_RANDOM, 1);
|
allowedFree = PlayerLogic.getInstance().check(user,VipPrivilegeType.FREE_SECRET_RANDOM, 1);
|
||||||
}
|
}
|
||||||
if (!allowedFree) {
|
if (!allowedFree) {
|
||||||
int[][] mainCost = sDifferDemonsBoxSetting.getMainCost();
|
int[][] mainCost = sDifferDemonsBoxSetting.getMainCost();
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
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.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.ArenaInfoProto;
|
import com.ljsd.jieling.protocols.ArenaInfoProto;
|
||||||
|
@ -325,7 +326,7 @@ public class ArenaLogic {
|
||||||
}
|
}
|
||||||
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
|
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
|
||||||
int battleFree = sArenaSetting.getBattleFree();
|
int battleFree = sArenaSetting.getBattleFree();
|
||||||
if(!user.getPlayerInfoManager().check(battleFree,1)){
|
if(!PlayerLogic.getInstance().check(user,battleFree,1)){
|
||||||
//校验消耗
|
//校验消耗
|
||||||
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME,enemyInfo.getEnemyId());
|
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME,enemyInfo.getEnemyId());
|
||||||
if(!enough){
|
if(!enough){
|
||||||
|
|
|
@ -259,38 +259,6 @@ public class PlayerManager extends MongoBase {
|
||||||
updateString("vipInfo", vipInfo);
|
updateString("vipInfo", vipInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean check(int privilageId,int updateNum){
|
|
||||||
if(privilageId == 0){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!vipInfo.containsKey(privilageId)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
VipInfo info = vipInfo.get(privilageId);
|
|
||||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
|
||||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
|
||||||
int maxCount = 0;
|
|
||||||
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
|
||||||
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilageId);
|
|
||||||
maxCount = condition.floorEntry(level).getValue();
|
|
||||||
}
|
|
||||||
if(maxCount==-1){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if((info.getCount()+updateNum>maxCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
updateVipPrivilage(privilageId, updateNum);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkFunctionIsAllowed(int privilageId){
|
public boolean checkFunctionIsAllowed(int privilageId){
|
||||||
if(privilageId == VipPrivilegeType.UNLOCK_TRIAL_BOMB_REWARD){
|
if(privilageId == VipPrivilegeType.UNLOCK_TRIAL_BOMB_REWARD){
|
||||||
return rechargeInfo.checkOneGoodsIsOverTimeByPrivilege(privilageId);
|
return rechargeInfo.checkOneGoodsIsOverTimeByPrivilege(privilageId);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
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.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
@ -529,7 +530,7 @@ public class FriendLogic {
|
||||||
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
|
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
|
||||||
}
|
}
|
||||||
friendManager.updateGiveMap(friendId,1);
|
friendManager.updateGiveMap(friendId,1);
|
||||||
boolean check = friendUser.getPlayerInfoManager().check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(check){
|
if(check){
|
||||||
friendManager1.updateHaveRewardMap(uid,1);
|
friendManager1.updateHaveRewardMap(uid,1);
|
||||||
sendFriendStatedication(uid,friendId,2);
|
sendFriendStatedication(uid,friendId,2);
|
||||||
|
@ -547,7 +548,7 @@ public class FriendLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
friendManager.updateGiveMap(friendUserId,1);
|
friendManager.updateGiveMap(friendUserId,1);
|
||||||
boolean check = friendUser.getPlayerInfoManager().check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(check){
|
if(check){
|
||||||
friendManager1.updateHaveRewardMap(uid,1);
|
friendManager1.updateHaveRewardMap(uid,1);
|
||||||
sendFriendStatedication(uid,friendUserId,2);
|
sendFriendStatedication(uid,friendUserId,2);
|
||||||
|
@ -573,7 +574,7 @@ public class FriendLogic {
|
||||||
List<Integer> friends = friendManager.getFriends();
|
List<Integer> friends = friendManager.getFriends();
|
||||||
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
|
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
boolean check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
Set<Integer> receieveFriends = new HashSet<>();
|
Set<Integer> receieveFriends = new HashSet<>();
|
||||||
if(!check){
|
if(!check){
|
||||||
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
|
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
|
||||||
|
@ -605,7 +606,7 @@ public class FriendLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(i++>0){
|
if(i++>0){
|
||||||
check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(!check){
|
if(!check){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
@ -233,7 +234,7 @@ public class HeroLogic{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(privilege!=0){
|
if(privilege!=0){
|
||||||
allowFree = user.getPlayerInfoManager().check(privilege, 1);
|
allowFree = PlayerLogic.getInstance().check(user,privilege, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.player;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
|
||||||
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||||
|
@ -712,4 +713,48 @@ 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);
|
||||||
}
|
}
|
||||||
|
public boolean check(User user,int privilageId,int updateNum){
|
||||||
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
|
if(privilageId == 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!vipInfo.containsKey(privilageId)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
VipInfo info = vipInfo.get(privilageId);
|
||||||
|
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
||||||
|
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
||||||
|
int maxCount = 0;
|
||||||
|
int cond = 0;
|
||||||
|
switch (sPrivilegeTypeConfig.getUnlockType()){
|
||||||
|
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
|
||||||
|
cond = user.getPlayerInfoManager().getLevel();
|
||||||
|
break;
|
||||||
|
case GlobalsDef.MAIN_LEVEL_UNLOCK_PRIVILEGE:
|
||||||
|
cond = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId()).getVirtureId();
|
||||||
|
break;
|
||||||
|
case GlobalsDef.VIP_UNLOCK_PRIVILEGE:
|
||||||
|
cond = user.getPlayerInfoManager().getVipLevel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
||||||
|
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilageId);
|
||||||
|
maxCount = condition.floorEntry(cond).getValue();
|
||||||
|
}
|
||||||
|
if(maxCount==-1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if((info.getCount()+updateNum>maxCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
user.getPlayerInfoManager().updateVipPrivilage(privilageId, updateNum);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
@ -468,9 +469,9 @@ public class StoreLogic {
|
||||||
if(relatedtoVIP == 1){
|
if(relatedtoVIP == 1){
|
||||||
if(limit == 6){
|
if(limit == 6){
|
||||||
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
|
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
|
||||||
check = playerInfoManager.check(limit, goodsNum);
|
check = PlayerLogic.getInstance().check(user,limit, goodsNum);
|
||||||
}else{
|
}else{
|
||||||
check = playerInfoManager.check(limit, itemNum);
|
check = PlayerLogic.getInstance().check(user,limit, itemNum);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
check = limit > buyTimes;
|
check = limit > buyTimes;
|
||||||
|
@ -549,7 +550,7 @@ public class StoreLogic {
|
||||||
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
|
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
|
||||||
int refreshNum = playerInfoManager.getVipPrivilageValue(refreshPrivilege);
|
int refreshNum = playerInfoManager.getVipPrivilageValue(refreshPrivilege);
|
||||||
int[][] cost = getCost(refreshNum, 1,sStoreTypeConfig.getRefreshItem(),1,0,0);
|
int[][] cost = getCost(refreshNum, 1,sStoreTypeConfig.getRefreshItem(),1,0,0);
|
||||||
if(!playerInfoManager.check(refreshPrivilege,1)){
|
if(!PlayerLogic.getInstance().check(user,refreshPrivilege,1)){
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("over limmit"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("over limmit"));
|
||||||
}
|
}
|
||||||
boolean result = ItemUtil.itemCost(user, cost, BIReason.STORE_HAND_REFRESH,storeId);
|
boolean result = ItemUtil.itemCost(user, cost, BIReason.STORE_HAND_REFRESH,storeId);
|
||||||
|
|
Loading…
Reference in New Issue