| | |
| | | import PlayerActivity
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PlayerXiangong
|
| | | import IpyGameDataPY
|
| | | import PlayerGubao
|
| | | import PyGameData
|
| | | import PlayerHero
|
| | | import PlayerMail
|
| | |
|
| | | import math
|
| | | import time
|
| | |
| | | tagItem.Clear()
|
| | | return True
|
| | |
|
| | | #气运
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_TiandaoQiyun:
|
| | | isAutoUse = itemEff.GetEffectValue(1)
|
| | | if isAutoUse:
|
| | | addQiyun = itemEff.GetEffectValue(0) * tagItemCount
|
| | | PlayerXiangong.AddTiandaoQiyun(curPlayer, addQiyun, {"ItemID":itemID, "ItemCount":tagItemCount, "isAutoUse":1})
|
| | | tagItem.Clear()
|
| | | return True
|
| | | #增加副本次数
|
| | | if itemEff.GetEffectID() == ChConfig.Def_Effect_AddFBCnt:
|
| | | isAutoUse = itemEff.GetEffectValue(1)
|
| | |
| | | #itemFactory = GameWorld.GetItemFactory()
|
| | | #isBind = tagItem.GetIsBind()
|
| | | # 目前暂只记录放入背包的
|
| | | if not isNeedRecord and packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptHero, IPY_GameWorld.rptIdentify, ShareDefine.rptMGTuiyan]:
|
| | | if not isNeedRecord and packIndex in ShareDefine.NeedRecordRPType:
|
| | | isNeedRecord = ItemNeedRecord(tagItem) or isForceEvent
|
| | | putResult = False
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def ResetHeroPack(curPlayer, curPack, beingIndex, endIndex):
|
| | | itemList = []
|
| | | for i in range(beingIndex, endIndex + 1):
|
| | | curRoleItem = curPack.GetAt(i)
|
| | | if curRoleItem.IsEmpty():
|
| | | continue
|
| | | curItem = curRoleItem.GetItem() |
| | | itemList.append(curItem)
|
| | | itemList.sort(__CmpHeroPack)
|
| | | |
| | | curPack.WipePack(beingIndex, endIndex)
|
| | | putPlace = beingIndex
|
| | | for item in itemList:
|
| | | curPack.GetAt(putPlace).AssignItem(item, False)
|
| | | putPlace += 1
|
| | | |
| | | ## 前端自行排序
|
| | | return
|
| | |
|
| | | def __CmpHeroPack(item1, item2):
|
| | | '''排序规则:上阵武将排前,未上阵武将排后,再各自按照以下规则排序
|
| | | 武将等级>突破等级>武将星级>武将品质>武将ID
|
| | | '''
|
| | | |
| | | posNum1, posNum2 = 0, 0
|
| | | for lpIndex in range(item1.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item1.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum1 = posNum
|
| | | break
|
| | | |
| | | for lpIndex in range(item2.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item2.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum2 = posNum
|
| | | break
|
| | | |
| | | if (posNum1 and posNum2) or (not posNum1 and not posNum2):
|
| | | lv1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | lv2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | if lv1 == lv2:
|
| | | bLV1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | bLV2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | if bLV1 == bLV2:
|
| | | star1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | star2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | if star1 == star2:
|
| | | heroID1 = item1.GetItemTypeID()
|
| | | heroID2 = item2.GetItemTypeID()
|
| | | ipyData1 = IpyGameDataPY.GetIpyGameData("Hero", heroID1)
|
| | | ipyData2 = IpyGameDataPY.GetIpyGameData("Hero", heroID2)
|
| | | quality1 = ipyData1.GetQuality() if ipyData1 else 0
|
| | | quality2 = ipyData2.GetQuality() if ipyData2 else 0
|
| | | if quality1 == quality2:
|
| | | return cmp(heroID1, heroID2)
|
| | | return -cmp(quality1, quality2)
|
| | | return -cmp(star1, star2)
|
| | | return -cmp(bLV1, bLV2)
|
| | | return -cmp(lv1, lv2)
|
| | | elif posNum1:
|
| | | return -1
|
| | | elif posNum2:
|
| | | return 1
|
| | | else:
|
| | | return cmp(item1.GetItemTypeID(), item2.GetItemTypeID())
|
| | | |
| | | #===============================================================================
|
| | | #Python 版重整物品
|
| | | # def ResetItem(curPlayer, curPackIndex, tick):
|
| | |
| | | GameWorld.ErrLog('DoLogic_PutItemInPack Error 物品无法放入背包')
|
| | | return False
|
| | |
|
| | | def GetIsBindValue(isBind=0, srcSign=0):
|
| | | ## 获取IsBind值,适用于配置或者通知前端特殊标记用,兼容是否绑定/拍品设定
|
| | | # @param isBind: 可支持原绑定/拍品逻辑,如果该项目没有该逻辑暂时默认都为0
|
| | | # @param srcSign: 标记物品特殊来源,如xx特权额外产出等
|
| | | return srcSign * 10 + isBind
|
| | |
|
| | | ## 是否拍品
|
| | | def GetIsAuctionItem(curItem): return curItem.GetIsBind()
|
| | | def GetIsAuctionItem(curItem): return 0#curItem.GetIsBind()
|
| | | def SetIsAuctionItem(curItem, isAuctionItem, curPlayer=None):
|
| | | curItem.SetIsBind(isAuctionItem)
|
| | | |
| | | if isAuctionItem:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | return
|
| | | #curItem.SetIsBind(isAuctionItem)
|
| | | #
|
| | | #if isAuctionItem:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | # return
|
| | | return
|
| | |
|
| | | def GetItemCountByID(curPlayer, itemID):
|
| | |
| | | break
|
| | |
|
| | | if isSendMail:
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], giveItemList)
|
| | | PlayerMail.SendMailByKey(mailKey, curPlayer.GetPlayerID(), giveItemList)
|
| | | GameWorld.DebugLog("GivePlayerItemOrMail背包空间不够,发送邮件: mailItemList=%s" % str(giveItemList), curPlayer.GetPlayerID())
|
| | | else:
|
| | | for itemID, itemCnt, isAuctionItem in giveItemList:
|
| | |
| | |
|
| | | if notifyMailKey:
|
| | | paramList = [itemID, itemID, recycleCount]
|
| | | PlayerControl.SendMailByKey(notifyMailKey, [playerID], addItemList, paramList)
|
| | | PlayerMail.SendMailByKey(notifyMailKey, playerID, addItemList, paramList)
|
| | | elif addItemList:
|
| | | GivePlayerItemOrMail(curPlayer, addItemList, event=["RecycleItem", False, {"RecycleItemID":itemID}])
|
| | |
|