| | |
| | | def DoTransformItem(self, curPlayer, tagItem, event=["", False, {}]):
|
| | | ## 将特殊物品转化为对应数值
|
| | | itemID = tagItem.GetItemTypeID()
|
| | | if itemID not in ChConfig.Def_TransformItemIDList:
|
| | | return False
|
| | | itemCount = max(tagItem.GetUserAttr(ShareDefine.Def_IudetItemCount), tagItem.GetCount())
|
| | | eventName, isForceEvent, addDict = event
|
| | | if isForceEvent:
|
| | |
| | | addDict["reason_name_son"] = itemID
|
| | | addDict["GiveItemEvent"] = ChConfig.ItemGiveTypeDict.get(eventName, eventName) # 获取该物品的事件
|
| | | moneyEventName = ChConfig.Def_GiveMoney_TransformItem # 货币的事件类型,因为传进来的事件类型是物品的
|
| | | if tagItem.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
|
| | | curEff = tagItem.GetEffectByIndex(0)
|
| | | moneyCount = curEff.GetEffectValue(0) * tagItem.GetCount()
|
| | | moneyType = curEff.GetEffectValue(1)
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyCount, moneyEventName, addDict)
|
| | | return True
|
| | | if itemID not in ChConfig.Def_TransformItemIDList:
|
| | | return False
|
| | | if itemID == ChConfig.Def_ItemID_FamilyContribution:
|
| | | PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, itemCount, True, ShareDefine.Def_AddFAVReason_UseItem, True)
|
| | | elif itemID == ChConfig.Def_ItemID_SilverMoney:
|
| | |
| | | tagItem.Clear()
|
| | | return True
|
| | |
|
| | | if itemID in ChConfig.Def_TransformItemIDList:
|
| | | if itemID in ChConfig.Def_TransformItemIDList or tagItem.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
|
| | | # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
|
| | | if packIndex == IPY_GameWorld.rptItem:
|
| | | self.DoTransformItem(curPlayer, tagItem, event)
|
| | |
| | | GameWorld.Log("找不到ItemID = %d" % curItemID)
|
| | | return False, 0
|
| | |
|
| | | if curItemID in ChConfig.Def_TransformItemIDList:
|
| | | if curItemID in ChConfig.Def_TransformItemIDList or curItemData.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
|
| | | # 货币直接转换的物品如果是放入背包的则直接转化,无需暂用格子
|
| | | if packIndex == IPY_GameWorld.rptItem:
|
| | | return True, 0
|
| | |
| | | # if isAuctionItem:
|
| | | # if IpyGameDataPY.GetIpyGameDataNotLog("AuctionItem", itemData.GetItemTypeID()):
|
| | | # return 1
|
| | | if itemData.GetItemTypeID() in ChConfig.Def_TransformItemIDList:
|
| | | if itemData.GetItemTypeID() in ChConfig.Def_TransformItemIDList or itemData.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
|
| | | # 货币直接转换的物品如果是放入背包的则不需要暂用格子,放入其他的背包的则按物品叠加上限算
|
| | | if packType == IPY_GameWorld.rptItem:
|
| | | return 0
|