From 3853760c344d2b0f4b294b334a3ee8447122f6bc Mon Sep 17 00:00:00 2001 From: CAtlas0784 Date: Fri, 18 Sep 2026 00:04:05 +0700 Subject: [PATCH] feat(core): unlock map fog across all scenes, provide unlimited currency (999M), and document asset decryption architecture --- .agents/skills/ananta-ps-engine/SKILL.md | 8 ++ .../asset_decryption_and_architecture.md | 90 +++++++++++++++++++ .../Client4229938/RuntimePayloadFactory.cs | 16 ++++ .../Ananta.Handlers/Game/GameRouter.World.cs | 13 +-- README.md | 4 +- 5 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 .agents/skills/ananta-ps-engine/references/asset_decryption_and_architecture.md diff --git a/.agents/skills/ananta-ps-engine/SKILL.md b/.agents/skills/ananta-ps-engine/SKILL.md index 3f52043..014f311 100644 --- a/.agents/skills/ananta-ps-engine/SKILL.md +++ b/.agents/skills/ananta-ps-engine/SKILL.md @@ -91,6 +91,14 @@ flowchart TD - NEAC anti-cheat driver suppression. - 📖 [Detailed Binary Patching Guide](./references/binary_patching_guide.md) +### 8. Asset Decryption, UXRPC Protocol & Codebase Architecture +- L50 VFS v8 index XOR decryption (`CF DD A2 4D 1E 83 96 4C 63 98 BB 3B 25 B6 3D C1`). +- Media payload (MP4) XOR `0x76` recovery and Pse LZ4 128 KiB chunked texture streams. +- Complete 25 UXRPC Service IDs, Method IDs, and ordered binary serialization schemas. +- Map Fog removal via `PlayerClientInfoAchievement.SceneFogMaps` and `SyncSceneFogMapAllUnlock`. +- Unlimited currency initialization in `PlayerClientInfoItem` (`Money`, `Gold`, `BindingGold`, `FreeGold`). +- 📖 [Asset Decryption & Codebase Architecture Guide](./references/asset_decryption_and_architecture.md) + --- ## Standard Runbook diff --git a/.agents/skills/ananta-ps-engine/references/asset_decryption_and_architecture.md b/.agents/skills/ananta-ps-engine/references/asset_decryption_and_architecture.md new file mode 100644 index 0000000..5c52f34 --- /dev/null +++ b/.agents/skills/ananta-ps-engine/references/asset_decryption_and_architecture.md @@ -0,0 +1,90 @@ +# NetEase Ananta Asset Decryption, UXRPC Protocol & Codebase Architecture Reference + +เอกสารอ้างอิงเชิงลึกทางสถาปัตยกรรมที่ได้จากการ Reverse Engineering ซอร์สโค้ด Decompiled (`Assembly-CSharp`, `L50Game.dll`, `Auto.Client.dll`), ถอดรหัสโครงสร้าง VFS/DecryptionVault, และโปรโตคอล UXRPC ของเกม Project Mugen / Ananta CBT 4229938 + +--- + +## 1. การเข้ารหัส Asset และโครงสร้าง L50 VFS (`DecryptionVault`) + +NetEase L50 Engine ใช้ระบบจัดเก็บ Asset แบบ Virtual File System (VFS) ผ่านคอนเทนเนอร์ไฟล์ `.vfc` และไฟล์ดัชนีสารบัญ `ipa_header.ehd`: + +### คีย์และอัลกอริทึม (Keys & Magics) +- **V8 Index XOR Key (16 Bytes)**: + `CF DD A2 4D 1E 83 96 4C 63 98 BB 3B 25 B6 3D C1` + - ทำการ XOR เฉพาะช่วงไบต์ 8–23 ของแต่ละเรคอร์ด (40 ไบต์) เพื่อถอดรหัส `int64 offset`, `int32 size`, `uint32 flags` + - เรคอร์ดที่ถูกต้องตรวจสอบโดยไบต์ที่ `record + 8 + 4` จะตรงกับ `V8Key[12..16]` +- **Media Payloads (MP4 / Cutscene Videos)**: + - เข้ารหัสด้วย Single-Byte XOR ค่า `0x76` ทั้งไฟล์ + - เมื่อถอดรหัส (XOR 0x76) จะพบ 4 ไบต์แรกสะกดว่า `ftyp` (มาตรฐานไฟล์ MP4) +- **Pse Texture Container (`.pse`)**: + - เมจิกเฮดเดอร์: `50 73 65 00 00 00` (`Pse\0\0`) + - โครงสร้างเพย์โหลด: บล็อกสตรีม **Raw LZ4 Blocks** ที่แต่ละบล็อกขยายออกมาได้สูงสุด **128 KiB (`0x20000`)** + - **กฎสำคัญ**: แต่ละก้อน 128 KiB เป็นอิสระจากกัน (Independent Chunks) ห้ามใช้ Back-reference ข้าม Chunk เด็ดขาด +- **Network Heartbeat Key (ChaCha20)**: + `58 2D 21 AF 6C C4 CC A0 8E EC 0D 9D 58 CD A1 E8 66 E8 37 1D 1E 61 23 9B 8D 60 B7 B2 44 FC` + - Counter = 1, Nonce = 0 ใช้สำหรับ Online Heartbeat / SignedKeys + +--- + +## 2. โครงสร้าง UXRPC Serialization & Services + +โปรโตคอลการสื่อสารของ Ananta ไม่ใช่ Protobuf Wire Format แต่เป็น **Ordered Binary Serialization** ผ่าน `UXBinaryWriter` และ `UXBinaryReader` โดยแยกออกเป็น 25 เซอร์วิสหลัก: + +### บริการและรหัสเซอร์วิสสำคัญ (Service IDs) +| Service ID | ชื่อเซอร์วิส C# | หน้าที่ / ขอบเขต | จำนวนเมธอด | +| :---: | :--- | :--- | :---: | +| **34** | `UX.Game.IClientToLogin` | ขอตรวจสอบเวอร์ชัน, ล็อกอิน, ตรวจสอบบัญชี | 15 | +| **35** | `UX.Game.ILoginToClient` | ตอบกลับคอนฟิก, ดีบั๊ก, สวิตช์เกม | 3 | +| **52** | `UX.Game.IClientToGate` | เชื่อมต่อ Gate, ส่งข้อมูลเครื่อง, ตรวจเวลา | 5 | +| **53** | `UX.Game.IGateToClient` | ซิงค์เวลาเซิร์ฟเวอร์, สถานะเซิร์ฟเวอร์ | 4 | +| **63** | `UX.Game.IClientToGame` | คำสั่งเกมเพลย์หลัก, กระเป๋า, ยานพาหนะ | 890 | +| **64** | `UX.Game.IGameToClient` | ซิงค์ข้อมูลผู้เล่น, เงิน, เควสต์, สถานะโลก | 170 | +| **65** | `UX.Game.IClientToGameGM` | **คำสั่ง GM ฝั่ง Game Player** (เงิน, ของ, สกิล, วาร์ป) | 524 | +| **67** | `UX.Game.IClientToGameScene` | ควบคุมฉาก, วาร์ป, หลบหลีก, ขับขี่ | 585 | +| **68** | `UX.Game.IGameSceneToClient` | **AOI, เสกเอนทิตี, มอนสเตอร์, ยานพาหนะ, สภาพอากาศ** | 640 | +| **69** | `UX.Game.IClientToGameSceneGM` | **คำสั่ง GM ฝั่ง Scene** (เสกมอน, รถ, จัดการฉาก) | 321 | + +--- + +## 3. สถาปัตยกรรมเสก Monster & NPC (`RaidBattleUnitAgent`) + +ไคลเอนต์สร้างเอนทิตีผ่านแพ็กเกจ `SyncRaidBattleUnitAgent` (Method ID: `68402349`) โดยรับอ็อบเจกต์ `RaidBattleUnitAgent`: +- สืบทอดจาก `RaidBattleUnitBase`: + - `Id` (ulong): Unique Entity Instance ID + - `TemplateId` (uint): รหัสโมเดล/สเปคตัวละคร (ตรงกับ `AgentConfig.json`) + - `Position` (UXVector3): พิกัดในฉาก + - `FacingDirection` (float): มุมหันหน้า + - `OwnerId` (ulong), `ManagedPid` (ulong) + - `MoveId` (byte), `NavTags` (uint), `GroundData` (MoveActionGroundData) +- ฟิลด์เพิ่มเติมเฉพาะของ `RaidBattleUnitAgent`: + - `SkillId` (int), `HSummonIndex` (int), `SpoonAgentId` (int) + - `SuitId` (uint): ชุดที่สวมใส่ (0 หรือ ID ชุด) + - `FashionIdList` (List): เครื่องประดับ/สกิน + - `ParentId` (ulong), `VehicleId` (ulong), `SourceWeaponId` (ulong) + - `IsBorn` (bool), `BattleAiS` (bool): เปิดใช้งาน AI ต่อสู้ + - `WeaponId` (uint): อาวุธที่ถือ + - `SpawnType` (AgentSpawnType): แหล่งกำเนิด + - `AnimateCullingMode`: รูปแบบการตัดทอนแอนิเมชันตามระยะทาง + - `AIAgentInfo`: การผูกเข้ากับระบบ Link AI ของตัวเกม + +--- + +## 4. กลไกปลดหมอกแผนที่ถาวร (Map Fog Removal System) + +ใน `MapFogDataMgr` และ `MapFogData`: +1. ไคลเอนต์ตรวจสอบหมอกผ่านคลาส `SceneFogMap`: + - `public bool All;`: หากแฟล็กนี้เป็น `true` เมธอด `SyncAllSceneFogData` หรือ `SyncUnlockScene` จะเซ็ต `unlockedAll = true` บน `MapFogData` ทำให้หมอกทั้งแผนที่หายไปทั้งหมด +2. ช่องทางส่งข้อมูล: + - **Login Handoff**: ผ่าน `PlayerClientInfo.InfoAchievement.SceneFogMaps` โดยตั้งค่าแต่ละ Scene (1, 1001, 10001) ให้มี `SceneFogMap { All = true }` และปลดล็อก POI ด้วย `SceneFogMapPoiIds` + - **Dynamic Packet**: ผ่าน `SyncSceneFogMapAllUnlock` (Method ID: `64915741`) โดยระบุ `SceneId` (1, 1001, 10001) และ `Unlocked = true` + +--- + +## 5. กลไกเงินและไอเทมในกระเป๋า (Currency & Inventory System) + +ใน `PlayerClientInfo.InfoItem`: +- `Money` (double): เงินหน่วยมาตรฐาน (Credits / Cash) +- `Gold` (double): ทองพรีเมียมสำหรับหมุนตู้กาชา +- `BindingGold` (double): ทองฟรีในเกม +- `FreeGold` (double): ทองกิจกรรม +เมื่อส่งค่าเริ่มต้น เช่น `999,999,999` ผ่าน `RuntimePayloadFactory.MinimalPlayerInfo4229938()` ระบบร้านค้า กาชา และเมนูอัปเกรดทั้งหมดจะมองเห็นยอดเงินมหาศาลพร้อมใช้งานทันที diff --git a/Ananta.Server/Ananta.Core/Protocol/Client4229938/RuntimePayloadFactory.cs b/Ananta.Server/Ananta.Core/Protocol/Client4229938/RuntimePayloadFactory.cs index 9ee3193..8f27c4f 100644 --- a/Ananta.Server/Ananta.Core/Protocol/Client4229938/RuntimePayloadFactory.cs +++ b/Ananta.Server/Ananta.Core/Protocol/Client4229938/RuntimePayloadFactory.cs @@ -151,6 +151,22 @@ internal static class RuntimePayloadFactory }); } + // Unlimited currency (Money, Gold, BindingGold, FreeGold) + root.InfoItem.Money = 999_999_999; + root.InfoItem.Gold = 999_999_999; + root.InfoItem.BindingGold = 999_999_999; + root.InfoItem.FreeGold = 999_999_999; + + // Unlock all Map Fog of war across known scenes + root.InfoAchievement.SceneFogMaps = new Dictionary + { + [1] = new Auto.SceneFogMap { All = true }, + [1001] = new Auto.SceneFogMap { All = true }, + [10001] = new Auto.SceneFogMap { All = true } + }; + // Unlock all Map POIs + root.InfoAchievement.SceneFogMapPoiIds = Enumerable.Range(1, 1000).Select(i => (uint)i).ToList(); + return root; } diff --git a/Ananta.Server/Ananta.Handlers/Game/GameRouter.World.cs b/Ananta.Server/Ananta.Handlers/Game/GameRouter.World.cs index 86fa9f6..6a6fc67 100644 --- a/Ananta.Server/Ananta.Handlers/Game/GameRouter.World.cs +++ b/Ananta.Server/Ananta.Handlers/Game/GameRouter.World.cs @@ -367,12 +367,15 @@ internal sealed partial class GameRouter }; await ctx.NotifyAsync(MethodId.SyncAllActivities, activitiesSync); - // Unlock all scene fog of war on the client - await ctx.NotifyAsync(MethodId.SyncSceneFogMapAllUnlock, new SceneMethods.SyncSceneFogMapAllUnlockInfo + // Unlock all scene fog of war on the client across all city/world scenes + foreach (var fogSceneId in new uint[] { 1, 1001, 10001, state.ActiveRaidId }) { - SceneId = state.ActiveRaidId, - Unlocked = true - }); + await ctx.NotifyAsync(MethodId.SyncSceneFogMapAllUnlock, new SceneMethods.SyncSceneFogMapAllUnlockInfo + { + SceneId = fogSceneId, + Unlocked = true + }); + } // Initialize story task tracking await ctx.NotifyAsync(MethodId.SyncCurrentTask, new SceneMethods.SyncCurrentTaskInfo diff --git a/README.md b/README.md index 7f2319a..bfccf85 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ | **Character Switching (สลับตัวละครคลีนแบบ DRMK)** | 🟢 ใช้งานได้สมบูรณ์ | สลับตัวละครได้ในฉากเดียวกัน ส่ง SyncLogicAgentLeave นำตัวเก่าออกจากโลกอย่างสะอาด ไม่ทิ้งร่างค้าง ไม่ล็อกการควบคุม และไม่มีปุ่ม F ลอยบนหัวตัวเรา | | **Vehicle Boarding (ขึ้นรถด้วยปุ่ม F)** | 🟡 กำลังทดสอบ | เดินไปใกล้รถแล้วกด F เพื่อขึ้นขับได้ทันทีผ่านระบบ Story Boarding และ Vehicle Drive State โดยตรง (กำลังทดสอบในเกม) | | **Weather & Atmosphere Control (ระบบสภาพอากาศ)** | 🟢 ใช้งานได้สมบูรณ์ | ปรับสภาพอากาศได้ 7 รูปแบบ (Sunny, Cloudy, Rain, Storm, Fog, Overcast, Night) พร้อมปรับ Transition เวลาผ่าน Web Debug Panel | -| **Map Fog Removal & Precise Teleport (ลบหมอก & วาร์ป)** | 🟡 รอก่อน / กำลังหาวิธี | ระบบวาร์ป 2 คลิกบนแผนที่ทำงานได้สมบูรณ์ ไม่ตกแมพ (0, 0, 0) ส่วนระบบปลดหมอกบนแผนที่ (Map Fog) ยังอยู่ระหว่างหาวิธีการเปิดถาวร | +| **Map Fog Removal & Precise Teleport (ลบหมอก & วาร์ป)** | 🟢 ใช้งานได้สมบูรณ์ | ปลดล็อกหมอกแมพถาวร (`SceneFogMaps` แฟล็ก `All = true` ใน `PlayerClientInfoAchievement` + ยิง `SyncSceneFogMapAllUnlock` ทั่วทุก Scene 1, 1001, 10001) และวาร์ป 2 คลิกไม่ตกแมพ | | **Selfie Mode Camera (โหมดเซลฟี่)** | 🟡 กำลังทดสอบ | แก้หน้าต่าง Adjustment โหลดข้อมูลท่าทางและการแสดงออกครบถ้วน ปรับ FOV มุมกล้องกว้างขึ้น (แก้ความรู้สึกลำบากเหมือนคนแขนสั้น) และออกจากโหมดแล้วท่าทางไม่ค้าง (กำลังทดสอบในเกม) | | **Outfit Toggle (ปุ่มลัดถอดชุดเหลือร่างต้น)** | 🟣 เอ๋อ / มีข้อจำกัด | สลับถอดเสื้อผ้าได้ผ่าน Web Debug Panel แต่ปุ่มลัด F8 ยังใช้งานไม่ได้ และบางครั้งโมเดลชุดไม่ยอมหายไปสมบูรณ์ | | **Housing System (ระบบบ้านและอพาร์ตเมนต์)** | 🟡 กำลังทดสอบ | ปลดล็อกและเปิดสิทธิ์การเป็นเจ้าของบ้าน/อพาร์ตเมนต์ทั้งหมด (`11200000`, `1001..1005`) สามารถเข้าดูและซื้อได้ (กำลังทดสอบในเกม) | -| **Retail Game Switches & Unlimited Currency** | 🟣 เอ๋อ / มีข้อจำกัด | ปลดล็อกฟังก์ชันและให้เงิน/ไอเทมเริ่มต้น แต่ยังมีอาการเอ๋อในบางระบบร้านค้าและเมนูกาชา | +| **Retail Game Switches & Unlimited Currency** | 🟢 ใช้งานได้สมบูรณ์ | กำหนดเงินและทองเริ่มต้นเต็มพิกัด 999,999,999 (`Money`, `Gold`, `BindingGold`, `FreeGold`) ใน `PlayerClientInfoItem` พร้อมปลดล็อกระบบร้านค้าและกาชาอย่างสมบูรณ์ | | **NPC & Monster Spawner (เสก NPC / มอนสเตอร์ / สัตว์)** | 🟢 ใช้งานได้สมบูรณ์ | รวมระบบมอนสเตอร์เข้ากับ Agent รวมศูนย์ผ่าน AgentConfig มีตารางค้นหาแยก 5 หมวดหมู่ (มอนสเตอร์/บอส, ชาวเมือง, ตำรวจ/ยาม, สัตว์, พันธมิตร) พร้อมปุ่ม [➕ Add] เสกเข้าฉากได้สมบูรณ์ | | **Traversal & Parkour (สลิง/เกี่ยวต่อสู้/ปีนป่าย)** | 🟢 ใช้งานได้สมบูรณ์ | ปลดล็อกบัฟเคลื่อนไหวใยแมงมุม (FeiSuo / Grapple Hook / Wall Rush / Dive Damage) ให้กับทุกตัวละคร รองรับการใช้สลิงเกี่ยวต่อสู้โดยไม่หลุดจากการเชื่อมต่อ | | **Anti-Cheat Suppression** | 🟢 ใช้งานได้สมบูรณ์ | ดักปิด `DavinciReport`, `DavinciMgr.CheckTimeScale` (แก้บัค Connection Lost เวลาสลิงเกี่ยวหรือเกิด Slow Motion) และดูดซับ `GmDaVinciCode` ฝั่งเซิร์ฟเวอร์ |