//
// 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 async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration)
{
// Idempotency guard: skip if Arkania (82) already exists.
if (gameConfiguration.Maps.Any(m => m.Number == Arkania.Number))
{
return;
}
var initializer = new Arkania(context, gameConfiguration);
initializer.Initialize(); // creates map 82 + loads terrain from Terrain83.att
initializer.SetSafezoneMap();
var arkania = gameConfiguration.Maps.First(m => m.Number == Arkania.Number);
// Host the map on every game server configuration (fresh seeds do this
// automatically, but existing databases need it added explicitly).
var serverConfigs = await context.GetAsync().ConfigureAwait(false);
foreach (var serverConfig in serverConfigs)
{
if (serverConfig.Maps.All(m => m.Number != Arkania.Number))
{
serverConfig.Maps.Add(arkania);
}
}
// 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;
}
}
}