From dc726cc331d46a3d684ec75b03176288257fafa3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 12 八月 2024 14:18:07 +0800
Subject: [PATCH] 10245 【越南】【砍树】【主干】【港台】古宝升星修改(支持额外扣除品质碎片数量)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py | 52 +++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 95 +++++++++++++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py | 8 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py | 13 ++
PySysDB/PySysDBPY.h | 1
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 95 +++++++++++++++---
6 files changed, 222 insertions(+), 42 deletions(-)
diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index f7de97f..a777435 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -519,6 +519,7 @@
WORD _GubaoID; //古宝ID
BYTE _GubaoStar; //古宝星级
list StarUPNeedItemInfo; //升星所需物品 [[物品ID,个数], ...]
+ list StarUPNeedQualityPiece; //升下一星额外所需品质碎片 [[品质,个数], ...]
list StarAttrIDList; //累计总属性ID列表
list StarAttrValueList; //累计总属性值列表
list StarEffIDList; //星级特殊效果ID列表
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 331497e..b28d832 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -19471,18 +19471,15 @@
#------------------------------------------------------
# B2 17 古宝升星 #tagCMGubaoStarUp
-class tagCMGubaoStarUp(Structure):
+class tagCMGubaoPieceUse(Structure):
_pack_ = 1
_fields_ = [
- ("Cmd", c_ubyte),
- ("SubCmd", c_ubyte),
- ("GubaoID", c_ushort),
+ ("GubaoID", c_ushort), # 通用碎片古宝ID
+ ("PieceCount", c_ushort), # 使用碎片个数
]
def __init__(self):
self.Clear()
- self.Cmd = 0xB2
- self.SubCmd = 0x17
return
def ReadData(self, stringData, _pos=0, _len=0):
@@ -19491,33 +19488,99 @@
return _pos + self.GetLength()
def Clear(self):
- self.Cmd = 0xB2
- self.SubCmd = 0x17
self.GubaoID = 0
+ self.PieceCount = 0
return
def GetLength(self):
- return sizeof(tagCMGubaoStarUp)
+ return sizeof(tagCMGubaoPieceUse)
def GetBuffer(self):
return string_at(addressof(self), self.GetLength())
def OutputString(self):
DumpString = '''// B2 17 古宝升星 //tagCMGubaoStarUp:
- Cmd:%s,
- SubCmd:%s,
- GubaoID:%d
+ GubaoID:%d,
+ PieceCount:%d
'''\
%(
- self.Cmd,
- self.SubCmd,
- self.GubaoID
+ self.GubaoID,
+ self.PieceCount
+ )
+ return DumpString
+
+
+class tagCMGubaoStarUp(Structure):
+ Head = tagHead()
+ GubaoID = 0 #(WORD GubaoID)
+ PieceSelectCount = 0 #(BYTE PieceSelectCount)
+ CommPieceUseList = list() #(vector<tagCMGubaoPieceUse> CommPieceUseList)// 通用古宝碎片使用列表
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x17
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.GubaoID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+ self.PieceSelectCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.PieceSelectCount):
+ temCommPieceUseList = tagCMGubaoPieceUse()
+ _pos = temCommPieceUseList.ReadData(_lpData, _pos)
+ self.CommPieceUseList.append(temCommPieceUseList)
+ return _pos
+
+ def Clear(self):
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x17
+ self.GubaoID = 0
+ self.PieceSelectCount = 0
+ self.CommPieceUseList = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += self.Head.GetLength()
+ length += 2
+ length += 1
+ for i in range(self.PieceSelectCount):
+ length += self.CommPieceUseList[i].GetLength()
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteWORD(data, self.GubaoID)
+ data = CommFunc.WriteBYTE(data, self.PieceSelectCount)
+ for i in range(self.PieceSelectCount):
+ data = CommFunc.WriteString(data, self.CommPieceUseList[i].GetLength(), self.CommPieceUseList[i].GetBuffer())
+ return data
+
+ def OutputString(self):
+ DumpString = '''
+ Head:%s,
+ GubaoID:%d,
+ PieceSelectCount:%d,
+ CommPieceUseList:%s
+ '''\
+ %(
+ self.Head.OutputString(),
+ self.GubaoID,
+ self.PieceSelectCount,
+ "..."
)
return DumpString
m_NAtagCMGubaoStarUp=tagCMGubaoStarUp()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Cmd,m_NAtagCMGubaoStarUp.SubCmd))] = m_NAtagCMGubaoStarUp
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Head.Cmd,m_NAtagCMGubaoStarUp.Head.SubCmd))] = m_NAtagCMGubaoStarUp
#------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 331497e..b28d832 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -19471,18 +19471,15 @@
#------------------------------------------------------
# B2 17 古宝升星 #tagCMGubaoStarUp
-class tagCMGubaoStarUp(Structure):
+class tagCMGubaoPieceUse(Structure):
_pack_ = 1
_fields_ = [
- ("Cmd", c_ubyte),
- ("SubCmd", c_ubyte),
- ("GubaoID", c_ushort),
+ ("GubaoID", c_ushort), # 通用碎片古宝ID
+ ("PieceCount", c_ushort), # 使用碎片个数
]
def __init__(self):
self.Clear()
- self.Cmd = 0xB2
- self.SubCmd = 0x17
return
def ReadData(self, stringData, _pos=0, _len=0):
@@ -19491,33 +19488,99 @@
return _pos + self.GetLength()
def Clear(self):
- self.Cmd = 0xB2
- self.SubCmd = 0x17
self.GubaoID = 0
+ self.PieceCount = 0
return
def GetLength(self):
- return sizeof(tagCMGubaoStarUp)
+ return sizeof(tagCMGubaoPieceUse)
def GetBuffer(self):
return string_at(addressof(self), self.GetLength())
def OutputString(self):
DumpString = '''// B2 17 古宝升星 //tagCMGubaoStarUp:
- Cmd:%s,
- SubCmd:%s,
- GubaoID:%d
+ GubaoID:%d,
+ PieceCount:%d
'''\
%(
- self.Cmd,
- self.SubCmd,
- self.GubaoID
+ self.GubaoID,
+ self.PieceCount
+ )
+ return DumpString
+
+
+class tagCMGubaoStarUp(Structure):
+ Head = tagHead()
+ GubaoID = 0 #(WORD GubaoID)
+ PieceSelectCount = 0 #(BYTE PieceSelectCount)
+ CommPieceUseList = list() #(vector<tagCMGubaoPieceUse> CommPieceUseList)// 通用古宝碎片使用列表
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x17
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.GubaoID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+ self.PieceSelectCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.PieceSelectCount):
+ temCommPieceUseList = tagCMGubaoPieceUse()
+ _pos = temCommPieceUseList.ReadData(_lpData, _pos)
+ self.CommPieceUseList.append(temCommPieceUseList)
+ return _pos
+
+ def Clear(self):
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x17
+ self.GubaoID = 0
+ self.PieceSelectCount = 0
+ self.CommPieceUseList = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += self.Head.GetLength()
+ length += 2
+ length += 1
+ for i in range(self.PieceSelectCount):
+ length += self.CommPieceUseList[i].GetLength()
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteWORD(data, self.GubaoID)
+ data = CommFunc.WriteBYTE(data, self.PieceSelectCount)
+ for i in range(self.PieceSelectCount):
+ data = CommFunc.WriteString(data, self.CommPieceUseList[i].GetLength(), self.CommPieceUseList[i].GetBuffer())
+ return data
+
+ def OutputString(self):
+ DumpString = '''
+ Head:%s,
+ GubaoID:%d,
+ PieceSelectCount:%d,
+ CommPieceUseList:%s
+ '''\
+ %(
+ self.Head.OutputString(),
+ self.GubaoID,
+ self.PieceSelectCount,
+ "..."
)
return DumpString
m_NAtagCMGubaoStarUp=tagCMGubaoStarUp()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Cmd,m_NAtagCMGubaoStarUp.SubCmd))] = m_NAtagCMGubaoStarUp
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Head.Cmd,m_NAtagCMGubaoStarUp.Head.SubCmd))] = m_NAtagCMGubaoStarUp
#------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
index afa6fae..364b8a4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
@@ -35,6 +35,7 @@
GameWorld.DebugAnswer(curPlayer, "重置古宝: Gubao 0")
GameWorld.DebugAnswer(curPlayer, "设置古宝: Gubao 古宝ID 等级 星级")
GameWorld.DebugAnswer(curPlayer, "设置效果: Gubao e 古宝ID 效果类型 进度值")
+ GameWorld.DebugAnswer(curPlayer, "设置碎片: Gubao p 古宝ID 数量")
return
gubaoIDList = []
@@ -60,7 +61,17 @@
PlayerGubao.Sync_GubaoItemEffInfo(curPlayer, force=True)
GameWorld.DebugAnswer(curPlayer, "重置古宝OK")
-
+ elif value1 == "p":
+ gubaoID = msgList[1] if len(msgList) > 1 else 0
+ pieceCount = msgList[2] if len(msgList) > 2 else 0
+ ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID)
+ if not ipyData:
+ GameWorld.DebugAnswer(curPlayer, "不存在该古宝!gubaoID=%s" % gubaoID)
+ return
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoPiece % gubaoID, pieceCount)
+ GameWorld.DebugAnswer(curPlayer, "设置碎片数量: ID:%s,数量:%s" % (gubaoID, pieceCount))
+ PlayerGubao.Sync_GubaoPieceInfo(curPlayer, [gubaoID])
+ return
elif len(msgList) == 3:
gubaoID, lv, star = msgList
ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 6127e6f..7e76b2d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -424,6 +424,7 @@
("WORD", "GubaoID", 1),
("BYTE", "GubaoStar", 1),
("list", "StarUPNeedItemInfo", 0),
+ ("list", "StarUPNeedQualityPiece", 0),
("list", "StarAttrIDList", 0),
("list", "StarAttrValueList", 0),
("list", "StarEffIDList", 0),
@@ -3048,9 +3049,10 @@
def GetGubaoID(self): return self.attrTuple[0] # 古宝ID WORD
def GetGubaoStar(self): return self.attrTuple[1] # 古宝星级 BYTE
def GetStarUPNeedItemInfo(self): return self.attrTuple[2] # 升星所需物品 [[物品ID,个数], ...] list
- def GetStarAttrIDList(self): return self.attrTuple[3] # 累计总属性ID列表 list
- def GetStarAttrValueList(self): return self.attrTuple[4] # 累计总属性值列表 list
- def GetStarEffIDList(self): return self.attrTuple[5] # 星级特殊效果ID列表 list
+ def GetStarUPNeedQualityPiece(self): return self.attrTuple[3] # 升下一星额外所需品质碎片 [[品质,个数], ...] list
+ def GetStarAttrIDList(self): return self.attrTuple[4] # 累计总属性ID列表 list
+ def GetStarAttrValueList(self): return self.attrTuple[5] # 累计总属性值列表 list
+ def GetStarEffIDList(self): return self.attrTuple[6] # 星级特殊效果ID列表 list
# 古宝特殊效果表
class IPY_GubaoEffAttr():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
index 2c30d14..6329808 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
@@ -162,10 +162,18 @@
#// B2 17 古宝升星 #tagCMGubaoStarUp
#
+#struct tagCMGubaoPieceUse
+#{
+# WORD GubaoID; // 通用碎片古宝ID
+# WORD PieceCount; // 使用碎片个数
+#};
+#
#struct tagCMGubaoStarUp
#{
# tagHead Head;
# WORD GubaoID;
+# BYTE PieceSelectCount;
+# tagCMGubaoPieceUse CommPieceUseList[PieceSelectCount]; // 通用古宝碎片使用列表
#};
def OnGubaoStarUp(index, curPackData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
@@ -185,7 +193,8 @@
if not ipyData:
return
needItemList = ipyData.GetStarUPNeedItemInfo()
- if not needItemList:
+ needQualityPiece = ipyData.GetStarUPNeedQualityPiece()
+ if not needItemList and not needQualityPiece:
return
needPieceInfo, realNeedItemList = ParseGubaoNeedItem(curPlayer, needItemList)
@@ -195,15 +204,46 @@
if lackItemDict:
GameWorld.DebugLog("古宝升星所需物品不足! star=%s,realNeedItemList=%s,lackItemDict=%s" % (star, realNeedItemList, lackItemDict), playerID)
return
- for gID, needPieceCount in needPieceInfo.items():
- curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoPiece % gID)
+
+ if needQualityPiece:
+ commPieceUseLimitInfo = IpyGameDataPY.GetFuncEvalCfg("GubaoPiece", 1, {})
+ selectPieceDict = {}
+ for pieceUse in curPackData.CommPieceUseList:
+ useGubaoID = pieceUse.GubaoID
+ usePieceCnt = pieceUse.PieceCount
+ useIpyData = IpyGameDataPY.GetIpyGameData("Gubao", useGubaoID)
+ if not useIpyData:
+ return
+ quality = useIpyData.GetGubaoQuality()
+ if str(quality) not in commPieceUseLimitInfo:
+ GameWorld.DebugLog("该古宝品质没有配置可作为通用碎片使用的最低星级! useGubaoID=%s" % (useGubaoID), playerID)
+ return
+ needStar = commPieceUseLimitInfo[str(quality)]
+ _, usePieceStar = GetGubaoLVInfo(curPlayer, useGubaoID)
+ if usePieceStar < needStar:
+ GameWorld.DebugLog("该古宝品质星级不足,无法作为通用碎片! useGubaoID=%s,usePieceStar=%s < %s" % (useGubaoID, usePieceStar, needStar), playerID)
+ return
+ selectPieceDict[quality] = selectPieceDict.get(quality, 0) + usePieceCnt
+ needPieceInfo[useGubaoID] = needPieceInfo.get(useGubaoID, 0) + usePieceCnt
+
+ for quality, needCount in needQualityPiece:
+ selectCount = selectPieceDict.get(quality, 0)
+ if selectCount != needCount: # 需精确匹配个数,多或少都不允许升星,防止多扣或者少扣
+ GameWorld.ErrLog("选择使用的品质通用碎片个数不匹配,无法升星! gubaoID=%s,star=%s,quality=%s,selectCount=%s != %s"
+ % (gubaoID, star, quality, selectCount, needCount), playerID)
+ return
+
+ GameWorld.DebugLog("所需古宝碎片汇总: %s" % needPieceInfo, playerID)
+
+ for costGubaoID, needPieceCount in needPieceInfo.items():
+ curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoPiece % costGubaoID)
if curCount < needPieceCount:
- GameWorld.DebugLog("古宝升星所需古宝碎片不足! gubaoID=%s,curCount=%s < needPieceCount=%s" % (gubaoID, curCount, needPieceCount), playerID)
+ GameWorld.DebugLog("古宝升星所需古宝碎片不足! gubaoID=%s,costGubaoID=%s,curCount=%s < needPieceCount=%s" % (gubaoID, costGubaoID, curCount, needPieceCount), playerID)
return
#扣消耗
- for gID, needPieceCount in needPieceInfo.items():
- DelGubaoPiece(curPlayer, gID, needPieceCount, "StarUp")
+ for costGubaoID, needPieceCount in needPieceInfo.items():
+ DelGubaoPiece(curPlayer, costGubaoID, needPieceCount, "StarUp")
if realNeedItemList:
ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Gubao")
--
Gitblit v1.8.0