| | |
| | | # @param itemID 物品ID
|
| | | # @return curSingleItem
|
| | | # @remarks 函数详细说明.
|
| | | def CreateSingleItem(itemID, itemCount=1, isBind=0):
|
| | | def CreateSingleItem(itemID, itemCount=1, isBind=0, expireTime=0):
|
| | | curSingleItem = GameWorld.GetItemFactory().CreateItem(itemID)
|
| | | if not curSingleItem:
|
| | | return
|
| | |
| | |
|
| | | ItemControler.SetItemCount(curSingleItem, itemCount)
|
| | |
|
| | | if expireTime > 0:
|
| | | curSingleItem.SetUserAttr(ShareDefine.Def_IudetExpireTime, expireTime)
|
| | | |
| | | #这里返回的是SingleItem , 如果创建了,未使用,会找出C++内存泄露!!!
|
| | | return curSingleItem
|
| | |
|
| | |
| | | SkillAtkRateReduce = attrDict.get(ShareDefine.Def_Effect_SkillAtkRateReduce, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAtkRateReduceC())
|
| | | Hit = attrDict.get(ShareDefine.Def_Effect_Hit, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetHitC())
|
| | | Miss = attrDict.get(ShareDefine.Def_Effect_Miss, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetMissC())
|
| | | SkillAddPerA = attrDict.get(ShareDefine.Def_Effect_SkillAddPer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer1C())
|
| | | SkillAddPerB = attrDict.get(ShareDefine.Def_Effect_SkillAddPer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer2C())
|
| | | SkillAddPerC = attrDict.get(ShareDefine.Def_Effect_SkillAddPer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer3C())
|
| | | SkillAddPerD = attrDict.get(ShareDefine.Def_Effect_SkillAddPer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer4C())
|
| | | SkillAddPerE = attrDict.get(ShareDefine.Def_Effect_SkillAddPer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer5C())
|
| | | SkillAddPerF = attrDict.get(ShareDefine.Def_Effect_SkillAddPer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer6C())
|
| | | SkillAddPerG = attrDict.get(ShareDefine.Def_Effect_SkillAddPer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillAddPer7C())
|
| | | SkillReducePerA = attrDict.get(ShareDefine.Def_Effect_SkillReducePer1, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer1C())
|
| | | SkillReducePerB = attrDict.get(ShareDefine.Def_Effect_SkillReducePer2, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer2C())
|
| | | SkillReducePerC = attrDict.get(ShareDefine.Def_Effect_SkillReducePer3, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer3C())
|
| | | SkillReducePerD = attrDict.get(ShareDefine.Def_Effect_SkillReducePer4, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer4C())
|
| | | SkillReducePerE = attrDict.get(ShareDefine.Def_Effect_SkillReducePer5, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer5C())
|
| | | SkillReducePerF = attrDict.get(ShareDefine.Def_Effect_SkillReducePer6, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer6C())
|
| | | SkillReducePerG = attrDict.get(ShareDefine.Def_Effect_SkillReducePer7, 0) * (1 if not gsParamIpyData else gsParamIpyData.GetSkillReducePer7C())
|
| | |
|
| | | # 攻速不默认乘,仅作为参数提供策划使用
|
| | | AtkSpeed = attrDict.get(ShareDefine.Def_Effect_AtkSpeed, 0)
|
| | |
| | | if GetIsDogzEquip(curItem):
|
| | | # 神兽装备用不同公式
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula3", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 3)))
|
| | | elif GetIsZhuXianEquip(curItem):
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula4", IpyGameDataPY.GetFuncCfg("EquipGSFormula", 4)))
|
| | | else:
|
| | | value = eval(FormulaControl.GetCompileFormula("EquipGSFormula", IpyGameDataPY.GetFuncCfg("EquipGSFormula")))
|
| | | return value
|
| | |
|
| | | def GetZhuXianEquipTotalGS(curPlayer):
|
| | | ##诛仙装备总评分
|
| | | equipScoreTotal = 0
|
| | | zhuXianEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianEquip)
|
| | | for equipIndex in xrange(zhuXianEquipPack.GetCount()):
|
| | | curEquip = zhuXianEquipPack.GetAt(equipIndex) |
| | | if curEquip.IsEmpty():
|
| | | continue
|
| | | equipScoreTotal += GetEquipGearScore(curEquip)
|
| | | return equipScoreTotal
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 通过效果ID,检查是否为指定物品
|
| | |
| | | # 特殊判定根据时效时间判定物品是否可以使用
|
| | | # 过期物品不能使用或装备但是可以出售续费
|
| | | def CheckItemCanUseByExpireTime(curItem):
|
| | | curItemCreateTime = curItem.GetCreateTime()
|
| | | curItemExpireTime = curItem.GetExpireTime()
|
| | | curItemPastTime = GameWorld.GetPastSeconds(curItemCreateTime)
|
| | | # curItemCreateTime = curItem.GetCreateTime()
|
| | | # curItemExpireTime = curItem.GetExpireTime()
|
| | | # curItemPastTime = GameWorld.GetPastSeconds(curItemCreateTime)
|
| | | # |
| | | # reduceType = curItem.GetEndureReduceType()
|
| | | # if reduceType == ChConfig.Def_EquipReduceType_RTimeItem and \
|
| | | # curItemPastTime >= curItemExpireTime:
|
| | | # # 过期了
|
| | | # return False
|
| | | # |
| | | # if reduceType == ChConfig.Def_EquipReduceType_Time:
|
| | | # # 开始装备时间
|
| | | # startTime = curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime)
|
| | | # if startTime == 0:
|
| | | # return True
|
| | | # if time.time() - startTime > curItemExpireTime:
|
| | | # return False
|
| | |
|
| | | isExpireItem, expireTime = GetItemRemainingTime(curItem)
|
| | | if isExpireItem:
|
| | | if expireTime <= 0:
|
| | | return False
|
| | | return True
|
| | |
|
| | | def GetItemRemainingTime(curItem):
|
| | | ''' 获取物品剩余时间,秒
|
| | | @return: 是否时效物品, 剩余时间 |
| | | '''
|
| | | |
| | | isExpireItem = False
|
| | | reduceType = curItem.GetEndureReduceType()
|
| | | if reduceType == ChConfig.Def_EquipReduceType_RTimeItem and \
|
| | | curItemPastTime >= curItemExpireTime:
|
| | | # 过期了
|
| | | return False
|
| | | remainingTime = 0
|
| | |
|
| | | if reduceType == ChConfig.Def_EquipReduceType_Time:
|
| | | if reduceType in [ChConfig.Def_EquipReduceType_Time, ChConfig.Def_EquipReduceType_RTimeItem]:
|
| | | isExpireItem = True
|
| | | # 装备后开始计时
|
| | | curItemExpireTime = curItem.GetUserAttr(ShareDefine.Def_IudetExpireTime)
|
| | | if not curItemExpireTime:
|
| | | curItemExpireTime = curItem.GetExpireTime()
|
| | | |
| | | # 开始装备时间
|
| | | startTime = curItem.GetUserAttr(ShareDefine.Def_IudetCreateTime)
|
| | | if startTime == 0:
|
| | | return True
|
| | | if time.time() - startTime > curItemExpireTime:
|
| | | return False
|
| | | return True
|
| | | remainingTime = curItemExpireTime
|
| | | else:
|
| | | curItemPastTime = max(0, int(time.time()) - startTime)
|
| | | remainingTime = max(0, curItemExpireTime - curItemPastTime)
|
| | | return isExpireItem, remainingTime
|
| | | |
| | | return isExpireItem, remainingTime
|
| | |
|
| | | ##检查该物品是否合法,类型验证
|
| | | # @param curItem 物品实例
|
| | |
| | | return hasEnough, itemIndexList, findItemIsBind, needCnt
|
| | |
|
| | |
|
| | | def GetPackItemBindStateIndexInfo(curPlayer, itemID, needCount=0):
|
| | | def GetPackItemBindStateIndexInfo(curPlayer, itemID, needCount=0, packType=IPY_GameWorld.rptItem):
|
| | | ''' 获取背包消耗道具绑定及未绑定索引情况
|
| | | @param needCount: 所需个数, 默认绑定优先,当找到已经足够的个数后不再遍历,减少无用遍历
|
| | | @return: 可消耗物品列表[[绑定物品索引], [不绑定物品索引]], 绑定个数, 未绑定个数
|
| | |
| | | consumeItemIndexList = [[], []] # 可消耗物品列表[[绑定物品索引], [不绑定物品索引]]
|
| | | bindCnt, unBindCnt = 0, 0
|
| | |
|
| | | curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | curPack = curPlayer.GetItemManager().GetPack(packType)
|
| | | for i in range(0, curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | if not curItem:
|
| | |
| | | # @remarks 函数详细说明.
|
| | | def SwitchItem(curPlayer, curItem, switchItem, putInPackIndex):
|
| | | ##物品绑定字段判定 -> 装备绑定
|
| | | if putInPackIndex == IPY_GameWorld.rptEquip:
|
| | | if putInPackIndex in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | # 装备技能书、坐骑装备绑定
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, curItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | #交换装备
|
| | |
| | | return
|
| | |
|
| | | ##物品绑定字段判定 -> 装备绑定
|
| | | if putInPackIndex == IPY_GameWorld.rptEquip:
|
| | | if putInPackIndex in [IPY_GameWorld.rptEquip, ShareDefine.rptZhuXianEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, switchItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | # 装备技能书、坐骑装备绑定
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip]:
|
| | | if putInPackIndex in [IPY_GameWorld.rptHorseEquip, ShareDefine.rptZhuXianEquip]:
|
| | | DoLogic_ItemBindType(curPlayer, emptyItem, ChConfig.Def_BindType_DoEquipBind)
|
| | |
|
| | | if switchItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem:
|
| | |
| | | ## 返回是否神兽装备
|
| | | return curItem.GetType() in ChConfig.Def_DogzEquiipType
|
| | |
|
| | | def GetIsZhuXianEquip(curItem):
|
| | | ## 返回是否诛仙装备
|
| | | return curItem.GetType() in ChConfig.Def_ZhuXianEquiipType
|
| | |
|
| | | ## 返回是否武器
|
| | | # @param curItem 当前物品
|
| | | # @return None
|