From 50e9aee15971da1d138e049f4135dca492e60253 Mon Sep 17 00:00:00 2001 From: zhangshanxue Date: Sun, 29 Dec 2019 17:24:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Task=20=E3=80=90ID1005360=E3=80=91=20?= =?UTF-8?q?=E3=80=90=E8=BE=BE=E4=BA=BA=E6=B4=BB=E5=8A=A8=E3=80=91=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AF=BB=E5=AE=9D=E8=BE=BE=E4=BA=BA=E7=AD=894?= =?UTF-8?q?=E9=A1=B9=E8=BE=BE=E4=BA=BA=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/logic/activity/ActivityLogic.java | 1 + .../jieling/logic/activity/ActivityType.java | 5 ++ .../logic/activity/ActivityTypeEnum.java | 4 ++ .../HeroRandomExpectRankActivity.java | 27 ++++++++ .../activity/LuckWheelExpectRankActivity.java | 29 +++++++++ .../MissSearchExpectRankActivity.java | 63 +++++++++++++++++++ .../activity/SecurtBoxExpectRankActivity.java | 27 ++++++++ .../logic/activity/event/HeroRandomEvent.java | 21 +++++++ .../activity/event/MissingRoomBestEvent.java | 8 ++- .../logic/activity/event/SecretBoxEvent.java | 23 +++++++ .../ljsd/jieling/logic/hero/HeroLogic.java | 7 +-- .../jieling/logic/mission/MissionLoigc.java | 2 +- .../jieling/logic/player/PlayerLogic.java | 7 +++ .../src/main/java/config/SPlayerRole.java | 44 +++++++++++++ 14 files changed, 262 insertions(+), 6 deletions(-) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/HeroRandomExpectRankActivity.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LuckWheelExpectRankActivity.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/MissSearchExpectRankActivity.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/SecurtBoxExpectRankActivity.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/HeroRandomEvent.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/SecretBoxEvent.java create mode 100644 tablemanager/src/main/java/config/SPlayerRole.java diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityLogic.java index 52225078d..557aa63b0 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityLogic.java @@ -659,6 +659,7 @@ public class ActivityLogic implements IEventHandler{ PlayerInfoProto.SecretBoxRandomResponse build = PlayerInfoProto.SecretBoxRandomResponse.newBuilder().setDrop(drop).setExtrarReward(extraDrop).build(); MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE, build, true); user.getUserMissionManager().onGameEvent(user, GameEvent.SECRETBOX, id, randCount); + Poster.getPoster().dispatchEvent(new SecretBoxEvent(uid,randCount)); } private int[] getSecretBoxRewardByPool(int secretBoxRandomPool) { diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityType.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityType.java index 168034a8c..2780466b9 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityType.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityType.java @@ -50,6 +50,11 @@ public interface ActivityType { int NEW_WELFARE = 42;//萌新福利 int LIMIT_RANDOM_CARD = 43;//限时抽卡 + int MISSIONSEARCH_EXPERT = 46;//寻宝达人 + int LUCKWHEEL_EXPERT = 47;//探宝达人 + int HERORANDOM_EXPERT = 48;//征募达人 + int SECURTBOX_EXPERT = 49;//秘宝达人 + } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java index 2a2b0bfca..deefe95d3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java @@ -38,6 +38,10 @@ public enum ActivityTypeEnum { LUCK_WHEEL_ADVANCE(ActivityType.LUCK_WHEEL_ADVANCE, LuckWheelAdvancedActivity::new), NEW_WELFARE(ActivityType.NEW_WELFARE, NewWelfareActivity::new), LIMIT_RANDOM_CARD(ActivityType.LIMIT_RANDOM_CARD,LimitRandomCardActivity::new), + MISSIONSEARCH_EXPERT(ActivityType.MISSIONSEARCH_EXPERT,MissSearchExpectRankActivity::new), + LUCKWHEEL_EXPERT(ActivityType.LUCKWHEEL_EXPERT,LuckWheelExpectRankActivity::new), + HERORANDOM_EXPERT(ActivityType.HERORANDOM_EXPERT,HeroRandomExpectRankActivity::new), + SECURTBOX_EXPERT(ActivityType.SECURTBOX_EXPERT,SecurtBoxExpectRankActivity::new), ; private int type; private Function toActivityFunction; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/HeroRandomExpectRankActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/HeroRandomExpectRankActivity.java new file mode 100644 index 000000000..de3e4df7f --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/HeroRandomExpectRankActivity.java @@ -0,0 +1,27 @@ +package com.ljsd.jieling.logic.activity; + + +import com.ljsd.jieling.logic.activity.event.HeroRandomEvent; +import com.ljsd.jieling.logic.activity.event.IEvent; +import com.ljsd.jieling.logic.activity.event.Poster; +import com.ljsd.jieling.logic.dao.UserManager; + +/** + * + */ +class HeroRandomExpectRankActivity extends ExpectRankActivity { + + public HeroRandomExpectRankActivity(int id) { + super(id); + Poster.getPoster().listenEvent(this, HeroRandomEvent.class); + } + + @Override + public void onEvent(IEvent event) throws Exception { + if (!(event instanceof HeroRandomEvent)) + return; + update(UserManager.getUser(((HeroRandomEvent) event).getUid()), ((HeroRandomEvent) event).getTime()); + } + + +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LuckWheelExpectRankActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LuckWheelExpectRankActivity.java new file mode 100644 index 000000000..d92d4c450 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LuckWheelExpectRankActivity.java @@ -0,0 +1,29 @@ +package com.ljsd.jieling.logic.activity; + + +import com.ljsd.jieling.logic.activity.event.IEvent; +import com.ljsd.jieling.logic.activity.event.LuckWheelAdvanceEvent; +import com.ljsd.jieling.logic.activity.event.LuckWheelEvent; +import com.ljsd.jieling.logic.activity.event.Poster; +import com.ljsd.jieling.logic.dao.UserManager; + +/** + * + */ +class LuckWheelExpectRankActivity extends ExpectRankActivity { + + public LuckWheelExpectRankActivity(int id) { + super(id); + Poster.getPoster().listenEvent(this, LuckWheelAdvanceEvent.class); + Poster.getPoster().listenEvent(this, LuckWheelEvent.class); + } + + @Override + public void onEvent(IEvent event) throws Exception { + if (!(event instanceof LuckWheelEvent)) + return; + update(UserManager.getUser(((LuckWheelEvent) event).getUid()), 1); + } + + +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/MissSearchExpectRankActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/MissSearchExpectRankActivity.java new file mode 100644 index 000000000..c05a78450 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/MissSearchExpectRankActivity.java @@ -0,0 +1,63 @@ +package com.ljsd.jieling.logic.activity; + + +import com.ljsd.jieling.logic.OnlineUserManager; +import com.ljsd.jieling.logic.activity.event.*; +import com.ljsd.jieling.logic.dao.ActivityMission; +import com.ljsd.jieling.logic.dao.ActivityProgressInfo; +import com.ljsd.jieling.logic.dao.UserManager; +import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.network.session.ISession; +import config.SActivityRewardConfig; +import config.SEquipConfig; +import manager.STableManager; + +import java.util.Map; + +/** + * + */ +class MissSearchExpectRankActivity extends ExpectRankActivity { + + public MissSearchExpectRankActivity(int id) { + super(id); + Poster.getPoster().listenEvent(this, MissingRoomBestEvent.class); + } + + @Override + public void onEvent(IEvent event) throws Exception { + if (!(event instanceof MissingRoomBestEvent)) + return; + + User user = UserManager.getUser(((MissingRoomBestEvent) event).getUid()); + ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id); + Map activityProgressInfoMap = activityMission.getActivityProgressInfoMap(); + + for (SActivityRewardConfig sActivityRewardConfig : SActivityRewardConfig.getsActivityRewardConfigByActivityId(id)) { + if (((MissingRoomBestEvent) event).getTaskType() == sActivityRewardConfig.getValues()[0][0]) { + ActivityProgressInfo activityProgressInfo = activityProgressInfoMap.getOrDefault(sActivityRewardConfig.getId(), null); + if (null == activityProgressInfo) + continue; + activityProgressInfo.setProgrss(activityProgressInfo.getProgrss() + 1); + activityMission.updateProgressInfo(sActivityRewardConfig.getId(), activityProgressInfo); + } + } + //更新进度 + ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId()); + System.out.print(activityMission.toString()); + sendActivityProgress(sessionByUid, activityMission, null); + } + + + @Override + boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception { + int[][] values = sActivityRewardConfig.getValues(); + int missionProgress = activityProgressInfo.getProgrss(); + if (missionProgress < values[1][0]) { + return false; + } + return true; + } + + +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/SecurtBoxExpectRankActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/SecurtBoxExpectRankActivity.java new file mode 100644 index 000000000..d7e3be9a7 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/SecurtBoxExpectRankActivity.java @@ -0,0 +1,27 @@ +package com.ljsd.jieling.logic.activity; + + +import com.ljsd.jieling.logic.activity.event.IEvent; +import com.ljsd.jieling.logic.activity.event.Poster; +import com.ljsd.jieling.logic.activity.event.SecretBoxEvent; +import com.ljsd.jieling.logic.dao.UserManager; + +/** + * + */ +class SecurtBoxExpectRankActivity extends ExpectRankActivity { + + public SecurtBoxExpectRankActivity(int id) { + super(id); + Poster.getPoster().listenEvent(this, SecretBoxEvent.class); + } + + @Override + public void onEvent(IEvent event) throws Exception { + if (!(event instanceof SecretBoxEvent)) + return; + update(UserManager.getUser(((SecretBoxEvent) event).getUid()), ((SecretBoxEvent) event).getTime()); + } + + +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/HeroRandomEvent.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/HeroRandomEvent.java new file mode 100644 index 000000000..5c27f505e --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/HeroRandomEvent.java @@ -0,0 +1,21 @@ +package com.ljsd.jieling.logic.activity.event; + + +public class HeroRandomEvent implements IEvent { + + private int uid; + private int time; + + public HeroRandomEvent(int uid, int time) { + this.uid = uid; + this.time = time; + } + + public int getTime() { + return time; + } + + public int getUid() { + return uid; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/MissingRoomBestEvent.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/MissingRoomBestEvent.java index 8157d971d..13e7e8d77 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/MissingRoomBestEvent.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/MissingRoomBestEvent.java @@ -8,6 +8,11 @@ package com.ljsd.jieling.logic.activity.event; public class MissingRoomBestEvent implements IEvent{ private int taskType; + private int uid; + + public int getUid() { + return uid; + } public int getTaskType() { return taskType; @@ -17,7 +22,8 @@ public class MissingRoomBestEvent implements IEvent{ this.taskType = taskType; } - public MissingRoomBestEvent(int taskType) { + public MissingRoomBestEvent(int taskType, int uid) { this.taskType = taskType; + this.uid = uid; } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/SecretBoxEvent.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/SecretBoxEvent.java new file mode 100644 index 000000000..08607ca81 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/event/SecretBoxEvent.java @@ -0,0 +1,23 @@ +package com.ljsd.jieling.logic.activity.event; + +/** + * 密盒 + */ +public class SecretBoxEvent implements IEvent { + + private int uid; + private int time; + + public SecretBoxEvent(int uid, int time) { + this.uid = uid; + this.time = time; + } + + public int getTime() { + return time; + } + + public int getUid() { + return uid; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index aa2068b50..708862cf3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -13,10 +13,7 @@ import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.Global; import com.ljsd.jieling.logic.activity.ActivityLogic; -import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent; -import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent; -import com.ljsd.jieling.logic.activity.event.Poster; -import com.ljsd.jieling.logic.activity.event.RandomCardEvent; +import com.ljsd.jieling.logic.activity.event.*; import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler; import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.root.User; @@ -318,6 +315,8 @@ public class HeroLogic{ if( (alreadyCount + perCount)/lotterySecurityReward[0] > alreadyCount/lotterySecurityReward[0]){ builder.setExtraBox(ItemUtil.drop(user, new int[]{lotterySecurityReward[1]},1F,0,BIReason.HERO_RANDOM)); } + Poster.getPoster().dispatchEvent(new HeroRandomEvent(uid,perCount)); + } user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount); heroManager.updateRandCount(type,randCount); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionLoigc.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionLoigc.java index 0a2136264..47ca0b836 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionLoigc.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionLoigc.java @@ -691,7 +691,7 @@ public class MissionLoigc { User user = UserManager.getUser(session.getUid()); MissingRoomMissionType missingRoomMissionType = user.getUserMissionManager().getMissingRoomMissionType(); missingRoomMissionType.heroSend(user,hero,missionId); - Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType())); + Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType(),user.getId())); user.getUserMissionManager().updateString("missingRoomMissionType",missingRoomMissionType); MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java index 846990a9a..9f5472859 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java @@ -138,6 +138,13 @@ public class PlayerLogic { playerInfoManager.setNickName(name); if(sex==0||sex==1){ playerInfoManager.setSex(sex); + int headID =SPlayerRole.getRolePic(sex); + if(headID==0){ + LOGGER.error("Exception::sex pic null"); + }else { + playerInfoManager.setHead(headID); + } + playerInfoUpdate(user); } String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false); RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER); diff --git a/tablemanager/src/main/java/config/SPlayerRole.java b/tablemanager/src/main/java/config/SPlayerRole.java new file mode 100644 index 000000000..c62baba81 --- /dev/null +++ b/tablemanager/src/main/java/config/SPlayerRole.java @@ -0,0 +1,44 @@ +package config; + +import manager.STableManager; +import manager.Table; + +import java.util.HashMap; +import java.util.Map; + +@Table(name ="PlayerRole") +public class SPlayerRole implements BaseConfig { + + private int id; + + private int role; + + private int rolePic; + + private static Map roleMap; + + @Override + public void init() throws Exception { + roleMap = new HashMap<>(); + for (SPlayerRole entry:STableManager.getConfig(SPlayerRole.class).values()) { + roleMap.put(entry.getRole(),entry.getRolePic()); + } + } + + public int getId() { + return id; + } + + public int getRole() { + return role; + } + + public int getRolePic() { + return rolePic; + } + + + public static int getRolePic(Integer sex) { + return SPlayerRole.roleMap.getOrDefault(sex,0); + } +} \ No newline at end of file From 2f9fb3c3499dc14be6b8325b54fdb1fca2b5ec90 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Tue, 31 Dec 2019 16:35:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=88=98=E6=96=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luafight/Modules/Battle/Logic/Base/Buff.lua | 35 +++++++++---------- luafight/Modules/Battle/Logic/Base/Effect.lua | 6 ++++ .../Modules/Battle/Logic/Base/Passivity.lua | 4 +-- luafight/Modules/Battle/Logic/BattleLogic.lua | 2 +- luafight/Modules/Battle/Logic/Buff/Aura.lua | 1 - luafight/Modules/Battle/Logic/Buff/Brand.lua | 1 - .../Modules/Battle/Logic/Buff/Control.lua | 1 - luafight/Modules/Battle/Logic/Buff/DOT.lua | 1 - luafight/Modules/Battle/Logic/Buff/HOT.lua | 1 - luafight/Modules/Battle/Logic/Buff/Immune.lua | 1 - .../Battle/Logic/Buff/PropertyChange.lua | 1 - luafight/Modules/Battle/Logic/Buff/Shield.lua | 1 - luafight/Modules/Battle/Logic/RoleLogic.lua | 2 ++ 13 files changed, 28 insertions(+), 29 deletions(-) diff --git a/luafight/Modules/Battle/Logic/Base/Buff.lua b/luafight/Modules/Battle/Logic/Base/Buff.lua index 3793d249c..bd71a9701 100644 --- a/luafight/Modules/Battle/Logic/Base/Buff.lua +++ b/luafight/Modules/Battle/Logic/Base/Buff.lua @@ -1,5 +1,4 @@ Buff = {} - local floor = math.floor local buffPoolList = {} @@ -50,7 +49,7 @@ BuffManager = {} BuffManager.__index = BuffManager function BuffManager.New() - local instance = {owner=0, buffQueue = BattleQueue.New(), buffList = BattleDictionary.New()} + local instance = {owner=0, buffQueue = BattleQueue.New(), buffDic = BattleDictionary.New()} setmetatable(instance, BuffManager) return instance end @@ -59,15 +58,15 @@ function BuffManager:Init() while self.buffQueue.size > 0 do putBuff(self.buffQueue:Dequeue()) end - for i = 1, self.buffList.size do - local list = self.buffList.vList[i] + for i = 1, self.buffDic.size do + local list = self.buffDic.vList[i] for j=1, list.size do putBuff(list.buffer[j]) end list:Clear() buffListPool:Put(list) end - self.buffList:Clear() + self.buffDic:Clear() end function BuffManager:AddBuff(target, buff) @@ -89,8 +88,8 @@ function BuffManager:AddBuff(target, buff) end function BuffManager:QueryBuff(target, checkFunc) - for i=1, self.buffList.size do - local list = self.buffList.vList[i] + for i=1, self.buffDic.size do + local list = self.buffDic.vList[i] for j=1, list.size do local buff = list.buffer[j] if buff.target == target then @@ -103,8 +102,8 @@ function BuffManager:QueryBuff(target, checkFunc) end function BuffManager:HasBuff(target, type, checkFunc) - if self.buffList.kvList[type] then - local buffList = self.buffList.kvList[type] + if self.buffDic.kvList[type] then + local buffList = self.buffDic.kvList[type] for i=1, buffList.size do local v = buffList.buffer[i] if v.target == target then @@ -119,8 +118,8 @@ end --func为nil时无条件清除,否则判定clear值,执行func function BuffManager:ClearBuff(target, func) - for i = 1, self.buffList.size do - local list = self.buffList.vList[i] + for i = 1, self.buffDic.size do + local list = self.buffDic.vList[i] if list.size > 0 then local idx = 1 while idx <= list.size do @@ -143,8 +142,8 @@ function BuffManager:PutBuff(buff) end function BuffManager:GetBuffCount(type) - if self.buffList[type] then - return self.buffList[type].size + if self.buffDic[type] then + return self.buffDic[type].size end return 0 end @@ -153,11 +152,11 @@ function BuffManager:Update() while self.buffQueue.size > 0 do local buff = self.buffQueue:Dequeue() local buffList - if not self.buffList.kvList[buff.type] then + if not self.buffDic.kvList[buff.type] then buffList = buffListPool:Get() - self.buffList:Add(buff.type, buffList) + self.buffDic:Add(buff.type, buffList) else - buffList = self.buffList.kvList[buff.type] + buffList = self.buffDic.kvList[buff.type] end if buff.cover and buffList.size > 0 then local isCovered = false @@ -186,8 +185,8 @@ function BuffManager:Update() buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff) end end - for i=1, self.buffList.size do - local buffList = self.buffList.vList[i] + for i=1, self.buffDic.size do + local buffList = self.buffDic.vList[i] if buffList.size > 0 then local index = 1 while index <= buffList.size do diff --git a/luafight/Modules/Battle/Logic/Base/Effect.lua b/luafight/Modules/Battle/Logic/Base/Effect.lua index bd4dea6a1..758ac7e61 100644 --- a/luafight/Modules/Battle/Logic/Base/Effect.lua +++ b/luafight/Modules/Battle/Logic/Base/Effect.lua @@ -1505,11 +1505,17 @@ local effectList = { local f1 = args[1] local f2 = args[2] BattleLogic.WaitForTrigger(interval, function () + local lastTrigger = 0 local OnPassiveDamaging = function(damagingFunc, atkRole, damage) + lastTrigger = lastTrigger + 1 + if lastTrigger > 1 then --加入限定避免循环触发 + return + end if not target.isDead then damagingFunc(floor(damage * f1)) BattleUtil.ApplyDamage(atkRole, target, BattleUtil.CalShield(atkRole, target, floor(damage * f1))) end + lastTrigger = 0 end local list = BattleLogic.GetNeighbor(target, 1) for i=1, #list do diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index eb22a287e..97838dbec 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -1188,7 +1188,7 @@ local passivityList = { if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then BattleUtil.RandomAction(f1, function () local val = floor(BattleUtil.FP_Mul(role:GetRoleData(propertyList[pro1]), f2)) - BattleUtil.CalTreat(skill.owner, skill.owner, val) + BattleUtil.CalTreat(role, skill.owner, val) end) end end @@ -1212,7 +1212,7 @@ local passivityList = { local f2 = args[3] BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, function (defRole, atkRole) - if atkRole.isTeam then + if role.isDead or atkRole.isTeam then return end if defRole.camp == role.camp then diff --git a/luafight/Modules/Battle/Logic/BattleLogic.lua b/luafight/Modules/Battle/Logic/BattleLogic.lua index 0aab83eea..386637941 100644 --- a/luafight/Modules/Battle/Logic/BattleLogic.lua +++ b/luafight/Modules/Battle/Logic/BattleLogic.lua @@ -12,7 +12,7 @@ local curFrame local playerSkillUsable local enemySkillUsable -BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 +BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战 BattleLogic.IsEnd = false BattleLogic.Result = -1 BattleLogic.Event = BattleEvent.New() diff --git a/luafight/Modules/Battle/Logic/Buff/Aura.lua b/luafight/Modules/Battle/Logic/Buff/Aura.lua index a378d35bc..30d099757 100644 --- a/luafight/Modules/Battle/Logic/Buff/Aura.lua +++ b/luafight/Modules/Battle/Logic/Buff/Aura.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") Aura = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/Brand.lua b/luafight/Modules/Battle/Logic/Buff/Brand.lua index 34f274ebe..5368fa20c 100644 --- a/luafight/Modules/Battle/Logic/Buff/Brand.lua +++ b/luafight/Modules/Battle/Logic/Buff/Brand.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") Brand = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/Control.lua b/luafight/Modules/Battle/Logic/Buff/Control.lua index 4d93c50c8..399a4de9f 100644 --- a/luafight/Modules/Battle/Logic/Buff/Control.lua +++ b/luafight/Modules/Battle/Logic/Buff/Control.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") Control = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/DOT.lua b/luafight/Modules/Battle/Logic/Buff/DOT.lua index 2ae99b2e9..da879de92 100644 --- a/luafight/Modules/Battle/Logic/Buff/DOT.lua +++ b/luafight/Modules/Battle/Logic/Buff/DOT.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") DOT = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/HOT.lua b/luafight/Modules/Battle/Logic/Buff/HOT.lua index aa2788987..7957f14c5 100644 --- a/luafight/Modules/Battle/Logic/Buff/HOT.lua +++ b/luafight/Modules/Battle/Logic/Buff/HOT.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") HOT = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/Immune.lua b/luafight/Modules/Battle/Logic/Buff/Immune.lua index b9851e60a..a986b5816 100644 --- a/luafight/Modules/Battle/Logic/Buff/Immune.lua +++ b/luafight/Modules/Battle/Logic/Buff/Immune.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") Immune = Buff:New() local immune1 = function(buff) diff --git a/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua b/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua index d3b52c3aa..6f2b36565 100644 --- a/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua +++ b/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") PropertyChange = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/Buff/Shield.lua b/luafight/Modules/Battle/Logic/Buff/Shield.lua index 6f7986256..c6fd4763f 100644 --- a/luafight/Modules/Battle/Logic/Buff/Shield.lua +++ b/luafight/Modules/Battle/Logic/Buff/Shield.lua @@ -1,4 +1,3 @@ -require("Modules/Battle/Logic/Base/Buff") Shield = Buff:New() --初始化Buff,通过传入一些自定义参数控制成长相关的数值 diff --git a/luafight/Modules/Battle/Logic/RoleLogic.lua b/luafight/Modules/Battle/Logic/RoleLogic.lua index 0ed57bbe6..645667d62 100644 --- a/luafight/Modules/Battle/Logic/RoleLogic.lua +++ b/luafight/Modules/Battle/Logic/RoleLogic.lua @@ -206,10 +206,12 @@ end function RoleLogic:AddBuff(buff) if self.isDead then + BattleLogic.BuffMgr:PutBuff(buff) return end for i=1, self.buffFilter.size do if self.buffFilter.buffer[i](buff) then + BattleLogic.BuffMgr:PutBuff(buff) return end end From 55091f4baefa619c0fa6021669f9ece15b6fa4a1 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Tue, 31 Dec 2019 17:32:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=89=B9=E6=9D=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/GameGM/GMRequestHandler.java | 3 +- .../jieling/handler/GetPlayerInfoHandler.java | 12 +-- .../com/ljsd/jieling/kefu/Cmd_fix_store.java | 7 +- .../logic/activity/FightMainEventHandler.java | 3 + .../activity/LimitRandomCardActivity.java | 8 ++ .../logic/activity/UserLevelEventHandler.java | 5 +- .../ljsd/jieling/logic/dao/PlayerManager.java | 91 ++++++++++++------- .../ljsd/jieling/logic/dao/UserManager.java | 4 +- .../com/ljsd/jieling/logic/dao/VipInfo.java | 35 +++++++ .../ljsd/jieling/logic/hero/HeroLogic.java | 5 +- .../jieling/logic/player/PlayerLogic.java | 7 +- .../jieling/logic/store/BuyGoodsLogic.java | 5 +- .../ljsd/jieling/logic/store/StoreLogic.java | 3 + 13 files changed, 134 insertions(+), 54 deletions(-) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/dao/VipInfo.java diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java index 68c328590..cc7023b40 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GameGM/GMRequestHandler.java @@ -243,7 +243,8 @@ public class GMRequestHandler extends BaseHandler{ VipMissionIdsType vipMissionIdsType = cUser.getUserMissionManager().getVipMissionIdsType(); vipMissionIdsType.getFinishMissionIds().clear(); vipMissionIdsType.getDoingMissionIds().clear(); - cUser.getPlayerInfoManager().updateVipInfo(cUser,prarm1); + cUser.getPlayerInfoManager().setVipLevel(prarm1); + cUser.getPlayerInfoManager().updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,prarm1); vipMissionIdsType.getFinishMissionIds().addAll(vipMissionIdsType.getDoingMissionIds()); vipMissionIdsType.getDoingMissionIds().clear(); cUser.getUserMissionManager().setVipMissionIdsType(vipMissionIdsType); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java index 8c4b4ab08..443bf3d08 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java @@ -8,10 +8,7 @@ import com.ljsd.jieling.handler.map.MapLogic; import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.logic.GlobalDataManaager; import com.ljsd.jieling.logic.activity.ActivityLogic; -import com.ljsd.jieling.logic.dao.PlayerManager; -import com.ljsd.jieling.logic.dao.RechargeInfo; -import com.ljsd.jieling.logic.dao.ServerConfig; -import com.ljsd.jieling.logic.dao.UserManager; +import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.root.GlobalSystemControl; import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.player.PlayerLogic; @@ -70,7 +67,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ GlobalDataManaager.checkNeedReFlush(iSession,user,null); playerInfoManager.setLoginTime(TimeUtils.now()); Map guidePoints = playerInfoManager.getGuidePoints(); - Map vipInfo = playerInfoManager.getVipInfo(); + Map vipInfo = playerInfoManager.getVipInfo(); List list = new ArrayList<>(); List privilegeList = new ArrayList<>(); for(Map.Entry guideItem : guidePoints.entrySet()){ @@ -79,10 +76,11 @@ public class GetPlayerInfoHandler extends BaseHandler{ . setId(guideItem.getValue()) .build()); } - for(Map.Entry vipInfoItem : vipInfo.entrySet()){ + for(Map.Entry vipInfoItem : vipInfo.entrySet()){ privilegeList.add(CommonProto.Privilege.newBuilder() .setId(vipInfoItem.getKey()) - . setUsedTimes(vipInfoItem.getValue()) + . setUsedTimes(vipInfoItem.getValue().getCount()) + .setEffectTime(vipInfoItem.getValue().getEffectTime()) .build()); } MapManager mapManager = user.getMapManager(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fix_store.java b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fix_store.java index 155ee72ed..2082dd293 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fix_store.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fix_store.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.kefu; import com.ljsd.jieling.db.mongo.MongoUtil; +import com.ljsd.jieling.logic.dao.VipInfo; import com.ljsd.jieling.logic.dao.root.User; import config.SStoreConfig; @@ -41,8 +42,8 @@ public class Cmd_fix_store extends GmAbstract { for (User user :userList){ process++; try { - for (Map.Entry en:user.getPlayerInfoManager().getVipInfo().entrySet()){ - if(en.getValue()!=0){ + for (Map.Entry en:user.getPlayerInfoManager().getVipInfo().entrySet()){ + if(en.getValue().getCount()!=0){ Integer itemId = vip2itemid.get(en.getKey()); if(itemId == null ){ continue; @@ -50,7 +51,7 @@ public class Cmd_fix_store extends GmAbstract { int storeid = SStoreConfig.getSstoreConfigMap().get(itemId).getStoreId(); Map itemNumMap = user.getStoreManager().getStoreInfoMap().get(storeid).getItemNumMap(); if(itemNumMap.containsKey(itemId)){ - itemNumMap.put(itemId,en.getValue()); + itemNumMap.put(itemId,en.getValue().getCount()); } user.getStoreManager().getStoreInfoMap().get(storeid).setItemNumMap(itemNumMap); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/FightMainEventHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/FightMainEventHandler.java index dbd5f8524..13df49f25 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/FightMainEventHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/FightMainEventHandler.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.activity; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.logic.activity.event.FightMainEvent; import com.ljsd.jieling.logic.activity.event.IEvent; @@ -35,6 +36,8 @@ public class FightMainEventHandler implements IEventHandler{ int uid = fightMainEvent.getUid(); User user = UserManager.getUser(uid); + //检测更新vip是否有新开 + user.getPlayerInfoManager().updateVipInfo(GlobalsDef.MAIN_LEVEL_UNLOCK_PRIVILEGE,10_000_000 * (fightId % 10) + fightId); for(SGlobalActivity sGlobalActivity : SGlobalActivity.getsGlobalActivityMap().values()){ int[] openRules = sGlobalActivity.getOpenRules(); if(openRules!=null && openRules.length>0 && openRules[0] == 1){ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LimitRandomCardActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LimitRandomCardActivity.java index dd70d01a1..db79211b9 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LimitRandomCardActivity.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/LimitRandomCardActivity.java @@ -1,5 +1,6 @@ package com.ljsd.jieling.logic.activity; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.logic.activity.event.IEvent; @@ -15,6 +16,7 @@ import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank; import com.ljsd.jieling.network.session.ISession; import config.SActivityRewardConfig; import config.SCHero; +import config.SSpecialConfig; import util.TimeUtils; import java.util.function.Consumer; @@ -55,6 +57,7 @@ public class LimitRandomCardActivity extends AbstractActivity { Consumer consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(), TimeUtils.now()/1000,a[0]); Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer); update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore()); + } @Override @@ -65,6 +68,11 @@ public class LimitRandomCardActivity extends AbstractActivity { @Override void updateProgressWithUser(User user, ActivityMission activityMission, int count) { activityMission.setValue(activityMission.getValue()+count); + //150分赠一次 + int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL); + if((activityMission.getValue()+count)/onceArrayValue[0]-activityMission.getValue()/onceArrayValue[0]>0){ + user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1); + } } @Override diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/UserLevelEventHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/UserLevelEventHandler.java index 89184f3b9..003a7cfcf 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/UserLevelEventHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/UserLevelEventHandler.java @@ -1,6 +1,7 @@ package com.ljsd.jieling.logic.activity; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.logic.activity.event.IEvent; import com.ljsd.jieling.logic.activity.event.Poster; @@ -13,9 +14,11 @@ import com.ljsd.jieling.util.ToolsUtil; import config.SGlobalActivity; import config.SGlobalSystemConfig; import config.SMainLevelConfig; +import config.SPrivilegeTypeConfig; import manager.STableManager; import java.util.List; +import java.util.Map; public class UserLevelEventHandler implements IEventHandler{ @@ -28,11 +31,11 @@ public class UserLevelEventHandler implements IEventHandler{ return; UserLevelEvent userLevelEvent = (UserLevelEvent) event; int level = userLevelEvent.getLevel(); - List sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(2).get(level); int uid = userLevelEvent.getUid(); User user = UserManager.getUser(uid); + user.getPlayerInfoManager().updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,user.getPlayerInfoManager().getLevel()); int state = user.getMainLevelManager().getState(); if(state == -1 ){ int fightId = user.getMainLevelManager().getFightId(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PlayerManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PlayerManager.java index 8f046938d..7fd97bc01 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PlayerManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PlayerManager.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao; import com.ljsd.common.mogodb.MongoBase; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.logic.dao.root.User; @@ -9,11 +10,9 @@ import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.player.PlayerLogic; import config.SPrivilegeTypeConfig; import config.SVipLevelConfig; +import util.TimeUtils; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.CopyOnWriteArraySet; @@ -63,7 +62,7 @@ public class PlayerManager extends MongoBase { private Map guidePoints = new HashMap<>(); - private Map vipInfo = new HashMap<>(); + private Map vipInfo = new HashMap<>(); private Set vipGoodInfo = new HashSet<>();// 特权商品礼包 private Set reds = new CopyOnWriteArraySet<>(); @@ -167,6 +166,11 @@ public class PlayerManager extends MongoBase { return vipLevel; } + public void setVipLevel(int vipLevel) { + this.vipLevel = vipLevel; + updateString("vipLevel",vipLevel); + } + public int getHead() { return head; } @@ -239,51 +243,52 @@ public class PlayerManager extends MongoBase { this.loginTime = loginTime; } - public Map getVipInfo() { + public Map getVipInfo() { return vipInfo; } - public void updateVipInfo(User user,int vipLevel) throws Exception { - SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel); - if(sVipLevelConfig == null){ - return; - } - Map vip = new HashMap<>(sVipLevelConfig.getPrivilegeMap()); - for(Integer privilageId : vip.keySet()){ - if(!vipInfo.containsKey(privilageId)){ - vipInfo.put(privilageId,0); + public void updateVipInfo(int unlockType,int condition) { + Map> conditionMap = SPrivilegeTypeConfig.conditionMap.get(unlockType); + for(Map.Entry> entry:conditionMap.entrySet()){ + if(entry.getValue().containsKey(condition)){ + if(!vipInfo.containsKey(entry.getKey())) { + vipInfo.put(entry.getKey(), new VipInfo()); + } } } updateString("vipInfo", vipInfo); - updateString("vipLevel", vipLevel); - this.vipLevel = vipLevel; - user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel); - PlayerLogic.getInstance().sendVipDailyOrLevlUpReward(user, vipLevel, BIReason.VIP_LEVEL_REWARD); - } public boolean check(int privilageId,int updateNum){ if(privilageId == 0){ return true; } - SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel); - if(sVipLevelConfig == null ){ + + if(!vipInfo.containsKey(privilageId)){ return false; } - Integer limitNum = sVipLevelConfig.getPrivilegeMap().get(privilageId); - if(limitNum == null){ + VipInfo info = vipInfo.get(privilageId); + if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){ return false; } - if(limitNum == -1){ + + SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId); + Map> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType()); + int maxCount = 0; + if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){ + TreeMap condition = (TreeMap)conditionMap.get(privilageId); + maxCount = condition.floorEntry(level).getValue(); + } + if(maxCount==-1){ return true; } - if(!vipInfo.containsKey(privilageId)){ - vipInfo.put(privilageId,0); - } - if(vipInfo.get(privilageId) + updateNum > limitNum){ + 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){ @@ -297,14 +302,16 @@ public class PlayerManager extends MongoBase { if(!vipInfo.containsKey(privilageId)){ return 0; } - return vipInfo.get(privilageId); + return vipInfo.get(privilageId).getCount(); } public void updateVipPrivilage(int privilageId,int updateNum){ if(!vipInfo.containsKey(privilageId)){ return; } - vipInfo.put(privilageId,vipInfo.get(privilageId)+updateNum); + VipInfo info = vipInfo.get(privilageId); + info.setCount(info.getCount()+updateNum); + vipInfo.put(privilageId, info); updateString("vipInfo", vipInfo); } @@ -328,6 +335,7 @@ public class PlayerManager extends MongoBase { vipGoodInfo.add(vipLevel); } + public int getHadTakeDailyBoxVip() { return hadTakeDailyBoxVip; } @@ -338,14 +346,17 @@ public class PlayerManager extends MongoBase { } public void vipFlush( Set removePrivileges) { + if (vipInfo.isEmpty()){ + return; + } for(Integer id : vipInfo.keySet()){ SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id); if(null == sPrivilegeTypeConfig){ continue; } int refreshType = sPrivilegeTypeConfig.getRefreshType()[0]; - if(refreshType == 1){ - vipInfo.put(id,0); + if(refreshType == 1&&vipInfo.get(id).getCount()>0){ + vipInfo.put(id,new VipInfo()); } } for(Integer remove : removePrivileges){ @@ -356,8 +367,18 @@ public class PlayerManager extends MongoBase { } public void addVipInfo(int privilageId){ - vipInfo.put(privilageId,0); - updateString("vipInfo."+privilageId, 0); + SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId); + if (config==null){ + return; + } + int maxTime = 0; + if(vipInfo.containsKey(privilageId)){ + maxTime = (int)(TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime()); + }else { + maxTime = (int)(TimeUtils.now()/1000+config.getContinueTime()); + } + vipInfo.put(privilageId,new VipInfo(0,maxTime+config.getContinueTime())); + updateString("vipInfo", vipInfo); } public void removeVipPriviliageId(int privilageId){ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java index 8fff28631..db841d647 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/UserManager.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.ktbeans.KtEventUtils; @@ -78,7 +79,8 @@ public class UserManager { playerManager.setCreateTime(now); playerManager.setLoginTime(now); playerManager.setSendDays(1); - playerManager.updateVipInfo(user,0); + playerManager.updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,1); + playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0); playerManager.setRechargeInfo(new RechargeInfo()); playerManager.setPhoneBindInfo(new PhoneBindInfo("")); playerManager.setChannel(channel); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/VipInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/VipInfo.java new file mode 100644 index 000000000..774c3b1cf --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/VipInfo.java @@ -0,0 +1,35 @@ +package com.ljsd.jieling.logic.dao; + +/** + * @author lvxinran + * @date 2019/12/26 + * @discribe + */ +public class VipInfo { + private int count; + private int effectTime; + + public void setCount(int count) { + this.count = count; + } + + public void setEffectTime(int effectTime) { + this.effectTime = effectTime; + } + + public int getCount() { + return count; + } + + public int getEffectTime() { + return effectTime; + } + + public VipInfo(int count, int effectTime) { + this.count = count; + this.effectTime = effectTime; + } + + public VipInfo() { + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index aa2068b50..19a60482b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -252,9 +252,10 @@ public class HeroLogic{ if(!enoughCost){ throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); } - }else{ - user.getPlayerInfoManager().updateVipPrivilage(privilege, 1); } +// else{ +// user.getPlayerInfoManager().updateVipPrivilage(privilege, 1); +// } //额外获取 int length = perCount; int[][] tenTimesMustGetItem = null; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java index 846990a9a..6a5fa887f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java @@ -281,11 +281,12 @@ public class PlayerLogic { sendVipDailyOrLevlUpReward(user, vipLevel,BIReason.VIP_DAY_REWARD); if(fBuilder!=null){ List privilegeList = new ArrayList<>(); - Map vipInfo = playerInfoManager.getVipInfo(); - for(Map.Entry vipInfoItem : vipInfo.entrySet()){ + Map vipInfo = playerInfoManager.getVipInfo(); + for(Map.Entry vipInfoItem : vipInfo.entrySet()){ privilegeList.add(CommonProto.Privilege.newBuilder() .setId(vipInfoItem.getKey()) - . setUsedTimes(vipInfoItem.getValue()) + . setUsedTimes(vipInfoItem.getValue().getCount()) + .setEffectTime(vipInfoItem.getValue().getEffectTime()) .build()); } fBuilder.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip()).addAllPrivilege(privilegeList); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java index f50f3f87d..064cf5ea0 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java @@ -1,6 +1,7 @@ package com.ljsd.jieling.logic.store; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.exception.ErrorCode; import com.ljsd.jieling.exception.ErrorCodeException; @@ -205,7 +206,9 @@ public class BuyGoodsLogic { //vip 等级更新和推送 int newLeve= SVipLevelConfig.getsVipLevel(rechargeInfo.getSaveAmt()); if(user.getPlayerInfoManager().getVipLevel()!=newLeve){ - user.getPlayerInfoManager().updateVipInfo(user,newLeve); +// user.getPlayerInfoManager().updateVipInfo(user,newLeve); + user.getPlayerInfoManager().setVipLevel(newLeve); + user.getPlayerInfoManager().updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,newLeve); CombatLogic.getInstance().getNewAdventureReward(user, true); } PlayerInfoProto.RefreshRechargeIndication.Builder builder = PlayerInfoProto.RefreshRechargeIndication.newBuilder(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java index d8c2f3f2b..f2e660b78 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java @@ -422,6 +422,9 @@ public class StoreLogic { int vipLeve = user.getPlayerInfoManager().getVipLevel(); user.getPlayerInfoManager().setHadTakeLevelBoxVip(vipLeve); } + if(sStoreConfig.getOpenPrivilege()!=null){ + Arrays.stream(sStoreConfig.getOpenPrivilege()).forEach(n->user.getPlayerInfoManager().addVipInfo(n)); + } PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build(); MessageUtil.sendMessage(iSession, 1,msgId, builder, true);