Browse Source

【需求】MMO-20399:调整PlayerPKModeChangeEventB2C协议

meijun 3 năm trước cách đây
mục cha
commit
ce69711b53

+ 47 - 6
Common/CommonAI/Zone/Messages.cs

@@ -4375,14 +4375,24 @@ namespace CommonAI.Zone
 	{
 		public byte[] cardData = new byte[(int)CardType.Max];       //0-3代表有
 
-		public RefreshBossCardInfo()
+        public RefreshBossCardInfo()
+        {
+            this.init();
+        }
+
+        public RefreshBossCardInfo(uint objId) : base(objId)
 		{
-			for (int i = 0; i < (int)CardType.Max; i++)
-			{
-				cardData[i] = (byte)CardType.Max;
-			}
+            this.init();
 		}
 
+        private void init()
+        {
+            for (int i = 0; i < (int)CardType.Max; i++)
+            {
+                cardData[i] = (byte)CardType.Max;
+            }
+        }
+
 		override public void WriteExternal(IOutputStream output)
 		{
 			base.WriteExternal(output);
@@ -4416,7 +4426,9 @@ namespace CommonAI.Zone
 		public byte layer;
 		public byte[] cardData = new byte[(int)CardType.Max];       //0-3代表有
 
-		public BossTriggerCardSkill() { }
+        public BossTriggerCardSkill() { }
+
+        public BossTriggerCardSkill(uint objId) : base(objId){ }
 		override public void WriteExternal(IOutputStream output)
 		{
 			base.WriteExternal(output);
@@ -4449,5 +4461,34 @@ namespace CommonAI.Zone
 			//System.Console.WriteLine("BossTriggerCardSkill: " + this.object_id + ", " + cardData[0] + ", " + cardData[1] + ", " + cardData[2] + ", " + cardData[3]);
 		}
 	}
+
+    /// <summary>
+    /// 单位PK模式改变通知.
+    /// </summary>
+    [MessageType(0x8708)]
+    public class PlayerPKModeChangeEventB2C : ObjectEvent
+    {
+        public PKMode CurMode = PKMode.Peace;
+
+        public PlayerPKModeChangeEventB2C() { }
+
+        public PlayerPKModeChangeEventB2C(uint objId, PKMode mode) : base(objId) 
+        {
+            this.CurMode = mode;
+        } 
+
+        public override void WriteExternal(IOutputStream output)
+        {
+            base.WriteExternal(output);
+            output.PutEnum8(CurMode);
+        }
+
+        public override void ReadExternal(IInputStream input)
+        {
+            base.ReadExternal(input);
+            CurMode = input.GetEnum8<PKMode>();
+        }
+    }
+
 }
 

+ 1 - 1
Common/CommonAI/ZoneServer/JSGModule/JSGServerProfile.cs

@@ -172,7 +172,7 @@ namespace CommonAI.ZoneServer.JSGModule
 			foreach (JSGTriggerProfile info in mZoneTriggers.Values)
 			{
 				JSGPrintLog("##场景触发器总揽:" + info.areaId + ", 检测次数:" + info.total.checkTimes + ", 触发次数: " + info.total.triggerTimes + ", 耗时:" + info.total.timeUse);
-				if (info.total.checkTimes < 10000 || info.total.timeUse < 1000)
+				if (info.total.checkTimes < 5000 || info.total.timeUse < 1000)
 				{
 					continue;
 				}

+ 0 - 21
XmdsCommon/Message/MessageB2C/BattleEventsB2C.cs

@@ -582,27 +582,6 @@ namespace XmdsCommon.Message
 		}
     }
 
-    /// <summary>
-    /// 单位PK模式改变通知.
-    /// </summary>
-    [MessageType(0xF000016)]
-    public class PlayerPKModeChangeEventB2C : PlayerEvent
-    {
-        public PKMode CurMode = PKMode.Peace;
-
-        public override void WriteExternal(IOutputStream output)
-        {
-            base.WriteExternal(output);
-            output.PutEnum8(CurMode);
-        }
-
-        public override void ReadExternal(IInputStream input)
-        {
-            base.ReadExternal(input);
-            CurMode = input.GetEnum8<PKMode>();
-        }
-    }
-
     /// <summary>
     /// 单位PK等级改变通知.
     /// </summary>

+ 5 - 5
XmdsCommon/ZoneClient/XmdsClientVirtual/XmdsClientVirtual_Actor.cs

@@ -23,11 +23,11 @@ namespace XmdsCommon.ZoneClient.XmdsClientVirtual
                 PlayerTeamIntoEventB2C evt = e as PlayerTeamIntoEventB2C;
                 mTeamList = evt.Members;
             }
