hxp
2 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.PlayerFeastWish
#
# @todo:½ÚÈÕ×£¸£
# @author hxp
# @date 2021-01-29
# @version 1.0
#
# ÏêϸÃèÊö: ½ÚÈÕ×£¸£
#
#-------------------------------------------------------------------------------
#"""Version = 2021-01-29 11:30"""
#-------------------------------------------------------------------------------
 
import ItemCommon
import PyGameData
import ShareDefine
import PlayerControl
import IpyGameDataPY
import ItemControler
import ChPyNetSendPack
import IPY_GameWorld
import NetPackCommon
import GameWorld
import ChConfig
 
import random
 
def OnPlayerLogin(curPlayer):
    isReset = __CheckPlayerFeastWishAction(curPlayer)
    if not isReset:
        actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
        # »î¶¯ÖÐͬ²½»î¶¯ÐÅÏ¢
        if actInfo.get(ShareDefine.ActKey_State):
            Sync_FeastWishActionInfo(curPlayer)
            Sync_FeastWishPlayerInfo(curPlayer)
    return
 
def RefreshFeastWishActionInfo():
    ## ÊÕµ½GameServerͬ²½µÄ»î¶¯ÐÅÏ¢£¬Ë¢Ð»ÐÅÏ¢
    playerManager = GameWorld.GetPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if not GameWorld.IsNormalPlayer(curPlayer):
            continue
        __CheckPlayerFeastWishAction(curPlayer)
    return
 
def __CheckPlayerFeastWishAction(curPlayer):
    ## ¼ì²éÍæ¼Ò»î¶¯ÐÅÏ¢
    
    playerID = curPlayer.GetPlayerID()
    
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
    actID = actInfo.get(ShareDefine.ActKey_ID, 0)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    
    templateID = __GetWishTemplateID()
    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishID) # Íæ¼ÒÉíÉϵĻID
    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishTemplateID) # Íæ¼ÒÉíÉϵÄÄ£°åID
    # »î¶¯ID ÏàͬµÄ»°²»´¦Àí
    if actID == playerActID:
        GameWorld.DebugLog("½ÚÈÕ×£¸£»î¶¯ID²»±ä£¬²»´¦Àí£¡", curPlayer.GetPlayerID())
        if state:
            if templateID and templateID != playerTemplateID:
                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)
        return
    GameWorld.DebugLog("½ÚÈÕ×£¸£»î¶¯ÖØÖÃ! actID=%s,playerActID=%s,state=%s,templateID=%s,playerTemplateID=%s" 
                       % (actID, playerActID, state, templateID, playerTemplateID), playerID)
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishID, actID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)
    if playerTemplateID:
        __SendWishBottleItemMail(curPlayer, playerTemplateID)
        
    bottleNumList = GetWishBottleNumList()
    for bottleNum in bottleNumList:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, 0)
        
    if state:
        Sync_FeastWishActionInfo(curPlayer)
        Sync_FeastWishPlayerInfo(curPlayer)
    return True
 
def __SendWishBottleItemMail(curPlayer, playerTemplateID):
    # Î´ÁìÈ¡µÄ½±ÀøÓʼþ·¢·Å
    
    if not playerTemplateID:
        return
    
    bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", playerTemplateID)
    if not bottleIpyDataList:
        return
    
    playerID = curPlayer.GetPlayerID()
    batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
    for ipyData in bottleIpyDataList:
        bottleNum = ipyData.GetWishBottleNum()
        choosePrizeItemDict = ipyData.GetChoosePrizeItem()
        
        curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
        getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
        
        getIndexList = []
        for recordIndex in choosePrizeItemDict.keys():
            if getState & pow(2, recordIndex):
                getIndexList.append(recordIndex)
                
        getTimes = len(getIndexList)
        maxTimes = ipyData.GetChooseTimeMax()
        if getTimes >= maxTimes:
            continue
        
        needGiveTimes = min(maxTimes - getTimes, curWishValue / ipyData.GetNeedWishValue())
        if not needGiveTimes:
            continue
        
        awardItemList = []
        for recordIndex, itemInfo in choosePrizeItemDict.items():
            if recordIndex in getIndexList:
                continue
            awardItemList.append(itemInfo)
            
            curWishValue = curWishValue - ipyData.GetNeedWishValue()
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, curWishValue)
            
            getState = getState | pow(2, recordIndex)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, getState)
            
            if len(awardItemList) >= needGiveTimes:
                break
            
        if not awardItemList:
            continue
        
        batchPlayerIDList.append([playerID])
        batchAddItemList.append(awardItemList)
        batchParamList.append([bottleNum])
        
    if batchPlayerIDList:
        PlayerControl.SendMailBatch("FeastWishBottleAwardMail", batchPlayerIDList, batchAddItemList, batchParamList)
        
    return
 
