| #!/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  | 
|   |