From 06eec1e27d26532824a710bba2483b0c7f39c27e Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期六, 22 十二月 2018 18:03:50 +0800
Subject: [PATCH] 5372 【后端】【1.4】聚魂副本开发(npc速度通知)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   16 +++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py |   62 +++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
index a85e9db..a0526b3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
@@ -758,3 +758,65 @@
 
 m_NAtagPlayerReborn=tagPlayerReborn()
 ChNetPackDict[eval("0x%02x%02x"%(m_NAtagPlayerReborn.Cmd,m_NAtagPlayerReborn.SubCmd))] = m_NAtagPlayerReborn
+
+#04 18 周围对象刷新#tagObjInfoRefresh
+
+class  tagObjInfoRefresh(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("ObjID", c_int),    
+                  ("ObjType", c_ubyte),    
+                  ("RefreshType", c_ubyte),    
+                  ("Value", c_int),    
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0x04
+        self.SubCmd = 0x18
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0x04
+        self.SubCmd = 0x18
+        self.ObjID = 0
+        self.ObjType = 0
+        self.RefreshType = 0
+        self.Value = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagObjInfoRefresh)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''//04 18 周围对象刷新//tagObjInfoRefresh:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                ObjID:%d,
+                                ObjType:%d,
+                                RefreshType:%d,
+                                Value:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.ObjID,
+                                self.ObjType,
+                                self.RefreshType,
+                                self.Value
+                                )
+        return DumpString
+
+
+m_NAtagObjInfoRefresh=tagObjInfoRefresh()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagObjInfoRefresh.Cmd,m_NAtagObjInfoRefresh.SubCmd))] = m_NAtagObjInfoRefresh
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 0853eaa..7599b01 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -24,7 +24,7 @@
 import SkillShell
 import BuffSkill
 import BaseAttack
-import PlayerTruck
+import ChNetSendPack
 import SkillCommon
 import AttackCommon
 import ItemControler
@@ -3791,9 +3791,11 @@
                 curNPC.SetDict(ChConfig.Def_NPC_Dict_SpeedPer, 0)
             return
         speed = int(curNPC.GetSpeed() * (ShareDefine.Def_MaxRateValue) / max(100.0, float(ShareDefine.Def_MaxRateValue + speedPer)))
-        
         curNPC.SetSpeed(speed)
         curNPC.SetDict(ChConfig.Def_NPC_Dict_SpeedPer, speedPer)
+        if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_GatherSoul:
+            #目前只在聚魂副本里通知
+            NPCSpeedChangeNotify(curNPC, speed)
         return
     
     
@@ -6080,3 +6082,13 @@
     GameWorld.DebugLog("通知GameServer地图Boss分流信息: mapID=%s,lineID=%s,shuntPlayerDict=%s" % (mapID, lineID, shuntPlayerDict), lineID)
     return
 
+def NPCSpeedChangeNotify(curNPC, speed):
+    ##通知NPC速度
+    sendPack = ChNetSendPack.tagObjInfoRefresh()
+    sendPack.Clear()
+    sendPack.ObjID = curNPC.GetID()
+    sendPack.ObjType = curNPC.GetGameObjType()
+    sendPack.RefreshType = IPY_GameWorld.CDBPlayerRefresh_Speed
+    sendPack.Value = speed
+    curNPC.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength())
+    return

--
Gitblit v1.8.0