Skip to content

Commit

Permalink
Fix unparsed columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Xsear committed Sep 1, 2024
1 parent 0d22a26 commit 6b5a3a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions UdpHosts/GameServer/StaticDB/Loaders/StaticDBLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ namespace GameServer.Data.SDB;
public class StaticDBLoader : ISDBLoader
{
private static readonly SnakeCasePropertyNamingPolicy Policy = new SnakeCasePropertyNamingPolicy();
private static readonly Dictionary<string, string> ManualNameConversions = new()
{
{ "DamageType", "damageType" }, // InflictDamageCommandDef and HealDamageCommandDef
{ "OrnamentsMapGroupId1", "ornaments_map_group_id_1" }, // dbitems::Weapons
{ "OrnamentsMapGroupId2", "ornaments_map_group_id_2" }, // dbitems::Weapons
{ "FlightFx1stPersonId", "flight_fx_1st_person_id" }, // dbitems::Ammo
};
private static StaticDB sdb;

public StaticDBLoader(StaticDB instance)
Expand Down Expand Up @@ -1326,10 +1333,9 @@ private static T[] LoadStaticDB<T>(string tableName)
{
propInfo.SetValue(entry, row[backupIndex], null);
}
else if (propInfo.Name == "DamageType")
else if (ManualNameConversions.TryGetValue(propInfo.Name, out var value))
{
// Appears in InflictDamageCommandDef and HealDamageCommandDef
propInfo.SetValue(entry, row[table.GetColumnIndexByName("damageType")], null);
propInfo.SetValue(entry, row[table.GetColumnIndexByName(value)], null);
}
else
{
Expand Down

0 comments on commit 6b5a3a1

Please sign in to comment.