Commit f043cffc1b33a8820bd6410696222f1df4540e19
Merge branch 'cn/develop' into cn/publish/preview
# Conflicts: # src/csvdata
Showing
3 changed files
with
22 additions
and
1 deletions
Show diff stats
src/actions/GmAction.lua
| @@ -182,6 +182,9 @@ function _M.fb(role, pms) -- 直接通关 | @@ -182,6 +182,9 @@ function _M.fb(role, pms) -- 直接通关 | ||
| 182 | local addPre | 182 | local addPre |
| 183 | addPre = function(carbonId) | 183 | addPre = function(carbonId) |
| 184 | local carbonData = csvdb["idle_battleCsv"][carbonId] | 184 | local carbonData = csvdb["idle_battleCsv"][carbonId] |
| 185 | + if carbonData.story_unlock ~= 0 then | ||
| 186 | + role:changeUpdates({{type = "storyB", field = carbonData.story_unlock, value = {s = -1}}}) | ||
| 187 | + end | ||
| 185 | for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do | 188 | for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do |
| 186 | role:hangFinish(pre) | 189 | role:hangFinish(pre) |
| 187 | role:checkTaskEnter("HangPass", {id = pre}) | 190 | role:checkTaskEnter("HangPass", {id = pre}) |
| @@ -205,6 +208,9 @@ function _M.fbc(role, pms) -- 直接通关 | @@ -205,6 +208,9 @@ function _M.fbc(role, pms) -- 直接通关 | ||
| 205 | local addPre | 208 | local addPre |
| 206 | addPre = function(carbonId) | 209 | addPre = function(carbonId) |
| 207 | local carbonData = csvdb["idle_battleCsv"][carbonId] | 210 | local carbonData = csvdb["idle_battleCsv"][carbonId] |
| 211 | + if carbonData.story_unlock ~= 0 then | ||
| 212 | + role:changeUpdates({{type = "storyB", field = carbonData.story_unlock, value = {s = -1}}}) | ||
| 213 | + end | ||
| 208 | for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do | 214 | for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do |
| 209 | role:hangFinish(pre) | 215 | role:hangFinish(pre) |
| 210 | role:checkTaskEnter("HangPass", {id = pre}) | 216 | role:checkTaskEnter("HangPass", {id = pre}) |
src/services/dbseed.lua
| @@ -241,6 +241,20 @@ local function loadAllUserInfo() | @@ -241,6 +241,20 @@ local function loadAllUserInfo() | ||
| 241 | end | 241 | end |
| 242 | end | 242 | end |
| 243 | 243 | ||
| 244 | +local function selectDb() | ||
| 245 | + local work_count = tonumber(skynet.getenv("thread")) | ||
| 246 | + for i = 1, work_count do | ||
| 247 | + local mysqld = skynet.localname(".mysql" .. i) | ||
| 248 | + | ||
| 249 | + local servId = skynet.getenv("servId") | ||
| 250 | + local ok, result = pcall(skynet.call, mysqld, "lua", "query", string.format("use server_%s", servId)) | ||
| 251 | + if not ok then | ||
| 252 | + skynet.error("select db error", "\n", debug.traceback(coroutine.running(), nil)) | ||
| 253 | + return | ||
| 254 | + end | ||
| 255 | + end | ||
| 256 | +end | ||
| 257 | + | ||
| 244 | skynet.start(function () | 258 | skynet.start(function () |
| 245 | --local new = redisproxy:hsetnx("autoincrement_set", "server_start", os.date("%Y%m%d", skynet.timex())) == 1 | 259 | --local new = redisproxy:hsetnx("autoincrement_set", "server_start", os.date("%Y%m%d", skynet.timex())) == 1 |
| 246 | --if not new then | 260 | --if not new then |
| @@ -259,5 +273,6 @@ skynet.start(function () | @@ -259,5 +273,6 @@ skynet.start(function () | ||
| 259 | initRedisDb() | 273 | initRedisDb() |
| 260 | initSeaportTask() -- 海港任务数据初始化 | 274 | initSeaportTask() -- 海港任务数据初始化 |
| 261 | loadAllUserInfo() | 275 | loadAllUserInfo() |
| 276 | + selectDb() | ||
| 262 | skynet.exit() | 277 | skynet.exit() |
| 263 | end) | 278 | end) |
| 264 | \ No newline at end of file | 279 | \ No newline at end of file |
src/services/mysqld.lua
| @@ -9,7 +9,7 @@ local command = {} | @@ -9,7 +9,7 @@ local command = {} | ||
| 9 | function command.open(conf) | 9 | function command.open(conf) |
| 10 | local function on_connect(db) | 10 | local function on_connect(db) |
| 11 | local servId = skynet.getenv("servId") | 11 | local servId = skynet.getenv("servId") |
| 12 | - db:query("set charset utf8mb4"); | 12 | + db:query("set names utf8mb4"); |
| 13 | db:query(string.format("use server_%s", servId)) | 13 | db:query(string.format("use server_%s", servId)) |
| 14 | end | 14 | end |
| 15 | local servId = skynet.getenv("servId") | 15 | local servId = skynet.getenv("servId") |