| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package GameWorldProcess  | 
| # @todo: ÊÀ½çÂß¼´¥·¢  | 
| #  | 
| # @author: eggxp  | 
| # @date 2010-5-10  | 
| # @version 6.3  | 
| #  | 
| # @note:   | 
| #---------------------------------------------------------------------  | 
| # @change: "2011-03-31 17:10" panwei ÐÂÔö¸ß¾«¶È¶¨Ê±Æ÷HighPrecisionProcess, 1ÃëC++µ÷ÓÃÒ»´Î  | 
| # @change: "2011-07-22 11:00" panwei FindGameFbEventºÍGetGameFbEvent½Ó¿Ú±ä¸üÐÂÔölineID  | 
| # @change: "2012-03-30 09:00" Alee Í³Ò»Ê±¼äµãͳ¼ÆÔÚÏßÈËÊý£¬±ãÓÚ¶à·þÎñͳ¼Æ  | 
| # @change: "2013-12-06 15:00" hxp Ôö¼Ó֪ͨMapServer¿ª·þÌìÊý£¬¿ª·þ»î¶¯×´Ì¬¸üР | 
| # @change: "2013-12-10 11:21" xmnathan È¥µô¿Í»§¶ËÓû§»úÆ÷Êý¾ÝÿÈÕÊý¾Ý²É¼¯²Ù×÷  | 
| # @change: "2013-12-26 20:20" Alee ¼õÉÙÁ÷Ïò¼Ç¼  | 
| # @change: "2013-12-27 22:00" Alee ¹Ø±ÕÿÈÕ³äֵͳ¼Æ£¨¹¦ÄÜ£©£¬¹Ø±Õ¼Ò×åÕù°ÔÕ½  | 
| # @change: "2014-01-14 20:00" hxp Ôö¼Ó֪ͨMapServerÉÏÒ»³¡Õ½ÃËÕ½»ñʤսÃËid  | 
| # @change: "2014-01-21 18:30" hxp Ôö¼ÓÄêÊÞÂß¼  | 
| # @change: "2014-02-11 14:30" hxp Ôö¼ÓÏÊ»¨OnDay´¦ÀíÈë¿Ú  | 
| # @change: "2014-02-27 12:00" hxp Ôö¼ÓÊÀ½çbossÂß¼  | 
| # @change: "2014-04-26 19:30" hxp Ôö¼ÓÁìµØÕ½»î¶¯  | 
| # @change: "2014-06-21 15:20" hxp Ôö¼ÓÌØ»Ý»î¶¯  | 
| # @change: "2014-08-15 17:00" xmnathan ÐÞ¸ÄOnDayº¯ÊýÄÚµÄÖ´ÐÐ˳Ðò  | 
| # @change: "2014-10-08 10:30" xmnathan add ¶¨Ê±ÇåÀí¹ýÆÚ²¹³¥  | 
| # @change: "2014-10-29 22:00" hxp MapServerInitOKÔö¼ÓÀ©Õ¹key״̬֪ͨ  | 
| # @change: "2014-10-31 15:00" xmnathan MapServerInitOK֪ͨ±ù·âÍõ×ù¹Ú¾üÕ½ÃËÃËÖ÷Ö°Òµµ½µØÍ¼Ë¢Ð¶ÔÓ¦µñÏñNPC  | 
| # @change: "2014-11-10 10:30" xmnathan PlayerBillboardͳһ¿½±´ÅÅÐаñ×òÈÕ°ñ  | 
| # @change: "2014-11-12 21:00" hxp OnDayʱ֪ͨMapServerµ±Ç°¿ª·þÌìÊýʱ»úÌáǰµ½MapServerOnDay֮ǰ  | 
| # @change: "2014-12-02 11:30" hxp Ôö¼ÓºÏ·þ״̬¼°ÌìÊý¼Ç¼; Ôö¼Ó¿ªµØÍ¼Í¬²½  | 
| # @change: "2014-12-03 14:30" hxp Ôö¼Óͬ²½ºÏ·þ»î¶¯×´Ì¬  | 
| # @change: "2014-12-03 18:00" hxp Ôö¼ÓºÏ·þÊ×´ÎÆô¶¯Êý¾Ý¼ÓÔØ´¦Àí  | 
| # @change: "2014-12-08 11:00" hxp Ôö¼ÓºÏ·þʱµÄ¿ª·þÌìÊý¼Ç¼  | 
| # @change: "2014-12-22 15:30" hxp Ôö¼ÓÈ«·þµôÂÊ  | 
| # @change: "2015-01-08 22:00" hxp µØÍ¼Æô¶¯ok֪ͨbossÐÅÏ¢  | 
| # @change: "2015-01-15 11:30" hxp Õû5·Öʼþ»ã±¨È«·þÔÚÏßÈËÊý; ¹Ø±ÕµØÍ¼ÈËÊý»ã±¨  | 
| # @change: "2015-01-22 15:00" hxp È¥³ý¸£Àû¶àͬ²½map  | 
| # @change: "2015-01-24 23:30" hxp ¿ªÆôµØÍ¼Í¬²½¹¥³ÇÕ½»ñʤսÃË  | 
| # @change: "2015-01-29 01:00" hxp ¿ªÆô·þÎñÆ÷ÖØÖÃÅÅÐаñ´¦Àí  | 
| # @change: "2015-02-04 14:00" hxp ÉñÃØÉ̵괦Àí  | 
| # @change: "2015-03-22 16:30" hxp Õ½Ã˼ÒÔ°  | 
| # @change: "2015-05-07 15:00" ljd ºì°ü²ú³ö¿ØÖÆ  | 
| # @change: "2015-06-05 17:00" hxp ÉÏÒ»´ÎPKÖÜÈüÌì֪ͨ  | 
| # @change: "2015-06-25 14:30" hxp Ôö¼Ó123457È«·þµôÂÊÔö¼Óʼþ  | 
| # @change: "2015-09-21 20:00" hxp ºÏ·þÊ×´ÎÆô¶¯Çå³ý¿ç·þ±¨ÃûÕ˺ÅÐÅÏ¢  | 
| # @change: "2015-10-25 17:00" hxp Ôö¼Ó¿ç·þPK  | 
| # @change: "2015-11-13 17:30" hxp Ôö¼ÓÍõÕßÕù°Ô  | 
| # @change: "2016-06-13 10:30" hxp ïÚ³µÐÞ¸ÄΪÏÞʱÍê³É  | 
| # @change: "2016-07-27 20:00" Alee Ð޸Ĵò¿ªÎļþ³¬Ê±¹Ø±Õ  | 
| # @change: "2016-08-05 19:00" hxp ½Å±¾ÈȸüÖ§³Ö  | 
| # @change: "2016-08-29 23:30" hxp ºé»ÄÖ®Á¦  | 
| # @change: "2016-08-30 16:00" hxp ×Ô¶¨ÒåÔÚÏßͳ¼Æ  | 
| # @change: "2016-10-26 17:00" hxp Ôö¼ÓÒ°ÍâµôÂä°ó¶¨µÈ¼¶¼ÆËã  | 
| # @change: "2016-11-03 21:30" hxp Í¨ÖªÕ½Ã˻µ±ÈÕ¿ªÆô״̬  | 
| # @change: "2017-05-24 16:00" hxp ¿ç·þ·þÎñÆ÷ÔÚÏßÍæ¼Òͳ¼Æ  | 
| # @change: "2017-06-05 19:30" hxp ºÏ·þºóÊ×´ÎÆô¶¯·þÎñÆ÷ɾ³ý¹ýÆÚµÄͨÓÃÊý¾Ý  | 
| # @change: "2017-06-22 15:00" hxp »î¶¯¿ØÖÆ´¥·¢ÆµÂʾ«È·µ½Õû·Ö  | 
| # @change: "2017-07-01 15:30" hxp ÈËÊýͳ¼ÆÖ§³Ö»ì·þģʽ  | 
| #---------------------------------------------------------------------  | 
| import GameWorld  | 
| import datetime  | 
| import ChConfig  | 
| import PlayerTruck  | 
| import PlayerEventCounter  | 
| import PlayerControl  | 
| import GMShell  | 
| import PlayerDBGSEvent  | 
| import PlayerFamily  | 
| import GameLogInfo  | 
| import GameWorldActionControl  | 
| import PlayerBillboard  | 
| #import PlayerExam  | 
| import IPY_GameServer  | 
| import GMCommon  | 
| import time  | 
| import DataRecordPack  | 
| import ShareDefine  | 
| import GameWorldAverageLv  | 
| import PlayerDBOper  | 
| import GameWorldBoss  | 
| import PlayerCompensation  | 
| import ReadChConfig  | 
| import EventReport  | 
| #import ReloadModule  | 
| import CrossRealmPK  | 
| import CrossRealmMsg  | 
| import CrossRealmPlayer  | 
| import CrossBattlefield  | 
| import CrossActionControl  | 
| import PlayerFBHelpBattle  | 
| import PlayerFamilyRedPacket  | 
| import PlayerFairyDomain  | 
| import IpyGameDataPY  | 
| import PlayerFamilyParty  | 
| import PlayerFamilyZhenfa  | 
| import GameWorldFamilyWar  | 
| import GameWorldArena  | 
| import CrossLuckyCloudBuy  | 
| import AuctionHouse  | 
| import PlayerXMZZ  | 
| import PlayerLove  | 
| import PlayerTeam  | 
| import PyGameData  | 
| import CrossBoss  | 
| import ChPlayer  | 
| import PyDataManager  | 
| import GameWorldOpenServerCampaign  | 
| import CrossBillboard  | 
| import CrossChampionship  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ´¥·¢Ã¿¸öСʱµÄʼþ  | 
| #  @param curTimeStr Ê±¼ä×Ö·û´®  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ÔÚÿ´ÎOnGameWorldProcessÖУ¬Òò¶Ô±Èʱ¼ä³öÏÖ²îÒ죬˵Ã÷¸Ã´¥·¢ÒÔСʱΪʱ¼ä²îµÄʼþ  | 
| #  ·Ö±ðµ÷ÓÃ Íæ¼ÒµÄOnHourºÍGameWorldµÄOnHour£¬  | 
| # £¨¶îÍâµÄ£¬Ã¿Ð¡Ê±¿ÉÄܻῪÆô´æ´¢ÈËÎïÐÅÏ¢×ֵ䣬Çå¿Õ±¦ÎïµôÂ䣩  | 
| #  ¸üе±Ç°Ê±¼ä  | 
| def OnHour(curTimeStr, tick):  | 
|     GameWorld.Log("GameServer -> OnHour!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnHour(tick)  | 
|     GameWorld.GetGameWorld().OnHour(curTimeStr)  | 
|     #ÉèÖôæÈ¡Êý¾Ý¿âKey  | 
|     __SetWorldKey_SavePlayer(curTimeStr)  | 
|     #ÿСʱÇå¿Õ±¦ÎïµôÂä  | 
|     #__ClearTreasureDropCount()  | 
|     #¼Ç¼µ±Ç°Ê±¼ä  | 
|     GameLogInfo.Set_Server_Hour()  | 
|       | 
|     PlayerFamily.FamilyOnHour()  | 
|     ChPlayer.CheckOnedayJobPlayerLoginoffTimeout()  | 
|     return  | 
|   | 
| ## ´¥·¢Ã¿ÈÕʼþ(²ÎÊý -> µ±Ç°Ê±¼ä)  | 
| #  @param curTimeStr Ê±¼ä×Ö·û´®  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnDay(curTimeStr, tick):  | 
|     GameWorld.Log("GameServer -> OnDay!")  | 
|     #ÅÅÐаñ¿½±´×òÈÕ°ñµ¥  | 
|     PlayerBillboard.CopyBillboardOnDay()  | 
|     CrossBillboard.CopyBillboardOnDay()  | 
|     #¿ª·þ»î¶¯£¬·ÅÔÚÅÅÐаñ¿½±´×òÈÕ°ñ¸üкó´¦Àí  | 
|     PlayerEventCounter.DoLogic_GameServer_OnDay(tick)  | 
|     # Í¨Öª¿ª·þÌìÊý, ·ÅÔÚµØÍ¼OnDay֮ǰ´¦Àí, ²»È»µØÍ¼ÔÚOnDayʱÐèÒªÓõ½¿ª·þÌìʱ»áÈ¡µ½×òÌìµÄÖµ  | 
|     openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay)  | 
|     isMixServer = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServer)  | 
|     mixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_MixServerDay)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_IsMixServer, isMixServer)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_MixServerDay, mixServerDay)  | 
|     GameWorld.GetGameWorld().OnDay(curTimeStr)  | 
|     #¼Ç¼µ±Ç°Ê±¼ä  | 
|     GameLogInfo.Set_Server_Day()  | 
|     #¼Ç¼ÅÅÐаñÐÅÏ¢µ½oss  | 
|     PlayerBillboard.NoteOssBillboardInfoByDay()  | 
|     # ³äÖµ»î¶¯ÏûºÄÔª±¦ÅÅÐаñ¸üР | 
|     #GameWorldActionHoliday.GoldActionRank_OnDay(tick)  | 
|     # ondayÖØÉèÈ«·þ³äÖµµãȯÊý£¬×ÜÔÚÏßÈËÊý  | 
|     # GameDataRecord.OnDayResetRecord()  | 
|     # ÏÉÃ˺ì°ü  | 
|     PlayerFamilyRedPacket.DoOnDay()  | 
|     # Íæ¼ÒµÈ¼¶¼Ç¼¸üР | 
|     ChPlayer.UpdataPlayerLVInfo()  | 
|     # Í¨Öª¿ª·þÌìÊý  | 
|     #openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay)  | 
|     #GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay)  | 
|     GameWorldOpenServerCampaign.DoOnDay()  | 
|     #ÇåÀí¹ýÆÚ²¹³¥  | 
|     PlayerCompensation.ClearUpTimeOutCompensation()  | 
|     import PlayerBourse  | 
|     PlayerBourse.OverTimeItemsDeal()  | 
|     # ÏÉÃËÁªÈü  | 
|     GameWorldFamilyWar.DoOnDay()  | 
|     # ÇéÔµ  | 
|     PlayerLove.DoOnDay()  | 
|     # Ôƹº  | 
|     CrossLuckyCloudBuy.DoOnDay()  | 
|     return  | 
|   | 
| def OnDayEx(tick):  | 
|     GameWorld.Log("GameServer -> OnDayEx!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnDayEx(tick)  | 
|       | 
|     __Set_Server_DayEx()  | 
|       | 
|     #ÏÉħ֮Õù  | 
|     PlayerXMZZ.XMZZOndayEx()  | 
|     #boss¸´»î  | 
|     GameWorldBoss.BossRebornOnDayEx()  | 
|     return  | 
|   | 
| ## ´¥·¢Ã¿ÖÜʼþ(²ÎÊý -> µ±Ç°Ê±¼ä)  | 
| #  @param curTimeStr Ê±¼ä×Ö·û´®  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnWeek(curTimeStr, tick):  | 
|     GameWorld.Log("GameServer -> OnWeek!")  | 
|     #¼Ç¼µ±Ç°Ê±¼ä-->½«¼Ç¼ʱ¼äÒÆµ½´¦ÀíÍæ¼ÒÖÜÏìӦ֮ǰ£¬ÒòÿÖÜÏìÓ¦ÐèÒª»ñÈ¡×îÐÂServer_Week  | 
|     GameLogInfo.Set_Server_Week()  | 
|     # ´¦ÀíÍæ¼ÒÿÖÜÏìÓ¦  | 
|     PlayerEventCounter.DoLogic_GameServer_OnWeek(tick)  | 
|     GameWorld.GetGameWorld().OnWeek(curTimeStr)  | 
|     return  | 
|   | 
| def OnWeekEx(tick):  | 
|     GameWorld.Log("GameServer -> OnWeekEx!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnWeekEx(tick)  | 
|       | 
|     __Set_Server_WeekEx()  | 
|     return  | 
|   | 
| ## ´¥·¢Ã¿ÔÂʼþ(²ÎÊý -> µ±Ç°Ê±¼ä)  | 
| #  @param curTimeStr Ê±¼ä×Ö·û´®  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnMonth(curTimeStr, tick):  | 
|     GameWorld.Log("GameServer -> OnMonth!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnMonth(tick)  | 
|     GameWorld.GetGameWorld().OnMonth(curTimeStr)  | 
|     #¼Ç¼µ±Ç°Ê±¼ä  | 
|     GameLogInfo.Set_Server_Month()  | 
|     return  | 
|   | 
| def OnMonthEx(tick):  | 
|     GameWorld.Log("GameServer -> OnMonthEx!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnMonthEx(tick)  | 
|       | 
|     __Set_Server_MonthEx()  | 
|     return  | 
|   | 
| ## ´¥·¢Ã¿Äêʼþ(²ÎÊý -> µ±Ç°Ê±¼ä)  | 
| #  @param curTimeStr Ê±¼ä×Ö·û´®  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnYear(curTimeStr, tick):  | 
|     GameWorld.Log("GameServer -> OnYear!")  | 
|     PlayerEventCounter.DoLogic_GameServer_OnYear(tick)  | 
|     GameWorld.GetGameWorld().OnYear(curTimeStr)  | 
|     #¼Ç¼µ±Ç°Ê±¼ä  | 
|     GameLogInfo.Set_Server_Year()  | 
|     return        | 
|           | 
| #---------------------------------------------------------------------  | 
| ## ÉèÖÃÊÇ·ñ´ò¿ª´¢´æÍæ¼Ò×Öµä  | 
| #  @param curTimeStr Ê±¼ä  | 
| #  @return None  | 
| #  @remarks Èç¹ûÊÇ23µã£¬¾Í´ò¿ª´æ´¢Íæ¼Ò×ֵ䣬·ñÔò¾Í¹Ø±Õ¡£   | 
| #  Õâ¸ö×ÖµäÖµÔÚDispose_MapServer_PlayerSave Àï»áÓõ½¡£  | 
| #  Dispose_MapServer_PlayerSaveÕâ¸öÿ´ÎOnGameProcess¶¼»áµ÷Ó㬠 | 
| #  Ö»ÓÐ×ֵ俪ÁË£¬²Å´æ´¢Íæ¼ÒÊý¾Ý  | 
| def __SetWorldKey_SavePlayer(curTimeStr):  | 
|     #curTimeStr -> 2009-03-05 16:00:00 type -> str  | 
|     #È¡³öµ±Ç°µÄСʱÊý  | 
|     try:  | 
|         timeStr = int(curTimeStr.split()[1].split(':')[0])  | 
|     except BaseException , e:  | 
|         GameWorld.Log('###»ñÈ¡Íæ¼Ò´¢´æ×ÖµäÒì³£ = %s , %s'%(curTimeStr , e))  | 
|         return  | 
|       | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     #µ±Ç°Ê±¼äÊÇ23µã  | 
|     if timeStr == 23:  | 
|         if not gameWorld.GetDictByKey(ChConfig.Def_WorldKey_SavePlayer):  | 
|             #ÉèÖÿªÆô  | 
|             gameWorld.SetDict(ChConfig.Def_WorldKey_SavePlayer , 1)  | 
|     else:  | 
|         if gameWorld.GetDictByKey(ChConfig.Def_WorldKey_SavePlayer):  | 
|             #»¹Ô×Öµä  | 
|             gameWorld.SetDict(ChConfig.Def_WorldKey_SavePlayer , 0)  | 
|           | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¸ß¾«¶È¼ÆÊ±Æ÷, 1ÃëC++µ÷ÓÃÒ»´Î  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks  | 
| def HighPrecisionProcess(tick):  | 
|     GameWorld.GetPsycoFunc(__Func_HighPrecisionProcess)(tick)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¸ß¾«¶È¼ÆÊ±Æ÷, 1ÃëC++µ÷ÓÃÒ»´Î  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks  | 
| def __Func_HighPrecisionProcess(tick):  | 
|     if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit):  | 
|         return  | 
|     curTime = int(time.time())  | 
|       | 
|     #ÏÉÃËÑç»á´ðÌⶨʱÆ÷  | 
|     PlayerFamilyParty.FamilyParty_Process(tick)  | 
|     # °ïÖ÷µ¯ÛÀʱÖÓµ÷Óà  | 
|     PlayerFamily.OnLeaderImpeachTick(tick)  | 
|     #¿ç·þÍæ¼Ò  | 
|     CrossRealmPlayer.OnCrossProcess(tick)  | 
|     #¿ç·þPKÆ¥Åä  | 
|     CrossRealmPK.OnPKMatchProcess(tick)  | 
|       | 
|     GameWorldBoss.DoCheckWorldBossReborn(tick)  | 
|       | 
|     #×é¶Ó¸±±¾°æ±¾  | 
|     PlayerTeam.DoTeamProcess(tick)  | 
|       | 
|     #²Ù×÷Python±í  | 
|     PlayerDBOper.PyDBProccess(tick)  | 
|       | 
|     #ÅÄÂôÐÐ  | 
|     AuctionHouse.OnAuctionItemTimeProcess(curTime, tick)  | 
|       | 
|     #ÇéÔµ  | 
|     PlayerLove.OnTimeProcess(curTime, tick)  | 
|       | 
|     #ÿÕû·ÖÖÓ´¦ÀíÒ»´Î  | 
|     curDateTime = datetime.datetime.today()  | 
|     curMinute = curDateTime.minute  | 
|     curSecond = curDateTime.second  | 
|     processMinute = curMinute + 1 # .minuteÊÇ0~59£¬ÕâÀïÊÖ¶¯+1  | 
|     lastProcessMinute = GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_ProcessMinute)  | 
|     if processMinute != lastProcessMinute:  | 
|         GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_ProcessMinute, processMinute)  | 
|         ## ·þÎñÆ÷Æô¶¯Ê±£¬µÚÒ»´ÎÕû·Ö´¦Àí»áÑÓ³Ù 0~59Ãë  | 
|         #if lastProcessMinute != 0:  | 
|         GameWorldProcessOnMinute(curMinute, tick)  | 
|       | 
|     # Ã¿Õû10Ãë´¦Àí          | 
|     if curSecond % 10 == 0:  | 
|         SendMapCommMapLinePlayerCount()  | 
|           | 
|     return  | 
|   | 
| def SendMapCommMapLinePlayerCount(isForce=False):  | 
|     # Í¬²½³£¹æµØÍ¼Ïß·ÈËÊýÃ÷ϸµ½µØÍ¼·þÎñÆ÷£¬Ä¿Ç°ÓÃÓÚÇÐͼ·ÖÁ÷Óà  | 
|     if not isForce and not PyGameData.g_needSyncCommMapLinePlayerCount:  | 
|         return  | 
|       | 
|     GameWorld.DebugLog("֪ͨ³£¹æµØÍ¼Íæ¼ÒÈËÊýÐÅÏ¢: isForce=%s,PyGameData.g_commMapLinePlayerCountDict=%s"   | 
|                        % (isForce, PyGameData.g_commMapLinePlayerCountDict))  | 
|       | 
|     GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_CommMapLinePlayerCount, PyGameData.g_commMapLinePlayerCountDict)  | 
|               | 
|     PyGameData.g_needSyncCommMapLinePlayerCount = False      | 
|     return  | 
|   | 
| def GameWorldProcessOnMinute(curMinute, tick):  | 
|     # Ã¿Õû·ÖÖÓ´¥·¢Ò»´Î  | 
|     CheckServerHasPlayerLoginAfterInitOK()  | 
|     #¼ì²é·þÎñÆ÷Õýʽ¿ª·þ  | 
|     DoCheckNewServerOpen(tick)  | 
|     #»Ø±¨Êý¾Ý¿âµ±Ç°ÔÚÏßÍæ¼ÒÊý  | 
|     DisposeGameActivePlayer(tick)  | 
|     #´¦ÀíÓÎÏ·ÊÀ½çÖеÄʱ¼äʼþ  | 
|     DisposeGameWorldEvenByTime(tick)  | 
|     GameWorldActionControl.Dispose_OperationActionState()  | 
|     GameWorldActionControl.Dispose_DailyActionState()  | 
|     GameWorldActionControl.Dispose_FBStateTime()  | 
|     #¿ç·þPK  | 
|     CrossRealmPK.OnMinuteProcess()  | 
|     #¿ç·þÅÅλ  | 
|     CrossChampionship.OnMinuteProcess(curMinute)  | 
|     CrossBattlefield.OnMinuteProcess()  | 
|     #´¦ÀíÖØ¿ª·þÎñÆ÷ºó, »î¶¯¼ÌÐø¿ªÆôÂß¼¸ù¾ÝÌìÊý  | 
|     #GameWorldActionControl.Dispose_Action_GoOn_ByDay(tick)  | 
|     #´¥·¢ÊÀ½çµÈ¼¶  | 
|     GameWorldAverageLv.OpenWorldAverageLv()  | 
|     #µ¹¼ÆÊ±Àë¶Ó´¦Àí  | 
|     PlayerTeam.DoCountdownLeaveTeamLogic(tick)  | 
|     #ºì°ü  | 
|     PlayerFamilyRedPacket.OnRedPacketMinuteProcess()  | 
|     #ÅÄÂôÐÐ  | 
|     AuctionHouse.OnAuctionItemMinuteProcess(tick)  | 
|     #ÿ5·ÖÖÓ´¥·¢Ò»´ÎÏÉÃË×ÜÕ½Á¦¸üР | 
|     if curMinute % 5 == 0:  | 
|         PlayerFamily.UpdFamilyTotalFightPower()  | 
|         PlayerFamilyRedPacket.CheckDelRedpacketData()  | 
|           | 
|     return  | 
|   | 
| def CheckServerHasPlayerLoginAfterInitOK():  | 
|     ## ¼ì²é·þÎñÆ÷Æô¶¯³É¹¦ºóÊÇ·ñÓÐÍæ¼ÒÕý³£µÇ¼  | 
|     initGameWorldTime = GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit)  | 
|     if not initGameWorldTime:  | 
|         return  | 
|       | 
|     if PyGameData.g_noPlayerLoginWarningMailState:  | 
|         return  | 
|       | 
|     curTime = int(time.time())  | 
|     noPlayerLoginWarningTimes = IpyGameDataPY.GetFuncCfg("ServerEvent", 1) * 60 # x·ÖÖÓûÓÐÍæ¼ÒµÇ¼ÔòÔ¤¾¯  | 
|     if curTime - initGameWorldTime < noPlayerLoginWarningTimes:  | 
|         return  | 
|       | 
|     GameWorld.SendGameError("NoPlayerLogin")  | 
|     PyGameData.g_noPlayerLoginWarningMailState = 1  | 
|     return  | 
|   | 
| def OnReloadConfig():  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÓÎÏ·ÊÀ½ç´¦Àí(²ÎÊý -> µ±Ç°Ê±¼ä) -< µ×²ã¶¨Ê±µ÷Óà  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks   | 
| def OnGameWorldProcess(tick):  | 
|     GameWorld.GetPsycoFunc(__Func_OnGameWorldProcess)(tick)  | 
|     return  | 
|   | 
| ## ÓÎÏ·ÊÀ½ç´¦Àí(²ÎÊý -> µ±Ç°Ê±¼ä) -< µ×²ã¶¨Ê±µ÷Óà  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks   | 
| def __Func_OnGameWorldProcess(tick):  | 
|     ##´¦ÀíÓÎÏ·ÊÀ½çÖеÄʱ¼äʼþ  | 
|     #DisposeGameWorldEvenByTime(tick)  | 
|     #´¦ÀíÓÎÏ·ÊÀ½çÖеÄïÚ³µÊ¼þ  | 
|     DisposeGameWorldEvenByTruck(tick)  | 
|     #´¦ÀíÊÀ½ç¹«¸æ  | 
|     DisposeGameWorldBroadcast(tick)  | 
|     #´¦ÀíÊÀ½ç»î¶¯  | 
|     DisposeGameWorldGame(tick)  | 
|     #»Ø±¨Êý¾Ý¿âµ±Ç°ÔÚÏßÍæ¼ÒÊý  | 
|     #DisposeGameActivePlayer(tick)  | 
|     #ͬ²½µØÍ¼·þÎñÆ÷ʱ¼ä  | 
|     Dispose_MapServer_Time(tick)  | 
|     #±£´æÍæ¼ÒÊý¾Ý  | 
|     Dispose_MapServer_PlayerSave(tick)  | 
|     #ˢеØÍ¼·þÎñÆ÷״̬  | 
|     DisposeMapServerRunningState(tick)  | 
|     #»Ø±¨Êý¾Ý¿â·þÎñÆ÷״̬£¬¼Ç¼Êý¾Ý¿âÈÕ־ûÓÐÓô¦  | 
|     #DisposeServerState(tick)  | 
|     #¶¨Ê±´æÈ¡Êý¾Ý¿âÖеÄGMÃüÁî  | 
|     Dispose_DataBase_GMShell(tick)  | 
|     ##´¦ÀíÖØ¿ª·þÎñÆ÷ºó, »î¶¯¼ÌÐø¿ªÆôÂß¼¸ù¾ÝÌìÊý  | 
|     #GameWorldActionControl.Dispose_Action_GoOn_ByDay(tick)  | 
|       | 
|     #¶¨Ê±ÏòRouteServer·¢ËÍÏûÏ¢  | 
|     Dispose_SendMsg_RouteServer(tick)  | 
|     #¶¨Ê±¼ì²â¹Ø±Õ³¬Ê±Îļþ  | 
|     EventReport.OnTimeCloseScribeTxt()  | 
|     #ÊÀ½çboss¼ÆË㵱ǰÔÚÏßÈËÊý  | 
|     GameWorldBoss.CalcGameWorldBossOnlineCnt(tick)  | 
|     return  | 
|   | 
| ## ¶¨Ê±ÏòRouteServer·¢ËÍÐÅÏ¢  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks SendHeartBeat()¶øÒÑ£¬¼ä¸ôÓÃGetTickByTypeÈ¡µÃ  | 
| def Dispose_SendMsg_RouteServer(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     lastTick = gameWorld.GetTickByType(ChConfig.TYPE_SendMsg_RouteServer)  | 
|       | 
|     if lastTick == -1:  | 
|         #δ³õʼ»¯²»·¢ÐÅÏ¢  | 
|         return  | 
|       | 
|     if tick - lastTick < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_SendMsg_RouteServer]:  | 
|         return  | 
|       | 
|     gameWorld.SetTickByType(ChConfig.TYPE_SendMsg_RouteServer , tick)  | 
|       | 
|     #·¢ËÍÏûÏ¢¸øRouteServer  | 
|     GameWorld.GetGameWorld().SendHeartBeat()  | 
|     return  | 
|   | 
|       | 
| ## ¶¨Ê±´æÈ¡Êý¾Ý¿âÖеÄGMÃüÁî  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ¼ä¸ôÅжϣ¬´ÓgameWorld.GetTickByTypeÀïÈ¡  | 
| #  gameWorld.GetDBGMCommandListManager() À´²Ù×÷¾ßÌåµÄgmÃüÁî´Ódb»ñÈ¡£¬·¢Ë͸øgmShellÖ´ÐÐ  | 
| def Dispose_DataBase_GMShell(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     if tick - gameWorld.GetTickByType(ChConfig.TYPE_ReadDateBaseGM) < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_ReadDateBaseGM]:  | 
|         return  | 
|       | 
|     gameWorld.SetTickByType(ChConfig.TYPE_ReadDateBaseGM , tick)  | 
|       | 
|     dBGMCommandListManager = gameWorld.GetDBGMCommandListManager()  | 
|     #֪ͨÊý¾Ý¿â×¼±¸»ñÈ¡ÃüÁî  | 
|     dBGMCommandListManager.DataServer_GMCommandReq()  | 
|       | 
|     dBGMCommandListCount = dBGMCommandListManager.GetCount()  | 
|       | 
|     if not dBGMCommandListCount:  | 
|         #Î޼Ǽ  | 
|         return  | 
|       | 
|     #Ö´ÐÐGMÃüÁî  | 
|     for i in range(0 , dBGMCommandListCount):  | 
|         gmCommon = dBGMCommandListManager.GetAt(i)  | 
|         GMShell.DoLogic_DBGMCommon(gmCommon)  | 
|       | 
|     #Çå¿ÕËùÓÐÊý¾Ý¿âµÄGMÇëÇó  | 
|     dBGMCommandListManager.Clear()  | 
|     return  | 
|   | 
| ## Í¬²½µØÍ¼·þÎñÆ÷ʱ¼ä  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks GetTickByTypeȡʱ¼ä¼ä¸ô£¬gameWorld.OnTimeSyncÀ´Ïò¸÷µØÍ¼·¢³öͬ²½ÐÅÏ¢  | 
| def Dispose_MapServer_Time(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     if tick - gameWorld.GetTickByType(ChConfig.TYPE_SendTimeToMapServer) < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_SendTimeToMapServer]:  | 
|         return  | 
|       | 
|     gameWorld.SetTickByType(ChConfig.TYPE_SendTimeToMapServer , tick)  | 
|       | 
|     #ͬ²½¼ÆËã»úʱ¼ä  | 
|     gameWorld.OnTimeSync(GameWorld.GetCurrentDataTimeStr())  | 
|     return  | 
|   | 
| ## »Ø±¨Êý¾Ý¿â·þÎñÆ÷״̬  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks gameWorld.DataServer_ServerStateReport() ÏòÊý¾Ý¿â»Ø±¨  | 
| #  GetTickByType È¡¼ä¸ô  | 
| def DisposeServerState(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     if tick - gameWorld.GetTickByType(ChConfig.TYPE_SendServerState) < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_SendServerState]:  | 
|         return  | 
|       | 
|     gameWorld.SetTickByType(ChConfig.TYPE_SendServerState , tick)  | 
|       | 
|     #»Ø±¨Êý¾Ý¿â·þÎñÆ÷״̬  | 
|     gameWorld.DataServer_ServerStateReport()  | 
|     return  | 
|   | 
| ## ±£´æÍæ¼ÒÊý¾Ý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks GetDictByKey(ChConfig.Def_WorldKey_SavePlayer) Õâ¸ö×ÖµäֵΪ1£¬Ôò±£´æÍæ¼ÒÊý¾Ý  | 
| #  OnHourÀÉèÖÃ23µãʱ£¬½«´ËkeyÉèÖÆÎª¿ÉÒÔ±£´æ¡£curPlayer.MapServer_PlayerSave()·¢Ëͱ£´æÇëÇó  | 
| def Dispose_MapServer_PlayerSave(tick):  | 
|     if GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_SavePlayer) != 1:  | 
|         #GameWorld.Log('±£´æ¿ª¹ØÎ´¿ªÆô')  | 
|         return  | 
|       | 
|     if datetime.datetime.today().minute < 50:  | 
|         #GameWorld.Log('ûµ½50·ÖÖÓ')  | 
|         return  | 
|       | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     curPlayerList = []  | 
|     for i in range(playerManager.GetActivePlayerCount()):  | 
|         curPlayer = playerManager.GetActivePlayerAt(i)  | 
|         curPlayerList.append(curPlayer)  | 
|       | 
|     #PythonÅÅÐò  | 
|     curPlayerList.sort(key = GetKey)  | 
|       | 
|     for i in range(0, len(curPlayerList)):  | 
|         #³¬¹ý50¸öÍæ¼Ò,²»´¦Àí  | 
|         if i >= 50:  | 
|             break  | 
|           | 
|         curPlayer = curPlayerList[i]  | 
|         curPlayer.MapServer_PlayerSave()  | 
|         #GameWorld.Log('---%s'%curPlayer.GetLV())  | 
|       | 
|     #ÉèÖÃΪÒѾ´¦ÀíÍê±Ï  | 
|     GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_SavePlayer , 2)  | 
|     return  | 
|   | 
| ## PythonµÄsort×Öµä  | 
| #  @param curPlayer µ±Ç°Ê±¼ä  | 
| #  @return lv  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def GetKey(curPlayer):  | 
|     return curPlayer.GetLV()  | 
|   | 
| ## »Ø±¨µ±Ç°Êý¾Ý¿âÍæ¼ÒÔÚÏßÊýÁ¿  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  ËùÓзþÎñÆ÷ÈËÊýÒª»Ø±¨Ò»´Î£¬  Ã¿¸ömapÒ²Òª»Ø±¨Ò»´Î  | 
| #  gameWorld.GetTickByType(0 - n) È¡¼ä¸ô  | 
| def DisposeGameActivePlayer(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()      | 
|     curMinute = datetime.datetime.today().minute   | 
|     #ΪÁËÿ¸ö·þµÄÊä³öʱ¼äµãͳһһ¸ö·ÖÖӵ㣬±ãÓÚͳ¼Æ  | 
|     if curMinute % 5 != 0:  | 
|         return  | 
|     noteData = gameWorld.GetDictByKey("OnlineCntM")  | 
|     if noteData == curMinute:  | 
|         # Í¬Ò»·ÖÖÓ²»¶à·¢ËÍ£¬´Ë´¦²»½¨ÒéÓÃCD´¦Àí£¬±ÜÃâÁ½CD³åÍ»  | 
|         return  | 
|     gameWorld.SetDict("OnlineCntM", curMinute)  | 
|       | 
|     # È«·þÔÚÏßÈËÊýƽ̨Ã÷ϸ  | 
|     platformOLDict = {} # Æ½Ì¨ÔÚÏßÈËÊý {ƽ̨:ÈËÊý, ...}  | 
|     #mapPlatformOLDict = {} # µØÍ¼Æ½Ì¨ÔÚÏßÈËÊý {mapID:{ƽ̨:ÈËÊý, ...}, ...}  | 
|     tjgOnlineCnt = 0 # ÍÑ»ú¹ÒÔÚÏßÍæ¼Ò  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     activePlayerCount = playerManager.GetActivePlayerCount()  | 
|     for index in xrange(activePlayerCount):  | 
|         player = playerManager.GetActivePlayerAt(index)  | 
|         if player == None or not player.GetInitOK():  | 
|             continue  | 
|           | 
|         if PlayerControl.GetIsTJG(player):  | 
|             tjgOnlineCnt += 1  | 
|             continue  | 
|           | 
|         platform = GameWorld.GetPlayerPlatform(player)  | 
|         platformOLDict[platform] = platformOLDict.get(platform, 0) + 1 # ÀÛ¼ÆÆ½Ì¨ÔÚÏßÈËÊý  | 
|           | 
| #        mapID = player.GetMapID()  | 
| #        mapOLDict = mapPlatformOLDict.get(mapID, {})  | 
| #        mapOLDict[platform] = mapOLDict.get(platform, 0) + 1 # ÀۼƵØÍ¼Æ½Ì¨ÔÚÏßÈËÊý  | 
| #        mapPlatformOLDict[mapID] = mapOLDict  | 
|           | 
|     #GameWorld.DebugLog("ƽ̨ÔÚÏßÈËÊý: %s" % platformOLDict)  | 
|     #GameWorld.DebugLog("µØÍ¼Æ½Ì¨ÔÚÏßÈËÊý: %s" % mapPlatformOLDict)  | 
|           | 
|     # ¼Ç¼·þÎñÆ÷ÈËÊý  | 
|     #activePlayerCount = GameWorld.GetPlayerManager().GetActivePlayerCount()  | 
|     #DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, platformOLDict, tjgOnlineCnt)  | 
|     #===========================================================================  | 
|     isMixture = False #ÊÇ·ñ»ì·þ  | 
|     if isMixture:  | 
|         for platform, playerCnt in platformOLDict.items():  | 
|             DataRecordPack.DR_OnLinePlayerCount(playerCnt, platform, tjgOnlineCnt) # µ¥Æ½Ì¨  | 
|             EventReport.WriteEvent_concurrency(playerCnt, 0, platform) # µ¥Æ½Ì¨  ´Ë´¦²»ÄÜ´«ÍÑ»ú¹ÒÍæ¼Ò×ÜÊý  | 
|         DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt)    # ×ÜÔÚÏß  | 
|         #EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt)  | 
|     else:  | 
|         serverPlatform = GameWorld.GetPlatform()  | 
|         DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt)    # ×ÜÔÚÏß  | 
|         EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt, serverPlatform)  | 
|     #===========================================================================  | 
|     #ˢе±Ç°µØÍ¼·þÎñÆ÷  | 
|     #===========================================================================  | 
|     # custom_concurrencyMapList = ReadChConfig.GetEvalChConfig("EventReportMapID")  | 
|     # gameMapManager = GameWorld.GetGameWorld().GetGameMapManager()  | 
|     # gameMapManager.RefreshMapPlayer()  | 
|     # mapCnt = gameMapManager.GetCount()  | 
|     # for i in xrange(mapCnt):  | 
|     #    curMap = gameMapManager.GetAt(i)  | 
|     #    mapID = curMap.GetID()  | 
|     #    if mapID not in custom_concurrencyMapList:  | 
|     #        continue  | 
|     #    #playerCnt = curMap.GetCount()  | 
|     #    mapOLDict = mapPlatformOLDict.get(mapID, {})  | 
|     #    for platform, playerCnt in mapOLDict.items():  | 
|     #        EventReport.WriteEvent_custom_concurrency(platform, playerCnt, "MapID:%s" % mapID)  | 
|     #===========================================================================  | 
|           | 
| #    #ˢе±Ç°µØÍ¼·þÎñÆ÷  | 
| #    gameMapManager = gameWorld.GetGameMapManager()  | 
| #    #ˢеØÍ¼·þÎñÆ÷  | 
| #    gameMapManager.RefreshMapPlayer()  | 
| #    for i in range(gameMapManager.GetGameMapByIPCount()):  | 
| #        curIP = gameMapManager.GetGameMapIPAt(i)  | 
| #        curIndex = gameMapManager.GetGameMapIndexByIPAt(i)  | 
| #        # ¼Ç¼µØÍ¼·þÎñÆ÷ÈËÊý  | 
| #        DataRecordPack.DR_GameMapOnLinePlayerCnt(str(curIP), curIndex, gameMapManager.GetGameMapPlayerCountByIPAt(i))  | 
|     return  | 
|   | 
| ## ´¦ÀíÊÀ½ç»î¶¯  | 
| #  @param tick  | 
| #  @return None  | 
| #  @remarks   | 
| #  ¶Ôµ±Ç°ËùÓл½øÐÐÅжϣ¬Èç¹û¿ªÆô»ò¹Ø±ÕµÄʱ¼äÓÐÒì³££¬»òÕ߻¹ýÆÚ£¬Ôò×¼±¸É¾³ý  | 
| #  Èç¹ûÇ¡ºÃ´¦Ôڻʱ¼äÄÚ£¬Ôò¿ªÆôSetIsProcessing(True) ²¢Í¨ÖªÏàÓ¦map  | 
| #  ×îºó½«ÒªÉ¾³ýµÄ»î¶¯µÄɾ³ý¹¤×÷£¨É¾³ýǰҪÏȹرջ) Í³Ò»½»¸ø±ðµÄ ·½·¨À´´¦Àí  | 
| def DisposeGameWorldGame(tick):  | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|     delList = []  | 
|     todayDateTime = datetime.datetime.today()  | 
|       | 
|     for index in range(eventManager.GetActiveEventCount()):  | 
|         event = eventManager.GetActiveEventByIndex(index)  | 
|         eventID = event.GetEventID()  | 
|         eventEndTime = GameWorld.GetDateTimeByStr(event.GetEndTime())  | 
|         eventStartTime = GameWorld.GetDateTimeByStr(event.GetStartTime())  | 
|           | 
|         if not eventStartTime or not eventEndTime:  | 
|             delList.append(eventID)  | 
|             GameWorld.Log("###---»î¶¯ÉèÖÃʱ¼äÒì³£ , %s , %s , %s"%(eventID , eventStartTime , eventEndTime))  | 
|             continue  | 
|           | 
|         #먦ÆôµÄ»î¶¯  | 
|         if not event.GetIsProcessing():  | 
|             if todayDateTime > eventStartTime and todayDateTime < eventEndTime:  | 
|                 #֪ͨµØÍ¼·þÎñÆ÷  | 
|                 event.SetIsProcessing(True)  | 
|                 #»ñµÃÄÚÈÝ  | 
|                 eventPar = event.GetPar()  | 
|                 #֪ͨµØÍ¼·þÎñÆ÷µ±Ç°»î¶¯  | 
|                 __NotifyMapServerProcess(event , eventID , eventPar)  | 
|                   | 
|                 #Êä³öϵͳÌáʾ  | 
|                 sysMsg = GMCommon.GetGameServer_GM_GameOpen_Msg(eventID)  | 
|                 if sysMsg != "":  | 
|                     PlayerControl.WorldNotify(0, sysMsg)  | 
|                   | 
|         if todayDateTime > eventEndTime:  | 
|             delList.append(eventID)  | 
|           | 
|     for delEventID in delList:  | 
|         DoLogic_ProcessEvent_Close(delEventID)  | 
|               | 
|         #ɾ³ýʼþ  | 
|         eventManager.DelActiveEvent(delEventID)  | 
|                       | 
|         #Êä³öϵͳÌáʾ  | 
|         sysMsg = GMCommon.GetGameServer_GM_GameClose_Msg(delEventID)  | 
|         if sysMsg != "":  | 
|             PlayerControl.WorldNotify(0, sysMsg)  | 
|               | 
|     return  | 
|   | 
| ## ½«»î¶¯Í¨Öª¸øµØÍ¼·þÎñÆ÷  | 
| #  @param event »î¶¯  | 
| #  @param eventID »î¶¯ID  | 
| #  @param eventPar ÄÚÈÝ  | 
| #  @return None  | 
| #  @remarks Í¨¹ý»î¶¯ID£¬·Ö±ðµ÷Óò»Í¬µÄ·½·¨À´´¦Àí»î¶¯Âß¼£¬ÕâÀï¶¼ÊÇ¿ªÆô»î¶¯  | 
| #  »î¶¯µÄ²ÎÊýParÕâÀïÓÐÓõ½ ¶øÇÒ²»Í¬µÄ»î¶¯£¬ParµÄº¬ÒåÒ²²»Í¬£¬¿ÉÄÜ»¹Òª½øÐнâÎö  | 
| def __NotifyMapServerProcess(event , eventID , eventPar):  | 
|     #ÊÇ·ñÊÇÈ«·þË«±¶ÈÎÎñ  | 
|     if eventID == ChConfig.Def_GY_GM_Game_DoubleExp:  | 
|         __DisposeWorldExpEvent(True , int(eventPar))  | 
|     #ÊÇ·ñÊÇÈ«·þµôÂÊÔö¼Ó  | 
|     elif eventID == ChConfig.Def_GY_GM_Game_DropRate:  | 
|         __DisposeWorldDropRateEvent(True , int(eventPar))  | 
|     #ÊÇ·ñÊÇÈ«·þ¹«¸æÈÎÎñ  | 
|     elif eventID == ChConfig.Def_GY_GM_Game_Broadcast:  | 
|         interval , msg = __GetBroseCastStr(eventPar)  | 
|         __DisposeBroadcastEvent(True, msg, interval)  | 
|     else:  | 
|         #֪ͨËùÓеĵØÍ¼·þÎñÆ÷,Ö´ÐÐÈÎÎñÊý¾Ý½Å±¾  | 
|         event.Notify_AllMapServerProcess()  | 
|           | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ¹Ø±ÕÒѾ¿ªÆôµÄ»î¶¯  | 
| #  @param eventID »î¶¯ID  | 
| #  @return None  | 
| #  @remarks Ó뿪Æô»î¶¯Ïà·´£¬ÕâÀïÊǹرջ  | 
| def DoLogic_ProcessEvent_Close(eventID):  | 
|     #ÊÇ·ñÊÇÈ«·þË«±¶ÈÎÎñ  | 
|     if eventID == ChConfig.Def_GY_GM_Game_DoubleExp:  | 
|         __DisposeWorldExpEvent(False)  | 
|     #ÊÇ·ñÊÇÈ«·þµôÂÊÔö¼Ó  | 
|     elif eventID == ChConfig.Def_GY_GM_Game_DropRate:  | 
|         __DisposeWorldDropRateEvent(False)  | 
|     #ÊÇ·ñÊÇÈ«·þ¹«¸æÈÎÎñ  | 
|     elif eventID == ChConfig.Def_GY_GM_Game_Broadcast:  | 
|         __DisposeBroadcastEvent(False)  | 
|           | 
|     return  | 
| #---------------------------------------------------------------------  | 
|   | 
| ## ½âÎö¹Ø²¥×Ö·û´®  | 
| #  @param eventPar  | 
| #  @return interval , msg  | 
| #  @remarks ¹ã²¥»î¶¯Á¦µÄPar£¬Í¨¹ý´Ë·½·¨±»½âÎö³É¹ã²¥ÄÚÈݺ͹㲥¼ä¸ô  | 
| def __GetBroseCastStr(eventPar):  | 
|     index = eventPar.find(":")  | 
|     interval = int(eventPar[:index])  | 
|     msg = eventPar[index + 1:]  | 
|     return interval , msg  | 
|   | 
| ## ÉèÖò¢´¦ÀíÊÀ½ç¾ÑéÂß¼  | 
| #  @param isOpen ÊÇ·ñÉèÖà  | 
| #  @param expRate Ä¬ÈÏÍò·ÖÂÊ Õâ¸öÊÇδ¿ªÊ¼»î¶¯µÄĬÈϾÑé±¶ÂÊ  | 
| #  @return None  | 
| #  @remarks ¿ªÆô»òɾ³ýÈ«¸±Ë«±¶»î¶¯£¬½ö½öÉèÖÃgameWorld.SetExpRate¾Í¿ÉÒÔÁË  | 
| def __DisposeWorldExpEvent(isOpen , expRate = ChConfig.Def_MaxRateValue):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     #¿ªÆô»î¶¯  | 
|     if isOpen:  | 
|         gameWorld.SetExpRate(expRate)  | 
|     else:  | 
|         gameWorld.SetExpRate(expRate)  | 
|           | 
|     return  | 
|   | 
| ## ÉèÖò¢´¦ÀíÊÀ½çµôÂÊÂß¼  | 
| #  @param isOpen ÊÇ·ñÉèÖà  | 
| #  @param expRate Ä¬ÈÏÍò·ÖÂÊ Õâ¸öÊÇδ¿ªÊ¼»î¶¯µÄĬÈϾÑé±¶ÂÊ  | 
| #  @return None  | 
| def __DisposeWorldDropRateEvent(isOpen, expRate=0):  | 
|     #¿ªÆô»î¶¯  | 
|     if isOpen:  | 
|         worldDropRateAdd = max(0, expRate - ChConfig.Def_MaxRateValue)  | 
|     else:  | 
|         worldDropRateAdd = 0 # Èô¹Ø±Õ£¬Ä¬ÈÏΪ0  | 
|           | 
|     SetWorldDropRateAdd(worldDropRateAdd)  | 
|     return  | 
|   | 
| ## ÉèÖò¢Í¨ÖªÊÀ½çµôÂÊÔö¼Ó  | 
| def SetWorldDropRateAdd(worldDropRateAdd):  | 
|     #===============================================================================================  | 
|     # # Í¨ÖªÊÀ½çµôÂÊÌáÉý  | 
|     # worldDropRateKey = ShareDefine.Def_Notify_WorldKey_WorldDropRateAdd  | 
|     # GameWorld.GetGameWorld().SetDict(worldDropRateKey, worldDropRateAdd)  | 
|     # GameWorld.SendMapServerMsgEx(worldDropRateKey, worldDropRateAdd)  | 
|     #===============================================================================================  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ´¦ÀíµØÍ¼¾Ñé×Ö·û´®  | 
| #  @param event »î¶¯  | 
| #  @param mapIDList Ë;ÑéµØÍ¼×Ö·û´®  | 
| #  @return None  | 
| #  @remarks Í¬ÖªµØÍ¼·þÎñÆ÷£¬ÓõÄÊÇ:  µ«ÊÇ֪ͨµÄÄÚÈÝÊÇÊ²Ã´ÄØ£¿Ó¦¸ÃÊÇDZ¹æÔò¾ÍÖªµÀÁË¡£¡£¡£  | 
| #  event.Notify_AllMapServerProcess()   | 
| #  ºÍ event.Notify_SelectMapServerProcess(vector)  | 
| def __DisposeMapGiveExp(event , mapIDList):  | 
|     #×Ö·û´® '[]' -> []  | 
|     mapIDList = eval(mapIDList)  | 
|       | 
|     if not mapIDList:  | 
|         #֪ͨȫ·þÎñÆ÷Ö´ÐÐ  | 
|         event.Notify_AllMapServerProcess()  | 
|         return  | 
|       | 
|     vector = IPY_GameServer.IntVector()  | 
|     for mapID in mapIDList:  | 
|         vector.push_back(int(mapID))  | 
|       | 
|     #ָ֪ͨ¶¨µØÍ¼·þÎñÆ÷  | 
|     event.Notify_SelectMapServerProcess(vector)  | 
|     return  | 
| #---------------------------------------------------------------------  | 
| ## ÉèÖÃÊÇ·ñ¿ªÆôÓÎÏ·ÊÀ½çÖеĹ«¸æÕâ¸ö»î¶¯  | 
| #  @param isOpen ÊÇ·ñ¿ªÆô  | 
| #  @param broadcastMsg ¹ã²¥ÄÚÈÝ  | 
| #  @param broadcastTick ¹ã²¥¼ä¸ô  | 
| #  @return None  | 
| #  @remarks ÉèÖÿªÆô»ò¹Ø±ÕÓÎÏ·¹ã²¥µÄ»î¶¯µÄ¿ª¹Ø£¬¿ÉÒÔÉèÖù㲥ÄÚÈݺ͹㲥¼ä¸ô  | 
| def __DisposeBroadcastEvent(isOpen , broadcastMsg = '' , broadcastTick = 0):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     #ÊÇ·ñ¿ªÆô  | 
|     if isOpen:  | 
|         gameWorld.SetBroadcastMsg(broadcastMsg)  | 
|         gameWorld.SetBroadcastInterval(broadcastTick)  | 
|           | 
|     #ÊÇ·ñ¹Ø±Õ  | 
|     else:  | 
|         gameWorld.SetBroadcastMsg(broadcastMsg)  | 
|         gameWorld.SetBroadcastTick(0)  | 
|         gameWorld.SetBroadcastInterval(0)  | 
|           | 
|     return  | 
| #---------------------------------------------------------------------  | 
| ## ´¦ÀíÊÀ½ç¹«¸æ  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks   | 
| #  IPY_GameWorldEventManager.FindActiveEvent(int eventID) µÃµ½IPY_GameWorldEvent  | 
| #  ÔÙÅжÏÕâ¸öevent ÊÇ·ñGetIsProcessing()  Õâ¸öʼþ¡£¡£¡£Æäʵ¾ÍÊǹ㲥ʼþChConfig.Def_GY_GM_Game_Broadcast  | 
| #  Èç¹û´¦Ôڹ㲥ʼþÏ£ºgameWorld.GetBroadcastTick()»ñÈ¡ÊÇ·ñ´ïµ½¹ã²¥¼ä¸ô   | 
| #  »¹Óй㲥ÄÚÈÝ£¬¹ã²¥³ÖÐøÊ±¼äµÈ£¬¶¼´ÓGameWorldÖ±½Ó»ñµÃ  | 
| #  ¶øÓÎÏ·¹ã²¥ÄÚÈÝ£¬Ò²ÊÇÔÚ±¾Ä£¿éÀïµÄÆäËû·½·¨ÀïÇëÇóÌí¼Ó½øÈ¥µÄ  | 
| def DisposeGameWorldBroadcast(tick):  | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|     broadEvent = eventManager.FindActiveEvent(ChConfig.Def_GY_GM_Game_Broadcast)  | 
|     if not broadEvent:  | 
|         #ÎÞ¹«¸æ  | 
|         return  | 
|       | 
|     if not broadEvent.GetIsProcessing():  | 
|         #δ¼¤»î  | 
|         return  | 
|       | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     broadcastMsg = gameWorld.GetBroadcastMsg()  | 
|       | 
|     if broadcastMsg == '' :  | 
|         #ÎÞÄÚÈÝ  | 
|         return  | 
|       | 
| #===============================================================================  | 
| #    ²»ÓÃÕâ¸öÅж¨ÁË,¸ÄΪ¿ªÆôʱ¼ä,½áÊøÊ±¼ä  | 
| #    boradcastStartTick = gameWorld.GetBroadcastStartTick()  | 
| #      | 
| #    if boradcastStartTick == 0:  | 
| #        #ÎÞ¿ªÆôʱ¼ä  | 
| #        return  | 
| #      | 
| #   | 
| #    ²»ÓÃÕâ¸öÅж¨ÁË,¸ÄΪ¿ªÆôʱ¼ä,½áÊøÊ±¼ä  | 
| #    if tick - boradcastStartTick > gameWorld.GetBroadcastLastTime() * 60 * 1000:  | 
| #        #ÒѾ¹ýÆÚ  | 
| #        return  | 
| #   | 
| #===============================================================================  | 
|   | 
|     #¼ä¸ô -> ·ÖÖÓתºÁÃë  | 
|     if tick - gameWorld.GetBroadcastTick() < gameWorld.GetBroadcastInterval() * 60 * 1000:  | 
|         #¼ä¸ôδµ½  | 
|         return  | 
|       | 
|     #¹ã²¥      | 
|     GameWorld.GetPlayerManager().BroadcastInfo(broadcastMsg)  | 
|     #ÉèÖüä¸ô  | 
|     gameWorld.SetBroadcastTick(tick)  | 
|       | 
|     return  | 
|   | 
| ## ´¦ÀíÓÎÏ·ÊÀ½çÖеÄïÚ³µ   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DisposeGameWorldEvenByTruck(tick) :  | 
|     #½«Éæ¼°µ½C++ÖÐÁбíɾ³ýµÄ¹¦ÄÜ,ͳһ¸Ä³É -> ¸´ÖÆPyÁбíºó,È»ºó½øÐÐɾ³ýÂß¼ (ÒòWhileÓм¸Âʽ«µ¼ÖÂËÀËø)  | 
|     worldTruck_List = []  | 
|     #ïÚ³µ¹ÜÀíÆ÷  | 
|     truckMananger = GameWorld.GetTruckMananger()  | 
|     for index in range(truckMananger.GetTruckCount()):  | 
|         truck = truckMananger.GetTruckByIndex(index)  | 
|         worldTruck_List.append(truck)  | 
|           | 
|     if not worldTruck_List:  | 
|         return  | 
|       | 
|     truckTime = ReadChConfig.GetEvalChConfig("TruckTime") * 60  | 
|     curTime = int(time.time())  | 
|     #·þÎñ¶Ë´¦ÀíïÚ³µ³¬Ê±Îª Êµ¼ÊÔËïÚÏÞÖÆÊ±¼ä+µôÏß»º³åʱ¼ä  | 
|     #³¬¹ý´Ëʱ¼äºóïÚ³µÏûʧ£¬ÇÒÎÞ½±Àø  | 
|     disappearTime = truckTime + ChConfig.Def_PlayerTruckLogoffTick / 1000  | 
|     #GameWorld.DebugLog("DisposeGameWorldEvenByTruck count=%s,curTime=%s,truckTime=%s,disappearTime=%s"   | 
|     #                   % (len(worldTruck_List), curTime, truckTime, disappearTime))  | 
|       | 
|     #´¦ÀíÂß¼      | 
|     for curTruck in worldTruck_List:  | 
|   | 
|         if curTime - curTruck.GetLogoffTick() < disappearTime:  | 
|             #GameWorld.Log("    ÔËïÚʱ¼ä: %d startTime=%d,curTime=%s,truckTime=%s, passTime=%s"   | 
|             #              % (curTruck.GetOwnerID(), curTruck.GetLogoffTick(), curTime, truckTime, curTime - curTruck.GetLogoffTick()))  | 
|             continue  | 
|           | 
|         GameWorld.Log("ÔËïÚʱ¼ä³¬Ê±: %d disappear! startTime=%d,curTime=%s,truckTime=%s"   | 
|                       % (curTruck.GetOwnerID(), curTruck.GetLogoffTick(), curTime, truckTime))  | 
|         #³¬¹ýʱ¼ä,ïÚ³µÏûʧ  | 
|         PlayerTruck.DelTruck(curTruck)  | 
|           | 
| #        #»ñµÃÖ÷ÈË  | 
| #        curTruckOwnerID = curTruck.GetOwnerID()  | 
| #        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(curTruckOwnerID)  | 
| #        #Ö÷ÈË»¹ÔÚÏß  | 
| #        if curPlayer != None:  | 
| #            continue  | 
| #  | 
| #        if curTruck.GetLogoffTick() == 0:  | 
| #            continue  | 
| #  | 
| #        #Íæ¼Ò²»ÔÚÏß,µ«ïÚ³µÏûʧʱ¼äδµ½,²»Ïûʧ  | 
| #        if tick - curTruck.GetLogoffTick() < ChConfig.Def_PlayerTruckLogoffTick:  | 
| #            continue  | 
| #          | 
| #        GameWorld.Log("%d disappear! logofftick = %d"%(curTruckOwnerID, curTruck.GetLogoffTick()))  | 
| #        #³¬¹ýʱ¼ä,ïÚ³µÏûʧ  | 
| #        PlayerTruck.DelTruck(curTruck)  | 
|           | 
|     return  | 
|   | 
| ## ´¦ÀíÓÎÏ·ÊÀ½çʱ¼äʼþ  | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DisposeGameWorldEvenByTime(tick) :  | 
|     #Ö´ÐÐʱ¼ä´¦ÀíÂß¼  | 
|     DoLogic_GameWorldEvenByTime(tick)  | 
|     return  | 
|   | 
| ## Ö´ÐÐʱ¼ä´¦ÀíÂß¼  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ¶Ô±È·þÎñÆ÷µ±Ç°Ê±¼äºÍ·þÎñÆ÷ÉϴμǼµÄʱ¼ä£¬Èç¹ûÓÐСʱ²îÒ죬Ôò˵Ã÷Ó¦´¥·¢Ð¡Ê±Ê¼þ  | 
| #  Èç´ËÀàÍÆ£¬callµ½ËùÓÐÒòʱ¼ä¶ø´¥·¢Ê¼þµÄº¯ÊýÖÐ  | 
| def DoLogic_GameWorldEvenByTime(tick):  | 
|     lastTick = GameWorld.GetGameWorld().GetTickByType(ChConfig.TYPE_EvenByTime)  | 
|       | 
|     if lastTick == -1:  | 
|         #GameWorld.Log("δ³õʼ»¯·þÎñÆ÷")  | 
|         return  | 
|       | 
|     #·þÎñÆ÷µ±Ç°Ê±¼ä( ×Ö·û´® ) , ÓÃÓڼǼ  | 
|     curTimeStr = GameWorld.GetCurrentDataTimeStr()  | 
|       | 
|     #-----------·þÎñÆ÷µ±Ç°Ê±¼ä  | 
|     curTime = datetime.datetime.today()  | 
|     curTimeHour = curTime.hour  | 
|     curTimeDay = curTime.day  | 
|     curTimeWeek = datetime.datetime.isocalendar(curTime)[1]  | 
|     curTimeMonth = curTime.month  | 
|     curTimeYear = curTime.year  | 
|       | 
|     #-----------·þÎñÆ÷¼Ç¼µÄʱ¼ä  | 
|     serverHour , serverDay , serverWeek , serverMonth , serverYear = GameLogInfo.InitServerTime()  | 
|       | 
|     #-----------¿ªÊ¼±È¶Ôʱ¼ä  | 
|     #OnHourʼþ  | 
|     if (serverHour != curTimeHour or serverDay!= curTimeDay or serverMonth != curTimeMonth or serverYear != curTimeYear):  | 
|         OnHour(curTimeStr, tick)  | 
|       | 
|     #OnDayʼþ  | 
|     if (serverDay != curTimeDay or serverMonth != curTimeMonth or serverYear != curTimeYear):  | 
|         OnDay(curTimeStr, tick)  | 
|           | 
|     #OnDayExʼþ  | 
|     if __Get_Can_OnDayEx():  | 
|         OnDayEx(tick)  | 
|           | 
|     #OnWeekʼþ  | 
|     #²»¿¼ÂǸôÄêÇé¿ö£¬Èç2009,12,31Èչطþ->2010,12,31ÈÕ¿ª·þ(²»´¥·¢OnWeek)  | 
|     if (serverWeek != curTimeWeek):  | 
|         OnWeek(curTimeStr, tick)  | 
|   | 
|     #OnWeekExʼþ  | 
|     if __Get_Can_OnWeekEx():  | 
|         OnWeekEx(tick)  | 
|           | 
|     #OnMonthʼþ  | 
|     if (serverMonth != curTimeMonth or serverYear != curTimeYear):  | 
|         OnMonth(curTimeStr, tick)  | 
|           | 
|     #OnMonthExʼþ  | 
|     if __Get_Can_OnMonthEx():  | 
|         OnMonthEx(tick)  | 
|           | 
|     #OnYearʼþ  | 
|     if serverYear != curTimeYear:  | 
|         OnYear(curTimeStr, tick)  | 
|           | 
|     return  | 
|   | 
| def __Get_Can_OnDayEx():  | 
|     '''ÅжϿɷñÁ賿Xµã¹ýÌì  | 
|     @return: 0-²»¿É£» 1-¿ÉÒÔ  | 
|     '''  | 
|     curDateTime = GameWorld.GetServerTime()  | 
|     #dateTime_Day = curDateTime.day  | 
|     #dateTime_Month = curDateTime.month  | 
|     #dateTime_Year = curDateTime.year  | 
|       | 
|     # ÉϴιýÌì¼Ç¼¸ñʽ: ÄêÔÂÈÕ, Èç20171027  | 
|     lastOndayEx = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_DayEx)  | 
|     #GameWorld.DebugLog("__Get_Can_OnDayEx lastOndayEx=%s" % (lastOndayEx))  | 
|     if lastOndayEx:  | 
|         lastOndayEx_Year = lastOndayEx / 10000  | 
|         lastOndayEx_Month = lastOndayEx % 10000 / 100  | 
|         lastOndayEx_Day = lastOndayEx % 100  | 
|         #GameWorld.DebugLog("lastOndayEx_Year=%s,lastOndayEx_Month=%s,lastOndayEx_Day=%s" % (lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day))  | 
|           | 
|         # ÉϴιýÌìµÄÈÕÆÚ0µã  | 
|         lastDatetime = datetime.datetime(lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day, 0, 0, 0)  | 
|         passTime = curDateTime - lastDatetime  | 
|         passDays = passTime.days  | 
|         passSeconds = passTime.seconds  | 
|           | 
|         # Èç¹ûʱ¼ä²îûÓг¬¹ý1Ì죬´ú±í»¹Î´¹ýÌì  | 
|         if passDays == 0:  | 
|             #GameWorld.DebugLog("Èç¹ûʱ¼ä²îûÓг¬¹ý1Ì죬´ú±í»¹Î´¹ýÌì, passDays=%s" % passDays)  | 
|             return 0  | 
|         # µÈÓÚ1ÌìµÄ, Ê±¼ä²îÐè >= Xʱ²Å¿É¹ýÌì, ¼´ X * 3600 Ãë  | 
|         if passDays == 1 and passSeconds < ShareDefine.Def_OnEventHour * 3600:  | 
|             #GameWorld.DebugLog("µÈÓÚ1ÌìµÄ, Ê±¼ä²îÐè >= Xʱ²Å¿É¹ýÌì, ¼´ X * 3600 Ãë, passSeconds=%s" % passSeconds)  | 
|             return 0  | 
|         #if passDays < 0:  | 
|         #    GameWorld.DebugLog("ʱ¼äÌì²îСÓÚ0£¬Ò»°ãΪÒì³£Çé¿ö£¬Ö»ÓÐʱ¼äÍù»Øµ÷²Å»Ø³öÏÖ!ĬÈÏÔÊÐí¹ýÌì,passDays=%s" % passDays)  | 
|         # ´óÓÚ1ÌìµÄÎÞÂÛʲôʱ¼äµã¶¼¿ÉÒÔ¹ýÌì  | 
|           | 
|     #GameWorld.DebugLog("¿ÉÒÔ¹ýÌì")  | 
|     return 1  | 
|   | 
| def __Set_Server_DayEx():  | 
|     onDayDateTime = GameWorld.GetServerTime()  | 
|     # ÌØÊâXµã֮ǰ¹ýÌìµÄ£¬´ú±íÌì²î´óÓÚ1ÌìµÄʱ¼ä¹ýÌ죬ÕâʱºòµÄ¹ýÌìÖµÐèÉèÖÃΪ×òÌì  | 
|     if onDayDateTime.hour < ShareDefine.Def_OnEventHour:  | 
|         onDayDateTime = onDayDateTime - datetime.timedelta(days=1)  | 
|         #GameWorld.Log("SetDayEx ÌØÊâXµã֮ǰ¹ýÌìµÄ£¬´ú±íÌì²î´óÓÚ1ÌìµÄʱ¼ä¹ýÌ죬ÕâʱºòµÄ¹ýÌìÖµÐèÉèÖÃΪ×òÌì %s" % onDayDateTime)  | 
|           | 
|     ondayExValue = onDayDateTime.year * 10000 + onDayDateTime.month * 100 + onDayDateTime.day  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_DayEx, ondayExValue)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OnDayEx, ondayExValue)  | 
|     GameWorld.Log("Set_Server_DayEx, OnDayExValue=%s" % ondayExValue)  | 
|     return  | 
|   | 
| def __Get_Can_OnWeekEx():  | 
|     '''ÅжϿɷñÁ賿Xµã¹ýÖÜ  | 
|     @return: 0-²»¿É£» 1-¿ÉÒÔ  | 
|     '''  | 
|     curDateTime = GameWorld.GetServerTime()  | 
|     isocalendar = datetime.datetime.isocalendar(curDateTime)  | 
|     dateTime_year, dateTime_week, dateTime_day = isocalendar  | 
|       | 
|     # ÉϴιýÖܼǼ¸ñʽ: ÄêÖÜ, Èç201752  | 
|     lastOnWeekEx = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_WeekEx)  | 
|     #GameWorld.DebugLog("__Get_Can_OnWeekEx lastOnWeekEx=%s,dateTime_year=%s,week=%s,day=%s"   | 
|     #                   % (lastOnWeekEx, dateTime_year, dateTime_week, dateTime_day))  | 
|     if lastOnWeekEx:  | 
|         lastOnWeekEx_Year = lastOnWeekEx / 100  | 
|         lastOnWeekEx_Week = lastOnWeekEx % 100  | 
|         # ±¾ÖÜÒѾ¹ýÖܹý  | 
|         if dateTime_year == lastOnWeekEx_Year and dateTime_week == lastOnWeekEx_Week:  | 
|             #GameWorld.DebugLog("±¾ÖÜÒѾ¹ýÖܹý")  | 
|             return 0  | 
|           | 
|         # µ±Ç°ÌìΪÿÖܵÚÒ»ÌìµÄʱºò£¬ÐèÅжÏÖܲîΪ1ʱµ±Ç°Ê±¼äµãÊÇ·ñ³¬¹ý5µã  | 
|         if dateTime_day == 1:  | 
|             preWeekDateTime = curDateTime - datetime.timedelta(days=7) # ÉÏÒ»ÖܵÄdatetime(¼´ÖܲîΪ1)  | 
|             preWeek_year, preWeek_week, preWeek_day = datetime.datetime.isocalendar(preWeekDateTime)  | 
|               | 
|             # ÉϴιýÖܵĸպÃÊÇÖܲî1, ÔòÐèÅжϵ±Ç°Ê±¼äµãÊÇ·ñ³¬¹ýXʱ  | 
|             if preWeek_year == lastOnWeekEx_Year and preWeek_week == lastOnWeekEx_Week:  | 
|                 if curDateTime.hour < ShareDefine.Def_OnEventHour:  | 
|                     #GameWorld.DebugLog("±¾ÖܵÚÒ»Ì죬δµ½´ï¹ýÖÜʱ¼äµã, hour=%s" % curDateTime.hour)  | 
|                     return 0  | 
|                   | 
|             # ÖܲΪ1µÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÖÜ  | 
|             else:  | 
|                 #GameWorld.DebugLog("ÖܲΪ1µÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÖÜ, ¿ÉÒÔ¹ýÖÜ")  | 
|                 pass  | 
|               | 
|         # ²»ÊÇÿÖܵÚÒ»ÌìµÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÖÜ  | 
|         else:  | 
|             #GameWorld.DebugLog("²»ÊÇÿÖܵÚÒ»ÌìµÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÖÜ, ¿ÉÒÔ¹ýÖÜ")  | 
|             pass  | 
|           | 
|     #GameWorld.DebugLog("¿ÉÒÔ¹ýÖÜ")  | 
|     return 1  | 
|   | 
| def __Set_Server_WeekEx():  | 
|     onWeekDateTime = GameWorld.GetServerTime()  | 
|     isocalendar = datetime.datetime.isocalendar(onWeekDateTime)  | 
|     dateTime_year, dateTime_week, dateTime_day = isocalendar  | 
|     # ÌØÊâXµã֮ǰ¹ýÖܵ쬴ú±íÖܲî´óÓÚ1ÌìµÄʱ¼ä¹ýÌ죬ÕâʱºòµÄ¹ýÌìÖµÐèÉèÖÃΪÉÏÖÜ  | 
|     if dateTime_day == 1 and onWeekDateTime.hour < ShareDefine.Def_OnEventHour:  | 
|         onWeekDateTime = onWeekDateTime - datetime.timedelta(days=7) # ÉÏÒ»ÖܵÄdatetime(¼´ÖܲîΪ1)  | 
|         dateTime_year, dateTime_week, dateTime_day = datetime.datetime.isocalendar(onWeekDateTime)  | 
|         #GameWorld.Log("SetWeekEx ÖÜÒ»ÌØÊâXµã֮ǰ¹ýÌìµÄ£¬´ú±íÖܲî´óÓÚ1µÄÖÜÒ»¹ýÖÜ£¬ÕâʱºòµÄ¹ýÖÜÖµÐèÉèÖÃΪÉÏÖÜ %s" % onWeekDateTime)  | 
|           | 
|     onWeekExValue = dateTime_year * 100 + dateTime_week  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_WeekEx, onWeekExValue)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OnWeekEx, onWeekExValue)  | 
|     GameWorld.Log("Set_Server_WeekEx, OnWeekExValue=%s" % onWeekExValue)  | 
|     return  | 
|   | 
| def __Get_Can_OnMonthEx():  | 
|     '''ÅжϿɷñÁ賿Xµã¹ýÔ  | 
|     @return: 0-²»¿É£» 1-¿ÉÒÔ  | 
|     '''  | 
|     curDateTime = GameWorld.GetServerTime()  | 
|     dateTime_day = curDateTime.day  | 
|     dateTime_month = curDateTime.month  | 
|     dateTime_year = curDateTime.year  | 
|       | 
|     # ÉϴιýԼǼ¸ñʽ: ÄêÔÂ, Èç201712  | 
|     lastOnMonthEx = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_MonthEx)  | 
|     #GameWorld.DebugLog("__Get_Can_OnMonthEx lastOnMonthEx=%s,dateTime_year=%s,dateTime_month=%s"   | 
|     #                   % (lastOnMonthEx, dateTime_year, dateTime_month))  | 
|     if lastOnMonthEx:  | 
|         lastOnMonthEx_Year = lastOnMonthEx / 100  | 
|         lastOnMonthEx_Month = lastOnMonthEx % 100  | 
|         # ±¾ÔÂÒѾ¹ýÔ¹ý  | 
|         if dateTime_year == lastOnMonthEx_Year and dateTime_month == lastOnMonthEx_Month:  | 
|             #GameWorld.DebugLog("±¾ÔÂÒѾ¹ýÔ¹ý")  | 
|             return 0  | 
|           | 
|         # µ±Ç°ÌìΪÿÔµÚÒ»ÌìµÄʱºò£¬ÐèÅжÏÔ²îΪ1ʱµ±Ç°Ê±¼äµãÊÇ·ñ³¬¹ý5µã  | 
|         if dateTime_day == 1:  | 
|             preMonth_month = 12 if dateTime_month == 1 else dateTime_month - 1 # ÉÏÒ»ÔÂ  | 
|             preMonth_year = dateTime_year if preMonth_month != 12 else dateTime_year - 1 # ÉÏÒ»ÔÂËùÊôÄê  | 
|             #GameWorld.DebugLog("preMonth_year=%s,preMonth_month=%s,lastOnMonthEx_Year=%s,lastOnMonthEx_Month=%s"   | 
|             #                   % (preMonth_year, preMonth_month, lastOnMonthEx_Year, lastOnMonthEx_Month))  | 
|             # ÉϴιýÔµĸպÃÊÇÔ²î1, ÔòÐèÅжϵ±Ç°Ê±¼äµãÊÇ·ñ³¬¹ýXʱ  | 
|             if preMonth_year == lastOnMonthEx_Year and preMonth_month == lastOnMonthEx_Month:  | 
|                 if curDateTime.hour < ShareDefine.Def_OnEventHour:  | 
|                     #GameWorld.DebugLog("±¾ÔµÚÒ»Ì죬δµ½´ï¹ýÔÂʱ¼äµã, hour=%s" % curDateTime.hour)  | 
|                     return 0  | 
|                   | 
|             # Ô²Ϊ1µÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÔ  | 
|             else:  | 
|                 #GameWorld.DebugLog("Ô²Ϊ1µÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÔÂ, ¿ÉÒÔ¹ýÔÂ")  | 
|                 pass  | 
|               | 
|         # ²»ÊÇÿÔµÚÒ»ÌìµÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÔ  | 
|         else:  | 
|             #GameWorld.DebugLog("²»ÊÇÿÔµÚÒ»ÌìµÄʱºò£¬ÔòÎÞÂÛʲôʱ¼äµã¾ù¿É¹ýÔÂ, ¿ÉÒÔ¹ýÔÂ")  | 
|             pass  | 
|           | 
|     #GameWorld.DebugLog("¿ÉÒÔ¹ýÔÂ")  | 
|     return 1  | 
|   | 
| def __Set_Server_MonthEx():  | 
|     onMonthDateTime = GameWorld.GetServerTime()  | 
|     dateTime_day = onMonthDateTime.day  | 
|     dateTime_month = onMonthDateTime.month  | 
|     dateTime_year = onMonthDateTime.year  | 
|     # ÌØÊâXµã֮ǰ¹ýÔµģ¬´ú±íÔ²î´óÓÚ1ÌìµÄʱ¼ä¹ýÌ죬ÕâʱºòµÄ¹ýÌìÖµÐèÉèÖÃΪÉÏÔ  | 
|     if dateTime_day == 1 and onMonthDateTime.hour < ShareDefine.Def_OnEventHour:  | 
|         dateTime_month = 12 if dateTime_month == 1 else dateTime_month - 1 # ÉÏÒ»ÔÂ  | 
|         dateTime_year = dateTime_year if dateTime_month != 12 else dateTime_year - 1 # ÉÏÒ»ÔÂËùÊôÄê  | 
|         GameWorld.Log("SetMonthEx ÔÂ1ºÅÌØÊâXµã֮ǰ¹ýÌìµÄ£¬´ú±íÔ²î´óÓÚ1µÄÔÂ1ºÅ¹ýÔ£¬ÕâʱºòµÄ¹ýÔÂÖµÐèÉèÖÃΪÉÏÔÂ")  | 
|           | 
|     onMonthExValue = dateTime_year * 100 + dateTime_month  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_Server_MonthEx, onMonthExValue)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OnMonthEx, onMonthExValue)  | 
|     GameWorld.Log("Set_Server_MonthEx, onMonthExValue=%s" % onMonthExValue)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##GameWorldÔ¤³õʼ»¯  | 
| # @param tick µ±Ç°Ê±¼ä  | 
| # @return None  | 
| # @remarks ±ÈInitGameWorld¸üÔçµÄʱ»ú³õʼ»¯  | 
| def PreInitGameWorld(tick):  | 
| #===============================================================================  | 
| #    ÔÚÕâÀï³õʼ»¯Ò»Ð©ºÍÓÎÏ·¶ÔÏóÎ޹صĶ«Î÷£¬Õâ¸ö³õʼ»¯Ê±»úÔ¶±ÈInitGameWorldÔ磬±ÈÈçÕâ´ÎµÄÅÅÐаñÀàÐ;ÍÒªÔÚÕâ¸ö³õʼ»¯ÀïÃæÌí¼Ó  | 
| # ÔÚÕâ¸ö³õʼ»¯º¯ÊýµÄ×îºó Òªµ÷ÓÃSetPreInitOKº¯Êý ÉèÖóõʼ»¯ÒѾ³É¹¦  | 
| #===============================================================================  | 
|     #³õʼ»¯ÅÅÐаñ  | 
|     PlayerBillboard.InitServerBillboard()  | 
|     #³õʼ»¯¶ÓÎé×î´óÈËÊý  | 
|     GameWorld.GetTeamManager().SetMaxTeamMemberCount(ChConfig.Def_Team_MaxPlayerCount)  | 
|       | 
|     #ÉèÖóõʼ»¯³É¹¦  | 
|     GameWorld.GetGameWorld().SetPreInitOK(True)  | 
|     return  | 
|   | 
| ## GameWorld³õʼ»¯  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks ÏÈÇëÇóÅÅÐаñÐÅÏ¢£¬È»ºóSetTickTypeCount£¬ÉèÖÃÐèÒª±£´æµÄʱ¼äÖÖÀà  | 
| def InitGameWorld(tick):  | 
|     #±ê¼ÇGameWorld³õʼ»¯Íê³É  | 
|     GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_IsGameWorldInit, int(time.time()))  | 
|     PlayerControl.LoadDBPlayer()  | 
|     #³õʼ»¯ÓÎϷʱÖÓ  | 
|     GameWorld.GetGameWorld().SetTickTypeCount(ChConfig.TYPE_Tick_Count)  | 
|     #³õʼ»°¿ª·þʱ¼ä¡¢ÐÇÆÚ¼¸  | 
|     initOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime)  | 
|     openServerWeekday = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday)  | 
|     if initOpenServerTime <= 0 or openServerWeekday <= 0:  | 
|         #¼Ç¼Ê״οª·¢Ê±¼ä(ÏÖʵʱ¼ä´Á)  | 
|         PlayerDBGSEvent.SetInitOpenServerTime(initOpenServerTime if initOpenServerTime else int(time.time()))  | 
|           | 
|     #³õʼ»¯¼Ò×åÊýÁ¿  | 
|     GameWorld.GetFamilyManager().SetFamilyUpperLimitCount(ChConfig.Def_Family_MaxCnt)  | 
|     #ÅÅÐòÔª±¦½»Òׯ½Ì¨  | 
|     GameWorld.GetGameWorld().GetDBGoldOrderFormMgr().Sort()  | 
|     #ÅÅÐòÅÅÐаñ  | 
|     PlayerBillboard.SortServerBillboard()  | 
|     #ÅÅÐòÏÉÃË  | 
|     PlayerFamily.DoFamilySort()  | 
|     GameWorldActionControl.Dispose_FBStateTime()  | 
|     #ÏÉÃËÁªÈü  | 
|     GameWorldFamilyWar.OnGameServerInitOK()  | 
|     #²éѯPyTableÐÅÏ¢  | 
|     #PlayerDBOper.QueryAllPyTable()  | 
|     #ʼþ»ã±¨³õʼ»¯  | 
|     EventReport.InitDllAppID()  | 
|       | 
|     #ReloadModule.RefreshModuleFileCMTime(True)  | 
|     #ºÏ·þÊ×´ÎÆô¶¯¼ÓÔØ´¦Àí  | 
|     __DoMixServerInit()  | 
|     #ÏÉħ֮Õù  | 
|     PlayerXMZZ.OnGameServerInitOK()  | 
|     #¼ÓÔØ»îÔ¾Íæ¼ÒµÈ¼¶ÐÅÏ¢  | 
|     ChPlayer.LoadPlayerLVData()  | 
|     #¼ÓÔØÖúÕ½ÐÅÏ¢  | 
|     PlayerFBHelpBattle.OnServerStart()  | 
|     #±¾·þ¾º¼¼³¡  | 
|     GameWorldArena.OnServerStart()  | 
|     #¿ç·þPK  | 
|     CrossRealmPK.OnGameServerInitOK()  | 
|     #¿ç·þÅÅλ  | 
|     CrossChampionship.OnServerStart()  | 
|     #¿ç·þÕ½³¡  | 
|     CrossBattlefield.OnServerStart()  | 
|     #ºì°ü  | 
|     PlayerFamilyRedPacket.OnServerStart()  | 
|     #ÔÆ¹º  | 
|     CrossLuckyCloudBuy.OnServerStart()  | 
|     #ÊÀ½çboss±»É±´ÎÊýÖØÖà  | 
|     #GameWorldBoss.CheckResetBossKilledCntOnServerInit()  | 
|       | 
|     __Func_HighPrecisionProcess(tick) # Ö÷¶¯´¥·¢Ò»´Î¸ß¾«¶ÈµÄµ÷Óã¬È·±£·þÎñÆ÷Æô¶¯ºóһЩ¹¦ÄܻµÈµÄÊý¾Ý»á±»¼ÓÔØ  | 
|       | 
|     GameWorld.Log("=============================== ·þÎñÆ÷Æô¶¯³É¹¦ ===================================")  | 
|     isCrossServer = GameWorld.IsCrossServer()  | 
|     if isCrossServer:  | 
|         isServerClose = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossServerClose)  | 
|         isServerOpen = 0 if isServerClose else 1  | 
|         GameWorld.GetGameWorld().SetDict(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isServerOpen)  | 
|         GameWorld.Log("¿ç·þ·þÎñÆ÷Æô¶¯³É¹¦: isServerOpen=%s,crossZoneName=%s" % (isServerOpen, GameWorld.GetCrossZoneName()))  | 
|     else:  | 
|         serverGroupID = GameWorld.GetServerGroupID()  | 
|         GameWorld.Log("·þÎñÆ÷Æô¶¯³É¹¦: ServerGroupID=%s" % serverGroupID)  | 
|     GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_GameWorldInitOK, 1)  | 
|       | 
|     AuctionHouse.OnGameServerInitOK()  | 
|     # ×¢Ò⣺¿ç·þÏà¹ØÐÅÏ¢µÄµ÷ÓÃÐè·ÅÔÚ×îºó£¬²»È»¿ÉÄܵ¼Ö·þÎñÆ÷δÆô¶¯¹¦ÄÜ»òÕß¹¦ÄÜδ¼ÓÔØ³É¹¦µ¼Ö¿ç·þ·þÎñÆ÷Óë×Ó·þÖ®¼äµÄÊý¾Ýͬ²½¿ÉÄܳöÏÖÒì³£µÄÇé¿ö  | 
|     CrossRealmMsg.OnGameServerInitOK()  | 
|     if PyGameData.g_allMapServerInitOK:  | 
|         GameWorld.Log("InitGameWorldʱAllMapServerInitOKÒÑ´¥·¢Ôò²¹´¥·¢Ò»´Î!")  | 
|         GameWorld.SendGameError("GameWarning", "InitGameWorld later than AllMapServerInitOK")  | 
|         AllMapServerInitOK(tick)  | 
|           | 
|     return  | 
|   | 
| def DoCheckNewServerOpen(tick):  | 
|     setOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_SetOpenServerTime)  | 
|     if not setOpenServerTime:  | 
|         #GameWorld.DebugLog("ûÓÐÖ¸¶¨¿ª·þʱ¼ä£¡")  | 
|         return  | 
|     curOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime)  | 
|     if curOpenServerTime == setOpenServerTime:  | 
|         #GameWorld.DebugLog("ÒѾÕýʽ¿ª·þ¹ýÁË£¡")  | 
|         return  | 
|     curTime = int(time.time())  | 
|     if curTime < setOpenServerTime:  | 
|         #GameWorld.DebugLog("»¹Î´µ½Õýʽ¿ª·þʱ¼ä£¡")  | 
|         return  | 
|     OnNewServerOpen(tick)  | 
|     return  | 
|       | 
| def OnNewServerOpen(tick):  | 
|     '''зþ¿ªÆôÐèÒª´¦ÀíµÄÂß¼'''  | 
|     GameWorld.Log("Ö´ÐÐÕýʽ¿ª·þÖØÖÃÂß¼...")  | 
|       | 
|     setOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_SetOpenServerTime)  | 
|     if not setOpenServerTime:  | 
|         return  | 
|       | 
|     #Çå DBGSTrig  | 
|     dbgsTrigKeyDict = {}  | 
|     gsEventTrigManager = GameWorld.GetGameWorld().GetDBGameServerEventTrigManager()  | 
|     for i in xrange(gsEventTrigManager.GetCount()):  | 
|         gsEvent = gsEventTrigManager.GetAt(i)  | 
|         key = gsEvent.GetEventID()  | 
|         value = gsEvent.GetIsEvent()  | 
|         if not value or key in [PlayerDBGSEvent.Def_InitOpenServerTime, PlayerDBGSEvent.Def_SetOpenServerTime]:  | 
|             continue  | 
|         dbgsTrigKeyDict[key] = value  | 
|     for key, value in dbgsTrigKeyDict.items():  | 
|         gsEventTrigManager.DeleteByKey(key)  | 
|         GameWorld.Log("DeleteGameServerEventTrig %s=%s" % (key, value))  | 
|           | 
|     #Çå ÅÅÐаñ  | 
|     for billboardIndex in ShareDefine.BillboardTypeList:  | 
|         billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex)  | 
|         count = 0 if not billBoard else billBoard.GetCount()  | 
|         if count:  | 
|             PlayerBillboard.ClearBillboardByIndex(billboardIndex)  | 
|             GameWorld.Log("ClearBillboard %s, count=%s" % (billboardIndex, count))  | 
|               | 
|     #Çå Í¨ÓüǼ  | 
|     universalRecMgr = GameWorld.GetUniversalRecMgr()  | 
|     for recType in ShareDefine.Def_UniversalGameRecTypeList:  | 
|         recordList = universalRecMgr.GetTypeList(recType)  | 
|         recordCount = 0 if not recordList else recordList.Count()  | 
|         universalRecMgr.Delete(recType)  | 
|         if recordCount:  | 
|             GameWorld.Log("DeleteRecData recType=%s, count=%s" % (recType, recordCount))  | 
|     CrossBoss.g_bossRecDataDict = {} # ÐèÒªÇå³ý£¬²»È»»áµ¼Ö¿ç·þbossͨÓüǼ»º´æ¶ÔÏó´íÎó  | 
|       | 
|     #Çå ¼Ò×å  | 
|     familyList = []  | 
|     familyMgr = GameWorld.GetFamilyManager()  | 
|     for i in xrange(familyMgr.GetCount()):  | 
|         familyList.append(familyMgr.GetAt(i))  | 
|     for family in familyList:  | 
|         GameWorld.Log("DeleteFamily familyID=%s" % (family.GetID()))  | 
|         PlayerFamily.DoLogic_DeleteFamily(None, family, tick)  | 
|           | 
|     #ÏÉÃËÁªÈü  | 
|     GameWorldFamilyWar.DoFamilyWarReset()  | 
|       | 
|     PyGameData.g_sortBOSSRefreshList = [] # bossË¢ÐÂÐÅÏ¢¼Ç¼»º´æÖØÖÃ, ²»ÖØÖûᵼÖÂ֪ͨǰ¶ËµÄbossÐÅϢΪ¿Õ  | 
|       | 
|     GameWorldArena.OnServerStart()  | 
|       | 
|     CrossBattlefield.OnServerStart()  | 
|       | 
|     PlayerDBGSEvent.SetInitOpenServerTime(setOpenServerTime)  | 
|       | 
|     ReadChConfig.ReloadConfig()  | 
|       | 
|     AllMapServerInitOK(tick)  | 
|       | 
|     GameWorld.GetGameWorld().SaveGameServerData()  | 
|     GameWorld.SendGameError("ClearOpenServerOK")  | 
|     return  | 
|   | 
| ## ·þÎñÆ÷¿ª·þʱÊÇÐÇÆÚ¼¸  | 
| def GetOpenServerWeekday(): return PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday)  | 
|   | 
| ## ËùÓеØÍ¼·þÎñÆ÷³õʼ»¯³É¹¦ºó(·â°ü×¢²á)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks µ±Ò»¸ömapServer¿ªÆôʱ£¬  | 
| def AllMapServerInitOK(tick):  | 
|     PyGameData.g_allMapServerInitOK = True  | 
|     if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit):  | 
|         GameWorld.Log("AllMapServerInitOKʱGameServer»¹Î´Æô¶¯ºÃ!")  | 
|         return  | 
|     #֪ͨËùÓеØÍ¼·þÎñÆ÷³õʼ»¯³É¹¦, Í¬²½Ê±¼ä  | 
|     GameWorld.GetGameWorld().Notify_AllMapServerInitOK(GameWorld.GetCurrentDataTimeStr())  | 
|       | 
|     #ÉèÖÃÈ«²¿¾Ñé±¶ÂÊ  | 
|     __SetWorldExpRate()  | 
|     __SetWorldDropRateAdd()  | 
|       | 
|     #֪ͨµØÍ¼·þÎñÆ÷µ±Ç°ÒѾ¼¤»îµÄ»î¶¯  | 
|     __NotifyMapServerEvent()  | 
|       | 
|     #֪ͨ»î¶¯×´Ì¬  | 
|     GameWorldActionControl.SendMapServerOperationActionState()  | 
|     GameWorldActionControl.SendMapServerDailyActionState()  | 
|     GameWorldActionControl.SendMapServerFBFuncState()  | 
|       | 
|     #֪ͨÒѾ·¢²¼µÄÈÎÎñ  | 
|     __NotifyMissionPubEvent()  | 
|       | 
|     #´¥·¢½Ú¼ÙÈջ  | 
|     #GameWorldActionHoliday.ActionHoliday_OpenAndClose(tick, True)  | 
|   | 
|     #֪ͨÊÀ½çµÈ¼¶  | 
|     worldLv = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_WorldAverageLv, worldLv)  | 
|       | 
|     # Í¨ÖªÈ«·þ½±Àø  | 
|     #PlayerCanGetReward.SendMapAllPlayerReward()  | 
|       | 
|     # Í¨Öª¿ª·þÌìÊý  | 
|     openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay)  | 
|     openServerWeekday = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OpenServerWeekday, openServerWeekday)  | 
|     # ºÏ·þ״̬  | 
|     isMixServer = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServer)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_IsMixServer, isMixServer)  | 
|     # ºÏ·þÌì  | 
|     mixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_MixServerDay)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_MixServerDay, mixServerDay)  | 
|     # ÉϴκϷþʱµÄ¿ª·þÌìÊý¡¢ÊÀ½çµÈ¼¶  | 
|     lastMixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerDay, lastMixServerDay)  | 
|     lastMixServerWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV, lastMixServerWorldLV)  | 
|       | 
|     # Í¨ÖªÕ½ÃËÏà¹Ø»î¶¯¿ªÆô״̬  | 
|     fadState = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState, fadState)   | 
|     # Í¨Öª¿ªÆô·þÎñÆ÷ʱ¼ä  | 
|     initGameWorldTime = GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_InitGameWorldTime, initGameWorldTime)   | 
|       | 
|     # Í¨ÖªÊÀ½çboss½±ÀøÐÅÏ¢  | 
|     GameWorldBoss.OnMapServerInitOK()  | 
|     # Í¨ÖªÊÀ½çµôÂÊÌáÉý  | 
|     #worldDropRateKey = ShareDefine.Def_Notify_WorldKey_WorldDropRateAdd  | 
|     #worldDropRate = GameWorld.GetGameWorld().GetDictByKey(worldDropRateKey)  | 
|     #GameWorld.SendMapServerMsgEx(worldDropRateKey, worldDropRate)  | 
|       | 
|     # ÏÉÃËÁªÈü  | 
|     GameWorldFamilyWar.OnMapServerInitOK()  | 
|       | 
|     # ¿ç·þ·þÎñÆ÷״̬  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerTime, PyGameData.g_crossServerTimeInfo)  | 
|     isCrossServerOpen = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isCrossServerOpen)  | 
|     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossZoneName, PyGameData.g_crossZoneName)  | 
|       | 
|     # ¿ç·þPK  | 
|     CrossRealmPK.OnMapServerInitOK()  | 
|     #¿ç·þÕ½³¡  | 
|     CrossBattlefield.OnMapServerInitOK()  | 
|     # ±¾·þ¾º¼¼³¡  | 
|     GameWorldArena.SendMapServerArenaInfo()  | 
|     # ÐÒÔËÔÆ¹º  | 
|     CrossLuckyCloudBuy.OnMapServerInitOK()  | 
|       | 
|     SendAllMapGlobalDropInfo() # È«¾ÖµôÂä¿ØÖÆ  | 
|       | 
|     SendMapCommMapLinePlayerCount(True) # Í¬²½Ò»´ÎÆÕͨµØÍ¼Ïß·ÈËÊýÐÅÏ¢  | 
|     #Ëæ»ú¼ÙÏÉÃË  | 
|     PlayerFamily.RandomFakeFamily()  | 
|     #ÏÉÃËÕó·¨  | 
|     PlayerFamilyZhenfa.OnMapServerInitOK()  | 
|     #çÎç¿ÏÉÓò  | 
|     PlayerFairyDomain.OnMapServerInitOK()  | 
|     #ÇéÂÂÐÅÏ¢  | 
|     PyDataManager.GetDBPyCoupleManager().SendMapServerCoupleInfo()  | 
|     # ¼Ç¼·þÎñÆ÷ÊÇ·ñÕý³£¿ªÆôÍê±Ï  | 
|     getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + "?Type=MapInit&MapCount=%s"%GameWorld.GetGameWorld().GetGameMapManager().GetCount()  | 
|     GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)  | 
|     return  | 
|   | 
| ## ·þÎñÆ÷ºÏ·þÊ×´ÎÆô¶¯Êý¾Ý¼ÓÔØ´¦Àí  | 
| #  @param None  | 
| #  @return None  | 
| def __DoMixServerInit():  | 
|     isMixServer = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServer)  | 
|     if not isMixServer:  | 
|         GameWorld.DebugLog("·ÇºÏ·þ£¬²»´¦ÀíºÏ·þÊ×´ÎÆô¶¯Êý¾Ý¼ÓÔØ£¡")  | 
|         return  | 
|       | 
|     isMixServerInitOK = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServerInitOK)  | 
|     if isMixServerInitOK:  | 
|         GameWorld.DebugLog("ºÏ·þÊ×´ÎÆô¶¯¼ÓÔØÒѾ´¦Àí¹ý£¡")  | 
|         return  | 
|       | 
|     GameWorld.Log("ºÏ·þÊ×´ÎÆô¶¯¼ÓÔØ´¦Àí...")  | 
|       | 
|     # Çå³ýÖ¸¶¨Í¨ÓÃÊý¾Ý£¬Ò»°ãÊǺϷþ¹¤¾ßɾ£¬ÕâÀï¿ÉÒÔÔÙ×ö¸ö²¹³ä  | 
|     universalRecMgr = GameWorld.GetUniversalRecMgr()  | 
|     delRecTypeList = []  | 
|     GameWorld.Log("Çå³ýÖ¸¶¨Í¨ÓÃÊý¾Ý delRecTypeList=%s" % str(delRecTypeList))  | 
|     for delRecType in delRecTypeList:  | 
|         universalRecMgr.Delete(delRecType)  | 
|           | 
|     # É¾³ý¹ýÆÚµÄͨÓÃÊý¾Ý  | 
|     __DelOutofdayRecData(universalRecMgr)  | 
|       | 
|     # ÏÉÃËÁªÈüÖØÖà  | 
|     GameWorldFamilyWar.DoFamilyWarReset()  | 
|     # ÖØÖÃËùÓÐÏÉÃËÁªÈüÆÀ¼¶  | 
|     familyManager = GameWorld.GetFamilyManager()  | 
|     for i in xrange(familyManager.GetCount()):  | 
|         family = familyManager.GetAt(i)  | 
|         PlayerFamily.SetFamilyWarRank(family, 0)  | 
|     PlayerFamily.DoFamilySort()  | 
|       | 
|     # ÉèÖúϷþÊ×´ÎÆô¶¯¼ÓÔØ³É¹¦  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServerInitOK, 1)  | 
|       | 
|     # ÉèÖñ¾´ÎºÏ·þʱµÄ¿ª·þÌìÊý¡¢ÊÀ½çµÈ¼¶  | 
|     serverDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay)  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay, serverDay)  | 
|     worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV, worldLV)  | 
|     GameWorld.Log("    ºÏ·þÊ×´ÎÆô¶¯¼ÓÔØ³É¹¦! serverDay=%s,worldLV=%s" % (serverDay, worldLV))  | 
|     return  | 
|       | 
| def __DelOutofdayRecData(universalRecMgr):  | 
|     # É¾³ý¹ýÆÚµÄͨÓÃÊý¾Ý  | 
|     curTime = int(time.time())  | 
|     delOutofdayRecDataDict = {  | 
|                               }  | 
|     GameWorld.Log("Ö´ÐÐɾ³ý¹ýÆÚµÄͨÓÃÊý¾Ý, curTime=%s,delOutofdayRecDataDict=%s" % (curTime, delOutofdayRecDataDict))  | 
|     for otDayRecType, otTime in delOutofdayRecDataDict.items():  | 
|         otRecDataList = universalRecMgr.GetTypeList(otDayRecType)  | 
|         if not otRecDataList:  | 
|             continue  | 
|         delCnt = 0  | 
|         totalCnt = otRecDataList.Count()  | 
|         for index in xrange(totalCnt):  | 
|             delIndex = index - delCnt  | 
|             otRecData = otRecDataList.At(delIndex)  | 
|             if curTime - otRecData.GetTime() >= otTime:  | 
|                 otRecDataList.Delete(delIndex)  | 
|                 delCnt +=1  | 
|         GameWorld.Log("    É¾³ý¹ýÆÚÌõÊý: recType=%s,totalCnt=%s,delCnt=%s" % (otDayRecType, totalCnt, delCnt))  | 
|     return  | 
|   | 
| ## ÉèÖÃÈ«²¿¾Ñé±¶ÂÊ£¬ÓÅÏȸù¾Ý»î¶¯¸ÅÂÊ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __SetWorldExpRate():  | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|     expRateEvent = eventManager.FindActiveEvent(ChConfig.Def_GY_GM_Game_DoubleExp)  | 
|       | 
|     #ÎÞ¾Ñé±¶ÂÊÉèÖà  | 
|     if not expRateEvent:  | 
|         expRate = ChConfig.Def_MaxRateValue  | 
|     #δ¼¤»î  | 
|     elif not expRateEvent.GetIsProcessing():  | 
|         expRate = ChConfig.Def_MaxRateValue  | 
|     else:  | 
|         expRate = int(expRateEvent.GetPar())  | 
|           | 
|     GameWorld.GetGameWorld().SetExpRate(expRate)  | 
|       | 
|     return  | 
|   | 
| ## ÉèÖÃÈ«·þµôÂÊÔö¼Ó¸ÅÂÊ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __SetWorldDropRateAdd():  | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|     event = eventManager.FindActiveEvent(ChConfig.Def_GY_GM_Game_DropRate)  | 
|       | 
|     #ÎÞ¾Ñé±¶ÂÊÉèÖà  | 
|     if not event:  | 
|         __DisposeWorldDropRateEvent(False)  | 
|     #δ¼¤»î  | 
|     elif not event.GetIsProcessing():  | 
|         __DisposeWorldDropRateEvent(False)  | 
|     else:  | 
|         __DisposeWorldDropRateEvent(True , int(event.GetPar()))  | 
|     return  | 
|   | 
| ## Í¨ÖªµØÍ¼·þÎñÆ÷µ±Ç°±£´æµÄ»î¶¯  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __NotifyMapServerEvent():  | 
|     eventManager = GameWorld.GetGameWorldEventManager()  | 
|       | 
|     for index in range(eventManager.GetActiveEventCount()):  | 
|         event = eventManager.GetActiveEventByIndex(index)  | 
|         #먦ÆôµÄ»î¶¯  | 
|         if not event.GetIsProcessing():  | 
|             continue  | 
|           | 
|         #֪ͨµØÍ¼·þÎñÆ÷µ±Ç°»î¶¯  | 
|         __NotifyMapServerProcess(event , event.GetEventID() , event.GetPar())  | 
|       | 
|     return  | 
|   | 
| ## µØÍ¼·þÎñÆ÷Ë¢ÐÂ×Ô¼º×´Ì¬  | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks Ã¿¸ömap ¶¨Ê±Éϱ¨×Ô¼ºµÄmapID£¬lineID£¬curPlayerCnt,maxPlayerCnt ,´æ´¢Èë  | 
| #  GameWorld().GetMapServerStateManager() ¸ñʽÈç mapid 101 , lineid 0, cur 0, max 2000  | 
| def MapServer_RefreshState(index, tick):  | 
|     pack = IPY_GameServer.IPY_GMapServerState()  | 
|     routeServerIndex = pack.GetRouteServerIndex()  | 
|     mapID = pack.GetMapID()  | 
|     lineID = pack.GetLineID()  | 
|     curPlayerCount = pack.GetCurPlayerCount()  | 
|     maxPlayerCount = pack.GetMaxPlayerCount()  | 
|     #int nRouteServerIndex, int nMapID, int nLineID, int nCurPlayerCnt, int nMaxPlayerCnt  | 
|     GameWorld.GetGameWorld().GetMapServerStateManager().SetZoneServerState(routeServerIndex, mapID, lineID, curPlayerCount, maxPlayerCount)  | 
|       | 
|     PyGameData.g_commMapLineRouteDict[(mapID, lineID)] = routeServerIndex  | 
|       | 
|     #GameWorld.DebugLog("MapServer_RefreshState routeServerIndex=%s,mapID=%s,lineID=%s,curPlayerCount=%s,maxPlayerCount=%s"   | 
|     #                   % (routeServerIndex, mapID, lineID, curPlayerCount, maxPlayerCount))  | 
|       | 
|     # ÕâÀïÖ»¸üУ¬Í¨ÖªÔÚÆäËûµØ·½´¦Àí  | 
|     linePlayerCountDict = PyGameData.g_commMapLinePlayerCountDict.get(mapID, {})  | 
|     if lineID not in linePlayerCountDict or linePlayerCountDict[lineID] != curPlayerCount:  | 
|         linePlayerCountDict[lineID] = curPlayerCount  | 
|         PyGameData.g_commMapLinePlayerCountDict[mapID] = linePlayerCountDict  | 
|         PyGameData.g_needSyncCommMapLinePlayerCount = True  | 
|     return  | 
|   | 
| #//////////////////////////////////////////////////////////////  | 
| #//01 04 ÈÎÎñ·¢²¼#tagGMissionPub  | 
| #tagGMissionPub       *   GettagGMissionPub();  | 
| #  | 
| #class   IPY_GMissionPub  | 
| #{  | 
| #public:  | 
| #    //·¢²¼ÈÎÎñID  | 
| #    int      GetMissionID();  | 
| #    //·¢²¼ÀàÐÍ(¼Ò×å, ¹ú¼Ò) TMissinoPubType  | 
| #    int      GetMissinoPubType();  | 
| #    //·¢²¼ID  | 
| #    int      GetPubID();  | 
| #};  | 
|   | 
| ## ÈÎÎñ·¢²¼±í  | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_MissionPub(index, tick):  | 
|     pack = IPY_GameServer.IPY_GMissionPub()  | 
|     missionPubManager = GameWorld.GetGameWorld().GetDBMissionPubManager()  | 
|     curMissionPub = missionPubManager.AddDBMissionPub(pack.GetMissionID())  | 
|     curMissionPub.SetMissinoPubType(pack.GetMissinoPubType())  | 
|     curMissionPub.SetPubID(pack.GetPubID())  | 
|     curMissionPub.Notify_AllMapServerProcess()  | 
|     return  | 
|   | 
| ## Í¨ÖªÒѾ·¢²¼µÄÈÎÎñ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __NotifyMissionPubEvent():  | 
|     missionPubManager = GameWorld.GetGameWorld().GetDBMissionPubManager()  | 
|     missionPubManager.NotifyAllMapServerMissionPubProcess()  | 
|     return  | 
| #---------------------------------------------------------------------  | 
| #//////////////////////////////////////////////////////////////  | 
| #//04 02 ¼«Æ·µôÂä#tagGTreasureDrop  | 
| #tagGTreasureDrop       *   GettagGTreasureDrop();  | 
| #  | 
| #class   IPY_GTreasureDrop  | 
| #{  | 
| #public:  | 
| #  | 
| #    int      GetItemID();  | 
| #  | 
| #    int      GetItemCount();  | 
| #    //µôÂ书ÄÜÀàÐÍ  | 
| #    int      GetDropFunctionType();  | 
| #---------------------------------------------------------------------  | 
| ## ÊÕ°ü£¬µôÂäÎïÆ·  | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_TreasureDrop(index, tick):  | 
|     pack = IPY_GameServer.IPY_GTreasureDrop()  | 
|     itemID = pack.GetItemID()  | 
|     itemCount = pack.GetItemCount()  | 
|     dropFunctionType = pack.GetDropFunctionType()   | 
|     __ProcessFunctionTypeDrop(dropFunctionType, itemID, itemCount)    | 
|       | 
|     if dropFunctionType != IPY_GameServer.dfdAll:  | 
|         #ËùÓеôÂä  | 
|         __ProcessFunctionTypeDrop(IPY_GameServer.dfdAll, itemID, itemCount)  | 
|   | 
|     return  | 
|   | 
| ## ´¦Àí¹¦ÄÜÀàÐ͵ôÂä  | 
| #  @param dropFunctionType µôÂ书ÄÜÀàÐÍ  | 
| #  @param itemID ÎïÆ·ID  | 
| #  @param itemCount ÎïÆ·ÊýÁ¿  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __ProcessFunctionTypeDrop(dropFunctionType, itemID, itemCount):  | 
|     dropManager = GameWorld.GetGameWorld().GetDBGameWorldDropManager()  | 
|     curDrop = dropManager.FindGameWorldDrop(itemID, dropFunctionType)  | 
|     if curDrop == None:  | 
|         #ÎÞ´ËÀàµôÂä  | 
|         return  | 
|       | 
|     finalCount = curDrop.GetCurrentCount() + itemCount  | 
|     curDrop.SetCurrentCount(finalCount)  | 
|       | 
|     if finalCount >= curDrop.GetDropCount():  | 
|         curDrop.Notify_AllMapServerDropState(0)  | 
|   | 
|     return  | 
|   | 
| ## Çå¿Õ±¦ÎïµôÂä  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks Ã¿ÌìÇå¿ÕÒ»´Î  | 
| def __ClearTreasureDropCount():  | 
|     #ÿÌìÇå¿Õ±¦ÎïµôÂä  | 
|     dropManager = GameWorld.GetGameWorld().GetDBGameWorldDropManager()  | 
|     for i in range(dropManager.GetCount()):  | 
|         curDrop = dropManager.GetAt(i)  | 
|         curDrop.SetCurrentCount(0)  | 
|       | 
|     dropManager.Notify_AllMapServerClearForbiddenDrop()  | 
|     return  | 
|   | 
| def SendAllMapGlobalDropInfo():  | 
|     # Í¬²½ËùÓеØÍ¼ËùÓÐÈ«·þµôÂä¿ØÖÆÐÅÏ¢  | 
|     globalDropCDDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 1) # {ÎïÆ·ID:·ÖÖÓ, ...}  | 
|     globalKilledCountDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # È«·þ»÷ɱ´ÎÊý±Øµô  | 
|     globalDropRateDict = IpyGameDataPY.GetFuncEvalCfg("NPCGlobalDropRate") # {ÎïÆ·ID:[[npcIDÁбí], "¸ÅÂʹ«Ê½"], ...}  | 
|       | 
|     for itemID in globalDropCDDict.keys():  | 
|         key = ShareDefine.Def_Notify_WorldKey_LastDropTime % itemID  | 
|         dropTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(key)  | 
|         GameWorld.SendMapServerMsgEx(key, dropTime)  | 
|           | 
|     for itemID in globalDropRateDict.keys():  | 
|         key = ShareDefine.Def_Notify_WorldKey_DropNPCKilledCnt % itemID  | 
|         killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key)  | 
|         GameWorld.SendMapServerMsgEx(key, killedCnt)  | 
|           | 
|     for npcID in globalKilledCountDropDict.keys():  | 
|         key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID  | 
|         killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key)  | 
|         GameWorld.SendMapServerMsgEx(key, killedCnt)  | 
|     return  | 
|   | 
| def UpdGlobalDropCD(msgList):  | 
|     ## ¸üÐÂÈ«¾ÖµôÂäCDÎïÆ·×îºóÒ»´ÎµôÂäʱ¼ä  | 
|     itemID, dropTime = msgList  | 
|     key = ShareDefine.Def_Notify_WorldKey_LastDropTime % itemID  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(key, dropTime)  | 
|     GameWorld.SendMapServerMsgEx(key, dropTime)  | 
|     return  | 
|   | 
| def UpdGlobalDropRate(msgList):  | 
|     ## ¸üÐÂÈ«¾Ö»÷ɱ´ÎÊý»»ËãµôÂä¸ÅÂʵÄÎïÆ·ËùÀۼƵĻ÷ɱ´ÎÊý  | 
|     itemID, updKilledCnt = msgList  | 
|     key = ShareDefine.Def_Notify_WorldKey_DropNPCKilledCnt % itemID  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(key, updKilledCnt)  | 
|     GameWorld.SendMapServerMsgEx(key, updKilledCnt)  | 
|     return  | 
|   | 
| def UpdGlobalKillCount(msgList):  | 
|     ## ¸üÐÂÈ«¾Ö»÷ɱ´ÎÊý  | 
|     npcID, updKilledCnt = msgList  | 
|     key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID  | 
|     PlayerDBGSEvent.SetDBGSTrig_ByKey(key, updKilledCnt)  | 
|     GameWorld.SendMapServerMsgEx(key, updKilledCnt)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| #//////////////////////////////////////////////////////////////  | 
| #//01 05 ×¢²á¸±±¾ÐÅÏ¢#tagGRegisterFBInfo  | 
| #tagGRegisterFBInfo       *   GettagGRegisterFBInfo();  | 
| #  | 
| #class   IPY_GRegisterFBInfo  | 
| #{  | 
| #public:  | 
| #  | 
| #    int      GetDataMapID();  | 
| #    //¶Ô¿Í»§¶ËµÄÏßID  | 
| #    int      GetClientLineID();  | 
| #    //µ¥Ïß×î´óÍæ¼ÒÊýÄ¿  | 
| #    int      GetMaxPlayerCount();  | 
| #  | 
| #    int      GetFbInfoLen();  | 
| #    //size = FbInfoLen  | 
| #    char *      GetFbInfo();  | 
| #};  | 
|   | 
|   | 
| ## ×¢²á¸±±¾ÐÅÏ¢  | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_RegisterFBInfo(index, tick):      | 
|     fbEventMgr = GameWorld.GetGameWorld().GetGameFbEventList()  | 
|     #»ñÈ¡·â°ü²ÎÊý  | 
|     mPack = IPY_GameServer.IPY_GRegisterFBInfo()  | 
|       | 
|     gameFBEvent = fbEventMgr.GetGameFbEvent(mPack.GetLineID(), mPack.GetDataMapID())  | 
|     fbDetail = gameFBEvent.GetGameFbDetail(mPack.GetClientLineID())  | 
|     fbDetail.SetClientLineID(mPack.GetClientLineID())  | 
|     fbDetail.SetMaxPlayerCount(mPack.GetMaxPlayerCount())  | 
|     fbDetail.SetFbInfo(mPack.GetFbInfo())  | 
|     return  | 
|   | 
| #//////////////////////////////////////////////////////////////  | 
| #//01 06 ¸±±¾ÐÅϢˢÐÂ#tagGFbInfoRefresh  | 
| #tagGFbInfoRefresh       *   GettagGFbInfoRefresh();  | 
| #  | 
| #class   IPY_GFbInfoRefresh  | 
| #{  | 
| #public:  | 
| #  | 
| #    int      GetDataMapID();  | 
| #  | 
| #    int      GetClientLineID();  | 
| #  | 
| #    int      GetPlayerCount();  | 
| #};  | 
|   | 
| ## ¸±±¾ÐÅϢˢР | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_FbInfoRefresh(index, tick):  | 
|     pack = IPY_GameServer.IPY_GFbInfoRefresh()  | 
|     fbEvent = GameWorld.GetGameWorld().GetGameFbEventList()  | 
|     gameFBEvent = fbEvent.FindGameFbEvent(pack.GetLineID(), pack.GetDataMapID())  | 
|       | 
|     if gameFBEvent == None:  | 
|         return  | 
|       | 
|     #2009.5.30  | 
|     #ÐÞ¸Ä: Èç¹û¸±±¾ÐÅϢˢеÄʱºò, ¸±±¾Ã»ÓÐ×¢²áÏêϸÐÅÏ¢, ÄÇô¾Í²»´¦Àí  | 
|     #gameFBEvent = fbEvent.GetGameFbEvent(pack.GetDataMapID())  | 
|     fbDetail = gameFBEvent.GetGameFbDetail(pack.GetClientLineID())  | 
|     fbDetail.SetPlayerCount(pack.GetPlayerCount())  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| # //08 07 µØÍ¼·þÎñÆ÷״̬#tagGMapServerRunningState  | 
| # tagGMapServerRunningState    * GettagGMapServerRunningState();  | 
| #   | 
| # class IPY_GMapServerRunningState  | 
| # {  | 
| # public:  | 
| #   | 
| #    // ÔÝʱ¼ÓÔÚ·â°ü  | 
| #    int GetRouteServerIndex();  | 
| #      | 
| #    int GetMapID();  | 
| #      | 
| #    int GetState();  | 
| # };  | 
| #===============================================================================  | 
| ## ÔËÐÐ״̬ˢР | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks state=3 ÊÇ¿ªÆô 0ÊÇʧȥÁ¬½Ó  | 
| def MapServer_RunningStateRefresh(index, tick):  | 
|     mapServerPack = IPY_GameServer.IPY_GMapServerRunningState()  | 
|     gameMapManager = GameWorld.GetGameWorld().GetGameMapManager()  | 
|       | 
|     curMap = gameMapManager.Find(mapServerPack.GetRouteServerIndex(), mapServerPack.GetMapID())  | 
|     if curMap == None:  | 
|         return  | 
|       | 
|     if mapServerPack.GetState() not in [0,1,2,3] and curMap.GetState() != mapServerPack.GetState():  | 
|         # ¼Ç¼·þÎñÆ÷ÊÇ·ñÕý³£¿ªÆôÍê±Ï, ±ÜÃâÖØ¸´·¢ËÍ  | 
|         GameWorld.DebugLog("MapServer_RunningStateRefresh--_%s"%([mapServerPack.GetState(), curMap.GetState(), mapServerPack.GetMapID(), curMap.GetID()]))  | 
|         GameWorld.SendGameError("MapError")  | 
|           | 
|     curMap.SetState(mapServerPack.GetState())  | 
|     curMap.SetRefreshTick(tick)  | 
|       | 
|     return  | 
|       | 
| ## Ë¢ÐµØÍ¼·þÎñÆ÷״̬, Èç¹û1·ÖÖÓûÓÐ״̬»Ø±¨, Ë¢ÐÂΪÏûʧ״̬  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks curMap.GetRefreshTick() > 5min Ôò£ºcurMap.SetState£¨Ïûʧ£©  | 
| def DisposeMapServerRunningState(tick):  | 
|     #¼ä¸ôδµ½  | 
|     if not GameWorld.SetWorldDictKey(ChConfig.TYPE_MapServerRunningState, tick):  | 
|         return  | 
|   | 
|     gameMapManager = GameWorld.GetGameWorld().GetGameMapManager()  | 
|       | 
|     isSendMapClose = False  | 
|     for i in range(0, gameMapManager.GetCount()):  | 
|         curMap = gameMapManager.GetAt(i)  | 
|   | 
|         if curMap.GetState() == IPY_GameServer.mssNone:  | 
|             #µØÍ¼ÒѾ»ÒÁË  | 
|             continue  | 
|   | 
|         if tick - curMap.GetRefreshTick() < ChConfig.Def_Tick_MapServer_MssNone:  | 
|             #¼ä¸ôδµ½  | 
|             continue  | 
|           | 
|         curMap.SetState(IPY_GameServer.mssNone)  | 
|         if not isSendMapClose:  | 
|             # ±ÜÃâ¶àµØÍ¼·¢Ë͹ý¶àÓʼþ, Èç¹Ø·þµÄʱºò  | 
|             GameWorld.SendGameError("MapDisconnect")   # ×´Ì¬±¨¸æ  | 
|             isSendMapClose = True  | 
|   | 
|     return  | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| # //01 07 µØÍ¼·þÎñÆ÷״̬ÐÅÏ¢#tagGMapServerMsg  | 
| #   | 
| # struct    tagGMapServerMsg  | 
| # {  | 
| #    tagHead        Head;  | 
| #    WORD        MsgLen;  | 
| #    char        Msg[MsgLen];        //size = MsgLen  | 
| # };  | 
| #===============================================================================  | 
| ## µØÍ¼·þÎñÆ÷״̬ÐÅÏ¢  | 
| #  @param index µØÍ¼Ë÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks µØÍ¼·þÎñÆ÷״̬ÐÅÏ¢.MapServer½Ó¿ÚGameWorld.GetGameWorld().SendGameServerMsg  | 
| def MapServer_MapServerMsg(index , tick):  | 
|     pack = IPY_GameServer.IPY_GMapServerMsg()  | 
|     msg = pack.GetMsg()  | 
|       | 
|     #MapServer·Ç¸öÈËÇëÇó´¦Àí  | 
|     RunEventFunc(msg)  | 
|     return  | 
|   | 
| ## MapServer·Ç¸öÈËÇëÇó´¦Àí  | 
| #  @param funcName   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def RunEventFunc(funcName):  | 
|     funcName = "RunEventFunc_" + funcName  | 
|       | 
|     if globals().has_key(funcName):  | 
|         return globals()[funcName]()  | 
|     else:  | 
|         GameWorld.Log("Error : RunEventFunc funcName = %s"%funcName)  | 
|   | 
|     return  | 
|   | 
|   | 
| ## ÓÃÓڹطþ֮ǰPYÒª´¦ÀíµÄÄÚÈÝ£¬×îºóÒ»¶¨ÒªÍ¨ÖªC++¹Ø·þ  | 
| #  @param None   | 
| #  @return None  | 
| def BeforeClose(tick):  | 
|     PlayerTeam.OnServerClose(tick)  | 
|     ChPlayer.SavePlayerLVData()  | 
|     PlayerFBHelpBattle.OnServerClose()  | 
|     CrossActionControl.OnServerClose()  | 
|     CrossChampionship.OnServerClose()  | 
|     CrossBattlefield.OnServerClose()  | 
|     PlayerFamilyRedPacket.OnServerClose()  | 
|     CrossLuckyCloudBuy.OnServerClose()  | 
|     GameWorldArena.OnServerClose()  | 
|     PlayerLove.OnServerClose()  | 
|     GameWorld.Log("֪ͨC++¹Ø·þ£¡")  | 
|     GameWorld.GetGameWorld().OnServerClose()  | 
|       | 
|       | 
| def ChangeGameServerState(state):  | 
|     # Ö»½ÓÊÕ´óÓÚµÈÓÚmssPyError  | 
|     GameWorld.DebugLog("ChangeGameServerState:%s"%state)  | 
|     GameWorld.SendGameError("GameServerError")  | 
|       | 
|      |