hxp
2019-02-13 2120cc2ad13c74ed1c5b4f9432c83c9d37182a12
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
#!/usr/bin/python
# -*- coding: GBK -*-
 
##@package GY_GM_StartGame
# ¿ªÆôϵͳ»î¶¯
#
# @author mark
# @date 2010-3-31
# @version 1.2
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
# @change: "2011-09-15 10:50" jiang ÐÞ¸ÄÌáʾÐÅÏ¢µÄ»ñÈ¡·½Ê½
# @change: "2014-01-07 15:30" hxp ÏµÍ³markÐÞ¸Ä
#
# Ä£¿éÏêϸ˵
#¿ªÆôϵͳ»î¶¯
#¿Í»§¶Ë·¢°ü [¿ªÆô(1)»òÕ߹رÕ(0) , Ê¼þID , »î¶¯¿ªÆôʼþ , »î¶¯½áÊøÊ±¼ä ]
#---------------------------------------------------------------------
"""Version = 2014-01-07 15:30"""
#---------------------------------------------------------------------
#µ¼Èë
import GameWorld
import PlayerControl
import datetime
import ChConfig
import GMCommon
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param playerList [¿ªÆô(1)»òÕ߹رÕ(0) , Ê¼þID , »î¶¯¿ªÆôʼþ , »î¶¯½áÊøÊ±¼ä ]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer , playerList):
    playerListLen = len(playerList)
    
    if playerListLen not in [2,4]:
        GameWorld.Log("¿Í»§¶Ë·â°ü³¤¶È´íÎó = %s"%playerListLen)
        return
    
    eventManager = GameWorld.GetGameWorldEventManager()
    #¿ªÆô»òÕ߹رÕ
    isOpen = playerList[0]
    #¿ªÆô»î¶¯µÄID
    eventID = playerList[1]
    
    if eventID not in GMCommon.GetGameServer_GM_GameID():
        GameWorld.Log("GM¿ªÆô»î¶¯Ê§°Ü,ûÓÐÕâ¸ö»î¶¯ = %s"%(eventID) , curPlayer.GetPlayerID())
        return
    
    #¿ªÆô»î¶¯
    if isOpen:
        #»î¶¯¿ªÆôʱ¼ä #"2007-11-23 11:23:00"
        eventStartTime = GameWorld.GetDateTimeByStr(playerList[2])
        #»î¶¯¹Ø±Õʱ¼ä #"2009-11-23 11:23:00"
        eventCloseTime = GameWorld.GetDateTimeByStr(playerList[3])
        
        if not eventStartTime or not eventCloseTime:
            GameWorld.Log('¿ªÊ¼ÓÎÏ··þÎñÆ÷»î¶¯ , ·â°üÒì³£ = %s,%s'%(playerList[2] , playerList[3]), curPlayer.GetPlayerID())
            return
        
        if eventStartTime < datetime.datetime.today():
            #GM_Activity_OpenTimeNoLegal ¶Ô²»Æð£¬ÄúÊäÈëµÄ¿ªÊ¼Ê±¼äСÓÚµ±Ç°ÏµÍ³Ê±¼ä£¬GMÖ¸Áî²Ù×÷ʧ°Ü
            PlayerControl.NotifyCode(curPlayer , "GM_Activity_OpenTimeNoLegal")
            return
        
        if eventStartTime > eventCloseTime:
            #GM_Activity_CloseTimeNoLegal02 ¶Ô²»Æð£¬ÄúÊäÈëµÄ½áÊøÊ±¼äСÓÚ¿ªÊ¼Ê±¼ä£¬GMÖ¸Áî²Ù×÷ʧ°Ü
            PlayerControl.NotifyCode(curPlayer , "GM_Activity_CloseTimeNoLegal02")
            return
        
        #Èç¹û»î¶¯ÒѾ­¿ªÆô,Ö´Ðи²¸Ç»î¶¯Âß¼­
        GMCommon.CloseProcessingEvent(eventID)
        
        #ÉèÖûÄÚÈݽø»î¶¯¹ÜÀíÆ÷
        addEvent = eventManager.AddActiveEvent(eventID)
        addEvent.SetEventID(eventID)
        addEvent.SetStartTime('%s'%eventStartTime)
        addEvent.SetEndTime('%s'%eventCloseTime)
        addEvent.SetAccID(curPlayer.GetAccID())
        
        #ÉèÖÃΪδ¼¤»î״̬
        addEvent.SetIsProcessing(False)
    
    #¹Ø±Õ»î¶¯
    else:
        activeEvent = eventManager.FindActiveEvent(eventID)
        if not activeEvent:
            GameWorld.Log("###²éÕÒÒѾ­¼¤»îµÄ»î¶¯Òì³£,ʧ°Ü = %s"%(eventID) , curPlayer.GetPlayerID())
            return
        
        #Õâ¸ö»î¶¯ÒѾ­¼¤»îÁË
        if activeEvent.GetIsProcessing():
            #Êä³öϵͳÌáʾ
            sysMsg = GMCommon.GetGameServer_GM_GameClose_Msg(eventID)
            if sysMsg != "":
                PlayerControl.WorldNotify(0, sysMsg)
            else:
                GameWorld.Log("###ÎÞ·¨²éÕÒµ½»î¶¯ID = %s ¹Ø±ÕÌáʾ"%(eventID))
        
        eventManager.DelActiveEvent(eventID)
    
    #GeRen_chenxin_673416 GMÖ¸ÁîÒÑÉúЧ£¬²Ù×÷³É¹¦
    PlayerControl.NotifyCode(curPlayer,"GeRen_chenxin_673416")
    
    #ÍÑ»ú¹¤¾ßʹÓÃ
    curPlayer.GMAnswer('%s;%s'%('GY_GM_StartGame', True))
    
    return