| #!/usr/bin/python  | 
| #-*- coding: GBK -*-  | 
| #----------------------------------------------------------------------------------------------------  | 
| #  | 
| #----------------------------------------------------------------------------------------------------  | 
| #  | 
| ##@package PlayerProduce  | 
| # @todo: Íæ¼ÒÉú²úϵͳ  | 
| #  | 
| # @author chenxuewei  | 
| # @date 2011-03-18 15:00  | 
| # @version 1.7  | 
| #@note: Íæ¼ÒÉú²úϵͳ  | 
| #  | 
| # @change: "2013-06-13 15:30" wdb È¥³ý·ÖÀ࣬Ôö¼ÓÊÖÐø·Ñ¸ÅÂÊ  | 
| # @change: "2014-08-12 11:00" xmnathan Ð޸ĺϳÉÌáʾ  | 
| # @change: "2014-10-27 18:00" xmnathan ºÏ³ÉÔÊÐí×Ô¶¯×êʯ¹ºÂò£¬ÅäÖà  | 
| # @change: "2014-10-28 11:34" xmnathan Ôö¼ÓºÏ³É³É¹¦ºóÈ«·þ¹ã²¥ÅäÖà  | 
| # @change: "2014-12-05 20:30" hxp ºÏ³ÉÄ¿±êÎïÖ§³Ö±ýÍ¼Ëæ»ú¸øÎïÆ·  | 
| # @change: "2015-01-14 12:30" hxp Ôö¼Ó×Ô¶¯¹ºÂòÏûºÄÁ÷Ïò  | 
| # @change: "2016-10-08 18:00" hxp ×Ô¶¯¹ºÂòÎïÆ·¼Û¸ñͳһȡÉ̳ÇÎïÆ·¼Û¸ñ  | 
| #------------------------------------------------------------------------------   | 
| """Version = 2016-10-08 18:00"""  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GameWorld  | 
| import IPY_GameWorld  | 
| import ChConfig  | 
| import ReadChConfig  | 
| import PetControl  | 
| import GameMap  | 
| import PlayerControl  | 
| import ShareDefine  | 
| import ItemControler  | 
| import BuffSkill  | 
| import random  | 
| import ItemCommon  | 
| import SkillCommon  | 
| import DataRecordPack  | 
| import PlayerSuperMarket  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö  | 
| #---------------------------------------------------------------------  | 
| #Â߼ʵÏÖ  | 
|   | 
|   | 
| #{µØÍ¼id:[[¸ÅÂÊ,²ÄÁÏid,ÊýÁ¿,ÊÇ·ñ°ó¶¨], [¸ÅÂÊ,²ÄÁÏid,ÊýÁ¿,ÊÇ·ñ°ó¶¨], [¸ÅÂÊ,²ÄÁÏid,ÊýÁ¿,ÊÇ·ñ°ó¶¨]¡¡]}  | 
| Def_PlayerProduceResultDic = ReadChConfig.GetEvalChConfig('PlayerProduceResult')  | 
|   | 
| #===================================================================================================  | 
| # //03 32 Éú²úϵͳ¿ª¹Ø#tagCProductionActive  | 
| # tagProductionActive    * GettagCProductionActive();  | 
| #   | 
| # class IPY_CProductionActive  | 
| # {  | 
| # public:  | 
| #   | 
| #    //¿ª1¹Ø0״̬  | 
| #    BYTE GetState();  | 
| # };  | 
| #===================================================================================================  | 
| ## ¿Í»§¶Ë·â°üÏìÓ¦  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #  @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 32 Éú²úϵͳ¿ª¹Ø#tagCProductionActive  | 
| def ProductionActive(index, tick):  | 
|       | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     pack = IPY_GameWorld.IPY_CProductionActive()  | 
|       | 
|     curProduction = pack.GetState()  # //¿ª1¹Ø0״̬  | 
|       | 
|     if curProduction:  | 
|         #¿ªÆô²É¼¯  | 
|           | 
|         if not __IsCanProduce(curPlayer):  | 
|             #²»¿É²É¼¯Éú²ú£¬Ìø³ö  | 
|             return  | 
|           | 
|         #֪ͨ¿ªÊ¼²É¼¯Éú²ú  | 
|         PlayerControl.Sync_PrepareBegin(curPlayer, ChConfig.Def_ProducePortalTime, ShareDefine.Def_PstProduce)  | 
|           | 
|     else:  | 
|         #¹Ø±Õ²É¼¯  | 
|           | 
|         #Çå³ýÉú²ú²É¼¯BUF  | 
|         PlayerControl.DelProduceBuff(curPlayer, tick)  | 
|           | 
|     return  | 
|   | 
|   | 
| ## Íæ¼Ò²É¼¯Éú²ú×¼±¸Íê±Ï  | 
| #  @param curPlayer£ºµ±Ç°Íæ¼Ò¶ÔÏó  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| #  @remarks Íæ¼Ò²É¼¯Éú²ú×¼±¸Íê±Ï  | 
| def OnProduceEnd(curPlayer, tick):  | 
|       | 
|     #»ñµÃ1¸ñ·¶Î§ÄÚµÄplayer¶ÔÏóÁÐ±í  | 
|     findPlayerObjList = GameMap.GetAreaGameObjByType(curPlayer.GetPosX(), curPlayer.GetPosY(), \  | 
|                                                    ChConfig.Def_Matrix_One, [IPY_GameWorld.gotPlayer])  | 
|       | 
|     for curPlayerObj in findPlayerObjList:  | 
|         #»ñÈ¡Íæ¼ÒʵÀý  | 
|         findPlayer = GameWorld.GetObj(curPlayerObj.GetID(), curPlayerObj.GetGameObjType())  | 
|           | 
|         if not findPlayer:  | 
|             continue  | 
|           | 
|         if findPlayer.GetPlayerAction() == IPY_GameWorld.paProduce:  | 
|             #¸ÃÍæ¼ÒÕýÔڲɼ¯Éú²úÖÐ  | 
|               | 
|             #¸½½üÒѾÓÐÍæ¼ÒÔڲɼ¯ÁË£¬ÇëÁíѰµØµã!  | 
|             PlayerControl.NotifyCode(curPlayer, "Collect_lhs_161795")  | 
|             #֪ͨ¿Í»§¶Ë(½«½ø¶ÈÌõ½çÃæ¹Ø±Õ)  | 
|             curPlayer.Sync_PrepareEnd()  | 
|             return  | 
|       | 
|     #ÕÙ»½»Ø³öÕ½µÄ³èÎï  | 
|     PetControl.ReCallFightPet(curPlayer)  | 
|       | 
|     #2011-04-07-chenxuewei-Ìí¼ÓÁ½¸öbuff£¬µÚÒ»¸öBuff²»Ë¢ÐÂÊôÐÔ£¬µÚ¶þ¸öÔÙË¢  | 
|     #Ìí¼ÓÉú²úbuff(ID20021)  | 
|     SkillCommon.AddBuffBySkillType_NoRefurbish(curPlayer, ChConfig.Def_ProduceBuffID, tick)  | 
|     #¸øÍæ¼Ò¼Ó»î¶¯ÎÞµÐBuff  | 
|     SkillCommon.AddBuffBySkillType(curPlayer, ChConfig.Def_SkillID_ActionWuDi, tick)  | 
|       | 
| #    curSkill = GameWorld.GetGameData().GetSkillBySkillID(ChConfig.Def_ProduceBuffID)  | 
| #      | 
| #    if not curSkill:  | 
| #        GameWorld.ErrLog("ûÓÐÕÒµ½Éú²ú²É¼¯buff£¬skillTypeID = %s"%ChConfig.Def_ProduceBuffID)  | 
| #        return  | 
| #      | 
| #    BuffSkill.DoAddBuff(curPlayer, IPY_GameWorld.bfActionBuff, curSkill, tick)  | 
|       | 
|     #ÉèÖõ±Ç°½øÈëÉú²ú²É¼¯×´Ì¬µÄtick  | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_Produce, tick)  | 
|     #ÉèÖÃÍæ¼Ò½øÈëÉú²ú²É¼¯×´Ì¬  | 
|     PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paProduce)  | 
|     #֪ͨ¿Í»§¶Ë  | 
|     curPlayer.Notify_ProductionState(ChConfig.Def_EnterProduction)  | 
|     #ͨ¹ý´òÔì»ØÓ¦·â°ü֪ͨ²É¼¯Éú²ú½øÐÐÖÐ  | 
|     curProduceState = 0  # µ±Ç°²É¼¯×´Ì¬Îª¿ªÊ¼²É¼¯Éú²ú½øÐÐÖÐ  | 
|     curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitProduceResult, curProduceState)  | 
|     return  | 
|   | 
|       | 
| ##Ñ»·´¦Àí²É¼¯Éú²úʱ¼ä  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return None  | 
| # @remarks Ñ»·´¦Àí²É¼¯Éú²úʱ¼ä  | 
| def PlayerProduceTime(curPlayer, tick):  | 
|       | 
|     if curPlayer.GetPlayerAction() != IPY_GameWorld.paProduce:  | 
|         #Íæ¼Òµ±Ç°×´Ì¬²»ÔÚÉú²ú²É¼¯£¬²»´¦Àí  | 
|         return  | 
|       | 
|     #10Ãë´¦ÀíÒ»´Î²É¼¯Éú²úʱ¼ä  | 
|     lastTick = curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_Produce)  | 
|       | 
|     pastTick = tick - lastTick  | 
|       | 
|     if pastTick < ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_Produce]:  | 
|         #ûÓе½Ë¢Ð¼ä¸ô  | 
|         return  | 
|       | 
|     curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_Produce, tick)  | 
|       | 
|     #²É¼¯Éú²úÂß¼´¦Àí  | 
|     isSucceed = DoLogic_ProduceResult(curPlayer)    | 
|     #ͨ¹ý´òÔì»ØÓ¦·â°ü֪ͨ²É¼¯Éú²ú½øÐÐÖУ¨Ê±»úΪ¿Í»§¶ËÀ²É¼¯½øÐÐÖеĽø¶ÈÌõ£©  | 
|     curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitProduceResult, isSucceed)  # ²ÎÊýΪÉÏÒ»´Î²É¼¯ÊÇ·ñ³É¹¦  | 
|     return  | 
|   | 
|   | 
| ##²É¼¯Éú²ú½á¹û  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ²É¼¯ÊÇ·ñ³É¹¦  | 
| # @remarks °´²ß»®ÅäÖõļ¸ÂÊÅж¨ÊÇ·ñ¸øÍæ¼ÒÎïÆ·  | 
| def DoLogic_ProduceResult(curPlayer):   | 
|     #·À³ÁÃÔ  | 
|     if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Wallow_LV) > ChConfig.Def_GameWallow_LV_First:  | 
|         PlayerControl.NotifyCode(curPlayer, "AvoidSink09")  | 
|         return False  | 
|          | 
|     mapID = curPlayer.GetMapID()  | 
|       | 
|     if mapID not in Def_PlayerProduceResultDic.keys():  | 
|         GameWorld.ErrLog("error: PlayerProduceResult.txtÅäÖôíÎó£¬PlayerProduceResult(%s) cannot find \  | 
|                           mapID(%s)"%(Def_PlayerProduceResultDic, mapID))  | 
|         return False  | 
|           | 
|     produceResultList = Def_PlayerProduceResultDic[mapID]  | 
|       | 
|     ranCnt = random.randint(0, 10000)  # Ëæ»úÖµ  | 
|     produceID = 0      # ²É¼¯²ÄÁÏID  | 
|     produceCnt = 0     # ²É¼¯²ÄÁÏÊýÁ¿  | 
|     produceIsBind = 0  # ²É¼¯²ÄÁÏÊÇ·ñ°ó¶¨  | 
|       | 
|     for infoList in produceResultList:  | 
|           | 
|         if len(infoList) < 4:  | 
|             GameWorld.ErrLog("error:PlayerProduceResult.txtÅäÖôíÎó£¬len(infoList) < 2 (%s)"%produceResultList)  | 
|             continue  | 
|           | 
|         if ranCnt <= infoList[0]:  | 
|             produceID = infoList[1]  | 
|             produceCnt = infoList[2]  | 
|             produceIsBind = infoList[3]  | 
|             break  | 
|       | 
|     if produceID <= 0 or produceCnt <= 0:  | 
|         #²É¼¯Ê§°Ü!  | 
|         PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_20296")  | 
|         return False  | 
|       | 
|     #¸øÍæ¼ÒÎïÆ·  | 
|     if not ItemControler.GivePlayerItem(curPlayer, produceID, produceCnt, produceIsBind,   | 
|                                                                      [IPY_GameWorld.rptItem]):  | 
|         #±³°ü¿Õ¼ä²»×ã!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_31379")  | 
|         return False  | 
|       | 
|     #²É¼¯³É¹¦!  | 
|     #curPlayer.Sync_GetItemView(produceID, produceCnt)  | 
|     #PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_827276")  | 
|     #PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [produceID, produceCnt])  | 
|     return True  | 
|   | 
| ##ÅжÏÍæ¼ÒÊÇ·ñ¿ÉÒԲɼ¯Éú²ú  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return Íæ¼ÒÊÇ·ñ¿ÉÒÔÉú²ú  | 
| # @remarks ÅжÏÍæ¼ÒÊÇ·ñ¿ÉÒԲɼ¯Éú²ú  | 
| def __IsCanProduce(curPlayer):  | 
|     if curPlayer.GetLV() < ChConfig.Def_ProduceLVMin:  | 
|         #µÈ¼¶²»×ã{%S1%}¼¶,²»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_287294", [ChConfig.Def_ProduceLVMin])  | 
|         return False  | 
|       | 
|     if not curPlayer.GetMapBuff().FindBuff(ChConfig.Def_SkillID_Produce):  | 
|         #µ±Ç°ÇøÓòÎÞ·¨½øÐвɼ¯£¡  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_0")  | 
|         return False  | 
|       | 
|     if curPlayer.IsMoving():  | 
|         #ÒÆ¶¯Öв»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_474794")  | 
|         return False  | 
|       | 
|     if curPlayer.GetHP() <= 0:  | 
|         #½ÇÉ«ËÀÍö²»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_70569")  | 
|         return False  | 
|       | 
|     curPlayerState = curPlayer.GetPlayerAction()  | 
|       | 
|     if curPlayerState == IPY_GameWorld.paAttack or curPlayer.IsBattleState():  | 
|         #Õ½¶·Öв»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_840854")  | 
|         return False  | 
|       | 
|     if curPlayerState == IPY_GameWorld.paTrade:  | 
|         #½»Ò×Öв»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_59724")  | 
|         return False  | 
|       | 
|     if curPlayerState == IPY_GameWorld.paSit:  | 
|         #µ÷Ï¢Öв»Äܲɼ¯!  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_lhs_293296")  | 
|         return False  | 
|   | 
|     #Óн»Í¨¹¤¾ß²»Èòɼ¯  | 
|     if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull:  | 
|         PlayerControl.NotifyCode(curPlayer, "Collect_max_dante_0")  | 
|         return False  | 
|           | 
|     if PlayerControl.IsPlanStateNull(curPlayer):  | 
|         #¿ÕÏÐ״̬£¬¿É²É¼¯  | 
|         return True  | 
|       | 
|     #Äúµ±Ç°Ëù´¦µÄ״̬²»Äܲɼ¯!  | 
|     PlayerControl.NotifyCode(curPlayer, "Collect_lhs_917284")  | 
|     return False  | 
|       | 
|   | 
| #===================================================================================================  | 
| # //03 33 ¿ªÊ¼ÖÆÔìÉú²úÎïÆ·#tagCStartProduce  | 
| # tagCStartProduce    * GettagCStartProduce();  | 
| #   | 
| # class IPY_CStartProduce  | 
| # {  | 
| # public:  | 
| #   | 
| #    //ÀàÐÍ  | 
| #    int GetType();  | 
| #    //ÎïÆ·ID  | 
| #    int GetItemID();  | 
| #    //ÖÆÔìÊýÁ¿  | 
| #    int GetCount();  | 
| # };  | 
| #===================================================================================================  | 
| ## ¿Í»§¶Ë·â°üÏìÓ¦  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #  @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 33 ¿ªÊ¼ÖÆÔìÉú²úÎïÆ·#tagCStartProduce  | 
| def StartProduce(index, tick):  | 
|     GameWorld.GetPsycoFunc(__Func_StartProduce)(index, tick)  | 
|     return  | 
|   | 
|   | 
| ## ¿Í»§¶Ë·â°üÏìÓ¦  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #  @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //03 33 ¿ªÊ¼ÖÆÔìÉú²úÎïÆ·#tagCStartProduce  | 
| def __Func_StartProduce(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_ProduceMakeItemTime, tick):  | 
|         #¼ä¸ôδµ½  | 
|         return  | 
|       | 
|     #---´¦Àí·â°ü---  | 
|     pack = IPY_GameWorld.IPY_CStartProduce()  | 
| #    curProduceType = pack.GetType()      # ÀàÐÍ(Óë¿Í»§¶ËÔ¼¶¨0£º²ÄÁϼӹ¤£»1£ºµ¤Ò©ºÏ³É)  | 
|     curProduceItemID = pack.GetItemID()  # ÎïÆ·ID  | 
|     curProduceCnt = pack.GetCount()    # ÖÆÔìÊýÁ¿  | 
|     useBind = pack.GetUseBind()    # ÊÇ·ñʹÓÃ°ó¶¨  | 
|     autoBuy = pack.GetAutoBuy()    #ÊÇ·ñ×Ô¶¯¹ºÂò²ÄÁÏ  | 
|     if useBind not in [0, 1]:  | 
|         return  | 
|   | 
|     #{ºÏ³ÉºóµÄÎïÆ·id:[[ËùÐè²ÄÁÏid,ÊýÁ¿], [ËùÐè²ÄÁÏid,ÊýÁ¿], [ËùÐè²ÄÁÏid,ÊýÁ¿]......]}  | 
|     composeDic = ReadChConfig.GetEvalChConfig('ProduceCompose')  | 
|     if curProduceItemID not in composeDic:  | 
|         return  | 
|       | 
|     DoLogic_Produce(curPlayer, curProduceItemID, curProduceCnt, composeDic[curProduceItemID], useBind, autoBuy)  | 
|     return  | 
|   | 
|   | 
| ## Ö´ÐвÄÁϼӹ¤Âß¼  | 
| #  @param curPlayer£ºÍæ¼ÒʵÀý  | 
| #  @param curProduceItemID£ººÏ³ÉºóµÄÎïÆ·ID  | 
| #  @param curProduceCnt£ººÏ³ÉÎïÆ·µÄÊýÁ¿  | 
| #  @param configInfo£ººÏ³ÉÐèÇóÐÅÏ¢ÁÐ±í  | 
| #  @param useBind ÊÇ·ñʹÓð󶨠  | 
| #  @param autoBuy ÊÇ·ñ×Ô¶¯¹ºÂò  | 
| #  @return   | 
| def DoLogic_Produce(curPlayer, curProduceItemID, curProduceCnt, configInfo, useBind, autoBuy):  | 
|     itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)  | 
|       | 
|     #(ÊÖÐø·Ñ, ¸ÅÂÊ, [[ËùÐè²ÄÁÏid,ÊýÁ¿,×Ô¶¯¹ºÂò¼Û¸ñ], [ËùÐè²ÄÁÏid,ÊýÁ¿,×Ô¶¯¹ºÂò¼Û¸ñ]...],"È«·þÌáʾ",Ëæ»ú±ýͼÎïÆ·Áбí)  | 
|     needMoney, successRate, needStuffList, notifyMark, randomItemList = configInfo  | 
|     needMoney, moneyType = needMoney*curProduceCnt, IPY_GameWorld.TYPE_Price_Silver_Money  | 
|       | 
|     if needMoney > 0 and not PlayerControl.HaveMoney(curPlayer, moneyType, needMoney):  | 
|         return  | 
|       | 
|     hasEnough, reduceItemList, isBind, autoBuyMoney, eventItemID, eventLackCnt = \  | 
|         __ParseStuff(curPlayer, itemPack, curProduceItemID, curProduceCnt, needStuffList, useBind)  | 
|     if not hasEnough:  | 
|         if not autoBuy:  | 
|             #¶Ô²»Æð,ÄúµÄ²ÄÁϲ»×ã,²Ù×÷ÎÞЧ!  | 
|             PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_481766")  | 
|             return  | 
|         else:  | 
|             if autoBuyMoney <= 0 or \  | 
|              not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, autoBuyMoney):   | 
|                 PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_481766")  | 
|                 return  | 
|               | 
|     if autoBuyMoney > 0:  | 
|         PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, autoBuyMoney, ChConfig.Def_Cost_BuyStoreItem,   | 
|                                {"ProduceItemID":curProduceItemID, ChConfig.Def_Cost_Reason_SonKey:eventItemID}, eventLackCnt)  | 
|       | 
|     result = 0  | 
|     notifyItemID = curProduceItemID  | 
|     # ²»ÅжϸÅÂÊ£¬»ò¸ÅÂʳɹ¦  | 
|     if successRate <= 0 or GameWorld.CanHappen(successRate, ShareDefine.Def_MaxRateValue):  | 
|         proIemCntDict = {}  | 
|         # Èç¹ûÓÐËæ»úºÏ³ÉÎïÆ·±ýͼ¸ÅÂÊÁÐ±í  | 
|         if randomItemList:  | 
|             # ÏÈËæ»ú³öËùÓеÄÎïÆ·½á¹û£¬¼õÉÙÉú²ú´ÎÊý¼°·¢°ü´ÎÊý  | 
|             for i in range(curProduceCnt):  | 
|                 randItemID = GameWorld.GetResultByRandomList(randomItemList, curProduceItemID)  | 
|                 proIemCntDict[randItemID] = proIemCntDict.get(randItemID, 0) + 1  | 
|         else:  | 
|             proIemCntDict[curProduceItemID] = curProduceCnt  | 
|               | 
|         for proItemID, proCnt in proIemCntDict.items():  | 
|             # ¸øºÏ³ÉÎïÆ·²»³É¹¦  | 
|             if not ItemControler.GivePlayerItem(curPlayer, proItemID, proCnt, isBind,   | 
|                                                 [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], True):  | 
|                 #±³°ü¿Õ¼ä²»×ã!  | 
|                 PlayerControl.NotifyCode(curPlayer, "Collect_lhs_31379")          | 
|                 break  | 
|               | 
|             result = 1  | 
|             notifyItemID = proItemID  | 
|             #Äã»ñµÃxxÎïÆ·xx¸ö!  | 
|             #PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [proItemID, proCnt])  | 
|   | 
|     if needMoney > 0:  | 
|         PlayerControl.PayMoney(curPlayer, moneyType, needMoney, ChConfig.Def_Cost_ItemProduce,   | 
|                                {ChConfig.Def_Cost_Reason_SonKey:curProduceItemID})  | 
|                    | 
|     # ¿Û³ý²ÄÁÏ  | 
|     for stuffList in reduceItemList:  | 
|         ItemCommon.ReduceItem(curPlayer, itemPack, stuffList[0], stuffList[1], isBind)  | 
|       | 
|     curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitMaterialCompound, result)  | 
|       | 
|     #°´ÅäÖ÷¢ËÍÈ«·þÌáʾÐÅÏ¢ ²ÎÊý Íæ¼ÒÃû ºÏ³ÉºóÎïÆ·ID  | 
|     if notifyMark:  | 
|         PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName(), str(notifyItemID)])  | 
|     return  | 
|       | 
|       | 
| ## ½âÎö²ÄÁϼӹ¤  | 
| #  @param curPlayer£ºÍæ¼ÒʵÀý  | 
| #  @param itemPack£ºÎïÆ·±³°ü  | 
| #  @param curProduceItemID£ººÏ³ÉºóµÄÎïÆ·ID  | 
| #  @param curProduceCnt£ººÏ³ÉÎïÆ·µÄÊýÁ¿  | 
| #  @param needStuffInfoList£ººÏ³ÉËùÐè²ÄÁϵÄÐÅÏ¢ÁÐ±í  | 
| #  @param useBind ÊÇ·ñʹÓð󶨠  | 
| #  @return (ÊÇ·ñÓÐ×ã¹»µÄ²ÄÁϼӹ¤, ²ÄÁϼӹ¤ÎïÆ·ÐÅÏ¢Áбí)  | 
| #  @remarks ½âÎö²ÄÁϼӹ¤  | 
| def __ParseStuff(curPlayer, itemPack, curProduceItemID, curProduceCnt, needStuffInfoList, useBind):  | 
|     isEnough = True  # ÊÇ·ñÓÐ×ã¹»µÄ²ÄÁÏ  | 
|     stuffList = []  | 
|     isBind = False  | 
|     autoBuyMoney = 0  | 
|     eventItemID = 0  | 
|     eventLackCnt = 0  | 
|       | 
|     #È¡µÃ°ó¶¨±êʶ  | 
|     useBindMark = ItemCommon.UseStuffMode_NoBind  | 
|     if useBind == 1:  | 
|         useBindMark = ItemCommon.UseStuffMode_All  | 
|           | 
|     for stuffInfoList in needStuffInfoList:  | 
|           | 
|         if len(stuffInfoList) < 3:  | 
|             GameWorld.ErrLog("error: curProduceItemID(%s):len(stuffInfoList)< 2 ,\  | 
|                               %s"%(curProduceItemID, needStuffInfoList))  | 
|             isEnough = False  | 
|             stuffList = []  | 
|             autoBuyMoney = 0  | 
|             break  | 
|           | 
|         needStuffID = stuffInfoList[0]  | 
|         needStuffCnt = stuffInfoList[1] * curProduceCnt  | 
|         stuffPrice = PlayerSuperMarket.GetStoreItemPrice(needStuffID, IPY_GameWorld.TYPE_Price_Gold_Money)  | 
|           | 
|         hasEnough, useItemList, tmpBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(needStuffID, itemPack, \  | 
|                                                                               needStuffCnt, useBindMark)  | 
|         if not hasEnough:  | 
|             if stuffPrice <= 0:  | 
|                 #²ÄÁϲ»×ãÇÒ²»ÔÊÐí×Ô¶¯¹ºÂò  | 
|                 isEnough = False  | 
|                 stuffList = []  | 
|                 autoBuyMoney = 0  | 
|                 break  | 
|             else:  | 
|                 #²ÄÁϲ»×ã²¢ÇÒÓÐ×Ô¶¯¹ºÂò¼Û¸ñ  | 
|                 isEnough = False  | 
|                 autoBuyMoney = autoBuyMoney + stuffPrice*lackCnt  | 
|                 eventItemID = needStuffID  | 
|                 eventLackCnt = lackCnt  | 
|                   | 
|           | 
|         #Èç¹ûÓÐÒ»ÖÖ²ÄÁÏÊǰ󶨵ÄÔòºÏ³öÀ´µÄ½á¹û¾ÍÊÇ°ó¶¨  | 
|         if not isBind and tmpBind:  | 
|             isBind = True  | 
|               | 
|         stuffList.append([useItemList, needStuffCnt])  | 
|       | 
|     return (isEnough, stuffList, isBind, autoBuyMoney, eventItemID, eventLackCnt)  | 
|           | 
|           | 
|          |