hxp
2023-11-06 0f79dbd110321d8071a98dca8065d51fc8dc5190
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GameWorldLogic.FBProcess.GameLogic_FamilyParty
#
# @todo:Õ½ÃËÊ¢Ñç
# @author xdh
# @date 2018-04-16
# @version 1.0
#
# ÏêϸÃèÊö: Õ½ÃËÊ¢Ñç
#
#---------------------------------------------------------------------
#"""Version = 2018-04-16 17:20"""
#---------------------------------------------------------------------
import ShareDefine
import FBCommon
import ChConfig
import IPY_GameWorld
import PlayerControl
import GameWorld
import PlayerFamily
import IpyGameDataPY
import PlayerFeastTravel
import PlayerFairyCeremony
import PlayerNewFairyCeremony
import PlayerActLogin
import EventReport
import PyGameData
import ItemCommon
import ItemControler
import PlayerActivity
import PlayerTongTianLing
import ChPyNetSendPack
import NetPackCommon
 
#---Õ½Ã˸±±¾---
FBPlayerDict_TagPlayerID = 'XMYH_TagPlayerID%s'  # ÑûÇë´«¹¦Ä¿±êÍæ¼ÒID
 
g_familyMapPlayerIDDict = {}#{lineID:[playerID,..]}
 
def OnDayFamilyPartyPlayer(curPlayer):
    GameWorld.DebugLog("ÖØÖÃÏÉÃËÑç»áÏà¹ØÊý¾Ý£¬º¬´«¹¦!", curPlayer.GetPlayerID())
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyJoinSign, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyCollectState, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExp, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalPoint, 0)
    #´ò×ø
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitExpRound, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExp, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExpPoint, 0)
    SyncFamilySitInfo(curPlayer)
    return
    
def OnFBPlayerOnLogin(curPlayer):
    SyncFamilySitInfo(curPlayer)
    return
 
##¿ªÆô¸±±¾
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ¿ªÆô¸±±¾
def OnOpenFB(tick):
    return
 
 
##¹Ø±Õ¸±±¾
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks 
def OnCloseFB(tick):
    global g_familyMapPlayerIDDict
    lineID = GameWorld.GetGameWorld().GetLineID()
    g_familyMapPlayerIDDict.pop(lineID, None)
    return
 
 
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
#  @param curPlayer Íæ¼ÒʵÀý
#  @param mapID µØÍ¼ID
#  @param lineID Ïß·id
#  @param tick Ê±¼ä´Á
#  @return ²¼¶ûÖµ
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
    return __CheckEnter(curPlayer, mapID)
 
 
##½øÈ븱±¾¼ì²é
#  @param curPlayer Íæ¼ÒʵÀý
#  @param mapID µØÍ¼ID
#  @param lineID Ïß·id
# @return None
def __CheckEnter(curPlayer, mapID):
    
    # ÊÇ·ñÓÐÕ½ÃË
    if curPlayer.GetFamilyID() <= 0:
        GameWorld.DebugLog("ûÓÐÕ½ÃË£¬²»ÄܽøÈëÕ½ÃËboss¸±±¾£¡")
        return False
    
    return True
 
 
##¸±±¾Íæ¼Ò½øÈëµã
# @param curPlayer Íæ¼ÒʵÀý
# @param mapID µØÍ¼ID
# @param lineId ·ÖÏßID
# @param ipyEnterPosInfo ¹¦ÄÜÏß·IPYÅäÖÃ×ø±êÐÅÏ¢
# @param tick Ê±¼ä´Á
# @return posX, posY, Ëæ»ú°ë¾¶(¿ÉÑ¡)
def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
    return ipyEnterPosInfo
 
   
##ÊÇ·ñ¿ÉÒÔ½øÈë
# @param ask ÇëÇó½á¹¹Ìå
# @param tick Ê±¼ä´Á
# @return
def OnChangeMapAsk(ask, tick):
    return IPY_GameWorld.cmeAccept
 
 
