| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GM.Commands.JobPlayerCount  | 
| #  | 
| # @todo:Ö°ÒµÈËÊýÐÅÏ¢  | 
| # @author hxp  | 
| # @date 2019-07-23  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: Ö°ÒµÈËÊýÐÅÏ¢  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2019-07-23 21:00"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import GameWorld  | 
| import PyGameData  | 
| import IpyGameDataPY  | 
| import time  | 
|   | 
|   | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param gmList []  | 
| #  @return None  | 
| def OnExec(curPlayer, gmList):  | 
|       | 
|     if not gmList:  | 
|         GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÈËÊý: JobPlayerCount 0")  | 
|         GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ24Сʱְҵ¶ÔÓ¦ÈËÊý: ")  | 
|         GameWorld.DebugAnswer(curPlayer, "JobPlayerCount Ö°Òµ1 ÈËÊý Ö°Òµ2 ÈËÊý")  | 
|         __PrintJobPlayerCount(curPlayer)  | 
|         return  | 
|       | 
|     if len(gmList) == 1 and gmList[0] == 0:  | 
|         PyGameData.g_onedayJobPlayerLoginoffTimeDict = {}  | 
|         GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÖ°ÒµÈËÊý³É¹¦! ")  | 
|         __PrintJobPlayerCount(curPlayer)  | 
|         return  | 
|       | 
|     if len(gmList) % 2 == 0:  | 
|         while gmList:  | 
|             job = gmList[0]  | 
|             count = gmList[1]  | 
|             gmList = gmList[2:]  | 
|             if job not in PyGameData.g_onedayJobPlayerLoginoffTimeDict:  | 
|                 PyGameData.g_onedayJobPlayerLoginoffTimeDict[job] = {}  | 
|             jobPlayerDict = PyGameData.g_onedayJobPlayerLoginoffTimeDict[job]  | 
|             curCount = len(jobPlayerDict)  | 
|             if curCount > count:  | 
|                 playerIDList = jobPlayerDict.keys()  | 
|                 for popPlayerID in playerIDList[:curCount - count]:  | 
|                     jobPlayerDict.pop(popPlayerID)  | 
|             elif curCount < count:  | 
|                 for i in range(count - curCount):  | 
|                     jobPlayerDict[100 + curCount + 1 + i] = int(time.time())  | 
|             else:  | 
|                 pass  | 
|         GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÖ°ÒµÈËÊý³É¹¦! ")  | 
|         __PrintJobPlayerCount(curPlayer)  | 
|                       | 
|     return  | 
|   | 
| def __PrintJobPlayerCount(curPlayer):  | 
|     openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1)  | 
|     GameWorld.DebugAnswer(curPlayer, "µ±Ç°: ")  | 
|     for job in openJobList:  | 
|         GameWorld.DebugAnswer(curPlayer, "Ö°Òµ%s  ÈËÊý: %s" % (job, len(PyGameData.g_onedayJobPlayerLoginoffTimeDict.get(job, {}))))  | 
|     return  | 
|   | 
|   | 
|   |