hxp
2021-05-26 130ec4fa6335c77e396353c766bea495085d003b
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package GameDataRecord.py
# ÓÎϷʹÓõÄͳ¼ÆÊý¾Ý
# ×òÌì(Íæ¼ÒµÇÈëÊýÁ¿£¬³äÖµÊý)ͳ¼Æ
#
# @author wdb
# @date 2012-07-09
# @version 1.1
# @note
# @change: "2013-01-15 14:00" wdb ·À·¶Íæ¼ÒÏÂÏßʱ¼äΪ¿Õ
#---------------------------------------------------------------------
"""Version = 2013-01-15 14:00"""
#---------------------------------------------------------------------
import GameWorld
import ChConfig
import ShareDefine
import DataRecordPack
#---------------------------------------------------------------------
# ¼ÇÂ¼Íæ¼ÒµÇÈëÊýÁ¿
g_yedayLoginPlayerCnt = 0
# Í³¼Æ½ñÈÕÍæ¼ÒµÇÈëµÄÊýÁ¿
g_todayLoginPlayerCnt = 0
 
# ¼Ç¼ȫ·þ³äÖµµãȯÊý
g_yodayNewCoinCnt = 0
# Í³¼Æ½ñÈÕÈ«·þ³äÖµµãȯÊý
g_todayNewCoinCnt = 0
 
#---------------------------------------------------------------------
## Í³¼ÆµÇÈëÈËÊý
#  @param curPlayer£ºµÇÈëµÄÍæ¼Ò
#  @param tick:µ±Ç°Ê±¼ä 
#  @return None
def PlayerLoginRecord(curPlayer, tick):
    global g_todayLoginPlayerCnt
       
    # ÏÂÏßʱ¼ä
    logoffTime = curPlayer.GetLogoffTime()
    if not logoffTime:
        return
    
    logoffTime = GameWorld.GetDateTimeByStr(logoffTime)
    # ·þÎñÆ÷ʱ¼ä
    curTime = GameWorld.GetServerTime()
    
    # ÅжÏÊÇ·ñÔÚ½ñÌìÏÂÏß
    if logoffTime != None:
        if logoffTime.day == curTime.day \
         and logoffTime.month == curTime.month \
          and logoffTime.year == curTime.year:
            return
    
    g_todayLoginPlayerCnt += 1
    return
 
 
## Í³¼Æ³äÖµµãȯÊý
#  @param curPlayer£ºµÇÈëµÄÍæ¼Ò
#  @param tick:µ±Ç°Ê±¼ä 
#  @return None
def ChangeCoinCnt(coinCnt):
    global g_todayNewCoinCnt
    
    if g_todayNewCoinCnt > ChConfig.Def_UpperLimit_DWord:
        return
    
    g_todayNewCoinCnt += coinCnt
    return
 
 
## onday, Í³¼ÆÊý¾Ý¸üÐÂ
#  @param None£º
#  @return None
def OnDayResetRecord():
    global g_yedayLoginPlayerCnt
    global g_todayLoginPlayerCnt
    global g_yodayNewCoinCnt
    global g_todayNewCoinCnt
    
    # ÖØÐÂͳ¼ÆÍæ¼ÒµÇÈëµÄÊýÁ¿
    g_yedayLoginPlayerCnt = g_todayLoginPlayerCnt
    g_todayLoginPlayerCnt = GameWorld.GetPlayerManager().GetActivePlayerCount()
    
    # ÖØÐÂͳ¼ÆÈ«·þ³äÖµµãȯÊý
    g_yodayNewCoinCnt = g_todayNewCoinCnt
    g_todayNewCoinCnt = 0
    
    # ¼Ç¼Á÷Ïò
    DataRecordPack.DR_ResetGameDataRecord(g_yedayLoginPlayerCnt, g_yodayNewCoinCnt)
    
    # Í¨Öª¸ø¿Í»§¶Ë
    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_YdayLoginCnt, g_yedayLoginPlayerCnt)
    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_YdayNewCoinCnt, g_yodayNewCoinCnt)
    return