#// AA 10 ½ÚÈÕ×£¸£Æ¿Ñ¡Ôñ½±ÀøÎïÆ· #tagCMFeastWishBottleChooseItem
#
#struct    tagCMFeastWishBottleChooseItem
#{
#    tagHead        Head;
#    BYTE        BottleNum;    //Æ¿×Ó±àºÅ
#    BYTE        RecordIndex;    //ÎïÆ·Ë÷Òý£¬ÓÃÓÚÑ¡Ôñ¼°¼Ç¼ÊÇ·ñÒÑÑ¡Ôñ
#};
def OnFeastWishBottleChooseItem(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    bottleNum = clientData.BottleNum
    getRecordIndex = clientData.RecordIndex
    
    templateID = __GetWishTemplateID()
    GameWorld.DebugLog("½ÚÈÕ×£¸£Æ¿Ñ¡Ôñ½±Àø! templateID=%s,bottleNum=%s,getRecordIndex=%s" % (templateID, bottleNum, getRecordIndex))
    if not templateID:
        return
    
    bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
    if not bottleIpyDataList:
        return
    
    findIpyData = None
    for bottleIpyData in bottleIpyDataList:
        if bottleNum == bottleIpyData.GetWishBottleNum():
            findIpyData = bottleIpyData
            break
        
    if not findIpyData:
        GameWorld.DebugLog("    ÕÒ²»µ½¶ÔÓ¦½ÚÈÕ×£¸£Æ¿! bottleNum=%s" % bottleNum)
        return
    
    choosePrizeItemDict = findIpyData.GetChoosePrizeItem()
    if getRecordIndex not in choosePrizeItemDict:
        GameWorld.DebugLog("    ÕÒ²»µ½¶ÔÓ¦½ÚÈÕ×£¸£Æ¿½±ÀøÎïÆ·! getRecordIndex=%s" % getRecordIndex)
        return
    
    curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
    getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
    getTimes = 0
    for recordIndex in choosePrizeItemDict.keys():
        if getState & pow(2, recordIndex):
            getTimes += 1
            if getRecordIndex == recordIndex:
                GameWorld.DebugLog("    ¸ÃÎïÆ·ÒѾ­Ñ¡Ôñ¹ý! getRecordIndex=%s,getState=%s" % (getRecordIndex, getState))
                return
            
    if getTimes >= findIpyData.GetChooseTimeMax():
        GameWorld.DebugLog("    ÒÑûÓÐÁìÈ¡´ÎÊý! getState=%s,getTimes=%s >= %s" % (getState, getTimes, findIpyData.GetChooseTimeMax()))
        return
    
    if curWishValue < findIpyData.GetNeedWishValue():
        GameWorld.DebugLog("    ×£¸£Öµ²»×ãÁìÈ¡! curWishValue=%s < %s" % (curWishValue, findIpyData.GetNeedWishValue()))
        return
    
    if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
        return
    itemInfo = choosePrizeItemDict[getRecordIndex]
    itemID, itemCount, isAuctionItem = itemInfo
    if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], ["", False, {}]):
        return
    
    updWishValue = curWishValue - findIpyData.GetNeedWishValue()
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)
    
    updGetState = getState | pow(2, getRecordIndex)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, updGetState)
    
    Sync_FeastWishPlayerInfo(curPlayer, [bottleNum])
    
    GameWorld.DebugLog("    Ñ¡Ôñ³É¹¦: getState=%s,updGetState=%s,curWishValue=%s,updWishValue=%s,itemInfo=%s" 
                       % (getState, updGetState, curWishValue, updWishValue, itemInfo))
    
    if itemID in findIpyData.GetGoodItemIDList():
        recFromType = 1 # ¼Ç¼À´Ô´£º 1-×£¸£Æ¿£¬2-×£¸£³Ø
        valueList = [itemID, itemCount, recFromType]
        strValueList = [curPlayer.GetPlayerName()]
        notifyType = 4 # Í¨ÖªÈ«·þµ¥Ìõ
        GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)
        
        notifyKey = findIpyData.GetWorldNotifyKey()
        if notifyKey:
            PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, "", itemCount])
            
    return
 
