| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package ChPlayer  | 
| # @todo: Íæ¼Ò·â°üÂß¼´¦Àí  | 
| #  | 
| # @author: eggxp  | 
| # @date 2010-3-31  | 
| # @version 4.2  | 
| #  | 
| # @note:   | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2017-06-22 15:00"""   | 
| #---------------------------------------------------------------------  | 
| import GameWorld  | 
| import IPY_GameServer  | 
| import PlayerTeam  | 
| import ChConfig  | 
| import PlayerControl  | 
| import PlayerFamily  | 
| import PlayerEventCounter  | 
| import PlayerFriend  | 
| import GMCommon  | 
| import ShareDefine  | 
| #import PlayerFamilyTech  | 
| import PlayerDataCollect  | 
| import time  | 
| import ChPyNetSendPack  | 
| import NetPackCommon  | 
| import GameDataRecord  | 
| import GameConfig  | 
| import ReadChConfig  | 
| import UpdatePlayerName  | 
| import GameWorldBoss  | 
| import PlayerFamilyBoss  | 
| #import PlayerManorWar  | 
| import PlayerBourse  | 
| import GameWorldActionTeHui  | 
| import PlayerXMZZ  | 
| import GameWorldMergePK  | 
| import GameWorldShopItem  | 
| import MergeChildMsg  | 
| import PlayerTruck  | 
| import PlayerMergeEvent  | 
| import HighLadder  | 
| import EventReport  | 
| import MergePlayer  | 
| import PlayerCompensation  | 
| import PlayerFamilyRedPacket  | 
| import PlayerFamilyStore  | 
| import PyDataManager  | 
| import PlayerSocial  | 
| import PlayerFamilyParty  | 
| import PlayerSealDemon  | 
| import PlayerBillboard  | 
| import PlayerLVAward  | 
| import PlayerDuJie  | 
| import PlayerFamilySWRH  | 
| import IpyGameDataPY  | 
| import PlayerTalk  | 
| import PlayerGeTui  | 
| import GameWorldActionControl  | 
| import GMT_CTG  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Íæ¼ÒµÇ¼³õʼ»¯(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks µÇ½˳Ðò, PlayerLogin->PlayerLoadMapState(PlayerLoginLoadMapOK), ´Ë´¦Î´ÉèÖóõʼ»¯×´Ì¬  | 
| def PlayerLogin(index, tick):  | 
|     GameWorld.GetPsycoFunc(__Func_PlayerLogin)(index, tick)  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Íæ¼ÒµÇ¼³õʼ»¯(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks µÇ½˳Ðò, PlayerLogin->PlayerLoadMapState(PlayerLoginLoadMapOK), ´Ë´¦Î´ÉèÖóõʼ»¯×´Ì¬  | 
| def __Func_PlayerLogin(index, tick):  | 
|       | 
|     #Íæ¼ÒµÇ¼³õʼ»¯  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     #Íæ¼ÒÔÚÏßʱ¼ä³õʼ»¯  | 
|     InitPlayerOnLineTime(curPlayer, tick)  | 
|     #Íæ¼ÒÏìÓ¦ÐÅÏ¢³õʼ»¯  | 
|     InitPlayerOnLineReply(curPlayer, tick)  | 
|     # Í³¼ÆµÇÈëÈËÊý  | 
|     GameDataRecord.PlayerLoginRecord(curPlayer, tick)  | 
|     #Íæ¼Ò¼Ò×åˢР | 
|     #¼Ò×åÈÎÎñÐèҪˢРFamilyLV, µØÍ¼·þÎñÆ÷ÐèÒªÖªµÀFamilyLVÀ´Í¨ÖªÍæ¼Ò¼Ò×åÈÎÎñ´ÎÊý   | 
|     PlayerFamily.PlayerLoginRefreshFamily(curPlayer, tick)  | 
|     #Íæ¼Ò¶ÓÎé³õʼ»¯  | 
|     PlayerTeam.OnPlayerLoginRefreshTeam(curPlayer, tick)  | 
|     PlayerCompensation.NotifyPlayerCompensation(curPlayer)  | 
|       | 
|     if not PlayerControl.GetIsTJG(curPlayer):  | 
|         # Ö»ÓÐ֪ͨÂß¼µÄÓ¦¸Ã·Å´Ë´¦¼õÉÙIO£¬ÈçÓÐÂß¼´¦Àí´æ´¢µÈ²»¿É·ÅÔÚ´Ë´¦  | 
|         #ºÃÓÑÐÅϢˢР | 
|         PlayerFriend.OnPlayerLogin(curPlayer, tick)  | 
|           | 
|         #Í¨ÖªÍæ¼ÒµÇ½ÐÅÏ¢£¬À´×ÔÔËÓª·½  | 
|         #DoLogic_LoginUserData(curPlayer)  | 
|       | 
|         #֪ͨ¿ª·þÌìÊý  | 
|         PlayerEventCounter.Sync_OpenServerDay(curPlayer)  | 
|         # Í¨Öª¹ã²¥ÐÅÏ¢  | 
|         GMCommon.SendBroadCastToClient(curPlayer)  | 
|       | 
|       | 
|         # ÔÚ·Ç¿ç·þ·þÎñÆ÷ÉÏÏßʱ£¬ÔÚ¿ç·þPKÈüÆÚ¼äÈç¹ûroomID²»Îª0ÔòÖØÖà  | 
|         #if not GameWorld.IsMergeServer() and GameWorldMergePK.IsMergePKMatchOpen() \  | 
|         #    and curPlayer.GetVsRoomId() != 0:  | 
|         #    PlayerControl.SetVsRoomId(curPlayer, 0)  | 
|       | 
|         PlayerTruck.SyncPlayerTruckStartTime(curPlayer)  | 
|         #Í¨ÖªÍæ¼Ò½»Ò×Ëù¹Òµ¥Çé¿ö  | 
|         PlayerBourse.OnPlayerLogin(curPlayer)  | 
|   | 
|         #ÉÏÏ߹㲥  | 
|         __CheckWorldNotifyOnLogin(curPlayer, tick)  | 
|         #ÉÏÏß½±Àø´¦Àí  | 
|         #PlayerMergeEvent.MergeEventOnPlayerLogin(curPlayer)  | 
|         #MergePlayer.OnPlayerLogin(curPlayer)  | 
|           | 
|         #ÏÉÃ˺ì°ü  | 
|         PlayerFamilyRedPacket.OnPlayerLogin(curPlayer)  | 
|         #ÏÉÃË²Ö¿â  | 
|         PlayerFamilyStore.OnPlayerLogin(curPlayer)  | 
|         #ÏÉÃËÑç»á  | 
|         PlayerFamilyParty.OnPlayerLogin(curPlayer)  | 
|         #·âħ̳  | 
|         PlayerSealDemon.OnPlayerLogin(curPlayer)  | 
|         #ÏÉħ֮Õù  | 
|         PlayerXMZZ.OnXMZZOnLogin(curPlayer)  | 
|         #µÈ¼¶½±Àø  | 
|         PlayerLVAward.OnPlayerLogin(curPlayer)  | 
|       | 
|         #֪ͨÊÀ½çbossÐÅÏ¢  | 
|         GameWorldBoss.OnPlayerLogin(curPlayer)  | 
|         #¼Ò×帱±¾boss״̬֪ͨ  | 
|         PlayerFamilyBoss.OnLogin(curPlayer)  | 
|         #¶É½Ù  | 
|         PlayerDuJie.OnPlayerLogin(curPlayer)  | 
|         #ÊØÎÀÈË»Ê  | 
|         PlayerFamilySWRH.OnLogin(curPlayer)  | 
|         PlayerTalk.LoginChatMi(curPlayer)  | 
|         PlayerGeTui.CleanNewGuyCallBackGeTui(curPlayer.GetID())  | 
|         #»î¶¯  | 
|         GameWorldActionControl.OnPlayerLogin(curPlayer)  | 
|           | 
|         GMT_CTG.OnPlayerLogin(curPlayer)  | 
|           | 
|     #֪ͨµØÍ¼·þÎñÆ÷×Ô¼º³õʼ»¯³É¹¦  | 
|     curPlayer.MapServer_InitOK()  | 
|     return  | 
|   | 
| ## Ôö¼Ó¸ßÊÖÍæ¼ÒÉÏÏ߹㲥  | 
| #  @param curPlayer  | 
| #  @return None  | 
| def __CheckWorldNotifyOnLogin(curPlayer, tick):  | 
|     # ¿ç·þ·þÎñÆ÷²»¹ã²¥  | 
|     if GameWorld.IsMergeServer():  | 
|         return  | 
|       | 
|     limitLV = IpyGameDataPY.GetFuncCfg("BillBoardPlayerLoginNotify", 2) # ×îµÍµÈ¼¶ÏÞÖÆ  | 
|       | 
|     if curPlayer.GetLV() < limitLV:  | 
|         return  | 
|       | 
|     notifyCD = IpyGameDataPY.GetFuncCfg("BillBoardPlayerLoginNotify", 3)  | 
|     LogoffTime = GetPlayerLeaveServerSecond(curPlayer)  | 
|     if LogoffTime and LogoffTime < notifyCD:  | 
|         #¾àÀëÉÏ´ÎÀëÏßµÄʱ¼äCD  | 
|         return  | 
|        | 
|     notifyCheckList = IpyGameDataPY.GetFuncEvalCfg("BillBoardPlayerLoginNotify")  | 
|     msgMark = ""  | 
|     for checkMark, notifyDict in notifyCheckList:  | 
|           | 
|         # ÅÅÐаñÀàÐÍ  | 
|         if isinstance(checkMark, int):  | 
|             if checkMark not in ShareDefine.BillboardTypeList:  | 
|                 continue  | 
|               | 
|             if checkMark in [ShareDefine.Def_BT_HighLadder]:  | 
|                 continue  | 
|               | 
|             billboard = GameWorld.GetBillboard().FindBillboard(checkMark)  | 
|             if not billboard:  | 
|                 continue  | 
|               | 
|             billboardCnt = billboard.GetCount()  | 
|             maxOrder = max(notifyDict)  | 
|             for index in range(0, maxOrder):  | 
|                 if index < 0 or index >= billboardCnt:  | 
|                     continue  | 
|                   | 
|                 order = index + 1  | 
|                   | 
|                 if order not in notifyDict:  | 
|                     continue  | 
|                   | 
|                 objBillboard = billboard.At(index)  | 
|                 if curPlayer.GetID() == objBillboard.GetID():  | 
|                     msgMark = notifyDict[order]  | 
|                     break  | 
| #        # ¾º¼¼³¡  | 
| #        elif checkMark == "HighLadder":  | 
| #            highLadderOrder = HighLadder.GetPlayerOrder(curPlayer.GetID()) + 1  | 
| #            msgMark = notifyDict.get(highLadderOrder, "")               | 
|           | 
|         # ÓпÉÒԹ㲥µÄ£¬ÂíÉϹ㲥£¬Í˳ö£¬²»ÔÙ¼ì²é  | 
|         if msgMark:  | 
|             PlayerControl.WorldNotify(0, msgMark, [curPlayer.GetName()])  | 
|             break  | 
|       | 
|     return  | 
|   | 
| ##»ñµÃÍæ¼Òµ±Ç°ÀۼƵÄÀëÏßÃëÊý  | 
| # @param curPlayer Íæ¼ÒʵÀý  | 
| # @return ÀۼƵÄÃëÊý  | 
| # @remarks ¿Í»§¶Ë·â°üÏìÓ¦  | 
| def GetPlayerLeaveServerSecond(curPlayer):  | 
|     #µ±Ç°ÀëÏßʱ¼ä×Ö·û´«  | 
|     logoffTimeStr = curPlayer.GetLogoffTime()  | 
|   | 
|     if logoffTimeStr == "" or logoffTimeStr == '0':  | 
|         return 0  | 
|   | 
|     logoffTime = GameWorld.GetDateTimeByStr(logoffTimeStr)  | 
|     loginTime = GameWorld.GetDateTimeByStr(GameWorld.GetCurrentDataTimeStr())  | 
|   | 
|     diff_Time = loginTime - logoffTime  | 
|     #ÌìÊý * 24Сʱ * 60 ·ÖÖÓ + Ãë  | 
|     return diff_Time.days * 24 * 60 * 60 + diff_Time.seconds  | 
|   | 
| ## Í³¼Æ¿Í»§¶Ë¿ç·þÈü¼¤»îʱ¼ä  | 
| #  @param index Íæ¼ÒË÷Òý  | 
| #  @return None  | 
| def SendMergeWarOpen(curPlayer):  | 
|     # ·¢ËÍ¿ç·þÈü·þÎñÆ÷ÐÅÏ¢  | 
|     mapConfig = GameConfig.GetConfig()  | 
|     mergeServerIP = mapConfig.get("MergeServerIP")  | 
|     mergeServerPort = mapConfig.get("MergeServerPort")  | 
|     if not mergeServerIP:  | 
|         return  | 
|     mergeServerInfo = ChPyNetSendPack.tagMergeServerInfo()  | 
|     mergeServerInfo.ServerIPLen = len(mergeServerIP)  | 
|     mergeServerInfo.ServerIP = mergeServerIP  | 
|     mergeServerInfo.Port = mergeServerPort  | 
|     mergeServerInfo.IsMergeServer = GameWorld.IsMergeServer()  | 
|     NetPackCommon.SendFakePack(curPlayer, mergeServerInfo)  | 
|     return  | 
|   | 
| ## ¿ç·þÈü֪ͨ½±Àø  | 
| #  @param curPlayer: Íæ¼ÒʵÀý  | 
| #  @return: None  | 
| def MSGetReward(curPlayer):  | 
|     #PlayerCanGetReward.SynClient_CanGetRewardList(curPlayer)  | 
|     return  | 
|   | 
|   | 
| ## Í¨ÖªÊ״οª·þʱ¼ä  | 
| #  @param curPlayer: Íæ¼ÒʵÀý  | 
| #  @return: None  | 
| def Sync_InitOpenServerTime(curPlayer):  | 
| #    initOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime)  | 
| #    packData = ChPyNetSendPack.tagInitOpenServerTime()  | 
| #    packData.Clear()  | 
| #    packData.Time = initOpenServerTime  | 
| #    NetPackCommon.SendFakePack(curPlayer, packData)  | 
|     return  | 
|       | 
|   | 
| ## ÔËÓªµÇ½ÐÅÏ¢´¦Àí  | 
| #  @param curPlayer  | 
| #  @return None  | 
| def DoLogic_LoginUserData(curPlayer):  | 
|     curPlayerUserData = GameWorld.GetUserData(curPlayer)  | 
|     if not curPlayerUserData:  | 
|         return  | 
|       | 
|     #Õ˺ż¤»î½±Àø  | 
|     ActivateAccountAward(curPlayer, curPlayerUserData)  | 
|       | 
|     SyncOPPlayerLoginInfo(curPlayer, curPlayerUserData)  | 
|     #NotifyGameWallowInfo  | 
|     return  | 
|   | 
|   | 
| ## ¸ù¾Ýkey»ñÈ¡Óû§ÐÅÏ¢  | 
| #  @param curPlayer  | 
| #  @param key  | 
| #  @param default  | 
| #  @return  | 
| def GetUserDataByKey(curPlayer, key, default=None):  | 
|     playerUserDataStr = curPlayer.GetUserData()  | 
|       | 
|     if not playerUserDataStr:  | 
|         return default  | 
|       | 
|     try:  | 
|         curPlayerUserData = eval(playerUserDataStr)  | 
|     except:  | 
|         GameWorld.ErrLog("data error UserData = %s"%curPlayerUserData )  | 
|         return default  | 
|       | 
|     if not isinstance(curPlayerUserData, dict):  | 
|         GameWorld.ErrLog("type error UserData = %s"%curPlayerUserData )  | 
|         return default  | 
|       | 
|     return curPlayerUserData.get(key, default)  | 
|   | 
| # Ñ¸À×ÐÅÏ¢  | 
| #curPlayerUserData={'username': 'alee',   | 
| #'cm': '1', 'agent': 'xunlei', 'goldlevel': '2', 'viplevel': '3',   | 
| #'serverid': '1', 'isvip': '1', 'clienttype': '1', 'isgoldvip': '1', 'paytype': '1',   | 
| #'token': '6fb3a97df0bb3c142593a11a95a1688b', 'time': '1393575021', 'viptype': '2'}  | 
|   | 
|   | 
| ## Í¨ÖªMAPƽ̨µÇ½ÐÅÏ¢  | 
| #  @param curPlayer  | 
| #  @return µÇ½ÐÅÏ¢×Ö·û´®  | 
| def SyncOPPlayerLoginInfo(curPlayer, userDict):  | 
|     if userDict.get('agent', "") == "xunlei":  | 
|         isvip = int(userDict.get('isvip', 0))  | 
|         curPlayer.SetDict("XunLeiVIP", isvip)  | 
|         #ѸÀ×Óû§£¬Ñ¸À×VIP£¬VIPµÈ¼¶£¬½ð¿¨VIP£¬½ð¿¨µÈ¼¶, µÇ¼¿Í»§¶ËÀàÐÍ  | 
|         result = ['xunlei', isvip, int(userDict.get('viplevel', 0)), int(userDict.get('isgoldvip', 0)),   | 
|                   int(userDict.get('goldlevel', 0)), int(userDict.get('clienttype', 0))]  | 
|     else:  | 
|         result = [int(userDict.get('clienttype', 0)), userDict.get('channel_code', ""),]  | 
|           | 
|     pid = GameWorld.ToIntDef(userDict.get('pid', "0"))  | 
|     curPlayer.SetDict(ChConfig.Def_PlayerKey_PlayerFromPID, pid)  | 
|       | 
|     platform = userDict.get('pf', "")  | 
|     if not platform:  | 
|         platform = userDict.get('platform', "")  | 
|           | 
|     account_type = GameWorld.ToIntDef(userDict.get('qidtype', "0"))  | 
|       | 
|     result.extend([pid, platform, account_type])  | 
|           | 
|     # µ± pf Îª qzone¡¢pengyou¡¢qplus Ê±£¬·¢ËÍ»Æ×êÐÅÏ¢  | 
|     if platform in ["qzone", "pengyou", "qplus"]:  | 
|         result.extend([int(userDict.get('is_yellow', 0)), int(userDict.get('is_year_yellow', 0)),   | 
|                        int(userDict.get('is_high_yellow', 0)), int(userDict.get('yellow_level', 0))])  | 
|           | 
|     # µ± pf Îª qqgame¡¢3366 Ê±£¬·¢ËÍÀ¶×êÐÅÏ¢  | 
|     elif platform in ["qqgame", "3366"]:  | 
|         result.extend([int(userDict.get('is_blue', 0)), int(userDict.get('is_year_blue', 0)),   | 
|                        int(userDict.get('is_high_blue', 0)), int(userDict.get('blue_level', 0))])  | 
|           | 
|     result = str(result)  | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, "LoginData", result, len(result))  | 
|     return  | 
|   | 
|       | 
| ## Õ˺ż¤»î½±Àø  | 
| #  @param Userdict  | 
| #  @return None  | 
| def ActivateAccountAward(curPlayer, userDict):  | 
|     if not userDict.has_key("activateType"):  | 
|         return  | 
|       | 
|     msg = str(userDict["activateType"])  | 
|       | 
|     curPlayer.MapServer_QueryPlayerResult(0, 0, 'ActivateAward', msg, len(msg))  | 
|   | 
|       | 
| ## Í¨ÖªÍæ¼Ò·À³ÁÃÔÐÅÏ¢  | 
| #  @param curPlayer: Íæ¼ÒʵÀý  | 
| #  @return: None  | 
| def NotifyGameWallowInfo(curPlayer):  | 
|       | 
|     return  | 
|     playerUserDataStr = curPlayer.GetUserData()  | 
|       | 
|     if not playerUserDataStr:  | 
|         return  | 
|       | 
|     curPlayerUserData = eval(playerUserDataStr)  | 
|   | 
|     GameWorld.Log("type=%s, curPlayerUserData=%s"%(type(curPlayerUserData), curPlayerUserData))  | 
|     #º«¹ú°æÓÐcurPlayerUserDataÊý¾Ý  | 
|     if not curPlayerUserData:  | 
|         GameWorld.Log("not curPlayerUserData=%s"%curPlayerUserData )  | 
|         return  | 
|       | 
|     try:  | 
|         curPlayerAge = int(curPlayerUserData["data"]["result"]["age"])  #ÄêÁä  | 
|         endTime = curPlayerUserData["data"]["result"]["endtime"]    #½áÊøÊ±¼ä  | 
|     except BaseException:  | 
|         GameWorld.ErrLog("curPlayerAge or endTime ##Error!" )  | 
|         return  | 
|   | 
|     #ÏÖÔÚʱ¼ä  | 
|     #curPlayerAge = 15 #ÄêÁä  | 
|     #endTime = ""    #½áÊøÊ±¼ä  | 
|   | 
|     if not curPlayerAge:  | 
|         GameWorld.ErrLog("curPlayerAge:%s not ##Error!"%curPlayerAge )  | 
|         return  | 
|   | 
|     if endTime:  | 
|         if not GameWorld.GetDateTimeByStr(endTime):  | 
|             GameWorld.ErrLog("endTime:%s Format ##Error!"%endTime )  | 
|             return  | 
|         endTime = int(time.mktime(time.strptime(endTime,"%Y-%m-%d %H:%M:%S")))   | 
|     else:  | 
|         endTime = 0  | 
|       | 
| #    packData = ChPyNetSendPack.tagInfoGameWallow()  | 
| #    packData.Clear()  | 
| #    packData.Age = curPlayerAge  | 
| #    packData.EndTime = endTime  | 
| #    GameWorld.Log("Í¨ÖªÍæ¼Ò·À³ÁÃÔÐÅÏ¢,packData.Age=%s ,packData.EndTime=%s"%(packData.Age,packData.EndTime))  | 
| #    NetPackCommon.SendFakePack(curPlayer, packData)  | 
|       | 
|     return  | 
|   | 
| ## ·¢ËÍÇëÇóÖÁÄ¿±êµØÍ¼(ÈÎÎñÐèÒªµÇ½¼Ò×峤´¥·¢Ê¼þ)  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __RefreshFamilyToMapServer(curPlayer):  | 
|     curFamily = curPlayer.GetFamily()  | 
|       | 
|     if not curFamily:  | 
|         #Íæ¼ÒÎÞ¼Ò×å  | 
|         return  | 
|       | 
|     playerID = curPlayer.GetPlayerID()  | 
|     curMember = curFamily.FindMember(playerID)  | 
|       | 
|     if not curMember:  | 
|         GameWorld.ErrLog("ˢмÒ×åÊôÐÔʧ°Ü, ¼Ò×å³ÉÔ±²éÕÒÒì³£ = %s"%(playerID))  | 
|         return  | 
|       | 
|     tagMapID = GameWorld.GetQueryPlayerMapID(curPlayer)  | 
|       | 
|     if not tagMapID:  | 
|         GameWorld.ErrLog("ˢмÒ×åÊôÐÔʧ°Ü, ¼Ò×å³ÉÔ±²éÕÒÒì³£ tagMapID = %s"%(tagMapID))  | 
|         return  | 
|       | 
|     sendCMD = "0"  | 
|       | 
|     if curMember.GetFamilyLV() == IPY_GameServer.fmlLeader:  | 
|         sendCMD = "1"  | 
|       | 
|     queryCallName = "Refresh_Family_Info"  | 
|       | 
|     #֪ͨMapServer½á¹û´¦Àí  | 
|     GameWorld.GetPlayerManager().MapServer_QueryPlayer(playerID, ChConfig.queryType_sqtRefresh_Family_Info,   | 
|                     playerID, tagMapID, queryCallName, sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())  | 
|     return  | 
|       | 
|   | 
| ## Íæ¼ÒÔÚÏßʱ¼ä³õʼ»¯   | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def InitPlayerOnLineTime(curPlayer, tick):  | 
|     curPlayer.SetLoginTick(tick)  | 
|     return  | 
|   | 
| ## Íæ¼ÒÏìÓ¦ÐÅÏ¢³õʼ»¯   | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def InitPlayerOnLineReply(curPlayer, tick):  | 
|     curPlayer.SetOnlineReplyErrorCount(0)  | 
|     curPlayer.SetOnlineReplyTick(0)  | 
|     return  | 
|   | 
| ## Íæ¼ÒÏÂÏß(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PlayerDisconnect(index, tick):  | 
|     GameWorld.GetPsycoFunc(__Func_PlayerDisconnect)(index, tick)  | 
|     return  | 
|   | 
| ## Íæ¼ÒÏÂÏß(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __Func_PlayerDisconnect(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     #¿ç·þÆ¥ÅäPK  | 
|     #GameWorldMergePK.OnLeaveServer(curPlayer)  | 
|       | 
|     #×é¶ÓÍæ¼ÒÀëÏß  | 
|     PlayerTeam.DoPlayerLogOffTeamLogic(curPlayer, tick)  | 
|     #¼Ò×åÍæ¼ÒÀëÏß  | 
|     PlayerFamily.PlayerLogoffRefreshFamily(curPlayer, tick)  | 
|     PlayerFriend.OnPlayerDisconnect(curPlayer, tick)  | 
|       | 
|     PlayerGeTui.NewGuyCallBackGeTui(curPlayer, tick)  | 
|     # ÉèÖüÒ×å³ÉÔ±ÀëÏßʱ¼ä  | 
|     SetPlayerOfflineTime(curPlayer)  | 
|       | 
|     #MergePlayer.OnPlayerLeaveGotoMergeServer(curPlayer, tick)  | 
|     #------------ïÚ³µÂß¼  | 
|     #TruckPlayerDisconnectProcess(curPlayer, tick)  | 
|     #µ÷ÓõײãÏÂÏß  | 
|     curPlayer.DoDisconnect()  | 
|     return  | 
|   | 
| ## ÉèÖÃÍæ¼ÒÀëÏßʱ¼ä  | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def SetPlayerOfflineTime(curPlayer):  | 
|     if PlayerControl.GetIsTJG(curPlayer):  | 
|         return  | 
|       | 
|     curPlayerID = curPlayer.GetPlayerID()  | 
|     curFamily = curPlayer.GetFamily()  | 
|     if not curFamily:  | 
|         return  | 
|     curMember = curFamily.FindMember(curPlayerID)  | 
|     curTimeStr = GameWorld.GetCurrentDataTimeStr()  | 
|     curTimeTuple = time.strptime(curTimeStr, ChConfig.TYPE_Time_Format)  | 
|     curTimeNum = int(time.mktime(curTimeTuple))  | 
|   | 
|     curMember.SetExattr2(curTimeNum)  | 
|   | 
| ## ïÚ³µÂß¼(²ÎÊý -> µ±Ç°Íæ¼Ò,µ±Ç°Ê±¼ä)  | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def TruckPlayerDisconnectProcess(curPlayer, tick):  | 
| #    #ïÚ³µ¹ÜÀíÆ÷  | 
| #    truckMananger = GameWorld.GetTruckMananger()  | 
| #    curPlayerTruck = truckMananger.FindTruckByOwner(curPlayer.GetPlayerID())  | 
| #    #¸ÃÍæ¼ÒÎÞïÚ³µ  | 
| #    if curPlayerTruck == None :  | 
| #        return  | 
| #    #ÉèÖüÆËãïÚ³µÏûʧʱ¼ä  | 
| #    curPlayerTruck.SetLogoffTick(tick)  | 
|     return  | 
|   | 
| ## Ë¢ÐÂÍæ¼ÒÃû×Ö(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def RefreshName(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     playerNamePack = IPY_GameServer.IPY_GRefreshPlayerName()  | 
|     curPlayer.SetName(playerNamePack.GetName())  | 
|     return  | 
|   | 
| ## Ë¢ÐÂ״̬(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def RefreshState(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|       | 
|     if curPlayer == None:  | 
|         GameWorld.Log("RefreshState, index = %d, player = None"%(index))  | 
|         return  | 
|       | 
|     playerStatePack = IPY_GameServer.IPY_GRefreshPlayerProperty()  | 
|     packValue = playerStatePack.GetValue()  | 
|     packType = playerStatePack.GetType()  | 
|       | 
|     #---ÌØÊâÂß¼´¦Àí---  | 
|     if packType == ShareDefine.CDBPlayerRefresh_ForbidenTalk:  | 
|         PlayerControl.SetGMForbidenTalk(curPlayer, packValue)  | 
|         return  | 
|       | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_State:  | 
|         # ÍÑ»úÔÚÏß  | 
|         PlayerControl.SetIsTJG(curPlayer, packValue)  | 
|         return  | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_HappyPoint:  | 
|         # ÍÑ»úʱ¼ä  | 
|         PlayerControl.SetTJGTime(curPlayer, packValue)  | 
|         return  | 
|       | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_FamilyActiveValue:  | 
|         #¼Ò×å»îÔ¾¶ÈˢР | 
|         PlayerFamily.ReFreshPlayerFamilyActiveValue(curPlayer, packValue)  | 
|         return  | 
|       | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_FightPower:  | 
|         curPlayer.SetFightPower(packValue)  | 
|         return  | 
|   | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_ExAttr10:  | 
|         #ÉèÖÃÍæ¼Ò¿ç·þÔ¤ÈüÅÅλ  | 
|         PlayerControl.SetMergeWarRank(curPlayer, packValue)  | 
|         return  | 
|   | 
|     if packType == IPY_GameServer.CDBPlayerRefresh_ExAttr2:  | 
|         #¶ÓÎéÏà¹ØÏà¹ØÉóºË¿ª¹Ø×´Ì¬  | 
|         PlayerTeam.SetTeamCheckState(curPlayer, packValue)  | 
|         return  | 
|       | 
|     #---³£¹æÂß¼´¦Àí---  | 
|           | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_LV:  | 
|         curPlayer.SetLV(packValue)  | 
|         PlayerSocial.UpdateSocialInfo(curPlayer, packType, packValue)  | 
|   | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_Job:  | 
|         curPlayer.SetJob(packValue)  | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_ExAttr1:  | 
|         PlayerControl.SetJobRank(curPlayer, packValue)  | 
|           | 
| #    elif packType == IPY_GameServer.CDBPlayerRefresh_CurrentPlayerType:  | 
| #        #ÕâÀïÓ¦¸Ã֪ͨ×é¶ÓÄDZßˢР | 
| #        curPlayer.SetCurrentProperty(packValue)  | 
| #        __RefreshTeamState(curPlayer)  | 
|           | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_MapID:  | 
|         #Íæ¼ÒÇл»µØÍ¼  | 
|         curPlayer.SetMapID(packValue)  | 
|           | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_RealMapID:  | 
|         #Íæ¼ÒµÄÕæÊµµØÍ¼ID  | 
|         curPlayer.SetRealMapID(packValue)  | 
|         OnPlayerChangeRealMap(curPlayer, tick)  | 
|           | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_FBID:  | 
|         curPlayer.SetFBID(packValue)  | 
|       | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_VIPLv:  | 
|         curPlayer.SetVIPLv(packValue);  | 
| #        __RefreshTeamState(curPlayer)  | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_ExAttr9:  | 
|         PlayerControl.SetVIPExpireTime(curPlayer, packValue)  | 
|           | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_OperateInfo:  | 
|         curPlayer.SetOperateInfo(packValue);  | 
|       | 
|     elif packType == IPY_GameServer.CDBPlayerRefresh_OfficialRank:  | 
|         curPlayer.SetOfficialRank(packValue)  | 
|         PlayerSocial.UpdateSocialInfo(curPlayer, packType, packValue)  | 
|         #¸üÐÂÅÅÐаñµÄ¾³½ç  | 
|         PlayerBillboard.UpdateBillboardRealm(curPlayer)  | 
|           | 
|     #×é¶Ó³ÉԱˢР | 
|     PlayerTeam.PlayerTeamMemberRefresh(curPlayer, packType, packValue, tick)  | 
|     #¼Ò×åˢР | 
|     PlayerFamily.PlayerRefresh(curPlayer, tick)  | 
|   | 
|     return  | 
|   | 
| ## Íæ¼ÒÇл»µØÍ¼µÄÏìÓ¦(²ÎÊý -> µ±Ç°Íæ¼Ò,µ±Ç°Ê±¼ä)  | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnPlayerChangeMap(curPlayer, tick):  | 
|     #δ³õʼ»¯³É¹¦²»´¦Àí  | 
|     if not curPlayer.GetInitOK():  | 
|         #GameWorld.ErrLog("Çл»µØÍ¼, Íæ¼Ò³õʼ»¯²»³É¹¦£¬²»Ö´ÐÐÏà¹ØÂß¼", curPlayer.GetPlayerID())  | 
|         return  | 
|       | 
|     GameWorld.Log("Íæ¼Ò : %s,%s,FBID=%s Çл»µØÍ¼" % (curPlayer.GetName(), curPlayer.GetRealMapID(), curPlayer.GetFBID()) , curPlayer.GetPlayerID())  | 
|     PlayerTeam.OnPlayerChangeMap(curPlayer, tick)  | 
|     GameWorldBoss.OnPlayerChangeMap(curPlayer)  | 
|     return   | 
|   | 
| ## Íæ¼ÒÇл»ÕæÊµµØÍ¼  | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnPlayerChangeRealMap(curPlayer , tick):  | 
| #===============================================================================  | 
| #    Çл»µØÍ¼·â°üʱÐò  | 
| #    CDBPlayerRefresh_MapID  | 
| #    CDBPlayerRefresh_FBID  | 
| #    CDBPlayerRefresh_RealMapID  | 
| #===============================================================================  | 
|     #¿ªÊ¼µØÍ¼³õʼ»¯¶¯×÷  | 
|     OnPlayerChangeMap(curPlayer, tick)  | 
|     return  | 
|   | 
| ## ¼ì²éÍæ¼ÒÏìӦʱ¼ä(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PlayerOnlineReply(index, tick):  | 
|     #Ŀǰ×öµ½RouteServerÖÐÈ¥ÁË  | 
| #    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
| #      | 
| #    curPlayer.Sync_OnlineReplyAnswer()  | 
| #    if curPlayer.GetOnlineReplyTick() == 0:  | 
| #        curPlayer.SetOnlineReplyTick(tick)  | 
| #        return  | 
| #      | 
| #    #ÏìӦʱ¼ä¼ì²â(5ÃëÕý³£¼Ç¼,10ÃëÌßÏÂÏß,10´Î´íÎóÌßÏÂÏß)  | 
| #    playerOnlineReplayTime = abs( tick - curPlayer.GetOnlineReplyTick() - ChConfig.Def_PlayerOnLineReply_ClientReply)  | 
| #    #²»ÁôÇé,Ö±½ÓÌß  | 
| #    if playerOnlineReplayTime >= ChConfig.Def_PlayerOnLineReply_MaxTick:  | 
| #        GameWorld.Log("ÏìÓ¦´íÎó,ʱ¼ä³¬¹ý%s,ÌßÏÂÏß"%(ChConfig.Def_PlayerOnLineReply_MaxTick))  | 
| #        curPlayer.Kick(IPY_GameServer.disTimeError)  | 
| #        return True  | 
| #    #¼Ç¼  | 
| #    elif playerOnlineReplayTime >= ChConfig.Def_PlayerOnLineReply_NoteTick:  | 
| #        curPlayer.SetOnlineReplyErrorCount( curPlayer.GetOnlineReplyErrorCount() + 1 )  | 
| #        GameWorld.Log("ÏìÓ¦´íÎó,Òѱ»¼Ç¼,µ±Ç°´ÎÊý%s"%(curPlayer.GetOnlineReplyErrorCount()))  | 
| #    #¼ì²é´íÎó´ÎÊý,Ö±½ÓÌß  | 
| #    if curPlayer.GetOnlineReplyErrorCount() >= ChConfig.Def_PlayerOnLineReply_ErrorCount:  | 
| #        GameWorld.Log("ÏìÓ¦´íÎó,´íÎó´ÎÊý³¬¹ý%s,ÌßÏÂÏß"%(ChConfig.Def_PlayerOnLineReply_ErrorCount))  | 
| #        curPlayer.Kick(IPY_GameServer.disTimeError)  | 
| #        return True  | 
| #    #ÉèÖõ±Ç°Ê±¼ä  | 
| #    curPlayer.SetOnlineReplyTick(tick)  | 
|       | 
|     return True  | 
|   | 
| #//////////////////////////////////////////////////////////////  | 
| #//01 03 Íæ¼ÒµÇ¼µØÍ¼³õʼ»¯#tagGPlayerLoadMap  | 
| #tagGPlayerLoadMap       *   GettagGPlayerLoadMap();  | 
| #  | 
| #class   IPY_GPlayerLoadMap  | 
| #{  | 
| #public:  | 
| #    //0: ¿ªÊ¼¶ÁÈ¡ 1: ¶ÁÈ¡³É¹¦  | 
| #    int      GetLoadState();  | 
| #};  | 
|   | 
| ## Íæ¼ÒµÚÒ»´Î½øÈëÓÎÏ·³õʼ»¯(²ÎÊý -> µ±Ç°Íæ¼Ò,µ±Ç°Ê±¼ä)  | 
| #  @param curPlayer  µ±Ç°Íæ¼Ò   | 
| #  @param tick µ±Ç°Ê±¼ä   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PlayerLoginLoadMapOK(curPlayer, tick):  | 
|     #ÔÚÍæ¼Ò·¢À´·â°ü, µØÍ¼¶ÁÈ¡³É¹¦ºó´¥·¢  | 
|     GameWorld.Log("%s µÇ¼, accID = %s, IP = %s, MapID = %s"%(curPlayer.GetName(), curPlayer.GetAccID(), curPlayer.GetIP(), curPlayer.GetRealMapID()) , curPlayer.GetPlayerID())  | 
|     #·¢Ë͸ø¿Í»§¶Ë·â°üͬ²½Ê±¼ä¸ÄÓÃA0 04  | 
|     #curPlayer.Sync_ServerDataTimeToClient()  | 
|     #¸Äµ½mapServerµÇ¼³É¹¦Í¨Öª  | 
|     #Sync_PyServerDataTimeToClient(curPlayer, tick)  | 
|       | 
|     #PlayerTeam.OnPlayerReadMapOK(curPlayer, tick)  | 
|       | 
|     #Ë¢ÐÂÈËÎïÈÕÆÚ״̬  | 
|     PlayerEventCounter.UpdatePlayerLoginTime(curPlayer)  | 
|       | 
| #===============================================================================  | 
| #    #¸±±¾»î¶¯½çÃæÐÞ¸ÄΪ, Íæ¼Òµã»÷NPC´¥·¢, 2010-07-02  | 
| #    if GameWorld.GetGameWorld().GetGameFbEventList().GetGameFbEventListCount() != 0:  | 
| #        #»î¶¯¸±±¾²»Îª0, Í¨Öª¿Í»§¶ËËùÓи±±¾×´Ì¬  | 
| #        curPlayer.Sync_GameFbEvent()  | 
| #===============================================================================  | 
|     #×Ô¼ºÒѾ³õʼ»¯³É¹¦  | 
|     curPlayer.SetInitOK(True)  | 
|       | 
|     #·¢ËÍÇëÇóÖÁÄ¿±êµØÍ¼(ÈÎÎñÐèÒªµÇ½¼Ò×峤´¥·¢Ê¼þ)  | 
|     __RefreshFamilyToMapServer(curPlayer)  | 
|     return  | 
|   | 
| ## Íæ¼Ò¶ÁÈ¡µØÍ¼×´Ì¬(·â°ü²ÎÊý)  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def PlayerLoadMapState(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     pack = IPY_GameServer.IPY_GPlayerLoadMap()  | 
|     if pack.GetLoadState() == 0:  | 
|         curPlayer.SetIsLoadMap(True)  | 
|         return  | 
|       | 
|     #Íæ¼ÒµÚÒ»´Î½øÈëÓÎÏ·³õʼ»¯£¬ÕâÀïÖ»ÔËÐÐÒ»´Î  | 
|     if not curPlayer.GetInitOK():  | 
|         PlayerLoginLoadMapOK(curPlayer, tick)  | 
|           | 
|         #¾ÀÕýÍæ¼ÒÃû×ÖÐÞ¸ÄÊÇ·ñ³É¹¦  | 
|         UpdatePlayerName.PlayerLoadMapRedressUpdatePlayerName(curPlayer, tick)  | 
|       | 
|     #2008.12.21  | 
|     #ÓÉÓÚbug: 2¸öÈËͬʱ½ø¸±±¾, ·Ç¶Ó³¤»á±»Ìß³ö  | 
|     #ÔÒò: ×é¶ÓˢеÄʱ»úÊÇÔÚ¿Í»§¶Ë·¢À´µØÍ¼¶ÁÈ¡³É¹¦µÄʱºò, Õâ¸öʱ»ú¹ýÍí  | 
|     #µ±2¸öÈËͬʱ½øÈëµÄʱºò, µØÍ¼·þÎñÆ÷»¹Ã»ÓÐ×é¶ÓÐÅÏ¢, ËùÒԻᱻÌß  | 
|     #ËùÒÔ°ÑOnPlayerChangeMapʼþ¸Äµ½SetMapIDÖÐ  | 
| #    else:  | 
| #        #¿ªÊ¼µØÍ¼³õʼ»¯¶¯×÷  | 
| #        OnPlayerChangeMap(curPlayer, tick)  | 
|       | 
|     #Íæ¼ÒµØÍ¼¶ÁÈ¡³É¹¦ºó£¬·¢Ë͸øµØÍ¼·þÎñÆ÷³õʼ»¯³É¹¦·â°ü  | 
|     if curPlayer.GetIsLoadMap():  | 
|         #֪ͨµØÍ¼·þÎñÆ÷Íæ¼Ò³õʼ»¯³É¹¦  | 
|         curPlayer.MapServer_GameServerRefreshOK()  | 
|       | 
|     curPlayer.SetIsLoadMap(False)  | 
|       | 
|     #Ö´ÐнûIP²Ù×÷  | 
|     GMCommon.DoLogic_GMForbidIP(curPlayer, tick)  | 
|       | 
|     GameWorld.Log("Íæ¼Ò¿ªÊ¼µØÍ¼³õʼ»¯¶¯×÷" , curPlayer.GetPlayerID())  | 
|     return  | 
|   | 
| #g_worldNotifyTick = 0  | 
| ## ÊÀ½ç֪ͨ  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def WorldNotify(index, tick):  | 
|     #===============================================================================================  | 
|     # global g_worldNotifyTick  | 
|     # if g_worldNotifyTick and tick - g_worldNotifyTick < 3000:  | 
|     #    return  | 
|     # g_worldNotifyTick = tick  | 
|     #===============================================================================================  | 
|     pack = IPY_GameServer.IPY_GWorldNotifyCode()  | 
|     #¹¹½¨ÏµÍ³Ìáʾ²ÎÊýÁÐ±í  | 
|     notifyCodeList = PlayerControl.NotifyCodeList  | 
|     notifyCodeList.Clear()  | 
|       | 
|     for i in range(pack.GetParCount()):  | 
|         notifyMsg = pack.GetPars(i)  | 
|           | 
|         if notifyMsg.GetLen() == 0:  | 
|             #ÊÇÕûÐÍ  | 
|             notifyCodeList.AddInt(notifyMsg.GetMsgInt())  | 
|             #ÊÇ×Ö·û´®  | 
|         else:  | 
|             notifyCodeList.AddStr(notifyMsg.GetMsg())  | 
|       | 
|     familyID = pack.GetFamilyID()  | 
|       | 
|     #¼Ò×å¹ã²¥  | 
|     if familyID != 0:  | 
|         GameWorld.GetPlayerManager().FamilyNotifyCode(familyID, pack.GetMsg(), notifyCodeList)  | 
|         return  | 
|       | 
|     #È«·þ¹ã²¥  | 
|     if pack.GetLineID() <= 0:  | 
|         GameWorld.GetPlayerManager().CountryNotifyCode(pack.GetCountry(), pack.GetMsg(), notifyCodeList)  | 
|         return  | 
|       | 
|     #·ÖÁ÷¹ã²¥ IPY_PlayerManager::LineNotifyCode(int LineNo, char * code, IPY_NotifyCodeList * nofityCode) // ·ÖÁ÷֪ͨ½Ó¿Ú  | 
|     GameWorld.GetPlayerManager().LineNotifyCode(pack.GetRouteIndex(), pack.GetMsg(), notifyCodeList)  | 
|     return  | 
|   | 
|   | 
|   | 
|   | 
|   | 
| #// A0 04 ²éѯ¸±±¾¹¦ÄÜÏß·ÈËÊý #tagCGGetFBLinePlayerCnt  | 
| #  | 
| #struct    tagCGGetFBLinePlayerCnt  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        MapID;  | 
| #    BYTE        FBLineID;  | 
| #    BYTE        IsAllLine;  | 
| #};  | 
| def ClinetQueryFBLinePlayerCnt(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     queryMapID = clientData.MapID  | 
|     fbLineID = clientData.FBLineID  | 
|     isAllLine = clientData.IsAllLine  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|       | 
|     sendCMD = str([queryMapID, fbLineID, isAllLine])  | 
|     playerManager.MapServer_QueryPlayer(curPlayer.GetPlayerID(), 0, 0, queryMapID,  | 
|                 'FBLinePlayerCnt', sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())  | 
|     return  | 
|   | 
| def QueryFBLinePlayerCntResult(curPlayer, resultInfo):  | 
|     if not curPlayer:  | 
|         return  | 
|     if not resultInfo:  | 
|         return  | 
|     if len(resultInfo) != 2:  | 
|         return  | 
|     tagMapID, fbLinePlayerCntDict = resultInfo  | 
|     fblinePack = ChPyNetSendPack.tagGCFBLinePlayerCnt()  | 
|     fblinePack.MapID = tagMapID  | 
|     fblinePack.FBLineInfoList = []  | 
|     for lineID, playerCnt in fbLinePlayerCntDict.items():  | 
|         mapLineState = ChPyNetSendPack.tagGCFBLineInfo()  | 
|         mapLineState.Clear()  | 
|         mapLineState.FBLineID = lineID  | 
|         mapLineState.PlayerCnt = playerCnt  | 
|         fblinePack.FBLineInfoList.append(mapLineState)  | 
|       | 
|     fblinePack.Count = len(fblinePack.FBLineInfoList)  | 
|     NetPackCommon.SendFakePack(curPlayer, fblinePack)  | 
|     return  | 
|   | 
| #// A0 03 ²éѯµØÍ¼Ïß·״̬ #tagPyGetLineState  | 
| #  | 
| #struct    tagPyGetLineState  | 
| #{  | 
| #    tagHead        Head;  | 
| #    DWORD        MapID;  | 
| #};  | 
| def ClientQueryLineState(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     queryMapID = clientData.MapID # Òª²éѯµÄµØÍ¼£¬0Ϊ²éÈ«²¿  | 
|       | 
|     mapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 1)  | 
|     mapPlayerDict = {}  | 
|     mapServerStateManager = GameWorld.GetGameWorld().GetMapServerStateManager()  | 
|     GetZoneServerCnt = mapServerStateManager.GetZoneServerCnt()  | 
|     for zoneIndex in xrange(GetZoneServerCnt):  | 
|         ZoneServerState = mapServerStateManager.GetZoneServerByIndex(zoneIndex)  | 
|         mapCnt = ZoneServerState.GetMapCount()  | 
|         for i in xrange(mapCnt):  | 
|             MapServerState = ZoneServerState.GetMapServerStateByIndex(i)  | 
|             mapID = MapServerState.GetMapID()  | 
|             if queryMapID > 0 and mapID != queryMapID:  | 
|                 continue  | 
|             lineCnt = MapServerState.GetLineCount()  | 
|             if mapID in mapLineDict:  | 
|                 lineCnt = min(lineCnt, mapLineDict[mapID])  | 
|             curPlayerCntList, maxPlayerCntList = mapPlayerDict.get(mapID, [[], []])  | 
|             for lineIndex in xrange(lineCnt):  | 
|                 MapServerLineState = MapServerState.GetLineByIndex(lineIndex)  | 
|                 #GetMapID = MapServerLineState.GetMapID()  | 
|                 #lineID = MapServerLineState.GetLineID()  | 
|                 curPlayerCnt = MapServerLineState.GetCurPlayerCnt()  | 
|                 maxPlayerCnt = MapServerLineState.GetMaxPlayerCnt()  | 
|                   | 
|                 curPlayerCntList.append(curPlayerCnt)  | 
|                 maxPlayerCntList.append(maxPlayerCnt)  | 
|                   | 
|             mapPlayerDict[mapID] = [curPlayerCntList, maxPlayerCntList]  | 
|             if queryMapID > 0:  | 
|                 break  | 
|       | 
|     # A0 06 ·þÎñÆ÷µØÍ¼Ïß·ÈËÊý״̬ #tagGCPyServerMapState  | 
|     mapStatePack = ChPyNetSendPack.tagGCPyServerMapState()  | 
|     mapStatePack.Clear()  | 
|     mapStatePack.MapStateList = []  | 
|     for mapID, playerCntList in mapPlayerDict.items():  | 
|         mapLineState = ChPyNetSendPack.tagGCPyServerMapLineState()  | 
|         mapLineState.Clear()  | 
|         mapLineState.MapID = mapID  | 
|         mapLineState.LineCurPlayerCntList = playerCntList[0]  | 
|         mapLineState.LineMaxPlayerCntList = playerCntList[1]  | 
|         mapLineState.LineCnt = len(mapLineState.LineCurPlayerCntList)  | 
|         mapStatePack.MapStateList.append(mapLineState)  | 
|     mapStatePack.MapCount = len(mapStatePack.MapStateList)  | 
|     NetPackCommon.SendFakePack(curPlayer, mapStatePack)  | 
|     return  | 
|   | 
| ## µØÍ¼·þÎñÆ÷ÇëÇóÍæ¼ÒÏß·״̬  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def MapServer_GetLineState(index, tick):  | 
| #    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
| #    #curPlayer.Sync_LineState()  | 
| #      | 
| #    mapPlayerDict = {}  | 
| #    mapServerStateManager = GameWorld.GetGameWorld().GetMapServerStateManager()  | 
| #    GetZoneServerCnt = mapServerStateManager.GetZoneServerCnt()  | 
| #    for zoneIndex in xrange(GetZoneServerCnt):  | 
| #        ZoneServerState = mapServerStateManager.GetZoneServerByIndex(zoneIndex)  | 
| #        mapCnt = ZoneServerState.GetMapCount()  | 
| #        for i in xrange(mapCnt):  | 
| #            MapServerState = ZoneServerState.GetMapServerStateByIndex(i)  | 
| #            mapID = MapServerState.GetMapID()  | 
| #            lineCnt = MapServerState.GetLineCount()  | 
| #            curPlayerCntList, maxPlayerCntList = mapPlayerDict.get(mapID, [[], []])  | 
| #            for lineIndex in xrange(lineCnt):  | 
| #                MapServerLineState = MapServerState.GetLineByIndex(lineIndex)  | 
| #                #GetMapID = MapServerLineState.GetMapID()  | 
| #                #lineID = MapServerLineState.GetLineID()  | 
| #                curPlayerCnt = MapServerLineState.GetCurPlayerCnt()  | 
| #                maxPlayerCnt = MapServerLineState.GetMaxPlayerCnt()  | 
| #                  | 
| #                curPlayerCntList.append(curPlayerCnt)  | 
| #                maxPlayerCntList.append(maxPlayerCnt)  | 
| #                  | 
| #            mapPlayerDict[mapID] = [curPlayerCntList, maxPlayerCntList]  | 
| #      | 
| #    # A0 06 ·þÎñÆ÷µØÍ¼Ïß·ÈËÊý״̬ #tagGCPyServerMapState  | 
| #    mapStatePack = ChPyNetSendPack.tagGCPyServerMapState()  | 
| #    mapStatePack.Clear()  | 
| #    mapStatePack.MapStateList = []  | 
| #    for mapID, playerCntList in mapPlayerDict.items():  | 
| #        mapLineState = ChPyNetSendPack.tagGCPyServerMapLineState()  | 
| #        mapLineState.Clear()  | 
| #        mapLineState.MapID = mapID  | 
| #        mapLineState.LineCurPlayerCntList = playerCntList[0]  | 
| #        mapLineState.LineMaxPlayerCntList = playerCntList[1]  | 
| #        mapLineState.LineCnt = len(mapLineState.LineCurPlayerCntList)  | 
| #        mapStatePack.MapStateList.append(mapLineState)  | 
| #    mapStatePack.MapCount = len(mapStatePack.MapStateList)  | 
| #    NetPackCommon.SendFakePack(curPlayer, mapStatePack)  | 
|     return  | 
|   | 
| ## ²é¿´FBÏÔʾ½çÃæ  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def ShowFbEvent(index, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     if tick - curPlayer.GetDictByKey("ShowFbEvent") < ChConfig.Def_Show_Fb_Event_Tick:  | 
|         return  | 
|       | 
|     curPlayer.Sync_GameFbEvent()  | 
|     curPlayer.SetDict("ShowFbEvent", tick)  | 
| #---------------------------------------------------------------------  | 
| #===============================================================================  | 
| # //03 24 ¾Ù±¨#tagCImpeach  | 
| # tagCImpeach       *   GettagCImpeach();  | 
| #   | 
| # class   IPY_CImpeach  | 
| # {  | 
| # public:  | 
| #   | 
| #    int      GetPlayerID();  | 
| #   | 
| #    int      GetMsgLen();  | 
| #    //size = MsgLen  | 
| #    char *      GetMsg();  | 
| #   | 
| #    int      GetTalkLen();  | 
| #    //size = TalkLen  | 
| #    char *      GetTalk();  | 
| # };  | 
| #===============================================================================  | 
| ## ¾Ù±¨Íæ¼Ò  | 
| #  @param index Íæ¼ÒË÷Òý   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def Impeach(index , tick):  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     curPlayer = playerManager.GetPlayerByIndex(index)  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|       | 
|     if tick - gameWorld.GetTickByType(ChConfig.TYPE_ImpeachTick) < ChConfig.TYPE_Tick_Time[ChConfig.TYPE_ImpeachTick]:  | 
|         #Speech_Lost_Frequently ¶Ô²»Æð£¬ÄúµÄ¾Ù±¨²Ù×÷¹ýÓÚÆµ·±£¬ÇëÉÔºóÖØÊÔ  | 
|         PlayerControl.NotifyCode(curPlayer, "Speech_Lost_Frequently")  | 
|         return  | 
|       | 
|     gameWorld.SetTickByType(ChConfig.TYPE_ImpeachTick , tick)  | 
|       | 
|     pack = IPY_GameServer.IPY_CImpeach()  | 
|     tagPlayer = playerManager.FindPlayerByID(pack.GetPlayerID())  | 
|       | 
|     if not tagPlayer:  | 
|         #Speech_Lost_NoLine ¶Ô²»Æð£¬Äú¾Ù±¨µÄÍæ¼Ò²»ÔÚÏߣ¬ÇëÉÔºóÖØÊÔ  | 
|         PlayerControl.NotifyCode(curPlayer, "Speech_Lost_NoLine")  | 
|         return  | 
|       | 
|     curPlayer.ImpeachPlayer(tagPlayer, str(pack.GetTalk()))  | 
|     #Speech_Success ×¢Ò⣺ÄúµÄ¾Ù±¨²Ù×÷ÒѾ³É¹¦  | 
|     PlayerControl.NotifyCode(curPlayer, "Speech_Success")  | 
|     return  | 
| #---------------------------------------------------------------------  | 
|   | 
| ## Í¬²½Ê±¼ä  | 
| #  @param index Íæ¼ÒʵÀý  | 
| #  @param clientData ·â°ü½á¹¹Ìå  | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| def ClientRequestServerTime(index, clientData, tick):  | 
|     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  | 
|     Sync_PyServerDataTimeToClient(curPlayer, tick)  | 
|     return  | 
|   | 
|   | 
| ## Í¬²½Ê±¼ä  | 
| #  @param curPlayer   | 
| #  @param tick Ê±¼ä´Á  | 
| #  @return None  | 
| def Sync_PyServerDataTimeToClient(curPlayer, tick):  | 
|   | 
|     if not GameWorld.RefurbishPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_SyncClientTick, tick):  | 
|         #¼ä¸ôδµ½  | 
|         return  | 
|       | 
|     # ·þÎñÆ÷ʱ¼ä  | 
|     serverTime = GameWorld.GetServerTime()  | 
|     if not serverTime:  | 
|         return  | 
|       | 
|     serverDateTime = ChPyNetSendPack.tagServerDateTime()  | 
|     serverDateTime.Clear()  | 
|     serverDateTime.Year = serverTime.year  | 
|     serverDateTime.Month = serverTime.month  | 
|     serverDateTime.Day = serverTime.day  | 
|     serverDateTime.Hour = serverTime.hour  | 
|     serverDateTime.Minute = serverTime.minute  | 
|     serverDateTime.Second = serverTime.second  | 
|     serverDateTime.MicSecond = serverTime.microsecond     | 
|       | 
|     # Í¨Öª¿Í»§¶Ëͬ²½Ê±¼ä  | 
|     NetPackCommon.SendFakePack(curPlayer, serverDateTime)  | 
|     return  | 
|   | 
|       | 
|      |