| | |
| | | # 小心, 小心, 小心, 小心, 小心
|
| | | # eggxp
|
| | | #===============================================================================
|
| | | def __PutItemInVPack(self, packIndex, tagItem, event):
|
| | | def PutItemInVPack(self, packIndex, tagItem, event=["", False, {}]):
|
| | | # 虚拟背包, 默认不做叠加
|
| | | curPlayer = self.__Player
|
| | | canPutInCnt = 1
|
| | |
| | | Sync_VPackItem_Refresh(curPlayer, packIndex, refreshPlaceList)
|
| | |
|
| | | if tagItem and not tagItem.IsEmpty():
|
| | | tagItem.Clear()
|
| | | #tagItem.Clear()
|
| | | return False
|
| | | return True
|
| | |
|
| | |
| | | if not curItemData:
|
| | | return False
|
| | |
|
| | | vPackItemDict = ChConfig.Def_VPackItem_Dict
|
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
|
| | |
|
| | | for pack, itemTypeList in vPackItemDict.items():
|
| | | if curItemData.GetType() in itemTypeList:
|
| | | packIndex = pack
|
| | | break
|
| | | |
| | | if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), tagItem.GetCount(), tagItem.GetIsBind(), defaultPile):
|
| | | GameWorld.DebugLog("背包满,不能放入物品 count = %d"%tagItem.GetCount())
|
| | | tagItem.Clear()
|
| | |
| | |
|
| | | # 虚拟背包, 默认不做叠加
|
| | | if packIndex in ShareDefine.Def_VPack_TypeList:
|
| | | return self.__PutItemInVPack(packIndex, tagItem, event)
|
| | | return self.PutItemInVPack(packIndex, tagItem, event)
|
| | |
|
| | | eventName, isForceEvent, addDict = event
|
| | |
|
| | |
| | | DropItemToOtherPack(curPlayer, clientData.SrcBackpack, clientData.DesBackPack, clientData.SrcIndex, clientData.IsAll)
|
| | | return
|
| | |
|
| | | def DropItemToOtherPack(curPlayer, fromPackIndex, toPackIndex, index, isAll=False):
|
| | | def DropItemToOtherPack(curPlayer, fromPackIndex, desPackIndex, index, isAll=False):
|
| | | '''拖动某个背包物品到玩家物品背包
|
| | | '''
|
| | | movePack = curPlayer.GetItemManager().GetPack(fromPackIndex)
|
| | |
| | |
|
| | | #整个背包转移
|
| | | if isAll:
|
| | | fullPackList = []
|
| | | for itemIndex in xrange(movePack.GetCount()):
|
| | | curItem = movePack.GetAt(itemIndex)
|
| | | if not curItem or curItem.IsEmpty():
|
| | | continue
|
| | | toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)
|
| | | if toPackIndex in fullPackList:
|
| | | continue
|
| | | if not __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, itemIndex, curItem):
|
| | | return
|
| | | if toPackIndex not in fullPackList:
|
| | | fullPackList.append(toPackIndex)
|
| | | |
| | | for fullPackIndex in fullPackList:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [fullPackIndex])
|
| | |
|
| | | #单个物品转移
|
| | | else:
|
| | | curItem = movePack.GetAt(index)
|
| | | if not curItem or curItem.IsEmpty():
|
| | | return
|
| | | toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), desPackIndex)
|
| | | __DoDropItemToOtherPack(curPlayer, itemControl, fromPackIndex, toPackIndex, index, curItem)
|
| | | return
|
| | |
|
| | |
| | | #curItemGUID = curItem.GetGUID()
|
| | | curItemCount = curItem.GetCount()
|
| | | curItemIsBind = curItem.GetIsBind()
|
| | | #toPackIndex = ChConfig.GetItemPackType(curItem.GetType(), toPackIndex)
|
| | | |
| | | # 常规物品转移到虚拟符印背包
|
| | | if toPackIndex == ShareDefine.rptRune:
|
| | | if not ItemCommon.CheckPackHasSpace(curPlayer, toPackIndex, True):
|
| | | return False
|
| | | return itemControl.PutItemInVPack(toPackIndex, curItem)
|
| | | |
| | | checkRet, putIndex = itemControl.CanPutInItemEx(toPackIndex, curItemTypeID, curItemCount, curItemIsBind)
|
| | | if not checkRet:
|
| | | return False
|
| | |
| | | itemList = [] # 非装备普通物品
|
| | | equipGSGreaterList = [] # 属于本职业的高评分装备
|
| | | equipGSLesserList = [] # 低评分装备和非本职业
|
| | | runeItemList = [] # 符印
|
| | | |
| | | #EquipGSTypeForSort
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | #组合列表
|
| | |
| | | equipGS = 1
|
| | | cmpEquipGS = 2
|
| | |
|
| | | if equipGS == 0:
|
| | | if tmpItem.GetType() in [ChConfig.Def_ItemType_Rune, ChConfig.Def_ItemType_RuneExp]:
|
| | | runeItemList.append(tmpItem)
|
| | | elif equipGS == 0:
|
| | | itemList.append(tmpItem)
|
| | | elif equipGS > cmpEquipGS:
|
| | | equipGSGreaterList.append(tmpItem)
|
| | |
| | | equipGSGreaterList.sort(__CmpRolePack)
|
| | | itemList.sort(__CmpRolePack)
|
| | | equipGSLesserList.sort(__CmpRolePack)
|
| | |
|
| | | runeItemList.sort(__CmpRolePack)
|
| | | |
| | | #===========================================================================
|
| | | # GameWorld.DebugLog("equipGSGreaterList")
|
| | | # for item in equipGSGreaterList:
|
| | |
| | | for item in equipGSLesserList:
|
| | | curPack.GetAt(putPlace).AssignItem(item, False)
|
| | | putPlace += 1
|
| | | |
| | | for item in runeItemList:
|
| | | curPack.GetAt(putPlace).AssignItem(item, False)
|
| | | putPlace += 1
|
| | | |
| | | return
|
| | |
|
| | |
|
| | |
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [itemID])
|
| | | return True
|
| | |
|
| | | vPackItemDict = ChConfig.Def_VPackItem_Dict
|
| | | for pack, itemTypeList in vPackItemDict.items():
|
| | | if curItemData.GetType() in itemTypeList:
|
| | | packIndexList = [pack]
|
| | | break
|
| | | defaultPack = IPY_GameWorld.rptItem if not packIndexList else packIndexList[0]
|
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), defaultPack)
|
| | | if packIndex != defaultPack or not packIndexList:
|
| | | packIndexList = [packIndex]
|
| | |
|
| | | if not __Check_CanPutItemInPack(curPlayer, itemID, itemCount, itemIsBind, packIndexList, defaultPile):
|
| | | #不可放入
|
| | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | key = (itemColor, itemQuality)
|
| | | isDogzEquip = ItemCommon.GetIsDogzEquip(curItem)
|
| | | # {(颜色,星级):[一般属性条数, 追求属性条数, 固定属性条数], ...}
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")
|
| | | if isDogzEquip:
|
| | | #神兽装备条数不一样
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount", 2)
|
| | | else:
|
| | | legAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrCount")
|
| | | if key not in legAttrCntDict:
|
| | | #GameWorld.DebugLog("该装备品质没有传奇属性: itemColor=%s,itemQuality=%s" % (itemColor, itemQuality))
|
| | | return
|
| | |
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | # {属性ID:{颜色:数值, ...}, ...}
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor")
|
| | | if isDogzEquip:
|
| | | # 神兽装备数值不一样 |
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2")
|
| | | else:
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor")
|
| | | legAttrValueClassLVDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByClassLV")
|
| | | for attrID in randAttrIDList:
|
| | | if attrID in legAttrValueColorDict:
|