#// AA 11 ½ÚÈÕ×£¸£³Ø×£¸£ #tagCMFeastWishPoolWish
#
#struct    tagCMFeastWishPoolWish
#{
#    tagHead        Head;
#    BYTE        WishCount;    //×£¸£´ÎÊý
#};
def OnFeastWishPoolWish(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    wishCount = clientData.WishCount
    
    templateID = __GetWishTemplateID()
    GameWorld.DebugLog("Íæ¼Ò½ÚÈÕ×£¸£: wishCount=%s,templateID=%s" % (wishCount, templateID))
    if not templateID:
        return
    
    bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
    poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)
    if not bottleIpyDataList or not poolIpyData:
        return
    
    canWishCountList = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 2)
    if wishCount not in canWishCountList:
        return
    
    costItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1)
    
    costItemNeedCount = wishCount
    costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID)
    lackCount = max(0, costItemNeedCount - bindCnt - unBindCnt)
    if lackCount > 0:
        GameWorld.DebugLog("    ËùÐè×£¸£µÀ¾ß²»×ã!costItemID=%s,costItemNeedCount=%s,lackCount=%s" 
                           % (costItemID, costItemNeedCount, lackCount))
        return
    
    giveWishValueTotal = 0
    wishValueRange = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 3)
    
    giveItemDict = {} # ÓÃÓÚÅжÏÕ¼Óñ³°üÓÃ
    giveItemList = [] # ÓÃÓÚʵ¼Ê¸øÎïÆ·¼°Í¨ÖªÇ°¶ËÓã¬Ò»¸ö¸ö¸ø
    isAuctionItem = 0 # Ä¬Èϸø·ÇÅÄÆ·
    itemWeightInfoList = poolIpyData.GetWishPoolItemWeightInfo()
    for _ in xrange(wishCount):
        randItemInfo = GameWorld.GetResultByWeightList(itemWeightInfoList)
        if not randItemInfo:
            GameWorld.ErrLog("½ÚÈÕ×£¸£³ØÎïÆ·È¨ÖØÅäÖÃÒì³£! %s" % itemWeightInfoList)
            return
        itemID, itemCount = randItemInfo
        giveItemList.append([itemID, itemCount, isAuctionItem])
        giveItemDict[itemID] = giveItemDict.get(itemID, 0) + itemCount
        giveWishValueTotal += random.randint(wishValueRange[0], wishValueRange[1])
        
    checkSpaceList = [[itemID, itemCount, isAuctionItem] for itemID, itemCount in giveItemDict.items()]
    if not ItemControler.CheckPackSpaceEnough(curPlayer, checkSpaceList):
        return
    
    GameWorld.DebugLog("    giveWishValueTotal=%s,giveItemList=%s" % (giveWishValueTotal, giveItemList))
    
    # ¿Û³ýÏûºÄ
    ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemNeedCount, "FeastWish")
    
    # ¼Ó×£¸£Öµ
    syncBottleNumList = []
    for bottleIpyData in bottleIpyDataList:
        bottleNum = bottleIpyData.GetWishBottleNum()
        curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
        getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
        getTimes = 0
        for recordIndex in bottleIpyData.GetChoosePrizeItem().keys():
            if getState & pow(2, recordIndex):
                getTimes += 1
        canGetTimes = max(0, bottleIpyData.GetChooseTimeMax() - getTimes)
        wishValueMax = bottleIpyData.GetNeedWishValue() * canGetTimes
        if curWishValue >= wishValueMax:
            GameWorld.DebugLog("    Æ¿×Ó×£¸£ÖµÒÑÂú! bottleNum=%s,canGetTimes=%s,wishValueMax=%s <= curWishValue=%s" 
                               % (bottleNum, canGetTimes, wishValueMax, curWishValue))
            continue
        updWishValue = min(wishValueMax, curWishValue + giveWishValueTotal)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)
        GameWorld.DebugLog("    Æ¿×Ó×£¸£Öµ¸üÐÂ! bottleNum=%s,canGetTimes=%s,wishValueMax=%s,curWishValue=%s,updWishValue=%s" 
                           % (bottleNum, canGetTimes, wishValueMax, curWishValue, updWishValue))
        syncBottleNumList.append(bottleNum)
        
    # ¸øÎïÆ·
    goodItemIDList = poolIpyData.GetGoodItemIDList()
    notifyKey = poolIpyData.GetWorldNotifyKey()
    for itemID, itemCount, isAuctionItem in giveItemList:
        itemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
        itemUserData = itemObj.GetUserData()
        isOK = ItemControler.DoLogic_PutItemInPack(curPlayer, itemObj, ["FeastWish", False, {}], [IPY_GameWorld.rptItem])
        
        if isOK and itemID in goodItemIDList:
            # Í¨ÖªGameServer¼Ç¼ºÃÎïÆ·ÂÖ²¥
            recFromType = 2 # ¼Ç¼À´Ô´£º 1-×£¸£Æ¿£¬2-×£¸£³Ø
            valueList = [itemID, itemCount, recFromType]
            strValueList = [curPlayer.GetPlayerName()]
            notifyType = 4 # Í¨ÖªÈ«·þµ¥Ìõ
            GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)
            
            if notifyKey:
                PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, itemUserData, itemCount])
                
    # Í¨ÖªÇ°¶Ë½á¹û
    retPack = ChPyNetSendPack.tagMCFeastWishResult()
    retPack.AddWishValue = giveWishValueTotal
    retPack.WishResult = str(giveItemList)
    retPack.WishResultLen = len(retPack.WishResult)
    NetPackCommon.SendFakePack(curPlayer, retPack)
    
    if syncBottleNumList:
        Sync_FeastWishPlayerInfo(curPlayer, syncBottleNumList)
        
    return
 
