10033 【后端】仙树升级系统及砍树产出规则(装备属性产出规则修改)
| | |
| | | list AttrValue; //属性值
|
| | | };
|
| | |
|
| | | //装备传奇属性条数表
|
| | |
|
| | | struct tagEquipLegendAttrCount
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | BYTE _ItemColor; //物品颜色
|
| | | BYTE _IsSuit; //是否套装
|
| | | BYTE _ItemQuality; //物品星级
|
| | | list LegendAttrCountInfo; //传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
|
| | | };
|
| | |
|
| | | //装备传奇属性类型表
|
| | |
|
| | | struct tagEquipLegendAttrType
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | dict LegendAttrTypeLib; //传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
|
| | | };
|
| | |
|
| | | //装备传奇属性值库表
|
| | |
|
| | | struct tagEquipLegendAttrLib
|
| | | {
|
| | | BYTE _LegendAttrID; //传奇属性ID
|
| | | dict LegendAttrLib; //属性库信息 {库编号:[随机数值, ...], ...}
|
| | | };
|
| | |
|
| | | //装备传奇属性等级数值表
|
| | |
|
| | | struct tagEquipLegendAttrValue
|
| | | {
|
| | | BYTE _ItemType; //物品类型
|
| | | BYTE _ItemClassLV; //物品阶级
|
| | | BYTE _ItemColor; //物品颜色
|
| | | BYTE _IsSuit; //是否套装
|
| | | BYTE _ItemQuality; //物品星级
|
| | | dict LVLegendAttrLibNumInfo; //属性ID等级段对应数值库编号 {属性ID:{等级:库编号, ...}}
|
| | | };
|
| | |
|
| | | //神兽表
|
| | |
|
| | | struct tagDogz
|
| | |
| | | BYTE WeekResetType; //每周次数重置类型; 0-不重置,1-0点,2-5点
|
| | | };
|
| | |
|
| | | //装备品质表
|
| | |
|
| | | struct tagEquipColor
|
| | | {
|
| | | BYTE _EquipColor; // 装备颜色
|
| | | list RangeLV; // 等级范围
|
| | | list RangeRand; // 随机上下限范围
|
| | | BYTE BattleAttrCount; // 战斗属性条数
|
| | | BYTE BattleDefAttrCount; // 战斗抗性条数
|
| | | list RangeFaintRate; // 击晕范围
|
| | | list RangeFaintDefRate; // 抗击晕范围
|
| | | list RangeSuperHitRate; // 暴击范围
|
| | | list RangeSuperHitRateReduce; // 抗暴击范围
|
| | | list RangeComboRate; // 连击范围
|
| | | list RangeComboDefRate; // 抗连击范围
|
| | | list RangeMissRate; // 闪避范围
|
| | | list RangeMissDefRate; // 抗闪避范围
|
| | | list RangeAtkBackRate; // 反击范围
|
| | | list RangeAtkBackDefRate; // 抗反击范围
|
| | | list RangeSuckHPPer; // 吸血范围
|
| | | list RangeSuckHPDefPer; // 抗吸血范围
|
| | | };
|
| | |
|
| | | //装备品质部位表
|
| | |
|
| | | struct tagEquipColorPlace
|
| | | {
|
| | | BYTE _EquipColor; // 装备颜色
|
| | | BYTE _EquipPlace; // 装备部位
|
| | | list RangeAtk; // 攻击范围
|
| | | list RangeHP; // 生命范围
|
| | | list RangeDef; // 防御范围
|
| | | list RangeAtkSpeed; // 攻速范围
|
| | | };
|
| | |
|
| | | //装备评分属性系数表
|
| | |
|
| | | struct tagEquipGSParam
|
| | |
| | |
|
| | | struct tagAppointItem
|
| | | {
|
| | | DWORD _ID; //定制物品ID
|
| | | DWORD _ID; //定制ID
|
| | | BYTE CancelUseLimit; //穿戴限制(除职业)
|
| | | WORD ItemLV; //物品等级
|
| | | list BaseAttrID; //基础属性ID
|
| | | list BaseAttrValue; //基础属性值
|
| | | list LegendAttrID; //传奇属性ID
|
| | | list LegendAttrValue; //传奇属性值
|
| | | };
|
| | |
| | | import GMCommon
|
| | | import uuid
|
| | | import ChConfig
|
| | | import ShareDefine
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
|
| | |
| | | if addItemDict['Count'] == 0:
|
| | | return {}
|
| | | addItemDict['IsAuctionItem'] = GameWorld.ToIntDef(gmCmdDict.get('IsBind%s'%itemIndexStr, '0'))
|
| | | appointID = GameWorld.ToIntDef(gmCmdDict.get('AppointID%s'%itemIndexStr, '0'))
|
| | | #添加UserData信息
|
| | | addItemDict['UserData'] = ''
|
| | | UserDataDict = {}
|
| | |
| | | continue
|
| | | itemUserData[key] = value
|
| | |
|
| | | if appointID:
|
| | | itemUserData[ShareDefine.Def_CItemKey_AppointID] = appointID
|
| | | |
| | | if itemUserData:
|
| | | addItemDict['UserData'] = '%s'%itemUserData
|
| | |
|
| | |
| | | Def_IudetMapLoaction = 15 # 物品记录地图坐标[mapid, posx, posy]
|
| | | Def_IudetLegendAttrID = 17 # 物品传奇属性ID列表
|
| | | Def_IudetLegendAttrValue = 19 # 物品传奇属性值列表
|
| | | Def_IudetBaseAttrID = 21 # 物品基础属性ID列表,适用于随机范围基础属性(非物品表配置的固定属性)
|
| | | Def_IudetBaseAttrValue = 23 # 物品基础属性值列表
|
| | | Def_IudetPartSuiteLV = 25 # 部位套装等级 [套装类型1等级, 套装类型2等级, ...]
|
| | | Def_IudetWingMaterialItemID = 27 # 翅膀精炼材料ID列表
|
| | | Def_IudetWingMaterialItemCount = 29 # 翅膀精炼材料个数列表
|
| | |
| | | Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
|
| | | Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
|
| | | Def_IudetCancelUseLimit = 20 # 物品取消使用限制
|
| | | Def_IudetItemLV = 22 # 物品等级,适用于动态物品等级(非物品表配置的固定等级)
|
| | | Def_IudetSource = 24 # 物品来源
|
| | | Def_IudetSuiteLV = 30 # 套装等级
|
| | | Def_IudetHasOpenCnt = 32 # 物品累积开启次数
|
| | |
| | | Def_IudetPet_Skill = 201 # 技能列表
|
| | |
|
| | | Def_IudetHorsePetSkinIndex = 210 # 骑宠觉醒外观索引
|
| | |
|
| | | # 以下为自定义的设置物品属性key
|
| | | Def_CItemKey_AppointID = "AppointID"
|
| | | # ----------------------------------------------------
|
| | |
|
| | | # 宠物物品数据状态
|
| | |
| | | # @change: "2013-07-19 20:00" Alee 添加回购
|
| | | # @change: "2013-07-22 17:00" Alee 物品可按数量购买
|
| | | # @change: "2013-10-12 21:10" Alee 系统提示
|
| | | # @change: "2013-10-22 11:10" Alee 物品技能增强效果,统一函数EquipAddAdditionEx
|
| | | # @change: "2013-10-22 11:10" Alee 物品技能增强效果,统一函数
|
| | | # @change: "2013-11-08 22:30" Alee 商城添加打孔
|
| | | # @change: "2013-11-19 11:00" hxp 修改出售物品判断金钱上限逻辑
|
| | | # @change: "2014-01-16 13:54" xmnathan 战盟商城购买
|
| | |
| | | GameWorld.Log('###创造任务物品失败, itemID = %s' % (itemID))
|
| | | return
|
| | |
|
| | | #tmpEquipData = ItemControler.SingleEquipTmpData()
|
| | | #tmpEquipData.starLV = starLV
|
| | | #tmpEquipData.holeCnt = holeCount
|
| | | #tmpEquipData.isSuite = isSuite
|
| | | #tmpEquipData.isBind = bind
|
| | | |
| | | #ChItem.EquipAddAdditionEx(curSingleItem, tmpEquipData)
|
| | | |
| | | return curSingleItem
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | # @change: "2013-05-10 17:00" wdb 装备增加属性封装
|
| | | # @change: "2013-05-20 15:00" wdb 装备附加属性接口修改
|
| | | # @change: "2013-06-03 14:00" wdb 修改卓越属性表名为特殊属性
|
| | | # @change: "2013-10-21 15:10" Alee 物品技能增强效果,统一函数EquipAddAdditionEx
|
| | | # @change: "2013-10-21 15:10" Alee 物品技能增强效果,统一函数
|
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2013-10-21 15:10"""
|
| | | #---------------------------------------------------------------------
|
| | |
| | | # @change: "2015-12-11 16:00" hxp 增加基础属性比例支持
|
| | | #
|
| | | # 模块详细说明
|
| | | #导入
|
| | |
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import ShareDefine
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import ItemCommon
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #全局变量
|
| | | #---------------------------------------------------------------------
|
| | | """Version = 2015-12-11 16:00"""
|
| | | #---------------------------------------------------------------------
|
| | | #逻辑实现
|
| | |
|
| | |
|
| | | ## GM命令执行入口
|
| | | # @param curPlayer 当前玩家
|
| | |
| | |
|
| | | #输入命令格式错误
|
| | | if len(msgList) < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID (个数 拍品组数 全部传奇属性)")
|
| | | GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID (个数 拍品组数 定制ID)")
|
| | | return
|
| | |
|
| | | event = [ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]
|
| | | itemID = msgList[0]
|
| | | 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
|
| | | appointID = msgList[3] if len(msgList) > 3 else 0
|
| | |
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | | return
|
| | |
|
| | | playerItemControler = ItemControler.PlayerItemControler(curPlayer)
|
| | | setAttrDict = {ShareDefine.Def_CItemKey_AppointID:appointID}
|
| | |
|
| | | # 拍品
|
| | | if auctionGroup > 0:
|
| | | for _ in xrange(auctionGroup):
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, True, [IPY_GameWorld.rptItem], event=event):
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, True, [IPY_GameWorld.rptItem], event=event, setAttrDict=setAttrDict):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | else:
|
| | | if not ItemCommon.GetIsEquip(itemData):
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, False, [IPY_GameWorld.rptItem], event=event):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | else:
|
| | | for _ in xrange(itemCount):
|
| | | __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, 1, False, isAllAttr, event)
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, False, [IPY_GameWorld.rptItem], event=event, setAttrDict=setAttrDict):
|
| | | GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
|
| | | return
|
| | |
|
| | | def __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, count, isAuctionItem, isAllAttr, event):
|
| | | if ItemControler.GetAppointItemRealID(itemID):
|
| | | ItemControler.GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event=event)
|
| | | return
|
| | | curItem = ItemControler.GetOutPutItemObj(itemID, count, isAuctionItem, curPlayer=curPlayer, isAllAttr=isAllAttr)
|
| | | if not playerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=event):
|
| | | GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
|
| | | |
| | | return
|
| | |
|
| | | |
| | | |
| | |
|
| | |
| | | ("list", "AttrValue", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrCount":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("BYTE", "ItemColor", 1),
|
| | | ("BYTE", "IsSuit", 1),
|
| | | ("BYTE", "ItemQuality", 1),
|
| | | ("list", "LegendAttrCountInfo", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrType":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("dict", "LegendAttrTypeLib", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrLib":(
|
| | | ("BYTE", "LegendAttrID", 1),
|
| | | ("dict", "LegendAttrLib", 0),
|
| | | ),
|
| | |
|
| | | "EquipLegendAttrValue":(
|
| | | ("BYTE", "ItemType", 1),
|
| | | ("BYTE", "ItemClassLV", 1),
|
| | | ("BYTE", "ItemColor", 1),
|
| | | ("BYTE", "IsSuit", 1),
|
| | | ("BYTE", "ItemQuality", 1),
|
| | | ("dict", "LVLegendAttrLibNumInfo", 0),
|
| | | ),
|
| | |
|
| | | "Dogz":(
|
| | | ("BYTE", "DogzID", 1),
|
| | | ("list", "BaseAttrTypes", 0),
|
| | |
| | | ("BYTE", "WeekResetType", 0),
|
| | | ),
|
| | |
|
| | | "EquipColor":(
|
| | | ("BYTE", "EquipColor", 1),
|
| | | ("list", "RangeLV", 0),
|
| | | ("list", "RangeRand", 0),
|
| | | ("BYTE", "BattleAttrCount", 0),
|
| | | ("BYTE", "BattleDefAttrCount", 0),
|
| | | ("list", "RangeFaintRate", 0),
|
| | | ("list", "RangeFaintDefRate", 0),
|
| | | ("list", "RangeSuperHitRate", 0),
|
| | | ("list", "RangeSuperHitRateReduce", 0),
|
| | | ("list", "RangeComboRate", 0),
|
| | | ("list", "RangeComboDefRate", 0),
|
| | | ("list", "RangeMissRate", 0),
|
| | | ("list", "RangeMissDefRate", 0),
|
| | | ("list", "RangeAtkBackRate", 0),
|
| | | ("list", "RangeAtkBackDefRate", 0),
|
| | | ("list", "RangeSuckHPPer", 0),
|
| | | ("list", "RangeSuckHPDefPer", 0),
|
| | | ),
|
| | |
|
| | | "EquipColorPlace":(
|
| | | ("BYTE", "EquipColor", 1),
|
| | | ("BYTE", "EquipPlace", 1),
|
| | | ("list", "RangeAtk", 0),
|
| | | ("list", "RangeHP", 0),
|
| | | ("list", "RangeDef", 0),
|
| | | ("list", "RangeAtkSpeed", 0),
|
| | | ),
|
| | |
|
| | | "EquipGSParam":(
|
| | | ("BYTE", "ClassLV", 1),
|
| | | ("BYTE", "EquipColor", 1),
|
| | |
| | | "AppointItem":(
|
| | | ("DWORD", "ID", 1),
|
| | | ("BYTE", "CancelUseLimit", 0),
|
| | | ("WORD", "ItemLV", 0),
|
| | | ("list", "BaseAttrID", 0),
|
| | | ("list", "BaseAttrValue", 0),
|
| | | ("list", "LegendAttrID", 0),
|
| | | ("list", "LegendAttrValue", 0),
|
| | | ),
|
| | |
| | | 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.ItemQuality = 0
|
| | | self.LegendAttrCountInfo = [] |
| | | return |
| | | |
| | | def GetItemType(self): return self.ItemType # 物品类型
|
| | | def GetItemColor(self): return self.ItemColor # 物品颜色
|
| | | def GetIsSuit(self): return self.IsSuit # 是否套装
|
| | | def GetItemQuality(self): return self.ItemQuality # 物品星级
|
| | | def GetLegendAttrCountInfo(self): return self.LegendAttrCountInfo # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...] |
| | | |
| | | # 装备传奇属性类型表 |
| | | class IPY_EquipLegendAttrType(): |
| | | |
| | | def __init__(self): |
| | | self.ItemType = 0
|
| | | self.LegendAttrTypeLib = {} |
| | | return |
| | | |
| | | def GetItemType(self): return self.ItemType # 物品类型
|
| | | def GetLegendAttrTypeLib(self): return self.LegendAttrTypeLib # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...} |
| | | |
| | | # 装备传奇属性值库表 |
| | | 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.ItemQuality = 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 GetItemQuality(self): return self.ItemQuality # 物品星级
|
| | | def GetLVLegendAttrLibNumInfo(self): return self.LVLegendAttrLibNumInfo # 属性ID等级段对应数值库编号 {属性ID:{等级:库编号, ...}} |
| | | |
| | | # 神兽表 |
| | | class IPY_Dogz(): |
| | | |
| | |
| | | def GetWeekTimes(self): return self.WeekTimes # 每周次数, 0为不限制
|
| | | def GetWeekResetType(self): return self.WeekResetType # 每周次数重置类型; 0-不重置,1-0点,2-5点 |
| | | |
| | | # 装备品质表 |
| | | class IPY_EquipColor(): |
| | | |
| | | def __init__(self): |
| | | self.EquipColor = 0
|
| | | self.RangeLV = []
|
| | | self.RangeRand = []
|
| | | self.BattleAttrCount = 0
|
| | | self.BattleDefAttrCount = 0
|
| | | self.RangeFaintRate = []
|
| | | self.RangeFaintDefRate = []
|
| | | self.RangeSuperHitRate = []
|
| | | self.RangeSuperHitRateReduce = []
|
| | | self.RangeComboRate = []
|
| | | self.RangeComboDefRate = []
|
| | | self.RangeMissRate = []
|
| | | self.RangeMissDefRate = []
|
| | | self.RangeAtkBackRate = []
|
| | | self.RangeAtkBackDefRate = []
|
| | | self.RangeSuckHPPer = []
|
| | | self.RangeSuckHPDefPer = [] |
| | | return |
| | | |
| | | def GetEquipColor(self): return self.EquipColor # 装备颜色
|
| | | def GetRangeLV(self): return self.RangeLV # 等级范围
|
| | | def GetRangeRand(self): return self.RangeRand # 随机上下限范围
|
| | | def GetBattleAttrCount(self): return self.BattleAttrCount # 战斗属性条数
|
| | | def GetBattleDefAttrCount(self): return self.BattleDefAttrCount # 战斗抗性条数
|
| | | def GetRangeFaintRate(self): return self.RangeFaintRate # 击晕范围
|
| | | def GetRangeFaintDefRate(self): return self.RangeFaintDefRate # 抗击晕范围
|
| | | def GetRangeSuperHitRate(self): return self.RangeSuperHitRate # 暴击范围
|
| | | def GetRangeSuperHitRateReduce(self): return self.RangeSuperHitRateReduce # 抗暴击范围
|
| | | def GetRangeComboRate(self): return self.RangeComboRate # 连击范围
|
| | | def GetRangeComboDefRate(self): return self.RangeComboDefRate # 抗连击范围
|
| | | def GetRangeMissRate(self): return self.RangeMissRate # 闪避范围
|
| | | def GetRangeMissDefRate(self): return self.RangeMissDefRate # 抗闪避范围
|
| | | def GetRangeAtkBackRate(self): return self.RangeAtkBackRate # 反击范围
|
| | | def GetRangeAtkBackDefRate(self): return self.RangeAtkBackDefRate # 抗反击范围
|
| | | def GetRangeSuckHPPer(self): return self.RangeSuckHPPer # 吸血范围
|
| | | def GetRangeSuckHPDefPer(self): return self.RangeSuckHPDefPer # 抗吸血范围 |
| | | |
| | | # 装备品质部位表 |
| | | class IPY_EquipColorPlace(): |
| | | |
| | | def __init__(self): |
| | | self.EquipColor = 0
|
| | | self.EquipPlace = 0
|
| | | self.RangeAtk = []
|
| | | self.RangeHP = []
|
| | | self.RangeDef = []
|
| | | self.RangeAtkSpeed = [] |
| | | return |
| | | |
| | | def GetEquipColor(self): return self.EquipColor # 装备颜色
|
| | | def GetEquipPlace(self): return self.EquipPlace # 装备部位
|
| | | def GetRangeAtk(self): return self.RangeAtk # 攻击范围
|
| | | def GetRangeHP(self): return self.RangeHP # 生命范围
|
| | | def GetRangeDef(self): return self.RangeDef # 防御范围
|
| | | def GetRangeAtkSpeed(self): return self.RangeAtkSpeed # 攻速范围 |
| | | |
| | | # 装备评分属性系数表 |
| | | class IPY_EquipGSParam(): |
| | | |
| | |
| | | def __init__(self): |
| | | self.ID = 0
|
| | | self.CancelUseLimit = 0
|
| | | self.ItemLV = 0
|
| | | self.BaseAttrID = []
|
| | | self.BaseAttrValue = []
|
| | | self.LegendAttrID = []
|
| | | self.LegendAttrValue = [] |
| | | return |
| | | |
| | | def GetID(self): return self.ID # 定制物品ID
|
| | | def GetID(self): return self.ID # 定制ID
|
| | | def GetCancelUseLimit(self): return self.CancelUseLimit # 穿戴限制(除职业)
|
| | | def GetItemLV(self): return self.ItemLV # 物品等级
|
| | | def GetBaseAttrID(self): return self.BaseAttrID # 基础属性ID
|
| | | def GetBaseAttrValue(self): return self.BaseAttrValue # 基础属性值
|
| | | def GetLegendAttrID(self): return self.LegendAttrID # 传奇属性ID
|
| | | def GetLegendAttrValue(self): return self.LegendAttrValue # 传奇属性值 |
| | | |
| | |
| | | self.ipyItemPlusMaxLen = len(self.ipyItemPlusMaxCache)
|
| | | 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)
|
| | |
| | | self.ipyNPCCustomRefreshLen = len(self.ipyNPCCustomRefreshCache)
|
| | | self.ipyDailyActionCache = self.__LoadFileData("DailyAction", IPY_DailyAction)
|
| | | self.ipyDailyActionLen = len(self.ipyDailyActionCache)
|
| | | self.ipyEquipColorCache = self.__LoadFileData("EquipColor", IPY_EquipColor)
|
| | | self.ipyEquipColorLen = len(self.ipyEquipColorCache)
|
| | | self.ipyEquipColorPlaceCache = self.__LoadFileData("EquipColorPlace", IPY_EquipColorPlace)
|
| | | self.ipyEquipColorPlaceLen = len(self.ipyEquipColorPlaceCache)
|
| | | self.ipyEquipGSParamCache = self.__LoadFileData("EquipGSParam", IPY_EquipGSParam)
|
| | | self.ipyEquipGSParamLen = len(self.ipyEquipGSParamCache)
|
| | | self.ipySuccessCache = self.__LoadFileData("Success", IPY_Success)
|
| | |
| | | def GetItemPlusMaxByIndex(self, index): return self.ipyItemPlusMaxCache[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
|
| | |
| | | def GetNPCCustomRefreshByIndex(self, index): return self.ipyNPCCustomRefreshCache[index]
|
| | | def GetDailyActionCount(self): return self.ipyDailyActionLen
|
| | | def GetDailyActionByIndex(self, index): return self.ipyDailyActionCache[index]
|
| | | def GetEquipColorCount(self): return self.ipyEquipColorLen
|
| | | def GetEquipColorByIndex(self, index): return self.ipyEquipColorCache[index]
|
| | | def GetEquipColorPlaceCount(self): return self.ipyEquipColorPlaceLen
|
| | | def GetEquipColorPlaceByIndex(self, index): return self.ipyEquipColorPlaceCache[index]
|
| | | def GetEquipGSParamCount(self): return self.ipyEquipGSParamLen
|
| | | def GetEquipGSParamByIndex(self, index): return self.ipyEquipGSParamCache[index]
|
| | | def GetSuccessCount(self): return self.ipySuccessLen
|
| | |
| | |
|
| | | return infoDict
|
| | |
|
| | | # 特别设定:卓越物品必带武器技能增强效果,使用者请特别注意
|
| | | ## 装备动态属性,只用于未设置属性的singleItem,roleItem使用多次发背包刷新包
|
| | | # @param curItem 玩家实例
|
| | | # @param equipData
|
| | | # @return |
| | | def EquipAddAdditionEx(curItem, equipData):
|
| | | # 绑定
|
| | | #if equipData.isBind:
|
| | | # ItemControler.SetItemIsBind(curItem, equipData.isBind)
|
| | | |
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return
|
| | | |
| | | #===========================================================================
|
| | | # # 强化等级
|
| | | # if equipData.starLV:
|
| | | # curItem.SetItemStarLV(equipData.starLV)
|
| | | # # 打孔
|
| | | # if 0 < equipData.holeCnt <= curItem.GetMaxHoleCount():
|
| | | # curItem.SetCanPlaceStoneCount(equipData.holeCnt)
|
| | | # |
| | | # # 给镶嵌宝石
|
| | | # for i, stoneID in enumerate(equipData.stoneData):
|
| | | # if i > equipData.holeCnt - 1:
|
| | | # break
|
| | | # |
| | | # if stoneID <= 0:
|
| | | # continue
|
| | | # |
| | | # curItem.SetStone(i, stoneID)
|
| | | #===========================================================================
|
| | | |
| | | # 套装
|
| | | #if equipData.isSuite:
|
| | | # curItem.SetIsSuite(equipData.isSuite)
|
| | | #if equipData.suiteLV:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetSuiteLV, equipData.suiteLV)
|
| | | # 物品来源
|
| | | if equipData.source:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetSource, equipData.source)
|
| | | |
| | | # 传奇属性
|
| | | if equipData.legendAttrIDList and equipData.legendAttrValueList:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(len(equipData.legendAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, equipData.legendAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, equipData.legendAttrValueList[i])
|
| | | # 传奇属性 - 神
|
| | | if equipData.legendAttrIDListShen and equipData.legendAttrValueListShen:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | for i in xrange(len(equipData.legendAttrIDListShen)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDShen, equipData.legendAttrIDListShen[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueShen, equipData.legendAttrValueListShen[i])
|
| | | # 传奇属性 - 仙
|
| | | if equipData.legendAttrIDListXian and equipData.legendAttrValueListXian:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | for i in xrange(len(equipData.legendAttrIDListXian)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDXian, equipData.legendAttrIDListXian[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueXian, equipData.legendAttrValueListXian[i])
|
| | | # 传奇属性 - 极
|
| | | if equipData.legendAttrIDListJi and equipData.legendAttrValueListJi:
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | for i in xrange(len(equipData.legendAttrIDListJi)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDJi, equipData.legendAttrIDListJi[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueJi, equipData.legendAttrValueListJi[i])
|
| | | |
| | | ItemCommon.MakeEquipGS(curItem) |
| | | return
|
| | |
|
| | |
|
| | | ## 判断装备是否是可加强装备
|
| | | # @param curItem 物品实例
|
| | | # @return None
|
| | |
| | | itemNoteDict = ItemCommon.GetItemNoteDict(item, canPutinCount, packItemCount, canPutinCount)
|
| | | ItemCommon.DR_GetItem(curPlayer, packIndex, eventName, itemNoteDict, addDict)
|
| | | else:
|
| | | #可以放下
|
| | | if isEquip:
|
| | | self.CheckEquipAttr(packIndex, tagItem)
|
| | | |
| | | |
| | | if tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitRoleItem:
|
| | | item.PutIn(tagItem)
|
| | | elif tagItem.GetGameWorldItemType() == IPY_GameWorld.gwitSingleItem:
|
| | |
| | | #放入东西
|
| | | return putResult
|
| | |
|
| | | def CheckEquipAttr(self, packType, curItem):
|
| | | legendAttrIDCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCount = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | |
| | | if legendAttrIDCount and legendAttrValueCount and legendAttrIDCount == legendAttrValueCount:
|
| | | return
|
| | | |
| | | curPlayer = self.__Player
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | if not legendAttrInfo:
|
| | | return
|
| | | |
| | | curPlayer = self.__Player
|
| | | srcScore = ItemCommon.GetEquipGearScore(curItem)
|
| | | SetEquipLegendAttr(curItem, legendAttrInfo)
|
| | | ItemCommon.MakeEquipGS(curItem)
|
| | | updScore = ItemCommon.GetEquipGearScore(curItem)
|
| | | GameWorld.DebugLog("传奇属性异常,重新刷新一次属性: packType=%s,itemID=%s,srcScore=%s,updScore=%s" |
| | | % (packType, curItem.GetItemTypeID(), srcScore, updScore), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | ## 是否能放入物品
|
| | | # @param packIndex 背包索引
|
| | | # @param curItemID 当前物品ID
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList, event=["", False, {}]):
|
| | | def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList, event=["", False, {}], setAttrDict=None):
|
| | | '''给玩家物品
|
| | | @param isAuctionItem: 是否拍品
|
| | | '''
|
| | |
| | | #不可放入
|
| | | return False
|
| | |
|
| | | #定制物品
|
| | | if GetAppointItemRealID(itemID):
|
| | | isOK = False
|
| | | for _ in xrange(itemCount):
|
| | | if GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event):
|
| | | isOK = True # 只要有成功的就返回成功,防止异常情况失败可能导致被刷
|
| | | return isOK
|
| | | |
| | | #装备
|
| | | if ItemCommon.GetIsEquip(curItemData):
|
| | | isOK = False
|
| | | for _ in xrange(itemCount):
|
| | | outPutEquip = GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer)
|
| | | outPutEquip = GetOutPutItemObj(itemID, 1, isAuctionItem, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if not outPutEquip:
|
| | | return isOK
|
| | | if DoLogic_PutItemInPack(curPlayer, outPutEquip, event, packIndexList):
|
| | | isOK = True # 只要有成功的就返回成功,防止异常情况失败可能导致被刷
|
| | | return isOK
|
| | |
|
| | | giveItem = GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
| | | giveItem = GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer, setAttrDict=setAttrDict)
|
| | | if not giveItem:
|
| | | return False
|
| | | return DoLogic_PutItemInPack(curPlayer, giveItem, event, packIndexList)
|
| | |
|
| | |
|
| | | def GivePlayerAppointItem(curPlayer, appointID, isAuctionItem, event=["", False, {}]):
|
| | | '''给玩家定制物品表物品,定制物品默认个数1
|
| | | @param appointID 定制表ID
|
| | | @param isAuctionItem 是否拍品
|
| | | '''
|
| | | itemDictData = GetAppointItemDictData(appointID, isAuctionItem)
|
| | | if not itemDictData:
|
| | | return False
|
| | | |
| | | return GivePlayerEquip(curPlayer, itemDictData, event=event)
|
| | |
|
| | | def GetAppointItemDictData(appointID, isAuctionItem):
|
| | | '''获取定制表物品数据,定制物品默认个数1
|
| | | @param appointID 定制表ID
|
| | | @param isAuctionItem 是否拍品
|
| | | '''
|
| | | itemID = GetAppointItemRealID(appointID)
|
| | | if not itemID:
|
| | | return {}
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", appointID)
|
| | | if not ipyData:
|
| | | return {}
|
| | | itemDictData = {}
|
| | | |
| | | itemDictData['legendAttrID'] = ipyData.GetLegendAttrID()
|
| | | itemDictData['legendAttrValue'] = ipyData.GetLegendAttrValue()
|
| | | itemDictData['ItemID'] = itemID
|
| | | itemDictData['CancelUseLimit'] = ipyData.GetCancelUseLimit()
|
| | | |
| | | itemDictData['IsAuctionItem'] = isAuctionItem
|
| | | |
| | | return itemDictData
|
| | |
|
| | | def GetAppointItemRealID(itemID):
|
| | | '''获取定制物品对应的真实物品ID'''
|
| | | curItem = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not curItem:
|
| | | return 0
|
| | | curEff = curItem.GetEffectByIndex(0)
|
| | | curEffID = curEff.GetEffectID()
|
| | | if curEffID != ChConfig.Def_Effect_AppointItem:
|
| | | return 0
|
| | | return curEff.GetEffectValue(0)
|
| | |
|
| | | ## 根据物品data字典给玩家装备/翅膀
|
| | | # @param curPlayer:玩家实例
|
| | | # @param itemData:物品数据
|
| | | # @param packType:背包类型
|
| | | # @param defaultPile 默认先判断是否能进行物品堆叠
|
| | | # @return None
|
| | | def GivePlayerEquip(curPlayer, itemData, event=["", False, {}], packType=[IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere],
|
| | | defaultPile=True):
|
| | | equipItem = GetItemByData(itemData)
|
| | | #将物品放入背包
|
| | | return DoLogic_PutItemInPack(curPlayer, equipItem, event, packType, defaultPile)
|
| | |
|
| | |
|
| | | ## 根据物品data字典创建物品
|
| | | # @param itemData:物品数据
|
| | | # @return ItemObj
|
| | | def GetItemByData(itemData):
|
| | | if not itemData:
|
| | | return
|
| | | |
| | | itemID = int(itemData.get('ItemID', 0))
|
| | | isAuctionItem = int(itemData.get('IsAuctionItem', 0))
|
| | | equipItem = ItemCommon.CreateSingleItem(itemID, isAuctionItem=isAuctionItem)
|
| | | if not equipItem:
|
| | | return
|
| | | |
| | | tmpEquipData = SingleEquipTmpData()
|
| | | |
| | | #tmpEquipData.starLV = int(itemData.get('StarLV', '0'))
|
| | | #tmpEquipData.holeCnt = int(itemData.get('HoleCount', '0'))
|
| | | #tmpEquipData.stoneData = eval(itemData.get('StoneData', '[]'))
|
| | | tmpEquipData.isBind = isAuctionItem
|
| | | #tmpEquipData.isSuite = int(itemData.get('IsSuit', '0'))
|
| | | #tmpEquipData.suiteLV = int(itemData.get('SuiteLV', '0'))
|
| | | #if tmpEquipData.suiteLV:
|
| | | # tmpEquipData.isSuite = 1
|
| | | tmpEquipData.source = int(itemData.get('Source', str(ShareDefine.Item_Source_Unkown)))
|
| | | |
| | | tmpEquipData.legendAttrIDList = itemData.get('legendAttrID', [])
|
| | | tmpEquipData.legendAttrValueList = itemData.get('legendAttrValue', [])
|
| | | |
| | | # 装备附加属性
|
| | | ChItem.EquipAddAdditionEx(equipItem, tmpEquipData)
|
| | | |
| | | if "UserData" in itemData:
|
| | | userData = itemData["UserData"]
|
| | | equipItem.SetUserData(userData, len(userData))
|
| | | |
| | | if "EquipGS" in itemData:
|
| | | equipGS = int(itemData["EquipGS"])
|
| | | ItemCommon.SetEquipGearScore(equipItem, equipGS)
|
| | | |
| | | |
| | | # 取消等级限制
|
| | | if itemData.get('CancelUseLimit', 0):
|
| | | equipItem.SetUserAttr(ShareDefine.Def_IudetCancelUseLimit, 1)
|
| | | |
| | | return equipItem
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 执行物品放入背包逻辑
|
| | |
| | | def SetIsAuctionItem(curItem, isAuctionItem, curPlayer=None):
|
| | | curItem.SetIsBind(isAuctionItem)
|
| | |
|
| | | if isAuctionItem:
|
| | | curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | return
|
| | | # 20201223 主干取消拍品有效时长设定
|
| | | #if isAuctionItem:
|
| | | # curItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, int(time.time()))
|
| | | # return
|
| | |
|
| | | if not curPlayer:
|
| | | return
|
| | | #if not curPlayer:
|
| | | # return
|
| | |
|
| | | if ItemCommon.GetIsEquip(curItem):
|
| | | legendAttrIDCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCnt = curItem.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | if legendAttrIDCnt and legendAttrIDCnt == legendAttrValueCnt:
|
| | | legendAttrInfo = GetEquipLegendAttrGroup(curItem)
|
| | | #GameWorld.DebugLog("已经有传奇属性的拍品: %s" % str(legendAttrInfo))
|
| | | else:
|
| | | # 生成传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer)
|
| | | #GameWorld.DebugLog("重新生成传奇属性的拍品: %s" % str(legendAttrInfo))
|
| | | if not legendAttrInfo:
|
| | | return
|
| | | |
| | | updateDict = {}
|
| | | if legendAttrInfo[0]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrID] = legendAttrInfo[0]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValue] = legendAttrInfo[1]
|
| | | if legendAttrInfo[2]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDShen] = legendAttrInfo[2]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueShen] = legendAttrInfo[3]
|
| | | if legendAttrInfo[4]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDXian] = legendAttrInfo[4]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueXian] = legendAttrInfo[5]
|
| | | if legendAttrInfo[6]:
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrIDJi] = legendAttrInfo[6]
|
| | | updateDict[ShareDefine.Def_IudetLegendAttrValueJi] = legendAttrInfo[7]
|
| | | |
| | | delKeyList = [ShareDefine.Def_IudetAuctionItemCreateTime]
|
| | | ItemCommon.UpdateItemUserData(curItem, updateDict, delKeyList, isUpdateGS=True)
|
| | | #if ItemCommon.GetIsEquip(curItem):
|
| | | # delKeyList = [ShareDefine.Def_IudetAuctionItemCreateTime]
|
| | | # ItemCommon.UpdateItemUserData(curItem, updateDict, delKeyList, isUpdateGS=True)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | #---无空位置,替换---
|
| | | return placeList[0]
|
| | |
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, isAllAttr=False):
|
| | | def GetOutPutItemObj(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, setAttrDict=None):
|
| | | ''' 获取功能产出的物品实例
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | | @param curPlayer: 产出该物品时的玩家,物品某些属性由玩家等级决定,如传奇属性
|
| | | @param isAllAttr: 是否生成该装备所有属性,GM创建物品时用,需验证相关权限
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | '''
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime)
|
| | | curItem = ItemCommon.CreateSingleItem(itemID, itemCount, isAuctionItem, expireTime, curPlayer, setAttrDict)
|
| | | if not curItem:
|
| | | GameWorld.ErrLog("产出物品异常,无法创建物品 = %s" % (itemID))
|
| | | return
|
| | | |
| | | # 非装备,无需设置属性
|
| | | if not ItemCommon.CheckItemIsEquip(curItem):
|
| | | return curItem
|
| | | |
| | | # 定制物品
|
| | | if GetAppointItemRealID(itemID):
|
| | | curItem.Clear()
|
| | | #GameWorld.DebugLog("清除给定制物品之前已经创建的物品ID=%s" % itemID)
|
| | | return GetItemByData(GetAppointItemDictData(itemID, isAuctionItem))
|
| | | |
| | | # # 拍品不处理其他属性
|
| | | # if isAuctionItem:
|
| | | # return curItem
|
| | | |
| | | tmpEquipData = SingleEquipTmpData()
|
| | | |
| | | # 传奇属性
|
| | | legendAttrInfo = GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr)
|
| | | if legendAttrInfo:
|
| | | tmpEquipData.legendAttrIDList = legendAttrInfo[0]
|
| | | tmpEquipData.legendAttrValueList = legendAttrInfo[1]
|
| | | tmpEquipData.legendAttrIDListShen = legendAttrInfo[2]
|
| | | tmpEquipData.legendAttrValueListShen = legendAttrInfo[3]
|
| | | tmpEquipData.legendAttrIDListXian = legendAttrInfo[4]
|
| | | tmpEquipData.legendAttrValueListXian = legendAttrInfo[5]
|
| | | tmpEquipData.legendAttrIDListJi = legendAttrInfo[6]
|
| | | tmpEquipData.legendAttrValueListJi = legendAttrInfo[7]
|
| | | |
| | | # 其他装备属性
|
| | | ChItem.EquipAddAdditionEx(curItem, tmpEquipData)
|
| | | return curItem
|
| | |
|
| | | def GetAddEquipLegendAttr(curItem, curPlayer, isAllAttr=False):
|
| | | '''获取生成到装备上的传奇属性
|
| | | @return: None 或者 [传奇属性效果ID列表], [属性值列表], [神ID], [神值], [仙ID], [仙值], [极ID], [极值]
|
| | | '''
|
| | | # if GetIsAuctionItem(curItem):
|
| | | # #GameWorld.DebugLog("拍品无法生成传奇属性!")
|
| | | # return
|
| | | itemID = curItem.GetItemTypeID()
|
| | | itemType = curItem.GetType()
|
| | | itemColor = curItem.GetItemColor()
|
| | | itemQuality = curItem.GetItemQuality()
|
| | | isSuit = 1 if curItem.GetSuiteID() else 0
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipShenAttr", itemID)
|
| | | if ipyData:
|
| | | return ipyData.GetLegendAttrIDList(), ipyData.GetLegendAttrValueList(), \
|
| | | ipyData.GetShenAttrIDList(), ipyData.GetShenAttrValueList(), \
|
| | | ipyData.GetXianAttrIDList(), ipyData.GetXianAttrValueList(), \
|
| | | ipyData.GetJiAttrIDList(), ipyData.GetJiAttrValueList()
|
| | | |
| | | # 1. 定条数
|
| | | attrCountIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipLegendAttrCount", itemType, itemColor, isSuit, itemQuality)
|
| | | if not attrCountIpyData:
|
| | | if itemColor >= ChConfig.Def_Quality_Purple:
|
| | | GameWorld.DebugLog("该装备没有传奇属性: itemID=%s" % (itemID))
|
| | | return
|
| | | legendAttrCountInfoList = attrCountIpyData.GetLegendAttrCountInfo() # 传奇属性条数信息 [[条数, [属性类型库编号, ...]], ...]
|
| | | if not legendAttrCountInfoList:
|
| | | return
|
| | | |
| | | if curPlayer:
|
| | | playerID, playerLV = curPlayer.GetPlayerID(), curPlayer.GetLV()
|
| | | else:
|
| | | playerID = 0
|
| | | playerLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | GameWorld.Log("生成装备传奇属性时没有玩家等级, 取当前世界等级! itemID=%s,worldLV=%s" % (itemID, playerLV))
|
| | | |
| | | # 2. 定属性ID
|
| | | attrTypeIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrType", itemType)
|
| | | if not attrTypeIpyData:
|
| | | return
|
| | | legendAttrTypeLibDict = attrTypeIpyData.GetLegendAttrTypeLib() # 传奇属性类型库 {属性类型库编号:[属性ID,...], ...}
|
| | | |
| | | curLegAttrIDList = []
|
| | | curLegAttrValueList = []
|
| | | itemClassLV = ItemCommon.GetItemClassLV(curItem)
|
| | | if isAllAttr:
|
| | | if curPlayer.GetGMLevel() != 90:
|
| | | return
|
| | | for attrIDList in legendAttrTypeLibDict.values():
|
| | | curLegAttrIDList += attrIDList
|
| | | #GameWorld.DebugLog("所有传奇属性: %s" % (curLegAttrIDList), playerID)
|
| | | else:
|
| | | #GameWorld.DebugLog("随机传奇属性: itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s" |
| | | # % (itemID, itemType, itemClassLV, itemColor, isSuit), playerID)
|
| | | for attrCount, libNumList in legendAttrCountInfoList:
|
| | | attrIDList = []
|
| | | for libNum in libNumList:
|
| | | attrIDList.extend(legendAttrTypeLibDict.get(libNum, []))
|
| | | for curAttrID in curLegAttrIDList:
|
| | | if curAttrID in attrIDList:
|
| | | attrIDList.remove(curAttrID)
|
| | | if len(attrIDList) < attrCount:
|
| | | GameWorld.ErrLog("装备传奇属性ID库配置不够条数随机!itemID=%s,itemType=%s,legendAttrCountInfoList=%s,legendAttrTypeLibDict=%s" |
| | | % (itemID, itemType, legendAttrCountInfoList, legendAttrTypeLibDict), playerID)
|
| | | return
|
| | | curLegAttrIDList += random.sample(attrIDList, attrCount)
|
| | | #GameWorld.DebugLog(" 随机传奇属性: attrCount=%s,libNumList=%s,attrIDList=%s,curLegAttrIDList=%s" |
| | | # % (attrCount, libNumList, attrIDList, curLegAttrIDList), playerID)
|
| | | |
| | | # 3. 定数值
|
| | | attrValueIpyData = IpyGameDataPY.GetIpyGameData("EquipLegendAttrValue", itemType, itemClassLV, itemColor, isSuit, itemQuality)
|
| | | if not attrValueIpyData:
|
| | | GameWorld.ErrLog("传奇属性等级数值表找不到配置!itemID=%s,itemType=%s,itemClassLV=%s,itemColor=%s,isSuit=%s,itemQuality=%s" |
| | | % (itemID, itemType, itemClassLV, itemColor, isSuit, itemQuality), playerID)
|
| | | return
|
| | | |
| | | 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 GetEquipLegendAttrAll(curItem):
|
| | | ## 获取装备传奇属性 - 所有分组合并返回
|
| | |
| | | jiAttrValueList.append(curItem.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValueJi, i))
|
| | |
|
| | | return legAttrIDList, legAttrValueList, shenAttrIDList, shenAttrValueList, xianAttrIDList, xianAttrValueList, jiAttrIDList, jiAttrValueList
|
| | |
|
| | | def SetEquipLegendAttr(curItem, legendAttrInfo):
|
| | | ## 设置装备传奇属性
|
| | | |
| | | legAttrIDList, legAttrValueList, shenAttrIDList, shenAttrValueList, \
|
| | | xianAttrIDList, xianAttrValueList, jiAttrIDList, jiAttrValueList = legendAttrInfo
|
| | | |
| | | # 普通传奇属性
|
| | | if legAttrIDList and legAttrValueList and len(legAttrIDList) == len(legAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrID)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(len(legAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrID, legAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValue, legAttrValueList[i])
|
| | | |
| | | # 神 传奇属性
|
| | | if shenAttrIDList and shenAttrValueList and len(shenAttrIDList) == len(shenAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDShen)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueShen)
|
| | | for i in xrange(len(shenAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDShen, shenAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueShen, shenAttrValueList[i])
|
| | | |
| | | # 仙 传奇属性
|
| | | if xianAttrIDList and xianAttrValueList and len(xianAttrIDList) == len(xianAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDXian)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueXian)
|
| | | for i in xrange(len(xianAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDXian, xianAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueXian, xianAttrValueList[i])
|
| | | |
| | | # 极 传奇属性
|
| | | if jiAttrIDList and jiAttrValueList and len(jiAttrIDList) == len(jiAttrValueList):
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrIDJi)
|
| | | curItem.ClearUserAttr(ShareDefine.Def_IudetLegendAttrValueJi)
|
| | | for i in xrange(len(jiAttrIDList)):
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrIDJi, jiAttrIDList[i])
|
| | | curItem.AddUserAttr(ShareDefine.Def_IudetLegendAttrValueJi, jiAttrValueList[i])
|
| | | |
| | | return
|
| | |
|
| | | ##创建物品所需的动态数据
|
| | | #
|
| | | # 便于统一修改
|
| | | class SingleEquipTmpData():
|
| | | |
| | | ## 初始化
|
| | | # @param |
| | | # @return None
|
| | | def __init__(self):
|
| | | self.starLV = 0 # 强化等级(星数)
|
| | | self.holeCnt = 0
|
| | | self.stoneData = [] # 宝石列表
|
| | | self.isSuite = False
|
| | | self.suiteLV = 0 #套装等级
|
| | | self.isBind = False
|
| | | |
| | | self.source = ShareDefine.Item_Source_Unkown #物品来源
|
| | | self.legendAttrIDList = [] # 传奇属性ID
|
| | | self.legendAttrValueList = [] # 传奇属性值
|
| | | self.legendAttrIDListShen = [] # 传奇属性ID - 神
|
| | | self.legendAttrValueListShen = [] # 传奇属性值 - 神
|
| | | self.legendAttrIDListXian = [] # 传奇属性ID - 仙
|
| | | self.legendAttrValueListXian = [] # 传奇属性值 - 仙
|
| | | self.legendAttrIDListJi = [] # 传奇属性ID - 极
|
| | | self.legendAttrValueListJi = [] # 传奇属性值 - 极
|
| | | return
|
| | |
|
| | | def ClearPack(curPlayer, packType):
|
| | | ## 清空指定背包
|
| | |
| | | GameWorld.DebugLog("物品过期时间" + timeStr)
|
| | | return GameWorld.ChangeTimeStrToNum(timeStr)
|
| | |
|
| | | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0):
|
| | | def CreateSingleItem(itemID, itemCount=1, isAuctionItem=False, expireTime=0, curPlayer=None, setAttrDict=None):
|
| | | ''' 创建物品
|
| | | @param isAuctionItem: 是否拍品,默认非拍品
|
| | | @param expireTime: 有效时间,时间单位由时效类型决定
|
| | |
| | | if expireTime > 0:
|
| | | curSingleItem.SetUserAttr(ShareDefine.Def_IudetExpireTime, expireTime)
|
| | |
|
| | | # 装备
|
| | | if GetIsEquip(curSingleItem):
|
| | | setAttrDict = GetCreateEquipAttr(curSingleItem, curPlayer, setAttrDict)
|
| | | if setAttrDict == None:
|
| | | curSingleItem.Clear()
|
| | | return
|
| | | AddCreateItemAttr(curSingleItem, setAttrDict)
|
| | | |
| | | #这里返回的是SingleItem , 如果创建了,未使用,会找出C++内存泄露!!!
|
| | | return curSingleItem
|
| | |
|
| | | def AddCreateItemAttr(curItem, setAttrDict):
|
| | | ## 设置生成装备所有属性
|
| | | for key, value in setAttrDict.items():
|
| | | key = GameWorld.ToIntDef(key, key)
|
| | | # 需支持
|
| | | # 1. UserData格式: {'19': ['1889', '2034', '893', '927'], '50': ['1702622046'], '17': ['39', '33', '34', '9']}
|
| | | # 2. 自定义字典: {"key":value, ...} key支持自定义或与UserData的key,value支持数值或列表,列表元素支持字符串或数值,均默认转为数值
|
| | | # 数值类型的默认为UserData属性 |
| | | if isinstance(key, int):
|
| | | if key % 2 == 0: # 偶数是单数值
|
| | | v = 0
|
| | | if isinstance(value, int):
|
| | | v = value
|
| | | elif (isinstance(value, list) or isinstance(value, tuple)) and value:
|
| | | v = GameWorld.ToIntDef(value[0], 0)
|
| | | curItem.SetUserAttr(key, v)
|
| | | elif isinstance(value, list) or isinstance(value, tuple): # 单数一定是要列表
|
| | | curItem.ClearUserAttr(key)
|
| | | for v in value:
|
| | | v = GameWorld.ToIntDef(v, 0)
|
| | | curItem.AddUserAttr(key, v)
|
| | | # 其他指定字符串类型属性
|
| | | else:
|
| | | GameWorld.Log("###AddCreateItemAttr unknown key:%s, value:%s, itemID=%s" % (key, value, curItem.GetItemTypeID()))
|
| | | |
| | | MakeEquipGS(curItem)
|
| | | return
|
| | |
|
| | | def GetCreateEquipAttr(curItem, curPlayer=None, setAttrDict=None):
|
| | | '''获取生成装备所有属性
|
| | | @param curPlayer: 可能为None
|
| | | @param setAttrDict: 直接设置物品的属性 {key:value, ...} key支持 ShareDefine.Def_IudetXXX字符串 或 自定key
|
| | | @return: None - 异常情况,物品实例需要clear
|
| | | equipAttrDict - 生成后的最新属性k:v字典,可直接用于 SetCreateEquipAttr
|
| | | '''
|
| | | if setAttrDict == None:
|
| | | setAttrDict = {}
|
| | | equipAttrDict = {}
|
| | | playerID = 0 if not curPlayer else curPlayer.GetPlayerID()
|
| | | itemID = curItem.GetItemTypeID()
|
| | | |
| | | appointID = setAttrDict.get(ShareDefine.Def_CItemKey_AppointID)
|
| | | # 定制属性ID
|
| | | if appointID > 0:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("AppointItem", appointID)
|
| | | if not ipyData:
|
| | | return
|
| | | if ipyData.GetCancelUseLimit():
|
| | | equipAttrDict[str(ShareDefine.Def_IudetCancelUseLimit)] = 1
|
| | | equipAttrDict[str(ShareDefine.Def_IudetItemLV)] = ipyData.GetItemLV()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = ipyData.GetBaseAttrID()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = ipyData.GetBaseAttrValue()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = ipyData.GetLegendAttrID()
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = ipyData.GetLegendAttrValue()
|
| | | GameWorld.DebugLog(" 装备定制属性: itemID=%s,appointID=%s,equipAttrDict=%s,setAttrDict=%s" % (itemID, appointID, equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | | |
| | | # 以下为常规生成属性逻辑
|
| | | itemColor = curItem.GetItemColor()
|
| | | equipPlace = curItem.GetEquipPlace()
|
| | | |
| | | if curPlayer:
|
| | | playerID, playerLV = curPlayer.GetPlayerID(), curPlayer.GetLV()
|
| | | else:
|
| | | playerLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | GameWorld.DebugLog("生成装备时没有玩家等级, 取当前世界等级! itemID=%s,worldLV=%s" % (itemID, playerLV), playerID)
|
| | | |
| | | colorIpyData = IpyGameDataPY.GetIpyGameData("EquipColor", itemColor)
|
| | | colorPlaceIpyData = IpyGameDataPY.GetIpyGameData("EquipColorPlace", itemColor, equipPlace)
|
| | | if not colorIpyData or not colorPlaceIpyData:
|
| | | GameWorld.ErrLog("生成装备时找不到对应配置! itemID=%s,itemColor=%s,equipPlace=%s" % (itemID, itemColor, equipPlace), playerID)
|
| | | return
|
| | | GameWorld.DebugLog("随机装备属性! itemID=%s,itemColor=%s,equipPlace=%s,setAttrDict=%s" % (itemID, itemColor, equipPlace, setAttrDict), playerID)
|
| | | |
| | | itemLV = setAttrDict.get(str(ShareDefine.Def_IudetItemLV), 0)
|
| | | if not itemLV:
|
| | | # 随机等级
|
| | | lowLV, highLV = IpyGameDataPY.GetFuncEvalCfg("EquipRandRule", 1)
|
| | | randLVList = range(max(playerLV - lowLV, 1), playerLV + highLV)
|
| | | itemLV = random.choice(randLVList)
|
| | | equipAttrDict[str(ShareDefine.Def_IudetItemLV)] = itemLV
|
| | | |
| | | reRatio = 0 # 参考基准值所在比率 0~1
|
| | | lvMin, lvMax = colorIpyData.GetRangeLV() # 品质对应的等级范围
|
| | | if itemLV <= lvMin:
|
| | | reRatio = 0
|
| | | elif itemLV >= lvMax:
|
| | | reRatio = 1
|
| | | else:
|
| | | reRatio = (itemLV - lvMin) / float(lvMax - lvMin)
|
| | | GameWorld.DebugLog(" itemLV=%s,lvMin=%s,lvMax=%s,reRatio=%s,playerLV=%s" % (itemLV, lvMin, lvMax, reRatio, playerLV), playerID)
|
| | | |
| | | baseAttrIDList = setAttrDict.get(str(ShareDefine.Def_IudetBaseAttrID))
|
| | | baseAttrValueList = setAttrDict.get(str(ShareDefine.Def_IudetBaseAttrValue))
|
| | | # 这里注意None为未指定,支持当空列表[]时为不给该属性
|
| | | if baseAttrIDList != None and baseAttrValueList != None and len(baseAttrIDList) == len(baseAttrValueList):
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = baseAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = baseAttrValueList
|
| | | else:
|
| | | __RandCreateEquipBaseAttr(reRatio, colorPlaceIpyData, equipAttrDict)
|
| | | |
| | | legendAttrIDList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrID))
|
| | | legendAttrValueList = setAttrDict.get(str(ShareDefine.Def_IudetLegendAttrValue))
|
| | | if legendAttrIDList != None and legendAttrValueList != None and len(legendAttrIDList) == len(legendAttrValueList):
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | equipAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | else:
|
| | | __RandCreateEquipLegendAttr(reRatio, colorIpyData, equipAttrDict)
|
| | | |
| | | # 神仙极属性可在这里扩展...
|
| | | |
| | | GameWorld.DebugLog(" 装备最终属性: equipAttrDict=%s,setAttrDict=%s" % (equipAttrDict, setAttrDict), playerID)
|
| | | return equipAttrDict
|
| | |
|
| | | def __RandCreateEquipBaseAttr(reRatio, colorPlaceIpyData, setAttrDict):
|
| | | ## 随机装备基础属性
|
| | | baseAttrDict = {ShareDefine.Def_Effect_Atk:colorPlaceIpyData.GetRangeAtk(),
|
| | | ShareDefine.Def_Effect_MaxHP:colorPlaceIpyData.GetRangeHP(),
|
| | | ShareDefine.Def_Effect_Def:colorPlaceIpyData.GetRangeDef(),
|
| | | ShareDefine.Def_Effect_AtkSpeed:colorPlaceIpyData.GetRangeAtkSpeed(),
|
| | | }
|
| | | upDownRateList = IpyGameDataPY.GetFuncEvalCfg("EquipRandRule", 2)
|
| | | baseAttrIDList, baseAttrValueList = [], []
|
| | | for attrID in [ShareDefine.Def_Effect_Atk, ShareDefine.Def_Effect_MaxHP, ShareDefine.Def_Effect_Def, ShareDefine.Def_Effect_AtkSpeed]:
|
| | | valueList = baseAttrDict[attrID]
|
| | | atkValue = __GetRandAttrValueByRatio(valueList, reRatio, upDownRateList)
|
| | | if not atkValue:
|
| | | continue
|
| | | baseAttrIDList.append(attrID)
|
| | | baseAttrValueList.append(atkValue)
|
| | | if baseAttrIDList:
|
| | | setAttrDict[str(ShareDefine.Def_IudetBaseAttrID)] = baseAttrIDList
|
| | | setAttrDict[str(ShareDefine.Def_IudetBaseAttrValue)] = baseAttrValueList
|
| | | GameWorld.DebugLog(" baseAttrIDList=%s,baseAttrValueList=%s" % (baseAttrIDList, baseAttrValueList))
|
| | | return
|
| | |
|
| | | def __RandCreateEquipLegendAttr(reRatio, colorIpyData, setAttrDict):
|
| | | ## 随机装备传奇属性
|
| | | upDownRateList = colorIpyData.GetRangeRand()
|
| | | battleAttrCount = colorIpyData.GetBattleAttrCount() # 战斗属性条数
|
| | | battleDefAttrCount = colorIpyData.GetBattleDefAttrCount() #战斗抗性条数
|
| | | if not battleAttrCount and not battleDefAttrCount:
|
| | | return
|
| | | |
| | | # 注: 闪避率-对应原闪避值;抗闪避-对应原命中值
|
| | | battleAttrDict = {ShareDefine.Def_Effect_FaintRate:colorIpyData.GetRangeFaintRate(),
|
| | | ShareDefine.Def_Effect_SuperHitRate:colorIpyData.GetRangeSuperHitRate(),
|
| | | ShareDefine.Def_Effect_ComboRate:colorIpyData.GetRangeComboRate(),
|
| | | ShareDefine.Def_Effect_Miss:colorIpyData.GetRangeMissRate(),
|
| | | ShareDefine.Def_Effect_AtkBackRate:colorIpyData.GetRangeAtkBackRate(),
|
| | | ShareDefine.Def_Effect_SuckHPPer:colorIpyData.GetRangeSuckHPPer(),
|
| | | }
|
| | | battleDefAttrDict = {ShareDefine.Def_Effect_FaintDefRate:colorIpyData.GetRangeFaintDefRate(),
|
| | | ShareDefine.Def_Effect_SuperHitRateReduce:colorIpyData.GetRangeSuperHitRateReduce(),
|
| | | ShareDefine.Def_Effect_ComboDefRate:colorIpyData.GetRangeComboDefRate(),
|
| | | ShareDefine.Def_Effect_Hit:colorIpyData.GetRangeMissDefRate(),
|
| | | ShareDefine.Def_Effect_AtkBackDefRate:colorIpyData.GetRangeAtkBackDefRate(),
|
| | | ShareDefine.Def_Effect_SuckHPDefPer:colorIpyData.GetRangeSuckHPDefPer(),
|
| | | }
|
| | | |
| | | # 没有配置值的属性不产出,打乱顺序后直接取限制条数前x个即为随机的属性ID
|
| | | # 战斗属性
|
| | | for k, v in battleAttrDict.items():
|
| | | if not v:
|
| | | battleAttrDict.pop(k)
|
| | | battleAttrIDList = battleAttrDict.keys()
|
| | | battleAttrIDList and random.shuffle(battleAttrIDList)
|
| | | battleAttrIDList = battleAttrIDList[:battleAttrCount]
|
| | | batAttrIDList, batAttrValueList= [], []
|
| | | for attrID in battleAttrIDList:
|
| | | atkValue = __GetRandAttrValueByRatio(battleAttrDict[attrID], reRatio, upDownRateList)
|
| | | if not atkValue:
|
| | | continue
|
| | | batAttrIDList.append(attrID)
|
| | | batAttrValueList.append(atkValue)
|
| | | GameWorld.DebugLog(" 战斗属性条数=%s,IDList=%s,ValueList=%s" % (battleAttrCount, batAttrIDList, batAttrValueList)) |
| | | |
| | | # 战斗抗性
|
| | | for k, v in battleDefAttrDict.items():
|
| | | if not v:
|
| | | battleDefAttrDict.pop(k)
|
| | | battleDefAttrIDList = battleDefAttrDict.keys()
|
| | | battleDefAttrIDList and random.shuffle(battleDefAttrIDList)
|
| | | battleDefAttrIDList = battleDefAttrIDList[:battleDefAttrCount]
|
| | | batDefAttrIDList, batDefAttrValueList= [], []
|
| | | for attrID in battleDefAttrIDList:
|
| | | atkValue = __GetRandAttrValueByRatio(battleDefAttrDict[attrID], reRatio, upDownRateList)
|
| | | if not atkValue:
|
| | | continue
|
| | | batDefAttrIDList.append(attrID)
|
| | | batDefAttrValueList.append(atkValue)
|
| | | GameWorld.DebugLog(" 战斗抗性条数=%s,IDList=%s,ValueList=%s" % (battleDefAttrCount, batDefAttrIDList, batDefAttrValueList))
|
| | | |
| | | # 全部放在传奇属性里
|
| | | legendAttrIDList = batAttrIDList + batDefAttrIDList
|
| | | legendAttrValueList = batAttrValueList + batDefAttrValueList
|
| | | if legendAttrIDList:
|
| | | setAttrDict[str(ShareDefine.Def_IudetLegendAttrID)] = legendAttrIDList
|
| | | setAttrDict[str(ShareDefine.Def_IudetLegendAttrValue)] = legendAttrValueList
|
| | | GameWorld.DebugLog(" legendAttrIDList=%s,legendAttrValueList=%s" % (legendAttrIDList, legendAttrValueList))
|
| | | return
|
| | |
|
| | | def __GetRandAttrValueByRatio(valueList, reRatio, upDownRateList):
|
| | | ## 根据参考比例随机属性值
|
| | | valueMin, valueMax = valueList
|
| | | if reRatio < 0 or reRatio > 1:
|
| | | # 不合法的参考比例,默认最小值,合法值为0~1,包含0跟1
|
| | | return valueMin
|
| | | diffValue = valueMax - valueMin
|
| | | reValue = valueMin + int(diffValue * reRatio) # 参考值
|
| | | |
| | | downRate, upRate = upDownRateList
|
| | | randValueMin = int(reValue - math.ceil(diffValue * downRate / 10000.0)) # 至少-1
|
| | | randValueMax = int(reValue + math.ceil(diffValue * upRate / 10000.0)) # 至少+1
|
| | | randValue = random.randint(randValueMin, randValueMax)
|
| | | GameWorld.DebugLog(" valueList=%s,reRatio=%s,upDownRateList=%s,diffValue=%s,reValue=%s,%s~%s,%s" |
| | | % (valueList, reRatio, upDownRateList, diffValue, reValue, randValueMin, randValueMax, randValue))
|
| | | return randValue
|
| | |
|
| | | def UpdateItemUserData(curItem, updateDict={}, delKeyList=[], isUpdateGS=False):
|
| | | ''' 更新物品UserData数据
|
| | | @param curItem: IPY_SingleItem 或 IPY_RoleItem
|
| | |
| | | for i in xrange(curPackData.Count):
|
| | | curPackItem = curPackData.Items[i]
|
| | | itemID = curPackItem.ItemID
|
| | | isAuctionItem = curPackItem.IsBind and not auctionItemTimeout
|
| | | if ItemControler.GetAppointItemRealID(itemID):
|
| | | curCreateItem = ItemControler.GetItemByData(ItemControler.GetAppointItemDictData(itemID, isAuctionItem))
|
| | | else:
|
| | | curCreateItem = ItemCommon.CreateSingleItem(itemID, curPackItem.Count, isAuctionItem)
|
| | | if not curCreateItem:
|
| | | GameWorld.ErrLog("OnGMRequestCompensationResult CreateSingleItem %s Err "%itemID)
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | |
| | | ##UserData包含了追加属性不完整,这里需要补齐
|
| | | userDataCreateTime = 0
|
| | | if curPackItem.UserDataLen: |
| | | UserDataDict = eval(curPackItem.UserData)
|
| | | #设置UserData
|
| | | UserData = "%s"%UserDataDict
|
| | | curCreateItem.SetUserData(UserData, len(UserData))
|
| | | userDataCreateTime = curCreateItem.GetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime)
|
| | | isAuctionItem = curPackItem.IsBind and not auctionItemTimeout
|
| | | setAttrDict = {} if not curPackItem.UserDataLen else eval(curPackItem.UserData) |
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, curPackItem.Count, isAuctionItem, [IPY_GameWorld.rptItem], |
| | | event=[ChConfig.ItemGive_Mail, False, {"MailGUID":curPackData.GUID}], setAttrDict=setAttrDict):
|
| | | GameWorld.ErrLog("OnGMRequestCompensationResult GivePlayerItem %s False" % itemID)
|
| | | continue
|
| | | if isPaimaiMail and ItemCommon.GetIsEquip(itemData):
|
| | | EventShell.EventRespons_BuyAuctionEquip(curPlayer, itemData.GetItemColor())
|
| | |
|
| | | if isAuctionItem and auctionItemCreateTime and not userDataCreateTime:
|
| | | curCreateItem.SetUserAttr(ShareDefine.Def_IudetAuctionItemCreateTime, auctionItemCreateTime)
|
| | | |
| | | ItemCommon.MakeEquipGS(curCreateItem)
|
| | | |
| | | if isPaimaiMail and ItemCommon.CheckItemIsEquip(curCreateItem):
|
| | | EventShell.EventRespons_BuyAuctionEquip(curPlayer, curCreateItem.GetItemColor())
|
| | | |
| | | #放入玩家背包
|
| | | ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curCreateItem, |
| | | event=[ChConfig.ItemGive_Mail, False, {"MailGUID":curPackData.GUID}])
|
| | | moneySource = curPackData.MoneySource + ChConfig.Def_GiveMoney_Unknown # 存值时为byte类型,使用时需还原回来
|
| | | if curPackData.Gold != 0:
|
| | | PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, curPackData.Gold, moneySource)
|
| | |
| | | combineItemList.append(mailItem)
|
| | | continue
|
| | |
|
| | | if len(mailItem) != 3:
|
| | | if len(mailItem) < 3:
|
| | | continue
|
| | |
|
| | | itemID, itemCnt, isAuctionItem = mailItem
|
| | | |
| | | if ItemControler.GetAppointItemRealID(itemID):
|
| | | # 定制物品转化为物品信息字典
|
| | | appointItemObj = ItemControler.GetItemByData(ItemControler.GetAppointItemDictData(itemID, isAuctionItem))
|
| | | if not appointItemObj:
|
| | | GameWorld.ErrLog("邮件定制物品转化失败!itemID, itemCnt, isAuctionItem" % (itemID, itemCnt, isAuctionItem))
|
| | | continue
|
| | | combineItemList.append(ItemCommon.GetMailItemDict(appointItemObj))
|
| | | appointItemObj.Clear()
|
| | | itemID, itemCnt, isAuctionItem = mailItem[:3]
|
| | | appointID = mailItem[3] if len(mailItem) > 3 else 0
|
| | | if appointID:
|
| | | UserData = {ShareDefine.Def_CItemKey_AppointID:appointID}
|
| | | itemDict = {'ItemID':itemID, 'Count':itemCnt, 'IsAuctionItem':isAuctionItem, 'UserData':UserData}
|
| | | combineItemList.append(str(itemDict))
|
| | | elif isAuctionItem:
|
| | | combineItemList.append((itemID, itemCnt, isAuctionItem))
|
| | | else:
|
| | |
| | |
|
| | | # 给物品
|
| | | if itemDict:
|
| | | itemDict['IsBind'] = isBind
|
| | | ItemControler.GivePlayerEquip(curPlayer, itemDict, event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | | pass
|
| | | #itemDict['IsBind'] = isBind
|
| | | #ItemControler.GivePlayerEquip(curPlayer, itemDict, event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | | else:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem],
|
| | | event=[ChConfig.ItemGive_FamilyStore, False, {}])
|
| | |
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0,
|
| | | [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere])
|
| | | elif itemType == 1:
|
| | | ItemControler.GivePlayerAppointItem(curPlayer, itemID, False)
|
| | | pass #定制物品
|
| | |
|
| | | else:
|
| | | GameWorld.ErrLog("钓鱼奖励类型不支持itemType=%s" % itemType, curPlayer.GetPlayerID())
|
| | |
| | | import EventReport
|
| | | import ItemCommon
|
| | | import DataRecordPack
|
| | | import ShareDefine
|
| | | import PlayerCoin
|
| | |
|
| | | import md5
|
| | |
| | | succGiveItemList = []
|
| | | for itemInfo in awardItemList:
|
| | | itemID, itemCount, itemBind = itemInfo[:3]
|
| | | isAppoint = itemInfo[3] if len(itemInfo) > 3 else 0
|
| | | |
| | | if isAppoint:
|
| | | isOK = ItemControler.GivePlayerAppointItem(curPlayer, itemID, False)
|
| | | else:
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
| | | appointID = itemInfo[3] if len(itemInfo) > 3 else 0
|
| | | setAttrDict = {ShareDefine.Def_CItemKey_AppointID:appointID}
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem], setAttrDict=setAttrDict)
|
| | | if isOK:
|
| | | succGiveItemList.append(itemInfo)
|
| | |
|
| | |
| | | elif equipPlace == ShareDefine.retWing:
|
| | | PlayerControl.NotifyCode(curPlayer, 'WingTiyan_Timeout')
|
| | |
|
| | | tryItemDict = IpyGameDataPY.GetFuncEvalCfg('FirstGoldTryItem', 1, {})
|
| | | tryItemID = tryItemDict.get(curPlayer.GetJob(), 0)
|
| | | if tryItemID and ItemControler.GetAppointItemRealID(tryItemID) == equipID:
|
| | | #首充试用武器过期并且还没首充的提示()
|
| | | if not curPlayer.GetChangeCoinPointTotal():
|
| | | PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
|
| | | PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
|
| | | #tryItemDict = IpyGameDataPY.GetFuncEvalCfg('FirstGoldTryItem', 1, {})
|
| | | #tryItemID = tryItemDict.get(curPlayer.GetJob(), 0)
|
| | | #if tryItemID and ItemControler.GetAppointItemRealID(tryItemID) == equipID:
|
| | | # #首充试用武器过期并且还没首充的提示()
|
| | | # if not curPlayer.GetChangeCoinPointTotal():
|
| | | # PlayerControl.NotifyCode(curPlayer, 'FirstGoldWPOver')
|
| | | # PlayerGoldGift.FirstGoldTryItemOutTime(curPlayer)
|
| | |
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | |
| | | Def_IudetMapLoaction = 15 # 物品记录地图坐标[mapid, posx, posy]
|
| | | Def_IudetLegendAttrID = 17 # 物品传奇属性ID列表
|
| | | Def_IudetLegendAttrValue = 19 # 物品传奇属性值列表
|
| | | Def_IudetBaseAttrID = 21 # 物品基础属性ID列表,适用于随机范围基础属性(非物品表配置的固定属性)
|
| | | Def_IudetBaseAttrValue = 23 # 物品基础属性值列表
|
| | | Def_IudetPartSuiteLV = 25 # 部位套装等级 [套装类型1等级, 套装类型2等级, ...]
|
| | | Def_IudetWingMaterialItemID = 27 # 翅膀精炼材料ID列表
|
| | | Def_IudetWingMaterialItemCount = 29 # 翅膀精炼材料个数列表
|
| | |
| | | Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
|
| | | Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
|
| | | Def_IudetCancelUseLimit = 20 # 物品取消使用限制
|
| | | Def_IudetItemLV = 22 # 物品等级,适用于动态物品等级(非物品表配置的固定等级)
|
| | | Def_IudetSource = 24 # 物品来源
|
| | | Def_IudetSuiteLV = 30 # 套装等级
|
| | | Def_IudetHasOpenCnt = 32 # 物品累积开启次数
|
| | |
| | | Def_IudetPet_Skill = 201 # 技能列表
|
| | |
|
| | | Def_IudetHorsePetSkinIndex = 210 # 骑宠觉醒外观索引
|
| | |
|
| | | # 以下为自定义的设置物品属性key
|
| | | Def_CItemKey_AppointID = "AppointID"
|
| | | # ----------------------------------------------------
|
| | |
|
| | | # 宠物物品数据状态
|