소스 검색

【优化】日志 & 部分情况下怪物死亡未调用

meijun 3 년 전
부모
커밋
676e494b91

+ 2 - 2
Common/CommonAI/Zone/EventTrigger/EventAdapter.cs

@@ -331,11 +331,11 @@ namespace CommonAI.Zone.EventTrigger
 #endif
 			if (GlobalData.GAME_BS_TEST)
 			{
-				log.Warn("--调试-场景:" + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
+				log.Warn("--调试场景:" + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
 			}
 			else
 			{
-				log.Info("--调试-场景:" + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
+				log.Info("--调试场景:" + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
 			}
 
 			//if(this.Name.Equals("事件重置列表1") || this.Name.Equals("玉重置"))

+ 9 - 3
Common/CommonAI/Zone/Instance/InstanceUnit.StateMachine.cs

@@ -2579,11 +2579,11 @@ namespace CommonAI.Zone.Instance
         {
             private TimeExpire<int> dead_time;
             private TimeExpire<int> rebirth_time;
-            private InstanceZoneObject attacker;
+            private InstanceUnit attacker;
             private bool crushed;
             private List<TimeExpire<int>> dead_delayTimes = new List<TimeExpire<int>>();
 
-            public StateDead(InstanceUnit unit, InstanceZoneObject attacker, bool crush = false)
+            public StateDead(InstanceUnit unit, InstanceUnit attacker, bool crush = false)
                 : base(unit)
             {
                 this.attacker = attacker;
@@ -2607,7 +2607,13 @@ namespace CommonAI.Zone.Instance
             }
             override protected void onStart()
             {
-                unit.SetActionStatus(UnitActionStatus.Dead);
+				//某些状态帧下死亡调用漏掉了
+				if (unit.IsNeedProcessDead())
+				{
+					unit.Parent.cb_unitDeadCallBack(unit, this.attacker, null);
+				}
+
+				unit.SetActionStatus(UnitActionStatus.Dead);
                 this.rebirth_time = new TimeExpire<int>(unit.mInfo.RebirthTimeMS);
                 this.dead_time = new TimeExpire<int>(unit.mInfo.DeadTimeMS);
                 if (unit.Info.DeadLaunchSpell != null)

+ 17 - 2
Common/CommonAI/Zone/Instance/InstanceUnit.cs

@@ -136,8 +136,19 @@ namespace CommonAI.Zone.Instance
             this.mUnitVirtual = TemplateManager.Factory.CreateUnitVirtual(this);			
 		}
 
-        protected override void Disposing()
+		public override bool IsNeedProcessDead()
+		{
+			return this.mProcessDeadTime == 0;
+		}
+
+		protected override void Disposing()
         {
+			if(this.IsMonster && (this.mProcessDeadTime == 0 || this.CurrentHP > 0 || this.mProcessDeadTime == 0))
+			{
+				log.Info("单位Disposing:" + this.Parent.UUID + ", " + this.Parent.GetSceneID() + ", " + this.ID + ", " + this.CurrentHP + "," +
+					this.IsMonster + ", " + mProcessDeadTime);
+			}
+
             if (mUnitVirtual != null)
             {
                 mUnitVirtual.OnDispose(this);
@@ -636,8 +647,12 @@ namespace CommonAI.Zone.Instance
             if (this.mOnDamage != null)
                 this.mOnDamage.Invoke(this, attacker, reduceHP, source);
         }
-        internal void callback_onDead(InstanceZone zone, InstanceUnit attacker)
+
+		public long mProcessDeadTime = 0;
+
+		internal void callback_onDead(InstanceZone zone, InstanceUnit attacker)
         {
+			this.mProcessDeadTime = CommonLang.TimeUtil.GetTimestampMS();
 			this.OnUnitDead();
 			if (this.mOnDead != null)
                 this.mOnDead.Invoke(this, attacker);

+ 2 - 0
Common/CommonAI/Zone/Instance/InstanceZoneObject.cs

@@ -76,6 +76,8 @@ namespace CommonAI.Zone.Instance
         /** 单位是否死亡 */
         public virtual bool IsDead() { return false; }
 
+		public virtual bool IsNeedProcessDead() { return false; }
+
         //---------------------------------------------------------------------------------------
 
         public uint ID { get { return mID; } }

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

@@ -100,7 +100,9 @@ namespace CommonAI.ZoneServer.JSGModule
 				return "";
 			}
 
-			return "【attackSN: " + (source.Attack == null ? 0 : source.Attack.SerialNumber) + ", spellID: " + (source.FromSpell == null ? 0 : source.FromSpell.ID) + "】";
+			return "【attackSN: " + (source.Attack == null ? 0 : source.Attack.SerialNumber) 
+				+ ", attackID: " + (source.Attack == null ? 0 : source.Attack.Properties.GetAttackID())
+				+ ", spellID: " + (source.FromSpell == null ? 0 : source.FromSpell.ID) + "】";
 		}
 
 		public static bool IsActiveSkill(XmdsSkillType skillType)

+ 2 - 1
XmdsCommonServer/Plugin/Units/XmdsInstancePlayer.cs

@@ -377,7 +377,8 @@ namespace XmdsCommonServer.Plugin.Units
         }
         protected override bool doLaunchSkill(UnitLaunchSkillAction sk)
         {
-			//Console.WriteLine(" ------------------------------doLaunchSkill - " + sk.SkillID + ", " + this.ID + ", targetID: " + sk.TargetObjID	+ ", XY:" + this.X + ", " + this.Y + ", direction : " + this.Direction);
+			//Console.WriteLine(" ------------------------------doLaunchSkill - " + sk.SkillID + ", " + this.ID + ", targetID: " + 
+			//	sk.TargetObjID	+ ", XY:" + this.X + ", " + this.Y + ", direction : " + this.Direction + ", " + this.Parent.UUID);
 			//if(sk.SkillID == 110160)
 			//	sk.SkillID = 110360;
 			//如果在采集中,不让放技能,并通知客户端.

+ 5 - 5
XmdsCommonServer/Plugin/XmdsVirtual/XmdsVirtual_Monster.cs

@@ -826,14 +826,14 @@ namespace XmdsCommonServer.Plugin
 
 			if (ret.MaxHP <= 0 || ret.MaxAttack <= 0 || ret.Defence <= 0)
 			{
-				log.Error("怪物属性错误:" + this.mUnit.Info.ID + ", 生命:" + ret.MaxHP +
+				log.Error("怪物属性错误:" + _sceneType + ", " + this.mUnit.Info.ID + ", 生命:" + ret.MaxHP +
 					", 攻击:" + ret.MaxAttack + ", 防御:" + ret.Defence);
 			}
-			else if(ret.MaxHP > 500000 || ret.MaxAttack > 30000)
+			else if(this.IsBoss() || ret.MaxHP > 500000 || ret.MaxAttack > 10000)
 			{
-				log.Info("场景:" + _sceneType + ", ID: " + templateID + ", " + this.mUnit.Parent.UUID + ", 等级: " + lvl_monster + ", 战斗规模:" + ma.Fight_Type + ",(攻-" +
-					ret.BaseAttack + ", 防-" + ret.BaseDefence + ", 血-" + ret.BaseMaxHP + ", 爆-" + ret.CritRate + ", 爆伤-" +
-					ret.CritDamage + ", 穿透-" + ret.IgnoreDefensePer + ")");
+				log.Info("场景:" + _sceneType + ", ID: " + templateID + ", " + this.mUnit.Parent.UUID + ", UID: " + this.mUnit.ID + ", 等级: " + lvl_monster 
+					+ ", 战斗规模:" + ma.Fight_Type + ",(攻-" +	ret.BaseAttack + ", 防-" + ret.BaseDefence + ", 血-" + ret.BaseMaxHP + ", 爆-" + ret.CritRate
+					+ ", 爆伤-" + ret.CritDamage + ", 穿透-" + ret.IgnoreDefensePer + ")");
 			}
         }