xdh
2019-01-28 8305e47be942c376430044332780e6e69a3c7a7f
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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
##@package PlayerGameEvent
#СÓÎϷʼþÂß¼­´¦Àí
#
# @author ifo
# @date 2010-4-23
# @version 2.1
#
# @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ
# @change: "2010-05-26 14:27" panwei ¿ªÆôµöÓã, ×¢Ê͵ô»Æ½ðС·¹ÍŵÈÔö¼ÓСÓÎÏ·¾­ÑéµÄÎïÆ·
# @change: "2010-07-09 17:55" panwei ¹Ø±ÕÑæ»ð¹¦ÄÜ
# @change: "2010-09-01 16:40" panwei Ð¡ÓÎϷʼþÂß¼­Öع¹
# @change: "2010-11-22 12:15" Alee ÏÞÖÆÐ¡ÓÎÏ·
# @change: "2010-12-07 12:00" Alee Í¨¹ý¶¯×÷»ñµÃ¶¯×÷λÐÞÕý
# @change: "2010-12-28 17:30" panwei »ñÈ¡¾­ÑéÐÂÔöÇþµÀ, º¬É±¹Ö, ÓÎÏ·, ÈÎÎñ 
# @change: "2011-05-03 15:40" panwei µöÓãÕٻسèÎï
# @change: "2011-07-01 12:40" Alee ·À³ÁÃÔÏÞÖÆ
# @change: "2013-09-10 20:10" Alee ÏµÍ³Ìáʾ³åÍ»
# @change: "2015-07-01 18:00" hxp µöÓãÐÞ¸Ä
#---------------------------------------------------------------------
"""Version = 2015-07-01 18:00"""
#------------------------------------------------------------------------------ 
import ShareDefine
import ChConfig
import IPY_GameWorld
import GameWorld
import random
import ItemControler
import PlayerControl
import EventShell
import ItemCommon
import GameDataControl
import OperControlManager
import PetControl
import ReadChConfig
import DataRecordPack
import ChPyNetSendPack
import NetPackCommon
import PyMapTable
import NPCCommon
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
## ¿ªÊ¼Ð¡ÓÎϷʼþ 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param eventType Ê¼þÀàÐÍ
#  @param tick µ±Ç°Ê±¼ä
#  @return ÎÞ·µ»ØÖµ
#  @remarks ¿ªÊ¼Ð¡ÓÎϷʼþ
def StartGameEvent(curPlayer, eventType, tick):
    if eventType == IPY_GameWorld.geDance:
        PlayerControl.NotifyCode(curPlayer, "BeginDance")
    
    elif eventType == IPY_GameWorld.geFish:
        #PlayerControl.NotifyCode(curPlayer, "BeginFishing")
        pass
    
    else:
        GameWorld.ErrLog('StartGameEvent unKnowType = %s'%(eventType))
        return
     
    #Çå³ýµã»÷¶ÔÏó
    curPlayer.SetActionObj(None)
    #ÖжÏÕ½¶·¶ÔÖÅ
    PlayerControl.ExitPlayerConfronting(curPlayer)
    #ÕÙ»½»Ø³öÕ½µÄ³èÎï
    PetControl.ReCallFightPet(curPlayer)
    
    #¿ªÊ¼ÓÎϷʼþ
    curPlayer.SetGameEventTick(tick)
    curPlayer.SetFishEventTick(tick)
    curPlayer.SetDanceEventTick(tick)
    
    curPlayer.SetPlayerGameEvent(eventType)
    __PutonFishermanEquipment(curPlayer)
    curPlayer.View_StartGameEvent(eventType)
    GameWorld.DebugLog("StartGameEvent...")
    return
 
##»ñÈ¡Óæ·ò×°ID
# @param curPlayer Íæ¼ÒʵÀý
# @return
def GetFishermanCoatID(curPlayer):
    jobType = ChConfig.JOB_TYPE_DICT[curPlayer.GetJob()]
    jobCoatIDDict = ReadChConfig.GetEvalChConfig("FisherClothes")
    return jobCoatIDDict.get(jobType, [0, 0])
 
