feat(maps): add Arkania DB update-plugin with spawn gate and /move warp
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
// <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 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<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;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
@@ -484,4 +484,9 @@ public enum UpdateVersion
|
||||
/// The version of the <see cref="AddImperialWeapons050UpdateSeason6"/>.
|
||||
/// </summary>
|
||||
AddImperialWeapons050Season6 = 95,
|
||||
|
||||
/// <summary>
|
||||
/// The version of the <see cref="AddArkaniaMapUpdateSeason6"/>.
|
||||
/// </summary>
|
||||
AddArkaniaMapSeason6 = 96,
|
||||
}
|
||||
Reference in New Issue
Block a user