| | |
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import Operate_EquipStone
|
| | | import PlayerMagicWeapon
|
| | | import IpyGameDataPY
|
| | | import DataRecordPack
|
| | | import EventShell
|
| | | import ChEquip
|
| | |
|
| | | import math
|
| | | import time
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | ## 获得背包的一个空格子
|
| | |
| | | for i in range(0, curPack.GetCount()):
|
| | | item = curPack.GetAt(i)
|
| | |
|
| | | if not ItemCommon.CheckItemCanUse(item):
|
| | | if not ItemCommon.CheckItemCanUse(item) or GetIsAuctionItem(item):
|
| | | continue
|
| | |
|
| | | if item.GetItemTypeID() == id:
|
| | |
| | | for i in range(0, curPack.GetCount()):
|
| | | item = curPack.GetAt(i)
|
| | |
|
| | | if not ItemCommon.CheckItemCanUse(item):
|
| | | if not ItemCommon.CheckItemCanUse(item) or GetIsAuctionItem(item):
|
| | | continue
|
| | |
|
| | | if item.GetItemTypeID() == id:
|
| | |
| | | for i in range(0, curPack.GetCount()):
|
| | | item = curPack.GetAt(i)
|
| | |
|
| | | if not ItemCommon.CheckItemCanUse(item):
|
| | | if not ItemCommon.CheckItemCanUse(item) or GetIsAuctionItem(item):
|
| | | continue
|
| | |
|
| | | effect = item.GetEffectByIndex(0)
|
| | |
| | | for i in range(0, curPack.GetCount()):
|
| | |
|
| | | item = curPack.GetAt(i)
|
| | | if not ItemCommon.CheckItemCanUse(item):
|
| | | if not ItemCommon.CheckItemCanUse(item) or GetIsAuctionItem(item):
|
| | | continue
|
| | |
|
| | | if item.GetItemTypeID() != id:
|
| | |
| | | return True
|
| | | return False
|
| | |
|
| | | #物品属性判断------------------------------------------------------------------
|
| | | ## 使用物品检查是否满足属性
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curItem 当前物品
|
| | | # @return False or True
|
| | | def CheckItemAttrLimit(curPlayer, curItem):
|
| | | # 取消限制的物品
|
| | | if curItem.GetUserAttr(ShareDefine.Def_IudetCancelUseLimit) == 1:
|
| | | return True
|
| | | #智力为基础限制
|
| | | if curItem.GetLimitPNE() > curPlayer.GetPNE():
|
| | | return False
|
| | | |
| | | #由于可变属性强化表加载问题, 暂时不处理强化表的属性点限制,以物品表为主,如有需要再开启此判断 20151210 by hxp
|
| | | # 从强化表中获得数据,装备强化限制力量 敏捷
|
| | | # if curItem.GetType() in ReadChConfig.GetEvalChConfig("EquipPlus_EquipType"):
|
| | | # plusInfo = ...
|
| | | # |
| | | # if plusInfo is None:
|
| | | # GameWorld.ErrLog("tagItemPlus.txt can't find equip:%s" % curItem.GetItemTypeID())
|
| | | # return False
|
| | | # |
| | | # limitSTR, limitPHY = plusInfo.GetLimitSTR(), plusInfo.GetLimitPHY()
|
| | | # |
| | | # # 物品表中获得信息
|
| | | # else:
|
| | | limitSTR, limitPHY = curItem.GetLimitSTR(), curItem.GetLimitPHY()
|
| | | |
| | | if limitSTR > curPlayer.GetSTR() or limitPHY > curPlayer.GetPHY():
|
| | | return False
|
| | | |
| | | return True
|
| | |
|
| | |
|
| | | #物品使用等级判断----------------------------------------------------------------
|
| | | ## 物品使用等级判断
|
| | | # @param curPlayer 玩家
|
| | |
| | | SetItemCount(srcItem, srcItem.GetCount() - realPutCount)
|
| | | SetItemCount(destItem, destItem.GetCount() + realPutCount)
|
| | |
|
| | | SetItemIsBind(destItem, True)
|
| | | #SetItemIsBind(destItem, True)
|
| | | return True
|
| | | #2. 目标位置有东西, 并且可以堆叠
|
| | | if (CanPackItem(srcItem, destItem) and maxPackCount > destItem.GetCount()):
|
| | |
| | | # return False
|
| | |
|
| | | #职业检查
|
| | | if not ItemCommon.JobUseable(curPlayer, curItem):
|
| | | if not ItemCommon.CheckJob(curPlayer, curItem):
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_31379")
|
| | |
|
| | |
| | | #等级检查
|
| | | if not CheckItemUseLV(curPlayer, curItem, needNotify):
|
| | | return False
|
| | |
|
| | | #使用物品检查是否满足属性
|
| | | if not CheckItemAttrLimit(curPlayer, curItem):
|
| | | if needNotify:
|
| | | PlayerControl.NotifyCode(curPlayer, "itemuse_andyshao_671654")
|
| | | return False
|
| | | |
| | | |
| | | #=======================================================================
|
| | | # #马匹检查
|
| | | # if curItem.GetType() == ChConfig.Def_Item_Type_Horse and not CheckCanEquipHorse(curPlayer):
|
| | |
| | | equipItem = equipPack.GetAt(equipPackIndex)
|
| | | desItemID, desUserData = [0, ''] if equipItem.IsEmpty() else [equipItem.GetItemTypeID(), equipItem.GetUserData()]
|
| | | srcItemID, srcUserData = curItem.GetItemTypeID(), curItem.GetUserData()
|
| | | # 装备绑定处理 在 DoLogic_ItemBindType函数有处理,此处注释掉
|
| | | # if not curItem.GetIsBind():
|
| | | # SetItemIsBind(curItem, True)
|
| | |
|
| | | #--其他装备物品---
|
| | | #itemColor = curItem.GetItemColor()
|
| | |
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
|
| | |
|
| | | tagItemCount = GetItemCount(tagItem)
|
| | | isAuctionItem = tagItem.GetIsBind()
|
| | | isAuctionItem = GetIsAuctionItem(tagItem)
|
| | | if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), tagItemCount, isAuctionItem, defaultPile):
|
| | | GameWorld.DebugLog("背包满,不能放入物品 count = %d"%GetItemCount(tagItem))
|
| | | tagItem.Clear()
|
| | |
| | | itemID = tagItem.GetItemTypeID()
|
| | | #激活成就的道具
|
| | | if tagItem.GetType() == ChConfig.Def_ItemType_SuccessItem:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [tagItem.GetEffectByIndex(0).GetEffectValue(0)])
|
| | | PlayerMagicWeapon.DoActiveMW(curPlayer, tagItem.GetEffectByIndex(0).GetEffectValue(0))
|
| | | tagItem.Clear()
|
| | | return True
|
| | | if itemID in ChConfig.Def_TransformItemIDList:
|
| | | # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
|
| | |
| | | #curItemGUID = curItem.GetGUID()
|
| | | curItemCount = curItem.GetCount()
|
| | | #curItemIsBind = curItem.GetIsBind()
|
| | | isAuctionItem = curItem.GetIsBind()
|
| | | isAuctionItem = GetIsAuctionItem(curItem)
|
| | | #toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), toPackIndex)
|
| | |
|
| | | # 常规物品转移到虚拟符印背包
|
| | |
| | | GameWorld.ErrLog('DoLogic_PutItemInPack Error 物品无法放入背包')
|
| | | return False
|
| | |
|
| | | ## 设置物品是否绑定
|
| | | # @param curGiveItem 物品实例
|
| | | # @param isBind 是否绑定
|
| | | # @return None
|
| | | # @remarks |
| | | def SetItemIsBind(curGiveItem, isBind):
|
| | | #isBind = False
|
| | | curGiveItem.SetIsBind(isBind)
|
| | | ## 是否拍品
|
| | | def GetIsAuctionItem(curItem): return curItem.GetIsBind()
|
| | | def SetIsAuctionItem(curItem, isAuctionItem, curPlayer=None):
|
| | | curItem.SetIsBind(isAuctionItem)
|
| | | |
| | | if isAuctionItem:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | return
|
| | | |
| | | if not curPlayer:
|
| | | return
|
| | | |
| | | if ItemCommon.GetIsEquip(curItem):
|
| | | # 生成传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | if not legendAttrInfo:
|
| | | return
|
| | | attrIDList, attrValueList = legendAttrInfo
|
| | | updateDict = {ShareDefine.Def_IudetLegendAttrID:attrIDList, ShareDefine.Def_IudetLegendAttrValue:attrValueList}
|
| | | delKeyList = [ShareDefine.Def_IudetAuctionItemCreateTime]
|
| | | ItemCommon.UpdateItemUserData(curItem, updateDict, delKeyList, isUpdateGS=True)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | | ## 设置物品数量
|
| | | # @param item 物品实例
|
| | |
| | | '''获取生成到装备上的传奇属性
|
| | | @return: None 或者 [[传奇属性效果ID列表], [属性值列表]]
|
| | | '''
|
| | | if curItem.GetIsBind():
|
| | | if GetIsAuctionItem(curItem):
|
| | | #GameWorld.DebugLog("拍品无法生成传奇属性!")
|
| | | return
|
| | | itemID = curItem.GetItemTypeID()
|
| | |
| | | for itemID, itemCnt, isAuctionItem in itemList:
|
| | | GivePlayerItem(curPlayer, itemID, itemCnt, isAuctionItem, [IPY_GameWorld.rptItem], event=event)
|
| | | return
|
| | |
|