# -*- coding: utf-8 -*- """ mir_map.py —— Mir2 .map 地图解析 + A* 寻路(供 bot 使用)。 格式(与文件尺寸互证): 52B头 + w*h*12B/格 头: u16 w, u16 h, 12B "Legend of mir..", 其余保留 每格 12B: u16 bk, u16 mid, u16 fr, u16 doorIdx, u16 doorOff, u16 aniFrame/aniTick/light 可走判定(Mir2 惯例, 与 C++ mapData2D::isObstacle 对应): (bk & 0x8000) or (mid != 0) → 障碍 [fr 高位为可站立掩码] doorIdx&0x8000 → 门/传送点 """ import heapq import struct import os MAP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "996传奇盒子资源包", "03-游戏客户端", "jycq_206923", "scene", "map") class MirMap: def __init__(self, path): raw = open(path, "rb").read() self.w, self.h = struct.unpack_from("