##Íæ¼Ò½øÈ븱±¾
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks Íæ¼Ò½øÈ븱±¾
def DoEnterFB(curPlayer, tick):
    global g_familyMapPlayerIDDict
    mapID = GameWorld.GetGameWorld().GetMapID()
    playerID = curPlayer.GetPlayerID()
    if not __CheckEnter(curPlayer, mapID):
        PlayerControl.PlayerLeaveFB(curPlayer)
        return
    
    gameWorld = GameWorld.GetGameWorld()
    partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
    if partyActionState:
        remainSeconds = PlayerActivity.GetDailyActionRemainSeconds(ShareDefine.DailyActionID_FamilyParty)
        __DoEnterJoinFamilyParty(curPlayer, remainSeconds)
        
    lineID = GameWorld.GetGameWorld().GetLineID()
    if lineID not in g_familyMapPlayerIDDict:
        g_familyMapPlayerIDDict[lineID] = []
    if playerID not in g_familyMapPlayerIDDict[lineID]:
        g_familyMapPlayerIDDict[lineID].append(playerID)
    
    playerManager = GameWorld.GetMapCopyPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if not curPlayer:
            continue
        DoFBHelp(curPlayer, tick, True)
        
    return
 
def __DoEnterJoinFamilyParty(curPlayer, remainSeconds):
    ## Íæ¼ÒÕýʽ¿ªÊ¼²ÎÓëÏÉÃËÑç»á£¬ÒòΪ¶à¸öÏÉÃ˻¿ÉÄܹ²ÓøõØÍ¼£¬Íæ¼Ò¿ÉÄܻ¿ªÊ¼Ê±ÒѾ­ÔڸõØÍ¼
    GameWorld.DebugLog("Íæ¼Ò²Î¼ÓÏÉÃËÑç»á!remainSeconds=%s" % remainSeconds, curPlayer.GetPlayerID())
    if remainSeconds:
        curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, remainSeconds * 1000, True)
        
    if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyJoinSign):
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyJoinSign, 1)
    
    #FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_FamilyParty)
    PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyParty)
    PlayerFamily.AddFamilyActivity(curPlayer, ShareDefine.FamilyActive_Party)
    EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_FamilyParty, 0, ChConfig.CME_Log_Start)
    PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1)
    PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1)
    PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_FamilyParty, 1)
    PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_FamilyParty, 1)
    return
 
## ÊÇ·ñ¿ÉÒÔ»ñµÃ¸±±¾µØÍ¼ÇøÓò¾­Ñé
def OnCanGetAreaExp(curPlayer):
    gameWorld = GameWorld.GetGameWorld()
    partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
    return partyActionState
 
##¸±±¾¶¨Ê±Æ÷
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
# @remarks ¸±±¾¶¨Ê±Æ÷
def OnProcess(tick):
    familyID = GameWorld.GetGameWorld().GetPropertyID()
    if not familyID:
        return
    
    gameWorld = GameWorld.GetGameWorld()
    sitActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilySit)
    partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
    
    if sitActionState:
        Process_SitAction(tick)
        
    # ÓÉÓÚÑç»á²»ÐèÒª¶îÍâ´¦Àí£¬Ö»ÐèҪͬ²½Help£¬ËùÒÔÈç¹û´ò×ø½øÐÐÖУ¬¾Í²»ÐèÒªÔÙÖØ¸´´¦ÀíÑç»áͬ²½
    elif partyActionState:
        FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
        
    return
 
