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
37 changes: 36 additions & 1 deletion UdpHosts/GameServer/StaticDB/Loaders/ISDBLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace GameServer.Data.SDB;
using Records.apt;
using Records.aptfs;
using Records.dbcharacter;
using Records.dbencounterdata;
using Records.dbitems;
using Records.dbviusalrecords;
using Records.dbphysicsmaterials;
using Records.dbvisualrecords;
using Records.dbzonemetadata;
using Records.vcs;

public interface ISDBLoader
Expand All @@ -14,11 +17,30 @@ public interface ISDBLoader
Dictionary<uint, CharCreateLoadout> LoadCharCreateLoadout();
Dictionary<uint, Dictionary<byte, CharCreateLoadoutSlots>> LoadCharCreateLoadoutSlots();
Dictionary<uint, Deployable> LoadDeployable();
Dictionary<uint, DeployableFunction> LoadDeployableFunction();
Dictionary<uint, DeployableCategory> LoadDeployableCategory();
Dictionary<uint, Faction> LoadFaction();
List<FactionRelations> LoadFactionRelations();
Dictionary<uint, List<FactionReputations>> LoadFactionReputations();
Dictionary<uint, Monster> LoadMonster();
Dictionary<uint, Turret> LoadTurret();
Dictionary<uint, PoseType> LoadPoseType();
Dictionary<uint, CharInfo> LoadCharInfo();
Dictionary<byte, DamageType> LoadDamageType();
Dictionary<byte, DamageResponse> LoadDamageResponse();
Dictionary<uint, DamageResponseDamageType> LoadDamageResponseDamageType();
Dictionary<uint, TinyObject> LoadTinyObject();

// dbencounterdata
Dictionary<uint, MapMarkerInfo> LoadMapMarkerInfo();
Dictionary<uint, SinCardTemplate> LoadSinCardTemplate();

// dbphysicsmaterials
Dictionary<uint, PhysicsMaterial> LoadPhysicsMaterial();

// dbvisualrecords
Dictionary<uint, WarpaintPalette> LoadWarpaintPalettes();
Dictionary<uint, VisualRecord> LoadVisualRecord();

// dbitems
Dictionary<uint, AttributeCategory> LoadAttributeCategory();
Expand All @@ -35,11 +57,22 @@ public interface ISDBLoader
Dictionary<uint, WeaponScope> LoadWeaponScope();
Dictionary<uint, WeaponUnderbarrel> LoadWeaponUnderbarrel();
Dictionary<uint, Ammo> LoadAmmo();
Dictionary<uint, LevelBand> LoadLevelBand();
Dictionary<uint, ResourceNodeBeacon> LoadResourceNodeBeacon();
Dictionary<KeyValuePair<uint, uint>, LevelCategoryScalars> LoadLevelCategoryScalars();
Dictionary<uint, FrameProgressionLevel> LoadFrameProgressionLevel();
Dictionary<uint, Blueprints> LoadBlueprints();
Dictionary<uint, List<Blueprint_Items>> LoadBlueprintItems();
Dictionary<uint, List<BattleframeVisuals>> LoadBattleframeVisuals();

// dbzonemetadata
Dictionary<uint, ZoneRecord> LoadZoneRecord();

