| | |
| | | if packIndex == ShareDefine.rptRune:
|
| | | runeSource = tagItem.GetUserAttr(ShareDefine.Def_IudetRuneSource) or 1
|
| | | setItemKeyData = GetRuneItemKeyData(tagItem.GetItemTypeID(), tagItem.GetUserAttr(ShareDefine.Def_IudetRuneLV), source=runeSource)
|
| | | elif packIndex == ShareDefine.rptGatherSoul:
|
| | | setItemKeyData = GetGatherSoulItemKeyData(tagItem.GetItemTypeID(), tagItem.GetUserAttr(ShareDefine.Def_IudetGatherSoulLV))
|
| | |
|
| | | refreshPlaceList = []
|
| | | for place in xrange(ItemCommon.GetVPackCnt(packIndex)):
|
| | |
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddBossRebornPoint', msgStr, len(msgStr))
|
| | | elif itemID == ChConfig.Def_ItemID_Ysog:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_Ysog, itemCount)
|
| | | |
| | | elif itemID == ChConfig.Def_ItemID_SoulDust:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_SoulDust, itemCount)
|
| | | elif itemID == ChConfig.Def_ItemID_SoulSplinters:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_SoulSplinters, itemCount)
|
| | | elif itemID == ChConfig.Def_ItemID_SoulCore:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_SoulCore, itemCount)
|
| | | elif itemID == ChConfig.Def_ItemID_Honor:
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_Honor, itemCount)
|
| | | return True
|
| | | |
| | | def __CrossServerPutInItem(self, packIndex, tagItem, event=["", False, {}]):
|
| | | ## 跨服获得物品
|
| | | curPlayer = self.__Player
|
| | | serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
|
| | | itemData = [tagItem.GetItemTypeID(), tagItem.GetCount(), tagItem.GetIsBind(), tagItem.GetUserData()]
|
| | | itemMsg = {"PlayerID":curPlayer.GetPlayerID(), "ItemData":itemData, "PackIndex":packIndex, "Event":event}
|
| | | GameWorld.SendMsgToClientServer(ShareDefine.CrossServerMsg_PutInItem, itemMsg, [serverGroupID])
|
| | | return
|
| | |
|
| | | ## 放入物品
|
| | | # @param packIndex 背包索引
|
| | |
| | | if not curItemData:
|
| | | return False
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | self.__CrossServerPutInItem(packIndex, tagItem, event)
|
| | | tagItem.Clear()
|
| | | return True
|
| | | |
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
|
| | |
|
| | | if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), GetItemCount(tagItem), tagItem.GetIsBind(), defaultPile):
|
| | |
| | | return False
|
| | |
|
| | | itemID = tagItem.GetItemTypeID()
|
| | | #激活成就的道具
|
| | | if tagItem.GetType() == ChConfig.Def_ItemType_SuccessItem:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [tagItem.GetEffectByIndex(0).GetEffectValue(0)])
|
| | | return True
|
| | | if itemID in ChConfig.Def_TransformItemIDList:
|
| | | # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
|
| | | if packIndex == IPY_GameWorld.rptItem:
|
| | |
| | | isBind = tagItem.GetIsBind()
|
| | | isNeedRecord = False
|
| | | # 目前暂只记录放入背包的
|
| | | if packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptRune]:
|
| | | if packIndex in [IPY_GameWorld.rptItem, ShareDefine.rptTreasure, ShareDefine.rptRune, ShareDefine.rptGatherSoul]:
|
| | | isNeedRecord = ItemNeedRecord(tagItem) or isForceEvent
|
| | | putResult = False
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def CheckRolePackEquipAttr(self):
|
| | | ''' 玩家上线修复装备属性bug
|
| | | 版本1:邮件给装备没有传奇属性,检查无传奇属性装备
|
| | | 版本2:绝版属性数值调整,已获得的装备重新刷下
|
| | | '''
|
| | | curPlayer = self.__Player
|
| | | checkVersion = 20190103
|
| | | key = "LoginCheckEquipAttr"
|
| | | if curPlayer.NomalDictGetProperty(key):
|
| | | curVersion = curPlayer.NomalDictGetProperty(key)
|
| | | if curVersion == checkVersion:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("玩家上线处理装备属性! curVersion=%s,checkVersion=%s" % (curVersion, checkVersion), playerID)
|
| | | |
| | | outOfPrintAttrItemDict = {} # 有绝版属性的定制物品属性信息 {itemID:[绝版属性ID列表, 绝版属性数值列表], ...}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetAppointItemCount()):
|
| | | ipyData = ipyDataMgr.GetAppointItemByIndex(i)
|
| | | outOfPrintAttrList = ipyData.GetOutOfPrintAttr()
|
| | | outOfPrintAttrValueList = ipyData.GetOutOfPrintAttrValue()
|
| | | if not outOfPrintAttrList or len(outOfPrintAttrList) != len(outOfPrintAttrValueList):
|
| | | continue
|
| | | itemID = GetAppointItemRealID(ipyData.GetID())
|
| | | if not itemID:
|
| | | continue
|
| | | outOfPrintAttrItemDict[itemID] = [outOfPrintAttrList, outOfPrintAttrValueList]
|
| | | |
| | | checkPackList = [IPY_GameWorld.rptEquip, IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]
|
| | | for packType in checkPackList:
|
| | | curPack = curPlayer.GetItemManager().GetPack(packType)
|
| | |
| | | isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | if not isEquip:
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | self.CheckEquipAttr(packType, curItem)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, 1)
|
| | | |
| | | # 重刷绝版属性
|
| | | if itemID in outOfPrintAttrItemDict:
|
| | | outOfPrintAttrList, outOfPrintAttrValueList = outOfPrintAttrItemDict[itemID]
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue)
|
| | | for outOfPrintAttrIndex in xrange(len(outOfPrintAttrList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrID, outOfPrintAttrList[outOfPrintAttrIndex])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetOutOfPrintAttrValue, outOfPrintAttrValueList[outOfPrintAttrIndex])
|
| | | GameWorld.Log(" 玩家登录重刷装备绝版属性: packType=%s,i=%s,itemID=%s,outOfPrintAttrList=%s,outOfPrintAttrValueList=%s" |
| | | % (packType, i, itemID, outOfPrintAttrList, outOfPrintAttrValueList), playerID)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, key, checkVersion)
|
| | | return
|
| | |
|
| | | ## 是否能放入物品
|
| | |
| | | # @return True or False
|
| | | # @remarks 函数详细说明.
|
| | | def CanPutInItem(self, packIndex, curItemID, curItemCount, isBind, defaultPile=True):
|
| | | if GameWorld.IsCrossServer():
|
| | | return True
|
| | | checkRet, putIndex = self.CanPutInItemEx(packIndex, curItemID, curItemCount, isBind, defaultPile)
|
| | | return checkRet
|
| | |
|
| | |
| | | def GetRuneItemIsLock(keyData): return keyData / 1000000000
|
| | | def GetRuneItemSource(keyData): return keyData % 1000000000 / 100000000
|
| | | def IsRuneItemNeedRecord(curItem, plusLV):
|
| | | return plusLV > 0 or curItem.GetItemColor() >= ChConfig.Def_Quality_Orange
|
| | |
|
| | | # 聚魂物品存储字典数值数据结构: 前5位为物品ID, 6~8位为强化等级
|
| | | def GetGatherSoulItemKeyData(itemID, GatherSoulLV):
|
| | | return min(GatherSoulLV, 999) * 100000 + itemID
|
| | | def GetGatherSoulItemID(keyData): return keyData % 100000
|
| | | def GetGatherSoulItemPlusLV(keyData): return keyData % 100000000 / 100000
|
| | | def IsGatherSoulItemNeedRecord(curItem, plusLV):
|
| | | return plusLV > 0 or curItem.GetItemColor() >= ChConfig.Def_Quality_Orange
|
| | |
|
| | | def SetVPackItemKeyData(curPlayer, packIndex, place, keyData, isSync=True):
|
| | |
| | | if not curItemData:
|
| | | return False
|
| | |
|
| | | #激活成就的道具
|
| | | if curItemData.GetType() == ChConfig.Def_ItemType_SuccessItem:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [itemID])
|
| | | return True
|
| | | |
| | | defaultPack = IPY_GameWorld.rptItem if not packIndexList else packIndexList[0]
|
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), defaultPack)
|
| | | if packIndex != defaultPack or not packIndexList:
|
| | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isBind=0):
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isBind=0, expireTime=0):
|
| | | ''' 获取功能产出的物品实例
|
| | | '''
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isBind)
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isBind, expireTime)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|