hxp
2019-06-22 d0f5f9922f17f5bff4288173f18a9ed827d95db8
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package UseItem.Item_AddFBCnt
#
# @todo:Ôö¼Ó¸±±¾¿É½øÈë´ÎÊý
# @author xdh
# @date 2018-03-09
# @version 1.0
#
# ÏêϸÃèÊö: Ôö¼Ó¸±±¾¿É½øÈë´ÎÊý
#
#-------------------------------------------------------------------------------
#"""Version = 2018-03-09 12:00"""
#-------------------------------------------------------------------------------
 
import ItemCommon
import FBCommon
import PlayerControl
import ChConfig
import IpyGameDataPY
import time
 
def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
    ##ÅúÁ¿Ê¹ÓÃÎïÆ·
    itemTypeID = curRoleItem.GetItemTypeID()
    curEff = curRoleItem.GetEffectByIndex(0)
    mapID = curEff.GetEffectValue(0)
    mapID = FBCommon.GetRecordMapID(mapID)
    oldMaxCnt = FBCommon.GetEnterFBMaxCnt(curPlayer, mapID)
    itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID, itemAddCnt+useCnt)
    
    ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_AddFBCnt)
    FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID)
    PlayerControl.NotifyCode(curPlayer, 'AddActivityCount_1', [itemTypeID, mapID, useCnt])
    
    #·âħ̳´ÎÊý³¬¹ýÉÏÏÞʱҪ¼Ç¼µ¹¼ÆÊ±Ê£Óàʱ¼ä
    lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
    if lastRegainTime:
        ipyData = FBCommon.GetFBIpyData(mapID)
        if ipyData:
            maxDayTimes = ipyData.GetDayTimes()
            enterCnt = FBCommon.GetEnterFBCount(curPlayer, mapID)
            if oldMaxCnt - enterCnt < maxDayTimes and oldMaxCnt - enterCnt + useCnt >= maxDayTimes:
                curTime = int(time.time())
                needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
                if not needTime:
                    needTime = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, needTime - (curTime-lastRegainTime))
                FBCommon.NotifyFBCntRegainInfo(curPlayer)
    return True, useCnt