| | |
| | | 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, {}]):
|
| | | ## 跨服获得物品
|
| | | if packIndex not in [IPY_GameWorld.rptItem, ShareDefine.rptDogzItem, ShareDefine.rptZhuXianItem]:
|
| | | #GameWorld.DebugLog("跨服获得物品不同步, packIndex=%s" % (packIndex))
|
| | | return
|
| | | 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
|
| | | if CheckChangeOldItem(curPlayer, tagItem):
|
| | | tagItem.Clear()
|
| | | return True
|
| | | packIndex = ChConfig.GetItemPackType(curItemData.GetType(), packIndex)
|
| | |
|
| | | if not self.CanPutInItem(packIndex, tagItem.GetItemTypeID(), GetItemCount(tagItem), tagItem.GetIsBind(), defaultPile):
|
| | |
| | | itemID = tagItem.GetItemTypeID()
|
| | | #激活成就的道具
|
| | | if tagItem.GetType() == ChConfig.Def_ItemType_SuccessItem:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [itemID])
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetSpecialItem, 1, [tagItem.GetEffectByIndex(0).GetEffectValue(0)])
|
| | | return True
|
| | | if itemID in ChConfig.Def_TransformItemIDList:
|
| | | # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
|
| | |
| | | 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
|
| | |
|
| | |
| | | #---无空位置,替换---
|
| | | 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
|
| | |
| | | itemType = curItem.GetType()
|
| | | if itemType == ChConfig.Def_ItemType_retWing:
|
| | | return __GetAddWingLegendAttr(curItem)
|
| | | |
| | | isZhuXianEquip = ItemCommon.GetIsZhuXianEquip(curItem)
|
| | | if isZhuXianEquip:
|
| | | return __GetRandLegendAttr(curItem)
|
| | |
|
| | | itemColor = curItem.GetItemColor()
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | |
| | | # GameWorld.DebugLog("commAttrList=%s, goodAttrList=%s, specAttrList=%s" % (commAttrList, goodAttrList, specAttrList))
|
| | | # GameWorld.DebugLog("randAttrIDList=%s,curLegAttrIDList=%s, curLegAttrValueList=%s"
|
| | | # % (randAttrIDList, curLegAttrIDList, curLegAttrValueList))
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | def __GetRandLegendAttr(curItem):
|
| | | # 纯随机类型及数值的规则
|
| | | |
| | | itemType = curItem.GetType()
|
| | | equipTypeRandGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 2, {}) # 随机传奇属性类型组配置: {(装备类型1, 装备类型2, ...):[传奇属性类型组1, ...], ...}
|
| | | if itemType in equipTypeRandGroupDict:
|
| | | randGroupList = equipTypeRandGroupDict[itemType]
|
| | | else:
|
| | | randGroupList = []
|
| | | for typeTuple, groupList in equipTypeRandGroupDict.items():
|
| | | if not isinstance(typeTuple, tuple):
|
| | | continue
|
| | | if itemType in typeTuple:
|
| | | randGroupList = groupList
|
| | | break
|
| | | |
| | | if not randGroupList:
|
| | | GameWorld.ErrLog("该物品类型没有传奇属性!itemType=%s" % itemType)
|
| | | return
|
| | | |
| | | randLegendAttrIDLsit = []
|
| | | legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {1:[传奇属性类型ID组], ...}
|
| | | for groupType in randGroupList:
|
| | | if groupType not in legendAttrGroupDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
|
| | | continue
|
| | | randLegendAttrIDLsit += legendAttrGroupDict[groupType]
|
| | | |
| | | if not randLegendAttrIDLsit:
|
| | | return
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | randCountKey = (itemClassLV, itemQuality)
|
| | | randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {(阶,星):[随机条数A, 随机条数B]], ...}
|
| | | if randCountKey not in randCountDict:
|
| | | GameWorld.ErrLog("没有配置装备阶星对应随机传奇属性条数: itemClassLV=%s, itemQuality=%s" % (itemClassLV, itemQuality))
|
| | | return
|
| | | randCountList = randCountDict[randCountKey]
|
| | | if not randCountList or len(randCountList) != 2:
|
| | | return
|
| | | legAttrCnt = random.randint(randCountList[0], randCountList[1])
|
| | | legAttrCnt = min(len(randLegendAttrIDLsit), legAttrCnt)
|
| | | curLegAttrIDList = random.sample(randLegendAttrIDLsit, legAttrCnt)
|
| | | curLegAttrValueList = []
|
| | | |
| | | randValueListDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 4) # 随机数值: {传奇属性类型:[随机数值1, 数值2, ...], ...}
|
| | | maxValueMinCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 5) # 保底最大数值条数: {(阶,星):条数, ...], ...} 没配置的默认0
|
| | | maxValueMinCount = maxValueMinCountDict.get((itemClassLV, itemQuality), 0)
|
| | | if legAttrCnt < maxValueMinCount:
|
| | | GameWorld.ErrLog("传奇属性条数少于保底最大数值条数: itemClassLV=%s, itemQuality=%s, legAttrCnt=%s, maxValueMinCount=%s" |
| | | % (itemClassLV, itemQuality, legAttrCnt, maxValueMinCount))
|
| | | return
|
| | | |
| | | for i, attrID in enumerate(curLegAttrIDList):
|
| | | if attrID not in randValueListDict:
|
| | | GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
|
| | | return
|
| | | randValueList = randValueListDict[attrID]
|
| | | if i < maxValueMinCount:
|
| | | randValue = max(randValueList)
|
| | | else:
|
| | | randValue = random.choice(randValueList)
|
| | | curLegAttrValueList.append(randValue)
|
| | | |
| | | # GameWorld.DebugLog("itemType=%s,itemClassLV=%s,itemQuality=%s,randLegendAttrIDLsit=%s" % (itemType, itemClassLV, itemQuality, randLegendAttrIDLsit))
|
| | | # GameWorld.DebugLog("legAttrCnt=%s,maxValueMinCount=%s" % (legAttrCnt, maxValueMinCount))
|
| | | # GameWorld.DebugLog("curLegAttrIDList=%s,curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | def __GetAddWingLegendAttr(curItem):
|
| | |
| | | return
|
| | |
|
| | |
|
| | | def CheckChangeOldItem(curPlayer, tagItem):
|
| | | ##替换旧物品
|
| | | itemID = tagItem.GetItemTypeID()
|
| | | changeOldItemDict = IpyGameDataPY.GetFuncEvalCfg('ChangeOldItem', 1, {})
|
| | | if itemID not in changeOldItemDict:
|
| | | return
|
| | | itemCnt = GetItemCount(tagItem)
|
| | | isBind = tagItem.GetIsBind()
|
| | | toItemID, toCnt, mailKey = changeOldItemDict[itemID]
|
| | | giveCnt = itemCnt * toCnt
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetPlayerID()], [[toItemID, giveCnt, isBind]])
|
| | | return True
|
| | |
|
| | | def LoginCheckChangeOldItem(curPlayer):
|
| | | ##登录检查替换旧物品
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_GodWeaponItem):
|
| | | return
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_GodWeaponItem, 1)
|
| | | giveItemDict = {}
|
| | | mailDict = {}
|
| | | for packIndex in [IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse, ShareDefine.rptTreasure]:
|
| | | curPack = curPlayer.GetItemManager().GetPack(packIndex)
|
| | | for i in xrange(curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | if not curItem:
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | changeOldItemDict = IpyGameDataPY.GetFuncEvalCfg('ChangeOldItem', 1, {})
|
| | | if itemID not in changeOldItemDict:
|
| | | continue
|
| | | isBind = curItem.GetIsBind()
|
| | | itemCount = curItem.GetCount()
|
| | | toItemID, toCnt, mailKey = changeOldItemDict[itemID]
|
| | | giveCnt = itemCount * toCnt
|
| | | keyStr = '%s_%s'%(toItemID, isBind)
|
| | | giveItemDict[keyStr] = giveItemDict.get(keyStr, 0) + giveCnt
|
| | | ItemCommon.DelItem(curPlayer, curItem, itemCount, False, "ChangeOldItem")
|
| | | if mailKey not in mailDict:
|
| | | mailDict[mailKey] = [keyStr]
|
| | | if keyStr not in mailDict[mailKey]:
|
| | | mailDict[mailKey].append(keyStr)
|
| | | for mailKey, keyStrList in mailDict.items():
|
| | | itemList = []
|
| | | for keyStr in keyStrList:
|
| | | if keyStr not in giveItemDict:
|
| | | continue
|
| | | giveCnt = giveItemDict[keyStr]
|
| | | itemID, isBind = keyStr.split('_')
|
| | | itemList.append([int(itemID), giveCnt, int(isBind)])
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], itemList)
|
| | | return |