chore: delete 106 unreachable *_system.gd and their parity tests
These files were loaded only by their own test_*_parity.gd and never by the runtime (transitively checked, incl. client_phase_integration_system). Removes 76 manifest implementation/evidence references across 18 contracts; contract docs get a note that conclusions based on them are void. Live systems kept: chest, consumable, item_attr, metin_socket, whisper_chat. Full headless suite: no new failures (7 failing + 5 headless-hanging render tests are identical before the deletion). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,3 +102,7 @@
|
||||
|
||||
- 先审计 `lifecycle.platform_release`,核对 Windows 窗口、导出、自包含资源、崩溃处理和发布门禁。
|
||||
- 回到实现阶段时,优先建立 BGM 多实例状态机和真实 3D 播放器清理测试,再处理固定实例池/Provider 的适配边界。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`test_bgm_jukebox_parity.gd`。
|
||||
|
||||
@@ -93,3 +93,7 @@
|
||||
- 为每个 affect bit 建立 40250 资源、附着骨骼、开关、清理和石头烟雾矩阵。
|
||||
- 增加 `GC_AFFECT_ADD → duration → GC_AFFECT_REMOVE`、重复/乱序/重连/换图的 native→HUD 端到端测试。
|
||||
- 增加远端 Actor 的 stunned/knockdown/skill-cancel 状态机测试,并修复 `hit_view_test.gd` 的前向 damage 资源选择后再提升合同状态。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`combat_status_effect_system.gd`, `test_combat_status_effect_parity.gd`, `test_mob_combat_reaction_parity.gd`。
|
||||
|
||||
@@ -237,3 +237,7 @@ native `CActorInstance` 的同一骨骼 composite matrix、旋转和绑定坐标
|
||||
进程退出码为 0;此前记录的 race 0 / 03150 左手贴合断言失败不再是当前待办项,已从
|
||||
manifest 的 `remaining` 移除。该校正只更新证据状态,不改变 WeaponTrace native
|
||||
骨骼 composite matrix、远端/怪物覆盖和服务端攻击闭环仍未证明的结论。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`socket_glow_fx_system.gd`, `test_combat_status_effect_parity.gd`。
|
||||
|
||||
@@ -119,3 +119,7 @@
|
||||
- 增加完整 `.msa` 事件源的 `CanChangeTarget`/动作锁/重复点击时间窗测试,并对照 `_change_target_to_picked_instance` 的实际调用链。
|
||||
- 增加地图属性 `ATTRIBUTE_BANPK` 与 `in_safe` 的移动、换图、目标切换矩阵。
|
||||
- 只有以上差异修复并通过 native/classic 与场景回归后,才能将本合同从 `PARTIAL` 提升。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`alignment_pk_system.gd`, `test_alignment_pk_parity.gd`, `test_auto_combat_bot_parity.gd`。
|
||||
|
||||
@@ -84,3 +84,7 @@
|
||||
- 本轮扫描到 524 个活跃源码/头文件:18 个 StdAfx 构建支持,142 个已在合同 manifest 中逐文件列出,364 个进入按行为合同归属的静态复核队列;当前未归属行为文件为 0。
|
||||
- `EffectLib`、`EterGrnLib`、`MilesLib` 已完成本轮活跃符号和生命周期链静态复核,但仍按实现差异保持 `PARTIAL`;其余 inferred queue 不得因为自动归属而视为已审计。
|
||||
- 下次审计必须先运行源码覆盖扫描,再从 `inferred_review_queue` 取下一组,补充对应合同的参考文件、符号、分支矩阵和测试证据;只有完成语义核对后才能转为 `reviewed_static_group`。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`combat_status_effect_system.gd`, `costume_system.gd`, `dungeon_ranking_system.gd`, `fishing_cooking_camp_system.gd`, `fishing_mining_system.gd`, `guild_mark_uploader_system.gd`, `guild_war_system.gd`, `horse_combat_system.gd`, `horse_system.gd`, `item_enchant_system.gd`, `item_split_system.gd`, `jewelry_socket_system.gd`, `messenger_system.gd`, `mining_refinery_smelt_system.gd`, `mounted_combat_skill_system.gd`, `npc_shop_system.gd`, `party_management_system.gd`, `pet_companion_system.gd`, `player_trade_exchange_system.gd`, `polymorph_system.gd`, `private_shop_system.gd`, `safebox_storage_keeper_system.gd`, `wardrobe_transmog_system.gd`, `weather_daynight_system.gd`, `world_boss_system.gd`。
|
||||
|
||||
@@ -151,3 +151,7 @@
|
||||
`PARTIAL`。快捷栏增删/交换现在遵循请求→`GC_QUICKSLOT_*`→重建显示的权威时序,分页也已按 4 页取模;
|
||||
但快捷栏使用的统一入口、消耗品反馈闭环、真实回包 fixture、音效/sequence 和跨生命周期清理仍未闭合,
|
||||
因此不能把整个合同标记为 40250 等价。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`item_split_system.gd`, `test_item_split_parity.gd`。
|
||||
|
||||
@@ -120,3 +120,7 @@
|
||||
- `EntityStore` 的正 HP 点数更新会清除 `dead`,`M2Client` 会重置 `dead_seen`,保证复活后下一次死亡可以再次发出 `entity_dead`。
|
||||
|
||||
本合同继续为 `PARTIAL`:本轮只修复了可直接验证的协议边界和死亡状态边沿,没有把本地属性/镶嵌/时装旁路误标为 40250 等价实现。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`costume_attr_transfer_system.gd`, `costume_system.gd`, `item_enchant_system.gd`, `jewelry_socket_system.gd`, `refine_effect_system.gd`, `test_costume_attr_transfer_parity.gd`, `test_costume_system_parity.gd`, `test_item_enchant_manager_parity.gd`, `test_jewelry_socket_parity.gd`, `test_refine_effect_parity.gd`, `test_wardrobe_transmog_parity.gd`, `wardrobe_transmog_system.gd`。
|
||||
|
||||
@@ -338,3 +338,7 @@ server_speed_scale = 0.0 if moving_speed > 1100 else float(moving_speed) / 100.0
|
||||
- `OnWaiting`:参考只在 `CInstanceBase::Transform()` 的 `IsWalking() || IsUsingMovingSkill()` 分支内、本帧位移 ≤1.0 时调用(`InstanceBase.cpp:1922-1930`),100ms 节流,位移基准为 `m_kPPosPrevWaiting`(由 `OnSyncing`/`OnWaiting` 更新)。当前端原有的 `_tick_on_waiting()` 在站立期间周期补发 `FUNC_WAIT`,参考没有该机制,已删除(含 `SEND_WAITING_*` 与 `_last_waiting_sent_t`)。走/跑中本帧无位移的 OnWaiting 路径尚未移植(DIVERGENT)。
|
||||
- `CInstanceBase::SHORSE::SetMoveSpeed` 只同步坐骑模型动画速率,不是另一套移动速度公式,归 `world.mount_pet_polymorph`。
|
||||
- 测试:`netplay_test.gd` 新增“站立被推开不发包”断言;netplay/keyboard_motion_timeline/movement_parity/player_move/test_wasd_steering_parity/test_no_auto_move_regression/motion_event_warp/playable_combat 均 PASS。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`test_alignment_parity.gd`。
|
||||
|
||||
@@ -101,3 +101,7 @@
|
||||
## Status
|
||||
|
||||
`PARTIAL`。NPC 点击、基础对话承接、普通/扩展商店协议骨架、购买出售 UI 和个人商店字段已经存在,但当前端仍有明确的多 tab 更新索引错误、购买模式错误放行出售、个人商店招牌不可点击打开、自己商店状态不分支、native 动作门控缺失以及本地硬编码库存/金币旁路。已完成审计并记录,未修改实现代码。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`npc_shop_system.gd`, `private_shop_system.gd`, `test_npc_shop_parity.gd`, `test_private_shop_bundle_parity.gd`。
|
||||
|
||||
@@ -223,3 +223,7 @@ Atlas overlay 使用与小地图相同的 server-centimetre→world→map 坐标
|
||||
|
||||
`test_quest_dialog_parity.gd` 新增缺失资源回归,当前 49 项全部通过;真实 `.msc` 文件的
|
||||
完整事件序列、过场播放器消费者和中断清理仍保持 `PARTIAL`。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`atlas_navigation_system.gd`, `biologist_quest_system.gd`, `dynamic_bounty_event_system.gd`, `event_manager_system.gd`, `metin_spawn_event_system.gd`, `test_atlas_navigation_parity.gd`, `test_biologist_quest_parity.gd`, `test_event_manager_parity.gd`, `test_map_name_shower_parity.gd`。
|
||||
|
||||
@@ -148,3 +148,7 @@
|
||||
- `player_skill_test`、`skill_test`、`guild_war_skill_test` 均通过,覆盖非公会战拒绝、公会战独立包和 UI 公会技能页。
|
||||
|
||||
仍保持 `PARTIAL`:真实 `GUILD_WAR_ON_WAR` 回包、服务端拒绝/冷却回滚、跨生命周期乱序和完整动作/damage 证据尚未闭合。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`test_status_skill_reset_parity.gd`。
|
||||
|
||||
@@ -127,3 +127,7 @@
|
||||
## Status
|
||||
|
||||
`PARTIAL`。当前端已有聊天协议骨架、公共输入、私聊基础发送、聊天气泡和名字尾标的可测试镜像,但并非与 40250 统一实现:live 私聊已接入独立会话,但窗口历史/任务栏通知/服务端 ignore 命令仍未闭环;公共颜色/notice 分支不一致、入站表情/过滤/跨帝国文本缺失,且尾标渲染仍使用 Godot billboard 与宽度估算。本轮已修正 whisper mode 映射、空错误文案、截断 whisper 拒绝逻辑并接通 live conversation/ignore 判断,其他差异继续保持 PARTIAL。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`test_chat_hyperlink_dice_parity.gd`。
|
||||
|
||||
@@ -97,3 +97,7 @@
|
||||
## Status
|
||||
|
||||
`PARTIAL`。当前端已经具备 exchange/safebox/mall 的 native 协议骨架、回包存储和主要 UI,交易物品属性与仓库商城的基本网络状态能够展示;但 native exchange 请求缺 40250 动作门控,交易/仓库 UI 存在 optimistic 状态和提前关闭,本地 helper 直接承担交易结算、密码、库存和金条 authority,且真实错误、乱序、断线和回包回滚证据不足。本轮完成审计并记录,未修改实现。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`player_trade_exchange_system.gd`, `safebox_storage_keeper_system.gd`, `test_mall_affect_parity.gd`, `test_player_trade_exchange_parity.gd`, `test_safebox_storage_keeper_parity.gd`, `test_security_lock_parity.gd`。
|
||||
|
||||
@@ -106,3 +106,7 @@
|
||||
## Status
|
||||
|
||||
`PARTIAL`。当前端的 native 社交协议和主要 UI 已有较完整骨架,组队、公会、好友和会徽 live 主路径大体接上 40250;但本地 party/guild skill/war/messenger/mark helper 仍把服务端权威逻辑复制成直接状态机,且真实权限拒绝、回包顺序、重连清理和独立会徽连接缺端到端证据。因此不能把现有 parity 测试通过等同于实现统一。本轮完成审计并记录,未修改实现代码。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`guild_mark_uploader_system.gd`, `guild_skill_system.gd`, `guild_war_system.gd`, `messenger_system.gd`, `party_management_system.gd`, `test_guild_mark_uploader_parity.gd`, `test_guild_skill_parity.gd`, `test_guild_war_observer_arena_parity.gd`, `test_guild_war_parity.gd`, `test_messenger_parity.gd`, `test_party_management_parity.gd`, `test_privilege_empire_guild_parity.gd`。
|
||||
|
||||
@@ -86,3 +86,7 @@
|
||||
本轮仍为 `PARTIAL`;完成三个地下城/活动方向的合同审计并登记,未修改实现。
|
||||
|
||||
`PARTIAL`。当前端已经具备 `GC_DUNGEON` 目标点的主要 parser、坐标状态和与 40250 一致的 Manhattan/20 秒算法,也有结果窗口骨架;但 40250 的 compass `.mse` alarm 没有实际消费者,结果链缺少 live 回包时序证据,且 Boss、排行和具体副本 helper 是当前端本地 authority,不是 40250 Windows 客户端实现。本轮完成审计并记录,未修改实现。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`dungeon_ranking_system.gd`, `endless_spire_dungeon_system.gd`, `flame_dungeon_razador_system.gd`, `spider_dungeon_system.gd`, `test_dungeon_ranking_parity.gd`, `test_endless_spire_dungeon_parity.gd`, `test_flame_dungeon_razador_parity.gd`, `test_spider_dungeon_key_parity.gd`, `test_spider_dungeon_parity.gd`, `world_boss_system.gd`。
|
||||
|
||||
@@ -102,3 +102,7 @@
|
||||
## 下一轮验证入口
|
||||
|
||||
- 进入实现阶段后,优先修复正式 GameScene 的天气/地图环境接入和 fog/filter/lens flare/wind 中的已确认 GAP;修复后重新运行本合同四组测试并增加真实渲染证据。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`test_weather_daynight_parity.gd`, `weather_daynight_system.gd`。
|
||||
|
||||
@@ -86,3 +86,7 @@
|
||||
本轮仍为 `PARTIAL`;完成钓鱼/采矿方向的合同审计并登记,未修改实现。
|
||||
|
||||
`PARTIAL`。当前端已经具备 40250 钓鱼/采矿协议骨架、角色动作入口、水属性扫描和水面构造;但持竿/持镐 live 门控、角色状态条件、采矿 count 动作队列和真实资源副作用证据不足,且钓鱼收益、烹饪、营火、熔炼、宝石与库存脚本承担了 40250 客户端没有承担的本地 authority。本轮完成审计并记录,未修改实现。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`fishing_cooking_camp_system.gd`, `fishing_mining_system.gd`, `fishing_rod_reel_system.gd`, `mining_refinery_smelt_system.gd`, `test_fishing_cooking_camp_parity.gd`, `test_fishing_mining_parity.gd`, `test_fishing_rod_reel_parity.gd`, `test_mining_refinery_smelt_parity.gd`。
|
||||
|
||||
@@ -81,3 +81,7 @@
|
||||
本轮仍为 `PARTIAL`;完成坐骑、宠物和变身方向的合同审计并登记,未修改实现。
|
||||
|
||||
`PARTIAL`。当前端已具备 `mount_vnum` 的网络存储、mount_changed 信号、部分动作模式/旋转速度/攻击门控,并有本地马匹、宠物和变身 helper;但没有发现实际坐骑模型挂接链,变身状态尚未进入 native entity,宠物与马战/成长/耐力/伤害脚本承担了 40250 客户端没有承担的本地 authority。基础测试全部通过仍不足以证明与 40250 Windows 客户端实现统一。本轮完成审计并记录,未修改实现。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`classic_pet_system.gd`, `horse_combat_system.gd`, `horse_level_growth_system.gd`, `horse_system.gd`, `mounted_combat_skill_system.gd`, `pet_companion_system.gd`, `polymorph_marble_system.gd`, `polymorph_system.gd`, `test_battle_arena_duel_parity.gd`, `test_classic_pet_parity.gd`, `test_horse_combat_parity.gd`, `test_horse_level_growth_parity.gd`, `test_mount_horse_parity.gd`, `test_mounted_combat_skill_parity.gd`, `test_pet_companion_parity.gd`, `test_polymorph_marble_parity.gd`, `test_polymorph_parity.gd`。
|
||||
|
||||
@@ -85,3 +85,7 @@
|
||||
## Status
|
||||
|
||||
`PARTIAL`。当前端已经具备 40250 实体/掉落协议的主要 native parser、VID 数据层、NPC/怪物场景层、地面物体和 shop sign 状态入口;可见性基础回归和每帧更新边界已修复,但掉落模型/特效/音效、建筑碰撞、完整 actor/ground 生命周期和 live 拾取/商店回包证据仍不足。
|
||||
|
||||
### 2026-09-22 死代码删除
|
||||
|
||||
以下文件只被自身测试引用、运行时从不加载,已删除;本文中以它们为实现或证据的结论作废,相关行为需按 40250 源码单元重新移植:`metin_spawn_event_system.gd`, `test_metin_spawn_event_parity.gd`。
|
||||
|
||||
@@ -484,3 +484,4 @@
|
||||
{"time": "2026-09-22T01:30:00Z", "event": "audit_round", "result": "PARTIAL", "ids": ["movement.keyboard.motion/canact-paralysis-faint-sleep-gate"], "files": ["audit/contracts/movement.keyboard-motion.md", "audit/manifest.json", "audit/history.jsonl"], "tests": ["40250 reference source reachability audit (exhaustive grep -arn across UserInterface/ + GameLib/ for SetParalysis/Paralysis, AFFECT_SLEEP/SetSleep, SetFaint/FaintTest, Stun/RecvStunPacket)"], "reason": "Investigated the movement.keyboard-motion.md Remaining item \"CActorInstance::CanAct() Paralysis/Faint/Sleep movement gates not wired into net_play.gd\" (flagged unfixed by the prior round). Findings: (1) IsParalysis()/m_isParalysis has exactly one setter in the whole reachable 40250 source, CInstanceBase::__Shaman_SetParalysis (InstanceBaseEffect.cpp:821-823), which itself has zero callers anywhere in the tree -- Paralysis is dead code, never true in live gameplay, so not wiring it is correct parity, not a gap. (2) IsSleep()/m_isSleep: the AFFECT_SLEEP case in SetAffect()s switch is commented out (dead); the only live setter is the AFFECT_STUN case (m_GraphicThingInstance.SetSleep(isVisible), ~InstanceBaseEffect.cpp:932-933) -- IsSleep() is functionally just an alias for AFFECT_STUN in practice, which the current clients Entity.stunned field already represents (entity_store.h:119) and net_play.gd::_can_process_network_state() already gates movement on (dead/stunned/knock_down) -- already covered, not a gap. (3) IsFaint()/m_isFaint: only setter is chrFaintTest() (PythonCharacterModule.cpp:1087-1105), a Python-bound debug helper (\"FaintTest\", registered alongside chrtestRestoreRenderMode) operating on GetSelectedInstancePtr(); the available 40250 checkout has no root/ Python UI/quest scripts to prove or disprove live-gameplay reachability -- evidence-blocked, left unresolved per SKILL.md do-not-audit-unreachable-code-as-product-behavior rule, no fix attempted. Byproduct finding while tracing IsStun(): CActorInstance::Stun() is only reachable via RecvStunPacket() (PythonNetworkStreamPhaseGame.cpp:1556-1578), which explicitly routes GC_STUN to Die() for the main character and to Stun() only for remote actors; verified this does NOT create a movement.keyboard.motion discrepancy because CanAct() blocks movement identically on IsDead() and IsStun(), and net_play.gd::_can_process_network_state() already blocks movement identically on dead and stunned -- the movement-blocking outcome is already correct parity regardless of which reference path fires. The Die()-vs-Stun() distinction only affects death-system semantics (m_isRealDead, EXP drop, corpse/respawn flow), which is combat.death.exp_drop/combat.affect_status territory and is already tracked there (combat.affect-status.md Remaining #2, equivalence rows 63/67: native GC_STUN only sets stunned=true with no dedicated clear path) -- not re-logged as a new finding to avoid duplicate tracking. No code changed this round; removed the resolved Remaining bullet from manifest.json and movement.keyboard-motion.md, replaced with investigation evidence and citations. Contract stays PARTIAL (root-motion/resource-event-source/sync-hit-death-gate-stacking/real-model-bone-flip items remain open)."}
|
||||
{"time": "2026-09-22T03:15:00Z", "event": "implementation_fix_round", "result": "PARTIAL", "ids": ["movement.keyboard.motion/server-speed-scale-clamp"], "files": ["project/player_controller.gd", "project/keyboard_motion_timeline_test.gd", "audit/contracts/movement.keyboard-motion.md", "audit/manifest.json", "audit/history.jsonl", "audit/remediation-roadmap.md", "audit/reports/coverage.md"], "tests": ["40250 reference source inspection (PASS: InstanceBaseMovement.cpp CInstanceBase::SetMoveSpeed(UINT uMovSpd) only guards uMovSpd>1100 -> 0; otherwise applies uMovSpd/100.0f unclamped)", "extension/src/net/entity_store.cpp EntityStore::motion_move_speed re-read (PASS: already-fixed remote-entity path mirrors the same >1100 -> 0 / mount_vnum!=0 -> 0 guards, no [0.25,3.0]-style band)", "pre-fix player_controller.gd::set_server_speed (FAIL by construction: clampf(moving_speed/100.0, 0.25, 3.0) silently floors/ceils haste or slow stacks outside the reference's 25..300 movSpd band)", "post-fix godot --headless --path project --script keyboard_motion_timeline_test.gd (PASS, incl. new set_server_speed(10/500/1200/100) assertions)", "godot --headless --path project --script test_wasd_steering_parity.gd (PASS)", "godot --headless --path project --script test_no_auto_move_regression.gd (PASS)", "godot --headless --path project --script game_camera_test.gd (PASS)", "godot --headless --path project --script movement_parity_test.gd (PASS)", "godot --headless --path project --script player_move_test.gd (PASS)", "godot --headless --path project --script mouse_controller_test.gd (PASS)", "godot --headless --path project --script test_alignment_parity.gd (PASS)", "godot --headless --path project --script netplay_test.gd (PASS; unrelated mock set_server_speed in netplay_test.gd has no clamp, unaffected)", "git diff --check (PASS)", "audit_ledger.py refresh --write/report --write/validate (PASS)"], "reason": "在同一合同下追查『根运动 vs 连续速度』假设时发现这是假线索——entity_store.cpp::advance_walk_by_motion 与本地 _process() 的位移积分在种类上同构(都是恒速直线插值);真正的差异是 set_server_speed() 把 moving_speed/100.0 塞进无参考依据的 clampf(0.25, 3.0),而参考实现 CInstanceBase::SetMoveSpeed 和本项目已修复的 EntityStore::motion_move_speed 都只有 moving_speed>1100 -> 0 这一个门。移除该私有夹钳,改为 0.0 if moving_speed > 1100 else moving_speed/100.0,两处调用方(net_world.gd、net_play.gd)均不额外夹钳,改动范围限于 player_controller.gd。新增回归断言覆盖旧边界内外和 1100 冻结门。副产品发现:CInstanceBase::SHORSE::SetMoveSpeed 是坐骑上玩家的独立速度设定,只在 IsMounting() 时生效,与远端 mount_vnum!=0 -> 0 的处理方式不同——本轮未下定论,留作独立候选。未修改根运动/AccumulationMovement 适配层、资源与网络事件完整顺序、同步/受击门叠加或真实模型测试,合同保持 PARTIAL。"}
|
||||
{"time": "2026-09-22T06:00:00Z", "event": "port_round", "unit": "UserInterface/PythonPlayerEventHandler.cpp", "ported": ["CPythonPlayerEventHandler::OnMove", "CPythonPlayerEventHandler::OnMoving", "CPythonPlayerEventHandler::OnStop"], "deleted": ["net_play.gd _tick_on_waiting idle FUNC_WAIT resend"], "divergent": ["CPythonPlayerEventHandler::OnWaiting (walking-but-stalled path not ported)"], "needs_live": [], "tests": ["project/netplay_test.gd PASS", "project/keyboard_motion_timeline_test.gd PASS", "project/movement_parity_test.gd PASS", "project/player_move_test.gd PASS"]}
|
||||
{"time":"2026-09-22T12:00:00Z","event":"dead_code_removal","deleted_system_files":106,"deleted_tests":106,"lines_removed":36221,"manifest_refs_removed":76,"contracts_touched":18,"reason":"project/*_system.gd reachable only from their own test_*_parity.gd; not implementations of 40250 behavior (SKILL.md: unreachable code is not evidence)","tests":["full headless Godot suite: 192 PASS, 7 FAIL and 5 render tests hanging in headless, all identical on the pre-deletion tree"]}
|
||||
|
||||
+69
-129
@@ -1414,7 +1414,6 @@
|
||||
"project/ui/ground_items.gd",
|
||||
"project/entity_rules.gd",
|
||||
"project/game_scene.gd",
|
||||
"project/metin_spawn_event_system.gd",
|
||||
"project/mob_drop_scatter.gd"
|
||||
],
|
||||
"symbols": [
|
||||
@@ -1466,7 +1465,6 @@
|
||||
"project/mob_death_drop_test.gd",
|
||||
"project/test_mob_drop_scatter_parity.gd",
|
||||
"project/mob_winding_test.gd",
|
||||
"project/test_metin_spawn_event_parity.gd",
|
||||
"build/extension/net_entity_test",
|
||||
"build/extension/net_classic_session_test",
|
||||
"build/extension/net_classic_wire_test"
|
||||
@@ -1478,13 +1476,14 @@
|
||||
"补齐不可见 race、未知 race/vnum、模型工厂未就绪、真实 drop model/effect/sound 和建筑碰撞的失败矩阵",
|
||||
"验证 ground add/owner/del 与 CG_ITEM_PICKUP→GC_DEL/ITEM_GET/ITEM_UPDATE 的 live 包序、失败、乱序和重连清理",
|
||||
"验证 GC_SHOP_SIGN 空/非空、未知 VID、重复包、私人商店 UI 和换图/断线清理",
|
||||
"把本地掉落散落、活动石头和 owner 保护与 40250 client presentation 分层,不把 custom authority 当 parity"
|
||||
"把本地掉落散落、活动石头和 owner 保护与 40250 client presentation 分层,不把 custom authority 当 parity",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 actor/ground/shop-sign 调用链和当前端 parser/store/view 对照;合同保持 PARTIAL。net_world_vis_test 复现 4 项可见性生命周期失败,本轮仅登记审计结果,未修改实现。",
|
||||
"fingerprints": {
|
||||
"reference": "97dfe247272a6098ce623ceae986732205de3273cb1199377f969faeec8d0ba0",
|
||||
"implementation": "3a7d87cad0ba405495ba51e13feab294af9ebddbde2fb18b5df9c606bbe3af08",
|
||||
"tests": "0100c7c3894330afa222f7a7d6bc60ec38ca08fc981a6d30746deffa5e159298"
|
||||
"implementation": "bdc38d8ef47e8a8f2676f6e9a080c7924a56b88ceb546affeb281dc57243a1d1",
|
||||
"tests": "702ac283f682d937fa8a02c70ca929942b68cacffc7adc686a5779e45f10f178"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1936,8 +1935,7 @@
|
||||
"project/damage_effect.gd",
|
||||
"project/ui/player_view.gd",
|
||||
"project/ui/equip_model.gd",
|
||||
"project/ui/weapon_trace.gd",
|
||||
"project/socket_glow_fx_system.gd"
|
||||
"project/ui/weapon_trace.gd"
|
||||
],
|
||||
"symbols": []
|
||||
},
|
||||
@@ -1964,12 +1962,13 @@
|
||||
"服务端伤害/死亡/重复命中与客户端命中窗的真实包级 fixture",
|
||||
"换图、断线、缺失动作资源和攻击队列清理测试",
|
||||
"WeaponTrace 已按 bound-box 最大长度、局部 Z 和 reach scale 接入 PlayerView;当前仍未证明 native bone matrix 的同一 composite/rotation 坐标语义、远端/怪物覆盖、真实刀光纹理视觉和服务端动作资源",
|
||||
"socket_glow_fx_system.has_trail 目前只有配置字段,没有进入武器刀光渲染链"
|
||||
"socket_glow_fx_system.has_trail 目前只有配置字段,没有进入武器刀光渲染链",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已按 40250 isValidAttacking/HitDataContainer 删除缺失动作攻击数据、空命中窗和缺少 .msm 防御球时的本地合成命中;状态包、命中窗、去重、受击、弓箭 FLY、本地主角伤害飘字和 WeaponTrace 多部件生命周期有回归证据。WeaponTrace 目前通过 weapon_trace.gd 适配层接入,包含武器类型过滤、每个 Weapon/Shield 部件独立 trace、双轨迹时间队列、cubic spline triangle strip、alpha/texture 材质、攻击动作开关、纹理控制入口、bound-box 最大长度/局部 Z/reach scale 和换装清理;AFFECT_GEOMGYEONG 的 1.5/1.0 reach scale 已同时接入刀光与普通攻击扫掠。native 骨骼矩阵坐标语义、远端/怪物覆盖、真实视觉资源及服务端伤害闭环仍不等价。强化配置中的 has_trail 仍是独立未消费字段。",
|
||||
"fingerprints": {
|
||||
"reference": "abf0577e3430979fbf4e1ea85fa637b2f59e798bf57e257060528940045eef43",
|
||||
"implementation": "b835d862fb211a964fb36df0d435247ad120636a81491e9e108b2c545710bba9",
|
||||
"implementation": "6f93c4bcb3aee4af48beee7cff2eb4c5923a3b0bb32eae0f2b132f2873524e8f",
|
||||
"tests": "228e1bb5ebb0ef52822956e3d33d9c51d55cc2090c323300b466f937249e5d3c"
|
||||
}
|
||||
},
|
||||
@@ -2013,8 +2012,7 @@
|
||||
"project/ui/mouse_controller.gd",
|
||||
"project/player_controller.gd",
|
||||
"project/net_play.gd",
|
||||
"project/net_world.gd",
|
||||
"project/alignment_pk_system.gd"
|
||||
"project/net_world.gd"
|
||||
],
|
||||
"symbols": [
|
||||
"EntityRules.is_attackable_instance",
|
||||
@@ -2053,9 +2051,7 @@
|
||||
"tests": [
|
||||
"project/entity_rules_test.gd",
|
||||
"project/target_board_test.gd",
|
||||
"project/test_alignment_pk_parity.gd",
|
||||
"project/test_click_target_effect_parity.gd",
|
||||
"project/test_auto_combat_bot_parity.gd",
|
||||
"project/playable_combat_test.gd",
|
||||
"project/netplay_test.gd"
|
||||
],
|
||||
@@ -2066,13 +2062,14 @@
|
||||
"隐身、复活隐身、视锥、门死亡、裁剪/淡出和迟到实体更新的目标生命周期矩阵",
|
||||
"地图 ATTRIBUTE_BANPK 与实体 in_safe 的实时数据权威和移动/换图更新链",
|
||||
"SetTarget 切换时间窗、OnTargeted/OnUntargeted、飞行目标和 CG_TARGET 顺序",
|
||||
"真实服务端目标包、死亡/删除/乱序/断线重连和目标框清理"
|
||||
"真实服务端目标包、死亡/删除/乱序/断线重连和目标框清理",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成目标攻击资格、目标可选中、目标框和安全区的逐分支静态审计;目标入口已统一接入 CanChangeTarget/CanPickInstance、重复目标窗口和 CG_TARGET(0) 清理,合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "d1c911b8bba1ccd48228a794568e3bc13ffa77ecd7d124d4e442ed9fecfdfb85",
|
||||
"implementation": "9d68120ea53f8da8821803c91ea5065ce208cfd14e0d48b1e1239b39895f9e25",
|
||||
"tests": "2cf38a10e34184c9477f0e7fc7316b6ba201c0adaa4db43a0ce8cb7d6936c1a4"
|
||||
"implementation": "47ddc51bc30196640a8e27ac2286405bc6bd5fc2a25d80b636884382fc0d468a",
|
||||
"tests": "3b20fa82a05fdf13597b631c6463f15d6a303dd7eddf43ed6f65d3e873bce756"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2218,7 +2215,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/combat_status_effect_system.gd",
|
||||
"project/ui/hit_reaction.gd",
|
||||
"project/ui/player_view.gd",
|
||||
"project/ui/mob_view.gd",
|
||||
@@ -2262,10 +2258,8 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/combat.affect-status.md",
|
||||
"tests": [
|
||||
"project/test_combat_status_effect_parity.gd",
|
||||
"project/damage_effect_test.gd",
|
||||
"project/combat_fx_test.gd",
|
||||
"project/test_mob_combat_reaction_parity.gd",
|
||||
"project/test_combat_death_pickup_entry_parity.gd",
|
||||
"project/hit_view_test.gd",
|
||||
"build/extension/net_entity_test",
|
||||
@@ -2278,13 +2272,14 @@
|
||||
"补齐 affect bit 到附着特效、图标、骨骼、stone smoke 和建筑 no-op 的逐位资源矩阵",
|
||||
"统一远端 stunned/knockdown/skill-cancel 的动作和网络状态门控",
|
||||
"修复 hit_view_test 前向 damage 资源/动作锁时序失败",
|
||||
"补齐重复、乱序、duration、死亡、换图、重连和 VID 重用清理测试"
|
||||
"补齐重复、乱序、duration、死亡、换图、重连和 VID 重用清理测试",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 AffectFlagContainer、Actor affect/受击动作、damage/affect 协议和当前 native/GDScript 链的逐分支审计;确认本地状态结算器的数据权威错误,且 hit_view_test 有 1 项失败。合同保持 PARTIAL,本轮仅登记审计结果,未修改实现。",
|
||||
"fingerprints": {
|
||||
"reference": "92ddbb559ef4966bcecc9358beb85f7fd8edec830f833cde7067f0c35eaa2aee",
|
||||
"implementation": "c783877a1a45419d9c8fd143e7dc3ce5cd37838e6c044941d36260d586249386",
|
||||
"tests": "f0e1f4279d7fed8a897eccd9d0978781e4f19c27765d4571138bd0c0f6faefce"
|
||||
"implementation": "0012356c81b291e8bff2f96561efad74ac45ba624c91986ce53309b25abf76cc",
|
||||
"tests": "1c7ab5e0776d4e144a37d2d2e659c02eb259aa0b5caec4111b50b673ef39b112"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2375,7 +2370,6 @@
|
||||
"project/netplay_test.gd",
|
||||
"project/test_skill_inventory_parity.gd",
|
||||
"project/test_taskbar_quickslot_parity.gd",
|
||||
"project/test_status_skill_reset_parity.gd",
|
||||
"project/mobile_gesture_test.gd",
|
||||
"project/playable_combat_test.gd",
|
||||
"project/guild_war_skill_test.gd",
|
||||
@@ -2389,13 +2383,14 @@
|
||||
"CanUseSkill 五类动作门已补齐;仍需把真实 shape/图形动作字段和拒绝副作用接入端到端回归",
|
||||
"POINT_CASTING_SPEED 已暴露并按 40250 __RunCoolTime 修正;仍需真实点变更/冷却回包时序 fixture",
|
||||
"补齐 skill/group/quickslot/cooldown-end 乱序、重复、断线、重连和换图测试",
|
||||
"建立全部技能 ID/grade/.msk 公式/动作/目标追加和服务端 damage 顺序快照"
|
||||
"建立全部技能 ID/grade/.msk 公式/动作/目标追加和服务端 damage 顺序快照",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 技能数据、三层施放校验、CanUseSkill、casting-speed 冷却公式、快捷栏、普通/公会技能发送入口、skill/group/cooldown 协议和 FUNC_SKILL→CG_USE_SKILL 动作/意图包序的逐分支审计;CanUseSkill 五类动作门、POINT_CASTING_SPEED 桥接和公会技独立路径已实现,但真实拒绝/乱序/跨生命周期 fixture、完整动作资源包序和服务端 damage 顺序仍使合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "c38e930585edcd35a8e0911f10f3fb6694a39bc7735a3bac0b3d4eea157c9bcb",
|
||||
"implementation": "233c5cd7ee94ba2fa9ecb1a833a3ecad3e805ade4a87333243480199b18e7d4b",
|
||||
"tests": "82695ce797fd9e07f6278d8beb3cab35441e8cd59be43e2be6920236d3736369"
|
||||
"tests": "e3b00c87a54d1af4effeef310d90de4c72dacf7a7323bab005f6850ace556bb5"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2567,7 +2562,6 @@
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/consumable_system.gd",
|
||||
"project/item_split_system.gd",
|
||||
"project/ui/quickbar.gd",
|
||||
"project/ui/inventory_ui.gd",
|
||||
"project/ui/shop_ui.gd",
|
||||
@@ -2578,7 +2572,6 @@
|
||||
"extension/src/net/entity_store.cpp",
|
||||
"extension/tests/net_classic_session_test.cpp",
|
||||
"project/test_consumables_parity.gd",
|
||||
"project/test_item_split_parity.gd",
|
||||
"project/test_taskbar_quickslot_parity.gd",
|
||||
"project/test_skill_inventory_parity.gd",
|
||||
"project/skill_test.gd",
|
||||
@@ -2632,7 +2625,6 @@
|
||||
"contract": "audit/contracts/item.consumable-action.md",
|
||||
"tests": [
|
||||
"project/test_consumables_parity.gd",
|
||||
"project/test_item_split_parity.gd",
|
||||
"project/test_taskbar_quickslot_parity.gd",
|
||||
"project/complex_item_drop_test.gd",
|
||||
"project/netplay_test.gd"
|
||||
@@ -2645,13 +2637,14 @@
|
||||
"堆叠拆分已统一为 CG_ITEM_MOVE 请求并等待服务器确认;快捷出售已统一为 CG_SHOP SELL/SELL2,价格、金币和物品变化仍待真实回包 fixture",
|
||||
"消耗品 native action gate 与装备类型门已补齐;物品音效和 SendSequence 的资源/包序证据仍缺",
|
||||
"断线、换图、重复回包、请求失败和延迟期间的状态清理/回滚",
|
||||
"快捷栏乐观更新和页面取模差异已修复;quickbar 资源泄漏、完整生命周期清理和真实服务器确认 fixture 仍待补齐;complex_item_drop_test 的购买模式卖出目标判定已修复"
|
||||
"快捷栏乐观更新和页面取模差异已修复;quickbar 资源泄漏、完整生命周期清理和真实服务器确认 fixture 仍待补齐;complex_item_drop_test 的购买模式卖出目标判定已修复",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已将拆分、快捷出售和快捷栏增删交换统一到 request→server/GC 确认路径,并修复购买模式误发出售请求;快捷栏使用、消耗品真实反馈包序、音效/sequence 和断线清理仍使合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "f364d4bbba79ef514f5f8aeccbf34a3d6adea8fcacf4cb82664476b6c29ebbfe",
|
||||
"implementation": "468b4155a11204d546d49ca92afea109ced58669c2ac2286f92c742f538a49e7",
|
||||
"tests": "5fe55c9e41140a0d3deb270df8cecb785d45d8eed3e6769d5a24b907d772e66c"
|
||||
"implementation": "20983090cb18e010bcd3fd674166491d589f32335253d4b19241c556431cf3b2",
|
||||
"tests": "360f28348ea118717464fd3ebe179791a95377b658f60364ff7286a041059d97"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2815,13 +2808,7 @@
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/ui/refine_ui.gd",
|
||||
"project/refine_effect_system.gd",
|
||||
"project/item_attr_system.gd",
|
||||
"project/item_enchant_system.gd",
|
||||
"project/jewelry_socket_system.gd",
|
||||
"project/costume_system.gd",
|
||||
"project/costume_attr_transfer_system.gd",
|
||||
"project/wardrobe_transmog_system.gd",
|
||||
"project/ui/equip_model.gd",
|
||||
"extension/src/net/m2_client.cpp",
|
||||
"extension/src/net/m2_client.h",
|
||||
@@ -2867,13 +2854,7 @@
|
||||
"contract": "audit/contracts/item.refine-socket-costume.md",
|
||||
"tests": [
|
||||
"project/test_refine_parity.gd",
|
||||
"project/test_refine_effect_parity.gd",
|
||||
"project/test_item_attr_parity.gd",
|
||||
"project/test_item_enchant_manager_parity.gd",
|
||||
"project/test_jewelry_socket_parity.gd",
|
||||
"project/test_costume_system_parity.gd",
|
||||
"project/test_costume_attr_transfer_parity.gd",
|
||||
"project/test_wardrobe_transmog_parity.gd",
|
||||
"extension/tests/net_classic_session_test.cpp",
|
||||
"extension/tests/net_entity_test.cpp",
|
||||
"extension/tests/net_bounds_test.cpp"
|
||||
@@ -2887,13 +2868,14 @@
|
||||
"把时装穿戴、属性、过期和 bonus 接入服务端 item/affect/point 与 actor armor/weapon/hair 更新链",
|
||||
"让强化等级/socket/type/subtype 驱动实际装备模型、强化特效 attach/clear,并覆盖资源缺失清理",
|
||||
"补充拒绝、断线、重复/乱序回包、换图、过期和服务端回滚测试",
|
||||
"将 wardrobe/transmog 自定义扩展与 40250 parity 分开标注,除非补齐对应服务端协议和角色部件同步"
|
||||
"将 wardrobe/transmog 自定义扩展与 40250 parity 分开标注,除非补齐对应服务端协议和角色部件同步",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "本轮已修复 M2Client::refine 对 40250 取消 sentinel(255,255) 的错误拦截,并补充边界/EntityStore 回归;属性、socket、时装和幻化仍绕过服务器权威回包,合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "6cc67309be64986008984215add763db78e2990b665274500cf4e76661b782e8",
|
||||
"implementation": "176ad923087d84b8f11dee97d2bd198c495d91014d8b720d3bf58acd0bd26fb8",
|
||||
"tests": "6bb13ce9e81271dfa30eaaab03c5cf5e801ef22965c32d4b4d38af95f6874bfb"
|
||||
"implementation": "0dceaccac8bd37f946846dfd7bebf7cb38563896dc2d24ec7eed3560854e2b31",
|
||||
"tests": "785b8529135d9169573531c379e0997d61a61acfffb40dbf1bc8f715ee3813de"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -2935,8 +2917,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/npc_shop_system.gd",
|
||||
"project/private_shop_system.gd",
|
||||
"project/ui/shop_ui.gd",
|
||||
"project/ui/private_shop_ui.gd",
|
||||
"project/net_play.gd",
|
||||
@@ -2983,11 +2963,9 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/npc.dialog-shop.md",
|
||||
"tests": [
|
||||
"project/test_npc_shop_parity.gd",
|
||||
"project/test_npc_shop_flow.gd",
|
||||
"project/test_npc_dialog_shop_ui_parity.gd",
|
||||
"project/private_shop_ui_test.gd",
|
||||
"project/test_private_shop_bundle_parity.gd",
|
||||
"project/shop_rules_test.gd",
|
||||
"project/p8_test.gd",
|
||||
"project/complex_item_drop_test.gd",
|
||||
@@ -3004,13 +2982,14 @@
|
||||
"为买卖请求补齐动作门控、实际库存/anti flag/商店状态校验和服务器结果回写",
|
||||
"移除 live 路径对硬编码 NPC 库存与本地金币/背包 helper 的权威依赖",
|
||||
"补充 START/START_EX/UPDATE/ERROR/END、拒绝、售罄、断线、重连和乱序包的端到端测试",
|
||||
"补充个人商店死亡/骑乘/战斗/bundle/重复源格校验和服务端拒绝清理测试"
|
||||
"补充个人商店死亡/骑乘/战斗/bundle/重复源格校验和服务端拒绝清理测试",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 与当前端的 NPC 点击、脚本对话、普通/多货架商店、买卖、个人商店招牌和摆摊提交逐分支/协议/状态审计。协议骨架和本地 UI 测试存在,但多货架更新、个人商店点击/状态、动作门控及本地直改旁路使合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "2fa18ff8979d5c03e2daf44129702e3a1b26bb9e6f7b3b585f6fa55ac898e765",
|
||||
"implementation": "5373e00e8785a5fa8a98f8c361fabc4b1cdc3625093811d9a74082957126db77",
|
||||
"tests": "3829ff07408c019b3a4a65fa8d4f283fe723342bcc2d1ed51ec4993d7f9c1874"
|
||||
"implementation": "4adc63160de3b1b21f51c11d6c512d7f550c976a50c49be46784c967eca574ca",
|
||||
"tests": "c4a51e1a265294adaf10693271297d832ba2cc7ef6de6e6125bded961cea7594"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3109,7 +3088,6 @@
|
||||
"project/guild_mark_tail_test.gd",
|
||||
"project/test_whisper_chat_parity.gd",
|
||||
"project/chat_mobile_ui_test.gd",
|
||||
"project/test_chat_hyperlink_dice_parity.gd",
|
||||
"build/extension/net_entity_test",
|
||||
"build/extension/net_classic_session_test"
|
||||
],
|
||||
@@ -3122,13 +3100,14 @@
|
||||
"复现入站表情解析、跨帝国文字转换、辱骂过滤和 40250 延迟聊天队列",
|
||||
"统一公共聊天颜色和文本前缀处理,发送失败不能生成成功回显",
|
||||
"让聊天/信息尾标使用同一权威实体生命周期,补齐真实字体度量、屏幕投影和死亡/换图清理",
|
||||
"补充重复/乱序/断线/重连、未知类型、超长文本和 whisper 错误端到端测试"
|
||||
"补充重复/乱序/断线/重连、未知类型、超长文本和 whisper 错误端到端测试",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 与当前端的公共聊天、私聊、忽略、聊天气泡、名字/称号/等级/公会名尾标及文本布局逐分支/协议/状态审计。已修正 whisper mode 映射、截断 GC_WHISPER 拒绝逻辑,并将 live ChatUI 的普通/GM whisper 接入独立会话和 ignore 判断;基础网络与静态尾标测试存在,但窗口通知、公共提示/过滤/表情/颜色和 Godot 字体布局差异使合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "2b70c64e18344d4f465354239899289d5df2f7b9c38e165c66d553f790e2859e",
|
||||
"implementation": "cd02d44596b377534a4200e0ef7002b3c6de8e7c328fbdd96afc7e9ed8a6cb8f",
|
||||
"tests": "47305f945c76eb3c208880fd4860775262489bc2dc5dd7d42eb3d136e28761ab"
|
||||
"tests": "83f508464e76c7b6eee0796af45dedabeea3fbe2a2c235ad5efbad753c39842e"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3175,12 +3154,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/party_management_system.gd",
|
||||
"project/guild_skill_system.gd",
|
||||
"project/guild_war_system.gd",
|
||||
"project/guild_war_observer_arena_system.gd",
|
||||
"project/messenger_system.gd",
|
||||
"project/guild_mark_uploader_system.gd",
|
||||
"project/ui/party_ui.gd",
|
||||
"project/ui/guild_ui.gd",
|
||||
"project/ui/friend_ui.gd",
|
||||
@@ -3241,16 +3214,9 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/social.party-guild-messenger.md",
|
||||
"tests": [
|
||||
"project/test_party_management_parity.gd",
|
||||
"project/test_messenger_parity.gd",
|
||||
"project/test_guild_mark_uploader_parity.gd",
|
||||
"project/guild_mark_test.gd",
|
||||
"project/guild_mark_tail_test.gd",
|
||||
"project/test_guild_war_parity.gd",
|
||||
"project/test_guild_war_observer_arena_parity.gd",
|
||||
"project/test_guild_skill_parity.gd",
|
||||
"project/guild_creation_ui_test.gd",
|
||||
"project/test_privilege_empire_guild_parity.gd",
|
||||
"project/p8_test.gd",
|
||||
"extension/tests/net_entity_test.cpp",
|
||||
"extension/tests/net_classic_session_test.cpp"
|
||||
@@ -3264,13 +3230,14 @@
|
||||
"补充公会权限拒绝、离会/踢人、公告/技能/金钱回包和邀请清理",
|
||||
"补充公会战声明/开始/结束/list/point 的连续事件与服务端奖励验证",
|
||||
"补充独立 mark client 的握手、index、CRC、压缩 block、损坏、断线、重试和角色刷新测试",
|
||||
"上传会徽/战旗必须验证真实用户资源、权限和服务端完成回包,避免默认占位图成为成功状态"
|
||||
"上传会徽/战旗必须验证真实用户资源、权限和服务端完成回包,避免默认占位图成为成功状态",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 40250 与当前端的组队、公会、好友/Messenger、会徽/战旗及相关 UI/native 回包链审计。live native 主路径较完整,但本地队伍/技能/公会战/Messenger/会徽 helper 仍存在直接状态旁路,真实权限拒绝、mark 独立连接和重连清理证据不足,合同保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "c0ba3dce2da7c2bd6c1f934ebd66eedaf0d37bc0d3bf99b22e401b939a150bc4",
|
||||
"implementation": "bf62ad6be63031d6630d7f4d1be497469f4a42ea8137be95b066864cd566f55c",
|
||||
"tests": "89f4d155ee7d3b4f3457ef2114aed642ef6030a7a7c226d5731fcc20cd2ba2dd"
|
||||
"implementation": "0be944c07b20317ca684d3219d86421e4e8a34e3610daf587ca0c1fb7671a660",
|
||||
"tests": "0377c649a21cdd049d7a76e9b241ed11eba0e16ba057f7cec27f583702c2cf94"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -3311,8 +3278,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/player_trade_exchange_system.gd",
|
||||
"project/safebox_storage_keeper_system.gd",
|
||||
"project/ui/exchange_ui.gd",
|
||||
"project/ui/safebox_ui.gd",
|
||||
"project/ui/mall_ui.gd",
|
||||
@@ -3356,18 +3321,19 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/social.exchange-safebox.md",
|
||||
"tests": [],
|
||||
"last_test_result": "PARTIAL"
|
||||
"last_test_result": "NOT_RUN"
|
||||
},
|
||||
"remaining": [
|
||||
"补齐 GC_EXCHANGE/GC_SAFEBOX/GC_MALL 的拒绝、乱序、断线和回包回滚测试",
|
||||
"将交易和仓库 UI 的 optimistic 状态改为由 native 回包重建并验证源位置",
|
||||
"区分并隔离本地 helper,避免将交易结算、密码、库存和金条规则当作客户端 authority",
|
||||
"补齐 exchange 动作门控、真实服务端物品/金币校验和商城 checkout 失败清理"
|
||||
"补齐 exchange 动作门控、真实服务端物品/金币校验和商城 checkout 失败清理",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成交易、仓库、安全箱、商城和金币确认的逐分支/协议/状态审计;native 主链存在但与 40250 仍是 PARTIAL,本轮未修改实现。",
|
||||
"fingerprints": {
|
||||
"reference": "8497886941be7e41b6b1960b22fc8e07b1c0fe65c4a032b13d662191b06a0404",
|
||||
"implementation": "d2cad2b8bdf7fc421478157ea0085bef07a4979d3d3799ff81823e1dd16216ab",
|
||||
"implementation": "23a59fe47d21a602f5baff19828f9db8f4bd89495bcd1a14922a7476ee5906a2",
|
||||
"tests": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
},
|
||||
@@ -3417,18 +3383,13 @@
|
||||
"project/ui/char_status_ui.gd",
|
||||
"project/ui/atlas_ui.gd",
|
||||
"project/ui/minimap.gd",
|
||||
"project/atlas_navigation_system.gd",
|
||||
"project/game_scene.gd",
|
||||
"extension/src/net/m2_client.cpp",
|
||||
"extension/src/net/m2_client.h",
|
||||
"extension/src/net/entity_store.cpp",
|
||||
"extension/src/net/entity_store.h",
|
||||
"extension/src/net/classic/classic_session.cpp",
|
||||
"extension/src/net/classic/classic_session.h",
|
||||
"project/biologist_quest_system.gd",
|
||||
"project/dynamic_bounty_event_system.gd",
|
||||
"project/event_manager_system.gd",
|
||||
"project/metin_spawn_event_system.gd"
|
||||
"extension/src/net/classic/classic_session.h"
|
||||
],
|
||||
"symbols": [
|
||||
"EntityStore::apply",
|
||||
@@ -3477,12 +3438,13 @@
|
||||
"补齐真实 server 脚本序列与中断回归;script-button、DONE、ESC/CANCEL answer 语义已闭合",
|
||||
"验证 RUN_CINEMA 的有效 .msc 资源序列、过场消费者和中断清理;验证地图信号在 Minimap/Atlas 的切图与多点生命周期",
|
||||
"补齐对话确认超时、fade/camera/cinema 中断、断线和重连清理测试",
|
||||
"隔离生物学家/悬赏/活动 helper,避免其本地规则冒充 40250 客户端实现"
|
||||
"隔离生物学家/悬赏/活动 helper,避免其本地规则冒充 40250 客户端实现",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成任务状态、事件脚本、对话、HUD、地图导航和过场链的逐分支/协议/时序审计;GC_QUEST_INFO END、script-button 任务索引 sentinel、DONE close-only/DoneEvent、ESC/CANCEL answer 分支和 RUN_CINEMA 缺失资源分支已按 40250 修复,其他明确差异继续保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "e05974ea414ca0d1bdcec3298119380ec35bfd20637a9c8e48588246347fc364",
|
||||
"implementation": "5aa1707764f5a74db510210bfd8803a9e90e0a4d989202795fe506d1f29a8395",
|
||||
"implementation": "71343d79bbcf40cf9437adac21bc5d6cef35b568e390445f5824ad9bba35e28f",
|
||||
"tests": "a65c31ca4ade9fe4359f1238ed7080a5a50c3a336b75a9d9ee2a1e2f7faeb02a"
|
||||
}
|
||||
},
|
||||
@@ -3518,12 +3480,6 @@
|
||||
"project/dungeon_state.gd",
|
||||
"project/ui/dungeon_result_ui.gd",
|
||||
"project/game_scene.gd",
|
||||
"project/world_boss_system.gd",
|
||||
"project/dungeon_ranking_system.gd",
|
||||
"project/spider_dungeon_system.gd",
|
||||
"project/spider_dungeon_key_system.gd",
|
||||
"project/flame_dungeon_razador_system.gd",
|
||||
"project/endless_spire_dungeon_system.gd",
|
||||
"extension/src/net/entity_store.cpp",
|
||||
"extension/src/net/entity_store.h",
|
||||
"extension/src/net/m2_client.cpp",
|
||||
@@ -3555,18 +3511,19 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/world.dungeon-activity.md",
|
||||
"tests": [],
|
||||
"last_test_result": "PARTIAL"
|
||||
"last_test_result": "NOT_RUN"
|
||||
},
|
||||
"remaining": [
|
||||
"接通 alarm_requested 到等价的 compass/mse 资源效果,并验证方向、初次提示和 20 秒重复提示",
|
||||
"补齐 GC_DUNGEON/DUNGEON_RESULT 的 live 回包、重复/乱序、拒绝、断线、切图和重连测试",
|
||||
"确认 server cm 到 Godot 世界坐标的轴向、地图基准和到达阈值实机一致",
|
||||
"把 Boss、排行和具体副本 helper 与 40250 client parity 分开,禁止本地 authority 冒充客户端等价实现"
|
||||
"把 Boss、排行和具体副本 helper 与 40250 client parity 分开,禁止本地 authority 冒充客户端等价实现",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 GC_DUNGEON 目标点、结果窗口、地图事件及本地 Boss/排行/副本 helper 的逐分支、协议、资源和时序审计;目标状态算法接近参考,但 compass 副作用未接通,本地 authority 不能视为 40250 客户端实现。",
|
||||
"fingerprints": {
|
||||
"reference": "66b5e63a273e45873bf4c4b90c8b658a9f073ba425de6f275d622b3c47fbac99",
|
||||
"implementation": "c4885c44a33a107d3095a20b988f26a5a62d50814514e34ffb03c86bfa7a745d",
|
||||
"implementation": "f962e7e5f470f447024073009b195aacf877cfbcbf624aeb88cf13f9e3646dc0",
|
||||
"tests": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
},
|
||||
@@ -3605,10 +3562,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/fishing_mining_system.gd",
|
||||
"project/fishing_rod_reel_system.gd",
|
||||
"project/fishing_cooking_camp_system.gd",
|
||||
"project/mining_refinery_smelt_system.gd",
|
||||
"project/net_play.gd",
|
||||
"project/net_world.gd",
|
||||
"extension/src/metin2_world.cpp",
|
||||
@@ -3649,18 +3602,19 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/world.fishing-mining.md",
|
||||
"tests": [],
|
||||
"last_test_result": "PARTIAL"
|
||||
"last_test_result": "NOT_RUN"
|
||||
},
|
||||
"remaining": [
|
||||
"补齐 CanFishing/持竿/持镐动作门控、服务端拒绝和角色消失/重连测试",
|
||||
"验证 GetFishingRot 的轴向、MapCoord heading 和全地图 water attribute/水高单位",
|
||||
"让 GC_DIG_MOTION 按 count 复现多个 dig motion,并验证目标缺失、动作完成和中断清理",
|
||||
"把钓鱼收益、烹饪、营火、采矿、熔炼和宝石脚本标记为 custom/server authority,禁止冒充 40250 client parity"
|
||||
"把钓鱼收益、烹饪、营火、采矿、熔炼和宝石脚本标记为 custom/server authority,禁止冒充 40250 client parity",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成钓鱼输入/水面扫描、GC_FISHING、GC_DIG_MOTION、地图水面和当前端生活技能 helper 的逐分支、协议、状态与资源审计;协议骨架和部分算法接近参考,但 live 动作/门控/清理证据不足,本地收益脚本不是 40250 客户端 authority。",
|
||||
"fingerprints": {
|
||||
"reference": "770f14f2d2bfdf025b471dbc90280f891671ea898faef52d4112684934f5bdb7",
|
||||
"implementation": "6be8a56d9630a7c8aa785ff2981dd46ed5a0b08b3fa097a20f55a1a4d31d768f",
|
||||
"implementation": "e9c3c25e1e61db656451f5a091ecf1365f54f01ee7a94b8098f5e625d67dded8",
|
||||
"tests": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
},
|
||||
@@ -3697,14 +3651,6 @@
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/horse_system.gd",
|
||||
"project/horse_combat_system.gd",
|
||||
"project/horse_level_growth_system.gd",
|
||||
"project/pet_companion_system.gd",
|
||||
"project/classic_pet_system.gd",
|
||||
"project/polymorph_system.gd",
|
||||
"project/polymorph_marble_system.gd",
|
||||
"project/mounted_combat_skill_system.gd",
|
||||
"project/net_play.gd",
|
||||
"project/net_world.gd",
|
||||
"project/ui/equip_model.gd",
|
||||
@@ -3740,18 +3686,19 @@
|
||||
"evidence": {
|
||||
"contract": "audit/contracts/world.mount-pet-polymorph.md",
|
||||
"tests": [],
|
||||
"last_test_result": "PARTIAL"
|
||||
"last_test_result": "NOT_RUN"
|
||||
},
|
||||
"remaining": [
|
||||
"补齐 mount_vnum/GC_MOUNT 到实际 horse actor/model attach/detach 的 live 链和位置清理",
|
||||
"验证骑乘 motion root、300/1200 度旋转速度、马等级攻击门和 weapon mode 的 live 回包时序",
|
||||
"把变身 affect/shape/装备遮挡接入 native entity 或明确标为缺失,不用本地 helper 代替",
|
||||
"将宠物、马匹成长/耐力/马上技能和伤害脚本与 40250 client parity 分离,禁止 custom authority 冒充等价实现"
|
||||
"将宠物、马匹成长/耐力/马上技能和伤害脚本与 40250 client parity 分离,禁止 custom authority 冒充等价实现",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 mount_vnum/GC_MOUNT、骑乘动作/攻击门、变身和当前端宠物/马匹 helper 的逐分支、协议、资源和时序审计;网络字段与部分门控存在,但实际坐骑模型挂接和变身 native 闭环缺失,本地宠物/成长/技能规则不是 40250 客户端 authority。",
|
||||
"fingerprints": {
|
||||
"reference": "5ef243a1ff134dfc8afff02136d104daf0a0ac12eca781a1c476b53f7da9ff19",
|
||||
"implementation": "47780fc336fe531fea973aa9196d587b581aabb2a8dfe00bd10a6d275ce98b4a",
|
||||
"implementation": "e69e964433af7177390e558ef32087425386bf6923a9408d457c48644c4fc6ad",
|
||||
"tests": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
},
|
||||
@@ -4064,7 +4011,6 @@
|
||||
"formats/environment.cpp",
|
||||
"formats/environment.h",
|
||||
"project/game_scene.gd",
|
||||
"project/weather_daynight_system.gd",
|
||||
"project/fx/weather.gd"
|
||||
],
|
||||
"symbols": [
|
||||
@@ -4099,7 +4045,6 @@
|
||||
"project/environment_test.gd",
|
||||
"project/skybox_test.gd",
|
||||
"project/p9_test.gd",
|
||||
"project/test_weather_daynight_parity.gd",
|
||||
"extension/tests/net_entity_test.cpp",
|
||||
"project/gamescene_test.gd",
|
||||
"project/netbridge_test.gd"
|
||||
@@ -4111,13 +4056,14 @@
|
||||
"修正/验证 40250 线性 fog near/far/color 与 HTP/STP/terrain 的参数和时序",
|
||||
"补齐 DayMode/PRESERVE_DayMode 正式环境切换;WeatherDayNightSystem 的自动地图预设继续隔离,不能替代服务器 xmas_snow 命令",
|
||||
"对天空 transition、云 plane、SnowEnvironment 池和真实渲染顺序增加参数/screenshot oracle",
|
||||
"增加重复加载、快速切图、暂停恢复、资源缺失和环境/粒子清理测试"
|
||||
"增加重复加载、快速切图、暂停恢复、资源缺失和环境/粒子清理测试",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成 .msenv、天空/云、双方向光、fog、天气粒子、服务器 xmas_snow 命令和正式场景过滤的逐分支审计;命令链与四张排除地图已有回归,但 SnowEnvironment 池、DayMode、filter/lens flare/wind、线性 fog 仍与 40250 不一致或缺失,故保持 PARTIAL。",
|
||||
"fingerprints": {
|
||||
"reference": "1cffc55eb356a522049e4f7bc36595ea968ad1e0ccd7780486064a3e250cc36b",
|
||||
"implementation": "dfc0fe4b13645b06daeea26f517d813a8c8ebb4cfcb2db19ebe2ee7e8f573c7c",
|
||||
"tests": "05fd8d3202d9774f7043311e8615e1210a09cc579f1346eb2fb9ebbfec339b5b"
|
||||
"implementation": "81e6a81489baf9f90e830458212910db6feaa713508d173236d2d255446aae53",
|
||||
"tests": "fa1ee00144332c33a93da2f94371a0b3602c46271356aa78b243d782aaa71c65"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -4502,7 +4448,6 @@
|
||||
"project/audio_miles_test.gd",
|
||||
"project/ambience_test.gd",
|
||||
"project/bgm_test.gd",
|
||||
"project/test_bgm_jukebox_parity.gd",
|
||||
"project/app_flow_lifecycle_test.gd",
|
||||
"project/system_option_ui_test.gd",
|
||||
"project/rendering_scenario_test.gd"
|
||||
@@ -4513,13 +4458,14 @@
|
||||
"验证真实 3D 播放实例不会绕过 master SFX,并补设备/实例路径的后台静音回归",
|
||||
"验证 BGM 多实例淡入/限幅淡出/全量淡出/加载失败回滚状态机",
|
||||
"验证 3D attenuation、实例池耗尽、远端动作音效和完整销毁顺序",
|
||||
"验证流式地图快速切换、环境声来源删除和退出时无悬挂播放器"
|
||||
"验证流式地图快速切换、环境声来源删除和退出时无悬挂播放器",
|
||||
"2026-09-22 删除了只被自身测试引用的 *_system.gd 及其 test_*_parity.gd;原来引用它们的实现/证据不再成立,需按 40250 源码单元重新移植"
|
||||
],
|
||||
"notes": "已完成首轮逐分支审计;基础音量/监听器/环境声/动作音效路径存在,后台 BGM/SFX 同时静音恢复与退出 Audio 缓存清理已有回归,但 Miles 实例池和 BGM 逐帧状态机仍不等价。",
|
||||
"fingerprints": {
|
||||
"reference": "1a8a9232bcc63724814d15df99f211ddfe67a28fcb2052bb4c84ad79373bdfef",
|
||||
"implementation": "f4c3fed1f7cbf08c1032c536927a689a9a1b71b1c431de2afb3c0041ee577315",
|
||||
"tests": "a7ca9e4555b71f92776b56669a0b74e443dc2aaab78a2f208c86f9fc4bc75bfc"
|
||||
"tests": "96a0171f670842fc52b665ae9fcae3cb30ef0046ef147836ca7f586e21646aab"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -4618,13 +4564,7 @@
|
||||
"symbols": []
|
||||
},
|
||||
"implementation": {
|
||||
"files": [
|
||||
"project/offline_bazaar_market_system.gd",
|
||||
"project/mail_system.gd",
|
||||
"project/dynamic_bounty_event_system.gd",
|
||||
"project/dragon_soul_system.gd",
|
||||
"project/solo_guild_domain_system.gd"
|
||||
],
|
||||
"files": [],
|
||||
"symbols": []
|
||||
},
|
||||
"equivalence": {},
|
||||
@@ -4635,11 +4575,11 @@
|
||||
"last_test_result": "NOT_RUN"
|
||||
},
|
||||
"remaining": [],
|
||||
"notes": "完整功能清单首批合同;尚未完成 40250 逐分支等价审计。",
|
||||
"notes": "2026-09-22 所列当前端独有功能(*_system.gd,仅被自身测试引用)已全部删除;按 SKILL.md,没有 40250 对应的逻辑属于缺陷,不再在此登记新条目。",
|
||||
"exclusion_reason": "在指定 40250 ClientVS22 source 中没有可达对应行为;记录该当前端扩展以防止漏审,但不计入 40250 等价率。",
|
||||
"fingerprints": {
|
||||
"reference": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"implementation": "fdaf946a6bffa5e914dfe7f40c2bbd42dc00e64d43e60231e9290021f14cbba2",
|
||||
"implementation": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"tests": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ python3 .agents/skills/metin2-40250-parity-audit/scripts/port_map.py queue --lim
|
||||
| 批次 | 内容 | 状态 |
|
||||
| --- | --- | --- |
|
||||
| 0 | 工具:参考根解析、缺失文件报错、`port_map.py`、构建/测试入口 | 完成 2026-09-22 |
|
||||
| 1 | 删除只被自身测试引用的 `project/*_system.gd` 与其 `test_*_parity.gd`,清除 manifest 中对应证据 | 待确认删除清单 |
|
||||
| 1 | 删除只被自身测试引用的 `project/*_system.gd` 与其 `test_*_parity.gd`,清除 manifest 中对应证据 | 完成 2026-09-22(106+106 个文件) |
|
||||
| 2 | P0 角色/移动单元(并行 worktree) | 未开始 |
|
||||
| 3 | P1 战斗/技能 → P2 游戏阶段封包 → P3 物品与 Python UI | 未开始 |
|
||||
| 4 | `NEEDS_LIVE` 真服验证批 | 未开始 |
|
||||
|
||||
@@ -24,10 +24,10 @@ Total contracts: 45
|
||||
|
||||
## Pending branch items
|
||||
|
||||
- Total: 224
|
||||
- P0: 93
|
||||
- P1: 118
|
||||
- P2: 13
|
||||
- Total: 241
|
||||
- P0: 94
|
||||
- P1: 132
|
||||
- P2: 15
|
||||
- P3: 0
|
||||
- Routing: see `audit/remediation-roadmap.md`
|
||||
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
# alignment_pk_system.gd —— Metin2 40250 善恶值与名望头衔奖惩系统 1:1
|
||||
# 对照 40250 服务端 char.cpp:1190-1205, char_battle.cpp:UpdateAlignment, root/localeinfo.py:GetAlignmentTitleName
|
||||
class_name AlignmentPkSystem
|
||||
extends RefCounted
|
||||
|
||||
signal alignment_changed(old_val: int, new_val: int, title: String)
|
||||
signal title_changed(old_title: String, new_title: String)
|
||||
signal items_dropped_on_death(dropped_items: Array)
|
||||
signal zen_bean_consumed(cleared_amount: int, current_alignment: int)
|
||||
|
||||
# 40250 官方善恶值极值 (内部数值 -200000 ~ +200000, 显示数值 -20000 ~ +20000)
|
||||
const MIN_REAL_ALIGNMENT := -200000
|
||||
const MAX_REAL_ALIGNMENT := 200000
|
||||
|
||||
const VNUM_ZEN_BEAN := 70102 # 禅豆 (消减罪孽值)
|
||||
const ZEN_BEAN_CLEAR_POINTS := 500 # 每次消除 500 显示点数 (5000 内部点数)
|
||||
|
||||
# 9 大官方经典头衔段位表 (40250 localeinfo.py / locale_game.txt)
|
||||
const TITLES: Array = [
|
||||
{"threshold": 12000, "name": "崇高骑士", "en_name": "Chivalric", "is_evil": false},
|
||||
{"threshold": 8000, "name": "尊贵贵族", "en_name": "Noble", "is_evil": false},
|
||||
{"threshold": 4000, "name": "正义良民", "en_name": "Good", "is_evil": false},
|
||||
{"threshold": 1000, "name": "友好伙伴", "en_name": "Friendly", "is_evil": false},
|
||||
{"threshold": 0, "name": "中立行者", "en_name": "Neutral", "is_evil": false},
|
||||
{"threshold": -3999, "name": "好斗狂徒", "en_name": "Aggressive","is_evil": true},
|
||||
{"threshold": -7999, "name": "狡诈恶徒", "en_name": "Fraudulent","is_evil": true},
|
||||
{"threshold": -11999,"name": "险恶凶手", "en_name": "Malicious", "is_evil": true},
|
||||
{"threshold": -20000,"name": "残忍魔头", "en_name": "Cruel", "is_evil": true}
|
||||
]
|
||||
|
||||
var real_alignment: int = 0 # 内部实际值 (-200000 ~ +200000)
|
||||
|
||||
# 获取玩家当前对外显示的善恶值 (40250: sAlignment = m_iAlignment / 10)
|
||||
func get_alignment() -> int:
|
||||
return int(real_alignment / 10)
|
||||
|
||||
# 根据善恶值获取官方 1:1 头衔名称 (40250 localeinfo.py:GetAlignmentTitleName)
|
||||
static func get_title_name(alignment: int) -> String:
|
||||
if alignment >= 12000:
|
||||
return "崇高骑士"
|
||||
elif alignment >= 8000:
|
||||
return "尊贵贵族"
|
||||
elif alignment >= 4000:
|
||||
return "正义良民"
|
||||
elif alignment >= 1000:
|
||||
return "友好伙伴"
|
||||
elif alignment >= 0:
|
||||
return "中立行者"
|
||||
elif alignment > -4000:
|
||||
return "好斗狂徒"
|
||||
elif alignment > -8000:
|
||||
return "狡诈恶徒"
|
||||
elif alignment > -12000:
|
||||
return "险恶凶手"
|
||||
else:
|
||||
return "残忍魔头"
|
||||
|
||||
# 检查当前是否为红名/恶名
|
||||
func is_evil() -> bool:
|
||||
return get_alignment() < 0
|
||||
|
||||
# 更新善恶值 (40250 char_battle.cpp:UpdateAlignment)
|
||||
# amount 为内部值加减 (如传入 100 表示内部 +100)
|
||||
func update_real_alignment(amount: int) -> void:
|
||||
var old_display = get_alignment()
|
||||
var old_title = get_title_name(old_display)
|
||||
|
||||
real_alignment = clampi(real_alignment + amount, MIN_REAL_ALIGNMENT, MAX_REAL_ALIGNMENT)
|
||||
|
||||
var new_display = get_alignment()
|
||||
var new_title = get_title_name(new_display)
|
||||
|
||||
if old_display != new_display:
|
||||
alignment_changed.emit(old_display, new_display, new_title)
|
||||
|
||||
if old_title != new_title:
|
||||
title_changed.emit(old_title, new_title)
|
||||
|
||||
# 按显示点数直接调整善恶值 (如传入 +500 相当于内部 +5000)
|
||||
func update_alignment_points(points: int) -> void:
|
||||
update_real_alignment(points * 10)
|
||||
|
||||
# 在线时间自然恢复善恶值 (40250 char.cpp:1194-1203)
|
||||
# minutes: 挂机分钟数
|
||||
func recover_alignment_by_time(minutes: int, has_fast_recovery_item: bool = false) -> void:
|
||||
if minutes <= 0:
|
||||
return
|
||||
|
||||
if real_alignment < 0:
|
||||
var rate_per_min = 120 if has_fast_recovery_item else 60
|
||||
update_alignment_points(rate_per_min * minutes)
|
||||
else:
|
||||
var rate_per_min = 5
|
||||
update_alignment_points(rate_per_min * minutes)
|
||||
|
||||
# 使用禅豆消减罪孽 (40250 Zen Bean 70102)
|
||||
func use_zen_bean(inventory: Array, slot_index: int) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item: Dictionary = inventory[slot_index]
|
||||
if int(item.get("vnum", 0)) != VNUM_ZEN_BEAN:
|
||||
return {"ok": false, "reason": "NOT_A_ZEN_BEAN", "msg": "此物品不是禅豆!"}
|
||||
|
||||
var cur_align := get_alignment()
|
||||
if cur_align >= 0:
|
||||
return {"ok": false, "reason": "ALIGNMENT_ALREADY_GOOD", "msg": "当前心境平和,无需使用禅豆消业!"}
|
||||
|
||||
# 消耗 1 颗禅豆
|
||||
var cnt := int(item.get("count", 1))
|
||||
if cnt > 1:
|
||||
item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 恢复 500 点善恶值 (若剩余负值不足 500 则刚好回满到 0)
|
||||
var clear_amount: int = mini(ZEN_BEAN_CLEAR_POINTS, -cur_align)
|
||||
update_alignment_points(clear_amount)
|
||||
|
||||
zen_bean_consumed.emit(clear_amount, get_alignment())
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"cleared": clear_amount,
|
||||
"current_alignment": get_alignment(),
|
||||
"title": get_title_name(get_alignment()),
|
||||
"msg": "服用禅豆,消除 %d 点罪业!当前善恶值:%d (%s)" % [clear_amount, get_alignment(), get_title_name(get_alignment())]
|
||||
}
|
||||
|
||||
# 击杀和平角色 (恶名惩罚)
|
||||
func record_pk_kill() -> void:
|
||||
update_alignment_points(-2000)
|
||||
|
||||
# 击破魔石或野外怪物 (正向善名积累)
|
||||
func record_monster_kill(is_metin: bool = false) -> void:
|
||||
var bonus = 50 if is_metin else 10
|
||||
update_alignment_points(bonus)
|
||||
|
||||
# 死亡惩罚计算 (40250 红名野外死亡爆装机制)
|
||||
func handle_death_drop_penalty(inventory: Array) -> Array:
|
||||
var cur_align := get_alignment()
|
||||
if cur_align >= 0:
|
||||
return [] # 白名/良民免死掉落
|
||||
|
||||
var drop_chance := 0.10
|
||||
var max_drop_count := 1
|
||||
|
||||
if cur_align <= -12000: # 残忍魔头
|
||||
drop_chance = 0.80
|
||||
max_drop_count = 3
|
||||
elif cur_align <= -8000: # 险恶凶手
|
||||
drop_chance = 0.50
|
||||
max_drop_count = 2
|
||||
elif cur_align <= -4000: # 狡诈恶徒
|
||||
drop_chance = 0.25
|
||||
max_drop_count = 1
|
||||
|
||||
var dropped_items: Array = []
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
continue
|
||||
var item: Dictionary = inventory[i]
|
||||
# 灵魂绑定锁定的装备免于死亡掉落
|
||||
if item.get("is_soulbound", false):
|
||||
continue
|
||||
|
||||
# 判定概率爆出
|
||||
if randf() <= drop_chance:
|
||||
dropped_items.append(item.duplicate(true))
|
||||
inventory[i] = null
|
||||
if dropped_items.size() >= max_drop_count:
|
||||
break
|
||||
|
||||
if not dropped_items.is_empty():
|
||||
items_dropped_on_death.emit(dropped_items)
|
||||
|
||||
return dropped_items
|
||||
|
||||
# 序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"real_alignment": real_alignment
|
||||
}
|
||||
|
||||
# 反序列化
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
real_alignment = int(data.get("real_alignment", 0))
|
||||
@@ -1 +0,0 @@
|
||||
uid://cvfimpfsp5t6b
|
||||
@@ -1,128 +0,0 @@
|
||||
# alignment_system.gd —— 人物善恶道德与红名系统(40250 官方 1:1 对齐)
|
||||
# 对齐源码:
|
||||
# - 40250 server/game/src/char.cpp:1190-1205 (UpdateAlignment, 自然恢复公式)
|
||||
# - 40250 server/game/src/char.cpp:3300 (UpdateAlignment)
|
||||
# - 40250 ClientVS22/source/UserInterface/InstanceBaseEffect.cpp:609 (GetTitleColor)
|
||||
# - 40250 ClientVS22/source/UserInterface/InstanceBase.h:262 (TITLE_NUM=9, TITLE_NONE=4)
|
||||
# - 40250 text_tail.gd (title_color, title_name_key)
|
||||
class_name AlignmentSystem
|
||||
extends RefCounted
|
||||
|
||||
const MIN_ALIGNMENT := -20000
|
||||
const MAX_ALIGNMENT := 20000
|
||||
|
||||
# 9 档善恶称号常量定义
|
||||
const TITLE_HEROIC := 0 # 英雄 (Heroic, >= 12000)
|
||||
const TITLE_NOBLE := 1 # 尊者 (Noble, 8000..11999)
|
||||
const TITLE_GOOD := 2 # 善良 (Good, 4000..7999)
|
||||
const TITLE_FRIENDLY := 3 # 友好 (Friendly, 1000..3999)
|
||||
const TITLE_NEUTRAL := 4 # 普通 (Neutral, 0..999)
|
||||
const TITLE_AGGRESSIVE := 5 # 无赖 (Aggressive, -1..-3999)
|
||||
const TITLE_FRAUDULENT := 6 # 欺诈 (Fraudulent, -4000..-7999)
|
||||
const TITLE_MALICIOUS := 7 # 邪恶 (Malicious, -8000..-11999)
|
||||
const TITLE_CRUEL := 8 # 魔头 (Cruel, <= -12000)
|
||||
|
||||
const VNUM_ZEN_BEAN := 70102 # 禅定豆 / 清恶豆
|
||||
|
||||
const GRADE_NAMES := {
|
||||
TITLE_HEROIC: "英雄",
|
||||
TITLE_NOBLE: "尊者",
|
||||
TITLE_GOOD: "善良",
|
||||
TITLE_FRIENDLY: "友好",
|
||||
TITLE_NEUTRAL: "普通",
|
||||
TITLE_AGGRESSIVE: "无赖",
|
||||
TITLE_FRAUDULENT: "欺诈",
|
||||
TITLE_MALICIOUS: "邪恶",
|
||||
TITLE_CRUEL: "魔头",
|
||||
}
|
||||
|
||||
const GRADE_COLORS := {
|
||||
TITLE_HEROIC: Color8(0, 204, 255),
|
||||
TITLE_NOBLE: Color8(0, 144, 255),
|
||||
TITLE_GOOD: Color8(92, 110, 255),
|
||||
TITLE_FRIENDLY: Color8(155, 155, 255),
|
||||
TITLE_NEUTRAL: Color8(255, 255, 255),
|
||||
TITLE_AGGRESSIVE: Color8(207, 117, 0),
|
||||
TITLE_FRAUDULENT: Color8(235, 83, 0),
|
||||
TITLE_MALICIOUS: Color8(227, 0, 0),
|
||||
TITLE_CRUEL: Color8(255, 0, 0),
|
||||
}
|
||||
|
||||
## 获取善恶值对应的 40250 称号等级 (0..8)
|
||||
static func get_alignment_grade(alignment: int) -> int:
|
||||
if alignment >= 12000:
|
||||
return TITLE_HEROIC
|
||||
elif alignment >= 8000:
|
||||
return TITLE_NOBLE
|
||||
elif alignment >= 4000:
|
||||
return TITLE_GOOD
|
||||
elif alignment >= 1000:
|
||||
return TITLE_FRIENDLY
|
||||
elif alignment >= 0:
|
||||
return TITLE_NEUTRAL
|
||||
elif alignment > -4000:
|
||||
return TITLE_AGGRESSIVE
|
||||
elif alignment > -8000:
|
||||
return TITLE_FRAUDULENT
|
||||
elif alignment > -12000:
|
||||
return TITLE_MALICIOUS
|
||||
else:
|
||||
return TITLE_CRUEL
|
||||
|
||||
## 获取善恶称号中文名
|
||||
static func get_title_name(grade: int) -> String:
|
||||
return GRADE_NAMES.get(grade, "普通")
|
||||
|
||||
## 获取善恶称号颜色
|
||||
static func get_title_color(grade: int) -> Color:
|
||||
return GRADE_COLORS.get(grade, Color.WHITE)
|
||||
|
||||
## 检查是否为红名(罪恶状态)
|
||||
static func is_red_name(alignment: int) -> bool:
|
||||
return alignment < 0
|
||||
|
||||
## 检查是否为蓝名(正义状态)
|
||||
static func is_blue_name(alignment: int) -> bool:
|
||||
return alignment >= 1000
|
||||
|
||||
## 40250 char.cpp:1197 在线自然恢复善恶计算
|
||||
## minutes: 在线分钟数;has_fast_item: 是否佩戴禅定香囊等加速道具
|
||||
static func calculate_time_recovery(cur_alignment: int, minutes: int, has_fast_item := false) -> int:
|
||||
if minutes <= 0:
|
||||
return cur_alignment
|
||||
var updated := cur_alignment
|
||||
if cur_alignment < 0:
|
||||
# 恶名状态:基础每分钟 +60 点,带香囊每分钟 +120 点
|
||||
var rate: int = 120 if has_fast_item else 60
|
||||
updated = mini(0, cur_alignment + rate * minutes)
|
||||
else:
|
||||
# 善良状态:每分钟 +5 点
|
||||
updated = mini(MAX_ALIGNMENT, cur_alignment + 5 * minutes)
|
||||
return updated
|
||||
|
||||
## 击杀怪物增加善恶值 (40250 char_battle.cpp: UpdateAlignment)
|
||||
## 击杀野外怪物根据怪物等级恢复善恶(红名时恢复极快)
|
||||
static func on_kill_monster(cur_alignment: int, mob_level: int, player_level: int) -> int:
|
||||
var delta := maxi(1, mob_level - player_level / 2)
|
||||
if cur_alignment < 0:
|
||||
delta *= 2 # 红名击杀怪物恢复加倍
|
||||
return mini(MAX_ALIGNMENT, cur_alignment + delta)
|
||||
|
||||
## 使用禅定豆 (Zen Bean 70102)
|
||||
## 40250 原生逻辑:仅在红名 (alignment < 0) 时可使用,一次清除 500 点罪恶
|
||||
static func use_zen_bean(cur_alignment: int) -> Dictionary:
|
||||
if cur_alignment >= 0:
|
||||
return {
|
||||
"ok": false,
|
||||
"code": "CANNOT_USE_NOT_EVIL",
|
||||
"msg": "你未处于恶名状态,无需使用禅定豆。"
|
||||
}
|
||||
var new_align: int = mini(0, cur_alignment + 500)
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "SUCCESS",
|
||||
"old_alignment": cur_alignment,
|
||||
"new_alignment": new_align,
|
||||
"consumed": true,
|
||||
"msg": "使用了禅定豆,洗清了 500 点罪恶值!(当前善恶: %d)" % new_align
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://vg3mkqiy31mq
|
||||
@@ -1,132 +0,0 @@
|
||||
# atlas_navigation_system.gd —— 40250 Atlas M 键全景大地图与 NPC 寻路导航光标系统 1:1
|
||||
# 严格对照:
|
||||
# Client/Eternexus/root/uiminimap.py (AtlasWindow, MiniMap)
|
||||
# ClientVS22/source/UserInterface/PythonMiniMap.cpp, PythonMiniMap.h (AddSignalPoint, ClearAllSignalPoint)
|
||||
# Client/Eternexus/root/atlasinfo.txt
|
||||
extends RefCounted
|
||||
|
||||
# 地图手绘全景 Atlas 纹理与尺寸映射
|
||||
const MAP_ATLAS_REGISTRY := {
|
||||
"metin2_map_a1": { "name": "赤蛇国主城 (Yongan)", "size": Vector2(256, 256), "world_size": Vector2(4000, 4000) },
|
||||
"metin2_map_b1": { "name": "白虎国主城 (Joan)", "size": Vector2(256, 256), "world_size": Vector2(4000, 4000) },
|
||||
"metin2_map_c1": { "name": "苍龙国主城 (Pyungmoo)", "size": Vector2(256, 256), "world_size": Vector2(4000, 4000) },
|
||||
"metin2_map_milgyo": { "name": "幽冥神殿 (Dark Temple)", "size": Vector2(256, 256), "world_size": Vector2(2000, 2000) },
|
||||
"metin2_map_deviltower": { "name": "恶魔之塔 (Demon Tower)", "size": Vector2(256, 256), "world_size": Vector2(1000, 1000) },
|
||||
}
|
||||
|
||||
# 官方预设标准城镇 NPC 索引目录 (NPC VID -> 数据)
|
||||
const PRESET_TOWN_NPCS := [
|
||||
{ "vid": 20016, "name": "铁匠 (Blacksmith)", "category": "Smith", "pos": Vector2(580, 620) },
|
||||
{ "vid": 9001, "name": "武器商人 (Weapon Dealer)", "category": "Shop", "pos": Vector2(610, 630) },
|
||||
{ "vid": 9002, "name": "防具商人 (Armor Dealer)", "category": "Shop", "pos": Vector2(590, 650) },
|
||||
{ "vid": 9003, "name": "杂货商人 (General Store)", "category": "Shop", "pos": Vector2(630, 600) },
|
||||
{ "vid": 9005, "name": "仓库保管员 (Storekeeper)", "category": "Safebox", "pos": Vector2(550, 580) },
|
||||
{ "vid": 20084, "name": "生物学家采吉拉布 (Biologist)", "category": "Quest", "pos": Vector2(680, 520) },
|
||||
{ "vid": 20092, "name": "老行商 (Old Wanderer)", "category": "Special", "pos": Vector2(450, 710) },
|
||||
{ "vid": 20008, "name": "城门守卫 (City Guard)", "category": "Guard", "pos": Vector2(800, 800) },
|
||||
{ "vid": 20001, "name": "药店掌柜 (Alchemist)", "category": "Craft", "pos": Vector2(520, 640) },
|
||||
{ "vid": 20091, "name": "修仙道长 (Taoist)", "category": "Skill", "pos": Vector2(640, 750) },
|
||||
]
|
||||
|
||||
# 状态变量
|
||||
var is_atlas_visible: bool = false
|
||||
var current_map_id: String = "metin2_map_a1"
|
||||
var zoom_level: float = 1.0 # 滚轮缩放倍率 (0.5x ~ 3.0x)
|
||||
var pan_offset: Vector2 = Vector2.ZERO # 拖拽平移偏移
|
||||
|
||||
# 动态信标点列表 (1:1 CPythonMiniMap::m_SignalPointVector)
|
||||
var signal_points: Array = []
|
||||
|
||||
func _init(map_id: String = "metin2_map_a1") -> void:
|
||||
current_map_id = map_id
|
||||
is_atlas_visible = false
|
||||
zoom_level = 1.0
|
||||
pan_offset = Vector2.ZERO
|
||||
signal_points.clear()
|
||||
|
||||
# 1. M 键快捷切换全景大地图 (1:1 ToggleAtlasWindow)
|
||||
func toggle_atlas() -> bool:
|
||||
is_atlas_visible = !is_atlas_visible
|
||||
return is_atlas_visible
|
||||
|
||||
func show_atlas() -> void:
|
||||
is_atlas_visible = true
|
||||
|
||||
func hide_atlas() -> void:
|
||||
is_atlas_visible = false
|
||||
|
||||
# 2. 切换当前地图与底图载入 (SetMapName)
|
||||
func set_map(map_id: String) -> bool:
|
||||
if not MAP_ATLAS_REGISTRY.has(map_id):
|
||||
return false
|
||||
current_map_id = map_id
|
||||
clear_all_signals()
|
||||
pan_offset = Vector2.ZERO
|
||||
zoom_level = 1.0
|
||||
return true
|
||||
|
||||
func get_current_map_info() -> Dictionary:
|
||||
return MAP_ATLAS_REGISTRY.get(current_map_id, {})
|
||||
|
||||
# 3. 缩放与平移控制
|
||||
func set_zoom(zoom: float) -> void:
|
||||
zoom_level = clamp(zoom, 0.5, 3.0)
|
||||
|
||||
func apply_pan(delta_offset: Vector2) -> void:
|
||||
pan_offset += delta_offset
|
||||
|
||||
# 4. NPC 目录检索与过滤
|
||||
func get_npcs(category_filter: String = "") -> Array:
|
||||
if category_filter.is_empty():
|
||||
return PRESET_TOWN_NPCS
|
||||
var filtered: Array = []
|
||||
for npc in PRESET_TOWN_NPCS:
|
||||
if npc.get("category") == category_filter:
|
||||
filtered.append(npc)
|
||||
return filtered
|
||||
|
||||
func find_npc_by_vid(vid: int) -> Dictionary:
|
||||
for npc in PRESET_TOWN_NPCS:
|
||||
if npc.get("vid") == vid:
|
||||
return npc
|
||||
return {}
|
||||
|
||||
# 5. 信标寻路导航点机制 (1:1 CPythonMiniMap::AddSignalPoint / ClearAllSignalPoint)
|
||||
func add_signal_point(target_x: float, target_y: float) -> Dictionary:
|
||||
var pt := {
|
||||
"x": target_x,
|
||||
"y": target_y,
|
||||
"active": true
|
||||
}
|
||||
signal_points.append(pt)
|
||||
return pt
|
||||
|
||||
func clear_all_signals() -> void:
|
||||
signal_points.clear()
|
||||
|
||||
# 6. 指南针方位角与距离计算 (角色与目标间的连线向量)
|
||||
func calculate_navigation_vector(player_pos: Vector2, target_pos: Vector2) -> Dictionary:
|
||||
var diff := target_pos - player_pos
|
||||
var dist := diff.length()
|
||||
var angle_rad := diff.angle()
|
||||
var angle_deg := rad_to_deg(angle_rad)
|
||||
|
||||
return {
|
||||
"distance": dist,
|
||||
"direction_vector": diff.normalized() if dist > 0.001 else Vector2.ZERO,
|
||||
"angle_rad": angle_rad,
|
||||
"angle_deg": angle_deg,
|
||||
"arrived": (dist <= 30.0) # 30 码内视为到达目标
|
||||
}
|
||||
|
||||
# 7. 世界坐标至大地图 UI 局部像素坐标投影转换
|
||||
func world_to_atlas_coord(world_pos: Vector2) -> Vector2:
|
||||
var map_info := get_current_map_info()
|
||||
var world_size: Vector2 = map_info.get("world_size", Vector2(4000, 4000))
|
||||
var atlas_size: Vector2 = map_info.get("size", Vector2(256, 256))
|
||||
|
||||
var ratio_x := atlas_size.x / world_size.x
|
||||
var ratio_y := atlas_size.y / world_size.y
|
||||
|
||||
var projected := Vector2(world_pos.x * ratio_x, world_pos.y * ratio_y)
|
||||
return (projected * zoom_level) + pan_offset
|
||||
@@ -1 +0,0 @@
|
||||
uid://dras8n6cjudtn
|
||||
@@ -1,144 +0,0 @@
|
||||
# attach_metin_dialog_system.gd
|
||||
# 40250 官方 1:1 装备幽魂石/灵魂石镶嵌与双重属性对比预览系统
|
||||
# 对照: uiattachmetin.py, attachstonedialog.py, char_item.cpp
|
||||
class_name AttachMetinDialogSystem
|
||||
extends RefCounted
|
||||
|
||||
const METIN_SOCKET_MAX_NUM: int = 3
|
||||
|
||||
const METIN_NORMAL: int = 0
|
||||
const METIN_GOLD: int = 1
|
||||
|
||||
const METIN_SOCKET_TYPE_NONE: int = 0
|
||||
const METIN_SOCKET_TYPE_SILVER: int = 1
|
||||
const METIN_SOCKET_TYPE_GOLD: int = 2
|
||||
|
||||
const ITEM_BROKEN_METIN_VNUM: int = 28960
|
||||
|
||||
# 经典灵魂石属性对照表 (40250 canonical metin stones 28000~28443)
|
||||
const METIN_STONES: Dictionary = {
|
||||
28030: {"name": "战神之石+0", "bonus_type": "ATT_BONUS_TO_WARRIOR", "bonus_value": 5},
|
||||
28130: {"name": "战神之石+1", "bonus_type": "ATT_BONUS_TO_WARRIOR", "bonus_value": 8},
|
||||
28230: {"name": "战神之石+2", "bonus_type": "ATT_BONUS_TO_WARRIOR", "bonus_value": 12},
|
||||
28330: {"name": "战神之石+3", "bonus_type": "ATT_BONUS_TO_WARRIOR", "bonus_value": 17},
|
||||
28430: {"name": "战神之石+4", "bonus_type": "ATT_BONUS_TO_WARRIOR", "bonus_value": 25},
|
||||
28434: {"name": "穿透之石+4", "bonus_type": "POINT_PENETRATE_PCT", "bonus_value": 8},
|
||||
28435: {"name": "致命之石+4", "bonus_type": "POINT_CRITICAL_PCT", "bonus_value": 8},
|
||||
28438: {"name": "防御之石+4", "bonus_type": "POINT_DEF_GRADE_BONUS", "bonus_value": 15},
|
||||
28442: {"name": "加速之石+4", "bonus_type": "POINT_MOV_SPEED", "bonus_value": 30},
|
||||
28960: {"name": "破碎的石头碎块", "bonus_type": "NONE", "bonus_value": 0}
|
||||
}
|
||||
|
||||
var is_open: bool = false
|
||||
var metin_pos: int = -1
|
||||
var target_pos: int = -1
|
||||
|
||||
var metin_vnum: int = 0
|
||||
var metin_subtype: int = METIN_NORMAL
|
||||
|
||||
var target_item_vnum: int = 0
|
||||
var current_sockets: Array = [0, 0, 0]
|
||||
var preview_sockets: Array = [0, 0, 0]
|
||||
var target_socket_idx: int = -1
|
||||
|
||||
var last_packet_sent: Dictionary = {}
|
||||
var last_sound_played: String = ""
|
||||
|
||||
signal dialog_opened(metin_pos: int, target_pos: int, preview_sockets: Array)
|
||||
signal dialog_closed()
|
||||
signal metin_attached(metin_pos: int, target_pos: int, target_slot_idx: int)
|
||||
signal attach_failed(reason: String)
|
||||
|
||||
func can_attach_metin(slot_type: int, metin_type: int) -> bool:
|
||||
if metin_type == METIN_NORMAL:
|
||||
if slot_type == METIN_SOCKET_TYPE_SILVER or slot_type == METIN_SOCKET_TYPE_GOLD:
|
||||
return true
|
||||
elif metin_type == METIN_GOLD:
|
||||
if slot_type == METIN_SOCKET_TYPE_GOLD:
|
||||
return true
|
||||
return false
|
||||
|
||||
func open_dialog(p_metin_pos: int, p_target_pos: int, p_metin_vnum: int, p_metin_subtype: int, p_target_vnum: int, p_sockets: Array) -> bool:
|
||||
metin_pos = p_metin_pos
|
||||
target_pos = p_target_pos
|
||||
metin_vnum = p_metin_vnum
|
||||
metin_subtype = p_metin_subtype
|
||||
target_item_vnum = p_target_vnum
|
||||
|
||||
current_sockets = [0, 0, 0]
|
||||
preview_sockets = [0, 0, 0]
|
||||
target_socket_idx = -1
|
||||
|
||||
for i in range(mini(p_sockets.size(), METIN_SOCKET_MAX_NUM)):
|
||||
current_sockets[i] = p_sockets[i]
|
||||
preview_sockets[i] = p_sockets[i]
|
||||
|
||||
# 寻找首个符合条件的开放槽位
|
||||
var found_slot: bool = false
|
||||
for i in range(METIN_SOCKET_MAX_NUM):
|
||||
var slot_state: int = current_sockets[i]
|
||||
if can_attach_metin(slot_state, metin_subtype):
|
||||
preview_sockets[i] = metin_vnum
|
||||
target_socket_idx = i
|
||||
found_slot = true
|
||||
break
|
||||
|
||||
if not found_slot:
|
||||
attach_failed.emit("NO_AVAILABLE_SOCKET")
|
||||
return false
|
||||
|
||||
is_open = true
|
||||
dialog_opened.emit(metin_pos, target_pos, preview_sockets)
|
||||
return true
|
||||
|
||||
func accept() -> bool:
|
||||
if not is_open:
|
||||
return false
|
||||
if target_socket_idx < 0:
|
||||
attach_failed.emit("INVALID_SOCKET")
|
||||
return false
|
||||
|
||||
# 40250 发送 net.SendItemUseToItemPacket(self.metinItemPos, self.targetItemPos)
|
||||
last_packet_sent = {
|
||||
"header": "HEADER_CG_ITEM_USE_TO_ITEM",
|
||||
"metin_pos": metin_pos,
|
||||
"target_pos": target_pos,
|
||||
"target_socket_idx": target_socket_idx,
|
||||
"metin_vnum": metin_vnum
|
||||
}
|
||||
|
||||
# 官方原版音效
|
||||
last_sound_played = "sound/ui/metinstone_insert.wav"
|
||||
|
||||
metin_attached.emit(metin_pos, target_pos, target_socket_idx)
|
||||
close_dialog()
|
||||
return true
|
||||
|
||||
func close_dialog() -> void:
|
||||
is_open = false
|
||||
metin_pos = -1
|
||||
target_pos = -1
|
||||
dialog_closed.emit()
|
||||
|
||||
# 模拟服务端结算镶嵌 (支持成功率判定: 成功直接嵌入,失败产生破碎石块 28960)
|
||||
func simulate_server_process(target_sockets: Array, socket_idx: int, attached_metin_vnum: int, success: bool) -> Array:
|
||||
var result_sockets: Array = target_sockets.duplicate()
|
||||
if socket_idx >= 0 and socket_idx < result_sockets.size():
|
||||
if success:
|
||||
result_sockets[socket_idx] = attached_metin_vnum
|
||||
else:
|
||||
result_sockets[socket_idx] = ITEM_BROKEN_METIN_VNUM
|
||||
return result_sockets
|
||||
|
||||
# 模拟卷轴清理破碎石头 (vnum 71083 / Scroll of Cleansing)
|
||||
func clean_broken_socket(target_sockets: Array, socket_idx: int) -> Array:
|
||||
var result_sockets: Array = target_sockets.duplicate()
|
||||
if socket_idx >= 0 and socket_idx < result_sockets.size():
|
||||
if result_sockets[socket_idx] == ITEM_BROKEN_METIN_VNUM:
|
||||
result_sockets[socket_idx] = METIN_SOCKET_TYPE_SILVER
|
||||
return result_sockets
|
||||
|
||||
func get_metin_info(vnum: int) -> Dictionary:
|
||||
if METIN_STONES.has(vnum):
|
||||
return METIN_STONES[vnum]
|
||||
return {"name": "未知幽魂石", "bonus_type": "UNKNOWN", "bonus_value": 0}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bkw5vjkd4yqgq
|
||||
@@ -1,175 +0,0 @@
|
||||
# auto_combat_bot_system.gd —— Metin2 40250 自动战斗猎杀挂机助手 1:1
|
||||
# 对照 40250 服务端 char_battle.cpp, bot.cpp, item_manager.cpp
|
||||
class_name AutoCombatBotSystem
|
||||
extends RefCounted
|
||||
|
||||
signal bot_toggled(enabled: bool)
|
||||
signal potion_used(potion_vnum: int, ptype: String)
|
||||
signal target_locked(target_id: String)
|
||||
signal auto_attack_fired(target_id: String, damage: int)
|
||||
signal auto_skill_fired(skill_vnum: int, target_id: String)
|
||||
signal auto_loot_collected(item_name: String, slot: int)
|
||||
|
||||
# 红药与蓝药 VNUM
|
||||
const HP_POTION_VNUMS: Array = [27001, 27002, 27003] # 小/中/大红
|
||||
const SP_POTION_VNUMS: Array = [27004, 27005, 27006] # 小/中/大蓝
|
||||
|
||||
var is_enabled: bool = false
|
||||
var auto_potion_enabled: bool = true
|
||||
var hp_threshold: float = 0.50 # 50% HP 触发喝红
|
||||
var sp_threshold: float = 0.40 # 40% SP 触发喝蓝
|
||||
|
||||
var auto_attack_enabled: bool = true
|
||||
var scan_radius: float = 15.0
|
||||
var attack_range: float = 3.0
|
||||
|
||||
var auto_skill_enabled: bool = true
|
||||
var assigned_skills: Array = []
|
||||
var skill_cooldowns: Dictionary = {}
|
||||
|
||||
var auto_loot_enabled: bool = true
|
||||
var loot_radius: float = 8.0
|
||||
|
||||
var current_target_id: String = ""
|
||||
var potion_cooldown: float = 0.0
|
||||
|
||||
# 开启/关闭挂机内挂
|
||||
func toggle_bot(enable: bool) -> Dictionary:
|
||||
is_enabled = enable
|
||||
if not is_enabled:
|
||||
current_target_id = ""
|
||||
bot_toggled.emit(is_enabled)
|
||||
return {"ok": true, "enabled": is_enabled, "msg": "自动战斗猎杀助手已%s!" % ("开启" if is_enabled else "关闭")}
|
||||
|
||||
# 帧心跳驱动挂机逻辑
|
||||
func update_bot(delta: float, player_data: Dictionary, inventory: Array, nearby_mobs: Array, nearby_drops: Array) -> Dictionary:
|
||||
if not is_enabled:
|
||||
return {"status": "disabled"}
|
||||
|
||||
if potion_cooldown > 0.0:
|
||||
potion_cooldown = max(0.0, potion_cooldown - delta)
|
||||
|
||||
for sk in skill_cooldowns.keys():
|
||||
if skill_cooldowns[sk] > 0.0:
|
||||
skill_cooldowns[sk] = max(0.0, skill_cooldowns[sk] - delta)
|
||||
|
||||
var p_pos: Vector3 = player_data.get("pos", Vector3.ZERO)
|
||||
var p_hp: int = int(player_data.get("hp", 100))
|
||||
var p_max_hp: int = max(1, int(player_data.get("max_hp", 100)))
|
||||
var p_sp: int = int(player_data.get("sp", 100))
|
||||
var p_max_sp: int = max(1, int(player_data.get("max_sp", 100)))
|
||||
|
||||
# 1. 自动智能喝药判定
|
||||
if auto_potion_enabled and potion_cooldown <= 0.0:
|
||||
if float(p_hp) / float(p_max_hp) <= hp_threshold:
|
||||
if _use_potion(HP_POTION_VNUMS, inventory, player_data, "hp"):
|
||||
potion_cooldown = 1.0 # 喝药公共冷却 1 秒
|
||||
|
||||
if float(p_sp) / float(p_max_sp) <= sp_threshold:
|
||||
if _use_potion(SP_POTION_VNUMS, inventory, player_data, "sp"):
|
||||
potion_cooldown = 1.0
|
||||
|
||||
# 2. 自动拾取掉落物
|
||||
if auto_loot_enabled:
|
||||
_process_auto_loot(p_pos, nearby_drops, inventory)
|
||||
|
||||
# 3. 自动搜敌与战斗打击
|
||||
if auto_attack_enabled:
|
||||
var act = _process_auto_combat(delta, p_pos, player_data, nearby_mobs)
|
||||
return act
|
||||
|
||||
return {"status": "idle"}
|
||||
|
||||
# 自动喝药
|
||||
func _use_potion(potion_vnums: Array, inventory: Array, player_data: Dictionary, ptype: String) -> bool:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) in potion_vnums:
|
||||
var pot = inventory[i]
|
||||
var pvnum = int(pot["vnum"])
|
||||
var cnt = int(pot.get("count", 1))
|
||||
if cnt > 1:
|
||||
pot["count"] = cnt - 1
|
||||
else:
|
||||
inventory[i] = null
|
||||
|
||||
var rec = 1500 if pvnum in [27003, 27006] else 800
|
||||
if ptype == "hp":
|
||||
player_data["hp"] = min(int(player_data["max_hp"]), int(player_data["hp"]) + rec)
|
||||
else:
|
||||
player_data["sp"] = min(int(player_data["max_sp"]), int(player_data["sp"]) + rec)
|
||||
|
||||
potion_used.emit(pvnum, ptype)
|
||||
return true
|
||||
return false
|
||||
|
||||
# 自动拾取
|
||||
func _process_auto_loot(player_pos: Vector3, drops: Array, inventory: Array) -> void:
|
||||
for d in drops:
|
||||
if d.get("looted", false):
|
||||
continue
|
||||
var d_pos: Vector3 = d.get("pos", Vector3.ZERO)
|
||||
if player_pos.distance_to(d_pos) <= loot_radius:
|
||||
# 放入背包
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {
|
||||
"vnum": d.get("vnum", 1),
|
||||
"name": d.get("name", "战利品"),
|
||||
"count": int(d.get("count", 1))
|
||||
}
|
||||
d["looted"] = true
|
||||
auto_loot_collected.emit(d["name"], i)
|
||||
break
|
||||
|
||||
# 自动锁敌与攻击
|
||||
func _process_auto_combat(delta: float, player_pos: Vector3, player_data: Dictionary, mobs: Array) -> Dictionary:
|
||||
var closest_mob = null
|
||||
var min_dist = scan_radius + 1.0
|
||||
|
||||
for m in mobs:
|
||||
if not m.get("alive", true):
|
||||
continue
|
||||
var m_pos: Vector3 = m.get("pos", Vector3.ZERO)
|
||||
var dist = player_pos.distance_to(m_pos)
|
||||
if dist <= scan_radius and dist < min_dist:
|
||||
min_dist = dist
|
||||
closest_mob = m
|
||||
|
||||
if closest_mob == null:
|
||||
current_target_id = ""
|
||||
return {"status": "no_targets"}
|
||||
|
||||
var target_id = str(closest_mob.get("id", "mob"))
|
||||
if current_target_id != target_id:
|
||||
current_target_id = target_id
|
||||
target_locked.emit(target_id)
|
||||
|
||||
var target_pos: Vector3 = closest_mob.get("pos", Vector3.ZERO)
|
||||
var dist_to_target = player_pos.distance_to(target_pos)
|
||||
|
||||
# 走位靠拢
|
||||
if dist_to_target > attack_range:
|
||||
var new_pos = player_pos.move_toward(target_pos, 5.0 * delta)
|
||||
player_data["pos"] = new_pos
|
||||
return {"status": "moving_to_target", "target": target_id, "dist": dist_to_target}
|
||||
|
||||
# 尝试释放技能
|
||||
if auto_skill_enabled:
|
||||
for sk in assigned_skills:
|
||||
if skill_cooldowns.get(sk, 0.0) <= 0.0:
|
||||
skill_cooldowns[sk] = 8.0 # 默认技能 8 秒冷却
|
||||
auto_skill_fired.emit(sk, target_id)
|
||||
var sk_dmg = int(float(player_data.get("atk", 500)) * 2.0)
|
||||
closest_mob["hp"] = max(0, int(closest_mob.get("hp", 1000)) - sk_dmg)
|
||||
if closest_mob["hp"] <= 0:
|
||||
closest_mob["alive"] = false
|
||||
return {"status": "skill_attack", "skill": sk, "damage": sk_dmg}
|
||||
|
||||
# 普通挥砍攻击
|
||||
var atk_dmg = int(player_data.get("atk", 500))
|
||||
closest_mob["hp"] = max(0, int(closest_mob.get("hp", 1000)) - atk_dmg)
|
||||
if closest_mob["hp"] <= 0:
|
||||
closest_mob["alive"] = false
|
||||
|
||||
auto_attack_fired.emit(target_id, atk_dmg)
|
||||
return {"status": "basic_attack", "target": target_id, "damage": atk_dmg}
|
||||
@@ -1 +0,0 @@
|
||||
uid://d2i1ud7k3o0l5
|
||||
@@ -1,218 +0,0 @@
|
||||
# battle_arena_duel_system.gd —— Metin2 40250 官方武斗竞技场切磋与裁判规则 1:1
|
||||
# 对照 40250 服务端 arena.cpp, arena.h, BattleArena.cpp, questlua_arena.cpp
|
||||
class_name BattleArenaDuelSystem
|
||||
extends RefCounted
|
||||
|
||||
signal duel_started(opponent_name: String, set_count: int, time_limit: float)
|
||||
signal round_started(current_round: int)
|
||||
signal round_ended(winner_side: String, score_a: int, score_b: int)
|
||||
signal duel_finished(winner_side: String, final_score_a: int, final_score_b: int, reward: Dictionary)
|
||||
signal rule_violation_intercepted(reason: String)
|
||||
|
||||
const NPC_REFEREE := 20017 # 比武场裁判 (Arena Referee)
|
||||
const ARENA_MAP_INDEX := 112
|
||||
|
||||
# 擂台对立出生点 (Point A 玩家, Point B 对手)
|
||||
const START_POINT_A := Vector2(100.0, 100.0)
|
||||
const START_POINT_B := Vector2(200.0, 200.0)
|
||||
const ARENA_BOUNDS := Rect2(80.0, 80.0, 140.0, 140.0) # 擂台活动合法矩形区域
|
||||
|
||||
# 决斗状态枚举
|
||||
const STATE_IDLE := "IDLE"
|
||||
const STATE_COUNTDOWN := "COUNTDOWN"
|
||||
const STATE_FIGHTING := "FIGHTING"
|
||||
const STATE_ROUND_OVER:= "ROUND_OVER"
|
||||
const STATE_FINISHED := "FINISHED"
|
||||
|
||||
# 单机官方 4 大门派守擂试炼 NPC 导师
|
||||
const OPPONENT_PRESETS: Dictionary = {
|
||||
"warrior": {
|
||||
"id": "warrior",
|
||||
"name": "战神武者教头",
|
||||
"job": "warrior",
|
||||
"max_hp": 12000,
|
||||
"attack_power": 450,
|
||||
"defense": 200,
|
||||
"skills": ["三连斩", "剑气破空"]
|
||||
},
|
||||
"assassin": {
|
||||
"id": "assassin",
|
||||
"name": "暗夜游侠神箭手",
|
||||
"job": "assassin",
|
||||
"max_hp": 9000,
|
||||
"attack_power": 520,
|
||||
"defense": 150,
|
||||
"skills": ["连环毒矢", "疾影步"]
|
||||
},
|
||||
"sura": {
|
||||
"id": "sura",
|
||||
"name": "冥界暗影修罗",
|
||||
"job": "sura",
|
||||
"max_hp": 11000,
|
||||
"attack_power": 480,
|
||||
"defense": 220,
|
||||
"skills": ["幽冥炎刃", "魔灵护体"]
|
||||
},
|
||||
"shaman": {
|
||||
"id": "shaman",
|
||||
"name": "雷鸣灵术萨满",
|
||||
"job": "shaman",
|
||||
"max_hp": 10000,
|
||||
"attack_power": 400,
|
||||
"defense": 180,
|
||||
"skills": ["天顶奔雷", "金钟守护"]
|
||||
}
|
||||
}
|
||||
|
||||
# 比赛运行时状态
|
||||
var match_state: String = STATE_IDLE
|
||||
var current_round: int = 1
|
||||
var max_sets: int = 3 # 3 局 2 胜
|
||||
var sets_to_win: int = 2
|
||||
var time_limit_per_round: float = 300.0 # 5 分钟
|
||||
var round_timer: float = 300.0
|
||||
var countdown_timer: float = 3.0
|
||||
|
||||
var score_a: int = 0 # 玩家得分
|
||||
var score_b: int = 0 # 对手得分
|
||||
|
||||
var player_pos: Vector2 = START_POINT_A
|
||||
var opponent_pos: Vector2 = START_POINT_B
|
||||
|
||||
var active_opponent: Dictionary = {}
|
||||
var opponent_current_hp: int = 0
|
||||
|
||||
# 启动武斗切磋
|
||||
func start_duel(opponent_id: String, sets: int = 3, time_limit: float = 300.0) -> Dictionary:
|
||||
if not OPPONENT_PRESETS.has(opponent_id):
|
||||
return {"ok": false, "reason": "INVALID_OPPONENT", "msg": "未知的守擂武者!"}
|
||||
|
||||
active_opponent = OPPONENT_PRESETS[opponent_id].duplicate(true)
|
||||
max_sets = sets
|
||||
sets_to_win = int(ceil(float(max_sets) / 2.0))
|
||||
time_limit_per_round = time_limit
|
||||
|
||||
score_a = 0
|
||||
score_b = 0
|
||||
current_round = 1
|
||||
|
||||
_prepare_round()
|
||||
|
||||
duel_started.emit(active_opponent["name"], max_sets, time_limit_per_round)
|
||||
return {
|
||||
"ok": true,
|
||||
"opponent": active_opponent["name"],
|
||||
"max_sets": max_sets,
|
||||
"sets_to_win": sets_to_win,
|
||||
"pos_a": player_pos,
|
||||
"pos_b": opponent_pos
|
||||
}
|
||||
|
||||
# 准备新回合
|
||||
func _prepare_round() -> void:
|
||||
match_state = STATE_COUNTDOWN
|
||||
countdown_timer = 3.0
|
||||
round_timer = time_limit_per_round
|
||||
|
||||
player_pos = START_POINT_A
|
||||
opponent_pos = START_POINT_B
|
||||
opponent_current_hp = int(active_opponent.get("max_hp", 10000))
|
||||
|
||||
# 心跳逻辑推进
|
||||
func update(delta: float) -> void:
|
||||
if match_state == STATE_COUNTDOWN:
|
||||
countdown_timer -= delta
|
||||
if countdown_timer <= 0.0:
|
||||
match_state = STATE_FIGHTING
|
||||
round_started.emit(current_round)
|
||||
elif match_state == STATE_FIGHTING:
|
||||
round_timer -= delta
|
||||
if round_timer <= 0.0:
|
||||
# 回合超时:双方均未击倒,判定为平局或根据剩余生命决出
|
||||
_handle_round_over("timeout")
|
||||
|
||||
# 40250 禁药规则拦截
|
||||
func use_potion_check(item_vnum: int) -> bool:
|
||||
if match_state == STATE_FIGHTING or match_state == STATE_COUNTDOWN:
|
||||
# 27001~27006 为红蓝药水
|
||||
if item_vnum >= 27001 and item_vnum <= 27006:
|
||||
rule_violation_intercepted.emit("POTION_FORBIDDEN_IN_ARENA")
|
||||
return false
|
||||
return true
|
||||
|
||||
# 40250 禁马规则拦截
|
||||
func mount_check() -> bool:
|
||||
if match_state == STATE_FIGHTING or match_state == STATE_COUNTDOWN:
|
||||
rule_violation_intercepted.emit("MOUNT_FORBIDDEN_IN_ARENA")
|
||||
return false
|
||||
return true
|
||||
|
||||
# 40250 擂台边界巡检
|
||||
func check_boundary(pos: Vector2) -> bool:
|
||||
if not ARENA_BOUNDS.has_point(pos):
|
||||
rule_violation_intercepted.emit("OUT_OF_ARENA_BOUNDS")
|
||||
return false
|
||||
return true
|
||||
|
||||
# 击倒判定处理
|
||||
func record_defeat(defeated_side: String) -> Dictionary:
|
||||
if match_state != STATE_FIGHTING:
|
||||
return {"ok": false, "reason": "NOT_IN_FIGHTING_STATE"}
|
||||
|
||||
var round_winner := ""
|
||||
if defeated_side == "B": # 对手倒下,玩家得分
|
||||
score_a += 1
|
||||
round_winner = "A"
|
||||
elif defeated_side == "A": # 玩家倒下,对手得分
|
||||
score_b += 1
|
||||
round_winner = "B"
|
||||
|
||||
return _handle_round_over(round_winner)
|
||||
|
||||
# 回合结束与大局胜负判定
|
||||
func _handle_round_over(winner_side: String) -> Dictionary:
|
||||
match_state = STATE_ROUND_OVER
|
||||
round_ended.emit(winner_side, score_a, score_b)
|
||||
|
||||
# 检查大局是否已有胜者
|
||||
if score_a >= sets_to_win or score_b >= sets_to_win or current_round >= max_sets:
|
||||
match_state = STATE_FINISHED
|
||||
var grand_winner := "A" if score_a > score_b else ("B" if score_b > score_a else "DRAW")
|
||||
|
||||
var reward: Dictionary = {}
|
||||
if grand_winner == "A":
|
||||
reward = {
|
||||
"arena_points": 100 * sets_to_win,
|
||||
"gold": 500000,
|
||||
"title": "【竞技场常胜军】"
|
||||
}
|
||||
|
||||
duel_finished.emit(grand_winner, score_a, score_b, reward)
|
||||
return {
|
||||
"ok": true,
|
||||
"match_finished": true,
|
||||
"winner": grand_winner,
|
||||
"score_a": score_a,
|
||||
"score_b": score_b,
|
||||
"reward": reward
|
||||
}
|
||||
|
||||
# 进入下一回合
|
||||
current_round += 1
|
||||
_prepare_round()
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"match_finished": false,
|
||||
"current_round": current_round,
|
||||
"score_a": score_a,
|
||||
"score_b": score_b
|
||||
}
|
||||
|
||||
# 重置武斗场状态
|
||||
func reset_arena() -> void:
|
||||
match_state = STATE_IDLE
|
||||
current_round = 1
|
||||
score_a = 0
|
||||
score_b = 0
|
||||
active_opponent.clear()
|
||||
@@ -1 +0,0 @@
|
||||
uid://bsbmx3e0l0jgs
|
||||
@@ -1,161 +0,0 @@
|
||||
# belt_system.gd —— Metin2 40250 腰带系统与专属药水背包 1:1
|
||||
# 对照 40250 服务端 belt.cpp, char_item.cpp, uiinventory.py
|
||||
class_name BeltSystem
|
||||
extends RefCounted
|
||||
|
||||
signal belt_equipped(belt_name: String, slots_unlocked: int)
|
||||
signal belt_unequipped()
|
||||
signal belt_item_stored(slot: int, item_name: String)
|
||||
signal belt_item_removed(slot: int)
|
||||
|
||||
const MAX_BELT_SLOTS := 16 # 最大 4x4 空间
|
||||
|
||||
# 允许存入腰带的消耗品/药水类型
|
||||
const ALLOWED_CONSUMABLE_TYPES: Array = ["potion", "consumable", "dew", "elixir"]
|
||||
|
||||
# 已装备的腰带
|
||||
var equipped_belt: Dictionary = {}
|
||||
var belt_inventory: Array = [] # 16 个格子
|
||||
|
||||
func _init() -> void:
|
||||
belt_inventory.resize(MAX_BELT_SLOTS)
|
||||
for i in range(MAX_BELT_SLOTS):
|
||||
belt_inventory[i] = null
|
||||
|
||||
# 根据腰带强化等级计算开放的药水槽位数量
|
||||
static func calculate_unlocked_slots(refine_level: int) -> int:
|
||||
if refine_level >= 9:
|
||||
return 16 # 4x4
|
||||
elif refine_level >= 7:
|
||||
return 12 # 3x4
|
||||
elif refine_level >= 5:
|
||||
return 10
|
||||
elif refine_level >= 3:
|
||||
return 8 # 2x4
|
||||
elif refine_level >= 1:
|
||||
return 6
|
||||
else:
|
||||
return 4 # 1x4
|
||||
|
||||
# 获取当前开放的药水格子数
|
||||
func get_unlocked_slot_count() -> int:
|
||||
if equipped_belt.is_empty():
|
||||
return 0
|
||||
var refine: int = int(equipped_belt.get("refine_level", 0))
|
||||
return calculate_unlocked_slots(refine)
|
||||
|
||||
# 佩戴腰带
|
||||
func equip_belt(belt_item: Dictionary) -> Dictionary:
|
||||
if belt_item.is_empty():
|
||||
return {"ok": false, "reason": "EMPTY_BELT", "msg": "腰带数据为空!"}
|
||||
|
||||
equipped_belt = belt_item.duplicate(true)
|
||||
var unlocked := get_unlocked_slot_count()
|
||||
var bname: String = equipped_belt.get("name", "腰带")
|
||||
|
||||
belt_equipped.emit(bname, unlocked)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"belt": equipped_belt,
|
||||
"unlocked_slots": unlocked,
|
||||
"msg": "已佩戴【%s】,解锁了 %d 格专属药水空间!" % [bname, unlocked]
|
||||
}
|
||||
|
||||
# 卸下腰带 (需确保腰带内物品能够全部安全移出或为空)
|
||||
func unequip_belt(main_inventory: Array) -> Dictionary:
|
||||
if equipped_belt.is_empty():
|
||||
return {"ok": false, "reason": "NO_BELT_EQUIPPED", "msg": "当前未佩戴腰带!"}
|
||||
|
||||
# 检查腰带内是否有物品
|
||||
var items_in_belt: Array = []
|
||||
for i in range(MAX_BELT_SLOTS):
|
||||
if belt_inventory[i] != null:
|
||||
items_in_belt.append({"belt_slot": i, "item": belt_inventory[i]})
|
||||
|
||||
if not items_in_belt.is_empty():
|
||||
# 统计主背包空位
|
||||
var empty_slots: Array = []
|
||||
for j in range(main_inventory.size()):
|
||||
if main_inventory[j] == null:
|
||||
empty_slots.append(j)
|
||||
|
||||
if empty_slots.size() < items_in_belt.size():
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "BELT_NOT_EMPTY",
|
||||
"items_count": items_in_belt.size(),
|
||||
"empty_slots": empty_slots.size(),
|
||||
"msg": "主背包空间不足以容纳腰带内的药水,无法卸下腰带!"
|
||||
}
|
||||
|
||||
# 移入主背包
|
||||
for k in range(items_in_belt.size()):
|
||||
var m_slot: int = empty_slots[k]
|
||||
var it = items_in_belt[k]["item"]
|
||||
var b_slot: int = items_in_belt[k]["belt_slot"]
|
||||
main_inventory[m_slot] = it
|
||||
belt_inventory[b_slot] = null
|
||||
|
||||
var old_belt := equipped_belt.duplicate(true)
|
||||
equipped_belt.clear()
|
||||
belt_unequipped.emit()
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"belt": old_belt,
|
||||
"msg": "腰带已卸下!内部药水已全部归还至主背包。"
|
||||
}
|
||||
|
||||
# 存放药水至腰带专属背包
|
||||
func store_item_in_belt(slot_idx: int, item: Dictionary) -> Dictionary:
|
||||
if equipped_belt.is_empty():
|
||||
return {"ok": false, "reason": "NO_BELT_EQUIPPED", "msg": "未佩戴腰带,无法使用专属药水栏!"}
|
||||
|
||||
var unlocked := get_unlocked_slot_count()
|
||||
if slot_idx < 0 or slot_idx >= unlocked:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "SLOT_LOCKED_OR_INVALID",
|
||||
"unlocked_slots": unlocked,
|
||||
"msg": "该腰带槽位尚未解锁或无效!当前腰带只开放了前 %d 格。" % unlocked
|
||||
}
|
||||
|
||||
# 药品类型校验
|
||||
var it_type: String = item.get("item_type", "")
|
||||
var is_potion: bool = ALLOWED_CONSUMABLE_TYPES.has(it_type) or item.get("is_potion", false)
|
||||
if not is_potion:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "NOT_A_POTION",
|
||||
"msg": "腰带栏位专用于补给品,只能存放药水、灵药与神圣露水!"
|
||||
}
|
||||
|
||||
belt_inventory[slot_idx] = item.duplicate(true)
|
||||
var iname: String = item.get("name", "药水")
|
||||
belt_item_stored.emit(slot_idx, iname)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"slot_idx": slot_idx,
|
||||
"item": belt_inventory[slot_idx],
|
||||
"msg": "已将【%s】置入腰带快捷栏!" % iname
|
||||
}
|
||||
|
||||
# 从腰带栏取出药水
|
||||
func take_item_from_belt(slot_idx: int) -> Dictionary:
|
||||
if slot_idx < 0 or slot_idx >= MAX_BELT_SLOTS:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item = belt_inventory[slot_idx]
|
||||
if item == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT"}
|
||||
|
||||
belt_inventory[slot_idx] = null
|
||||
belt_item_removed.emit(slot_idx)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"slot_idx": slot_idx,
|
||||
"item": item
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://nde6dfrdg7vg
|
||||
@@ -1,101 +0,0 @@
|
||||
# bgm_jukebox_system.gd —— 40250 客户端 BGM 点唱机与地图音乐配置系统 1:1
|
||||
# 严格对照:
|
||||
# Client/Eternexus/root/uiselectmusic.py (SelectMusicWindow)
|
||||
# Client/Eternexus/root/musicinfo.py
|
||||
# ClientVS22/source/UserInterface/PythonSoundManagerModule.cpp
|
||||
extends RefCounted
|
||||
|
||||
const DEFAULT_THEME_TRACK := "enter_the_east.mp3"
|
||||
|
||||
# 40250 官方标准曲目清单 (musicinfo.py)
|
||||
const CANONICAL_TRACKS := [
|
||||
"enter_the_east.mp3",
|
||||
"open_the_gate.mp3",
|
||||
"characterselect.mp3",
|
||||
"wedding.mp3",
|
||||
"desert.mp3",
|
||||
"mountain.mp3",
|
||||
"temple.mp3",
|
||||
"monkey_dungeon.mp3",
|
||||
"flame_dungeon.mp3",
|
||||
"catacomb.mp3",
|
||||
"save_the_world.mp3",
|
||||
"peaceful_valley.mp3",
|
||||
"wonderland.mp3"
|
||||
]
|
||||
|
||||
# 各大地图官方默认 BGM 映射表
|
||||
const DEFAULT_MAP_BGM_MAP := {
|
||||
"intro_login": "enter_the_east.mp3",
|
||||
"intro_select": "characterselect.mp3",
|
||||
"metin2_map_a1": "open_the_gate.mp3",
|
||||
"metin2_map_b1": "open_the_gate.mp3",
|
||||
"metin2_map_c1": "open_the_gate.mp3",
|
||||
"metin2_map_n_desert_01": "desert.mp3",
|
||||
"metin2_map_n_snowm_01": "mountain.mp3",
|
||||
"metin2_map_milgyo": "temple.mp3",
|
||||
"metin2_map_deviltower": "catacomb.mp3",
|
||||
"metin2_map_wedding_01": "wedding.mp3",
|
||||
}
|
||||
|
||||
# 播放器运行时状态
|
||||
var current_track: String = ""
|
||||
var is_playing: bool = false
|
||||
var loop_enabled: bool = true
|
||||
var volume: float = 0.8 # 0.0 ~ 1.0 (默认 80%)
|
||||
|
||||
# 自定义地图偏好覆写: map_id -> track_name
|
||||
var custom_map_overrides: Dictionary = {}
|
||||
|
||||
func _init() -> void:
|
||||
current_track = ""
|
||||
is_playing = false
|
||||
loop_enabled = true
|
||||
volume = 0.8
|
||||
custom_map_overrides.clear()
|
||||
|
||||
# 1. 播放指定曲目 (1:1 snd.PlayBGM)
|
||||
func play_bgm(track_name: String, loop: bool = true) -> bool:
|
||||
if not CANONICAL_TRACKS.has(track_name):
|
||||
return false
|
||||
current_track = track_name
|
||||
is_playing = true
|
||||
loop_enabled = loop
|
||||
return true
|
||||
|
||||
# 2. 停止背景音乐 (1:1 snd.StopBGM)
|
||||
func stop_bgm() -> void:
|
||||
is_playing = false
|
||||
current_track = ""
|
||||
|
||||
# 3. 调节音量 (1:1 snd.SetBGMVolume)
|
||||
func set_volume(vol_pct: float) -> void:
|
||||
volume = clamp(vol_pct, 0.0, 1.0)
|
||||
|
||||
# 4. 获取指定地图应当播放的背景音乐 (自定义优先,其次默认)
|
||||
func get_effective_map_bgm(map_id: String) -> String:
|
||||
if custom_map_overrides.has(map_id):
|
||||
return custom_map_overrides[map_id]
|
||||
return DEFAULT_MAP_BGM_MAP.get(map_id, DEFAULT_THEME_TRACK)
|
||||
|
||||
# 5. 进入地图自动切换音乐
|
||||
func on_enter_map(map_id: String) -> String:
|
||||
var target_track = get_effective_map_bgm(map_id)
|
||||
if target_track != current_track or not is_playing:
|
||||
play_bgm(target_track, true)
|
||||
return target_track
|
||||
|
||||
# 6. 点唱机自定义地图专属曲目 (uiselectmusic.py: SelectMusic)
|
||||
func set_custom_map_bgm(map_id: String, track_name: String) -> bool:
|
||||
if not CANONICAL_TRACKS.has(track_name):
|
||||
return false
|
||||
custom_map_overrides[map_id] = track_name
|
||||
return true
|
||||
|
||||
# 7. 恢复地图默认曲目
|
||||
func reset_custom_map_bgm(map_id: String) -> void:
|
||||
if custom_map_overrides.has(map_id):
|
||||
custom_map_overrides.erase(map_id)
|
||||
|
||||
func clear_all_custom_overrides() -> void:
|
||||
custom_map_overrides.clear()
|
||||
@@ -1 +0,0 @@
|
||||
uid://co4sc1bl3n0sj
|
||||
@@ -1,270 +0,0 @@
|
||||
# biologist_chaegirab_research_system.gd —— Metin2 40250 官方生物学者车齿木全套调查研究链与永久属性嘉奖系统 1:1
|
||||
# 对照 40250 服务端 collect_quest_lv30.quest ~ collect_quest_lv94.quest, char.cpp
|
||||
class_name BiologistChaegirabResearchSystem
|
||||
extends RefCounted
|
||||
|
||||
signal sample_submitted(item_name: String, success: bool, current: int, target: int)
|
||||
signal capstone_submitted(stone_name: String, stage_name: String)
|
||||
signal stage_completed(stage_name: String, rewards: Dictionary)
|
||||
|
||||
const NPC_BIOLOGIST := 20084 # 生物学者车齿木 (Biologist Chaegirab)
|
||||
const VNUM_RESEARCH_ELIXIR := 71035 # 贤者之药 (提高提交成功率至 90%)
|
||||
|
||||
# 40250 官方 8 大里程碑阶段全量研究任务链
|
||||
const RESEARCH_STAGES: Array = [
|
||||
{
|
||||
"stage_id": 1,
|
||||
"title": "【Lv 30 研究】兽人牙齿调查",
|
||||
"min_level": 30,
|
||||
"sample_vnum": 30006, # 兽人牙齿
|
||||
"sample_name": "兽人牙齿",
|
||||
"target_count": 10,
|
||||
"soul_stone_vnum": 30220, # 兽人灵魂石
|
||||
"soul_stone_name": "兽人灵魂石",
|
||||
"reward_stats": {"move_speed": 10},
|
||||
"desc": "永久移动速度 +10"
|
||||
},
|
||||
{
|
||||
"stage_id": 2,
|
||||
"title": "【Lv 40 研究】诅咒之书调查",
|
||||
"min_level": 40,
|
||||
"sample_vnum": 30047, # 诅咒之书
|
||||
"sample_name": "诅咒之书",
|
||||
"target_count": 15,
|
||||
"soul_stone_vnum": 30221, # 诅咒灵魂石
|
||||
"soul_stone_name": "诅咒灵魂石",
|
||||
"reward_stats": {"cast_speed_pct": 5},
|
||||
"desc": "永久施法速度 +5%"
|
||||
},
|
||||
{
|
||||
"stage_id": 3,
|
||||
"title": "【Lv 50 研究】恶魔纪念物调查",
|
||||
"min_level": 50,
|
||||
"sample_vnum": 30015, # 恶魔纪念物
|
||||
"sample_name": "恶魔纪念物",
|
||||
"target_count": 15,
|
||||
"soul_stone_vnum": 30222, # 恶魔灵魂石
|
||||
"soul_stone_name": "恶魔灵魂石",
|
||||
"reward_stats": {"defense": 60},
|
||||
"desc": "永久防御力 +60"
|
||||
},
|
||||
{
|
||||
"stage_id": 4,
|
||||
"title": "【Lv 60 研究】冰之碎片调查",
|
||||
"min_level": 60,
|
||||
"sample_vnum": 30050, # 冰之碎片
|
||||
"sample_name": "冰之碎片",
|
||||
"target_count": 20,
|
||||
"soul_stone_vnum": 30223, # 冰霜灵魂石
|
||||
"soul_stone_name": "冰霜灵魂石",
|
||||
"reward_stats": {"attack_power": 50},
|
||||
"desc": "永久物理攻击力 +50"
|
||||
},
|
||||
{
|
||||
"stage_id": 5,
|
||||
"title": "【Lv 70 研究】幽灵树枝调查",
|
||||
"min_level": 70,
|
||||
"sample_vnum": 30165, # 幽灵树枝
|
||||
"sample_name": "幽灵树枝",
|
||||
"target_count": 25,
|
||||
"soul_stone_vnum": 30224, # 森林灵魂石
|
||||
"soul_stone_name": "森林灵魂石",
|
||||
"reward_stats": {"move_speed": 11, "damage_reduction_pct": 10},
|
||||
"desc": "永久移动速度 +11, 伤害抗性 +10%"
|
||||
},
|
||||
{
|
||||
"stage_id": 6,
|
||||
"title": "【Lv 80 研究】巨灵石碑调查",
|
||||
"min_level": 80,
|
||||
"sample_vnum": 30166, # 巨灵石碑
|
||||
"sample_name": "巨灵石碑",
|
||||
"target_count": 30,
|
||||
"soul_stone_vnum": 30225, # 巨灵灵魂石
|
||||
"soul_stone_name": "巨灵灵魂石",
|
||||
"reward_stats": {"attack_speed": 6, "attack_pct": 10},
|
||||
"desc": "永久攻击速度 +6, 物理伤害 +10%"
|
||||
},
|
||||
{
|
||||
"stage_id": 7,
|
||||
"title": "【Lv 85 研究】红木灵枝调查",
|
||||
"min_level": 85,
|
||||
"sample_vnum": 30167, # 红木灵枝
|
||||
"sample_name": "红木灵枝",
|
||||
"target_count": 40,
|
||||
"soul_stone_vnum": 30226, # 灵魂之石
|
||||
"soul_stone_name": "灵魂之石",
|
||||
"reward_stats": {"all_resistance_pct": 10},
|
||||
"desc": "永久全属性抗性 +10%"
|
||||
},
|
||||
{
|
||||
"stage_id": 8,
|
||||
"title": "【Lv 90 研究】首领领主证书调查",
|
||||
"min_level": 90,
|
||||
"sample_vnum": 30168, # 领主证书
|
||||
"sample_name": "首领领主证书",
|
||||
"target_count": 50,
|
||||
"soul_stone_vnum": 30227, # 首领灵魂石
|
||||
"soul_stone_name": "首领灵魂石",
|
||||
"reward_stats": {"boss_damage_pct": 10},
|
||||
"desc": "永久对野外首领伤害 +10%"
|
||||
}
|
||||
]
|
||||
|
||||
var current_stage_index: int = 0
|
||||
var current_samples: int = 0
|
||||
var waiting_for_soul_stone: bool = false
|
||||
var completed_stages: Array = []
|
||||
var permanent_bonuses: Dictionary = {}
|
||||
|
||||
# 获取当前正在进行的研究任务配置
|
||||
func get_current_stage() -> Dictionary:
|
||||
if current_stage_index >= RESEARCH_STAGES.size():
|
||||
return {} # 已全部完成
|
||||
return RESEARCH_STAGES[current_stage_index].duplicate(true)
|
||||
|
||||
# 交付样本材料
|
||||
func submit_sample(inventory: Array, slot_index: int, player_level: int, force_success: bool = false, use_elixir: bool = false) -> Dictionary:
|
||||
var stage = get_current_stage()
|
||||
if stage.is_empty():
|
||||
return {"ok": false, "reason": "ALL_RESEARCH_COMPLETED", "msg": "所有生物学者调查研究均已登峰造极!"}
|
||||
|
||||
if player_level < int(stage["min_level"]):
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "PLAYER_LEVEL_TOO_LOW",
|
||||
"msg": "等级不足!开启该阶段研究需达到 %d 级。" % int(stage["min_level"])
|
||||
}
|
||||
|
||||
if waiting_for_soul_stone:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "WAITING_FOR_SOUL_STONE",
|
||||
"msg": "样本已全部收集齐!请交付【%s】以完成终极认证。" % stage["soul_stone_name"]
|
||||
}
|
||||
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item: Dictionary = inventory[slot_index]
|
||||
var item_vnum := int(item.get("vnum", 0))
|
||||
if item_vnum != int(stage["sample_vnum"]):
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "WRONG_SAMPLE_ITEM",
|
||||
"msg": "车齿木摇了摇头:当前阶段需要研究的是【%s】!" % stage["sample_name"]
|
||||
}
|
||||
|
||||
# 消耗 1 件样本
|
||||
var cnt := int(item.get("count", 1))
|
||||
if cnt > 1:
|
||||
item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 判定成功率 (基础 60%,使用贤者之药 90%)
|
||||
var success_chance := 0.90 if use_elixir else 0.60
|
||||
var is_success := force_success or (randf() <= success_chance)
|
||||
|
||||
if is_success:
|
||||
current_samples += 1
|
||||
sample_submitted.emit(stage["sample_name"], true, current_samples, stage["target_count"])
|
||||
|
||||
# 检查样本是否集齐
|
||||
if current_samples >= int(stage["target_count"]):
|
||||
waiting_for_soul_stone = true
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"current": current_samples,
|
||||
"target": stage["target_count"],
|
||||
"need_soul_stone": true,
|
||||
"soul_stone_name": stage["soul_stone_name"],
|
||||
"msg": "样本品质极高!%d 件样本已全部收集完毕,请寻找【%s】交付!" % [current_samples, stage["soul_stone_name"]]
|
||||
}
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"current": current_samples,
|
||||
"target": stage["target_count"],
|
||||
"need_soul_stone": false,
|
||||
"msg": "样本验证成功!研究进度:(%d / %d)。" % [current_samples, stage["target_count"]]
|
||||
}
|
||||
else:
|
||||
sample_submitted.emit(stage["sample_name"], false, current_samples, stage["target_count"])
|
||||
return {
|
||||
"ok": true,
|
||||
"success": false,
|
||||
"current": current_samples,
|
||||
"target": stage["target_count"],
|
||||
"need_soul_stone": false,
|
||||
"msg": "学者车齿木叹息:这件样本受损严重,无法用于精炼分析。"
|
||||
}
|
||||
|
||||
# 交付关底灵魂石完成该阶段
|
||||
func submit_soul_stone(inventory: Array, slot_index: int, player_stats: Dictionary) -> Dictionary:
|
||||
var stage = get_current_stage()
|
||||
if stage.is_empty():
|
||||
return {"ok": false, "reason": "ALL_RESEARCH_COMPLETED"}
|
||||
|
||||
if not waiting_for_soul_stone:
|
||||
return {"ok": false, "reason": "SAMPLES_NOT_COMPLETED", "msg": "样本尚未收集齐,无法交付灵魂石!"}
|
||||
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item: Dictionary = inventory[slot_index]
|
||||
if int(item.get("vnum", 0)) != int(stage["soul_stone_vnum"]):
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "WRONG_SOUL_STONE",
|
||||
"msg": "需要交付的是专属的【%s】!" % stage["soul_stone_name"]
|
||||
}
|
||||
|
||||
# 消耗灵魂石
|
||||
var cnt := int(item.get("count", 1))
|
||||
if cnt > 1:
|
||||
item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 注入永久属性加成
|
||||
var rewards: Dictionary = stage.get("reward_stats", {})
|
||||
for k in rewards.keys():
|
||||
var val = int(rewards[k])
|
||||
player_stats[k] = int(player_stats.get(k, 0)) + val
|
||||
permanent_bonuses[k] = int(permanent_bonuses.get(k, 0)) + val
|
||||
|
||||
completed_stages.append(stage["stage_id"])
|
||||
current_stage_index += 1
|
||||
current_samples = 0
|
||||
waiting_for_soul_stone = false
|
||||
|
||||
capstone_submitted.emit(stage["soul_stone_name"], stage["title"])
|
||||
stage_completed.emit(stage["title"], rewards)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"completed_stage": stage["title"],
|
||||
"rewards": rewards,
|
||||
"permanent_bonuses": permanent_bonuses,
|
||||
"msg": "【%s】圆满达成!永久获得属性加成:%s!" % [stage["title"], stage["desc"]]
|
||||
}
|
||||
|
||||
# 序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"current_stage_index": current_stage_index,
|
||||
"current_samples": current_samples,
|
||||
"waiting_for_soul_stone": waiting_for_soul_stone,
|
||||
"completed_stages": completed_stages.duplicate(true),
|
||||
"permanent_bonuses": permanent_bonuses.duplicate(true)
|
||||
}
|
||||
|
||||
# 反序列化
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
current_stage_index = int(data.get("current_stage_index", 0))
|
||||
current_samples = int(data.get("current_samples", 0))
|
||||
waiting_for_soul_stone = bool(data.get("waiting_for_soul_stone", false))
|
||||
completed_stages = data.get("completed_stages", []).duplicate(true)
|
||||
permanent_bonuses = data.get("permanent_bonuses", {}).duplicate(true)
|
||||
@@ -1 +0,0 @@
|
||||
uid://dvues2wv3bqb1
|
||||
@@ -1,263 +0,0 @@
|
||||
# biologist_quest_system.gd —— Metin2 40250 生物学研究家任务链与永久属性加成系统 1:1
|
||||
# 对照 40250 服务端 collect_quest_lv30.quest ~ collect_quest_lv80.quest 及 char.cpp:ComputePoints
|
||||
class_name BiologistQuestSystem
|
||||
extends RefCounted
|
||||
|
||||
const NPC_CHAEGIRAB := 20084
|
||||
const ITEM_SPIRAL_POTION := 71035 # 灵魂秘药 / 研究家的秘药
|
||||
|
||||
const STAGES: Array[Dictionary] = [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Lv30 兽人的牙齿研究",
|
||||
"required_level": 30,
|
||||
"collect_vnum": 30006, # 兽人齿
|
||||
"collect_name": "兽人齿",
|
||||
"collect_count": 10,
|
||||
"soul_stone_vnum": 30220, # 兽人灵魂石
|
||||
"soul_stone_name": "金龙之灵魂石",
|
||||
"reward_type": "move_speed",
|
||||
"reward_value": 10,
|
||||
"reward_title": "永久移动速度 +10"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Lv40 诅咒之书研究",
|
||||
"required_level": 40,
|
||||
"collect_vnum": 30047, # 诅咒书
|
||||
"collect_name": "诅咒之书",
|
||||
"collect_count": 15,
|
||||
"soul_stone_vnum": 30221, # 诅咒灵魂石
|
||||
"soul_stone_name": "神殿之灵魂石",
|
||||
"reward_type": "att_speed",
|
||||
"reward_value": 5,
|
||||
"reward_title": "永久攻击速度 +5"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Lv50 恶魔纪念物研究",
|
||||
"required_level": 50,
|
||||
"collect_vnum": 30015, # 恶魔纪念物
|
||||
"collect_name": "恶魔纪念物",
|
||||
"collect_count": 15,
|
||||
"soul_stone_vnum": 30222, # 恶魔灵魂石
|
||||
"soul_stone_name": "恶魔之灵魂石",
|
||||
"reward_type": "def_grade",
|
||||
"reward_value": 60,
|
||||
"reward_title": "永久防御力 +60"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Lv60 冰球研究",
|
||||
"required_level": 60,
|
||||
"collect_vnum": 30050, # 冰球
|
||||
"collect_name": "冰球",
|
||||
"collect_count": 20,
|
||||
"soul_stone_vnum": 30223, # 冰球灵魂石
|
||||
"soul_stone_name": "雪山之灵魂石",
|
||||
"reward_type": "att_grade",
|
||||
"reward_value": 50,
|
||||
"reward_title": "永久攻击力 +50"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Lv70 幽灵树枝研究",
|
||||
"required_level": 70,
|
||||
"collect_vnum": 30165, # 幽灵树枝
|
||||
"collect_name": "幽灵树枝",
|
||||
"collect_count": 25,
|
||||
"soul_stone_vnum": 30224, # 幽灵灵魂石
|
||||
"soul_stone_name": "鬼树之灵魂石",
|
||||
"reward_type": "damage_reduction",
|
||||
"reward_value": 10,
|
||||
"reward_title": "受到伤害永久减少 10%"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Lv80 图基石板研究",
|
||||
"required_level": 80,
|
||||
"collect_vnum": 30166, # 图基石板
|
||||
"collect_name": "图基石板",
|
||||
"collect_count": 30,
|
||||
"soul_stone_vnum": 30225, # 图基灵魂石
|
||||
"soul_stone_name": "图基之灵魂石",
|
||||
"reward_type": "att_grade_pct",
|
||||
"reward_value": 10,
|
||||
"reward_title": "物理攻击力永久提升 10%"
|
||||
}
|
||||
]
|
||||
|
||||
var player_level: int = 1
|
||||
var current_stage_idx: int = -1 # -1: 未开始
|
||||
var delivered_count: int = 0
|
||||
var soul_stone_phase: bool = false
|
||||
var completed_stages: Array[int] = []
|
||||
var cooldown_remaining: float = 0.0
|
||||
|
||||
var permanent_bonuses: Dictionary = {
|
||||
"move_speed": 0,
|
||||
"att_speed": 0,
|
||||
"def_grade": 0,
|
||||
"att_grade": 0,
|
||||
"damage_reduction": 0,
|
||||
"att_grade_pct": 0
|
||||
}
|
||||
|
||||
func init_for_player(level: int) -> void:
|
||||
player_level = level
|
||||
_check_available_stage()
|
||||
|
||||
func _check_available_stage() -> void:
|
||||
if current_stage_idx >= 0 and current_stage_idx < STAGES.size():
|
||||
return # 正在进行中
|
||||
|
||||
for i in range(STAGES.size()):
|
||||
if i not in completed_stages:
|
||||
var stage: Dictionary = STAGES[i]
|
||||
if player_level >= int(stage["required_level"]):
|
||||
current_stage_idx = i
|
||||
delivered_count = 0
|
||||
soul_stone_phase = false
|
||||
break
|
||||
|
||||
func get_current_stage() -> Dictionary:
|
||||
if current_stage_idx >= 0 and current_stage_idx < STAGES.size():
|
||||
return STAGES[current_stage_idx]
|
||||
return {}
|
||||
|
||||
func can_submit() -> bool:
|
||||
return current_stage_idx >= 0 and not soul_stone_phase and cooldown_remaining <= 0.0
|
||||
|
||||
func submit_item(inventory: Array, use_potion: bool = false, force_success: bool = false) -> Dictionary:
|
||||
if current_stage_idx < 0 or current_stage_idx >= STAGES.size():
|
||||
return {"ok": false, "reason": "NO_ACTIVE_QUEST"}
|
||||
if soul_stone_phase:
|
||||
return {"ok": false, "reason": "NEED_SOUL_STONE"}
|
||||
if cooldown_remaining > 0.0 and not use_potion:
|
||||
return {"ok": false, "reason": "COOLDOWN_ACTIVE", "remaining": cooldown_remaining}
|
||||
|
||||
var stage: Dictionary = STAGES[current_stage_idx]
|
||||
var req_vnum: int = int(stage["collect_vnum"])
|
||||
|
||||
# 查找收集物槽位
|
||||
var item_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
var it = inventory[i]
|
||||
if it != null and int(it.get("vnum", 0)) == req_vnum:
|
||||
item_slot = i
|
||||
break
|
||||
|
||||
if item_slot == -1:
|
||||
return {"ok": false, "reason": "MISSING_ITEM", "vnum": req_vnum}
|
||||
|
||||
# 检查秘药
|
||||
var potion_consumed := false
|
||||
if use_potion:
|
||||
for i in range(inventory.size()):
|
||||
var it = inventory[i]
|
||||
if it != null and int(it.get("vnum", 0)) == ITEM_SPIRAL_POTION:
|
||||
inventory[i] = null
|
||||
potion_consumed = true
|
||||
cooldown_remaining = 0.0
|
||||
break
|
||||
|
||||
# 扣除收集物
|
||||
inventory[item_slot] = null
|
||||
|
||||
# 成功判定 (默认 60%,秘药 90%)
|
||||
var success_chance: float = 0.90 if potion_consumed else 0.60
|
||||
var roll: float = 0.0 if force_success else randf()
|
||||
var success := roll < success_chance
|
||||
|
||||
if not success:
|
||||
cooldown_remaining = 0.0 if potion_consumed else 3600.0 # 1 小时
|
||||
return {
|
||||
"ok": true,
|
||||
"success": false,
|
||||
"delivered": delivered_count,
|
||||
"target": stage["collect_count"],
|
||||
"msg": "样本已损坏,未能提取有效数据!"
|
||||
}
|
||||
|
||||
# 成功交付
|
||||
delivered_count += 1
|
||||
var target_count: int = int(stage["collect_count"])
|
||||
if delivered_count >= target_count:
|
||||
soul_stone_phase = true
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"delivered": delivered_count,
|
||||
"target": target_count,
|
||||
"stage_completed": true,
|
||||
"msg": "研究样本收集完毕!接下来请获取专属灵魂石交付!"
|
||||
}
|
||||
else:
|
||||
cooldown_remaining = 0.0 if potion_consumed else 3600.0
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"delivered": delivered_count,
|
||||
"target": target_count,
|
||||
"stage_completed": false,
|
||||
"msg": "样本质量极佳!已记录样本数据。"
|
||||
}
|
||||
|
||||
func submit_soul_stone(inventory: Array) -> Dictionary:
|
||||
if current_stage_idx < 0 or current_stage_idx >= STAGES.size():
|
||||
return {"ok": false, "reason": "NO_ACTIVE_QUEST"}
|
||||
if not soul_stone_phase:
|
||||
return {"ok": false, "reason": "NOT_IN_SOUL_STONE_PHASE"}
|
||||
|
||||
var stage: Dictionary = STAGES[current_stage_idx]
|
||||
var soul_vnum: int = int(stage["soul_stone_vnum"])
|
||||
|
||||
var found_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
var it = inventory[i]
|
||||
if it != null and int(it.get("vnum", 0)) == soul_vnum:
|
||||
found_slot = i
|
||||
break
|
||||
|
||||
if found_slot == -1:
|
||||
return {"ok": false, "reason": "MISSING_SOUL_STONE", "vnum": soul_vnum}
|
||||
|
||||
# 消耗灵魂石
|
||||
inventory[found_slot] = null
|
||||
|
||||
# 结算阶段奖励
|
||||
var reward_type: String = String(stage["reward_type"])
|
||||
var reward_val: int = int(stage["reward_value"])
|
||||
permanent_bonuses[reward_type] = int(permanent_bonuses.get(reward_type, 0)) + reward_val
|
||||
completed_stages.append(current_stage_idx)
|
||||
|
||||
var finished_stage_id: int = current_stage_idx
|
||||
current_stage_idx = -1
|
||||
delivered_count = 0
|
||||
soul_stone_phase = false
|
||||
cooldown_remaining = 0.0
|
||||
|
||||
# 检查下一阶段
|
||||
_check_available_stage()
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"completed_stage": finished_stage_id,
|
||||
"reward_title": stage["reward_title"],
|
||||
"reward_type": reward_type,
|
||||
"reward_value": reward_val,
|
||||
"all_bonuses": permanent_bonuses.duplicate()
|
||||
}
|
||||
|
||||
func get_quest_status() -> Dictionary:
|
||||
return {
|
||||
"player_level": player_level,
|
||||
"stage_idx": current_stage_idx,
|
||||
"stage_info": get_current_stage(),
|
||||
"delivered": delivered_count,
|
||||
"target": int(get_current_stage().get("collect_count", 0)),
|
||||
"soul_stone_phase": soul_stone_phase,
|
||||
"cooldown_remaining": cooldown_remaining,
|
||||
"completed_stages": completed_stages,
|
||||
"permanent_bonuses": permanent_bonuses
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cqcq40dpplogo
|
||||
@@ -1,312 +0,0 @@
|
||||
# boss_summon_scroll_system.gd —— Metin2 40250 官方首领降临与魔石/矿脉召唤卷轴系统 1:1
|
||||
# 100% 对照 40250 服务端 special_item_group.txt, char_item.cpp (ITEM_GIFTBOX), char_manager.cpp
|
||||
class_name BossSummonScrollSystem
|
||||
extends RefCounted
|
||||
|
||||
signal boss_summoned(mob_vnum: int, mob_name: String, spawn_pos: Vector2, is_aggressive: bool)
|
||||
signal metin_summoned(metin_vnum: int, metin_name: String, spawn_pos: Vector2, level: int)
|
||||
signal ore_vein_summoned(vein_vnum: int, vein_name: String, spawn_pos: Vector2)
|
||||
signal summon_failed(reason: String)
|
||||
|
||||
# ==========================================
|
||||
# 40250 官方首领召唤卷轴 (Boss Summon Scrolls)
|
||||
# 对应 special_item_group.txt Vnum 71036 ~ 71043
|
||||
# ==========================================
|
||||
const BOSS_SCROLLS: Dictionary = {
|
||||
71036: {
|
||||
"name": "兽人首领召唤卷轴",
|
||||
"tr_name": "Kağıt-Ork Şefi",
|
||||
"mob_vnum": 691,
|
||||
"mob_name": "兽人首领 (Orc Chief)",
|
||||
"level": 50,
|
||||
"rank": 4, # BOSS
|
||||
"is_aggressive": true
|
||||
},
|
||||
71037: {
|
||||
"name": "密教首领召唤卷轴",
|
||||
"tr_name": "Kağıt-Karanlık Lider",
|
||||
"mob_vnum": 791,
|
||||
"mob_name": "黑风教主/密教首领 (Dark Leader)",
|
||||
"level": 54,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71038: {
|
||||
"name": "蜘蛛女王召唤卷轴",
|
||||
"tr_name": "Kağıt-Kraliçe Örümcek",
|
||||
"mob_vnum": 2091,
|
||||
"mob_name": "蜘蛛女王 (Spider Queen)",
|
||||
"level": 60,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71039: {
|
||||
"name": "沙漠巨龟召唤卷轴",
|
||||
"tr_name": "Kağıt-Kaplumbağa",
|
||||
"mob_vnum": 2191,
|
||||
"mob_name": "沙漠巨龟 (Giant Desert Tortoise)",
|
||||
"level": 67,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71040: {
|
||||
"name": "烈焰魔王召唤卷轴",
|
||||
"tr_name": "Kağıt-Alev Kral",
|
||||
"mob_vnum": 2206,
|
||||
"mob_name": "烈焰魔王 (Flame King)",
|
||||
"level": 73,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71041: {
|
||||
"name": "九尾狐召唤卷轴",
|
||||
"tr_name": "Kağıt-Dokuz Kuyruk",
|
||||
"mob_vnum": 1901,
|
||||
"mob_name": "九尾狐仙 (Nine Tails)",
|
||||
"level": 72,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71042: {
|
||||
"name": "恶魔之王召唤卷轴",
|
||||
"tr_name": "Kağıt-Şeytan Kral",
|
||||
"mob_vnum": 1091,
|
||||
"mob_name": "恶魔之王 (Demon King)",
|
||||
"level": 75,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
},
|
||||
71043: {
|
||||
"name": "虎灵妖兽召唤卷轴",
|
||||
"tr_name": "Sarı Kaplan H. Kağıdı",
|
||||
"mob_vnum": 1304,
|
||||
"mob_name": "黄虎幽灵 (Tiger Ghost)",
|
||||
"level": 75,
|
||||
"rank": 4,
|
||||
"is_aggressive": true
|
||||
}
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 40250 官方魔石召唤卷轴 (Metin Summon Scrolls)
|
||||
# 对应 special_item_group.txt Vnum 71080 ~ 71082
|
||||
# ==========================================
|
||||
const METIN_SCROLLS: Dictionary = {
|
||||
71080: {
|
||||
"name": "初级魔石召唤卷",
|
||||
"tr_name": "Metin Taşı Çağırma Kağıdı (K)",
|
||||
"pool": [
|
||||
{"vnum": 8001, "name": "悲哀之石 (Metin of Sorrow)", "level": 5},
|
||||
{"vnum": 8002, "name": "战斗之石 (Metin of Combat)", "level": 10},
|
||||
{"vnum": 8003, "name": "会战之石 (Metin of Battle)", "level": 15},
|
||||
{"vnum": 8004, "name": "贪婪之石 (Metin of Greed)", "level": 20},
|
||||
{"vnum": 8005, "name": "漆黑之石 (Metin of Black)", "level": 25}
|
||||
]
|
||||
},
|
||||
71081: {
|
||||
"name": "中级魔石召唤卷",
|
||||
"tr_name": "Metin Taşı Çağırma Kağıdı (O)",
|
||||
"pool": [
|
||||
{"vnum": 8006, "name": "黑暗之石 (Metin of Darkness)", "level": 30},
|
||||
{"vnum": 8007, "name": "嫉妒之石 (Metin of Jealousy)", "level": 35},
|
||||
{"vnum": 8008, "name": "灵魂之石 (Metin of Soul)", "level": 40},
|
||||
{"vnum": 8009, "name": "阴影之石 (Metin of Shadow)", "level": 45},
|
||||
{"vnum": 8010, "name": "强韧之石 (Metin of Toughness)", "level": 50}
|
||||
]
|
||||
},
|
||||
71082: {
|
||||
"name": "高级魔石召唤卷",
|
||||
"tr_name": "Metin Taşı Çağırma Kağıdı (Z)",
|
||||
"pool": [
|
||||
{"vnum": 8011, "name": "恶魔之石 (Metin of Devil)", "level": 55},
|
||||
{"vnum": 8012, "name": "陨落之石 (Metin of Fall)", "level": 60},
|
||||
{"vnum": 8013, "name": "死者之石 (Metin of Death)", "level": 65},
|
||||
{"vnum": 8014, "name": "屠杀之石 (Metin of Murder)", "level": 70},
|
||||
{"vnum": 8024, "name": "狂风之石 (Metin of Pung-Ma)", "level": 75},
|
||||
{"vnum": 8025, "name": "魔岩之石 (Metin of Ma-An)", "level": 80},
|
||||
{"vnum": 8026, "name": "斗击之石 (Metin of Tu-Gyuk)", "level": 85},
|
||||
{"vnum": 8027, "name": "绝望之石 (Metin of Jeon-Un)", "level": 90}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 40250 官方矿脉召唤卷轴 (Ore Vein Scrolls)
|
||||
# 对应 special_item_group.txt Vnum 71057 ~ 71067
|
||||
# ==========================================
|
||||
const ORE_VEIN_SCROLLS: Dictionary = {
|
||||
71057: {"mob_vnum": 20049, "name": "钻石矿脉 (Diamond Vein)"},
|
||||
71058: {"mob_vnum": 20050, "name": "琥珀矿脉 (Amber Vein)"},
|
||||
71059: {"mob_vnum": 20051, "name": "木化石矿脉 (Fossil Wood Vein)"},
|
||||
71060: {"mob_vnum": 20052, "name": "铜矿脉 (Copper Vein)"},
|
||||
71061: {"mob_vnum": 20053, "name": "银矿脉 (Silver Vein)"},
|
||||
71062: {"mob_vnum": 20054, "name": "金矿脉 (Gold Vein)"},
|
||||
71063: {"mob_vnum": 20055, "name": "翡翠矿脉 (Jade Vein)"},
|
||||
71064: {"mob_vnum": 20056, "name": "黑檀木矿脉 (Ebony Vein)"},
|
||||
71065: {"mob_vnum": 20057, "name": "珍珠矿脉 (Pearl Vein)"},
|
||||
71066: {"mob_vnum": 20058, "name": "白金矿脉 (White Gold Vein)"},
|
||||
71067: {"mob_vnum": 20059, "name": "水晶矿脉 (Crystal Vein)"}
|
||||
}
|
||||
|
||||
# 当前已召唤生成的实体记录列表
|
||||
var _active_summoned_entities: Array[Dictionary] = []
|
||||
|
||||
# 判断是否是 40250 原版召唤卷轴
|
||||
func is_summon_scroll(vnum: int) -> bool:
|
||||
return BOSS_SCROLLS.has(vnum) or METIN_SCROLLS.has(vnum) or ORE_VEIN_SCROLLS.has(vnum)
|
||||
|
||||
# 获取召唤卷轴类型类别
|
||||
func get_scroll_category(vnum: int) -> String:
|
||||
if BOSS_SCROLLS.has(vnum):
|
||||
return "boss"
|
||||
elif METIN_SCROLLS.has(vnum):
|
||||
return "metin"
|
||||
elif ORE_VEIN_SCROLLS.has(vnum):
|
||||
return "ore_vein"
|
||||
return ""
|
||||
|
||||
# 使用召唤卷轴
|
||||
func use_summon_scroll(
|
||||
inventory: Array,
|
||||
slot_index: int,
|
||||
player_pos: Vector2,
|
||||
is_in_safe_zone: bool,
|
||||
forced_choice_idx: int = -1
|
||||
) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size():
|
||||
summon_failed.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "无效的背包物品格位!"}
|
||||
|
||||
var item = inventory[slot_index]
|
||||
if item == null:
|
||||
summon_failed.emit("EMPTY_SLOT")
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "指定格位没有任何道具!"}
|
||||
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
var category = get_scroll_category(vnum)
|
||||
if category == "":
|
||||
summon_failed.emit("NOT_A_SUMMON_SCROLL")
|
||||
return {"ok": false, "reason": "NOT_A_SUMMON_SCROLL", "msg": "此物品并非怪物或魔石召唤卷轴!"}
|
||||
|
||||
# 40250 原版规则:安全区内禁止召唤具有攻击性的首领与魔石
|
||||
if is_in_safe_zone and category != "ore_vein":
|
||||
summon_failed.emit("CANNOT_SPAWN_IN_SAFEZONE")
|
||||
return {"ok": false, "reason": "CANNOT_SPAWN_IN_SAFEZONE", "msg": "在安全区内无法召唤怪物!请移至野外危险区域。"}
|
||||
|
||||
# 扣除卷轴消耗 (40250 item->SetCount(item->GetCount()-1))
|
||||
var current_count = int(item.get("count", 1))
|
||||
if current_count > 1:
|
||||
item["count"] = current_count - 1
|
||||
else:
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 生成随机偏移位置 (类似 40250 GetX() + number(-500, 500))
|
||||
var offset_x = randf_range(-120.0, 120.0)
|
||||
var offset_y = randf_range(-120.0, 120.0)
|
||||
# 确保不会生成在绝对重合点
|
||||
if abs(offset_x) < 30.0:
|
||||
offset_x = 50.0 if offset_x >= 0.0 else -50.0
|
||||
if abs(offset_y) < 30.0:
|
||||
offset_y = 50.0 if offset_y >= 0.0 else -50.0
|
||||
|
||||
var spawn_pos = Vector2(player_pos.x + offset_x, player_pos.y + offset_y)
|
||||
var summoned_entity: Dictionary = {}
|
||||
|
||||
match category:
|
||||
"boss":
|
||||
var boss_info = BOSS_SCROLLS[vnum]
|
||||
summoned_entity = {
|
||||
"vnum": int(boss_info["mob_vnum"]),
|
||||
"name": str(boss_info["mob_name"]),
|
||||
"level": int(boss_info["level"]),
|
||||
"rank": int(boss_info["rank"]),
|
||||
"pos": spawn_pos,
|
||||
"is_aggressive": true,
|
||||
"category": "boss",
|
||||
"summoner_pos": player_pos
|
||||
}
|
||||
_active_summoned_entities.append(summoned_entity)
|
||||
boss_summoned.emit(summoned_entity["vnum"], summoned_entity["name"], spawn_pos, true)
|
||||
|
||||
"metin":
|
||||
var metin_scroll = METIN_SCROLLS[vnum]
|
||||
var pool: Array = metin_scroll["pool"]
|
||||
var picked_idx = 0
|
||||
if forced_choice_idx >= 0 and forced_choice_idx < pool.size():
|
||||
picked_idx = forced_choice_idx
|
||||
else:
|
||||
picked_idx = randi() % pool.size()
|
||||
|
||||
var picked_metin = pool[picked_idx]
|
||||
summoned_entity = {
|
||||
"vnum": int(picked_metin["vnum"]),
|
||||
"name": str(picked_metin["name"]),
|
||||
"level": int(picked_metin["level"]),
|
||||
"rank": 5, # STONE
|
||||
"pos": spawn_pos,
|
||||
"is_aggressive": false,
|
||||
"category": "metin",
|
||||
"summoner_pos": player_pos
|
||||
}
|
||||
_active_summoned_entities.append(summoned_entity)
|
||||
metin_summoned.emit(summoned_entity["vnum"], summoned_entity["name"], spawn_pos, summoned_entity["level"])
|
||||
|
||||
"ore_vein":
|
||||
var vein_info = ORE_VEIN_SCROLLS[vnum]
|
||||
summoned_entity = {
|
||||
"vnum": int(vein_info["mob_vnum"]),
|
||||
"name": str(vein_info["name"]),
|
||||
"pos": spawn_pos,
|
||||
"is_aggressive": false,
|
||||
"category": "ore_vein",
|
||||
"summoner_pos": player_pos
|
||||
}
|
||||
_active_summoned_entities.append(summoned_entity)
|
||||
ore_vein_summoned.emit(summoned_entity["vnum"], summoned_entity["name"], spawn_pos)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"category": category,
|
||||
"entity": summoned_entity,
|
||||
"msg": "卷轴散发出一道耀眼的光芒,强大的封印能量破空而出!"
|
||||
}
|
||||
|
||||
# 获取当前已召唤的所有活跃实体
|
||||
func get_active_summoned_entities() -> Array[Dictionary]:
|
||||
return _active_summoned_entities
|
||||
|
||||
# 清空/移除已击败或离开的实体
|
||||
func remove_summoned_entity(index: int) -> bool:
|
||||
if index >= 0 and index < _active_summoned_entities.size():
|
||||
_active_summoned_entities.remove_at(index)
|
||||
return true
|
||||
return false
|
||||
|
||||
func clear_summoned_entities() -> void:
|
||||
_active_summoned_entities.clear()
|
||||
|
||||
# 存档与读档支持
|
||||
func serialize() -> Dictionary:
|
||||
var list_copy: Array = []
|
||||
for e in _active_summoned_entities:
|
||||
var pos_dict = {"x": e["pos"].x, "y": e["pos"].y}
|
||||
var copy_e = e.duplicate()
|
||||
copy_e["pos"] = pos_dict
|
||||
if copy_e.has("summoner_pos"):
|
||||
copy_e["summoner_pos"] = {"x": e["summoner_pos"].x, "y": e["summoner_pos"].y}
|
||||
list_copy.append(copy_e)
|
||||
return {
|
||||
"active_entities": list_copy
|
||||
}
|
||||
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
_active_summoned_entities.clear()
|
||||
var raw_list = data.get("active_entities", [])
|
||||
for item in raw_list:
|
||||
var pos_data = item.get("pos", {"x": 0.0, "y": 0.0})
|
||||
var ent = item.duplicate()
|
||||
ent["pos"] = Vector2(pos_data.get("x", 0.0), pos_data.get("y", 0.0))
|
||||
if ent.has("summoner_pos"):
|
||||
var sp_data = ent.get("summoner_pos", {"x": 0.0, "y": 0.0})
|
||||
ent["summoner_pos"] = Vector2(sp_data.get("x", 0.0), sp_data.get("y", 0.0))
|
||||
_active_summoned_entities.append(ent)
|
||||
@@ -1 +0,0 @@
|
||||
uid://xjrr61n0rkui
|
||||
@@ -1,147 +0,0 @@
|
||||
# chat_hyperlink_dice_system.gd —— 40250 聊天物品超链接与 /dice 掷骰系统 1:1
|
||||
# 严格对照:
|
||||
# ClientVS22/source/EterLib/TextTag.cpp:32 (Hyperlink |Hitem:vnum:flags:socket:attr|h[%s]|h)
|
||||
# Client/Eternexus/root/uichat.py & uitooltip.py (ItemHyperlink, SetHyperlinkItem)
|
||||
# metin2/src/server/game/src/cmd_general.cpp:2392 (do_dice)
|
||||
extends RefCounted
|
||||
|
||||
const LINK_COLOR := "ffffc700" # 官方物品链接专用亮金黄色
|
||||
|
||||
# 1. 将物品数据编码为 40250 官方超链接格式
|
||||
# 格式: |cffffc700|Hitem:vnum:flags:s0:s1:s2:a0_t:a0_v:a1_t:a1_v:...|h[物品名]|h|r
|
||||
static func encode_item_hyperlink(item_data: Dictionary) -> String:
|
||||
var vnum: int = item_data.get("vnum", 0)
|
||||
var name: String = item_data.get("name", "Unknown Item")
|
||||
var flags: int = item_data.get("flags", 0)
|
||||
|
||||
var sockets: Array = item_data.get("sockets", [0, 0, 0])
|
||||
while sockets.size() < 3:
|
||||
sockets.append(0)
|
||||
|
||||
var attrs: Array = item_data.get("attributes", [])
|
||||
var attr_parts: Array = []
|
||||
for a in attrs:
|
||||
attr_parts.append("%d:%d" % [a.get("type", 0), a.get("value", 0)])
|
||||
|
||||
var payload_parts := [
|
||||
str(vnum),
|
||||
str(flags),
|
||||
str(sockets[0]),
|
||||
str(sockets[1]),
|
||||
str(sockets[2])
|
||||
]
|
||||
if not attr_parts.is_empty():
|
||||
payload_parts.append((":").join(attr_parts))
|
||||
|
||||
var payload := (":").join(payload_parts)
|
||||
return "|c%s|Hitem:%s|h[%s]|h|r" % [LINK_COLOR, payload, name]
|
||||
|
||||
# 2. 从超链接中解析提取物品完整数据结构 (1:1 TextTag::FindHyperlink)
|
||||
static func decode_item_hyperlink(hyperlink_text: String) -> Dictionary:
|
||||
var res := {
|
||||
"valid": false,
|
||||
"vnum": 0,
|
||||
"name": "",
|
||||
"flags": 0,
|
||||
"sockets": [0, 0, 0],
|
||||
"attributes": []
|
||||
}
|
||||
|
||||
# 正则或字符串匹配提取 |Hitem:(.+?)\|h\[(.*?)\]\|h
|
||||
var h_start := hyperlink_text.find("|Hitem:")
|
||||
if h_start == -1:
|
||||
return res
|
||||
|
||||
var payload_start := h_start + 7 # len("|Hitem:")
|
||||
var payload_end := hyperlink_text.find("|h[", payload_start)
|
||||
if payload_end == -1:
|
||||
return res
|
||||
|
||||
var payload := hyperlink_text.substr(payload_start, payload_end - payload_start)
|
||||
|
||||
var name_start := payload_end + 3 # len("|h[")
|
||||
var name_end := hyperlink_text.find("]|h", name_start)
|
||||
if name_end == -1:
|
||||
return res
|
||||
|
||||
var display_name := hyperlink_text.substr(name_start, name_end - name_start)
|
||||
res["name"] = display_name
|
||||
|
||||
var tokens := payload.split(":")
|
||||
if tokens.size() < 5:
|
||||
return res
|
||||
|
||||
res["vnum"] = tokens[0].to_int()
|
||||
res["flags"] = tokens[1].to_int()
|
||||
res["sockets"] = [tokens[2].to_int(), tokens[3].to_int(), tokens[4].to_int()]
|
||||
|
||||
# 解析属性对 (type:value)
|
||||
var attrs: Array = []
|
||||
var idx := 5
|
||||
while idx + 1 < tokens.size():
|
||||
var at_type := tokens[idx].to_int()
|
||||
var at_val := tokens[idx + 1].to_int()
|
||||
attrs.append({ "type": at_type, "value": at_val })
|
||||
idx += 2
|
||||
|
||||
res["attributes"] = attrs
|
||||
res["valid"] = true
|
||||
return res
|
||||
|
||||
# 3. 模拟 Tooltip 生成(悬停时渲染内容)
|
||||
static func build_tooltip_text(item_dict: Dictionary) -> String:
|
||||
if not item_dict.get("valid", false):
|
||||
return "无效的物品链接"
|
||||
|
||||
var lines: Array = []
|
||||
lines.append("=== %s (Vnum: %d) ===" % [item_dict["name"], item_dict["vnum"]])
|
||||
|
||||
# 宝石孔位信息
|
||||
var sockets: Array = item_dict.get("sockets", [])
|
||||
for i in range(sockets.size()):
|
||||
var s: int = sockets[i]
|
||||
if s > 0:
|
||||
lines.append("孔位 %d: 镶嵌宝石 [Vnum %d]" % [i + 1, s])
|
||||
elif s == 1: # 官方孔位开孔标记
|
||||
lines.append("孔位 %d: 空孔" % [i + 1])
|
||||
|
||||
# 附加属性信息 (1~7 条)
|
||||
var attrs: Array = item_dict.get("attributes", [])
|
||||
for a in attrs:
|
||||
lines.append("附加属性: 类型 %d +%d" % [a["type"], a["value"]])
|
||||
|
||||
return ("\n").join(lines)
|
||||
|
||||
# 4. 40250 官方 /dice 掷骰系统 (1:1 ACMD(do_dice))
|
||||
static func execute_dice(player_name: String, args: Array = [], roll_override: int = -1) -> Dictionary:
|
||||
var start_val := 1
|
||||
var end_val := 100
|
||||
|
||||
if args.size() >= 2:
|
||||
start_val = int(args[0])
|
||||
end_val = int(args[1])
|
||||
elif args.size() == 1:
|
||||
start_val = 1
|
||||
end_val = int(args[0])
|
||||
|
||||
# 40250 规则: end = MAX(start, end); start = MIN(start, end);
|
||||
var real_start := mini(start_val, end_val)
|
||||
var real_end := maxi(start_val, end_val)
|
||||
|
||||
var roll_result: int = 0
|
||||
if roll_override >= 0:
|
||||
roll_result = clamp(roll_override, real_start, real_end)
|
||||
else:
|
||||
roll_result = randi() % (real_end - real_start + 1) + real_start
|
||||
|
||||
var broadcast_msg := "%s 投掷了骰子,点数为 %d (%d-%d)" % [
|
||||
player_name, roll_result, real_start, real_end
|
||||
]
|
||||
|
||||
return {
|
||||
"player": player_name,
|
||||
"roll": roll_result,
|
||||
"start": real_start,
|
||||
"end": real_end,
|
||||
"message": broadcast_msg
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bnktthkdod33w
|
||||
@@ -1,233 +0,0 @@
|
||||
# class_specialization_system.gd —— Metin2 40250 角色 30 级双流派转职与无损洗髓系统 1:1
|
||||
# 对照 40250 服务端 quest/skill_group.quest, char_skill.cpp, cmd_general.cpp
|
||||
class_name ClassSpecializationSystem
|
||||
extends RefCounted
|
||||
|
||||
signal specialization_chosen(job: int, spec_id: int, spec_name: String)
|
||||
signal skill_point_allocated(skill_vnum: int, new_level: int, remaining_points: int)
|
||||
signal specialization_reset(refunded_points: int)
|
||||
|
||||
const VNUM_RESET_SCROLL := 71100 # 洗髓卷轴 / 重新分配技能书 (Scroll of Redistribution)
|
||||
const REQUIRED_LEVEL := 30 # 转职等级门槛
|
||||
|
||||
const SPEC_TREE: Dictionary = {
|
||||
0: { # 战士
|
||||
1: {
|
||||
"name": "战狂流派 (Arahan)",
|
||||
"desc": "极度偏向狂暴输出与高速连斩,兼具霸体与破坏力",
|
||||
"skills": {
|
||||
1: "三连斩",
|
||||
2: "旋风斩",
|
||||
3: "狂战士",
|
||||
4: "剑气",
|
||||
5: "冲锋"
|
||||
}
|
||||
},
|
||||
2: {
|
||||
"name": "圣战流派 (Partisan)",
|
||||
"desc": "坚若磐石的钢铁之躯,以强身术与精神打击粉碎强敌",
|
||||
"skills": {
|
||||
16: "强身术",
|
||||
17: "精神打击",
|
||||
18: "宝剑斩",
|
||||
19: "震地波",
|
||||
20: "剑气斩"
|
||||
}
|
||||
}
|
||||
},
|
||||
1: { # 刺客
|
||||
1: {
|
||||
"name": "近战刺客流派 (Dagger)",
|
||||
"desc": "隐身于阴影之中,擅长淬毒与致命近身背刺",
|
||||
"skills": {
|
||||
31: "伏击",
|
||||
32: "绝杀",
|
||||
33: "匕首旋风",
|
||||
34: "隐身术",
|
||||
35: "毒刃"
|
||||
}
|
||||
},
|
||||
2: {
|
||||
"name": "远程弓箭流派 (Archer)",
|
||||
"desc": "千里之外取敌首级,漫天箭雨与火炎穿透射击",
|
||||
"skills": {
|
||||
46: "连射",
|
||||
47: "箭雨",
|
||||
48: "火炎箭",
|
||||
49: "疾风步",
|
||||
50: "毒箭"
|
||||
}
|
||||
}
|
||||
},
|
||||
2: { # 修罗
|
||||
1: {
|
||||
"name": "魔剑修罗流派 (Weapon)",
|
||||
"desc": "附魔之刃附体,吸血噬魂与破魔剑气并存",
|
||||
"skills": {
|
||||
61: "附魔之刃",
|
||||
62: "附魔之甲",
|
||||
63: "惧意",
|
||||
64: "龙卷风",
|
||||
65: "手指戳击"
|
||||
}
|
||||
},
|
||||
2: {
|
||||
"name": "黑魔法修罗流派 (Black Magic)",
|
||||
"desc": "掌控幽冥暗焰,幽暗之盾抵消伤害,黑暗之球远程轰杀",
|
||||
"skills": {
|
||||
76: "幽冥一击",
|
||||
77: "烈焰一击",
|
||||
78: "黑暗之球",
|
||||
79: "幽暗之盾",
|
||||
80: "鬼影步"
|
||||
}
|
||||
}
|
||||
},
|
||||
3: { # 萨满
|
||||
1: {
|
||||
"name": "巨龙神圣辅助流派 (Dragon)",
|
||||
"desc": "掌控巨龙图腾之力,为团队提供巨龙之赐与龙之协助光环",
|
||||
"skills": {
|
||||
91: "飞龙射击",
|
||||
92: "巨龙射击",
|
||||
93: "巨龙咆哮",
|
||||
94: "巨龙之赐",
|
||||
95: "龙之协助"
|
||||
}
|
||||
},
|
||||
2: {
|
||||
"name": "雷电神圣治疗流派 (Lightning)",
|
||||
"desc": "引动九天雷电轰杀群敌,施展神圣治愈术与疾风迅捷",
|
||||
"skills": {
|
||||
106: "雷电箭",
|
||||
107: "召唤雷电",
|
||||
108: "雷电之爪",
|
||||
109: "治愈术",
|
||||
110: "迅捷步"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 获取职业可选流派
|
||||
func get_available_specializations(job: int) -> Dictionary:
|
||||
return SPEC_TREE.get(job, {})
|
||||
|
||||
# 进行 30 级转职选定流派
|
||||
func choose_specialization(spec_id: int, player_data: Dictionary) -> Dictionary:
|
||||
var job: int = int(player_data.get("job", 0))
|
||||
var lvl: int = int(player_data.get("level", 1))
|
||||
|
||||
if lvl < REQUIRED_LEVEL:
|
||||
return {"ok": false, "reason": "LEVEL_TOO_LOW", "msg": "转职需要角色等级达到 30 级!当前等级: %d" % lvl}
|
||||
|
||||
var cur_group: int = int(player_data.get("skill_group", 0))
|
||||
if cur_group != 0:
|
||||
return {"ok": false, "reason": "ALREADY_SPECIALIZED", "msg": "你已选定了流派!若需变更,请先使用【洗髓卷轴】。"}
|
||||
|
||||
if not SPEC_TREE.has(job) or not SPEC_TREE[job].has(spec_id):
|
||||
return {"ok": false, "reason": "INVALID_SPEC_ID", "msg": "无效的流派代码!"}
|
||||
|
||||
var spec = SPEC_TREE[job][spec_id]
|
||||
player_data["skill_group"] = spec_id
|
||||
|
||||
# 初始化该流派专属 5 大技能
|
||||
if not player_data.has("skills"):
|
||||
player_data["skills"] = {}
|
||||
|
||||
for svnum in spec["skills"].keys():
|
||||
player_data["skills"][svnum] = {
|
||||
"name": spec["skills"][svnum],
|
||||
"level": 0,
|
||||
"master_type": 0
|
||||
}
|
||||
|
||||
specialization_chosen.emit(job, spec_id, spec["name"])
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"job": job,
|
||||
"spec_id": spec_id,
|
||||
"spec_name": spec["name"],
|
||||
"skills_count": spec["skills"].size(),
|
||||
"msg": "恭喜!成功完成 30 级转职,踏入【%s】流派之道!" % spec["name"]
|
||||
}
|
||||
|
||||
# 学习与加点技能
|
||||
func allocate_skill_point(skill_vnum: int, player_data: Dictionary) -> Dictionary:
|
||||
var cur_group: int = int(player_data.get("skill_group", 0))
|
||||
if cur_group == 0:
|
||||
return {"ok": false, "reason": "NOT_SPECIALIZED", "msg": "尚未进行 30 级转职,无法修习流派绝学!"}
|
||||
|
||||
var pts: int = int(player_data.get("skill_points", 0))
|
||||
if pts <= 0:
|
||||
return {"ok": false, "reason": "NO_SKILL_POINTS", "msg": "技能点数不足!"}
|
||||
|
||||
var skills: Dictionary = player_data.get("skills", {})
|
||||
if not skills.has(skill_vnum):
|
||||
return {"ok": false, "reason": "SKILL_NOT_AVAILABLE", "msg": "此技能不属于当前专精流派!"}
|
||||
|
||||
var sk = skills[skill_vnum]
|
||||
var cur_lvl: int = int(sk.get("level", 0))
|
||||
if cur_lvl >= 20:
|
||||
return {"ok": false, "reason": "MAX_NORMAL_LEVEL", "msg": "该技能基础等级已满 (20),进阶需使用技能秘籍!"}
|
||||
|
||||
sk["level"] = cur_lvl + 1
|
||||
player_data["skill_points"] = pts - 1
|
||||
|
||||
skill_point_allocated.emit(skill_vnum, sk["level"], player_data["skill_points"])
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"skill_vnum": skill_vnum,
|
||||
"new_level": sk["level"],
|
||||
"remaining_points": player_data["skill_points"],
|
||||
"msg": "【%s】提升至等级 %d!" % [sk.get("name", "技能"), sk["level"]]
|
||||
}
|
||||
|
||||
# 使用洗髓卷轴 (71100) 无损重置流派与返还技能点
|
||||
func reset_specialization(inventory: Array, player_data: Dictionary, free_reset: bool = false) -> Dictionary:
|
||||
var cur_group: int = int(player_data.get("skill_group", 0))
|
||||
if cur_group == 0:
|
||||
return {"ok": false, "reason": "NOT_SPECIALIZED", "msg": "当前尚未选定任何专精流派,无需洗髓!"}
|
||||
|
||||
# 卷轴消耗检查
|
||||
var scroll_slot = -1
|
||||
if not free_reset:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) == VNUM_RESET_SCROLL:
|
||||
scroll_slot = i
|
||||
break
|
||||
if scroll_slot == -1:
|
||||
return {"ok": false, "reason": "NEED_RESET_SCROLL", "msg": "需要【洗髓卷轴】(71100) 才能重置专精流派!"}
|
||||
|
||||
# 统计已投入的所有技能点数
|
||||
var skills: Dictionary = player_data.get("skills", {})
|
||||
var total_invested: int = 0
|
||||
for svnum in skills.keys():
|
||||
var sk = skills[svnum]
|
||||
total_invested += int(sk.get("level", 0))
|
||||
|
||||
# 消耗卷轴
|
||||
if scroll_slot != -1:
|
||||
var sc_item = inventory[scroll_slot]
|
||||
var sc_cnt = int(sc_item.get("count", 1))
|
||||
if sc_cnt > 1:
|
||||
sc_item["count"] = sc_cnt - 1
|
||||
else:
|
||||
inventory[scroll_slot] = null
|
||||
|
||||
# 全额返还技能点
|
||||
var cur_pts: int = int(player_data.get("skill_points", 0))
|
||||
player_data["skill_points"] = cur_pts + total_invested
|
||||
player_data["skill_group"] = 0
|
||||
player_data["skills"] = {}
|
||||
|
||||
specialization_reset.emit(total_invested)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"refunded_points": total_invested,
|
||||
"total_skill_points": player_data["skill_points"],
|
||||
"msg": "洗髓成功!经脉重铸,%d 点技能点数全额返还,可重新选定双分支流派!" % total_invested
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cxlbtf4m6ejc4
|
||||
@@ -1,203 +0,0 @@
|
||||
# classic_pet_system.gd —— Metin2 40250 经典封印宠物跟随与守护系统 1:1
|
||||
# 对照 40250 服务端 PetSystem.cpp, PetSystem.h, questlua_pet.cpp
|
||||
class_name ClassicPetSystem
|
||||
extends RefCounted
|
||||
|
||||
signal pet_summoned(mob_vnum: int, pet_name: String, buffs: Dictionary)
|
||||
signal pet_unsummoned(mob_vnum: int, pet_name: String)
|
||||
signal pet_moved(current_pos: Vector2, is_teleport: bool)
|
||||
|
||||
# 40250 官方经典宠物召唤 Mob Vnum
|
||||
const MOB_BABY_BOAR := 34001 # 幼野猪
|
||||
const MOB_BABY_WOLF := 34002 # 幼狼
|
||||
const MOB_BABY_TIGER := 34003 # 幼虎
|
||||
const MOB_BABY_LION := 34004 # 幼狮
|
||||
const MOB_BABY_FIREDRAKE := 34005 # 幼火龙
|
||||
const MOB_ICE_PHOENIX := 34006 # 冰凤凰
|
||||
const MOB_BABY_AZRAEL := 34009 # 幼小阿兹瑞尔
|
||||
|
||||
# 40250 官方经典封印物品 Vnum
|
||||
const SEAL_BABY_BOAR := 53001 # 幼野猪封印
|
||||
const SEAL_BABY_FIREDRAKE := 53002 # 幼火龙封印
|
||||
const SEAL_ICE_PHOENIX := 53003 # 冰凤凰封印
|
||||
const SEAL_BABY_LION := 53004 # 幼狮封印
|
||||
const SEAL_BABY_AZRAEL := 53005 # 幼小阿兹瑞尔封印
|
||||
|
||||
# 40250 AI 跟随与瞬移距离参数
|
||||
const MIN_FOLLOW_DIST := 2.0 # 最小跟随停步距离 (米)
|
||||
const MAX_TELEPORT_DIST := 15.0 # 最大跟随超距,超过直接瞬移到身边 (米)
|
||||
const FOLLOW_SPEED := 6.0 # 跟随移动速度
|
||||
|
||||
# 40250 宠物封印配置表
|
||||
const PET_SEAL_CONFIGS: Dictionary = {
|
||||
SEAL_BABY_BOAR: {
|
||||
"mob_vnum": MOB_BABY_BOAR,
|
||||
"name": "幼野猪",
|
||||
"buffs": {"monster_damage_pct": 15},
|
||||
"dungeon_only": false
|
||||
},
|
||||
SEAL_BABY_FIREDRAKE: {
|
||||
"mob_vnum": MOB_BABY_FIREDRAKE,
|
||||
"name": "幼火龙",
|
||||
"buffs": {"max_hp": 1500, "attack_pct": 15},
|
||||
"dungeon_only": false
|
||||
},
|
||||
SEAL_ICE_PHOENIX: {
|
||||
"mob_vnum": MOB_ICE_PHOENIX,
|
||||
"name": "冰凤凰",
|
||||
"buffs": {"max_hp": 1500, "defense_pct": 15},
|
||||
"dungeon_only": false
|
||||
},
|
||||
SEAL_BABY_LION: {
|
||||
"mob_vnum": MOB_BABY_LION,
|
||||
"name": "幼狮",
|
||||
"buffs": {"crit_pct": 10},
|
||||
"dungeon_only": false
|
||||
},
|
||||
SEAL_BABY_AZRAEL: {
|
||||
"mob_vnum": MOB_BABY_AZRAEL,
|
||||
"name": "小阿兹瑞尔",
|
||||
"buffs": {"dungeon_attack_pct": 20, "max_hp": 1000},
|
||||
"dungeon_only": true # 40250 源码判定:若不在地牢中,专属地牢增益不生效
|
||||
}
|
||||
}
|
||||
|
||||
# 当前宠物出战状态
|
||||
var is_summoned: bool = false
|
||||
var active_mob_vnum: int = 0
|
||||
var active_seal_vnum: int = 0
|
||||
var active_pet_name: String = ""
|
||||
var active_buffs: Dictionary = {}
|
||||
var pet_pos: Vector2 = Vector2.ZERO
|
||||
|
||||
# 检查物品是否为 40250 宠物封印
|
||||
static func is_pet_seal(vnum: int) -> bool:
|
||||
return PET_SEAL_CONFIGS.has(vnum)
|
||||
|
||||
# 获取宠物封印配置
|
||||
static func get_pet_config_by_seal(seal_vnum: int) -> Dictionary:
|
||||
return PET_SEAL_CONFIGS.get(seal_vnum, {}).duplicate(true)
|
||||
|
||||
# 召唤经典封印宠物 (40250 CPetSystem::Summon)
|
||||
func summon_pet(seal_item: Dictionary, player_stats: Dictionary, is_in_dungeon: bool = false, owner_pos: Vector2 = Vector2.ZERO) -> Dictionary:
|
||||
var seal_vnum := int(seal_item.get("vnum", 0))
|
||||
if not PET_SEAL_CONFIGS.has(seal_vnum):
|
||||
return {"ok": false, "reason": "NOT_A_PET_SEAL", "msg": "该物品不是有效的宠物封印!"}
|
||||
|
||||
# 若已有宠物出战,先解散旧宠物 (40250 规则:同时只出战一只)
|
||||
if is_summoned:
|
||||
unsummon_pet(player_stats)
|
||||
|
||||
var conf: Dictionary = PET_SEAL_CONFIGS[seal_vnum]
|
||||
active_mob_vnum = conf["mob_vnum"]
|
||||
active_seal_vnum = seal_vnum
|
||||
active_pet_name = conf["name"]
|
||||
pet_pos = owner_pos + Vector2(1.5, 0.0) # 出生在身侧
|
||||
|
||||
# 计算注入的 Buff (40250 GiveBuff 规则)
|
||||
var buffs_to_apply: Dictionary = {}
|
||||
var base_buffs: Dictionary = conf.get("buffs", {})
|
||||
var is_dungeon_only: bool = bool(conf.get("dungeon_only", false))
|
||||
|
||||
for stat_key in base_buffs.keys():
|
||||
var val = base_buffs[stat_key]
|
||||
# 40250 特殊判定:小阿兹瑞尔等特定宠物仅在地牢中激活特定地牢 Buff
|
||||
if stat_key == "dungeon_attack_pct":
|
||||
if is_in_dungeon:
|
||||
buffs_to_apply[stat_key] = val
|
||||
else:
|
||||
buffs_to_apply[stat_key] = val
|
||||
|
||||
# 应用属性加成至玩家
|
||||
_apply_buffs_to_player(buffs_to_apply, player_stats, 1)
|
||||
active_buffs = buffs_to_apply
|
||||
is_summoned = true
|
||||
|
||||
pet_summoned.emit(active_mob_vnum, active_pet_name, active_buffs)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"mob_vnum": active_mob_vnum,
|
||||
"pet_name": active_pet_name,
|
||||
"buffs": active_buffs,
|
||||
"pos": pet_pos,
|
||||
"msg": "成功召唤宠物【%s】!守护属性已激活。" % active_pet_name
|
||||
}
|
||||
|
||||
# 召回/解散宠物 (40250 CPetSystem::Unsummon / ClearBuff)
|
||||
func unsummon_pet(player_stats: Dictionary) -> Dictionary:
|
||||
if not is_summoned:
|
||||
return {"ok": false, "reason": "NO_PET_SUMMONED", "msg": "当前没有出战的宠物!"}
|
||||
|
||||
# 清除施加在玩家身上的属性
|
||||
_apply_buffs_to_player(active_buffs, player_stats, -1)
|
||||
|
||||
var old_mob := active_mob_vnum
|
||||
var old_name := active_pet_name
|
||||
|
||||
is_summoned = false
|
||||
active_mob_vnum = 0
|
||||
active_seal_vnum = 0
|
||||
active_pet_name = ""
|
||||
active_buffs.clear()
|
||||
pet_pos = Vector2.ZERO
|
||||
|
||||
pet_unsummoned.emit(old_mob, old_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"mob_vnum": old_mob,
|
||||
"pet_name": old_name,
|
||||
"msg": "宠物【%s】已召回,守护属性已解除。" % old_name
|
||||
}
|
||||
|
||||
# 跟随 AI 逻辑步进 (40250 CPetActor::_UpdateFollowAI)
|
||||
func update_follow_ai(owner_pos: Vector2, delta: float) -> Dictionary:
|
||||
if not is_summoned:
|
||||
return {"action": "none"}
|
||||
|
||||
var dist := pet_pos.distance_to(owner_pos)
|
||||
|
||||
# 超过最大瞬移距离,直接瞬移回主人身边
|
||||
if dist > MAX_TELEPORT_DIST:
|
||||
pet_pos = owner_pos + Vector2(1.5, 0.0)
|
||||
pet_moved.emit(pet_pos, true)
|
||||
return {"action": "teleport", "pos": pet_pos, "dist": dist}
|
||||
|
||||
# 超过最小跟随距离,平滑朝主人位移
|
||||
if dist > MIN_FOLLOW_DIST:
|
||||
var move_dist: float = minf(FOLLOW_SPEED * delta, dist - MIN_FOLLOW_DIST)
|
||||
pet_pos = pet_pos.move_toward(owner_pos, move_dist)
|
||||
pet_moved.emit(pet_pos, false)
|
||||
return {"action": "follow", "pos": pet_pos, "dist": pet_pos.distance_to(owner_pos)}
|
||||
|
||||
# 处于舒适距离,保持待机
|
||||
return {"action": "idle", "pos": pet_pos, "dist": dist}
|
||||
|
||||
# 属性加成注入或反向扣减
|
||||
func _apply_buffs_to_player(buffs: Dictionary, player_stats: Dictionary, factor: int) -> void:
|
||||
for stat_key in buffs.keys():
|
||||
var val = int(buffs[stat_key]) * factor
|
||||
var cur = int(player_stats.get(stat_key, 0))
|
||||
player_stats[stat_key] = cur + val
|
||||
|
||||
# 序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"is_summoned": is_summoned,
|
||||
"active_mob_vnum": active_mob_vnum,
|
||||
"active_seal_vnum": active_seal_vnum,
|
||||
"active_pet_name": active_pet_name,
|
||||
"active_buffs": active_buffs.duplicate(true),
|
||||
"pos_x": pet_pos.x,
|
||||
"pos_y": pet_pos.y
|
||||
}
|
||||
|
||||
# 反序列化
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
is_summoned = bool(data.get("is_summoned", false))
|
||||
active_mob_vnum = int(data.get("active_mob_vnum", 0))
|
||||
active_seal_vnum = int(data.get("active_seal_vnum", 0))
|
||||
active_pet_name = str(data.get("active_pet_name", ""))
|
||||
active_buffs = data.get("active_buffs", {}).duplicate(true)
|
||||
pet_pos = Vector2(float(data.get("pos_x", 0.0)), float(data.get("pos_y", 0.0)))
|
||||
@@ -1 +0,0 @@
|
||||
uid://brl1ecflh4ugi
|
||||
@@ -1,192 +0,0 @@
|
||||
# client_phase_integration_system.gd —— 40250 客户端全状态机与全流程一体化集成系统 1:1
|
||||
# 严格对照:
|
||||
# Client/Eternexus/root/networkmodule.py, interfacemodule.py, game.py
|
||||
# ClientVS22/source/UserInterface/PythonNetworkStream.h (PHASE_*)
|
||||
extends RefCounted
|
||||
|
||||
const IntroLoginPhase = preload("res://intro_login_phase.gd")
|
||||
const IntroEmpirePhase = preload("res://intro_empire_phase.gd")
|
||||
const IntroSelectPhase = preload("res://intro_select_phase.gd")
|
||||
const IntroCreatePhase = preload("res://intro_create_phase.gd")
|
||||
const IntroLoadingPhase = preload("res://intro_loading_phase.gd")
|
||||
|
||||
const MessengerSystem = preload("res://messenger_system.gd")
|
||||
const WhisperChatSystem = preload("res://whisper_chat_system.gd")
|
||||
const AtlasNavigationSystem = preload("res://atlas_navigation_system.gd")
|
||||
const EquipmentInspectSystem = preload("res://equipment_inspect_system.gd")
|
||||
const BgmJukeboxSystem = preload("res://bgm_jukebox_system.gd")
|
||||
|
||||
# 官方 Phase 枚举 (PythonNetworkStream.h)
|
||||
enum ClientPhase {
|
||||
PHASE_OFFLINE,
|
||||
PHASE_LOGIN,
|
||||
PHASE_EMPIRE,
|
||||
PHASE_SELECT,
|
||||
PHASE_CREATE,
|
||||
PHASE_LOADING,
|
||||
PHASE_GAME
|
||||
}
|
||||
|
||||
var current_phase: int = ClientPhase.PHASE_LOGIN
|
||||
|
||||
# 阶段子模块实例
|
||||
var login_phase: RefCounted = null
|
||||
var empire_phase: RefCounted = null
|
||||
var select_phase: RefCounted = null
|
||||
var create_phase: RefCounted = null
|
||||
var loading_phase: RefCounted = null
|
||||
|
||||
# 游戏内核心交互模块实例
|
||||
var messenger: RefCounted = null
|
||||
var whisper: RefCounted = null
|
||||
var atlas: RefCounted = null
|
||||
var equip_inspect: RefCounted = null
|
||||
var jukebox: RefCounted = null
|
||||
|
||||
# 活跃角色数据
|
||||
var active_character: Dictionary = {}
|
||||
var active_account: String = ""
|
||||
|
||||
# 热键弹窗焦点栈 (用于 Escape 键自顶向下关闭)
|
||||
var dialog_focus_stack: Array = []
|
||||
|
||||
func _init() -> void:
|
||||
current_phase = ClientPhase.PHASE_LOGIN
|
||||
active_character = {}
|
||||
active_account = ""
|
||||
dialog_focus_stack.clear()
|
||||
|
||||
# 初始化各阶段系统
|
||||
login_phase = IntroLoginPhase.new()
|
||||
empire_phase = IntroEmpirePhase.new()
|
||||
select_phase = IntroSelectPhase.new()
|
||||
create_phase = IntroCreatePhase.new()
|
||||
loading_phase = IntroLoadingPhase.new()
|
||||
|
||||
# 初始化游戏内交互系统
|
||||
messenger = MessengerSystem.new()
|
||||
whisper = WhisperChatSystem.new()
|
||||
atlas = AtlasNavigationSystem.new()
|
||||
equip_inspect = EquipmentInspectSystem.new()
|
||||
jukebox = BgmJukeboxSystem.new()
|
||||
|
||||
# 1. 登录跳转流 (Login -> Select / Empire)
|
||||
func process_login(account: String, password_input: String) -> Dictionary:
|
||||
var r = login_phase.attempt_login(account, password_input)
|
||||
if not r["success"]:
|
||||
return r
|
||||
|
||||
active_account = account
|
||||
if r.get("has_characters", false):
|
||||
current_phase = ClientPhase.PHASE_SELECT
|
||||
r["next_phase"] = ClientPhase.PHASE_SELECT
|
||||
else:
|
||||
current_phase = ClientPhase.PHASE_EMPIRE
|
||||
r["next_phase"] = ClientPhase.PHASE_EMPIRE
|
||||
|
||||
return r
|
||||
|
||||
# 2. 阵营抉择流 (Empire -> Create)
|
||||
func process_empire_select(empire_id: int) -> Dictionary:
|
||||
if current_phase != ClientPhase.PHASE_EMPIRE:
|
||||
return { "success": false, "error": "NOT_IN_EMPIRE_PHASE" }
|
||||
|
||||
empire_phase.select_empire(empire_id)
|
||||
var conf = empire_phase.confirm_empire_selection()
|
||||
current_phase = ClientPhase.PHASE_CREATE
|
||||
conf["next_phase"] = ClientPhase.PHASE_CREATE
|
||||
return conf
|
||||
|
||||
# 3. 角色塑形流 (Create -> Select)
|
||||
func process_character_create(name: String, empire_id: int = 1) -> Dictionary:
|
||||
if current_phase != ClientPhase.PHASE_CREATE:
|
||||
return { "success": false, "error": "NOT_IN_CREATE_PHASE" }
|
||||
|
||||
var r = create_phase.create_character(name, empire_id)
|
||||
if not r["success"]:
|
||||
return r
|
||||
|
||||
# 存入角色选择大厅首个空槽位
|
||||
select_phase.set_character_slot(0, r["character"])
|
||||
current_phase = ClientPhase.PHASE_SELECT
|
||||
r["next_phase"] = ClientPhase.PHASE_SELECT
|
||||
return r
|
||||
|
||||
# 4. 选择角色出战流 (Select -> Loading -> Game)
|
||||
func process_character_start(slot_idx: int) -> Dictionary:
|
||||
if current_phase != ClientPhase.PHASE_SELECT:
|
||||
return { "success": false, "error": "NOT_IN_SELECT_PHASE" }
|
||||
|
||||
select_phase.select_slot(slot_idx)
|
||||
var r = select_phase.start_game()
|
||||
if not r["success"]:
|
||||
return r
|
||||
|
||||
active_character = r["character"]
|
||||
|
||||
# 启动过场加载
|
||||
loading_phase.start_loading()
|
||||
current_phase = ClientPhase.PHASE_LOADING
|
||||
|
||||
# 完成 4 阶段加载
|
||||
for i in range(5):
|
||||
loading_phase.advance_loading_step()
|
||||
|
||||
if loading_phase.is_completed():
|
||||
current_phase = ClientPhase.PHASE_GAME
|
||||
jukebox.on_enter_map("metin2_map_a1")
|
||||
messenger.main_player_name = active_character.get("name", "Hero")
|
||||
whisper.main_player_name = active_character.get("name", "Hero")
|
||||
r["next_phase"] = ClientPhase.PHASE_GAME
|
||||
|
||||
return r
|
||||
|
||||
# 5. 全局热键路由与窗口调度 (1:1 interfacemodule.py)
|
||||
func handle_input_hotkey(key_name: String) -> Dictionary:
|
||||
if current_phase != ClientPhase.PHASE_GAME:
|
||||
return { "handled": false, "phase": current_phase }
|
||||
|
||||
match key_name:
|
||||
"Alt+M": # 好友面板
|
||||
var is_showing: bool = (dialog_focus_stack.has("MESSENGER"))
|
||||
if is_showing:
|
||||
dialog_focus_stack.erase("MESSENGER")
|
||||
return { "handled": true, "action": "CLOSE_MESSENGER" }
|
||||
else:
|
||||
dialog_focus_stack.append("MESSENGER")
|
||||
return { "handled": true, "action": "OPEN_MESSENGER" }
|
||||
|
||||
"M": # Atlas 全景大地图
|
||||
var visible = atlas.toggle_atlas()
|
||||
if visible:
|
||||
dialog_focus_stack.append("ATLAS")
|
||||
return { "handled": true, "action": "OPEN_ATLAS" }
|
||||
else:
|
||||
dialog_focus_stack.erase("ATLAS")
|
||||
return { "handled": true, "action": "CLOSE_ATLAS" }
|
||||
|
||||
"Escape": # 自顶向下关闭弹窗或呼出系统菜单
|
||||
if not dialog_focus_stack.is_empty():
|
||||
var top_dialog = dialog_focus_stack.pop_back()
|
||||
if top_dialog == "ATLAS":
|
||||
atlas.hide_atlas()
|
||||
return { "handled": true, "action": "CLOSED_TOP_DIALOG", "dialog": top_dialog }
|
||||
else:
|
||||
return { "handled": true, "action": "OPEN_SYSTEM_MENU" }
|
||||
|
||||
return { "handled": false }
|
||||
|
||||
# 6. 登出游戏 (Game -> Select / Login)
|
||||
func logout_to_select() -> void:
|
||||
current_phase = ClientPhase.PHASE_SELECT
|
||||
active_character = {}
|
||||
dialog_focus_stack.clear()
|
||||
atlas.hide_atlas()
|
||||
jukebox.on_enter_map("intro_select")
|
||||
|
||||
func logout_to_login() -> void:
|
||||
current_phase = ClientPhase.PHASE_LOGIN
|
||||
active_character = {}
|
||||
active_account = ""
|
||||
dialog_focus_stack.clear()
|
||||
jukebox.on_enter_map("intro_login")
|
||||
@@ -1 +0,0 @@
|
||||
uid://n55fydu6qdrj
|
||||
@@ -1,170 +0,0 @@
|
||||
# combat_replay_snapshot_system.gd —— Metin2 40250 战斗高光战报与首领击杀瞬间快照 1:1
|
||||
# 对照 40250 服务端 battle.cpp, packet.h, char_battle.cpp
|
||||
class_name CombatReplaySnapshotSystem
|
||||
extends RefCounted
|
||||
|
||||
signal combat_session_started(target_name: String)
|
||||
signal combat_highlight_generated(card: Dictionary)
|
||||
signal new_personal_record(target_name: String, record_type: String, new_val: int)
|
||||
|
||||
const MAX_STORED_CARDS := 20
|
||||
|
||||
var is_in_session: bool = false
|
||||
var session_id: int = 1
|
||||
var target_vnum: int = 0
|
||||
var target_name: String = ""
|
||||
var target_max_hp: int = 0
|
||||
|
||||
var session_start_time: float = 0.0
|
||||
var elapsed_time: float = 0.0
|
||||
|
||||
var total_damage_dealt: int = 0
|
||||
var total_damage_taken: int = 0
|
||||
var total_attacks: int = 0
|
||||
var total_skills_used: int = 0
|
||||
var max_single_hit: int = 0
|
||||
var critical_hits_count: int = 0
|
||||
|
||||
# 历史高光战报归档
|
||||
var highlight_cards: Array = []
|
||||
# 个人最高纪录:target_name -> { "best_dps": int, "fastest_time": float, "highest_hit": int }
|
||||
var personal_bests: Dictionary = {}
|
||||
|
||||
# 开始一场战斗记录
|
||||
func start_combat_session(vnum: int, tname: String, max_hp: int) -> Dictionary:
|
||||
is_in_session = true
|
||||
target_vnum = vnum
|
||||
target_name = tname
|
||||
target_max_hp = max_hp
|
||||
|
||||
session_start_time = Time.get_unix_time_from_system()
|
||||
elapsed_time = 0.0
|
||||
|
||||
total_damage_dealt = 0
|
||||
total_damage_taken = 0
|
||||
total_attacks = 0
|
||||
total_skills_used = 0
|
||||
max_single_hit = 0
|
||||
critical_hits_count = 0
|
||||
|
||||
combat_session_started.emit(target_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"session_id": session_id,
|
||||
"target_name": target_name,
|
||||
"target_hp": target_max_hp
|
||||
}
|
||||
|
||||
# 记录一次攻击命中
|
||||
func record_hit(dmg: int, is_crit: bool, skill_name: String = "") -> void:
|
||||
if not is_in_session:
|
||||
return
|
||||
|
||||
total_damage_dealt += dmg
|
||||
total_attacks += 1
|
||||
|
||||
if is_crit:
|
||||
critical_hits_count += 1
|
||||
|
||||
if not skill_name.is_empty():
|
||||
total_skills_used += 1
|
||||
|
||||
if dmg > max_single_hit:
|
||||
max_single_hit = dmg
|
||||
|
||||
# 记录受到的伤害
|
||||
func record_damage_taken(dmg: int) -> void:
|
||||
if not is_in_session:
|
||||
return
|
||||
total_damage_taken += dmg
|
||||
|
||||
# 帧心跳更新战斗时长
|
||||
func update(delta: float) -> void:
|
||||
if is_in_session:
|
||||
elapsed_time += delta
|
||||
|
||||
# 结束战斗并生成结构化高光快照战报
|
||||
func end_combat_session(is_kill: bool, drops: Array = []) -> Dictionary:
|
||||
if not is_in_session:
|
||||
return {"ok": false, "reason": "NO_ACTIVE_SESSION"}
|
||||
|
||||
is_in_session = false
|
||||
var duration = max(0.5, elapsed_time)
|
||||
var dps = int(float(total_damage_dealt) / duration)
|
||||
|
||||
# 战斗评级评估 (S / A / B / C)
|
||||
var rank = "C"
|
||||
if is_kill:
|
||||
if dps >= 4000:
|
||||
rank = "S"
|
||||
elif dps >= 2500:
|
||||
rank = "A"
|
||||
elif dps >= 1200:
|
||||
rank = "B"
|
||||
else:
|
||||
rank = "C"
|
||||
|
||||
var card: Dictionary = {
|
||||
"session_id": session_id,
|
||||
"target_vnum": target_vnum,
|
||||
"target_name": target_name,
|
||||
"is_kill": is_kill,
|
||||
"rank": rank,
|
||||
"duration": duration,
|
||||
"total_damage": total_damage_dealt,
|
||||
"dps": dps,
|
||||
"max_single_hit": max_single_hit,
|
||||
"crit_count": critical_hits_count,
|
||||
"damage_taken": total_damage_taken,
|
||||
"skills_used": total_skills_used,
|
||||
"drops": drops.duplicate(true),
|
||||
"datetime": Time.get_datetime_string_from_system()
|
||||
}
|
||||
|
||||
session_id += 1
|
||||
highlight_cards.push_front(card)
|
||||
if highlight_cards.size() > MAX_STORED_CARDS:
|
||||
highlight_cards.pop_back()
|
||||
|
||||
# 刷新个人纪录判定
|
||||
_update_personal_bests(card)
|
||||
|
||||
combat_highlight_generated.emit(card)
|
||||
return card
|
||||
|
||||
# 检查并更新个人生涯纪录
|
||||
func _update_personal_bests(card: Dictionary) -> void:
|
||||
if not card["is_kill"]:
|
||||
return
|
||||
|
||||
var tname: String = card["target_name"]
|
||||
if not personal_bests.has(tname):
|
||||
personal_bests[tname] = {
|
||||
"best_dps": card["dps"],
|
||||
"fastest_time": card["duration"],
|
||||
"highest_hit": card["max_single_hit"]
|
||||
}
|
||||
new_personal_record.emit(tname, "FIRST_KILL", card["dps"])
|
||||
return
|
||||
|
||||
var pb = personal_bests[tname]
|
||||
if card["dps"] > pb["best_dps"]:
|
||||
pb["best_dps"] = card["dps"]
|
||||
new_personal_record.emit(tname, "BEST_DPS", card["dps"])
|
||||
|
||||
if card["duration"] < pb["fastest_time"]:
|
||||
pb["fastest_time"] = card["duration"]
|
||||
new_personal_record.emit(tname, "FASTEST_TIME", int(card["duration"]))
|
||||
|
||||
if card["max_single_hit"] > pb["highest_hit"]:
|
||||
pb["highest_hit"] = card["max_single_hit"]
|
||||
new_personal_record.emit(tname, "HIGHEST_HIT", card["max_single_hit"])
|
||||
|
||||
# 查询最近战报
|
||||
func get_recent_highlights() -> Array:
|
||||
return highlight_cards
|
||||
|
||||
# 查询特定目标的最佳战报纪录
|
||||
func get_personal_best(tname: String) -> Dictionary:
|
||||
return personal_bests.get(tname, {})
|
||||
@@ -1 +0,0 @@
|
||||
uid://cxu88rt8qo1o5
|
||||
@@ -1,249 +0,0 @@
|
||||
# combat_status_effect_system.gd —— Metin2 40250 官方战斗状态异常与五大负面减益结算系统 1:1
|
||||
# 100% 对照 40250 服务端 battle.cpp, char_resist.cpp, affect.h, char.h (POINT_POISON_PCT, IMMUNE_STUN, IMMUNE_SLOW)
|
||||
class_name CombatStatusEffectSystem
|
||||
extends RefCounted
|
||||
|
||||
signal status_applied(target_id: int, effect_type: String, duration: float)
|
||||
signal status_resisted(target_id: int, effect_type: String, reason: String)
|
||||
signal status_ticked(target_id: int, effect_type: String, damage: int, remaining_ticks: int)
|
||||
signal status_cleared(target_id: int, effect_type: String)
|
||||
|
||||
# 40250 官方核心状态异常类型
|
||||
const EFFECT_POISON := "poison" # 中毒 (AFF_POISON)
|
||||
const EFFECT_STUN := "stun" # 眩晕 (AFF_STUN)
|
||||
const EFFECT_SLOW := "slow" # 减速 (AFF_SLOW)
|
||||
const EFFECT_FIRE := "fire" # 烈焰灼烧 (AFF_FIRE)
|
||||
const EFFECT_BLEEDING := "bleeding" # 流血虚弱 (AFF_BLEEDING)
|
||||
|
||||
# 等级压制中毒调整表 (40250 char_resist.cpp: poison_level_adjust)
|
||||
const POISON_LEVEL_ADJUST: Array[int] = [100, 90, 80, 70, 60, 50, 40, 30, 20]
|
||||
|
||||
# 状态记录表: target_id -> { effect_type -> { "duration": float, "timer": float, "tick_interval": float, "ticks_left": int, "param": int } }
|
||||
var _target_effects: Dictionary = {}
|
||||
|
||||
# ==========================================
|
||||
# 1. 状态异常施加与判定 (battle.cpp: NormalAttackAffect)
|
||||
# ==========================================
|
||||
|
||||
# 尝试施加攻击异常效果 (通用结算)
|
||||
func try_apply_normal_attack_effects(
|
||||
attacker: Dictionary,
|
||||
victim: Dictionary,
|
||||
forced_rolls: Dictionary = {}
|
||||
) -> Dictionary:
|
||||
var victim_id = int(victim.get("id", 0))
|
||||
var applied: Array[String] = []
|
||||
var resisted: Array[String] = []
|
||||
|
||||
var is_attacker_pc = bool(attacker.get("is_pc", true))
|
||||
var is_victim_pc = bool(victim.get("is_pc", true))
|
||||
var attacker_level = int(attacker.get("level", 1))
|
||||
var victim_level = int(victim.get("level", 1))
|
||||
|
||||
# 1. 中毒判定 (POINT_POISON_PCT)
|
||||
var poison_pct = int(attacker.get("poison_pct", 0))
|
||||
if poison_pct > 0 and not has_effect(victim_id, EFFECT_POISON):
|
||||
# 怪物只中毒一次检查 (char_resist.cpp: m_bHasPoisoned && !IsPC())
|
||||
var already_poisoned_once = bool(victim.get("has_been_poisoned", false))
|
||||
if not is_victim_pc and already_poisoned_once:
|
||||
resisted.append("poison_already_poisoned_once")
|
||||
else:
|
||||
var roll = int(forced_rolls.get("poison_pct_roll", randi_range(1, 100)))
|
||||
if roll <= poison_pct:
|
||||
# 等级差距惩罚检查
|
||||
var can_poison := true
|
||||
if attacker_level < victim_level:
|
||||
var delta = min(victim_level - attacker_level, 8)
|
||||
var level_roll = int(forced_rolls.get("poison_level_roll", randi_range(1, 100)))
|
||||
if level_roll > POISON_LEVEL_ADJUST[delta]:
|
||||
can_poison = false
|
||||
resisted.append("poison_level_penalty")
|
||||
|
||||
if can_poison:
|
||||
apply_poison(victim, attacker)
|
||||
applied.append(EFFECT_POISON)
|
||||
|
||||
# 2. 眩晕判定 (POINT_STUN_PCT)
|
||||
var stun_pct = int(attacker.get("stun_pct", 0))
|
||||
if stun_pct > 0 and not has_effect(victim_id, EFFECT_STUN):
|
||||
# 免疫眩晕判定 (IMMUNE_STUN)
|
||||
if bool(victim.get("immune_stun", false)):
|
||||
status_resisted.emit(victim_id, EFFECT_STUN, "IMMUNE_STUN")
|
||||
resisted.append("immune_stun")
|
||||
else:
|
||||
var roll = int(forced_rolls.get("stun_pct_roll", randi_range(1, 100)))
|
||||
if roll <= stun_pct:
|
||||
var stun_dur = 4.0 if (is_attacker_pc and not is_victim_pc) else 2.0
|
||||
apply_stun(victim_id, stun_dur)
|
||||
applied.append(EFFECT_STUN)
|
||||
|
||||
# 3. 减速判定 (POINT_SLOW_PCT)
|
||||
var slow_pct = int(attacker.get("slow_pct", 0))
|
||||
if slow_pct > 0 and not has_effect(victim_id, EFFECT_SLOW):
|
||||
# 免疫减速判定 (IMMUNE_SLOW)
|
||||
if bool(victim.get("immune_slow", false)):
|
||||
status_resisted.emit(victim_id, EFFECT_SLOW, "IMMUNE_SLOW")
|
||||
resisted.append("immune_slow")
|
||||
else:
|
||||
var roll = int(forced_rolls.get("slow_pct_roll", randi_range(1, 100)))
|
||||
if roll <= slow_pct:
|
||||
apply_slow(victim_id, 20.0, 30) # 40250 官方减速 20 秒,移速 -30
|
||||
applied.append(EFFECT_SLOW)
|
||||
|
||||
return {
|
||||
"applied": applied,
|
||||
"resisted": resisted
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 2. 状态具体应用 (char_resist.cpp)
|
||||
# ==========================================
|
||||
|
||||
# 施加中毒: 10 次跳伤害,每次间隔 3 秒,总持续 30 秒 (POISON_LENGTH + 1)
|
||||
func apply_poison(victim: Dictionary, attacker: Dictionary = {}) -> void:
|
||||
var victim_id = int(victim.get("id", 0))
|
||||
victim["has_been_poisoned"] = true
|
||||
|
||||
_add_raw_effect(victim_id, EFFECT_POISON, {
|
||||
"duration": 30.0,
|
||||
"timer": 3.0,
|
||||
"tick_interval": 3.0,
|
||||
"ticks_left": 10,
|
||||
"param": int(victim.get("poison_reduce", 0)), # 抗毒减免比例 (0~100)
|
||||
"max_hp": int(victim.get("max_hp", 1000)),
|
||||
"attacker_id": int(attacker.get("id", 0))
|
||||
})
|
||||
status_applied.emit(victim_id, EFFECT_POISON, 30.0)
|
||||
|
||||
# 施加眩晕: 期间无法移动和释放技能
|
||||
func apply_stun(victim_id: int, duration: float = 2.0) -> void:
|
||||
_add_raw_effect(victim_id, EFFECT_STUN, {
|
||||
"duration": duration,
|
||||
"timer": duration,
|
||||
"tick_interval": 0.0,
|
||||
"ticks_left": 0,
|
||||
"param": 0
|
||||
})
|
||||
status_applied.emit(victim_id, EFFECT_STUN, duration)
|
||||
|
||||
# 施加减速: 移动速度扣除 speed_reduction 点
|
||||
func apply_slow(victim_id: int, duration: float = 20.0, speed_reduction: int = 30) -> void:
|
||||
_add_raw_effect(victim_id, EFFECT_SLOW, {
|
||||
"duration": duration,
|
||||
"timer": duration,
|
||||
"tick_interval": 0.0,
|
||||
"ticks_left": 0,
|
||||
"param": speed_reduction
|
||||
})
|
||||
status_applied.emit(victim_id, EFFECT_SLOW, duration)
|
||||
|
||||
# 施加烈焰灼烧: 固定火伤每 3 秒跳一次
|
||||
func apply_fire(victim_id: int, ticks: int = 5, damage_per_tick: int = 50) -> void:
|
||||
_add_raw_effect(victim_id, EFFECT_FIRE, {
|
||||
"duration": float(ticks * 3),
|
||||
"timer": 3.0,
|
||||
"tick_interval": 3.0,
|
||||
"ticks_left": ticks,
|
||||
"param": damage_per_tick
|
||||
})
|
||||
status_applied.emit(victim_id, EFFECT_FIRE, float(ticks * 3))
|
||||
|
||||
# 解除特定状态 (例如解毒药水 RemovePoison)
|
||||
func clear_effect(victim_id: int, effect_type: String) -> bool:
|
||||
if not _target_effects.has(victim_id):
|
||||
return false
|
||||
if _target_effects[victim_id].has(effect_type):
|
||||
_target_effects[victim_id].erase(effect_type)
|
||||
status_cleared.emit(victim_id, effect_type)
|
||||
return true
|
||||
return false
|
||||
|
||||
# 检查目标是否具有特定异常状态
|
||||
func has_effect(victim_id: int, effect_type: String) -> bool:
|
||||
if not _target_effects.has(victim_id):
|
||||
return false
|
||||
return _target_effects[victim_id].has(effect_type)
|
||||
|
||||
# 检查目标是否处于无法行动状态 (眩晕)
|
||||
func is_stunned(victim_id: int) -> bool:
|
||||
return has_effect(victim_id, EFFECT_STUN)
|
||||
|
||||
# 获取减速移速惩罚值
|
||||
func get_slow_reduction(victim_id: int) -> int:
|
||||
if not has_effect(victim_id, EFFECT_SLOW):
|
||||
return 0
|
||||
return int(_target_effects[victim_id][EFFECT_SLOW].get("param", 30))
|
||||
|
||||
# 检查自然回血是否被阻断 (40250 char.cpp:2453 中毒状态禁止自然回血)
|
||||
func is_natural_hp_regen_blocked(victim_id: int) -> bool:
|
||||
return has_effect(victim_id, EFFECT_POISON)
|
||||
|
||||
# ==========================================
|
||||
# 3. 状态心跳更新与跳伤害结算 (char_resist.cpp: poison_event, fire_event)
|
||||
# ==========================================
|
||||
func update(delta: float, targets_map: Dictionary = {}) -> void:
|
||||
for vid in _target_effects.keys().duplicate():
|
||||
var effects: Dictionary = _target_effects[vid]
|
||||
var to_remove: Array[String] = []
|
||||
|
||||
for eff_type in effects.keys():
|
||||
var data = effects[eff_type]
|
||||
data["duration"] -= delta
|
||||
|
||||
if data["tick_interval"] > 0.0:
|
||||
# 周期跳伤害逻辑 (中毒/灼烧)
|
||||
data["timer"] -= delta
|
||||
while data["timer"] <= 0.0 and data["ticks_left"] > 0:
|
||||
data["timer"] += data["tick_interval"]
|
||||
data["ticks_left"] -= 1
|
||||
|
||||
var dmg := 0
|
||||
if eff_type == EFFECT_POISON:
|
||||
# 40250 官方: GetMaxHP() * 5 / 100 * (100 - poison_reduce) / 100
|
||||
var max_hp = int(data.get("max_hp", 1000))
|
||||
var reduce = int(data.get("param", 0))
|
||||
var base_dmg = int(floor(max_hp * 0.05))
|
||||
dmg = max(1, int(floor(base_dmg * (100 - reduce) / 100.0)))
|
||||
elif eff_type == EFFECT_FIRE:
|
||||
dmg = int(data.get("param", 50))
|
||||
|
||||
# 扣减目标生命 (不可致死,留 1 点 HP)
|
||||
if targets_map.has(vid):
|
||||
var tgt = targets_map[vid]
|
||||
var cur_hp = int(tgt.get("hp", 100))
|
||||
tgt["hp"] = max(1, cur_hp - dmg)
|
||||
|
||||
status_ticked.emit(vid, eff_type, dmg, data["ticks_left"])
|
||||
|
||||
if data["ticks_left"] <= 0:
|
||||
to_remove.append(eff_type)
|
||||
break
|
||||
else:
|
||||
# 持续时间型 (眩晕/减速)
|
||||
if data["duration"] <= 0.0:
|
||||
to_remove.append(eff_type)
|
||||
|
||||
for eff_type in to_remove:
|
||||
effects.erase(eff_type)
|
||||
status_cleared.emit(vid, eff_type)
|
||||
|
||||
if effects.is_empty():
|
||||
_target_effects.erase(vid)
|
||||
|
||||
func _add_raw_effect(victim_id: int, effect_type: String, data: Dictionary) -> void:
|
||||
if not _target_effects.has(victim_id):
|
||||
_target_effects[victim_id] = {}
|
||||
_target_effects[victim_id][effect_type] = data
|
||||
|
||||
# 获取目标全部当前状态
|
||||
func get_target_effects(victim_id: int) -> Dictionary:
|
||||
return _target_effects.get(victim_id, {}).duplicate(true)
|
||||
|
||||
# 序列化与反序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"target_effects": _target_effects.duplicate(true)
|
||||
}
|
||||
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
_target_effects = data.get("target_effects", {}).duplicate(true)
|
||||
@@ -1 +0,0 @@
|
||||
uid://bo2ad4sxgu07r
|
||||
@@ -1,192 +0,0 @@
|
||||
# compass_treasure_hunt_system.gd —— Metin2 40250 官方魔石地脉探测罗盘与寻宝系统 1:1
|
||||
# 对照 40250 服务端 questlua_item.cpp, locale_en/itemdesc.txt:27989
|
||||
class_name CompassTreasureHuntSystem
|
||||
extends RefCounted
|
||||
|
||||
signal compass_scanned(target_name: String, distance: float, angle_deg: float, proximity: String, charges_left: int)
|
||||
signal treasure_excavated(chest_vnum: int, chest_name: String)
|
||||
signal treasure_opened(chest_name: String, rewards: Array)
|
||||
|
||||
# 40250 官方核心道具 Vnum
|
||||
const VNUM_COMPASS_OF_METIN := 27989 # 魔石探测罗盘 (Compass for Metin Stones, 6次充能)
|
||||
const VNUM_GOLD_CHEST := 50005 # 黄金宝箱
|
||||
const VNUM_SILVER_CHEST := 50006 # 白银宝箱
|
||||
const VNUM_GOLD_KEY := 50007 # 黄金钥匙
|
||||
const VNUM_SILVER_KEY := 50008 # 白银钥匙
|
||||
|
||||
const MAX_CHARGES := 6
|
||||
|
||||
# 探测距离等级
|
||||
const PROXIMITY_FAR := "FAR" # > 100m ("微弱微光 - 遥远")
|
||||
const PROXIMITY_MEDIUM := "MEDIUM" # 50m ~ 100m ("泛起银光 - 渐近")
|
||||
const PROXIMITY_NEAR := "NEAR" # 20m ~ 50m ("强烈明光 - 附近")
|
||||
const PROXIMITY_VERY_CLOSE := "VERY_CLOSE" # < 20m ("璀璨耀光 - 极近")
|
||||
|
||||
# 激活魔石探测罗盘扫描最近的魔石或地脉宝藏
|
||||
func scan_nearest_metin(player_pos: Vector2, target_list: Array, inventory: Array, slot_index: int) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var compass: Dictionary = inventory[slot_index]
|
||||
if int(compass.get("vnum", 0)) != VNUM_COMPASS_OF_METIN:
|
||||
return {"ok": false, "reason": "NOT_A_COMPASS", "msg": "该物品不是魔石探测罗盘!"}
|
||||
|
||||
var charges: int = int(compass.get("charges", MAX_CHARGES))
|
||||
if charges <= 0:
|
||||
inventory[slot_index] = null
|
||||
return {"ok": false, "reason": "COMPASS_EXHAUSTED", "msg": "罗盘灵力已耗尽,化作飞灰!"}
|
||||
|
||||
if target_list.is_empty():
|
||||
return {"ok": false, "reason": "NO_TARGETS_FOUND", "msg": "当前地图未探测到任何魔石波动!"}
|
||||
|
||||
# 寻找最近的目标
|
||||
var nearest_target: Dictionary = {}
|
||||
var min_dist := INF
|
||||
for t in target_list:
|
||||
var pos: Vector2 = t.get("pos", Vector2.ZERO)
|
||||
var d := player_pos.distance_to(pos)
|
||||
if d < min_dist:
|
||||
min_dist = d
|
||||
nearest_target = t
|
||||
|
||||
# 扣除 1 次充能计数 (40250 官方 6 次限制)
|
||||
charges -= 1
|
||||
compass["charges"] = charges
|
||||
if charges <= 0:
|
||||
inventory[slot_index] = null # 充能用完销毁
|
||||
|
||||
# 计算方位角与距离等级
|
||||
var target_pos: Vector2 = nearest_target.get("pos", Vector2.ZERO)
|
||||
var dir_vec: Vector2 = (target_pos - player_pos).normalized()
|
||||
var angle := rad_to_deg(dir_vec.angle())
|
||||
|
||||
var proximity := PROXIMITY_FAR
|
||||
var desc := "微弱微光(遥远)"
|
||||
if min_dist < 20.0:
|
||||
proximity = PROXIMITY_VERY_CLOSE
|
||||
desc = "璀璨耀光(极近)"
|
||||
elif min_dist < 50.0:
|
||||
proximity = PROXIMITY_NEAR
|
||||
desc = "强烈明光(附近)"
|
||||
elif min_dist < 100.0:
|
||||
proximity = PROXIMITY_MEDIUM
|
||||
desc = "泛起银光(渐近)"
|
||||
|
||||
var target_name: String = str(nearest_target.get("name", "魔石"))
|
||||
compass_scanned.emit(target_name, min_dist, angle, proximity, charges)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"target_name": target_name,
|
||||
"target_pos": nearest_target.get("pos", Vector2.ZERO),
|
||||
"distance": min_dist,
|
||||
"angle_deg": angle,
|
||||
"proximity": proximity,
|
||||
"proximity_desc": desc,
|
||||
"charges_left": charges,
|
||||
"msg": "罗盘指针震颤!锁定【%s】,距离 %.1f 米,光芒等级:%s,剩余使用次数:%d。" % [target_name, min_dist, desc, charges]
|
||||
}
|
||||
|
||||
# 在地脉极近坐标处挖掘秘宝
|
||||
func excavate_treasure(player_pos: Vector2, treasure_nodes: Array, inventory: Array) -> Dictionary:
|
||||
var target_idx := -1
|
||||
for i in range(treasure_nodes.size()):
|
||||
var node_pos: Vector2 = treasure_nodes[i].get("pos", Vector2.ZERO)
|
||||
if player_pos.distance_to(node_pos) <= 5.0: # 5米范围内可挖掘
|
||||
target_idx = i
|
||||
break
|
||||
|
||||
if target_idx == -1:
|
||||
return {"ok": false, "reason": "NO_TREASURE_NEARBY", "msg": "周围 5 米内未探测到地脉埋藏的宝箱!"}
|
||||
|
||||
var node: Dictionary = treasure_nodes[target_idx]
|
||||
var is_gold: bool = bool(node.get("is_gold", false))
|
||||
var chest_vnum = VNUM_GOLD_CHEST if is_gold else VNUM_SILVER_CHEST
|
||||
var chest_name = "黄金宝箱" if is_gold else "白银宝箱"
|
||||
|
||||
# 寻找背包空格放入宝箱
|
||||
var free_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
free_slot = i
|
||||
break
|
||||
|
||||
if free_slot == -1:
|
||||
return {"ok": false, "reason": "INVENTORY_FULL", "msg": "背包已满,无法容纳挖出的宝箱!"}
|
||||
|
||||
inventory[free_slot] = {
|
||||
"vnum": chest_vnum,
|
||||
"name": chest_name,
|
||||
"count": 1
|
||||
}
|
||||
|
||||
treasure_nodes.remove_at(target_idx)
|
||||
treasure_excavated.emit(chest_vnum, chest_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"chest_vnum": chest_vnum,
|
||||
"chest_name": chest_name,
|
||||
"slot": free_slot,
|
||||
"msg": "破土而出!在地脉深处成功发掘出【%s】!" % chest_name
|
||||
}
|
||||
|
||||
# 使用对应的黄金钥匙或白银钥匙开启宝箱
|
||||
func open_treasure_chest(chest_slot: int, key_slot: int, inventory: Array) -> Dictionary:
|
||||
if chest_slot < 0 or chest_slot >= inventory.size() or inventory[chest_slot] == null:
|
||||
return {"ok": false, "reason": "INVALID_CHEST_SLOT"}
|
||||
if key_slot < 0 or key_slot >= inventory.size() or inventory[key_slot] == null:
|
||||
return {"ok": false, "reason": "INVALID_KEY_SLOT"}
|
||||
|
||||
var chest: Dictionary = inventory[chest_slot]
|
||||
var key: Dictionary = inventory[key_slot]
|
||||
|
||||
var chest_vnum := int(chest.get("vnum", 0))
|
||||
var key_vnum := int(key.get("vnum", 0))
|
||||
|
||||
var match_ok := false
|
||||
if chest_vnum == VNUM_GOLD_CHEST and key_vnum == VNUM_GOLD_KEY:
|
||||
match_ok = true
|
||||
elif chest_vnum == VNUM_SILVER_CHEST and key_vnum == VNUM_SILVER_KEY:
|
||||
match_ok = true
|
||||
|
||||
if not match_ok:
|
||||
return {"ok": false, "reason": "KEY_MISMATCH", "msg": "钥匙与宝箱类型不匹配!黄金宝箱需用黄金钥匙开启。"}
|
||||
|
||||
# 消耗钥匙与宝箱
|
||||
inventory[chest_slot] = null
|
||||
var key_cnt := int(key.get("count", 1))
|
||||
if key_cnt > 1:
|
||||
key["count"] = key_cnt - 1
|
||||
else:
|
||||
inventory[key_slot] = null
|
||||
|
||||
# 生成高额宝物奖励
|
||||
var rewards: Array = []
|
||||
if chest_vnum == VNUM_GOLD_CHEST:
|
||||
rewards = [
|
||||
{"vnum": 25040, "name": "祝福卷轴", "count": 3},
|
||||
{"vnum": 51501, "name": "龙石原石", "count": 2},
|
||||
{"vnum": 28430, "name": "+4 灵石", "count": 1}
|
||||
]
|
||||
else:
|
||||
rewards = [
|
||||
{"vnum": 25040, "name": "祝福卷轴", "count": 1},
|
||||
{"vnum": 50300, "name": "技能书", "count": 1}
|
||||
]
|
||||
|
||||
# 放入背包
|
||||
for r in rewards:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = r.duplicate(true)
|
||||
break
|
||||
|
||||
treasure_opened.emit(chest.get("name", "宝箱"), rewards)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"chest_name": chest.get("name", "宝箱"),
|
||||
"rewards": rewards,
|
||||
"msg": "清脆的开锁声响起!开启宝箱,获得珍稀秘宝!"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bau7tkdeg2823
|
||||
@@ -1,244 +0,0 @@
|
||||
# costume_attr_transfer_system.gd —— Metin2 40250 官方时装属性转移与增益附魔系统 1:1
|
||||
# 100% 对照 40250 服务端 char_item.cpp (ITEM_COSTUME, 70063, 70064), item_proto.txt
|
||||
class_name CostumeAttrTransferSystem
|
||||
extends RefCounted
|
||||
|
||||
signal costume_transformed(costume_vnum: int, new_attrs: Array)
|
||||
signal costume_enchanted(costume_vnum: int, new_attrs: Array)
|
||||
signal costume_attributes_transferred(src_vnum: int, dst_vnum: int, attrs: Array)
|
||||
signal costume_error(reason: String)
|
||||
|
||||
# 40250 官方时装重铸与附魔道具 Vnum
|
||||
const VNUM_COSTUME_TRANSFORM := 70063 # 时装重铸卷轴 (Kostümü dönüştür - 随机 1~3 条新属性)
|
||||
const VNUM_COSTUME_ENCHANT := 70064 # 时装附魔石 (Kostümü efsunla - 保留条数重洗属性)
|
||||
const VNUM_ATTR_TRANSFER := 72325 # 时装属性转移符
|
||||
|
||||
# 时装最大词条数
|
||||
const MAX_COSTUME_ATTRS := 3
|
||||
|
||||
# 40250 官方时装属性词条候选池
|
||||
const COSTUME_ATTR_POOL: Array[Dictionary] = [
|
||||
{"type": "max_hp", "name": "生命上限", "min": 500, "max": 2000},
|
||||
{"type": "max_sp", "name": "法力上限", "min": 200, "max": 1000},
|
||||
{"type": "crit_pct", "name": "暴击几率 (%)", "min": 5, "max": 10},
|
||||
{"type": "penetrate_pct", "name": "穿刺伤害几率 (%)", "min": 5, "max": 10},
|
||||
{"type": "att_speed", "name": "攻击速度", "min": 5, "max": 10},
|
||||
{"type": "mov_speed", "name": "移动速度", "min": 5, "max": 10},
|
||||
{"type": "cast_speed", "name": "施法速度", "min": 5, "max": 10},
|
||||
{"type": "hp_regen", "name": "生命自然恢复 (%)", "min": 10, "max": 30}
|
||||
]
|
||||
|
||||
# 校验是否为时装物品
|
||||
func is_costume_item(item: Dictionary) -> bool:
|
||||
if item == null:
|
||||
return false
|
||||
var subtype = str(item.get("costume_subtype", ""))
|
||||
var is_costume = bool(item.get("is_costume", false))
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
# 40250 官方区间:时装铠甲 (41001~44000), 时装发型 (45001~46000), 时装武器 (40101~)
|
||||
if is_costume or subtype != "":
|
||||
return true
|
||||
if (vnum >= 41001 and vnum <= 46000) or (vnum >= 40101 and vnum <= 40999):
|
||||
return true
|
||||
return false
|
||||
|
||||
# ==========================================
|
||||
# 1. 时装重铸 (70063 Kostümü dönüştür)
|
||||
# ==========================================
|
||||
# 移除所有既有属性,随机赋予 1~3 条全新的时装属性
|
||||
func transform_costume(
|
||||
inventory: Array,
|
||||
scroll_slot: int,
|
||||
costume_slot: int,
|
||||
forced_count: int = -1,
|
||||
forced_attrs: Array = []
|
||||
) -> Dictionary:
|
||||
if not _validate_slots(inventory, scroll_slot, costume_slot):
|
||||
costume_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "格位无效或道具为空!"}
|
||||
|
||||
var scroll = inventory[scroll_slot]
|
||||
var costume = inventory[costume_slot]
|
||||
|
||||
if int(scroll.get("vnum", 0)) != VNUM_COSTUME_TRANSFORM:
|
||||
costume_error.emit("NOT_TRANSFORM_SCROLL")
|
||||
return {"ok": false, "reason": "NOT_TRANSFORM_SCROLL", "msg": "该道具不是时装重铸卷轴!"}
|
||||
|
||||
if not is_costume_item(costume):
|
||||
costume_error.emit("NOT_COSTUME")
|
||||
return {"ok": false, "reason": "NOT_COSTUME", "msg": "只有时装物品可以使用时装重铸卷轴!"}
|
||||
|
||||
if bool(costume.get("is_equipped", false)):
|
||||
costume_error.emit("EQUIPPED_ITEM")
|
||||
return {"ok": false, "reason": "EQUIPPED_ITEM", "msg": "无法对穿戴中的时装进行重铸,请先卸下!"}
|
||||
|
||||
# 消耗 1 个重铸卷轴
|
||||
_consume_item_one(inventory, scroll_slot)
|
||||
|
||||
# 决定新属性条数 (1~3 条)
|
||||
var count = forced_count if forced_count in [1, 2, 3] else randi_range(1, 3)
|
||||
var new_attrs: Array = []
|
||||
|
||||
if not forced_attrs.is_empty():
|
||||
new_attrs = forced_attrs.duplicate(true)
|
||||
else:
|
||||
new_attrs = _roll_random_attributes(count)
|
||||
|
||||
costume["attrs"] = new_attrs
|
||||
costume_transformed.emit(int(costume.get("vnum", 0)), new_attrs)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"attrs_count": new_attrs.size(),
|
||||
"attrs": new_attrs,
|
||||
"msg": "时装周身流光溢彩!重铸成功,获得了 %d 条全新的时装属性。" % new_attrs.size()
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 2. 时装附魔 (70064 Kostümü efsunla)
|
||||
# ==========================================
|
||||
# 保留当前属性条数,重新随机洗练词条类型与数值
|
||||
func enchant_costume(
|
||||
inventory: Array,
|
||||
scroll_slot: int,
|
||||
costume_slot: int,
|
||||
forced_attrs: Array = []
|
||||
) -> Dictionary:
|
||||
if not _validate_slots(inventory, scroll_slot, costume_slot):
|
||||
costume_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "格位无效或道具为空!"}
|
||||
|
||||
var scroll = inventory[scroll_slot]
|
||||
var costume = inventory[costume_slot]
|
||||
|
||||
if int(scroll.get("vnum", 0)) != VNUM_COSTUME_ENCHANT:
|
||||
costume_error.emit("NOT_ENCHANT_SCROLL")
|
||||
return {"ok": false, "reason": "NOT_ENCHANT_SCROLL", "msg": "该道具不是时装附魔石!"}
|
||||
|
||||
if not is_costume_item(costume):
|
||||
costume_error.emit("NOT_COSTUME")
|
||||
return {"ok": false, "reason": "NOT_COSTUME", "msg": "只有时装物品可以使用时装附魔石!"}
|
||||
|
||||
if bool(costume.get("is_equipped", false)):
|
||||
costume_error.emit("EQUIPPED_ITEM")
|
||||
return {"ok": false, "reason": "EQUIPPED_ITEM", "msg": "无法对穿戴中的时装进行附魔,请先卸下!"}
|
||||
|
||||
var existing_attrs: Array = costume.get("attrs", [])
|
||||
if existing_attrs.is_empty():
|
||||
costume_error.emit("NO_ATTRS_TO_ENCHANT")
|
||||
return {"ok": false, "reason": "NO_ATTRS_TO_ENCHANT", "msg": "此时装没有任何附加属性!请先使用时装重铸卷轴赋予属性。"}
|
||||
|
||||
# 消耗 1 个附魔石
|
||||
_consume_item_one(inventory, scroll_slot)
|
||||
|
||||
var count = existing_attrs.size()
|
||||
var new_attrs: Array = []
|
||||
if not forced_attrs.is_empty():
|
||||
new_attrs = forced_attrs.duplicate(true)
|
||||
else:
|
||||
new_attrs = _roll_random_attributes(count)
|
||||
|
||||
costume["attrs"] = new_attrs
|
||||
costume_enchanted.emit(int(costume.get("vnum", 0)), new_attrs)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"attrs_count": new_attrs.size(),
|
||||
"attrs": new_attrs,
|
||||
"msg": "附魔灵石融入织物!保留原有 %d 条属性槽位,洗练出了全新的强力词条。" % count
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 3. 时装属性转移 (Costume Attribute Transfer)
|
||||
# ==========================================
|
||||
func transfer_costume_attributes(
|
||||
inventory: Array,
|
||||
scroll_slot: int,
|
||||
src_slot: int,
|
||||
dst_slot: int
|
||||
) -> Dictionary:
|
||||
if scroll_slot < 0 or scroll_slot >= inventory.size() or inventory[scroll_slot] == null:
|
||||
costume_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "转移卷轴格位无效!"}
|
||||
|
||||
if src_slot < 0 or src_slot >= inventory.size() or inventory[src_slot] == null:
|
||||
costume_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "源时装格位无效!"}
|
||||
|
||||
if dst_slot < 0 or dst_slot >= inventory.size() or inventory[dst_slot] == null:
|
||||
costume_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "目标时装格位无效!"}
|
||||
|
||||
var scroll = inventory[scroll_slot]
|
||||
var src_item = inventory[src_slot]
|
||||
var dst_item = inventory[dst_slot]
|
||||
|
||||
if int(scroll.get("vnum", 0)) != VNUM_ATTR_TRANSFER:
|
||||
costume_error.emit("NOT_TRANSFER_SCROLL")
|
||||
return {"ok": false, "reason": "NOT_TRANSFER_SCROLL", "msg": "该物品不是时装属性转移符!"}
|
||||
|
||||
if not is_costume_item(src_item) or not is_costume_item(dst_item):
|
||||
costume_error.emit("NOT_COSTUME")
|
||||
return {"ok": false, "reason": "NOT_COSTUME", "msg": "源道具与目标道具都必须是时装!"}
|
||||
|
||||
var src_type = str(src_item.get("costume_subtype", "body"))
|
||||
var dst_type = str(dst_item.get("costume_subtype", "body"))
|
||||
if src_type != dst_type:
|
||||
costume_error.emit("TYPE_MISMATCH")
|
||||
return {"ok": false, "reason": "TYPE_MISMATCH", "msg": "时装类型不匹配!时装铠甲只能转移至时装铠甲,发型只能转移至发型。"}
|
||||
|
||||
var src_attrs: Array = src_item.get("attrs", [])
|
||||
if src_attrs.is_empty():
|
||||
costume_error.emit("NO_ATTRS_TO_TRANSFER")
|
||||
return {"ok": false, "reason": "NO_ATTRS_TO_TRANSFER", "msg": "源时装没有任何可转移的属性!"}
|
||||
|
||||
# 消耗 1 张转移符
|
||||
_consume_item_one(inventory, scroll_slot)
|
||||
|
||||
# 执行无损属性迁移
|
||||
var transferred = src_attrs.duplicate(true)
|
||||
dst_item["attrs"] = transferred
|
||||
src_item["attrs"] = [] # 源时装词条清空
|
||||
|
||||
costume_attributes_transferred.emit(int(src_item.get("vnum", 0)), int(dst_item.get("vnum", 0)), transferred)
|
||||
return {
|
||||
"ok": true,
|
||||
"transferred_attrs": transferred,
|
||||
"msg": "乾坤倒转!成功将 %d 条极品属性从旧时装完整迁移至新时装。" % transferred.size()
|
||||
}
|
||||
|
||||
# 内部随机属性抽取工具
|
||||
func _roll_random_attributes(count: int) -> Array:
|
||||
var result: Array = []
|
||||
var pool_indices: Array[int] = []
|
||||
for i in range(COSTUME_ATTR_POOL.size()):
|
||||
pool_indices.append(i)
|
||||
pool_indices.shuffle()
|
||||
|
||||
var actual_count = min(count, pool_indices.size())
|
||||
for i in range(actual_count):
|
||||
var def = COSTUME_ATTR_POOL[pool_indices[i]]
|
||||
var val = randi_range(int(def["min"]), int(def["max"]))
|
||||
result.append({
|
||||
"type": def["type"],
|
||||
"name": def["name"],
|
||||
"value": val
|
||||
})
|
||||
return result
|
||||
|
||||
func _validate_slots(inventory: Array, s1: int, s2: int) -> bool:
|
||||
if s1 < 0 or s1 >= inventory.size() or inventory[s1] == null:
|
||||
return false
|
||||
if s2 < 0 or s2 >= inventory.size() or inventory[s2] == null:
|
||||
return false
|
||||
return true
|
||||
|
||||
func _consume_item_one(inventory: Array, slot: int) -> void:
|
||||
if slot < 0 or slot >= inventory.size() or inventory[slot] == null:
|
||||
return
|
||||
var item = inventory[slot]
|
||||
var count = int(item.get("count", 1))
|
||||
if count > 1:
|
||||
item["count"] = count - 1
|
||||
else:
|
||||
inventory[slot] = null
|
||||
@@ -1 +0,0 @@
|
||||
uid://cd5g767aqt3ui
|
||||
@@ -1,126 +0,0 @@
|
||||
# costume_system.gd —— Metin2 40250 独立时装发型与武器衣柜系统 1:1
|
||||
# 对照 40250 服务端 costume.cpp, char_item.cpp, uiinventory.py, item_data.h
|
||||
class_name CostumeSystem
|
||||
extends RefCounted
|
||||
|
||||
signal costume_equipped(slot_type: int, item: Dictionary)
|
||||
signal costume_unequipped(slot_type: int)
|
||||
signal costume_expired(slot_type: int, item_name: String)
|
||||
|
||||
enum CostumeSlot {
|
||||
COSTUME_BODY = 0, # 时装衣服
|
||||
COSTUME_HAIR = 1, # 时装发型
|
||||
COSTUME_WEAPON = 2 # 时装武器外观
|
||||
}
|
||||
|
||||
const DEFAULT_COSTUME_DURATION := 604800.0 # 默认 7 天 (7 * 86400)
|
||||
|
||||
var equipped_costumes: Dictionary = {
|
||||
CostumeSlot.COSTUME_BODY: null,
|
||||
CostumeSlot.COSTUME_HAIR: null,
|
||||
CostumeSlot.COSTUME_WEAPON: null
|
||||
}
|
||||
|
||||
# 穿戴时装
|
||||
func equip_costume(slot_type: int, costume_item: Dictionary) -> Dictionary:
|
||||
if not equipped_costumes.has(slot_type):
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "无效的时装栏位!"}
|
||||
|
||||
if costume_item.is_empty():
|
||||
return {"ok": false, "reason": "EMPTY_ITEM", "msg": "时装物品数据为空!"}
|
||||
|
||||
# 校验时装部位匹配
|
||||
var c_type: String = costume_item.get("costume_type", "")
|
||||
match slot_type:
|
||||
CostumeSlot.COSTUME_BODY:
|
||||
if c_type != "body":
|
||||
return {"ok": false, "reason": "SLOT_TYPE_MISMATCH", "msg": "此物品不是时装衣服!"}
|
||||
CostumeSlot.COSTUME_HAIR:
|
||||
if c_type != "hair":
|
||||
return {"ok": false, "reason": "SLOT_TYPE_MISMATCH", "msg": "此物品不是时装发型!"}
|
||||
CostumeSlot.COSTUME_WEAPON:
|
||||
if c_type != "weapon":
|
||||
return {"ok": false, "reason": "SLOT_TYPE_MISMATCH", "msg": "此物品不是时装武器外观!"}
|
||||
|
||||
var old_item = equipped_costumes[slot_type]
|
||||
var item_to_equip = costume_item.duplicate(true)
|
||||
|
||||
if not item_to_equip.has("remaining_time"):
|
||||
item_to_equip["remaining_time"] = DEFAULT_COSTUME_DURATION
|
||||
|
||||
equipped_costumes[slot_type] = item_to_equip
|
||||
|
||||
costume_equipped.emit(slot_type, item_to_equip)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"slot_type": slot_type,
|
||||
"item": item_to_equip,
|
||||
"old_item": old_item,
|
||||
"msg": "时装【%s】已成功穿戴!" % item_to_equip.get("name", "时装")
|
||||
}
|
||||
|
||||
# 卸下时装
|
||||
func unequip_costume(slot_type: int) -> Dictionary:
|
||||
if not equipped_costumes.has(slot_type):
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "无效的时装栏位!"}
|
||||
|
||||
var item = equipped_costumes[slot_type]
|
||||
if item == null:
|
||||
return {"ok": false, "reason": "SLOT_EMPTY", "msg": "该时装栏位未穿戴时装!"}
|
||||
|
||||
equipped_costumes[slot_type] = null
|
||||
costume_unequipped.emit(slot_type)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"slot_type": slot_type,
|
||||
"item": item,
|
||||
"msg": "已卸下时装【%s】。" % item.get("name", "时装")
|
||||
}
|
||||
|
||||
# 汇总所有已穿戴时装的战力属性
|
||||
func get_costume_bonuses() -> Dictionary:
|
||||
var total_bonuses: Dictionary = {}
|
||||
for slot in equipped_costumes.keys():
|
||||
var it = equipped_costumes[slot]
|
||||
if it == null:
|
||||
continue
|
||||
var bonuses: Dictionary = it.get("bonuses", {})
|
||||
for b_key in bonuses.keys():
|
||||
var val: int = int(bonuses[b_key])
|
||||
total_bonuses[b_key] = total_bonuses.get(b_key, 0) + val
|
||||
return total_bonuses
|
||||
|
||||
# 获取 3D 外观覆盖模型 ID
|
||||
func get_appearance_overrides() -> Dictionary:
|
||||
var overrides: Dictionary = {
|
||||
"body_model": 0,
|
||||
"hair_model": 0,
|
||||
"weapon_model": 0
|
||||
}
|
||||
if equipped_costumes[CostumeSlot.COSTUME_BODY] != null:
|
||||
overrides["body_model"] = int(equipped_costumes[CostumeSlot.COSTUME_BODY].get("model_id", 0))
|
||||
if equipped_costumes[CostumeSlot.COSTUME_HAIR] != null:
|
||||
overrides["hair_model"] = int(equipped_costumes[CostumeSlot.COSTUME_HAIR].get("model_id", 0))
|
||||
if equipped_costumes[CostumeSlot.COSTUME_WEAPON] != null:
|
||||
overrides["weapon_model"] = int(equipped_costumes[CostumeSlot.COSTUME_WEAPON].get("model_id", 0))
|
||||
return overrides
|
||||
|
||||
# 逐帧时效衰减更新
|
||||
func update(dt: float) -> Array:
|
||||
var expired_list: Array = []
|
||||
for slot in equipped_costumes.keys():
|
||||
var it = equipped_costumes[slot]
|
||||
if it == null:
|
||||
continue
|
||||
|
||||
it["remaining_time"] = maxf(0.0, float(it.get("remaining_time", 0.0)) - dt)
|
||||
if it["remaining_time"] <= 0.0:
|
||||
var iname: String = it.get("name", "时装")
|
||||
expired_list.append({"slot": slot, "item": it})
|
||||
equipped_costumes[slot] = null
|
||||
costume_expired.emit(slot, iname)
|
||||
costume_unequipped.emit(slot)
|
||||
|
||||
return expired_list
|
||||
@@ -1 +0,0 @@
|
||||
uid://bas2h6u0g5rsg
|
||||
@@ -1,293 +0,0 @@
|
||||
# cube_crafting_system.gd —— Metin2 40250 官方魔方炼金合成台系统 1:1
|
||||
# 100% 对照 40250 服务端 cube.cpp, cube.h, cube.txt, quest/cube.quest
|
||||
class_name CubeCraftingSystem
|
||||
extends RefCounted
|
||||
|
||||
signal cube_opened(npc_vnum: int, npc_name: String)
|
||||
signal cube_closed()
|
||||
signal craft_succeeded(reward_vnum: int, count: int, reward_name: String)
|
||||
signal craft_failed(recipe_name: String)
|
||||
signal cube_error(reason: String)
|
||||
|
||||
# 40250 官方四大魔方炼金 NPC
|
||||
const NPC_BAEK_GO := 20018 # 药剂师 白高 (草药汁提炼)
|
||||
const NPC_YU_HWAN := 20017 # 游侠助手 刘焕 (中级药水配制)
|
||||
const NPC_HUAHN_SO := 20022 # 隐者 幻素 (高级露水炼制)
|
||||
const NPC_JAE_SEON_KIM:= 20383 # 顶级工匠 金在善 (神武/神甲熔铸)
|
||||
|
||||
const NPC_NAMES: Dictionary = {
|
||||
20018: "药剂师 白高 (Baek-Go)",
|
||||
20017: "游侠助手 刘焕 (Yu-Hwan)",
|
||||
20022: "隐者 幻素 (Huahn-So)",
|
||||
20383: "神级工匠 金在善 (Jae-Seon Kim)"
|
||||
}
|
||||
|
||||
# 40250 经典 cube.txt 配方定义表
|
||||
const RECIPES: Array[Dictionary] = [
|
||||
# --- 药剂师 白高 (20018) & 刘焕 (20017) 基础草药汁 ---
|
||||
{
|
||||
"id": "herb_peach_flower",
|
||||
"name": "桃花汁提炼",
|
||||
"npcs": [20018, 20017],
|
||||
"materials": [{"vnum": 50721, "count": 1}], # 桃花
|
||||
"reward": {"vnum": 50801, "count": 1, "name": "桃花汁 (Peach Flower Juice)"},
|
||||
"gold": 0,
|
||||
"percent": 100
|
||||
},
|
||||
{
|
||||
"id": "herb_campanula",
|
||||
"name": "风铃草汁提炼",
|
||||
"npcs": [20018, 20017],
|
||||
"materials": [{"vnum": 50722, "count": 1}], # 风铃草
|
||||
"reward": {"vnum": 50802, "count": 1, "name": "风铃草汁 (Campanula Juice)"},
|
||||
"gold": 0,
|
||||
"percent": 100
|
||||
},
|
||||
{
|
||||
"id": "herb_lilac",
|
||||
"name": "紫丁香汁批量提炼",
|
||||
"npcs": [20018, 20017],
|
||||
"materials": [{"vnum": 50723, "count": 1}], # 紫丁香
|
||||
"reward": {"vnum": 50803, "count": 100, "name": "紫丁香汁 x100"},
|
||||
"gold": 0,
|
||||
"percent": 100
|
||||
},
|
||||
{
|
||||
"id": "herb_persimmon",
|
||||
"name": "柿子花汁批量提炼",
|
||||
"npcs": [20018, 20017],
|
||||
"materials": [{"vnum": 50724, "count": 1}], # 柿子花
|
||||
"reward": {"vnum": 50804, "count": 100, "name": "柿子花汁 x100"},
|
||||
"gold": 0,
|
||||
"percent": 100
|
||||
},
|
||||
|
||||
# --- 隐者 幻素 (20022) 露水药水炼制 (Dew Crafting) ---
|
||||
{
|
||||
"id": "dew_peach_flower",
|
||||
"name": "桃花露水炼制",
|
||||
"npcs": [20022],
|
||||
"materials": [
|
||||
{"vnum": 50801, "count": 10}, # 桃花汁 x10
|
||||
{"vnum": 70031, "count": 10} # 空瓶 (Empty Bottle) x10
|
||||
],
|
||||
"reward": {"vnum": 50821, "count": 1, "name": "纯净桃花露 (Peach Flower Dew)"},
|
||||
"gold": 10000,
|
||||
"percent": 100
|
||||
},
|
||||
{
|
||||
"id": "dew_campanula",
|
||||
"name": "风铃草露水炼制",
|
||||
"npcs": [20022],
|
||||
"materials": [
|
||||
{"vnum": 50802, "count": 10}, # 风铃草汁 x10
|
||||
{"vnum": 70031, "count": 10} # 空瓶 x10
|
||||
],
|
||||
"reward": {"vnum": 50822, "count": 1, "name": "纯净风铃露 (Campanula Dew)"},
|
||||
"gold": 10000,
|
||||
"percent": 100
|
||||
},
|
||||
|
||||
# --- 工匠 金在善 (20383) 顶级神兵海神剑 (Triton Sword) 熔铸 ---
|
||||
{
|
||||
"id": "craft_triton_low",
|
||||
"name": "海神剑试炼熔铸 (低阶+5)",
|
||||
"npcs": [20383],
|
||||
"materials": [
|
||||
{"vnum": 145, "count": 1}, # 战神之剑+5
|
||||
{"vnum": 30500, "count": 10},# 能量晶石 x10
|
||||
{"vnum": 30505, "count": 10} # 熔铸秘石 x10
|
||||
],
|
||||
"reward": {"vnum": 460, "count": 1, "name": "海神之剑+0 (Triton Sword)"},
|
||||
"gold": 100000,
|
||||
"percent": 5 # 40250 原版 5% 概率
|
||||
},
|
||||
{
|
||||
"id": "craft_triton_master",
|
||||
"name": "海神剑巅峰熔铸 (满阶+9)",
|
||||
"npcs": [20383],
|
||||
"materials": [
|
||||
{"vnum": 149, "count": 1}, # 战神之剑+9
|
||||
{"vnum": 30500, "count": 10},# 能量晶石 x10
|
||||
{"vnum": 30505, "count": 10} # 熔铸秘石 x10
|
||||
],
|
||||
"reward": {"vnum": 460, "count": 1, "name": "海神之剑+0 (Triton Sword)"},
|
||||
"gold": 100000,
|
||||
"percent": 100 # 40250 原版 +9 保底 100%
|
||||
}
|
||||
]
|
||||
|
||||
# 当前魔方状态
|
||||
var current_active_npc: int = 0
|
||||
var is_cube_open: bool = false
|
||||
var crafting_history: Array[Dictionary] = []
|
||||
|
||||
# 打开魔方窗口
|
||||
func open_cube(npc_vnum: int) -> bool:
|
||||
if not NPC_NAMES.has(npc_vnum):
|
||||
cube_error.emit("INVALID_NPC")
|
||||
return false
|
||||
current_active_npc = npc_vnum
|
||||
is_cube_open = true
|
||||
cube_opened.emit(npc_vnum, NPC_NAMES[npc_vnum])
|
||||
return true
|
||||
|
||||
# 关闭魔方窗口
|
||||
func close_cube() -> void:
|
||||
current_active_npc = 0
|
||||
is_cube_open = false
|
||||
cube_closed.emit()
|
||||
|
||||
# 根据放入槽位的材料与当前 NPC 匹配配方 (对照 cube.cpp: FN_find_cube)
|
||||
func find_matching_recipe(cube_slots: Array, npc_vnum: int) -> Dictionary:
|
||||
# 统计放入槽位的物品 Vnum 与数量
|
||||
var inputs: Dictionary = {}
|
||||
for it in cube_slots:
|
||||
if it != null:
|
||||
var v = int(it.get("vnum", 0))
|
||||
var c = int(it.get("count", 1))
|
||||
inputs[v] = inputs.get(v, 0) + c
|
||||
|
||||
if inputs.is_empty():
|
||||
return {}
|
||||
|
||||
for rec in RECIPES:
|
||||
var npcs: Array = rec["npcs"]
|
||||
if not npcs.has(npc_vnum):
|
||||
continue
|
||||
|
||||
var req_materials: Array = rec["materials"]
|
||||
if req_materials.size() != inputs.size():
|
||||
continue
|
||||
|
||||
var matched := true
|
||||
for mat in req_materials:
|
||||
var mv = int(mat["vnum"])
|
||||
var mc = int(mat["count"])
|
||||
if inputs.get(mv, -1) != mc:
|
||||
matched = false
|
||||
break
|
||||
|
||||
if matched:
|
||||
return rec
|
||||
|
||||
return {}
|
||||
|
||||
# 执行魔方制造 (对照 cube.cpp: Cube_make)
|
||||
func craft_item(
|
||||
cube_slots: Array,
|
||||
inventory: Array,
|
||||
player_gold: int,
|
||||
forced_roll: int = -1
|
||||
) -> Dictionary:
|
||||
if not is_cube_open:
|
||||
cube_error.emit("CUBE_NOT_OPEN")
|
||||
return {"ok": false, "reason": "CUBE_NOT_OPEN", "msg": "制造窗口尚未打开!"}
|
||||
|
||||
var recipe = find_matching_recipe(cube_slots, current_active_npc)
|
||||
if recipe.is_empty():
|
||||
cube_error.emit("NO_MATCHING_RECIPE")
|
||||
return {"ok": false, "reason": "NO_MATCHING_RECIPE", "msg": "材料不足或配方不存在!"}
|
||||
|
||||
var fee = int(recipe.get("gold", 0))
|
||||
if player_gold < fee:
|
||||
cube_error.emit("NOT_ENOUGH_GOLD")
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "NOT_ENOUGH_GOLD",
|
||||
"msg": "金币不足!本次合成需要 %d 金币,你只有 %d 金币。" % [fee, player_gold]
|
||||
}
|
||||
|
||||
# 扣除材料 (清空魔方放置槽)
|
||||
for i in range(cube_slots.size()):
|
||||
cube_slots[i] = null
|
||||
|
||||
# 扣除手续费金币
|
||||
var remaining_gold = player_gold - fee
|
||||
|
||||
# 判定成功概率
|
||||
var pct = int(recipe.get("percent", 100))
|
||||
var roll = forced_roll if forced_roll > 0 else randi_range(1, 100)
|
||||
|
||||
if roll <= pct:
|
||||
# 合成成功 (cube success)
|
||||
var rew = recipe["reward"]
|
||||
var reward_vnum = int(rew["vnum"])
|
||||
var reward_count = int(rew.get("count", 1))
|
||||
var reward_name = str(rew.get("name", "制造道具"))
|
||||
|
||||
_give_or_stack_item(inventory, reward_vnum, reward_count)
|
||||
|
||||
var record = {
|
||||
"recipe_id": recipe["id"],
|
||||
"success": true,
|
||||
"reward_vnum": reward_vnum,
|
||||
"reward_count": reward_count,
|
||||
"fee": fee
|
||||
}
|
||||
crafting_history.append(record)
|
||||
craft_succeeded.emit(reward_vnum, reward_count, reward_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"reward_vnum": reward_vnum,
|
||||
"reward_count": reward_count,
|
||||
"remaining_gold": remaining_gold,
|
||||
"msg": "叮!伴随着绚烂的灵光,你成功制造出了【%s】!" % reward_name
|
||||
}
|
||||
else:
|
||||
# 合成失败 (cube fail)
|
||||
var record = {
|
||||
"recipe_id": recipe["id"],
|
||||
"success": false,
|
||||
"fee": fee
|
||||
}
|
||||
crafting_history.append(record)
|
||||
craft_failed.emit(recipe["name"])
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"success": false,
|
||||
"remaining_gold": remaining_gold,
|
||||
"msg": "制造失败了!魔方中传出一阵焦黑的青烟,材料化为了灰烬。"
|
||||
}
|
||||
|
||||
# 获取当前 NPC 允许合成的所有配方清单
|
||||
func get_available_recipes(npc_vnum: int) -> Array[Dictionary]:
|
||||
var list: Array[Dictionary] = []
|
||||
for rec in RECIPES:
|
||||
if rec["npcs"].has(npc_vnum):
|
||||
list.append(rec)
|
||||
return list
|
||||
|
||||
# 历史记录
|
||||
func get_history() -> Array[Dictionary]:
|
||||
return crafting_history
|
||||
|
||||
func clear_history() -> void:
|
||||
crafting_history.clear()
|
||||
|
||||
# 内部发放道具堆叠
|
||||
func _give_or_stack_item(inventory: Array, vnum: int, count: int) -> void:
|
||||
for it in inventory:
|
||||
if it != null and int(it.get("vnum", 0)) == vnum:
|
||||
it["count"] = int(it.get("count", 1)) + count
|
||||
return
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {"vnum": vnum, "count": count}
|
||||
return
|
||||
inventory.append({"vnum": vnum, "count": count})
|
||||
|
||||
# 序列化与反序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"history": crafting_history.duplicate(true)
|
||||
}
|
||||
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
crafting_history.clear()
|
||||
var raw = data.get("history", [])
|
||||
for it in raw:
|
||||
crafting_history.append(it.duplicate(true))
|
||||
@@ -1 +0,0 @@
|
||||
uid://dxkngqnfky42a
|
||||
@@ -1,196 +0,0 @@
|
||||
# cursed_monolith_spire_system.gd —— Metin2 40250 野外魔石破除之【封印魔塔】限时防守挑战 1:1
|
||||
# 对照 40250 服务端 regen.cpp, dungeon.cpp, char_battle.cpp, item_manager.cpp
|
||||
class_name CursedMonolithSpireSystem
|
||||
extends RefCounted
|
||||
|
||||
signal spire_emerged(pos: Vector3, time_limit: float)
|
||||
signal wave_spawned(wave_index: int, wave_name: String, mob_count: int)
|
||||
signal trial_completed(success: bool, time_used: float)
|
||||
signal reward_chest_spawned(chest_vnum: int, pos: Vector3)
|
||||
|
||||
const TRIAL_TIME_LIMIT: float = 180.0 # 3 分钟倒计时
|
||||
const CHEST_VNUM: int = 50130 # 上古魔塔宝箱 (Ancient Spire Chest)
|
||||
|
||||
const WAVE_CONFIG: Dictionary = {
|
||||
1: {
|
||||
"name": "第 1 波:狂暴魔兵突袭",
|
||||
"mob_vnum": 701, # 恶魔士兵
|
||||
"count": 6
|
||||
},
|
||||
2: {
|
||||
"name": "第 2 波:双生魔将合围",
|
||||
"mob_vnum": 1092, # 恶魔大将
|
||||
"count": 2
|
||||
},
|
||||
3: {
|
||||
"name": "第 3 波:上古守墓魔王",
|
||||
"mob_vnum": 1093, # 恶魔死神幻影
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
|
||||
var is_active: bool = false
|
||||
var current_wave: int = 0
|
||||
var time_remaining: float = 0.0
|
||||
var spire_pos: Vector3 = Vector3.ZERO
|
||||
var difficulty: int = 50
|
||||
|
||||
var active_mobs: Dictionary = {} # mob_id -> { "vnum", "alive" }
|
||||
var next_mob_id: int = 1
|
||||
var is_victory: bool = false
|
||||
var chest_available: bool = false
|
||||
|
||||
# 启动封印魔塔挑战
|
||||
func start_trial(pos: Vector3, diff_level: int = 50) -> Dictionary:
|
||||
if is_active:
|
||||
return {"ok": false, "reason": "TRIAL_ALREADY_ACTIVE", "msg": "封印魔塔挑战正在进行中!"}
|
||||
|
||||
is_active = true
|
||||
is_victory = false
|
||||
chest_available = false
|
||||
spire_pos = pos
|
||||
difficulty = diff_level
|
||||
time_remaining = TRIAL_TIME_LIMIT
|
||||
current_wave = 0
|
||||
active_mobs.clear()
|
||||
next_mob_id = 1
|
||||
|
||||
spire_emerged.emit(pos, TRIAL_TIME_LIMIT)
|
||||
|
||||
# 立即召唤第 1 波
|
||||
_spawn_wave(1)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"pos": pos,
|
||||
"time_limit": TRIAL_TIME_LIMIT,
|
||||
"msg": "大地剧烈震颤!【诅咒的封印黑石魔塔】破土升起!请在 180 秒内清除所有魔潮!"
|
||||
}
|
||||
|
||||
# 产生指定阶段怪潮
|
||||
func _spawn_wave(wave_idx: int) -> void:
|
||||
current_wave = wave_idx
|
||||
var cfg = WAVE_CONFIG[wave_idx]
|
||||
var count: int = cfg["count"]
|
||||
var vnum: int = cfg["mob_vnum"]
|
||||
|
||||
active_mobs.clear()
|
||||
for i in range(count):
|
||||
var mid := next_mob_id
|
||||
next_mob_id += 1
|
||||
active_mobs[mid] = {
|
||||
"id": mid,
|
||||
"vnum": vnum,
|
||||
"alive": true
|
||||
}
|
||||
|
||||
wave_spawned.emit(wave_idx, cfg["name"], count)
|
||||
|
||||
# 击杀魔潮怪物
|
||||
func kill_mob(mob_id: int) -> Dictionary:
|
||||
if not is_active:
|
||||
return {"ok": false, "reason": "TRIAL_NOT_ACTIVE"}
|
||||
|
||||
if not active_mobs.has(mob_id) or not active_mobs[mob_id]["alive"]:
|
||||
return {"ok": false, "reason": "MOB_NOT_FOUND"}
|
||||
|
||||
active_mobs[mob_id]["alive"] = false
|
||||
active_mobs.erase(mob_id)
|
||||
|
||||
# 检查当前波次是否全清
|
||||
if active_mobs.is_empty():
|
||||
if current_wave < 3:
|
||||
# 进入下一波
|
||||
var next_w = current_wave + 1
|
||||
_spawn_wave(next_w)
|
||||
return {
|
||||
"ok": true,
|
||||
"wave_cleared": current_wave - 1,
|
||||
"next_wave": next_w,
|
||||
"msg": "当前波次肃清!更加凶险的魔物正在凝聚!"
|
||||
}
|
||||
else:
|
||||
# 第 3 波首领击破 -> 大获全胜!
|
||||
return _finish_trial(true)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"remaining_in_wave": active_mobs.size()
|
||||
}
|
||||
|
||||
# 帧心跳更新限时倒计时
|
||||
func update(delta: float) -> Dictionary:
|
||||
if not is_active:
|
||||
return {"status": "inactive"}
|
||||
|
||||
time_remaining -= delta
|
||||
if time_remaining <= 0.0:
|
||||
time_remaining = 0.0
|
||||
return _finish_trial(false)
|
||||
|
||||
return {
|
||||
"status": "running",
|
||||
"wave": current_wave,
|
||||
"remaining_mobs": active_mobs.size(),
|
||||
"time_remaining": time_remaining
|
||||
}
|
||||
|
||||
# 结算挑战胜负
|
||||
func _finish_trial(success: bool) -> Dictionary:
|
||||
is_active = false
|
||||
is_victory = success
|
||||
var time_used = TRIAL_TIME_LIMIT - time_remaining
|
||||
|
||||
if success:
|
||||
chest_available = true
|
||||
reward_chest_spawned.emit(CHEST_VNUM, spire_pos)
|
||||
trial_completed.emit(true, time_used)
|
||||
return {
|
||||
"ok": true,
|
||||
"victory": true,
|
||||
"time_used": time_used,
|
||||
"msg": "【封印魔塔】封印彻底瓦解!降下【上古魔塔宝箱】!耗时: %.1f 秒" % time_used
|
||||
}
|
||||
else:
|
||||
active_mobs.clear()
|
||||
trial_completed.emit(false, TRIAL_TIME_LIMIT)
|
||||
return {
|
||||
"ok": true,
|
||||
"victory": false,
|
||||
"time_used": TRIAL_TIME_LIMIT,
|
||||
"msg": "时间耗尽!封印黑石魔塔重新沉入深渊地底,挑战失败!"
|
||||
}
|
||||
|
||||
# 开启上古宝箱获取掉落
|
||||
func open_reward_chest() -> Array:
|
||||
if not chest_available:
|
||||
return []
|
||||
|
||||
chest_available = false
|
||||
var drops: Array = [
|
||||
{"vnum": 71003, "name": "祝福卷轴", "count": 2},
|
||||
{"vnum": 50513, "name": "灵魂之石", "count": 1},
|
||||
{"vnum": 70024, "name": "祝福宝珠", "count": 1},
|
||||
{"vnum": 1, "name": "金币", "count": 3500000}
|
||||
]
|
||||
return drops
|
||||
|
||||
# 取消/中断挑战
|
||||
func cancel_trial() -> Dictionary:
|
||||
if not is_active:
|
||||
return {"ok": false, "reason": "NOT_ACTIVE"}
|
||||
|
||||
is_active = false
|
||||
active_mobs.clear()
|
||||
return {"ok": true, "msg": "挑战已提前终止。"}
|
||||
|
||||
# 获取状态
|
||||
func get_trial_state() -> Dictionary:
|
||||
return {
|
||||
"is_active": is_active,
|
||||
"is_victory": is_victory,
|
||||
"current_wave": current_wave,
|
||||
"remaining_mobs": active_mobs.size(),
|
||||
"time_remaining": time_remaining,
|
||||
"chest_available": chest_available
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://mklhwerocdlu
|
||||
@@ -1,225 +0,0 @@
|
||||
# demon_tower_system.gd —— 恶魔之塔 1~9 层单机爬塔挑战循环与塔顶免费铁匠(40250 官方 1:1 对齐)
|
||||
# 对齐源码:
|
||||
# - 40250 server/share/locale/english/quest/deviltower_zone.quest
|
||||
# - 40250 server/game/src/dungeon.cpp
|
||||
# - 40250 server/game/src/char_battle.cpp
|
||||
class_name DemonTowerSystem
|
||||
extends RefCounted
|
||||
|
||||
signal floor_changed(floor_num: int, floor_name: String)
|
||||
signal floor_completed(floor_num: int)
|
||||
signal tower_completed
|
||||
signal tower_failed(reason: String)
|
||||
signal blacksmith_spawned(blacksmith_vnum: int, blacksmith_name: String)
|
||||
|
||||
# 核心怪物与 NPC Vnum (40250 官方标准)
|
||||
const VNUM_METIN_FLOOR1 := 8015 # 坚韧之石 (1层入口封印)
|
||||
const VNUM_DEMON_KING := 1091 # 恶魔王 (3层 BOSS)
|
||||
const VNUM_METIN_FLOOR4 := 8016 # 恶魔封印石 (4层真伪封印石)
|
||||
const VNUM_ELITE_DEMON_KING := 1092 # 精英恶魔王 (6层 BOSS)
|
||||
const VNUM_METIN_DEATH := 8017 # 死亡之石 (7层)
|
||||
const VNUM_DEATH_REAPER := 1093 # 死神 (9层 最终 BOSS)
|
||||
|
||||
# 塔顶免费铁匠 NPC
|
||||
const NPC_TOWER_WEAPON_SMITH := 20074 # 恶魔之塔武器铁匠
|
||||
const NPC_TOWER_ARMOR_SMITH := 20075 # 恶魔之塔防具铁匠
|
||||
const NPC_TOWER_JEWELRY_SMITH := 20076 # 恶魔之塔首饰铁匠
|
||||
|
||||
# 核心任务道具
|
||||
const VNUM_ZIN_KEY_FLOOR5 := 50084 # 解除 5 层石碑钥匙
|
||||
const VNUM_ZIN_MAP_FLOOR7 := 30302 # 7 层恶魔封印地图
|
||||
const VNUM_ZIN_KEY_FLOOR8 := 30304 # 8 层通往塔顶钥匙
|
||||
const VNUM_DEATH_REAPER_CHEST := 50082 # 9 层死神宝箱
|
||||
|
||||
const TOTAL_FLOORS := 9
|
||||
const FLOOR_NAMES := {
|
||||
1: "第 1 层:恶魔入口",
|
||||
2: "第 2 层:恶魔集结所",
|
||||
3: "第 3 层:恶魔王大殿",
|
||||
4: "第 4 层:迷幻封印之阵",
|
||||
5: "第 5 层:五柱封印禁地",
|
||||
6: "第 6 层:恶魔之塔顶峰",
|
||||
7: "第 7 层:死神迷宫前厅",
|
||||
8: "第 8 层:死神结界禁地",
|
||||
9: "第 9 层:死神王座决战",
|
||||
}
|
||||
|
||||
# 运行期状态
|
||||
var current_floor := 1
|
||||
var is_active := false
|
||||
var floor_time_left := 1200.0 # 20 分钟单层时限
|
||||
var floor4_real_metin_idx := -1
|
||||
var floor5_unlocked_pillars := 0
|
||||
var floor6_blacksmith_vnum := 0
|
||||
var floor6_free_refine_used := false
|
||||
|
||||
func start_tower() -> void:
|
||||
current_floor = 1
|
||||
is_active = true
|
||||
floor_time_left = 1200.0
|
||||
floor4_real_metin_idx = -1
|
||||
floor5_unlocked_pillars = 0
|
||||
floor6_blacksmith_vnum = 0
|
||||
floor6_free_refine_used = false
|
||||
floor_changed.emit(1, FLOOR_NAMES[1])
|
||||
|
||||
func get_floor() -> int:
|
||||
return current_floor
|
||||
|
||||
func get_floor_name() -> String:
|
||||
return FLOOR_NAMES.get(current_floor, "未知层")
|
||||
|
||||
## 第 1 层判定:击碎封印石 8015 即可通关
|
||||
func on_floor1_metin_destroyed(vnum: int) -> bool:
|
||||
if current_floor != 1 or not is_active:
|
||||
return false
|
||||
if vnum == VNUM_METIN_FLOOR1:
|
||||
_advance_floor()
|
||||
return true
|
||||
return false
|
||||
|
||||
## 第 2 层判定:清理全图怪物
|
||||
func on_floor2_mobs_cleared(mob_count: int) -> bool:
|
||||
if current_floor != 2 or not is_active:
|
||||
return false
|
||||
if mob_count <= 0:
|
||||
_advance_floor()
|
||||
return true
|
||||
return false
|
||||
|
||||
## 第 3 层判定:击杀恶魔王 1091
|
||||
func on_floor3_boss_killed(boss_vnum: int) -> bool:
|
||||
if current_floor != 3 or not is_active:
|
||||
return false
|
||||
if boss_vnum == VNUM_DEMON_KING:
|
||||
_advance_floor()
|
||||
return true
|
||||
return false
|
||||
|
||||
## 第 4 层判定:初始化 7 座封印石并在打破真石时通关
|
||||
func setup_floor4_metins() -> void:
|
||||
# 7 座封印石 (索引 0..6),随机指定 1 座为真石
|
||||
floor4_real_metin_idx = randi() % 7
|
||||
|
||||
func on_floor4_metin_hit(stone_idx: int) -> Dictionary:
|
||||
if current_floor != 4 or not is_active:
|
||||
return {"ok": false, "msg": "当前不在第 4 层!"}
|
||||
if stone_idx == floor4_real_metin_idx:
|
||||
_advance_floor()
|
||||
return {"ok": true, "is_real": true, "msg": "找到了真实的恶魔封印石!通往第 5 层的传送门开启!"}
|
||||
else:
|
||||
return {"ok": true, "is_real": false, "msg": "这是一座虚假的封印石,迷雾尚未散开!"}
|
||||
|
||||
## 第 5 层判定:使用钥匙解除 5 座恶魔石柱
|
||||
func on_floor5_unlock_pillar(key_vnum: int) -> Dictionary:
|
||||
if current_floor != 5 or not is_active:
|
||||
return {"ok": false, "msg": "当前不在第 5 层!"}
|
||||
if key_vnum != VNUM_ZIN_KEY_FLOOR5:
|
||||
return {"ok": false, "msg": "钥匙不匹配!"}
|
||||
|
||||
floor5_unlocked_pillars += 1
|
||||
var remain := 5 - floor5_unlocked_pillars
|
||||
if floor5_unlocked_pillars >= 5:
|
||||
_advance_floor()
|
||||
return {"ok": true, "completed": true, "msg": "5 座恶魔石碑全部解除封印!传送至第 6 层!"}
|
||||
else:
|
||||
return {"ok": true, "completed": false, "remain": remain, "msg": "成功解除了一座石碑封印,还剩 %d 座!" % remain}
|
||||
|
||||
## 第 6 层判定:击杀精英恶魔王 1092 并召唤免费铁匠
|
||||
func on_floor6_boss_killed(boss_vnum: int) -> Dictionary:
|
||||
if current_floor != 6 or not is_active:
|
||||
return {"ok": false, "msg": "当前不在第 6 层!"}
|
||||
if boss_vnum == VNUM_ELITE_DEMON_KING:
|
||||
# 随机召唤三位塔顶铁匠之一
|
||||
var smiths := [
|
||||
{"vnum": NPC_TOWER_WEAPON_SMITH, "name": "恶魔之塔武器铁匠"},
|
||||
{"vnum": NPC_TOWER_ARMOR_SMITH, "name": "恶魔之塔防具铁匠"},
|
||||
{"vnum": NPC_TOWER_JEWELRY_SMITH, "name": "恶魔之塔首饰铁匠"}
|
||||
]
|
||||
var chosen: Dictionary = smiths[randi() % smiths.size()]
|
||||
floor6_blacksmith_vnum = chosen["vnum"]
|
||||
floor6_free_refine_used = false
|
||||
blacksmith_spawned.emit(chosen["vnum"], chosen["name"])
|
||||
return {
|
||||
"ok": true,
|
||||
"blacksmith_vnum": chosen["vnum"],
|
||||
"blacksmith_name": chosen["name"],
|
||||
"msg": "击杀了精英恶魔王!塔顶现身了一位【%s】!" % chosen["name"]
|
||||
}
|
||||
return {"ok": false, "msg": "目标不是精英恶魔王!"}
|
||||
|
||||
## 第 6 层塔顶免费铁匠强化 (无需材料,单人爬塔经典福利)
|
||||
func perform_tower_free_refine(item: Dictionary, item_type: int) -> Dictionary:
|
||||
if current_floor != 6 or floor6_blacksmith_vnum == 0:
|
||||
return {"ok": false, "code": "NO_BLACKSMITH", "msg": "塔顶铁匠尚未出现!"}
|
||||
if floor6_free_refine_used:
|
||||
return {"ok": false, "code": "ALREADY_USED", "msg": "恶魔之塔铁匠本次只能免费强化一次!"}
|
||||
|
||||
# 校验铁匠类型与物品类型匹配
|
||||
if floor6_blacksmith_vnum == NPC_TOWER_WEAPON_SMITH and item_type != 1:
|
||||
return {"ok": false, "code": "TYPE_MISMATCH", "msg": "武器铁匠只能强化武器!"}
|
||||
if floor6_blacksmith_vnum == NPC_TOWER_ARMOR_SMITH and item_type != 2:
|
||||
return {"ok": false, "code": "TYPE_MISMATCH", "msg": "防具铁匠只能强化防具!"}
|
||||
|
||||
floor6_free_refine_used = true
|
||||
var cur_vnum := int(item.get("vnum", 0))
|
||||
var new_vnum := cur_vnum + 1
|
||||
item["vnum"] = new_vnum
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "SUCCESS",
|
||||
"old_vnum": cur_vnum,
|
||||
"new_vnum": new_vnum,
|
||||
"msg": "【%s】为你施展了恶魔神工,免费强化成功!装备晋升为 #%d!" % [
|
||||
"武器铁匠" if floor6_blacksmith_vnum == NPC_TOWER_WEAPON_SMITH else "防具铁匠",
|
||||
new_vnum
|
||||
]
|
||||
}
|
||||
|
||||
## 从第 6 层前往第 7 层 (要求角色等级 >= 75)
|
||||
func advance_to_floor7(player_level: int) -> Dictionary:
|
||||
if current_floor != 6:
|
||||
return {"ok": false, "msg": "不在第 6 层!"}
|
||||
if player_level < 75:
|
||||
return {"ok": false, "code": "LEVEL_TOO_LOW", "msg": "只有等级达到 75 级的真正勇者,才能踏入恶魔之塔第 7 层禁地!"}
|
||||
_advance_floor()
|
||||
return {"ok": true, "msg": "踏入了死神禁地第 7 层!"}
|
||||
|
||||
## 第 7 层判定:使用恶魔地图 30302 通关
|
||||
func on_floor7_map_used(map_vnum: int) -> bool:
|
||||
if current_floor != 7 or not is_active:
|
||||
return false
|
||||
if map_vnum == VNUM_ZIN_MAP_FLOOR7:
|
||||
_advance_floor()
|
||||
return true
|
||||
return false
|
||||
|
||||
## 第 8 层判定:使用钥匙 30304 通关
|
||||
func on_floor8_key_used(key_vnum: int) -> bool:
|
||||
if current_floor != 8 or not is_active:
|
||||
return false
|
||||
if key_vnum == VNUM_ZIN_KEY_FLOOR8:
|
||||
_advance_floor()
|
||||
return true
|
||||
return false
|
||||
|
||||
## 第 9 层终极对决:击杀死神 1093
|
||||
func on_floor9_boss_killed(boss_vnum: int) -> Dictionary:
|
||||
if current_floor != 9 or not is_active:
|
||||
return {"ok": false, "msg": "当前不在第 9 层!"}
|
||||
if boss_vnum == VNUM_DEATH_REAPER:
|
||||
is_active = false
|
||||
tower_completed.emit()
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "TOWER_CLEAR",
|
||||
"drop_vnum": VNUM_DEATH_REAPER_CHEST,
|
||||
"msg": "壮举!你成功斩杀了死神,恶魔之塔被彻底征服!获得了【死神宝箱】!"
|
||||
}
|
||||
return {"ok": false, "msg": "目标不是死神!"}
|
||||
|
||||
func _advance_floor() -> void:
|
||||
floor_completed.emit(current_floor)
|
||||
current_floor += 1
|
||||
floor_time_left = 1200.0
|
||||
floor_changed.emit(current_floor, FLOOR_NAMES.get(current_floor, "第 %d 层" % current_floor))
|
||||
@@ -1 +0,0 @@
|
||||
uid://berjrd53seoek
|
||||
@@ -1,326 +0,0 @@
|
||||
# devils_catacomb_system.gd —— Metin2 40250 地下墓穴 7 层与冥王阿兹瑞尔挑战副本 1:1
|
||||
# 对照 40250 服务端 devils_catacomb.quest, dungeon.cpp, char_battle.cpp, mob 2598, 2597, 2596
|
||||
class_name DevilsCatacombSystem
|
||||
extends RefCounted
|
||||
|
||||
signal floor_advanced(floor: int)
|
||||
signal metin_destroyed(is_correct: bool)
|
||||
signal tartaros_killed(drop_item: Dictionary)
|
||||
signal obelisk_activated()
|
||||
signal charon_killed()
|
||||
signal azrael_hp_changed(current_hp: int, max_hp: int)
|
||||
signal catacomb_cleared(drops: Array)
|
||||
signal catacomb_failed(reason: String)
|
||||
|
||||
const NPC_CATACOMB_GUARD := 20367
|
||||
const ITEM_SOUL_CRYSTAL_KEY := 30311 # 灵魂水晶钥匙 (进入与 1 层解锁)
|
||||
const ITEM_GRIM_SOUL_STONE := 30312 # 冷酷之石 (5 层塔耳塔洛斯掉落)
|
||||
const MIN_LEVEL := 75
|
||||
const TIME_LIMIT := 3600.0 # 60 分钟限时
|
||||
|
||||
# 首领属性
|
||||
const MOB_TARTAROS := 2597 # 5 层守卫 塔耳塔洛斯
|
||||
const MOB_CHARON := 2596 # 6 层将军 卡隆
|
||||
const MOB_AZRAEL := 2598 # 7 层冥界之王 阿兹瑞尔
|
||||
|
||||
const AZRAEL_MAX_HP := 900000
|
||||
const AZRAEL_BASE_ATK := 2200
|
||||
const AZRAEL_BASE_DEF := 680
|
||||
|
||||
var is_active: bool = false
|
||||
var current_floor: int = 0
|
||||
var remaining_time: float = 0.0
|
||||
|
||||
# 3 层复仇魔石状态
|
||||
var correct_metin_id: int = 3
|
||||
var metins_broken: int = 0
|
||||
|
||||
# 5 层方尖碑状态
|
||||
var has_grim_stone: bool = false
|
||||
var is_obelisk_unlocked: bool = false
|
||||
|
||||
# 7 层阿兹瑞尔状态
|
||||
var azrael_hp: int = 0
|
||||
var azrael_max_hp: int = AZRAEL_MAX_HP
|
||||
var is_azrael_alive: bool = false
|
||||
var azrael_minions_summoned: bool = false
|
||||
|
||||
# 进入地下墓穴 (通过 NPC 20367)
|
||||
func enter_catacomb(player_level: int, inventory: Array) -> Dictionary:
|
||||
if player_level < MIN_LEVEL:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "LEVEL_TOO_LOW",
|
||||
"msg": "你的等级不足 75 级,无法承受地下墓穴的死灵死气!"
|
||||
}
|
||||
|
||||
# 检查 1 层必需的灵魂水晶钥匙 (30311)
|
||||
var key_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
var item = inventory[i]
|
||||
if item != null and int(item.get("vnum", 0)) == ITEM_SOUL_CRYSTAL_KEY:
|
||||
key_slot = i
|
||||
break
|
||||
|
||||
if key_slot == -1:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "MISSING_SOUL_KEY",
|
||||
"msg": "进入地下墓穴需要持有【灵魂水晶钥匙】!"
|
||||
}
|
||||
|
||||
# 初始化副本状态进入 1 层
|
||||
is_active = true
|
||||
current_floor = 1
|
||||
remaining_time = TIME_LIMIT
|
||||
correct_metin_id = randi_range(1, 5)
|
||||
metins_broken = 0
|
||||
has_grim_stone = false
|
||||
is_obelisk_unlocked = false
|
||||
is_azrael_alive = false
|
||||
|
||||
floor_advanced.emit(1)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 1,
|
||||
"time_limit": remaining_time,
|
||||
"msg": "成功踏入地下墓穴一层!限时 60 分钟!"
|
||||
}
|
||||
|
||||
# 第 1 层:使用灵魂水晶钥匙开启石门封印进入 2 层
|
||||
func unlock_floor_1(inventory: Array) -> Dictionary:
|
||||
if not is_active or current_floor != 1:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
var key_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
var item = inventory[i]
|
||||
if item != null and int(item.get("vnum", 0)) == ITEM_SOUL_CRYSTAL_KEY:
|
||||
key_slot = i
|
||||
break
|
||||
|
||||
if key_slot == -1:
|
||||
return {"ok": false, "reason": "MISSING_KEY", "msg": "背包中缺少灵魂水晶钥匙!"}
|
||||
|
||||
# 消耗钥匙
|
||||
inventory[key_slot] = null
|
||||
current_floor = 2
|
||||
floor_advanced.emit(2)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 2,
|
||||
"msg": "灵魂水晶钥匙已插入封印,石门轰然开启!进入地下墓穴二层!"
|
||||
}
|
||||
|
||||
# 第 2 层:突破恶灵迷宫进入 3 层
|
||||
func complete_floor_2() -> Dictionary:
|
||||
if not is_active or current_floor != 2:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
current_floor = 3
|
||||
floor_advanced.emit(3)
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 3,
|
||||
"msg": "已突破恶灵迷宫!进入地下墓穴三层!"
|
||||
}
|
||||
|
||||
# 第 3 层:击碎复仇魔石 (8035)
|
||||
func break_floor_3_metin(metin_idx: int) -> Dictionary:
|
||||
if not is_active or current_floor != 3:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
metins_broken += 1
|
||||
if metin_idx == correct_metin_id:
|
||||
current_floor = 4
|
||||
metin_destroyed.emit(true)
|
||||
floor_advanced.emit(4)
|
||||
return {
|
||||
"ok": true,
|
||||
"correct": true,
|
||||
"floor": 4,
|
||||
"msg": "击碎了真正的复仇魔石!封印瓦解,传送至地下墓穴四层!"
|
||||
}
|
||||
else:
|
||||
metin_destroyed.emit(false)
|
||||
return {
|
||||
"ok": true,
|
||||
"correct": false,
|
||||
"floor": 3,
|
||||
"msg": "这是虚假的伪装魔石!周围唤醒了冥界诅咒之魂!"
|
||||
}
|
||||
|
||||
# 第 4 层:玄武岩石柱迷宫寻路进入 5 层
|
||||
func complete_floor_4() -> Dictionary:
|
||||
if not is_active or current_floor != 4:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
current_floor = 5
|
||||
floor_advanced.emit(5)
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 5,
|
||||
"msg": "成功找到玄武岩迷宫真出口!进入地下墓穴五层!"
|
||||
}
|
||||
|
||||
# 第 5 层:击败塔耳塔洛斯 (2597) 并获得冷酷之石 (30312)
|
||||
func defeat_tartaros(inventory: Array) -> Dictionary:
|
||||
if not is_active or current_floor != 5:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
# 放入背包
|
||||
var empty_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
empty_slot = i
|
||||
break
|
||||
|
||||
if empty_slot == -1:
|
||||
return {"ok": false, "reason": "INVENTORY_FULL", "msg": "背包已满,无法拾取冷酷之石!"}
|
||||
|
||||
var grim_stone = {"vnum": ITEM_GRIM_SOUL_STONE, "name": "冷酷之石", "count": 1}
|
||||
inventory[empty_slot] = grim_stone
|
||||
has_grim_stone = true
|
||||
|
||||
tartaros_killed.emit(grim_stone)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"drop": grim_stone,
|
||||
"msg": "击败了守卫【塔耳塔洛斯】,获得了【冷酷之石】!请前往方尖碑镶嵌!"
|
||||
}
|
||||
|
||||
# 第 5 层:将冷酷之石插入玄武岩方尖碑,开启 6 层通道
|
||||
func insert_grim_stone_to_obelisk(inventory: Array) -> Dictionary:
|
||||
if not is_active or current_floor != 5:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
var stone_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
var item = inventory[i]
|
||||
if item != null and int(item.get("vnum", 0)) == ITEM_GRIM_SOUL_STONE:
|
||||
stone_slot = i
|
||||
break
|
||||
|
||||
if stone_slot == -1:
|
||||
return {"ok": false, "reason": "MISSING_STONE", "msg": "背包中缺少冷酷之石!"}
|
||||
|
||||
inventory[stone_slot] = null
|
||||
is_obelisk_unlocked = true
|
||||
current_floor = 6
|
||||
obelisk_activated.emit()
|
||||
floor_advanced.emit(6)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 6,
|
||||
"msg": "冷酷之石完美嵌入方尖碑!冥界封印开启,进入地下墓穴六层!"
|
||||
}
|
||||
|
||||
# 第 6 层:击败冥界将军卡隆 (2596) 进入 7 层阿兹瑞尔王座
|
||||
func defeat_charon() -> Dictionary:
|
||||
if not is_active or current_floor != 6:
|
||||
return {"ok": false, "reason": "WRONG_FLOOR"}
|
||||
|
||||
current_floor = 7
|
||||
# 初始化 7 层 Boss 阿兹瑞尔
|
||||
azrael_hp = AZRAEL_MAX_HP
|
||||
azrael_max_hp = AZRAEL_MAX_HP
|
||||
is_azrael_alive = true
|
||||
azrael_minions_summoned = false
|
||||
|
||||
charon_killed.emit()
|
||||
floor_advanced.emit(7)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"floor": 7,
|
||||
"boss_hp": azrael_hp,
|
||||
"msg": "冥界将军【卡隆】已被斩灭!传送至七层【冥王阿兹瑞尔王座】!"
|
||||
}
|
||||
|
||||
# 第 7 层:对冥王阿兹瑞尔造成伤害
|
||||
func attack_azrael(raw_dmg: int) -> Dictionary:
|
||||
if not is_active or current_floor != 7 or not is_azrael_alive:
|
||||
return {"ok": false, "reason": "BOSS_NOT_AVAILABLE"}
|
||||
|
||||
var net_dmg: int = max(1, raw_dmg - AZRAEL_BASE_DEF)
|
||||
azrael_hp = max(0, azrael_hp - net_dmg)
|
||||
|
||||
azrael_hp_changed.emit(azrael_hp, azrael_max_hp)
|
||||
|
||||
# 半血召唤死灵护卫
|
||||
var triggered_minions := false
|
||||
if azrael_hp <= int(AZRAEL_MAX_HP * 0.5) and not azrael_minions_summoned:
|
||||
azrael_minions_summoned = true
|
||||
triggered_minions = true
|
||||
|
||||
# 击败阿兹瑞尔
|
||||
if azrael_hp <= 0:
|
||||
is_azrael_alive = false
|
||||
is_active = false
|
||||
var drops: Array = _generate_azrael_drops()
|
||||
catacomb_cleared.emit(drops)
|
||||
return {
|
||||
"ok": true,
|
||||
"killed": true,
|
||||
"net_dmg": net_dmg,
|
||||
"remaining_hp": 0,
|
||||
"drops": drops,
|
||||
"msg": "【冥王阿兹瑞尔】轰然倒下!地下墓穴已被彻底征服!"
|
||||
}
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"killed": false,
|
||||
"net_dmg": net_dmg,
|
||||
"remaining_hp": azrael_hp,
|
||||
"summoned_minions": triggered_minions
|
||||
}
|
||||
|
||||
# 逐帧倒计时
|
||||
func update(dt: float) -> void:
|
||||
if not is_active:
|
||||
return
|
||||
|
||||
remaining_time -= dt
|
||||
if remaining_time <= 0.0:
|
||||
is_active = false
|
||||
is_azrael_alive = false
|
||||
catacomb_failed.emit("TIME_OUT")
|
||||
|
||||
# 生成阿兹瑞尔掉落物
|
||||
func _generate_azrael_drops() -> Array:
|
||||
var drops: Array = []
|
||||
|
||||
# 1. 必掉阿兹瑞尔专属宝箱 (50187)
|
||||
drops.append({
|
||||
"vnum": 50187,
|
||||
"name": "阿兹瑞尔宝箱",
|
||||
"count": 1
|
||||
})
|
||||
|
||||
# 2. 必掉灵魂之石 (50513)
|
||||
drops.append({
|
||||
"vnum": 50513,
|
||||
"name": "灵魂之石",
|
||||
"count": 1
|
||||
})
|
||||
|
||||
# 3. 终极泰坦之盾 (13149) 概率掉落
|
||||
drops.append({
|
||||
"vnum": 13149,
|
||||
"name": "泰坦之盾+0",
|
||||
"count": 1
|
||||
})
|
||||
|
||||
# 4. 大额冥界金币
|
||||
drops.append({
|
||||
"vnum": 1,
|
||||
"name": "金币",
|
||||
"count": randi_range(200000, 400000)
|
||||
})
|
||||
|
||||
return drops
|
||||
@@ -1 +0,0 @@
|
||||
uid://dyqcl4bpdcalf
|
||||
@@ -1,257 +0,0 @@
|
||||
# dragon_lair_system.gd —— Metin2 40250 冰龙贝兰-塞陶挑战巢穴 1:1
|
||||
# 对照 40250 服务端 dragon_lair.quest, dungeon.cpp, char_battle.cpp, mob 2493, NPC 30121
|
||||
class_name DragonLairSystem
|
||||
extends RefCounted
|
||||
|
||||
signal dungeon_started(time_limit: float)
|
||||
signal metin_destroyed(metin_vnum: int, metin_name: String)
|
||||
signal minions_spawned(count: int, mob_vnum: int)
|
||||
signal dragon_hp_changed(current_hp: int, max_hp: int)
|
||||
signal dragon_defeated(drops: Array)
|
||||
signal dungeon_failed(reason: String)
|
||||
|
||||
const NPC_GHOST_OF_SURA := 30121 # 修罗鬼魂
|
||||
const ITEM_TWISTED_KEY := 30179 # 扭曲钥匙
|
||||
const KEY_REQUIRED_COUNT := 3
|
||||
const MIN_LEVEL := 75
|
||||
const TIME_LIMIT := 3600.0 # 60 分钟限时
|
||||
|
||||
const BOSS_VNUM := 2493 # 贝兰-塞陶 (Beran-Setaou)
|
||||
const BOSS_MAX_HP := 800000
|
||||
const BOSS_BASE_ATK := 1800
|
||||
const BOSS_BASE_DEF := 650
|
||||
|
||||
const METIN_TABLE: Dictionary = {
|
||||
8031: {"name": "傲慢之石", "desc": "提供 30% 物理抗性减免"},
|
||||
8032: {"name": "寂寞之石", "desc": "提供生命自然恢复"},
|
||||
8033: {"name": "平静之石", "desc": "提供 30% 魔法抗性减免"},
|
||||
8034: {"name": "复仇之石", "desc": "提供 40% 攻击力增幅"}
|
||||
}
|
||||
|
||||
var is_active: bool = false
|
||||
var remaining_time: float = 0.0
|
||||
var dragon_hp: int = 0
|
||||
var dragon_max_hp: int = BOSS_MAX_HP
|
||||
var is_dragon_alive: bool = false
|
||||
var active_metins: Dictionary = {} # vnum -> bool (true = alive)
|
||||
var active_minions: Array = []
|
||||
var regen_timer: float = 0.0
|
||||
|
||||
# 进入冰龙巢穴 (通过 NPC 30121 验证)
|
||||
func enter_lair(player_level: int, inventory: Array) -> Dictionary:
|
||||
if player_level < MIN_LEVEL:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "LEVEL_TOO_LOW",
|
||||
"msg": "你的等级不足 75 级,无法承受冰龙巢穴的严寒!"
|
||||
}
|
||||
|
||||
# 检查背包中的 3 把扭曲钥匙 (30179)
|
||||
var key_slots: Array = []
|
||||
var total_keys: int = 0
|
||||
for i in range(inventory.size()):
|
||||
var item = inventory[i]
|
||||
if item != null and int(item.get("vnum", 0)) == ITEM_TWISTED_KEY:
|
||||
var cnt: int = int(item.get("count", 1))
|
||||
total_keys += cnt
|
||||
key_slots.append({"slot": i, "count": cnt})
|
||||
|
||||
if total_keys < KEY_REQUIRED_COUNT:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "MISSING_KEYS",
|
||||
"current_keys": total_keys,
|
||||
"required_keys": KEY_REQUIRED_COUNT,
|
||||
"msg": "进入冰龙巢穴需要 3 把扭曲钥匙!你当前拥有 %d 把。" % total_keys
|
||||
}
|
||||
|
||||
# 扣除 3 把扭曲钥匙
|
||||
var needed: int = KEY_REQUIRED_COUNT
|
||||
for ks in key_slots:
|
||||
var slot_idx: int = ks["slot"]
|
||||
var available: int = ks["count"]
|
||||
if available <= needed:
|
||||
needed -= available
|
||||
inventory[slot_idx] = null
|
||||
else:
|
||||
inventory[slot_idx]["count"] = available - needed
|
||||
needed = 0
|
||||
if needed <= 0:
|
||||
break
|
||||
|
||||
# 初始化巢穴状态
|
||||
is_active = true
|
||||
remaining_time = TIME_LIMIT
|
||||
dragon_hp = BOSS_MAX_HP
|
||||
dragon_max_hp = BOSS_MAX_HP
|
||||
is_dragon_alive = true
|
||||
active_minions.clear()
|
||||
regen_timer = 0.0
|
||||
|
||||
# 刷新 4 块龙神魔石
|
||||
active_metins.clear()
|
||||
for vnum in METIN_TABLE.keys():
|
||||
active_metins[vnum] = true
|
||||
|
||||
dungeon_started.emit(remaining_time)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"time_limit": remaining_time,
|
||||
"dragon_hp": dragon_hp,
|
||||
"metins": active_metins.duplicate(),
|
||||
"msg": "已使用 3 把扭曲钥匙,成功开启冰龙巢穴!限时 60 分钟!"
|
||||
}
|
||||
|
||||
# 获取当前冰龙实际攻击力 (受 8034 复仇之石影响)
|
||||
func get_dragon_atk() -> int:
|
||||
var atk := BOSS_BASE_ATK
|
||||
if active_metins.get(8034, false):
|
||||
atk = int(atk * 1.4) # +40% ATK
|
||||
return atk
|
||||
|
||||
# 获取当前冰龙防御力
|
||||
func get_dragon_def() -> int:
|
||||
return BOSS_BASE_DEF
|
||||
|
||||
# 击破魔石机制
|
||||
func destroy_metin(metin_vnum: int) -> Dictionary:
|
||||
if not is_active:
|
||||
return {"ok": false, "reason": "DUNGEON_NOT_ACTIVE"}
|
||||
|
||||
if not active_metins.get(metin_vnum, false):
|
||||
return {"ok": false, "reason": "METIN_ALREADY_DESTROYED"}
|
||||
|
||||
active_metins[metin_vnum] = false
|
||||
var mname: String = METIN_TABLE[metin_vnum]["name"]
|
||||
|
||||
# 击破魔石唤醒 4 只塞陶龙宫护卫 (vnum: 2401)
|
||||
var spawn_count := 4
|
||||
for i in range(spawn_count):
|
||||
active_minions.append({"vnum": 2401, "hp": 30000})
|
||||
|
||||
metin_destroyed.emit(metin_vnum, mname)
|
||||
minions_spawned.emit(spawn_count, 2401)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"metin_vnum": metin_vnum,
|
||||
"metin_name": mname,
|
||||
"remaining_metins": get_alive_metin_count(),
|
||||
"spawned_minions": spawn_count,
|
||||
"msg": "【%s】已被击破!对应龙神加成已破除,但唤醒了龙宫护卫!" % mname
|
||||
}
|
||||
|
||||
# 获取存活魔石数量
|
||||
func get_alive_metin_count() -> int:
|
||||
var count := 0
|
||||
for v in active_metins.values():
|
||||
if v:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
# 对冰龙造成伤害
|
||||
func apply_damage(raw_dmg: int, is_magic: bool = false) -> Dictionary:
|
||||
if not is_active or not is_dragon_alive:
|
||||
return {"ok": false, "reason": "DRAGON_NOT_ALIVE"}
|
||||
|
||||
var def := get_dragon_def()
|
||||
var net_dmg: float = max(1, raw_dmg - def)
|
||||
|
||||
# 8031 傲慢之石减免 30% 物理伤害
|
||||
if not is_magic and active_metins.get(8031, false):
|
||||
net_dmg *= 0.70
|
||||
|
||||
# 8033 平静之石减免 30% 魔法伤害
|
||||
if is_magic and active_metins.get(8033, false):
|
||||
net_dmg *= 0.70
|
||||
|
||||
var final_dmg := int(round(net_dmg))
|
||||
dragon_hp = max(0, dragon_hp - final_dmg)
|
||||
|
||||
dragon_hp_changed.emit(dragon_hp, dragon_max_hp)
|
||||
|
||||
# 击杀冰龙判定
|
||||
if dragon_hp <= 0:
|
||||
is_dragon_alive = false
|
||||
is_active = false
|
||||
var drops := _generate_dragon_drops()
|
||||
dragon_defeated.emit(drops)
|
||||
return {
|
||||
"ok": true,
|
||||
"killed": true,
|
||||
"net_dmg": final_dmg,
|
||||
"remaining_hp": 0,
|
||||
"drops": drops,
|
||||
"msg": "【冰龙贝兰-塞陶】已被彻底击败!龙鳞与龙爪散落一地!"
|
||||
}
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"killed": false,
|
||||
"net_dmg": final_dmg,
|
||||
"remaining_hp": dragon_hp,
|
||||
"hp_ratio": float(dragon_hp) / float(dragon_max_hp)
|
||||
}
|
||||
|
||||
# 逐帧更新 (计时与 8032 寂寞之石生命回复)
|
||||
func update(dt: float) -> void:
|
||||
if not is_active:
|
||||
return
|
||||
|
||||
remaining_time -= dt
|
||||
if remaining_time <= 0.0:
|
||||
is_active = false
|
||||
is_dragon_alive = false
|
||||
dungeon_failed.emit("TIME_OUT")
|
||||
return
|
||||
|
||||
# 8032 寂寞之石:每 5 秒为冰龙回复 2% 最大生命 (16000 HP)
|
||||
if is_dragon_alive and active_metins.get(8032, false):
|
||||
regen_timer += dt
|
||||
if regen_timer >= 5.0:
|
||||
regen_timer = 0.0
|
||||
var heal_amount := int(BOSS_MAX_HP * 0.02)
|
||||
dragon_hp = mini(BOSS_MAX_HP, dragon_hp + heal_amount)
|
||||
dragon_hp_changed.emit(dragon_hp, dragon_max_hp)
|
||||
|
||||
# 生成冰龙掉落物 (71123 龙鳞, 71129 龙爪, 50186 水龙宝箱)
|
||||
func _generate_dragon_drops() -> Array:
|
||||
var drops: Array = []
|
||||
|
||||
# 1. 必掉史诗升阶材料:龙鳞 (71123)
|
||||
drops.append({
|
||||
"vnum": 71123,
|
||||
"name": "龙鳞",
|
||||
"count": randi_range(1, 2)
|
||||
})
|
||||
|
||||
# 2. 必掉史诗升阶材料:龙爪 (71129)
|
||||
drops.append({
|
||||
"vnum": 71129,
|
||||
"name": "龙爪",
|
||||
"count": randi_range(1, 2)
|
||||
})
|
||||
|
||||
# 3. 必掉水龙专属宝箱 (50186)
|
||||
drops.append({
|
||||
"vnum": 50186,
|
||||
"name": "贝兰-塞陶宝箱",
|
||||
"count": 1
|
||||
})
|
||||
|
||||
# 4. 必掉灵魂之石 (50513)
|
||||
drops.append({
|
||||
"vnum": 50513,
|
||||
"name": "灵魂之石",
|
||||
"count": 1
|
||||
})
|
||||
|
||||
# 5. 大额金币掉落
|
||||
drops.append({
|
||||
"vnum": 1,
|
||||
"name": "金币",
|
||||
"count": randi_range(150000, 300000)
|
||||
})
|
||||
|
||||
return drops
|
||||
@@ -1 +0,0 @@
|
||||
uid://bp1qvx4apa2no
|
||||
@@ -1,215 +0,0 @@
|
||||
# dragon_soul_system.gd —— Metin2 40250 龙神炼金石系统 1:1
|
||||
# 对照 40250 服务端 DragonSoul.cpp, char_dragonsoul.cpp 及客户端 uidragonsoul.py
|
||||
class_name DragonSoulSystem
|
||||
extends RefCounted
|
||||
|
||||
signal deck_activated(deck_idx: int)
|
||||
signal deck_deactivated(deck_idx: int)
|
||||
|
||||
# 6 种官方龙神石类型 (DragonSoul.cpp:EDSStoneTypes)
|
||||
enum DragonStoneType {
|
||||
NONE = 0,
|
||||
DIAMOND = 1, # 钻石: INT, 魔法抗性
|
||||
RUBY = 2, # 红宝石: STR, 物理攻击力, 防御力
|
||||
JADE = 3, # 玉石: Max HP, HP 恢复
|
||||
SAPPHIRE = 4,# 蓝宝石: DEX, 职业减伤
|
||||
GARNET = 5, # 石榴石: CON, Max SP
|
||||
ONYX = 6 # 缟玛瑙: 格挡, 反弹, 穿透抵抗
|
||||
}
|
||||
|
||||
# 5 档品阶 (Grade)
|
||||
enum Grade {
|
||||
ROUGH = 0, # 粗糙
|
||||
CUT = 1, # 切割
|
||||
RARE = 2, # 稀有
|
||||
ANCIENT = 3, # 古代
|
||||
LEGENDARY = 4 # 传奇
|
||||
}
|
||||
|
||||
# 5 档净度 (Clarity)
|
||||
enum Clarity {
|
||||
MATT = 0, # 哑光
|
||||
CLEAR = 1, # 清晰
|
||||
FLAWLESS = 2, # 无瑕
|
||||
BRILLIANT = 3, # 辉煌
|
||||
EXCELLENT = 4 # 卓越
|
||||
}
|
||||
|
||||
const DECK_SKY := 0 # 天空卡槽
|
||||
const DECK_EARTH := 1 # 大地卡槽
|
||||
const DECK_COUNT := 2
|
||||
const SLOTS_PER_DECK := 6 # 每卡槽 6 个神石槽位
|
||||
|
||||
# 双卡槽数据结构: decks[deck_idx][slot_idx] = stone_dict or null
|
||||
var decks: Array[Array] = [[], []]
|
||||
var active_deck: int = -1 # -1: 未激活, 0: 天空卡槽, 1: 大地卡槽
|
||||
|
||||
func _init() -> void:
|
||||
for d in range(DECK_COUNT):
|
||||
var slot_list: Array = []
|
||||
for s in range(SLOTS_PER_DECK):
|
||||
slot_list.append(null)
|
||||
decks[d] = slot_list
|
||||
|
||||
# 创建一颗龙神石
|
||||
static func create_dragon_stone(type: int, grade: int = 0, clarity: int = 0, refine: int = 0, duration: float = 86400.0) -> Dictionary:
|
||||
var stone: Dictionary = {
|
||||
"stone_type": type,
|
||||
"grade": clampi(grade, 0, 4),
|
||||
"clarity": clampi(clarity, 0, 4),
|
||||
"refine": clampi(refine, 0, 6),
|
||||
"duration": duration, # 激活消耗时间 (秒)
|
||||
"total_duration": duration
|
||||
}
|
||||
stone["attributes"] = calculate_stone_attributes(stone)
|
||||
return stone
|
||||
|
||||
# 计算单颗神石属性 (对齐 40250 DragonSoulTable.txt)
|
||||
static func calculate_stone_attributes(stone: Dictionary) -> Dictionary:
|
||||
var type: int = int(stone.get("stone_type", 0))
|
||||
var gr: int = int(stone.get("grade", 0))
|
||||
var cl: int = int(stone.get("clarity", 0))
|
||||
var rf: int = int(stone.get("refine", 0))
|
||||
|
||||
var attrs: Dictionary = {}
|
||||
|
||||
match type:
|
||||
DragonStoneType.DIAMOND:
|
||||
attrs["int_bonus"] = 5 + (gr * 3) + (cl * 2) + rf
|
||||
attrs["magic_defense"] = 2 + (gr * 2) + (cl * 2) + (rf * 2)
|
||||
DragonStoneType.RUBY:
|
||||
attrs["str_bonus"] = 5 + (gr * 3) + (cl * 2) + rf
|
||||
attrs["att_grade"] = 20 + (gr * 15) + (cl * 10) + (rf * 5)
|
||||
attrs["def_grade"] = 15 + (gr * 10) + (cl * 5) + (rf * 4)
|
||||
DragonStoneType.JADE:
|
||||
attrs["max_hp"] = 300 + (gr * 250) + (cl * 150) + (rf * 100)
|
||||
attrs["hp_recovery_pct"] = 3 + gr + cl + rf
|
||||
DragonStoneType.SAPPHIRE:
|
||||
attrs["dex_bonus"] = 5 + (gr * 3) + (cl * 2) + rf
|
||||
attrs["resist_warrior"] = 2 + gr + cl + rf
|
||||
attrs["resist_assassin"] = 2 + gr + cl + rf
|
||||
DragonStoneType.GARNET:
|
||||
attrs["con_bonus"] = 5 + (gr * 3) + (cl * 2) + rf
|
||||
attrs["max_sp"] = 200 + (gr * 150) + (cl * 100) + (rf * 50)
|
||||
DragonStoneType.ONYX:
|
||||
attrs["block_pct"] = 2 + (gr * 2) + cl + rf
|
||||
attrs["reflect_pct"] = 2 + (gr * 2) + cl + rf
|
||||
|
||||
return attrs
|
||||
|
||||
# 装备神石到卡槽
|
||||
func equip_stone(deck_idx: int, stone: Dictionary) -> Dictionary:
|
||||
if deck_idx < 0 or deck_idx >= DECK_COUNT:
|
||||
return {"ok": false, "reason": "INVALID_DECK"}
|
||||
|
||||
var type: int = int(stone.get("stone_type", 0))
|
||||
if type < 1 or type > 6:
|
||||
return {"ok": false, "reason": "INVALID_STONE_TYPE"}
|
||||
|
||||
var slot_idx: int = type - 1 # 1~6 映射到 0~5 号槽位
|
||||
decks[deck_idx][slot_idx] = stone
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"deck": deck_idx,
|
||||
"slot": slot_idx,
|
||||
"stone": stone
|
||||
}
|
||||
|
||||
# 卸下神石
|
||||
func unequip_stone(deck_idx: int, slot_idx: int) -> Dictionary:
|
||||
if deck_idx < 0 or deck_idx >= DECK_COUNT:
|
||||
return {"ok": false, "reason": "INVALID_DECK"}
|
||||
if slot_idx < 0 or slot_idx >= SLOTS_PER_DECK:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var removed = decks[deck_idx][slot_idx]
|
||||
decks[deck_idx][slot_idx] = null
|
||||
return {"ok": true, "stone": removed}
|
||||
|
||||
# 激活/停用卡槽
|
||||
func toggle_deck(deck_idx: int) -> bool:
|
||||
if active_deck == deck_idx:
|
||||
active_deck = -1
|
||||
deck_deactivated.emit(deck_idx)
|
||||
return false
|
||||
else:
|
||||
if active_deck != -1:
|
||||
deck_deactivated.emit(active_deck)
|
||||
active_deck = deck_idx
|
||||
deck_activated.emit(deck_idx)
|
||||
return true
|
||||
|
||||
# 计算当前已激活卡槽的总战力属性
|
||||
func get_active_bonuses() -> Dictionary:
|
||||
var total_bonuses: Dictionary = {}
|
||||
if active_deck < 0 or active_deck >= DECK_COUNT:
|
||||
return total_bonuses
|
||||
|
||||
var deck: Array = decks[active_deck]
|
||||
for slot in deck:
|
||||
if slot != null and float(slot.get("duration", 0.0)) > 0.0:
|
||||
var attrs: Dictionary = slot.get("attributes", {})
|
||||
for key in attrs:
|
||||
total_bonuses[key] = int(total_bonuses.get(key, 0)) + int(attrs[key])
|
||||
|
||||
return total_bonuses
|
||||
|
||||
# 逐帧消耗激活中的龙神石能量时间
|
||||
func update(dt: float) -> Array:
|
||||
var expired_stones: Array = []
|
||||
if active_deck < 0 or active_deck >= DECK_COUNT:
|
||||
return expired_stones
|
||||
|
||||
var deck: Array = decks[active_deck]
|
||||
for i in range(deck.size()):
|
||||
var stone = deck[i]
|
||||
if stone != null:
|
||||
var dur: float = float(stone.get("duration", 0.0))
|
||||
dur -= dt
|
||||
if dur <= 0.0:
|
||||
dur = 0.0
|
||||
expired_stones.append({"deck": active_deck, "slot": i, "stone": stone})
|
||||
stone["duration"] = dur
|
||||
|
||||
return expired_stones
|
||||
|
||||
# 升阶 (Grade Refine): 2 颗同种类、同品阶神石融合升级
|
||||
static func refine_grade(stone_a: Dictionary, stone_b: Dictionary, force_success: bool = false) -> Dictionary:
|
||||
var ta: int = int(stone_a.get("stone_type", 0))
|
||||
var tb: int = int(stone_b.get("stone_type", 0))
|
||||
var ga: int = int(stone_a.get("grade", 0))
|
||||
var gb: int = int(stone_b.get("grade", 0))
|
||||
|
||||
if ta != tb or ga != gb:
|
||||
return {"ok": false, "reason": "MISMATCHED_STONES", "msg": "只有同种类且同品阶的神石才能融合升阶!"}
|
||||
if ga >= Grade.LEGENDARY:
|
||||
return {"ok": false, "reason": "MAX_GRADE", "msg": "该神石已达到最高传奇品阶!"}
|
||||
|
||||
# 成功率 60%
|
||||
var success: bool = force_success or randf() < 0.60
|
||||
if success:
|
||||
var new_stone = create_dragon_stone(ta, ga + 1, 0, 0)
|
||||
return {"ok": true, "success": true, "stone": new_stone, "msg": "神石品阶提升成功!"}
|
||||
else:
|
||||
return {"ok": true, "success": false, "msg": "升阶失败,融合材料已碎裂。"}
|
||||
|
||||
# 升净度 (Clarity Refine): 2 颗同种类、同品阶、同净度神石融合升级
|
||||
static func refine_clarity(stone_a: Dictionary, stone_b: Dictionary, force_success: bool = false) -> Dictionary:
|
||||
var ta: int = int(stone_a.get("stone_type", 0))
|
||||
var tb: int = int(stone_b.get("stone_type", 0))
|
||||
var ca: int = int(stone_a.get("clarity", 0))
|
||||
var cb: int = int(stone_b.get("clarity", 0))
|
||||
|
||||
if ta != tb or ca != cb:
|
||||
return {"ok": false, "reason": "MISMATCHED_STONES", "msg": "只有同种类且同净度的神石才能融合提升净度!"}
|
||||
if ca >= Clarity.EXCELLENT:
|
||||
return {"ok": false, "reason": "MAX_CLARITY", "msg": "该神石已达到最高卓越净度!"}
|
||||
|
||||
var success: bool = force_success or randf() < 0.50
|
||||
if success:
|
||||
var ga: int = int(stone_a.get("grade", 0))
|
||||
var new_stone = create_dragon_stone(ta, ga, ca + 1, 0)
|
||||
return {"ok": true, "success": true, "stone": new_stone, "msg": "神石净度提升成功!"}
|
||||
else:
|
||||
return {"ok": true, "success": false, "msg": "净度提升失败,辅助材料碎裂。"}
|
||||
@@ -1 +0,0 @@
|
||||
uid://ia8t4ldbjqhp
|
||||
@@ -1,133 +0,0 @@
|
||||
# dungeon_ranking_system.gd —— Metin2 40250 地牢信息面板与最速通关记录系统 1:1
|
||||
# 对照 40250 服务端与客户端 dungeon_info.cpp, dungeon.cpp, uidungeoninfo.py
|
||||
class_name DungeonRankingSystem
|
||||
extends RefCounted
|
||||
|
||||
signal record_updated(dungeon_id: String, fastest_time: float, total_clears: int)
|
||||
signal new_fastest_record(dungeon_id: String, new_time: float, old_time: float)
|
||||
|
||||
# 40250 官方经典地牢登记表
|
||||
const DUNGEON_REGISTRY: Dictionary = {
|
||||
"demon_tower": {
|
||||
"name": "恶魔之塔",
|
||||
"min_level": 40,
|
||||
"ticket_vnum": 0,
|
||||
"ticket_count": 0,
|
||||
"ticket_name": "无",
|
||||
"cooldown_seconds": 0.0
|
||||
},
|
||||
"spider_dungeon_3": {
|
||||
"name": "蜘蛛洞穴三层",
|
||||
"min_level": 50,
|
||||
"ticket_vnum": 30327,
|
||||
"ticket_count": 1,
|
||||
"ticket_name": "蜘蛛钥匙",
|
||||
"cooldown_seconds": 1800.0 # 30 分钟
|
||||
},
|
||||
"dragon_lair": {
|
||||
"name": "冰龙贝兰巢穴",
|
||||
"min_level": 75,
|
||||
"ticket_vnum": 30179,
|
||||
"ticket_count": 3,
|
||||
"ticket_name": "扭曲钥匙",
|
||||
"cooldown_seconds": 3600.0 # 60 分钟
|
||||
},
|
||||
"devils_catacomb": {
|
||||
"name": "地下墓穴",
|
||||
"min_level": 75,
|
||||
"ticket_vnum": 30311,
|
||||
"ticket_count": 1,
|
||||
"ticket_name": "灵魂水晶钥匙",
|
||||
"cooldown_seconds": 3600.0 # 60 分钟
|
||||
}
|
||||
}
|
||||
|
||||
# 个人通关数据字典: dungeon_id -> Dictionary
|
||||
var dungeon_records: Dictionary = {}
|
||||
|
||||
func _init() -> void:
|
||||
for d_id in DUNGEON_REGISTRY.keys():
|
||||
dungeon_records[d_id] = {
|
||||
"total_clears": 0,
|
||||
"fastest_clear_time": 999999.0, # 初始极大值
|
||||
"highest_peak_damage": 0,
|
||||
"last_clear_timestamp": 0.0
|
||||
}
|
||||
|
||||
# 记录通关结算
|
||||
func record_clear(
|
||||
dungeon_id: String,
|
||||
clear_time_sec: float,
|
||||
peak_damage: int,
|
||||
current_timestamp: float = 0.0
|
||||
) -> Dictionary:
|
||||
if not DUNGEON_REGISTRY.has(dungeon_id):
|
||||
return {"ok": false, "reason": "INVALID_DUNGEON_ID", "msg": "未知的地牢!"}
|
||||
|
||||
var rec = dungeon_records[dungeon_id]
|
||||
rec["total_clears"] += 1
|
||||
rec["last_clear_timestamp"] = current_timestamp
|
||||
|
||||
# 检查并更新最高单次输出伤害
|
||||
if peak_damage > int(rec["highest_peak_damage"]):
|
||||
rec["highest_peak_damage"] = peak_damage
|
||||
|
||||
# 检查是否刷新最速通关记录
|
||||
var is_new_record := false
|
||||
var old_time: float = float(rec["fastest_clear_time"])
|
||||
if clear_time_sec < old_time:
|
||||
is_new_record = true
|
||||
rec["fastest_clear_time"] = clear_time_sec
|
||||
new_fastest_record.emit(dungeon_id, clear_time_sec, old_time)
|
||||
|
||||
record_updated.emit(dungeon_id, rec["fastest_clear_time"], rec["total_clears"])
|
||||
|
||||
var dname: String = DUNGEON_REGISTRY[dungeon_id]["name"]
|
||||
return {
|
||||
"ok": true,
|
||||
"dungeon_id": dungeon_id,
|
||||
"dungeon_name": dname,
|
||||
"clear_time": clear_time_sec,
|
||||
"is_new_record": is_new_record,
|
||||
"fastest_time": rec["fastest_clear_time"],
|
||||
"total_clears": rec["total_clears"],
|
||||
"highest_peak_damage": rec["highest_peak_damage"],
|
||||
"msg": "【%s】通关成功!耗时 %.1f 秒%s!" % [dname, clear_time_sec, " (刷新最快纪录!)" if is_new_record else ""]
|
||||
}
|
||||
|
||||
# 获取地牢详情与入场/冷却状态
|
||||
func get_dungeon_info(dungeon_id: String, current_timestamp: float = 0.0) -> Dictionary:
|
||||
if not DUNGEON_REGISTRY.has(dungeon_id):
|
||||
return {"ok": false, "reason": "INVALID_DUNGEON_ID"}
|
||||
|
||||
var cfg = DUNGEON_REGISTRY[dungeon_id]
|
||||
var rec = dungeon_records[dungeon_id]
|
||||
|
||||
# 判定冷却时间
|
||||
var cd_sec: float = float(cfg["cooldown_seconds"])
|
||||
var last_ts: float = float(rec["last_clear_timestamp"])
|
||||
var elapsed := current_timestamp - last_ts
|
||||
var is_on_cooldown := (cd_sec > 0.0 and last_ts > 0.0 and elapsed < cd_sec)
|
||||
var remaining_cd := maxf(0.0, cd_sec - elapsed) if is_on_cooldown else 0.0
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"dungeon_id": dungeon_id,
|
||||
"name": cfg["name"],
|
||||
"min_level": cfg["min_level"],
|
||||
"ticket_vnum": cfg["ticket_vnum"],
|
||||
"ticket_count": cfg["ticket_count"],
|
||||
"ticket_name": cfg["ticket_name"],
|
||||
"is_on_cooldown": is_on_cooldown,
|
||||
"remaining_cooldown": remaining_cd,
|
||||
"total_clears": rec["total_clears"],
|
||||
"fastest_clear_time": rec["fastest_clear_time"] if rec["fastest_clear_time"] < 999999.0 else 0.0,
|
||||
"highest_peak_damage": rec["highest_peak_damage"]
|
||||
}
|
||||
|
||||
# 获取全部地牢摘要速览列表
|
||||
func get_all_dungeon_summaries(current_timestamp: float = 0.0) -> Array:
|
||||
var list: Array = []
|
||||
for d_id in DUNGEON_REGISTRY.keys():
|
||||
list.append(get_dungeon_info(d_id, current_timestamp))
|
||||
return list
|
||||
@@ -1 +0,0 @@
|
||||
uid://c4msy78ir4a3v
|
||||
@@ -1,163 +0,0 @@
|
||||
# dynamic_bounty_event_system.gd —— Metin2 40250 单人单机动态事件与赏金通缉令系统 1:1
|
||||
# 对照 40250 服务端 questmanager.cpp, char.cpp, quest.h
|
||||
class_name DynamicBountyEventSystem
|
||||
extends RefCounted
|
||||
|
||||
signal bounties_refreshed(bounty_list: Array)
|
||||
signal bounty_progress_updated(bounty_id: String, current: int, target: int)
|
||||
signal bounty_completed(bounty_id: String, title: String)
|
||||
signal bounty_reward_claimed(bounty_id: String, exp: int, gold: int)
|
||||
|
||||
const BOUNTY_TYPE_HUNT := "hunt" # 怪物狩猎
|
||||
const BOUNTY_TYPE_METIN := "metin" # 魔石破除
|
||||
const BOUNTY_TYPE_BOSS := "boss" # 首领讨伐
|
||||
|
||||
const BOUNTY_CHEST_VNUM := 50180 # 赏金猎人宝箱 (Bounty Chest)
|
||||
|
||||
# 活跃悬赏任务字典: id -> Dictionary
|
||||
var active_bounties: Dictionary = {}
|
||||
var total_completed_count: int = 0
|
||||
|
||||
# 每日自动生成/刷新 3 条特色赏金任务
|
||||
func refresh_daily_bounties() -> Array:
|
||||
active_bounties.clear()
|
||||
|
||||
# 1. 狩猎任务 (野蛮士兵 501, 目标 25 只)
|
||||
var b1: Dictionary = {
|
||||
"id": "bounty_hunt_barbarian",
|
||||
"type": BOUNTY_TYPE_HUNT,
|
||||
"title": "【通缉令】清剿荒原野蛮士兵",
|
||||
"target_vnum": 501,
|
||||
"target_count": 25,
|
||||
"current_count": 0,
|
||||
"is_completed": false,
|
||||
"is_claimed": false,
|
||||
"rewards": {
|
||||
"exp": 150000,
|
||||
"gold": 500000,
|
||||
"items": [{"vnum": 27003, "name": "红色药水(特大)", "count": 100}]
|
||||
}
|
||||
}
|
||||
|
||||
# 2. 破灭魔石任务 (嫉妒之石 8008, 目标 2 颗)
|
||||
var b2: Dictionary = {
|
||||
"id": "bounty_metin_jealousy",
|
||||
"type": BOUNTY_TYPE_METIN,
|
||||
"title": "【天灾通缉】破灭野外嫉妒魔石",
|
||||
"target_vnum": 8008,
|
||||
"target_count": 2,
|
||||
"current_count": 0,
|
||||
"is_completed": false,
|
||||
"is_claimed": false,
|
||||
"rewards": {
|
||||
"exp": 300000,
|
||||
"gold": 1200000,
|
||||
"items": [{"vnum": 50300, "name": "技能书", "count": 1}]
|
||||
}
|
||||
}
|
||||
|
||||
# 3. 讨伐世界首领 (九尾妖狐 1901, 目标 1 次)
|
||||
var b3: Dictionary = {
|
||||
"id": "bounty_boss_ninetails",
|
||||
"type": BOUNTY_TYPE_BOSS,
|
||||
"title": "【大统领诛杀令】斩落雪山九尾妖狐",
|
||||
"target_vnum": 1901,
|
||||
"target_count": 1,
|
||||
"current_count": 0,
|
||||
"is_completed": false,
|
||||
"is_claimed": false,
|
||||
"rewards": {
|
||||
"exp": 1000000,
|
||||
"gold": 3000000,
|
||||
"items": [
|
||||
{"vnum": BOUNTY_CHEST_VNUM, "name": "赏金猎人宝箱", "count": 1},
|
||||
{"vnum": 71003, "name": "祝福卷轴", "count": 1}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
active_bounties[b1["id"]] = b1
|
||||
active_bounties[b2["id"]] = b2
|
||||
active_bounties[b3["id"]] = b3
|
||||
|
||||
var list = [b1, b2, b3]
|
||||
bounties_refreshed.emit(list)
|
||||
return list
|
||||
|
||||
# 怪物击杀侦测挂钩
|
||||
func on_mob_killed(mob_vnum: int, count: int = 1) -> void:
|
||||
for bid in active_bounties.keys():
|
||||
var b = active_bounties[bid]
|
||||
if b["is_completed"]:
|
||||
continue
|
||||
|
||||
if (b["type"] == BOUNTY_TYPE_HUNT or b["type"] == BOUNTY_TYPE_BOSS) and b["target_vnum"] == mob_vnum:
|
||||
b["current_count"] = min(b["target_count"], b["current_count"] + count)
|
||||
bounty_progress_updated.emit(bid, b["current_count"], b["target_count"])
|
||||
|
||||
if b["current_count"] >= b["target_count"]:
|
||||
b["is_completed"] = true
|
||||
total_completed_count += 1
|
||||
bounty_completed.emit(bid, b["title"])
|
||||
|
||||
# 魔石击碎侦测挂钩
|
||||
func on_metin_destroyed(metin_vnum: int) -> void:
|
||||
for bid in active_bounties.keys():
|
||||
var b = active_bounties[bid]
|
||||
if b["is_completed"]:
|
||||
continue
|
||||
|
||||
if b["type"] == BOUNTY_TYPE_METIN and b["target_vnum"] == metin_vnum:
|
||||
b["current_count"] = min(b["target_count"], b["current_count"] + 1)
|
||||
bounty_progress_updated.emit(bid, b["current_count"], b["target_count"])
|
||||
|
||||
if b["current_count"] >= b["target_count"]:
|
||||
b["is_completed"] = true
|
||||
total_completed_count += 1
|
||||
bounty_completed.emit(bid, b["title"])
|
||||
|
||||
# 领取赏金通缉令奖励
|
||||
func claim_bounty_reward(bounty_id: String, player_data: Dictionary, inventory: Array) -> Dictionary:
|
||||
if not active_bounties.has(bounty_id):
|
||||
return {"ok": false, "reason": "BOUNTY_NOT_FOUND", "msg": "未找到该通缉令!"}
|
||||
|
||||
var b = active_bounties[bounty_id]
|
||||
if not b["is_completed"]:
|
||||
return {"ok": false, "reason": "NOT_COMPLETED", "msg": "该通缉令目标尚未达成!"}
|
||||
|
||||
if b["is_claimed"]:
|
||||
return {"ok": false, "reason": "ALREADY_CLAIMED", "msg": "该通缉令赏金已被领取!"}
|
||||
|
||||
var rew = b["rewards"]
|
||||
var exp_gain: int = rew.get("exp", 0)
|
||||
var gold_gain: int = rew.get("gold", 0)
|
||||
var items: Array = rew.get("items", [])
|
||||
|
||||
# 发放经验与金币
|
||||
player_data["exp"] = int(player_data.get("exp", 0)) + exp_gain
|
||||
player_data["gold"] = int(player_data.get("gold", 0)) + gold_gain
|
||||
|
||||
# 物品入包
|
||||
var granted_items := []
|
||||
for it in items:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = it.duplicate(true)
|
||||
granted_items.append(it["name"])
|
||||
break
|
||||
|
||||
b["is_claimed"] = true
|
||||
bounty_reward_claimed.emit(bounty_id, exp_gain, gold_gain)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"bounty_id": bounty_id,
|
||||
"exp_gain": exp_gain,
|
||||
"gold_gain": gold_gain,
|
||||
"items_granted": granted_items,
|
||||
"msg": "通缉赏金核销!获得 %d 经验、%d 金币以及丰厚物资!" % [exp_gain, gold_gain]
|
||||
}
|
||||
|
||||
# 获取所有活跃悬赏
|
||||
func get_active_bounties() -> Array:
|
||||
return active_bounties.values()
|
||||
@@ -1 +0,0 @@
|
||||
uid://dmh3ypb8w0pwt
|
||||
@@ -1,99 +0,0 @@
|
||||
# emotion_action_system.gd —— 角色情绪动作与表情快捷键(40250 官方 1:1 对齐)
|
||||
# 对齐源码:
|
||||
# - 40250 root/emotion.py (EMOTION_DICT, EMOTION_CLAP..DANCE_6)
|
||||
# - 40250 server/game/src/cmd_emotion.cpp
|
||||
# - 40250 root/game.py: __PressNumKey (Ctrl + 1..9)
|
||||
class_name EmotionActionSystem
|
||||
extends RefCounted
|
||||
|
||||
# 40250 官方情绪动作常量
|
||||
const EMOTION_CLAP := 1
|
||||
const EMOTION_CONGRATULATION := 2
|
||||
const EMOTION_FORGIVE := 3
|
||||
const EMOTION_ANGRY := 4
|
||||
const EMOTION_ATTRACTIVE := 5
|
||||
const EMOTION_SAD := 6
|
||||
const EMOTION_SHY := 7
|
||||
const EMOTION_CHEERUP := 8
|
||||
const EMOTION_BANTER := 9
|
||||
const EMOTION_JOY := 10
|
||||
const EMOTION_CHEERS_1 := 11
|
||||
const EMOTION_CHEERS_2 := 12
|
||||
const EMOTION_DANCE_1 := 13
|
||||
const EMOTION_DANCE_2 := 14
|
||||
const EMOTION_DANCE_3 := 15
|
||||
const EMOTION_DANCE_4 := 16
|
||||
const EMOTION_DANCE_5 := 17
|
||||
const EMOTION_DANCE_6 := 18
|
||||
|
||||
# 情绪字典表 (对齐 emotion.py)
|
||||
const EMOTION_TABLE := {
|
||||
EMOTION_CLAP: {"name": "鼓掌", "command": "/clap", "motion": "clap"},
|
||||
EMOTION_CONGRATULATION: {"name": "祝贺", "command": "/congratulation", "motion": "congratulation"},
|
||||
EMOTION_FORGIVE: {"name": "原谅", "command": "/forgive", "motion": "forgive"},
|
||||
EMOTION_ANGRY: {"name": "愤怒", "command": "/angry", "motion": "angry"},
|
||||
EMOTION_ATTRACTIVE: {"name": "飞吻", "command": "/attractive", "motion": "attractive"},
|
||||
EMOTION_SAD: {"name": "悲伤", "command": "/sad", "motion": "sad"},
|
||||
EMOTION_SHY: {"name": "害羞", "command": "/shy", "motion": "shy"},
|
||||
EMOTION_CHEERUP: {"name": "加油", "command": "/cheerup", "motion": "cheerup"},
|
||||
EMOTION_BANTER: {"name": "嘲讽", "command": "/banter", "motion": "banter"},
|
||||
EMOTION_JOY: {"name": "喜悦", "command": "/joy", "motion": "joy"},
|
||||
EMOTION_CHEERS_1: {"name": "欢呼1", "command": "/cheer1", "motion": "cheers_1"},
|
||||
EMOTION_CHEERS_2: {"name": "欢呼2", "command": "/cheer2", "motion": "cheers_2"},
|
||||
EMOTION_DANCE_1: {"name": "跳舞1", "command": "/dance1", "motion": "dance_1"},
|
||||
EMOTION_DANCE_2: {"name": "跳舞2", "command": "/dance2", "motion": "dance_2"},
|
||||
EMOTION_DANCE_3: {"name": "跳舞3", "command": "/dance3", "motion": "dance_3"},
|
||||
EMOTION_DANCE_4: {"name": "跳舞4", "command": "/dance4", "motion": "dance_4"},
|
||||
EMOTION_DANCE_5: {"name": "跳舞5", "command": "/dance5", "motion": "dance_5"},
|
||||
EMOTION_DANCE_6: {"name": "跳舞6", "command": "/dance6", "motion": "dance_6"},
|
||||
}
|
||||
|
||||
## 检查是否为有效的情绪动作 ID
|
||||
static func is_valid_emotion(emotion_id: int) -> bool:
|
||||
return EMOTION_TABLE.has(emotion_id)
|
||||
|
||||
## 通过聊天命令解析情绪 (例如 "/clap" -> 1)
|
||||
static func get_emotion_from_command(cmd_text: String) -> int:
|
||||
var clean := cmd_text.strip_edges().to_lower()
|
||||
for id in EMOTION_TABLE.keys():
|
||||
if EMOTION_TABLE[id]["command"] == clean:
|
||||
return id
|
||||
return 0
|
||||
|
||||
## 通过快捷键序号获取情绪 (0..8 对应 Ctrl + 1..9)
|
||||
static func get_hotkey_emotion(hotkey_idx: int) -> int:
|
||||
# 40250 官方快捷栏默认前 9 个动作
|
||||
var list := [
|
||||
EMOTION_CLAP,
|
||||
EMOTION_CONGRATULATION,
|
||||
EMOTION_FORGIVE,
|
||||
EMOTION_ANGRY,
|
||||
EMOTION_ATTRACTIVE,
|
||||
EMOTION_SAD,
|
||||
EMOTION_SHY,
|
||||
EMOTION_CHEERUP,
|
||||
EMOTION_BANTER,
|
||||
]
|
||||
if hotkey_idx >= 0 and hotkey_idx < list.size():
|
||||
return list[hotkey_idx]
|
||||
return 0
|
||||
|
||||
## 执行情绪动作
|
||||
static func perform_emotion(emotion_id: int, is_fighting := false, is_mounted := false) -> Dictionary:
|
||||
if not is_valid_emotion(emotion_id):
|
||||
return {"ok": false, "code": "INVALID_EMOTION", "msg": "未知的动作!"}
|
||||
if is_fighting:
|
||||
return {"ok": false, "code": "CANNOT_IN_BATTLE", "msg": "战斗中无法做出情绪动作!"}
|
||||
if is_mounted:
|
||||
return {"ok": false, "code": "CANNOT_ON_MOUNT", "msg": "骑乘状态下无法做出该动作!"}
|
||||
|
||||
var em: Dictionary = EMOTION_TABLE[emotion_id]
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "SUCCESS",
|
||||
"emotion_id": emotion_id,
|
||||
"name": em["name"],
|
||||
"motion": em["motion"],
|
||||
"command": em["command"],
|
||||
"msg": "执行了【%s】动作。" % em["name"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://c7ffckxgf2fyf
|
||||
@@ -1,213 +0,0 @@
|
||||
# empire_kingdom_system.gd —— Metin2 40250 三圣帝国国家归属与领地国运系统 1:1
|
||||
# 对照 40250 服务端 empire.cpp, questlua_empire.cpp, root/introempire.py
|
||||
class_name EmpireKingdomSystem
|
||||
extends RefCounted
|
||||
|
||||
signal empire_selected(empire_id: int, empire_name: String)
|
||||
signal empire_blessing_activated(empire_id: int, blessings: Dictionary)
|
||||
signal empire_changed(old_empire: int, new_empire: int)
|
||||
signal territory_entered(map_name: String, is_home: bool, is_hostile: bool)
|
||||
|
||||
# 40250 官方三大帝国 ID
|
||||
const EMPIRE_NONE := 0
|
||||
const EMPIRE_SHINSOO := 1 # 慎修帝国 (Shinsoo / 红国)
|
||||
const EMPIRE_CHUNJO := 2 # 准照帝国 (Chunjo / 黄国)
|
||||
const EMPIRE_JINNO := 3 # 晋诺帝国 (Jinno / 蓝国)
|
||||
|
||||
const VNUM_TINCTURE_OF_EMPIRES := 71054 # 转国卷轴 (Tincture of Empires)
|
||||
|
||||
# 三大帝国官方档案与专属祈福特性表
|
||||
const EMPIRES_INFO: Dictionary = {
|
||||
EMPIRE_SHINSOO: {
|
||||
"id": EMPIRE_SHINSOO,
|
||||
"name": "慎修帝国",
|
||||
"color": "红国",
|
||||
"capital": "永安省 (Yongan)",
|
||||
"desc": "南方沿海商业贸易帝国,商贾云集,财富充盈。",
|
||||
"home_maps": ["Yongan", "Jayang"],
|
||||
"blessings": {
|
||||
"gold_bonus_pct": 10, # 金币获取 +10%
|
||||
"shop_discount_pct": 5 # 商店折扣 5%
|
||||
}
|
||||
},
|
||||
EMPIRE_CHUNJO: {
|
||||
"id": EMPIRE_CHUNJO,
|
||||
"name": "准照帝国",
|
||||
"color": "黄国",
|
||||
"capital": "准安省 (Joan)",
|
||||
"desc": "西方高原神圣宗教帝国,受大祭司与神官庇护,信仰虔诚。",
|
||||
"home_maps": ["Joan", "Bokjung"],
|
||||
"blessings": {
|
||||
"cast_speed": 10, # 施法速度 +10
|
||||
"cooldown_reduction_pct": 5 # 技能冷却缩减 5%
|
||||
}
|
||||
},
|
||||
EMPIRE_JINNO: {
|
||||
"id": EMPIRE_JINNO,
|
||||
"name": "晋诺帝国",
|
||||
"color": "蓝国",
|
||||
"capital": "平武省 (Pyungmoo)",
|
||||
"desc": "东方雄关铁血军事帝国,崇尚武道,兵强马壮。",
|
||||
"home_maps": ["Pyungmoo", "Bakra"],
|
||||
"blessings": {
|
||||
"attack_bonus": 50, # 物理攻击 +50
|
||||
"monster_damage_pct": 5 # 对怪增伤 5%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var current_empire: int = EMPIRE_NONE
|
||||
var is_blessing_active: bool = false
|
||||
var blessing_time_remaining: float = 0.0 # 祈福持续时间 (秒)
|
||||
const BLESSING_DURATION: float = 86400.0 # 24 小时 (86400 秒)
|
||||
|
||||
# 初始选择国家
|
||||
func select_empire(empire_id: int) -> Dictionary:
|
||||
if not EMPIRES_INFO.has(empire_id):
|
||||
return {"ok": false, "reason": "INVALID_EMPIRE", "msg": "无效的帝国代码!"}
|
||||
|
||||
if current_empire != EMPIRE_NONE:
|
||||
return {"ok": false, "reason": "ALREADY_HAS_EMPIRE", "msg": "已有国家归属,需使用转国卷轴!"}
|
||||
|
||||
current_empire = empire_id
|
||||
var info: Dictionary = EMPIRES_INFO[current_empire]
|
||||
empire_selected.emit(current_empire, info["name"])
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"empire_id": current_empire,
|
||||
"name": info["name"],
|
||||
"capital": info["capital"],
|
||||
"msg": "效忠【%s】成功!开启帝国护国征途。" % info["name"]
|
||||
}
|
||||
|
||||
# 激活每日帝国国运祈福 (Daily Empire Blessing)
|
||||
func activate_empire_prayer(player_stats: Dictionary) -> Dictionary:
|
||||
if current_empire == EMPIRE_NONE:
|
||||
return {"ok": false, "reason": "NO_EMPIRE", "msg": "尚未加入任何帝国!"}
|
||||
|
||||
if is_blessing_active:
|
||||
# 刷新时长
|
||||
blessing_time_remaining = BLESSING_DURATION
|
||||
return {"ok": true, "msg": "国运祈福时长已刷新为 24 小时!"}
|
||||
|
||||
var blessings: Dictionary = EMPIRES_INFO[current_empire]["blessings"]
|
||||
_apply_blessings_to_player(blessings, player_stats, 1)
|
||||
|
||||
is_blessing_active = true
|
||||
blessing_time_remaining = BLESSING_DURATION
|
||||
|
||||
empire_blessing_activated.emit(current_empire, blessings)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"empire_id": current_empire,
|
||||
"blessings": blessings,
|
||||
"duration": BLESSING_DURATION,
|
||||
"msg": "获得【%s】护国祈福!全境增益持续 24 小时。" % EMPIRES_INFO[current_empire]["name"]
|
||||
}
|
||||
|
||||
# 倒计时推进
|
||||
func update(delta: float, player_stats: Dictionary) -> void:
|
||||
if is_blessing_active:
|
||||
blessing_time_remaining -= delta
|
||||
if blessing_time_remaining <= 0.0:
|
||||
# 祈福过期
|
||||
var blessings: Dictionary = EMPIRES_INFO[current_empire]["blessings"]
|
||||
_apply_blessings_to_player(blessings, player_stats, -1)
|
||||
is_blessing_active = false
|
||||
blessing_time_remaining = 0.0
|
||||
|
||||
# 领地巡检:判断玩家在某地图是否处于敌国入侵状态
|
||||
func check_territory(map_name: String) -> Dictionary:
|
||||
if current_empire == EMPIRE_NONE:
|
||||
return {"is_home": false, "is_hostile": false, "relation": "neutral"}
|
||||
|
||||
var my_home_maps: Array = EMPIRES_INFO[current_empire]["home_maps"]
|
||||
if my_home_maps.has(map_name):
|
||||
territory_entered.emit(map_name, true, false)
|
||||
return {"is_home": true, "is_hostile": false, "relation": "homeland"}
|
||||
|
||||
# 检查是否为其他两个帝国的本土领地
|
||||
for other_id in [EMPIRE_SHINSOO, EMPIRE_CHUNJO, EMPIRE_JINNO]:
|
||||
if other_id == current_empire:
|
||||
continue
|
||||
var foreign_maps: Array = EMPIRES_INFO[other_id]["home_maps"]
|
||||
if foreign_maps.has(map_name):
|
||||
territory_entered.emit(map_name, false, true)
|
||||
return {
|
||||
"is_home": false,
|
||||
"is_hostile": true,
|
||||
"hostile_empire": EMPIRES_INFO[other_id]["name"],
|
||||
"relation": "hostile_invasion"
|
||||
}
|
||||
|
||||
# 中立公共地图 (如沙漠、雪山、烈焰、神殿)
|
||||
territory_entered.emit(map_name, false, false)
|
||||
return {"is_home": false, "is_hostile": false, "relation": "neutral"}
|
||||
|
||||
# 使用转国卷轴更换帝国 (40250 Tincture of Empires 71054)
|
||||
func change_empire(target_empire: int, item_slot: int, inventory: Array, player_stats: Dictionary, is_in_guild: bool = false) -> Dictionary:
|
||||
if not EMPIRES_INFO.has(target_empire):
|
||||
return {"ok": false, "reason": "INVALID_TARGET_EMPIRE", "msg": "无效的目标帝国!"}
|
||||
|
||||
if target_empire == current_empire:
|
||||
return {"ok": false, "reason": "CANNOT_CHANGE_TO_SAME_EMPIRE", "msg": "无法转入当前已效忠的国家!"}
|
||||
|
||||
if is_in_guild:
|
||||
return {"ok": false, "reason": "MUST_LEAVE_GUILD", "msg": "已有公会归属,必须先退出公会方可转国!"}
|
||||
|
||||
if item_slot < 0 or item_slot >= inventory.size() or inventory[item_slot] == null:
|
||||
return {"ok": false, "reason": "INVALID_ITEM_SLOT"}
|
||||
|
||||
var scroll: Dictionary = inventory[item_slot]
|
||||
if int(scroll.get("vnum", 0)) != VNUM_TINCTURE_OF_EMPIRES:
|
||||
return {"ok": false, "reason": "NOT_A_TINCTURE_ITEM", "msg": "需要消耗【转国卷轴】(71054)!"}
|
||||
|
||||
# 若当前已有祈福加成,先解除旧帝国祈福
|
||||
if is_blessing_active:
|
||||
var old_blessings: Dictionary = EMPIRES_INFO[current_empire]["blessings"]
|
||||
_apply_blessings_to_player(old_blessings, player_stats, -1)
|
||||
is_blessing_active = false
|
||||
blessing_time_remaining = 0.0
|
||||
|
||||
# 消耗转国卷轴
|
||||
var cnt := int(scroll.get("count", 1))
|
||||
if cnt > 1:
|
||||
scroll["count"] = cnt - 1
|
||||
else:
|
||||
inventory[item_slot] = null
|
||||
|
||||
var old_emp := current_empire
|
||||
current_empire = target_empire
|
||||
|
||||
empire_changed.emit(old_emp, current_empire)
|
||||
|
||||
var new_info: Dictionary = EMPIRES_INFO[current_empire]
|
||||
return {
|
||||
"ok": true,
|
||||
"old_empire": old_emp,
|
||||
"new_empire": current_empire,
|
||||
"new_empire_name": new_info["name"],
|
||||
"msg": "成功转入【%s】!请前往母国【%s】领取新的帝国嘉奖。" % [new_info["name"], new_info["capital"]]
|
||||
}
|
||||
|
||||
func _apply_blessings_to_player(blessings: Dictionary, player_stats: Dictionary, factor: int) -> void:
|
||||
for k in blessings.keys():
|
||||
var val = int(blessings[k]) * factor
|
||||
var cur = int(player_stats.get(k, 0))
|
||||
player_stats[k] = cur + val
|
||||
|
||||
# 序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"current_empire": current_empire,
|
||||
"is_blessing_active": is_blessing_active,
|
||||
"blessing_time_remaining": blessing_time_remaining
|
||||
}
|
||||
|
||||
# 反序列化
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
current_empire = int(data.get("current_empire", EMPIRE_NONE))
|
||||
is_blessing_active = bool(data.get("is_blessing_active", false))
|
||||
blessing_time_remaining = float(data.get("blessing_time_remaining", 0.0))
|
||||
@@ -1 +0,0 @@
|
||||
uid://cw0e8mkuuaupg
|
||||
@@ -1,194 +0,0 @@
|
||||
# endless_spire_dungeon_system.gd —— Metin2 40250 单人单机迷宫地牢【无尽天关】爬塔挑战 1:1
|
||||
# 对照 40250 服务端 dungeon.cpp, dungeon_info.cpp, questmanager.cpp
|
||||
class_name EndlessSpireDungeonSystem
|
||||
extends RefCounted
|
||||
|
||||
signal floor_started(floor_num: int, is_boss_floor: bool, mob_count: int)
|
||||
signal floor_cleared(floor_num: int, points_earned: int, time_used: float)
|
||||
signal checkpoint_saved(checkpoint_floor: int)
|
||||
signal spire_trial_completed(highest_floor: int, total_points: int)
|
||||
signal spire_trial_failed(floor_num: int, reason: String)
|
||||
|
||||
const MAX_FLOORS := 50
|
||||
const FLOOR_TIME_LIMIT := 120.0 # 每层 120 秒限时
|
||||
|
||||
const MILESTONE_BOSSES: Dictionary = {
|
||||
5: {"name": "半兽人首领", "vnum": 691, "hp": 50000},
|
||||
10: {"name": "蜘蛛女王", "vnum": 2091, "hp": 80000},
|
||||
15: {"name": "沙漠巨怪", "vnum": 2191, "hp": 120000},
|
||||
20: {"name": "恶魔死神", "vnum": 1093, "hp": 180000},
|
||||
25: {"name": "烈焰领主", "vnum": 2206, "hp": 220000},
|
||||
30: {"name": "九尾妖狐", "vnum": 1901, "hp": 280000},
|
||||
35: {"name": "黄虎之魂", "vnum": 1304, "hp": 320000},
|
||||
40: {"name": "冥王阿兹瑞尔", "vnum": 2598, "hp": 400000},
|
||||
45: {"name": "冰龙贝兰-塞陶", "vnum": 2493, "hp": 500000},
|
||||
50: {"name": "混沌魔神·阿萨泽尔", "vnum": 8027, "hp": 800000}
|
||||
}
|
||||
|
||||
var is_in_trial: bool = false
|
||||
var current_floor: int = 1
|
||||
var highest_checkpoint: int = 1
|
||||
var total_points: int = 0
|
||||
var floor_time_remaining: float = 0.0
|
||||
|
||||
var active_mobs: Dictionary = {} # mob_id -> { "vnum", "alive" }
|
||||
var next_mob_id: int = 1
|
||||
var personal_best_floor: int = 0
|
||||
|
||||
# 开启爬塔挑战
|
||||
func start_trial(from_checkpoint: bool = false) -> Dictionary:
|
||||
if is_in_trial:
|
||||
return {"ok": false, "reason": "ALREADY_IN_TRIAL"}
|
||||
|
||||
is_in_trial = true
|
||||
current_floor = highest_checkpoint if from_checkpoint else 1
|
||||
total_points = 0
|
||||
next_mob_id = 1
|
||||
|
||||
_start_floor(current_floor)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"starting_floor": current_floor,
|
||||
"checkpoint": highest_checkpoint,
|
||||
"msg": "踏入【无尽天关】第 %d 层!" % current_floor
|
||||
}
|
||||
|
||||
# 开启指定层数
|
||||
func _start_floor(floor_num: int) -> void:
|
||||
current_floor = floor_num
|
||||
floor_time_remaining = FLOOR_TIME_LIMIT
|
||||
active_mobs.clear()
|
||||
|
||||
var is_boss = MILESTONE_BOSSES.has(floor_num)
|
||||
if is_boss:
|
||||
var b_cfg = MILESTONE_BOSSES[floor_num]
|
||||
var mid = next_mob_id
|
||||
next_mob_id += 1
|
||||
active_mobs[mid] = {
|
||||
"id": mid,
|
||||
"vnum": b_cfg["vnum"],
|
||||
"name": b_cfg["name"],
|
||||
"is_boss": true,
|
||||
"alive": true
|
||||
}
|
||||
floor_started.emit(floor_num, true, 1)
|
||||
else:
|
||||
# 普通层小怪
|
||||
var mob_count = 4 + (floor_num % 5) * 2
|
||||
for i in range(mob_count):
|
||||
var mid = next_mob_id
|
||||
next_mob_id += 1
|
||||
active_mobs[mid] = {
|
||||
"id": mid,
|
||||
"vnum": 101 + (floor_num % 10),
|
||||
"name": "天关守卫",
|
||||
"is_boss": false,
|
||||
"alive": true
|
||||
}
|
||||
floor_started.emit(floor_num, false, mob_count)
|
||||
|
||||
# 击杀当前层怪物
|
||||
func kill_mob(mob_id: int) -> Dictionary:
|
||||
if not is_in_trial:
|
||||
return {"ok": false, "reason": "NOT_IN_TRIAL"}
|
||||
|
||||
if not active_mobs.has(mob_id) or not active_mobs[mob_id]["alive"]:
|
||||
return {"ok": false, "reason": "MOB_NOT_FOUND"}
|
||||
|
||||
active_mobs[mob_id]["alive"] = false
|
||||
active_mobs.erase(mob_id)
|
||||
|
||||
# 检查本层是否清空
|
||||
if active_mobs.is_empty():
|
||||
return _on_floor_cleared()
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"remaining_mobs": active_mobs.size()
|
||||
}
|
||||
|
||||
# 本层通关结算
|
||||
func _on_floor_cleared() -> Dictionary:
|
||||
var time_used = FLOOR_TIME_LIMIT - floor_time_remaining
|
||||
var points_awarded = current_floor * 10
|
||||
total_points += points_awarded
|
||||
|
||||
if current_floor > personal_best_floor:
|
||||
personal_best_floor = current_floor
|
||||
|
||||
floor_cleared.emit(current_floor, points_awarded, time_used)
|
||||
|
||||
# 检查点保存判定 (逢 5 层通关)
|
||||
if current_floor % 5 == 0:
|
||||
var next_cp = current_floor + 1
|
||||
if next_cp > highest_checkpoint and next_cp <= MAX_FLOORS:
|
||||
highest_checkpoint = next_cp
|
||||
checkpoint_saved.emit(highest_checkpoint)
|
||||
|
||||
# 终极 50 层通关判定
|
||||
if current_floor >= MAX_FLOORS:
|
||||
is_in_trial = false
|
||||
spire_trial_completed.emit(MAX_FLOORS, total_points)
|
||||
return {
|
||||
"ok": true,
|
||||
"trial_completed": true,
|
||||
"highest_floor": MAX_FLOORS,
|
||||
"total_points": total_points,
|
||||
"msg": "登峰造极!你已彻底通关【无尽天关】第 50 层巅峰!"
|
||||
}
|
||||
|
||||
# 进阶下一层
|
||||
var next_f = current_floor + 1
|
||||
_start_floor(next_f)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"floor_cleared": current_floor - 1,
|
||||
"next_floor": next_f,
|
||||
"points": total_points,
|
||||
"msg": "第 %d 层顺利通关!进入第 %d 层!" % [current_floor - 1, next_f]
|
||||
}
|
||||
|
||||
# 帧心跳更新限时
|
||||
func update(delta: float) -> Dictionary:
|
||||
if not is_in_trial:
|
||||
return {"status": "inactive"}
|
||||
|
||||
floor_time_remaining -= delta
|
||||
if floor_time_remaining <= 0.0:
|
||||
floor_time_remaining = 0.0
|
||||
is_in_trial = false
|
||||
spire_trial_failed.emit(current_floor, "TIME_EXPIRED")
|
||||
return {
|
||||
"status": "failed",
|
||||
"reason": "TIME_EXPIRED",
|
||||
"floor": current_floor,
|
||||
"msg": "时间耗尽!被传送出天关。"
|
||||
}
|
||||
|
||||
return {
|
||||
"status": "active",
|
||||
"floor": current_floor,
|
||||
"remaining_time": floor_time_remaining,
|
||||
"remaining_mobs": active_mobs.size()
|
||||
}
|
||||
|
||||
# 中途离开挑战
|
||||
func exit_trial() -> Dictionary:
|
||||
if not is_in_trial:
|
||||
return {"ok": false, "reason": "NOT_IN_TRIAL"}
|
||||
is_in_trial = false
|
||||
active_mobs.clear()
|
||||
return {"ok": true, "msg": "已主动退出天关,检查点进度已保存。"}
|
||||
|
||||
# 获取挑战概览
|
||||
func get_spire_status() -> Dictionary:
|
||||
return {
|
||||
"is_in_trial": is_in_trial,
|
||||
"current_floor": current_floor,
|
||||
"highest_checkpoint": highest_checkpoint,
|
||||
"personal_best_floor": personal_best_floor,
|
||||
"total_points": total_points,
|
||||
"remaining_time": floor_time_remaining
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://c6sc72uf1btdv
|
||||
@@ -1,237 +0,0 @@
|
||||
# energy_system.gd —— Metin2 40250 官方能量碎片提取与能量水晶熔炼系统 1:1
|
||||
# 对照 40250 服务端 energy_system.quest, char_item.cpp:6319 (CBuffOnAttributes), char.h (POINT_ENERGY=128)
|
||||
class_name EnergySystem
|
||||
extends RefCounted
|
||||
|
||||
signal fragments_extracted(count: int, item_name: String)
|
||||
signal crystal_fused(crystal_item: Dictionary)
|
||||
signal energy_activated(duration: float, bonus_pct: int)
|
||||
signal energy_expired()
|
||||
|
||||
const NPC_ALCHEMIST := 20001 # 炼金术士
|
||||
const MIN_PLAYER_LEVEL := 35 # 角色开启门槛 35 级
|
||||
const MIN_EQUIP_LEVEL := 35 # 装备分解门槛 35 级
|
||||
|
||||
const VNUM_ENERGY_STONE := 51001 # 能量碎片 (Energy Stone / Fragment)
|
||||
const VNUM_CHARGING_STONE := 51002 # 能量水晶 (Charging Stone / Energy Crystal)
|
||||
|
||||
const FUSION_NEED_STONES := 30 # 熔炼需要 30 颗碎片
|
||||
const FUSION_COST_GOLD := 1000 # 熔炼手续费 1000 金币
|
||||
const ENERGY_DURATION := 7200.0 # 2 小时 (7200 秒)
|
||||
const ATTR_BONUS_PCT := 10 # 全身穿戴装备属性增幅 +10%
|
||||
|
||||
var is_energy_active: bool = false
|
||||
var energy_time_remaining: float = 0.0
|
||||
var applied_bonuses: Dictionary = {}
|
||||
|
||||
# 计算装备分解产出碎片数量 (40250 energy_system.quest 概率阶梯)
|
||||
static func calculate_fragment_yield(equip_level_limit: int, rand_val: int = -1) -> int:
|
||||
var r: int = rand_val if rand_val >= 0 else (randi() % 100)
|
||||
if equip_level_limit >= 35 and equip_level_limit <= 50:
|
||||
# 35~50 级装备产出 1~5 颗
|
||||
return clampi(1 + (r % 5), 1, 5)
|
||||
elif equip_level_limit > 50 and equip_level_limit <= 70:
|
||||
# 51~70 级装备产出 3~8 颗
|
||||
return clampi(3 + (r % 6), 3, 8)
|
||||
else:
|
||||
# 70 级以上顶级装备产出 5~15 颗
|
||||
return clampi(5 + (r % 11), 5, 15)
|
||||
|
||||
# 在炼金术士处分解淘汰装备提取能量碎片
|
||||
func extract_energy_fragments(inventory: Array, slot_index: int, player_level: int) -> Dictionary:
|
||||
if player_level < MIN_PLAYER_LEVEL:
|
||||
return {"ok": false, "reason": "PLAYER_LEVEL_TOO_LOW", "msg": "炼金术士只为 35 级以上的强者提取能量!"}
|
||||
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item: Dictionary = inventory[slot_index]
|
||||
var limit_lv := int(item.get("level_limit", item.get("limit_level", 0)))
|
||||
if limit_lv < MIN_EQUIP_LEVEL:
|
||||
return {"ok": false, "reason": "EQUIP_LEVEL_TOO_LOW", "msg": "只能分解 35 级以上的武器、防具或首饰!"}
|
||||
|
||||
# 检查箭矢等消耗品
|
||||
if item.get("type", 0) == 1 and item.get("subtype", 0) == 5: # WEAPON_ARROW
|
||||
return {"ok": false, "reason": "ARROW_NOT_ALLOWED", "msg": "箭矢无法提取能量!"}
|
||||
|
||||
var item_name: String = str(item.get("name", "淘汰装备"))
|
||||
var count_yield := calculate_fragment_yield(limit_lv)
|
||||
|
||||
# 移除装备
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 发放能量碎片 (查找已有堆叠或找空位)
|
||||
var placed := false
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) == VNUM_ENERGY_STONE:
|
||||
var cur_c := int(inventory[i].get("count", 1))
|
||||
inventory[i]["count"] = cur_c + count_yield
|
||||
placed = true
|
||||
break
|
||||
|
||||
if not placed:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {
|
||||
"vnum": VNUM_ENERGY_STONE,
|
||||
"name": "能量碎片",
|
||||
"count": count_yield
|
||||
}
|
||||
placed = true
|
||||
break
|
||||
|
||||
fragments_extracted.emit(count_yield, item_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"yield": count_yield,
|
||||
"item_name": item_name,
|
||||
"msg": "成功分解【%s】,提取出 %d 颗【能量碎片】!" % [item_name, count_yield]
|
||||
}
|
||||
|
||||
# 熔炼能量水晶 (30 碎片 + 1000 金币)
|
||||
func fuse_energy_crystal(inventory: Array, player_gold: Dictionary) -> Dictionary:
|
||||
var cur_gold := int(player_gold.get("gold", 0))
|
||||
if cur_gold < FUSION_COST_GOLD:
|
||||
return {"ok": false, "reason": "NOT_ENOUGH_GOLD", "msg": "金币不足!熔炼需要 1,000 金币。"}
|
||||
|
||||
# 统计能量碎片总数
|
||||
var total_stones := 0
|
||||
var stone_slots: Array = []
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) == VNUM_ENERGY_STONE:
|
||||
total_stones += int(inventory[i].get("count", 1))
|
||||
stone_slots.append(i)
|
||||
|
||||
if total_stones < FUSION_NEED_STONES:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "NOT_ENOUGH_STONES",
|
||||
"msg": "能量碎片不足!需要 %d 颗,当前拥有 %d 颗。" % [FUSION_NEED_STONES, total_stones]
|
||||
}
|
||||
|
||||
# 寻找放置能量水晶的槽位
|
||||
var crystal_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
crystal_slot = i
|
||||
break
|
||||
|
||||
# 扣除 30 颗碎片
|
||||
var need_to_deduct := FUSION_NEED_STONES
|
||||
for slot_idx in stone_slots:
|
||||
var it: Dictionary = inventory[slot_idx]
|
||||
var c := int(it.get("count", 1))
|
||||
if c <= need_to_deduct:
|
||||
need_to_deduct -= c
|
||||
inventory[slot_idx] = null
|
||||
if crystal_slot == -1:
|
||||
crystal_slot = slot_idx # 复用清空的格子
|
||||
else:
|
||||
it["count"] = c - need_to_deduct
|
||||
need_to_deduct = 0
|
||||
break
|
||||
|
||||
player_gold["gold"] = cur_gold - FUSION_COST_GOLD
|
||||
|
||||
var crystal := {
|
||||
"vnum": VNUM_CHARGING_STONE,
|
||||
"name": "能量水晶",
|
||||
"count": 1
|
||||
}
|
||||
inventory[crystal_slot] = crystal
|
||||
|
||||
crystal_fused.emit(crystal)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"crystal": crystal,
|
||||
"slot": crystal_slot,
|
||||
"msg": "熔炼成功!纯净的【能量水晶】已凝聚成型。"
|
||||
}
|
||||
|
||||
# 使用能量水晶激活 2 小时全身穿戴装备 10% 增幅 (40250 CBuffOnAttributes)
|
||||
func use_energy_crystal(inventory: Array, slot_index: int, equipped_items: Array, player_stats: Dictionary) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item: Dictionary = inventory[slot_index]
|
||||
if int(item.get("vnum", 0)) != VNUM_CHARGING_STONE:
|
||||
return {"ok": false, "reason": "NOT_A_CHARGING_STONE", "msg": "此物品不是能量水晶!"}
|
||||
|
||||
# 消耗 1 颗能量水晶
|
||||
var c := int(item.get("count", 1))
|
||||
if c > 1:
|
||||
item["count"] = c - 1
|
||||
else:
|
||||
inventory[slot_index] = null
|
||||
|
||||
# 如果已激活,先清除旧加成
|
||||
if is_energy_active:
|
||||
_clear_energy_buffs(player_stats)
|
||||
|
||||
# 计算穿戴装备基础属性总和的 10%
|
||||
applied_bonuses.clear()
|
||||
for eq in equipped_items:
|
||||
if eq == null:
|
||||
continue
|
||||
var atk = int(eq.get("attack_power", 0))
|
||||
var def = int(eq.get("defense", 0))
|
||||
var hp = int(eq.get("max_hp", 0))
|
||||
if atk > 0:
|
||||
applied_bonuses["attack_power"] = int(applied_bonuses.get("attack_power", 0)) + int(ceil(atk * 0.10))
|
||||
if def > 0:
|
||||
applied_bonuses["defense"] = int(applied_bonuses.get("defense", 0)) + int(ceil(def * 0.10))
|
||||
if hp > 0:
|
||||
applied_bonuses["max_hp"] = int(applied_bonuses.get("max_hp", 0)) + int(ceil(hp * 0.10))
|
||||
|
||||
# 保底全属性增益 (即使没有极品装备,也提供保底加成)
|
||||
applied_bonuses["attack_power"] = maxi(10, int(applied_bonuses.get("attack_power", 0)))
|
||||
applied_bonuses["defense"] = maxi(10, int(applied_bonuses.get("defense", 0)))
|
||||
|
||||
# 注入玩家属性
|
||||
for k in applied_bonuses.keys():
|
||||
player_stats[k] = int(player_stats.get(k, 0)) + applied_bonuses[k]
|
||||
|
||||
is_energy_active = true
|
||||
energy_time_remaining = ENERGY_DURATION
|
||||
|
||||
energy_activated.emit(ENERGY_DURATION, ATTR_BONUS_PCT)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"duration": ENERGY_DURATION,
|
||||
"bonuses": applied_bonuses,
|
||||
"msg": "能量水晶激活!全身装备属性增幅 +10%%,持续 2 小时。"
|
||||
}
|
||||
|
||||
# 清除能量属性
|
||||
func _clear_energy_buffs(player_stats: Dictionary) -> void:
|
||||
for k in applied_bonuses.keys():
|
||||
player_stats[k] = int(player_stats.get(k, 0)) - applied_bonuses[k]
|
||||
applied_bonuses.clear()
|
||||
is_energy_active = false
|
||||
energy_time_remaining = 0.0
|
||||
|
||||
# 时钟心跳推进
|
||||
func update(delta: float, player_stats: Dictionary) -> void:
|
||||
if not is_energy_active:
|
||||
return
|
||||
energy_time_remaining -= delta
|
||||
if energy_time_remaining <= 0.0:
|
||||
_clear_energy_buffs(player_stats)
|
||||
energy_expired.emit()
|
||||
|
||||
# 序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"is_energy_active": is_energy_active,
|
||||
"energy_time_remaining": energy_time_remaining,
|
||||
"applied_bonuses": applied_bonuses.duplicate(true)
|
||||
}
|
||||
|
||||
# 反序列化
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
is_energy_active = bool(data.get("is_energy_active", false))
|
||||
energy_time_remaining = float(data.get("energy_time_remaining", 0.0))
|
||||
applied_bonuses = data.get("applied_bonuses", {}).duplicate(true)
|
||||
@@ -1 +0,0 @@
|
||||
uid://ckdibi7t8851x
|
||||
@@ -1,210 +0,0 @@
|
||||
# epic_refine_system.gd —— Metin2 40250 修元平史诗级神装升阶转换锻造 1:1
|
||||
# 对照 40250 服务端 refine.cpp, char_item.cpp, NPC 20091 (修元平 Seon-Pyeong)
|
||||
class_name EpicRefineSystem
|
||||
extends RefCounted
|
||||
|
||||
signal epic_refine_succeeded(old_vnum: int, new_vnum: int, item_data: Dictionary)
|
||||
signal epic_refine_failed(reason: String)
|
||||
|
||||
const NPC_SEON_PYEONG := 20091
|
||||
|
||||
const ITEM_DRAGON_SCALE := 71123 # 龙鳞
|
||||
const ITEM_DRAGON_CLAW := 71129 # 龙爪
|
||||
const REQUIRED_SCALE_COUNT := 3
|
||||
const REQUIRED_CLAW_COUNT := 4
|
||||
const REQUIRED_YANG := 200000
|
||||
|
||||
# 官方 40250 经典史诗升阶配方表
|
||||
const EPIC_RECIPES: Dictionary = {
|
||||
# 武器篇:65 级 +9 武器 -> 80~90 级 +0 史诗神兵
|
||||
169: {
|
||||
"target_vnum": 279,
|
||||
"name": "崔顿之剑+0",
|
||||
"desc": "战神之剑+9 升阶为 崔顿之剑+0"
|
||||
},
|
||||
3159: {
|
||||
"target_vnum": 3209,
|
||||
"name": "神圣之剑+0",
|
||||
"desc": "鬼牙刃+9 升阶为 神圣之剑+0"
|
||||
},
|
||||
1109: {
|
||||
"target_vnum": 1139,
|
||||
"name": "太阳之刃+0",
|
||||
"desc": "党人斧+9 升阶为 太阳之刃+0"
|
||||
},
|
||||
1119: {
|
||||
"target_vnum": 1129,
|
||||
"name": "龙神刀+0",
|
||||
"desc": "龙刀+9 升阶为 龙神刀+0"
|
||||
},
|
||||
2149: {
|
||||
"target_vnum": 2159,
|
||||
"name": "巨鸦弓+0",
|
||||
"desc": "黄龙弓+9 升阶为 巨鸦弓+0"
|
||||
},
|
||||
5109: {
|
||||
"target_vnum": 5119,
|
||||
"name": "恶魔之杖+0",
|
||||
"desc": "救赎之杖+9 升阶为 恶魔之杖+0"
|
||||
},
|
||||
# 铠甲篇:66 级 +9 黑钢铠甲 -> 90 级 +0 蓝钢铠甲
|
||||
11299: {
|
||||
"target_vnum": 12019,
|
||||
"name": "蓝钢甲+0",
|
||||
"desc": "黑钢甲+9 升阶为 蓝钢甲+0"
|
||||
},
|
||||
11499: {
|
||||
"target_vnum": 12029,
|
||||
"name": "蓝风甲+0",
|
||||
"desc": "黑风甲+9 升阶为 蓝风甲+0"
|
||||
},
|
||||
11699: {
|
||||
"target_vnum": 12039,
|
||||
"name": "蓝仙袍+0",
|
||||
"desc": "黑仙袍+9 升阶为 蓝仙袍+0"
|
||||
},
|
||||
11899: {
|
||||
"target_vnum": 12049,
|
||||
"name": "蓝龙袍+0",
|
||||
"desc": "黑龙袍+9 升阶为 蓝龙袍+0"
|
||||
}
|
||||
}
|
||||
|
||||
# 判定物品是否可进行史诗升阶
|
||||
func can_epic_refine(item: Dictionary) -> bool:
|
||||
if item.is_empty():
|
||||
return false
|
||||
var vnum: int = int(item.get("vnum", 0))
|
||||
return EPIC_RECIPES.has(vnum)
|
||||
|
||||
# 获取升阶配方详情
|
||||
func get_recipe(vnum: int) -> Dictionary:
|
||||
return EPIC_RECIPES.get(vnum, {})
|
||||
|
||||
# 执行史诗装备升阶转换锻造
|
||||
func do_epic_refine(
|
||||
target_slot: int,
|
||||
inventory: Array,
|
||||
player_data: Dictionary
|
||||
) -> Dictionary:
|
||||
if target_slot < 0 or target_slot >= inventory.size():
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "无效的装备栏位!"}
|
||||
|
||||
var base_item = inventory[target_slot]
|
||||
if base_item == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格子上没有装备!"}
|
||||
|
||||
# 安全锁拦截
|
||||
if base_item.get("is_locked", false):
|
||||
return {"ok": false, "reason": "ITEM_LOCKED", "msg": "已加锁的装备无法进行史诗锻造!"}
|
||||
|
||||
var base_vnum: int = int(base_item.get("vnum", 0))
|
||||
if not EPIC_RECIPES.has(base_vnum):
|
||||
return {"ok": false, "reason": "NOT_AN_EPIC_BASE_ITEM", "msg": "该物品无法进行修元平史诗升阶!"}
|
||||
|
||||
var recipe: Dictionary = EPIC_RECIPES[base_vnum]
|
||||
|
||||
# 1. 检查金币 (Yang)
|
||||
var current_yang: int = int(player_data.get("gold", 0))
|
||||
if current_yang < REQUIRED_YANG:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "INSUFFICIENT_YANG",
|
||||
"required_yang": REQUIRED_YANG,
|
||||
"current_yang": current_yang,
|
||||
"msg": "史诗锻造需要 200,000 金币!你的金币不足。"
|
||||
}
|
||||
|
||||
# 2. 统计并收集龙鳞与龙爪
|
||||
var scale_slots: Array = []
|
||||
var claw_slots: Array = []
|
||||
var total_scales: int = 0
|
||||
var total_claws: int = 0
|
||||
|
||||
for i in range(inventory.size()):
|
||||
var item = inventory[i]
|
||||
if item == null:
|
||||
continue
|
||||
var v: int = int(item.get("vnum", 0))
|
||||
var cnt: int = int(item.get("count", 1))
|
||||
if v == ITEM_DRAGON_SCALE:
|
||||
total_scales += cnt
|
||||
scale_slots.append({"slot": i, "count": cnt})
|
||||
elif v == ITEM_DRAGON_CLAW:
|
||||
total_claws += cnt
|
||||
claw_slots.append({"slot": i, "count": cnt})
|
||||
|
||||
if total_scales < REQUIRED_SCALE_COUNT:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "MISSING_DRAGON_SCALES",
|
||||
"required": REQUIRED_SCALE_COUNT,
|
||||
"current": total_scales,
|
||||
"msg": "史诗锻造需要 3 个龙鳞!当前只有 %d 个。" % total_scales
|
||||
}
|
||||
|
||||
if total_claws < REQUIRED_CLAW_COUNT:
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "MISSING_DRAGON_CLAWS",
|
||||
"required": REQUIRED_CLAW_COUNT,
|
||||
"current": total_claws,
|
||||
"msg": "史诗锻造需要 4 个龙爪!当前只有 %d 个。" % total_claws
|
||||
}
|
||||
|
||||
# 3. 扣除金币
|
||||
player_data["gold"] = current_yang - REQUIRED_YANG
|
||||
|
||||
# 4. 扣除材料 (龙鳞 3, 龙爪 4)
|
||||
_consume_materials(inventory, scale_slots, REQUIRED_SCALE_COUNT)
|
||||
_consume_materials(inventory, claw_slots, REQUIRED_CLAW_COUNT)
|
||||
|
||||
# 5. 生成新史诗装备,1:1 完整继承 5 条附加属性与已镶嵌灵石!
|
||||
var new_vnum: int = recipe["target_vnum"]
|
||||
var inherited_attrs: Array = []
|
||||
if base_item.has("attributes"):
|
||||
for attr in base_item["attributes"]:
|
||||
inherited_attrs.append(attr.duplicate())
|
||||
|
||||
var inherited_sockets: Array = []
|
||||
if base_item.has("sockets"):
|
||||
for sock in base_item["sockets"]:
|
||||
inherited_sockets.append(sock)
|
||||
|
||||
var epic_item: Dictionary = {
|
||||
"vnum": new_vnum,
|
||||
"name": recipe["name"],
|
||||
"count": 1,
|
||||
"attributes": inherited_attrs,
|
||||
"sockets": inherited_sockets,
|
||||
"socket_count": base_item.get("socket_count", 3),
|
||||
"is_locked": false
|
||||
}
|
||||
|
||||
# 替换背包中原位置的装备
|
||||
inventory[target_slot] = epic_item
|
||||
|
||||
epic_refine_succeeded.emit(base_vnum, new_vnum, epic_item)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"old_vnum": base_vnum,
|
||||
"new_vnum": new_vnum,
|
||||
"item": epic_item,
|
||||
"msg": "恭喜!修元平大师成功将装备升阶锻造为【%s】!" % recipe["name"]
|
||||
}
|
||||
|
||||
# 辅助函数:按需从多个格子中扣除材料数量
|
||||
func _consume_materials(inventory: Array, slots_info: Array, count_needed: int) -> void:
|
||||
var needed := count_needed
|
||||
for info in slots_info:
|
||||
var s: int = info["slot"]
|
||||
var have: int = info["count"]
|
||||
if have <= needed:
|
||||
needed -= have
|
||||
inventory[s] = null
|
||||
else:
|
||||
inventory[s]["count"] = have - needed
|
||||
needed = 0
|
||||
if needed <= 0:
|
||||
break
|
||||
@@ -1 +0,0 @@
|
||||
uid://cg7egxv7schkr
|
||||
@@ -1,134 +0,0 @@
|
||||
# equipment_inspect_system.gd —— 40250 装备透视检视与 GM 监察系统 1:1
|
||||
# 严格对照:
|
||||
# Client/Eternexus/root/uiequipmentdialog.py (EquipmentDialog)
|
||||
# ClientVS22/source/UserInterface/PythonPlayer.cpp
|
||||
# metin2/src/server/game/src/cmd_gm.cpp (do_view_equip)
|
||||
extends RefCounted
|
||||
|
||||
# 官方装备槽位常量定义 (1:1 ClientVS22/source/UserInterface/GameType.h)
|
||||
const WEAR_BODY := 0 # 铠甲
|
||||
const WEAR_HEAD := 1 # 头盔
|
||||
const WEAR_FOOTS := 2 # 鞋子
|
||||
const WEAR_WRIST := 3 # 手镯
|
||||
const WEAR_WEAPON := 4 # 武器
|
||||
const WEAR_NECK := 5 # 项链
|
||||
const WEAR_EAR := 6 # 耳环
|
||||
const WEAR_SHIELD := 10 # 盾牌
|
||||
const WEAR_COSTUME_BODY := 19 # 时装身体
|
||||
const WEAR_COSTUME_HAIR := 20 # 时装发型
|
||||
const WEAR_COSTUME_WEAPON := 21 # 时装武器
|
||||
|
||||
const SLOT_NAMES := {
|
||||
WEAR_BODY: "铠甲",
|
||||
WEAR_HEAD: "头盔",
|
||||
WEAR_FOOTS: "鞋子",
|
||||
WEAR_WRIST: "手镯",
|
||||
WEAR_WEAPON: "武器",
|
||||
WEAR_NECK: "项链",
|
||||
WEAR_EAR: "耳环",
|
||||
WEAR_SHIELD: "盾牌",
|
||||
WEAR_COSTUME_BODY: "时装身体",
|
||||
WEAR_COSTUME_HAIR: "时装发型",
|
||||
WEAR_COSTUME_WEAPON: "时装武器",
|
||||
}
|
||||
|
||||
# 窗口状态
|
||||
var is_open: bool = false
|
||||
var inspected_vid: int = 0
|
||||
var inspected_name: String = ""
|
||||
var equipment_slots: Dictionary = {} # slot_idx -> item_data Dictionary
|
||||
|
||||
func _init() -> void:
|
||||
is_open = false
|
||||
inspected_vid = 0
|
||||
inspected_name = ""
|
||||
equipment_slots.clear()
|
||||
|
||||
# 1. 打开检视窗口 (1:1 EquipmentDialog.Open)
|
||||
# caller_is_gm: GM 可强制穿透隐私限制
|
||||
func open_dialog(
|
||||
target_vid: int,
|
||||
target_name: String,
|
||||
target_equip_dict: Dictionary,
|
||||
allow_inspect: bool = true,
|
||||
caller_is_gm: bool = false
|
||||
) -> Dictionary:
|
||||
var res := { "success": false, "error_code": "OK", "message": "" }
|
||||
|
||||
if not allow_inspect and not caller_is_gm:
|
||||
res["error_code"] = "INSPECT_FORBIDDEN"
|
||||
res["message"] = "目标玩家设置了隐私保护,禁止查看装备。"
|
||||
return res
|
||||
|
||||
inspected_vid = target_vid
|
||||
inspected_name = target_name
|
||||
equipment_slots.clear()
|
||||
|
||||
# 载入目标玩家装备数据
|
||||
for slot_key in target_equip_dict:
|
||||
var slot_idx: int = int(slot_key)
|
||||
var it: Dictionary = target_equip_dict[slot_key]
|
||||
equipment_slots[slot_idx] = _normalize_item_data(it)
|
||||
|
||||
is_open = true
|
||||
res["success"] = true
|
||||
res["message"] = "成功载入 %s 的装备信息。" % target_name
|
||||
return res
|
||||
|
||||
# 2. 关闭检视窗口 (EquipmentDialog.Close)
|
||||
func close_dialog() -> void:
|
||||
is_open = false
|
||||
inspected_vid = 0
|
||||
inspected_name = ""
|
||||
equipment_slots.clear()
|
||||
|
||||
# 3. 规范化装备项数据 (确保含有 3 宝石孔与 7 词条结构)
|
||||
func _normalize_item_data(it: Dictionary) -> Dictionary:
|
||||
var item_copy := it.duplicate(true)
|
||||
var sockets: Array = item_copy.get("sockets", [0, 0, 0])
|
||||
while sockets.size() < 3:
|
||||
sockets.append(0)
|
||||
item_copy["sockets"] = sockets
|
||||
|
||||
var attrs: Array = item_copy.get("attributes", [])
|
||||
item_copy["attributes"] = attrs
|
||||
return item_copy
|
||||
|
||||
# 4. 获取指定槽位装备
|
||||
func get_slot_item(slot_idx: int) -> Dictionary:
|
||||
if not is_open:
|
||||
return {}
|
||||
return equipment_slots.get(slot_idx, {})
|
||||
|
||||
# 5. 悬停生成 Tooltip 详情 (1:1 EquipmentDialog.OverInItem)
|
||||
func build_slot_tooltip(slot_idx: int) -> String:
|
||||
if not is_open:
|
||||
return ""
|
||||
|
||||
if not equipment_slots.has(slot_idx):
|
||||
var slot_name: String = SLOT_NAMES.get(slot_idx, "未知槽位")
|
||||
return "[%s] 未佩戴装备" % slot_name
|
||||
|
||||
var it: Dictionary = equipment_slots[slot_idx]
|
||||
var lines: Array = []
|
||||
var title_name: String = it.get("name", "Unknown Item")
|
||||
var vnum: int = it.get("vnum", 0)
|
||||
|
||||
lines.append("=== %s (Vnum: %d) ===" % [title_name, vnum])
|
||||
lines.append("部位: %s" % SLOT_NAMES.get(slot_idx, "特殊部位"))
|
||||
|
||||
# 宝石孔位
|
||||
var sockets: Array = it.get("sockets", [])
|
||||
for i in range(sockets.size()):
|
||||
var s: int = sockets[i]
|
||||
if s > 0:
|
||||
lines.append("孔位 %d: 镶嵌宝石 [Vnum %d]" % [i + 1, s])
|
||||
elif s == 1:
|
||||
lines.append("孔位 %d: 空孔" % [i + 1])
|
||||
|
||||
# 附加属性 (1~7 词条)
|
||||
var attrs: Array = it.get("attributes", [])
|
||||
for a in attrs:
|
||||
lines.append("附加属性: 属性 %d +%d" % [a.get("type", 0), a.get("value", 0)])
|
||||
|
||||
return ("\n").join(lines)
|
||||
@@ -1 +0,0 @@
|
||||
uid://gt0l8bv2agu3
|
||||
@@ -1,171 +0,0 @@
|
||||
# event_manager_system.gd —— Metin2 40250 单人模式全服掉落活动与倍率调度器 1:1
|
||||
# 对照 40250 服务端 cmd_gm.cpp (do_priv_empire), priv_manager.cpp, event.cpp, Items 50011, 50037
|
||||
class_name EventManagerSystem
|
||||
extends RefCounted
|
||||
|
||||
signal rate_changed(rate_type: String, multiplier: float)
|
||||
signal event_state_changed(event_name: String, is_active: bool)
|
||||
signal event_box_dropped(box_vnum: int, box_name: String)
|
||||
|
||||
const ITEM_MOONLIGHT_BOX := 50011 # 月光宝盒
|
||||
const ITEM_HEXAGONAL_BOX := 50037 # 六角宝盒
|
||||
|
||||
# 宝盒奖励奖池 (40250 官方 special_item_group.txt 1:1)
|
||||
const EVENT_BOX_LOOT: Dictionary = {
|
||||
50011: [
|
||||
{"vnum": 25040, "name": "祝福卷轴", "count": 1, "weight": 30},
|
||||
{"vnum": 71084, "name": "高级附魔石", "count": 1, "weight": 25},
|
||||
{"vnum": 71085, "name": "高级洗练石", "count": 1, "weight": 25},
|
||||
{"vnum": 70024, "name": "祝福大理石", "count": 1, "weight": 10},
|
||||
{"vnum": 72723, "name": "月之灵药(特)", "count": 1, "weight": 10}
|
||||
],
|
||||
50037: [
|
||||
{"vnum": 72001, "name": "经验之戒", "count": 1, "weight": 20},
|
||||
{"vnum": 72002, "name": "盗贼手套", "count": 1, "weight": 20},
|
||||
{"vnum": 27102, "name": "绿药水(大)", "count": 5, "weight": 30},
|
||||
{"vnum": 27105, "name": "紫药水(大)", "count": 5, "weight": 30}
|
||||
]
|
||||
}
|
||||
|
||||
var exp_rate: float = 1.0
|
||||
var drop_rate: float = 1.0
|
||||
var gold_rate: float = 1.0
|
||||
|
||||
var is_moonlight_active: bool = false
|
||||
var is_hexagonal_active: bool = false
|
||||
|
||||
# 设置倍率 (exp, drop, gold)
|
||||
func set_rate(rate_type: String, multiplier: float) -> Dictionary:
|
||||
if multiplier < 1.0 or multiplier > 5.0:
|
||||
return {"ok": false, "reason": "INVALID_MULTIPLIER", "msg": "倍率必须在 1.0 到 5.0 之间!"}
|
||||
|
||||
match rate_type:
|
||||
"exp":
|
||||
exp_rate = multiplier
|
||||
"drop":
|
||||
drop_rate = multiplier
|
||||
"gold":
|
||||
gold_rate = multiplier
|
||||
_:
|
||||
return {"ok": false, "reason": "INVALID_RATE_TYPE", "msg": "未知的倍率类型!"}
|
||||
|
||||
rate_changed.emit(rate_type, multiplier)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"rate_type": rate_type,
|
||||
"multiplier": multiplier,
|
||||
"msg": "全服【%s】倍率已设置为 %.1fx!" % [rate_type.to_upper(), multiplier]
|
||||
}
|
||||
|
||||
# 开关经典限时掉落活动
|
||||
func toggle_event(event_name: String, enable: bool) -> Dictionary:
|
||||
match event_name:
|
||||
"moonlight":
|
||||
is_moonlight_active = enable
|
||||
"hexagonal":
|
||||
is_hexagonal_active = enable
|
||||
_:
|
||||
return {"ok": false, "reason": "INVALID_EVENT_NAME", "msg": "未知的活动名称!"}
|
||||
|
||||
event_state_changed.emit(event_name, enable)
|
||||
|
||||
var state_str := "开启" if enable else "关闭"
|
||||
var ev_desc := "月光宝盒掉落狂欢" if event_name == "moonlight" else "六角宝盒冲级庆典"
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"event_name": event_name,
|
||||
"is_active": enable,
|
||||
"msg": "【%s】活动已%s!" % [ev_desc, state_str]
|
||||
}
|
||||
|
||||
# 怪物击杀时判定额外活动宝盒掉落
|
||||
func check_event_drops(mob_level: int, player_level: int, forced_roll: float = -1.0) -> Array:
|
||||
var drops: Array = []
|
||||
|
||||
# 等级差在 15 级以内才掉落活动宝盒
|
||||
if absi(mob_level - player_level) > 15:
|
||||
return drops
|
||||
|
||||
# 1. 月光宝盒判定 (基础概率 10% * drop_rate)
|
||||
if is_moonlight_active:
|
||||
var chance := 0.10 * drop_rate
|
||||
var roll := forced_roll if forced_roll >= 0.0 else randf()
|
||||
if roll <= chance:
|
||||
drops.append({"vnum": ITEM_MOONLIGHT_BOX, "name": "月光宝盒", "count": 1})
|
||||
event_box_dropped.emit(ITEM_MOONLIGHT_BOX, "月光宝盒")
|
||||
|
||||
# 2. 六角宝盒判定 (基础概率 15% * drop_rate)
|
||||
if is_hexagonal_active:
|
||||
var chance := 0.15 * drop_rate
|
||||
var roll := forced_roll if forced_roll >= 0.0 else randf()
|
||||
if roll <= chance:
|
||||
drops.append({"vnum": ITEM_HEXAGONAL_BOX, "name": "六角宝盒", "count": 1})
|
||||
event_box_dropped.emit(ITEM_HEXAGONAL_BOX, "六角宝盒")
|
||||
|
||||
return drops
|
||||
|
||||
# 计算经倍率加成后的经验与金币
|
||||
func calculate_exp(base_exp: int) -> int:
|
||||
return int(round(base_exp * exp_rate))
|
||||
|
||||
func calculate_gold(base_gold: int) -> int:
|
||||
return int(round(base_gold * gold_rate))
|
||||
|
||||
# 打开活动宝盒
|
||||
func open_event_box(slot_idx: int, inventory: Array) -> Dictionary:
|
||||
if slot_idx < 0 or slot_idx >= inventory.size():
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "无效的背包栏位!"}
|
||||
|
||||
var box = inventory[slot_idx]
|
||||
if box == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格子上没有物品!"}
|
||||
|
||||
var box_vnum: int = int(box.get("vnum", 0))
|
||||
if not EVENT_BOX_LOOT.has(box_vnum):
|
||||
return {"ok": false, "reason": "NOT_AN_EVENT_BOX", "msg": "这不是活动宝盒!"}
|
||||
|
||||
var pool: Array = EVENT_BOX_LOOT[box_vnum]
|
||||
|
||||
# 权重抽奖
|
||||
var total_weight := 0
|
||||
for item in pool:
|
||||
total_weight += int(item.get("weight", 1))
|
||||
|
||||
var roll := randi_range(1, total_weight)
|
||||
var accumulated := 0
|
||||
var reward: Dictionary = {}
|
||||
for item in pool:
|
||||
accumulated += int(item.get("weight", 1))
|
||||
if roll <= accumulated:
|
||||
reward = item.duplicate()
|
||||
break
|
||||
|
||||
if reward.is_empty():
|
||||
reward = pool[0].duplicate()
|
||||
|
||||
# 扣除宝盒,存入奖励
|
||||
var cnt: int = int(box.get("count", 1))
|
||||
if cnt <= 1:
|
||||
inventory[slot_idx] = null
|
||||
else:
|
||||
box["count"] = cnt - 1
|
||||
|
||||
var stored_slot := -1
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {
|
||||
"vnum": reward["vnum"],
|
||||
"name": reward["name"],
|
||||
"count": reward.get("count", 1)
|
||||
}
|
||||
stored_slot = i
|
||||
break
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"reward": reward,
|
||||
"stored_slot": stored_slot,
|
||||
"msg": "打开活动宝盒,获得了【%s x%d】!" % [reward["name"], reward.get("count", 1)]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bvf0ul7tdn6o5
|
||||
@@ -1,432 +0,0 @@
|
||||
# fish_clam_roast_system.gd —— Metin2 40250 官方珍珠蚌开珠与活鱼宰杀/篝火炙烤盛宴系统 1:1
|
||||
# 100% 对照 40250 服务端 fishing.cpp, char_item.cpp (ITEM_FISH, 27987, USE_ABILITY_UP, USE_INVISIBILITY), item_proto.txt
|
||||
class_name FishClamRoastSystem
|
||||
extends RefCounted
|
||||
|
||||
signal fish_gutted(result_type: String, item_vnum: int, item_name: String)
|
||||
signal clam_opened(result_type: String, item_vnum: int, item_name: String)
|
||||
signal fish_grilled(raw_vnum: int, cooked_vnum: int, count: int)
|
||||
signal cooked_fish_consumed(fish_vnum: int, effect_type: String, value: int, duration: float)
|
||||
signal campfire_spawned(pos: Vector2, duration: float)
|
||||
|
||||
# 官方核心 Vnum 常量
|
||||
const VNUM_CLAM := 27987 # 珍珠蚌 (Clam / Istiridye)
|
||||
const VNUM_STONE_PIECE := 27990 # 碎石 (Stone Piece)
|
||||
const VNUM_WHITE_PEARL := 27992 # 白珍珠 (White Pearl)
|
||||
const VNUM_BLUE_PEARL := 27993 # 蓝珍珠 (Blue Pearl)
|
||||
const VNUM_BLOOD_PEARL := 27994 # 血红珍珠 (Blood Pearl)
|
||||
const VNUM_FISH_BONE := 27995 # 鱼骨 (Fishbone)
|
||||
const VNUM_EARTHWORM := 27801 # 蚯蚓/饵料 (Earthworm)
|
||||
const VNUM_CAMPFIRE_ITEM := 27600 # 篝火道具
|
||||
const MOB_CAMPFIRE := 12000 # 篝火 NPC/Mob
|
||||
|
||||
# 40250 官方鱼类资料表 (alive_vnum, dead_vnum, cooked_vnum, buff/effect)
|
||||
const FISH_DATA: Dictionary = {
|
||||
27803: {
|
||||
"name": "鲈鱼 (Sudak)",
|
||||
"alive_vnum": 27803,
|
||||
"dead_vnum": 27833,
|
||||
"cooked_vnum": 27863,
|
||||
"effect": "instant_hp",
|
||||
"value": 180,
|
||||
"duration": 0.0,
|
||||
"desc": "立即恢复 180 点生命值"
|
||||
},
|
||||
27804: {
|
||||
"name": "鲱鱼 (Ringa)",
|
||||
"alive_vnum": 27804,
|
||||
"dead_vnum": 27834,
|
||||
"cooked_vnum": 27864,
|
||||
"effect": "instant_sp",
|
||||
"value": 150,
|
||||
"duration": 0.0,
|
||||
"desc": "立即恢复 150 点魔法值"
|
||||
},
|
||||
27806: {
|
||||
"name": "鲤鱼 (Sazan)",
|
||||
"alive_vnum": 27806,
|
||||
"dead_vnum": 27836,
|
||||
"cooked_vnum": 27866,
|
||||
"effect": "move_speed",
|
||||
"value": 20,
|
||||
"duration": 600.0,
|
||||
"desc": "移动速度 +20 持续 10 分钟"
|
||||
},
|
||||
27807: {
|
||||
"name": "三文鱼/鲑鱼 (Som)",
|
||||
"alive_vnum": 27807,
|
||||
"dead_vnum": 27837,
|
||||
"cooked_vnum": 27867,
|
||||
"effect": "instant_sp",
|
||||
"value": 300,
|
||||
"duration": 0.0,
|
||||
"desc": "立即恢复 300 点魔法值"
|
||||
},
|
||||
27808: {
|
||||
"name": "草鱼 (Ot Sazanı)",
|
||||
"alive_vnum": 27808,
|
||||
"dead_vnum": 27838,
|
||||
"cooked_vnum": 27868,
|
||||
"effect": "attack_speed",
|
||||
"value": 20,
|
||||
"duration": 600.0,
|
||||
"desc": "攻击速度 +20 持续 10 分钟"
|
||||
},
|
||||
27810: {
|
||||
"name": "水针鱼 (Zargana)",
|
||||
"alive_vnum": 27810,
|
||||
"dead_vnum": 27840,
|
||||
"cooked_vnum": 27870,
|
||||
"effect": "strength",
|
||||
"value": 10,
|
||||
"duration": 600.0,
|
||||
"desc": "力量 (STR) +10 持续 10 分钟"
|
||||
},
|
||||
27813: {
|
||||
"name": "凤尾鱼 (Hamsi)",
|
||||
"alive_vnum": 27813,
|
||||
"dead_vnum": 27843,
|
||||
"cooked_vnum": 27873,
|
||||
"effect": "dexterity",
|
||||
"value": 10,
|
||||
"duration": 600.0,
|
||||
"desc": "敏捷 (DEX) +10 持续 10 分钟"
|
||||
},
|
||||
27814: {
|
||||
"name": "海鲈鱼 (Levrek)",
|
||||
"alive_vnum": 27814,
|
||||
"dead_vnum": 27844,
|
||||
"cooked_vnum": 27874,
|
||||
"effect": "cure_poison",
|
||||
"value": 1,
|
||||
"duration": 0.0,
|
||||
"desc": "祛除体内的一切猛毒状态"
|
||||
},
|
||||
27817: {
|
||||
"name": "泥鳅 (Çopra)",
|
||||
"alive_vnum": 27817,
|
||||
"dead_vnum": 27847,
|
||||
"cooked_vnum": 27877,
|
||||
"effect": "invisibility",
|
||||
"value": 1,
|
||||
"duration": 300.0,
|
||||
"desc": "进入幽冥迷雾隐身状态 5 分钟"
|
||||
}
|
||||
}
|
||||
|
||||
# 逆向索引
|
||||
var _dead_to_cooked: Dictionary = {}
|
||||
var _alive_to_cooked: Dictionary = {}
|
||||
var _cooked_to_data: Dictionary = {}
|
||||
|
||||
# 当前激活的烤鱼增益状态列表
|
||||
var _active_buffs: Dictionary = {} # effect_type -> {"value": int, "duration": float}
|
||||
|
||||
# 当前地图是否存在有效篝火
|
||||
var is_near_active_campfire: bool = false
|
||||
var campfire_time_left: float = 0.0
|
||||
|
||||
func _init() -> void:
|
||||
for k in FISH_DATA.keys():
|
||||
var data = FISH_DATA[k]
|
||||
_alive_to_cooked[data["alive_vnum"]] = data
|
||||
_dead_to_cooked[data["dead_vnum"]] = data
|
||||
_cooked_to_data[data["cooked_vnum"]] = data
|
||||
|
||||
# ==========================================
|
||||
# 1. 活鱼宰杀/使用 (fishing.cpp: UseFish)
|
||||
# ==========================================
|
||||
func gut_live_fish(inventory: Array, slot_index: int, forced_roll: int = -1) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格位没有活鱼!"}
|
||||
|
||||
var item = inventory[slot_index]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
if not _alive_to_cooked.has(vnum):
|
||||
return {"ok": false, "reason": "NOT_ALIVE_FISH", "msg": "此物品不是可以剖杀的鲜活鱼类!"}
|
||||
|
||||
var fish = _alive_to_cooked[vnum]
|
||||
# 扣减活鱼数量
|
||||
_consume_item_one(inventory, slot_index)
|
||||
|
||||
# 40250 原版随机概率 1~10000:
|
||||
# r >= 4001 (60%): 产出死鱼 (dead_vnum)
|
||||
# r >= 2001 (20%): 产出鱼骨 (FISH_BONE_VNUM 27995)
|
||||
# r < 2001 (20%): 肚中有物 (蚌壳 27987、饵料 27801 或失手滑入水中)
|
||||
var r = forced_roll if forced_roll > 0 else randi_range(1, 10000)
|
||||
|
||||
if r >= 4001:
|
||||
_give_or_stack_item(inventory, fish["dead_vnum"], 1)
|
||||
fish_gutted.emit("dead_fish", fish["dead_vnum"], "死" + fish["name"])
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "dead_fish",
|
||||
"vnum": fish["dead_vnum"],
|
||||
"name": "死" + fish["name"],
|
||||
"msg": "你熟练地宰杀了活鱼,获得了可用于烤制的死鱼。"
|
||||
}
|
||||
elif r >= 2001:
|
||||
_give_or_stack_item(inventory, VNUM_FISH_BONE, 1)
|
||||
fish_gutted.emit("fish_bone", VNUM_FISH_BONE, "鱼骨")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "fish_bone",
|
||||
"vnum": VNUM_FISH_BONE,
|
||||
"name": "鱼骨",
|
||||
"msg": "活鱼体内只剩下一截晶莹剔透的坚硬鱼骨。"
|
||||
}
|
||||
else:
|
||||
# r < 2001
|
||||
if r <= 1000:
|
||||
# 珍稀产出:珍珠蚌 (Clam 27987)
|
||||
_give_or_stack_item(inventory, VNUM_CLAM, 1)
|
||||
fish_gutted.emit("clam", VNUM_CLAM, "珍珠蚌")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "clam",
|
||||
"vnum": VNUM_CLAM,
|
||||
"name": "珍珠蚌",
|
||||
"msg": "难以置信!你在鱼肚中发现了一枚紧闭的神秘【珍珠蚌】!"
|
||||
}
|
||||
elif r <= 1500:
|
||||
_give_or_stack_item(inventory, VNUM_EARTHWORM, 1)
|
||||
fish_gutted.emit("earthworm", VNUM_EARTHWORM, "蚯蚓")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "earthworm",
|
||||
"vnum": VNUM_EARTHWORM,
|
||||
"name": "蚯蚓",
|
||||
"msg": "鱼肚里还残留着一条未消化的蚯蚓饵料。"
|
||||
}
|
||||
else:
|
||||
# 滑入水中/空
|
||||
fish_gutted.emit("escape", 0, "溜走")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "escape",
|
||||
"vnum": 0,
|
||||
"name": "",
|
||||
"msg": "活鱼猛烈扑腾,从你的指缝中滑落回了深水之中!"
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 2. 珍珠蚌开珠 (char_item.cpp:2965 Case 27987)
|
||||
# ==========================================
|
||||
func open_clam(
|
||||
inventory: Array,
|
||||
slot_index: int,
|
||||
forced_branch_roll: int = -1,
|
||||
forced_pearl_roll: int = -1
|
||||
) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格位没有物品!"}
|
||||
|
||||
var item = inventory[slot_index]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
if vnum != VNUM_CLAM:
|
||||
return {"ok": false, "reason": "NOT_A_CLAM", "msg": "该物品不是珍珠蚌!"}
|
||||
|
||||
# 消耗 1 枚珍珠蚌
|
||||
_consume_item_one(inventory, slot_index)
|
||||
|
||||
# 40250 官方第一轮分支 (1~100):
|
||||
# r <= 50 (50%): 碎石 (27990)
|
||||
# r > 50 (50%): 判定珍珠概率表 prob_table {80, 90, 97}
|
||||
var r = forced_branch_roll if forced_branch_roll > 0 else randi_range(1, 100)
|
||||
|
||||
if r <= 50:
|
||||
_give_or_stack_item(inventory, VNUM_STONE_PIECE, 1)
|
||||
clam_opened.emit("stone", VNUM_STONE_PIECE, "碎石")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "stone",
|
||||
"vnum": VNUM_STONE_PIECE,
|
||||
"name": "碎石",
|
||||
"msg": "珍珠蚌打开了,但里面只包裹着一块毫无价值的普通碎石。"
|
||||
}
|
||||
else:
|
||||
# 珍珠判定表 (1~100)
|
||||
# roll <= 80 (80%): 空蚌壳 (什么都没有)
|
||||
# 81 <= roll <= 90 (10%): 白珍珠 (27992)
|
||||
# 91 <= roll <= 97 (7%): 蓝珍珠 (27993)
|
||||
# roll >= 98 (3%): 血红珍珠 (27994)
|
||||
var p_roll = forced_pearl_roll if forced_pearl_roll > 0 else randi_range(1, 100)
|
||||
if p_roll <= 80:
|
||||
clam_opened.emit("empty", 0, "空蚌")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "empty",
|
||||
"vnum": 0,
|
||||
"name": "",
|
||||
"msg": "蚌壳碎裂开来,里面空空如也,什么也没有留下。"
|
||||
}
|
||||
elif p_roll <= 90:
|
||||
_give_or_stack_item(inventory, VNUM_WHITE_PEARL, 1)
|
||||
clam_opened.emit("white_pearl", VNUM_WHITE_PEARL, "白珍珠")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "white_pearl",
|
||||
"vnum": VNUM_WHITE_PEARL,
|
||||
"name": "白珍珠",
|
||||
"msg": "璀璨温润!你从蚌肉中剥出了一颗纯净的【白珍珠】!"
|
||||
}
|
||||
elif p_roll <= 97:
|
||||
_give_or_stack_item(inventory, VNUM_BLUE_PEARL, 1)
|
||||
clam_opened.emit("blue_pearl", VNUM_BLUE_PEARL, "蓝珍珠")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "blue_pearl",
|
||||
"vnum": VNUM_BLUE_PEARL,
|
||||
"name": "蓝珍珠",
|
||||
"msg": "幽蓝如海!你收获了一颗弥足珍贵的【蓝珍珠】!"
|
||||
}
|
||||
else:
|
||||
_give_or_stack_item(inventory, VNUM_BLOOD_PEARL, 1)
|
||||
clam_opened.emit("blood_pearl", VNUM_BLOOD_PEARL, "血红珍珠")
|
||||
return {
|
||||
"ok": true,
|
||||
"result": "blood_pearl",
|
||||
"vnum": VNUM_BLOOD_PEARL,
|
||||
"name": "血红珍珠",
|
||||
"msg": "旷世奇珍!蚌心处赫然闪烁着血煞夺目的极品【血红珍珠】!"
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 3. 篝火炙烤 (char_item.cpp:6880, fishing.cpp: Grill)
|
||||
# ==========================================
|
||||
func place_campfire(duration: float = 600.0) -> void:
|
||||
is_near_active_campfire = true
|
||||
campfire_time_left = duration
|
||||
campfire_spawned.emit(Vector2.ZERO, duration)
|
||||
|
||||
func grill_fish(inventory: Array, slot_index: int, near_campfire_override: bool = false) -> Dictionary:
|
||||
var can_grill = is_near_active_campfire or near_campfire_override
|
||||
if not can_grill:
|
||||
return {"ok": false, "reason": "NO_CAMPFIRE", "msg": "烤鱼必须在点燃的营火 (篝火) 旁进行!"}
|
||||
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格位没有鱼类!"}
|
||||
|
||||
var item = inventory[slot_index]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
var count = int(item.get("count", 1))
|
||||
|
||||
var fish_data = null
|
||||
if _dead_to_cooked.has(vnum):
|
||||
fish_data = _dead_to_cooked[vnum]
|
||||
elif _alive_to_cooked.has(vnum):
|
||||
fish_data = _alive_to_cooked[vnum]
|
||||
else:
|
||||
return {"ok": false, "reason": "NOT_GRILLABLE", "msg": "此物品无法用于篝火炙烤!"}
|
||||
|
||||
var cooked_vnum = int(fish_data["cooked_vnum"])
|
||||
# 40250 item->SetCount(0); AutoGiveItem(grill_vnum, count);
|
||||
inventory[slot_index] = null
|
||||
_give_or_stack_item(inventory, cooked_vnum, count)
|
||||
|
||||
fish_grilled.emit(vnum, cooked_vnum, count)
|
||||
return {
|
||||
"ok": true,
|
||||
"cooked_vnum": cooked_vnum,
|
||||
"count": count,
|
||||
"name": "烤" + fish_data["name"],
|
||||
"msg": "营火噼啪作响,鱼肉散发出浓郁扑鼻的焦香!你获得了 %d 条【烤%s】。" % [count, fish_data["name"]]
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 4. 食用熟鱼获得增益 (char_item.cpp: USE_POTION / USE_ABILITY_UP)
|
||||
# ==========================================
|
||||
func eat_cooked_fish(inventory: Array, slot_index: int) -> Dictionary:
|
||||
if slot_index < 0 or slot_index >= inventory.size() or inventory[slot_index] == null:
|
||||
return {"ok": false, "reason": "EMPTY_SLOT", "msg": "该格位没有熟鱼!"}
|
||||
|
||||
var item = inventory[slot_index]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
if not _cooked_to_data.has(vnum):
|
||||
return {"ok": false, "reason": "NOT_COOKED_FISH", "msg": "此物品不是烤制完成的熟鱼!"}
|
||||
|
||||
var data = _cooked_to_data[vnum]
|
||||
_consume_item_one(inventory, slot_index)
|
||||
|
||||
var effect = str(data["effect"])
|
||||
var val = int(data["value"])
|
||||
var dur = float(data["duration"])
|
||||
|
||||
if dur > 0.0:
|
||||
_active_buffs[effect] = {
|
||||
"value": val,
|
||||
"time_remaining": dur,
|
||||
"name": "烤" + data["name"]
|
||||
}
|
||||
|
||||
cooked_fish_consumed.emit(vnum, effect, val, dur)
|
||||
return {
|
||||
"ok": true,
|
||||
"effect": effect,
|
||||
"value": val,
|
||||
"duration": dur,
|
||||
"desc": data["desc"],
|
||||
"msg": "你大快朵颐地吃下了香喷喷的烤鱼,%s!" % data["desc"]
|
||||
}
|
||||
|
||||
func update(delta: float) -> void:
|
||||
if campfire_time_left > 0.0:
|
||||
campfire_time_left -= delta
|
||||
if campfire_time_left <= 0.0:
|
||||
campfire_time_left = 0.0
|
||||
is_near_active_campfire = false
|
||||
|
||||
# 更新 BUFF 持续倒计时
|
||||
var to_remove: Array = []
|
||||
for eff in _active_buffs.keys():
|
||||
var b = _active_buffs[eff]
|
||||
b["time_remaining"] -= delta
|
||||
if b["time_remaining"] <= 0.0:
|
||||
to_remove.append(eff)
|
||||
|
||||
for eff in to_remove:
|
||||
_active_buffs.erase(eff)
|
||||
|
||||
func get_active_buffs() -> Dictionary:
|
||||
return _active_buffs
|
||||
|
||||
func clear_buffs() -> void:
|
||||
_active_buffs.clear()
|
||||
|
||||
# ==========================================
|
||||
# 辅助函数: 背包堆叠与消耗
|
||||
# ==========================================
|
||||
func _consume_item_one(inventory: Array, slot: int) -> void:
|
||||
var item = inventory[slot]
|
||||
var count = int(item.get("count", 1))
|
||||
if count > 1:
|
||||
item["count"] = count - 1
|
||||
else:
|
||||
inventory[slot] = null
|
||||
|
||||
func _give_or_stack_item(inventory: Array, vnum: int, count: int) -> void:
|
||||
# 尝试堆叠
|
||||
for it in inventory:
|
||||
if it != null and int(it.get("vnum", 0)) == vnum:
|
||||
it["count"] = int(it.get("count", 1)) + count
|
||||
return
|
||||
# 寻找首个空槽
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {"vnum": vnum, "count": count}
|
||||
return
|
||||
# 若无空槽则追加
|
||||
inventory.append({"vnum": vnum, "count": count})
|
||||
|
||||
# 序列化与反序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"active_buffs": _active_buffs.duplicate(true),
|
||||
"campfire_time_left": campfire_time_left,
|
||||
"is_near_active_campfire": is_near_active_campfire
|
||||
}
|
||||
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
_active_buffs = data.get("active_buffs", {}).duplicate(true)
|
||||
campfire_time_left = float(data.get("campfire_time_left", 0.0))
|
||||
is_near_active_campfire = bool(data.get("is_near_active_campfire", false))
|
||||
@@ -1 +0,0 @@
|
||||
uid://d1lso6wx22xr2
|
||||
@@ -1,214 +0,0 @@
|
||||
# fishing_cooking_camp_system.gd —— Metin2 40250 野外钓鱼烹饪与生火露营增益系统 1:1
|
||||
# 对照 40250 服务端 fishing.cpp, char_item.cpp, affect.h
|
||||
class_name FishingCookingCampSystem
|
||||
extends RefCounted
|
||||
|
||||
signal campfire_lit(pos: Vector3, duration: float)
|
||||
signal campfire_extinguished()
|
||||
signal fish_cooked(raw_vnum: int, cooked_vnum: int, cooked_name: String)
|
||||
signal food_buff_applied(buff_id: String, buff_name: String, duration: float)
|
||||
signal food_buff_expired(buff_id: String)
|
||||
|
||||
const CAMPFIRE_KIT_VNUM := 27600 # 营火工具 (Campfire)
|
||||
const CAMPFIRE_DURATION := 300.0 # 营火持续 5 分钟
|
||||
const FOOD_BUFF_DURATION := 1800.0 # 食用增益 30 分钟 (1800 秒)
|
||||
|
||||
# 鱼类与烹饪食谱
|
||||
const RECIPES: Dictionary = {
|
||||
27802: { # 生鲤鱼 -> 烤鲤鱼
|
||||
"cooked_vnum": 27832,
|
||||
"cooked_name": "烤鲤鱼",
|
||||
"buff_id": "buff_grilled_carp",
|
||||
"stat_key": "max_hp",
|
||||
"stat_val": 1000,
|
||||
"desc": "最大生命上限 +1000,持续 30 分钟"
|
||||
},
|
||||
27803: { # 生草鱼 -> 烤草鱼
|
||||
"cooked_vnum": 27833,
|
||||
"cooked_name": "烤草鱼",
|
||||
"buff_id": "buff_grilled_grass_carp",
|
||||
"stat_key": "move_speed",
|
||||
"stat_val": 15,
|
||||
"desc": "移动速度 +15,持续 30 分钟"
|
||||
},
|
||||
27815: { # 生红鳟鱼 -> 烤红鳟鱼
|
||||
"cooked_vnum": 27845,
|
||||
"cooked_name": "烤红鳟鱼",
|
||||
"buff_id": "buff_grilled_trout",
|
||||
"stat_key": "atk",
|
||||
"stat_val": 50,
|
||||
"desc": "攻击力 +50,持续 30 分钟"
|
||||
}
|
||||
}
|
||||
|
||||
# 烤鱼物品映射
|
||||
const COOKED_FOODS: Dictionary = {
|
||||
27832: {"buff_id": "buff_grilled_carp", "name": "烤鲤鱼", "stat_key": "max_hp", "stat_val": 1000},
|
||||
27833: {"buff_id": "buff_grilled_grass_carp", "name": "烤草鱼", "stat_key": "move_speed", "stat_val": 15},
|
||||
27845: {"buff_id": "buff_grilled_trout", "name": "烤红鳟鱼", "stat_key": "atk", "stat_val": 50}
|
||||
}
|
||||
|
||||
var is_campfire_active: bool = false
|
||||
var campfire_timer: float = 0.0
|
||||
var campfire_pos: Vector3 = Vector3.ZERO
|
||||
|
||||
# 活跃中的食物 Buff: buff_id -> { "remaining": float, "stat_key": String, "stat_val": int }
|
||||
var active_buffs: Dictionary = {}
|
||||
|
||||
# 点燃野外营火
|
||||
func light_campfire(pos: Vector3, inventory: Array) -> Dictionary:
|
||||
var kit_slot = -1
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) == CAMPFIRE_KIT_VNUM:
|
||||
kit_slot = i
|
||||
break
|
||||
|
||||
if kit_slot == -1:
|
||||
return {"ok": false, "reason": "NO_CAMPFIRE_KIT", "msg": "背包中没有【营火工具】(27600)!"}
|
||||
|
||||
# 消耗 1 个营火工具
|
||||
var item = inventory[kit_slot]
|
||||
var cnt = int(item.get("count", 1))
|
||||
if cnt > 1:
|
||||
item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[kit_slot] = null
|
||||
|
||||
is_campfire_active = true
|
||||
campfire_timer = CAMPFIRE_DURATION
|
||||
campfire_pos = pos
|
||||
|
||||
campfire_lit.emit(pos, CAMPFIRE_DURATION)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"pos": pos,
|
||||
"duration": CAMPFIRE_DURATION,
|
||||
"msg": "营火已点燃!散发着温暖火光,可在此烧烤烹饪渔获!"
|
||||
}
|
||||
|
||||
# 在营火旁烹饪烤鱼
|
||||
func cook_fish(slot: int, inventory: Array) -> Dictionary:
|
||||
if not is_campfire_active:
|
||||
return {"ok": false, "reason": "NO_ACTIVE_CAMPFIRE", "msg": "周围没有生起的营火,无法烹饪!"}
|
||||
|
||||
if slot < 0 or slot >= inventory.size() or inventory[slot] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var raw_item = inventory[slot]
|
||||
var raw_vnum = int(raw_item.get("vnum", 0))
|
||||
|
||||
if not RECIPES.has(raw_vnum):
|
||||
return {"ok": false, "reason": "NOT_COOKABLE", "msg": "此物品无法在营火上烹饪!"}
|
||||
|
||||
var r = RECIPES[raw_vnum]
|
||||
# 消耗 1 条生鱼
|
||||
var cnt = int(raw_item.get("count", 1))
|
||||
if cnt > 1:
|
||||
raw_item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[slot] = null
|
||||
|
||||
# 入包烤鱼
|
||||
var cooked_vnum: int = r["cooked_vnum"]
|
||||
var cooked_name: String = r["cooked_name"]
|
||||
|
||||
# 寻找可叠加的空格或同类
|
||||
var placed := false
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] != null and int(inventory[i].get("vnum", 0)) == cooked_vnum:
|
||||
inventory[i]["count"] = int(inventory[i].get("count", 1)) + 1
|
||||
placed = true
|
||||
break
|
||||
|
||||
if not placed:
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {
|
||||
"vnum": cooked_vnum,
|
||||
"name": cooked_name,
|
||||
"count": 1
|
||||
}
|
||||
placed = true
|
||||
break
|
||||
|
||||
fish_cooked.emit(raw_vnum, cooked_vnum, cooked_name)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"cooked_name": cooked_name,
|
||||
"desc": r["desc"],
|
||||
"msg": "滋滋作响!成功烤制出色香味俱全的【%s】!" % cooked_name
|
||||
}
|
||||
|
||||
# 食用烤鱼获得 30 分钟强力 Buff
|
||||
func eat_cooked_fish(slot: int, inventory: Array, player_data: Dictionary) -> Dictionary:
|
||||
if slot < 0 or slot >= inventory.size() or inventory[slot] == null:
|
||||
return {"ok": false, "reason": "INVALID_SLOT"}
|
||||
|
||||
var item = inventory[slot]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
|
||||
if not COOKED_FOODS.has(vnum):
|
||||
return {"ok": false, "reason": "NOT_EDIBLE_COOKED_FISH"}
|
||||
|
||||
var cfg = COOKED_FOODS[vnum]
|
||||
var bid: String = cfg["buff_id"]
|
||||
var stat_k: String = cfg["stat_key"]
|
||||
var stat_v: int = cfg["stat_val"]
|
||||
|
||||
# 消耗 1 条烤鱼
|
||||
var cnt = int(item.get("count", 1))
|
||||
if cnt > 1:
|
||||
item["count"] = cnt - 1
|
||||
else:
|
||||
inventory[slot] = null
|
||||
|
||||
# 如果已有同类 Buff,先刷新时长并避免重复叠加属性
|
||||
if active_buffs.has(bid):
|
||||
active_buffs[bid]["remaining"] = FOOD_BUFF_DURATION
|
||||
else:
|
||||
player_data[stat_k] = int(player_data.get(stat_k, 0)) + stat_v
|
||||
active_buffs[bid] = {
|
||||
"remaining": FOOD_BUFF_DURATION,
|
||||
"stat_key": stat_k,
|
||||
"stat_val": stat_v,
|
||||
"name": cfg["name"]
|
||||
}
|
||||
|
||||
food_buff_applied.emit(bid, cfg["name"], FOOD_BUFF_DURATION)
|
||||
|
||||
return {
|
||||
"ok": true,
|
||||
"buff_id": bid,
|
||||
"buff_name": cfg["name"],
|
||||
"stat_key": stat_k,
|
||||
"stat_val": stat_v,
|
||||
"current_stat": player_data[stat_k],
|
||||
"msg": "品尝了美味的【%s】!精神焕发,获得了【%s +%d】持续 30 分钟!" % [cfg["name"], stat_k, stat_v]
|
||||
}
|
||||
|
||||
# 帧心跳更新营火与食物 Buff
|
||||
func update(delta: float, player_data: Dictionary) -> void:
|
||||
# 营火计时
|
||||
if is_campfire_active:
|
||||
campfire_timer -= delta
|
||||
if campfire_timer <= 0.0:
|
||||
is_campfire_active = false
|
||||
campfire_extinguished.emit()
|
||||
|
||||
# 食物 Buff 计时与过期反扣
|
||||
var expired_ids := []
|
||||
for bid in active_buffs.keys():
|
||||
var b = active_buffs[bid]
|
||||
b["remaining"] -= delta
|
||||
if b["remaining"] <= 0.0:
|
||||
expired_ids.append(bid)
|
||||
|
||||
for bid in expired_ids:
|
||||
var b = active_buffs[bid]
|
||||
var stat_k = b["stat_key"]
|
||||
var stat_v = b["stat_val"]
|
||||
player_data[stat_k] = max(0, int(player_data.get(stat_k, 0)) - stat_v)
|
||||
active_buffs.erase(bid)
|
||||
food_buff_expired.emit(bid)
|
||||
@@ -1 +0,0 @@
|
||||
uid://bl0claww12l2
|
||||
@@ -1,213 +0,0 @@
|
||||
# fishing_mining_system.gd —— 钓鱼与采矿休闲生活系统(40250 官方 1:1 对齐)
|
||||
# 对齐源码:
|
||||
# - 40250 server/game/src/fishing.cpp:180-360 (钓竿、鱼饵、钓鱼状态机、开鱼与蚌壳珍珠)
|
||||
# - 40250 server/game/src/mining.cpp:50-180 (矿镐、矿脉 NPC、采矿倒计时与原石产出)
|
||||
class_name FishingMiningSystem
|
||||
extends RefCounted
|
||||
|
||||
# 核心道具 Vnum 常量
|
||||
const VNUM_ROD_BASE := 27400 # 钓竿 +0
|
||||
const VNUM_BAIT_EARTHWORM := 27800 # 鱼饵 (蚯蚓)
|
||||
const VNUM_BAIT_PASTE := 27801 # 鱼饵 (面团)
|
||||
|
||||
const VNUM_FISHBONE := 27990 # 鱼骨
|
||||
const VNUM_CLAM := 27987 # 蚌壳
|
||||
const VNUM_STONE_PIECE := 27991 # 碎石片
|
||||
const VNUM_WHITE_PEARL := 27992 # 白珍珠
|
||||
const VNUM_BLUE_PEARL := 27993 # 蓝珍珠
|
||||
const VNUM_BLOOD_PEARL := 27994 # 血红珍珠
|
||||
|
||||
const VNUM_PICKAXE_BASE := 29101 # 矿镐 +0
|
||||
|
||||
# 经典鱼类列表
|
||||
const FISH_TABLE := [
|
||||
{"vnum": 27802, "name": "金鲫鱼"},
|
||||
{"vnum": 27803, "name": "鲤鱼"},
|
||||
{"vnum": 27804, "name": "鲑鱼"},
|
||||
{"vnum": 27805, "name": "鳟鱼"},
|
||||
{"vnum": 27806, "name": "鲶鱼"},
|
||||
]
|
||||
|
||||
# 矿脉 NPC 与对应原石产出表 (40250 mining.cpp)
|
||||
const VEIN_TABLE := {
|
||||
20047: {"name": "钻石矿脉", "ore_vnum": 50601, "ore_name": "钻石原石"},
|
||||
20048: {"name": "琥珀矿脉", "ore_vnum": 50602, "ore_name": "琥珀原石"},
|
||||
20049: {"name": "化石木", "ore_vnum": 50603, "ore_name": "化石原石"},
|
||||
20050: {"name": "铜矿脉", "ore_vnum": 50604, "ore_name": "铜原石"},
|
||||
20051: {"name": "银矿脉", "ore_vnum": 50605, "ore_name": "银原石"},
|
||||
20052: {"name": "金矿脉", "ore_vnum": 50606, "ore_name": "金原石"},
|
||||
20053: {"name": "玉矿脉", "ore_vnum": 50607, "ore_name": "玉原石"},
|
||||
20054: {"name": "黑檀木", "ore_vnum": 50608, "ore_name": "黑檀原石"},
|
||||
20055: {"name": "珍珠矿脉", "ore_vnum": 50609, "ore_name": "珍珠原石"},
|
||||
20056: {"name": "白金矿脉", "ore_vnum": 50610, "ore_name": "白金原石"},
|
||||
20057: {"name": "水晶矿脉", "ore_vnum": 50611, "ore_name": "水晶原石"},
|
||||
20058: {"name": "紫晶矿脉", "ore_vnum": 50612, "ore_name": "紫晶原石"},
|
||||
20059: {"name": "天堂泪矿脉", "ore_vnum": 50613, "ore_name": "天堂泪原石"},
|
||||
}
|
||||
|
||||
# --- 钓鱼系统 ---
|
||||
|
||||
## 检查物品是否为钓竿
|
||||
static func is_fishing_rod(vnum: int) -> bool:
|
||||
return vnum >= 27400 and vnum <= 27590
|
||||
|
||||
## 检查物品是否为鱼饵
|
||||
static func is_bait(vnum: int) -> bool:
|
||||
return vnum == VNUM_BAIT_EARTHWORM or vnum == VNUM_BAIT_PASTE
|
||||
|
||||
## 检查是否为鲜鱼
|
||||
static func is_live_fish(vnum: int) -> bool:
|
||||
return vnum >= 27802 and vnum <= 27832
|
||||
|
||||
## 检查是否为蚌壳
|
||||
static func is_clam(vnum: int) -> bool:
|
||||
return vnum == VNUM_CLAM
|
||||
|
||||
## 钓鱼判定 (40250 fishing.cpp:210)
|
||||
## has_bait: 是否已挂饵; rod_level: 钓竿等级 (0..9)
|
||||
static func perform_fishing(has_bait: bool, rod_level := 0, force_success := false) -> Dictionary:
|
||||
if not has_bait:
|
||||
return {"ok": false, "code": "NO_BAIT", "msg": "钓钩上没有鱼饵,无法钓鱼!"}
|
||||
|
||||
# 40250 基础钓鱼成功率:40% + 钓竿等级 * 3%
|
||||
var base_rate := 40 + rod_level * 3
|
||||
var roll := 0 if force_success else (randi() % 100 + 1)
|
||||
|
||||
if not force_success and roll > base_rate:
|
||||
return {
|
||||
"ok": false,
|
||||
"code": "FISH_ESCAPED",
|
||||
"consumed_bait": true,
|
||||
"msg": "鱼饵被咬走了,但鱼溜掉了!"
|
||||
}
|
||||
|
||||
# 成功钓上鲜鱼
|
||||
var fish_idx := randi() % FISH_TABLE.size()
|
||||
var fish: Dictionary = FISH_TABLE[fish_idx]
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "SUCCESS",
|
||||
"consumed_bait": true,
|
||||
"fish_vnum": fish["vnum"],
|
||||
"fish_name": fish["name"],
|
||||
"msg": "钓上了一条活蹦乱跳的【%s】!" % fish["name"]
|
||||
}
|
||||
|
||||
## 打开鲜鱼 (40250 fishing.cpp:330)
|
||||
## 鲜鱼开出:死鱼 (50%)、鱼骨 27990 (30%)、蚌壳 27987 (10%)、滑落逃脱 (10%)
|
||||
static func open_live_fish(fish_vnum: int) -> Dictionary:
|
||||
var roll := randi() % 100
|
||||
if roll < 50:
|
||||
# 获得死鱼(死鱼 Vnum = 活鱼 + 31)
|
||||
var dead_vnum := fish_vnum + 31
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "DEAD_FISH",
|
||||
"result_vnum": dead_vnum,
|
||||
"msg": "得到了一条死鱼,可以在篝火上烤熟食用。"
|
||||
}
|
||||
elif roll < 80:
|
||||
# 获得鱼骨 (精炼核心材料)
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "FISHBONE",
|
||||
"result_vnum": VNUM_FISHBONE,
|
||||
"msg": "剖开鲜鱼,在鱼肚里找到了一根坚硬的【鱼骨】!"
|
||||
}
|
||||
elif roll < 90:
|
||||
# 获得珍贵蚌壳
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "CLAM",
|
||||
"result_vnum": VNUM_CLAM,
|
||||
"msg": "不可思议!在鱼肚里发现了一个紧闭的【蚌壳】!"
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"ok": false,
|
||||
"code": "ESCAPED",
|
||||
"msg": "鲜鱼一摆尾巴跳进水里溜走了!"
|
||||
}
|
||||
|
||||
## 打开蚌壳 (40250 fishing.cpp 蚌壳产出珍珠算法)
|
||||
## 碎石 (50%)、白珍珠 27992 (25%)、蓝珍珠 27993 (15%)、血红珍珠 27994 (10%)
|
||||
static func open_clam(force_pearl_type := 0) -> Dictionary:
|
||||
if force_pearl_type > 0:
|
||||
var pname := "白珍珠" if force_pearl_type == VNUM_WHITE_PEARL else ("蓝珍珠" if force_pearl_type == VNUM_BLUE_PEARL else "血红珍珠")
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "PEARL",
|
||||
"result_vnum": force_pearl_type,
|
||||
"msg": "蚌壳里散发着璀璨光芒,开出了珍稀的【%s】!" % pname
|
||||
}
|
||||
|
||||
var roll := randi() % 100
|
||||
if roll < 50:
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "STONE",
|
||||
"result_vnum": VNUM_STONE_PIECE,
|
||||
"msg": "蚌壳里只有一块无用的碎石片。"
|
||||
}
|
||||
elif roll < 75:
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "PEARL",
|
||||
"result_vnum": VNUM_WHITE_PEARL,
|
||||
"msg": "蚌壳里开出了一颗温润光泽的【白珍珠】!"
|
||||
}
|
||||
elif roll < 90:
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "PEARL",
|
||||
"result_vnum": VNUM_BLUE_PEARL,
|
||||
"msg": "蚌壳里开出了一颗幽蓝剔透的【蓝珍珠】!"
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "PEARL",
|
||||
"result_vnum": VNUM_BLOOD_PEARL,
|
||||
"msg": "天赐奇宝!蚌壳里开出了一颗极品【血红珍珠】!"
|
||||
}
|
||||
|
||||
# --- 采矿系统 ---
|
||||
|
||||
## 检查是否为矿镐
|
||||
static func is_pickaxe(vnum: int) -> bool:
|
||||
return vnum >= 29101 and vnum <= 29110
|
||||
|
||||
## 检查 NPC 是否为矿脉
|
||||
static func is_vein(npc_vnum: int) -> bool:
|
||||
return VEIN_TABLE.has(npc_vnum)
|
||||
|
||||
## 获取矿脉信息
|
||||
static func get_vein_info(npc_vnum: int) -> Dictionary:
|
||||
return VEIN_TABLE.get(npc_vnum, {})
|
||||
|
||||
## 采矿判定 (40250 mining.cpp:85)
|
||||
## pickaxe_level: 矿镐等级 (0..9)
|
||||
static func perform_mining(vein_vnum: int, pickaxe_level := 0, force_success := false) -> Dictionary:
|
||||
if not is_vein(vein_vnum):
|
||||
return {"ok": false, "code": "NOT_A_VEIN", "msg": "目标不是有效的矿脉!"}
|
||||
|
||||
var vein: Dictionary = VEIN_TABLE[vein_vnum]
|
||||
var base_rate := 35 + pickaxe_level * 4
|
||||
var roll := 0 if force_success else (randi() % 100 + 1)
|
||||
|
||||
if not force_success and roll > base_rate:
|
||||
return {
|
||||
"ok": false,
|
||||
"code": "MINING_FAIL",
|
||||
"msg": "用力敲击了矿脉,但没有采集到有效矿石。"
|
||||
}
|
||||
|
||||
var count := 1 + (randi() % 3) # 1..3 个原石
|
||||
return {
|
||||
"ok": true,
|
||||
"code": "SUCCESS",
|
||||
"ore_vnum": vein["ore_vnum"],
|
||||
"ore_name": vein["ore_name"],
|
||||
"count": count,
|
||||
"msg": "成功从【%s】采集到了 %d 个【%s】!" % [vein["name"], count, vein["ore_name"]]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://ceequyq2hytjy
|
||||
@@ -1,307 +0,0 @@
|
||||
# fishing_rod_reel_system.gd —— Metin2 40250 官方钓鱼抛竿拉杆与浮漂反应小游戏机制 1:1
|
||||
# 100% 对照 40250 服务端 fishing.cpp (CreateFishingEvent, Take, FishingPractice, RealRefineRod), fishing.h
|
||||
class_name FishingRodReelSystem
|
||||
extends RefCounted
|
||||
|
||||
signal line_cast(rod_level: int, bait_name: String)
|
||||
signal fish_bite(reaction_time_window: float)
|
||||
signal fish_caught(fish_vnum: int, fish_name: String, fish_length_cm: float, practice_points: int)
|
||||
signal fish_escaped(reason: String, practice_points: int)
|
||||
signal rod_refined(new_vnum: int, success: bool, new_level: int)
|
||||
signal fishing_error(reason: String)
|
||||
|
||||
# 40250 官方钓竿 Vnum (27400 基础钓鱼竿+0 ~ 27500 +9)
|
||||
const BASE_ROD_VNUM := 27400 # 钓鱼竿+0
|
||||
const MAX_ROD_LEVEL := 9
|
||||
|
||||
# 40250 官方饵料 Vnum
|
||||
const VNUM_PASTE := 27800 # 鱼饵面团 (Paste)
|
||||
const VNUM_EARTHWORM := 27801 # 蚯蚓 (Earthworm)
|
||||
|
||||
# 40250 渔夫 NPC
|
||||
const NPC_FISHERMAN := 9009
|
||||
|
||||
# 钓竿进阶最大熟练度点数表与成功率 (对照 item_proto Value(2) 与 Value(3))
|
||||
const ROD_LEVEL_DATA: Dictionary = {
|
||||
0: {"max_points": 10, "refine_chance": 100, "base_catch_rate": 0.50},
|
||||
1: {"max_points": 20, "refine_chance": 90, "base_catch_rate": 0.55},
|
||||
2: {"max_points": 40, "refine_chance": 80, "base_catch_rate": 0.60},
|
||||
3: {"max_points": 80, "refine_chance": 70, "base_catch_rate": 0.65},
|
||||
4: {"max_points": 120, "refine_chance": 60, "base_catch_rate": 0.70},
|
||||
5: {"max_points": 160, "refine_chance": 50, "base_catch_rate": 0.75},
|
||||
6: {"max_points": 200, "refine_chance": 40, "base_catch_rate": 0.80},
|
||||
7: {"max_points": 250, "refine_chance": 30, "base_catch_rate": 0.85},
|
||||
8: {"max_points": 300, "refine_chance": 20, "base_catch_rate": 0.90},
|
||||
9: {"max_points": 350, "refine_chance": 10, "base_catch_rate": 0.95}
|
||||
}
|
||||
|
||||
# 常见垂钓渔获池 (对照 fishing.cpp)
|
||||
const CATCH_POOL: Array[Dictionary] = [
|
||||
{"vnum": 27803, "name": "鲈鱼 (Sudak)", "min_len": 15.0, "max_len": 35.0, "weight": 35},
|
||||
{"vnum": 27806, "name": "鲤鱼 (Sazan)", "min_len": 25.0, "max_len": 65.0, "weight": 25},
|
||||
{"vnum": 27808, "name": "草鱼 (Ot Sazanı)", "min_len": 20.0, "max_len": 55.0, "weight": 20},
|
||||
{"vnum": 27810, "name": "水针鱼 (Zargana)", "min_len": 30.0, "max_len": 70.0, "weight": 10},
|
||||
{"vnum": 27817, "name": "泥鳅 (Çopra)", "min_len": 8.0, "max_len": 18.0, "weight": 5},
|
||||
{"vnum": 70201, "name": "漂白水 (Bleach)", "min_len": 0.0, "max_len": 0.0, "weight": 3},
|
||||
{"vnum": 27987, "name": "珍稀珍珠蚌 (Clam)", "min_len": 5.0, "max_len": 12.0, "weight": 2}
|
||||
]
|
||||
|
||||
# 当前垂钓状态
|
||||
var is_fishing: bool = false
|
||||
var has_bait: bool = false
|
||||
var current_bait_vnum: int = 0
|
||||
|
||||
var rod_level: int = 0
|
||||
var rod_practice_points: int = 0
|
||||
|
||||
var bite_timer: float = 0.0
|
||||
var is_bite_active: bool = false
|
||||
var bite_reaction_time_left: float = 0.0
|
||||
const REACTION_WINDOW_SECONDS := 3.0 # 3 秒拉杆反应时间窗口
|
||||
|
||||
# ==========================================
|
||||
# 1. 挂饵与抛竿 (fishing.cpp: CreateFishingEvent)
|
||||
# ==========================================
|
||||
|
||||
# 穿戴/设定当前鱼竿
|
||||
func equip_rod(level: int, current_points: int = 0) -> void:
|
||||
rod_level = clamp(level, 0, MAX_ROD_LEVEL)
|
||||
var max_p = ROD_LEVEL_DATA[rod_level]["max_points"]
|
||||
rod_practice_points = clamp(current_points, 0, max_p)
|
||||
|
||||
# 挂上鱼饵 (面团 27800 或 蚯蚓 27801)
|
||||
func attach_bait(inventory: Array, bait_slot: int) -> Dictionary:
|
||||
if is_fishing:
|
||||
fishing_error.emit("ALREADY_FISHING")
|
||||
return {"ok": false, "reason": "ALREADY_FISHING", "msg": "正在垂钓中,无法更换鱼饵!"}
|
||||
|
||||
if bait_slot < 0 or bait_slot >= inventory.size() or inventory[bait_slot] == null:
|
||||
fishing_error.emit("INVALID_SLOT")
|
||||
return {"ok": false, "reason": "INVALID_SLOT", "msg": "未找到指定的鱼饵!"}
|
||||
|
||||
var item = inventory[bait_slot]
|
||||
var vnum = int(item.get("vnum", 0))
|
||||
if vnum != VNUM_PASTE and vnum != VNUM_EARTHWORM:
|
||||
fishing_error.emit("NOT_BAIT")
|
||||
return {"ok": false, "reason": "NOT_BAIT", "msg": "该物品无法作为鱼饵挂在鱼钩上!"}
|
||||
|
||||
_consume_item_one(inventory, bait_slot)
|
||||
has_bait = true
|
||||
current_bait_vnum = vnum
|
||||
var bait_name = "鱼饵面团" if vnum == VNUM_PASTE else "蚯蚓"
|
||||
return {"ok": true, "bait_vnum": vnum, "bait_name": bait_name, "msg": "将【%s】小心地挂在了鱼钩上。" % bait_name}
|
||||
|
||||
# 抛竿垂钓
|
||||
func cast_line(forced_wait_time: float = -1.0) -> Dictionary:
|
||||
if not has_bait:
|
||||
fishing_error.emit("NO_BAIT")
|
||||
return {"ok": false, "reason": "NO_BAIT", "msg": "鱼钩上空无一物!请先挂上蚯蚓或面团饵料。"}
|
||||
|
||||
if is_fishing:
|
||||
fishing_error.emit("ALREADY_FISHING")
|
||||
return {"ok": false, "reason": "ALREADY_FISHING", "msg": "钓线已经抛入水中,静候鱼儿上钩。"}
|
||||
|
||||
is_fishing = true
|
||||
is_bite_active = false
|
||||
has_bait = false # 抛竿时消耗鱼钩上的鱼饵
|
||||
|
||||
# 40250 等待上钩时间: 2~7 秒
|
||||
bite_timer = forced_wait_time if forced_wait_time > 0.0 else randf_range(2.0, 7.0)
|
||||
bite_reaction_time_left = 0.0
|
||||
|
||||
var bait_name = "鱼饵面团" if current_bait_vnum == VNUM_PASTE else "蚯蚓"
|
||||
line_cast.emit(rod_level, bait_name)
|
||||
return {"ok": true, "msg": "钓竿轻扬,鱼线带着微澜划破水面,沉入了平静的湖心……"}
|
||||
|
||||
# ==========================================
|
||||
# 2. 反应窗口拉杆提竿 (fishing.cpp: Take)
|
||||
# ==========================================
|
||||
func pull_rod(inventory: Array, forced_catch_idx: int = -1, forced_success: bool = false) -> Dictionary:
|
||||
if not is_fishing:
|
||||
fishing_error.emit("NOT_FISHING")
|
||||
return {"ok": false, "reason": "NOT_FISHING", "msg": "你并未处于垂钓状态!"}
|
||||
|
||||
var max_p = ROD_LEVEL_DATA[rod_level]["max_points"]
|
||||
|
||||
# 提前起竿 (鱼儿未咬钩)
|
||||
if not is_bite_active:
|
||||
is_fishing = false
|
||||
bite_timer = 0.0
|
||||
# 哪怕失败亦获得 1 点熟练度练习 (FishingPractice)
|
||||
if rod_practice_points < max_p:
|
||||
rod_practice_points += 1
|
||||
fish_escaped.emit("PULLED_TOO_EARLY", rod_practice_points)
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "PULLED_TOO_EARLY",
|
||||
"practice_points": rod_practice_points,
|
||||
"msg": "起竿太早了!鱼钩划破空荡荡的水面,鱼饵不翼而飞。"
|
||||
}
|
||||
|
||||
# 鱼已咬钩:计算捕获概率
|
||||
is_fishing = false
|
||||
is_bite_active = false
|
||||
|
||||
# 熟练度 +1
|
||||
if rod_practice_points < max_p:
|
||||
rod_practice_points += 1
|
||||
|
||||
var base_rate = float(ROD_LEVEL_DATA[rod_level]["base_catch_rate"])
|
||||
if current_bait_vnum == VNUM_EARTHWORM:
|
||||
base_rate += 0.05 # 蚯蚓比面团成功率多 5%
|
||||
|
||||
var roll = randf()
|
||||
var success = (roll <= base_rate) or forced_success
|
||||
|
||||
if success:
|
||||
# 捕获成功:从鱼池选取
|
||||
var picked_fish: Dictionary = {}
|
||||
if forced_catch_idx >= 0 and forced_catch_idx < CATCH_POOL.size():
|
||||
picked_fish = CATCH_POOL[forced_catch_idx]
|
||||
else:
|
||||
var total_w := 0
|
||||
for f in CATCH_POOL:
|
||||
total_w += int(f["weight"])
|
||||
var r = randi_range(1, total_w)
|
||||
var cur := 0
|
||||
for f in CATCH_POOL:
|
||||
cur += int(f["weight"])
|
||||
if r <= cur:
|
||||
picked_fish = f
|
||||
break
|
||||
|
||||
var fish_vnum = int(picked_fish["vnum"])
|
||||
var fish_name = str(picked_fish["name"])
|
||||
var length_cm = randf_range(float(picked_fish["min_len"]), float(picked_fish["max_len"]))
|
||||
|
||||
_give_or_stack_item(inventory, fish_vnum, 1)
|
||||
fish_caught.emit(fish_vnum, fish_name, length_cm, rod_practice_points)
|
||||
return {
|
||||
"ok": true,
|
||||
"fish_vnum": fish_vnum,
|
||||
"fish_name": fish_name,
|
||||
"length_cm": length_cm,
|
||||
"practice_points": rod_practice_points,
|
||||
"msg": "水花四溅!你收紧鱼线,成功钓上了一条 %.1f cm 的【%s】!" % [length_cm, fish_name]
|
||||
}
|
||||
else:
|
||||
# 挣脱脱钩
|
||||
fish_escaped.emit("FISH_GOT_AWAY", rod_practice_points)
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "FISH_GOT_AWAY",
|
||||
"practice_points": rod_practice_points,
|
||||
"msg": "大鱼猛烈摆尾,挣脱鱼钩游回了深水,只留下一串水泡……"
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 3. 渔夫 NPC 鱼竿升星锻造 (fishing.cpp: RealRefineRod)
|
||||
# ==========================================
|
||||
func can_refine_rod() -> bool:
|
||||
if rod_level >= MAX_ROD_LEVEL:
|
||||
return false
|
||||
var max_p = ROD_LEVEL_DATA[rod_level]["max_points"]
|
||||
return rod_practice_points >= max_p
|
||||
|
||||
func refine_rod_at_fisherman(forced_roll: int = -1) -> Dictionary:
|
||||
if not can_refine_rod():
|
||||
fishing_error.emit("PRACTICE_NOT_MAXED")
|
||||
return {
|
||||
"ok": false,
|
||||
"reason": "PRACTICE_NOT_MAXED",
|
||||
"msg": "鱼竿熟练度尚未练满!需要 %d/%d 熟练度点数方可前往渔夫处升级。" % [
|
||||
rod_practice_points, ROD_LEVEL_DATA[rod_level]["max_points"]
|
||||
]
|
||||
}
|
||||
|
||||
var chance = int(ROD_LEVEL_DATA[rod_level]["refine_chance"])
|
||||
var r = forced_roll if forced_roll > 0 else randi_range(1, 100)
|
||||
|
||||
if r <= chance:
|
||||
# 锻造升级成功
|
||||
rod_level += 1
|
||||
rod_practice_points = 0
|
||||
var new_vnum = BASE_ROD_VNUM + rod_level
|
||||
rod_refined.emit(new_vnum, true, rod_level)
|
||||
return {
|
||||
"ok": true,
|
||||
"success": true,
|
||||
"new_level": rod_level,
|
||||
"new_vnum": new_vnum,
|
||||
"msg": "渔夫巧手翻飞,金光闪烁!你的钓鱼竿成功进阶为【钓鱼竿+%d】!" % rod_level
|
||||
}
|
||||
else:
|
||||
# 锻造失败:降 1 级 (40250 官方机制)
|
||||
rod_level = max(0, rod_level - 1)
|
||||
rod_practice_points = 0
|
||||
var new_vnum = BASE_ROD_VNUM + rod_level
|
||||
rod_refined.emit(new_vnum, false, rod_level)
|
||||
return {
|
||||
"ok": true,
|
||||
"success": false,
|
||||
"new_level": rod_level,
|
||||
"new_vnum": new_vnum,
|
||||
"msg": "精炼失败了!鱼竿受损,品质降为了【钓鱼竿+%d】。" % rod_level
|
||||
}
|
||||
|
||||
# ==========================================
|
||||
# 4. 心跳推进与超时判定
|
||||
# ==========================================
|
||||
func update(delta: float) -> void:
|
||||
if not is_fishing:
|
||||
return
|
||||
|
||||
if not is_bite_active:
|
||||
# 等待鱼咬钩
|
||||
bite_timer -= delta
|
||||
if bite_timer <= 0.0:
|
||||
is_bite_active = true
|
||||
bite_reaction_time_left = REACTION_WINDOW_SECONDS
|
||||
fish_bite.emit(REACTION_WINDOW_SECONDS)
|
||||
else:
|
||||
# 鱼咬钩等待提竿窗口
|
||||
bite_reaction_time_left -= delta
|
||||
if bite_reaction_time_left <= 0.0:
|
||||
# 超时逃跑
|
||||
is_fishing = false
|
||||
is_bite_active = false
|
||||
var max_p = ROD_LEVEL_DATA[rod_level]["max_points"]
|
||||
if rod_practice_points < max_p:
|
||||
rod_practice_points += 1
|
||||
fish_escaped.emit("REACTION_TIMEOUT", rod_practice_points)
|
||||
|
||||
func _consume_item_one(inventory: Array, slot: int) -> void:
|
||||
if slot < 0 or slot >= inventory.size() or inventory[slot] == null:
|
||||
return
|
||||
var item = inventory[slot]
|
||||
var count = int(item.get("count", 1))
|
||||
if count > 1:
|
||||
item["count"] = count - 1
|
||||
else:
|
||||
inventory[slot] = null
|
||||
|
||||
func _give_or_stack_item(inventory: Array, vnum: int, count: int) -> void:
|
||||
for it in inventory:
|
||||
if it != null and int(it.get("vnum", 0)) == vnum:
|
||||
it["count"] = int(it.get("count", 1)) + count
|
||||
return
|
||||
for i in range(inventory.size()):
|
||||
if inventory[i] == null:
|
||||
inventory[i] = {"vnum": vnum, "count": count}
|
||||
return
|
||||
inventory.append({"vnum": vnum, "count": count})
|
||||
|
||||
# 序列化与反序列化
|
||||
func serialize() -> Dictionary:
|
||||
return {
|
||||
"rod_level": rod_level,
|
||||
"rod_practice_points": rod_practice_points,
|
||||
"has_bait": has_bait,
|
||||
"current_bait_vnum": current_bait_vnum
|
||||
}
|
||||
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
rod_level = int(data.get("rod_level", 0))
|
||||
rod_practice_points = int(data.get("rod_practice_points", 0))
|
||||
has_bait = bool(data.get("has_bait", false))
|
||||
current_bait_vnum = int(data.get("current_bait_vnum", 0))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user