Browse Source

【优化】战斗日志输出

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

+ 1 - 1
Common/CommonAI/CommonAI.csproj

@@ -40,7 +40,7 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>..\..\Library\Debug\</OutputPath>
-    <DefineConstants>TRACE;DEBUG;PATH_NO_SQRT;JSGProfile</DefineConstants>
+    <DefineConstants>TRACE;DEBUG;PATH_NO_SQRT;JSGProfile;JSG_DMG_LOG</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>

+ 4 - 1
Common/CommonAI/Zone/Instance/InstanceUnit.API.cs

@@ -201,12 +201,15 @@ namespace CommonAI.Zone.Instance
 			int finalHP = ReduceHP(-hp, sender, sendHit);
 
 			//排除怪物回血
-			if ((finalHP < -100000000 || finalHP > 100000000) && !(this.IsMonster && hp == this.MaxHP))
+#if JSG_DMG_LOG
+			int atkPropID = (source == null || source.Attack == null || source.Attack.Properties == null) ? 0 : source.Attack.Properties.GetAttackID();
+			if (atkPropID != 9999901 && (finalHP < -100000000 || finalHP > 100000000) && !(this.IsMonster && hp == this.MaxHP))
 			{
 				string stackInfo = new StackTrace().ToString();
 				log.Error("伤害异常: " + finalHP + ", ID" + this.Info.ID + ", " + (sender == null ? "-1" : sender.PlayerUUID)
 					+ JSGModule.GetAttackSourceDes(source) + ", " + stackInfo);
 			}
+#endif
 			return finalHP;
 		}
 

+ 10 - 3
XmdsCommonServer/Plugin/CardSkill/PlayerCardSkill/JSGCardRateModule.cs

@@ -15,15 +15,21 @@ namespace CommonAI.ZoneServer.JSGModule
 	//卡牌权重变更模块
 	public class JSGCardRateModule
 	{
+		private String mUniqueInfo;
 		protected static Logger log = LoggerFactory.GetLogger("JSGCardRateModule");
 
 		// 卡牌权重变更列表       
 		private List<CardRateChgData> mCardRateChgLists = new List<CardRateChgData>();
-		
+
 		// 权重计算辅助结构
 		private CardWeigthExt mCardWeightExt = new CardWeigthExt();
 
-		public JSGCardRateModule() {}
+		public JSGCardRateModule() { }
+
+		public void initUniqueInfo(String uniqueInfo)
+		{
+			this.mUniqueInfo = uniqueInfo;
+		}
 
 		public void Update()
 		{
@@ -106,7 +112,8 @@ namespace CommonAI.ZoneServer.JSGModule
 			GenCardData cardData = mCardWeightExt.GetWeightIndex();
 			if (cardData == null)
 			{
-				log.Error("JSGCardRateModule GetRandomCardType异常:" + mCardWeightExt.ToString());
+				log.Error("JSGCardRateModule GetRandomCardType异常:" + mCardWeightExt.ToString() + ", " + 
+					(this.mUniqueInfo == null ? "null" : this.mUniqueInfo));
 			}
 			return cardData;
 		}

+ 5 - 0
XmdsCommonServer/Plugin/CardSkill/PlayerCardSkill/JSGPlayerCardModule.cs

@@ -65,6 +65,7 @@ namespace XmdsCommonSkill.Plugin.CardSkill
 			}
 
 			int totalWeight = 0;
+			String extInfo = "";
 			for (int i = 0; i <= (int)CardType.Max; i++)
 			{
 				GameSkill gs = prop.ServerData.CardSkills.UnitSkills[i];
@@ -75,10 +76,14 @@ namespace XmdsCommonSkill.Plugin.CardSkill
 				}
 
 				totalWeight += gs.TalentSkillLevel1;
+				extInfo = extInfo + ", " + gs.TalentSkillLevel1;
 			}
 
+			String uniqueInfo = owner.mUnit.IsPlayer ? owner.mUnit.PlayerUUID : (owner.mUnit.Parent.GetSceneID() + "_" + owner.mInfo.ID);
+			log.Info("初始化卡牌:" + uniqueInfo + ", 总权重:" + totalWeight + ", " + extInfo);
 			this.mIsFuncOpen = totalWeight > 0;
 			this.ReSet(true, notifyClient);
+			mCardRateModule.initUniqueInfo(uniqueInfo);
 			return true;
 		}
 

+ 2 - 0
XmdsCommonServer/Plugin/XmdsSkillTemplate/DamageCalculator/XmdsDamageCalculator.cs

@@ -365,6 +365,7 @@ namespace XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator
 			int damage = CUtils.CastInt(damageBaseValue * (1.0f - DefCoef) * allDmgChgFinal * monsterDmgChgFinal * playerDmgChgFinal * artifaceDmgChgFinal * monsterAtkPer);
 
 			//异常日志输出--justsogo
+#if JSG_DMG_LOG
 			if (damageBaseValue > 50 && (damage <= 1 || damage > 30000000))
 			{
 				XmdsVirtual.FormatLog(LoggerLevel.ERROR, "----1. 伤害异常 : {0}, {1}, {2}, {3}, 防御信息:{4}, {5}, {6}", attacker.mInfo.Name, hitter.mInfo.Name,
@@ -378,6 +379,7 @@ namespace XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator
 				//	hitter.MirrorProp.Defence, attacker.MirrorProp.IgnoreDefensePer, GetDefenceAddition(hitter.GetStateLv()),
 				//	hitter.MirrorProp.KillValuePer, attacker.MirrorProp.KillValuePer);
 			}
+#endif
 			//Console.WriteLine("受击ID: " + hitter.mUnit.ID + ", " + damage);
 			if (attacker.IsPlayerUnit())
 			{

+ 3 - 1
XmdsCommonServer/Plugin/XmdsVirtual/XmdsVirtual.cs

@@ -1859,6 +1859,7 @@ namespace XmdsCommonServer.Plugin
 
 		private void PrintAttrErrorInfo(UnitAttributeType Type, int value1, int value2)
 		{
+#if JSG_DMG_LOG
 			try
 			{
 				string stackInfo = new StackTrace().ToString();
@@ -1867,7 +1868,8 @@ namespace XmdsCommonServer.Plugin
 			catch(Exception e)
 			{
 				XmdsVirtual.FormatLog(LoggerLevel.ERROR, "PrintAttrErrorInfo异常:" + Type + ", " + value1 + ", " + value2 + ", " + e);
-			}			
+			}
+#endif       
 		}
 
 

+ 1 - 1
XmdsVSPlugins/XmdsCommonSkill/Plugin/Skills/Remedy/RemedySkillBase.cs

@@ -30,7 +30,7 @@ namespace XmdsCommonSkill.Plugin.Skills.Remedy
 			var playerTalent = unit.GetPlayerCache() as PlayerCache_Remedy;
 			if(playerTalent == null)
 			{
-				log.Error("没有按照要求配置单位:" + unit.mInfo.ID);
+				log.Error("没有按照要求配置单位:" + unit.mInfo.ID + ", " + unit.mInfo.Name + ", 场景:" + unit.mUnit.Parent.GetSceneID());
 				return;
 			}
 			playerTalent.SetSkillPoisonRate(new IntIntData(mPoisionValue.GetValue(1), mPoisionValue.GetValue(2)), this.SkillID);