From 900edea7e693fd04bdbd2d66c684ae5f709cc7fb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 15 三月 2021 17:58:32 +0800
Subject: [PATCH] 8854 子 【主干】【BT2】【GM】【后端】后台实现封禁玩家设备ID号后,聊天禁言
---
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_UnForbidTalk.py | 11 ++++-
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_UnForbidTalk.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTUnForbidTalk.py | 4 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTForbidTalk.py | 5 ++
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMCommon.py | 3 +
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_ForbidTalk.py | 9 +++-
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerForbid.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGMOper.py | 4 +-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 49 ++++++++++++++++++------
ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetForbidInfo.py | 2
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_ForbidTalk.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 3 +
12 files changed, 71 insertions(+), 27 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_ForbidTalk.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_ForbidTalk.py
index 14ed859..0e28220 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_ForbidTalk.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_ForbidTalk.py
@@ -41,6 +41,7 @@
forbitHour = gmCmdDict.get("forbitHour", '')
forbitMinute = gmCmdDict.get("forbitMinute", '')
+ forbidDevice = gmCmdDict.get("forbidDevice", '')
if not forbitHour or not forbitHour.isdigit() or not forbitMinute or not forbitMinute.isdigit():
GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
@@ -67,7 +68,7 @@
# 通知map
if playerFind != "":
GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind,
- gmCmdDict, 'GMTForbidTalk', [forbitTotalMinute])
+ gmCmdDict, 'GMTForbidTalk', [forbitTotalMinute, forbidDevice])
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_UnForbidTalk.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_UnForbidTalk.py
index 36512e9..4670e72 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_UnForbidTalk.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_UnForbidTalk.py
@@ -40,6 +40,7 @@
# 获得并转换字符串
playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')
playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
+ unForbidDevice = gmCmdDict.get("unForbidDevice", '')
playerFind = ''
# 账号禁言
@@ -54,7 +55,7 @@
# 通过账号锁定
if playerFind != '':
GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind,
- gmCmdDict, 'GMTUnForbidTalk', [])
+ gmCmdDict, 'GMTUnForbidTalk', [unForbidDevice])
return
forbidAccIP = gmCmdDict.get(GMCommon.Def_GMKey_IP, '')
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 89ad1c1..ee6cd49 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -1596,7 +1596,8 @@
(
Def_PysForbidByPy,
Def_PysForbidTalk,
-) = range(4, 4 + 2)
+Def_PysForbidTalkDevice,
+) = range(4, 4 + 3)
#---玩家生产系统-------------------------------------------
#生产采集状态枚举值
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 48c9641..6fc4016 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -5982,17 +5982,41 @@
# 禁言 通知gameServer
def SetGMForbidenTalk(curPlayer, value):
- curPlayer.SetGMForbidenTalk(value)
- curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value)
- curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value, False)
+ ''' 设置是否禁言
+ @param value: 0-解禁;1-禁言;2-禁设备;3-解设备
+
+ 禁设备流程
+ 1.先设置2通知前端写入禁设备记录(前端处理当为2时本地设备标记为禁设备)
+ 2.再设置1,此时前后端状态均为1,即角色禁言
+
+ 解禁设备流程
+ 1.先设置3通知前端删除禁设备记录
+ 2.再设置0,此时前后端状态均为1,即角色解禁
+ '''
+ __SetGMForbidenTalkValue(curPlayer, value)
#同步设置离线DB玩家账号状态值
accState = curPlayer.GetAccState()
- if value:
+ if value == 2:
+ accState = accState | pow(2, ChConfig.Def_PysForbidTalkDevice)
accState = accState | pow(2, ChConfig.Def_PysForbidTalk)
+ elif value == 1:
+ accState = accState | pow(2, ChConfig.Def_PysForbidTalk)
+ elif value == 3:
+ if (accState & pow(2, ChConfig.Def_PysForbidTalkDevice)):
+ accState = accState ^ pow(2, ChConfig.Def_PysForbidTalkDevice)
+ if (accState & pow(2, ChConfig.Def_PysForbidTalk)):
+ accState = accState ^ pow(2, ChConfig.Def_PysForbidTalk)
elif (accState & pow(2, ChConfig.Def_PysForbidTalk)) > 0:
accState = accState ^ pow(2, ChConfig.Def_PysForbidTalk)
SetPlayerAccState(curPlayer, accState)
+ return
+
+def __SetGMForbidenTalkValue(curPlayer, value):
+ curPlayer.SetGMForbidenTalk(value)
+ curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value)
+ curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value, False)
+ GameWorld.DebugLog("__SetGMForbidenTalkValue %s" % value, curPlayer.GetPlayerID())
return
def SetPlayerAccState(curPlayer, accState):
@@ -6000,21 +6024,22 @@
curPlayer.SetExAttr17(accState) # 同步设置该值 0309 封包登录时需要用到
curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ExAttr17, accState)
curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ExAttr17, accState, False)
- GameWorld.DebugLog("SetPlayerAccState %s" % (accState))
+ GameWorld.DebugLog("SetPlayerAccState %s" % (accState), curPlayer.GetPlayerID())
return
def DoGMForbidenTalkOnLogin(curPlayer):
## 离线时被禁言,此时DB的账号状态值为禁言状态,但是GMOper暂时没有禁言操作命令,故上线时检查设置下离线禁言状态
## 目前离线时被禁言的,暂时只处理AccState ExAttr17, GMOper命令暂不处理,所以为永久禁言
- if not curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidTalk):
+ if curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidTalkDevice):
+ GameWorld.Log("上线时角色为被设备禁言状态!", curPlayer.GetPlayerID())
+ __SetGMForbidenTalkValue(curPlayer, 2)
+ __SetGMForbidenTalkValue(curPlayer, 1)
+ elif curPlayer.GetAccState() & pow(2, ChConfig.Def_PysForbidTalk):
+ GameWorld.Log("上线时角色为被禁言状态!", curPlayer.GetPlayerID())
+ __SetGMForbidenTalkValue(curPlayer, 1)
+ else:
curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, 0, False)
- return
- GameWorld.Log("上线时角色为被禁言状态!", curPlayer.GetPlayerID())
- value = 1
- curPlayer.SetGMForbidenTalk(value)
- curPlayer.SendGameServerRefreshState(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value)
- curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value, False)
return
## 协助目标玩家ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGMOper.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGMOper.py
index 13fc89f..cbb6081 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGMOper.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGMOper.py
@@ -181,7 +181,7 @@
# @remarks 函数详细说明.
def __Do_ForbidTalk(curPlayer):
if not curPlayer.GetGMForbidenTalk():
- PlayerControl.SetGMForbidenTalk(curPlayer, True)
+ PlayerControl.SetGMForbidenTalk(curPlayer, 1)
return
@@ -191,7 +191,7 @@
# @remarks 函数详细说明.
def __Cancel_ForbidTalk(curPlayer):
if curPlayer.GetGMForbidenTalk():
- PlayerControl.SetGMForbidenTalk(curPlayer, False)
+ PlayerControl.SetGMForbidenTalk(curPlayer, 0)
return
#---------------------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTForbidTalk.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTForbidTalk.py
index 60a2b86..50a59e8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTForbidTalk.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTForbidTalk.py
@@ -47,13 +47,16 @@
curFindPlayer_GMOper = curFindPlayer.GetGMOperManager()
gmOper = curFindPlayer_GMOper.AddGMOper(IPY_GameWorld.gmForbidTalk)
lastTime = int(packCMDList[0])
+ forbidDevice = packCMDList[1] if len(packCMDList) > 1 else ""
gmOper.SetGMAccID(curFindPlayer.GetAccID())
gmOper.SetLastTime(lastTime)
- GameWorld.DebugLog(" 解禁时间=%s" % str(gmOper.GetEndTime()))
+ GameWorld.DebugLog(" forbidDevice=%s,解禁时间=%s" % (forbidDevice, str(gmOper.GetEndTime())))
curFindPlayer_GMOper.Sync_SaveToDB()
+ if forbidDevice:
+ PlayerControl.SetGMForbidenTalk(curFindPlayer, 2)
PlayerControl.SetGMForbidenTalk(curFindPlayer, 1)
#PlayerControl.NotifyCode(curFindPlayer, "GeRen_chenxin_80731", [lastTime])
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTUnForbidTalk.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTUnForbidTalk.py
index ac2780e..c5b7d7e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTUnForbidTalk.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTUnForbidTalk.py
@@ -40,7 +40,7 @@
if not curFindPlayer or curFindPlayer.IsEmpty():
return ''
-
+ unForbidDevice = packCMDList[0] if len(packCMDList) > 0 else ""
curFindName = curFindPlayer.GetPlayerName()
#流向
DataRecordPack.DR_ToolGMOperate(query_ID, curFindName, curFindPlayer.GetAccID(), 'GMTUnForbidTalk')
@@ -54,6 +54,8 @@
curFindPlayer_GMOper.Sync_SaveToDB()
break
+ if unForbidDevice:
+ PlayerControl.SetGMForbidenTalk(curFindPlayer, 3)
PlayerControl.SetGMForbidenTalk(curFindPlayer, 0)
#PlayerControl.NotifyCode(curFindPlayer, "GeRen_liubo_97211")
return ''
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMCommon.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMCommon.py
index d37589e..cc591f3 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMCommon.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMCommon.py
@@ -89,7 +89,8 @@
(
Def_PysForbidByPy,
Def_PysForbidTalk,
-) = range(4, 4 + 2 )
+Def_PysForbidTalkDevice,
+) = range(4, 4 + 3)
Def_GMKey_Type = 'pack_type'
Def_GMKey_ResultType = 'ResultType'
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_ForbidTalk.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
index a22c99a..4a16f71 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_ForbidTalk.py
@@ -92,18 +92,23 @@
if not loadOK:
return GMCommon.Def_NoTag, ''
+ forbidDevice = gmCmdDict.get("forbidDevice", '')
+ forbidType = GMCommon.Def_PysForbidTalkDevice if forbidDevice else GMCommon.Def_PysForbidTalk
# 玩家账号已禁
- if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidTalk)) > 0:
+ if (dbPlayer.AccState & pow(2, forbidType)) > 0:
return GMCommon.Def_NoNeed, ''
# 设置玩家账号状态
- dbPlayer.AccState = dbPlayer.AccState|pow(2, GMCommon.Def_PysForbidTalk)
+ dbPlayer.AccState = dbPlayer.AccState|pow(2, forbidType)
+ if forbidType == GMCommon.Def_PysForbidTalkDevice:
+ dbPlayer.AccState = dbPlayer.AccState|pow(2, GMCommon.Def_PysForbidTalk)
dbPlayer.ExAttr17 = dbPlayer.AccState
dbPlayer.adoUpdateC(collection)
# 记录流向
dataDic = {"PlayerID":dbPlayer.PlayerID, 'AccID':playerAccID}
GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic)
+ mylog.info("GMT_ForbidTalk: playerAccID=%s,forbidType=%s,AccState=%s" % (playerAccID, forbidType, dbPlayer.AccState))
return GMCommon.Def_Success, ''
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetForbidInfo.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetForbidInfo.py
index c6341f0..098857b 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetForbidInfo.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetForbidInfo.py
@@ -96,7 +96,7 @@
accID = player.get('AccID', "")
forbidLoginList.append(accID)
- if (accState & pow(2, GMCommon.Def_PysForbidTalk)) > 0:
+ if (accState & pow(2, GMCommon.Def_PysForbidTalk)) > 0 or (accState & pow(2, GMCommon.Def_PysForbidTalkDevice)) > 0:
accID = player.get('AccID', "")
forbidTalkList.append(accID)
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerForbid.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerForbid.py
index 764d0c0..dbcceb18 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerForbid.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_GetPlayerForbid.py
@@ -90,7 +90,7 @@
accState = findPlayer[0].get('AccState', 0)
forbidInfo = {
'forbidLogin':(accState & pow(2, GMCommon.Def_PysForbidByPy)) > 0, #是否锁定
- 'forbidTalk': (accState & pow(2, GMCommon.Def_PysForbidTalk)) > 0, #是否禁言
+ 'forbidTalk': (accState & pow(2, GMCommon.Def_PysForbidTalk)) > 0 or (accState & pow(2, GMCommon.Def_PysForbidTalkDevice)) > 0, #是否禁言
}
return GMCommon.Def_Success, forbidInfo
diff --git a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_UnForbidTalk.py b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_UnForbidTalk.py
index 7315941..1e545a8 100644
--- a/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_UnForbidTalk.py
+++ b/ServerPython/db/PyMongoDataServer/GMToolLogicProcess/Commands/GMT_UnForbidTalk.py
@@ -94,18 +94,23 @@
if not loadOK:
return GMCommon.Def_NoTag, ''
+ unForbidDevice = gmCmdDict.get("unForbidDevice", '')
+ unForbidType = GMCommon.Def_PysForbidTalkDevice if unForbidDevice else GMCommon.Def_PysForbidTalk
# 玩家账号正常
- if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidTalk)) <= 0:
+ if (dbPlayer.AccState & pow(2, unForbidType)) <= 0:
return GMCommon.Def_NoNeed, ''
# 设置玩家账号状态
- dbPlayer.AccState = dbPlayer.AccState ^ pow(2, GMCommon.Def_PysForbidTalk)
+ dbPlayer.AccState = dbPlayer.AccState ^ pow(2, unForbidType)
+ if unForbidType == GMCommon.Def_PysForbidTalkDevice and (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidTalk)):
+ dbPlayer.AccState = dbPlayer.AccState ^ pow(2, GMCommon.Def_PysForbidTalk)
dbPlayer.ExAttr17 = dbPlayer.AccState
dbPlayer.adoUpdateC(collection)
-
+
# 记录流向
dataDic = {"PlayerID":dbPlayer.PlayerID, 'AccID':playerAccID}
GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic)
+ mylog.info("GMT_UnForbidTalk: playerAccID=%s,unForbidType=%s,AccState=%s" % (playerAccID, unForbidType, dbPlayer.AccState))
return GMCommon.Def_Success, ''
--
Gitblit v1.8.0