From 4b8b97685e1a06ad312531f1e3ed3b030489c5fb Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 5 Jan 2024 15:29:18 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E6=88=98=E6=96=97=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ljsd/jieling/util/FightDataUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/FightDataUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/FightDataUtil.java index 5af8e2401..7b9a674c5 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/FightDataUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/FightDataUtil.java @@ -516,8 +516,8 @@ public class FightDataUtil { skill.rawset(j++, LuaValue.valueOf(KeyFrame/1000f)); skill.rawset(j++, LuaValue.valueOf(SkillDuration/1000f)); skill.rawset(j++, LuaValue.valueOf(SkillNumber)); - skill.rawset(j++, getSkillNumberTime(sCombatControl.getSkillNumbetTime())); - skill.rawset(j++, getEffectArgs(sCombatControl.getAttackDisplaceoffset())); +// skill.rawset(j++, getSkillNumberTime(sCombatControl.getSkillNumbetTime())); +// skill.rawset(j++, getEffectArgs(sCombatControl.getAttackDisplaceoffset())); List effectList = getEffect(sSkillLogicVo); int size = effectList.size(); if (size > 0) { From 29fc92526e99617ed2cb22c015648bb174090fb5 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 8 Jan 2024 10:46:03 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/hotfix.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/hotfix.json b/conf/hotfix.json index 032375a09..e0bf6b3f7 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,7 +1,6 @@ { - "version":"9", + "version":"6", "classes":[ - {"name":"CBean2Proto.class","fullName":"com.ljsd.jieling.util.CBean2Proto"}, - {"name":"EquipLogic.class","fullName":"com.ljsd.jieling.logic.equip.EquipLogic"} + {"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"} ] } \ No newline at end of file From e6f0fe821878406df9045e322ec4eb0af0e939a6 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 8 Jan 2024 17:02:39 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E6=88=98=E6=96=97=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/hotfix.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/hotfix.json b/conf/hotfix.json index e0bf6b3f7..e7438e199 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,6 +1,7 @@ { "version":"6", "classes":[ - {"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"} + {"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"}, + {"name":"FightDataUtil.class","fullName":"com.ljsd.jieling.util.FightDataUtil"} ] } \ No newline at end of file From d62458e3d4dcc400107e6db29f7843b0a3a9a4b4 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 8 Jan 2024 17:03:34 +0800 Subject: [PATCH 04/30] =?UTF-8?q?=E6=88=98=E6=96=97=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index ef3d8616a..2b4b31e47 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", - "tables":"SpecialConfig" + "version":"5", + "tables":"" } \ No newline at end of file From cb34967218c77f7dbae16043d5e79f9a8397b0d0 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 16 Jan 2024 14:39:56 +0800 Subject: [PATCH 05/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- conf/hotfix.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 2b4b31e47..af142624e 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"5", - "tables":"" + "version":"6", + "tables":"GlobalActivity" } \ No newline at end of file diff --git a/conf/hotfix.json b/conf/hotfix.json index e7438e199..a4f862ef3 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,7 +1,6 @@ { "version":"6", "classes":[ - {"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"}, - {"name":"FightDataUtil.class","fullName":"com.ljsd.jieling.util.FightDataUtil"} + {"name":"ContinuousGiftActivity.class","fullName":"com.ljsd.jieling.logic.activity.ContinuousGiftActivity"} ] } \ No newline at end of file From 82d9aefe6f84f5eacb1e000efa66696bf63bfa36 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 16 Jan 2024 15:34:57 +0800 Subject: [PATCH 06/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index af142624e..416a67772 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { "version":"6", - "tables":"GlobalActivity" + "tables":"GlobalActivity|RechargeCommodityConfig" } \ No newline at end of file From 89504dec5c39d0821cb703e5a6e082444f38773f Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 16 Jan 2024 15:53:49 +0800 Subject: [PATCH 07/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 416a67772..af142624e 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { "version":"6", - "tables":"GlobalActivity|RechargeCommodityConfig" + "tables":"GlobalActivity" } \ No newline at end of file From c83cdd40229ee87268cf1447253426167088f718 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Thu, 18 Jan 2024 11:17:35 +0800 Subject: [PATCH 08/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/hotfix.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/hotfix.json b/conf/hotfix.json index a4f862ef3..a2c24b789 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,6 +1,7 @@ { - "version":"6", + "version":"7", "classes":[ - {"name":"ContinuousGiftActivity.class","fullName":"com.ljsd.jieling.logic.activity.ContinuousGiftActivity"} + {"name":"ContinuousGiftActivity.class","fullName":"com.ljsd.jieling.logic.activity.ContinuousGiftActivity"}, + {"name":"Cmd_general.class","fullName":"com.ljsd.jieling.kefu.Cmd_general"} ] } \ No newline at end of file From 3997625a8b469a6ac8bf600798e2c4c72d65c5e8 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Thu, 25 Jan 2024 10:57:23 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index af142624e..4499a95c8 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", + "version":"7", "tables":"GlobalActivity" } \ No newline at end of file From f1f73d205f203116c1e56c5cc9cfbb0da45aae5d Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 12 Feb 2024 19:10:12 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 4499a95c8..af142624e 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"7", + "version":"6", "tables":"GlobalActivity" } \ No newline at end of file From 2a1fc6a66d323465423a7367353582d5c4df915d Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 12 Feb 2024 19:13:11 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/hotfix.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/hotfix.json b/conf/hotfix.json index a2c24b789..2e5c7ac7a 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,7 +1,5 @@ { - "version":"7", + "version":"5", "classes":[ - {"name":"ContinuousGiftActivity.class","fullName":"com.ljsd.jieling.logic.activity.ContinuousGiftActivity"}, - {"name":"Cmd_general.class","fullName":"com.ljsd.jieling.kefu.Cmd_general"} ] } \ No newline at end of file From a7cfe8c300a614cda410515147cb4ca9b3ff8a79 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 19 Feb 2024 14:11:25 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index af142624e..4499a95c8 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", + "version":"7", "tables":"GlobalActivity" } \ No newline at end of file From 05f2ebf7ebe4e4e201593b0ddbc240e236283ff0 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 23 Feb 2024 16:37:25 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=83=AD=E6=9B=B4,vip?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/hotfix.json | 3 ++- .../com/ljsd/jieling/logic/dao/PlayerManager.java | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/conf/hotfix.json b/conf/hotfix.json index 2e5c7ac7a..2d614d60e 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,5 +1,6 @@ { - "version":"5", + "version":"6", "classes":[ + {"name":"PlayerManager.class","fullName":"com.ljsd.jieling.logic.dao.PlayerManager"} ] } \ No newline at end of file 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 e4fe3a426..8f3601d67 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 @@ -566,22 +566,24 @@ public class PlayerManager extends MongoBase { if (vipInfo.isEmpty()) { return; } + for (Integer remove : removePrivileges) { + vipInfo.remove(remove); + } for (Map.Entry entry : vipInfo.entrySet()) { Integer id = entry.getKey(); + VipInfo info = entry.getValue(); SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id); if (null == sPrivilegeTypeConfig) { continue; } int refreshType = sPrivilegeTypeConfig.getRefreshType()[0]; - if (refreshType == 1 && entry.getValue().getCount() > 0) { + if (refreshType == 1 && info.getCount() > 0) { VipInfo refreshVipInfo = new VipInfo(); - refreshVipInfo.setEffectTime(entry.getValue().getEffectTime()); + refreshVipInfo.setCount(0); + refreshVipInfo.setEffectTime(info.getEffectTime()); vipInfo.put(id,refreshVipInfo); } } - for (Integer remove : removePrivileges) { - vipInfo.remove(remove); - } updateString("vipInfo", vipInfo); setHadTakeDailyBoxVip(-1); } From 0c5506982939ab894a662aef1f4a367c8a7a2c2f Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 26 Feb 2024 14:10:04 +0800 Subject: [PATCH 14/30] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=83=AD=E6=9B=B4,vip?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- conf/hotfix.json | 5 +++-- .../ljsd/jieling/logic/dao/PlayerManager.java | 4 ++++ .../jieling/logic/player/PlayerLogic.java | 21 +++++++++++-------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 4499a95c8..7da862d29 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"7", + "version":"8", "tables":"GlobalActivity" } \ No newline at end of file diff --git a/conf/hotfix.json b/conf/hotfix.json index 2d614d60e..08c193c51 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,6 +1,7 @@ { - "version":"6", + "version":"7", "classes":[ - {"name":"PlayerManager.class","fullName":"com.ljsd.jieling.logic.dao.PlayerManager"} + {"name":"PlayerManager.class","fullName":"com.ljsd.jieling.logic.dao.PlayerManager"}, + {"name":"PlayerLogic.class","fullName":"com.ljsd.jieling.logic.player.PlayerLogic"} ] } \ No newline at end of file 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 8f3601d67..c721f46e2 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 @@ -563,12 +563,15 @@ public class PlayerManager extends MongoBase { } public void vipFlush(Set removePrivileges) { + System.out.println("开始刷新特权:"+removePrivileges); if (vipInfo.isEmpty()) { return; } + System.out.println("开始刷新特权,删除前特权数量:"+vipInfo.size()); for (Integer remove : removePrivileges) { vipInfo.remove(remove); } + System.out.println("开始刷新特权,删除后特权数量:"+vipInfo.size()); for (Map.Entry entry : vipInfo.entrySet()) { Integer id = entry.getKey(); VipInfo info = entry.getValue(); @@ -584,6 +587,7 @@ public class PlayerManager extends MongoBase { vipInfo.put(id,refreshVipInfo); } } + System.out.println("刷新特权完成,特权数量:"+vipInfo.size()); updateString("vipInfo", vipInfo); setHadTakeDailyBoxVip(-1); } 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 0fada4a69..a29ed2bb4 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 @@ -350,28 +350,31 @@ public class PlayerLogic { int nowInt = TimeUtils.nowInt(); Map vipInfo = playerInfoManager.getVipInfo(); for(Map.Entry vipInfoItem : vipInfo.entrySet()){ + Integer id = vipInfoItem.getKey(); + VipInfo info = vipInfoItem.getValue(); //如果这个权限是活动 且永久了 那么需要修复 - SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(vipInfoItem.getKey()); + SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id); if (config == null){ - LOGGER.info("特权刷新删除日志1:{}-{}",vipInfoItem.getKey(),vipInfoItem.getValue().getEffectTime()); - removePrivileges.add(vipInfoItem.getKey()); + LOGGER.info("特权刷新删除日志1:{};{};{}",user.getId(), id, info.getEffectTime()); + removePrivileges.add(id); 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(id, 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:{}-{}",vipInfoItem.getKey(),vipInfoItem.getValue().getEffectTime()); + removePrivileges.add(id); + LOGGER.info("特权刷新删除日志2:{};{};{}",user.getId(), id, info.getEffectTime()); } } + LOGGER.info("特权刷新删除日志3:{};{}",user.getId(),removePrivileges); playerInfoManager.vipFlush(removePrivileges); // vip刷新后才能发给前端 From 16e05fd4b7fb962384df16b34bc59ad4dba00cd4 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 27 Feb 2024 16:15:42 +0800 Subject: [PATCH 15/30] =?UTF-8?q?vip=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 +- conf/hotfix.json | 4 +- .../jieling/handler/GetPlayerInfoHandler.java | 2 +- .../logic/activity/GmDialActivity.java | 3 +- .../ljsd/jieling/logic/dao/PlayerManager.java | 67 +------------- .../jieling/logic/player/PlayerLogic.java | 92 ++++++++++++++++++- .../jieling/logic/store/BuyGoodsNewLogic.java | 2 +- 7 files changed, 103 insertions(+), 71 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 7da862d29..2b4b31e47 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"8", - "tables":"GlobalActivity" + "version":"5", + "tables":"" } \ No newline at end of file diff --git a/conf/hotfix.json b/conf/hotfix.json index 08c193c51..2e5c7ac7a 100644 --- a/conf/hotfix.json +++ b/conf/hotfix.json @@ -1,7 +1,5 @@ { - "version":"7", + "version":"5", "classes":[ - {"name":"PlayerManager.class","fullName":"com.ljsd.jieling.logic.dao.PlayerManager"}, - {"name":"PlayerLogic.class","fullName":"com.ljsd.jieling.logic.player.PlayerLogic"} ] } \ No newline at end of file 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 a4c9c9528..bc4a257e1 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java @@ -91,7 +91,7 @@ public class GetPlayerInfoHandler extends BaseHandler{ int unlockType = entry.getValue().getUnlockType(); if(unlockType < 4 || unlockType == 6 || unlockType == 11){ if (!vipInfo.containsKey(entry.getKey())){ - playerInfoManager.addVipInfo(entry.getKey()); + PlayerLogic.getInstance().addVipInfo(user, entry.getKey()); } } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/GmDialActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/GmDialActivity.java index 6ae879f5d..1182974d5 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/GmDialActivity.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/GmDialActivity.java @@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.activity; import com.ljsd.jieling.logic.activity.event.LuckWheelEvent; import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.player.PlayerLogic; import config.SGlobalActivity; /** @@ -23,7 +24,7 @@ public class GmDialActivity extends LuckWheelNormalActivity{ super.initActivity(user); SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id); if (activity.getPrivilege() != 0){ - user.getPlayerInfoManager().addVipInfo(activity.getPrivilege()); + PlayerLogic.getInstance().addVipInfo(user, activity.getPrivilege()); } } 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 c721f46e2..71b41d874 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 @@ -514,6 +514,11 @@ public class PlayerManager extends MongoBase { return vipInfo; } + public void setVipInfo(Map vipInfo) { + this.vipInfo = vipInfo; + updateString("vipInfo", vipInfo); + } + public Set getHadTakeLevelBoxVip() { return vipGoodInfo; } @@ -562,74 +567,12 @@ public class PlayerManager extends MongoBase { updateString("vipInfo", vipInfo); } - public void vipFlush(Set removePrivileges) { - System.out.println("开始刷新特权:"+removePrivileges); - if (vipInfo.isEmpty()) { - return; - } - System.out.println("开始刷新特权,删除前特权数量:"+vipInfo.size()); - for (Integer remove : removePrivileges) { - vipInfo.remove(remove); - } - System.out.println("开始刷新特权,删除后特权数量:"+vipInfo.size()); - for (Map.Entry entry : vipInfo.entrySet()) { - Integer id = entry.getKey(); - VipInfo info = entry.getValue(); - SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id); - if (null == sPrivilegeTypeConfig) { - 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); - } - } - System.out.println("刷新特权完成,特权数量:"+vipInfo.size()); - updateString("vipInfo", vipInfo); - setHadTakeDailyBoxVip(-1); - } - public void clearVipCount(int priviliageId){ vipInfo.put(priviliageId,new VipInfo()); updateString("vipInfo", vipInfo); } - public void addVipInfo(int privilegeId){ - SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId); - if (config==null){ - return; - } - int maxTime; - int nowInt = TimeUtils.nowInt(); - VipInfo newVipInfo = new VipInfo(); - if(config.getContinueTime()!=null && config.getContinueTime().length>0){ - if(vipInfo.containsKey(privilegeId)){ - VipInfo info = vipInfo.get(privilegeId); - if(config.getContinueTime()[1]==1 && nowInt < info.getEffectTime()){ - boolean aBool = config.getCondition().length == 1 && config.getCondition()[0][0] == 0; - if(!aBool){ - newVipInfo.setCount(info.getCount()-config.getCondition()[0][1]); - newVipInfo.setEffectTime(info.getEffectTime()); - vipInfo.put(privilegeId,newVipInfo); - updateString("vipInfo", this.vipInfo); - } - return; - } - maxTime = Math.max(nowInt, info.getEffectTime()) + config.getContinueTime()[0]; - }else { - maxTime = nowInt + config.getContinueTime()[0]; - } - maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000L,0,0,true)/1000); - newVipInfo.setEffectTime(maxTime); - } - this.vipInfo.put(privilegeId,newVipInfo); - updateString("vipInfo", this.vipInfo); - } - /** * 根据时间添加权限 * @param privilageId 权限id 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 a29ed2bb4..a131d082e 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 @@ -57,6 +57,7 @@ import util.MathUtils; import util.TimeUtils; import java.util.*; +import java.util.stream.Collectors; @SuppressWarnings("unchecked") public class PlayerLogic { @@ -375,7 +376,7 @@ public class PlayerLogic { } } LOGGER.info("特权刷新删除日志3:{};{}",user.getId(),removePrivileges); - playerInfoManager.vipFlush(removePrivileges); + vipFlush(user, removePrivileges); // vip刷新后才能发给前端 if(fBuilder != null){ @@ -391,6 +392,95 @@ public class PlayerLogic { } } + /** + * vip刷新逻辑测试 + * @param uid + * @param remove + * @throws Exception + */ + public void vipFlushTest(int uid, int[] remove) throws Exception { + LOGGER.info("刷新特权测试,uid:{},remove:{}",uid,remove); + User user = UserManager.getUser(uid); + Set collect = Arrays.stream(remove).boxed().collect(Collectors.toSet()); + vipFlush(user, collect); + } + + /** + * vip刷新逻辑 + * @param user + * @param removePrivileges + */ + public void vipFlush(User user, Set removePrivileges) { + PlayerManager playerInfoManager = user.getPlayerInfoManager(); + Map vipInfo = playerInfoManager.getVipInfo(); + LOGGER.info("开始刷新特权,uid:{},list:{}",user.getId(),removePrivileges); + if (vipInfo.isEmpty()) { + return; + } + LOGGER.info("开始刷新特权,删除前特权数量,uid:{},size:{}",user.getId(),vipInfo.size()); + for (Integer remove : removePrivileges) { + vipInfo.remove(remove); + } + LOGGER.info("开始刷新特权,删除后特权数量,uid:{},size:{}",user.getId(),vipInfo.size()); + for (Map.Entry entry : vipInfo.entrySet()) { + Integer id = entry.getKey(); + VipInfo info = entry.getValue(); + SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id); + if (null == sPrivilegeTypeConfig) { + 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); + } + } + LOGGER.info("刷新特权完成,特权数量,uid:{},size:{}",user.getId(),vipInfo.size()); + playerInfoManager.setVipInfo(vipInfo); + playerInfoManager.setHadTakeDailyBoxVip(-1); + } + + /** + * 新增或刷新vip信息 + * @param user + * @param privilegeId + */ + public void addVipInfo(User user, int privilegeId){ + SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId); + if (config==null){ + return; + } + PlayerManager playerManager = user.getPlayerInfoManager(); + Map vipInfo = playerManager.getVipInfo(); + int maxTime; + int nowInt = TimeUtils.nowInt(); + VipInfo newVipInfo = new VipInfo(); + if(config.getContinueTime()!=null && config.getContinueTime().length>0){ + if(vipInfo.containsKey(privilegeId)){ + VipInfo info = vipInfo.get(privilegeId); + if(config.getContinueTime()[1]==1 && nowInt < info.getEffectTime()){ + boolean aBool = config.getCondition().length == 1 && config.getCondition()[0][0] == 0; + if(!aBool){ + newVipInfo.setCount(info.getCount()-config.getCondition()[0][1]); + newVipInfo.setEffectTime(info.getEffectTime()); + vipInfo.put(privilegeId,newVipInfo); + playerManager.setVipInfo(vipInfo); + } + return; + } + maxTime = Math.max(nowInt, info.getEffectTime()) + config.getContinueTime()[0]; + }else { + maxTime = nowInt + config.getContinueTime()[0]; + } + maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000L,0,0,true)/1000); + newVipInfo.setEffectTime(maxTime); + } + vipInfo.put(privilegeId,newVipInfo); + playerManager.setVipInfo(vipInfo); + } + public Set getPrivilege(User user, Collection collection) { Map vipInfo = user.getPlayerInfoManager().getVipInfo(); HashSet set = new HashSet<>(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java index 1deecd224..eced2ae6e 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java @@ -605,7 +605,7 @@ public class BuyGoodsNewLogic { if(privilegeType == VipPrivilegeType.ADVENTURE_BASE_REWARD){ CombatLogic.getInstance().getNewAdventureReward(user,true,TimeUtils.nowInt()); } - user.getPlayerInfoManager().addVipInfo(privilege); + PlayerLogic.getInstance().addVipInfo(user, privilege); VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(privilege); indication.addInfos(CommonProto.Privilege.newBuilder().setId(privilege).setUsedTimes(vipInfo.getCount()).setEffectTime(vipInfo.getEffectTime()).build()); } From f99362b3889448bea21fc373039c2defab55b772 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 27 Feb 2024 17:01:04 +0800 Subject: [PATCH 16/30] =?UTF-8?q?vip=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ljsd/jieling/logic/player/PlayerLogic.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 a131d082e..4388e884d 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 @@ -8,6 +8,7 @@ import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType; import com.ljsd.jieling.db.mongo.AreaManager; +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; @@ -410,7 +411,7 @@ public class PlayerLogic { * @param user * @param removePrivileges */ - public void vipFlush(User user, Set removePrivileges) { + public void vipFlush(User user, Set removePrivileges) throws Exception { PlayerManager playerInfoManager = user.getPlayerInfoManager(); Map vipInfo = playerInfoManager.getVipInfo(); LOGGER.info("开始刷新特权,uid:{},list:{}",user.getId(),removePrivileges); @@ -440,6 +441,7 @@ public class PlayerLogic { LOGGER.info("刷新特权完成,特权数量,uid:{},size:{}",user.getId(),vipInfo.size()); playerInfoManager.setVipInfo(vipInfo); playerInfoManager.setHadTakeDailyBoxVip(-1); + MongoUtil.getInstence().lastUpdate(); } /** From 20f77be81dd51be38b5870a0fb3569e5ded72018 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 5 Mar 2024 17:18:24 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 2b4b31e47..af142624e 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"5", - "tables":"" + "version":"6", + "tables":"GlobalActivity" } \ No newline at end of file From fc0c3b1250863f7862f2e9ebdeebfc08b3d5438a Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Tue, 12 Mar 2024 15:19:45 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index af142624e..4499a95c8 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", + "version":"7", "tables":"GlobalActivity" } \ No newline at end of file From bedc8a1c0add74532f1c0b735b202994ebf4d71c Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Wed, 13 Mar 2024 18:11:52 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/db/mongo/LjsdMongoTemplate.java | 10 ----- .../com/ljsd/jieling/db/mongo/MongoUtil.java | 43 +++++++++++++------ .../com/ljsd/jieling/logic/dao/root/User.java | 4 ++ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/LjsdMongoTemplate.java b/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/LjsdMongoTemplate.java index bdd7008db..a82ad689a 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/LjsdMongoTemplate.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/LjsdMongoTemplate.java @@ -38,9 +38,6 @@ public class LjsdMongoTemplate implements MongoUpdateImp { //注释 public void save(int uid,T obj) throws Exception { -// MongoRoot root = (MongoRoot)obj; -// mongoTemplate.save(obj,root.getCollection()); -// root.setBsave(true); int serverIdByUid = AreaManager.getInstance().getServerIdByUid(uid); MongoTemplate otherMonogTemplate = getMongoTemplate(serverIdByUid); if (otherMonogTemplate == null) { @@ -75,14 +72,8 @@ public class LjsdMongoTemplate implements MongoUpdateImp { if (mongoTemplate != null) { return mongoTemplate.findAll(clazz); } - -// for (MongoTemplate mongoTemplate : MongoUtil.mongoTemplateMap.values()) { -// List all = mongoTemplate.findAll(clazz); -// list.addAll(all); -// } } return list; - //return mongoTemplate.findAll(clazz,collectionName); } public List findAllByCondition(Query query, Class entityClass) { @@ -149,7 +140,6 @@ public class LjsdMongoTemplate implements MongoUpdateImp { return otherMonogTemplate.findById(id,clazz,collectionName); } - public T findById(int id, Class clazz) throws Exception { int serverIdByUid ; if(clazz.equals(GlobalSystemControl.class)||clazz.equals(ServerConfig.class)){ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/MongoUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/MongoUtil.java index 1e8bf5431..62a0fd29c 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/MongoUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/db/mongo/MongoUtil.java @@ -12,7 +12,9 @@ import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.util.ConfigurableApplicationContextManager; import com.ljsd.jieling.util.InnerMessageUtil; import com.ljsd.jieling.util.SysUtil; +import com.mongodb.DBObject; import com.mongodb.MongoClient; +import org.bson.Document; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.annotation.Transient; @@ -86,22 +88,37 @@ public class MongoUtil { } //todo 慢查 需要修改 - public List getRandomUsers(int size, int uid, int level) throws Exception { + public List getRandomUsers(int size, int uid, int level) { + // 验证size参数的有效性 if (size <= 0) { - return null; + return Collections.emptyList(); } - int randomLevel = MathUtils.random(5, 20); - Criteria criatira = new Criteria(); - int minLevel = level - randomLevel; - minLevel = Math.max(minLevel, 5); - int maxLevel = level + randomLevel; - long befor3Day = System.currentTimeMillis() - BEFOR_3_DAY; - criatira.andOperator(Criteria.where("id").nin(uid),//不包含自己 - Criteria.where("playerManager.level").gte(minLevel), Criteria.where("playerManager.level").lte(maxLevel), - Criteria.where("playerManager.loginTime").gte(befor3Day)); - Query query = new Query(criatira).limit(size * 2 + 1); + // 随机等级差异的计算 + int randomLevel = MathUtils.random(5, 20); + int minLevel = Math.max(level - randomLevel, 5); + int maxLevel = level + randomLevel; + + // 计算三天前的时间点 + long threeDaysAgo = System.currentTimeMillis() - BEFOR_3_DAY; + + // 构建查询条件 + Criteria criteria = Criteria.where("id").nin(uid) + .and("playerManager.level").gte(minLevel).lte(maxLevel) + .and("playerManager.loginTime").gte(threeDaysAgo); + + // 创建查询对象,并设置限制条件 + int length = size * 2 + 1; + Query query = Query.query(criteria).limit(length); + + // 限定返回的字段,只返回需要的字段可以提高效率 query.fields().include("playerManager"); + +// MongoTemplate mongoTemplate = mongoTemplateMap.get(GameApplication.serverId); +// DBObject explainResult = mongoTemplate.getCollection("user").find(query.getQueryObject()).explain(); +// LOGGER.info("随机玩家mongo检查:{}",explainResult.toString()); + + // 执行查询 return this.myMongoTemplate.findAllByCondition(query, User.class); } @@ -266,7 +283,7 @@ public class MongoUtil { mongoTemplate = new MongoTemplate(mongoDbFactory, mappingMongoConverter); mongoTemplateMap.put(serverId,mongoTemplate); } - return mongoTemplate; + return mongoTemplate; } /** diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/User.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/User.java index 3ccaa5f57..38a613dae 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/User.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/User.java @@ -6,7 +6,11 @@ import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.jbean.ActivityManager; import com.ljsd.jieling.jbean.gm.GmActivityManager; import com.ljsd.jieling.logic.dao.*; +import org.springframework.data.mongodb.core.index.CompoundIndex; +import org.springframework.data.mongodb.core.mapping.Document; +@Document +@CompoundIndex(def = "{'playerManager.level' : 1, 'playerManager.loginTime': 1}", name = "level_loginTime_idx") public class User { public static final String _COLLECTION_NAME = "user"; From 9cbb9f06a442ecdfed3eb4ef5b9e023324381f78 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 15 Mar 2024 10:42:04 +0800 Subject: [PATCH 20/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 4499a95c8..e4ed9d8c0 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"7", - "tables":"GlobalActivity" + "version":"6", + "tables":"HeroRankupConfig" } \ No newline at end of file From 0503da80cba830f411cc8049710171390b95709a Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 15 Mar 2024 11:29:40 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index e4ed9d8c0..e3e89b919 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { "version":"6", - "tables":"HeroRankupConfig" + "tables":"HeroRankupConfig|RechargeCommodityConfig" } \ No newline at end of file From c1f27f93659da6b262f4741a90b0f3e323019121 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 15 Mar 2024 15:22:12 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index e3e89b919..99760df72 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", - "tables":"HeroRankupConfig|RechargeCommodityConfig" + "version":"7", + "tables":"HeroRankupConfig|RechargeCommodityConfig|GlobalActivity" } \ No newline at end of file From 1d136a81b7051eeca791a50c72f90fde7bae418a Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 15 Mar 2024 15:43:43 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 99760df72..64a6ef367 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { "version":"7", - "tables":"HeroRankupConfig|RechargeCommodityConfig|GlobalActivity" + "tables":"HeroRankupConfig|RechargeCommodityConfig|GlobalActivity|MonsterConfig|MainLevelConfig" } \ No newline at end of file From b6e4cf9f1ee42d57bffa091e054ab3c3f929d359 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Fri, 15 Mar 2024 15:48:44 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 64a6ef367..2b4b31e47 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"7", - "tables":"HeroRankupConfig|RechargeCommodityConfig|GlobalActivity|MonsterConfig|MainLevelConfig" + "version":"5", + "tables":"" } \ No newline at end of file From 7afdf411bfcac574412874b8d929a9ffb3a6e36b Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 18 Mar 2024 10:30:02 +0800 Subject: [PATCH 25/30] =?UTF-8?q?=E8=A3=85=E5=A4=87=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/jieling/logic/dao/EquipManager.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/EquipManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/EquipManager.java index 73d92734f..9af4dbfe4 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/EquipManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/EquipManager.java @@ -60,6 +60,11 @@ public class EquipManager extends MongoBase { updateString("equipMap." + equip.getId(), equip); } + public void updateEquip(PropertyItem equip){ + equipMap.put(equip.getId(),equip); + updateString("equipMap", equipMap); + } + public void removeEquip(String equipId){ if (!equipMap.containsKey(equipId)){ return; @@ -130,9 +135,11 @@ public class EquipManager extends MongoBase { public void loadFaxiang(String key,String heroId) { PropertyItem faxiang = getEquip(key); - if (faxiang != null){ - faxiang.setHeroId(heroId); + if (faxiang == null){ + return; } + faxiang.setHeroId(heroId); + updateEquip(faxiang); } public void unloadFaxiang(String key) { From a27e058066c46c00c2f5d4f4e345317d8702726d Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 18 Mar 2024 13:55:50 +0800 Subject: [PATCH 26/30] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=8E=BB=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/chat/logic/ChatLogic.java | 32 ++--- .../ljsd/jieling/chat/messge/LoopQueue.java | 124 ++++++++++-------- .../jieling/chat/messge/MessageCache.java | 71 ++++------ .../com/ljsd/jieling/util/CBean2Proto.java | 52 +++----- 4 files changed, 127 insertions(+), 152 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java index 7a40a8627..1e78d2405 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java @@ -55,7 +55,8 @@ public class ChatLogic { */ public void getAllChatMessageInfo(ISession iSession, int chatType,long messageId) throws Exception { int uid = iSession.getUid(); - FriendManager friendManager = UserManager.getUser(uid).getFriendManager(); + User user = UserManager.getUser(uid); + FriendManager friendManager = user.getFriendManager(); List friends = friendManager.getFriends(); List chatInfoList = new ArrayList<>(); switch (chatType){ @@ -66,14 +67,14 @@ public class ChatLogic { chatInfoList = MessageCache.worldMsg.getObjs(messageId); break; case 2://公会 - int guildId = UserManager.getUser(uid).getPlayerInfoManager().getGuildId(); + int guildId = user.getPlayerInfoManager().getGuildId(); if(guildId!=0&&MessageCache.guildMsg.containsKey(guildId)){ chatInfoList = MessageCache.guildMsg.get(guildId).getObjs(messageId); } break; case 3: //好友 Map hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid); - if (hmget != null && hmget.size() != 0){ + if (hmget != null && !hmget.isEmpty()){ for (Map.Entry entry :hmget.entrySet()){ String[] split = entry.getKey().toString().split("#"); String message = String.valueOf(entry.getValue()); @@ -82,16 +83,12 @@ public class ChatLogic { continue; } long time = Long.parseLong(split[1]); - User user = UserManager.getUser(userid); - chatInfoList.add(CBean2Proto.getChatInfoBuilder(user, message,time,0)); + chatInfoList.add(CBean2Proto.getChatInfoBuilder(userid, message,time,0)); } - } - if (hmget!= null && !hmget.isEmpty()){ //取出数据好友聊天数据后删除 RedisUtil.getInstence().del(GameApplication.serverId + RedisKey.CUser_Chat + uid); } break; - case 4: //跨服 int group = GlobleSystemLogic.getInstence().getCrossGroup(); if(group==-1){ @@ -99,11 +96,10 @@ public class ChatLogic { return; } chatInfoList = MessageCache.getCrossMsg(messageId,String.valueOf(group)); - break; - default:{ - LOGGER.info("getAllChatMessageInfo wrong chatType=>{} uid=>{}", chatType, uid); - } + default: + LOGGER.info("getAllChatMessageInfo wrong chatType=>{} uid=>{}", chatType, uid); + break; } ChatProto.GetChatMessageInfoResponse getChatMessageInfoResponse = ChatProto.GetChatMessageInfoResponse .newBuilder().addAllChatInfo(chatInfoList) @@ -153,7 +149,7 @@ public class ChatLogic { result[i]=c; } tmp = new String(result); - ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1); + ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(),tmp,nowTime,-1); ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build(); MessageUtil.sendMessage(iSession,1,msgId,response,true); return; @@ -190,7 +186,7 @@ public class ChatLogic { mes[i]='*'; } tmp = new String(mes); - ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1); + ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(),tmp,nowTime,-1); ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build(); MessageUtil.sendMessage(iSession,1,msgId,response,true); ReportUtil.onReportEvent(user, ReportEventEnum.SEND_MESSAGE.getType(),String.valueOf(chatType),message,new Date()); @@ -200,7 +196,7 @@ public class ChatLogic { switch (chatType){ case 1: //世界 long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_WORD_MSG_ID + GameApplication.serverId); - ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId); + ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(),message,nowTime,messageId); MessageCache.addWordMsg(chatInfo,messageId); break; @@ -210,7 +206,7 @@ public class ChatLogic { if(guildId==0){ throw new ErrorCodeException(ErrorCode.CHAT_NO_FAMILY); } - chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId); + chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(),message,nowTime,messageId); MessageCache.addGuildMsg(chatInfo,messageId,guildId); break; case 3: //好友 @@ -222,7 +218,7 @@ public class ChatLogic { //现在好友推送 if (OnlineUserManager.checkUidOnline(friendId)) { ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId); - chatInfo = CBean2Proto.getChatInfoBuilder(user, message, nowTime, 0); + chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(), message, nowTime, 0); sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder() .setChatInfo(chatInfo) .setType(1) @@ -242,7 +238,7 @@ public class ChatLogic { } messageId = RedisUtil.getInstence().increment( RedisKey.CHAT_CROSS_MSG_ID + group); - chatInfo = CBean2Proto.getCrossChatInfoBuilder(user,message,nowTime,messageId); + chatInfo = CBean2Proto.getChatInfoBuilder(user.getId(),message,nowTime,messageId); MessageCache.addCrossMsg(chatInfo,messageId,String.valueOf(group)); break; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java index 806495039..9998c5430 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java @@ -3,6 +3,10 @@ package com.ljsd.jieling.chat.messge; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; public class LoopQueue { class Item{ @@ -19,93 +23,103 @@ public class LoopQueue { } } - private int writeIndex; - private Item[] queueList; - private int maxlen = 0; - private int getMaxLen =0; - private long diffTime ; - private int initLength =20; + private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); + private final Lock writeLock = new ReentrantLock(); + private int writeIndex; // 这是共享资源的索引 + private final Item[] queueList; // 共享资源 + private int maxlen; // 假设的最大长度 + private long diffTime;// 时间差阈值,假设 + private int initLength = 20; // 假设的初始长度 - public LoopQueue(int maxlen, int getMaxLen, long diffTime) { + public LoopQueue(int maxlen, long diffTime) { this.maxlen = maxlen; - queueList = (Item[])Array.newInstance(Item.class, maxlen); + queueList = (Item[])Array.newInstance(Item.class, maxlen); for(int i=0; i getObjs(long messageId) { + public List getObjs(long messageId) { List objs = new ArrayList<>(); - int nextIndex = writeIndex%maxlen-1; - int endIndex = writeIndex%maxlen; - if(nextIndex==-1){ - nextIndex = maxlen - 1; - } + boolean needCompareTime = (messageId == 0); - long curTime = System.currentTimeMillis(); - while(queueList[nextIndex].obj != null && nextIndex != endIndex){ +// readWriteLock.readLock().lock(); + try { + int nextIndex = (writeIndex - 1 + maxlen) % maxlen; + int endIndex = writeIndex % maxlen; - if(!needCompareTime){ - //比较消息id - if(messageId>=queueList[nextIndex].messgeId){ + long curTime = System.currentTimeMillis(); + + while (queueList[nextIndex] != null && nextIndex != endIndex) { + if (!needCompareTime && messageId >= queueList[nextIndex].messgeId) { break; } - } + if (needCompareTime) { + if (objs.size() >= initLength || + (diffTime != -1 && (curTime - queueList[nextIndex].timestamp) >= diffTime)) { + break; + } + } - if (needCompareTime && objs.size() >= initLength ){ - break; - } + objs.add(0, queueList[nextIndex].obj); - if(needCompareTime){ - if(diffTime!=-1&& (curTime - queueList[nextIndex].timestamp) >= diffTime){ + if (objs.size() > maxlen) { break; } - } - objs.add(0, queueList[nextIndex].obj); - if(objs.size()>maxlen){ - break; - } - nextIndex--; - if(nextIndex == -1){ - nextIndex = maxlen - 1; + nextIndex = (nextIndex - 1 + maxlen) % maxlen; } + } finally { +// readWriteLock.readLock().unlock(); } - if(!needCompareTime && objs.size()>getMaxLen){ - return objs.subList(0,getMaxLen); + + // 后处理不需要在锁中进行 + if (!needCompareTime && objs.size() > maxlen) { + return objs.subList(0, maxlen); } + return objs; } - public synchronized String toString() { - StringBuilder builder = new StringBuilder(); - for(int i=0; i"); + if (queueList[i] == null) { + builder.append("-1"); + } else { + builder.append(queueList[i].toString()); // 确保obj有有效的toString方法 + } + builder.append(","); } - builder.append("->"); - if(queueList[i].obj == null){ - builder.append("-1"); - } else { - builder.append(queueList[i].obj); - } - builder.append(","); + return builder.toString(); + } finally { +// readWriteLock.readLock().unlock(); } - return builder.toString(); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java index 26272dbc8..5ce3a4a14 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java @@ -3,23 +3,18 @@ package com.ljsd.jieling.chat.messge; import com.google.gson.Gson; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; -import org.luaj.vm2.ast.Str; import rpc.protocols.ChatProto; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; public class MessageCache { private static final int capuatiy =30; private static final int msgInterval = 24*3600*1000; private static final int perCaught= 30; - public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,-1); - public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval); + public static LoopQueue worldMsg = new LoopQueue(capuatiy, -1); + public static LoopQueue sysMsg = new LoopQueue(capuatiy, msgInterval); public static Map guildMsg = new ConcurrentHashMap(); private static Gson gson = new Gson(); @@ -32,7 +27,7 @@ public class MessageCache { } public static void addGuildMsg(ChatProto.ChatInfo chatInfo,long messageId,int guildId){ if(!guildMsg.containsKey(guildId)){ - guildMsg.put(guildId,new LoopQueue(capuatiy,perCaught,-1)); + guildMsg.put(guildId,new LoopQueue(capuatiy, -1)); } guildMsg.get(guildId).push(chatInfo,messageId); } @@ -44,53 +39,41 @@ public class MessageCache { RedisUtil.getInstence().hset(key,String.valueOf(index),gson.toJson(chatInfo)); } - public static List getCrossMsg(long messageId,String group){ - String key = RedisKey.CHAT_CROSS_INFO_CACHE+group; - Map map = new HashMap<>(); - Map collect = RedisUtil.getInstence().hmget(key); - collect.entrySet().forEach(o -> map.put(Integer.parseInt(o.getKey().toString()), - gson.fromJson(o.getValue().toString(),ChatProto.ChatInfo.class))); + public static List getCrossMsg(long messageId, String group) { + String key = RedisKey.CHAT_CROSS_INFO_CACHE + group; + Map rawMap = RedisUtil.getInstence().hmget(key); + + if (rawMap == null || rawMap.isEmpty()) { + return Collections.emptyList(); + } List objs = new ArrayList<>(); Object obj = RedisUtil.getInstence().get(RedisKey.CHAT_CROSS_MSG_ID + group); - if(obj==null){ + + if (obj == null) { return objs; } int writeIndex = Integer.parseInt(String.valueOf(obj)); + int nextIndex = writeIndex % capuatiy; // Assuming capacity is a static value or defined elsewhere - Integer nextIndex = writeIndex%capuatiy; - - if(nextIndex==-1){ - nextIndex = capuatiy - 1; - } - if(collect.size()<=0){ - return objs; - } boolean needCompareTime = (messageId == 0); - while(map.containsKey(nextIndex)){ + while (rawMap.containsKey(nextIndex)) { + String rawValue = String.valueOf(rawMap.get(nextIndex)); + ChatProto.ChatInfo chatInfo = gson.fromJson(rawValue, ChatProto.ChatInfo.class); - ChatProto.ChatInfo o = map.get(nextIndex); - if(!needCompareTime){ - //比较消息id - if(messageId>=o.getMessageId()){ - break; - } - - } - objs.add(0, o); - if(objs.size()>perCaught){ + if (!needCompareTime && messageId >= chatInfo.getMessageId()) { break; } - nextIndex--; - if(nextIndex == -1){ - nextIndex = capuatiy - 1; - } - } - if(!needCompareTime && objs.size()>perCaught){ - return objs.subList(0,perCaught); - } - return objs; + objs.add(0, chatInfo); + + if (objs.size() > perCaught) { + break; + } + + nextIndex = (nextIndex - 1 + capuatiy) % capuatiy; + } + return objs.size() > perCaught ? objs.subList(0, perCaught) : objs; } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/CBean2Proto.java b/serverlogic/src/main/java/com/ljsd/jieling/util/CBean2Proto.java index 7575b21f7..58d4a3240 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/CBean2Proto.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/CBean2Proto.java @@ -786,42 +786,24 @@ public class CBean2Proto { .build(); } - - public static ChatProto.ChatInfo getChatInfoBuilder(User user,String message,long time,long messageId) { + public static ChatProto.ChatInfo getChatInfoBuilder(int uid,String message,long time,long messageId) { ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder(); - PlayerManager playerInfoManager = user.getPlayerInfoManager(); - chatInfo.setSenderId(user.getId()); - chatInfo.setSenderName(playerInfoManager.getNickName()); - chatInfo.setSenderlevel(playerInfoManager.getLevel()); - chatInfo.setSendervip(playerInfoManager.getVipLevel()); - chatInfo.setTimes(time); - chatInfo.setMsg(message); - chatInfo.setHead(playerInfoManager.getHead()); - chatInfo.setFrame(playerInfoManager.getHeadFrame()); - chatInfo.setSoulVal(playerInfoManager.getMaxForce()); - chatInfo.setMessageId(messageId); - chatInfo.setUserTitle(playerInfoManager.getUserTitle()); - chatInfo.setPracticeLevel(user.getHeroManager().getPracticeLevel()); - return chatInfo.build(); - } - - public static ChatProto.ChatInfo getCrossChatInfoBuilder(User user,String message,long time,long messageId){ - ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder(); - PlayerManager playerInfoManager = user.getPlayerInfoManager(); - chatInfo.setSenderId(user.getId()); - chatInfo.setSenderName(playerInfoManager.getNickName()); - chatInfo.setSenderlevel(playerInfoManager.getLevel()); - chatInfo.setSendervip(playerInfoManager.getVipLevel()); - chatInfo.setTimes(time); - chatInfo.setMsg(message); - chatInfo.setHead(playerInfoManager.getHead()); - chatInfo.setFrame(playerInfoManager.getHeadFrame()); - chatInfo.setSoulVal(playerInfoManager.getMaxForce()); - chatInfo.setMessageId(messageId); - chatInfo.setUserTitle(playerInfoManager.getUserTitle()); - chatInfo.setPracticeLevel(user.getHeroManager().getPracticeLevel()); - String serverName = CrossServiceLogic.simplifyServerName(GameApplication.serverId); - chatInfo.setServerName(serverName); + CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid); + if (csPlayer != null){ + chatInfo.setSenderId(csPlayer.getUserId()); + chatInfo.setSenderName(csPlayer.getName()); + chatInfo.setSenderlevel(csPlayer.getLevel()); + chatInfo.setTimes(time); + chatInfo.setMsg(message); + chatInfo.setHead(csPlayer.getHead()); + chatInfo.setFrame(csPlayer.getHeadFrame()); + chatInfo.setSoulVal(csPlayer.getMaxFore()); + chatInfo.setMessageId(messageId); + chatInfo.setUserTitle(csPlayer.getUserTitle()); + chatInfo.setPracticeLevel(csPlayer.getPracticeLevel()); + String serverName = CrossServiceLogic.getServerName(csPlayer.getServerId()); + chatInfo.setServerName(serverName); + } return chatInfo.build(); } From 6aafcc9cd2636037b4d0a7b184353ef0767193e4 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 18 Mar 2024 14:48:48 +0800 Subject: [PATCH 27/30] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java | 2 +- .../src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java index 1e78d2405..4eefd3a30 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java @@ -101,7 +101,7 @@ public class ChatLogic { LOGGER.info("getAllChatMessageInfo wrong chatType=>{} uid=>{}", chatType, uid); break; } - ChatProto.GetChatMessageInfoResponse getChatMessageInfoResponse = ChatProto.GetChatMessageInfoResponse + ChatProto.GetChatMessageInfoResponse getChatMessageInfoResponse = ChatProto.GetChatMessageInfoResponse .newBuilder().addAllChatInfo(chatInfoList) .build(); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REPONSE_VALUE, getChatMessageInfoResponse, true); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java index 9998c5430..e3d8ca460 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/LoopQueue.java @@ -67,7 +67,7 @@ public class LoopQueue { long curTime = System.currentTimeMillis(); - while (queueList[nextIndex] != null && nextIndex != endIndex) { + while (queueList[nextIndex].obj != null && nextIndex != endIndex) { if (!needCompareTime && messageId >= queueList[nextIndex].messgeId) { break; } From 6df338db96bf52e90587615332a128df8e0c4eda Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Mon, 18 Mar 2024 18:33:05 +0800 Subject: [PATCH 28/30] =?UTF-8?q?=E7=83=AD=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 2b4b31e47..0d8ceb3fc 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"5", - "tables":"" + "version":"6", + "tables":"BlessingConfigNew" } \ No newline at end of file From d5d2ff3d2a1bd934318c6cf90a2dea34fc20bb5a Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Wed, 20 Mar 2024 13:51:24 +0800 Subject: [PATCH 29/30] =?UTF-8?q?=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/c_database_version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/c_database_version.json b/conf/c_database_version.json index 0d8ceb3fc..f0cc5b377 100644 --- a/conf/c_database_version.json +++ b/conf/c_database_version.json @@ -1,4 +1,4 @@ { - "version":"6", - "tables":"BlessingConfigNew" + "version":"", + "tables":"" } \ No newline at end of file From b1f60947ca30681c49ca096a5ebec7ae702e0d96 Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Thu, 21 Mar 2024 14:32:32 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E8=A3=85=E5=A4=87=E5=8A=A0=E9=81=93?= =?UTF-8?q?=E5=85=B7=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/jieling/logic/dao/Item.java | 1 - .../com/ljsd/jieling/logic/item/ItemLog.java | 14 +++++ .../java/com/ljsd/jieling/util/ItemUtil.java | 54 ++++++++++++------- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Item.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Item.java index 0ff4ea4a3..f64412bda 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Item.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Item.java @@ -24,7 +24,6 @@ public class Item extends MongoBase { } - public int getItemId() { return itemId; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLog.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLog.java index c310a600b..91e216113 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLog.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLog.java @@ -16,6 +16,9 @@ public class ItemLog { private String id; @Field(value = "uid") private int uid; + /** + * 0 增加,1 减少 + */ @Field(value = "type") private int type; @Field(value = "level") @@ -46,6 +49,17 @@ public class ItemLog { this.itemTotalNum = itemTotalNum; } + public ItemLog(User user, int type, int reason, int itemId, long itemNum, long itemTotalNum) { + this.uid = user.getId(); + this.type = type; + this.level = user.getPlayerInfoManager().getLevel(); + this.time = String.valueOf(TimeUtils.now()); + this.reason = reason; + this.itemId = itemId; + this.itemNum = itemNum; + this.itemTotalNum = itemTotalNum; + } + public ItemLog(User user, int type, int reason, Item item, long itemNum) { this.uid = user.getId(); this.type = type; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java index d0f42368e..f239fcacb 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java @@ -71,7 +71,7 @@ public class ItemUtil { addCard(user, itemObj.getCardMap(), dropBuilder,reason); addEquip(user, itemObj.getEquipMap(), dropBuilder,reason); addSpecialMonster(user,itemObj,dropBuilder,reason); - addMagicSoldier(user,itemObj.getMagicSoldierMap(),dropBuilder); + addMagicSoldier(user,itemObj.getMagicSoldierMap(),dropBuilder,reason); addGemNew(user,itemObj.getGemNewMap(),dropBuilder); } @@ -1189,18 +1189,20 @@ public class ItemUtil { StringBuilder reward = new StringBuilder(); List jewelList = new CopyOnWriteArrayList<>(); + Map propertyItemMap = user.getEquipManager().getEquipMap(); // jewelMap 为了做宝物礼包推送<宝物品质, 数量> ArrayList jewelPush = new ArrayList<>(); for (Map.Entry entry : equipMap.entrySet()) { Integer key = entry.getKey(); int count = entry.getValue(); + long count1 = propertyItemMap.values().stream().filter(v -> v.getEquipId() == key).count(); int itemType = SItem.getsItemMap().get(key).getItemType(); if(!ifPropertyItem(itemType)){ continue; } for (int i = 0; i < count; i++) { // 到达装备上限,发送邮件,不走背包 - if (user.getEquipManager().getEquipMap().size() >= gameSetting.getEquipNumlimit()) { + if (propertyItemMap.size() >= gameSetting.getEquipNumlimit()) { reward.append(key).append("#1").append("|"); if (reward.length() > 0){ reward = new StringBuilder(reward.substring(0, reward.length() - 1)); @@ -1211,6 +1213,8 @@ public class ItemUtil { ReportUtil.onReportEvent(user,ReportEventEnum.GET_TREASURE.getType(), key,reason); } } + // 后台日志 + ItemLogic.getInstance().addItemLog(new ItemLog(user, 0, reason, key, count, count+count1)); } if (reward.length() > 0) { @@ -1298,42 +1302,42 @@ public class ItemUtil { int hasHeroNum = user.getHeroManager().getHeroMap().size(); String title = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_title"); String content = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_txt"); + int nowInt = TimeUtils.nowInt(); if (hasHeroNum >= gameSetting.getHeroNumlimit()){ String reward = getLimitReward(cardMap); - int nowTime =(int) (TimeUtils.now()/1000); - MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME); + MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowInt,Global.MAIL_EFFECTIVE_TIME); MessageUtil.nofityBagIsFull(user); return; } List heroList = new CopyOnWriteArrayList<>(); StringBuilder reward = new StringBuilder(); for (Map.Entry entry : cardMap.entrySet()) { + Integer itemId = entry.getKey(); int count = entry.getValue(); for (int i = 0; i < count; i++) { if (user.getHeroManager().getHeroMap().size() >= gameSetting.getHeroNumlimit()) { if (reward.length() == 0){ - reward = new StringBuilder(entry.getKey() + "#1"); + reward = new StringBuilder(itemId + "#1"); }else{ - reward.append("|").append(entry.getKey()).append("#1"); + reward.append("|").append(itemId).append("#1"); } continue; } - addCard(user, entry.getKey(),heroList,reason); - SItem sItem = SItem.getsItemMap().get(entry.getKey()); + addCard(user, itemId,heroList,reason); + SItem sItem = SItem.getsItemMap().get(itemId); extraDropAop(user,dropBuilder,sItem); } // 回退所得神将不更新任务或活动 if (reason == BIReason.HERO_RETURN) { continue; } - fiveStarEvent(user,entry.getKey()); + fiveStarEvent(user, itemId); if(reason != BIReason.HERO_RANDOM){ - fiveStarPushByCombine(user,entry.getKey(),count); + fiveStarPushByCombine(user, itemId,count); } } if (reward.length() > 0) { - int nowTime = (int) (TimeUtils.now() / 1000); - MailLogic.getInstance().sendMail(user.getId(), title, content, reward.toString(), nowTime, Global.MAIL_EFFECTIVE_TIME); + MailLogic.getInstance().sendMail(user.getId(), title, content, reward.toString(), nowInt, Global.MAIL_EFFECTIVE_TIME); MessageUtil.nofityBagIsFull(user); } dropBuilder.addAllHero(heroList); @@ -1866,16 +1870,20 @@ public class ItemUtil { if(itemObj.getSpecialMonsterMap().isEmpty()){ return; } + Map pokemonMap = user.getPokemonManager().getPokemonMap(); for(Map.Entry entry:itemObj.getSpecialMonsterMap().entrySet()){ - for(int i = 0 ; i v.getTmpId() == itemId).count(); + for(int i = 0; i < number; i++){ + Pokemon pokemon = new Pokemon(user.getId(), itemId); user.getPokemonManager().addPokemon(pokemon); if(!user.getPokemonManager().getPokemonGot().contains(pokemon.getTmpId())){ user.getPokemonManager().addPokemonGot(pokemon.getTmpId()); } dropBuilder.addPokemon(CBean2Proto.getPokemon(pokemon)); - SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(entry.getKey()); - ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(),entry.getKey(),animal.getQuality(),reason); + SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(itemId); + ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(), itemId,animal.getQuality(),reason); if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)&&reason!=BIReason.COMPOS_HERO_REWARD) { //策划资质改成星级 String nameColor = user.getPlayerInfoManager().getNameColor(); String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_get_broadcast_content", @@ -1886,6 +1894,8 @@ public class ItemUtil { } } } + // 后台日志 + ItemLogic.getInstance().addItemLog(new ItemLog(user, 0, reason, itemId, count, count+number)); } // 触发任务,东海寻仙 user.getUserMissionManager().onGameEvent(user,GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.HAVE_ID_STAR_LV_POKEMON_NUM); @@ -1894,17 +1904,23 @@ public class ItemUtil { /** * 掉落神兵 */ - private static void addMagicSoldier(User user,Map map,CommonProto.Drop.Builder dropBuilder) { + private static void addMagicSoldier(User user,Map map,CommonProto.Drop.Builder dropBuilder, int reason) { if(map == null || map.isEmpty()){ return; } MagicSoldierManager manager = user.getMagicSoldierManager(); + Map soldierMap = manager.getMagicSoldierMap(); for (Map.Entry entry : map.entrySet()) { - for (int i = 0; i < entry.getValue(); i++) { - MagicSoldier soldier = new MagicSoldier(user.getId(), entry.getKey()); + Integer itemId = entry.getKey(); + Integer number = entry.getValue(); + long count = soldierMap.values().stream().filter(v -> v.getTmpId() == itemId).count(); + for (int i = 0; i < number; i++) { + MagicSoldier soldier = new MagicSoldier(user.getId(), itemId); manager.setMagicSoldier(soldier); dropBuilder.addMagicSoldier(CBean2Proto.toBeanMagicSoldier(soldier)); } + // 后台日志 + ItemLogic.getInstance().addItemLog(new ItemLog(user, 0, reason, itemId, count, count+number)); } }