diff --git a/src/Persistence/Initialization/Updates/AddArkaniaMapUpdateSeason6.cs b/src/Persistence/Initialization/Updates/AddArkaniaMapUpdateSeason6.cs new file mode 100644 index 0000000..afd6b3e --- /dev/null +++ b/src/Persistence/Initialization/Updates/AddArkaniaMapUpdateSeason6.cs @@ -0,0 +1,82 @@ +// +// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// + +namespace MUnique.OpenMU.Persistence.Initialization.Updates; + +using System.Runtime.InteropServices; +using MUnique.OpenMU.DataModel.Configuration; +using MUnique.OpenMU.Persistence.Initialization.VersionSeasonSix.Maps; +using MUnique.OpenMU.PlugIns; + +/// +/// Adds the imported Arkania map (number 83): the map definition with its terrain, +/// a spawn gate on a walkable tile, and a /move warp entry so players can reach it. +/// Monsters and NPCs are added afterwards via the admin panel. +/// +[PlugIn] +[Display(Name = PlugInName, Description = PlugInDescription)] +[Guid("2C8B0A61-6B2E-4D7A-9E3C-7F1A4B2D9E01")] +public class AddArkaniaMapUpdateSeason6 : UpdatePlugInBase +{ + internal const string PlugInName = "Add Arkania map (83)"; + internal const string PlugInDescription = "Adds the imported Arkania map (number 83) with terrain, a spawn gate, and a /move warp. Monsters/NPCs are added via the admin panel."; + + /// + public override UpdateVersion Version => UpdateVersion.AddArkaniaMapSeason6; + + /// + public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id; + + /// + public override string Name => PlugInName; + + /// + public override string Description => PlugInDescription; + + /// + public override bool IsMandatory => true; + + /// + public override DateTime CreatedAt => new(2026, 07, 19, 12, 0, 0, DateTimeKind.Utc); + + /// + protected override ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) + { + // Idempotency guard: skip if Arkania (83) already exists. + if (gameConfiguration.Maps.Any(m => m.Number == Arkania.Number)) + { + return default; + } + + var initializer = new Arkania(context, gameConfiguration); + initializer.Initialize(); // creates map 83 + loads terrain from Terrain84.att + initializer.SetSafezoneMap(); + + var arkania = gameConfiguration.Maps.First(m => m.Number == Arkania.Number); + + // Spawn gate on a walkable tile (center of the map; attr 0x00, verified walkable). + var spawnGate = context.CreateNew(); + arkania.ExitGates.Add(spawnGate); + spawnGate.Map = arkania; + spawnGate.X1 = 128; + spawnGate.Y1 = 128; + spawnGate.X2 = 128; + spawnGate.Y2 = 128; + spawnGate.IsSpawnGate = true; + + // /move warp entry. + if (gameConfiguration.WarpList.All(w => w.Name != Arkania.Name)) + { + var warp = context.CreateNew(); + gameConfiguration.WarpList.Add(warp); + warp.Index = 83; + warp.Name = Arkania.Name; + warp.Costs = 5000; + warp.LevelRequirement = 10; + warp.Gate = spawnGate; + } + + return default; + } +} diff --git a/src/Persistence/Initialization/Updates/UpdateVersion.cs b/src/Persistence/Initialization/Updates/UpdateVersion.cs index 7edf6b3..891f5fe 100644 --- a/src/Persistence/Initialization/Updates/UpdateVersion.cs +++ b/src/Persistence/Initialization/Updates/UpdateVersion.cs @@ -484,4 +484,9 @@ public enum UpdateVersion /// The version of the . /// AddImperialWeapons050Season6 = 95, + + /// + /// The version of the . + /// + AddArkaniaMapSeason6 = 96, } \ No newline at end of file