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,6 +1240,12 @@ function _M.chatRpc(agent, data) | ||
1240 | return | 1240 | return |
1241 | end | 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 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 | 1249 | role._worldChatLimit = role._worldChatLimit or {start = 0, count = 0, canSayt = 0} --第一次开始说话时间 从第一次说话次数 能说话的时间 |
1244 | 1250 | ||
1245 | if now < role._worldChatLimit.canSayt then | 1251 | if now < role._worldChatLimit.canSayt then |
@@ -1268,6 +1274,8 @@ function _M.chatRpc(agent, data) | @@ -1268,6 +1274,8 @@ function _M.chatRpc(agent, data) | ||
1268 | else | 1274 | else |
1269 | mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) | 1275 | mcast_util.pub_world(actionCodes.Role_chat, MsgPack.pack(response)) |
1270 | end | 1276 | end |
1277 | + dailyChatTimes = dailyChatTimes + 1 | ||
1278 | + role.dailyData:updateProperty({field="chatTimes", value=dailyChatTimes}) | ||
1271 | -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) | 1279 | -- pcall(skynet.send, '.globald', "lua", "sendWorldMsg", role._channelIdx, response) |
1272 | role:mylog("role_action", {desc = "chatWorld", text1 = content}) | 1280 | role:mylog("role_action", {desc = "chatWorld", text1 = content}) |
1273 | end, | 1281 | end, |
src/models/Daily.lua
@@ -36,6 +36,8 @@ Daily.schema = { | @@ -36,6 +36,8 @@ Daily.schema = { | ||
36 | 36 | ||
37 | treasureBase = {"number", 0}, -- 资源值 | 37 | treasureBase = {"number", 0}, -- 资源值 |
38 | treasureList = {"table", {}}, --挂机图鉴 | 38 | treasureList = {"table", {}}, --挂机图鉴 |
39 | + | ||
40 | + chatTimes = {"number", 0}, --每日发言次数 | ||
39 | } | 41 | } |
40 | 42 | ||
41 | function Daily:updateProperty(params) | 43 | function Daily:updateProperty(params) |