战神引擎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 *****
:(下载来看看ADS 感谢分享 支持楼主 感谢楼主分享 23421423大大撒地方 懂法守法多少度 支持楼主 66666666666666666666666 积分任务 感谢分享
页:
[1]
2