##´©ÉÏÓæ·ò×°±¸
# @param curPlayer Íæ¼ÒʵÀý
# @return
def __PutonFishermanEquipment(curPlayer):
    return
 
##¸øÎ±×°Ê±×°
# @param curPlayer Íæ¼ÒʵÀý
# @return
def __AssignItem(curPlayer, index, itemID):
    equipePack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
    destItem = equipePack.GetAt(index)
    
    destItem.Clear()
    
    tagItem = ItemCommon.CreateSingleItem(itemID)
    if tagItem == None:
        # ÎÞ´ËÎïÆ·
        GameWorld.ErrLog('Can not find item, itemID=%s' % itemID)
        return False
 
    destItem.AssignItem(tagItem)
 
    curPlayer.ChangeEquip(itemID, index, 0, 0, 0, destItem.GetUserData())
    return True
 
##ÍÑÏÂÓæ·ò×°±¸
# @param curPlayer Íæ¼ÒʵÀý
# @return
def TakeoffFishermanEquipment(curPlayer):
    
#===============================================================================
#    clothesID, weaponID = GetFishermanCoatID(curPlayer)
#    equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
#    
#    clothesCoatItem = equipPack.GetAt(IPY_GameWorld.retClothesCoat)
#    if clothesCoatItem and not clothesCoatItem.IsEmpty() and clothesCoatItem.GetItemTypeID() == clothesID:
#        clothesCoatItem.Clear()
#        curPlayer.Sync_UnEquipItem(clothesID, IPY_GameWorld.retClothesCoat)
#        GameWorld.DebugLog("    TakeoffFishermanEquipment clothesID=%s" % clothesID)
#        
#    weaponCoatItem = equipPack.GetAt(IPY_GameWorld.retWeaponCoat)
#    if weaponCoatItem and not weaponCoatItem.IsEmpty() and weaponCoatItem.GetItemTypeID() == weaponID:
#        weaponCoatItem.Clear()
#        curPlayer.Sync_UnEquipItem(weaponID, IPY_GameWorld.retWeaponCoat)
#        GameWorld.DebugLog("    TakeoffFishermanEquipment weaponID=%s" % weaponID)
#===============================================================================
        
    return
#---------------------------------------------------------------------
## Í£Ö¹Íæ¼ÒСÓÎϷʼþ
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param tick Ê±¼ä´Á
#  @return ÎÞ·µ»ØÖµ
#  @remarks Í£Ö¹Íæ¼ÒСÓÎϷʼþ
def StopGameEvent(curPlayer, tick):
    curPlayer.SetPlayerGameEvent(IPY_GameWorld.geNull)
    curPlayer.View_StartGameEvent(IPY_GameWorld.geNull)
    
    #Èç¹ûÔÚÓÎÏ·ÖÐ,ÉèÖÃΪ¿ÕÏÐ״̬
    if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
        PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
        
    TakeoffFishermanEquipment(curPlayer)
    GameWorld.DebugLog("StopGameEvent...")
    return
#---------------------------------------------------------------------
## ¼ì²âÊÇ·ñ¿ÉÒÔ¿ªÊ¼Ð¡ÓÎÏ·Âß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param tick µ±Ç°Ê±¼ä
#  @return ²¼¶ûÖµ
#  @remarks ¼ì²âÊÇ·ñ¿ÉÒÔ¿ªÊ¼Ð¡ÓÎÏ·Âß¼­  
def CheckCanBeginGameEvent(curPlayer, tick):
    #---ÑéÖ¤Íæ¼Ò»ù´¡×´Ì¬---
    
    if curPlayer.GetPlayerAction() not in ChConfig.Def_Player_StartGameEvent_State:
        return False 
    
    #---ÑéÖ¤Íæ¼ÒÌØÊâ״̬---
    
    if curPlayer.IsMoving():
        #PlayerControl.NotifyCode(curPlayer, "GeRen_lhs_0")
        return False
    
    return True
