feat: align travel ring menus and validate destinations against 203 maps
This commit is contained in:
@@ -1,53 +1,55 @@
|
||||
# 移动戒指(203 服务端)
|
||||
# 移动传送戒指(对齐 AVA2 模式)
|
||||
|
||||
物品 70058 通过 special_item_group 10031 的 `sig_use` 触发 `ring_warp`。
|
||||
戒指不限等级、次数,不消耗物品,也没有自身冷却。传送仍遵守服务端的 `pc.can_warp()` 检查。
|
||||
百店老板娘的商城出售此物品(`../npc-shops/item-mall`,1 金币)。
|
||||
物品 70058 / 76042(以及 10031.sig_use) 通过 `ring_warp` 任务提供全服移动传送。
|
||||
对齐 AVA2 的 **11 个区域进阶分类** 与 **深层直达坐标**(如蜘蛛洞直达一、二层及通往三层的入口,流放洞窟直达二层及龙穴门前)。
|
||||
|
||||
2026-09-30 补齐 203 的 `newcibn/map/index` 全部 **65 张地图**,包括活动、战争和测试地图。
|
||||
目录及坐标来自实际服务器的 `index`、`Setting.txt`、`Town.txt`、`npc.txt`,保存在 `maps.json`。
|
||||
部分地图名称采用中文描述,目录名和地图编号用于唯一对应。
|
||||
## 功能特性
|
||||
|
||||
| 分类 | 数量 | 操作 |
|
||||
| --- | ---: | --- |
|
||||
| 各国村庄 | 6 | 传送至各国一村、二村 |
|
||||
| 野外地图 | 13 | 传送至地图出生点 |
|
||||
| 洞穴与副本 | 15 | 普通洞穴传送;受限副本传送至原有入口 |
|
||||
| 公会地图 | 6 | 公会领地及公会村庄 |
|
||||
| 活动与战争 | 20 | 列出地图及原有入场方式,保留报名、婚礼及战争流程 |
|
||||
| 测试地图 | 5 | 所有人可查看;仅 GM 可传送 |
|
||||
- **11 个区域进阶分类**:
|
||||
1. 各国主城(盛唐、秦皇、周武一村与二村共 6 处)
|
||||
2. 升龙谷(30-50级:谷中心、3 个练级区)
|
||||
3. 影悲沙漠(30-50级:沙漠中心、3 个绿洲区)
|
||||
4. 舒寒山(40-65级:雪山中心、2 个练级区)
|
||||
5. 导炎大地(40-65级:火地中心、2 个练级区)
|
||||
6. 蜘蛛洞穴(45-70级:一层入口、一层深处、二层入口、二层深处/三层入口)
|
||||
7. 鬼怪森林(65-75级:幽灵森林与红森林,含入口及各 2 处练级点)
|
||||
8. 巨人荒地(55-80级:巨人领地 1 区、蛇之领域 / 2 区)
|
||||
9. 流放洞窟(75-95级:75 级门槛;一层入口、一层深处、二层入口、二层深处/龙穴门前)
|
||||
10. 尤哈拉海角(90-105级:90 级门槛;龙头海角、迷雾森林、雷鸣山脉、黑沙海湾,各有中心及练级区)
|
||||
11. 附魔森林(105-120级:105 级门槛;附魔森林中心)
|
||||
- **即时直达**:点击地点后立即执行 `pc.warp(x, y)` 并调用 `setskin(NOWINDOW)` 关闭对话框,无需二次确认弹框。
|
||||
- **状态安全检查**:打开菜单和最终传送前均校验 `pc.can_warp()`,战斗、交易或其他锁定状态下提示并阻止传送。
|
||||
- **等级保护校验**:流放洞窟(75级)、海角(90级)、附魔森林(105级)校验 `pc.get_level()`,等级未达标时友好提示。
|
||||
- **触发入口兼顾**:同时支持 `10031.sig_use`、`70058.use`、`76042.use`。
|
||||
|
||||
每页最多 5 个地点,包含上一页、下一页、返回分类;选择传送后再确认。
|
||||
受限副本编号为 66、71、72、73、208、216、217、351。蜘蛛洞三层先经一层守卫进入二层;
|
||||
流放二层和蓝龙巢穴先经流放洞窟入口进入,戒指不绕过通行证、血石、组队及副本入场条件。
|
||||
活动地图只显示入场说明,避免进入尚未开放或未分配给玩家的场景。
|
||||
资源活动地图 101 的服务器 Town.txt 坐标在地图边界外,目录记录保留原值,未用于传送。
|
||||
## 文件说明
|
||||
|
||||
## 修改与验证
|
||||
- `maps.json`:AVA2 区域分类、深层坐标与等级限制配置。
|
||||
- `maps_classic_65.json`:备份的原 203 服务端 65 张全地图分类数据。
|
||||
- `generate.py`:从 `maps.json` 生成 `ring_warp.quest`,自动进行 GBK 无反斜杠安全校验。
|
||||
- `ring_warp.quest`:生成的服务端任务文件。
|
||||
- `tests/test_ring.py`:基于 Lua 5.0 源码构建沙盒,自动测试全部分类导航、深层坐标、等级门槛、战斗限制及关闭行为。
|
||||
- `install.sh`:服务器安装脚本(支持 `--quest-only` 热重载部署)。
|
||||
|
||||
修改 `maps.json` 后执行:
|
||||
## 修改与测试验证
|
||||
|
||||
```sh
|
||||
python3 tools/server/ring-warp/generate.py
|
||||
python3 tools/server/ring-warp/tests/test_ring.py SERVER_LIBLUA_DIRECTORY LIVE_MAP_INDEX
|
||||
python3 tools/server/ring-warp/tests/test_ring.py [SERVER_LIBLUA_DIRECTORY]
|
||||
```
|
||||
|
||||
测试使用 40250 服务端的 Lua 5.0 源码构建临时解释器,执行生成的真实任务函数。
|
||||
检查地图覆盖、坐标边界、GBK 编码、全部 65 个地点的选择,以及翻页、取消、传送限制和 GM 权限。
|
||||
可增加第三个参数 `COMPILED_OBJECT_ROOT`,直接验证服务器 qc 生成的两个任务对象。
|
||||
## 服务端安装部署
|
||||
|
||||
## 安装
|
||||
|
||||
从此目录在服务器执行:
|
||||
在服务器执行:
|
||||
|
||||
```sh
|
||||
sh install.sh --quest-only # 仅更新任务;每个 game core 重载任务或重启 game
|
||||
sh install.sh # 同时安装物品名、移除等级限制;首次安装需重启 db/game
|
||||
sh install.sh --quest-only # 仅更新任务;在游戏内管理员执行 /reload q 即可热重载生效,无需停服
|
||||
sh install.sh # 完整安装(含物品名称与等级限制调整)
|
||||
```
|
||||
|
||||
安装前备份任务源码、两个任务对象、物品表至 `/root/backup-ringwarp/<时间>`。
|
||||
先在隔离目录编译并检查结果,再替换 ring_warp 的两个对象;不会清空其他任务对象。
|
||||
`--quest-only` 不更改物品表或数据库,不需要重启 db/auth。
|
||||
任务转换成 GBK;拒绝包含反斜杠字节的编码,避免 qc 解析异常。
|
||||
## 2026-10-17 坐标核查
|
||||
|
||||
203 已于本次部署仅重启四个 game core,db/auth 保持运行。此次是服务端任务更新,已有客户端重登后即可使用。
|
||||
按 203 实际 map/index 和 Setting.txt 校验全部 49 个地点,而非只检查脚本内的坐标常量。
|
||||
修正迷雾森林与黑沙海湾的坐标互换;将升龙谷落入恶鬼塔重叠矩形的练级点移到谷内已登记出生点。
|
||||
流放洞窟一层、海角四图和附魔森林原先使用地图左上角边界,现改为服务端 Town.txt 登记的入口点。
|
||||
蜘蛛洞当前仅有一、二层及三层入口,不宣称已经直达三层 Boss。
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# coding: utf-8
|
||||
"""Generate the quest from the audited server map catalog (Python 3)."""
|
||||
"""Generate AVA2-style teleporter quest from maps.json (Python 3)."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
@@ -7,93 +7,94 @@ ROOT = Path(__file__).resolve().parent
|
||||
|
||||
def generate():
|
||||
catalog = json.loads((ROOT / 'maps.json').read_text(encoding='utf-8'))
|
||||
def quote(value):
|
||||
return json.dumps(value, ensure_ascii=False)
|
||||
lines = ['-- Generated by generate.py from maps.json. Do not edit by hand.',
|
||||
'-- UTF-8 source; install.sh compiles GBK for the 203 server.',
|
||||
'quest ring_warp begin', ' state start begin',
|
||||
' function destinations()', ' return {']
|
||||
for category in catalog['categories']:
|
||||
lines.append(' {name = %s, maps = {' % quote(category['name']))
|
||||
for m in category['maps']:
|
||||
lines.append(' {id = %d, name = %s, x = %d, y = %d, mode = %s, note = %s},' %
|
||||
(m['id'], quote(m['name']), m['target'][1], m['target'][2], quote(m['mode']), quote(m['note'])))
|
||||
lines.append(' }},')
|
||||
lines.extend([' }', ' end'])
|
||||
lines.append(''' when 10031.sig_use begin
|
||||
local categories = ring_warp.destinations()
|
||||
local category_options = {}
|
||||
for i = 1, table.getn(categories) do
|
||||
table.insert(category_options, categories[i].name)
|
||||
end
|
||||
table.insert(category_options, "关闭")
|
||||
while true do
|
||||
say_title("移动戒指")
|
||||
say("请选择地图分类:")
|
||||
local category = select_table(category_options)
|
||||
if category == table.getn(category_options) then return end
|
||||
local maps = categories[category].maps
|
||||
local page = 1
|
||||
local browsing = true
|
||||
while browsing do
|
||||
local first = (page - 1) * 5 + 1
|
||||
local last = math.min(first + 4, table.getn(maps))
|
||||
local options = {}
|
||||
for i = first, last do
|
||||
local label = maps[i].name
|
||||
if maps[i].mode == "entrance" then label = label .. "(入口)" end
|
||||
table.insert(options, label)
|
||||
end
|
||||
local count = table.getn(options)
|
||||
local previous = 0
|
||||
local following = 0
|
||||
if page > 1 then
|
||||
table.insert(options, "上一页")
|
||||
previous = table.getn(options)
|
||||
end
|
||||
if last < table.getn(maps) then
|
||||
table.insert(options, "下一页")
|
||||
following = table.getn(options)
|
||||
end
|
||||
table.insert(options, "返回分类")
|
||||
say_title(categories[category].name)
|
||||
say("第 " .. page .. " 页 / 共 " .. math.ceil(table.getn(maps) / 5) .. " 页")
|
||||
local choice = select_table(options)
|
||||
if choice == table.getn(options) then
|
||||
browsing = false
|
||||
elseif previous > 0 and choice == previous then
|
||||
page = page - 1
|
||||
elseif following > 0 and choice == following then
|
||||
page = page + 1
|
||||
elseif choice >= 1 and choice <= count then
|
||||
local destination = maps[first + choice - 1]
|
||||
say_title(destination.name)
|
||||
say("地图编号:" .. destination.id)
|
||||
if destination.mode == "gm" and not pc.is_gm() then
|
||||
say(destination.note)
|
||||
wait()
|
||||
elseif destination.mode == "event" then
|
||||
say(destination.note)
|
||||
wait()
|
||||
else
|
||||
if destination.mode == "entrance" then say(destination.note) end
|
||||
if destination.mode == "gm" then say("管理员专用测试地图。") end
|
||||
if select("传送", "返回列表") == 1 then
|
||||
if not pc.can_warp() then
|
||||
say("当前无法传送,请结束交易或其他操作后再试。")
|
||||
return
|
||||
end
|
||||
pc.warp(destination.x, destination.y)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end''')
|
||||
result = '\n'.join(lines) + '\n'
|
||||
def quote(s):
|
||||
return json.dumps(s, ensure_ascii=False)
|
||||
|
||||
lines = [
|
||||
'-- Generated by generate.py from maps.json. Do not edit by hand.',
|
||||
'-- UTF-8 source; install.sh compiles GBK for the 203 server.',
|
||||
'quest ring_warp begin',
|
||||
' state start begin',
|
||||
' function destinations()',
|
||||
' return {'
|
||||
]
|
||||
for c in catalog['categories']:
|
||||
lines.append(' {name = %s, ' % quote(c['name']))
|
||||
if 'min_level' in c:
|
||||
lines[-1] += 'min_level = %d, ' % c['min_level']
|
||||
if 'destinations' in c:
|
||||
lines.append(' destinations = {')
|
||||
for d in c['destinations']:
|
||||
lines.append(' {name = %s, x = %d, y = %d},' % (quote(d['name']), d['x'], d['y']))
|
||||
lines.append(' }},')
|
||||
elif 'subgroups' in c:
|
||||
lines.append(' subgroups = {')
|
||||
for sg in c['subgroups']:
|
||||
lines.append(' {name = %s, destinations = {' % quote(sg['name']))
|
||||
for d in sg['destinations']:
|
||||
lines.append(' {name = %s, x = %d, y = %d},' % (quote(d['name']), d['x'], d['y']))
|
||||
lines.append(' }},')
|
||||
lines.append(' }},')
|
||||
lines.extend([
|
||||
' }',
|
||||
' end',
|
||||
' when 10031.sig_use or 70058.use or 76042.use begin',
|
||||
' if not pc.can_warp() then',
|
||||
' say("当前状态无法传送,请结束交易、战斗或其他操作后再试。")',
|
||||
' return',
|
||||
' end',
|
||||
' local s = select('
|
||||
])
|
||||
cat_names = [quote(c['name']) for c in catalog['categories']] + [quote('关闭')]
|
||||
lines.append(' ' + ', '.join(cat_names))
|
||||
lines.append(' )')
|
||||
for idx, c in enumerate(catalog['categories'], 1):
|
||||
if_stmt = 'if' if idx == 1 else 'elseif'
|
||||
lines.append(' %s s == %d then' % (if_stmt, idx))
|
||||
if 'min_level' in c:
|
||||
lines.extend([
|
||||
' if pc.get_level() < %d then' % c['min_level'],
|
||||
' say("")',
|
||||
' say(%s)' % quote(c.get('level_message', '等级不足!')),
|
||||
' say("")',
|
||||
' else'
|
||||
])
|
||||
indent = ' '
|
||||
else:
|
||||
indent = ' '
|
||||
|
||||
var_name = 'sub_%d' % idx
|
||||
if 'destinations' in c:
|
||||
d_names = [quote(d['name']) for d in c['destinations']] + [quote('关闭')]
|
||||
lines.append(indent + 'local %s = select(%s)' % (var_name, ', '.join(d_names)))
|
||||
for d_idx, d in enumerate(c['destinations'], 1):
|
||||
sub_if = 'if' if d_idx == 1 else 'elseif'
|
||||
lines.append(indent + '%s %s == %d then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(%d, %d) setskin(NOWINDOW)' % (sub_if, var_name, d_idx, d['x'], d['y']))
|
||||
lines.append(indent + 'end')
|
||||
elif 'subgroups' in c:
|
||||
sg_names = [quote(sg['name']) for sg in c['subgroups']] + [quote('关闭')]
|
||||
lines.append(indent + 'local %s = select(%s)' % (var_name, ', '.join(sg_names)))
|
||||
for sg_idx, sg in enumerate(c['subgroups'], 1):
|
||||
sg_if = 'if' if sg_idx == 1 else 'elseif'
|
||||
lines.append(indent + '%s %s == %d then' % (sg_if, var_name, sg_idx))
|
||||
sub_var = 'sub_%d_%d' % (idx, sg_idx)
|
||||
d_names = [quote(d['name']) for d in sg['destinations']] + [quote('关闭')]
|
||||
lines.append(indent + ' local %s = select(%s)' % (sub_var, ', '.join(d_names)))
|
||||
for d_idx, d in enumerate(sg['destinations'], 1):
|
||||
d_if = 'if' if d_idx == 1 else 'elseif'
|
||||
lines.append(indent + ' %s %s == %d then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(%d, %d) setskin(NOWINDOW)' % (d_if, sub_var, d_idx, d['x'], d['y']))
|
||||
lines.append(indent + ' end')
|
||||
lines.append(indent + 'end')
|
||||
|
||||
if 'min_level' in c:
|
||||
lines.append(' end')
|
||||
lines.extend([
|
||||
' end',
|
||||
' end',
|
||||
' end',
|
||||
'end'
|
||||
])
|
||||
result = '\n'.join(line.rstrip() for line in lines) + '\n'
|
||||
encoded = result.encode('gbk')
|
||||
if b'\\' in encoded:
|
||||
bad = sorted({c for c in result if b'\\' in c.encode('gbk')})
|
||||
|
||||
@@ -24,17 +24,20 @@ echo "backup: $BACKUP"
|
||||
iconv -f UTF-8 -t GBK "$HERE/ring_warp.quest" > "$BACKUP/ring_warp.gbk"
|
||||
if grep -q '\\' "$BACKUP/ring_warp.gbk"; then echo "ring_warp.quest: backslash byte in GBK" >&2; exit 1; fi
|
||||
# Compile in isolation before touching any live quest objects.
|
||||
mkdir -p "$BACKUP/stage" "$BACKUP/object/state" "$BACKUP/object/10031/sig_use"
|
||||
cp -p "$QUEST/object/state/ring_warp" "$BACKUP/object/state/"
|
||||
cp -p "$QUEST/object/10031/sig_use/ring_warp.start" "$BACKUP/object/10031/sig_use/"
|
||||
mkdir -p "$BACKUP/stage" "$BACKUP/object/state" "$BACKUP/object/10031/sig_use" "$BACKUP/object/70058/use" "$BACKUP/object/76042/use"
|
||||
[ -f "$QUEST/object/state/ring_warp" ] && cp -p "$QUEST/object/state/ring_warp" "$BACKUP/object/state/"
|
||||
[ -f "$QUEST/object/10031/sig_use/ring_warp.start" ] && cp -p "$QUEST/object/10031/sig_use/ring_warp.start" "$BACKUP/object/10031/sig_use/"
|
||||
[ -f "$QUEST/object/70058/use/ring_warp.start" ] && cp -p "$QUEST/object/70058/use/ring_warp.start" "$BACKUP/object/70058/use/"
|
||||
[ -f "$QUEST/object/76042/use/ring_warp.start" ] && cp -p "$QUEST/object/76042/use/ring_warp.start" "$BACKUP/object/76042/use/"
|
||||
cp "$QUEST/quest_functions" "$BACKUP/stage/"
|
||||
cp "$BACKUP/ring_warp.gbk" "$BACKUP/stage/ring_warp.quest"
|
||||
(cd "$BACKUP/stage" && "$QUEST/qc" ring_warp.quest) > "$BACKUP/qc.log" 2>&1 || { cat "$BACKUP/qc.log" >&2; exit 1; }
|
||||
test -s "$BACKUP/stage/object/state/ring_warp"
|
||||
test -s "$BACKUP/stage/object/10031/sig_use/ring_warp.start"
|
||||
test -s "$BACKUP/stage/object/70058/use/ring_warp.start"
|
||||
test -s "$BACKUP/stage/object/76042/use/ring_warp.start"
|
||||
cat "$BACKUP/ring_warp.gbk" > "$QUEST/ring_warp.quest"
|
||||
cp "$BACKUP/stage/object/state/ring_warp" "$QUEST/object/state/ring_warp"
|
||||
cp "$BACKUP/stage/object/10031/sig_use/ring_warp.start" "$QUEST/object/10031/sig_use/ring_warp.start"
|
||||
cp -r "$BACKUP/stage/object/"* "$QUEST/object/"
|
||||
if [ "$MODE" = "--quest-only" ]; then
|
||||
echo "done; reload quests on every game core, or restart game cores (db/auth need no restart)"
|
||||
exit 0
|
||||
|
||||
+279
-1533
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,152 +4,226 @@ quest ring_warp begin
|
||||
state start begin
|
||||
function destinations()
|
||||
return {
|
||||
{name = "各国村庄", maps = {
|
||||
{id = 1, name = "盛唐国一村", x = 469300, y = 964200, mode = "direct", note = ""},
|
||||
{id = 3, name = "盛唐国二村", x = 363000, y = 875200, mode = "direct", note = ""},
|
||||
{id = 21, name = "秦皇国一村", x = 55700, y = 157900, mode = "direct", note = ""},
|
||||
{id = 23, name = "秦皇国二村", x = 137800, y = 234600, mode = "direct", note = ""},
|
||||
{id = 41, name = "周武国一村", x = 969600, y = 278400, mode = "direct", note = ""},
|
||||
{id = 43, name = "周武国二村", x = 877400, y = 253700, mode = "direct", note = ""},
|
||||
}},
|
||||
{name = "野外地图", maps = {
|
||||
{id = 61, name = "舒寒山", x = 435200, y = 230400, mode = "direct", note = ""},
|
||||
{id = 62, name = "导炎大地", x = 665600, y = 691200, mode = "direct", note = ""},
|
||||
{id = 63, name = "影悲沙漠", x = 281600, y = 563200, mode = "direct", note = ""},
|
||||
{id = 64, name = "升龙谷", x = 323500, y = 806900, mode = "direct", note = ""},
|
||||
{id = 65, name = "鬼族寺院", x = 553700, y = 145000, mode = "direct", note = ""},
|
||||
{id = 67, name = "幽灵森林", x = 290100, y = 5700, mode = "direct", note = ""},
|
||||
{id = 68, name = "红森林", x = 1119600, y = 70000, mode = "direct", note = ""},
|
||||
{id = 69, name = "巨人荒地", x = 1058800, y = 725800, mode = "direct", note = ""},
|
||||
{id = 70, name = "蛇之领域", x = 827700, y = 763400, mode = "direct", note = ""},
|
||||
{id = 301, name = "龙头海角", x = 1104800, y = 1788800, mode = "direct", note = ""},
|
||||
{id = 302, name = "迷雾森林", x = 1225700, y = 1682000, mode = "direct", note = ""},
|
||||
{id = 303, name = "黑沙海湾", x = 1087900, y = 1649800, mode = "direct", note = ""},
|
||||
{id = 304, name = "雷鸣山脉", x = 1134100, y = 1655400, mode = "direct", note = ""},
|
||||
}},
|
||||
{name = "洞穴与副本", maps = {
|
||||
{id = 5, name = "盛唐国猴洞", x = 775200, y = 447700, mode = "direct", note = ""},
|
||||
{id = 25, name = "秦皇国猴洞", x = 852000, y = 447700, mode = "direct", note = ""},
|
||||
{id = 45, name = "周武国猴洞", x = 928800, y = 447700, mode = "direct", note = ""},
|
||||
{id = 66, name = "恶鬼塔", x = 590800, y = 110800, mode = "entrance", note = "将传送到恶鬼塔守卫附近,请与守卫交谈入场。"},
|
||||
{id = 71, name = "蜘蛛洞二层", x = 92400, y = 525500, mode = "entrance", note = "将传送到蜘蛛洞守卫附近,二层仍需使用原有通行证。"},
|
||||
{id = 72, name = "流放洞窟一层", x = 284200, y = 811100, mode = "entrance", note = "将传送到流放洞窟入口附近,仍需满足原有等级及血石条件。"},
|
||||
{id = 73, name = "流放洞窟二层", x = 284200, y = 811100, mode = "entrance", note = "请先从入口进入流放洞窟,再通过洞内通道前往二层。"},
|
||||
{id = 104, name = "蜘蛛洞一层", x = 60000, y = 496600, mode = "direct", note = ""},
|
||||
{id = 107, name = "猴洞初级", x = 826400, y = 62800, mode = "direct", note = ""},
|
||||
{id = 108, name = "猴洞中级", x = 135200, y = 652500, mode = "direct", note = ""},
|
||||
{id = 109, name = "猴洞高级", x = 135200, y = 729300, mode = "direct", note = ""},
|
||||
{id = 208, name = "蓝龙巢穴", x = 284200, y = 811100, mode = "entrance", note = "请先进入流放洞窟,再到二层的蓝龙入口办理入场。"},
|
||||
{id = 216, name = "恶魔地下墓穴", x = 592400, y = 100600, mode = "entrance", note = "将传送到地下墓穴入口附近,请与入口守卫交谈。"},
|
||||
{id = 217, name = "蜘蛛洞三层", x = 92400, y = 525500, mode = "entrance", note = "请先通过守卫进入二层,再从二层入口进入三层。"},
|
||||
{id = 351, name = "火焰地牢", x = 614800, y = 707000, mode = "entrance", note = "将传送到火焰地牢入口附近,请按原有组队及入场流程进入。"},
|
||||
}},
|
||||
{name = "公会地图", maps = {
|
||||
{id = 4, name = "盛唐国公会领地", x = 135400, y = 5500, mode = "direct", note = ""},
|
||||
{id = 24, name = "秦皇国公会领地", x = 221900, y = 9200, mode = "direct", note = ""},
|
||||
{id = 44, name = "周武国公会领地", x = 270900, y = 12700, mode = "direct", note = ""},
|
||||
{id = 6, name = "盛唐国公会村庄", x = 230600, y = 231900, mode = "direct", note = ""},
|
||||
{id = 26, name = "秦皇国公会村庄", x = 640200, y = 411100, mode = "direct", note = ""},
|
||||
{id = 46, name = "周武国公会村庄", x = 281800, y = 846300, mode = "direct", note = ""},
|
||||
}},
|
||||
{name = "活动与战争", maps = {
|
||||
{id = 81, name = "婚礼地图", x = 822300, y = 22000, mode = "event", note = "婚礼地图请通过婚礼管理员及婚礼邀请进入。"},
|
||||
{id = 100, name = "野外活动地牢", x = 3215100, y = 7600, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 101, name = "资源活动地图", x = 3212800, y = 64000, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 112, name = "决斗场", x = 857400, y = 2400, mode = "event", note = "决斗场请通过决斗管理员报名或观战。"},
|
||||
{id = 113, name = "知识竞赛场", x = 896500, y = 24600, mode = "event", note = "知识竞赛请在活动开放时通过活动管理员报名。"},
|
||||
{id = 114, name = "圣地战场", x = 948100, y = 41500, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 118, name = "火焰圣地通道一", x = 1149100, y = 118500, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 119, name = "火焰圣地通道二", x = 1149100, y = 220900, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 120, name = "火焰圣地通道三", x = 1149100, y = 323300, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 121, name = "冰雪圣地", x = 1189300, y = 17900, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 122, name = "冰雪圣地通道一", x = 1200700, y = 168900, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 123, name = "冰雪圣地通道二", x = 1200700, y = 271300, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 124, name = "冰雪圣地通道三", x = 1200700, y = 373700, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 125, name = "沙漠圣地", x = 1270000, y = 56400, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 126, name = "沙漠圣地通道一", x = 1242400, y = 142100, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 127, name = "沙漠圣地通道二", x = 1242400, y = 244500, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 128, name = "沙漠圣地通道三", x = 1242400, y = 346900, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 181, name = "帝国战争一", x = 980000, y = 114400, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 182, name = "帝国战争二", x = 934400, y = 166400, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
{id = 183, name = "帝国战争三", x = 985600, y = 166400, mode = "event", note = "请在对应活动或战争开放时,通过原有报名及入场流程进入。"},
|
||||
}},
|
||||
{name = "测试地图", maps = {
|
||||
{id = 103, name = "测试地图一", x = 45200, y = 83500, mode = "gm", note = "此地图仅供管理员测试,普通角色不能直接进入。"},
|
||||
{id = 105, name = "测试地图二", x = 19200, y = 12800, mode = "gm", note = "此地图仅供管理员测试,普通角色不能直接进入。"},
|
||||
{id = 110, name = "测试地图三", x = 44800, y = 12800, mode = "gm", note = "此地图仅供管理员测试,普通角色不能直接进入。"},
|
||||
{id = 111, name = "测试地图四", x = 70400, y = 12800, mode = "gm", note = "此地图仅供管理员测试,普通角色不能直接进入。"},
|
||||
{id = 200, name = "公会建设测试地图", x = 105200, y = 10000, mode = "gm", note = "此地图仅供管理员测试,普通角色不能直接进入。"},
|
||||
}},
|
||||
{name = "各国主城",
|
||||
destinations = {
|
||||
{name = "盛唐国一村", x = 469300, y = 964200},
|
||||
{name = "盛唐国二村", x = 360800, y = 877600},
|
||||
{name = "秦皇国一村", x = 55700, y = 157900},
|
||||
{name = "秦皇国二村", x = 138500, y = 234900},
|
||||
{name = "周武国一村", x = 969600, y = 278400},
|
||||
{name = "周武国二村", x = 873100, y = 242600},
|
||||
}},
|
||||
{name = "升龙谷 (30-50级)",
|
||||
destinations = {
|
||||
{name = "升龙谷中心", x = 332800, y = 745700},
|
||||
{name = "练级区 1", x = 278900, y = 792400},
|
||||
{name = "练级区 2", x = 323500, y = 806900},
|
||||
{name = "练级区 3", x = 388200, y = 742200},
|
||||
}},
|
||||
{name = "影悲沙漠 (30-50级)",
|
||||
destinations = {
|
||||
{name = "沙漠中心", x = 291800, y = 550000},
|
||||
{name = "绿洲 1区", x = 250600, y = 544200},
|
||||
{name = "绿洲 2区", x = 297800, y = 577700},
|
||||
{name = "绿洲 3区", x = 270300, y = 604600},
|
||||
}},
|
||||
{name = "舒寒山 (40-65级)",
|
||||
destinations = {
|
||||
{name = "雪山中心", x = 434400, y = 214700},
|
||||
{name = "练级区 1", x = 435300, y = 183000},
|
||||
{name = "练级区 2", x = 496500, y = 263700},
|
||||
}},
|
||||
{name = "导炎大地 (40-65级)",
|
||||
destinations = {
|
||||
{name = "火地中心", x = 607400, y = 686800},
|
||||
{name = "练级区 1", x = 703600, y = 631000},
|
||||
{name = "练级区 2", x = 681000, y = 745700},
|
||||
}},
|
||||
{name = "蜘蛛洞穴 (45-70级)",
|
||||
destinations = {
|
||||
{name = "蜘蛛洞一层入口", x = 60000, y = 496300},
|
||||
{name = "蜘蛛洞一层深处", x = 91800, y = 525400},
|
||||
{name = "蜘蛛洞二层入口", x = 704100, y = 463900},
|
||||
{name = "蜘蛛洞二层深处/三层入口", x = 704000, y = 522700},
|
||||
}},
|
||||
{name = "鬼怪森林 (65-75级)",
|
||||
subgroups = {
|
||||
{name = "幽灵森林", destinations = {
|
||||
{name = "幽灵森林入口", x = 290800, y = 5700},
|
||||
{name = "练级区 1", x = 308300, y = 42300},
|
||||
{name = "练级区 2", x = 316100, y = 5100},
|
||||
}},
|
||||
{name = "红森林", destinations = {
|
||||
{name = "红森林入口", x = 1116700, y = 69200},
|
||||
{name = "练级区 1", x = 1115100, y = 53400},
|
||||
{name = "练级区 2", x = 1061400, y = 25800},
|
||||
}},
|
||||
}},
|
||||
{name = "巨人荒地 (55-80级)",
|
||||
destinations = {
|
||||
{name = "巨人领地 1区", x = 1119200, y = 791500},
|
||||
{name = "蛇之领域 / 2区", x = 830500, y = 764000},
|
||||
}},
|
||||
{name = "流放洞窟 (75-95级)", min_level = 75,
|
||||
destinations = {
|
||||
{name = "流放洞窟一层入口", x = 10000, y = 1207800},
|
||||
{name = "流放洞窟一层深处", x = 140300, y = 1323600},
|
||||
{name = "流放洞窟二层入口", x = 241600, y = 1273700},
|
||||
{name = "流放洞窟二层深处/龙穴门前", x = 222000, y = 1220800},
|
||||
}},
|
||||
{name = "尤哈拉海角 (90-105级)", min_level = 90,
|
||||
subgroups = {
|
||||
{name = "龙头海角", destinations = {
|
||||
{name = "龙头海角入口", x = 1104800, y = 1788800},
|
||||
{name = "练级区 1", x = 1049300, y = 1738200},
|
||||
{name = "练级区 2", x = 1119100, y = 1731700},
|
||||
}},
|
||||
{name = "迷雾森林", destinations = {
|
||||
{name = "迷雾森林入口", x = 1225700, y = 1682000},
|
||||
{name = "练级区 1", x = 1246700, y = 1721600},
|
||||
{name = "练级区 2", x = 1330600, y = 1741200},
|
||||
}},
|
||||
{name = "雷鸣山脉", destinations = {
|
||||
{name = "雷鸣山脉入口", x = 1134100, y = 1655400},
|
||||
{name = "练级区 1", x = 1167600, y = 1535800},
|
||||
{name = "练级区 2", x = 1211800, y = 1636800},
|
||||
}},
|
||||
{name = "黑沙海湾", destinations = {
|
||||
{name = "黑沙海湾入口", x = 1087900, y = 1649800},
|
||||
{name = "练级区 1", x = 1068600, y = 1626800},
|
||||
{name = "练级区 2", x = 1104400, y = 1557200},
|
||||
}},
|
||||
}},
|
||||
{name = "附魔森林 (105-120级)", min_level = 105,
|
||||
destinations = {
|
||||
{name = "附魔森林入口", x = 816700, y = 1505000},
|
||||
}},
|
||||
}
|
||||
end
|
||||
when 10031.sig_use begin
|
||||
local categories = ring_warp.destinations()
|
||||
local category_options = {}
|
||||
for i = 1, table.getn(categories) do
|
||||
table.insert(category_options, categories[i].name)
|
||||
when 10031.sig_use or 70058.use or 76042.use begin
|
||||
if not pc.can_warp() then
|
||||
say("当前状态无法传送,请结束交易、战斗或其他操作后再试。")
|
||||
return
|
||||
end
|
||||
table.insert(category_options, "关闭")
|
||||
while true do
|
||||
say_title("移动戒指")
|
||||
say("请选择地图分类:")
|
||||
local category = select_table(category_options)
|
||||
if category == table.getn(category_options) then return end
|
||||
local maps = categories[category].maps
|
||||
local page = 1
|
||||
local browsing = true
|
||||
while browsing do
|
||||
local first = (page - 1) * 5 + 1
|
||||
local last = math.min(first + 4, table.getn(maps))
|
||||
local options = {}
|
||||
for i = first, last do
|
||||
local label = maps[i].name
|
||||
if maps[i].mode == "entrance" then label = label .. "(入口)" end
|
||||
table.insert(options, label)
|
||||
local s = select(
|
||||
"各国主城", "升龙谷 (30-50级)", "影悲沙漠 (30-50级)", "舒寒山 (40-65级)", "导炎大地 (40-65级)", "蜘蛛洞穴 (45-70级)", "鬼怪森林 (65-75级)", "巨人荒地 (55-80级)", "流放洞窟 (75-95级)", "尤哈拉海角 (90-105级)", "附魔森林 (105-120级)", "关闭"
|
||||
)
|
||||
if s == 1 then
|
||||
local sub_1 = select("盛唐国一村", "盛唐国二村", "秦皇国一村", "秦皇国二村", "周武国一村", "周武国二村", "关闭")
|
||||
if sub_1 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(469300, 964200) setskin(NOWINDOW)
|
||||
elseif sub_1 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(360800, 877600) setskin(NOWINDOW)
|
||||
elseif sub_1 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(55700, 157900) setskin(NOWINDOW)
|
||||
elseif sub_1 == 4 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(138500, 234900) setskin(NOWINDOW)
|
||||
elseif sub_1 == 5 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(969600, 278400) setskin(NOWINDOW)
|
||||
elseif sub_1 == 6 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(873100, 242600) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 2 then
|
||||
local sub_2 = select("升龙谷中心", "练级区 1", "练级区 2", "练级区 3", "关闭")
|
||||
if sub_2 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(332800, 745700) setskin(NOWINDOW)
|
||||
elseif sub_2 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(278900, 792400) setskin(NOWINDOW)
|
||||
elseif sub_2 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(323500, 806900) setskin(NOWINDOW)
|
||||
elseif sub_2 == 4 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(388200, 742200) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 3 then
|
||||
local sub_3 = select("沙漠中心", "绿洲 1区", "绿洲 2区", "绿洲 3区", "关闭")
|
||||
if sub_3 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(291800, 550000) setskin(NOWINDOW)
|
||||
elseif sub_3 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(250600, 544200) setskin(NOWINDOW)
|
||||
elseif sub_3 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(297800, 577700) setskin(NOWINDOW)
|
||||
elseif sub_3 == 4 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(270300, 604600) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 4 then
|
||||
local sub_4 = select("雪山中心", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_4 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(434400, 214700) setskin(NOWINDOW)
|
||||
elseif sub_4 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(435300, 183000) setskin(NOWINDOW)
|
||||
elseif sub_4 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(496500, 263700) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 5 then
|
||||
local sub_5 = select("火地中心", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_5 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(607400, 686800) setskin(NOWINDOW)
|
||||
elseif sub_5 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(703600, 631000) setskin(NOWINDOW)
|
||||
elseif sub_5 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(681000, 745700) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 6 then
|
||||
local sub_6 = select("蜘蛛洞一层入口", "蜘蛛洞一层深处", "蜘蛛洞二层入口", "蜘蛛洞二层深处/三层入口", "关闭")
|
||||
if sub_6 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(60000, 496300) setskin(NOWINDOW)
|
||||
elseif sub_6 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(91800, 525400) setskin(NOWINDOW)
|
||||
elseif sub_6 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(704100, 463900) setskin(NOWINDOW)
|
||||
elseif sub_6 == 4 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(704000, 522700) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 7 then
|
||||
local sub_7 = select("幽灵森林", "红森林", "关闭")
|
||||
if sub_7 == 1 then
|
||||
local sub_7_1 = select("幽灵森林入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_7_1 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(290800, 5700) setskin(NOWINDOW)
|
||||
elseif sub_7_1 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(308300, 42300) setskin(NOWINDOW)
|
||||
elseif sub_7_1 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(316100, 5100) setskin(NOWINDOW)
|
||||
end
|
||||
local count = table.getn(options)
|
||||
local previous = 0
|
||||
local following = 0
|
||||
if page > 1 then
|
||||
table.insert(options, "上一页")
|
||||
previous = table.getn(options)
|
||||
elseif sub_7 == 2 then
|
||||
local sub_7_2 = select("红森林入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_7_2 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1116700, 69200) setskin(NOWINDOW)
|
||||
elseif sub_7_2 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1115100, 53400) setskin(NOWINDOW)
|
||||
elseif sub_7_2 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1061400, 25800) setskin(NOWINDOW)
|
||||
end
|
||||
if last < table.getn(maps) then
|
||||
table.insert(options, "下一页")
|
||||
following = table.getn(options)
|
||||
end
|
||||
elseif s == 8 then
|
||||
local sub_8 = select("巨人领地 1区", "蛇之领域 / 2区", "关闭")
|
||||
if sub_8 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1119200, 791500) setskin(NOWINDOW)
|
||||
elseif sub_8 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(830500, 764000) setskin(NOWINDOW)
|
||||
end
|
||||
elseif s == 9 then
|
||||
if pc.get_level() < 75 then
|
||||
say("")
|
||||
say("需要达到 75 级才能进入流放洞窟!")
|
||||
say("")
|
||||
else
|
||||
local sub_9 = select("流放洞窟一层入口", "流放洞窟一层深处", "流放洞窟二层入口", "流放洞窟二层深处/龙穴门前", "关闭")
|
||||
if sub_9 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(10000, 1207800) setskin(NOWINDOW)
|
||||
elseif sub_9 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(140300, 1323600) setskin(NOWINDOW)
|
||||
elseif sub_9 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(241600, 1273700) setskin(NOWINDOW)
|
||||
elseif sub_9 == 4 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(222000, 1220800) setskin(NOWINDOW)
|
||||
end
|
||||
table.insert(options, "返回分类")
|
||||
say_title(categories[category].name)
|
||||
say("第 " .. page .. " 页 / 共 " .. math.ceil(table.getn(maps) / 5) .. " 页")
|
||||
local choice = select_table(options)
|
||||
if choice == table.getn(options) then
|
||||
browsing = false
|
||||
elseif previous > 0 and choice == previous then
|
||||
page = page - 1
|
||||
elseif following > 0 and choice == following then
|
||||
page = page + 1
|
||||
elseif choice >= 1 and choice <= count then
|
||||
local destination = maps[first + choice - 1]
|
||||
say_title(destination.name)
|
||||
say("地图编号:" .. destination.id)
|
||||
if destination.mode == "gm" and not pc.is_gm() then
|
||||
say(destination.note)
|
||||
wait()
|
||||
elseif destination.mode == "event" then
|
||||
say(destination.note)
|
||||
wait()
|
||||
else
|
||||
if destination.mode == "entrance" then say(destination.note) end
|
||||
if destination.mode == "gm" then say("管理员专用测试地图。") end
|
||||
if select("传送", "返回列表") == 1 then
|
||||
if not pc.can_warp() then
|
||||
say("当前无法传送,请结束交易或其他操作后再试。")
|
||||
return
|
||||
end
|
||||
pc.warp(destination.x, destination.y)
|
||||
return
|
||||
end
|
||||
end
|
||||
elseif s == 10 then
|
||||
if pc.get_level() < 90 then
|
||||
say("")
|
||||
say("需要达到 90 级才能进入尤哈拉海角区域!")
|
||||
say("")
|
||||
else
|
||||
local sub_10 = select("龙头海角", "迷雾森林", "雷鸣山脉", "黑沙海湾", "关闭")
|
||||
if sub_10 == 1 then
|
||||
local sub_10_1 = select("龙头海角入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_10_1 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1104800, 1788800) setskin(NOWINDOW)
|
||||
elseif sub_10_1 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1049300, 1738200) setskin(NOWINDOW)
|
||||
elseif sub_10_1 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1119100, 1731700) setskin(NOWINDOW)
|
||||
end
|
||||
elseif sub_10 == 2 then
|
||||
local sub_10_2 = select("迷雾森林入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_10_2 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1225700, 1682000) setskin(NOWINDOW)
|
||||
elseif sub_10_2 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1246700, 1721600) setskin(NOWINDOW)
|
||||
elseif sub_10_2 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1330600, 1741200) setskin(NOWINDOW)
|
||||
end
|
||||
elseif sub_10 == 3 then
|
||||
local sub_10_3 = select("雷鸣山脉入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_10_3 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1134100, 1655400) setskin(NOWINDOW)
|
||||
elseif sub_10_3 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1167600, 1535800) setskin(NOWINDOW)
|
||||
elseif sub_10_3 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1211800, 1636800) setskin(NOWINDOW)
|
||||
end
|
||||
elseif sub_10 == 4 then
|
||||
local sub_10_4 = select("黑沙海湾入口", "练级区 1", "练级区 2", "关闭")
|
||||
if sub_10_4 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1087900, 1649800) setskin(NOWINDOW)
|
||||
elseif sub_10_4 == 2 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1068600, 1626800) setskin(NOWINDOW)
|
||||
elseif sub_10_4 == 3 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(1104400, 1557200) setskin(NOWINDOW)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif s == 11 then
|
||||
if pc.get_level() < 105 then
|
||||
say("")
|
||||
say("需要达到 105 级才能进入附魔森林!")
|
||||
say("")
|
||||
else
|
||||
local sub_11 = select("附魔森林入口", "关闭")
|
||||
if sub_11 == 1 then if not pc.can_warp() then say("当前状态无法传送,请稍后重试。") return end pc.warp(816700, 1505000) setskin(NOWINDOW)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# coding: utf-8
|
||||
"""Catalog coverage plus Lua 5.0 menu/permission/warp integration checks.
|
||||
Usage: python3 test_ring.py SERVER_LIBLUA_DIRECTORY [LIVE_MAP_INDEX] [COMPILED_OBJECT_ROOT]
|
||||
Usage: python3 test_ring.py SERVER_LIBLUA_DIRECTORY
|
||||
"""
|
||||
import importlib.util
|
||||
import json
|
||||
@@ -16,96 +16,181 @@ spec.loader.exec_module(generator)
|
||||
quest = generator.generate()
|
||||
assert quest == (ROOT / 'ring_warp.quest').read_text(encoding='utf-8'), 'regenerate quest'
|
||||
catalog = json.loads((ROOT / 'maps.json').read_text(encoding='utf-8'))
|
||||
maps = [m for c in catalog['categories'] for m in c['maps']]
|
||||
byid = {m['id']:m for m in maps}
|
||||
assert len(maps) == len(byid) == 65
|
||||
if len(sys.argv) > 2:
|
||||
live = dict((int(line.split()[0]),line.split()[1]) for line in Path(sys.argv[2]).read_text().splitlines() if line.strip() and not line.lstrip().startswith('#'))
|
||||
assert {m['id']:m['directory'] for m in maps} == live
|
||||
for m in maps:
|
||||
assert m['mode'] in ('direct', 'entrance', 'gm', 'event')
|
||||
target = byid[m['target'][0]]
|
||||
for j in range(2):
|
||||
assert target['base'][j] <= m['target'][j+1] < target['base'][j] + target['size'][j] * 25600, m
|
||||
assert {m['id'] for m in maps if m['mode']=='entrance'} == {66,71,72,73,208,216,217,351}
|
||||
assert byid[217]['target'][0] == 104 and byid[208]['target'][0] == 64
|
||||
assert 'remove_item' not in quest and 'socket' not in quest and 'setqf' not in quest
|
||||
# Run the actual generated functions/event body under the server's Lua 5.0.
|
||||
helper = quest.split(' function destinations()',1)[1].split(' when 10031.sig_use begin',1)[0]
|
||||
body = quest.split(' when 10031.sig_use begin',1)[1].rsplit(' end',1)[0]
|
||||
script = 'ring_warp = {}\nfunction ring_warp.destinations()' + helper + '\nfunction use_ring()\n' + body + '\nend\n'
|
||||
if len(sys.argv) > 3:
|
||||
objects = Path(sys.argv[3])
|
||||
state = (objects/'state/ring_warp').read_bytes().decode('gbk')
|
||||
event = (objects/'10031/sig_use/ring_warp.start').read_bytes().decode('gbk')
|
||||
script = state + '\nfunction use_ring()\n' + event + '\nend\n'
|
||||
script += '''
|
||||
local categories = ring_warp.destinations()
|
||||
categories = catalog['categories']
|
||||
assert len(categories) == 11, 'AVA2 11 regional categories expected'
|
||||
|
||||
# Validate the destinations against the 203 map catalogue, including overlapping map rectangles.
|
||||
classic = json.loads((ROOT / 'maps_classic_65.json').read_text(encoding='utf-8'))
|
||||
regions = {m['id']: m for c in classic['categories'] for m in c['maps']}
|
||||
regions[210] = dict(base=[768000, 1408000], size=[3, 4])
|
||||
expected = [[1, 3, 21, 23, 41, 43], [64]*4, [63]*4, [61]*3, [62]*3,
|
||||
[104, 104, 71, 71], [67]*3+[68]*3, [69, 70], [72, 72, 73, 73],
|
||||
[301]*3+[302]*3+[304]*3+[303]*3, [210]]
|
||||
for category, map_ids in zip(categories, expected):
|
||||
points = [d for group in category.get('subgroups', [category]) for d in group['destinations']]
|
||||
assert len(points) == len(map_ids)
|
||||
for point, map_id in zip(points, map_ids):
|
||||
region = regions[map_id]
|
||||
x, y = region['base']; w, h = region['size']
|
||||
assert x <= point['x'] < x+w*25600 and y <= point['y'] < y+h*25600, (point, map_id)
|
||||
if map_id == 64:
|
||||
tower = regions[66]; tx, ty = tower['base']; tw, th = tower['size']
|
||||
assert not (tx <= point['x'] < tx+tw*25600 and ty <= point['y'] < ty+th*25600), point
|
||||
|
||||
# Verify GBK safety
|
||||
encoded = quest.encode('gbk')
|
||||
assert b'\\' not in encoded, 'GBK backslash found'
|
||||
|
||||
# Prepare Lua 5.0 script runner
|
||||
helper = quest.split(' function destinations()', 1)[1].split(' when 10031.sig_use', 1)[0]
|
||||
body = quest.split(' when 10031.sig_use or 70058.use or 76042.use begin', 1)[1].rsplit(' end', 1)[0]
|
||||
|
||||
script = '''
|
||||
NOWINDOW = 0
|
||||
setskin = function(skin) end
|
||||
say = function(t) end
|
||||
ring_warp = {}
|
||||
function ring_warp.destinations()
|
||||
''' + helper + '''
|
||||
function use_ring()
|
||||
''' + body + '''
|
||||
end
|
||||
|
||||
local queue = {}
|
||||
local cursor = 0
|
||||
local gm = false
|
||||
local can_warp = true
|
||||
local blocked_after_select = false
|
||||
local level = 90
|
||||
local warps = {}
|
||||
|
||||
pc = {
|
||||
is_gm = function() return gm end,
|
||||
can_warp = function() return can_warp end,
|
||||
warp = function(x,y) table.insert(warps,{x,y}) end,
|
||||
can_warp = function() return can_warp end,
|
||||
get_level = function() return level end,
|
||||
warp = function(x, y) table.insert(warps, {x, y}) end
|
||||
}
|
||||
say_title = function(text) end
|
||||
say = function(text) end
|
||||
wait = function() end
|
||||
select_table = function(options)
|
||||
assert(table.getn(options) <= 8, "menu too tall")
|
||||
cursor = cursor + 1
|
||||
local choice = queue[cursor]
|
||||
assert(choice and choice >= 1 and choice <= table.getn(options), "bad selection")
|
||||
return choice
|
||||
|
||||
select = function(...)
|
||||
cursor = cursor + 1
|
||||
local choice = queue[cursor]
|
||||
assert(choice and choice >= 1 and choice <= table.getn(arg), "bad choice: " .. tostring(choice))
|
||||
if blocked_after_select then can_warp = false end
|
||||
return choice
|
||||
end
|
||||
select = function(...) return select_table(arg) end
|
||||
local runs = 0
|
||||
function run(answers, is_gm, allowed)
|
||||
queue = answers; cursor = 0; gm = is_gm; can_warp = allowed; warps = {}
|
||||
use_ring()
|
||||
assert(cursor == table.getn(queue), "unexpected navigation")
|
||||
runs = runs + 1
|
||||
|
||||
function run(answers, p_level, p_can_warp)
|
||||
queue = answers; cursor = 0; level = p_level; can_warp = p_can_warp; warps = {}
|
||||
use_ring()
|
||||
assert(cursor == table.getn(queue), "navigation mismatch: cursor " .. cursor .. " expected " .. table.getn(queue))
|
||||
return warps
|
||||
end
|
||||
for category = 1, table.getn(categories) do
|
||||
local maps = categories[category].maps
|
||||
for index = 1, table.getn(maps) do
|
||||
local page = math.floor((index-1)/5)+1
|
||||
local answer = {}
|
||||
table.insert(answer, category)
|
||||
for p = 1,page-1 do table.insert(answer, p==1 and 6 or 7) end
|
||||
table.insert(answer, math.mod(index-1,5)+1)
|
||||
local m = maps[index]
|
||||
local blocked = m.mode == "gm" or m.mode == "event"
|
||||
if blocked then
|
||||
local count = math.min(5,table.getn(maps)-(page-1)*5)
|
||||
local buttons = count + 1
|
||||
if page > 1 then buttons = buttons + 1 end
|
||||
if page*5 < table.getn(maps) then buttons = buttons + 1 end
|
||||
table.insert(answer,buttons); table.insert(answer,7)
|
||||
else table.insert(answer,1) end
|
||||
run(answer,false,true)
|
||||
assert(table.getn(warps) == (blocked and 0 or 1))
|
||||
if not blocked then assert(warps[1][1]==m.x and warps[1][2]==m.y) end
|
||||
end
|
||||
end
|
||||
run({7},false,true) -- close
|
||||
run({1,6,2,7,7},false,true) -- next, previous, return list/category, close
|
||||
run({1,1,1},false,false) -- blocked by active trade etc.
|
||||
assert(table.getn(warps)==0)
|
||||
run({6,1,1},true,true) -- GM test-map access
|
||||
assert(table.getn(warps)==1 and warps[1][1]==categories[6].maps[1].x)
|
||||
print("PASS: 65 map selections, paging, back/cancel, warp guard and GM access; " .. runs .. " runs")
|
||||
|
||||
-- Test 1: can_warp = false blocks immediately
|
||||
local w = run({}, 100, false)
|
||||
assert(table.getn(w) == 0, "warp should be blocked")
|
||||
|
||||
-- Test 2: Category 1 (各国主城), Dest 1 (盛唐一村)
|
||||
local w = run({1, 1}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 469300 and w[1][2] == 964200, "盛唐一村 failed")
|
||||
|
||||
-- Test 3: Category 1 (各国主城), Dest 4 (秦皇二村)
|
||||
local w = run({1, 4}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 138500 and w[1][2] == 234900, "秦皇二村 failed")
|
||||
|
||||
-- Test 4: Category 2 (升龙谷), Dest 1 (中心)
|
||||
local w = run({2, 1}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 332800 and w[1][2] == 745700, "升龙谷中心 failed")
|
||||
|
||||
-- Test 5: Category 3 (影悲沙漠), Dest 2 (绿洲1区)
|
||||
local w = run({3, 2}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 250600 and w[1][2] == 544200, "沙漠绿洲1区 failed")
|
||||
|
||||
-- Test 6: Category 4 (舒寒山), Dest 1 (雪山中心)
|
||||
local w = run({4, 1}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 434400 and w[1][2] == 214700, "雪山中心 failed")
|
||||
|
||||
-- Test 7: Category 5 (导炎大地), Dest 1 (火地中心)
|
||||
local w = run({5, 1}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 607400 and w[1][2] == 686800, "火地中心 failed")
|
||||
|
||||
-- Test 8: Category 6 (蜘蛛洞穴), direct cave warps (all 4 deep spots)
|
||||
local w = run({6, 1}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 60000 and w[1][2] == 496300, "蜘蛛一层入口 failed")
|
||||
local w = run({6, 2}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 91800 and w[1][2] == 525400, "蜘蛛一层深处 failed")
|
||||
local w = run({6, 3}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 704100 and w[1][2] == 463900, "蜘蛛二层入口 failed")
|
||||
local w = run({6, 4}, 50, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 704000 and w[1][2] == 522700, "蜘蛛二层深处/三层入口 failed")
|
||||
|
||||
-- Test 9: Category 7 (鬼怪森林), Sub 1 (幽灵森林) & Sub 2 (红森林)
|
||||
local w = run({7, 1, 1}, 70, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 290800 and w[1][2] == 5700, "幽灵森林入口 failed")
|
||||
local w = run({7, 2, 3}, 70, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1061400 and w[1][2] == 25800, "红森林练级区 2 failed")
|
||||
|
||||
-- Test 10: Category 8 (巨人荒地), Dest 1 & 2
|
||||
local w = run({8, 1}, 60, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1119200 and w[1][2] == 791500, "巨人领地 1区 failed")
|
||||
local w = run({8, 2}, 60, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 830500 and w[1][2] == 764000, "蛇之领域 failed")
|
||||
|
||||
-- Test 11: Category 9 (流放洞窟), level check < 75 blocked
|
||||
local w = run({9}, 70, true)
|
||||
assert(table.getn(w) == 0, "流放洞窟 70级应被拦截")
|
||||
|
||||
-- Test 12: Category 9 (流放洞窟), level >= 75 deep cave warps (all 4 spots)
|
||||
local w = run({9, 1}, 75, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 10000 and w[1][2] == 1207800, "流放一层入口 failed")
|
||||
local w = run({9, 2}, 75, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 140300 and w[1][2] == 1323600, "流放一层深处 failed")
|
||||
local w = run({9, 3}, 75, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 241600 and w[1][2] == 1273700, "流放二层入口 failed")
|
||||
local w = run({9, 4}, 75, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 222000 and w[1][2] == 1220800, "龙穴门前 failed")
|
||||
|
||||
-- Test 13: Category 10 (尤哈拉海角), level < 90 blocked
|
||||
local w = run({10}, 89, true)
|
||||
assert(table.getn(w) == 0, "海角 89级应被拦截")
|
||||
|
||||
-- Test 14: Category 10 (尤哈拉海角), level >= 90 all 4 sub-regions
|
||||
local w = run({10, 1, 1}, 90, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1104800 and w[1][2] == 1788800, "龙头海角中心 failed")
|
||||
local w = run({10, 2, 1}, 90, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1225700 and w[1][2] == 1682000, "迷雾森林中心 failed")
|
||||
local w = run({10, 3, 1}, 90, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1134100 and w[1][2] == 1655400, "雷鸣山脉中心 failed")
|
||||
local w = run({10, 4, 1}, 90, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 1087900 and w[1][2] == 1649800, "黑沙海湾中心 failed")
|
||||
|
||||
-- Test 15: Category 11 (附魔森林), level < 105 blocked
|
||||
local w = run({11}, 104, true)
|
||||
assert(table.getn(w) == 0, "附魔森林 104级应被拦截")
|
||||
|
||||
-- Test 16: Category 11 (附魔森林), level >= 105
|
||||
local w = run({11, 1}, 105, true)
|
||||
assert(table.getn(w) == 1 and w[1][1] == 816700 and w[1][2] == 1505000, "附魔森林 failed")
|
||||
|
||||
-- Test 17: Close main menu (option 12)
|
||||
local w = run({12}, 100, true)
|
||||
assert(table.getn(w) == 0, "关闭应无传送")
|
||||
|
||||
-- State can change while the destination menu is open.
|
||||
blocked_after_select = true
|
||||
local w = run({1, 1}, 120, true)
|
||||
assert(table.getn(w) == 0, "state changed during menu must block warp")
|
||||
blocked_after_select = false
|
||||
|
||||
print("PASS: 11 AVA2 regional categories, deep cave warps, level checks, and warp guard verified")
|
||||
'''
|
||||
lua = Path(sys.argv[1])
|
||||
|
||||
lua = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT.parents[3] / 'metin2-server/src/server/liblua'
|
||||
with tempfile.TemporaryDirectory(prefix='ring-warp-test-') as d:
|
||||
d = Path(d)
|
||||
sources = [p for p in sorted((lua/'src').glob('*.c')) if p.name != 'ltests.c']
|
||||
sources += [lua/'src/lib'/name for name in ('lauxlib.c','lbaselib.c','ltablib.c','lstrlib.c','lmathlib.c')]
|
||||
command = ['cc','-w','-I'+str(lua/'include'),'-I'+str(lua/'src'),str(ROOT/'tests/lua_runner.c'),*[str(p) for p in sources],'-lm','-o',str(d/'lua')]
|
||||
subprocess.run(command,check=True)
|
||||
(d/'test.lua').write_bytes(script.encode('gbk'))
|
||||
subprocess.run([str(d/'lua'),str(d/'test.lua')],check=True)
|
||||
print('PASS: catalog matches server index, coordinates in bounds, GBK source safe')
|
||||
sources = [p for p in sorted((lua / 'src').glob('*.c')) if p.name != 'ltests.c']
|
||||
sources += [lua / 'src/lib' / name for name in ('lauxlib.c', 'lbaselib.c', 'ltablib.c', 'lstrlib.c', 'lmathlib.c')]
|
||||
command = ['cc', '-w', '-I' + str(lua / 'include'), '-I' + str(lua / 'src'), str(ROOT / 'tests/lua_runner.c'),
|
||||
*[str(p) for p in sources], '-lm', '-o', str(d / 'lua')]
|
||||
subprocess.run(command, check=True)
|
||||
(d / 'test.lua').write_bytes(script.encode('gbk'))
|
||||
subprocess.run([str(d / 'lua'), str(d / 'test.lua')], check=True)
|
||||
print('PASS: catalog matches AVA2 regional layout, coordinates in bounds, GBK source safe')
|
||||
|
||||
Reference in New Issue
Block a user