#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
  
 | 
##@package GMTool_ForbidTalk  
 | 
# Êý¾Ý¿âGMÃüÁîÖ´ÐÐ->ÕʺŽûÑÔ  
 | 
#  
 | 
# @author wdb  
 | 
# @date 2012-06-14   
 | 
# @version 1.3  
 | 
#  
 | 
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  
 | 
# @change: "2012-07-12 18:00" wdb ×Ö·ûת»»ÔÚÈë¿Ú´¦Àí  
 | 
# @change: "2012-08-10 15:00" zhangxi ÐÞ¸ÄOSS¼Ç¼  
 | 
# @change: "2014-09-05 16:30" hxp Ôö¼Ó¿ÉÉèÖýûÑÔʱ³¤  
 | 
# @note  
 | 
# Ä£¿éÏêϸ˵  
 | 
#½Å±¾ËµÃ÷  
 | 
#---------------------------------------------------------------------  
 | 
#µ¼Èë  
 | 
import IPY_GameServer  
 | 
import GMCommon  
 | 
import ChConfig  
 | 
import GameWorld  
 | 
import DataRecordPack  
 | 
#---------------------------------------------------------------------  
 | 
#È«¾Ö±äÁ¿  
 | 
#---------------------------------------------------------------------  
 | 
VER = "2014-09-05 16:30"   
 | 
#---------------------------------------------------------------------  
 | 
#Â߼ʵÏÖ(ÕâÀïcurPlayer = None)  
 | 
## Ö´ÐÐÂß¼  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò  
 | 
#  @param gmList [cmdIndex,gmAccID,forbidAcc,lastTime]  
 | 
#  @return None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def OnExec(orderId, gmCmdDict):  
 | 
    GameWorld.DebugLog("GMTool_ForbidTalk OnExec gmCmdDict=%s" % str(gmCmdDict))  
 | 
    # »ñµÃ²¢×ª»»×Ö·û´®  
 | 
    playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')  
 | 
    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')  
 | 
      
 | 
    forbitHour = gmCmdDict.get("forbitHour", '')  
 | 
    forbitMinute = gmCmdDict.get("forbitMinute", '')  
 | 
      
 | 
    if not forbitHour or not forbitHour.isdigit() or not forbitMinute or not forbitMinute.isdigit():  
 | 
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  
 | 
        return  
 | 
      
 | 
    forbitHour = GameWorld.ToIntDef(forbitHour, 0)  
 | 
    forbitMinute = GameWorld.ToIntDef(forbitMinute, 0)  
 | 
      
 | 
    if forbitHour <= 0 and forbitMinute <= 0:  
 | 
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  
 | 
        return  
 | 
      
 | 
    forbitTotalMinute = forbitHour * 60 + forbitMinute # ½ûÑÔʱ³¤  
 | 
      
 | 
    playerFind = ''  
 | 
    # Õ˺ŽûÑÔ  
 | 
    if playerAccID != '':  
 | 
        queryType = ChConfig.queryType_sqtPlayerByAccID  
 | 
        playerFind = playerAccID  
 | 
    # Ãû×Ö½ûÑÔ  
 | 
    elif playerName != '':  
 | 
        playerFind = playerName  
 | 
        queryType = ChConfig.queryType_sqtPlayerByName  
 | 
    # Í¨Öªmap  
 | 
    if playerFind != "":  
 | 
        GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind,  
 | 
                                         gmCmdDict, 'GMTForbidTalk', [forbitTotalMinute])  
 | 
  
 | 
        return  
 | 
      
 | 
    forbidAccIP = gmCmdDict.get(GMCommon.Def_GMKey_IP, '')  
 | 
    if forbidAccIP == "":  
 | 
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  
 | 
        return  
 | 
      
 | 
    #²Ù×÷·û  
 | 
    gmOper = IPY_GameServer.gmForbidTalk  
 | 
    ipManager = GameWorld.GetGameWorld().GetAllDBIPManage()  
 | 
    #ÒѾ´æÔÚ´ËIP,²»Öظ´Ìí¼Ó  
 | 
    if ipManager.FindIPManage(forbidAccIP, gmOper):  
 | 
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed)  
 | 
        return  
 | 
      
 | 
    addIP = ipManager.AddIP()  
 | 
    addIP.SetIP(forbidAccIP)  
 | 
    addIP.SetOper(gmOper)  
 | 
      
 | 
    #¹ã²¥ËùÓеØÍ¼ , Èç¹ûÍæ¼ÒÔÚÏßÖ´Ðд˲Ù×÷  
 | 
    playerManager = GameWorld.GetPlayerManager()  
 | 
  
 | 
    for index in range(playerManager.GetPlayerCount()):  
 | 
        curPlayer = playerManager.GetPlayerByIndex(index)  
 | 
        if not curPlayer.GetID():  
 | 
            continue  
 | 
          
 | 
        if curPlayer.GetIP() != forbidAccIP:  
 | 
            continue  
 | 
  
 | 
        GMCommon.GMTool_MapServer_Query(ChConfig.queryType_sqtPlayerByAccID, orderId, curPlayer.GetAccID(),   
 | 
                                        gmCmdDict, 'GMTForbidTalk', [forbitTotalMinute], False)  
 | 
          
 | 
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success)  
 | 
    #¼Ç¼Á÷Ïò  
 | 
    DataRecordPack.DR_ToolGMOperate(0, '', '', gmCmdDict.get(GMCommon.Def_GMKey_Type, forbidAccIP))  
 | 
    return  
 | 
  
 | 
  
 | 
  
 |