From 17e2d8068515a57e68cf998e163a30048a83c7cc Mon Sep 17 00:00:00 2001 From: lvxinran Date: Mon, 17 May 2021 21:34:40 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E4=B8=8A=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 baac71c65..59f919dcc 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java @@ -772,7 +772,7 @@ public class ItemUtil { } } }else{ - item.setItemNum((int) (item.getItemNum() + entry.getValue())); + item.setItemNum(item.getItemNum() + entry.getValue()); } } From dd6b800ecb99363ef07200f9a31118efc75b9c5e Mon Sep 17 00:00:00 2001 From: duhui Date: Thu, 20 May 2021 11:14:23 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=88=98=E6=96=97bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fightmanager/src/main/java/com/ljsd/fight/CheckFight.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java index 3fab7539b..17701ce21 100644 --- a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java +++ b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java @@ -110,9 +110,9 @@ public class CheckFight { for (int i = 1; i <= result.length(); i++) { long tolong = result.rawget(i).tolong(); if(tolong>0){ - resultCache[i+1]= Math.min((long) Integer.MAX_VALUE,tolong); + resultCache[i+1]= Math.min(Long.MAX_VALUE,tolong); }else { - resultCache[i+1]= Math.max((long) Integer.MIN_VALUE,tolong); + resultCache[i+1]= Math.max(Long.Min_VALUE,tolong); } resultCache[i+1] = (long) result.rawget(i).toint(); LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]); From b20567f328873df9343d92a3fb27b3a09b1cbec8 Mon Sep 17 00:00:00 2001 From: duhui Date: Thu, 20 May 2021 11:20:21 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fightmanager/src/main/java/com/ljsd/fight/CheckFight.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java index 17701ce21..ca53200f7 100644 --- a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java +++ b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java @@ -112,7 +112,7 @@ public class CheckFight { if(tolong>0){ resultCache[i+1]= Math.min(Long.MAX_VALUE,tolong); }else { - resultCache[i+1]= Math.max(Long.Min_VALUE,tolong); + resultCache[i+1]= Math.max(Long.MIN_VALUE,tolong); } resultCache[i+1] = (long) result.rawget(i).toint(); LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]); From e7ea5f645e889f3415a685a45c09b0092deae13a Mon Sep 17 00:00:00 2001 From: "DESKTOP-98AVA47\\Administrator" Date: Thu, 13 May 2021 01:33:12 +0700 Subject: [PATCH 04/13] =?UTF-8?q?=E5=B7=A5=E4=BC=9A=E5=89=AF=E6=9C=AC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fightmanager/src/main/java/com/ljsd/fight/CheckFight.java | 2 +- .../java/com/ljsd/jieling/logic/dao/root/GuildInfo.java | 6 +++--- .../com/ljsd/jieling/logic/family/GuildChallengeLogic.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java index ca53200f7..2f4855513 100644 --- a/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java +++ b/fightmanager/src/main/java/com/ljsd/fight/CheckFight.java @@ -114,7 +114,7 @@ public class CheckFight { }else { resultCache[i+1]= Math.max(Long.MIN_VALUE,tolong); } - resultCache[i+1] = (long) result.rawget(i).toint(); + resultCache[i+1] = result.rawget(i).tolong(); LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/GuildInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/GuildInfo.java index 4fe9ba781..816115c2f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/GuildInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/root/GuildInfo.java @@ -55,7 +55,7 @@ public class GuildInfo extends MongoBase { private int currBossId; - private int bossHpRemain; + private long bossHpRemain; private int buffIndex; @@ -284,11 +284,11 @@ public class GuildInfo extends MongoBase { updateString("currBossId",currBossId); } - public int getBossHpRemain() { + public long getBossHpRemain() { return bossHpRemain; } - public void setBossHpRemain(int bossHpRemain) { + public void setBossHpRemain(long bossHpRemain) { this.bossHpRemain = bossHpRemain; updateString("bossHpRemain",bossHpRemain); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java index 27136da6b..f41d8ef09 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java @@ -225,7 +225,7 @@ public class GuildChallengeLogic { }else if(checkResult[0]==0){ //怪物保持在第四位 if(guildInfo.getBossHpRemain()!=-1){ - guildInfo.setBossHpRemain(checkResult[3]==0?10000: (int) checkResult[3]); + guildInfo.setBossHpRemain(checkResult[3]); } }else{ error = "战斗异常!"; @@ -240,7 +240,7 @@ public class GuildChallengeLogic { }else{ //扫荡 if(guildInfo.getBossHpRemain()!=-1){ - int remain = guildInfo.getBossHpRemain() - guildMyInfo.getGuildChallengeDamage(); + long remain = guildInfo.getBossHpRemain() - guildMyInfo.getGuildChallengeDamage(); if(remain>=0){ guildInfo.setBossHpRemain(remain); }else{ From 66d10040d3f12e8a81ec0e9dce5f5456f316d368 Mon Sep 17 00:00:00 2001 From: duhui Date: Tue, 25 May 2021 10:25:12 +0800 Subject: [PATCH 05/13] Merge branch 'dh_dev_gm' into master_test_gn (cherry picked from commit b4048143826ae3a57c3582fab5e811a93dec61a3) --- .../src/main/java/com/ljsd/GmService.java | 15 +----- .../handler/core/ExchangeCdkHandler.java | 2 +- .../ljsd/jieling/kefu/Cmd_fightrecord.java | 31 ++++++++++-- .../ljsd/jieling/kefu/Cmd_updateguild.java | 49 +++++++++++++++++++ .../com/ljsd/jieling/kefu/GmInterface.java | 7 ++- 5 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_updateguild.java diff --git a/serverlogic/src/main/java/com/ljsd/GmService.java b/serverlogic/src/main/java/com/ljsd/GmService.java index 9a6fc4d03..6c93d1f77 100644 --- a/serverlogic/src/main/java/com/ljsd/GmService.java +++ b/serverlogic/src/main/java/com/ljsd/GmService.java @@ -115,19 +115,8 @@ public class GmService implements RPCRequestGMIFace.Iface { } else { LOGGER.info("gm________________________start:"+cmd); obj.exec(parameters); - - // 获取玩家战报系统 - if (cmd.contains("fightrecord")) { - if (cmd.contains("delete")) { - FightRecordLogic.getInstance().delete(); - } else if (cmd.contains("all")){ - String allValue = FightRecordLogic.getInstance().getAll(Integer.parseInt(parameters[1])); - result.setResultMsg(allValue); - } else { - String oneRecord = FightRecordLogic.getInstance().getOneRecord(parameters[0]); - result.setResultMsg(oneRecord); - } - } + String exec2 = obj.exec2(parameters); + result.setResultMsg(exec2); LOGGER.info("gm________________________end:"+cmd); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/core/ExchangeCdkHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/core/ExchangeCdkHandler.java index 4ea5fba98..411344a22 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/core/ExchangeCdkHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/core/ExchangeCdkHandler.java @@ -44,7 +44,7 @@ public class ExchangeCdkHandler extends BaseHandler sCdkInfosCacheMap = CoreLogic.getInstance().getsCdkInfosCacheMap(); - if (cdk.length() != 18 || sCdkInfosCacheMap == null || sCdkInfosCacheMap.isEmpty()) { + if (sCdkInfosCacheMap == null || sCdkInfosCacheMap.isEmpty()) { throw new ErrorCodeException(ErrorCode.CDK_FAIL); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fightrecord.java b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fightrecord.java index 6ac29876f..0aaf1bf7c 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fightrecord.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_fightrecord.java @@ -1,12 +1,37 @@ package com.ljsd.jieling.kefu; +import com.ljsd.jieling.logic.fight.FightRecordLogic; + +import java.util.Optional; + public class Cmd_fightrecord extends GmAbstract { @Override public boolean exec(String[] args) throws Exception { - if (args.length < 2) { - return false; - } return true; } + + @Override + public String exec2(String[] args){ + if (args.length < 2){ + return ""; + } + // 获取玩家战报系统 + String content = Optional.ofNullable(args[0]).orElse(""); + String parm = Optional.ofNullable(args[1]).orElse(""); + String result = ""; + if (content.equals("delete")){ + FightRecordLogic.getInstance().delete(); + } + else if (content.equals("all")){ + result = FightRecordLogic.getInstance().getAll(Integer.parseInt(parm)); + System.out.printf("战报信息,all:{%s}",result); + } + else { + result = FightRecordLogic.getInstance().getOneRecord(content); + System.out.printf("战报信息,OneRecord:{%s}",result); + } + + return result; + } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_updateguild.java b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_updateguild.java new file mode 100644 index 000000000..16e109ce4 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/kefu/Cmd_updateguild.java @@ -0,0 +1,49 @@ +package com.ljsd.jieling.kefu; + +import com.ljsd.jieling.db.mongo.MongoUtil; +import com.ljsd.jieling.exception.ErrorCodeException; +import com.ljsd.jieling.logic.dao.GuilidManager; +import com.ljsd.jieling.logic.dao.root.GuildInfo; +import com.ljsd.jieling.logic.family.GuildLogic; + +import java.util.Optional; + +public class Cmd_updateguild extends GmAbstract { + + @Override + public boolean exec(String[] args) throws Exception { + + int guildId = Optional.of(Integer.parseInt(args[0])).orElse(0); + GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId); + if (guildInfo == null) { + throw new ErrorCodeException("修改公会,公会不存在,公会id:"+guildId); + } + + String parm = Optional.ofNullable(args[1]).orElse(""); + + String content; + switch (parm) { + case "name": + // 修改公会名字 + content = Optional.ofNullable(args[2]).orElse(""); + guildInfo.setName(content); + break; + case "announce": + // 修改公会宣言 + content = Optional.ofNullable(args[2]).orElse(""); + guildInfo.setAnnounce(content); + break; + case "dissolution": + guildInfo.setLevelTime(1); + GuilidManager.addGuildToRelease(guildInfo); + break; + default: + throw new ErrorCodeException("修改公会,类型错误,公会id:"+guildId+",类型:"+parm); + } + GuildLogic.sendFamilyBaseUpdateIndication(guildInfo); + + //非用户线程更新玩家数据 + MongoUtil.getLjsdMongoTemplate().lastUpdate(); + return true; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/kefu/GmInterface.java b/serverlogic/src/main/java/com/ljsd/jieling/kefu/GmInterface.java index d894a1467..6d6a913f7 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/kefu/GmInterface.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/kefu/GmInterface.java @@ -4,5 +4,10 @@ package com.ljsd.jieling.kefu; public interface GmInterface { boolean exec(String[] args) throws Exception; - String usage(); + + default String exec2(String[] args) throws Exception { + return ""; + } + + String usage(); } From 1d7e46ee36dd72ae7069a3fff94530badcc6ff0a Mon Sep 17 00:00:00 2001 From: lvxinran Date: Wed, 26 May 2021 16:23:24 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E7=BB=8F=E9=AA=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamecommon/src/main/java/util/MathUtils.java | 9 +++++++++ .../java/com/ljsd/jieling/logic/dao/PlayerManager.java | 6 +++--- .../src/main/java/com/ljsd/jieling/util/ItemUtil.java | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gamecommon/src/main/java/util/MathUtils.java b/gamecommon/src/main/java/util/MathUtils.java index 70cbeef11..f9e553719 100644 --- a/gamecommon/src/main/java/util/MathUtils.java +++ b/gamecommon/src/main/java/util/MathUtils.java @@ -125,6 +125,15 @@ public class MathUtils { } return original; } + public static long setBetweenWithMax(long original, long min, long max) { + if (original >= max) { + original = max; + } + if (original < min) { + original = min; + } + return original; + } public static int getMaxNum(int a, int b) { if(a>=b){ 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 a4604eb8c..9c6f3165c 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 @@ -42,7 +42,7 @@ public class PlayerManager extends MongoBase { private int level; - private int exp; + private long exp; private int vipLevel; @@ -204,11 +204,11 @@ public class PlayerManager extends MongoBase { this.level = level; } - public int getExp() { + public long getExp() { return exp; } - public void setExp(int exp) throws Exception { + public void setExp(long exp) throws Exception { updateString("exp", exp); this.exp = exp; } 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 59f919dcc..eef133403 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java @@ -846,7 +846,7 @@ public class ItemUtil { if (playerInfoManager.getExp() >= maxExp) { return; } - int curExp = MathUtils.setBetweenWithMax((int)playerInfoManager.getExp() + (int)addExp, 0, maxExp); + long curExp = MathUtils.setBetweenWithMax(playerInfoManager.getExp() + addExp, 0, maxExp); int oldLevel = playerInfoManager.getLevel(); // 当前等级表配置 SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel); From 363262da612e42faec57f56c335b1cadfd3a9383 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Sat, 5 Jun 2021 17:36:45 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E5=A4=A9=E5=AE=AB=E8=BE=BE=E4=BA=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/activity/ExpeditionExpert.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ExpeditionExpert.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ExpeditionExpert.java index f3b52060b..7675624b3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ExpeditionExpert.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ExpeditionExpert.java @@ -56,4 +56,15 @@ public class ExpeditionExpert extends ExpectRankActivity implements IEventHandle super(id); Poster.getPoster().listenEvent(this,EndExpeditionNodeEvent.class); } + @Override + boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception { + int[][] values = sActivityRewardConfig.getValues(); + User user = UserManager.getUser(session.getUid()); + Map value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getActivityMissionMap(); + if (value.containsKey(sActivityRewardConfig.getId())&& value.get(sActivityRewardConfig.getId()).getProgrss()< values[1][0]) { + // MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not"); + return false; + } + return true; + } } From 93fca9a83b5da3c3ea0f0075b1af068961bc0be6 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Thu, 3 Jun 2021 06:34:13 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=8A=A5=E7=A9=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ljsd/jieling/logic/activity/TreasureActivity.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/TreasureActivity.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/TreasureActivity.java index f584daadb..fffee0d0d 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/TreasureActivity.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/activity/TreasureActivity.java @@ -251,6 +251,10 @@ public class TreasureActivity extends AbstractActivity { private void getAllTreasureRewards(User user, ActivityMission activityMission, int destState, List dropList){ for(int i = 1 ; i<=user.getPlayerInfoManager().getTreasureLevel();i++){ Map progressInfoMap = activityMission.getActivityMissionMap(); + if(progressInfoMap.get(i)==null){ + LOGGER.info("问题id:{}",i); + continue; + } int state =progressInfoMap.get(i).getState(); if(state == destState || state == ActivityType.FINISH_TAKED) { continue; From 2dd6b4c382e0f9b29a2f0b07f9049565f3339b51 Mon Sep 17 00:00:00 2001 From: mengchengzhen <13682025901@163.com> Date: Mon, 31 May 2021 12:15:17 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E7=9B=B4=E8=B4=AD=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8e8fe67bf..1b04282c0 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 @@ -346,7 +346,7 @@ public class BuyGoodsNewLogic { ISession session = OnlineUserManager.getSessionByUid(user.getId()); int type = config.getType(); CommonProto.Drop.Builder drop = null; - if(dropArray!=null && dropArray.length>1){ + if(dropArray!=null && dropArray.length>=1){ drop = ItemUtil.drop(user,dropArray, BIReason.DIRECT_BUY); } From 4de7b94119dbd269b0a20a46fefea724f1da40a9 Mon Sep 17 00:00:00 2001 From: duhui Date: Wed, 9 Jun 2021 00:06:33 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E5=89=AF=E6=9C=AC?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/logic/dao/CumulationData.java | 3 ++ .../logic/family/GuildChallengeLogic.java | 3 ++ .../ljsd/jieling/logic/mission/GameEvent.java | 2 ++ .../jieling/logic/mission/MissionType.java | 2 ++ .../mission/data/DataManagerDistributor.java | 2 ++ .../mission/data/GuildBossRoomManager.java | 30 +++++++++++++++++++ .../event/MissionEventDistributor.java | 5 ++++ 7 files changed, 47 insertions(+) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/GuildBossRoomManager.java diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/CumulationData.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/CumulationData.java index 043d95cd7..718e8c923 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/CumulationData.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/CumulationData.java @@ -194,6 +194,9 @@ public class CumulationData { //山河社稷章节数 public int hardstage_node; + // 公会boss + public int guild_boss_room; + public Result updateData(MissionType missionType, Object...parm) throws Exception { return DataManagerDistributor.updateData(this, missionType,parm); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java index f41d8ef09..6c0b49ed2 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildChallengeLogic.java @@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.fight.*; import com.ljsd.jieling.logic.fight.result.FightResult; import com.ljsd.jieling.logic.mail.MailLogic; +import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.logic.rank.RankContext; import com.ljsd.jieling.logic.rank.RankEnum; @@ -373,6 +374,8 @@ public class GuildChallengeLogic { PlayerLogic.getInstance().checkAndUpdate(user,config.getPrivilege()[0],1); + user.getUserMissionManager().onGameEvent(user, GameEvent.GUILD_BOSS_ROOM,1); + MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true); if(kill==1&&!UserManager.getUser(uid).getGuildMyInfo().getRefreshedBoss().contains(bossId)&&guildInfo.getBossHpRemain()!=-1){ indication.setIsRefresh(1);//需要前端刷新次数 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/GameEvent.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/GameEvent.java index f1c45ab64..9981a3650 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/GameEvent.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/GameEvent.java @@ -123,4 +123,6 @@ public enum GameEvent { HARSTAGE_STARS,//山河社稷图星数 HARSTAGE_NODE,//山河社稷图通关章节 + + GUILD_BOSS_ROOM,//公会boos副本 } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionType.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionType.java index 8a4673e49..9014d4c3d 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionType.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/MissionType.java @@ -136,6 +136,8 @@ public enum MissionType { ENDLESS_OPEN_PERCENT(128), ENDLESS_SMALL_REWARD(129), ENDLESS_BIG_REWARD(130), + + GUILD_BOSS_ROOM(131),//公会副本boss ; private int missionType; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/DataManagerDistributor.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/DataManagerDistributor.java index 966318fae..50f383e6f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/DataManagerDistributor.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/DataManagerDistributor.java @@ -158,6 +158,8 @@ public class DataManagerDistributor { judges.put(MissionType.HARSTAGE_STARS, new HardStageStarsDataManager()); judges.put(MissionType.HARSTAGE_NODE, new HardStageNodeDataManager()); + // 公会副本/boss + judges.put(MissionType.GUILD_BOSS_ROOM,new GuildBossRoomManager()); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/GuildBossRoomManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/GuildBossRoomManager.java new file mode 100644 index 000000000..89fdf3d17 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/data/GuildBossRoomManager.java @@ -0,0 +1,30 @@ +package com.ljsd.jieling.logic.mission.data; + +import com.ljsd.jieling.logic.dao.CumulationData; +import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.mission.MissionType; + +/** + * @Author hj + * @Date 2021/6/7 11:03 + * @Description: + * @Version 1.0 + */ +public class GuildBossRoomManager extends AbstractDataManager { + @Override + public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) { + int num = (int)parm[0]; + data.guild_boss_room+=num; + return new CumulationData.Result(missionType); + } + + @Override + public boolean isFinish(User user,CumulationData data, int[][] value, Object... parm) { + return data.guild_boss_room>=value[1][0]; + } + + @Override + public int getProcess(User user, CumulationData data, int[] missionSubType) { + return data.guild_boss_room; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/event/MissionEventDistributor.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/event/MissionEventDistributor.java index 59ca27064..9c664cc28 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/event/MissionEventDistributor.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mission/event/MissionEventDistributor.java @@ -345,6 +345,11 @@ public class MissionEventDistributor { eventEnumListMap.put(GameEvent.LOGIN_GAME,typeList); eventProcessor.put(GameEvent.LOGIN_GAME,new CumulationDataEventProcessor()); + typeList = new ArrayList<>(); + typeList.add(MissionType.GUILD_BOSS_ROOM); + eventEnumListMap.put(GameEvent.GUILD_BOSS_ROOM,typeList); + eventProcessor.put(GameEvent.GUILD_BOSS_ROOM,new CumulationDataEventProcessor()); + typeList = new ArrayList<>(); typeList.add(MissionType.SEVEN_GIFT_BUY); eventEnumListMap.put(GameEvent.BUY_SEVEN_GIFT,typeList); From 962f0641b7ccac96b3248496570136461b18ca95 Mon Sep 17 00:00:00 2001 From: mengchengzhen <13682025901@163.com> Date: Tue, 8 Jun 2021 10:41:51 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=A4=A9=E7=9C=BC=E5=B0=81=E7=A6=81?= =?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/netty/handler/SkyEyeHandler.java | 50 +++++++------ .../jieling/netty/server/SkyEyeClient.java | 71 +++++++++---------- .../config/skyeye/SkyEyeAutoConfigration.java | 16 +++++ .../config/skyeye/SkyEyeProperties.java | 28 ++++++++ .../com/ljsd/jieling/util/MessageUtil.java | 23 ++++-- 5 files changed, 121 insertions(+), 67 deletions(-) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeAutoConfigration.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeProperties.java diff --git a/netty/src/main/java/com/ljsd/jieling/netty/handler/SkyEyeHandler.java b/netty/src/main/java/com/ljsd/jieling/netty/handler/SkyEyeHandler.java index 961624816..d6212cc56 100644 --- a/netty/src/main/java/com/ljsd/jieling/netty/handler/SkyEyeHandler.java +++ b/netty/src/main/java/com/ljsd/jieling/netty/handler/SkyEyeHandler.java @@ -1,6 +1,7 @@ package com.ljsd.jieling.netty.handler; import com.ljsd.jieling.netty.server.SkyEyeClient; +import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.EventLoop; @@ -9,45 +10,50 @@ import io.netty.handler.timeout.IdleState; import io.netty.handler.timeout.IdleStateEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import rpc.protocols.ChatProto; + +import java.util.concurrent.TimeUnit; @ChannelHandler.Sharable public class SkyEyeHandler extends SimpleChannelInboundHandler { private static final Logger logger = LoggerFactory.getLogger(SkyEyeHandler.class); - long start = 0; - private long heartbeatCount = 0; + private SkyEyeClient cilent; + + public SkyEyeHandler(SkyEyeClient cilent){ + this.cilent = cilent; + } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { + logger.info("天眼激活......"); ctx.fireChannelActive(); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { - System.out.println("掉线了"+(System.currentTimeMillis()-start)/1000); + logger.info("天眼channelInactive......"); + EventLoop loop = ctx.channel().eventLoop(); + loop.schedule(() ->{ + logger.info("天眼reconnect......"); + cilent.connect(); + },1, TimeUnit.SECONDS); + ctx.fireChannelInactive(); } @Override protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { - System.out.println(); + ByteBuf in = (ByteBuf)msg; + int length = in.readableBytes(); + if(length<=6){ + return; + } + byte[] b = new byte[length-6]; + in.readBytes(6); + for(int i =0;i() { - //初始化channel - @Override - protected void initChannel(Channel ch) throws Exception { - ch.pipeline().addLast(watchdog.handlers()); - } - }); - future = bootstrap.connect(host,port); - } - future.sync(); - -// f = bootstrap.connect(); -// f.addListener(new ConnectionListener()); - channel = future.channel(); -// channel.closeFuture().sync(); - } catch (Throwable t) { - LOGGER.error("客户端连接失败------------,ip为{},端口为{}",host,port); - if (null != future) { - try { - timer.newTimeout(watchdog,60, TimeUnit.SECONDS); - } catch (Exception e1) { - e1.printStackTrace(); + bootstrap.remoteAddress(host,port); + bootstrap.handler(new ChannelInitializer() { + //初始化channel + @Override + protected void initChannel(Channel ch) throws Exception { + ch.pipeline().addLast(new SkyEyeHandler(SkyEyeClient.this)); } - } - }finally { -// group.shutdownGracefully(); + }); + connect(); +// channel.closeFuture().sync(); + } catch (Exception e1) { + LOGGER.error("客户端连接失败------------,ip为{},端口为{}",host,port); + e1.printStackTrace(); + } + } + + public void connect(){ + synchronized (bootstrap) { + ChannelFuture future = bootstrap.connect(host, port); + channel = future.channel(); + future.addListener(new ChannelFutureListener() { + public void operationComplete(ChannelFuture f) throws Exception { + boolean succeed = f.isSuccess(); + Channel channel = f.channel(); + if (!succeed) { + LOGGER.info("重连失败"); + f.channel().pipeline().fireChannelInactive(); + } else { + LOGGER.info("重连成功"); + } + } + }); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeAutoConfigration.java b/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeAutoConfigration.java new file mode 100644 index 000000000..c6b1048fe --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeAutoConfigration.java @@ -0,0 +1,16 @@ +package com.ljsd.jieling.config.skyeye; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableConfigurationProperties(SkyEyeProperties.class) +public class SkyEyeAutoConfigration { + @Autowired + private SkyEyeProperties skyEyeProperties; + + public SkyEyeProperties getSkyEyeProperties() { + return skyEyeProperties; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeProperties.java b/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeProperties.java new file mode 100644 index 000000000..e440edebe --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/skyeye/SkyEyeProperties.java @@ -0,0 +1,28 @@ +package com.ljsd.jieling.config.skyeye; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "skyeye") +public class SkyEyeProperties { + + private String appId; + private String gmAddress; + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getGmAddress() { + return gmAddress; + } + + public void setGmAddress(String gmAddress) { + this.gmAddress = gmAddress; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java index 2d4cb4afc..47febca01 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java @@ -1,5 +1,6 @@ package com.ljsd.jieling.util; +import com.alibaba.fastjson.JSON; import com.google.gson.Gson; import com.google.protobuf.ByteString; import com.google.protobuf.GeneratedMessage; @@ -7,6 +8,8 @@ import com.googlecode.protobuf.format.JsonFormat; import com.ljsd.GameApplication; import com.ljsd.SkyEyeService; import com.ljsd.jieling.chat.messge.MessageCache; +import com.ljsd.jieling.config.skyeye.SkyEyeAutoConfigration; +import com.ljsd.jieling.config.skyeye.SkyEyeProperties; import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.SimpleTransaction; import com.ljsd.jieling.db.redis.RedisKey; @@ -36,6 +39,7 @@ import java.util.*; public class MessageUtil { private static final Logger LOGGER = LoggerFactory.getLogger(MessageUtil.class); + private static HashMap skyEyeExtraMap = new HashMap<>(); public static byte[] wrappedBuffer(int uid, int token, int index, int result, int msgId, GeneratedMessage generatedMessage) { byte[] backMessage; @@ -79,8 +83,9 @@ public class MessageUtil { return bytes1; } - public static byte[] wrappedBufferSE(GeneratedMessage generatedMessage) { - byte[] idByte = short2byte((short) 0xd6ac); + public static byte[] wrappedBufferSE(GeneratedMessage generatedMessage,SkyEyeProperties properties) { + int b1 = Integer.parseInt(properties.getAppId(),16); + byte[] idByte = short2byte((short) b1); byte[] backMessage = generatedMessage.toByteArray(); byte[] verifyByte = new byte[2+4+backMessage.length]; byte[] lengthByte =int2bytes(backMessage.length); @@ -457,8 +462,10 @@ public class MessageUtil { if(uid != 0){ he = UserManager.getUser(uid); } - ChatProto.ChatV3.Builder v3 = buildChatV3(msg,me,he,channel); - byte[] byteBuf = wrappedBufferSE(v3.build()); + SkyEyeAutoConfigration netServerConfig = ConfigurableApplicationContextManager.getBean(SkyEyeAutoConfigration.class); + SkyEyeProperties properties = netServerConfig.getSkyEyeProperties(); + ChatProto.ChatV3.Builder v3 = buildChatV3(msg,me,he,channel,properties); + byte[] byteBuf = wrappedBufferSE(v3.build(),properties); // session.writeAndFlush(byteBuf); // session.putBackMassageToMap(byteBuf); ByteBuf bb = PooledByteBufAllocator.DEFAULT.heapBuffer(); @@ -466,7 +473,7 @@ public class MessageUtil { SkyEyeService.sendMsg(bb); } - public static ChatProto.ChatV3.Builder buildChatV3(String msg,User me,User he,int type){ + public static ChatProto.ChatV3.Builder buildChatV3(String msg,User me,User he,int type,SkyEyeProperties properties){ ChatProto.ChatV3.Builder v3 = ChatProto.ChatV3.newBuilder(); String uuid = UUID.randomUUID().toString().replaceAll("-",""); v3.setId(uuid); @@ -479,6 +486,10 @@ public class MessageUtil { ISession iSession = OnlineUserManager.getSessionByUid(me.getId()); String ip = iSession.getChannel().getLocalAddress().getHostString(); v3.setIp(ip); + skyEyeExtraMap.clear(); + String url = properties.getGmAddress(); + skyEyeExtraMap.put("url",url); + v3.setExtra(JSON.toJSONString(skyEyeExtraMap)); return v3; } @@ -491,7 +502,7 @@ public class MessageUtil { v3.setVipLevel(user.getPlayerInfoManager().getVipLevel()); v3.setZoneId(String.valueOf(GameApplication.serverId)); v3.setZoneName(String.valueOf(GameApplication.serverId)); - v3.setServerId(1+""); + v3.setServerId(user.getPlayerInfoManager().getChannel_id()); return v3; } //高位在前,低位在后 From 33cbd037dac468fcd782ac9cb9d985fc3158a8c4 Mon Sep 17 00:00:00 2001 From: mengchengzhen <13682025901@163.com> Date: Tue, 8 Jun 2021 10:42:31 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=A4=A9=E7=9C=BC=E5=B0=81=E7=A6=81?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- serverlogic/src/main/resources/application.properties | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/serverlogic/src/main/resources/application.properties b/serverlogic/src/main/resources/application.properties index 8a90108ef..9647505ff 100644 --- a/serverlogic/src/main/resources/application.properties +++ b/serverlogic/src/main/resources/application.properties @@ -1,5 +1,5 @@ #server info -server.id = 10161 +server.id = 10163 server.openTime = 20190101000101 server.num = 1 server.debug = true @@ -33,7 +33,7 @@ spring.redis.expireTime = -1 #spring.data.mongodb.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/ysj_wx_1 #spring.data.mongodb2.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/develop_ysj_wx_1 #mongodb2 develop -spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10161 +spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10163 spring.data.mongodbcore.uri = mongodb://60.1.1.14:27017/jl_core #spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10212 mongodb.options.maxWaitTime = 120000 @@ -62,13 +62,16 @@ netty.allTimeout=35 #core -services.core.ip=60.1.1.161 +services.core.ip=60.1.1.163 services.core.port=7900 services.core.area=1000 services.core.id=1 services.core.gmport = 7902 services.core.weight=5 +#skyeye +skyeye.appId=d6ac +skyeye.gmAddress=http://193.112.78.218:8888/skyEye logging.config = conf/logback-boot.xml \ No newline at end of file From bda5f6a970e2d663809a905e6eb8a5814e98df10 Mon Sep 17 00:00:00 2001 From: mengchengzhen <13682025901@163.com> Date: Tue, 8 Jun 2021 14:18:08 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E5=A4=A9=E7=9C=BC=E5=B0=81=E7=A6=81prope?= =?UTF-8?q?rties=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ljsd/jieling/util/MessageUtil.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java index 47febca01..4bbb53d26 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/MessageUtil.java @@ -84,7 +84,10 @@ public class MessageUtil { } public static byte[] wrappedBufferSE(GeneratedMessage generatedMessage,SkyEyeProperties properties) { - int b1 = Integer.parseInt(properties.getAppId(),16); + int b1 = 0; + if(properties.getAppId() != null){ + b1 = Integer.parseInt(properties.getAppId(),16); + } byte[] idByte = short2byte((short) b1); byte[] backMessage = generatedMessage.toByteArray(); byte[] verifyByte = new byte[2+4+backMessage.length]; @@ -464,6 +467,9 @@ public class MessageUtil { } SkyEyeAutoConfigration netServerConfig = ConfigurableApplicationContextManager.getBean(SkyEyeAutoConfigration.class); SkyEyeProperties properties = netServerConfig.getSkyEyeProperties(); + if(properties == null){ + return; + } ChatProto.ChatV3.Builder v3 = buildChatV3(msg,me,he,channel,properties); byte[] byteBuf = wrappedBufferSE(v3.build(),properties); // session.writeAndFlush(byteBuf); @@ -488,6 +494,9 @@ public class MessageUtil { v3.setIp(ip); skyEyeExtraMap.clear(); String url = properties.getGmAddress(); + if(url == null){ + return v3; + } skyEyeExtraMap.put("url",url); v3.setExtra(JSON.toJSONString(skyEyeExtraMap)); return v3;