| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package PlayerRefineStove  | 
| # @todo: Íæ¼ÒÁ¶µ¤Â¯  | 
| #  | 
| # @author: xdh  | 
| # @date 2019-4-12  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2019-4-12 16:40"""  | 
| #---------------------------------------------------------------------  | 
| import ChConfig  | 
| import GameWorld  | 
| import IPY_GameWorld  | 
| import ItemControler  | 
| import PlayerControl  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import GameFuncComm  | 
| import ShareDefine  | 
| import ItemCommon  | 
| import PlayerSuccess  | 
| import PlayerAttrFruit  | 
| import IpyGameDataPY  | 
| import EventShell  | 
| import PlayerActivity  | 
| import PlayerFairyCeremony  | 
| import PlayerNewFairyCeremony  | 
| import PlayerActGarbageSorting  | 
| import PlayerActLogin  | 
| import PlayerVip  | 
|   | 
| import copy  | 
| import time  | 
|   | 
| DefStoveType1 = 1 #1Á鵤  | 
| DefStoveType2 = 2 #2Ïɵ¤  | 
|   | 
|   | 
| ##¹¦ÄÜ¿ªÆô  | 
| def DoRefineStoveOpen(curPlayer):  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyLV, 1)  | 
|     PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_AlchemyLV, 1)  | 
|     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;  | 
| #    DWORD    AlchemyID;    // µ¤Ò©ID  | 
| #    BYTE   DoType;  // 0-ѧϰ 1-¿ªÊ¼Á¶µ¤ 2-Í£Ö¹Á¶µ¤ 3-¿ªÂ¯È¡µ¤  | 
| #};  | 
| def PlayerRefineItem(index, clientPack, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     playerID = curPlayer.GetPlayerID()  | 
|     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineStove):  | 
|         GameWorld.DebugLog("Á¶µ¤Â¯¹¦ÄÜ먦Æô£¡", playerID)  | 
|         return  | 
|     refineTimes = max(1, clientPack.AlchemyTimes)  | 
|     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  | 
|     alchemType = alchemyIpyData.GetAlchemType()  | 
|     alchemyItemID = alchemyIpyData.GetAlchemItemID()  | 
|     alchemyQuality = alchemyIpyData.GetAlchemyQuality()  | 
|     hasLearn = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyLearnState, alchemyID)  | 
|     alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)  | 
|     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  | 
|         learnNeedLingGenPoint = alchemyIpyData.GetLearnNeedLingGenPoint()  | 
|         if PlayerControl.GetTotalLingGenPoint(curPlayer) < learnNeedLingGenPoint:  | 
|             GameWorld.DebugLog('µ¤·½Ñ§Ï°ÐèÒª×ÜÁé¸ùµã %s' % learnNeedLingGenPoint)  | 
|             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  | 
|         if refineTimes < 1:  | 
|             return  | 
|         # »ù´¡¹Ì¶¨ÏûºÄ  | 
|         needMaterialDict = alchemyIpyData.GetMaterial()  | 
|         needMaterialDict = {itemID:itemCnt*refineTimes for itemID, itemCnt in needMaterialDict.items()}  | 
|         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  | 
|         #ÈÎÎñ  | 
|         for _ in xrange(refineTimes):  | 
|             EventShell.EventRespons_RefineItem(curPlayer, alchemyQuality, alchemyItemID)  | 
|               | 
|         #¿ÛÏûºÄ  | 
|         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)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyTimes % alchemyID, refineTimes)  | 
|   | 
|         Sycn_AlchemyMsg(curPlayer, alchemyID, False)  | 
|         #ÈÕ³£ÈÎÎñ  | 
|         costItemCnt = sum(needMaterialDict.values())  | 
|         #PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_RefineStove, costItemCnt)  | 
|   | 
|     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  | 
|         refineTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyTimes % alchemyID)  | 
|         refineTimes = max(1, refineTimes)  | 
|         startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyStartTime % alchemyID)  | 
|         passTime = max(0, curTime - startTime)  | 
|         if passTime < alchemyIpyData.GetNeedTime() * refineTimes:  | 
|             GameWorld.DebugLog('¿ªÂ¯µ¤Ò©,ʱ¼äδµ½  passTime=%s' % passTime)  | 
|             return  | 
|         alchemyQuality = alchemyIpyData.GetAlchemyQuality()  | 
|   | 
|         alchemyAppointCntDict = {} #¶¨ÖÆÅäÖà{´ÎÊý:[ÊýÁ¿,³É¹¦ÂÊ]}  | 
|         alchemyCustomizedDict = IpyGameDataPY.GetFuncEvalCfg('alchemyCustomized', 1, {})  | 
|         if alchemyID in alchemyCustomizedDict:  | 
|             alchemyCnt = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyCnt, alchemyID, False)  | 
|             alchemyAppointCntDict = alchemyCustomizedDict[alchemyID]  | 
|   | 
|         resultIpyData = IpyGameDataPY.InterpolationSearch('AlchemyResult', 'LuckValue', curLuckValue, {'AlchemyQuality':alchemyIpyData.GetAlchemyQuality()})  | 
|         if not resultIpyData:  | 
|             GameWorld.ErrLog('AlchemyResult ÅäÖôíÎó Î´ÕÒµ½¸Ãµ¤·½ÊýÁ¿ alchemyItemID=%s' % alchemyItemID, playerID)  | 
|             return  | 
|         makeItemData = GameWorld.GetGameData().GetItemByTypeID(alchemyItemID)  | 
|         if not makeItemData:  | 
|             return  | 
|         #Á鵤³É¹¦Âʹ«Ê½ ²ÎÊý curLuckValue:»Û¸ù  alchemyLV:Á¶µ¤µÈ¼¶ alchemyQuality:µ¤Ò©µÈ¼¶  qualityNeedLuck:ÒªÇó»Û¸ù  | 
|         qualityNeedLuck = IpyGameDataPY.GetFuncEvalCfg('alchemySuccess', 2, {}).get(str(alchemyQuality), 0)  | 
|         nomalsuccessRate = eval(IpyGameDataPY.GetFuncCompileCfg('alchemySuccess'))  | 
|           | 
|         resultCnt = 0  #µ¤Ò©ÊýÁ¿ 0´ú±íʧ°Ü  | 
|         for i in xrange(refineTimes):  | 
|             #³É¹¦ÂÊ  | 
|             appointInfo = [] #[ÊýÁ¿,³É¹¦ÂÊ]  | 
|             if alchemyAppointCntDict and alchemyCnt+1+i in alchemyAppointCntDict:  | 
|                 appointInfo = alchemyAppointCntDict[alchemyCnt+1+i]  | 
|             if appointInfo:  | 
|                 successRate = appointInfo[1]  | 
|             elif alchemType == DefStoveType2:  | 
|                 successRate = ShareDefine.Def_MaxRateValue  #Ïɵ¤±Ø¶¨³É¹¦  | 
|             elif alchemType == DefStoveType1:  | 
|                 successRate = nomalsuccessRate  | 
|             else:  | 
|                 return  | 
|             isSuccess = GameWorld.CanHappen(successRate)  | 
|             if isSuccess:  | 
|                 if alchemType == DefStoveType2:  | 
|                     resultCnt += 1 #Ïɵ¤±Ø¶¨Îª1  | 
|                 elif alchemType == DefStoveType1:  | 
|                     if appointInfo:  | 
|                         resultCnt += appointInfo[0]  | 
|                     else:  | 
|                         resultCnt += GameWorld.GetResultByRandomList(resultIpyData.GetCntRateList())  | 
|                 if not resultCnt:  | 
|                     GameWorld.ErrLog('AlchemyResult ÅäÖôíÎó Î´Ëæ»ú³ö¸Ãµ¤·½ÊýÁ¿alchemyItemID=%s' % alchemyItemID, playerID)  | 
|                     return  | 
|         if resultCnt:  | 
|             needSpace = 1  | 
|             packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)  | 
|             if needSpace > packSpace:  | 
|                 PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|                 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])  | 
|   | 
| #        #ÈÎÎñ£¬¸ÄΪ¿ªÊ¼Á¶µ¤´¥·¢  | 
| #        for _ in xrange(refineTimes):  | 
| #            EventShell.EventRespons_RefineItem(curPlayer, alchemyQuality, alchemyItemID)  | 
|         #ÖØÖÃ  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyItemID % alchemType, 0)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyStartTime % alchemyID, 0)  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyTimes % alchemyID, 0)  | 
|         #¼Ó¾Ñé  | 
|         addExp = alchemyIpyData.GetAlchemyExp() * refineTimes  | 
|         AddRefineExp(curPlayer, addExp, alchemyLV)  | 
|         #¼Ó´ÎÊý  | 
|         if alchemyID in alchemyCustomizedDict:  | 
|             GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_AlchemyCnt, alchemyID, min(alchemyCnt + refineTimes, 9), False)  | 
|       | 
|         GameWorld.DebugLog('Á¶µ¤½á¹û alchemyItemID=%s,refineTimes=%s,isSuccess=%s,resultCnt=%s' % (alchemyItemID, refineTimes, isSuccess, resultCnt), playerID)  | 
|       | 
|         Sycn_AlchemyMsg(curPlayer, alchemyID, False, alchemyItemID, resultCnt)  | 
|       | 
|         #Íê³É1´ÎÁ¶µ¤³É¾Í  | 
|         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineItem, refineTimes)  | 
|         #Íê³É1´ÎXÆ·ÖÊÎïÆ·Á¶µ¤³É¾Í  | 
|         #PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_RefineStoveColor, 1, [makeItemData.GetItemColor()])  | 
|       | 
|       | 
|         PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, refineTimes)  | 
|         PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_RefineStove, refineTimes)  | 
|         PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_Alchemy, refineTimes)  | 
|         PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_RefineStove, refineTimes)  | 
|     return  | 
|   | 
|   | 
| def AddRefineExp(curPlayer, addExp, alchemyLV):  | 
|     #Ôö¼ÓÁ¶µ¤Â¯¾Ñé  | 
|     if addExp <= 0:  | 
|         return  | 
|   | 
|     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())  | 
|   | 
|     isLVUp = False  | 
|     stoveIpyData = IpyGameDataPY.GetIpyGameDataNotLog("RefineStove", alchemyLV)  | 
|     while stoveIpyData and stoveIpyData.GetUpNeedExp() and alchemyExp >= stoveIpyData.GetUpNeedExp():  | 
|         needExp = stoveIpyData.GetUpNeedExp()  | 
|         nextLV = alchemyLV + 1  | 
|         stoveIpyData = IpyGameDataPY.GetIpyGameDataNotLog("RefineStove", nextLV)  | 
|         if not stoveIpyData:  | 
|             GameWorld.DebugLog("ûÓÐÏÂÒ»¼¶Êý¾ÝÁË£¬ÒÑÂú¼¶£¡²»¿ÉÉý¼¶£¡", curPlayer.GetPlayerID())  | 
|             break  | 
|   | 
|         alchemyExp -= needExp  | 
|         alchemyLV += 1  | 
|         GameWorld.DebugLog("    Á¶µ¤Éý¼¶: alchemyLV=%s,alchemyExp=%s" % (alchemyLV, alchemyExp), curPlayer.GetPlayerID())  | 
|         isLVUp = True  | 
|         EventShell.EventRespons_RefineStoveUp(curPlayer, alchemyLV)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyExp, alchemyExp)  | 
|     if not isLVUp:  | 
|         return False  | 
|   | 
|     GameWorld.DebugLog("Éý¼¶ºóÊ£Óà¾Ñ飺 %s" % alchemyExp, curPlayer.GetPlayerID())  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyLV, alchemyLV)  | 
|     PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_AlchemyLV, alchemyLV)  | 
|     return True  | 
|   | 
|   | 
| def Sycn_AlchemyMsg(curPlayer, alchemyID=0, isAll=True, itemID=0, itemCnt=0):  | 
|     # Í¨Öª¿Í»§¶ËÁ¶µ¤Â¯ÐÅÏ¢  | 
|     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)  | 
|         StoveInfo.AlchemyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyTimes % 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):  | 
|     # ¹ûʵ¼Ó³É  | 
|     allAttrYaoList = [{} for _ in range(4)]  | 
|     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)  | 
|     return  | 
|   | 
|   | 
| #// A5 14 Æí¸£µ¤Ò© #tagCMPrayElixir  | 
| #  | 
| #struct    tagCMPrayElixir  | 
| #  | 
| #{  | 
| #    tagHead        Head;  | 
| #};  | 
| def PlayerPrayElixir(index, clientPack, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     prayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)  | 
|     limitCnt = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_PrayElixir)  | 
|     if prayCnt >= limitCnt:  | 
|         GameWorld.DebugLog('½ñÈÕÆí¸£µ¤Ò©´ÎÊýÒÑÂú£¡prayCnt=%s' % prayCnt)  | 
|         return  | 
|     packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)  | 
|     if not packSpace:  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")  | 
|         return  | 
|   | 
|     alchemyItemList = IpyGameDataPY.GetFuncEvalCfg('GodAlchemy')  | 
|   | 
|     newItemInfoList = []  | 
|     for itemInfo in alchemyItemList:  | 
|         itemID = itemInfo[1]  | 
| #        if not GetIsCanOutByAlchemyLV(curPlayer, itemID):  | 
| #            #GameWorld.DebugLog('Æí¸£µ¤Ò©,Á¶µ¤µÈ¼¶Î´´ïµ½£¬ÒƳý²ú³ö¿â£¡itemID=%s'%itemID)  | 
| #            continue  | 
|         if PlayerAttrFruit.IsFruitEatFull(curPlayer, itemID):  | 
|             #GameWorld.DebugLog('Æí¸£µ¤Ò©,ʹÓôÎÊýÒÑÂú£¬ÒƳý²ú³ö¿â£¡itemID=%s'%itemID)  | 
|             continue  | 
|         newItemInfoList.append(itemInfo)  | 
|     if not newItemInfoList:  | 
|         GameWorld.DebugLog('Æí¸£µ¤Ò©,ûÓе¤Ò©¿É²ú³ö£¡£¡')  | 
|         return  | 
|   | 
|     makeItemInfo = GameWorld.GetResultByWeightList(newItemInfoList)  | 
|     if not makeItemInfo:  | 
|         GameWorld.DebugLog("Æí¸£µ¤Ò©£¬ ½á¹û´íÎó£¡")  | 
|         return  | 
|   | 
|     makeItemID, itemCount = makeItemInfo  | 
|     makeItemData = GameWorld.GetGameData().GetItemByTypeID(makeItemID)  | 
|     if not makeItemData:  | 
|         return  | 
|   | 
|     costMoney = IpyGameDataPY.GetFuncCfg('GodAlchemy', 2)  | 
|     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],  | 
|                                  event=[ChConfig.ItemGive_Refine, False, {}])  | 
|     #GameWorld.DebugLog('makeItemID=%s,newItemInfoList=%s'%(makeItemID, newItemInfoList))  | 
|   | 
|     #×ÏÉ«¼°ÒÔÉÏÈ«·þ¹ã²¥  | 
|     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, "BlastfurnaceBlessing", [curPlayer.GetPlayerName(), makeItemID])  | 
|   | 
|     #¸üдÎÊý  | 
|     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 = ChPyNetSendPack.tagMCPrayElixirResult()  | 
|     pack.PrayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)  | 
|     pack.ItemID = itemID  | 
|     NetPackCommon.SendFakePack(curPlayer, pack)  | 
|     return  |