diff --git a/src/actions/HttpAction.lua b/src/actions/HttpAction.lua index eff3d01..15ba210 100644 --- a/src/actions/HttpAction.lua +++ b/src/actions/HttpAction.lua @@ -147,6 +147,15 @@ function _M.gm_action(query) return status end +function _M.query_role(query) + if not query.uid then return "not found" end + local user = redisproxy:get(string.format("uid:%s", query.uid)) + if not user then return "not found" end + local roleId = redisproxy:get(string_format("user:%s", string.upper(user))) + if not roleId then return "not found" end + return json.encode({roleId, user}) +end + function _M.broadcast(query) local msg = {} local handle = { diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index 60ab1fe..e3574cd 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -1361,12 +1361,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) return not self:isHaveArtifact(artifactId) end, -- 11 = 地图上没有指定id 的怪 - [11] = function(_, monsterId) - for _, room in pairs(self:getCurMap().rooms) do - for _, block in pairs(room.blocks) do - if block:isMonster() then + [11] = function(_, monsterId, size) + if not size or size == 0 then + for _, room in pairs(self:getCurMap().rooms) do + for _, block in pairs(room.blocks) do + if block:isMonster() then + if not monsterId then return false end + if block.event.id == monsterId then + return false + end + end + end + end + else + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do + if cblock:isMonster() then if not monsterId then return false end - if block.event.id == monsterId then + if cblock.event.id == monsterId then return false end end @@ -1375,12 +1386,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) return true end, -- 12 = 地图上没有指定id 的建筑 - [12] = function(_, buildId) - for _, room in pairs(self:getCurMap().rooms) do - for _, block in pairs(room.blocks) do - if block:isBuild() then + [12] = function(_, buildId, size) + if not size or size == 0 then + for _, room in pairs(self:getCurMap().rooms) do + for _, block in pairs(room.blocks) do + if block:isBuild() then + if not buildId then return false end + if block.event.id == buildId then + return false + end + end + end + end + else + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do + if cblock:isBuild() then if not buildId then return false end - if block.event.id == buildId then + if cblock.event.id == buildId then return false end end @@ -1389,12 +1411,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) return true end, -- 13 = 地图上没有指定的 选择点 - [13] = function(_, chooseId) - for _, room in pairs(self:getCurMap().rooms) do - for _, block in pairs(room.blocks) do - if block:isChoose() then + [13] = function(_, chooseId, size) + if not size or size == 0 then + for _, room in pairs(self:getCurMap().rooms) do + for _, block in pairs(room.blocks) do + if block:isChoose() then + if not chooseId then return false end + if block.event.id == chooseId then + return false + end + end + end + end + else + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do + if cblock:isChoose() then if not chooseId then return false end - if block.event.id == chooseId then + if cblock.event.id == chooseId then return false end end -- libgit2 0.21.2