| | |
| | | ##@package PlayerRefineStove
|
| | | # @todo: 玩家炼丹炉
|
| | | #
|
| | | # @author: sgj
|
| | | # @date 2017-11-07
|
| | | # @author: xdh
|
| | | # @date 2019-4-12
|
| | | # @version 1.0
|
| | | #
|
| | | # @note:
|
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2017-11-07 16:40"""
|
| | | #"""Version = 2019-4-12 16:40"""
|
| | | #---------------------------------------------------------------------
|
| | | import ChConfig
|
| | | import GameWorld
|
| | |
| | | import PlayerVip
|
| | |
|
| | | import copy
|
| | | import time
|
| | |
|
| | | DefStoveTypeList = [1, 2] #1灵丹 2仙丹
|
| | |
|
| | |
|
| | | ##功能开启
|
| | |
| | | Sycn_AlchemyMsg(curPlayer)
|
| | | return True
|
| | |
|
| | |
|
| | | ##登录处理
|
| | | def DoOnLogin(curPlayer, tick):
|
| | | Sycn_AlchemyMsg(curPlayer)
|
| | | Sycn_AlchemyPrayMsg(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def OnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyPrayCnt, 0)
|
| | | Sycn_AlchemyPrayMsg(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | #// A5 76 玩家炼丹 #tagCMPlayerRefine
|
| | | #
|
| | | #struct tagCMPlayerRefine
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD RefineNum; // 配方编号
|
| | | # DWORD UseRateItem; // 附加材料ID
|
| | | # DWORD AlchemyID; // 丹药ID
|
| | | # BYTE DoType; // 0-学习 1-开始炼丹 2-停止炼丹 3-开炉取丹
|
| | | #};
|
| | | def PlayerRefineItem(index, clientPack, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | |
| | | GameWorld.DebugLog("炼丹炉功能未开启!", playerID)
|
| | | return
|
| | |
|
| | | alchemyID = clientPack.RefineNum
|
| | | specID = clientPack.UseRateItem # 特殊炼丹ID
|
| | | GameWorld.DebugLog("玩家炼丹: alchemyID=%s,specID=%s" % (alchemyID, specID), playerID)
|
| | | alchemyID = clientPack.AlchemyID
|
| | | doType = clientPack.DoType
|
| | | GameWorld.DebugLog("玩家炼丹: alchemyID=%s, doType=%s" % (alchemyID, doType), playerID)
|
| | | alchemyIpyData = IpyGameDataPY.GetIpyGameData("Alchemy", alchemyID)
|
| | | if not alchemyIpyData:
|
| | | GameWorld.DebugLog("配方不存在!alchemyID=%s" % alchemyID, playerID)
|
| | | return
|
| | | |
| | | specAlchemyIpyData = None
|
| | | if specID:
|
| | | specAlchemyIDList = alchemyIpyData.GetSpecAlchemyID()
|
| | | if specID not in specAlchemyIDList:
|
| | | GameWorld.DebugLog("非法特殊配方!alchemyID=%s,specID=%s" % (alchemyID, specID), playerID)
|
| | | return
|
| | | specAlchemyIpyData = IpyGameDataPY.GetIpyGameData("AlchemySpec", specID)
|
| | | if not specAlchemyIpyData:
|
| | | GameWorld.DebugLog("特殊配方不存在!alchemyID=%s,specID=%s" % (alchemyID, specID), playerID)
|
| | | return
|
| | | |
| | | # 等级判断
|
| | | alchemType = alchemyIpyData.GetAlchemType()
|
| | | alchemyItemID = alchemyIpyData.GetAlchemItemID()
|
| | | hasLearn = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyLearnState, alchemyID)
|
| | | alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | if alchemyLV < alchemyIpyData.GetNeedAlchemyLV(): |
| | | GameWorld.DebugLog("配方未开启!alchemyID=%s,needAlchemyLV=%s,curAlchemyLV=%s" |
| | | % (alchemyID, alchemyIpyData.GetNeedAlchemyLV(), alchemyLV), playerID)
|
| | | return
|
| | | if specAlchemyIpyData:
|
| | | if alchemyLV < specAlchemyIpyData.GetNeedAlchemyLV(): |
| | | GameWorld.DebugLog("特殊配方未开启!alchemyID=%s,specID=%s,needAlchemyLV=%s,curAlchemyLV=%s" |
| | | % (alchemyID, specID, specAlchemyIpyData.GetNeedAlchemyLV(), alchemyLV), playerID)
|
| | | curAlchemyItemID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyItemID % alchemType) #正在炼的丹
|
| | | curLuckValue = curPlayer.GetLuckValue()
|
| | | curTime = int(time.time())
|
| | | |
| | | if doType == 0:
|
| | | if hasLearn:
|
| | | GameWorld.DebugLog('丹方已学习!,不可重复学')
|
| | | return
|
| | | learnNeedAlchemLV = alchemyIpyData.GetLearnNeedAlchemLV()
|
| | | if alchemyLV < learnNeedAlchemLV:
|
| | | GameWorld.DebugLog('丹方学习需要炼丹等级 %s' % learnNeedAlchemLV)
|
| | | return
|
| | | learnNeedLuck = alchemyIpyData.GetLearnNeedLuck()
|
| | | if curLuckValue < learnNeedLuck:
|
| | | GameWorld.DebugLog('丹方学习需要慧根 %s' % learnNeedLuck)
|
| | | return
|
| | | learnNeedItemID = alchemyIpyData.GetLearnNeedItemID()
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(learnNeedItemID, itemPack, 1)
|
| | | if not enough:
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, indexList, 1, False, "RefineStove")
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyLearnState, alchemyID, 1)
|
| | | Sycn_AlchemyMsg(curPlayer, alchemyID, False)
|
| | | elif doType == 1:
|
| | | if not hasLearn:
|
| | | GameWorld.DebugLog('丹方未学习!,不可炼丹')
|
| | | return
|
| | | if curAlchemyItemID:
|
| | | GameWorld.DebugLog('当前丹类型已在炼丹中! curAlchemyItemID=%s' % curAlchemyItemID)
|
| | | return
|
| | | # 基础固定消耗
|
| | | needMaterialDict = alchemyIpyData.GetMaterial()
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needMaterialDict, itemPack, False)
|
| | | if lackItemDict:
|
| | | GameWorld.DebugLog("配方材料不足!alchemyID=%s,needMaterialDict=%s,lackItemDict=%s,hasItemDict=%s" |
| | | % (alchemyItemID, needMaterialDict, lackItemDict, delInfoDict), playerID)
|
| | | return
|
| | | #扣消耗
|
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, ChConfig.ItemDel_Alchemy)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyItemID % alchemType, alchemyItemID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyStartTime % alchemyID, curTime)
|
| | |
|
| | | alchemyItemList = specAlchemyIpyData.GetAlchemyItem()
|
| | | alchemyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyCountSpec % specID)
|
| | | SpecialAlchemyDict = IpyGameDataPY.GetFuncEvalCfg("SpecialAlchemy", 2)
|
| | | SpecialAlchemyCountItemDict = SpecialAlchemyDict.get(specID, {})
|
| | | else:
|
| | | alchemyItemList = alchemyIpyData.GetAlchemyItem()
|
| | | alchemyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyCount % alchemyID)
|
| | | SpecialAlchemyDict = IpyGameDataPY.GetFuncEvalCfg("SpecialAlchemy", 1)
|
| | | SpecialAlchemyCountItemDict = SpecialAlchemyDict.get(alchemyID, {})
|
| | | Sycn_AlchemyMsg(curPlayer, alchemyID, False)
|
| | | #日常任务
|
| | | costItemCnt = sum(needMaterialDict.values())
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_RefineStove, costItemCnt)
|
| | |
|
| | | updAlchemyCount = 0
|
| | | if SpecialAlchemyCountItemDict:
|
| | | nextAlchemyCount = alchemyCount + 1
|
| | | if nextAlchemyCount <= max(SpecialAlchemyCountItemDict):
|
| | | updAlchemyCount = nextAlchemyCount # 只要还没达到最大洗练次数特殊产出,则每次累加次数
|
| | | # 非特殊材料配方的情况下,达到指定次数则使用特殊次数指定产出库
|
| | | if nextAlchemyCount in SpecialAlchemyCountItemDict:
|
| | | alchemyItemList = SpecialAlchemyCountItemDict[nextAlchemyCount]
|
| | | GameWorld.DebugLog("炼丹次数特殊产出库: 炼丹编号=%s,特殊ID=%s,次数=%s,特殊产出库=%s" |
| | | % (alchemyID, specID, nextAlchemyCount, alchemyItemList), playerID)
|
| | | |
| | | # 去除限制产出的物品
|
| | | outPutCountLimitDict = IpyGameDataPY.GetFuncEvalCfg("SpecialAlchemy", 3)
|
| | | if outPutCountLimitDict:
|
| | | limitItemInfoList = []
|
| | | alchemyItemList = copy.copy(alchemyItemList)
|
| | | for itemInfo in alchemyItemList:
|
| | | itemID = itemInfo[1]
|
| | | if itemID not in outPutCountLimitDict:
|
| | | continue
|
| | | limitCount = outPutCountLimitDict[itemID]
|
| | | outputCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyOutputCount % itemID)
|
| | | if outputCount >= limitCount:
|
| | | limitItemInfoList.append(itemInfo)
|
| | | GameWorld.DebugLog("已达到最大产出次数,从产出库中移除! alchemyItemList=%s,itemID=%s,outputCount=%s,limitCount=%s" |
| | | % (alchemyItemList, itemID, outputCount, limitCount), playerID)
|
| | | |
| | | for limitItemInfo in limitItemInfoList:
|
| | | alchemyItemList.remove(limitItemInfo)
|
| | | |
| | | if not alchemyItemList:
|
| | | GameWorld.DebugLog("配方产出物品配置错误!alchemyID=%s,specID=%s" % (alchemyID, specID), playerID)
|
| | | return
|
| | | |
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1) |
| | | if not packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 基础固定消耗
|
| | | needMaterialDict = alchemyIpyData.GetMaterial()
|
| | | # 特殊配方额外消耗
|
| | | if specAlchemyIpyData:
|
| | | needMaterialDict = copy.deepcopy(needMaterialDict)
|
| | | needMaterialDict[specAlchemyIpyData.GetMaterialID()] = specAlchemyIpyData.GetMaterialCnt()
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needMaterialDict, itemPack, False)
|
| | | if lackItemDict:
|
| | | GameWorld.DebugLog("配方材料不足!alchemyID=%s,specID=%s,needMaterialDict=%s,lackItemDict=%s,hasItemDict=%s" |
| | | % (alchemyID, specID, needMaterialDict, lackItemDict, delInfoDict), playerID)
|
| | | return
|
| | | |
| | | makeItemInfo = GameWorld.GetResultByWeightList(alchemyItemList)
|
| | | if not makeItemInfo:
|
| | | GameWorld.ErrLog("配方合成结果错误!alchemyID=%s,specID=%s" % (alchemyID, specID), playerID)
|
| | | return
|
| | | makeItemID, itemCount = makeItemInfo
|
| | | GameWorld.DebugLog("合成配方: alchemyID=%s,specID=%s,makeItemID=%s,itemCount=%s,alchemyItemList=%s" |
| | | % (alchemyID, specID, makeItemID, itemCount, alchemyItemList), playerID)
|
| | | #检查按丹炉等级进阶的丹药
|
| | | makeItemID = __GetAlchemyUpItemID(makeItemID, alchemyLV, alchemyIpyData.GetAlchemyUp())
|
| | | makeItemData = GameWorld.GetGameData().GetItemByTypeID(makeItemID)
|
| | | if not makeItemData:
|
| | | return
|
| | | |
| | | if updAlchemyCount:
|
| | | if specID:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyCountSpec % specID, updAlchemyCount)
|
| | | elif doType == 2:
|
| | | if curAlchemyItemID != alchemyItemID:
|
| | | GameWorld.DebugLog('停止丹药ID错误 curAlchemyItemID=%s' % curAlchemyItemID)
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyItemID % alchemType, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyStartTime % alchemyID, 0)
|
| | | Sycn_AlchemyMsg(curPlayer, alchemyID, False)
|
| | | elif doType == 3:
|
| | | if curAlchemyItemID != alchemyItemID:
|
| | | GameWorld.DebugLog('开炉丹药ID错误 curAlchemyItemID=%s' % curAlchemyItemID)
|
| | | return
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyStartTime % alchemyID)
|
| | | passTime = max(0, curTime - startTime)
|
| | | if passTime < alchemyIpyData.GetNeedTime():
|
| | | GameWorld.DebugLog('开炉丹药,时间未到 passTime=%s' % passTime)
|
| | | return
|
| | | #成功率
|
| | | if alchemType == 2:
|
| | | successRate = ShareDefine.Def_MaxRateValue #仙丹必定成功
|
| | | else:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyCount % alchemyID, updAlchemyCount)
|
| | | GameWorld.DebugLog("更新炼丹次数累计: alchemyID=%s,特殊ID=%s,次数=%s" % (alchemyID, specID, updAlchemyCount), playerID)
|
| | | #灵丹成功率公式 参数 curLuckValue:慧根 alchemyLV:炼丹等级 alchemyQuality:丹药等级 qualityNeedLuck:要求慧根
|
| | | alchemyQuality = alchemyIpyData.GetAlchemyQuality()
|
| | | qualityNeedLuck = IpyGameDataPY.GetFuncEvalCfg('alchemySuccess', 2, {}).get(alchemyQuality, 0)
|
| | | successRate = eval(IpyGameDataPY.GetFuncCompileCfg('alchemySuccess'))
|
| | | isSuccess = GameWorld.CanHappen(successRate)
|
| | | resultCnt = 0 #丹药数量 0代表失败
|
| | | if isSuccess:
|
| | | needSpace = 1
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | ipyData = IpyGameDataPY.InterpolationSearch('AlchemyResult', 'LuckValue', curLuckValue, {'AlchemyQuality':alchemyIpyData.GetAlchemyQuality()})
|
| | | if not ipyData:
|
| | | GameWorld.ErrLog('AlchemyResult 配置错误 未找到该丹方数量 alchemyItemID=%s' % alchemyItemID, playerID)
|
| | | return
|
| | | resultCnt = GameWorld.GetResultByRandomList(ipyData.GetCntRateList())
|
| | | if not resultCnt:
|
| | | GameWorld.ErrLog('AlchemyResult 配置错误 未随机出该丹方数量alchemyItemID=%s' % alchemyItemID, playerID)
|
| | | return
|
| | | makeItemData = GameWorld.GetGameData().GetItemByTypeID(alchemyItemID)
|
| | | if not makeItemData:
|
| | | return
|
| | | ItemControler.GivePlayerItem(curPlayer, alchemyItemID, resultCnt, 0, [IPY_GameWorld.rptItem],
|
| | | event=[ChConfig.ItemGive_Refine, False, {}])
|
| | | #紫色及以上全服广播
|
| | | notifyColor = IpyGameDataPY.GetFuncCfg("AlchemyNotify", 1)
|
| | | needNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 2)
|
| | | notNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 3)
|
| | | if alchemyItemID not in notNotifyItemIDList and (alchemyItemID in needNotifyItemIDList or makeItemData.GetItemColor() >= notifyColor):
|
| | | PlayerControl.WorldNotify(0, "AchemyGreatSuccess", [curPlayer.GetPlayerName(), alchemyItemID])
|
| | |
|
| | | #重置
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyItemID % alchemType, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyStartTime % alchemyID, 0)
|
| | | #加经验
|
| | | addExp = alchemyIpyData.GetAlchemyExp()
|
| | | AddRefineExp(curPlayer, addExp, alchemyLV)
|
| | | GameWorld.DebugLog('炼丹结果 alchemyItemID=%s,successRate=%s,isSuccess=%s,resultCnt=%s' % (alchemyItemID, successRate, isSuccess, resultCnt), playerID)
|
| | | |
| | | Sycn_AlchemyMsg(curPlayer, alchemyID, False, alchemyItemID, resultCnt)
|
| | | |
| | | #完成1次炼丹成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineItem, 1)
|
| | | #完成1次X品质物品炼丹成就
|
| | | #PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineStoveColor, 1, [makeItemData.GetItemColor()])
|
| | | #任务
|
| | | #EventShell.EventRespons_RefineItem(curPlayer, alchemyIpyData.GetNeedAlchemyLV())
|
| | |
|
| | | #扣消耗
|
| | | delItemHasBind = ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, ChConfig.ItemDel_Alchemy)
|
| | | |
| | | #加经验
|
| | | addExp = alchemyIpyData.GetAlchemyExp()
|
| | | if specAlchemyIpyData:
|
| | | addExp += specAlchemyIpyData.GetAlchemyExp()
|
| | | AddRefineExp(curPlayer, addExp)
|
| | | |
| | | #加产出次数
|
| | | if makeItemID in outPutCountLimitDict:
|
| | | outputCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyOutputCount % makeItemID) + 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyOutputCount % makeItemID, outputCount)
|
| | | GameWorld.DebugLog("更新炼丹产出特殊物品次数: makeItemID=%s,outputCount=%s" % (makeItemID, outputCount), playerID)
|
| | | |
| | | #给物品
|
| | | notBindItemList = IpyGameDataPY.GetFuncEvalCfg("SpecialAlchemy", 4) # 固定不绑定的物品
|
| | | if makeItemID in notBindItemList:
|
| | | makeItemBind = False
|
| | | else:
|
| | | makeItemBind = delItemHasBind
|
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, 0, [IPY_GameWorld.rptItem], |
| | | event=[ChConfig.ItemGive_Refine, False, {}])
|
| | | |
| | | Sycn_AlchemyMsg(curPlayer, makeItemID)
|
| | | |
| | | #紫色及以上全服广播
|
| | | notifyColor = IpyGameDataPY.GetFuncCfg("AlchemyNotify", 1)
|
| | | needNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 2)
|
| | | notNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 3)
|
| | | if makeItemID not in notNotifyItemIDList and (makeItemID in needNotifyItemIDList or makeItemData.GetItemColor() >= notifyColor):
|
| | | PlayerControl.WorldNotify(0, "AchemyGreatSuccess", [curPlayer.GetPlayerName(), makeItemID])
|
| | | |
| | | #完成1次炼丹成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineItem, 1)
|
| | | #完成1次X品质物品炼丹成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineStoveColor, 1, [makeItemData.GetItemColor()])
|
| | | #任务
|
| | | EventShell.EventRespons_RefineItem(curPlayer, alchemyIpyData.GetNeedAlchemyLV())
|
| | | #日常任务
|
| | | costItemCnt = sum(needMaterialDict.values())
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_RefineStove, costItemCnt)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, 1)
|
| | | PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, 1)
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_Alchemy, 1)
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, 1)
|
| | | PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, 1)
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_Alchemy, 1)
|
| | | return
|
| | |
|
| | | def __GetAlchemyUpItemID(itemID, alchemyLV, alchemyUpCfg):
|
| | | #获取按丹炉等级进阶的丹药ID
|
| | | if not alchemyUpCfg:
|
| | | return itemID
|
| | | itemIDStr = str(itemID)
|
| | | upItemList = []
|
| | | for alchemyUpItemDict in alchemyUpCfg:
|
| | | if itemIDStr in alchemyUpItemDict:
|
| | | for upID, upLV in alchemyUpItemDict.items():
|
| | | upItemList.append([upLV, int(upID)])
|
| | | |
| | | if not upItemList:
|
| | | return itemID
|
| | | upItemList.sort(reverse=True)
|
| | | for upLV, makeItemID in upItemList:
|
| | | if alchemyLV >= upLV:
|
| | | GameWorld.DebugLog(" 获得进阶丹药: itemID=%s to upItemID=%s" % (itemID, makeItemID))
|
| | | return makeItemID
|
| | | return itemID
|
| | |
|
| | | def AddRefineExp(curPlayer, addExp):
|
| | | def AddRefineExp(curPlayer, addExp, alchemyLV):
|
| | | #增加炼丹炉经验
|
| | | if addExp <= 0:
|
| | | return
|
| | |
|
| | | alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | alchemyExp = min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyExp) + addExp, ShareDefine.Def_UpperLimit_DWord)
|
| | | GameWorld.DebugLog("增加炼丹经验: alchemyLV=%s,addExp=%s,alchemyExp=%s" % (alchemyLV, addExp, alchemyExp), curPlayer.GetPlayerID())
|
| | |
|
| | |
| | | GameWorld.DebugLog("升级后剩余经验: %s" % alchemyExp, curPlayer.GetPlayerID())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyLV, alchemyLV)
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_AlchemyLV, alchemyLV)
|
| | | |
| | | RefreshStoveAttr(curPlayer)
|
| | | |
| | | # 解锁广播
|
| | | ipyGameData = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyGameData.GetAlchemyCount()):
|
| | | ipyData = ipyGameData.GetAlchemyByIndex(i)
|
| | | if alchemyLV == ipyData.GetNeedAlchemyLV():
|
| | | PlayerControl.WorldNotify(0, "FurnaceLVUp", [curPlayer.GetPlayerName(), alchemyLV, ipyData.GetAlchemyID()])
|
| | | break
|
| | | |
| | | return True
|
| | |
|
| | | def Sycn_AlchemyMsg(curPlayer, itemID=0):
|
| | |
|
| | | def Sycn_AlchemyMsg(curPlayer, alchemyID=0, isAll=True, itemID=0, itemCnt=0):
|
| | | # 通知客户端炼丹炉信息
|
| | | if not itemID and not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineStove):
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineStove):
|
| | | return
|
| | | pack = ChPyNetSendPack.tagMCPlayerStoveMsg()
|
| | | pack.StoveExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyExp)
|
| | | pack.StoveLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | pack.ItemID = itemID
|
| | | pack.ItemCnt = itemCnt
|
| | | pack.InfoList = []
|
| | | syncItemIDList = []
|
| | | if isAll:
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyMgr.GetAlchemyCount()):
|
| | | ipyData = ipyMgr.GetAlchemyByIndex(i)
|
| | | alchemyID = ipyData.GetID()
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyLearnState, alchemyID):
|
| | | syncItemIDList.append(alchemyID)
|
| | | elif alchemyID and GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyLearnState, alchemyID):
|
| | | syncItemIDList = [alchemyID]
|
| | | |
| | | for alchemyID in syncItemIDList:
|
| | | StoveInfo = ChPyNetSendPack.tagMCPlayerStoveInfo()
|
| | | StoveInfo.AlchemyID = alchemyID
|
| | | StoveInfo.StartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyStartTime % alchemyID)
|
| | | pack.InfoList.append(StoveInfo)
|
| | | pack.StoveCnt = len(pack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, pack)
|
| | | return
|
| | |
|
| | |
|
| | | def RefreshStoveAttr(curPlayer):
|
| | | CalcStoveAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | |
|
| | | def CalcStoveAttr(curPlayer):
|
| | | # 果实加成
|
| | |
| | | fightPowerEx = PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrYaoList, ShareDefine.Def_AttrFruitFunc_Stove)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_StoveYao, allAttrYaoList)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_StoveYao, fightPowerEx)
|
| | | |
| | | allAttrList = [{} for _ in range(4)]
|
| | | alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | stoveIpyData = IpyGameDataPY.GetIpyGameData("RefineStove", alchemyLV)
|
| | | if stoveIpyData:
|
| | | attrTypeList = stoveIpyData.GetAddAttrType()
|
| | | attrValueList = stoveIpyData.GetAddAttrNum()
|
| | | for i, attrID in enumerate(attrTypeList):
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
|
| | | |
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stove, allAttrList)
|
| | | return
|
| | |
|
| | | g_needAlchemyLVDict = {}
|
| | | def GetIsCanOutByAlchemyLV(curPlayer, itemID):
|
| | | #判断当前丹炉等级是否可产出该丹药
|
| | | global g_needAlchemyLVDict
|
| | | if not g_needAlchemyLVDict:
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyMgr.GetAlchemyCount()):
|
| | | ipyData = ipyMgr.GetAlchemyByIndex(i)
|
| | | needAlchemyLV = ipyData.GetNeedAlchemyLV()
|
| | | itemList = ipyData.GetAlchemyItem()
|
| | | for itemInfo in itemList:
|
| | | g_needAlchemyLVDict[itemInfo[1]] = needAlchemyLV
|
| | | for i in xrange(ipyMgr.GetAlchemySpecCount()):
|
| | | ipyData = ipyMgr.GetAlchemySpecByIndex(i)
|
| | | needAlchemyLV = ipyData.GetNeedAlchemyLV()
|
| | | itemList = ipyData.GetAlchemyItem()
|
| | | for itemInfo in itemList:
|
| | | g_needAlchemyLVDict[itemInfo[1]] = needAlchemyLV
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV) >= g_needAlchemyLVDict.get(itemID, 0)
|
| | |
|
| | |
|
| | | #// A5 14 祈福丹药 #tagCMPrayElixir
|
| | |
| | | prayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)
|
| | | limitCnt = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_PrayElixir)
|
| | | if prayCnt >= limitCnt:
|
| | | GameWorld.DebugLog('今日祈福丹药次数已满!prayCnt=%s'%prayCnt)
|
| | | GameWorld.DebugLog('今日祈福丹药次数已满!prayCnt=%s' % prayCnt)
|
| | | return
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)
|
| | | if not packSpace:
|
| | |
| | | newItemInfoList = []
|
| | | for itemInfo in alchemyItemList:
|
| | | itemID = itemInfo[1]
|
| | | if not GetIsCanOutByAlchemyLV(curPlayer, itemID):
|
| | | #GameWorld.DebugLog('祈福丹药,炼丹等级未达到,移除产出库!itemID=%s'%itemID)
|
| | | continue
|
| | | # if not GetIsCanOutByAlchemyLV(curPlayer, itemID):
|
| | | # #GameWorld.DebugLog('祈福丹药,炼丹等级未达到,移除产出库!itemID=%s'%itemID)
|
| | | # continue
|
| | | if PlayerAttrFruit.IsFruitEatFull(curPlayer, itemID):
|
| | | #GameWorld.DebugLog('祈福丹药,使用次数已满,移除产出库!itemID=%s'%itemID)
|
| | | continue
|
| | |
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney, ChConfig.Def_Cost_AlchemyPray):
|
| | | return
|
| | | #给物品
|
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, 0, [IPY_GameWorld.rptItem], |
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, 0, [IPY_GameWorld.rptItem],
|
| | | event=[ChConfig.ItemGive_Refine, False, {}])
|
| | | #GameWorld.DebugLog('makeItemID=%s,newItemInfoList=%s'%(makeItemID, newItemInfoList))
|
| | | |
| | |
|
| | | #紫色及以上全服广播
|
| | | notifyColor = IpyGameDataPY.GetFuncCfg("AlchemyNotify", 1)
|
| | |
| | | PlayerControl.WorldNotify(0, "BlastfurnaceBlessing", [curPlayer.GetPlayerName(), makeItemID])
|
| | |
|
| | | #更新次数
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyPrayCnt, prayCnt+1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyPrayCnt, prayCnt + 1)
|
| | | Sycn_AlchemyPrayMsg(curPlayer, makeItemID)
|
| | | return
|
| | |
|
| | |
|
| | | def Sycn_AlchemyPrayMsg(curPlayer, itemID=0):
|
| | | return
|
| | | #祈福丹药结果
|
| | | if not itemID and not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineStove):
|
| | | return
|
| | |
| | | pack.PrayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)
|
| | | pack.ItemID = itemID
|
| | | NetPackCommon.SendFakePack(curPlayer, pack)
|
| | | return |
| | | return
|