-            else if (e is PlayerPKModeChangeEventB2C)
-            {
-                PlayerPKModeChangeEventB2C evt = e as PlayerPKModeChangeEventB2C;
-                mData.UnitPKInfo.CurPKMode = evt.CurMode;
-            }
+            //else if (e is PlayerPKModeChangeEventB2C)
+            //{
+            //    PlayerPKModeChangeEventB2C evt = e as PlayerPKModeChangeEventB2C;
+            //    mData.UnitPKInfo.CurPKMode = evt.CurMode;
+            //}
             /* else if (e is SetAutoBattleB2C)
             {
                 SetAutoBattleB2C evt = e as SetAutoBattleB2C;

+ 7 - 7
XmdsCommonServer/Plugin/CardSkill/MonsterCardSkill/JSGMonsterCardData.cs

@@ -13,9 +13,9 @@ namespace XmdsCommonSkill.Plugin.CardSkill
 	//玩家卡牌技能数据
     public class JSGMonsterCardData : JSGCardDataBase
 	{
-		public override void RefreshCardInfo(XmdsVirtual player)
+		public override void RefreshCardInfo(XmdsVirtual unit)
 		{
-			RefreshBossCardInfo cardInfo = new RefreshBossCardInfo();
+			RefreshBossCardInfo cardInfo = new RefreshBossCardInfo(unit.mUnit.ID);
 			for(int i = 0; i < (int)CardType.Max; i++)
 			{
 				if(i < this.mCards)
@@ -28,23 +28,23 @@ namespace XmdsCommonSkill.Plugin.CardSkill
 				}
 				
 			}
-			player.mUnit.queueEvent(cardInfo);
+			unit.mUnit.queueEvent(cardInfo);
 		}
 
-		public override void RefreshCardInfo(XmdsVirtual player, byte[] cardData)
+		public override void RefreshCardInfo(XmdsVirtual unit, byte[] cardData)
 		{
-			RefreshBossCardInfo cardInfo = new RefreshBossCardInfo();
+			RefreshBossCardInfo cardInfo = new RefreshBossCardInfo(unit.mUnit.ID);
 			for (int i = 0; i < (int)CardType.Max; i++)
 			{
 				cardInfo.cardData[i] = cardData[i];
 			}
-			player.SendMsgToPlayer(cardInfo);
+			unit.SendMsgToPlayer(cardInfo);
 		}
 
 
 		public override void SendTriggerInfo(XmdsVirtual unit, CardTriggerResult result, int skillId, byte[] cardData)
 		{
-			BossTriggerCardSkill launchInfo = new BossTriggerCardSkill();
+			BossTriggerCardSkill launchInfo = new BossTriggerCardSkill(unit.mUnit.ID);
 			launchInfo.cardSkill = skillId;
 			launchInfo.type = result.type;
 			launchInfo.layer = result.sameNums;

+ 2 - 4
XmdsCommonServer/Plugin/XmdsVirtual/XmdsVirtual_Player.Message.cs

@@ -373,13 +373,11 @@ namespace XmdsCommonServer.Plugin
         /// <param name="evt"></param>
         private void OnReceivePlayerPKModeChangeEventR2B(PlayerPKModeChangeEventR2B evt)
         {
-            FormatLog("OnReceivePlayerPKLvChangeEventR2B", null);
+            log.Info("OnReceivePlayerPKLvChangeEventR2B:" + this.mUnit.PlayerUUID + ", " + evt.CurPKMode);
 
             this.mProp.ServerData.UnitPKInfo.CurPKMode = evt.CurPKMode;
             SyncPlayerVisibleData();
-            PlayerPKModeChangeEventB2C evtb2c = new PlayerPKModeChangeEventB2C();
-            evtb2c.CurMode = evt.CurPKMode;
-            this.mUnit.queueEvent(evtb2c);
+            this.mUnit.queueEvent(new PlayerPKModeChangeEventB2C(this.mUnit.ID, evt.CurPKMode));
         }
 
         protected virtual void OnReceivePlayerPKValueChangeEventR2B(PlayerPKValueChangeEventR2B evt)

+ 2 - 2
test/Program.cs

@@ -44,8 +44,6 @@ namespace test
                 logConfig.serverId = GetConfigAsString("game.server.id");
                 logConfig.outputPath = GetConfigAsString("logConfig.outputPath");
                 logConfig.level = GetConfigLoglevel("logConfig.level");
-				GlobalData.GAME_BS_TEST = GetConfigAsBool("game.bstest") || logConfig.serverId.Equals("10004");
-
 				string socketPort = "socket_" + GetConfigAsString("fastStreamConfig.port");
 
 				//log4j默认的配置文件名,其实也不能修改
@@ -74,6 +72,8 @@ namespace test
                 iceConfig.isWarnConnections = GetConfigAsBool("iceConfig.isWarnConnections");
 
                 intput.iceConfig = iceConfig;
+                GlobalData.GAME_BS_TEST = GetConfigAsBool("game.bstest") || (logConfig.serverId.Equals("10004") && iceConfig.port == 9910);
+
                 // -- fastStreamConfig
                 var fastStreamConfig = new FastStreamConfig();
                 fastStreamConfig.port = GetConfigAsInt("fastStreamConfig.port");