From fa10596d9f3abf523f8e900d7b920e4af8ea6bc5 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 07 三月 2019 14:45:41 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py                      |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/HurtLog.py              |   25 ++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                           |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py     |    3 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py  |   41 +++++++++++++++++++-
 6 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 770c3d6..4a57ddb 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -214,6 +214,7 @@
 Def_Notify_WorldKey_LoginAwardEndDate = 'LoginAwardEndDate_%s'   # 登录领取奖励结束时间,参数为活动类型
 
 Def_Notify_WorldKey_RedPacketOutput = 'RedPacketOutput'  # 红包产出信息
+Def_Notify_WorldKey_HurtLog = 'HurtLog'  # 战斗伤害日志
 
 #运营活动表名定义
 OperationActionName_ExpRate = "ActExpRate" # 多倍经验活动
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index bb89a25..9383283 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1604,6 +1604,7 @@
     atkObj = ElfChangeAttacker(attacker)  # Elf灵为替身攻击,要取玩家的属性
     
     resultHurtType = HurtType()
+    atkObjType = attacker.GetGameObjType()
     defObjType = defObj.GetGameObjType()
     dHP = GameObj.GetHP(defObj)                # 防守方当前血量
     dMaxHP = GameObj.GetMaxHP(defObj)          # 防守方最大血量
@@ -1628,12 +1629,14 @@
             hurtValue = clientValue
         else:
             # 外挂最高伤害基本防范
-            GameWorld.DebugAnswer(atkObj, "%s----客户端伤害 %s 服务端最高伤害 %s"%(atkObj.GetID(), [clientValue, hurtType], hurtValue))
+            GameWorld.DebugLog(atkObj, "%s----客户端伤害 %s 服务端最高伤害 %s"%(atkObj.GetID(), [clientValue, hurtType], hurtValue))
             hurtValue = int(hurtValue*0.8)
         #GameWorld.DebugAnswer(atkObj, "客户端伤害 %s 服务端伤害 %s"%([defObj.GetID(), clientValue, hurtType], hurtValue))
 
     else:
         hurtValue, hurtType = CalcHurtHP(atkObj, defObj, curSkill, atkSkillValue, atkSkillPer, tick, orgAtkObj=attacker)
+    
+    WriteHurtLog(attacker, defObj, curSkill, hurtValue, hurtType, "公式层")
     
     # 优先处理神兵护盾
     hurtValue = CalcAtkProDef(atkObj, defObj, hurtValue, curSkill, tick)
@@ -1751,7 +1754,9 @@
     resultHurtType.LostHP = lostValue
     if defObjType == IPY_GameWorld.gotPlayer:
         FBLogic.OnFBLostHP(defObj, lostValue)
-        
+    
+    WriteHurtLog(attacker, defObj, curSkill, resultHurtType.LostHP, resultHurtType.HurtType, "最终扣血")
+    
     #攻击触发事件, 该代码应该放在DoAttack函数中处理逻辑比较清晰,也不会破坏GetHurtHP函数
     #因为DoAttack修改点比较多,暂不迁移,相关攻击事件逻辑,就往此函数中添加
     AttackEventTrigger(atkObj, defObj, curSkill, resultHurtType, tick)
@@ -1763,6 +1768,38 @@
     return resultHurtType
 
 
