2546 【1.3】【1.3.100】自动分解装备增加防范
| | |
| | |
|
| | | class tagCMEquipDecompose(Structure):
|
| | | Head = tagHead()
|
| | | IndexCount = 0 #(BYTE IndexCount)//材料所在背包索引的数量
|
| | | IndexList = list() #(vector<BYTE> IndexList)//材料所在背包索引列表
|
| | | Count = 0 #(BYTE Count)//材料所在背包索引的数量
|
| | | IndexList = list() #(vector<WORD> IndexList)//材料所在背包索引列表
|
| | | ItemIDList = list() #(vector<DWORD> ItemIDList)//材料所在背包物品ID列表
|
| | | IsAuto = 0 #(BYTE IsAuto)//是否自动分解
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.IndexCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.IndexCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | value,_pos=CommFunc.ReadWORD(_lpData,_pos)
|
| | | self.IndexList.append(value)
|
| | | for i in range(self.Count):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.ItemIDList.append(value)
|
| | | self.IsAuto,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x2C
|
| | | self.IndexCount = 0
|
| | | self.Count = 0
|
| | | self.IndexList = list()
|
| | | self.ItemIDList = list()
|
| | | self.IsAuto = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1 * self.IndexCount
|
| | | length += 2 * self.Count
|
| | | length += 4 * self.Count
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.IndexCount)
|
| | | for i in range(self.IndexCount):
|
| | | data = CommFunc.WriteBYTE(data, self.IndexList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteWORD(data, self.IndexList[i])
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteDWORD(data, self.ItemIDList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.IsAuto)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | IndexCount:%d,
|
| | | IndexList:%s
|
| | | Count:%d,
|
| | | IndexList:%s,
|
| | | ItemIDList:%s,
|
| | | IsAuto:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.IndexCount,
|
| | | "..."
|
| | | self.Count,
|
| | | "...",
|
| | | "...",
|
| | | self.IsAuto
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | class tagCMEquipDecompose(Structure):
|
| | | Head = tagHead()
|
| | | IndexCount = 0 #(BYTE IndexCount)//材料所在背包索引的数量
|
| | | IndexList = list() #(vector<BYTE> IndexList)//材料所在背包索引列表
|
| | | Count = 0 #(BYTE Count)//材料所在背包索引的数量
|
| | | IndexList = list() #(vector<WORD> IndexList)//材料所在背包索引列表
|
| | | ItemIDList = list() #(vector<DWORD> ItemIDList)//材料所在背包物品ID列表
|
| | | IsAuto = 0 #(BYTE IsAuto)//是否自动分解
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.IndexCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.IndexCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | value,_pos=CommFunc.ReadWORD(_lpData,_pos)
|
| | | self.IndexList.append(value)
|
| | | for i in range(self.Count):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.ItemIDList.append(value)
|
| | | self.IsAuto,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x2C
|
| | | self.IndexCount = 0
|
| | | self.Count = 0
|
| | | self.IndexList = list()
|
| | | self.ItemIDList = list()
|
| | | self.IsAuto = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1 * self.IndexCount
|
| | | length += 2 * self.Count
|
| | | length += 4 * self.Count
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.IndexCount)
|
| | | for i in range(self.IndexCount):
|
| | | data = CommFunc.WriteBYTE(data, self.IndexList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteWORD(data, self.IndexList[i])
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteDWORD(data, self.ItemIDList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.IsAuto)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | IndexCount:%d,
|
| | | IndexList:%s
|
| | | Count:%d,
|
| | | IndexList:%s,
|
| | | ItemIDList:%s,
|
| | | IsAuto:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.IndexCount,
|
| | | "..."
|
| | | self.Count,
|
| | | "...",
|
| | | "...",
|
| | | self.IsAuto
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | #struct tagCMEquipDecompose
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE IndexCount; //材料所在背包索引的数量
|
| | | # BYTE IndexList[IndexCount]; //材料所在背包索引列表
|
| | | # BYTE Count; //材料所在背包索引的数量
|
| | | # WORD IndexList[Count]; //材料所在背包索引列表
|
| | | # DWORD ItemIDList[Count]; //材料所在背包物品ID列表
|
| | | # BYTE IsAuto; //是否自动分解
|
| | | #};
|
| | |
|
| | | ## 玩家分解装备封包 A5 08
|
| | | # @param playerIndex 玩家索引
|
| | | # @param clientData 客户端封包
|
| | |
| | | # @return None
|
| | | def OnDoEquipDecompose(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | if not clientData.Count:
|
| | | return
|
| | | eatIndexList = clientData.IndexList
|
| | | |
| | | EatItems(curPlayer, eatIndexList)
|
| | | eatItemIDList = clientData.ItemIDList
|
| | | isAuto = clientData.IsAuto
|
| | | EatItems(curPlayer, eatIndexList, eatItemIDList, isAuto)
|
| | | return
|
| | |
|
| | | # 吞噬物品, 返回被吞数量
|
| | | def EatItems(curPlayer, eatIndexList):
|
| | | drDelItemList, totalAddExp, delAllCnt = __GetCanEatItemInfo(curPlayer, eatIndexList)
|
| | | def EatItems(curPlayer, eatIndexList, eatItemIDList, isAuto=False):
|
| | | if len(eatIndexList) != len(eatItemIDList):
|
| | | return 0, 0
|
| | | drDelItemList, totalAddExp, delAllCnt = __GetCanEatItemInfo(curPlayer, eatIndexList, eatItemIDList)
|
| | | if not totalAddExp:
|
| | | GameWorld.DebugLog(" 装备吸收 没有可吞噬物品!")
|
| | | return 0, 0
|
| | |
| | | Sync_EDLVInfo(curPlayer, jsonItemList)
|
| | | # 流向
|
| | | saveDataDict = {"ExpBefore":Exp, "AddTotalExp":reduceTotalExp, "ExpAfter":updExp,
|
| | | "DelItemList(ItemID,delCnt,baseExp,addExp)":drDelItemList}
|
| | | "DelItemList(ItemID,delCnt,baseExp,addExp)":drDelItemList, 'isAuto':isAuto}
|
| | | DataRecordPack.DR_ClassUpSystem(curPlayer, "EquipDecomposeUp", updLV, saveDataDict)
|
| | |
|
| | | #EventReport.WriteEvent__lv(curPlayer, LV, updLV, Exp, updExp)
|
| | |
| | | ##获取可以吞噬的物品信息
|
| | | # @param curPlayer: 玩家实例
|
| | | # @return [可吞噬的物品列表], 最大可提供的经验
|
| | | def __GetCanEatItemInfo(curPlayer, expIndexList):
|
| | | def __GetCanEatItemInfo(curPlayer, expIndexList, eatItemIDList):
|
| | | eatItemList = []
|
| | | totalAddExp = 0
|
| | | allitemCnt = 0
|
| | | petEatItemAddExpPer = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_EatItem)
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | for index in expIndexList:
|
| | | for i, index in enumerate(expIndexList):
|
| | | eatItem = itemPack.GetAt(index)
|
| | |
|
| | | if not eatItem or eatItem.IsEmpty():
|
| | | continue
|
| | |
|
| | | eatItemID = eatItem.GetItemTypeID()
|
| | | if eatItemIDList[i] != eatItemID:
|
| | | GameWorld.ErrLog(' 装备分解客户端发的物品索引与实际物品ID不对应 index=%s,eatItemID=%s,wantEatItemID'%(index, eatItemID, eatItemIDList[i]))
|
| | | continue
|
| | | if eatItem.GetType() == ChConfig.Def_ItemType_EquipDecomposeExp:
|
| | | curEff = eatItem.GetEffectByIndex(0)
|
| | | baseExp = curEff.GetEffectValue(0)
|
| | |
| | | #GameWorld.DebugLog("equipScores----%s"%equipScores)
|
| | |
|
| | | eatIndexList = []
|
| | | eatItemIDList = []
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | for i in range(0, itemPack.GetCount()):
|
| | | curItem = itemPack.GetAt(i)
|
| | |
| | | continue
|
| | |
|
| | | eatIndexList.append(i)
|
| | | |
| | | eatItemIDList.append(curItem.GetItemTypeID())
|
| | | #GameWorld.DebugLog("eatIndexList-----------%s"%len(eatIndexList))
|
| | | eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList)
|
| | | eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList, eatItemIDList)
|
| | | NoteEatEquip(curPlayer, eatCount, giveCnt)
|
| | | CheckPackFull(curPlayer)
|
| | |
|