#---------------------------------------------------------------------
## ´¦ÀíÍæ¼ÒСÓÎϷʼþ 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param tick µ±Ç°Ê±¼ä
#  @return ÎÞ·µ»ØÖµ
#  @remarks ¶¨Ê±Æ÷µ÷ÓÃ, ´¦ÀíÍæ¼ÒСÓÎϷʼþ
def ProcessGameEvent(curPlayer, tick):
    #---»ù±¾¼ì²é---
    
    if curPlayer.GetPlayerGameEvent() == IPY_GameWorld.geNull:
        return
    
    #---Ö´ÐÐСÓÎÏ·¶¯×÷---
 
    if __ProcessGameEvent(curPlayer, tick):
        return
    
    #---Ö´ÐÐСÓÎÏ·¶¯×÷ʧ°Ü, ½áÊøÐ¡ÓÎÏ·---
 
    StopGameEvent(curPlayer, tick)
    return
#---------------------------------------------------------------------
## ´¦ÀíÍæ¼ÒСÓÎϷʼþ 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param tick µ±Ç°Ê±¼ä
#  @return ²¼¶ûÖµ, ÊÇ·ñ¼ÌÐøÐ¡ÓÎϷ״̬
#  @remarks ÄÚ²¿º¯Êý, ´¦ÀíÍæ¼ÒСÓÎϷʼþ
def __ProcessGameEvent(curPlayer, tick):
    #---Íæ¼Ò״̬¼ì²é, ÊÇ·ñ»¹¿ÉÒÔ¼ÌÐøÐ¡ÓÎϷʼþ---
    curPlayerAction = curPlayer.GetPlayerAction()
 
    if curPlayerAction != IPY_GameWorld.paGameEvent:
        return False
    
    #---Íæ¼ÒÓÎϷʼþ¼ì²é---
    gameEventType = curPlayer.GetPlayerGameEvent() 
        
    if not CanProcessGameEvent(curPlayer, gameEventType, tick):
        return False
    
    #---´¦ÀíÌøÎè---
    if gameEventType == IPY_GameWorld.geDance:
        __GivePlayerGameEventReward(curPlayer, gameEventType, ChConfig.Def_Item_Type_Dance, \
                                    curPlayer.GetDanceEventTick(), ChConfig.Def_EventRewardTime, curPlayer.SetDanceEventTick, tick)
        return True
    
    #---´¦ÀíµöÓã---
    __GivePlayerGameEventReward(curPlayer, gameEventType, ChConfig.Def_Item_Type_Fish, \
                                curPlayer.GetFishEventTick(), ChConfig.Def_EventRewardTime, curPlayer.SetFishEventTick, tick)
    return True
#---------------------------------------------------------------------
## ÊÇ·ñÄܼÌÐøÓÎϷʼþ 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gameEvent ÓÎϷʼþ
#  @param tick µ±Ç°Ê±¼ä
#  @return ²¼¶ûÖµ
#  @remarks ÊÇ·ñÄܼÌÐøÓÎϷʼþ
def CanProcessGameEvent(curPlayer, gameEvent, tick):
    #---ͨÓüì²é---
    #ͨ¹ý¶¯×÷»ñµÃÏàÓ¦¶¯×÷λ
    curActBit= OperControlManager.GetActBitByAction(ChConfig.Def_ActBit_GameEvent, gameEvent)
 
    if curActBit != None:
        #À­½ø¶ÈÌõÖР״̬, ·þÎñ¶ËÏÞÖÆ
        if not OperControlManager.IsObjCanDoAction(curPlayer, 
                                                   ChConfig.Def_Obj_ActState_ServerAct, 
                                                   curActBit):
            return False
    
    #Óн»Í¨¹¤¾ß²»¿ÉÖ´ÐÐ
    #if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull:
    #    GameWorld.DebugLog("Óн»Í¨¹¤¾ß£¬²»¿ÉÖ´ÐÐСÓÎÏ·£¡")
    #    return False
    
    #---µöÓã¼ì²é---
    
    if gameEvent == IPY_GameWorld.geFish:
        # ºóÐøÓÐÐèÒªÓàGetAreaTypeByMapPosÅжÏ
        pass
        #PlayerControl.NotifyCode(curPlayer, "GeRen_hgg_542057")
        
        #if not CheckPlayerFishWeapon(curPlayer, tick):
        #    PlayerControl.NotifyCode(curPlayer, "ScarcityRod")
        #    return False
        
        #if not curPlayer.GetHaveGameBuff():
        #    PlayerControl.NotifyCode(curPlayer, "GeRen_jin_681085")
        #    return False
 
    return True
