vip特权刷新逻辑修改

master_dev
grimm 2024-02-22 16:42:24 +08:00
parent d122ae17b5
commit aa4cb55b7e
2 changed files with 46 additions and 43 deletions

View File

@ -69,10 +69,10 @@ public class PlayerManager extends MongoBase {
private int versionCode;//兼容版本号
private Map<Integer,Integer> guidePoints = new HashMap<>();
private final Map<Integer,Integer> guidePoints = new HashMap<>();
private Map<Integer,VipInfo> vipInfo = new HashMap<>();
private Set<Integer> vipGoodInfo = new HashSet<>();// 特权商品礼包
private final Map<Integer,VipInfo> vipInfo = new HashMap<>();
private final Set<Integer> vipGoodInfo = new HashSet<>();// 特权商品礼包
private Set<Integer> reds = new CopyOnWriteArraySet<>();
private NewRechargeInfo newRechargeInfo;
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
@ -130,7 +130,7 @@ public class PlayerManager extends MongoBase {
private Set<Integer> sysMailIds = new CopyOnWriteArraySet<>();
private Set<Integer> dailyPass = new HashSet<>();
private final Set<Integer> dailyPass = new HashSet<>();
private String maxforceHero;
@ -146,7 +146,7 @@ public class PlayerManager extends MongoBase {
* gm
* keyidvalue
*/
private Map<Integer, Integer> gmDialNum = new HashMap<>();
private final Map<Integer, Integer> gmDialNum = new HashMap<>();
private int luckAdvanceWheelLimitTime;
@ -175,9 +175,9 @@ public class PlayerManager extends MongoBase {
private boolean isGetOrderMail;
// 四灵试炼层数
private int[] fourChallenge = new int[4];
private final int[] fourChallenge = new int[4];
// 四灵试炼剩余挑战次数
private int[] fourChallengeRemainTimes = new int[4];
private final int[] fourChallengeRemainTimes = new int[4];
// 是否是首次开启四灵
private boolean openFourChallenge = false;
@ -192,9 +192,9 @@ public class PlayerManager extends MongoBase {
private boolean compareNumEndGame;
// 开启的七界层数, key 七届类型, value 最高层数
private Map<Integer,Integer> sevenWorldOpenTier = new HashMap<>();
private final Map<Integer,Integer> sevenWorldOpenTier = new HashMap<>();
// 七界试炼遗物信息,只存储激活的遗物信息, key遗物id value遗物状态0未激活1已激活
private Map<Integer,Integer> sevenWorldRelic = new HashMap<>();
private final Map<Integer,Integer> sevenWorldRelic = new HashMap<>();
private int ridingSwardNum;// 御剑行游玩次数
//周卡 key周卡idvkey天数value领取状态0未领取1已领取
@ -205,9 +205,9 @@ public class PlayerManager extends MongoBase {
private Map<Integer,ExplorerInfo> explorer = new HashMap<>(); //<teamId,队伍数据>
private List<KeyVal> exploreEvent = new ArrayList<>();//随机事件
private int exploreEventMatchDefUid;//探索事件 镜像心魔 匹配对手uid
private Map<Integer,ArchitectureInfo> architectureInfoMap = new HashMap<>();//浮生阁建筑列表
private Map<Integer,LandInfo> landInfoMap = new HashMap<>();//栖云阁地块列表
private HashSet<Integer> heroDispatchAgos = new HashSet<>();//栖云阁已派遣英雄列表
private final Map<Integer,ArchitectureInfo> architectureInfoMap = new HashMap<>();//浮生阁建筑列表
private final Map<Integer,LandInfo> landInfoMap = new HashMap<>();//栖云阁地块列表
private final HashSet<Integer> heroDispatchAgos = new HashSet<>();//栖云阁已派遣英雄列表
private Set<Integer> desireOpenHeroList = new HashSet<>();//心愿可以选择的英雄列表
// private Set<Integer> desireOpenFabaoList = new HashSet<>();//心愿可以选择的法宝列表
private final Map<Integer, Integer> desireDraw = new HashMap<>();//选择的心愿
@ -408,7 +408,7 @@ public class PlayerManager extends MongoBase {
}
public String getNameColor() {
if (nameColor == null || "".equals(nameColor)){
if (nameColor == null || nameColor.isEmpty()){
// 默认名字颜色
setNameColor("F6E1B6");
}
@ -510,10 +510,6 @@ public class PlayerManager extends MongoBase {
this.loginTime = loginTime;
}
public Map<Integer, VipInfo> getVipInfo() {
return vipInfo;
}
public Set<Integer> getHadTakeLevelBoxVip() {
return vipGoodInfo;
}
@ -523,6 +519,10 @@ public class PlayerManager extends MongoBase {
updateString("vipGoodInfo", vipGoodInfo);
}
public Map<Integer, VipInfo> getVipInfo() {
return vipInfo;
}
public void updateVipInfo(int unlockType,int condition) {
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(unlockType);
if (conditionMap == null || conditionMap.isEmpty()){
@ -566,24 +566,25 @@ public class PlayerManager extends MongoBase {
if (vipInfo.isEmpty()) {
return;
}
for (Map.Entry<Integer, VipInfo> entry : vipInfo.entrySet()) {
Integer id = entry.getKey();
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id);
if (null == sPrivilegeTypeConfig) {
continue;
}
int refreshType = sPrivilegeTypeConfig.getRefreshType()[0];
if (refreshType == 1 && entry.getValue().getCount() > 0) {
VipInfo refreshVipInfo = new VipInfo();
refreshVipInfo.setEffectTime(entry.getValue().getEffectTime());
vipInfo.put(id,refreshVipInfo);
}
}
for (Integer remove : removePrivileges) {
vipInfo.remove(remove);
}
for (Map.Entry<Integer, VipInfo> entry : vipInfo.entrySet()) {
Integer id = entry.getKey();
VipInfo info = entry.getValue();
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id);
if (sPrivilegeTypeConfig == null) {
continue;
}
int refreshType = sPrivilegeTypeConfig.getRefreshType()[0];
if (refreshType == 1 && info.getCount() > 0) {
VipInfo refreshVipInfo = new VipInfo();
refreshVipInfo.setCount(0);
refreshVipInfo.setEffectTime(info.getEffectTime());
vipInfo.put(id,refreshVipInfo);
}
}
updateString("vipInfo", vipInfo);
setHadTakeDailyBoxVip(-1);
}
public void clearVipCount(int priviliageId){
@ -619,8 +620,8 @@ public class PlayerManager extends MongoBase {
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000L,0,0,true)/1000);
newVipInfo.setEffectTime(maxTime);
}
this.vipInfo.put(privilegeId,newVipInfo);
updateString("vipInfo", this.vipInfo);
vipInfo.put(privilegeId,newVipInfo);
updateString("vipInfo", vipInfo);
}
/**

View File

@ -350,30 +350,32 @@ public class PlayerLogic {
int nowInt = TimeUtils.nowInt();
Map<Integer, VipInfo> vipInfo = playerInfoManager.getVipInfo();
for(Map.Entry<Integer,VipInfo> vipInfoItem : vipInfo.entrySet()){
Integer key = vipInfoItem.getKey();
VipInfo info = vipInfoItem.getValue();
//如果这个权限是活动 且永久了 那么需要修复
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(vipInfoItem.getKey());
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(key);
if (config == null){
LOGGER.info("特权刷新删除日志1{}-{}-{}",user.getId(),vipInfoItem.getKey(),vipInfoItem.getValue().getEffectTime());
removePrivileges.add(vipInfoItem.getKey());
LOGGER.info("特权刷新删除日志1{}-{}-{}",user.getId(), key, info.getEffectTime());
removePrivileges.add(key);
continue;
}
if(vipInfoItem.getValue().getEffectTime() == 0){
if(info.getEffectTime() == 0){
int unlockType = config.getUnlockType();
if(unlockType==5 || (unlockType==4 && config.getContinueTime().length>0)){
playerInfoManager.addVipByTime(vipInfoItem.getKey(), nowInt);
playerInfoManager.addVipByTime(key, nowInt);
}
}
else if(vipInfoItem.getValue().getEffectTime() <= nowInt){
else if(info.getEffectTime() <= nowInt){
if(config.getPrivilegeType() == VipPrivilegeType.ADVENTURE_BASE_REWARD){
CombatLogic.getInstance().getNewAdventureReward(user,true,vipInfoItem.getValue().getEffectTime());
CombatLogic.getInstance().getNewAdventureReward(user,true, info.getEffectTime());
}
removePrivileges.add(vipInfoItem.getKey());
LOGGER.info("特权刷新删除日志2{}-{}-{}",user.getId(),vipInfoItem.getKey(),vipInfoItem.getValue().getEffectTime());
removePrivileges.add(key);
LOGGER.info("特权刷新删除日志2{}-{}-{}",user.getId(), key, info.getEffectTime());
}
}
playerInfoManager.vipFlush(removePrivileges);
playerInfoManager.setHadTakeDailyBoxVip(-1);
// vip刷新后才能发给前端
if(fBuilder != null){
List<CommonProto.Privilege> privilegeList = new ArrayList<>();