| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package SetExpMultiple  | 
| # Êý¾Ý¿âGMÃüÁîÖ´ÐÐ->ÉèÖÃÈ«·þ¾Ñé±¶ÂÊ  | 
| #  | 
| # @author mark  | 
| # @date 2010-3-31  | 
| # @version 1.0  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| # VER = "2010-05-14 9:30" zhengyang Ìí¼Ó×¢ÊÍ  | 
| #  | 
| # Ä£¿éÏêϸ˵  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GMCommon  | 
| import ChConfig  | 
| import GameWorld  | 
| import PlayerControl  | 
| import datetime  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| #Â߼ʵÏÖ(ÕâÀïcurPlayer = None)  | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param gmList [cmdIndex gmAccID expRate beginTime overTime]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer, gmList):  | 
|     cmdIndex = gmList[0]  | 
|       | 
|     result = __DoLogic_StartGame( gmList )  | 
|       | 
|     if result :  | 
|         GMCommon.Send_DataServer_GMCommandResult(cmdIndex, ChConfig.Def_GMTool_Succeed)  | 
|     else:  | 
|         GMCommon.Send_DataServer_GMCommandResult(cmdIndex, ChConfig.Def_GMTool_Fail)  | 
|           | 
| ## ÉèÖÃÂß¼  | 
| #  @param gmList [cmdIndex gmAccID expRate beginTime overTime]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.   | 
| def __DoLogic_StartGame( gmList ):  | 
|     #²Ù×÷Ô±ID  | 
|     gmAccID = gmList[1]  | 
|     #¾Ñé±¶ÂÊ  | 
|     expRate = int( gmList[2] )  | 
|       | 
|     if not (10000 <= expRate <= 30000):  | 
|         GameWorld.Log( 'Êý¾Ý¿â¶ÁÈ¡GMÃüÁî,ÉèÖþÑé±¶ÂÊ´íÎó = %s'%(expRate) )  | 
|         return  | 
|       | 
|     #¾Ñé±¶ÂÊID  | 
|     eventID = ChConfig.Def_GY_GM_Game_DoubleExp  | 
|       | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|       | 
|     #¿ªÆô»î¶¯  | 
|     if expRate != 10000:  | 
|         #¿ªÊ¼Ê±¼ä  | 
|         beginTime = gmList[3]  | 
|         #½áÊøÊ±¼ä  | 
|         overTime = gmList[4]  | 
|           | 
|         #»î¶¯¿ªÆôʱ¼ä #"2007-11-23 11:23:00"  | 
|         eventStartTime = GameWorld.GetDateTimeByStr( beginTime )  | 
|         #»î¶¯¹Ø±Õʱ¼ä #"2009-11-23 11:23:00"  | 
|         eventCloseTime = GameWorld.GetDateTimeByStr( overTime )  | 
|           | 
|         if not eventStartTime or not eventCloseTime:  | 
|             GameWorld.Log('Êý¾Ý¿â¶ÁÈ¡GMÃüÁî:ÉèÖþÑé±¶ÂÊʧ°Ü, Ê±¼äÒì³£ = %s,%s'%(beginTime , overTime))  | 
|             return  | 
|           | 
|         if eventStartTime < datetime.datetime.today():  | 
|             GameWorld.Log('Êý¾Ý¿â¶ÁÈ¡GMÃüÁî:ÉèÖþÑé±¶ÂÊʧ°Ü , ÊäÈëµÄ¿ªÊ¼Ê±¼äСÓÚµ±Ç°ÏµÍ³Ê±¼ä ')  | 
|             return  | 
|           | 
|         if eventStartTime > eventCloseTime:  | 
|             GameWorld.Log('Êý¾Ý¿â¶ÁÈ¡GMÃüÁî:ÉèÖþÑé±¶ÂÊʧ°Ü , ÄúÊäÈëµÄ½áÊøÊ±¼äСÓÚ¿ªÊ¼Ê±¼ä')  | 
|             return  | 
|           | 
|         #Èç¹û»î¶¯ÒѾ¿ªÆô,Ö´Ðи²¸Ç»î¶¯Âß¼  | 
|         GMCommon.CloseProcessingEvent(eventID)  | 
|           | 
|         #ÉèÖûÄÚÈݽø»î¶¯¹ÜÀíÆ÷  | 
|         addEvent = eventManager.AddActiveEvent(eventID)  | 
|         addEvent.SetEventID(eventID)  | 
|         addEvent.SetStartTime('%s'%eventStartTime)  | 
|         addEvent.SetEndTime('%s'%eventCloseTime)  | 
|         addEvent.SetAccID( gmAccID )  | 
|         addEvent.SetPar('%s'%(expRate))  | 
|           | 
|         #ÉèÖÃΪδ¼¤»î״̬  | 
|         addEvent.SetIsProcessing(False)  | 
|       | 
|     #¹Ø±Õ»î¶¯  | 
|     else:  | 
|         activeEvent = eventManager.FindActiveEvent(eventID)  | 
|         if not activeEvent:  | 
|             GameWorld.Log('Êý¾Ý¿â¶ÁÈ¡GMÃüÁî:¹Ø±Õ»î¶¯Ê§°Ü , ÎÞ¼¤»î´Ë»î¶¯ = %s'%(eventID))  | 
|             return  | 
|           | 
|         #Õâ¸ö»î¶¯ÒѾ¼¤»îÁË  | 
|         if activeEvent.GetIsProcessing():  | 
|             #Êä³öϵͳÌáʾ  | 
|             if eventID in ChConfig.Def_GY_GM_Close_Sysmsg :  | 
|                 PlayerControl.WorldNotify(0, ChConfig.Def_GY_GM_Close_Sysmsg[eventID])  | 
|             else:  | 
|                 GameWorld.Log("Êý¾Ý¿â¶ÁÈ¡GMÃüÁî:ÎÞ·¨²éÕÒµ½»î¶¯ID = %s ¹Ø±ÕÌáʾ"%(eventID))  | 
|           | 
|         #Èç¹û»î¶¯ÒѾ¿ªÆô,Ö´Ðи²¸Ç»î¶¯Âß¼  | 
|         GMCommon.CloseProcessingEvent(eventID)  | 
|       | 
|         eventManager.DelActiveEvent(eventID)  | 
|       | 
|     return True  | 
|       |