### Navigate and Extract WZ Node Data Source: https://context7.com/elem8100/maplenecrocer/llms.txt Shows how to find WZ nodes by path, extract images, access node properties like text and value, iterate through child nodes, get typed values with defaults, resolve UOL references, find the associated WZ file, and export the node as XML. ```csharp // Navigate through WZ node tree Wz_Node characterNode = wzStructure.WzNode; // Find node by path with image extraction Wz_Node bodyNode = characterNode.FindNodeByPath("Character\00002000.img\stand1\0\body", extractImage: true); // Access node properties string nodeName = bodyNode.Text; object nodeValue = bodyNode.Value; string fullPath = bodyNode.FullPath; // Iterate child nodes foreach (Wz_Node child in bodyNode.Nodes) { Console.WriteLine($"Child: {child.Text}"); } // Get typed values with defaults int delay = bodyNode.GetValue(100); string action = bodyNode.GetValue("stand1"); // Resolve UOL (link) references Wz_Node resolved = bodyNode.ResolveUol(); // Find associated WZ file Wz_File associatedFile = bodyNode.GetNodeWzFile(); // Export node as XML using var xmlWriter = XmlWriter.Create("output.xml"); bodyNode.DumpAsXml(xmlWriter); ``` -------------------------------- ### Extract and Manage WZ Image Data Source: https://context7.com/elem8100/maplenecrocer/llms.txt Details how to get a Wz_Image from a node, extract its data, access the extracted node tree, iterate through image contents, and unload the extracted data to free memory. It also covers checking image properties like name, size, checksum, and whether it's a Lua image. ```csharp // Get image from node Wz_Image wzImage = node.GetValue(); // Extract image data (parses all contained nodes) if (wzImage.TryExtract(out Exception error)) { // Access extracted node tree Wz_Node imageRoot = wzImage.Node; // Navigate image contents foreach (Wz_Node child in imageRoot.Nodes) { Console.WriteLine($"Property: {child.Text} = {child.Value}"); } } else { Console.WriteLine($"Extraction failed: {error?.Message}"); } // Unload extracted data to free memory wzImage.Unextract(); // Check image properties Console.WriteLine($"Name: {wzImage.Name}"); Console.WriteLine($"Size: {wzImage.Size} bytes"); Console.WriteLine($"Checksum: {wzImage.Checksum}"); Console.WriteLine($"Is Lua Script: {wzImage.IsLuaImage}"); ``` -------------------------------- ### Handle Individual WZ File Source: https://context7.com/elem8100/maplenecrocer/llms.txt Demonstrates creating a Wz_File instance, checking its loaded status, accessing header information, building the directory tree, and detecting the WZ type and version. This is typically done via Wz_Structure. ```csharp // Create WZ file instance (typically done through Wz_Structure) using var wzFile = new Wz_File("C:/MapleStory/Character.wz", wzStructure); // Check if file loaded successfully if (wzFile.Loaded) { // Access file properties Wz_Header header = wzFile.Header; Console.WriteLine($"File: {header.FileName}"); Console.WriteLine($"Data Size: {header.DataSize}"); Console.WriteLine($"Version: {header.WzVersion}"); // Build directory tree Wz_Node rootNode = new Wz_Node("Character.wz"); wzFile.Node = rootNode; wzFile.GetDirTree(rootNode, useBaseWz: false); // Auto-detect WZ type (Character, Map, Sound, etc.) wzFile.DetectWzType(); Console.WriteLine($"WZ Type: {wzFile.Type}"); // Detect and verify WZ version wzFile.DetectWzVersion(); } ``` -------------------------------- ### Initialize and Load WZ Structure Source: https://context7.com/elem8100/maplenecrocer/llms.txt Initializes the Wz_Structure, enables auto-detection of extension files, and loads the base WZ file. It also shows how to load individual WZ files and handle KMST1125+ data formats. Remember to clear resources when done. ```csharp // Initialize WZ structure and load a base WZ file var wzStructure = new Wz_Structure(); wzStructure.AutoDetectExtFiles = true; // Load base.wz which auto-loads related WZ files wzStructure.Load("C:/MapleStory/base.wz", useBaseWz: true); // Access the root node containing all loaded data Wz_Node rootNode = wzStructure.WzNode; // Load individual WZ file Wz_File mapFile = wzStructure.LoadFile("C:/MapleStory/Map.wz", rootNode, useBaseWz: false); // Load KMST1125+ data format (split WZ files) if (wzStructure.IsKMST1125WzFormat("C:/MapleStory/Data/Character.wz")) { wzStructure.LoadKMST1125DataWz("C:/MapleStory/Data/Character.wz"); } // Clean up resources when done wzStructure.Clear(); ``` -------------------------------- ### Play Audio with Sound and Music Classes Source: https://context7.com/elem8100/maplenecrocer/llms.txt Handles playback of sound effects and background music using file paths. ```csharp // Play sound effect Sound.Play("Sound/Game.img/Portal"); Sound.Play("Sound/Mob.img/100100/Die"); // Play background music Music.Play("Sound/Bgm00.img/FloralLife"); // Sound path examples string weaponSound = "Sound/Weapon.img/swordL/Attack"; string uiSound = "Sound/UI.img/BtMouseClick"; string skillSound = "Sound/Skill.img/8/Attack"; ``` -------------------------------- ### Manage Equipment Data with Equip Class Source: https://context7.com/elem8100/maplenecrocer/llms.txt Provides utility methods for resolving equipment paths, identifying part types, and accessing equipment data dictionaries. ```csharp // Get equipment directory path string directory = Equip.GetDir("01302000"); // Returns "Weapon/" string capDir = Equip.GetDir("01000000"); // Returns "Cap/" string faceDir = Equip.GetDir("00020000"); // Returns "Face/" // Get equipment part type PartName part = Equip.GetPart("01302000"); // Returns PartName.Weapon PartName capPart = Equip.GetPart("01000000"); // Returns PartName.Cap // Get weapon afterimage string for attack effects string afterImage = Equip.GetAfterImageStr("01302000"); // Returns "swordOL" // Get weapon number for animation paths string weaponNum = Equip.GetWeaponNum("01302000"); // Returns "30" // Access equipment data dictionaries Equip.Data["body/stand1/FrameCount"] = 3; Equip.DataS["stand1/0"] = "stand1"; ``` -------------------------------- ### Access WZ Data with Wz Helper Source: https://context7.com/elem8100/maplenecrocer/llms.txt Provides methods for node retrieval, existence checks, data caching, and type-safe value conversion. ```csharp // Get node by path Wz_Node node = Wz.GetNode("Map/Map/Map0/100000000.img"); Wz_Node nodeA = Wz.GetNodeA("String/Mob.img/100100/name"); // Check if data exists bool exists = Wz.HasNode("UI/Basic.img/Cursor/0"); bool hasData = Wz.HasData("Mob/100100.img/stand/0"); bool hasDataE = Wz.HasDataE("Character/Weapon/01302000.img/stand1"); // Dump node data to cache dictionaries Wz.DumpData(sourceNode, Wz.Data, Wz.ImageLib); Wz.DumpData(equipNode, Wz.EquipData, Wz.EquipImageLib); // Access cached data var imageNode = Wz.Data["Mob/100100.img/stand/0"]; var texture = Wz.ImageLib["Mob/100100.img/stand/0"]; // Get values with type conversion int intValue = node.ToInt(); string strValue = node.ToStr(); bool boolValue = node.ToBool(); Wz_Vector vectorValue = node.ToVector(); // WzDict utility for direct path access int delay = WzDict.GetInt("Mob/100100.img/stand/0/delay", defaultValue: 100); string name = WzDict.GetStr("Mob/100100.img/info/name"); Wz_Vector origin = WzDict.GetVector("Mob/100100.img/stand/0/origin"); bool flag = WzDict.GetBool("Mob/100100.img/info/boss"); ``` -------------------------------- ### Sound Class - Audio Playback Source: https://context7.com/elem8100/maplenecrocer/llms.txt Handles audio playback for game sounds and background music. ```APIDOC ## Sound Class - Audio Playback ### Description Handles audio playback for game sounds and background music. ### Methods #### Sound.Play - **Description**: Plays a sound effect. - **Parameters**: - `path` (string) - The path to the sound file (e.g., "Sound/Game.img/Portal"). #### Music.Play - **Description**: Plays background music. - **Parameters**: - `path` (string) - The path to the music file (e.g., "Sound/Bgm00.img/FloralLife"). ### Sound Path Examples - Weapon Sound: `"Sound/Weapon.img/swordL/Attack"` - UI Sound: `"Sound/UI.img/BtMouseClick"` - Skill Sound: `"Sound/Skill.img/8/Attack"` ``` -------------------------------- ### Equip Class - Equipment Utilities Source: https://context7.com/elem8100/maplenecrocer/llms.txt Provides methods for handling equipment data, categorization, and path resolution. ```APIDOC ## Equip Class - Equipment Utilities ### Description Provides utility methods for handling equipment data, categorization, and path resolution. ### Methods #### GetDir - **Description**: Retrieves the directory path for a given equipment ID. - **Parameters**: - `id` (string) - The equipment ID. - **Returns**: `string` - The directory path (e.g., "Weapon/"). #### GetPart - **Description**: Retrieves the `PartName` enum for a given equipment ID. - **Parameters**: - `id` (string) - The equipment ID. - **Returns**: `PartName` - The equipment part type. #### GetAfterImageStr - **Description**: Retrieves the afterimage string for weapon effects. - **Parameters**: - `id` (string) - The equipment ID. - **Returns**: `string` - The afterimage string (e.g., "swordOL"). #### GetWeaponNum - **Description**: Retrieves the weapon number used for animation paths. - **Parameters**: - `id` (string) - The equipment ID. - **Returns**: `string` - The weapon number (e.g., "30"). ### Data Access - `Equip.Data` (dictionary): Accesses equipment data, e.g., `Equip.Data["body/stand1/FrameCount"] = 3;` - `Equip.DataS` (dictionary): Accesses string-based equipment data, e.g., `Equip.DataS["stand1/0"] = "stand1";` ``` -------------------------------- ### Manage NPCs with Npc Class Source: https://context7.com/elem8100/maplenecrocer/llms.txt Handles NPC spawning, display configuration, and iteration over summoned NPCs. ```csharp // NPCs are created automatically from map data Npc.Create(); // Spawns all NPCs defined in current map // Manually spawn an NPC Npc.Spawn( ID: "9000000", // NPC ID PosX: 500, PosY: 300, FlipX: 0 // 0 = facing right, 1 = facing left ); // NPC display settings Map.ShowNpc = true; Map.ShowNpcName = true; Map.ShowNpcChat = true; // Access summoned NPC list foreach (string npcId in Npc.SummonedList) { Console.WriteLine($"Summoned NPC: {npcId}"); } ``` -------------------------------- ### Wz Helper Class - Simplified Data Access Source: https://context7.com/elem8100/maplenecrocer/llms.txt Provides helper utilities for convenient WZ data access patterns. ```APIDOC ## Wz Helper Class - Simplified Data Access ### Description Provides helper utilities for convenient WZ data access patterns. ### Methods #### GetNode - **Description**: Retrieves a WZ node by its path. - **Parameters**: - `path` (string) - The path to the WZ node. - **Returns**: `Wz_Node` - The WZ node. #### GetNodeA - **Description**: Retrieves a WZ node by its path, often used for string data. - **Parameters**: - `path` (string) - The path to the WZ node. - **Returns**: `Wz_Node` - The WZ node. #### HasNode - **Description**: Checks if a WZ node exists at the given path. - **Parameters**: - `path` (string) - The path to check. - **Returns**: `bool` - True if the node exists, false otherwise. #### HasData - **Description**: Checks if data exists for a given WZ path. - **Parameters**: - `path` (string) - The path to check. - **Returns**: `bool` - True if data exists, false otherwise. #### HasDataE - **Description**: Checks if extended data exists for a given WZ path. - **Parameters**: - `path` (string) - The path to check. - **Returns**: `bool` - True if extended data exists, false otherwise. #### DumpData - **Description**: Dumps WZ node data into cache dictionaries. - **Parameters**: - `sourceNode` (Wz_Node) - The source WZ node. - `targetDict` (dictionary) - The target dictionary to dump data into. - `targetImageLib` (dictionary) - The target image library to dump data into. ### Data Access - `Wz.Data` (dictionary): Cache for general WZ data. - `Wz.ImageLib` (dictionary): Cache for WZ image data. - `Wz.EquipData` (dictionary): Cache for equipment WZ data. - `Wz.EquipImageLib` (dictionary): Cache for equipment WZ image data. ### Type Conversion - `node.ToInt()`: Converts node value to an integer. - `node.ToStr()`: Converts node value to a string. - `node.ToBool()`: Converts node value to a boolean. - `node.ToVector()`: Converts node value to a `Wz_Vector`. ### WzDict Utility - `WzDict.GetInt(path, defaultValue)`: Gets an integer value from WZ data with a default value. - `WzDict.GetStr(path)`: Gets a string value from WZ data. - `WzDict.GetVector(path)`: Gets a `Wz_Vector` value from WZ data. - `WzDict.GetBool(path)`: Gets a boolean value from WZ data. ``` -------------------------------- ### Manage Monsters with Mob Class Source: https://context7.com/elem8100/maplenecrocer/llms.txt Handles monster spawning, display settings, and iteration over active mobs. ```csharp // Mobs are created automatically from map data Mob.Create(); // Spawns all mobs defined in current map // Manually spawn a mob Mob.Spawn( ID: "100100", // Snail PosX: 500, PosY: 300, RX0: 400, // Left movement boundary RX1: 600 // Right movement boundary ); // Mob properties (accessed via instance) // mob.ID - Mob identifier // mob.HP - Current health // mob.Die - Death state // mob.GetHit1 - Hit reaction state // mob.MoveDirection - Current movement direction // mob.Action - Current animation action // Mob display settings Map.ShowMob = true; Map.ShowMobName = true; Map.ShowID = true; // Access mob list foreach (string mobId in Mob.MobList) { Console.WriteLine($"Loaded mob: {mobId}"); } ``` -------------------------------- ### Load and Configure MapleStory Maps Source: https://context7.com/elem8100/maplenecrocer/llms.txt The Map class handles loading and rendering of game maps. It allows configuration of display settings, visibility of map elements, and loading maps by ID. Map metadata and resource loading can also be accessed. ```csharp // Initialize map display settings Map.DisplaySize = new Point(1024, 768); Map.ShowTile = true; Map.ShowObj = true; Map.ShowBack = true; Map.ShowNpc = true; Map.ShowMob = true; Map.ShowPortal = true; Map.ShowPlayer = true; Map.ShowMiniMap = true; Map.GameMode = GameMode.Play; // or GameMode.Viewer // Load a map by ID Map.LoadMap("100000000"); // Henesys // Access map information Console.WriteLine($"Map ID: {Map.ID}"); Console.WriteLine($"Bounds: L={Map.Left}, T={Map.Top}, R={Map.Right}, B={Map.Bottom}"); Console.WriteLine($"BGM: {Map.BgmName}"); // Access map metadata int mapWidth = Map.Info["MapWidth"]; int mapHeight = Map.Info["MapHeight"]; int centerX = Map.Info["centerX"]; int centerY = Map.Info["centerY"]; // Control map visibility settings Map.ShowMobName = true; Map.ShowNpcName = true; Map.ShowFootholds = true; Map.ShowPortalInfo = true; // Create resource loader for map assets Map.CreateResLoader(); ``` -------------------------------- ### Extract Audio Data from WZ Files Source: https://context7.com/elem8100/maplenecrocer/llms.txt The Wz_Sound class extracts audio from WZ files, supporting MP3 and PCM WAV. It automatically detects the format and provides properties for duration, channels, frequency, and data length. Extracted data can be saved directly to a file. ```csharp // Get sound data from node Wz_Sound soundData = node.GetValue(); // Check audio properties Console.WriteLine($"Duration: {soundData.Ms} ms"); Console.WriteLine($"Channels: {soundData.Channels}"); Console.WriteLine($"Frequency: {soundData.Frequency} Hz"); Console.WriteLine($"Data Length: {soundData.DataLength} bytes"); Console.WriteLine($"Sound Type: {soundData.SoundType}"); // Extract audio data (returns MP3 bytes or WAV with header) byte[] audioData = soundData.ExtractSound(); // Save to file based on type string extension = soundData.SoundType == Wz_SoundType.Mp3 ? ".mp3" : ".wav"; File.WriteAllBytes($"extracted_audio{extension}", audioData); // Copy raw data to buffer byte[] buffer = new byte[soundData.DataLength]; soundData.CopyTo(buffer, 0); ``` -------------------------------- ### Manage Player Character Source: https://context7.com/elem8100/maplenecrocer/llms.txt The Player class handles character management, including spawning, positioning, state control, and equipment. It allows for dynamic equipment changes and provides access to player properties like current action and direction. ```csharp // Spawn player (done automatically on first map load) Player.SpawnNew(); // Access player instance Player player = Game.Player; // Set player position player.X = 500; player.Y = 300; // Control player state player.FaceDir = FaceDir.Right; player.InLadder = false; player.Attack = false; // Manage equipment player.CreateEquip("01302000", player.AvatarEngine); // Weapon player.CreateEquip("01040005", player.AvatarEngine); // Top player.CreateEquip("01060002", player.AvatarEngine); // Bottom // Equipment list Player.EqpList.Add("01302000"); Console.WriteLine($"Equipped items: {Player.EqpList.Count}"); // Remove all equipment sprites player.RemoveSprites(); // Player properties Console.WriteLine($"Stand Type: {player.StandType}"); Console.WriteLine($"Walk Type: {player.WalkType}"); Console.WriteLine($"Weapon Number: {player.WeaponNum}"); Console.WriteLine($"Current Action: {player.Action}"); ``` -------------------------------- ### Extract PNG Data from WZ Files Source: https://context7.com/elem8100/maplenecrocer/llms.txt Use Wz_Png to extract texture data from WZ files. Supports various formats and allows extraction of raw pixel data or System.Drawing.Bitmap objects. Specify page for multi-page textures. ```csharp // Get PNG data from a node Wz_Png pngData = node.GetValue(); // Get image properties Console.WriteLine($"Dimensions: {pngData.Width}x{pngData.Height}"); Console.WriteLine($"Format: {pngData.Format}"); Console.WriteLine($"Scale: {pngData.ActualScale}"); Console.WriteLine($"Pages: {pngData.ActualPages}"); // Extract as System.Drawing.Bitmap using Bitmap bitmap = pngData.ExtractPng(); bitmap.Save("extracted_sprite.png", ImageFormat.Png); // Extract specific page for multi-page textures using Bitmap page2 = pngData.ExtractPng(page: 1); // Get raw decompressed pixel data byte[] rawPixels = pngData.GetRawData(); int dataSize = pngData.GetRawDataSize(); // Calculate expected data size for format int expectedSize = Wz_Png.GetUncompressedDataSize( Wz_TextureFormat.ARGB8888, scale: 1, width: 256, height: 256 ); ``` -------------------------------- ### Mob Class - Monster Management Source: https://context7.com/elem8100/maplenecrocer/llms.txt Handles monster spawning, AI behavior, animations, collision detection, and damage handling. ```APIDOC ## Mob Class - Monster Management ### Description Handles monster spawning, AI behavior, animations, collision detection, and damage handling. ### Methods #### Create - **Description**: Spawns all mobs defined in the current map. #### Spawn - **Description**: Manually spawns a mob at a specified location with movement boundaries. - **Parameters**: - `ID` (string) - The mob identifier. - `PosX` (int) - The X-coordinate for spawning. - `PosY` (int) - The Y-coordinate for spawning. - `RX0` (int) - The left movement boundary. - `RX1` (int) - The right movement boundary. ### Properties (accessed via instance) - `ID` (string): Mob identifier. - `HP` (int): Current health. - `Die` (bool): Death state. - `GetHit1` (int): Hit reaction state. - `MoveDirection` (int): Current movement direction. - `Action` (string): Current animation action. ### Display Settings - `Map.ShowMob` (bool): Toggles mob visibility. - `Map.ShowMobName` (bool): Toggles mob name visibility. - `Map.ShowID` (bool): Toggles mob ID visibility. ### Mob List - `Mob.MobList` (list of strings): Accesses the list of loaded mob IDs. ``` -------------------------------- ### Access and Find Map Portals Source: https://context7.com/elem8100/maplenecrocer/llms.txt Portals are automatically managed by MapPortal when maps are loaded. You can iterate through the PortalList to access individual portal data, including name, position, type, and destination. Portals can also be found by their position. ```csharp // Portals are created automatically during Map.LoadMap() // Access portal data for custom logic foreach (var portal in MapPortal.PortalList) { Console.WriteLine($"Portal: {portal.PortalName}"); Console.WriteLine($" Position: ({portal.X}, {portal.Y})"); Console.WriteLine($" Type: {portal.Type}"); Console.WriteLine($" Destination: {portal.ToMap} -> {portal.ToName}"); } // Find portal at position PortalInfo portalAtPos = MapPortal.Find(new Vector2(x, y), ref onPortal); ``` -------------------------------- ### Npc Class - NPC Management Source: https://context7.com/elem8100/maplenecrocer/llms.txt Manages non-player characters including spawning, animations, chat balloons, and MapleTV integration. ```APIDOC ## Npc Class - NPC Management ### Description Manages non-player characters including spawning, animations, chat balloons, and MapleTV integration. ### Methods #### Create - **Description**: Spawns all NPCs defined in the current map. #### Spawn - **Description**: Manually spawns an NPC at a specified location. - **Parameters**: - `ID` (string) - The NPC identifier. - `PosX` (int) - The X-coordinate for spawning. - `PosY` (int) - The Y-coordinate for spawning. - `FlipX` (int) - Facing direction (0 = right, 1 = left). ### Display Settings - `Map.ShowNpc` (bool): Toggles NPC visibility. - `Map.ShowNpcName` (bool): Toggles NPC name visibility. - `Map.ShowNpcChat` (bool): Toggles NPC chat balloon visibility. ### Summoned List - `Npc.SummonedList` (list of strings): Accesses the list of summoned NPC IDs. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.