def Process_SitAction(tick):
    key = "SitActionProcessTick"
    interval, expRoundMax = IpyGameDataPY.GetFuncEvalCfg("FamilySit", 1)
    gameFB = GameWorld.GetGameFB()
    lastTick = gameFB.GetGameFBDictByKey(key)
    if tick - lastTick < interval * 1000:
        return
    gameFB.SetGameFBDict(key, tick)
    
    worldlv = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
    playerManager = GameWorld.GetMapCopyPlayerManager()
    playerCount = playerManager.GetPlayerCount()
    # Ã¿Ôö¼ÓÒ»ÃûÏÉÃ˳ÉÔ±¼Ó³É¾­Ñé°Ù·Ö±È|×î¸ß¼Ó³É°Ù·Ö±È£¬Á½¸öÈË¿ªÊ¼Ëã¼Ó³É
    perPlayerExpRateAdd, expRateAddMax = IpyGameDataPY.GetFuncEvalCfg("FamilySit", 3)
    expRateEx = min(expRateAddMax, (playerCount - 1) * perPlayerExpRateAdd) if playerCount > 1 else 0
    
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if not curPlayer:
            continue
        
        expRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
        if expRound < expRoundMax:
            expRound += 1
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitExpRound, expRound)
            
            # ¸ø¾­Ñé
            reLV = curPlayer.GetLV()
            reExp = PlayerControl.GetPlayerReExp(curPlayer)
            giveExp = eval(IpyGameDataPY.GetFuncCompileCfg("FamilySit", 2))
            finalAddExp = PlayerControl.PlayerControl(curPlayer).AddExp(giveExp, ShareDefine.Def_ViewExpType_Sit, expRateEx=expRateEx)
            
            exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
            expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
            newTotalExp = expPoint * ChConfig.Def_PerPointValue + exp + finalAddExp
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExp, newTotalExp % ChConfig.Def_PerPointValue)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExpPoint, newTotalExp / ChConfig.Def_PerPointValue)    
            
            #GameWorld.DebugLog("´ò×ø¾­Ñé: expRound=%s,reLV=%s,reExp=%s,giveExp=%s,expRateEx=%s,finalAddExp=%s" 
            #                   % (expRound, reLV, reExp, giveExp, expRateEx, finalAddExp), curPlayer.GetPlayerID())
            
        DoFBHelp(curPlayer, tick)
        
    return
 
def FamilyPartyAnswerRight(curPlayer, answerInfo):
    #»Ø´ðÕýÈ·£¬¸ø½±Àø
    
    rightPlayerID = answerInfo[0]
    
    #¸ø±¾Ìâ´ðÌâ½±Àø£¬±¾µØÍ¼ÖеļÒ×å³ÉÔ±²Å¸ø
    answerRWItemReward = IpyGameDataPY.GetFuncEvalCfg('PartyReward2', 1)
    rightItemID, wrongItemID = answerRWItemReward
    playerManager = GameWorld.GetMapCopyPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        player = playerManager.GetPlayerByIndex(index)
        if not player:
            continue
        if player.GetFamilyID() != curPlayer.GetFamilyID():
            continue
        if player.GetPlayerID() == rightPlayerID:
            giveItemID = rightItemID
        else:
            giveItemID = wrongItemID
        itemCount, isAuctionItem = 1, False
        ItemControler.GivePlayerItem(player, giveItemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
        
    if curPlayer.GetPlayerID() != rightPlayerID:
        return
    
    addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2)
    #ÏÉÃ˹±Ï×¶È
    PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty, True)
    #´ðÌâ¾­Ñé¸üÐÂ
    PlayerControl.PlayerControl(curPlayer).AddExp(addExp, ShareDefine.Def_ViewExpType_SysEx)
    PlayerControl.FamilyNotify(curPlayer.GetFamilyID(), 'Party_Answer', [curPlayer.GetName(), rightItemID])
    curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1)
    PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_FamilyPartyAnswerRight, 1)
    
    if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_FamilyParty:
        DoFBHelp(curPlayer, 0)
    return
 
 
