From aad0a5ae3099dce49f49e25b63786f32b1b4139d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 06 六月 2024 11:17:53 +0800
Subject: [PATCH] 10130 【后端】福地争夺资源功能(福地记录信息增加同步目标玩家名等信息)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 56 ++++++++++++++++++++-------
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 56 ++++++++++++++++++++-------
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldMineArea.py | 4 ++
3 files changed, 86 insertions(+), 30 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index a54a925..d308982 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -8079,48 +8079,74 @@
# B0 35 福地记录信息 #tagGCMineAreaRecordInfo
class tagGCMineAreaRecord(Structure):
- _pack_ = 1
- _fields_ = [
- ("RecordType", c_ubyte), # 记录类型;1-自己拉物品;2-物品被人抢
- ("TagPlayerID", c_int), # 目标玩家ID,等于自己玩家ID时代表拉自己的,反之为抢别人的
- ("RecordTime", c_int), # 记录时间戳
- ("MineID", c_ushort), # 矿物ID,对应福地采集表中ID
- ]
+ RecordType = 0 #(BYTE RecordType)// 记录类型;1-自己拉物品;2-物品被人抢
+ TagPlayerID = 0 #(DWORD TagPlayerID)// 目标玩家ID,等于自己玩家ID时代表拉自己的,反之为抢别人的
+ RecordTime = 0 #(DWORD RecordTime)// 记录时间戳
+ MineID = 0 #(WORD MineID)// 矿物ID,对应福地采集表中ID
+ TagPlayerName = "" #(char TagPlayerName[33])
+ TagFace = 0 #(DWORD TagFace)
+ data = None
def __init__(self):
self.Clear()
return
- def ReadData(self, stringData, _pos=0, _len=0):
+ def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
- memmove(addressof(self), stringData[_pos:], self.GetLength())
- return _pos + self.GetLength()
+ self.RecordType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ self.TagPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.RecordTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.MineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+ self.TagPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
+ self.TagFace,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ return _pos
def Clear(self):
self.RecordType = 0
self.TagPlayerID = 0
self.RecordTime = 0
self.MineID = 0
+ self.TagPlayerName = ""
+ self.TagFace = 0
return
def GetLength(self):
- return sizeof(tagGCMineAreaRecord)
+ length = 0
+ length += 1
+ length += 4
+ length += 4
+ length += 2
+ length += 33
+ length += 4
+
+ return length
def GetBuffer(self):
- return string_at(addressof(self), self.GetLength())
+ data = ''
+ data = CommFunc.WriteBYTE(data, self.RecordType)
+ data = CommFunc.WriteDWORD(data, self.TagPlayerID)
+ data = CommFunc.WriteDWORD(data, self.RecordTime)
+ data = CommFunc.WriteWORD(data, self.MineID)
+ data = CommFunc.WriteString(data, 33, self.TagPlayerName)
+ data = CommFunc.WriteDWORD(data, self.TagFace)
+ return data
def OutputString(self):
- DumpString = '''// B0 35 福地记录信息 //tagGCMineAreaRecordInfo:
+ DumpString = '''
RecordType:%d,
TagPlayerID:%d,
RecordTime:%d,
- MineID:%d
+ MineID:%d,
+ TagPlayerName:%s,
+ TagFace:%d
'''\
%(
self.RecordType,
self.TagPlayerID,
self.RecordTime,
- self.MineID
+ self.MineID,
+ self.TagPlayerName,
+ self.TagFace
)
return DumpString
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldMineArea.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldMineArea.py
index bf1b063..7af148d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldMineArea.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldMineArea.py
@@ -1262,6 +1262,10 @@
recordInfo.TagPlayerID = recData.TagPlayerID
recordInfo.RecordTime = recData.RecordTime
recordInfo.MineID = recData.MineID
+ if playerID != recordInfo.TagPlayerID and recordInfo.TagPlayerID > Def_FakeAreaCount:
+ tagCacheDict = PlayerViewCache.GetCachePropDataDict(PlayerViewCache.FindViewCache(recordInfo.TagPlayerID))
+ recordInfo.TagPlayerName = tagCacheDict.get("Name", "")
+ recordInfo.TagFace = tagCacheDict.get("Face", 0)
clientPack.AreaRecordList.append(recordInfo)
clientPack.RecordCount = len(clientPack.AreaRecordList)
NetPackCommon.SendFakePack(curPlayer, clientPack)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index a54a925..d308982 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -8079,48 +8079,74 @@
# B0 35 福地记录信息 #tagGCMineAreaRecordInfo
class tagGCMineAreaRecord(Structure):
- _pack_ = 1
- _fields_ = [
- ("RecordType", c_ubyte), # 记录类型;1-自己拉物品;2-物品被人抢
- ("TagPlayerID", c_int), # 目标玩家ID,等于自己玩家ID时代表拉自己的,反之为抢别人的
- ("RecordTime", c_int), # 记录时间戳
- ("MineID", c_ushort), # 矿物ID,对应福地采集表中ID
- ]
+ RecordType = 0 #(BYTE RecordType)// 记录类型;1-自己拉物品;2-物品被人抢
+ TagPlayerID = 0 #(DWORD TagPlayerID)// 目标玩家ID,等于自己玩家ID时代表拉自己的,反之为抢别人的
+ RecordTime = 0 #(DWORD RecordTime)// 记录时间戳
+ MineID = 0 #(WORD MineID)// 矿物ID,对应福地采集表中ID
+ TagPlayerName = "" #(char TagPlayerName[33])
+ TagFace = 0 #(DWORD TagFace)
+ data = None
def __init__(self):
self.Clear()
return
- def ReadData(self, stringData, _pos=0, _len=0):
+ def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
- memmove(addressof(self), stringData[_pos:], self.GetLength())
- return _pos + self.GetLength()
+ self.RecordType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ self.TagPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.RecordTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.MineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+ self.TagPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,33)
+ self.TagFace,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ return _pos
def Clear(self):
self.RecordType = 0
self.TagPlayerID = 0
self.RecordTime = 0
self.MineID = 0
+ self.TagPlayerName = ""
+ self.TagFace = 0
return
def GetLength(self):
- return sizeof(tagGCMineAreaRecord)
+ length = 0
+ length += 1
+ length += 4
+ length += 4
+ length += 2
+ length += 33
+ length += 4
+
+ return length
def GetBuffer(self):
- return string_at(addressof(self), self.GetLength())
+ data = ''
+ data = CommFunc.WriteBYTE(data, self.RecordType)
+ data = CommFunc.WriteDWORD(data, self.TagPlayerID)
+ data = CommFunc.WriteDWORD(data, self.RecordTime)
+ data = CommFunc.WriteWORD(data, self.MineID)
+ data = CommFunc.WriteString(data, 33, self.TagPlayerName)
+ data = CommFunc.WriteDWORD(data, self.TagFace)
+ return data
def OutputString(self):
- DumpString = '''// B0 35 福地记录信息 //tagGCMineAreaRecordInfo:
+ DumpString = '''
RecordType:%d,
TagPlayerID:%d,
RecordTime:%d,
- MineID:%d
+ MineID:%d,
+ TagPlayerName:%s,
+ TagFace:%d
'''\
%(
self.RecordType,
self.TagPlayerID,
self.RecordTime,
- self.MineID
+ self.MineID,
+ self.TagPlayerName,
+ self.TagFace
)
return DumpString
--
Gitblit v1.8.0