Commit 171abf99bcdf4ae34baeefcc756fcf1bb4f09b57
1 parent
62920af9
每日世界聊天上限
Showing
2 changed files
with
10 additions
and
0 deletions
Show diff stats
src/actions/RoleAction.lua
... | ... | @@ -1240,6 +1240,12 @@ function _M.chatRpc(agent, data) |
1240 | 1240 | return |
1241 | 1241 | end |
1242 | 1242 | |
1243 | + local dailyChatTimes = role.dailyData:getProperty("chatTimes") | |
1244 | + if dailyChatTimes > (globalCsv.chat_world_day_limit or 15) then | |
1245 | + result = 4 | |
1246 | + return | |
1247 | + end | |
1248 | + | |
1243 | 1249 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
1244 | 1250 | |
1245 | 1251 | if now < role._worldChatLimit.canSayt then |
... | ... | @@ -1268,6 +1274,8 @@ function _M.chatRpc(agent, data) |
1268 | 1274 | else |
1269 | 1275 | mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) |
1270 | 1276 | end |
1277 | + dailyChatTimes = dailyChatTimes + 1 | |
1278 | + role.dailyData:updateProperty({field="chatTimes", value=dailyChatTimes}) | |
1271 | 1279 | -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) |
1272 | 1280 | role:mylog("role_action", {desc = "chatWorld", text1 = content}) |
1273 | 1281 | end, | ... | ... |
src/models/Daily.lua