| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package GY_GM_MapGiveExp  | 
| # ÔÚÏßË;Ñé»î¶¯  | 
| #  | 
| # @author mark  | 
| # @date 2010-3-31  | 
| # @version 1.1  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| # @change: "2014-01-07 15:30" hxp ÏµÍ³markÐÞ¸Ä  | 
| #  | 
| # VER = "2014-01-07 15:30" zhengyang Ìí¼Ó×¢ÊÍ  | 
| #  | 
| # Ä£¿éÏêϸ˵  | 
| #½Å±¾ËµÃ÷  | 
| #ÔÚÏßË;Ñé»î¶¯ ¿Í»§¶Ë²ÎÊý±í[ÊÇ·ñ¿ªÆô,ʼþID,¿ªÊ¼Ê±¼ä,½áÊøÊ±¼ä,µØÍ¼IDÁбí]  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GameWorld  | 
| import ChConfig  | 
| import datetime  | 
| import PlayerControl  | 
| from types import IntType  | 
| import GMCommon  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| #Â߼ʵÏÖ  | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param playerList [isOpen eventID]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer , playerList):  | 
|     playerListLen = len(playerList)  | 
|     #¹Ø±ÕÖ»Ðè¶þ¸ö²ÎÊý  | 
|     if playerListLen not in [2,5]:  | 
|         GameWorld.Log("¿Í»§¶Ë·â°ü³¤¶È´íÎó = %s"%playerListLen)  | 
|         return  | 
|       | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|     #¿ªÆô»òÕß¹Ø±Õ  | 
|     isOpen = playerList[0]  | 
|     #ʼþID  | 
|     eventID = playerList[1]  | 
|     #¿ªÆô»î¶¯  | 
|     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  | 
|           | 
|         #Èç¹ûΪȫ·þÎñÆ÷,ÄÇôÁбíΪ¿Õ  | 
|         #Èç¹ûΪµ¥¸öµØÍ¼,Íâ²ã»áת³ÉÕûÐÍ 1 type -> int  | 
|         #»î¶¯µØÍ¼IDÁбí '1,2,3,4,5,6' -> [1,2,3,4,5,6]  | 
|         #¿Í»§¶ËÁÐ±í  | 
|         client_List = playerList[4]  | 
|         #¹¹½¨ÁÐ±í  | 
|         mapIDList = []  | 
|         #¿ÕÁбí,ĬÈÏΪȫ·þÎñÆ÷  | 
|         if not client_List:  | 
|             pass  | 
|         elif type(client_List) is IntType:  | 
|             mapIDList.append(client_List)  | 
|         else:  | 
|             mapIDList = list(eval(client_List))  | 
|               | 
|         #Èç¹û»î¶¯ÒѾ¿ªÆô,Ö´Ðи²¸Ç»î¶¯Âß¼  | 
|         GMCommon.CloseProcessingEvent(eventID)  | 
|           | 
|         #ÉèÖûÄÚÈݽø»î¶¯¹ÜÀíÆ÷  | 
|         addEvent = eventManager.AddActiveEvent(eventID)  | 
|         addEvent.SetEventID(eventID)  | 
|         addEvent.SetStartTime('%s'%eventStartTime)  | 
|         addEvent.SetEndTime('%s'%eventCloseTime)  | 
|         addEvent.SetAccID(curPlayer.GetAccID())  | 
|         addEvent.SetPar('%s'%(mapIDList))  | 
|         #ÉèÖÃΪδ¼¤»î״̬  | 
|         addEvent.SetIsProcessing(False)  | 
|       | 
|     #¹Ø±Õ»î¶¯  | 
|     else:  | 
|         activeEvent = eventManager.FindActiveEvent(eventID)  | 
|         if not activeEvent:  | 
|             GameWorld.Log("###²éÕÒÒѾ¼¤»îµÄ»î¶¯Òì³£,ʧ°Ü = %s"%(eventID) , curPlayer.GetPlayerID())  | 
|             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("###ÎÞ·¨²éÕÒµ½»î¶¯ID = %s ¹Ø±ÕÌáʾ"%(eventID))  | 
|           | 
|         eventManager.DelActiveEvent(eventID)  | 
|       | 
|     #GeRen_chenxin_673416 GMÖ¸ÁîÒÑÉúЧ£¬²Ù×÷³É¹¦  | 
|     PlayerControl.NotifyCode(curPlayer,"GeRen_chenxin_673416")  | 
|       | 
|     #ÍÑ»ú¹¤¾ßʹÓà  | 
|     curPlayer.GMAnswer('%s;%s'%('GY_GM_MapGiveExp', True))  | 
|      |