diff --git a/source/Coop.Core/Client/Messages/NetworkGameSaveDataReceived.cs b/source/Coop.Core/Client/Messages/NetworkGameSaveDataReceived.cs index 7dc1154e8..bb6b6e5c9 100644 --- a/source/Coop.Core/Client/Messages/NetworkGameSaveDataReceived.cs +++ b/source/Coop.Core/Client/Messages/NetworkGameSaveDataReceived.cs @@ -1,7 +1,7 @@ // Ignore Spelling: Guids using Common.Messaging; -using GameInterface.Services.Heroes.Data; +using GameInterface.Services.Save.Data; using ProtoBuf; namespace Coop.Core.Client.Messages diff --git a/source/Coop.Core/Client/Services/ItemRosters/Handlers/NetworkItemRosterMessageHandler.cs b/source/Coop.Core/Client/Services/ItemRosters/Handlers/NetworkItemRosterMessageHandler.cs index 7c3b81716..934fd39a6 100644 --- a/source/Coop.Core/Client/Services/ItemRosters/Handlers/NetworkItemRosterMessageHandler.cs +++ b/source/Coop.Core/Client/Services/ItemRosters/Handlers/NetworkItemRosterMessageHandler.cs @@ -3,7 +3,7 @@ using Coop.Core.Server.Services.ItemRosters.Messages; using GameInterface.Services.ItemRosters.Messages; -namespace Coop.Core.Client.Services.PartyBases.Handlers +namespace Coop.Core.Client.Services.ItemRosters.Handlers { /// /// Handles NetworkItemRosterUpdate and publishes UpdateItemRoster diff --git a/source/Coop.Core/Client/Services/Settlements/Handlers/ClientSettlementComponentHandler.cs b/source/Coop.Core/Client/Services/Settlements/Handlers/ClientSettlementComponentHandler.cs index 94e7945ec..fbd64058a 100644 --- a/source/Coop.Core/Client/Services/Settlements/Handlers/ClientSettlementComponentHandler.cs +++ b/source/Coop.Core/Client/Services/Settlements/Handlers/ClientSettlementComponentHandler.cs @@ -1,5 +1,6 @@ using Common.Messaging; using Common.Network; +using Coop.Core.Server.Services.Settlements.Messages; using GameInterface.Services.Settlements.Messages; using System; using System.Collections.Generic; diff --git a/source/Coop.Core/Client/Services/Time/Handlers/TimeHandler.cs b/source/Coop.Core/Client/Services/Time/Handlers/TimeHandler.cs index 06ab6cc3d..a005168e7 100644 --- a/source/Coop.Core/Client/Services/Time/Handlers/TimeHandler.cs +++ b/source/Coop.Core/Client/Services/Time/Handlers/TimeHandler.cs @@ -4,6 +4,7 @@ using Coop.Core.Server.Connections.Messages; using Coop.Core.Server.Services.Time.Messages; using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Messages; using Serilog; namespace Coop.Core.Client.Services.Time.Handlers diff --git a/source/Coop.Core/Server/Connections/States/TransferSaveState.cs b/source/Coop.Core/Server/Connections/States/TransferSaveState.cs index 71be261e8..faee0230f 100644 --- a/source/Coop.Core/Server/Connections/States/TransferSaveState.cs +++ b/source/Coop.Core/Server/Connections/States/TransferSaveState.cs @@ -2,8 +2,9 @@ using Common.Network; using Coop.Core.Client.Messages; using Coop.Core.Server.Services.Time.Messages; -using GameInterface.Services.Heroes.Enum; using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Save.Messages; +using GameInterface.Services.Time.Enum; namespace Coop.Core.Server.Connections.States; diff --git a/source/Coop.Core/Server/Services/Connection/Handlers/PeerQueueOverloadedHandler.cs b/source/Coop.Core/Server/Services/Connection/Handlers/PeerQueueOverloadedHandler.cs index 7cbcd2848..ca23d0762 100644 --- a/source/Coop.Core/Server/Services/Connection/Handlers/PeerQueueOverloadedHandler.cs +++ b/source/Coop.Core/Server/Services/Connection/Handlers/PeerQueueOverloadedHandler.cs @@ -5,7 +5,7 @@ using Coop.Core.Server.Services.Time.Handlers; using Coop.Core.Server.Services.Time.Messages; using GameInterface.Services.GameDebug.Messages; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using LiteNetLib; using Serilog; using System; diff --git a/source/Coop.Core/Server/Services/Connection/Handlers/PlayerConnectionServerMessageHandler.cs b/source/Coop.Core/Server/Services/Connection/Handlers/PlayerConnectionServerMessageHandler.cs index 839c16928..1de6883e2 100644 --- a/source/Coop.Core/Server/Services/Connection/Handlers/PlayerConnectionServerMessageHandler.cs +++ b/source/Coop.Core/Server/Services/Connection/Handlers/PlayerConnectionServerMessageHandler.cs @@ -6,7 +6,8 @@ using Coop.Core.Server.Connections.Messages; using Coop.Core.Server.Services.Time.Messages; using GameInterface.Services.GameDebug.Messages; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Save.Messages; +using GameInterface.Services.Time.Messages; using LiteNetLib; using Serilog; using System.Linq; diff --git a/source/Coop.Core/Server/Services/ItemRosters/Handlers/ItemRosterMessageHandler.cs b/source/Coop.Core/Server/Services/ItemRosters/Handlers/ItemRosterMessageHandler.cs index b74602f53..5bd18832a 100644 --- a/source/Coop.Core/Server/Services/ItemRosters/Handlers/ItemRosterMessageHandler.cs +++ b/source/Coop.Core/Server/Services/ItemRosters/Handlers/ItemRosterMessageHandler.cs @@ -3,7 +3,7 @@ using Coop.Core.Server.Services.ItemRosters.Messages; using GameInterface.Services.ItemRosters.Messages; -namespace Coop.Core.Server.Services.PartyBases.Handlers; +namespace Coop.Core.Server.Services.ItemRosters.Handlers; /// /// Handles ItemRosterUpdated and sends network event to all clients. diff --git a/source/Coop.Core/Server/Services/Save/Handlers/SaveGameHandler.cs b/source/Coop.Core/Server/Services/Save/Handlers/SaveGameHandler.cs index f2fbe70c6..251baf5ad 100644 --- a/source/Coop.Core/Server/Services/Save/Handlers/SaveGameHandler.cs +++ b/source/Coop.Core/Server/Services/Save/Handlers/SaveGameHandler.cs @@ -5,6 +5,7 @@ using GameInterface.Services.GameState.Messages; using GameInterface.Services.Heroes.Messages; using GameInterface.Services.MobileParties.Messages.Control; +using GameInterface.Services.Save.Messages; namespace Coop.Core.Server.Services.Save.Handlers; diff --git a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentGold.cs b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentGold.cs index 3cfdb4552..d2761e958 100644 --- a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentGold.cs +++ b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentGold.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; -namespace GameInterface.Services.Settlements.Messages +namespace Coop.Core.Server.Services.Settlements.Messages { /// /// Notify clients of set diff --git a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentIsOwnerUnassigned.cs b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentIsOwnerUnassigned.cs index fc42351dc..03f6b59bb 100644 --- a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentIsOwnerUnassigned.cs +++ b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentIsOwnerUnassigned.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; -namespace GameInterface.Services.Settlements.Messages +namespace Coop.Core.Server.Services.Settlements.Messages { /// /// Notify clients of set diff --git a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentOwner.cs b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentOwner.cs index 329aea05f..0676750ea 100644 --- a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentOwner.cs +++ b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkChangeSettlementComponentOwner.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; -namespace GameInterface.Services.Settlements.Messages +namespace Coop.Core.Server.Services.Settlements.Messages { /// /// Notify clients of set diff --git a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkSettlementAuditResponse.cs b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkSettlementAuditResponse.cs index e0bd648f8..52a6ae3c0 100644 --- a/source/Coop.Core/Server/Services/Settlements/Messages/NetworkSettlementAuditResponse.cs +++ b/source/Coop.Core/Server/Services/Settlements/Messages/NetworkSettlementAuditResponse.cs @@ -1,7 +1,8 @@ using Common.Messaging; +using GameInterface.Services.Settlements.Audit; using ProtoBuf; -namespace GameInterface.Services.Settlements.Audit; +namespace Coop.Core.Server.Services.Settlements.Messages; /// /// Response message for the settlement audit. diff --git a/source/Coop.Core/Server/Services/Time/Handlers/TimeHandler.cs b/source/Coop.Core/Server/Services/Time/Handlers/TimeHandler.cs index 35ea8f2c5..249eda6e2 100644 --- a/source/Coop.Core/Server/Services/Time/Handlers/TimeHandler.cs +++ b/source/Coop.Core/Server/Services/Time/Handlers/TimeHandler.cs @@ -3,8 +3,9 @@ using Common.Network; using Coop.Core.Server.Connections; using Coop.Core.Server.Services.Time.Messages; -using GameInterface.Services.Heroes.Enum; using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using Serilog; using System; using System.Collections.Generic; diff --git a/source/Coop.Core/Server/Services/Time/Messages/NetworkChangeTimeControlMode.cs b/source/Coop.Core/Server/Services/Time/Messages/NetworkChangeTimeControlMode.cs index 3ac6246f8..3a546e1d8 100644 --- a/source/Coop.Core/Server/Services/Time/Messages/NetworkChangeTimeControlMode.cs +++ b/source/Coop.Core/Server/Services/Time/Messages/NetworkChangeTimeControlMode.cs @@ -1,5 +1,5 @@ using Common.Messaging; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using ProtoBuf; namespace Coop.Core.Server.Services.Time.Messages; diff --git a/source/Coop.Core/Server/Services/Time/Messages/NetworkRequestTimeSpeedChange.cs b/source/Coop.Core/Server/Services/Time/Messages/NetworkRequestTimeSpeedChange.cs index 0428f18ce..d1df17531 100644 --- a/source/Coop.Core/Server/Services/Time/Messages/NetworkRequestTimeSpeedChange.cs +++ b/source/Coop.Core/Server/Services/Time/Messages/NetworkRequestTimeSpeedChange.cs @@ -1,6 +1,6 @@ using Common.Logging.Attributes; using Common.Messaging; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using ProtoBuf; namespace Coop.Core.Server.Services.Time.Messages; diff --git a/source/Coop.IntegrationTests/MobileParties/MilitiaPartyComponentSettlementTest.cs b/source/Coop.IntegrationTests/MobileParties/MilitiaPartyComponentSettlementTest.cs index e45e9a1b4..38af61543 100644 --- a/source/Coop.IntegrationTests/MobileParties/MilitiaPartyComponentSettlementTest.cs +++ b/source/Coop.IntegrationTests/MobileParties/MilitiaPartyComponentSettlementTest.cs @@ -6,8 +6,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Coop.Core.Server.Services.Settlements.Messages; -namespace Coop.IntegrationTests.Settlement +namespace Coop.IntegrationTests.MobileParties { /// /// Test syncs for diff --git a/source/Coop.IntegrationTests/MobileParties/TimeControlTest.cs b/source/Coop.IntegrationTests/MobileParties/TimeControlTest.cs index af15ebe0e..6a578d312 100644 --- a/source/Coop.IntegrationTests/MobileParties/TimeControlTest.cs +++ b/source/Coop.IntegrationTests/MobileParties/TimeControlTest.cs @@ -1,6 +1,6 @@ using Coop.IntegrationTests.Environment; -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using TaleWorlds.CampaignSystem; namespace Coop.IntegrationTests.MobileParties; diff --git a/source/Coop.IntegrationTests/Settlements/SettlementComponentIsOwnerUnassignedTest.cs b/source/Coop.IntegrationTests/Settlements/SettlementComponentIsOwnerUnassignedTest.cs index 104eb1e94..92b0469dd 100644 --- a/source/Coop.IntegrationTests/Settlements/SettlementComponentIsOwnerUnassignedTest.cs +++ b/source/Coop.IntegrationTests/Settlements/SettlementComponentIsOwnerUnassignedTest.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Coop.Core.Server.Services.Settlements.Messages; namespace Coop.IntegrationTests.Settlements { diff --git a/source/Coop.IntegrationTests/Settlements/SettlementComponentOwnerTest.cs b/source/Coop.IntegrationTests/Settlements/SettlementComponentOwnerTest.cs index bd6ed908e..ff1ad83ab 100644 --- a/source/Coop.IntegrationTests/Settlements/SettlementComponentOwnerTest.cs +++ b/source/Coop.IntegrationTests/Settlements/SettlementComponentOwnerTest.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Coop.Core.Server.Services.Settlements.Messages; namespace Coop.IntegrationTests.Settlements { diff --git a/source/Coop.Tests/Client/Services/Time/TimeHandlerTests.cs b/source/Coop.Tests/Client/Services/Time/TimeHandlerTests.cs index b0e0cd46a..0908ca477 100644 --- a/source/Coop.Tests/Client/Services/Time/TimeHandlerTests.cs +++ b/source/Coop.Tests/Client/Services/Time/TimeHandlerTests.cs @@ -3,8 +3,8 @@ using Coop.Core.Client.Services.Time.Handlers; using Coop.Core.Server.Services.Time.Messages; using Coop.Tests.Mocks; -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using System.Linq; using Xunit; diff --git a/source/Coop.Tests/Server/Connections/States/TransferCharacterStateTests.cs b/source/Coop.Tests/Server/Connections/States/TransferCharacterStateTests.cs index 1b88ac3c1..f2fe06ea8 100644 --- a/source/Coop.Tests/Server/Connections/States/TransferCharacterStateTests.cs +++ b/source/Coop.Tests/Server/Connections/States/TransferCharacterStateTests.cs @@ -7,7 +7,7 @@ using Coop.Core.Server.Connections.Messages; using Coop.Core.Server.Connections.States; using Coop.Tests.Mocks; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Save.Messages; using LiteNetLib; using System.Linq; using Xunit; diff --git a/source/Coop.Tests/Server/Services/Connection/PeerQueueOverloadedTests.cs b/source/Coop.Tests/Server/Services/Connection/PeerQueueOverloadedTests.cs index a514258d8..5467be3c6 100644 --- a/source/Coop.Tests/Server/Services/Connection/PeerQueueOverloadedTests.cs +++ b/source/Coop.Tests/Server/Services/Connection/PeerQueueOverloadedTests.cs @@ -4,8 +4,8 @@ using Coop.Core.Server.Services.Time.Messages; using Coop.Tests.Extensions; using Coop.Tests.Mocks; -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using System; using System.Linq; using Xunit; diff --git a/source/Coop.Tests/Server/Services/Time/TimeHandlerTests.cs b/source/Coop.Tests/Server/Services/Time/TimeHandlerTests.cs index 5985ebc26..0b0726691 100644 --- a/source/Coop.Tests/Server/Services/Time/TimeHandlerTests.cs +++ b/source/Coop.Tests/Server/Services/Time/TimeHandlerTests.cs @@ -5,8 +5,8 @@ using Coop.Core.Server.Services.Time.Handlers; using Coop.Core.Server.Services.Time.Messages; using Coop.Tests.Mocks; -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using LiteNetLib; using System; using System.Collections.Generic; diff --git a/source/E2E.Tests/Services/ItemObjects/ItemObjectSyncTest.cs b/source/E2E.Tests/Services/ItemObjects/ItemObjectSyncTest.cs index 0cfc9034a..8ebdf8f8a 100644 --- a/source/E2E.Tests/Services/ItemObjects/ItemObjectSyncTest.cs +++ b/source/E2E.Tests/Services/ItemObjects/ItemObjectSyncTest.cs @@ -1,16 +1,12 @@ using Common.Util; using E2E.Tests.Environment; using HarmonyLib; -using System.Runtime.ConstrainedExecution; -using System.Runtime.InteropServices; -using TaleWorlds.CampaignSystem; -using TaleWorlds.CampaignSystem.Settlements.Buildings; -using TaleWorlds.CampaignSystem.Siege; using TaleWorlds.Core; +using TaleWorlds.Library; using TaleWorlds.Localization; using Xunit.Abstractions; -namespace E2E.Tests.Services.ItemObjectService +namespace E2E.Tests.Services.ItemObjects { public class ItemObjectSyncTest : IDisposable { @@ -35,14 +31,58 @@ public void ServerCreateItemObject_SyncAllClients() string? itemObjectId = null; var typeField = AccessTools.Field(typeof(ItemObject), nameof(ItemObject.Type)); - var typeIntercept = TestEnvironment.GetIntercept(typeField); - + + var culture = new BasicCultureObject() { Name = new TextObject("Battania") }; + var weaponDesign = ObjectHelper.SkipConstructor(); + var holsterPositionShift = new Vec3(1, 2, 3, 4); + string[] itemHolsters = { "holster12", "holster23", "holster34" }; + var itemComponent = new TradeItemComponent(); + var itemCategory = ObjectHelper.SkipConstructor(); + var prerequisiteItem = new ItemObject(); + var itemTypeEnum = ItemObject.ItemTypeEnum.OneHandedWeapon; server.Call(() => { ItemObject itemObject = new ItemObject(); Assert.True(server.ObjectManager.TryGetId(itemObject, out itemObjectId)); + + itemObject.Weight = 3.5f; + itemObject.Name = new TextObject("Name"); + itemObject.MultiMeshName = "MultiMeshName"; + itemObject.HolsterMeshName = "HolsterMeshName"; + itemObject.HolsterWithWeaponMeshName = "WithWeaponMeshName"; + itemObject.HolsterPositionShift = holsterPositionShift; + itemObject.FlyingMeshName = "FlyingMeshName"; + itemObject.BodyName = "BodyName"; + itemObject.HolsterBodyName = "HolsterBodyName"; + itemObject.CollisionBodyName = "CollisionBodyName"; + itemObject.RecalculateBody = false; + itemObject.Culture = culture; + itemObject.Difficulty = 1; + itemObject.ScaleFactor = 3.5f; + itemObject.ItemFlags = ItemFlags.Civilian; + itemObject.Appearance = 3.5f; + itemObject.WeaponDesign = weaponDesign; + itemObject.ItemHolsters = itemHolsters; + + //Rest of Properties + itemObject.ItemComponent = itemComponent; + itemObject.HasLowerHolsterPriority = true; + itemObject.PrefabName = "PrefabName"; + itemObject.ItemCategory = itemCategory; + itemObject.Value = 1; + itemObject.Effectiveness = 3.5f; + itemObject.IsUsingTableau = true; + itemObject.ArmBandMeshName = "ArmBandMeshName"; + itemObject.IsFood = true; + itemObject.IsUniqueItem = true; + itemObject.MultiplayerItem = true; + itemObject.NotMerchandise = true; + itemObject.IsCraftedByPlayer = true; + itemObject.LodAtlasIndex = 1; + itemObject.PrerequisiteItem = prerequisiteItem; + itemObject.ItemType = itemTypeEnum; }); // Assert @@ -50,19 +90,75 @@ public void ServerCreateItemObject_SyncAllClients() server.Call(() => { - typeIntercept.Invoke(null, new object[] { itemObject, 69 }); + //typeIntercept.Invoke(null, new object[] { itemObject, 69 }); }); - server.ObjectManager.TryGetId(itemObject, out string serverObjectId); + Assert.True(server.ObjectManager.TryGetId(itemObject, out string serverObjectId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.Culture, out string serverCultureId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.WeaponDesign, out string serverWeaponDesignId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.ItemHolsters, out string serverItemHolstersId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.ItemComponent, out string serverItemComponentId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.ItemCategory, out string serverItemCategoryId)); + Assert.True(server.ObjectManager.TryGetId(itemObject.PrerequisiteItem, out string serverPrerequisiteItemId)); foreach (var client in TestEnvironment.Clients) { Assert.True(client.ObjectManager.TryGetObject(serverObjectId, out ItemObject clientItemObject)); + + //Field Assert.Equal(itemObject.Type, clientItemObject.Type); - client.ObjectManager.TryGetId(clientItemObject, out string clientObjectId); - + Assert.True(client.ObjectManager.TryGetId(clientItemObject, out string clientObjectId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.Culture, out string clientCultureId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.WeaponDesign, out string clientWeaponDesignId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.ItemHolsters, out string clientItemHolstersId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.ItemComponent, out string clientItemComponentId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.ItemCategory, out string clientItemCategoryId)); + Assert.True(client.ObjectManager.TryGetId(clientItemObject.PrerequisiteItem, out string clientPrerequisiteItemId)); Assert.Equal(serverObjectId, clientObjectId); + + + //Properties + Assert.Equal(3.5f, clientItemObject.Weight); + Assert.Equal("Name", clientItemObject.Name.ToString()); + Assert.Equal("MultiMeshName", clientItemObject.MultiMeshName); + Assert.Equal("HolsterMeshName", clientItemObject.HolsterMeshName); + Assert.Equal("WithWeaponMeshName", clientItemObject.HolsterWithWeaponMeshName); + Assert.Equal(holsterPositionShift, clientItemObject.HolsterPositionShift); + Assert.Equal("FlyingMeshName", clientItemObject.FlyingMeshName); + Assert.Equal("BodyName", clientItemObject.BodyName); + Assert.Equal("HolsterBodyName", clientItemObject.HolsterBodyName); + Assert.Equal("CollisionBodyName", clientItemObject.CollisionBodyName); + Assert.False(clientItemObject.RecalculateBody); + Assert.Equal(clientCultureId, serverCultureId); + Assert.Equal(1, clientItemObject.Difficulty); + Assert.Equal(3.5f, clientItemObject.ScaleFactor); + Assert.Equal(ItemFlags.Civilian, clientItemObject.ItemFlags); + Assert.Equal(3.5f, clientItemObject.Appearance); + Assert.Equal(clientWeaponDesignId, serverWeaponDesignId); + + //Rest of Properties + Assert.Equal(serverItemComponentId, clientItemComponentId); + Assert.True(clientItemObject.HasLowerHolsterPriority); + Assert.Equal("PrefabName", clientItemObject.PrefabName); + Assert.Equal(serverItemCategoryId, clientItemCategoryId); + Assert.Equal(1, clientItemObject.Value); + Assert.Equal(3.5f, clientItemObject.Effectiveness); + Assert.True(clientItemObject.IsUsingTableau); + Assert.Equal("ArmBandMeshName", clientItemObject.ArmBandMeshName); + Assert.True(clientItemObject.IsFood); + Assert.True(clientItemObject.IsUniqueItem); + Assert.True(clientItemObject.MultiplayerItem); + Assert.True(clientItemObject.NotMerchandise); + Assert.True(clientItemObject.IsCraftedByPlayer); + Assert.Equal(1, clientItemObject.LodAtlasIndex); + Assert.Equal(serverPrerequisiteItemId, clientPrerequisiteItemId); + Assert.Equal(ItemObject.ItemTypeEnum.OneHandedWeapon, clientItemObject.ItemType); + + //Collection + Assert.Equal(itemHolsters, clientItemObject.ItemHolsters); + Assert.Equal(itemHolsters[0], clientItemObject.ItemHolsters[0]); + Assert.Equal(serverItemHolstersId, clientItemHolstersId); } } } diff --git a/source/E2E.Tests/Services/Kingdoms/KingdomCreationTests.cs b/source/E2E.Tests/Services/Kingdoms/KingdomCreationTests.cs index 76cc881a4..78fd8827f 100644 --- a/source/E2E.Tests/Services/Kingdoms/KingdomCreationTests.cs +++ b/source/E2E.Tests/Services/Kingdoms/KingdomCreationTests.cs @@ -4,7 +4,7 @@ using TaleWorlds.CampaignSystem.Party; using Xunit.Abstractions; -namespace E2E.Tests.Services.Armies; +namespace E2E.Tests.Services.Kingdoms; public class ArmyCreationTests : IDisposable { E2ETestEnvironment TestEnvironment { get; } diff --git a/source/E2E.Tests/Services/MBBodyProperties/MapEventLifetimeTests.cs b/source/E2E.Tests/Services/MBBodyProperties/MapEventLifetimeTests.cs index 2bee85ebe..250eaecd1 100644 --- a/source/E2E.Tests/Services/MBBodyProperties/MapEventLifetimeTests.cs +++ b/source/E2E.Tests/Services/MBBodyProperties/MapEventLifetimeTests.cs @@ -4,7 +4,7 @@ using TaleWorlds.Core; using Xunit.Abstractions; -namespace E2E.Tests.Services.MBBodyPropertys; +namespace E2E.Tests.Services.MBBodyProperties; public class MBBodyPropertyLifetimeTests : IDisposable { E2ETestEnvironment TestEnvironment { get; } diff --git a/source/E2E.Tests/Services/MapEventSides/MapEventSideLifetimeTests.cs b/source/E2E.Tests/Services/MapEventSides/MapEventSideLifetimeTests.cs index 16733065d..e243fb47c 100644 --- a/source/E2E.Tests/Services/MapEventSides/MapEventSideLifetimeTests.cs +++ b/source/E2E.Tests/Services/MapEventSides/MapEventSideLifetimeTests.cs @@ -5,7 +5,7 @@ using TaleWorlds.Core; using Xunit.Abstractions; -namespace E2E.Tests.Services.MapEvents; +namespace E2E.Tests.Services.MapEventSides; public class MapEventSideLifetimeTests : IDisposable { E2ETestEnvironment TestEnvironment { get; } diff --git a/source/GameInterface/Exceptions/Exceptions.cs b/source/GameInterface/Exceptions/Exceptions.cs index a1a3f39ab..c96b762eb 100644 --- a/source/GameInterface/Exceptions/Exceptions.cs +++ b/source/GameInterface/Exceptions/Exceptions.cs @@ -1,6 +1,6 @@ using System; -namespace Coop.Mod.Patch +namespace GameInterface.Exceptions { public class MethodNotFoundException : Exception { diff --git a/source/GameInterface/Services/Arenas/Patches/DisableAlleyCampaignBehavior.cs b/source/GameInterface/Services/Arenas/Patches/DisableAlleyCampaignBehavior.cs index 01c16284b..f1107cd3d 100644 --- a/source/GameInterface/Services/Arenas/Patches/DisableAlleyCampaignBehavior.cs +++ b/source/GameInterface/Services/Arenas/Patches/DisableAlleyCampaignBehavior.cs @@ -2,7 +2,7 @@ using SandBox.CampaignBehaviors; using TaleWorlds.CampaignSystem.CampaignBehaviors.AiBehaviors; -namespace GameInterface.Services.Alleys.Patches; +namespace GameInterface.Services.Arenas.Patches; [HarmonyPatch(typeof(ArenaMasterCampaignBehavior))] internal class DisableArenaMasterCampaignBehavior diff --git a/source/GameInterface/Services/Barbers/Patches/DisableBarberCampaignBehavior.cs b/source/GameInterface/Services/Barbers/Patches/DisableBarberCampaignBehavior.cs index b7c81bc8f..20bad2eb8 100644 --- a/source/GameInterface/Services/Barbers/Patches/DisableBarberCampaignBehavior.cs +++ b/source/GameInterface/Services/Barbers/Patches/DisableBarberCampaignBehavior.cs @@ -2,7 +2,7 @@ using SandBox.CampaignBehaviors; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Banners.Patches; +namespace GameInterface.Services.Barbers.Patches; [HarmonyPatch(typeof(BarberCampaignBehavior))] internal class DisableBarberCampaignBehavior diff --git a/source/GameInterface/Services/Barters/Patches/DisableGoldBarterBehavior.cs b/source/GameInterface/Services/Barters/Patches/DisableGoldBarterBehavior.cs index 86ee8be6e..3593445b2 100644 --- a/source/GameInterface/Services/Barters/Patches/DisableGoldBarterBehavior.cs +++ b/source/GameInterface/Services/Barters/Patches/DisableGoldBarterBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors.BarterBehaviors; -namespace GameInterface.Services.Settlements.Patches; +namespace GameInterface.Services.Barters.Patches; [HarmonyPatch(typeof(GoldBarterBehavior))] internal class DisableGoldBarterBehavior diff --git a/source/GameInterface/Services/BesiegerCamps/Commands/BesiegerCampDebugCommand.cs b/source/GameInterface/Services/BesiegerCamps/Commands/BesiegerCampDebugCommand.cs index 1b1405502..05c8e7efe 100644 --- a/source/GameInterface/Services/BesiegerCamps/Commands/BesiegerCampDebugCommand.cs +++ b/source/GameInterface/Services/BesiegerCamps/Commands/BesiegerCampDebugCommand.cs @@ -7,7 +7,7 @@ using TaleWorlds.CampaignSystem.Siege; using static TaleWorlds.Library.CommandLineFunctionality; -namespace GameInterface.Services.Villages.Commands; +namespace GameInterface.Services.BesiegerCamps.Commands; public class BesiegerCampDebugCommand { diff --git a/source/GameInterface/Services/BesiegerCamps/Handlers/BesiegerCampBesiegerPartyHandler.cs b/source/GameInterface/Services/BesiegerCamps/Handlers/BesiegerCampBesiegerPartyHandler.cs index 6523ba7c5..422b62e58 100644 --- a/source/GameInterface/Services/BesiegerCamps/Handlers/BesiegerCampBesiegerPartyHandler.cs +++ b/source/GameInterface/Services/BesiegerCamps/Handlers/BesiegerCampBesiegerPartyHandler.cs @@ -1,7 +1,6 @@ using Common.Logging; using Common.Messaging; using Common.Network; -using GameInterface.Services.BesiegerCamps.Messages; using GameInterface.Services.BesiegerCamps.Messages.Collection; using GameInterface.Services.ObjectManager; using Serilog; diff --git a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyAdded.cs b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyAdded.cs index fe019fc73..7aed00527 100644 --- a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyAdded.cs +++ b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyAdded.cs @@ -2,7 +2,7 @@ using TaleWorlds.CampaignSystem.Party; using TaleWorlds.CampaignSystem.Siege; -namespace GameInterface.Services.BesiegerCamps.Messages; +namespace GameInterface.Services.BesiegerCamps.Messages.Collection; /// /// Internal event for diff --git a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyRemoved.cs b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyRemoved.cs index f4ce804d3..84fa80f06 100644 --- a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyRemoved.cs +++ b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/BesiegerPartyRemoved.cs @@ -2,7 +2,7 @@ using TaleWorlds.CampaignSystem.Party; using TaleWorlds.CampaignSystem.Siege; -namespace GameInterface.Services.BesiegerCamps.Messages; +namespace GameInterface.Services.BesiegerCamps.Messages.Collection; /// /// Internal event for diff --git a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkAddBesiegerParty.cs b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkAddBesiegerParty.cs index 7d829842c..9e974356c 100644 --- a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkAddBesiegerParty.cs +++ b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkAddBesiegerParty.cs @@ -1,9 +1,8 @@ using Common.Messaging; -using GameInterface.Services.BesiegerCamps.Messages.Collection; using ProtoBuf; using TaleWorlds.CampaignSystem.Siege; -namespace GameInterface.Services.BesiegerCamps.Messages; +namespace GameInterface.Services.BesiegerCamps.Messages.Collection; /// /// Command to add an besieger party on diff --git a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkRemoveBesiegerParty.cs b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkRemoveBesiegerParty.cs index ced638ac0..ade190e94 100644 --- a/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkRemoveBesiegerParty.cs +++ b/source/GameInterface/Services/BesiegerCamps/Messages/Collection/NetworkRemoveBesiegerParty.cs @@ -1,8 +1,7 @@ using Common.Messaging; -using GameInterface.Services.BesiegerCamps.Messages.Collection; using ProtoBuf; -namespace GameInterface.Services.BesiegerCamps.Messages; +namespace GameInterface.Services.BesiegerCamps.Messages.Collection; /// /// Command to remove an besieger party on diff --git a/source/GameInterface/Services/BesiegerCamps/Patches/BesiegerCampCollectionPatches.cs b/source/GameInterface/Services/BesiegerCamps/Patches/BesiegerCampCollectionPatches.cs index 40da2159d..2553cf42e 100644 --- a/source/GameInterface/Services/BesiegerCamps/Patches/BesiegerCampCollectionPatches.cs +++ b/source/GameInterface/Services/BesiegerCamps/Patches/BesiegerCampCollectionPatches.cs @@ -1,4 +1,4 @@ -using GameInterface.Services.BesiegerCamps.Messages; +using GameInterface.Services.BesiegerCamps.Messages.Collection; using GameInterface.Utils; using HarmonyLib; using System.Collections.Generic; diff --git a/source/GameInterface/Services/Buildings/Handlers/BuildingLifetimeHandler.cs b/source/GameInterface/Services/Buildings/Handlers/BuildingLifetimeHandler.cs index 1b0feee71..7b35b5ba7 100644 --- a/source/GameInterface/Services/Buildings/Handlers/BuildingLifetimeHandler.cs +++ b/source/GameInterface/Services/Buildings/Handlers/BuildingLifetimeHandler.cs @@ -2,7 +2,7 @@ using Common.Messaging; using Common.Network; using Common.Util; -using GameInterface.Services.Armies.Messages.Lifetime; +using GameInterface.Services.Buildings.Messages; using GameInterface.Services.ObjectManager; using Serilog; using System; diff --git a/source/GameInterface/Services/Buildings/Messages/BuildingCreated.cs b/source/GameInterface/Services/Buildings/Messages/BuildingCreated.cs index 900b5b747..32824cff8 100644 --- a/source/GameInterface/Services/Buildings/Messages/BuildingCreated.cs +++ b/source/GameInterface/Services/Buildings/Messages/BuildingCreated.cs @@ -5,7 +5,7 @@ using TaleWorlds.CampaignSystem.Settlements; using TaleWorlds.CampaignSystem.Settlements.Buildings; -namespace GameInterface.Services.Armies.Messages.Lifetime; +namespace GameInterface.Services.Buildings.Messages; /// /// Event to create a new building. diff --git a/source/GameInterface/Services/Buildings/Messages/NetworkCreateBuilding.cs b/source/GameInterface/Services/Buildings/Messages/NetworkCreateBuilding.cs index 548ed9200..ac908738b 100644 --- a/source/GameInterface/Services/Buildings/Messages/NetworkCreateBuilding.cs +++ b/source/GameInterface/Services/Buildings/Messages/NetworkCreateBuilding.cs @@ -1,7 +1,7 @@ using Common.Messaging; using ProtoBuf; -namespace GameInterface.Services.Armies.Messages.Lifetime; +namespace GameInterface.Services.Buildings.Messages; [ProtoContract(SkipConstructor = true)] internal class NetworkCreateBuilding : ICommand diff --git a/source/GameInterface/Services/Clans/Commands/ClanDebugCommands.cs b/source/GameInterface/Services/Clans/Commands/ClanDebugCommands.cs index 6f8428b36..6b46f0efc 100644 --- a/source/GameInterface/Services/Clans/Commands/ClanDebugCommands.cs +++ b/source/GameInterface/Services/Clans/Commands/ClanDebugCommands.cs @@ -8,7 +8,7 @@ using TaleWorlds.CampaignSystem.Settlements; using static TaleWorlds.Library.CommandLineFunctionality; -namespace GameInterface.Services.GameDebug.Commands +namespace GameInterface.Services.Clans.Commands { public class ClanDebugCommands { diff --git a/source/GameInterface/Services/Clans/Patches/ClanLifetimePatches.cs b/source/GameInterface/Services/Clans/Patches/ClanLifetimePatches.cs index 3310bea34..981acc95f 100644 --- a/source/GameInterface/Services/Clans/Patches/ClanLifetimePatches.cs +++ b/source/GameInterface/Services/Clans/Patches/ClanLifetimePatches.cs @@ -16,7 +16,7 @@ using TaleWorlds.CampaignSystem.Actions; using TaleWorlds.ObjectSystem; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.Clans.Patches; /// /// Patches for lifecycle of objects. diff --git a/source/GameInterface/Services/Companions/Patches/DisableCompanionGrievanceBehavior.cs b/source/GameInterface/Services/Companions/Patches/DisableCompanionGrievanceBehavior.cs index 4b414db3d..0ef7e56c5 100644 --- a/source/GameInterface/Services/Companions/Patches/DisableCompanionGrievanceBehavior.cs +++ b/source/GameInterface/Services/Companions/Patches/DisableCompanionGrievanceBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Cheats.Patches +namespace GameInterface.Services.Companions.Patches { [HarmonyPatch(typeof(CompanionGrievanceBehavior))] internal class DisableCompanionGrievanceBehavior diff --git a/source/GameInterface/Services/Companions/Patches/DisableCompanionRolesCampaignBehavior.cs b/source/GameInterface/Services/Companions/Patches/DisableCompanionRolesCampaignBehavior.cs index 48d94e34c..aee0b2bb4 100644 --- a/source/GameInterface/Services/Companions/Patches/DisableCompanionRolesCampaignBehavior.cs +++ b/source/GameInterface/Services/Companions/Patches/DisableCompanionRolesCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using SandBox.CampaignBehaviors; -namespace GameInterface.Services.Cheats.Patches +namespace GameInterface.Services.Companions.Patches { [HarmonyPatch(typeof(CompanionRolesCampaignBehavior))] internal class DisableCompanionRolesCampaignBehavior diff --git a/source/GameInterface/Services/Companions/Patches/DisableCompanionsCampaignBehavior.cs b/source/GameInterface/Services/Companions/Patches/DisableCompanionsCampaignBehavior.cs index e564aec72..c5f5d63aa 100644 --- a/source/GameInterface/Services/Companions/Patches/DisableCompanionsCampaignBehavior.cs +++ b/source/GameInterface/Services/Companions/Patches/DisableCompanionsCampaignBehavior.cs @@ -2,7 +2,7 @@ using SandBox.CampaignBehaviors; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Cheats.Patches +namespace GameInterface.Services.Companions.Patches { [HarmonyPatch(typeof(CompanionsCampaignBehavior))] internal class DisableCompanionsCampaignBehavior diff --git a/source/GameInterface/Services/Companions/Patches/DisablePerkResetCampaignBehavior.cs b/source/GameInterface/Services/Companions/Patches/DisablePerkResetCampaignBehavior.cs index 5cdc3ea1e..9f363ca1d 100644 --- a/source/GameInterface/Services/Companions/Patches/DisablePerkResetCampaignBehavior.cs +++ b/source/GameInterface/Services/Companions/Patches/DisablePerkResetCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Cheats.Patches +namespace GameInterface.Services.Companions.Patches { [HarmonyPatch(typeof(PerkResetCampaignBehavior))] internal class DisablePerkResetCampaignBehavior diff --git a/source/GameInterface/Services/Equipments/Handler/EquipmentHandler.cs b/source/GameInterface/Services/Equipments/Handler/EquipmentHandler.cs index a175d44ab..02496e182 100644 --- a/source/GameInterface/Services/Equipments/Handler/EquipmentHandler.cs +++ b/source/GameInterface/Services/Equipments/Handler/EquipmentHandler.cs @@ -14,7 +14,7 @@ using System.Reflection; -namespace GameInterface.Services.Equipments.Handlers +namespace GameInterface.Services.Equipments.Handler { /// /// Handles all changes to Equipments on client. diff --git a/source/GameInterface/Services/Equipments/Handler/ItemSlotHandler.cs b/source/GameInterface/Services/Equipments/Handler/ItemSlotHandler.cs index 46a57138f..775d3f921 100644 --- a/source/GameInterface/Services/Equipments/Handler/ItemSlotHandler.cs +++ b/source/GameInterface/Services/Equipments/Handler/ItemSlotHandler.cs @@ -15,7 +15,7 @@ using System.Diagnostics; -namespace GameInterface.Services.Equipments.Handlers +namespace GameInterface.Services.Equipments.Handler { /// /// Handles all changes to Equipments on client. diff --git a/source/GameInterface/Services/Equipments/Patches/DisableHeroAgentSpawnCampaignBehavior.cs b/source/GameInterface/Services/Equipments/Patches/DisableHeroAgentSpawnCampaignBehavior.cs index cea6bdf05..d52ee25ca 100644 --- a/source/GameInterface/Services/Equipments/Patches/DisableHeroAgentSpawnCampaignBehavior.cs +++ b/source/GameInterface/Services/Equipments/Patches/DisableHeroAgentSpawnCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Equipments.Patches; /// /// This behavior does nothing diff --git a/source/GameInterface/Services/Heroes/Audit/HeroAuditor.cs b/source/GameInterface/Services/Heroes/Audit/HeroAuditor.cs index c097c04c6..313a8d7ea 100644 --- a/source/GameInterface/Services/Heroes/Audit/HeroAuditor.cs +++ b/source/GameInterface/Services/Heroes/Audit/HeroAuditor.cs @@ -4,7 +4,6 @@ using Common.Network; using GameInterface.Services.ObjectManager; using GameInterface.Services.ObjectManager.Extensions; -using GameInterface.Services.Registry; using LiteNetLib; using Serilog; using System; diff --git a/source/GameInterface/Services/Heroes/HeroRegistry.cs b/source/GameInterface/Services/Heroes/HeroRegistry.cs index 0d13772f9..52a223dd3 100644 --- a/source/GameInterface/Services/Heroes/HeroRegistry.cs +++ b/source/GameInterface/Services/Heroes/HeroRegistry.cs @@ -13,7 +13,7 @@ using TaleWorlds.Library; using TaleWorlds.ObjectSystem; -namespace GameInterface.Services.Registry; +namespace GameInterface.Services.Heroes; /// /// Registry for identifying ownership of objects diff --git a/source/GameInterface/Services/ItemCategories/ItemCategoryRegistry.cs b/source/GameInterface/Services/ItemCategories/ItemCategoryRegistry.cs index 3fbd99b30..7fb9cae32 100644 --- a/source/GameInterface/Services/ItemCategories/ItemCategoryRegistry.cs +++ b/source/GameInterface/Services/ItemCategories/ItemCategoryRegistry.cs @@ -9,7 +9,7 @@ using TaleWorlds.Core; using TaleWorlds.ObjectSystem; -namespace GameInterface.Services.ItemCategorys; +namespace GameInterface.Services.ItemCategories; internal class ItemCategoryRegistry : IAutoRegistry { ILogger Logger { get; } diff --git a/source/GameInterface/Services/ItemComponents/Handlers/ItemComponentHandler.cs b/source/GameInterface/Services/ItemComponents/Handlers/ItemComponentHandler.cs index cf373f598..607839bfa 100644 --- a/source/GameInterface/Services/ItemComponents/Handlers/ItemComponentHandler.cs +++ b/source/GameInterface/Services/ItemComponents/Handlers/ItemComponentHandler.cs @@ -10,7 +10,7 @@ using TaleWorlds.Core; using TaleWorlds.Library; -namespace GameInterface.Services.PartyComponents.Handlers; +namespace GameInterface.Services.ItemComponents.Handlers; internal class ItemComponentHandler : IHandler { private static readonly ILogger Logger = LogManager.GetLogger(); diff --git a/source/GameInterface/Services/ItemObjects/ItemObjectSync.cs b/source/GameInterface/Services/ItemObjects/ItemObjectSync.cs index aa32dec5e..4e27119b6 100644 --- a/source/GameInterface/Services/ItemObjects/ItemObjectSync.cs +++ b/source/GameInterface/Services/ItemObjects/ItemObjectSync.cs @@ -9,7 +9,46 @@ public class ItemObjectSync : IAutoSync { public ItemObjectSync(IAutoSyncBuilder autoSyncBuilder) { + //Fields autoSyncBuilder.AddField(AccessTools.Field(typeof(ItemObject), nameof(ItemObject.Type))); + + //Properties + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Weight))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Name))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.MultiMeshName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.HolsterMeshName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.HolsterWithWeaponMeshName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.HolsterPositionShift))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.FlyingMeshName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.BodyName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.HolsterBodyName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.CollisionBodyName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.RecalculateBody))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Culture))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Difficulty))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ScaleFactor))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ItemFlags))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Appearance))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.WeaponDesign))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ItemComponent))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.HasLowerHolsterPriority))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.PrefabName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ItemCategory))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Value))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.Effectiveness))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.IsUsingTableau))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ArmBandMeshName))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.IsFood))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.IsUniqueItem))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.MultiplayerItem))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.NotMerchandise))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.IsCraftedByPlayer))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.LodAtlasIndex))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.PrerequisiteItem))); + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ItemType))); + + //Collection + autoSyncBuilder.AddProperty(AccessTools.Property(typeof(ItemObject), nameof(ItemObject.ItemHolsters))); } } } diff --git a/source/GameInterface/Services/Kingdoms/Handlers/KingdomLifetimeHandler.cs b/source/GameInterface/Services/Kingdoms/Handlers/KingdomLifetimeHandler.cs index 2057337c8..77df050a7 100644 --- a/source/GameInterface/Services/Kingdoms/Handlers/KingdomLifetimeHandler.cs +++ b/source/GameInterface/Services/Kingdoms/Handlers/KingdomLifetimeHandler.cs @@ -2,11 +2,11 @@ using Common.Messaging; using Common.Network; using Common.Util; -using GameInterface.Services.Kingdoms.Messages; using GameInterface.Services.ObjectManager; using Serilog; using TaleWorlds.CampaignSystem; using Common; +using GameInterface.Services.Kingdoms.Messages.Lifetime; namespace GameInterface.Services.Kingdoms.Handlers; diff --git a/source/GameInterface/Services/Kingdoms/Messages/Lifetime/KingdomCreated.cs b/source/GameInterface/Services/Kingdoms/Messages/Lifetime/KingdomCreated.cs index 23b2ad479..79017bdf0 100644 --- a/source/GameInterface/Services/Kingdoms/Messages/Lifetime/KingdomCreated.cs +++ b/source/GameInterface/Services/Kingdoms/Messages/Lifetime/KingdomCreated.cs @@ -1,6 +1,6 @@ using Common.Messaging; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Kingdoms.Messages; +namespace GameInterface.Services.Kingdoms.Messages.Lifetime; /// diff --git a/source/GameInterface/Services/Kingdoms/Messages/Lifetime/NetworkCreateKingdom.cs b/source/GameInterface/Services/Kingdoms/Messages/Lifetime/NetworkCreateKingdom.cs index 897c1bc8b..7cf1b8830 100644 --- a/source/GameInterface/Services/Kingdoms/Messages/Lifetime/NetworkCreateKingdom.cs +++ b/source/GameInterface/Services/Kingdoms/Messages/Lifetime/NetworkCreateKingdom.cs @@ -1,7 +1,7 @@ using Common.Messaging; using ProtoBuf; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Kingdoms.Messages; +namespace GameInterface.Services.Kingdoms.Messages.Lifetime; /// diff --git a/source/GameInterface/Services/MapEventSides/Handlers/MapEventSideLifetimeHandler.cs b/source/GameInterface/Services/MapEventSides/Handlers/MapEventSideLifetimeHandler.cs index 77a483d4e..16ee30e51 100644 --- a/source/GameInterface/Services/MapEventSides/Handlers/MapEventSideLifetimeHandler.cs +++ b/source/GameInterface/Services/MapEventSides/Handlers/MapEventSideLifetimeHandler.cs @@ -2,7 +2,6 @@ using Common.Messaging; using Common.Network; using GameInterface.Services.MapEvents.Handlers; -using GameInterface.Services.MapEvents.Messages; using GameInterface.Services.MapEventSides.Messages; using GameInterface.Services.ObjectManager; using Serilog; diff --git a/source/GameInterface/Services/MapEventSides/MapEventSideRegistry.cs b/source/GameInterface/Services/MapEventSides/MapEventSideRegistry.cs index 538942067..2c8c21a53 100644 --- a/source/GameInterface/Services/MapEventSides/MapEventSideRegistry.cs +++ b/source/GameInterface/Services/MapEventSides/MapEventSideRegistry.cs @@ -4,7 +4,7 @@ using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.MapEvents; -namespace GameInterface.Services.MapEvents; +namespace GameInterface.Services.MapEventSides; /// /// Registry for objects diff --git a/source/GameInterface/Services/MapEventSides/Messages/NetworkCreateMapEventSide.cs b/source/GameInterface/Services/MapEventSides/Messages/NetworkCreateMapEventSide.cs index b90360154..95ac8b283 100644 --- a/source/GameInterface/Services/MapEventSides/Messages/NetworkCreateMapEventSide.cs +++ b/source/GameInterface/Services/MapEventSides/Messages/NetworkCreateMapEventSide.cs @@ -1,7 +1,7 @@ using Common.Messaging; using ProtoBuf; -namespace GameInterface.Services.MapEvents.Messages; +namespace GameInterface.Services.MapEventSides.Messages; [ProtoContract(SkipConstructor = true)] internal record NetworkCreateMapEventSide(string MapEventSideId, string MapEventId, int BattleSide, string MobilePartyId) : IEvent diff --git a/source/GameInterface/Services/MapEventSides/Messages/NetworkDestroyMapEventSide.cs b/source/GameInterface/Services/MapEventSides/Messages/NetworkDestroyMapEventSide.cs index 3b29f20b7..78000ce7b 100644 --- a/source/GameInterface/Services/MapEventSides/Messages/NetworkDestroyMapEventSide.cs +++ b/source/GameInterface/Services/MapEventSides/Messages/NetworkDestroyMapEventSide.cs @@ -1,7 +1,7 @@ using Common.Messaging; using ProtoBuf; -namespace GameInterface.Services.MapEvents.Messages; +namespace GameInterface.Services.MapEventSides.Messages; [ProtoContract(SkipConstructor = true)] internal record NetworkDestroyMapEventSide(string MapEventSideId) : IEvent diff --git a/source/GameInterface/Services/MapEventSides/Patches/MapEventSideCreationPatches.cs b/source/GameInterface/Services/MapEventSides/Patches/MapEventSideCreationPatches.cs index e4fbe4266..5114ca149 100644 --- a/source/GameInterface/Services/MapEventSides/Patches/MapEventSideCreationPatches.cs +++ b/source/GameInterface/Services/MapEventSides/Patches/MapEventSideCreationPatches.cs @@ -11,7 +11,7 @@ using TaleWorlds.CampaignSystem.Party; using TaleWorlds.Core; -namespace GameInterface.Services.MapEvents.Patches; +namespace GameInterface.Services.MapEventSides.Patches; [HarmonyPatch] internal class MapEventSideCreationPatches diff --git a/source/GameInterface/Services/MapEventSides/Patches/MapEventSideDestructionPatches.cs b/source/GameInterface/Services/MapEventSides/Patches/MapEventSideDestructionPatches.cs index 36a53cb52..db4b18758 100644 --- a/source/GameInterface/Services/MapEventSides/Patches/MapEventSideDestructionPatches.cs +++ b/source/GameInterface/Services/MapEventSides/Patches/MapEventSideDestructionPatches.cs @@ -7,7 +7,7 @@ using System; using TaleWorlds.CampaignSystem.MapEvents; -namespace GameInterface.Services.MapEvents.Patches; +namespace GameInterface.Services.MapEventSides.Patches; [HarmonyPatch(typeof(MapEventSide))] internal class MapEventSideDestructionPatches diff --git a/source/GameInterface/Services/MobileParties/Messages/Behavior/EndSettlementEncounter.cs b/source/GameInterface/Services/MobileParties/Messages/Behavior/EndSettlementEncounter.cs index 744c47ff6..3d12a29ad 100644 --- a/source/GameInterface/Services/MobileParties/Messages/Behavior/EndSettlementEncounter.cs +++ b/source/GameInterface/Services/MobileParties/Messages/Behavior/EndSettlementEncounter.cs @@ -1,6 +1,6 @@ using Common.Messaging; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Messages.Behavior; /// /// Ends the player's encounter with a settlement diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDesertionCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDesertionCampaignBehavior.cs index d5862779f..54fc40740 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDesertionCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDesertionCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(DesertionCampaignBehavior))] internal class DisableDesertionCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDisbandPartyCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDisbandPartyCampaignBehavior.cs index 3b7527f96..5c16fbeee 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDisbandPartyCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDisbandPartyCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(DisbandPartyCampaignBehavior))] internal class DisableDisbandPartyCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDiscardItemsCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDiscardItemsCampaignBehavior.cs index 619888804..59706820a 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDiscardItemsCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableDiscardItemsCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(DiscardItemsCampaignBehavior))] internal class DisableDiscardItemsCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFindingItemOnMapBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFindingItemOnMapBehavior.cs index 429eb4711..af2f2852a 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFindingItemOnMapBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFindingItemOnMapBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(FindingItemOnMapBehavior))] internal class DisableFindingItemOnMapBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFoodConsumptionBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFoodConsumptionBehavior.cs index 59c857fb6..60998907e 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFoodConsumptionBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableFoodConsumptionBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(FoodConsumptionBehavior))] internal class DisableFoodConsumptionBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordConversationsCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordConversationsCampaignBehavior.cs index 2251a8924..6babac946 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordConversationsCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordConversationsCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordConversationsCampaignBehavior))] internal class DisableLordConversationsCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordDefectionCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordDefectionCampaignBehavior.cs index 310e04ace..15a3f6e90 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordDefectionCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordDefectionCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordDefectionCampaignBehavior))] internal class DisableLordDefectionCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsGarrisonTroopsIssueQuestBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsGarrisonTroopsIssueQuestBehavior.cs index 22b12e7b7..c8f92acb9 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsGarrisonTroopsIssueQuestBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsGarrisonTroopsIssueQuestBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordNeedsGarrisonTroopsIssueQuestBehavior))] internal class DisableLordNeedsGarrisonTroopsIssueQuestBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsHorsesIssueBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsHorsesIssueBehavior.cs index 6a1ddee23..133128ae2 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsHorsesIssueBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordNeedsHorsesIssueBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordNeedsHorsesIssueBehavior))] internal class DisableLordNeedsHorsesIssueBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordWantsRivalCapturedIssueBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordWantsRivalCapturedIssueBehavior.cs index 67e02ff97..bbe66ba8c 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordWantsRivalCapturedIssueBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordWantsRivalCapturedIssueBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordWantsRivalCapturedIssueBehavior))] internal class DisableLordWantsRivalCapturedIssueBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordsNeedsTutorIssueBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordsNeedsTutorIssueBehavior.cs index fc5b739f2..7f94a819a 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordsNeedsTutorIssueBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableLordsNeedsTutorIssueBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(LordsNeedsTutorIssueBehavior))] internal class DisableLordsNeedsTutorIssueBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableMobilePartyTrainingBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableMobilePartyTrainingBehavior.cs index 2077194f7..3bfcb56d2 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableMobilePartyTrainingBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableMobilePartyTrainingBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(MobilePartyTrainingBehavior))] internal class DisableMobilePartyTrainingBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyFoodCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyFoodCampaignBehavior.cs index 1447ac253..a1bfc28f3 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyFoodCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyFoodCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartiesBuyFoodCampaignBehavior))] internal class DisablePartiesBuyFoodCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyHorseCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyHorseCampaignBehavior.cs index c02206123..84600741f 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyHorseCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesBuyHorseCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartiesBuyHorseCampaignBehavior))] internal class DisablePartiesBuyHorseCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellLootCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellLootCampaignBehavior.cs index 562dc3c40..c5c1c8bf1 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellLootCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellLootCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartiesSellLootCampaignBehavior))] internal class DisablePartiesSellLootCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellPrisonerCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellPrisonerCampaignBehavior.cs index e097eaa61..025456765 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellPrisonerCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartiesSellPrisonerCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartiesSellPrisonerCampaignBehavior))] internal class DisablePartiesSellPrisonerCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyEncounterPatch.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyEncounterPatch.cs index 011c901ba..54a17966a 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyEncounterPatch.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyEncounterPatch.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; /// /// Disables party encounters diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyHealCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyHealCampaignBehavior.cs index 8b89bc152..bbcf26051 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyHealCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyHealCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartyHealCampaignBehavior))] internal class DisablePartyHealCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyRolesCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyRolesCampaignBehavior.cs index a46372781..0558445a5 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyRolesCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyRolesCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartyRolesCampaignBehavior))] internal class DisablePartyRolesCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyUpgraderCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyUpgraderCampaignBehavior.cs index d981bcb05..3820c8799 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyUpgraderCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePartyUpgraderCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PartyUpgraderCampaignBehavior))] internal class DisablePartyUpgraderCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePerkActivationHandlerCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePerkActivationHandlerCampaignBehavior.cs index e71ea462e..1db8d1386 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePerkActivationHandlerCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisablePerkActivationHandlerCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(PerkActivationHandlerCampaignBehavior))] internal class DisablePerkActivationHandlerCampaignBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRaidAnEnemyTerritoryIssueBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRaidAnEnemyTerritoryIssueBehavior.cs index 06071cc26..04ba83234 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRaidAnEnemyTerritoryIssueBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRaidAnEnemyTerritoryIssueBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(RaidAnEnemyTerritoryIssueBehavior))] internal class DisableRaidAnEnemyTerritoryIssueBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitPrisonersCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitPrisonersCampaignBehavior.cs index d0bdd8688..a11465b7e 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitPrisonersCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitPrisonersCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(RecruitPrisonersCampaignBehavior))] diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitmentCampaignBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitmentCampaignBehavior.cs index a8e1939fc..5eb0bb2df 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitmentCampaignBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableRecruitmentCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(RecruitmentCampaignBehavior))] diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheConquestOfSettlementIssueBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheConquestOfSettlementIssueBehavior.cs index 3c918aa15..891edd801 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheConquestOfSettlementIssueBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheConquestOfSettlementIssueBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(TheConquestOfSettlementIssueBehavior))] internal class DisableTheConquestOfSettlementIssueBehavior diff --git a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheSpyPartyIssueQuestBehavior.cs b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheSpyPartyIssueQuestBehavior.cs index 1ed9f2dd1..cc1ada5ff 100644 --- a/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheSpyPartyIssueQuestBehavior.cs +++ b/source/GameInterface/Services/MobileParties/Patches/Disable/DisableTheSpyPartyIssueQuestBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using SandBox.Issues; -namespace GameInterface.Services.MobileParties.Patches; +namespace GameInterface.Services.MobileParties.Patches.Disable; [HarmonyPatch(typeof(TheSpyPartyIssueQuestBehavior))] internal class DisableTheSpyPartyIssueQuestBehavior diff --git a/source/GameInterface/Services/Players/Patches/DisablePlayerTrackCompanionBehavior.cs b/source/GameInterface/Services/Players/Patches/DisablePlayerTrackCompanionBehavior.cs index 1f5076814..8738e9509 100644 --- a/source/GameInterface/Services/Players/Patches/DisablePlayerTrackCompanionBehavior.cs +++ b/source/GameInterface/Services/Players/Patches/DisablePlayerTrackCompanionBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Players.Patches; [HarmonyPatch(typeof(PlayerTrackCompanionBehavior))] internal class DisablePlayerTrackCompanionBehavior diff --git a/source/GameInterface/Services/Players/Patches/DisablePlayerVariablesBehavior.cs b/source/GameInterface/Services/Players/Patches/DisablePlayerVariablesBehavior.cs index f7f5a3a1e..af5ecd6eb 100644 --- a/source/GameInterface/Services/Players/Patches/DisablePlayerVariablesBehavior.cs +++ b/source/GameInterface/Services/Players/Patches/DisablePlayerVariablesBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Players.Patches; [HarmonyPatch(typeof(PlayerVariablesBehavior))] internal class DisablePlayerVariablesBehavior diff --git a/source/GameInterface/Services/Save/CoopInMemSaveDriver.cs b/source/GameInterface/Services/Save/CoopInMemSaveDriver.cs index e78ef2195..293ff4690 100644 --- a/source/GameInterface/Services/Save/CoopInMemSaveDriver.cs +++ b/source/GameInterface/Services/Save/CoopInMemSaveDriver.cs @@ -1,7 +1,7 @@ using System.Reflection; using TaleWorlds.SaveSystem; -namespace GameInterface.Services.Heroes; +namespace GameInterface.Services.Save; internal class CoopInMemSaveDriver : InMemDriver { diff --git a/source/GameInterface/Services/Save/Data/GameObjectGuids.cs b/source/GameInterface/Services/Save/Data/GameObjectGuids.cs index d17b8a95c..f0e553e6e 100644 --- a/source/GameInterface/Services/Save/Data/GameObjectGuids.cs +++ b/source/GameInterface/Services/Save/Data/GameObjectGuids.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -namespace GameInterface.Services.Heroes.Data; +namespace GameInterface.Services.Save.Data; [ProtoContract(SkipConstructor = true)] public class GameObjectGuids diff --git a/source/GameInterface/Services/Save/Handlers/SaveHandler.cs b/source/GameInterface/Services/Save/Handlers/SaveHandler.cs index 2fe10ef51..ed19eed43 100644 --- a/source/GameInterface/Services/Save/Handlers/SaveHandler.cs +++ b/source/GameInterface/Services/Save/Handlers/SaveHandler.cs @@ -1,10 +1,10 @@ using Common; using Common.Messaging; -using GameInterface.Services.Heroes.Interfaces; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Save.Interfaces; +using GameInterface.Services.Save.Messages; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Handlers; +namespace GameInterface.Services.Save.Handlers; internal class SaveHandler : IHandler { diff --git a/source/GameInterface/Services/Save/Interfaces/SaveInterface.cs b/source/GameInterface/Services/Save/Interfaces/SaveInterface.cs index 43f48da62..48aefaa91 100644 --- a/source/GameInterface/Services/Save/Interfaces/SaveInterface.cs +++ b/source/GameInterface/Services/Save/Interfaces/SaveInterface.cs @@ -6,7 +6,7 @@ using TaleWorlds.Core; using TaleWorlds.SaveSystem; -namespace GameInterface.Services.Heroes.Interfaces; +namespace GameInterface.Services.Save.Interfaces; internal interface ISaveInterface : IGameAbstraction { diff --git a/source/GameInterface/Services/Save/Messages/GameLoaded.cs b/source/GameInterface/Services/Save/Messages/GameLoaded.cs index 75e924663..30b736237 100644 --- a/source/GameInterface/Services/Save/Messages/GameLoaded.cs +++ b/source/GameInterface/Services/Save/Messages/GameLoaded.cs @@ -1,6 +1,6 @@ using Common.Messaging; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Save.Messages; public record GameLoaded : IEvent { diff --git a/source/GameInterface/Services/Save/Messages/GameSaved.cs b/source/GameInterface/Services/Save/Messages/GameSaved.cs index cfd1355d2..1123f13bb 100644 --- a/source/GameInterface/Services/Save/Messages/GameSaved.cs +++ b/source/GameInterface/Services/Save/Messages/GameSaved.cs @@ -1,6 +1,6 @@ using Common.Messaging; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Save.Messages; public record GameSaved : IEvent { diff --git a/source/GameInterface/Services/Save/Messages/PackageGameSaveData.cs b/source/GameInterface/Services/Save/Messages/PackageGameSaveData.cs index 9777b108c..7fbc45b98 100644 --- a/source/GameInterface/Services/Save/Messages/PackageGameSaveData.cs +++ b/source/GameInterface/Services/Save/Messages/PackageGameSaveData.cs @@ -1,6 +1,6 @@ using Common.Messaging; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Save.Messages; public record PackageGameSaveData : ICommand { diff --git a/source/GameInterface/Services/Save/Messages/PackageObjectGuids.cs b/source/GameInterface/Services/Save/Messages/PackageObjectGuids.cs index a7fb4edfc..a5c8bae31 100644 --- a/source/GameInterface/Services/Save/Messages/PackageObjectGuids.cs +++ b/source/GameInterface/Services/Save/Messages/PackageObjectGuids.cs @@ -1,8 +1,8 @@ using Common.Messaging; -using GameInterface.Services.Heroes.Data; +using GameInterface.Services.Save.Data; using System; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Save.Messages; public record PackageObjectGuids : ICommand { diff --git a/source/GameInterface/Services/Save/Patches/LoadPatches.cs b/source/GameInterface/Services/Save/Patches/LoadPatches.cs index 05d154785..cc2eb2901 100644 --- a/source/GameInterface/Services/Save/Patches/LoadPatches.cs +++ b/source/GameInterface/Services/Save/Patches/LoadPatches.cs @@ -6,7 +6,7 @@ using TaleWorlds.SaveSystem; using TaleWorlds.SaveSystem.Load; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Save.Patches; [HarmonyPatch(typeof(SaveManager), "Load", new Type[] { typeof(string), typeof(ISaveDriver), typeof(bool) })] internal class LoadPatches diff --git a/source/GameInterface/Services/Save/Patches/SavePatches.cs b/source/GameInterface/Services/Save/Patches/SavePatches.cs index 521bdebfc..f8b1da81e 100644 --- a/source/GameInterface/Services/Save/Patches/SavePatches.cs +++ b/source/GameInterface/Services/Save/Patches/SavePatches.cs @@ -3,7 +3,7 @@ using HarmonyLib; using TaleWorlds.Core; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Save.Patches; [HarmonyPatch(typeof(Game), "Save")] class SavePatches diff --git a/source/GameInterface/Services/Settlements/Commands/SettlementCommands.cs b/source/GameInterface/Services/Settlements/Commands/SettlementCommands.cs index cb2cf5f2b..e9a8c901e 100644 --- a/source/GameInterface/Services/Settlements/Commands/SettlementCommands.cs +++ b/source/GameInterface/Services/Settlements/Commands/SettlementCommands.cs @@ -10,7 +10,7 @@ using static TaleWorlds.CampaignSystem.Settlements.Settlement; using static TaleWorlds.Library.CommandLineFunctionality; -namespace GameInterface.Services.Template.Commands; +namespace GameInterface.Services.Settlements.Commands; internal class SettlementCommands { @@ -219,8 +219,8 @@ public static string ListSiegeStates(List args) StringBuilder sb = new(); - foreach(int i in Enum.GetValues(typeof(Settlement.SiegeState))) { - sb.AppendLine($"{i}: {Enum.GetName(typeof(Settlement.SiegeState), i)}"); + foreach(int i in Enum.GetValues(typeof(SiegeState))) { + sb.AppendLine($"{i}: {Enum.GetName(typeof(SiegeState), i)}"); } return sb.ToString(); } diff --git a/source/GameInterface/Services/SiegeEngineConstructionProgressService/SiegeEngineConstructionProgressSync.cs b/source/GameInterface/Services/SiegeEngineConstructionProgressService/SiegeEngineConstructionProgressSync.cs index 4b9f16a29..448c5c5bf 100644 --- a/source/GameInterface/Services/SiegeEngineConstructionProgressService/SiegeEngineConstructionProgressSync.cs +++ b/source/GameInterface/Services/SiegeEngineConstructionProgressService/SiegeEngineConstructionProgressSync.cs @@ -2,7 +2,7 @@ using HarmonyLib; using static TaleWorlds.CampaignSystem.Siege.SiegeEvent; -namespace GameInterface.Services.SiegeEnginesConstructionProgress +namespace GameInterface.Services.SiegeEngineConstructionProgressService { internal class SiegeEngineConstructionProgressSync : IAutoSync { diff --git a/source/GameInterface/Services/SiegeEngines/Handlers/SiegeEnginesContainerLifetimeHandler.cs b/source/GameInterface/Services/SiegeEngines/Handlers/SiegeEnginesContainerLifetimeHandler.cs index 5ab100033..b89716e2b 100644 --- a/source/GameInterface/Services/SiegeEngines/Handlers/SiegeEnginesContainerLifetimeHandler.cs +++ b/source/GameInterface/Services/SiegeEngines/Handlers/SiegeEnginesContainerLifetimeHandler.cs @@ -3,11 +3,11 @@ using Common.Network; using Common.Util; using GameInterface.Services.ObjectManager; -using GameInterface.Services.SiegeEnginesContainers.Messages; +using GameInterface.Services.SiegeEngines.Messages; using Serilog; using static TaleWorlds.CampaignSystem.Siege.SiegeEvent; -namespace GameInterface.Services.SiegeEnginesContainers.Handlers; +namespace GameInterface.Services.SiegeEngines.Handlers; internal class SiegeEnginesContainerLifetimeHandler : IHandler { diff --git a/source/GameInterface/Services/SiegeEngines/Messages/NetworkCreateSiegeEnginesContainer.cs b/source/GameInterface/Services/SiegeEngines/Messages/NetworkCreateSiegeEnginesContainer.cs index 0ad8c25b9..2f6df0934 100644 --- a/source/GameInterface/Services/SiegeEngines/Messages/NetworkCreateSiegeEnginesContainer.cs +++ b/source/GameInterface/Services/SiegeEngines/Messages/NetworkCreateSiegeEnginesContainer.cs @@ -1,7 +1,7 @@ using Common.Messaging; using ProtoBuf; -namespace GameInterface.Services.SiegeEnginesContainers.Messages; +namespace GameInterface.Services.SiegeEngines.Messages; [ProtoContract(SkipConstructor = true)] internal class NetworkCreateSiegeEnginesContainer : ICommand diff --git a/source/GameInterface/Services/SiegeEngines/Messages/SiegeEnginesContainerCreated.cs b/source/GameInterface/Services/SiegeEngines/Messages/SiegeEnginesContainerCreated.cs index 32a0f8508..6035a52df 100644 --- a/source/GameInterface/Services/SiegeEngines/Messages/SiegeEnginesContainerCreated.cs +++ b/source/GameInterface/Services/SiegeEngines/Messages/SiegeEnginesContainerCreated.cs @@ -1,7 +1,7 @@ using Common.Messaging; using static TaleWorlds.CampaignSystem.Siege.SiegeEvent; -namespace GameInterface.Services.SiegeEnginesContainers.Messages; +namespace GameInterface.Services.SiegeEngines.Messages; internal class SiegeEnginesContainerCreated : IEvent { diff --git a/source/GameInterface/Services/SiegeEngines/Patches/SiegeEnginesContainerCreationPatches.cs b/source/GameInterface/Services/SiegeEngines/Patches/SiegeEnginesContainerCreationPatches.cs index a7e06d8a5..ef13a82d0 100644 --- a/source/GameInterface/Services/SiegeEngines/Patches/SiegeEnginesContainerCreationPatches.cs +++ b/source/GameInterface/Services/SiegeEngines/Patches/SiegeEnginesContainerCreationPatches.cs @@ -9,7 +9,7 @@ using System.Reflection; using static TaleWorlds.CampaignSystem.Siege.SiegeEvent; -namespace GameInterface.Services.SiegeEnginesContainers.Patches; +namespace GameInterface.Services.SiegeEngines.Patches; [HarmonyPatch()] internal class SiegeEnginesContainerCreationPatches diff --git a/source/GameInterface/Services/StanceLinks/Data/StanceLinkCreationData.cs b/source/GameInterface/Services/StanceLinks/Data/StanceLinkCreationData.cs index dd1eba324..0808d174e 100644 --- a/source/GameInterface/Services/StanceLinks/Data/StanceLinkCreationData.cs +++ b/source/GameInterface/Services/StanceLinks/Data/StanceLinkCreationData.cs @@ -1,7 +1,7 @@ using ProtoBuf; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Stances.Data; +namespace GameInterface.Services.StanceLinks.Data; /// /// Data required for creating a StanceLink diff --git a/source/GameInterface/Services/StanceLinks/Handlers/StanceLinkLifetimeHandler.cs b/source/GameInterface/Services/StanceLinks/Handlers/StanceLinkLifetimeHandler.cs index eb06e1381..57b8b4043 100644 --- a/source/GameInterface/Services/StanceLinks/Handlers/StanceLinkLifetimeHandler.cs +++ b/source/GameInterface/Services/StanceLinks/Handlers/StanceLinkLifetimeHandler.cs @@ -7,8 +7,8 @@ using GameInterface.Services.Armies.Data; using GameInterface.Services.Armies.Messages.Lifetime; using GameInterface.Services.ObjectManager; +using GameInterface.Services.StanceLinks.Messages.Lifetime; using GameInterface.Services.Stances.Data; -using GameInterface.Services.Stances.Messages.Lifetime; using GameInterface.Services.Template.Messages; using GameInterface.Services.Template.Patches; using Serilog; @@ -17,7 +17,7 @@ using TaleWorlds.ObjectSystem; using static TaleWorlds.Core.ViewModelCollection.CharacterViewModel; -namespace GameInterface.Services.Template.Handlers; +namespace GameInterface.Services.StanceLinks.Handlers; /// /// Handler for messages @@ -51,7 +51,7 @@ private void Handle_StanceLinkCreated(MessagePayload payload) { //create temp objects to manipulate data easier var stanceLink = payload.What.StanceLink; - var stanceType = (short)(payload.What.StanceType); + var stanceType = (short)payload.What.StanceType; var faction1 = payload.What.Faction1; var faction2 = payload.What.Faction2; var isAtConstantWar = payload.What.IsAtConstantWar; diff --git a/source/GameInterface/Services/StanceLinks/Messages/Lifetime/NetworkCreateStanceLink.cs b/source/GameInterface/Services/StanceLinks/Messages/Lifetime/NetworkCreateStanceLink.cs index 7c45faf57..55b7a72cc 100644 --- a/source/GameInterface/Services/StanceLinks/Messages/Lifetime/NetworkCreateStanceLink.cs +++ b/source/GameInterface/Services/StanceLinks/Messages/Lifetime/NetworkCreateStanceLink.cs @@ -1,8 +1,8 @@ using Common.Messaging; -using GameInterface.Services.Stances.Data; +using GameInterface.Services.StanceLinks.Data; using ProtoBuf; -namespace GameInterface.Services.Stances.Messages.Lifetime; +namespace GameInterface.Services.StanceLinks.Messages.Lifetime; [ProtoContract(SkipConstructor = true)] internal class NetworkCreateStanceLink : ICommand diff --git a/source/GameInterface/Services/StanceLinks/Messages/Lifetime/StanceLinkCreated.cs b/source/GameInterface/Services/StanceLinks/Messages/Lifetime/StanceLinkCreated.cs index 2ad46b27d..007564b59 100644 --- a/source/GameInterface/Services/StanceLinks/Messages/Lifetime/StanceLinkCreated.cs +++ b/source/GameInterface/Services/StanceLinks/Messages/Lifetime/StanceLinkCreated.cs @@ -1,7 +1,7 @@ using Common.Messaging; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Stances.Messages.Lifetime +namespace GameInterface.Services.StanceLinks.Messages.Lifetime { /// /// Command to create a new StanceLink on client side. diff --git a/source/GameInterface/Services/StanceLinks/Patches/StanceLinkLifetimePatches.cs b/source/GameInterface/Services/StanceLinks/Patches/StanceLinkLifetimePatches.cs index 40ea22534..1649a4045 100644 --- a/source/GameInterface/Services/StanceLinks/Patches/StanceLinkLifetimePatches.cs +++ b/source/GameInterface/Services/StanceLinks/Patches/StanceLinkLifetimePatches.cs @@ -11,7 +11,7 @@ using System; using GameInterface.Services.Stances.Messages.Lifetime; -namespace GameInterface.Services.Stances.Patches; +namespace GameInterface.Services.StanceLinks.Patches; /// /// Patches required for creating a StanceLink diff --git a/source/GameInterface/Services/Template/Extensions/TemplateExtensions.cs b/source/GameInterface/Services/Template/Extensions/TemplateExtensions.cs index 41e08567b..3cf4a4fda 100644 --- a/source/GameInterface/Services/Template/Extensions/TemplateExtensions.cs +++ b/source/GameInterface/Services/Template/Extensions/TemplateExtensions.cs @@ -1,6 +1,6 @@ using GameInterface.Services.Template.Handlers; -namespace GameInterface.Services.MobileParties.Extensions; +namespace GameInterface.Services.Template.Extensions; /// /// TODO fill me out diff --git a/source/GameInterface/Services/Time/Commands/TimeCommands.cs b/source/GameInterface/Services/Time/Commands/TimeCommands.cs index a3a0c9e5a..efc916a40 100644 --- a/source/GameInterface/Services/Time/Commands/TimeCommands.cs +++ b/source/GameInterface/Services/Time/Commands/TimeCommands.cs @@ -1,6 +1,6 @@ using Common.Messaging; -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Messages; using System; using System.Collections.Generic; using System.Threading; diff --git a/source/GameInterface/Services/Time/Enum/TimeControlEnum.cs b/source/GameInterface/Services/Time/Enum/TimeControlEnum.cs index 8ee51c137..cfc559043 100644 --- a/source/GameInterface/Services/Time/Enum/TimeControlEnum.cs +++ b/source/GameInterface/Services/Time/Enum/TimeControlEnum.cs @@ -1,6 +1,6 @@ using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Enum; +namespace GameInterface.Services.Time.Enum; public enum TimeControlEnum { diff --git a/source/GameInterface/Services/Time/Handlers/TimeControlHandler.cs b/source/GameInterface/Services/Time/Handlers/TimeControlHandler.cs index 45924ca2b..d23325616 100644 --- a/source/GameInterface/Services/Time/Handlers/TimeControlHandler.cs +++ b/source/GameInterface/Services/Time/Handlers/TimeControlHandler.cs @@ -1,11 +1,11 @@ using Common.Messaging; using Common.Network; -using GameInterface.Services.Heroes.Interaces; -using GameInterface.Services.Heroes.Messages; +using GameInterface.Services.Time.Interaces; +using GameInterface.Services.Time.Messages; using System; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Handlers; +namespace GameInterface.Services.Time.Handlers; internal class TimeControlHandler : IHandler { diff --git a/source/GameInterface/Services/Time/Interaces/TimeControlInterface.cs b/source/GameInterface/Services/Time/Interaces/TimeControlInterface.cs index 6174aca2a..9c99f102e 100644 --- a/source/GameInterface/Services/Time/Interaces/TimeControlInterface.cs +++ b/source/GameInterface/Services/Time/Interaces/TimeControlInterface.cs @@ -1,9 +1,9 @@ -using GameInterface.Services.Heroes.Enum; -using GameInterface.Services.Heroes.Patches; -using GameInterface.Services.Time; +using GameInterface.Services.Time; +using GameInterface.Services.Time.Enum; +using GameInterface.Services.Time.Patches; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Interaces; +namespace GameInterface.Services.Time.Interaces; internal interface ITimeControlInterface : IGameAbstraction { diff --git a/source/GameInterface/Services/Time/Messages/AttemptedTimeSpeedChanged.cs b/source/GameInterface/Services/Time/Messages/AttemptedTimeSpeedChanged.cs index 3b6b817f6..d6bb496bd 100644 --- a/source/GameInterface/Services/Time/Messages/AttemptedTimeSpeedChanged.cs +++ b/source/GameInterface/Services/Time/Messages/AttemptedTimeSpeedChanged.cs @@ -1,9 +1,9 @@ using Common.Messaging; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using System; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Time.Messages; public record AttemptedTimeSpeedChanged : IEvent { diff --git a/source/GameInterface/Services/Time/Messages/GetTimeControlMode.cs b/source/GameInterface/Services/Time/Messages/GetTimeControlMode.cs index 175652f02..25c30e32c 100644 --- a/source/GameInterface/Services/Time/Messages/GetTimeControlMode.cs +++ b/source/GameInterface/Services/Time/Messages/GetTimeControlMode.cs @@ -1,7 +1,7 @@ using Common.Messaging; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Time.Messages; public record GetTimeControlMode : ICommand { @@ -13,6 +13,6 @@ public record TimeControlModeResponse : IResponse public TimeControlModeResponse(TimeControlEnum timeMode) { - this.TimeMode = timeMode; + TimeMode = timeMode; } } diff --git a/source/GameInterface/Services/Time/Messages/SetTimeControlMode.cs b/source/GameInterface/Services/Time/Messages/SetTimeControlMode.cs index c4ed45ed5..3054df5ef 100644 --- a/source/GameInterface/Services/Time/Messages/SetTimeControlMode.cs +++ b/source/GameInterface/Services/Time/Messages/SetTimeControlMode.cs @@ -1,9 +1,9 @@ using Common.Logging.Attributes; using Common.Messaging; -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using System; -namespace GameInterface.Services.Heroes.Messages; +namespace GameInterface.Services.Time.Messages; [BatchLogMessage] public record SetTimeControlMode : ICommand diff --git a/source/GameInterface/Services/Time/Patches/DisableGameMenuPausePatches.cs b/source/GameInterface/Services/Time/Patches/DisableGameMenuPausePatches.cs index 231dbfefc..3a9db06f9 100644 --- a/source/GameInterface/Services/Time/Patches/DisableGameMenuPausePatches.cs +++ b/source/GameInterface/Services/Time/Patches/DisableGameMenuPausePatches.cs @@ -1,5 +1,4 @@ -using GameInterface.Services.Heroes.Patches; -using HarmonyLib; +using HarmonyLib; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; diff --git a/source/GameInterface/Services/Time/Patches/DisableMapClickTimeChange.cs b/source/GameInterface/Services/Time/Patches/DisableMapClickTimeChange.cs index 78d0fabd0..467d4cf64 100644 --- a/source/GameInterface/Services/Time/Patches/DisableMapClickTimeChange.cs +++ b/source/GameInterface/Services/Time/Patches/DisableMapClickTimeChange.cs @@ -6,7 +6,7 @@ using System.Reflection.Emit; using TaleWorlds.CampaignSystem; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Time.Patches; [HarmonyPatch(typeof(MapScreen))] internal class DisableMapClickTimeChange diff --git a/source/GameInterface/Services/Time/Patches/TimePatches.cs b/source/GameInterface/Services/Time/Patches/TimePatches.cs index 52567e91b..98d76bdcd 100644 --- a/source/GameInterface/Services/Time/Patches/TimePatches.cs +++ b/source/GameInterface/Services/Time/Patches/TimePatches.cs @@ -10,7 +10,7 @@ using TaleWorlds.CampaignSystem.Encounters; using TaleWorlds.CampaignSystem.ViewModelCollection.Map.MapBar; -namespace GameInterface.Services.Heroes.Patches; +namespace GameInterface.Services.Time.Patches; [HarmonyPatch(typeof(Campaign))] internal class TimePatches diff --git a/source/GameInterface/Services/Time/TimeControlModeConverter.cs b/source/GameInterface/Services/Time/TimeControlModeConverter.cs index 46f736df4..98c0c49b5 100644 --- a/source/GameInterface/Services/Time/TimeControlModeConverter.cs +++ b/source/GameInterface/Services/Time/TimeControlModeConverter.cs @@ -1,4 +1,4 @@ -using GameInterface.Services.Heroes.Enum; +using GameInterface.Services.Time.Enum; using System; using System.Collections.Generic; using System.Text; diff --git a/source/GameInterface/Services/Towns/Commands/TownDebugCommand.cs b/source/GameInterface/Services/Towns/Commands/TownDebugCommand.cs index c524c57c6..9dc6b8106 100644 --- a/source/GameInterface/Services/Towns/Commands/TownDebugCommand.cs +++ b/source/GameInterface/Services/Towns/Commands/TownDebugCommand.cs @@ -16,7 +16,7 @@ using TaleWorlds.ObjectSystem; using static TaleWorlds.Library.CommandLineFunctionality; -namespace GameInterface.Services.Villages.Commands; +namespace GameInterface.Services.Towns.Commands; public class TownDebugCommand { @@ -106,8 +106,8 @@ public static string Info(List args) sb.AppendFormat("ID: '{0}'\n", args[0]); sb.AppendFormat("Name: '{0}'\n", town.Name); - sb.AppendFormat("Governor: '{0}'\n", (town.Governor != null) ? town.Governor.Name : "null"); - sb.AppendFormat("LastCapturedBy: '{0}'\n", (town.LastCapturedBy != null) ? town.LastCapturedBy.Name : "null"); + sb.AppendFormat("Governor: '{0}'\n", town.Governor != null ? town.Governor.Name : "null"); + sb.AppendFormat("LastCapturedBy: '{0}'\n", town.LastCapturedBy != null ? town.LastCapturedBy.Name : "null"); sb.AppendFormat("Prosperity: '{0}'\n", town.Prosperity); sb.AppendFormat("Loyalty: '{0}'\n", town.Loyalty); sb.AppendFormat("Security: '{0}'\n", town.Security); diff --git a/source/GameInterface/Services/Towns/Handlers/TownAuditorHandler.cs b/source/GameInterface/Services/Towns/Handlers/TownAuditorHandler.cs index 4568f06dc..bd6e3ee76 100644 --- a/source/GameInterface/Services/Towns/Handlers/TownAuditorHandler.cs +++ b/source/GameInterface/Services/Towns/Handlers/TownAuditorHandler.cs @@ -17,7 +17,7 @@ using TaleWorlds.Core; using TaleWorlds.Library; -namespace GameInterface.Services.Towns.Handlers.TownAuditorHandler +namespace GameInterface.Services.Towns.Handlers { /// /// Handles Town Auditor (send all sync). diff --git a/source/GameInterface/Services/UI/LoadGameUI/CoopLoadUI.cs b/source/GameInterface/Services/UI/LoadGameUI/CoopLoadUI.cs index 78b79c909..0cb2a5e91 100644 --- a/source/GameInterface/Services/UI/LoadGameUI/CoopLoadUI.cs +++ b/source/GameInterface/Services/UI/LoadGameUI/CoopLoadUI.cs @@ -18,7 +18,7 @@ using Common.Messaging; using GameInterface.Services.UI.Messages; -namespace Coop.UI.LoadGameUI +namespace GameInterface.Services.UI.LoadGameUI { class SelectedGameVM : SavedGameVM { diff --git a/source/GameInterface/Services/WeaponDesigns/WeaponDesignRegistry.cs b/source/GameInterface/Services/WeaponDesigns/WeaponDesignRegistry.cs index 83c060c6a..3a47deacc 100644 --- a/source/GameInterface/Services/WeaponDesigns/WeaponDesignRegistry.cs +++ b/source/GameInterface/Services/WeaponDesigns/WeaponDesignRegistry.cs @@ -6,7 +6,7 @@ using TaleWorlds.Core; using static TaleWorlds.CampaignSystem.CampaignBehaviors.CraftingCampaignBehavior; -namespace GameInterface.Services.ItemObjects +namespace GameInterface.Services.WeaponDesigns { internal class WeaponDesignRegistry : RegistryBase { diff --git a/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCampaignBehavior.cs b/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCampaignBehavior.cs index e439dcd8f..a2f410173 100644 --- a/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCampaignBehavior.cs +++ b/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCampaignBehavior.cs @@ -1,7 +1,7 @@ using HarmonyLib; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Characters.Patches; +namespace GameInterface.Services.Workshops.Patches; [HarmonyPatch(typeof(WorkshopsCampaignBehavior))] internal class DisableWorkshopsCampaignBehavior diff --git a/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCharactersCampaignBehavior.cs b/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCharactersCampaignBehavior.cs index 299383ea4..c1e64026c 100644 --- a/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCharactersCampaignBehavior.cs +++ b/source/GameInterface/Services/Workshops/Patches/DisableWorkshopsCharactersCampaignBehavior.cs @@ -2,7 +2,7 @@ using SandBox.CampaignBehaviors; using TaleWorlds.CampaignSystem.CampaignBehaviors; -namespace GameInterface.Services.Characters.Patches; +namespace GameInterface.Services.Workshops.Patches; [HarmonyPatch(typeof(WorkshopsCharactersCampaignBehavior))] internal class DisableWorkshopsCharactersCampaignBehavior diff --git a/source/GameInterface/Surrogates/ArmorComponentSurrogate.cs b/source/GameInterface/Surrogates/ArmorComponentSurrogate.cs new file mode 100644 index 000000000..1c5985705 --- /dev/null +++ b/source/GameInterface/Surrogates/ArmorComponentSurrogate.cs @@ -0,0 +1,111 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates +{ + [ProtoContract] + internal struct ArmorComponentSurrogate + { + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + [ProtoMember(3)] + public int HeadArmor { get; set; } + [ProtoMember(4)] + public int BodyArmor { get; set; } + [ProtoMember(5)] + public int LegArmor { get; set; } + [ProtoMember(6)] + public int ArmArmor { get; set; } + [ProtoMember(7)] + public int ManeuverBonus { get; set; } + [ProtoMember(8)] + public int SpeedBonus { get; set; } + [ProtoMember(9)] + public int ChargeBonus { get; set; } + [ProtoMember(10)] + public int FamilyType { get; set; } + [ProtoMember(11)] + public ArmorComponent.ArmorMaterialTypes MaterialType { get; set; } + [ProtoMember(12)] + public SkinMask MeshesMask { get; set; } + [ProtoMember(13)] + public ArmorComponent.BodyMeshTypes BodyMeshType { get; set; } + [ProtoMember(14)] + public ArmorComponent.BodyDeformTypes BodyDeformType { get; set; } + [ProtoMember(15)] + public ArmorComponent.HairCoverTypes HairCoverType { get; set; } + [ProtoMember(16)] + public ArmorComponent.BeardCoverTypes BeardCoverType { get; set; } + [ProtoMember(17)] + public ArmorComponent.HorseHarnessCoverTypes ManeCoverType { get; set; } + [ProtoMember(18)] + public ArmorComponent.HorseTailCoverTypes TailCoverType { get; set; } + [ProtoMember(19)] + public string ReinsMesh { get; set; } + + + public ArmorComponentSurrogate(ArmorComponent armorComponent) + { + if (armorComponent == null) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + HeadArmor = -1; + BodyArmor = -1; + LegArmor = -1; + ArmArmor = -1; + ManeuverBonus = -1; + SpeedBonus = -1; + ChargeBonus = -1; + FamilyType = -1; + MaterialType = ArmorComponent.ArmorMaterialTypes.None; + MeshesMask = ObjectHelper.SkipConstructor(); + BodyMeshType = ArmorComponent.BodyMeshTypes.Normal; + BodyDeformType = ArmorComponent.BodyDeformTypes.Medium; + HairCoverType = ArmorComponent.HairCoverTypes.None; + BeardCoverType = ArmorComponent.BeardCoverTypes.None; + ManeCoverType = ArmorComponent.HorseHarnessCoverTypes.None; + TailCoverType = ArmorComponent.HorseTailCoverTypes.None; + ReinsMesh = ""; + + } + else + { + Item = armorComponent.Item; + ItemModifierGroup = armorComponent.ItemModifierGroup; + HeadArmor = armorComponent.HeadArmor; + BodyArmor = armorComponent.BodyArmor; + LegArmor = armorComponent.LegArmor; + ArmArmor = armorComponent.ArmArmor; + ManeuverBonus = armorComponent.ManeuverBonus; + SpeedBonus = armorComponent.SpeedBonus; + ChargeBonus = armorComponent.ChargeBonus; + FamilyType = armorComponent.FamilyType; + MaterialType = armorComponent.MaterialType; + MeshesMask = armorComponent.MeshesMask; + BodyMeshType = armorComponent.BodyMeshType; + BodyDeformType = armorComponent.BodyDeformType; + HairCoverType = armorComponent.HairCoverType; + BeardCoverType = armorComponent.BeardCoverType; + ManeCoverType = armorComponent.ManeCoverType; + TailCoverType = armorComponent.TailCoverType; + ReinsMesh = armorComponent.ReinsMesh; + } + } + + public static implicit operator ArmorComponentSurrogate(ArmorComponent armorComponent) + { + return new ArmorComponentSurrogate(armorComponent); + } + + public static implicit operator ArmorComponent(ArmorComponentSurrogate surrogate) + { + return new ArmorComponent(surrogate.Item); + } + } +} \ No newline at end of file diff --git a/source/GameInterface/Surrogates/HorseComponentSurrogate.cs b/source/GameInterface/Surrogates/HorseComponentSurrogate.cs new file mode 100644 index 000000000..8956236a5 --- /dev/null +++ b/source/GameInterface/Surrogates/HorseComponentSurrogate.cs @@ -0,0 +1,78 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates +{ + [ProtoContract] + internal struct HorseComponentSurrogate + { + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + [ProtoMember(3)] + public Monster Monster { get; set; } + [ProtoMember(4)] + public int Manuever { get; set; } + [ProtoMember(5)] + public int ChargeDamage { get; set; } + [ProtoMember(6)] + public int Speed { get; set; } + [ProtoMember(7)] + public int BodyLength { get; set; } + [ProtoMember(8)] + public int HitPoints { get; set; } + [ProtoMember(9)] + public bool IsRideable { get; set; } + [ProtoMember(10)] + public bool IsPackAnimal { get; set; } + [ProtoMember(11)] + public SkeletonScale SkeletonScale { get; set; } + + + public HorseComponentSurrogate(HorseComponent horseComponent) + { + if (horseComponent == null) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + Monster = ObjectHelper.SkipConstructor(); + Manuever = -1; + ChargeDamage = -1; + Speed = -1; + BodyLength = -1; + HitPoints = -1; + IsRideable = false; + IsPackAnimal = false; + SkeletonScale = ObjectHelper.SkipConstructor(); + } + else + { + Item = horseComponent.Item; + ItemModifierGroup = horseComponent.ItemModifierGroup; + Monster = horseComponent.Monster; + Manuever = horseComponent.Maneuver; + ChargeDamage = horseComponent.ChargeDamage; + Speed = horseComponent.Speed; + BodyLength = horseComponent.BodyLength; + HitPoints = horseComponent.HitPoints; + IsRideable = horseComponent.IsRideable; + IsPackAnimal = horseComponent.IsPackAnimal; + SkeletonScale = horseComponent.SkeletonScale; + } + } + + public static implicit operator HorseComponentSurrogate(HorseComponent horseComponent) + { + return new HorseComponentSurrogate(horseComponent); + } + + public static implicit operator HorseComponent(HorseComponentSurrogate surrogate) + { + return new HorseComponent(); + } + } +} diff --git a/source/GameInterface/Surrogates/ItemCategorySurrogate.cs b/source/GameInterface/Surrogates/ItemCategorySurrogate.cs new file mode 100644 index 000000000..347325b50 --- /dev/null +++ b/source/GameInterface/Surrogates/ItemCategorySurrogate.cs @@ -0,0 +1,63 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates; +[ProtoContract] +internal struct ItemCategorySurrogate +{ + [ProtoMember(1)] + public bool IsTradeGood { get; set; } + [ProtoMember(2)] + public bool IsAnimal { get; set; } + [ProtoIgnore] + public ItemCategory CanSubstitute { get; set; } + [ProtoMember(4)] + public float SubstitutionFactor { get; set; } + [ProtoMember(5)] + public ItemCategory.Property Properties { get; set; } + [ProtoMember(6)] + public bool IsValid { get; set; } + [ProtoMember(7)] + public float BaseDemand { get; private set; } + [ProtoMember(8)] + public float LuxuryDemand { get; private set; } + + public ItemCategorySurrogate(ItemCategory ItemCategory) + { + if (ItemCategory == null) + { + IsTradeGood = false; + IsAnimal = false; + CanSubstitute = ObjectHelper.SkipConstructor(); + SubstitutionFactor = -1f; + Properties = ItemCategory.Property.None; + IsValid = false; + BaseDemand = -1f; + LuxuryDemand = -1f; + } + else + { + IsTradeGood = ItemCategory.IsTradeGood; + IsAnimal = ItemCategory.IsAnimal; + CanSubstitute = ItemCategory.CanSubstitute; + SubstitutionFactor = ItemCategory.SubstitutionFactor; + Properties = ItemCategory.Properties; + IsValid = ItemCategory.IsValid; + BaseDemand = ItemCategory.BaseDemand; + LuxuryDemand = ItemCategory.LuxuryDemand; + } + } + + public static implicit operator ItemCategorySurrogate(ItemCategory item) + { + return new ItemCategorySurrogate(item); + } + + public static implicit operator ItemCategory(ItemCategorySurrogate item) + { + return new ItemCategory(); + } +} diff --git a/source/GameInterface/Surrogates/ItemComponentSurrogate.cs b/source/GameInterface/Surrogates/ItemComponentSurrogate.cs new file mode 100644 index 000000000..90f1f3f1e --- /dev/null +++ b/source/GameInterface/Surrogates/ItemComponentSurrogate.cs @@ -0,0 +1,198 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates; +[ProtoContract] +internal struct ItemComponentSurrogate +{ + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + + //Horse + [ProtoMember(3)] + public Monster Monster { get; set; } + [ProtoMember(4)] + public int Manuever { get; set; } + [ProtoMember(5)] + public int ChargeDamage { get; set; } + [ProtoMember(6)] + public int Speed { get; set; } + [ProtoMember(7)] + public int BodyLength { get; set; } + [ProtoMember(8)] + public int HitPoints { get; set; } + [ProtoMember(9)] + public bool IsRideable { get; set; } + [ProtoMember(10)] + public bool IsPackAnimal { get; set; } + [ProtoMember(11)] + public SkeletonScale SkeletonScale { get; set; } + + //Armor + [ProtoMember(12)] + public int HeadArmor { get; set; } + [ProtoMember(13)] + public int BodyArmor { get; set; } + [ProtoMember(14)] + public int LegArmor { get; set; } + [ProtoMember(15)] + public int ArmArmor { get; set; } + [ProtoMember(16)] + public int ManeuverBonus { get; set; } + [ProtoMember(17)] + public int SpeedBonus { get; set; } + [ProtoMember(18)] + public int ChargeBonus { get; set; } + [ProtoMember(19)] + public int FamilyType { get; set; } + [ProtoMember(20)] + public ArmorComponent.ArmorMaterialTypes MaterialType { get; set; } + [ProtoMember(21)] + public SkinMask MeshesMask { get; set; } + [ProtoMember(22)] + public ArmorComponent.BodyMeshTypes BodyMeshType { get; set; } + [ProtoMember(23)] + public ArmorComponent.BodyDeformTypes BodyDeformType { get; set; } + [ProtoMember(24)] + public ArmorComponent.HairCoverTypes HairCoverType { get; set; } + [ProtoMember(25)] + public ArmorComponent.BeardCoverTypes BeardCoverType { get; set; } + [ProtoMember(26)] + public ArmorComponent.HorseHarnessCoverTypes ManeCoverType { get; set; } + [ProtoMember(27)] + public ArmorComponent.HorseTailCoverTypes TailCoverType { get; set; } + [ProtoMember(28)] + public string ReinsMesh { get; set; } + [ProtoMember(29)] + public ItemComponentType ComponentType { get; set; } + + public enum ItemComponentType + { + None, + Weapon, + TradeItem, + Saddle, + Horse, + Armor + } + + public ItemComponentSurrogate(ItemComponent itemComponent) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + Monster = ObjectHelper.SkipConstructor(); + Manuever = -1; + ChargeDamage = -1; + Speed = -1; + BodyLength = -1; + HitPoints = -1; + IsRideable = false; + IsPackAnimal = false; + SkeletonScale = ObjectHelper.SkipConstructor(); + HeadArmor = -1; + BodyArmor = -1; + LegArmor = -1; + ArmArmor = -1; + ManeuverBonus = -1; + SpeedBonus = -1; + ChargeBonus = -1; + FamilyType = -1; + MaterialType = ArmorComponent.ArmorMaterialTypes.None; + MeshesMask = SkinMask.NoneVisible; + BodyMeshType = ArmorComponent.BodyMeshTypes.Normal; + BodyDeformType = ArmorComponent.BodyDeformTypes.Medium; + HairCoverType = ArmorComponent.HairCoverTypes.None; + BeardCoverType = ArmorComponent.BeardCoverTypes.None; + ManeCoverType = ArmorComponent.HorseHarnessCoverTypes.None; + TailCoverType = ArmorComponent.HorseTailCoverTypes.None; + ReinsMesh = ""; + ComponentType = ItemComponentType.None; + + if (itemComponent != null) + { + Item = itemComponent.Item; + ItemModifierGroup = itemComponent.ItemModifierGroup; + + if (itemComponent is ArmorComponent armorComponent) + { + HeadArmor = armorComponent.HeadArmor; + BodyArmor = armorComponent.BodyArmor; + LegArmor = armorComponent.LegArmor; + ArmArmor = armorComponent.ArmArmor; + ManeuverBonus = armorComponent.ManeuverBonus; + SpeedBonus = armorComponent.SpeedBonus; + ChargeBonus = armorComponent.ChargeBonus; + FamilyType = armorComponent.FamilyType; + MaterialType = armorComponent.MaterialType; + MeshesMask = armorComponent.MeshesMask; + BodyMeshType = armorComponent.BodyMeshType; + BodyDeformType = armorComponent.BodyDeformType; + HairCoverType = armorComponent.HairCoverType; + BeardCoverType = armorComponent.BeardCoverType; + ManeCoverType = armorComponent.ManeCoverType; + TailCoverType = armorComponent.TailCoverType; + ReinsMesh = armorComponent.ReinsMesh; + } + else if (itemComponent is HorseComponent horseComponent) + { + Monster = horseComponent.Monster; + Manuever = horseComponent.Maneuver; + ChargeDamage = horseComponent.ChargeDamage; + Speed = horseComponent.Speed; + BodyLength = horseComponent.BodyLength; + HitPoints = horseComponent.HitPoints; + IsRideable = horseComponent.IsRideable; + IsPackAnimal = horseComponent.IsPackAnimal; + SkeletonScale = horseComponent.SkeletonScale; + } + } + if (itemComponent != null) + { + Type type = itemComponent.GetType(); + + if (type == typeof(ArmorComponent)) + ComponentType = ItemComponentType.Armor; + else if (type == typeof(HorseComponent)) + ComponentType = ItemComponentType.Horse; + else if (type == typeof(WeaponComponent)) + ComponentType = ItemComponentType.Weapon; + else if (type == typeof(TradeItemComponent)) + ComponentType = ItemComponentType.TradeItem; + else if (type == typeof(SaddleComponent)) + ComponentType = ItemComponentType.Saddle; + else + ComponentType = ItemComponentType.None; + } + } + + public static implicit operator ItemComponentSurrogate(ItemComponent itemComponent) + { + return new ItemComponentSurrogate(itemComponent); + } + + public static implicit operator ItemComponent(ItemComponentSurrogate surrogate) + { + switch (surrogate.ComponentType) + { + case ItemComponentType.Weapon: + return new WeaponComponent(surrogate.Item); + case ItemComponentType.TradeItem: + return new TradeItemComponent(); + case ItemComponentType.Saddle: + return new SaddleComponent((SaddleComponent)surrogate); + case ItemComponentType.Horse: + return new HorseComponent(); + case ItemComponentType.Armor: + return new ArmorComponent(surrogate.Item); + default: + throw new InvalidOperationException("Unknown ItemComponentSurrogate type."); + } + } +} + diff --git a/source/GameInterface/Surrogates/ItemObjectSurrogate.cs b/source/GameInterface/Surrogates/ItemObjectSurrogate.cs new file mode 100644 index 000000000..213ee8e46 --- /dev/null +++ b/source/GameInterface/Surrogates/ItemObjectSurrogate.cs @@ -0,0 +1,123 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using TaleWorlds.Core; +using TaleWorlds.Library; +using TaleWorlds.Localization; + +namespace GameInterface.Surrogates; + +[ProtoContract] +internal struct ItemObjectSurrogate +{ + [ProtoIgnore] + public ItemComponent ItemComponent { get; set; } + [ProtoMember(2)] + public string MultiMeshName { get; set; } + [ProtoMember(3)] + public string HolsterMeshName { get; set; } + [ProtoMember(4)] + public string HolsterWithWeaponMeshName { get; set; } + [ProtoMember(5)] + public string[] ItemHolsters { get; set; } + [ProtoMember(6)] + public Vec3 HolsterPositionShift { get; set; } + [ProtoMember(7)] + public bool HasLowerHolsterPriority { get; set; } + [ProtoMember(8)] + public string FlyingMeshName { get; set; } + [ProtoMember(9)] + public string BodyName { get; set; } + [ProtoMember(10)] + public string HolsterBodyName { get; set; } + [ProtoMember(11)] + public string CollisionBodyName { get; set; } + [ProtoMember(12)] + public bool RecalculateBody { get; set; } + [ProtoMember(13)] + public string PrefabName { get; set; } + [ProtoMember(14)] + public TextObject Name { get; set; } + [ProtoMember(15)] + public ItemFlags ItemFlags { get; set; } + [ProtoMember(16)] + public ItemCategory ItemCategory { get; set; } + [ProtoMember(17)] + public int Value { get; set; } + [ProtoMember(18)] + public float Effectiveness { get; set; } + [ProtoMember(19)] + public float Weight { get; set; } + [ProtoMember(20)] + public int Difficulty { get; set; } + [ProtoMember(21)] + public float Appearance { get; set; } + [ProtoMember(22)] + public bool IsUsingTableau { get; set; } + + public ItemObjectSurrogate(ItemObject ItemObject) + { + if (ItemObject == null) + { + ItemComponent = new TradeItemComponent(); + MultiMeshName = ""; + HolsterMeshName = ""; + HolsterWithWeaponMeshName = ""; + ItemHolsters = new string[] {""}; + HolsterPositionShift = ObjectHelper.SkipConstructor(); + HasLowerHolsterPriority = false; + FlyingMeshName = ""; + BodyName = ""; + HolsterBodyName = ""; + CollisionBodyName = ""; + RecalculateBody = false; + PrefabName = ""; + Name = ObjectHelper.SkipConstructor(); + ItemFlags = ItemFlags.Civilian; + ItemCategory = ObjectHelper.SkipConstructor(); + Value = -1; + Effectiveness = -1f; + Weight = -1f; + Difficulty = -1; + Appearance = -1f; + IsUsingTableau = false; + } + else + { + ItemComponent = ItemObject.ItemComponent; + MultiMeshName = ItemObject.MultiMeshName; + HolsterMeshName = ItemObject.HolsterMeshName; + HolsterWithWeaponMeshName = ItemObject.HolsterWithWeaponMeshName; + ItemHolsters = ItemObject.ItemHolsters; + HolsterPositionShift = ItemObject.HolsterPositionShift; + HasLowerHolsterPriority = ItemObject.HasLowerHolsterPriority; + FlyingMeshName = ItemObject.FlyingMeshName; + BodyName = ItemObject.BodyName; + HolsterBodyName = ItemObject.HolsterBodyName; + CollisionBodyName = ItemObject.CollisionBodyName; + RecalculateBody = ItemObject.RecalculateBody; + PrefabName = ItemObject.PrefabName; + Name = ItemObject.Name; + ItemFlags = ItemObject.ItemFlags; + ItemCategory = ItemObject.ItemCategory; + Value = ItemObject.Value; + Effectiveness = ItemObject.Effectiveness; + Weight = ItemObject.Weight; + Difficulty = ItemObject.Difficulty; + Appearance = ItemObject.Appearance; + IsUsingTableau = ItemObject.IsUsingTableau; + } + } + + public static implicit operator ItemObjectSurrogate(ItemObject ItemObject) + { + return new ItemObjectSurrogate(ItemObject); + } + + public static implicit operator ItemObject(ItemObjectSurrogate ItemObject) + { + return new ItemObject(); + } +} diff --git a/source/GameInterface/Surrogates/MonsterSurrogate.cs b/source/GameInterface/Surrogates/MonsterSurrogate.cs new file mode 100644 index 000000000..4c9d4c681 --- /dev/null +++ b/source/GameInterface/Surrogates/MonsterSurrogate.cs @@ -0,0 +1,369 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Common.Util; +using ProtoBuf; +using TaleWorlds.Core; +using TaleWorlds.Library; + +namespace GameInterface.Surrogates; +[ProtoContract] +internal struct MonsterSurrogate +{ + [ProtoMember(1)] + public string BaseMonster { get; set; } + [ProtoMember(2)] + public float BodyCapsuleRadius { get; set; } + [ProtoMember(3)] + public Vec3 BodyCapsulePoint1 { get; set; } + [ProtoMember(4)] + public Vec3 BodyCapsulePoint2 { get; set; } + [ProtoMember(5)] + public float CrouchedBodyCapsuleRadius { get; set; } + [ProtoMember(6)] + public Vec3 CrouchedBodyCapsulePoint1 { get; set; } + [ProtoMember(7)] + public Vec3 CrouchedBodyCapsulePoint2 { get; set; } + [ProtoMember(8)] + public AgentFlag Flags { get; set; } + [ProtoMember(9)] + public int Weight { get; set; } + [ProtoMember(10)] + public int HitPoints { get; set; } + [ProtoMember(11)] + public string ActionSetCode { get; set; } + [ProtoMember(12)] + public string FemaleActionSetCode { get; set; } + [ProtoMember(13)] + public int NumPaces { get; set; } + [ProtoMember(14)] + public string MonsterUsage { get; set; } + [ProtoMember(15)] + public float WalkingSpeedLimit { get; set; } + [ProtoMember(16)] + public float CrouchWalkingSpeedLimit { get; set; } + [ProtoMember(17)] + public float JumpAcceleration { get; set; } + [ProtoMember(18)] + public float AbsorbedDamageRatio { get; set; } + [ProtoMember(19)] + public string SoundAndCollisionInfoClassName { get; set; } + [ProtoMember(20)] + public float RiderCameraHeightAdder { get; set; } + [ProtoMember(21)] + public float RiderBodyCapsuleHeightAdder { get; set; } + [ProtoMember(22)] + public float RiderBodyCapsuleForwardAdder { get; set; } + [ProtoMember(23)] + public float StandingChestHeight { get; set; } + [ProtoMember(24)] + public float StandingPelvisHeight { get; set; } + [ProtoMember(25)] + public float StandingEyeHeight { get; set; } + [ProtoMember(26)] + public float CrouchEyeHeight { get; set; } + [ProtoMember(27)] + public float MountedEyeHeight { get; set; } + [ProtoMember(28)] + public float RiderEyeHeightAdder { get; set; } + [ProtoMember(29)] + public Vec3 EyeOffsetWrtHead { get; set; } + [ProtoMember(30)] + public Vec3 FirstPersonCameraOffsetWrtHead { get; set; } + [ProtoMember(31)] + public float ArmLength { get; set; } + [ProtoMember(32)] + public float ArmWeight { get; set; } + [ProtoMember(33)] + public float JumpSpeedLimit { get; set; } + [ProtoMember(34)] + public float RelativeSpeedLimitForCharge { get; set; } + [ProtoMember(35)] + public int FamilyType { get; set; } + [ProtoMember(36)] + public sbyte[] IndicesOfRagdollBonesToCheckForCorpses { get; set; } + [ProtoMember(37)] + public sbyte[] RagdollFallSoundBoneIndices { get; set; } + [ProtoMember(38)] + public sbyte HeadLookDirectionBoneIndex { get; set; } + [ProtoMember(39)] + public sbyte SpineLowerBoneIndex { get; set; } + [ProtoMember(40)] + public sbyte SpineUpperBoneIndex { get; set; } + [ProtoMember(41)] + public sbyte ThoraxLookDirectionBoneIndex { get; set; } + [ProtoMember(42)] + public sbyte NeckRootBoneIndex { get; set; } + [ProtoMember(43)] + public sbyte PelvisBoneIndex { get; set; } + [ProtoMember(44)] + public sbyte RightUpperArmBoneIndex { get; set; } + [ProtoMember(45)] + public sbyte LeftUpperArmBoneIndex { get; set; } + [ProtoMember(46)] + public sbyte FallBlowDamageBoneIndex { get; set; } + [ProtoMember(47)] + public sbyte TerrainDecalBone0Index { get; set; } + [ProtoMember(48)] + public sbyte TerrainDecalBone1Index { get; set; } + [ProtoMember(49)] + public sbyte[] RagdollStationaryCheckBoneIndices { get; set; } + [ProtoMember(50)] + public sbyte[] MoveAdderBoneIndices { get; set; } + [ProtoMember(51)] + public sbyte[] SplashDecalBoneIndices { get; set; } + [ProtoMember(52)] + public sbyte[] BloodBurstBoneIndices { get; set; } + [ProtoMember(53)] + public sbyte MainHandBoneIndex { get; set; } + [ProtoMember(54)] + public sbyte OffHandBoneIndex { get; set; } + [ProtoMember(55)] + public sbyte MainHandItemBoneIndex { get; set; } + [ProtoMember(56)] + public sbyte OffHandItemBoneIndex { get; set; } + [ProtoMember(57)] + public sbyte MainHandItemSecondaryBoneIndex { get; set; } + [ProtoMember(58)] + public sbyte OffHandItemSecondaryBoneIndex { get; set; } + [ProtoMember(59)] + public sbyte OffHandShoulderBoneIndex { get; set; } + [ProtoMember(60)] + public sbyte HandNumBonesForIk { get; set; } + [ProtoMember(61)] + public sbyte PrimaryFootBoneIndex { get; set; } + [ProtoMember(62)] + public sbyte SecondaryFootBoneIndex { get; set; } + [ProtoMember(63)] + public sbyte RightFootIkEndEffectorBoneIndex { get; set; } + [ProtoMember(64)] + public sbyte LeftFootIkEndEffectorBoneIndex { get; set; } + [ProtoMember(65)] + public sbyte RightFootIkTipBoneIndex { get; set; } + [ProtoMember(66)] + public sbyte LeftFootIkTipBoneIndex { get; set; } + [ProtoMember(67)] + public sbyte FootNumBonesForIk { get; set; } + [ProtoMember(68)] + public Vec3 ReinHandleLeftLocalPosition { get; set; } + [ProtoMember(69)] + public Vec3 ReinHandleRightLocalPosition { get; set; } + [ProtoMember(70)] + public string ReinSkeleton { get; set; } + [ProtoMember(71)] + public string ReinCollisionBody { get; set; } + [ProtoMember(72)] + public sbyte FrontBoneToDetectGroundSlopeIndex { get; set; } + [ProtoMember(73)] + public sbyte BackBoneToDetectGroundSlopeIndex { get; set; } + [ProtoMember(74)] + public sbyte[] BoneIndicesToModifyOnSlopingGround { get; set; } + [ProtoMember(75)] + public sbyte BodyRotationReferenceBoneIndex { get; set; } + [ProtoMember(76)] + public sbyte RiderSitBoneIndex { get; set; } + [ProtoMember(77)] + public sbyte ReinHandleBoneIndex { get; set; } + [ProtoMember(78)] + public sbyte ReinCollision1BoneIndex { get; set; } + [ProtoMember(79)] + public sbyte ReinCollision2BoneIndex { get; set; } + [ProtoMember(80)] + public sbyte ReinHeadBoneIndex { get; set; } + [ProtoMember(81)] + public sbyte ReinHeadRightAttachmentBoneIndex { get; set; } + [ProtoMember(82)] + public sbyte ReinHeadLeftAttachmentBoneIndex { get; set; } + [ProtoMember(83)] + public sbyte ReinRightHandBoneIndex { get; set; } + [ProtoMember(84)] + public sbyte ReinLeftHandBoneIndex { get; set; } + + public MonsterSurrogate(Monster Monster) + { + if (Monster == null) + { + BaseMonster = ""; + BodyCapsuleRadius = -1; + BodyCapsulePoint1 = ObjectHelper.SkipConstructor(); + BodyCapsulePoint2 = ObjectHelper.SkipConstructor(); + CrouchedBodyCapsuleRadius = -1; + CrouchedBodyCapsulePoint1 = ObjectHelper.SkipConstructor(); + CrouchedBodyCapsulePoint2 = ObjectHelper.SkipConstructor(); + Flags = AgentFlag.None; + Weight = -1; + HitPoints = -1; + ActionSetCode = ""; + FemaleActionSetCode = ""; + NumPaces = -1; + MonsterUsage = ""; + WalkingSpeedLimit = -1; + CrouchWalkingSpeedLimit = -1; + JumpAcceleration = -1; + AbsorbedDamageRatio = -1; + SoundAndCollisionInfoClassName = ""; + RiderCameraHeightAdder = -1; + RiderBodyCapsuleHeightAdder = -1; + RiderBodyCapsuleForwardAdder = -1; + StandingChestHeight = -1; + StandingPelvisHeight = -1; + StandingEyeHeight = -1; + CrouchEyeHeight = -1; + MountedEyeHeight = -1; + RiderEyeHeightAdder = -1; + EyeOffsetWrtHead = ObjectHelper.SkipConstructor(); + FirstPersonCameraOffsetWrtHead = ObjectHelper.SkipConstructor(); + ArmLength = -1; + ArmWeight = -1; + JumpSpeedLimit = -1; + RelativeSpeedLimitForCharge = -1; + FamilyType = -1; + IndicesOfRagdollBonesToCheckForCorpses = new sbyte[0]; + RagdollFallSoundBoneIndices = new sbyte[0]; + HeadLookDirectionBoneIndex = -1; + SpineLowerBoneIndex = -1; + SpineUpperBoneIndex = -1; + ThoraxLookDirectionBoneIndex = -1; + NeckRootBoneIndex = -1; + PelvisBoneIndex = -1; + RightUpperArmBoneIndex = -1; + LeftUpperArmBoneIndex = -1; + FallBlowDamageBoneIndex = -1; + TerrainDecalBone0Index = -1; + TerrainDecalBone1Index = -1; + RagdollStationaryCheckBoneIndices = new sbyte[0]; + MoveAdderBoneIndices = new sbyte[0]; + SplashDecalBoneIndices = new sbyte[0]; + BloodBurstBoneIndices = new sbyte[0]; + MainHandBoneIndex = -1; + OffHandBoneIndex = -1; + MainHandItemBoneIndex = -1; + OffHandItemBoneIndex = -1; + MainHandItemSecondaryBoneIndex = -1; + OffHandItemSecondaryBoneIndex = -1; + OffHandShoulderBoneIndex = -1; + HandNumBonesForIk = -1; + PrimaryFootBoneIndex = -1; + SecondaryFootBoneIndex = -1; + RightFootIkEndEffectorBoneIndex = -1; + LeftFootIkEndEffectorBoneIndex = -1; + RightFootIkTipBoneIndex = -1; + LeftFootIkTipBoneIndex = -1; + FootNumBonesForIk = -1; + ReinHandleLeftLocalPosition = ObjectHelper.SkipConstructor(); + ReinHandleRightLocalPosition = ObjectHelper.SkipConstructor(); + ReinSkeleton = ""; + ReinCollisionBody = ""; + FrontBoneToDetectGroundSlopeIndex = -1; + BackBoneToDetectGroundSlopeIndex = -1; + BoneIndicesToModifyOnSlopingGround = new sbyte[0]; + BodyRotationReferenceBoneIndex = -1; + RiderSitBoneIndex = -1; + ReinHandleBoneIndex = -1; + ReinCollision1BoneIndex = -1; + ReinCollision2BoneIndex = -1; + ReinHeadBoneIndex = -1; + ReinHeadRightAttachmentBoneIndex = -1; + ReinHeadLeftAttachmentBoneIndex = -1; + ReinRightHandBoneIndex = -1; + ReinLeftHandBoneIndex = -1; + } + else + { + BaseMonster = Monster.BaseMonster; + BodyCapsuleRadius = Monster.BodyCapsuleRadius; + BodyCapsulePoint1 = Monster.BodyCapsulePoint1; + BodyCapsulePoint2 = Monster.BodyCapsulePoint2; + CrouchedBodyCapsuleRadius = Monster.CrouchedBodyCapsuleRadius; + CrouchedBodyCapsulePoint1 = Monster.CrouchedBodyCapsulePoint1; + CrouchedBodyCapsulePoint2 = Monster.CrouchedBodyCapsulePoint2; + Flags = Monster.Flags; + Weight = Monster.Weight; + HitPoints = Monster.HitPoints; + ActionSetCode = Monster.ActionSetCode; + FemaleActionSetCode = Monster.FemaleActionSetCode; + NumPaces = Monster.NumPaces; + MonsterUsage = Monster.MonsterUsage; + WalkingSpeedLimit = Monster.WalkingSpeedLimit; + CrouchWalkingSpeedLimit = Monster.CrouchWalkingSpeedLimit; + JumpAcceleration = Monster.JumpAcceleration; + AbsorbedDamageRatio = Monster.AbsorbedDamageRatio; + SoundAndCollisionInfoClassName = Monster.SoundAndCollisionInfoClassName; + RiderCameraHeightAdder = Monster.RiderCameraHeightAdder; + RiderBodyCapsuleHeightAdder = Monster.RiderBodyCapsuleHeightAdder; + RiderBodyCapsuleForwardAdder = Monster.RiderBodyCapsuleForwardAdder; + StandingChestHeight = Monster.StandingChestHeight; + StandingPelvisHeight = Monster.StandingPelvisHeight; + StandingEyeHeight = Monster.StandingEyeHeight; + CrouchEyeHeight = Monster.CrouchEyeHeight; + MountedEyeHeight = Monster.MountedEyeHeight; + RiderEyeHeightAdder = Monster.RiderEyeHeightAdder; + EyeOffsetWrtHead = Monster.EyeOffsetWrtHead; + FirstPersonCameraOffsetWrtHead = Monster.FirstPersonCameraOffsetWrtHead; + ArmLength = Monster.ArmLength; + ArmWeight = Monster.ArmWeight; + JumpSpeedLimit = Monster.JumpSpeedLimit; + RelativeSpeedLimitForCharge = Monster.RelativeSpeedLimitForCharge; + FamilyType = Monster.FamilyType; + IndicesOfRagdollBonesToCheckForCorpses = Monster.IndicesOfRagdollBonesToCheckForCorpses ?? new sbyte[0]; + RagdollFallSoundBoneIndices = Monster.RagdollFallSoundBoneIndices ?? new sbyte[0]; + HeadLookDirectionBoneIndex = Monster.HeadLookDirectionBoneIndex; + SpineLowerBoneIndex = Monster.SpineLowerBoneIndex; + SpineUpperBoneIndex = Monster.SpineUpperBoneIndex; + ThoraxLookDirectionBoneIndex = Monster.ThoraxLookDirectionBoneIndex; + NeckRootBoneIndex = Monster.NeckRootBoneIndex; + PelvisBoneIndex = Monster.PelvisBoneIndex; + RightUpperArmBoneIndex = Monster.RightUpperArmBoneIndex; + LeftUpperArmBoneIndex = Monster.LeftUpperArmBoneIndex; + FallBlowDamageBoneIndex = Monster.FallBlowDamageBoneIndex; + TerrainDecalBone0Index = Monster.TerrainDecalBone0Index; + TerrainDecalBone1Index = Monster.TerrainDecalBone1Index; + RagdollStationaryCheckBoneIndices = Monster.RagdollStationaryCheckBoneIndices ?? new sbyte[0]; + MoveAdderBoneIndices = Monster.MoveAdderBoneIndices ?? new sbyte[0]; + SplashDecalBoneIndices = Monster.SplashDecalBoneIndices ?? new sbyte[0]; + BloodBurstBoneIndices = Monster.BloodBurstBoneIndices ?? new sbyte[0]; + MainHandBoneIndex = Monster.MainHandBoneIndex; + OffHandBoneIndex = Monster.OffHandBoneIndex; + MainHandItemBoneIndex = Monster.MainHandItemBoneIndex; + OffHandItemBoneIndex = Monster.OffHandItemBoneIndex; + MainHandItemSecondaryBoneIndex = Monster.MainHandItemSecondaryBoneIndex; + OffHandItemSecondaryBoneIndex = Monster.OffHandItemSecondaryBoneIndex; + OffHandShoulderBoneIndex = Monster.OffHandShoulderBoneIndex; + HandNumBonesForIk = Monster.HandNumBonesForIk; + PrimaryFootBoneIndex = Monster.PrimaryFootBoneIndex; + SecondaryFootBoneIndex = Monster.SecondaryFootBoneIndex; + RightFootIkEndEffectorBoneIndex = Monster.RightFootIkEndEffectorBoneIndex; + LeftFootIkEndEffectorBoneIndex = Monster.LeftFootIkEndEffectorBoneIndex; + RightFootIkTipBoneIndex = Monster.RightFootIkTipBoneIndex; + LeftFootIkTipBoneIndex = Monster.LeftFootIkTipBoneIndex; + FootNumBonesForIk = Monster.FootNumBonesForIk; + ReinHandleLeftLocalPosition = Monster.ReinHandleLeftLocalPosition; + ReinHandleRightLocalPosition = Monster.ReinHandleRightLocalPosition; + ReinSkeleton = Monster.ReinSkeleton; + ReinCollisionBody = Monster.ReinCollisionBody; + FrontBoneToDetectGroundSlopeIndex = Monster.FrontBoneToDetectGroundSlopeIndex; + BackBoneToDetectGroundSlopeIndex = Monster.BackBoneToDetectGroundSlopeIndex; + BoneIndicesToModifyOnSlopingGround = Monster.BoneIndicesToModifyOnSlopingGround; + BodyRotationReferenceBoneIndex = Monster.BodyRotationReferenceBoneIndex; + RiderSitBoneIndex = Monster.RiderSitBoneIndex; + ReinHandleBoneIndex = Monster.ReinHandleBoneIndex; + ReinCollision1BoneIndex = Monster.ReinCollision1BoneIndex; + ReinCollision2BoneIndex = Monster.ReinCollision2BoneIndex; + ReinHeadBoneIndex = Monster.ReinHeadBoneIndex; + ReinHeadRightAttachmentBoneIndex = Monster.ReinHeadRightAttachmentBoneIndex; + ReinHeadLeftAttachmentBoneIndex = Monster.ReinHeadLeftAttachmentBoneIndex; + ReinRightHandBoneIndex = Monster.ReinRightHandBoneIndex; + ReinLeftHandBoneIndex = Monster.ReinLeftHandBoneIndex; + } + } + + public static implicit operator MonsterSurrogate(Monster Monster) + { + return new MonsterSurrogate(Monster); + } + + public static implicit operator Monster(MonsterSurrogate MonsterSurrogate) + { + return new Monster(); + } +} diff --git a/source/GameInterface/Surrogates/SaddleComponentSurrogate.cs b/source/GameInterface/Surrogates/SaddleComponentSurrogate.cs new file mode 100644 index 000000000..f63072bee --- /dev/null +++ b/source/GameInterface/Surrogates/SaddleComponentSurrogate.cs @@ -0,0 +1,42 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates +{ + [ProtoContract] + internal struct SaddleComponentSurrogate + { + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + + + public SaddleComponentSurrogate(SaddleComponent saddleComponent) + { + if (saddleComponent == null) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + } + else + { + Item = saddleComponent.Item; + ItemModifierGroup = saddleComponent.ItemModifierGroup; + } + } + + public static implicit operator SaddleComponentSurrogate(SaddleComponent saddleComponent) + { + return new SaddleComponentSurrogate(saddleComponent); + } + + public static implicit operator SaddleComponent(SaddleComponentSurrogate surrogate) + { + return new SaddleComponent(surrogate); + } + } +} diff --git a/source/GameInterface/Surrogates/SkeletonScaleSurrogate.cs b/source/GameInterface/Surrogates/SkeletonScaleSurrogate.cs new file mode 100644 index 000000000..5d969c10d --- /dev/null +++ b/source/GameInterface/Surrogates/SkeletonScaleSurrogate.cs @@ -0,0 +1,56 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; +using TaleWorlds.Library; + +namespace GameInterface.Surrogates; +[ProtoContract] +internal struct SkeletonScaleSurrogate +{ + [ProtoMember(1)] + public string SkeletonModel { get; private set; } + [ProtoMember(2)] + public Vec3 MountSitBoneScale { get; private set; } + [ProtoMember(3)] + public float MountRadiusAdder { get; private set; } + [ProtoMember(4)] + public Vec3[] Scales { get; private set; } + [ProtoMember(5)] + public List BoneNames { get; private set; } + [ProtoMember(6)] + public sbyte[] BoneIndices { get; private set; } + + public SkeletonScaleSurrogate(SkeletonScale SkeletonScale) + { + if (SkeletonScale == null) + { + SkeletonModel = ""; + MountSitBoneScale = ObjectHelper.SkipConstructor(); + MountRadiusAdder = -1f; + Scales = ObjectHelper.SkipConstructor(); + BoneNames = new List() { "" }; + BoneIndices = new sbyte[] { 0 }; + } + else + { + SkeletonModel = SkeletonScale.SkeletonModel; + MountSitBoneScale = SkeletonScale.MountSitBoneScale; + MountRadiusAdder = SkeletonScale.MountRadiusAdder; + Scales = SkeletonScale.Scales; + BoneNames = SkeletonScale.BoneNames; + BoneIndices = SkeletonScale.BoneIndices; + } + } + + public static implicit operator SkeletonScaleSurrogate(SkeletonScale SkeletonScale) + { + return new SkeletonScaleSurrogate(SkeletonScale); + } + + public static implicit operator SkeletonScale(SkeletonScaleSurrogate SkeletonScale) + { + return new SkeletonScale(); + } +} diff --git a/source/GameInterface/Surrogates/SurrogateCollection.cs b/source/GameInterface/Surrogates/SurrogateCollection.cs index 1990c8fa7..4d6d31740 100644 --- a/source/GameInterface/Surrogates/SurrogateCollection.cs +++ b/source/GameInterface/Surrogates/SurrogateCollection.cs @@ -1,4 +1,5 @@ -using ProtoBuf.Meta; +using System; +using ProtoBuf.Meta; using TaleWorlds.CampaignSystem; using TaleWorlds.Core; using TaleWorlds.Library; @@ -29,5 +30,35 @@ public SurrogateCollection() if (RuntimeTypeModel.Default.CanSerialize(typeof(Banner)) == false) RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(Vec3)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(ItemObject)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(ItemComponent)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(ItemCategory)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(SkeletonScale)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(Monster)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(WeaponComponent)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(SaddleComponent)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(HorseComponent)) == false) + RuntimeTypeModel.Default.SetSurrogate(); + + if (RuntimeTypeModel.Default.CanSerialize(typeof(ArmorComponent)) == false) + RuntimeTypeModel.Default.SetSurrogate(); } } diff --git a/source/GameInterface/Surrogates/TradeItemComponentSurrogate.cs b/source/GameInterface/Surrogates/TradeItemComponentSurrogate.cs new file mode 100644 index 000000000..eaadf9ee7 --- /dev/null +++ b/source/GameInterface/Surrogates/TradeItemComponentSurrogate.cs @@ -0,0 +1,43 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates +{ + [ProtoContract] + internal struct TradeItemComponentSurrogate + { + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + + + public TradeItemComponentSurrogate(TradeItemComponent tradeItemComponent) + { + if (tradeItemComponent == null) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + } + else + { + Item = tradeItemComponent.Item; + ItemModifierGroup = tradeItemComponent.ItemModifierGroup; + } + } + + public static implicit operator TradeItemComponentSurrogate(TradeItemComponent tradeItemComponent) + { + return new TradeItemComponentSurrogate(tradeItemComponent); + } + + public static implicit operator TradeItemComponent(TradeItemComponentSurrogate surrogate) + { + return new TradeItemComponent(); + } + } +} + diff --git a/source/GameInterface/Surrogates/Vec3Surrogate.cs b/source/GameInterface/Surrogates/Vec3Surrogate.cs new file mode 100644 index 000000000..b7e50a34b --- /dev/null +++ b/source/GameInterface/Surrogates/Vec3Surrogate.cs @@ -0,0 +1,36 @@ +using ProtoBuf; +using TaleWorlds.Library; + +namespace GameInterface.Surrogates; + +[ProtoContract] +internal struct Vec3Surrogate +{ + [ProtoMember(1)] + public float X { get; set; } + + [ProtoMember(2)] + public float Y { get; set; } + [ProtoMember(3)] + public float Z { get; set; } + [ProtoMember(4)] + public float W { get; set; } + + public Vec3Surrogate(Vec3 vec3) + { + X = vec3.x; + Y = vec3.y; + Z = vec3.z; + W = vec3.w; + } + + public static implicit operator Vec3Surrogate(Vec3 vec3) + { + return new Vec3Surrogate(vec3); + } + + public static implicit operator Vec3(Vec3Surrogate surrogate) + { + return new Vec3(surrogate.X, surrogate.Y, surrogate.Z, surrogate.W); + } +} diff --git a/source/GameInterface/Surrogates/WeaponComponentSurrogate.cs b/source/GameInterface/Surrogates/WeaponComponentSurrogate.cs new file mode 100644 index 000000000..e4db05dc1 --- /dev/null +++ b/source/GameInterface/Surrogates/WeaponComponentSurrogate.cs @@ -0,0 +1,42 @@ +using Common.Util; +using ProtoBuf; +using System; +using System.Collections.Generic; +using TaleWorlds.Core; + +namespace GameInterface.Surrogates; + + +[ProtoContract] +internal struct WeaponComponentSurrogate +{ + [ProtoMember(1)] + public ItemObject Item { get; set; } + [ProtoMember(2)] + public ItemModifierGroup ItemModifierGroup { get; set; } + + + public WeaponComponentSurrogate(WeaponComponent weaponComponent) + { + if (weaponComponent == null) + { + Item = ObjectHelper.SkipConstructor(); + ItemModifierGroup = ObjectHelper.SkipConstructor(); + } + else + { + Item = weaponComponent.Item; + ItemModifierGroup = weaponComponent.ItemModifierGroup; + } + } + + public static implicit operator WeaponComponentSurrogate(WeaponComponent weaponComponent) + { + return new WeaponComponentSurrogate(weaponComponent); + } + + public static implicit operator WeaponComponent(WeaponComponentSurrogate surrogate) + { + return new WeaponComponent(surrogate.Item); + } +}