#---------------------------------------------------------------------
## ¼ì²éÍæ¼ÒµöÓ㹤¾ß 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param tick µ±Ç°Ê±¼ä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def CheckPlayerFishWeapon(curPlayer, tick):
    #µÃµ½Íæ¼ÒµÄÎäÆ÷¸ñ
    playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
    curWeapon = playerEquip.GetAt(ShareDefine.retWeapon)
 
    if curWeapon.IsEmpty():
        #ÐèÒªÓã¸Í,µ«ÊÇÍæ¼ÒûÓÐ×°±¸Óã¸Í
        #GameWorld.Log("ûÓÐ×°±¸ÎäÆ÷")
        return False
    
    #¼ì²éÊÇ·ñ×°±¸ÁËÓã¸Í
    return curWeapon.GetEffectByIndex(0).GetEffectID() == ChConfig.Def_Item_Effect_FishTool
#---------------------------------------------------------------------
## ¸øÍæ¼ÒСÓÎÏ·½±Àø 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @return ÎÞÒâÒå
#  @remarks ¸øÍæ¼ÒСÓÎÏ·½±Àø 
def AddGameEventExp(curPlayer):
    #---»ñµÃÍæ¼Ò¶ÓÎéÈËÊý(º¬×Ô¼º)---
 
    teamMemberList = PlayerControl.GetAreaTeamMember(curPlayer.GetTeam(), curPlayer.GetPosX(), curPlayer.GetPosY())
    teamMemberCnt = len(teamMemberList)
 
    #---»ñµÃReExp---
 
    #ReEXPµÄµÈ¼¶²î
    getExpLV = max(1, curPlayer.GetLV() - ChConfig.Def_GameEventExpLVDiff)
 
    givePlayerReExp = 0
 
    #---¸øÍæ¼Ò¾­Ñé---
 
    giveExp = GameWorld.GetFloatUpper(givePlayerReExp * ChConfig.Def_TeamMemberExp[teamMemberCnt])
 
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.AddExp(giveExp, ShareDefine.Def_ViewExpType_GameEvent)
    return
#---------------------------------------------------------------------
## ¸øÓèÍæ¼ÒÓÎÏ·½±ÀøÎïÆ·
#  @param curPlayer Íæ¼ÒʵÀý
#  @param giveItemType ½±ÀøÎïÆ·ÀàÐÍ
#  @return ÎÞ·µ»ØÖµ
#  @remarks ¸øÓèÍæ¼ÒÓÎÏ·½±ÀøÎïÆ·
def AddGameEventItem(curPlayer, giveItemType):
    #---¼ì²éÊÇ·ñ´ïµ½Ã¿ÈÕ×î´ó»ñÈ¡ÉÏÏÞ---
    dayCount = curPlayer.GetDayProcessGameEventCount()
    
