hxp
2019-09-20 67bcc2ab06912fc3d9cf31ceae533da76e50d5ae
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
#!/usr/bin/python
# -*- coding: GBK -*-
 
##@package GMT_UnFobidTalk.py
# Êý¾Ý¿âGMÃüÁîÖ´ÐÐ->½â³ýÕʺŽûÑÔ
#
# @author wdb
# @date 2012-06-14
# @version 1.4
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
# @change: "2012-07-12 18:00" wdb ×Ö·ûת»»ÔÚÈë¿Ú´¦Àí
# @change: "2012-07-30 11:30" wdb GM»Ø¸´Ï¸»¯£¬´úÂëÓÅ»¯
# @change: "2012-08-10 15:00" zhangxi ÐÞ¸ÄOSS¼Ç¼
# @change: "2014-09-05 16:30" hxp ½â½ûͳһÓÃGMTUnForbidTalk
# @note
# Ä£¿éÏêϸ˵
#Êý¾Ý¿âGMÃüÁîÖ´ÐÐ->½â³ýÕʺŽûÑÔ
#---------------------------------------------------------------------
#µ¼Èë
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]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict):
    
    # »ñµÃ²¢×ª»»×Ö·û´®
    playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')
    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
    
    playerFind = ''
    # Õ˺ŽûÑÔ
    if playerAccID != '':
        queryType = ChConfig.queryType_sqtPlayerByAccID
        playerFind = playerAccID
    # Ãû×Ö½ûÑÔ
    elif playerName != '':
        playerFind = playerName
        queryType = ChConfig.queryType_sqtPlayerByName
        
    # Í¨¹ýÕ˺ÅËø¶¨
    if playerFind != '':
        GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind,
                                         gmCmdDict, 'GMTUnForbidTalk', [])
        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()
    
    curFindIP = ipManager.FindIPManage(forbidAccIP, gmOper)
    #²»´æÔڴ˲Ù×÷
    if not curFindIP:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed)
        return
    
    #¹ã²¥ËùÓеØÍ¼ , Èç¹ûÍæ¼ÒÔÚÏßÖ´Ðд˲Ù×÷
    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, 'GMTUnForbidTalk', [], False)
        
    #ɾ³ýÕâÌõ²Ù×÷
    result = ipManager.DeleteIPManage(forbidAccIP, gmOper)
 
    if result:
        #֪ͨ³É¹¦
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success)
    else:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_DeleteIPFail)
    
    #¼Ç¼Á÷Ïò
    DataRecordPack.DR_ToolGMOperate(0, '', '', gmCmdDict.get(GMCommon.Def_GMKey_Type, forbidAccIP))
    return