Browse Source

【优化】日志

meijun 3 years ago
parent
commit
534beb51ce

+ 7 - 4
Common/CommonAI/Zone/Instance/InstanceUnit.cs

@@ -486,11 +486,14 @@ namespace CommonAI.Zone.Instance
 
             if (IsDead() && (!IsStateDead))
             {
-                changeState(new StateDead(this, this, false), true);
-                log.Warn("手动调用死亡逻辑2:" + this.PlayerUUID + ", " + this.mZone.GetSceneID() + ", " + this.Info.ID + ", state: " + this.current_state);
-
-                Parent.cb_unitDeadCallBack(this, this);
+                changeState(new StateDead(this, this, false), true);                
                 queueEvent(new UnitDeadEvent(ID, this.ID, false, mInfo.RebirthTimeMS));
+
+                if(this.mProcessDeadCallbackTime < CommonLang.CUtils.localTimeMS)
+                {
+                    log.Warn("手动调用死亡逻辑2:" + this.PlayerUUID + ", " + this.mZone.GetSceneID() + ", templateID:" + this.Info.ID + ", state: " + this.current_state);
+                    Parent.cb_unitDeadCallBack(this, this);
+                }
             }
             else if (next_state == null && next_state_queue.Count > 0)
             {

+ 1 - 1
Common/CommonAI/Zone/Instance/InstanceZone.cs

@@ -1437,7 +1437,7 @@ namespace CommonAI.Zone.Instance
                     log.Info("boss死亡:" + obj.Parent.GetSceneID() + ", 单位id=" + obj.Info.ID + ", 处理死亡时间:" + obj.mProcessDeadCallbackTime
                          + ", SceneUID: " + obj.mZone.UUID + ", " + (attacker == null ? "null" : attacker.PlayerUUID));
 
-                    if (attacker.IsPlayerUnit)
+                    if (attacker != null && attacker.IsPlayerUnit)
                     {
                         JSGHackerModule.OnPlayerKillMonster(attacker, obj);
                     }

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

@@ -46,11 +46,11 @@ namespace CommonAI.ZoneServer.JSGModule
                 if (!unit.IsPlayer){ return;}
 
                 int atkPropID = (source == null || source.Attack == null || source.Attack.Properties == null) ? 0 : source.Attack.Properties.GetAttackID();
-                if (atkPropID != 9999901 && (finalHP < -100000000 || finalHP > 100000000) && !(unit.IsMonster && hp == unit.MaxHP))
+                if (atkPropID != -1 && atkPropID != 9999901 && (finalHP < -100000000 || finalHP > 100000000) && !(unit.IsMonster && hp == unit.MaxHP))
                 {
                     string stackInfo = new StackTrace().ToString();
-                    log.Error("伤害异常: " + finalHP + ", ID" + unit.Info.ID + ", " + (sender == null ? "-1" : sender.PlayerUUID)
-                        + JSGModule.GetAttackSourceDes(source) + ", " + stackInfo);
+                    log.Warn("伤害异常: " + hp + ", finalHP: " + finalHP + ", UnitInfo:" + unit.Info.ID + ", " + unit.PlayerUUID + ", sender:"
+                        + (sender == null ? "-1" : sender.PlayerUUID) + JSGModule.GetAttackSourceDes(source) + ", " + stackInfo);
                 }
             }
             catch (Exception e)

+ 1 - 1
Common/CommonAIServer/Node/BaseZoneNode.cs

@@ -291,7 +291,7 @@ namespace CommonAIServer.Node
                         }
                         catch (Exception err)
                         {
-                            log.Error("zoneUpdateCatch" + mZone.GetSceneID() + ", " + err.Message, err);
+                            log.Error("zoneUpdateCatch: " + mZone.GetSceneID() + ", " + err.Message, err);
                             OnError(err);
                         }
                         finally

+ 5 - 7
XmdsCommonServer/Plugin/JSGModule/JSGXmdsHackerModule.cs

@@ -72,7 +72,7 @@ namespace XmdsCommonServer.Plugin.JSGXmdsModule
 
         /** 玩家伤害监测输出 */
         public static void CheckAndPrintDamageLog(int damageBaseValue, XmdsVirtual attacker, XmdsVirtual hitter, AttackSource source, int damage,
-            double DefCoef, int damageReduce, int addDamage, int artifaceMainDamage)
+            double DefCoef, float allDmgChgFinal, float monsterDmgChgFinal, float playerDmgChgFinal, float artifaceDmgChgFinal, float monsterAtkPer)
         {
 #if JSGProfile
             try
@@ -98,13 +98,11 @@ namespace XmdsCommonServer.Plugin.JSGXmdsModule
                             break;
                         }
 