#===============================================================================
#    #ÔÝʱ²»ÏÞÖÆÁË
#    if dayCount > ChConfig.Def_EventCount:
#        #GameWorld.Log("µ±Ç°´ÎÊý = %s,³¬¹ýÿÈÕ×î´ó´ÎÊý %s,²»ÄÜ»ñµÃÎïÆ·"%(dayCount , ChConfig.Def_EventCount))
#        return
#===============================================================================
    curPlayer.SetDayProcessGameEventCount(dayCount + 1)
    
    #---¼ì²éʼþ½±Àø¸ÅÂÊ---
    happenRate = eval(ChConfig.Def_EventRate)
    
    if not GameWorld.CanHappen(happenRate, ChConfig.Def_EventMaxRate):
        return
    
    #---¸øÍæ¼Ò½±ÀøÎïÆ·---
 
    #»ñµÃ½±Àø¸øÍæ¼ÒµÄÎïÆ·Áбí
    giveItemList = GameDataControl.GetItemDataListByType(giveItemType)
    
    if len(giveItemList) == 0:
        GameWorld.ErrLog('СÓÎϷʼþ, Êý¾Ý¿âÎÞ´ËÀàÐÍÎïÆ· giveItemType = %s'%(giveItemType))
        return
    
    #Ëæ»ú¸øÍæ¼ÒÒ»¸ö½±ÀøÎïÆ·
    giveItemData = random.choice(giveItemList)
    #ÎïÆ·ÊôÐÔ
    giveItemID = giveItemData.GetItemTypeID()
    giveItemCnt = 1
    giveItemBind = False
    #·ÅÈë±³°üË÷Òý
    packIndex = IPY_GameWorld.rptItem
    
    itemControl = ItemControler.PlayerItemControler(curPlayer)
    
    if not itemControl.CanPutInItem(packIndex, giveItemID, giveItemCnt, giveItemBind):
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packIndex])
        return
    
    giveItem = ItemCommon.CreateSingleItem(giveItemID)
    
    if giveItem == None:
        GameWorld.ErrLog("СÓÎϷʼþ, ´´ÔìÎïÆ·ID = %s, Ê§°Ü"%(giveItemID))
        return
 
    if not itemControl.PutInItem(packIndex, giveItem):
        giveItem.Clear()
        GameWorld.ErrLog('СÓÎϷʼþ,  ·ÅÈëÎïÆ·Òì³£!! itemID = %s'%(giveItemID))
        return
    
    #PlayerControl.NotifyCode(curPlayer, "ObtainRes01", [giveItemID, giveItemCnt])
    return
#---------------------------------------------------------------------
## ¸øÓèÍæ¼ÒСÓÎϷʼþ½±Àø
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param eventType Ê¼þÀàÐÍ
#  @param giveItemType ¸øÓè½±ÀøÎïÆ·ÀàÐÍ
#  @param lastTimeTick Éϴν±ÀøÊ±¼ä´Á
#  @param limitTimeGap ½±ÀøÏÞÖÆÊ±¼ä¼ä¸ô
#  @param setTickFunc ±£´æ±¾´Î½±Àøº¯Êý½á¹¹Ìå
#  @param tick µ±Ç°Ê±¼ä´Á
#  @return ÎÞ·µ»ØÖµ
#  @remarks ¸øÓèÍæ¼ÒСÓÎϷʼþ½±Àø
def __GivePlayerGameEventReward(curPlayer, eventType, giveItemType, lastTimeTick, limitTimeGap, setTickFunc, tick):
    #---¼ì²â¼ä¸ô---
    if tick - lastTimeTick < limitTimeGap:
        return
    
    setTickFunc(tick)
    
    #·À³ÁÃÔ
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Wallow_LV) > ChConfig.Def_GameWallow_LV_First:
        PlayerControl.NotifyCode(curPlayer, "AvoidSink09")
        return
    
    #---֪ͨ¿Í»§¶Ë»ñµÃ½±Àø---
    curPlayer.Sync_GameEventResult(eventType)
    
    #¸øÍæ¼Ò¾­Ñé
    AddGameEventExp(curPlayer)
    
    #¸øÍæ¼ÒÎïÆ·
    AddGameEventItem(curPlayer, giveItemType)
    
    #µ÷ÓÃÈÎÎñ´¥·¢Æ÷
    EventShell.EventRespons_OnGameEvent(curPlayer)
    return
#---------------------------------------------------------------------
 
