| | |
| | | list AttrValue; //属性值
|
| | | };
|
| | |
|
| | | //装备传奇属性条数表
|
| | |
|
| | | struct tagEquipLegendAttrCount
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | BYTE _ItemColor; //物品颜色
|
| | | BYTE _IsSuit; //是否套装
|
| | | BYTE FixedLegendAttrCount; //固定传奇属性条数
|
| | | BYTE GoodLegendAttrCount; //追求传奇属性保底条数
|
| | | BYTE OtherLegendAttrCount; //其他随机传奇属性条数
|
| | | };
|
| | |
|
| | | //装备传奇属性类型表
|
| | |
|
| | | struct tagEquipLegendAttrType
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | list FixedLegendAttrList; //固定传奇属性列表
|
| | | list GoodLegendAttrList; //追求传奇属性列表
|
| | | list CommLegendAttrList; //一般传奇属性列表
|
| | | };
|
| | |
|
| | | //装备传奇属性值库表
|
| | |
|
| | | struct tagEquipLegendAttrLib
|
| | | {
|
| | | BYTE _LegendAttrID; //传奇属性ID
|
| | | dict LegendAttrLib; //属性库信息 {库编号:[随机数值, ...], ...}
|
| | | };
|
| | |
|
| | | //装备传奇属性等级数值表
|
| | |
|
| | | struct tagEquipLegendAttrValue
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | BYTE _ItemClassLV; //物品阶级
|
| | | BYTE _ItemColor; //物品颜色
|
| | | BYTE _IsSuit; //是否套装
|
| | | dict LVLegendAttrLibNumInfo; //属性ID等级段对应数值库编号 {属性ID:{等级:库编号, ...}}
|
| | | };
|
| | |
|
| | | //神兽表
|
| | |
|
| | | struct tagDogz
|
| | |
| | | import ItemCommon
|
| | | import ItemControler
|
| | | import IPY_GameWorld
|
| | | import IpyGameDataPY
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #逻辑实现
|
| | |
| | | cmdlen = len(cmdList)
|
| | | if cmdlen < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "重新随机传奇属性: AddLegendAttr 背包格子索引")
|
| | | GameWorld.DebugAnswer(curPlayer, "添加指定传奇属性: AddLegendAttr 背包格子索引 属性ID1 属性ID2 ...")
|
| | | GameWorld.DebugAnswer(curPlayer, "添加所有传奇属性: AddLegendAttr 背包格子索引 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "部位所有传奇属性: AddLegendAttr 背包格子索引 1")
|
| | | return
|
| | |
|
| | | #获取物品
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "非装备无法获得传奇属性!")
|
| | | return
|
| | |
|
| | | attrIDList, attrValueList = [], [] # 重新刷新的属性
|
| | | addAttrIDList, addAttrValueList = [], [] # 添加的属性
|
| | | if curItem.GetType() == ChConfig.Def_ItemType_retWing:
|
| | | attrInfo = __GetWingGMAddLegendAttrInfo(curPlayer, curItem, cmdList)
|
| | | else:
|
| | | attrInfo = __GetEquipGMAddLegendAttrInfo(curPlayer, curItem, cmdList)
|
| | | |
| | | if not attrInfo or (not attrInfo[0] and not attrInfo[1]):
|
| | | GameWorld.DebugAnswer(curPlayer, "获取该装备传奇属性失败或没有传奇属性!")
|
| | | if not curItem.GetIsBind():
|
| | | GameWorld.DebugAnswer(curPlayer, "拍品无法生成传奇属性!")
|
| | | return
|
| | |
|
| | | if attrInfo[0]:
|
| | | attrIDList, attrValueList = attrInfo[0]
|
| | | if attrInfo[1]:
|
| | | addAttrIDList, addAttrValueList = attrInfo[1]
|
| | | |
| | | isAllAttr = cmdList[1] if len(cmdList) > 1 else 0
|
| | | legendAttrInfo = ItemControler.GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if not legendAttrInfo:
|
| | | GameWorld.DebugAnswer(curPlayer, "获取该装备传奇属性失败或没有传奇属性!")
|
| | | return
|
| | | attrIDList, attrValueList = legendAttrInfo
|
| | | |
| | | # 传奇属性
|
| | | if attrIDList and attrValueList and len(attrIDList) == len(attrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | GameWorld.DebugLog("刷新传奇属性: ID=%s,value=%s" % (attrIDList, attrValueList))
|
| | | attrDict = {}
|
| | | for i, attrID in enumerate(attrIDList):
|
| | | value = attrValueList[i]
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, attrValueList[i])
|
| | | |
| | | # 直接添加的
|
| | | if addAttrIDList and addAttrValueList and len(addAttrIDList) == len(addAttrValueList):
|
| | | GameWorld.DebugLog("添加传奇属性: ID=%s,value=%s" % (addAttrIDList, addAttrValueList))
|
| | | for i, attrID in enumerate(addAttrIDList):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, attrID)
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, addAttrValueList[i])
|
| | | |
| | | idList = [curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i) \
|
| | | for i in range(curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID))]
|
| | | valueList = [curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i) \
|
| | | for i in range(curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue))]
|
| | | GameWorld.DebugLog("当前传奇属性: ID=%s,value=%s" % (idList, valueList))
|
| | | |
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, value)
|
| | | attrDict[attrID] = value
|
| | | GameWorld.DebugAnswer(curPlayer, "传奇属性:%s" % (attrDict))
|
| | | |
| | | return
|
| | |
|
| | | def __GetEquipGMAddLegendAttrInfo(curPlayer, curItem, cmdList):
|
| | | isAdd = False
|
| | | cmdlen = len(cmdList)
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | itemColor = curItem.GetItemColor()
|
| | | if cmdlen == 1:
|
| | | return ItemControler.GetAddEquipLegendAttr(curItem), []
|
| | | |
| | | if cmdList[1] == 0:
|
| | | legAttrRuleDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRule")
|
| | | if equipPlace not in legAttrRuleDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "该装备位无法获得传奇属性!equipPlace=%s" % equipPlace)
|
| | | return
|
| | | commAttrList, goodAttrList, specAttrList = legAttrRuleDict[equipPlace]
|
| | | attrIDList = commAttrList + goodAttrList
|
| | | if specAttrList:
|
| | | if type(specAttrList) == int:
|
| | | attrIDList.append(specAttrList)
|
| | | else:
|
| | | attrIDList += specAttrList
|
| | | else:
|
| | | isAdd = True
|
| | | attrIDList = cmdList[1:]
|
| | | |
| | | legAttrIDList = []
|
| | | legAttrValueList = []
|
| | | |
| | | legAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValue")
|
| | | for attrID in attrIDList:
|
| | | if attrID not in legAttrValueDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有该传奇属性: %s" % attrID)
|
| | | continue
|
| | | colorValueDict = legAttrValueDict[attrID]
|
| | | if itemColor not in colorValueDict:
|
| | | continue
|
| | | legAttrIDList.append(attrID)
|
| | | legAttrValueList.append(colorValueDict[itemColor])
|
| | | |
| | | if not legAttrIDList or not legAttrValueList:
|
| | | return
|
| | | return ([], [legAttrIDList, legAttrValueList]) if isAdd else ([legAttrIDList, legAttrValueList], [])
|
| | |
|
| | | def __GetWingGMAddLegendAttrInfo(curPlayer, curItem, cmdList):
|
| | | isAdd = False
|
| | | cmdlen = len(cmdList)
|
| | | if cmdlen == 1:
|
| | | return ItemControler.GetAddEquipLegendAttr(curItem), []
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | wingLegAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrValue")
|
| | | if itemClassLV not in wingLegAttrValueDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "该翅膀阶级无法获得传奇属性!itemClassLV=%s" % itemClassLV)
|
| | | return
|
| | | curClassLVLegAttrDict = wingLegAttrValueDict[itemClassLV]
|
| | | if cmdList[1] == 0:
|
| | | attrIDList = curClassLVLegAttrDict.keys()
|
| | | else:
|
| | | isAdd = True
|
| | | attrIDList = cmdList[1:]
|
| | | |
| | | legAttrIDList = []
|
| | | legAttrValueList = []
|
| | | for attrID in attrIDList:
|
| | | if attrID not in curClassLVLegAttrDict:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有该翅膀传奇属性: %s" % attrID)
|
| | | continue
|
| | | legAttrIDList.append(attrID)
|
| | | legAttrValueList.append(random.choice(curClassLVLegAttrDict[attrID]))
|
| | | |
| | | if not legAttrIDList or not legAttrValueList:
|
| | | return
|
| | | return ([], [legAttrIDList, legAttrValueList]) if isAdd else ([legAttrIDList, legAttrValueList], [])
|
| | |
|
| | |
|
| | |
| | | paramA = msgList[0]
|
| | | paramCount = len(msgList)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | isBind = False
|
| | | isAuctionItem = True
|
| | |
|
| | | # 清空拍品
|
| | | if paramA == 0:
|
| | |
| | | for i in xrange(auctionGroup):
|
| | | if i == auctionGroup - 1:
|
| | | groupItemCount += itemCount % auctionGroup
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, groupItemCount, isBind)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, groupItemCount, isAuctionItem)
|
| | | auctionItemList.append([curItem])
|
| | | PlayerAuctionHouse.__DoAddAuctionItem(curPlayer, auctionItemList)
|
| | |
|
| | |
| | | def OnExec(curPlayer, msgList):
|
| | | #输入命令格式错误
|
| | | if len(msgList) < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItem ItemID 可选(个数 归属类型 归属ID)")
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItem ID (个数 是否拍品 归属类型 归属ID)")
|
| | | GameWorld.DebugAnswer(curPlayer, "归属类型:1-玩家,2-队伍,5-阵营,6-指定多个玩家")
|
| | | return
|
| | |
|
| | | itemID = msgList[0]
|
| | | count = msgList[1] if len(msgList) > 1 else 1
|
| | | dropType = msgList[2] if len(msgList) > 2 else ChConfig.Def_NPCHurtTypeAll
|
| | | itemCount = msgList[1] if len(msgList) > 1 else 1
|
| | | isAuctionItem = msgList[2] if len(msgList) > 2 else 0
|
| | | dropType = msgList[3] if len(msgList) > 3 else ChConfig.Def_NPCHurtTypeAll
|
| | | ownerID = 0
|
| | | specOwnerIDList = []
|
| | |
|
| | | if dropType == ChConfig.Def_NPCHurtTypeSpecial:
|
| | | specOwnerIDList = msgList[3:] if len(msgList) > 3 else []
|
| | | specOwnerIDList = msgList[4:] if len(msgList) > 4 else []
|
| | | else:
|
| | | ownerID = msgList[3] if len(msgList) > 3 else 0
|
| | | |
| | | ownerID = msgList[4] if len(msgList) > 4 else 0
|
| | | |
| | | gameMap = GameWorld.GetMap()
|
| | | dropPosX, dropPosY = curPlayer.GetPosX(), curPlayer.GetPosY() # 以玩家为中心点开始掉落
|
| | | doCount = 0
|
| | |
| | | #玩家不可移动这个点
|
| | | continue
|
| | |
|
| | | if index > count - 1:
|
| | | if index > itemCount - 1:
|
| | | break
|
| | | index += 1
|
| | |
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | if curItem == None:
|
| | | GameWorld.DebugAnswer(curPlayer, '无法查找物品 = %s' % (itemID))
|
| | | continue
|
| | |
| | | #
|
| | | # 模块详细说明
|
| | | #导入
|
| | |
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | | import IpyGameDataPY
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | | #输入命令格式错误
|
| | | if len(msgList) < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount id, [count, 符印等级]")
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID (个数 拍品分组 全部传奇属性)")
|
| | | return
|
| | |
|
| | | itemID = msgList[0]
|
| | | count = msgList[1] if len(msgList) > 1 else 1
|
| | | runeLV = msgList[2] if len(msgList) > 2 else None
|
| | | itemCount = msgList[1] if len(msgList) > 1 else 1
|
| | | auctionGroup = msgList[2] if len(msgList) > 2 else 0
|
| | | isAllAttr = msgList[3] if len(msgList) > 3 else 0
|
| | |
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | |
| | | return
|
| | | packCount = itemData.GetPackCount()
|
| | | if itemID in ChConfig.Def_TransformItemIDList:
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID)
|
| | | ItemControler.SetItemCount(curItem, count, curPlayer.GetPlayerID(), curPlayer.GetAccID(),
|
| | | curPlayer.GetPlayerName())
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, curPlayer=curPlayer)
|
| | | PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | if not PlayerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]):
|
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | | return
|
| | |
|
| | | if packCount > 1:
|
| | | __DoGMGivePlayerItem(curPlayer, itemID, count, runeLV)
|
| | | playerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | |
| | | # 拍品
|
| | | if auctionGroup:
|
| | | isAuctionItem = True
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AuctionItem", itemID)
|
| | | if not ipyData:
|
| | | GameWorld.DebugAnswer(curPlayer, "非可拍卖物品itemID=%s" % (itemID))
|
| | | return
|
| | | groupItemCount = itemCount / auctionGroup
|
| | | for i in xrange(auctionGroup):
|
| | | if i == auctionGroup - 1:
|
| | | groupItemCount += itemCount % auctionGroup
|
| | | __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, groupItemCount, isAuctionItem, isAllAttr) |
| | | else:
|
| | | for _ in xrange(count):
|
| | | __DoGMGivePlayerItem(curPlayer, itemID, 1, runeLV)
|
| | | |
| | | isAuctionItem = False
|
| | | if packCount > 1:
|
| | | __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, itemCount, isAuctionItem, isAllAttr)
|
| | | else:
|
| | | for _ in xrange(itemCount):
|
| | | __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, 1, isAuctionItem, isAllAttr)
|
| | | return
|
| | |
|
| | | def __DoGMGivePlayerItem(curPlayer, itemID, count, runeLV):
|
| | | def __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, count, isAuctionItem, isAllAttr):
|
| | | if ItemControler.GetAppointItemRealID(itemID):
|
| | | ItemControler.GivePlayerAppointItem(curPlayer, itemID, 0, True, True)
|
| | | ItemControler.GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event=[ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}])
|
| | | return
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID)
|
| | | ItemControler.SetItemCount(curItem, count, curPlayer.GetPlayerID(), curPlayer.GetAccID(),
|
| | | curPlayer.GetPlayerName())
|
| | |
|
| | | if curItem.GetType() == ChConfig.Def_ItemType_Rune and runeLV:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetRuneLV, runeLV)
|
| | | if curItem.GetType() in [ChConfig.Def_ItemType_GatherSoul,ChConfig.Def_ItemType_GatherSoulCore] and runeLV:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetGatherSoulLV, runeLV)
|
| | | #将物品放置玩家背包
|
| | | PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | if not PlayerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]):
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, count, isAuctionItem, curPlayer=curPlayer, isAllAttr=isAllAttr)
|
| | | if not playerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]):
|
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | |
|
| | | return
|
| | |
| | | ("list", "AttrValue", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrCount":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("BYTE", "ItemColor", 1),
|
| | | ("BYTE", "IsSuit", 1),
|
| | | ("BYTE", "FixedLegendAttrCount", 0),
|
| | | ("BYTE", "GoodLegendAttrCount", 0),
|
| | | ("BYTE", "OtherLegendAttrCount", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrType":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("list", "FixedLegendAttrList", 0),
|
| | | ("list", "GoodLegendAttrList", 0),
|
| | | ("list", "CommLegendAttrList", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrLib":(
|
| | | ("BYTE", "LegendAttrID", 1),
|
| | | ("dict", "LegendAttrLib", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrValue":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("BYTE", "ItemClassLV", 1),
|
| | | ("BYTE", "ItemColor", 1),
|
| | | ("BYTE", "IsSuit", 1),
|
| | | ("dict", "LVLegendAttrLibNumInfo", 0),
|
| | | ),
|
| | |
|
| | | "Dogz":(
|
| | | ("BYTE", "DogzID", 1),
|
| | | ("list", "BaseAttrTypes", 0),
|
| | |
| | | def GetStarsNeed(self): return self.StarsNeed # 全身星数
|
| | | def GetAttrType(self): return self.AttrType # 属性类型
|
| | | def GetAttrValue(self): return self.AttrValue # 属性值 |
| | | |
| | | # 装备传奇属性条数表 |
| | | class IPY_EquipLegendAttrCount(): |
| | | |
| | | def __init__(self): |
| | | self.ItemType = 0
|
| | | self.ItemColor = 0
|
| | | self.IsSuit = 0
|
| | | self.FixedLegendAttrCount = 0
|
| | | self.GoodLegendAttrCount = 0
|
| | | self.OtherLegendAttrCount = 0 |
| | | return |
| | | |
| | | def GetItemType(self): return self.ItemType # 物品类型
|
| | | def GetItemColor(self): return self.ItemColor # 物品颜色
|
| | | def GetIsSuit(self): return self.IsSuit # 是否套装
|
| | | def GetFixedLegendAttrCount(self): return self.FixedLegendAttrCount # 固定传奇属性条数
|
| | | def GetGoodLegendAttrCount(self): return self.GoodLegendAttrCount # 追求传奇属性保底条数
|
| | | def GetOtherLegendAttrCount(self): return self.OtherLegendAttrCount # 其他随机传奇属性条数 |
| | | |
| | | # 装备传奇属性类型表 |
| | | class IPY_EquipLegendAttrType(): |
| | | |
| | | def __init__(self): |
| | | self.ItemType = 0
|
| | | self.FixedLegendAttrList = []
|
| | | self.GoodLegendAttrList = []
|
| | | self.CommLegendAttrList = [] |
| | | return |
| | | |
| | | def GetItemType(self): return self.ItemType # 物品类型
|
| | | def GetFixedLegendAttrList(self): return self.FixedLegendAttrList # 固定传奇属性列表
|
| | | def GetGoodLegendAttrList(self): return self.GoodLegendAttrList # 追求传奇属性列表
|
| | | def GetCommLegendAttrList(self): return self.CommLegendAttrList # 一般传奇属性列表 |
| | | |
| | | # 装备传奇属性值库表 |
| | | class IPY_EquipLegendAttrLib(): |
| | | |
| | | def __init__(self): |
| | | self.LegendAttrID = 0
|
| | | self.LegendAttrLib = {} |
| | | return |
| | | |
| | | def GetLegendAttrID(self): return self.LegendAttrID # 传奇属性ID
|
| | | def GetLegendAttrLib(self): return self.LegendAttrLib # 属性库信息 {库编号:[随机数值, ...], ...} |
| | | |
| | | # 装备传奇属性等级数值表 |
| | | class IPY_EquipLegendAttrValue(): |
| | | |
| | | def __init__(self): |
| | | self.ItemType = 0
|
| | | self.ItemClassLV = 0
|
| | | self.ItemColor = 0
|
| | | self.IsSuit = 0
|
| | | self.LVLegendAttrLibNumInfo = {} |
| | | return |
| | | |
| | | def GetItemType(self): return self.ItemType # 物品类型
|
| | | def GetItemClassLV(self): return self.ItemClassLV # 物品阶级
|
| | | def GetItemColor(self): return self.ItemColor # 物品颜色
|
| | | def GetIsSuit(self): return self.IsSuit # 是否套装
|
| | | def GetLVLegendAttrLibNumInfo(self): return self.LVLegendAttrLibNumInfo # 属性ID等级段对应数值库编号 {属性ID:{等级:库编号, ...}} |
| | | |
| | | # 神兽表 |
| | | class IPY_Dogz(): |
| | |
| | | self.ipyItemPlusSumAttrLen = len(self.ipyItemPlusSumAttrCache)
|
| | | self.ipyRoleEquipStarsCache = self.__LoadFileData("RoleEquipStars", IPY_RoleEquipStars)
|
| | | self.ipyRoleEquipStarsLen = len(self.ipyRoleEquipStarsCache)
|
| | | self.ipyEquipLegendAttrCountCache = self.__LoadFileData("EquipLegendAttrCount", IPY_EquipLegendAttrCount)
|
| | | self.ipyEquipLegendAttrCountLen = len(self.ipyEquipLegendAttrCountCache)
|
| | | self.ipyEquipLegendAttrTypeCache = self.__LoadFileData("EquipLegendAttrType", IPY_EquipLegendAttrType)
|
| | | self.ipyEquipLegendAttrTypeLen = len(self.ipyEquipLegendAttrTypeCache)
|
| | | self.ipyEquipLegendAttrLibCache = self.__LoadFileData("EquipLegendAttrLib", IPY_EquipLegendAttrLib)
|
| | | self.ipyEquipLegendAttrLibLen = len(self.ipyEquipLegendAttrLibCache)
|
| | | self.ipyEquipLegendAttrValueCache = self.__LoadFileData("EquipLegendAttrValue", IPY_EquipLegendAttrValue)
|
| | | self.ipyEquipLegendAttrValueLen = len(self.ipyEquipLegendAttrValueCache)
|
| | | self.ipyDogzCache = self.__LoadFileData("Dogz", IPY_Dogz)
|
| | | self.ipyDogzLen = len(self.ipyDogzCache)
|
| | | self.ipyDogzEquipPlusCache = self.__LoadFileData("DogzEquipPlus", IPY_DogzEquipPlus)
|
| | |
| | | def GetItemPlusSumAttrByIndex(self, index): return self.ipyItemPlusSumAttrCache[index]
|
| | | def GetRoleEquipStarsCount(self): return self.ipyRoleEquipStarsLen
|
| | | def GetRoleEquipStarsByIndex(self, index): return self.ipyRoleEquipStarsCache[index]
|
| | | def GetEquipLegendAttrCountCount(self): return self.ipyEquipLegendAttrCountLen
|
| | | def GetEquipLegendAttrCountByIndex(self, index): return self.ipyEquipLegendAttrCountCache[index]
|
| | | def GetEquipLegendAttrTypeCount(self): return self.ipyEquipLegendAttrTypeLen
|
| | | def GetEquipLegendAttrTypeByIndex(self, index): return self.ipyEquipLegendAttrTypeCache[index]
|
| | | def GetEquipLegendAttrLibCount(self): return self.ipyEquipLegendAttrLibLen
|
| | | def GetEquipLegendAttrLibByIndex(self, index): return self.ipyEquipLegendAttrLibCache[index]
|
| | | def GetEquipLegendAttrValueCount(self): return self.ipyEquipLegendAttrValueLen
|
| | | def GetEquipLegendAttrValueByIndex(self, index): return self.ipyEquipLegendAttrValueCache[index]
|
| | | def GetDogzCount(self): return self.ipyDogzLen
|
| | | def GetDogzByIndex(self, index): return self.ipyDogzCache[index]
|
| | | def GetDogzEquipPlusCount(self): return self.ipyDogzEquipPlusLen
|
| | |
| | | if legendAttrIDCount and legendAttrValueCount and legendAttrIDCount == legendAttrValueCount:
|
| | | return
|
| | |
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem)
|
| | | curPlayer = self.__Player
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | if not legendAttrInfo:
|
| | | return
|
| | |
|
| | |
| | |
|
| | | def CheckRolePackEquipAttr(self):
|
| | | ''' 玩家上线修复装备属性bug
|
| | | 版本1:邮件给装备没有传奇属性,检查无传奇属性装备
|
| | | 版本2:绝版属性数值调整,已获得的装备重新刷下
|
| | | '''
|
| | | curPlayer = self.__Player
|
| | | checkVersion = 20190103
|
| | | key = "LoginCheckEquipAttr"
|
| | | 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)
|
| | | for i in xrange(curPack.GetCount()):
|
| | | curItem = curPack.GetAt(i)
|
| | | #GameWorld.DebugLog("packType=%s,i=%s" % (packType, i))
|
| | | if curItem.IsEmpty():
|
| | | continue
|
| | | isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | if not isEquip:
|
| | | continue
|
| | | itemID = curItem.GetItemTypeID()
|
| | | self.CheckEquipAttr(packType, curItem)
|
| | | |
| | | # 重刷绝版属性
|
| | | 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)
|
| | | # curPlayer = self.__Player
|
| | | # checkVersion = 20190103
|
| | | # key = "LoginCheckEquipAttr"
|
| | | # 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)
|
| | | # for i in xrange(curPack.GetCount()):
|
| | | # curItem = curPack.GetAt(i)
|
| | | # #GameWorld.DebugLog("packType=%s,i=%s" % (packType, i))
|
| | | # if curItem.IsEmpty():
|
| | | # continue
|
| | | # isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | # if not isEquip:
|
| | | # continue
|
| | | # itemID = curItem.GetItemTypeID()
|
| | | # self.CheckEquipAttr(packType, curItem)
|
| | | # |
| | | # # 重刷绝版属性
|
| | | # 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
|
| | |
|
| | | ## 是否能放入物品
|
| | |
| | |
|
| | | ## 获取定制表物品数据
|
| | | # @param index 表index
|
| | | # @param isBind 是否绑定
|
| | | # @param isAuctionItem 是否拍品
|
| | | # @return ItemDictData
|
| | | def GetAppointItemDictData(index, isBind):
|
| | | def GetAppointItemDictData(index, isAuctionItem):
|
| | | itemID = GetAppointItemRealID(index)
|
| | | if not itemID:
|
| | | return {}
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", index)
|
| | | if not ipyData:
|
| | | GameWorld.ErrLog("GivePlayerAppointItem() Index=%s not data" % (index))
|
| | | GameWorld.ErrLog("GetAppointItemDictData() Index=%s not data" % (index))
|
| | | return {}
|
| | | itemDictData = {}
|
| | |
|
| | |
| | | itemDictData['CancelUseLimit'] = ipyData.GetCancelUseLimit()
|
| | |
|
| | | # 设置是否绑定
|
| | | isBind = 1 if not isAuctionItem else 0
|
| | | itemDictData['IsBind'] = isBind
|
| | |
|
| | | #装备绝版属性,随等级变化
|
| | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isBind=1, expireTime=0):
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, isAllAttr=False):
|
| | | ''' 获取功能产出的物品实例
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | @param curPlayer: 产出该物品时的玩家,非拍品时需传入该值,物品某些属性由玩家等级决定,如传奇属性
|
| | | @param isAllAttr: 是否生成该装备所有属性,GM创建物品时用,需验证相关权限
|
| | | '''
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isBind, expireTime)
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|
| | |
| | | if GetAppointItemRealID(itemID):
|
| | | curItem.Clear()
|
| | | #GameWorld.DebugLog("清除给定制物品之前已经创建的物品ID=%s" % itemID)
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isBind))
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isAuctionItem))
|
| | | |
| | | # 拍品不处理其他属性
|
| | | if isAuctionItem:
|
| | | return curItem
|
| | |
|
| | | tmpEquipData = SingleEquipTmpData()
|
| | |
|
| | | # 传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem)
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if legendAttrInfo:
|
| | | tmpEquipData.legendAttrIDList = legendAttrInfo[0]
|
| | | tmpEquipData.legendAttrValueList = legendAttrInfo[1]
|
| | |
| | | ChItem.EquipAddAdditionEx(curItem, tmpEquipData)
|
| | | return curItem
|
| | |
|
| | | def GetAddEquipLegendAttr(curItem):
|
| | | def GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr=False):
|
| | | '''获取生成到装备上的传奇属性
|
| | | @return: None-没有传奇属性; 传奇属性字典-[[传奇属性效果ID列表], [属性值列表]]
|
| | | @return: None 或者 [[传奇属性效果ID列表], [属性值列表]]
|
| | | '''
|
| | | if not curItem.GetIsBind():
|
| | | #GameWorld.DebugLog("拍品无法生成传奇属性!")
|
| | | return
|
| | | itemID = curItem.GetItemTypeID()
|
| | | 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)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | key = (itemColor, itemQuality)
|
| | | isDogzEquip = ItemCommon.GetIsDogzEquip(curItem)
|
| | | # {(颜色,星级):[一般属性条数, 追求属性条数, 固定属性条数], ...}
|
| | | 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))
|
| | | isSuit = 1 if curItem.GetSuiteID() else 0
|
| | | # 1. 定条数
|
| | | attrCountIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipLegendAttrCount", itemType, itemColor, isSuit)
|
| | | if not attrCountIpyData:
|
| | | if itemColor >= ChConfig.Def_Quality_Purple:
|
| | | GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
|
| | | return
|
| | | commAttrCnt, goodAttrCnt, specAttrCnt = legAttrCntDict[key]
|
| | | |
| | | # {装备位:[[一般属性ID列表], [追求属性ID列表], [固定属性ID列表]], ...}
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | legAttrRuleDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRule")
|
| | | if equipPlace not in legAttrRuleDict:
|
| | | #GameWorld.DebugLog("该装备位没有传奇属性, equipPlace=%s" % equipPlace)
|
| | | fixedLegendAttrCount = attrCountIpyData.GetFixedLegendAttrCount()
|
| | | goodLegendAttrCount = attrCountIpyData.GetGoodLegendAttrCount()
|
| | | otherLegendAttrCount = attrCountIpyData.GetOtherLegendAttrCount()
|
| | | if fixedLegendAttrCount <= 0 and goodLegendAttrCount <= 0 and otherLegendAttrCount <= 0:
|
| | | return
|
| | | commAttrList, goodAttrList, specAttrList = legAttrRuleDict[equipPlace]
|
| | |
|
| | | randAttrIDList = [] # 先随机传奇属性类型
|
| | | if commAttrCnt:
|
| | | randAttrIDList.extend(random.sample(commAttrList, min(len(commAttrList), commAttrCnt)))
|
| | | if goodAttrCnt:
|
| | | randAttrIDList.extend(random.sample(goodAttrList, min(len(goodAttrList), goodAttrCnt)))
|
| | | if specAttrCnt:
|
| | | if type(specAttrList) == int:
|
| | | if specAttrList:
|
| | | randAttrIDList.append(specAttrList)
|
| | | else:
|
| | | randAttrIDList.extend(random.sample(specAttrList, min(len(specAttrList), specAttrCnt)))
|
| | | |
| | | if not curPlayer:
|
| | | GameWorld.ErrLog("生成装备传奇属性时玩家不存在!itemID=%s" % (itemID))
|
| | | return
|
| | | |
| | | playerID, playerLV = curPlayer.GetPlayerID(), curPlayer.GetLV()
|
| | | # 2. 定属性ID
|
| | | attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
|
| | | if not attrTypeIpyData:
|
| | | return
|
| | | fixedLegendAttrList = attrTypeIpyData.GetFixedLegendAttrList()
|
| | | goodLegendAttrList = attrTypeIpyData.GetGoodLegendAttrList()
|
| | | commLegendAttrList = attrTypeIpyData.GetCommLegendAttrList()
|
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | # {属性ID:{颜色:数值, ...}, ...}
|
| | | if isDogzEquip:
|
| | | # 神兽装备数值不一样 |
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 1, {})
|
| | | legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor2", 2, {})
|
| | | else:
|
| | | legAttrValueColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 1, {})
|
| | | legAttrValueClassLVColorDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByColor", 2, {})
|
| | | legAttrValueClassLVDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrValueByClassLV")
|
| | | for attrID in randAttrIDList:
|
| | | if attrID in legAttrValueColorDict:
|
| | | colorValueDict = legAttrValueColorDict[attrID]
|
| | | if itemColor not in colorValueDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备颜色对应的数值, attrID=%s,itemColor=%s" % (attrID, itemColor))
|
| | | continue
|
| | | attrValue = colorValueDict[itemColor]
|
| | | # {属性ID:{阶:{颜色:数值, ...}, ...}, ...}
|
| | | elif attrID in legAttrValueClassLVColorDict:
|
| | | classLVColorValueDict = legAttrValueClassLVColorDict[attrID]
|
| | | if itemClassLV in classLVColorValueDict:
|
| | | colorValueDict = classLVColorValueDict[itemClassLV]
|
| | | else:
|
| | | minClassLV, maxClassLV = min(classLVColorValueDict), max(classLVColorValueDict)
|
| | | if itemClassLV <= minClassLV:
|
| | | colorValueDict = classLVColorValueDict[minClassLV]
|
| | | elif itemClassLV >= maxClassLV:
|
| | | colorValueDict = classLVColorValueDict[maxClassLV]
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级颜色对应的数值, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))
|
| | | continue
|
| | | if itemColor not in colorValueDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级颜色对应的数值, attrID=%s,itemClassLV=%s,itemColor=%s" % (attrID, itemClassLV, itemColor))
|
| | | continue
|
| | | attrValue = colorValueDict[itemColor]
|
| | | elif attrID in legAttrValueClassLVDict:
|
| | | classLVValueDict = legAttrValueClassLVDict[attrID]
|
| | | if itemClassLV in classLVValueDict:
|
| | | attrValue = classLVValueDict[itemClassLV]
|
| | | else:
|
| | | minClassLV, maxClassLV = min(classLVValueDict), max(classLVValueDict)
|
| | | if itemClassLV <= minClassLV:
|
| | | attrValue = classLVValueDict[minClassLV]
|
| | | elif itemClassLV >= maxClassLV:
|
| | | attrValue = classLVValueDict[maxClassLV]
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID装备阶级对应的数值, attrID=%s,itemClassLV=%s" % (attrID, itemClassLV))
|
| | | continue
|
| | | else:
|
| | | GameWorld.ErrLog("没有配置传奇属性ID对应的数值, attrID=%s" % attrID)
|
| | | continue
|
| | | |
| | | curLegAttrIDList.append(attrID)
|
| | | curLegAttrValueList.append(attrValue)
|
| | | # GameWorld.DebugLog("itemClassLV=%s,itemColor=%s,itemQuality=%s,commAttrCnt=%s,goodAttrCnt=%s,specAttrCnt=%s" |
| | | # % (itemClassLV, itemColor, itemQuality, commAttrCnt, goodAttrCnt, specAttrCnt))
|
| | | # 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, ...], ...}
|
| | | if str(itemType) not in equipTypeRandGroupDict:
|
| | | return
|
| | | randGroupList = equipTypeRandGroupDict[str(itemType)]
|
| | | if not randGroupList:
|
| | | GameWorld.ErrLog("该物品类型没有传奇属性!itemType=%s" % itemType)
|
| | | return
|
| | | |
| | | randLegendAttrIDLsit = []
|
| | | legendAttrGroupDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 1, {}) # 传奇类型组 {"组ID":[属性ID1, 属性ID2], ...}
|
| | | for groupType in randGroupList:
|
| | | if str(groupType) not in legendAttrGroupDict:
|
| | | GameWorld.ErrLog("没有配置传奇属性组对应传奇属性类型列表! groupType=%s" % groupType)
|
| | | continue
|
| | | randLegendAttrIDLsit += legendAttrGroupDict[str(groupType)]
|
| | | |
| | | if not randLegendAttrIDLsit:
|
| | | return
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | randCountDict = IpyGameDataPY.GetFuncEvalCfg("LegendAttrRandRule", 3) # 随机条数: {"阶":{"星":[条数A, 条数B], ...}, ...}
|
| | | if str(itemClassLV) not in randCountDict:
|
| | | GameWorld.ErrLog("没有配置装备阶对应随机传奇属性条数: itemClassLV=%s" % (itemClassLV))
|
| | | return
|
| | | qualityCountDict = randCountDict[str(itemClassLV)]
|
| | | if str(itemQuality) not in qualityCountDict:
|
| | | GameWorld.ErrLog("没有配置装备阶星对应随机传奇属性条数: itemClassLV=%s, itemQuality=%s" % (itemClassLV, itemQuality))
|
| | | return
|
| | | randCountList = qualityCountDict[str(itemQuality)]
|
| | | 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) # 随机数值: {"传奇属性ID":[随机数值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 str(attrID) not in randValueListDict:
|
| | | GameWorld.ErrLog("传奇属性没有配置随机数值范围或配置错误: attrID=%s" % (attrID))
|
| | | if isAllAttr:
|
| | | if curPlayer.GetGMLevel() != 90:
|
| | | return
|
| | | randValueList = randValueListDict[str(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))
|
| | | curLegAttrIDList = fixedLegendAttrList + goodLegendAttrList + commLegendAttrList
|
| | | else:
|
| | | if fixedLegendAttrCount:
|
| | | if len(fixedLegendAttrList) < fixedLegendAttrCount:
|
| | | GameWorld.ErrLog("装备固定传奇属性配置不足!itemID=%s,itemType=%s,fixedLegendAttrCount=%s,fixedLegendAttrList=%s" |
| | | % (itemID, itemType, fixedLegendAttrCount, fixedLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += fixedLegendAttrList[:fixedLegendAttrCount]
|
| | | |
| | | if goodLegendAttrCount:
|
| | | if len(goodLegendAttrList) < goodLegendAttrCount:
|
| | | GameWorld.ErrLog("装备追求传奇属性配置不足!itemID=%s,itemType=%s,goodLegendAttrCount=%s,goodLegendAttrList=%s" |
| | | % (itemID, itemType, goodLegendAttrCount, goodLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(goodLegendAttrList, goodLegendAttrCount)
|
| | | |
| | | if otherLegendAttrCount:
|
| | | otherLegendAttrList = list(goodLegendAttrList) + list(commLegendAttrList)
|
| | | for curAttrID in curLegAttrIDList:
|
| | | if curAttrID in otherLegendAttrList:
|
| | | otherLegendAttrList.remove(curAttrID)
|
| | | if len(otherLegendAttrList) < otherLegendAttrCount:
|
| | | GameWorld.ErrLog("装备一般传奇属性配置不足!itemID=%s,itemType=%s,otherLegendAttrCount=%s,otherLegendAttrList=%s" |
| | | % (itemID, itemType, otherLegendAttrCount, otherLegendAttrList), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(otherLegendAttrList, otherLegendAttrCount)
|
| | | |
| | | # 3. 定数值
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit)
|
| | | if not attrValueIpyData:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
|
| | | return
|
| | | #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | # % (itemID, itemType, itemClassLV, itemColor, isSuit, ), playerID)
|
| | | #GameWorld.DebugLog(" 固定条数=%s-%s,追求条数=%s-%s,其他条数=%s-%s" |
| | | # % (fixedLegendAttrCount, fixedLegendAttrList, goodLegendAttrCount, goodLegendAttrList, |
| | | # otherLegendAttrCount, commLegendAttrList), playerID) |
| | | attrLVLibNumDict = attrValueIpyData.GetLVLegendAttrLibNumInfo() # {属性ID:{等级:库编号, ...}}
|
| | | for attrID in curLegAttrIDList:
|
| | | if attrID not in attrLVLibNumDict:
|
| | | GameWorld.ErrLog("传奇属性等级数值表没有配置属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID), playerID)
|
| | | return
|
| | | curLibNum = None
|
| | | lvAttrLibList = attrLVLibNumDict[attrID]
|
| | | for lv, libNum in lvAttrLibList:
|
| | | if playerLV <= lv:
|
| | | curLibNum = libNum
|
| | | break
|
| | | if curLibNum == None:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到属性ID对应等级库编号!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,attrID=%s,playerLV=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, attrID, playerLV), playerID)
|
| | | return
|
| | | attrLibIpyData = attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrLib", attrID)
|
| | | if not attrLibIpyData:
|
| | | GameWorld.ErrLog("传奇属性库不存在传奇属性ID配置!itemID=%s,attrID=%s" % (itemID, attrID), playerID)
|
| | | return
|
| | | attrLibDict = attrLibIpyData.GetLegendAttrLib() # {库编号:[随机数值, ...], ...}
|
| | | if curLibNum not in attrLibDict:
|
| | | GameWorld.ErrLog("传奇属性库编号不存在!itemID=%s,attrID=%s,curLibNum=%s" % (itemID, attrID, curLibNum), playerID)
|
| | | return
|
| | | valueList = attrLibDict[curLibNum]
|
| | | attrValue = random.choice(valueList)
|
| | | curLegAttrValueList.append(attrValue)
|
| | | #GameWorld.DebugLog(" 随机属性: attrID=%s,attrValue=%s,playerLV=%s,curLibNum=%s,valueList=%s" |
| | | # % (attrID, attrValue, playerLV, curLibNum, valueList), playerID)
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | def __GetAddWingLegendAttr(curItem):
|
| | | # {阶数:条数, ...}
|
| | | wingLegAttrCntDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrCount")
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | if itemClassLV not in wingLegAttrCntDict:
|
| | | GameWorld.DebugLog("该翅膀阶级没有传奇属性, 阶数=%s" % itemClassLV)
|
| | | return
|
| | | legAttrCnt = wingLegAttrCntDict[itemClassLV]
|
| | | # {阶数:{属性ID1:[数值随机列表], 属性ID2:[数值随机列表]},阶数:{属性ID1:[数值随机列表], 属性ID2:[数值随机列表]},...}
|
| | | wingLegAttrValueDict = IpyGameDataPY.GetFuncEvalCfg("WingLegendAttrValue")
|
| | | if itemClassLV not in wingLegAttrValueDict:
|
| | | GameWorld.ErrLog("该翅膀阶级没有配置对应的传奇属性数值, 阶数=%s" % itemClassLV) |
| | | return
|
| | | curClassLVLegAttrDict = wingLegAttrValueDict[itemClassLV]
|
| | | attrIDList = curClassLVLegAttrDict.keys()
|
| | | legAttrCnt = min(len(attrIDList), legAttrCnt)
|
| | | GameWorld.DebugLog("生成翅膀传奇属性: itemClassLV=%s,legAttrCnt=%s,attrIDList=%s" % (itemClassLV, legAttrCnt, attrIDList))
|
| | | if not legAttrCnt:
|
| | | return
|
| | | curLegAttrIDList = random.sample(attrIDList, legAttrCnt)
|
| | | #curLegAttrIDList.sort()
|
| | | curLegAttrValueList = [random.choice(curClassLVLegAttrDict[attrID]) for attrID in curLegAttrIDList]
|
| | | GameWorld.DebugLog(" curLegAttrIDList=%s, curLegAttrValueList=%s" % (curLegAttrIDList, curLegAttrValueList))
|
| | | return [curLegAttrIDList, curLegAttrValueList]
|
| | |
|
| | | ##创建物品所需的动态数据
|
| | | #
|
| | |
| | | GameWorld.DebugLog("物品过期时间" + timeStr)
|
| | | return GameWorld.ChangeTimeStrToNum(timeStr)
|
| | |
|
| | |
|
| | | ## 创建物品
|
| | | # @param itemID 物品ID
|
| | | # @return curSingleItem
|
| | | # @remarks 函数详细说明.
|
| | | def CreateSingleItem(itemID, itemCount=1, isBind=1, expireTime=0):
|
| | | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0):
|
| | | ''' 创建物品
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | '''
|
| | | if itemCount < 1:
|
| | | GameWorld.ErrLog("创建物品个数不能少于1! itemID=%s,itemCount=%s" % (itemID, itemCount))
|
| | | return
|
| | |
| | | return
|
| | | curSingleItem.SetRemainHour(outTimeServerDay)
|
| | |
|
| | | isBind = not isAuctionItem
|
| | | if isBind:
|
| | | curSingleItem.SetIsBind(1)
|
| | |
|
| | |
| | | ''' 上架仙盟拍品,因为仙盟拍品默认上架,所以使用批量上架
|
| | | @param familyAuctionItemDict: {仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,总个数,拍品组数], ...]], ...}
|
| | | '''
|
| | | isBind = False
|
| | | isAuctionItem = True
|
| | | auctionItemList = []
|
| | | for familyID, auctionInfo in familyAuctionItemDict.items():
|
| | | familyPlayerIDList, familyAuctionItemList = auctionInfo
|
| | |
| | | for i in xrange(auctionGroup):
|
| | | if i == auctionGroup - 1:
|
| | | groupItemCount += itemCount % auctionGroup
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, groupItemCount, isBind)
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, groupItemCount, isAuctionItem)
|
| | | if not curItem:
|
| | | continue
|
| | | auctionItemList.append([curItem, familyID, familyPlayerIDList])
|