// apt
Dictionary<uint, BaseCommandDef> LoadBaseCommandDef();
Dictionary<uint, CommandType> LoadCommandType();
Dictionary<uint, AbilityData> LoadAbilityData();
Dictionary<uint, ActiveInitiationCommandDef> LoadActiveInitiationCommandDef();
Dictionary<uint, ImpactApplyEffectCommandDef> LoadImpactApplyEffectCommandDef();
Dictionary<uint, ConditionalBranchCommandDef> LoadConditionalBranchCommandDef();
Dictionary<uint, WhileLoopCommandDef> LoadWhileLoopCommandDef();
Expand All @@ -51,6 +84,7 @@ public interface ISDBLoader
Dictionary<uint, InstantActivationCommandDef> LoadInstantActivationCommandDef();
Dictionary<uint, StagedActivationCommandDef> LoadStagedActivationCommandDef();
Dictionary<uint, StatusEffectData> LoadStatusEffectData();
Dictionary<uint, HashSet<uint>> LoadStatusEffectTags();
Dictionary<uint, TargetPBAECommandDef> LoadTargetPBAECommandDef();
Dictionary<uint, TargetConeAECommandDef> LoadTargetConeAECommandDef();
Dictionary<uint, TargetClearCommandDef> LoadTargetClearCommandDef();
Expand Down Expand Up @@ -230,4 +264,5 @@ public interface ISDBLoader
Dictionary<uint, TurretComponentDef> LoadTurretComponentDef();
Dictionary<uint, DeployableComponentDef> LoadDeployableComponentDef();
Dictionary<uint, SpawnPointComponentDef> LoadSpawnPointComponentDef();
Dictionary<uint, HullSegmentDef> LoadHullSegmentDef();
}
166 changes: 164 additions & 2 deletions UdpHosts/GameServer/StaticDB/Loaders/StaticDBLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ namespace GameServer.Data.SDB;
using Records.apt;
using Records.aptfs;
using Records.dbcharacter;
using Records.dbencounterdata;
using Records.dbitems;
using Records.dbviusalrecords;
using Records.dbphysicsmaterials;
using Records.dbvisualrecords;
using Records.dbzonemetadata;
using Records.vcs;
using Serilog;
using Shared.Common;
Expand Down Expand Up @@ -51,6 +54,37 @@ public Dictionary<uint, Deployable> LoadDeployable()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, DeployableFunction> LoadDeployableFunction()
{
return LoadStaticDB<DeployableFunction>("dbcharacter::DeployableFunction")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, DeployableCategory> LoadDeployableCategory()
{
return LoadStaticDB<DeployableCategory>("dbcharacter::DeployableCategory")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, Faction> LoadFaction()
{
return LoadStaticDB<Faction>("dbcharacter::Faction")
.ToDictionary(row => row.Id);
}

public List<FactionRelations> LoadFactionRelations()
{
return LoadStaticDB<FactionRelations>("dbcharacter::FactionRelations")
.ToList();
}

public Dictionary<uint, List<FactionReputations>> LoadFactionReputations()
{
return LoadStaticDB<FactionReputations>("dbcharacter::FactionReputations")
.GroupBy(row => row.FactionId)
.ToDictionary(group => group.Key, group => group.ToList());
}

public Dictionary<uint, Monster> LoadMonster()
{
return LoadStaticDB<Monster>("dbcharacter::Monster")
Expand All @@ -63,12 +97,30 @@ public Dictionary<uint, Turret> LoadTurret()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, MapMarkerInfo> LoadMapMarkerInfo()
{
return LoadStaticDB<MapMarkerInfo>("dbencounterdata::MapMarkerInfo")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, SinCardTemplate> LoadSinCardTemplate()
{
return LoadStaticDB<SinCardTemplate>("dbencounterdata::SinCardTemplate")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, WarpaintPalette> LoadWarpaintPalettes()
{
return LoadStaticDB<WarpaintPalette>("dbvisualrecords::WarpaintPalette")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, VisualRecord> LoadVisualRecord()
{
return LoadStaticDB<VisualRecord>("dbvisualrecords::VisualRecord")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, AttributeCategory> LoadAttributeCategory()
{
return LoadStaticDB<AttributeCategory>("dbitems::AttributeCategory")
Expand Down Expand Up @@ -113,6 +165,13 @@ public Dictionary<uint, Battleframe> LoadBattleframe()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, List<BattleframeVisuals>> LoadBattleframeVisuals()
{
return LoadStaticDB<BattleframeVisuals>("dbitems::BattleframeVisuals")
.GroupBy(row => row.VisualGroup)
.ToDictionary(group => group.Key, group => group.ToList());
}

public Dictionary<uint, AbilityModule> LoadAbilityModule()
{
return LoadStaticDB<AbilityModule>("dbitems::AbilityModule")
Expand Down Expand Up @@ -143,6 +202,12 @@ public Dictionary<uint, AbilityData> LoadAbilityData()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, ActiveInitiationCommandDef> LoadActiveInitiationCommandDef()
{
return LoadStaticDB<ActiveInitiationCommandDef>("apt::ActiveInitiationCommandDef")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, ImpactApplyEffectCommandDef> LoadImpactApplyEffectCommandDef()
{
return LoadStaticDB<ImpactApplyEffectCommandDef>("apt::ImpactApplyEffectCommandDef")
Expand Down Expand Up @@ -877,6 +942,12 @@ public Dictionary<uint, SpawnPointComponentDef> LoadSpawnPointComponentDef()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, HullSegmentDef> LoadHullSegmentDef()
{
return LoadStaticDB<HullSegmentDef>("vcs::HullSegmentDef")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, TargetSingleCommandDef> LoadTargetSingleCommandDef()
{
return LoadStaticDB<TargetSingleCommandDef>("apt::TargetSingleCommandDef")
Expand Down Expand Up @@ -1309,12 +1380,93 @@ public Dictionary<uint, Ammo> LoadAmmo()
.ToDictionary(row => row.Id);
}

public Dictionary<uint, LevelBand> LoadLevelBand()
{
return LoadStaticDB<LevelBand>("dbitems::LevelBand")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, ZoneRecord> LoadZoneRecord()
{
return LoadStaticDB<ZoneRecord>("dbzonemetadata::ZoneRecord")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, ResourceNodeBeacon> LoadResourceNodeBeacon()
{
return LoadStaticDB<ResourceNodeBeacon>("dbitems::ResourceNodeBeacon")
.ToDictionary(row => row.Id);
}

public Dictionary<KeyValuePair<uint, uint>, LevelCategoryScalars> LoadLevelCategoryScalars()
{
return LoadStaticDB<LevelCategoryScalars>("dbitems::LevelCategoryScalars")
.GroupBy(row => new KeyValuePair<uint, uint>(row.AttributeCategory, row.Level))
.ToDictionary(group => group.Key, group => group.First());
}

public Dictionary<uint, FrameProgressionLevel> LoadFrameProgressionLevel()
{
return LoadStaticDB<FrameProgressionLevel>("dbitems::FrameProgressionLevel")
.GroupBy(row => row.Level)
.ToDictionary(group => group.Key, group => group.First());
}

public Dictionary<uint, Blueprints> LoadBlueprints()
{
return LoadStaticDB<Blueprints>("dbitems::Blueprints")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, List<Blueprint_Items>> LoadBlueprintItems()
{
return LoadStaticDB<Blueprint_Items>("dbitems::Blueprint_Items")
.GroupBy(row => row.BlueprintId)
.ToDictionary(group => group.Key, group => group.ToList());
}

public Dictionary<uint, PhysicsMaterial> LoadPhysicsMaterial()
{
return LoadStaticDB<PhysicsMaterial>("dbphysicsmaterials::PhysicsMaterial")
.ToDictionary(row => row.Id);
}

public Dictionary<byte, DamageType> LoadDamageType()
{
return LoadStaticDB<DamageType>("dbcharacter::DamageType")
.ToDictionary(row => row.Id);
}

public Dictionary<byte, DamageResponse> LoadDamageResponse()
{
return LoadStaticDB<DamageResponse>("dbcharacter::DamageResponse")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, DamageResponseDamageType> LoadDamageResponseDamageType()
{
return LoadStaticDB<DamageResponseDamageType>("dbcharacter::DamageResponseDamageType")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, TinyObject> LoadTinyObject()
{
return LoadStaticDB<TinyObject>("dbcharacter::TinyObject")
.ToDictionary(row => row.Id);
}

public Dictionary<uint, PoseType> LoadPoseType()
{
return LoadStaticDB<PoseType>("dbcharacter::PoseType")
.ToDictionary(row => row.PoseId);
}

public Dictionary<uint, CharInfo> LoadCharInfo()
{
return LoadStaticDB<CharInfo>("dbcharacter::CharInfo")
.ToDictionary(row => row.Id);
}

private static T[] LoadStaticDB<T>(string tableName)
where T : class, new()
{
Expand Down Expand Up @@ -1350,7 +1502,17 @@ private static T[] LoadStaticDB<T>(string tableName)
{
if (prop.Index != -1)
{
prop.PropInfo.SetValue(entry, row[prop.Index], null);
if (prop.PropInfo.PropertyType == typeof(string))
{
// FauFau SDB parser leaves null characters in strings, which can break things for us if we try to send one of these strings in a network message, so let's make sure that can't happen.
string rawStr = (string)row[prop.Index];
string cleanStr = rawStr.Replace("\0", string.Empty);
prop.PropInfo.SetValue(entry, cleanStr, null);
}
else
{
prop.PropInfo.SetValue(entry, row[prop.Index], null);
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace GameServer.Data.SDB.Records.apt;
public record class UpdateWaitAndFireOnceCommandDef : ICommandDef
{
public uint Chain { get; set; }
public uint Duration { get; set; }
public uint Duration { get; set; }
public uint Id { get; set; }
public byte Regop { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
namespace GameServer.Data.SDB.Records.dbcharacter;

public record class DamageType
{
public uint LocalizedNameId { get; set; }
public string Color { get; set; }
public uint IconAssetId { get; set; }
public string Name { get; set; }
public ushort DamageReduction { get; set; }
public ushort DamageReductionAttribute { get; set; }
public byte Id { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public record class Faction
public uint JobBoardIconId { get; set; }
public uint DescriptionId { get; set; }
public int MaxReputation { get; set; }
public uint AbbreviatedName { get; set; }
public uint AbbreviatedNameId { get; set; }
public int MinReputation { get; set; }
public uint Id { get; set; }
public byte DefaultStancePriority { get; set; }
Expand Down
14 changes: 7 additions & 7 deletions UdpHosts/GameServer/StaticDB/Records/dbcharacter/TinyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ namespace GameServer.Data.SDB.Records.dbcharacter;
public record class TinyObject
{
public float Size { get; set; }
public int SpawnPfxId { get; set; }
public int PosefileId { get; set; }
public int PfxId { get; set; }
public int SpawnStatusfxId { get; set; }
public int Id { get; set; }
public int HitStatusfxId { get; set; }
public int Flags { get; set; }
public uint SpawnPfxId { get; set; }
public uint PosefileId { get; set; }
public uint PfxId { get; set; }
public uint SpawnStatusfxId { get; set; }
public uint Id { get; set; }
public uint HitStatusfxId { get; set; }
public uint Flags { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace GameServer.Data.SDB.Records.dbfabrication;
public record class Ingredient
{
public uint IngredientId { get; set; }

public uint IngredientGroupId { get; set; }

public uint ItemId { get; set; }

public uint Id { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ namespace GameServer.Data.SDB.Records.dbfabrication;
public record class IngredientGroup
{
public uint NameId { get; set; }

public uint DescriptionId { get; set; }

public uint Id { get; set; }
}
Loading
Loading