Same pattern as Arkania: terrain resources Terrain84-87.att, map initializer classes, registration, and update-plugin (v97) that creates each map + spawn gate + /move warp AND assigns it to the game server configuration so it is hosted. Also fix the Arkania update-plugin to assign the game server config (was missing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
92 lines
3.5 KiB
C#
92 lines
3.5 KiB
C#
// <copyright file="AddArkaniaMapUpdateSeason6.cs" company="MUnique">
|
|
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
|
// </copyright>
|
|
|
|
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;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
[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.";
|
|
|
|
/// <inheritdoc />
|
|
public override UpdateVersion Version => UpdateVersion.AddArkaniaMapSeason6;
|
|
|
|
/// <inheritdoc />
|
|
public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id;
|
|
|
|
/// <inheritdoc />
|
|
public override string Name => PlugInName;
|
|
|
|
/// <inheritdoc />
|
|
public override string Description => PlugInDescription;
|
|
|
|
/// <inheritdoc />
|
|
public override bool IsMandatory => true;
|
|
|
|
/// <inheritdoc />
|
|
public override DateTime CreatedAt => new(2026, 07, 19, 12, 0, 0, DateTimeKind.Utc);
|
|
|
|
/// <inheritdoc />
|
|
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<GameServerConfiguration>().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<ExitGate>();
|
|
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<WarpInfo>();
|
|
gameConfiguration.WarpList.Add(warp);
|
|
warp.Index = 83;
|
|
warp.Name = Arkania.Name;
|
|
warp.Costs = 5000;
|
|
warp.LevelRequirement = 10;
|
|
warp.Gate = spawnGate;
|
|
}
|
|
}
|
|
}
|