#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
  
 | 
##@package GMT_LockIP  
 | 
# Êý¾Ý¿âGMÃüÁîÖ´ÐÐ->IPËø¶¨  
 | 
#  
 | 
# @author whx  
 | 
# @date 2012-08-10 17:00   
 | 
# @version 1.0  
 | 
#  
 | 
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  
 | 
# @note  
 | 
# Ä£¿éÏêϸ˵  
 | 
#½Å±¾ËµÃ÷  
 | 
#---------------------------------------------------------------------  
 | 
#µ¼Èë  
 | 
import IPY_GameServer  
 | 
import GMCommon  
 | 
import ChConfig  
 | 
import GameWorld  
 | 
import DataRecordPack  
 | 
#---------------------------------------------------------------------  
 | 
#È«¾Ö±äÁ¿  
 | 
#---------------------------------------------------------------------  
 | 
VER = "2012-08-10 17:00"   
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ(ÕâÀïcurPlayer = None)  
 | 
## Ö´ÐÐÂß¼  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param gmList [cmdIndex,gmAccID,forbidAcc,lastTime]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(orderId, gmCmdDict):  
 | 
    # »ñµÃ²¢×ª»»×Ö·û´®  
 | 
    lockIP = gmCmdDict.get(GMCommon.Def_GMKey_IP, '')  
 | 
      
 | 
    #²Ù×÷·û  
 | 
    gmOper = IPY_GameServer.gmForbidAcc  
 | 
    ipManager = GameWorld.GetGameWorld().GetAllDBIPManage()  
 | 
    #ÒѾ´æÔÚ´ËIP,²»Öظ´Ìí¼Ó  
 | 
    if ipManager.FindIPManage(lockIP, gmOper):  
 | 
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed)  
 | 
        return  
 | 
      
 | 
    addIP = ipManager.AddIP()  
 | 
    addIP.SetIP(lockIP)  
 | 
    addIP.SetOper(gmOper)  
 | 
      
 | 
    #¹ã²¥ËùÓеØÍ¼ , Èç¹ûÍæ¼ÒÔÚÏßÖ´Ðд˲Ù×÷  
 | 
    playerManager = GameWorld.GetPlayerManager()  
 | 
      
 | 
    for index in range(playerManager.GetPlayerCount()):  
 | 
        curPlayer = playerManager.GetPlayerByIndex(index)  
 | 
        if not curPlayer.GetID():  
 | 
            continue  
 | 
          
 | 
        if curPlayer.GetIP() != lockIP:  
 | 
            continue  
 | 
          
 | 
        curPlayer.Kick(IPY_GameServer.disGMKick)  
 | 
          
 | 
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success)  
 | 
    #¼Ç¼Á÷Ïò  
 | 
    DataRecordPack.DR_ToolGMOperate(0, '', '', gmCmdDict.get(GMCommon.Def_GMKey_Type, lockIP))  
 | 
    return  
 | 
  
 | 
  
 |