Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs-website/docs/admin-panel/configuration-captions.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,29 @@ editors, a translated hint appears below the original name or description.
The input still edits the stored English text, which configuration updates use to
identify attributes. Unknown or customized text is shown unchanged.
These display translations do not require linking or applying configuration names.

## Cash shop package names

The cash shop catalog uses localized package names, including the list, search and
name editor. Searches accept both the displayed translation and the neutral name.
New Season 6 configurations include the resource links. For an existing catalog,
link the names and review and apply the translations on this page, then restart
as described above. Linking uses the package number from the client script and
requires an exact match of the neutral name. Customized names and ambiguous
package numbers are not automatically linked.

This changes admin panel captions only. The client still displays its own shop
script. Package and product numbers, prices, delivery items and sale flags are
unchanged. Names remain stored in the same database text column; the localized
string converter also reads existing plain English values.

Chinese names reuse the existing item translations where applicable. The
[official legacy item guide](https://mu.zhaouc.com/01_news/updatecn/s5/s5_4.htm)
confirms the unicorn, skeleton pet, transformation ring and AG/SD aura names.
[Official VIP rewards](https://mu.zhaouc.com/event/vipxt/vip/) also document potion,
seal and scroll terminology. English-client promotions such as eX700 celebration
packages, gold-channel packages, charms, statues and rare-item tickets use
provisional descriptive translations; they are not presented as verified Chinese
Season 6 client labels. Other labels without a confirmed Season 6 counterpart
also remain descriptive translations. Brackets, GP markers, durations and bundle
quantities are preserved to distinguish the script's offers.
4 changes: 2 additions & 2 deletions src/DataModel/Configuration/CashShopPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class CashShopPackage
/// Gets or sets the name, which is only shown in the admin panel.
/// The client shows the name of its script.
/// </summary>
public string Name { get; set; } = string.Empty;
public LocalizedString Name { get; set; } = new(string.Empty);

/// <summary>
/// Gets or sets the price of a bundle package.
Expand Down Expand Up @@ -69,6 +69,6 @@ public partial class CashShopPackage
/// <inheritdoc />
public override string ToString()
{
return $"{this.PackageSequence}: {this.Name}";
return $"{this.PackageSequence}: {this.Name.GetTranslation(System.Globalization.CultureInfo.CurrentUICulture)}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
using System.Collections.Generic;
using System.Reflection;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.Interfaces;
using MUnique.OpenMU.Persistence.EntityFramework.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#pragma warning disable 219, 612, 618
Expand Down Expand Up @@ -80,9 +82,13 @@ public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType bas

var name = runtimeEntityType.AddProperty(
"Name",
typeof(string),
typeof(MUnique.OpenMU.Interfaces.LocalizedString),
propertyInfo: typeof(MUnique.OpenMU.DataModel.Configuration.CashShopPackage).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
fieldInfo: typeof(MUnique.OpenMU.DataModel.Configuration.CashShopPackage).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
name.SetValueConverter(new ValueConverter<MUnique.OpenMU.Interfaces.LocalizedString, string>(
string (LocalizedString value) => value.Value ?? string.Empty,
LocalizedString (string value) => new LocalizedString(value)));
name.SetSentinelFromProviderValue("");
name.AddAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.None);

var packageSequence = runtimeEntityType.AddProperty(
Expand Down
1 change: 1 addition & 0 deletions src/Persistence/EntityFramework/EntityDataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<CastleSiegePendingReward>().Apply();
modelBuilder.Entity<CastleSiegeNpcDefinition>().Apply();
modelBuilder.Entity<CastleSiegeNpcState>().Apply();
modelBuilder.Entity<CashShopPackage>().Apply();
modelBuilder.Entity<CashShopStorageItem>().Apply();
modelBuilder.Entity<CashShopCoinGrant>().Apply();
modelBuilder.Entity<DropItemGroup>().Apply();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ namespace MUnique.OpenMU.Persistence.EntityFramework.Extensions.ModelBuilder;
/// </summary>
internal static class CashShopExtensions
{
/// <summary>
/// Applies the settings for the <see cref="CashShopPackage"/> entity.
/// </summary>
/// <param name="builder">The builder.</param>
public static void Apply(this EntityTypeBuilder<CashShopPackage> builder)
{
builder.Property(package => package.Name).HasConversion(LocalizedStringConverter.Instance);
}

/// <summary>
/// Applies the settings for the <see cref="CashShopStorageItem"/> entity.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ internal sealed partial class GameConfigurationLoader
entity.IsBundle = reader.GetBoolean(3);
entity.IsForSale = reader.GetBoolean(4);
entity.IsGiftable = reader.GetBoolean(5);
entity.Name = reader.GetString(6);
entity.Name = reader.IsDBNull(6) ? default : new global::MUnique.OpenMU.Interfaces.LocalizedString(reader.GetString(6));
entity.PackageSequence = reader.GetInt32(7);
entity.Price = reader.GetInt32(8);
this._CashShopPackage[entity.Id] = entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ internal static (string OwnerType, long Number, string PropertyName)? GetNumberK
return (GetTypeName(set) + ":ArmorSet", ((long)armorNumber << 32) | (uint)set.SetLevel, caption.Property.Name);
}

if (caption.Owner is CashShopPackage package)
{
return (GetTypeName(package), package.PackageSequence, caption.Property.Name);
}

var numberProperty = caption.Owner.GetType().GetProperty("Number");
return numberProperty?.GetValue(caption.Owner) is { } number and (byte or short or int or long or ushort)
? (GetTypeName(caption.Owner), Convert.ToInt64(number, CultureInfo.InvariantCulture), caption.Property.Name)
Expand Down
1 change: 1 addition & 0 deletions src/Persistence/Initialization/ConfigurationNameSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class ConfigurationNameSources
/// </summary>
public static void Register()
{
RegisterIfNeeded(nameof(CashShopPackageNames), CashShopPackageNames.ResourceManager);
RegisterIfNeeded(nameof(CharacterClassNames), CharacterClassNames.ResourceManager);
RegisterIfNeeded(nameof(MapNames), MapNames.ResourceManager);
RegisterIfNeeded(nameof(MerchantNames), MerchantNames.ResourceManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,15 @@
<DependentUpon>WarpNames.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\CashShopPackageNames.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>CashShopPackageNames.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Update="Properties\CashShopPackageNames.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>CashShopPackageNames.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>
Loading
Loading