def OnFamilyPartyStateChange(state, tick):
    #»î¶¯×´Ì¬±ä¸ü
    mapID = GameWorld.GetMap().GetMapID()
    if mapID != ChConfig.Def_FBMapID_FamilyParty:
        return
    
    GameWorld.DebugLog('ÏÉÃËÑç»á»î¶¯×´Ì¬±ä¸ü state=%s' % state)
    if state == 1:
        remainSeconds = PlayerActivity.GetDailyActionRemainSeconds(ShareDefine.DailyActionID_FamilyParty)
        playerManager = GameWorld.GetPlayerManager()
        for i in xrange(playerManager.GetPlayerCount()):
            curPlayer = playerManager.GetPlayerByIndex(i)
            if not curPlayer or curPlayer.IsEmpty():
                continue
            __DoEnterJoinFamilyParty(curPlayer, remainSeconds)
    else:
        PyGameData.g_familyPartyInfo = []
        
    return
 
 
##Íæ¼ÒÍ˳ö¼Ò×å´¦Àí
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎÞÒâÒå
def OnLeaveFamily(curPlayer, tick):
    #GameWorld.DebugLog("OnLeaveFamily...")
    PlayerControl.PlayerLeaveFB(curPlayer)
    return
 
 
##»ñµÃ¸±±¾°ïÖúÐÅÏ¢
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks ÓÃÓÚ֪ͨÕóÓª±È·ÖÌõ
def DoFBHelp(curPlayer, tick, isSyncPlayerID=False):
    gameWorld = GameWorld.GetGameWorld()
    partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
    
    playerID = curPlayer.GetPlayerID()
    curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)
    addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2)
    exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExp)
    expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint)
    totalExp = expPoint * ChConfig.Def_PerPointValue + exp + addExp * curAnswerCnt
    exp = totalExp % ChConfig.Def_PerPointValue
    expPoint = totalExp / ChConfig.Def_PerPointValue
    
    totalPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalPoint)
    #totalPoint += IpyGameDataPY.GetFuncCfg('PartyReward') #¼Ó²ÎÓë½±
    totalPoint += addPoint * curAnswerCnt
    hasCollect = int(curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyCollectState) or not partyActionState) # ·Ç»î¶¯ÆÚ¼äҲͬ²½ÒѲɼ¯£¬Ç°¶Ë¸ù¾Ý´Ë״̬¿ØÖư´Å¥ÏÔÒþ
    
    helpDict = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, FBCommon.Help_score:totalPoint, "hasCollect":hasCollect}
    if PyGameData.g_familyPartyInfo:
        rankList = []
        for i, info in enumerate(PyGameData.g_familyPartyInfo[0], 1):
            rankList.append({"rank":i, "name":info[1], "cnt":info[2]})
        helpDict['familyPartyRank'] = rankList
        helpDict['familyPartyTop'] = {'name':PyGameData.g_familyPartyInfo[1], "cnt":PyGameData.g_familyPartyInfo[2]}
    if isSyncPlayerID:
        lineID = GameWorld.GetGameWorld().GetLineID()
        helpDict['familyPartyPlayer'] = g_familyMapPlayerIDDict.get(lineID, [])
        
    # ´ò×ø
    sitActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilySit)
    if sitActionState:
        exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
        expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
        expRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
        playerCount = GameWorld.GetMapCopyPlayerManager().GetPlayerCount()
        sitInfo = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, "expRound":expRound, "playerCount":playerCount}
        helpDict["sitInfo"] = sitInfo
        
    GameWorld.DebugLog("DoFBHelp %s" % helpDict, playerID)
    FBCommon.Notify_FBHelp(curPlayer, helpDict)
    return
 
 
##ÊÇ·ñ¿ÉÒԲɼ¯
# @param curPlayer Íæ¼ÒʵÀý
# @param curNPC NPCʵÀý
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks
def OnCanCollect(curPlayer, curNPC, tick):
    partyActionState = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
    if not partyActionState:
        PlayerControl.NotifyCode(curPlayer, 'Party_NotInPartyTime')
        return
    hasCollect = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyCollectState)
    if hasCollect:
        PlayerControl.NotifyCode(curPlayer, 'Party_HadCollected')
        return
    needSpace = len(IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3))
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    return True
 
 
##¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä.
# @param curPlayer Íæ¼ÒʵÀý
# @param curNPC NPCʵÀý
# @return ·µ»ØÖµ, Loadingʱ¼ä
# @remarks ¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä
def GetFBPrepareTime(curPlayer, curNPC):
    return IpyGameDataPY.GetFuncCfg('FamilyPartyDesk', 2) * 1000
 
 
