| | |
| | | import ReadChConfig
|
| | | import OperControlManager
|
| | | import ShareDefine
|
| | | import PlayerAttrFruit
|
| | | import DataRecordPack
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | |
| | | #===============================================================================
|
| | | def __Func_InitItem(tick):
|
| | | #初始化物品掉落保护
|
| | | MapItemProtectTime = IpyGameDataPY.GetFuncCfg("MapItemProtectTime")
|
| | | MapItemProtectTime = 120000 #IpyGameDataPY.GetFuncCfg("MapItemProtectTime")
|
| | | GameWorld.GetMapItemManager().SetProtectTime(MapItemProtectTime)
|
| | |
|
| | | #===============================================================================================
|
| | |
| | | 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 useSpecialItemResult
|
| | |
|
| | | #---特殊装备不验证装备属性, 普通物品要验证装备属性---
|
| | | itemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | |
| | | #装备无法使用
|
| | | if itemControler.PlayerCanEquipItem(curItem, False):
|
| | | #这个物品是装备
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_774045")
|
| | | return
|
| | | |
| | | #物品类型ID
|
| | | itemTypeID = curItem.GetItemTypeID()
|
| | |
|
| | |
| | | # @return None or True
|
| | | # @remarks 函数详细说明.
|
| | | def __DealWith_SpecialItem(curPlayer, curItem, tick, useCnt, exData):
|
| | | #果实物品
|
| | | useFruitResult = PlayerAttrFruit.DoPlayerEatFruitItem(curPlayer, curItem, useCnt)
|
| | | if useFruitResult != -1:
|
| | | return useFruitResult
|
| | |
|
| | | #------------------------获得物品相关属性
|
| | | itemTypeID = curItem.GetItemTypeID() #物品类型id
|
| | |
| | | # @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):
|
| | |
| | | infoDict[ShareDefine.Def_MapItemInfo_IsSuite] = 1
|
| | |
|
| | | return infoDict
|
| | |
|
| | | # 特别设定:卓越物品必带武器技能增强效果,使用者请特别注意
|
| | | ## 装备动态属性,只用于未设置属性的singleItem,roleItem使用多次发背包刷新包
|
| | | # @param curItem 玩家实例
|
| | | # @param equipData
|
| | | # @return |
| | | def EquipAddAdditionEx(curItem, equipData):
|
| | | # 绑定
|
| | | #if equipData.isBind:
|
| | | # ItemControler.SetItemIsBind(curItem, equipData.isBind)
|
| | | |
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return
|
| | | |
| | | #===========================================================================
|
| | | # # 强化等级
|
| | | # if equipData.starLV:
|
| | | # curItem.SetItemStarLV(equipData.starLV)
|
| | | # # 打孔
|
| | | # if 0 < equipData.holeCnt <= curItem.GetMaxHoleCount():
|
| | | # curItem.SetCanPlaceStoneCount(equipData.holeCnt)
|
| | | # |
| | | # # 给镶嵌宝石
|
| | | # for i, stoneID in enumerate(equipData.stoneData):
|
| | | # if i > equipData.holeCnt - 1:
|
| | | # break
|
| | | # |
| | | # if stoneID <= 0:
|
| | | # continue
|
| | | # |
| | | # curItem.SetStone(i, stoneID)
|
| | | #===========================================================================
|
| | | |
| | | # 套装
|
| | | #if equipData.isSuite:
|
| | | # curItem.SetIsSuite(equipData.isSuite)
|
| | | #if equipData.suiteLV:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetSuiteLV, equipData.suiteLV)
|
| | | # 物品来源
|
| | | if equipData.source:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSource, equipData.source)
|
| | | |
| | | # 传奇属性
|
| | | if equipData.legendAttrIDList and equipData.legendAttrValueList:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(len(equipData.legendAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, equipData.legendAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, equipData.legendAttrValueList[i])
|
| | | # 传奇属性 - 神
|
| | | if equipData.legendAttrIDListShen and equipData.legendAttrValueListShen:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | for i in xrange(len(equipData.legendAttrIDListShen)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDShen, equipData.legendAttrIDListShen[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueShen, equipData.legendAttrValueListShen[i])
|
| | | # 传奇属性 - 仙
|
| | | if equipData.legendAttrIDListXian and equipData.legendAttrValueListXian:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | for i in xrange(len(equipData.legendAttrIDListXian)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDXian, equipData.legendAttrIDListXian[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueXian, equipData.legendAttrValueListXian[i])
|
| | | # 传奇属性 - 极
|
| | | if equipData.legendAttrIDListJi and equipData.legendAttrValueListJi:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | for i in xrange(len(equipData.legendAttrIDListJi)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDJi, equipData.legendAttrIDListJi[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueJi, equipData.legendAttrValueListJi[i])
|
| | | |
| | | ItemCommon.MakeEquipGS(curItem) |
| | | return
|
| | |
|
| | |
|
| | | ## 判断装备是否是可加强装备
|
| | | # @param curItem 物品实例
|