夜游神 发表于 2023-2-26 09:17:41

战神引擎Mir2明文全套lua源文件

local bigmap = {
    maps = {},
    group = {},
    scriptPath = {}
}

function bigmap:loadLike(map)
    self.maps = self.maps or {}
    local mapCache = cache.getBigmap(map)
    local likes = {}

    if mapCache and mapCache.likes then
      likes = mapCache.likes
    end

    if not self.maps.likes then
      self.maps.likes = likes
    end
end

function bigmap:isExistLike(map, x, y)
    if not map or map == "" then
      return
    end

    self:loadLike(map)

    for i, v in ipairs(self.maps.likes) do
      if v.x == x and v.y == y then
            return true
      end
    end
end

function bigmap:addLike(map, name, x, y)
    if not map or map == "" then
      return
    end

    self:loadLike(map)

    for i, v in ipairs(self.maps.likes) do
      if v.x == x and v.y == y then
            return
      end
    end

    self.maps.likes[#self.maps.likes + 1] = {
      name = name,
      x = x,
      y = y
    }

    cache.saveBigmap(map)
end

function bigmap:removeLike(map, x, y)
    if not map or map == "" then
      return
    end

    self:loadLike(map)

    for i, v in ipairs(self.maps.likes) do
      if v.x == x and v.y == y then
            table.remove(self.maps.likes, i)
            self:removeLike(map, x, y)
            cache.saveBigmap(map)
      end
    end
end

function bigmap:getLikes(map)
    self:loadLike(map)

    return self.maps.likes
end

function bigmap:loadNpcs(map)
    self.maps = self.maps or cache.getBigmap(map) or {}
    self.maps.npcs = self.maps.npcs or {}
end

function bigmap:addNpcs(msg, buf, bufLen)
    local title = g_data.client.npcMap.title
    self.maps = self.maps or {}
    self.maps.npcs = {}
    local npc = nil

    for i = 1, msg.tag do
      npc, buf, bufLen = net.record("TNpcDesc", buf, bufLen)
      npc.destMapid = g_data.client.npcMap.id
      self.maps.npcs<i> = npc
    end
end

function bigmap:getNpcs(map)
    if not self.maps then
      return nil
    else
      return self.maps.npcs
    end
end

function bigmap:getGroupInfo(msg, buf, bufLen)
    self.group = {}
    local mem = nil

    for i = 1, msg.param do
      mem, buf, bufLen = net.record("TGroupMemPosition", buf, bufLen)
      self.group[#self.group + 1] = mem
    end
end

function bigmap:scriptAutoPath(msg, buf, bufLen)
    self.scriptPath = {}
    local tmp = nil

    for i = 1, msg.recog do
      tmp, buf, bufLen = net.record("TMapPathNode", buf, bufLen)
      self.scriptPath[#self.scriptPath + 1] = tmp
    end
end

function bigmap:getScriptPath(mapid)
    if #self.scriptPath > 0 then
      local tmp = nil

      for i, v in ipairs(self.scriptPath) do
            if v.name == mapid then
                return v
            end
      end
    end
end

return bigmap</i>
**** Hidden Message *****

15211146281 发表于 2023-8-28 20:00:19

:(下载来看看ADS

616126447 发表于 2023-8-29 06:25:41

感谢分享

616126447 发表于 2023-8-30 07:51:36

支持楼主

616126447 发表于 2023-9-22 08:07:37

感谢楼主分享

stxinyun 发表于 2023-10-12 16:29:06

23421423大大撒地方 懂法守法多少度

seth9413 发表于 2023-11-2 14:20:43

支持楼主

楓哥哥 发表于 2023-11-5 23:09:57

66666666666666666666666

Chinese.Doll 发表于 2023-12-4 09:43:41

积分任务

vrvt 发表于 2024-1-11 13:30:33

感谢分享
页: [1] 2
查看完整版本: 战神引擎Mir2明文全套lua源文件