## Ö´ÐеöÓãÂß¼­
#  @param curPlayer Íæ¼ÒʵÀý
#  @param fishType µöÓã½±ÀøÀàÐÍ
#  @return ÎÞ·µ»ØÖµ
def DoFishLogic(curPlayer, fishType):
    GameWorld.DebugLog("µöÓãÊÕ¸Ë: fishType=%s" % (fishType))
 
    fishAwardTypeDict = __GetFishAwardTypeDict(curPlayer)
    if not fishAwardTypeDict:
        return
    
    if fishType not in fishAwardTypeDict:
        return
    
    fishAwardItemList = fishAwardTypeDict[fishType]
    awardItemInfo = GameWorld.GetResultByRandomList(fishAwardItemList)
    if len(awardItemInfo) != 4:
        return
    
    #ÑéÖ¤±³°ü¿Õ¼ä
    if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    
    hasBind = False
    
    # µöÓãÏûºÄ
    costItemInfo = ReadChConfig.GetEvalChConfig("FishCostItem")
    if costItemInfo:
        costItemID, costItemCnt = costItemInfo
        if costItemID > 0 and costItemCnt > 0:
            itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
            enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(
                                                        costItemID, itemPack, costItemCnt)
            if not enough:
                GameWorld.DebugLog("µöÓãÏûºÄÎïÆ·²»×ã costItemID=%s,costCnt=%s" \
                                   % (costItemID, costItemCnt))
                return True
            
            ItemCommon.ReduceItem(curPlayer, itemPack, indexList, costItemCnt, False)
    
    itemType, itemID, itemCnt, isBind = awardItemInfo
    
    isBind = hasBind or isBind
    if itemType == 0:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, 
                                     [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere])
    elif itemType == 1:
        ItemControler.GivePlayerAppointItem(curPlayer, itemID, isBind)
    
    else:
        GameWorld.ErrLog("µöÓã½±ÀøÀàÐͲ»Ö§³ÖitemType=%s" % itemType, curPlayer.GetPlayerID())
    
    addDataDict = {"CostItemInfo":costItemInfo, "AwardItemInfo":awardItemInfo}
    DataRecordPack.DR_FuncGiveItem(curPlayer, "Fish", addDataDict)
    Sync_FishResult(curPlayer, awardItemInfo)
    
    syncItemInfoList = [[itemType, itemID, itemCnt, isBind, ""]]
    NPCCommon.SyncCollectionItemInfo(curPlayer, 0, 0, 0, syncItemInfoList) 
    return
 
## »ñÈ¡µöÓã½±ÀøÀàÐÍ×Öµä
#  @param curPlayer Íæ¼ÒʵÀý
#  @return 
def __GetFishAwardTypeDict(curPlayer):
    FishAwardLVModeDict = ReadChConfig.GetEvalChConfig("FishAwardLV")
    modeID = None
    playerLV = curPlayer.GetLV()
    for lvKey, mIDStr in FishAwardLVModeDict.items():
        if lvKey[0] <= playerLV <= lvKey[1]:
            modeID = mIDStr
            break
        
    if not modeID:
        GameWorld.ErrLog("ÕÒ²»µ½Íæ¼ÒµÈ¼¶¶ÔÓ¦µÄµöÓã½±ÀøÄ£°å£¡playerLV=%s" % playerLV, curPlayer.GetPlayerID())
        return
    
    modeFileName = "FishAward_%s" % modeID
    fishAwardInfo = ReadChConfig.GetEvalChConfig(modeFileName)
    
    if not fishAwardInfo:
        return
    
    infoKey = () # Ä¬ÈÏkey
    job = curPlayer.GetJob()
    for key in fishAwardInfo.keys():
        if job in key:
            infoKey = key
            break
        
    if infoKey not in fishAwardInfo:
        GameWorld.ErrLog('%s.txt can not find key=%s!' % (modeFileName, infoKey), curPlayer.GetPlayerID())
        return
    
    return fishAwardInfo[infoKey]
 
 
## Í¬²½µöÓã½á¹û
#  @param curPlayer Íæ¼ÒʵÀý
#  @return 
def Sync_FishResult(curPlayer, awardItemInfo):
    fishResultPack = ChPyNetSendPack.tagMCFishResult()
    fishResultPack.Clear()
    NetPackCommon.SendFakePack(curPlayer, fishResultPack)
    return