hxp
2018-08-10 bf6eb250654cbb2b11284ef7642f7ca1f1826b20
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package test_OnHour
# @todo: GMÃüÁî, OnHour
#
# @author: panwei
# @date 2011-01-09
# @version 1.1
#
# @change: "2012-05-16 14:30" jiang C++½Ó¿ÚÐÞ¸ÄMapServer_QueryPlayerResultºÍMapServer_QueryPlayerÐÞ¸Ä
#---------------------------------------------------------------------
"""Version = 2012-05-16 14:30"""
#---------------------------------------------------------------------
import GameWorldProcess
import GameWorld
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
Def_MaxHour = 24
#---------------------------------------------------------------------
## Ö´ÐÐÂß¼­  Ö´Ðиø¶¨²ÎÊý´ÎonHour
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param cmdList ´«Èë²ÎÊý
#  @return None
#  @remarks Ö´Ðиø¶¨²ÎÊý´ÎonHour
def OnExec(curPlayer, cmdList):
    timeStr = GameWorld.GetCurrentDataTimeStr()
    tick = GameWorld.GetGameWorld().GetTick()
    
    #֪ͨµØÍ¼·þÎñÆ÷Íæ¼ÒË¢ÐÂÐÅÏ¢
    DoLogic_GM_OnHour(timeStr, tick)
    
    if len(cmdList) == 0:
        count = 1
    else:
        count = min(Def_MaxHour, cmdList[0])
    
    for i in range(count):
        GameWorldProcess.OnHour(timeStr, tick)
            
    return
 
## ÊÀ½ç·þÎñÆ÷Ö´ÐР test_OnHour  Ò»´Î ²¢Í¨ÖªÔÚÏßËùÓÐÍæ¼Ò
#  @param timeStr   Ê±¼ä´Á
#  @param tick     µ±Ç°tick
#  @return ÎÞ·µ»ØÖµ
#  @remarks ÊÀ½ç·þÎñÆ÷Ö´ÐРtest_OnHour  Ò»´Î
def DoLogic_GM_OnHour(timeStr, tick):
    playerManager = GameWorld.GetPlayerManager()
    
    for i in range(0, playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(i)
        
        if not curPlayer or curPlayer.IsEmpty():
            continue
        
        mapID = GameWorld.GetQueryPlayerMapID(curPlayer)
        
        if not mapID:
            continue
        
        playerManager.MapServer_QueryPlayer(0, 0, curPlayer.GetID(), mapID, 'GMDateTime', 'GMOnHour', len("GMOnHour"))
    
    return