Commit b23cd820f983a5bf6e10db16dc0ee3e9b5400609
1 parent
fc306cca
查询角色
Showing
2 changed files
with
57 additions
and
15 deletions
Show diff stats
src/actions/HttpAction.lua
| @@ -147,6 +147,15 @@ function _M.gm_action(query) | @@ -147,6 +147,15 @@ function _M.gm_action(query) | ||
| 147 | return status | 147 | return status |
| 148 | end | 148 | end |
| 149 | 149 | ||
| 150 | +function _M.query_role(query) | ||
| 151 | + if not query.uid then return "not found" end | ||
| 152 | + local user = redisproxy:get(string.format("uid:%s", query.uid)) | ||
| 153 | + if not user then return "not found" end | ||
| 154 | + local roleId = redisproxy:get(string_format("user:%s", string.upper(user))) | ||
| 155 | + if not roleId then return "not found" end | ||
| 156 | + return json.encode({roleId, user}) | ||
| 157 | +end | ||
| 158 | + | ||
| 150 | function _M.broadcast(query) | 159 | function _M.broadcast(query) |
| 151 | local msg = {} | 160 | local msg = {} |
| 152 | local handle = { | 161 | local handle = { |
src/adv/Adv.lua
| @@ -1361,12 +1361,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1361,12 +1361,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 1361 | return not self:isHaveArtifact(artifactId) | 1361 | return not self:isHaveArtifact(artifactId) |
| 1362 | end, | 1362 | end, |
| 1363 | -- 11 = 地图上没有指定id 的怪 | 1363 | -- 11 = 地图上没有指定id 的怪 |
| 1364 | - [11] = function(_, monsterId) | ||
| 1365 | - for _, room in pairs(self:getCurMap().rooms) do | ||
| 1366 | - for _, block in pairs(room.blocks) do | ||
| 1367 | - if block:isMonster() then | 1364 | + [11] = function(_, monsterId, size) |
| 1365 | + if not size or size == 0 then | ||
| 1366 | + for _, room in pairs(self:getCurMap().rooms) do | ||
| 1367 | + for _, block in pairs(room.blocks) do | ||
| 1368 | + if block:isMonster() then | ||
| 1369 | + if not monsterId then return false end | ||
| 1370 | + if block.event.id == monsterId then | ||
| 1371 | + return false | ||
| 1372 | + end | ||
| 1373 | + end | ||
| 1374 | + end | ||
| 1375 | + end | ||
| 1376 | + else | ||
| 1377 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
| 1378 | + if cblock:isMonster() then | ||
| 1368 | if not monsterId then return false end | 1379 | if not monsterId then return false end |
| 1369 | - if block.event.id == monsterId then | 1380 | + if cblock.event.id == monsterId then |
| 1370 | return false | 1381 | return false |
| 1371 | end | 1382 | end |
| 1372 | end | 1383 | end |
| @@ -1375,12 +1386,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1375,12 +1386,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 1375 | return true | 1386 | return true |
| 1376 | end, | 1387 | end, |
| 1377 | -- 12 = 地图上没有指定id 的建筑 | 1388 | -- 12 = 地图上没有指定id 的建筑 |
| 1378 | - [12] = function(_, buildId) | ||
| 1379 | - for _, room in pairs(self:getCurMap().rooms) do | ||
| 1380 | - for _, block in pairs(room.blocks) do | ||
| 1381 | - if block:isBuild() then | 1389 | + [12] = function(_, buildId, size) |
| 1390 | + if not size or size == 0 then | ||
| 1391 | + for _, room in pairs(self:getCurMap().rooms) do | ||
| 1392 | + for _, block in pairs(room.blocks) do | ||
| 1393 | + if block:isBuild() then | ||
| 1394 | + if not buildId then return false end | ||
| 1395 | + if block.event.id == buildId then | ||
| 1396 | + return false | ||
| 1397 | + end | ||
| 1398 | + end | ||
| 1399 | + end | ||
| 1400 | + end | ||
| 1401 | + else | ||
| 1402 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
| 1403 | + if cblock:isBuild() then | ||
| 1382 | if not buildId then return false end | 1404 | if not buildId then return false end |
| 1383 | - if block.event.id == buildId then | 1405 | + if cblock.event.id == buildId then |
| 1384 | return false | 1406 | return false |
| 1385 | end | 1407 | end |
| 1386 | end | 1408 | end |
| @@ -1389,12 +1411,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | @@ -1389,12 +1411,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) | ||
| 1389 | return true | 1411 | return true |
| 1390 | end, | 1412 | end, |
| 1391 | -- 13 = 地图上没有指定的 选择点 | 1413 | -- 13 = 地图上没有指定的 选择点 |
| 1392 | - [13] = function(_, chooseId) | ||
| 1393 | - for _, room in pairs(self:getCurMap().rooms) do | ||
| 1394 | - for _, block in pairs(room.blocks) do | ||
| 1395 | - if block:isChoose() then | 1414 | + [13] = function(_, chooseId, size) |
| 1415 | + if not size or size == 0 then | ||
| 1416 | + for _, room in pairs(self:getCurMap().rooms) do | ||
| 1417 | + for _, block in pairs(room.blocks) do | ||
| 1418 | + if block:isChoose() then | ||
| 1419 | + if not chooseId then return false end | ||
| 1420 | + if block.event.id == chooseId then | ||
| 1421 | + return false | ||
| 1422 | + end | ||
| 1423 | + end | ||
| 1424 | + end | ||
| 1425 | + end | ||
| 1426 | + else | ||
| 1427 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | ||
| 1428 | + if cblock:isChoose() then | ||
| 1396 | if not chooseId then return false end | 1429 | if not chooseId then return false end |
| 1397 | - if block.event.id == chooseId then | 1430 | + if cblock.event.id == chooseId then |
| 1398 | return false | 1431 | return false |
| 1399 | end | 1432 | end |
| 1400 | end | 1433 | end |