xdh
2018-08-14 d1ad5d9c180f06127775498044c239d980689dbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
#!/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)