hxp
2018-08-10 bf6eb250654cbb2b11284ef7642f7ca1f1826b20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/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