80 【常规】背包-服务端(去除使用物品多余验证;同步使用物品封包;)
| | |
| | | class tagCMUseItems(Structure):
|
| | | Head = tagHead()
|
| | | ItemIndex = 0 #(BYTE ItemIndex)//物品在背包中索引
|
| | | UseCnt = 0 #(WORD UseCnt)//使用个数,0表示全部使用
|
| | | UseCnt = 0 #(DWORD UseCnt)//使用个数,0表示全部使用
|
| | | ExData = 0 #(DWORD ExData)//使用扩展值, 默认0, 选择物品宝箱时发送选择的物品ID
|
| | | SelectCount = 0 #(BYTE SelectCount)//指定选择项,当批量使用单个箱子需要同时选中多种选项时使用该值
|
| | | SelectList = list() #(vector<tagCMUseItemsSelect> SelectList)
|
| | |
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ItemIndex,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.UseCnt,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.UseCnt,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.ExData,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.SelectCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.SelectCount):
|
| | |
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.SelectCount):
|
| | |
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ItemIndex)
|
| | | data = CommFunc.WriteWORD(data, self.UseCnt)
|
| | | data = CommFunc.WriteDWORD(data, self.UseCnt)
|
| | | data = CommFunc.WriteDWORD(data, self.ExData)
|
| | | data = CommFunc.WriteBYTE(data, self.SelectCount)
|
| | | for i in range(self.SelectCount):
|
| | |
| | | def __DoLogic_PlayerUseItemSelf(curPlayer, useItemIndex, tick, useCnt=1, exData=0):
|
| | |
|
| | | #使用物品行为状态, 判断客户端限制
|
| | | if not OperControlManager.IsObjCanDoAction(
|
| | | curPlayer, |
| | | ChConfig.Def_Obj_ActState_ClientAct, |
| | | IPY_GameWorld.oalUseItem
|
| | | ):
|
| | | return False
|
| | | #if not OperControlManager.IsObjCanDoAction(
|
| | | # curPlayer, |
| | | # ChConfig.Def_Obj_ActState_ClientAct, |
| | | # IPY_GameWorld.oalUseItem
|
| | | # ):
|
| | | # return False
|
| | |
|
| | | #------------------封包参数 获得 玩家物品
|
| | | backPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | |
| | | # @return 布尔值
|
| | | # @remarks 检查使用物品的玩家属性.
|
| | | def CheckUseItemSelf_Player(curPlayer):
|
| | | if GameObj.GetHP(curPlayer) <= 0 :
|
| | | return False
|
| | | #if GameObj.GetHP(curPlayer) <= 0 :
|
| | | # return False
|
| | |
|
| | | # #眩晕时, 不可使用物品
|
| | | # if curPlayer.GetAbnormalState() == IPY_GameWorld.sctFaint:
|
| | | # return False
|
| | |
|
| | | #使用物品行为状态, 判断服务端限制
|
| | | if not OperControlManager.IsObjCanDoAction(
|
| | | curPlayer, |
| | | ChConfig.Def_Obj_ActState_ServerAct, |
| | | IPY_GameWorld.oalUseItem
|
| | | ):
|
| | | return False
|
| | | #if not OperControlManager.IsObjCanDoAction(
|
| | | # curPlayer, |
| | | # ChConfig.Def_Obj_ActState_ServerAct, |
| | | # IPY_GameWorld.oalUseItem
|
| | | # ):
|
| | | # return False
|
| | |
|
| | | #交易状态, 不可使用物品
|
| | | if curPlayer.GetPlayerAction() == IPY_GameWorld.paTrade:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_372238")
|
| | | return False
|
| | | #if curPlayer.GetPlayerAction() == IPY_GameWorld.paTrade:
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_372238")
|
| | | # return False
|
| | |
|
| | | # #GM禁止使用
|
| | | # if GameWorld.IsGM(curPlayer):
|