def GetFeastWishDropItemIDList(curPlayer, npcData):
    ## »ñÈ¡µôÂä×£¸£µÀ¾ßIDÁбí
    ## @return: [itemID, ...]
    
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
    if not actInfo:
        return []
    
    if not actInfo.get(ShareDefine.ActKey_State):
        return []
    
    if not ChConfig.IsGameBoss(npcData):
        return []
    
    npcID = npcData.GetNPCID()
    killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
    limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
    if limitIndex not in [ShareDefine.Def_Boss_Func_World, ShareDefine.Def_Boss_Func_Home]:
        # ¹æ¶¨Ö»ÓÐÊÀ½çboss¡¢bossÖ®¼Ò¿ÉµôÂä
        return
    
    dropRate = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 4)
    if not GameWorld.CanHappen(dropRate):
        return
    wishItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1) # Ä¬Èϵô1¸ö
    #GameWorld.DebugLog("µôÂä½ÚÈÕ×£¸£µÀ¾ß: npcID=%s,dropRate=%s,wishItemID=%s" % (npcID, dropRate, wishItemID))
    return [wishItemID]
 
def Sync_FeastWishPlayerInfo(curPlayer, bottleNumList=[]):
    ## Í¨Öª»î¶¯Íæ¼ÒÐÅÏ¢
    
    if bottleNumList:
        syncBottleNumList = bottleNumList
    else:
        syncBottleNumList = GetWishBottleNumList()
    
    playerPack = ChPyNetSendPack.tagMCFeastWishPlayerInfo()
    playerPack.PlayerBottleInfo = []
    for bottleNum in syncBottleNumList:
        playerBottle = ChPyNetSendPack.tagMCFeastWishPlayerBottle()
        playerBottle.BottleNum = bottleNum
        playerBottle.WishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
        playerBottle.ChooseRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
        playerPack.PlayerBottleInfo.append(playerBottle)
    playerPack.BottleCount = len(playerPack.PlayerBottleInfo)
    NetPackCommon.SendFakePack(curPlayer, playerPack)
    return
 
