4409 【后端】【1.2.0】装备合成、翅膀合成修改
| | |
| | | {
|
| | | WORD _ID; //合成配置编号ID
|
| | | list MakeID; //可合成的道具ID,多个则随机一个
|
| | | BYTE IsFirstSuccMakeJobItem; //首次成功是否必出本职业
|
| | | list UnfixedItemID; //不固定道具ID, 多个ID时则任意一种均可
|
| | | BYTE UnfixedItemCount; //不固定道具消耗数量
|
| | | list FixedItemID; //消耗固定道具ID, 多个ID时代表每个ID均需消耗
|
| | |
| | | DWORD NeedMoney; // 消耗铜钱
|
| | | WORD SuccessRate; // 成功率万分率
|
| | | WORD SuccessRateMax; // 最大成功率万分率
|
| | | list SuccessRateIncrease; //提高成功率道具, 道具ID|个数|提高的概率
|
| | | BYTE AddonsCountMax; //最大可附加材料数, 增加概率用, 非必须, 0代表不可附加材料
|
| | | char SysMark; //提示mark
|
| | | BYTE SysMarkParamType; //系统提示参数组合类型
|
| | |
| | | AddonsItemIndexCnt = 0 #(BYTE AddonsItemIndexCnt)// 附加物品在背包中索引个数
|
| | | AddonsItemIndex = list() #(vector<BYTE> AddonsItemIndex)// 附加物品在背包的索引列表
|
| | | AddonsItemCount = list() #(vector<BYTE> AddonsItemCount)// 附加物品在背包的索引对应扣除数量列表
|
| | | RateIncreaseItemIndexCnt = 0 #(BYTE RateIncreaseItemIndexCnt)// 提升概率物品在背包中索引个数
|
| | | RateIncreaseItemIndex = list() #(vector<BYTE> RateIncreaseItemIndex)// 提升概率物品在背包的索引列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.AddonsItemIndexCnt):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.AddonsItemCount.append(value)
|
| | | self.RateIncreaseItemIndexCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RateIncreaseItemIndexCnt):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.RateIncreaseItemIndex.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.AddonsItemIndexCnt = 0
|
| | | self.AddonsItemIndex = list()
|
| | | self.AddonsItemCount = list()
|
| | | self.RateIncreaseItemIndexCnt = 0
|
| | | self.RateIncreaseItemIndex = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 1 * self.AddonsItemIndexCnt
|
| | | length += 1 * self.AddonsItemIndexCnt
|
| | | length += 1
|
| | | length += 1 * self.RateIncreaseItemIndexCnt
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.AddonsItemIndex[i])
|
| | | for i in range(self.AddonsItemIndexCnt):
|
| | | data = CommFunc.WriteBYTE(data, self.AddonsItemCount[i])
|
| | | data = CommFunc.WriteBYTE(data, self.RateIncreaseItemIndexCnt)
|
| | | for i in range(self.RateIncreaseItemIndexCnt):
|
| | | data = CommFunc.WriteBYTE(data, self.RateIncreaseItemIndex[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | FixedItemIndex:%s,
|
| | | AddonsItemIndexCnt:%d,
|
| | | AddonsItemIndex:%s,
|
| | | AddonsItemCount:%s
|
| | | AddonsItemCount:%s,
|
| | | RateIncreaseItemIndexCnt:%d,
|
| | | RateIncreaseItemIndex:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | |
| | | "...",
|
| | | self.AddonsItemIndexCnt,
|
| | | "...",
|
| | | "...",
|
| | | self.RateIncreaseItemIndexCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
| | | Def_PDict_IsAddReviveTired = "IsAddReviveTired" # 死亡是否增加复活疲劳
|
| | |
|
| | | Def_PDict_HadCompoundWing = "HadCompoundWing" # 是否合成过一代翅膀
|
| | | Def_PDict_FirstSuccMakeJobItem = "FirstSuccMakeJobItem_%s" # 首次合成成功给本职业物品记录,参数为(合成ID)
|
| | |
|
| | | Def_PDict_DownloadAwardState = "DownloadAwardState" # 分支下载奖励状态 0-未领 1-已领
|
| | |
|
| | |
| | | AddonsItemIndexCnt = 0 #(BYTE AddonsItemIndexCnt)// 附加物品在背包中索引个数
|
| | | AddonsItemIndex = list() #(vector<BYTE> AddonsItemIndex)// 附加物品在背包的索引列表
|
| | | AddonsItemCount = list() #(vector<BYTE> AddonsItemCount)// 附加物品在背包的索引对应扣除数量列表
|
| | | RateIncreaseItemIndexCnt = 0 #(BYTE RateIncreaseItemIndexCnt)// 提升概率物品在背包中索引个数
|
| | | RateIncreaseItemIndex = list() #(vector<BYTE> RateIncreaseItemIndex)// 提升概率物品在背包的索引列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.AddonsItemIndexCnt):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.AddonsItemCount.append(value)
|
| | | self.RateIncreaseItemIndexCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RateIncreaseItemIndexCnt):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.RateIncreaseItemIndex.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.AddonsItemIndexCnt = 0
|
| | | self.AddonsItemIndex = list()
|
| | | self.AddonsItemCount = list()
|
| | | self.RateIncreaseItemIndexCnt = 0
|
| | | self.RateIncreaseItemIndex = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 1 * self.AddonsItemIndexCnt
|
| | | length += 1 * self.AddonsItemIndexCnt
|
| | | length += 1
|
| | | length += 1 * self.RateIncreaseItemIndexCnt
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.AddonsItemIndex[i])
|
| | | for i in range(self.AddonsItemIndexCnt):
|
| | | data = CommFunc.WriteBYTE(data, self.AddonsItemCount[i])
|
| | | data = CommFunc.WriteBYTE(data, self.RateIncreaseItemIndexCnt)
|
| | | for i in range(self.RateIncreaseItemIndexCnt):
|
| | | data = CommFunc.WriteBYTE(data, self.RateIncreaseItemIndex[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | FixedItemIndex:%s,
|
| | | AddonsItemIndexCnt:%d,
|
| | | AddonsItemIndex:%s,
|
| | | AddonsItemCount:%s
|
| | | AddonsItemCount:%s,
|
| | | RateIncreaseItemIndexCnt:%d,
|
| | | RateIncreaseItemIndex:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | |
| | | "...",
|
| | | self.AddonsItemIndexCnt,
|
| | | "...",
|
| | | "...",
|
| | | self.RateIncreaseItemIndexCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
| | | # BYTE AddonsItemIndexCnt; // 附加物品在背包中索引个数
|
| | | # BYTE AddonsItemIndex[AddonsItemIndexCnt]; // 附加物品在背包的索引列表
|
| | | # BYTE AddonsItemCount[AddonsItemIndexCnt]; // 附加物品在背包的索引对应扣除数量列表
|
| | | # BYTE RateIncreaseItemIndexCnt; // 提升概率物品在背包中索引个数
|
| | | # BYTE RateIncreaseItemIndex[RateIncreaseItemIndexCnt]; // 提升概率物品在背包的索引列表
|
| | | #};
|
| | | def OnItemCompound(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | |
| | | fixedItemIndexList = clientData.FixedItemIndex
|
| | | addonsItemIndexList = clientData.AddonsItemIndex
|
| | | addonsItemCountList = clientData.AddonsItemCount
|
| | | GameWorld.DebugLog("物品合成: ID=%s,compoundCnt=%s,unfixedItemIndexList=%s,fixedItemIndexList=%s,addonsItemIndexList=%s,addonsItemCountList=%s" |
| | | % (compoundID, compoundCnt, unfixedItemIndexList, fixedItemIndexList, addonsItemIndexList, addonsItemCountList), playerID)
|
| | | incRateItemIndexList = clientData.RateIncreaseItemIndex
|
| | | GameWorld.DebugLog("物品合成: ID=%s,compoundCnt=%s,unfixedItemIndexList=%s,fixedItemIndexList=%s,addonsItemIndexList=%s,addonsItemCountList=%s,incRateItemIndexList=%s" |
| | | % (compoundID, compoundCnt, unfixedItemIndexList, fixedItemIndexList, addonsItemIndexList, addonsItemCountList, incRateItemIndexList), playerID)
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ItemCompound", compoundID)
|
| | | if not ipyData:
|
| | |
| | | fixedItemIDList = ipyData.GetFixedItemID()
|
| | | fixedItemCountList = ipyData.GetFixedItemCount()
|
| | |
|
| | | makeItemID = random.choice(makeIDList) # 从可合成物品列表里随机一个
|
| | | isFirstSuccMakeJobItem = False
|
| | | if ipyData.GetIsFirstSuccMakeJobItem() and not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstSuccMakeJobItem % compoundID):
|
| | | isFirstSuccMakeJobItem = True
|
| | | makeItemID = 0
|
| | | for jobItemID in makeIDList:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(jobItemID)
|
| | | if itemData and ItemCommon.CheckJob(curPlayer, itemData):
|
| | | makeItemID = jobItemID
|
| | | break
|
| | | else:
|
| | | makeItemID = random.choice(makeIDList) # 从可合成物品列表里随机一个
|
| | | makeItemData = GameWorld.GetGameData().GetItemByTypeID(makeItemID)
|
| | | if not makeItemData:
|
| | | GameWorld.ErrLog("不存在该合成物品! makeItemID=%s" % makeItemID)
|
| | |
| | | needMoney = ipyData.GetNeedMoney()
|
| | | successRate = ipyData.GetSuccessRate()
|
| | | successRateMax = ipyData.GetSuccessRateMax()
|
| | | successRateIncrease = ipyData.GetSuccessRateIncrease()
|
| | | addonsCountMax = ipyData.GetAddonsCountMax() # 可叠加的算叠加数量
|
| | | # 可使用非固定道具 或 附加道具的 单次合成数默认为1
|
| | | if unfixedItemIDList or addonsCountMax > 0:
|
| | | if unfixedItemIDList or addonsCountMax > 0 or incRateItemIndexList:
|
| | | compoundCnt = 1
|
| | |
|
| | | totalNeedMoney = needMoney * compoundCnt
|
| | |
| | | return
|
| | | addSuccRate, addSuccRateItemInfo = addSuccRateInfo
|
| | |
|
| | | # 检查提升概率道具
|
| | | incRateItemCostList, needIncRateItemCount, incRate = [], 0, 0
|
| | | if successRateIncrease and len(successRateIncrease) == 3 and incRateItemIndexList:
|
| | | incRateItemID, needIncRateItemCount, incRate = successRateIncrease
|
| | | incRateItemInfo = __CheckIncRateItem(playerID, compoundID, itemPack, incRateItemIndexList, incRateItemID, needIncRateItemCount)
|
| | | if not incRateItemInfo:
|
| | | return
|
| | | incRateItemCostList = incRateItemInfo
|
| | | |
| | | # 扣铜钱
|
| | | PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, totalNeedMoney, ChConfig.Def_Cost_ItemProduce,
|
| | | {ChConfig.Def_Cost_Reason_SonKey:makeItemID, "CompoundCount":compoundCnt})
|
| | |
| | | False, ChConfig.ItemDel_ItemCompound, drDict)
|
| | | #makeItemBind = True if hasBind else makeItemBind #策划说附加材料不决定合成物品是否绑定
|
| | |
|
| | | # 扣提升概率道具
|
| | | if incRateItemCostList:
|
| | | bindIncRateItemIndexList, unBindIncRateItemIndexList = incRateItemCostList
|
| | | hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, bindIncRateItemIndexList + unBindIncRateItemIndexList, needIncRateItemCount, |
| | | False, ChConfig.ItemDel_ItemCompound, drDict)
|
| | | |
| | | if compoundCnt == 1 and makeItemBind:
|
| | | compoundBindCnt = 1
|
| | |
|
| | | # 给合成物品
|
| | | totalSuccRate = successRate + addSuccRate
|
| | | totalSuccRate = successRate + addSuccRate + incRate
|
| | | if successRateMax:
|
| | | totalSuccRate = min(successRateMax, totalSuccRate)
|
| | | GameWorld.DebugLog("合成成功率: successRate=%s,addSuccRate=%s,successRateMax=%s,totalSuccRate=%s" |
| | | % (successRate, addSuccRate, successRateMax, totalSuccRate), playerID)
|
| | | GameWorld.DebugLog("合成成功率: successRate=%s,addSuccRate=%s,incRate=%s,successRateMax=%s,totalSuccRate=%s" |
| | | % (successRate, addSuccRate, incRate, successRateMax, totalSuccRate), playerID)
|
| | | # 首次合成一代翅膀成功率百分百
|
| | | if makeItemData.GetType() == ChConfig.Def_ItemType_retWing and ItemCommon.GetWingLV(makeItemData) == 1:
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HadCompoundWing):
|
| | |
| | | # 不是百分百成功的记录合成流向
|
| | | if successRate != maxRateValue:
|
| | | drDict = {"PlayerID":curPlayer.GetPlayerID(), "AccID":curPlayer.GetAccID(), "ID":compoundID, "MakeItemID":makeItemID, "IsSuccess":canHappen,
|
| | | "RateInfo":{"totalSuccRate":"%s(%s+%s)" % (totalSuccRate, successRate, addSuccRate), "randValue":randValue, "maxRateValue":maxRateValue},
|
| | | "RateInfo":{"totalSuccRate":"%s(%s+%s+%s)" % (totalSuccRate, successRate, addSuccRate, incRate), "randValue":randValue, "maxRateValue":maxRateValue},
|
| | | "AddSuccRateItemInfo":addSuccRateItemInfo
|
| | | }
|
| | | DataRecordPack.SendEventPack("ItemCompound", drDict, curPlayer)
|
| | |
| | | else:
|
| | | PlayerControl.WorldNotify(0, msgMark, [curPlayer.GetName(), makeItemID, userData])
|
| | |
|
| | | if isFirstSuccMakeJobItem:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstSuccMakeJobItem % compoundID, 1)
|
| | | GameWorld.DebugLog("标记首次合成成功给本职业物品!", playerID)
|
| | | |
| | | # 通知合成成功
|
| | | ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitItemCompound, ChConfig.Def_ComposeState_Sucess, makeItemID)
|
| | | #成功合成1个物品成就
|
| | |
| | |
|
| | | return int(addTotalSuccRate), addSuccRateItemInfo
|
| | |
|
| | | def __CheckIncRateItem(playerID, compoundID, itemPack, incRateItemIndexList, incRateItemID, needIncRateItemCount):
|
| | | ## 检查提升概率道具, 只要客户端提交的数据有不符合要求的,则直接返回 None
|
| | | incRateItemTotalCount = 0
|
| | | incRateItemCostList = [[], []] # [[绑定索引], [非绑定索引]]
|
| | | maxPackCount = itemPack.GetCount()
|
| | | for index in incRateItemIndexList:
|
| | | if index >= maxPackCount:
|
| | | GameWorld.Log("该物品格子索引不存在!无法合成!index=%s,maxPackCount=%s" % (index, maxPackCount), playerID)
|
| | | return
|
| | | curItem = itemPack.GetAt(index)
|
| | | if not __CheckItemCanUseCompound(playerID, index, curItem):
|
| | | GameWorld.Log("该物品不可使用!无法合成! ID=%s,index=%s" % (compoundID, index), playerID)
|
| | | return
|
| | | itemID = curItem.GetItemTypeID()
|
| | | if itemID != incRateItemID:
|
| | | GameWorld.Log("该物品不可用于提升合成目标物品概率!ID=%s,index=%s,itemID=%s != incRateItemID=%s" |
| | | % (compoundID, index, itemID, incRateItemID), playerID)
|
| | | return
|
| | | |
| | | isBind = curItem.GetIsBind()
|
| | | itemCount = curItem.GetCount()
|
| | | incRateItemTotalCount += itemCount
|
| | | incRateItemCostList[0].append(index) if isBind else incRateItemCostList[1].append(index)
|
| | | |
| | | if incRateItemTotalCount < needIncRateItemCount:
|
| | | GameWorld.Log("提升概率消耗道具不足,无法合成!ID=%s,incRateItemID=%s,needIncRateItemCount=%s > incRateItemTotalCount=%s" |
| | | % (compoundID, incRateItemID, needIncRateItemCount, incRateItemTotalCount), playerID)
|
| | | return
|
| | | |
| | | return incRateItemCostList
|
| | |
|
| | | def __CheckItemCanUseCompound(playerID, index, curItem):
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | |
| | | "ItemCompound":(
|
| | | ("WORD", "ID", 1),
|
| | | ("list", "MakeID", 0),
|
| | | ("BYTE", "IsFirstSuccMakeJobItem", 0),
|
| | | ("list", "UnfixedItemID", 0),
|
| | | ("BYTE", "UnfixedItemCount", 0),
|
| | | ("list", "FixedItemID", 0),
|
| | |
| | | ("DWORD", "NeedMoney", 0),
|
| | | ("WORD", "SuccessRate", 0),
|
| | | ("WORD", "SuccessRateMax", 0),
|
| | | ("list", "SuccessRateIncrease", 0),
|
| | | ("BYTE", "AddonsCountMax", 0),
|
| | | ("char", "SysMark", 0),
|
| | | ("BYTE", "SysMarkParamType", 0),
|
| | |
| | | def __init__(self): |
| | | self.ID = 0
|
| | | self.MakeID = []
|
| | | self.IsFirstSuccMakeJobItem = 0
|
| | | self.UnfixedItemID = []
|
| | | self.UnfixedItemCount = 0
|
| | | self.FixedItemID = []
|
| | |
| | | self.NeedMoney = 0
|
| | | self.SuccessRate = 0
|
| | | self.SuccessRateMax = 0
|
| | | self.SuccessRateIncrease = []
|
| | | self.AddonsCountMax = 0
|
| | | self.SysMark = ""
|
| | | self.SysMarkParamType = 0 |
| | |
| | | |
| | | def GetID(self): return self.ID # 合成配置编号ID
|
| | | def GetMakeID(self): return self.MakeID # 可合成的道具ID,多个则随机一个
|
| | | def GetIsFirstSuccMakeJobItem(self): return self.IsFirstSuccMakeJobItem # 首次成功是否必出本职业
|
| | | def GetUnfixedItemID(self): return self.UnfixedItemID # 不固定道具ID, 多个ID时则任意一种均可
|
| | | def GetUnfixedItemCount(self): return self.UnfixedItemCount # 不固定道具消耗数量
|
| | | def GetFixedItemID(self): return self.FixedItemID # 消耗固定道具ID, 多个ID时代表每个ID均需消耗
|
| | |
| | | def GetNeedMoney(self): return self.NeedMoney # 消耗铜钱
|
| | | def GetSuccessRate(self): return self.SuccessRate # 成功率万分率
|
| | | def GetSuccessRateMax(self): return self.SuccessRateMax # 最大成功率万分率
|
| | | def GetSuccessRateIncrease(self): return self.SuccessRateIncrease # 提高成功率道具, 道具ID|个数|提高的概率
|
| | | def GetAddonsCountMax(self): return self.AddonsCountMax # 最大可附加材料数, 增加概率用, 非必须, 0代表不可附加材料
|
| | | def GetSysMark(self): return self.SysMark # 提示mark
|
| | | def GetSysMarkParamType(self): return self.SysMarkParamType # 系统提示参数组合类型 |