10245 【越南】【砍树】【主干】【港台】古宝升星修改(支持额外扣除品质碎片数量)
|  |  |  | 
|---|
|  |  |  | WORD        _GubaoID;    //古宝ID | 
|---|
|  |  |  | BYTE        _GubaoStar;    //古宝星级 | 
|---|
|  |  |  | list        StarUPNeedItemInfo;    //升星所需物品 [[物品ID,个数], ...] | 
|---|
|  |  |  | list        StarUPNeedQualityPiece;    //升下一星额外所需品质碎片 [[品质,个数], ...] | 
|---|
|  |  |  | list        StarAttrIDList;    //累计总属性ID列表 | 
|---|
|  |  |  | list        StarAttrValueList;    //累计总属性值列表 | 
|---|
|  |  |  | list        StarEffIDList;    //星级特殊效果ID列表 | 
|---|
|  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # 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): | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # 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): | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "重置古宝: Gubao 0") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置古宝: Gubao 古宝ID 等级 星级") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置效果: Gubao e 古宝ID 效果类型  进度值") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置碎片: Gubao p 古宝ID 数量") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gubaoIDList = [] | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | ("WORD", "GubaoID", 1), | 
|---|
|  |  |  | ("BYTE", "GubaoStar", 1), | 
|---|
|  |  |  | ("list", "StarUPNeedItemInfo", 0), | 
|---|
|  |  |  | ("list", "StarUPNeedQualityPiece", 0), | 
|---|
|  |  |  | ("list", "StarAttrIDList", 0), | 
|---|
|  |  |  | ("list", "StarAttrValueList", 0), | 
|---|
|  |  |  | ("list", "StarEffIDList", 0), | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(): | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  |  | 
|---|