hxp
2019-09-20 67bcc2ab06912fc3d9cf31ceae533da76e50d5ae
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GM.Commands.GMT_BourseOnOff
#
# @todo:½»Ò×Ëù¿ª¹Ø/״̬²éѯ
# @author hxp
# @date 2014-05-17
# @version 1.0
#
# ÏêϸÃèÊö: ½»Ò×Ëù¿ª¹Ø/״̬²éѯ
#
#---------------------------------------------------------------------
"""Version = 2014-05-17 12:30"""
 
#µ¼Èë
import DataRecordPack
import PlayerBourse
import GameWorld
import GMCommon
 
#---------------------------------------------------------------------
 
 
StateList = (
State_Off,
State_On,
) = range(2)
 
 
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gmCmdDict: ÃüÁî×Öµä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict):
    GameWorld.DebugLog("GMT_BourseOnOff gmCmdDict=%s" % str(gmCmdDict))
    
    operate = gmCmdDict.get('operate', '')
    
    curState = PlayerBourse.GetOpenState()
    
    # ×´Ì¬²éѯ
    if operate == "query":
        if curState == State_On:
            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ActionOpening)
        elif curState == State_Off:
            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NotOpenAction)
        else:
            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
        return
    
    # ×´Ì¬¸ü¸Ä        
    if operate == "on":
        changeState = State_On
    elif operate == "off":
        changeState = State_Off
    else:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
        return
    
    if curState == changeState:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed)
        return
    
    PlayerBourse.SetOpenState(changeState)
    
    # ¼Ç¼Á÷Ïò
    DataRecordPack.DR_ToolGMOperate(0, '', '', 'GMT_BourseOnOff', str(gmCmdDict))
    # »Ø¸´
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success) 
    return