+# GM 命令  HurtLog 查看战斗伤害日志
+def WriteHurtLog(attacker, defObj, curSkill, hurtValue, hurtType, msg):
+    logLevel = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_HurtLog)
+    if not logLevel:
+        return
+    
+    if logLevel == 1:
+        # 只看玩家伤害
+        if not attacker:
+            return
+        
+        if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
+            return
+        msg = "玩家" + msg
+    
+    attackerID = attacker.GetID() if attacker else 0
+    defenderID = defObj.GetID() if defObj else 0
+    skillID = curSkill.GetSkillID() if curSkill else 0
+    skillName = curSkill.GetSkillName()  if curSkill else ""
+    attackerName = attacker.GetName() if attacker else ""
+    defenderName = defObj.GetName() if defObj else ""
+    
+    if attacker and attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
+        attackerName = attackerName.decode("utf8").encode('gbk')
+        
+    if defObj and defObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
+        defenderName = defenderName.decode("utf8").encode('gbk')
+        
+    GameWorld.DebugLog("攻击伤害-%s:(%s %s)攻击(%s %s), 技能ID:(%s %s), 伤害值:%s, 伤害类型:%s "%(
+                        msg, attackerID, attackerName, defenderID, defenderName,
+                        skillID, skillName, hurtValue, hurtType))
+
 # 血盾支持多个同时存在
 def CalcBloodShield(atkObj, defObj, hurtValue):
     # 伤害值用于血盾抵消
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/HurtLog.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/HurtLog.py
new file mode 100644
index 0000000..4485278
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/HurtLog.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#
+##@package
+#
+# @todo: 开启伤害输出日志
+#
+# @author: Alee
+# @date 2019-3-6 下午05:21:33
+# @version 1.0
+#
+# @note: 
+#
+#---------------------------------------------------------------------
+import GameWorld
+import ShareDefine
+
+def OnExec(curPlayer, cmdList):
+    if not cmdList:
+        logLevel = 1
+    else:
+        logLevel = int(cmdList[0])
+        
+    GameWorld.DebugAnswer(curPlayer, "开启战斗日志,1为玩家攻击伤害 2为所有伤害")
+    GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_HurtLog, logLevel)
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index c84ca76..4a57ddb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -214,6 +214,7 @@
 Def_Notify_WorldKey_LoginAwardEndDate = 'LoginAwardEndDate_%s'   # 登录领取奖励结束时间,参数为活动类型
 
 Def_Notify_WorldKey_RedPacketOutput = 'RedPacketOutput'  # 红包产出信息
+Def_Notify_WorldKey_HurtLog = 'HurtLog'  # 战斗伤害日志
 
 #运营活动表名定义
 OperationActionName_ExpRate = "ActExpRate" # 多倍经验活动
@@ -658,7 +659,8 @@
 # 3 紫色
 # 4 橙色
 # 5 红色
-# 6 粉色#===============================================================================
+# 6 粉色
+#===============================================================================
 Def_Item_Color_White = 1     #白
 Def_Item_Color_Blue = 2      #蓝
 Def_Item_Color_Purple = 3    #紫
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
index 77c8a2b..20ae584 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameBuffs/BuffProcess_1033.py
@@ -43,7 +43,7 @@
     hurtPer = FindBuffPer(defender, curBuff)    # 找到另外一个buff对中毒的伤害加成
     
     singleDecHP = int((hurtPer + ChConfig.Def_MaxRateValue)*1.0/ChConfig.Def_MaxRateValue*singleDecHP)
-    GameWorld.DebugLog("1033---------%s-%s-%s-%s"%(curBuff.GetValue(), layer, hurtPer, singleDecHP ) )
+    #GameWorld.DebugLog("1033---------%s-%s-%s-%s"%(curBuff.GetValue(), layer, hurtPer, singleDecHP ) )
     #buff拥有者
     buffOwner = SkillCommon.GetBuffOwner(curBuff)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
index 0e6b322..854897d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
@@ -1295,6 +1295,8 @@
             # 已广播的不重复
             GameObj.SetHP(curObj, remainHP, not view)
     
+    AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "持续掉血")
+    
     if view:
         #广播伤血类型
         AttackCommon.ChangeHPView(curObj, buffOwner, skillTypeID, notifyLostValue, hurtType)
@@ -1309,6 +1311,7 @@
         AttackCommon.DoLogic_ObjDead(None, curObj, curSkill, tick)
         return
         
+
     #NPC需要手动添加伤血和仇恨, 因为无调用DoAttack
     if curObjType == IPY_GameWorld.gotNPC:
         

--
Gitblit v1.8.0