##Íæ¼ÒÊÕ¼¯³É¹¦(Ëþ, Æì)
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
# @remarks
def OnCollectOK(curPlayer, npcID, tick):
    playerID = curPlayer.GetID()
    #gameWorld = GameWorld.GetGameWorld()
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyCollectState, 1)
    
    GameWorld.DebugLog('    Ñç»á²É¼¯³É¹¦£¡', playerID)
    #¸ø½±Àø
    itemAward = IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3)
    for itemID, itemCount, isBind in itemAward:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
    addPoint = IpyGameDataPY.GetFuncCfg('FamilyPartyDesk')
    PlayerControl.NotifyCode(curPlayer, 'Party_CollectSuccess', [addPoint])
    PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty)
    
    totalPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalPoint)
    updPoint = totalPoint + addPoint
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalPoint, updPoint)
    DoFBHelp(curPlayer, 0)
    return
 
## »ñµÃ¾­Ñé
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param addExp »ñµÃµÄ¾­Ñé
#  @param expViewType ¾­ÑéÀàÐÍ
#  @return True or False
def OnGetExp(curPlayer, addExp, expViewType):
    
    if expViewType != ShareDefine.Def_ViewExpType_SysEx:
        return
    exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExp)
    expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint)
    newTotalExp = expPoint * ChConfig.Def_PerPointValue + exp + addExp
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExp, newTotalExp % ChConfig.Def_PerPointValue)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint, newTotalExp / ChConfig.Def_PerPointValue)
    return
 
##Íæ¼ÒÍ˳ö¸±±¾
# @param curPlayer Íæ¼ÒʵÀý
# @param tick Ê±¼ä´Á
# @return ÎÞÒâÒå
def DoExitFB(curPlayer, tick):
    global g_familyMapPlayerIDDict
    SyncFamilySitInfo(curPlayer)
    lineID = GameWorld.GetGameWorld().GetLineID()
    playerID = curPlayer.GetID()
    if playerID in g_familyMapPlayerIDDict.get(lineID, []):
        g_familyMapPlayerIDDict[lineID].remove(playerID)
        if g_familyMapPlayerIDDict[lineID]:
            playerManager = GameWorld.GetMapCopyPlayerManager()
            for index in xrange(playerManager.GetPlayerCount()):
                curPlayer = playerManager.GetPlayerByIndex(index)
                if not curPlayer:
                    continue
                DoFBHelp(curPlayer, tick, True)
    return
 
## ¸±±¾ÐÐΪ
#  @param curPlayer Íæ¼Ò
#  @param actionType ÐÐΪÀàÐÍ
#  @param actionInfo ÐÐΪÐÅÏ¢
#  @param tick µ±Ç°Ê±¼ä
#  @return None
def DoFBAction(curPlayer, actionType, actionInfo, tick):
    return
 
def DoAddFamilyMemberFamilyActivity(familyID, addFamilyActivity):
    playerManager = GameWorld.GetPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if not curPlayer:
            continue
        if curPlayer.GetFamilyID() != familyID:
            continue
        PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_FamilyActivity, addFamilyActivity)
        GameWorld.DebugLog("Ôö¼Ó±¾ÏÉÃ˳ÉÔ±´ðÌâ»îÔ¾Áî, playerID=%s,addFamilyActivity=%s" % (curPlayer.GetPlayerID(), addFamilyActivity))
    return
 
def SyncFamilySitInfo(curPlayer):
    clientPack = ChPyNetSendPack.tagMCFamilySitInfo()
    clientPack.Clear()
    clientPack.ExpRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
    clientPack.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
    clientPack.ExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return