-                        XmdsSkillType FromSkillType = source == null ? XmdsSkillType.none : source.FromSkillType;
-                        XmdsVirtual.FormatLog(LoggerLevel.ERROR, "1. 伤害异常 : {0}, {1}, {2}, 实际伤害值:{3}, 防御信息:{4}, {5}, {6}", attacker.mInfo.Name, hitter.mInfo.Name,
-                            FromSkillType, damage, hitter.MirrorProp.Defence, attacker.MirrorProp.IgnoreDefense, attacker.MirrorProp.IgnoreDefensePer);
+                        XmdsVirtual.FormatLog(LoggerLevel.WARNNING, "伤害异常 : {0}->{1}, ID:{2}-{3},{4}-{5},基础攻击:{6}", damageBaseValue, damage, attacker.mInfo.ID, 
+                            attacker.mInfo.Name, hitter.mInfo.ID, hitter.mInfo.Name, finalAttack);
 
-                        int spellInfo = (source == null || source.FromSpell == null) ? 0 : source.FromSpell.ID;
-                        XmdsVirtual.FormatLog(LoggerLevel.ERROR, "2. 伤害异常 : {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}",
-                            damageBaseValue, DefCoef, damageReduce, addDamage, artifaceMainDamage, spellInfo, attacker.mUnit.PlayerUUID, hitter.mUnit.PlayerUUID);
+                        XmdsVirtual.FormatLog(LoggerLevel.WARNNING, "--伤害信息 : {0}, {1}, {2}, {3}, {4}, {5}, {6}",(float)(1.0f- DefCoef), allDmgChgFinal, 
+                            monsterDmgChgFinal, playerDmgChgFinal, artifaceDmgChgFinal, monsterAtkPer, JSGModule.GetAttackSourceDes(source));
 
                         //XmdsVirtual.FormatLog(LoggerLevel.ERROR, "3. 伤害异常受击防御 : {0},攻击穿透:{1},防御系数:{2},杀意信息:{3},{4}",
                         //	hitter.MirrorProp.Defence, attacker.MirrorProp.IgnoreDefensePer, GetDefenceAddition(hitter.GetStateLv()),

+ 1 - 1
XmdsCommonServer/Plugin/XmdsSkillTemplate/DamageCalculator/XmdsDamageCalculator.cs

@@ -433,7 +433,7 @@ namespace XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator
 			}
 
 			//异常日志输出监测输出
-			JSGXmdsHackerModule.CheckAndPrintDamageLog(damageBaseValue, attacker, hitter, source, damage, DefCoef, damageReduce, addDamage, artifaceMainDamage);
+			JSGXmdsHackerModule.CheckAndPrintDamageLog(damageBaseValue, attacker, hitter, source, damage, DefCoef, allDmgChgFinal, monsterDmgChgFinal, playerDmgChgFinal, artifaceDmgChgFinal, monsterAtkPer);
 			return Math.Max(damage, 1);
 		}
 

+ 3 - 3
XmdsVSPlugins/XmdsCommonSkill/Plugin/Skills/XmdsSkillBase.cs

@@ -20,6 +20,7 @@ using System.Diagnostics;
 using System.Collections.Generic;
 using XmdsCommonServer.Plugin.Base;
 using XmdsCommon.JSGModule.Interface;
+using CommonAI.ZoneServer.JSGModule;
 
 namespace XmdsCommonSkill.Plugin.Skills
 {
@@ -930,9 +931,8 @@ namespace XmdsCommonSkill.Plugin.Skills
 			if(attack <= 1 && attackTemp > 10)
 			{
 				string stackInfo = new StackTrace().ToString();
-				int spellID = (param.Source != null && param.Source.FromSpell != null) ? param.Source.FromSpell.ID : 0;
-				XmdsVirtual.FormatLog(LoggerLevel.ERROR, "攻击异常 : {0}, {1}, {2}, {3}, {4}, {5}, {6}", attackTemp, attack, 
-					param.SkillDamagePer, param.SkillDamageModify, param.DamageModifyAdd, spellID, stackInfo);
+				XmdsVirtual.FormatLog(LoggerLevel.ERROR, "攻击异常 : {0}->{1}, dmgInfo:{2}, {3}, {4}, {5}, {6}", attackTemp, attack, 
+					param.SkillDamagePer, param.SkillDamageModify, param.DamageModifyAdd, JSGModule.GetAttackSourceDes(param.Source), stackInfo);
 			}
             OnGetSkillDamageAdd(param);            
             param.FinalSkillDamage = XmdsDamageCalculator.GetDamage(attack, attacker, hitter, param.Source) + param.SkillDamageAdd;