def GetWishBottleNumList():
    templateID = __GetWishTemplateID()
    if not templateID:
        return []
    
    bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
    if not bottleIpyDataList:
        return []
    return [bottleIpyData.GetWishBottleNum() for bottleIpyData in bottleIpyDataList]
 
def __GetWishTemplateID():
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
    if not actInfo:
        return 0
    
    if not actInfo.get(ShareDefine.ActKey_State):
        return 0
    
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
    ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)
    if not ipyData:
        return 0
    
    worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)
    templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)
    return templateID
 
def Sync_FeastWishActionInfo(curPlayer):
    ## Í¨Öª»î¶¯ÐÅÏ¢
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
    if not actInfo:
        return
    
    if not actInfo.get(ShareDefine.ActKey_State):
        return
    
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
    ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)
    if not ipyData:
        return
    
    worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)
    templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)
    if not templateID:
        return
    
    bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
    poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)
    
    startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
    actPack = ChPyNetSendPack.tagMCFeastWishInfo()
    actPack.Clear()
    actPack.StartDate = startDateStr
    actPack.EndtDate = endDateStr
    actPack.LimitLV = ipyData.GetLVLimit()
    actPack.ResetType = ipyData.GetResetType()
    actPack.WishPoolShowItemList = poolIpyData.GetWishPoolClientItemShow() if poolIpyData else []
    actPack.WishPoolShowCount = len(actPack.WishPoolShowItemList)
    actPack.BottleInfoList = []
    if bottleIpyDataList:
        for bottleIpyData in bottleIpyDataList:
            bottleInfo = ChPyNetSendPack.tagMCFeastWishBottleInfo()
            bottleInfo.BottleNum = bottleIpyData.GetWishBottleNum()
            bottleInfo.NeedWishValue = bottleIpyData.GetNeedWishValue()
            bottleInfo.ChooseTimeMax = bottleIpyData.GetChooseTimeMax()
            bottleInfo.ChoosePrizeList = []
            prizeItemDict = bottleIpyData.GetChoosePrizeItem()
            for recordIndex, itemInfo in prizeItemDict.items():
                itemID, itemCount, isAuctionItem = itemInfo
                itemInfo = ChPyNetSendPack.tagMCFeastWishBottleItem()
                itemInfo.RecordIndex = recordIndex
                itemInfo.ItemID = itemID
                itemInfo.ItemCount = itemCount
                itemInfo.IsBind = isAuctionItem
                bottleInfo.ChoosePrizeList.append(itemInfo)
            bottleInfo.ChoosePrizeCount = len(bottleInfo.ChoosePrizeList)
            actPack.BottleInfoList.append(bottleInfo)
    actPack.BottleCount = len(actPack.BottleInfoList)
    NetPackCommon.SendFakePack(curPlayer, actPack)
    return