Skip to content

Commit d78bb18

Browse files
committed
feat: 禁止非满级角色使用查看角色属性功能
1 parent 9d8ca71 commit d78bb18

File tree

6 files changed

+44
-20
lines changed

6 files changed

+44
-20
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
return {
22
['[%s] wants to get your location, would you like to share?'] = '[%s] ϣ��ȡ���㵱ǰ���ڵ�ͼλ�ã����Ƿ�Ը�⹲����ǰλ����Ϣ��',
33
['Block'] = '������',
4-
['[%s] wants to see your detailed character info, OK?'] = '[%s] ��鿴������ϸ��ɫ������Ϣ���Ƿ��֪��',
4+
['[%s] wants to see your detailed character info, OK?'] = '[%s] ��鿴������ϸ��ɫ������Ϣ���Ƿ�������',
5+
['[%s] refused to share detailed character info with you.'] = '[%s] �ܾ�����������ϸ��ɫ������Ϣ��',
56
['[%s] want to see your info, OK?'] = '�ų� [%s] ��֪������װ�����ķ����Ƿ��֪��',
67
['I\'ve installed %s v%s'] = '���Ѱ�װ%s v%s��',
78
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
return {
22
['[%s] wants to get your location, would you like to share?'] = '[%s] 希望取得你當前所在地圖位置,你是否願意共享當前位置信息?',
33
['Block'] = '屏蔽他',
4-
['[%s] wants to see your detailed character info, OK?'] = '[%s] 想查看您的詳細角色屬性信息,是否告知?',
4+
['[%s] wants to see your detailed character info, OK?'] = '[%s] 想查看您的詳細角色屬性信息,是否允許?',
5+
['[%s] refused to share detailed character info with you.'] = '[%s] 拒絕向您共享詳細角色屬性信息。',
56
['[%s] want to see your info, OK?'] = '團長 [%s] 想知曉您的裝備、心法,是否告知?',
67
['I\'ve installed %s v%s'] = '我已安裝%s v%s。',
78
}

MY_!Base/src/BgMsgCenter.lua

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ X.RegisterBgMsg('CHAR_INFO', function(_, data, nChannel, dwTalkerID, szTalkerNam
110110
local bDebug = data[3] == 'DEBUG' and bAcquaintance
111111
local bConfirm = not bAcquaintance and not bDebug
112112
local function fnResolve()
113+
--[[#DEBUG BEGIN]]
114+
X.OutputDebugMessage(X.PACKET_INFO.NAME_SPACE, 'CHAR_INFO request from ' .. szTalkerName .. ' (' .. dwTalkerID .. ') accepted, sending info.', X.DEBUG_LEVEL.LOG)
115+
--[[#DEBUG END]]
113116
local aInfo = X.GetClientPlayerCharInfo()
114117
if not X.IsTeammate(dwTalkerID) and not bDebug then
115118
for _, v in ipairs(aInfo) do
@@ -121,32 +124,45 @@ X.RegisterBgMsg('CHAR_INFO', function(_, data, nChannel, dwTalkerID, szTalkerNam
121124
local function fnReject()
122125
X.SendBgMsg(nReplyChannel, 'CHAR_INFO', {'REFUSE', dwTalkerID}, true)
123126
end
127+
--[[#DEBUG BEGIN]]
128+
X.OutputDebugMessage(X.PACKET_INFO.NAME_SPACE, 'CHAR_INFO request from ' .. szTalkerName .. ' (' .. dwTalkerID .. '), ' .. (bConfirm and 'confirm' or 'no confirm') .. ' required', X.DEBUG_LEVEL.LOG)
129+
--[[#DEBUG END]]
124130
if not CHAR_INFO_BLOCK_LIST[dwTalkerID] and (not _G.MY_CharInfo or _G.MY_CharInfo.bEnable or bDebug) then
125131
if bConfirm then
126-
X.MessageBox('MY_CharInfo', {
127-
szMessage = _L('[%s] wants to see your detailed character info, OK?', szTalkerName),
128-
{
129-
szOption = g_tStrings.STR_ACCEPT,
130-
fnAction = fnResolve,
131-
}, {
132-
szOption = g_tStrings.STR_REFUSE,
133-
fnAction = fnReject,
134-
},
135-
{
136-
szOption = _L('Block'),
137-
bCheck = true,
138-
fnAction = function()
139-
fnReject()
140-
CHAR_INFO_BLOCK_LIST[dwTalkerID] = true
141-
end,
142-
}
143-
})
132+
X.PeekOtherPlayerByID(dwTalkerID, function (dwID, eState, kPlayer)
133+
if not kPlayer or kPlayer.nLevel ~= X.CONSTANT.MAX_PLAYER_LEVEL then
134+
--[[#DEBUG BEGIN]]
135+
X.OutputDebugMessage(X.PACKET_INFO.NAME_SPACE, 'CHAR_INFO request from ' .. szTalkerName .. ' (' .. dwTalkerID .. ') rejected due to not max level.', X.DEBUG_LEVEL.LOG)
136+
--[[#DEBUG END]]
137+
return
138+
end
139+
X.MessageBox('MY_CharInfo', {
140+
szMessage = _L('[%s] wants to see your detailed character info, OK?', szTalkerName),
141+
{
142+
szOption = g_tStrings.STR_ACCEPT,
143+
fnAction = fnResolve,
144+
}, {
145+
szOption = g_tStrings.STR_REFUSE,
146+
fnAction = fnReject,
147+
},
148+
{
149+
szOption = _L('Block'),
150+
bCheck = true,
151+
fnAction = function()
152+
fnReject()
153+
CHAR_INFO_BLOCK_LIST[dwTalkerID] = true
154+
end,
155+
}
156+
})
157+
end)
144158
else
145159
fnResolve()
146160
end
147161
else
148162
fnReject()
149163
end
164+
elseif data[1] == 'REFUSE' and data[2] == X.GetClientPlayerID() then
165+
X.OutputSystemAnnounceMessage(_L('[%s] refused to share detailed character info with you.', szTalkerName))
150166
end
151167
end
152168
end)

MY_TeamTools/lang/zhcn.jx3dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ return {
121121
['Asking...'] = '������ѯ�Է����\n�����ʱ��δ��Ӧ�����ǶԷ�û�а�װ�����',
122122
['Syncing: %.2f%%.'] = '����ͬ������(%.2f%%)...',
123123
['Refuse request'] = '�Է��ܾ�����������',
124+
['Only max level can use this feature.'] = 'ֻ��������ɫ����ʹ�øù��ܡ�',
124125
['Party limit'] = '����ͶԷ����',
125126

126127
-- MY_RoomRequest

MY_TeamTools/lang/zhtw.jx3dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ return {
121121
['Asking...'] = '正在徵詢對方意見\n如果長時間未響應可能是對方沒有安裝插件。',
122122
['Syncing: %.2f%%.'] = '正在同步數據(%.2f%%)...',
123123
['Refuse request'] = '對方拒絕了您的請求!',
124+
['Only max level can use this feature.'] = '只有滿級角色才能使用該功能。',
124125
['Party limit'] = '必須和對方組隊',
125126

126127
-- MY_RoomRequest

MY_TeamTools/src/MY_CharInfo.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ function D.ViewCharInfoToPlayer(dwID)
155155
if X.IsSafeLocked(SAFE_LOCK_EFFECT_TYPE.TALK) then
156156
return X.Alert('TALK_LOCK', _L['Please unlock talk lock first.'])
157157
end
158+
local cpi = X.GetClientPlayerInfo()
159+
if cpi and cpi.nLevel ~= X.CONSTANT.MAX_PLAYER_LEVEL then
160+
return X.Alert(_L['Only max level can use this feature.'])
161+
end
158162
local nChannel, szName
159163
if X.IsTeammate(dwID) then
160164
local team = GetClientTeam()

0 commit comments

Comments
 (0)