From 3d750f0d9ee6bc01783afd0eaceeb7a5a6645631 Mon Sep 17 00:00:00 2001 From: Foglio Date: Wed, 10 Apr 2024 21:48:13 +0200 Subject: [PATCH] use explicit private modifiers everywhere --- TCC.Core/App.xaml.cs | 24 +- .../Data/Abnormalities/AbnormalityDuration.cs | 20 +- .../Abnormalities/ArcherAbnormalityTracker.cs | 33 +-- .../BerserkerAbnormalityTracker.cs | 16 +- .../BrawlerAbnormalityTracker.cs | 16 +- .../Abnormalities/GunnerAbnormalityTracker.cs | 16 +- .../Abnormalities/LancerAbnormalityTracker.cs | 22 +- .../Abnormalities/MysticAbnormalityTracker.cs | 30 +-- .../Abnormalities/NinjaAbnormalityTracker.cs | 16 +- .../Abnormalities/PriestAbnormalityTracker.cs | 40 ++-- .../Abnormalities/ReaperAbnormalityTracker.cs | 44 ++-- .../Abnormalities/SlayerAbnormalityTracker.cs | 8 +- .../SorcererAbnormalityTracker.cs | 28 +-- .../ValkyrieAbnormalityTracker.cs | 34 +-- .../WarriorAbnormalityTracker.cs | 57 ++--- TCC.Core/Data/ApplyCommand.cs | 6 +- TCC.Core/Data/AurasTracker.cs | 2 +- TCC.Core/Data/BaseStackBuffTracker.cs | 2 +- TCC.Core/Data/Chat/ActionMessagePiece.cs | 2 +- TCC.Core/Data/Chat/ChatChannelOnOff.cs | 2 +- TCC.Core/Data/Chat/ChatMessage.cs | 34 +-- TCC.Core/Data/Chat/LFG.cs | 16 +- TCC.Core/Data/Chat/LfgMessage.cs | 14 +- TCC.Core/Data/Chat/MessagePieceBase.cs | 6 +- TCC.Core/Data/Chat/MessagePieceBuilder.cs | 8 +- TCC.Core/Data/Chat/Money.cs | 2 +- TCC.Core/Data/Chat/SystemMessage.cs | 4 +- TCC.Core/Data/Chat/SystemMessagesProcessor.cs | 44 ++-- TCC.Core/Data/Chat/UrlMessagePiece.cs | 6 +- TCC.Core/Data/Counter.cs | 12 +- .../Data/Databases/AchievementDatabase.cs | 4 +- TCC.Core/Data/Databases/DatabaseBase.cs | 4 +- .../Data/Databases/DatabaseQueryMeasure.cs | 20 +- TCC.Core/Data/Databases/DungeonDatabase.cs | 16 +- TCC.Core/Data/Databases/ItemsDatabase.cs | 2 +- TCC.Core/Data/Databases/MonsterDatabase.cs | 8 +- TCC.Core/Data/Databases/RegionsDatabase.cs | 2 +- TCC.Core/Data/Databases/SkillsDatabase.cs | 6 +- .../Data/Databases/SystemMessagesDatabase.cs | 4 +- TCC.Core/Data/Databases/TccDatabases.cs | 2 +- TCC.Core/Data/Dungeon.cs | 13 +- TCC.Core/Data/DungeonCooldown.cs | 6 +- TCC.Core/Data/EpDataProvider.cs | 2 +- TCC.Core/Data/EventGroup.cs | 4 +- TCC.Core/Data/FlyingGuardianDataProvider.cs | 16 +- TCC.Core/Data/FriendList.cs | 4 +- TCC.Core/Data/GearItem.cs | 2 +- TCC.Core/Data/GroupInfo.cs | 4 +- TCC.Core/Data/GuildInfo.cs | 4 +- TCC.Core/Data/Listing.cs | 30 +-- TCC.Core/Data/Map/Guard.cs | 2 +- TCC.Core/Data/Map/Section.cs | 2 +- TCC.Core/Data/Npc/EnragePattern.cs | 2 +- TCC.Core/Data/Npc/HpTriggeredTimerPattern.cs | 2 +- TCC.Core/Data/Npc/Npc.cs | 30 +-- TCC.Core/Data/Npc/TimerPattern.cs | 6 +- TCC.Core/Data/Pc/Character.cs | 32 +-- TCC.Core/Data/Pc/DungeonCooldownData.cs | 4 +- TCC.Core/Data/Pc/GuardianInfo.cs | 6 +- TCC.Core/Data/Pc/InventoryItem.cs | 2 +- TCC.Core/Data/Pc/Player.cs | 66 +++--- TCC.Core/Data/Pc/User.cs | 64 +++--- TCC.Core/Data/Pc/VanguardInfo.cs | 8 +- TCC.Core/Data/Skills/Cooldown.cs | 36 +-- TCC.Core/Data/Skills/Skill.cs | 2 +- TCC.Core/Data/StanceTracker.cs | 2 +- TCC.Core/Data/StatTracker.cs | 12 +- TCC.Core/Debugging/DebugWindow.xaml.cs | 42 ++-- TCC.Core/Debugging/ObjectTracker.cs | 4 +- TCC.Core/Game.cs | 154 ++++++------- TCC.Core/GameEventManager.cs | 20 +- TCC.Core/Notice/NoticeChecker.cs | 16 +- .../DataTemplates.xaml.cs | 14 +- TCC.Core/ResourceDictionaries/Styles.xaml.cs | 4 +- TCC.Core/Settings/CooldownConfigParser.cs | 2 +- TCC.Core/Settings/JsonSettingsReader.cs | 4 +- TCC.Core/Settings/SettingsContainer.cs | 8 +- .../WindowSettings/BuffWindowSettings.cs | 4 +- .../WindowSettings/CharacterWindowSettings.cs | 12 +- .../WindowSettings/ChatWindowSettings.cs | 18 +- .../WindowSettings/ClassWindowSettings.cs | 16 +- .../WindowSettings/CooldownWindowSettings.cs | 4 +- .../WindowSettings/FlightWindowSettings.cs | 4 +- .../FloatingButtonWindowSettings.cs | 2 +- .../WindowSettings/GroupWindowSettings.cs | 30 +-- .../WindowSettings/LfgWindowSettings.cs | 10 +- .../LootDistributionWindowSettings.cs | 18 +- .../NotificationAreaSettings.cs | 2 +- .../WindowSettings/NpcWindowSettings.cs | 6 +- .../WindowSettings/WindowSettingsBase.cs | 6 +- .../Abnormalities/AbnormalityIndicatorBase.cs | 12 +- .../AbnormalityToolTipControl.cs | 4 +- .../Controls/Abnormalities/TooltipParser.cs | 40 ++-- TCC.Core/UI/Controls/Chat/ApplyBody.xaml.cs | 6 +- .../UI/Controls/Chat/BrokerOfferBody.xaml.cs | 10 +- .../Controls/Chat/ChatMessageControl.xaml.cs | 14 +- .../Controls/Chat/ChatMessageHeader.xaml.cs | 6 +- .../Controls/Chat/DefaultMessageBody.xaml.cs | 4 +- .../Controls/Chat/FriendMessageDialog.xaml.cs | 8 +- TCC.Core/UI/Controls/Chat/LFGcontrol.xaml.cs | 10 +- TCC.Core/UI/Controls/Chat/LfgBody.xaml.cs | 8 +- .../Chat/MessagePieceBodyControl.xaml.cs | 8 +- .../UI/Controls/Chat/MoongourdPopup.xaml.cs | 12 +- .../UI/Controls/Chat/PlayerMenuWindow.xaml.cs | 26 +-- .../Controls/Chat/TabSettingControl.xaml.cs | 40 ++-- .../Chat/TranslationIndicator.xaml.cs | 4 +- .../UI/Controls/Classes/ArcherLayout.xaml.cs | 12 +- .../UI/Controls/Classes/BrawlerLayout.xaml.cs | 8 +- .../Elements/MysticAurasIndicator.xaml.cs | 6 +- .../Elements/RagnarokBuffControl.xaml.cs | 12 +- .../Classes/Elements/RunemarksControl.xaml.cs | 6 +- .../Elements/TraverseCutControl.xaml.cs | 18 +- .../UI/Controls/Classes/GunnerLayout.xaml.cs | 8 +- .../UI/Controls/Classes/LancerLayout.xaml.cs | 14 +- .../UI/Controls/Classes/NinjaLayout.xaml.cs | 8 +- .../Controls/Classes/ValkyrieLayout.xaml.cs | 12 +- .../Controls/Dashboard/CharacterViewModel.cs | 2 +- .../Dashboard/DungeonColumnViewModel.cs | 4 +- .../Dashboard/DungeonInfoControl.xaml.cs | 4 +- .../UI/Controls/Dashboard/DungeonView.xaml.cs | 8 +- .../Controls/Dashboard/EventControl.xaml.cs | 8 +- .../Dashboard/GearItemControl.xaml.cs | 4 +- .../Dashboard/GenericInfoView.xaml.cs | 4 +- .../Dashboard/RectangleBarGauge.xaml.cs | 4 +- .../Dashboard/TimeMarkerControl.xaml.cs | 6 +- TCC.Core/UI/Controls/GenericGauge.xaml.cs | 14 +- TCC.Core/UI/Controls/Group/GroupMemberBase.cs | 26 ++- TCC.Core/UI/Controls/NPCs/BossGage.xaml.cs | 40 ++-- TCC.Core/UI/Controls/NPCs/BossViewModel.cs | 20 +- .../UI/Controls/NPCs/DragonControl.xaml.cs | 12 +- TCC.Core/UI/Controls/NPCs/EnragePeriodItem.cs | 2 +- TCC.Core/UI/Controls/NPCs/NpcViewModel.cs | 4 +- .../NPCs/Phase2BallistaBossControl.xaml.cs | 2 +- .../UI/Controls/NPCs/SmallMobControl.xaml.cs | 20 +- .../UI/Controls/NPCs/SmallMobViewModel.cs | 4 +- .../UI/Controls/Settings/BoolSetting.xaml.cs | 14 +- .../Controls/Settings/CheckboxSetting.xaml.cs | 2 +- .../UI/Controls/Settings/FieldSetting.xaml.cs | 4 +- .../Controls/Settings/HotkeySetting.xaml.cs | 14 +- .../Settings/SelectionSetting.xaml.cs | 6 +- .../UI/Controls/Settings/ValueSetting.xaml.cs | 14 +- .../Skills/FixedSkillContainers.xaml.cs | 58 ++--- .../UI/Controls/Skills/FixedSkillControl.cs | 10 +- .../Skills/NormalSkillContainer.xaml.cs | 6 +- .../Skills/RhombSkillEffectControl.xaml.cs | 14 +- .../Skills/RoundSkillEffectControl.xaml.cs | 14 +- .../UI/Controls/Skills/SkillControlBase.cs | 10 +- TCC.Core/UI/Controls/TccPopup.cs | 4 +- TCC.Core/UI/Controls/TccTrayIcon.cs | 12 +- .../Converters/GearLevelToFactorConverter.cs | 2 +- TCC.Core/UI/FocusManager.cs | 24 +- TCC.Core/UI/KeyboardHook.cs | 32 +-- TCC.Core/UI/VisibilityManager.cs | 14 +- TCC.Core/UI/WindowManager.cs | 12 +- .../UI/Windows/ChatSettingsWindow.xaml.cs | 12 +- TCC.Core/UI/Windows/DashboardWindow.xaml.cs | 6 +- TCC.Core/UI/Windows/DungeonEditWindow.xaml.cs | 10 +- TCC.Core/UI/Windows/FUBH.xaml.cs | 10 +- .../Windows/GroupAbnormalConfigWindow.xaml.cs | 18 +- .../UI/Windows/LaurelSelectionWindow.xaml.cs | 2 +- .../UI/Windows/LfgFilterConfigWindow.xaml.cs | 8 +- TCC.Core/UI/Windows/LfgListWindow.xaml.cs | 16 +- .../UI/Windows/LootDistributionWindow.xaml.cs | 9 +- .../UI/Windows/MergedInventoryWindow.xaml.cs | 10 +- .../UI/Windows/MyAbnormalConfigWindow.xaml.cs | 18 +- TCC.Core/UI/Windows/NewDungeonDialog.xaml.cs | 6 +- TCC.Core/UI/Windows/SettingsWindow.xaml.cs | 20 +- TCC.Core/UI/Windows/SkillConfigWindow.xaml.cs | 16 +- TCC.Core/UI/Windows/SplashScreenViewModel.cs | 6 +- .../SystemMessagesConfigWindow.xaml.cs | 12 +- TCC.Core/UI/Windows/TccMessageBox.xaml.cs | 20 +- TCC.Core/UI/Windows/TccSplashScreen.xaml.cs | 4 +- TCC.Core/UI/Windows/TccWindow.cs | 6 +- TCC.Core/UI/Windows/WelcomeWindow.xaml.cs | 10 +- TCC.Core/UI/Windows/Widgets/BuffWindow.cs | 44 +--- .../Windows/Widgets/CharacterWindow.xaml.cs | 20 +- .../UI/Windows/Widgets/ChatWindow.xaml.cs | 28 +-- .../Windows/Widgets/CivilUnrestWindow.xaml.cs | 4 +- .../DefaultNotificationControl.xaml.cs | 10 +- .../Widgets/FlightDurationWindow.xaml.cs | 16 +- .../Widgets/FloatingButtonViewModel.cs | 12 +- .../Widgets/FloatingButtonWindow.xaml.cs | 38 ++-- .../UI/Windows/Widgets/GroupWindow.xaml.cs | 14 +- .../Widgets/NotificationAreaViewModel.cs | 14 +- .../Widgets/NotificationControlBase.cs | 4 +- .../Windows/Widgets/NotificationInfoBase.cs | 8 +- .../Windows/Widgets/PerfMonitorWindow.xaml.cs | 4 +- .../ProgressNotificationControl.xaml.cs | 4 +- TCC.Core/UI/Windows/Widgets/TccWidget.cs | 68 +++--- .../UI/Windows/Widgets/TccWidgetBuilder.cs | 2 +- TCC.Core/Update/IconsUpdater.cs | 16 +- TCC.Core/Update/OpcodeDownloader.cs | 8 +- TCC.Core/Update/UpdateManager.cs | 24 +- TCC.Core/Utilities/ExceptionReportBuilder.cs | 8 +- TCC.Core/Utilities/GlobalExceptionHandler.cs | 8 +- TCC.Core/Utilities/TccUtils.cs | 6 +- TCC.Core/ViewModels/ChatManager.cs | 64 +++--- TCC.Core/ViewModels/ChatMessageFactory.cs | 2 +- .../ClassManagers/ArcherLayoutViewModel.cs | 2 +- .../ClassManagers/BerserkerLayoutViewModel.cs | 2 +- .../ClassManagers/BrawlerLayoutViewModel.cs | 4 +- .../ClassManagers/LancerLayoutViewModel.cs | 2 +- .../ClassManagers/MysticLayoutViewModel.cs | 14 +- .../ClassManagers/NinjaLayoutViewModel.cs | 4 +- .../ClassManagers/PriestLayoutViewModel.cs | 12 +- .../ClassManagers/SorcererLayoutViewModel.cs | 8 +- .../ClassManagers/ValkyrieLayoutViewModel.cs | 2 +- .../ClassManagers/WarriorLayoutViewModel.cs | 6 +- TCC.Core/ViewModels/DailyEvent.cs | 8 +- TCC.Core/ViewModels/DashboardViewModel.cs | 58 ++--- .../ViewModels/GroupAbnormalityViewModel.cs | 2 +- TCC.Core/ViewModels/GroupConfigVM.cs | 2 +- .../ViewModels/LaurelSelectionViewModel.cs | 10 +- TCC.Core/ViewModels/LfgListViewModel.cs | 92 ++++---- .../ViewModels/LootDistributionViewModel.cs | 78 +++---- .../LootFilterConfigurationViewModel.cs | 2 +- TCC.Core/ViewModels/LootItemViewModel.cs | 16 +- TCC.Core/ViewModels/LootingGroupMember.cs | 6 +- TCC.Core/ViewModels/MyAbnormalityVM.cs | 4 +- TCC.Core/ViewModels/PlayerMenuViewModel.cs | 40 ++-- .../ViewModels/SettingsWindowViewModel.cs | 14 +- TCC.Core/ViewModels/Tab.cs | 6 +- TCC.Core/ViewModels/TabViewModel.cs | 6 +- TCC.Core/ViewModels/TimeMarker.cs | 8 +- .../Widgets/AbnormalityWindowViewModel.cs | 8 +- .../Widgets/CharacterWindowViewModel.cs | 11 +- TCC.Core/ViewModels/Widgets/ChatViewModel.cs | 22 +- .../Widgets/CivilUnrestViewModel.cs | 16 +- .../Widgets/ClassWindowViewModel.cs | 32 +-- .../Widgets/CooldownWindowViewModel.cs | 52 ++--- .../Widgets/FlightGaugeViewModel.cs | 2 +- .../Widgets/GroupWindowViewModel.cs | 209 +++++++++++------- .../ViewModels/Widgets/NpcWindowViewModel.cs | 114 +++++----- .../Widgets/PerfMonitorViewModel.cs | 18 +- TCC.Interop/Cloud.cs | 3 +- TCC.Interop/Firebase.cs | 6 +- TCC.Interop/Moongourd/KabedonManager.cs | 12 +- TCC.Interop/Proxy/RpcServer.cs | 14 +- TCC.Interop/Proxy/StubClient.cs | 2 +- TCC.Interop/Proxy/StubInterface.cs | 10 +- TCC.Interop/Proxy/StubMessageParser.cs | 15 +- TCC.Updater/Program.cs | 14 +- TCC.Utils/HttpClientProgress.cs | 2 +- TCC.Utils/Log.cs | 4 +- TCC.Utils/Utilities.cs | 2 +- TeraPacketParser/Analysis/PacketAnalyzer.cs | 12 +- TeraPacketParser/Data/Angle.cs | 2 +- TeraPacketParser/Data/SkillId.cs | 4 +- TeraPacketParser/MessageFactory.cs | 10 +- .../Messages/S_BAN_PARTY_MEMBER.cs | 4 +- TeraPacketParser/Messages/S_FRIEND_LIST.cs | 2 +- TeraPacketParser/Messages/S_IMAGE_DATA.cs | 2 +- .../Messages/S_LEAVE_PARTY_MEMBER.cs | 6 +- TeraPacketParser/Messages/S_LOGIN.cs | 46 ++-- .../Messages/S_LOGOUT_PARTY_MEMBER.cs | 4 +- .../Messages/S_PARTY_MEMBER_CHANGE_HP.cs | 4 +- .../Messages/S_PLAYER_CHANGE_MP.cs | 6 +- .../Messages/S_USER_BLOCK_LIST.cs | 2 +- TeraPacketParser/Messages/S_USER_EFFECT.cs | 2 +- TeraPacketParser/OpCodeNamer.cs | 6 +- .../Processing/MessageProcessor.cs | 2 +- TeraPacketParser/Sniffing/JsonRPC/Request.cs | 4 +- .../Sniffing/ToolboxHttpClient.cs | 8 +- TeraPacketParser/Sniffing/ToolboxSniffer.cs | 12 +- .../Game/Services/ServerDatabase.cs | 12 +- .../PacketLog/Parsing/BlockSplitter.cs | 12 +- .../PacketLog/Parsing/StreamHelper.cs | 2 +- .../Sniffing/ConnectionDecrypter.cs | 14 +- .../TeraCommon/Sniffing/Crypt/Cryptor.cs | 10 +- .../TeraCommon/Sniffing/Crypt/Session.cs | 4 +- .../TeraCommon/Sniffing/EndpointIpv4.cs | 6 +- .../TeraCommon/Sniffing/IpSniffer.cs | 2 +- .../IpSnifferRawSocketMultipleInterfaces.cs | 4 +- .../IpSnifferRawSocketSingleInterface.cs | 16 +- .../TeraCommon/Sniffing/IpSnifferWinPcap.cs | 18 +- .../TeraCommon/Sniffing/MessageSplitter.cs | 14 +- .../TeraCommon/Sniffing/TcpConnection.cs | 4 +- .../TeraCommon/Sniffing/TcpSniffer.cs | 8 +- .../TeraCommon/Sniffing/TeraSniffer.cs | 30 +-- TeraPacketParser/TeraMessageReader.cs | 2 +- 280 files changed, 2062 insertions(+), 2020 deletions(-) diff --git a/TCC.Core/App.xaml.cs b/TCC.Core/App.xaml.cs index 14a41622..24569234 100644 --- a/TCC.Core/App.xaml.cs +++ b/TCC.Core/App.xaml.cs @@ -35,9 +35,9 @@ public partial class App { public static event Action? ReadyEvent; - static bool _restarted; - static bool _running; - static Mutex? _mutex; + private static bool _restarted; + private static bool _running; + private static Mutex? _mutex; public static bool Beta => GlobalFlags.IsBeta; @@ -63,7 +63,7 @@ public partial class App public static bool Loading { get; private set; } public static bool ToolboxMode { get; private set; } - static bool FirstStart { get; set; } + private static bool FirstStart { get; set; } public static Random Random { get; } = new(DateTime.Now.DayOfYear + DateTime.Now.Year + DateTime.Now.Minute + DateTime.Now.Second + @@ -73,8 +73,7 @@ public partial class App public static SettingsContainer Settings { get; private set; } = null!; - - async void OnStartup(object sender, StartupEventArgs e) + private async void OnStartup(object sender, StartupEventArgs e) { _running = true; AppVersion = TccUtils.GetTccVersion(); @@ -128,7 +127,8 @@ async void OnStartup(object sender, StartupEventArgs e) //TCC.Debug.Tester.AddAbnormalityToGroupMember(memberId: 1, abnormalId: 101301); //Tester.StartItemCooldown(444); } - static async Task Setup() + + private static async Task Setup() { TccUtils.SetAlignment(); @@ -208,7 +208,7 @@ static async Task Setup() } } - static void ParseStartupArgs(IList args) + private static void ParseStartupArgs(IList args) { // --toolbox ToolboxMode = args.IndexOf("--toolbox") != -1; @@ -253,7 +253,7 @@ public static void Close(bool releaseMutex = true, int code = 0) Environment.Exit(code); } - static bool IsAlreadyRunning() + private static bool IsAlreadyRunning() { _mutex = new Mutex(true, nameof(TCC), out var createdNew); if (createdNew || !_restarted) return !createdNew; @@ -277,7 +277,7 @@ public static void ReleaseMutex() }); } - static void LoadModules() + private static void LoadModules() { BaseDispatcher.Invoke(() => { @@ -328,7 +328,7 @@ public static void WaitDispatchersShutdown() //Log.CW("All dispatchers shut down."); } - static void StartDispatcherWatcher() + private static void StartDispatcherWatcher() { const int limit = 60000; @@ -371,7 +371,7 @@ static void StartDispatcherWatcher() #region Misc - static FUBH? _fubh; + private static FUBH? _fubh; public static bool FI { get; } = DateTime.Now >= TimeUtils.FromUnixTime(1567123200) && DateTime.Now < TimeUtils.FromUnixTime(1567209600); diff --git a/TCC.Core/Data/Abnormalities/AbnormalityDuration.cs b/TCC.Core/Data/Abnormalities/AbnormalityDuration.cs index f31ffa57..4f4e5a1d 100644 --- a/TCC.Core/Data/Abnormalities/AbnormalityDuration.cs +++ b/TCC.Core/Data/Abnormalities/AbnormalityDuration.cs @@ -8,14 +8,14 @@ namespace TCC.Data.Abnormalities; public class AbnormalityDuration : ThreadSafeObservableObject, IDisposable { - readonly Timer _timer; - uint _duration; - int _stacks; - double _durationLeft; - bool _isTimerDisposed; - DateTime _startTime; - DateTime _endTime; - bool _isHidden; + private readonly Timer _timer; + private uint _duration; + private int _stacks; + private double _durationLeft; + private bool _isTimerDisposed; + private DateTime _startTime; + private DateTime _endTime; + private bool _isHidden; public event Action? Refreshed; @@ -45,7 +45,7 @@ public bool IsHidden public bool CanBeHidden { get; set; } public DateTime TimeOfArrival { get; } = DateTime.Now; - AbnormalityDuration(Abnormality b) + private AbnormalityDuration(Abnormality b) { Abnormality = b; _timer = new Timer { Interval = 900 }; @@ -77,7 +77,7 @@ public AbnormalityDuration(Abnormality b, uint d, int s, ulong t, Dispatcher dis ObjectTracker.Unregister(GetType()); } - void DecreaseDuration(object? sender, EventArgs e) + private void DecreaseDuration(object? sender, EventArgs e) { DurationLeft = (_endTime - DateTime.Now).TotalMilliseconds; if (DurationLeft < 0) DurationLeft = 0; diff --git a/TCC.Core/Data/Abnormalities/ArcherAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/ArcherAbnormalityTracker.cs index 7bdcd202..7583f0c8 100644 --- a/TCC.Core/Data/Abnormalities/ArcherAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/ArcherAbnormalityTracker.cs @@ -6,10 +6,11 @@ namespace TCC.Data.Abnormalities; public class ArcherAbnormalityTracker : AbnormalityTracker { - const uint FocusId = 601400; - const uint FocusXId = 601450; - static readonly uint[] WindsongIds = [602101, 602221 /*, 602107, 602108, 602227*/]; - static readonly uint[] WindWalkIds = [602102, 602103]; + private const uint FocusId = 601400; + private const uint FocusXId = 601450; + private static readonly uint[] WindsongIds = [602101, 602221 /*, 602107, 602108, 602227*/]; + + private static readonly uint[] WindWalkIds = [602102, 602103]; //private const string WindsongIconName = "icon_skills.breeze_tex"; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) @@ -42,7 +43,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckGaleStepsEnd(p); } - static void CheckWindsongBegin(S_ABNORMALITY_BEGIN p) + private static void CheckWindsongBegin(S_ABNORMALITY_BEGIN p) { if (!WindsongIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -50,7 +51,7 @@ static void CheckWindsongBegin(S_ABNORMALITY_BEGIN p) vm.Windsong.StartEffect(p.Duration); } - static void CheckWindsongRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckWindsongRefresh(S_ABNORMALITY_REFRESH p) { if (!WindsongIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -58,7 +59,7 @@ static void CheckWindsongRefresh(S_ABNORMALITY_REFRESH p) vm.Windsong.RefreshEffect(p.Duration); } - static void CheckWindsongEnd(S_ABNORMALITY_END p) + private static void CheckWindsongEnd(S_ABNORMALITY_END p) { if (!WindsongIds.Contains(p.AbnormalityId)) return; //if (!CheckByIconName(p.AbnormalityId, WindsongIconName)) return; //TODO: temporary @@ -67,7 +68,7 @@ static void CheckWindsongEnd(S_ABNORMALITY_END p) vm.Windsong.StopEffect(); } - static void CheckGaleStepsBegin(S_ABNORMALITY_BEGIN p) + private static void CheckGaleStepsBegin(S_ABNORMALITY_BEGIN p) { if (!WindWalkIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -76,7 +77,7 @@ static void CheckGaleStepsBegin(S_ABNORMALITY_BEGIN p) vm.WindWalkProc = true; } - static void CheckWindWalkRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckWindWalkRefresh(S_ABNORMALITY_REFRESH p) { if (!WindWalkIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -85,7 +86,7 @@ static void CheckWindWalkRefresh(S_ABNORMALITY_REFRESH p) vm.WindWalkProc = true; } - static void CheckGaleStepsEnd(S_ABNORMALITY_END p) + private static void CheckGaleStepsEnd(S_ABNORMALITY_END p) { if (!WindWalkIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -94,7 +95,7 @@ static void CheckGaleStepsEnd(S_ABNORMALITY_END p) vm.WindWalkProc = false; } - static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) + private static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -102,7 +103,7 @@ static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) vm.Focus.StartFocus(p.Duration); } - static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -110,7 +111,7 @@ static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) vm.Focus.SetFocusStacks(p.Stacks, p.Duration); } - static void CheckFocusRefresh(S_ABNORMALITY_END p) + private static void CheckFocusRefresh(S_ABNORMALITY_END p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -118,7 +119,7 @@ static void CheckFocusRefresh(S_ABNORMALITY_END p) vm.Focus.StopFocus(); } - static void CheckFocusXBegin(S_ABNORMALITY_BEGIN p) + private static void CheckFocusXBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != FocusXId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -126,7 +127,7 @@ static void CheckFocusXBegin(S_ABNORMALITY_BEGIN p) vm.Focus.StartFocusX(p.Duration); } - static void CheckFocusXRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckFocusXRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != FocusXId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -134,7 +135,7 @@ static void CheckFocusXRefresh(S_ABNORMALITY_REFRESH p) vm.Focus.StartFocusX(p.Duration); } - static void CheckFocusXRefresh(S_ABNORMALITY_END p) + private static void CheckFocusXRefresh(S_ABNORMALITY_END p) { if (p.AbnormalityId != FocusXId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/BerserkerAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/BerserkerAbnormalityTracker.cs index 9b900579..21a90a83 100644 --- a/TCC.Core/Data/Abnormalities/BerserkerAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/BerserkerAbnormalityTracker.cs @@ -5,11 +5,11 @@ namespace TCC.Data.Abnormalities; public class BerserkerAbnormalityTracker : AbnormalityTracker { - const int BloodlustId = 400701; - const int FieryRageId = 400105; - const int UnleashId = 401705; - const int SinisterDexter = 401706; - const int Rampage = 401710; + private const int BloodlustId = 400701; + private const int FieryRageId = 400105; + private const int UnleashId = 401705; + private const int SinisterDexter = 401706; + private const int Rampage = 401710; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { @@ -83,7 +83,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) } } - static void CheckUnleashAbnormalsBegin(S_ABNORMALITY_BEGIN p) + private static void CheckUnleashAbnormalsBegin(S_ABNORMALITY_BEGIN p) { if (!TryGetClassViewModel(out var vm)) return; @@ -101,7 +101,7 @@ static void CheckUnleashAbnormalsBegin(S_ABNORMALITY_BEGIN p) } } - static void CheckUnleashAbnormalsRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckUnleashAbnormalsRefresh(S_ABNORMALITY_REFRESH p) { if (!TryGetClassViewModel(out var vm)) return; @@ -119,7 +119,7 @@ static void CheckUnleashAbnormalsRefresh(S_ABNORMALITY_REFRESH p) } } - static void CheckUnleashAbnormalsEnd(S_ABNORMALITY_END p) + private static void CheckUnleashAbnormalsEnd(S_ABNORMALITY_END p) { if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/BrawlerAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/BrawlerAbnormalityTracker.cs index 7f66b214..e0826aeb 100644 --- a/TCC.Core/Data/Abnormalities/BrawlerAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/BrawlerAbnormalityTracker.cs @@ -5,8 +5,8 @@ namespace TCC.Data.Abnormalities; public class BrawlerAbnormalityTracker : AbnormalityTracker { - const int GrowingFuryId = 10153040; - const int CounterGlyphId = 31020; + private const int GrowingFuryId = 10153040; + private const int CounterGlyphId = 31020; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { @@ -32,7 +32,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckCounterProcEnd(p); } - static void CheckGrowingFuryBegin(S_ABNORMALITY_BEGIN p) + private static void CheckGrowingFuryBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != GrowingFuryId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -40,7 +40,7 @@ static void CheckGrowingFuryBegin(S_ABNORMALITY_BEGIN p) vm.IsGfOn = true; } - static void CheckGrowingFuryRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckGrowingFuryRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != GrowingFuryId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -48,7 +48,7 @@ static void CheckGrowingFuryRefresh(S_ABNORMALITY_REFRESH p) vm.IsGfOn = true; } - static void CheckGrowingFuryEnd(S_ABNORMALITY_END p) + private static void CheckGrowingFuryEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != GrowingFuryId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -56,7 +56,7 @@ static void CheckGrowingFuryEnd(S_ABNORMALITY_END p) vm.IsGfOn = false; } - static void CheckCounterProcBegin(S_ABNORMALITY_BEGIN p) + private static void CheckCounterProcBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != CounterGlyphId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -65,7 +65,7 @@ static void CheckCounterProcBegin(S_ABNORMALITY_BEGIN p) vm.CounterProc = true; } - static void CheckCounterProcRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckCounterProcRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != CounterGlyphId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -74,7 +74,7 @@ static void CheckCounterProcRefresh(S_ABNORMALITY_REFRESH p) vm.CounterProc = true; } - static void CheckCounterProcEnd(S_ABNORMALITY_END p) + private static void CheckCounterProcEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != CounterGlyphId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/GunnerAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/GunnerAbnormalityTracker.cs index f28b580d..7242e7be 100644 --- a/TCC.Core/Data/Abnormalities/GunnerAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/GunnerAbnormalityTracker.cs @@ -8,10 +8,10 @@ namespace TCC.Data.Abnormalities; public class GunnerAbnormalityTracker : AbnormalityTracker { - const uint DashingReloadId = 10152354; - static readonly List LaserTargetingIDs = [10152340]; - readonly Skill _dashingReload; - readonly Skill _rollingReload; + private const uint DashingReloadId = 10152354; + private static readonly List LaserTargetingIDs = [10152340]; + private readonly Skill _dashingReload; + private readonly Skill _rollingReload; public GunnerAbnormalityTracker() { @@ -44,7 +44,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckLaserTargetingEnd(p); } - void CheckDashingReloadBegin(S_ABNORMALITY_BEGIN p) + private void CheckDashingReloadBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != DashingReloadId) return; @@ -53,7 +53,7 @@ void CheckDashingReloadBegin(S_ABNORMALITY_BEGIN p) StartPrecooldown(_rollingReload, p.Duration); } - static void CheckLaserTargetingBegin(S_ABNORMALITY_BEGIN p) + private static void CheckLaserTargetingBegin(S_ABNORMALITY_BEGIN p) { if (!LaserTargetingIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -61,7 +61,7 @@ static void CheckLaserTargetingBegin(S_ABNORMALITY_BEGIN p) vm.ModularSystem.StartEffect(p.Duration); } - static void CheckLaserTargetingRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckLaserTargetingRefresh(S_ABNORMALITY_REFRESH p) { if (!LaserTargetingIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -69,7 +69,7 @@ static void CheckLaserTargetingRefresh(S_ABNORMALITY_REFRESH p) vm.ModularSystem.RefreshEffect(p.Duration); } - static void CheckLaserTargetingEnd(S_ABNORMALITY_END p) + private static void CheckLaserTargetingEnd(S_ABNORMALITY_END p) { if (!LaserTargetingIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/LancerAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/LancerAbnormalityTracker.cs index d22088b0..fd77e33d 100644 --- a/TCC.Core/Data/Abnormalities/LancerAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/LancerAbnormalityTracker.cs @@ -7,8 +7,8 @@ namespace TCC.Data.Abnormalities; public class LancerAbnormalityTracker : AbnormalityTracker { public static readonly uint[] ARushIDs = [200700, 200701, 200731]; - static readonly uint[] GShoutIDs = [200200, 200201, 200202]; - const uint LineHeldId = 201701; + private static readonly uint[] GShoutIDs = [200200, 200201, 200202]; + private const uint LineHeldId = 201701; public const string AdrenalineRushIconName = "icon_skills.fightingwill_tex"; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) @@ -38,7 +38,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckLineHeldEnd(p); } - static void CheckArushBegin(S_ABNORMALITY_BEGIN p) + private static void CheckArushBegin(S_ABNORMALITY_BEGIN p) { if (!CheckByIconName(p.AbnormalityId, AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; @@ -46,7 +46,7 @@ static void CheckArushBegin(S_ABNORMALITY_BEGIN p) vm.AdrenalineRush.StartEffect(p.Duration); } - static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) { if (!CheckByIconName(p.AbnormalityId, AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; @@ -54,7 +54,7 @@ static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) vm.AdrenalineRush.StartEffect(p.Duration); } - static void CheckArushEnd(S_ABNORMALITY_END p) + private static void CheckArushEnd(S_ABNORMALITY_END p) { if (!CheckByIconName(p.AbnormalityId, AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; @@ -62,7 +62,7 @@ static void CheckArushEnd(S_ABNORMALITY_END p) vm.AdrenalineRush.StopEffect(); } - static void CheckGshoutBegin(S_ABNORMALITY_BEGIN p) + private static void CheckGshoutBegin(S_ABNORMALITY_BEGIN p) { if (!GShoutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -70,7 +70,7 @@ static void CheckGshoutBegin(S_ABNORMALITY_BEGIN p) vm.GuardianShout.StartEffect(p.Duration); } - static void CheckGshoutRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckGshoutRefresh(S_ABNORMALITY_REFRESH p) { if (!GShoutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -78,7 +78,7 @@ static void CheckGshoutRefresh(S_ABNORMALITY_REFRESH p) vm.GuardianShout.StartEffect(p.Duration); } - static void CheckGshoutEnd(S_ABNORMALITY_END p) + private static void CheckGshoutEnd(S_ABNORMALITY_END p) { if (!GShoutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -86,7 +86,7 @@ static void CheckGshoutEnd(S_ABNORMALITY_END p) vm.GuardianShout.StopEffect(); } - static void CheckLineHeldBegin(S_ABNORMALITY_BEGIN p) + private static void CheckLineHeldBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != LineHeldId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -94,7 +94,7 @@ static void CheckLineHeldBegin(S_ABNORMALITY_BEGIN p) vm.LH.StartBaseBuff(p.Duration); } - static void CheckLineHeldRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckLineHeldRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != LineHeldId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -102,7 +102,7 @@ static void CheckLineHeldRefresh(S_ABNORMALITY_REFRESH p) vm.LH.RefreshBaseBuff(p.Stacks, p.Duration); } - static void CheckLineHeldEnd(S_ABNORMALITY_END p) + private static void CheckLineHeldEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != LineHeldId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/MysticAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/MysticAbnormalityTracker.cs index e1138464..906e8e46 100644 --- a/TCC.Core/Data/Abnormalities/MysticAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/MysticAbnormalityTracker.cs @@ -9,17 +9,17 @@ public class MysticAbnormalityTracker : AbnormalityTracker { //const int HurricaneId = 60010; //const int HurricaneDuration = 120000; - const int VowOfRebirthId = 700100; + private const int VowOfRebirthId = 700100; - const int VolleyOfCursesId = 27160; - const int ThrallOfVengeanceId = 702003; - const int ThrallOfWrathId = 702004; + private const int VolleyOfCursesId = 27160; + private const int ThrallOfVengeanceId = 702003; + private const int ThrallOfWrathId = 702004; - static readonly uint[] CritAuraIDs = [700600, 700601, 700602, 700603]; - static readonly uint[] ManaAuraIDs = [700300]; - static readonly uint[] CritResAuraIDs = [700200, 700201, 700202, 700203]; - static readonly uint[] SwiftAuraIDs = [700700, 700701]; - static readonly uint[] ElementalizeIDs = [702000]; + private static readonly uint[] CritAuraIDs = [700600, 700601, 700602, 700603]; + private static readonly uint[] ManaAuraIDs = [700300]; + private static readonly uint[] CritResAuraIDs = [700200, 700201, 700202, 700203]; + private static readonly uint[] SwiftAuraIDs = [700700, 700701]; + private static readonly uint[] ElementalizeIDs = [702000]; //public static void CheckHurricane(S_ABNORMALITY_BEGIN msg) //{ @@ -52,7 +52,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckAurasEnd(p, vm); } - static void CheckAurasBegin(S_ABNORMALITY_BEGIN p, MysticLayoutViewModel vm) + private static void CheckAurasBegin(S_ABNORMALITY_BEGIN p, MysticLayoutViewModel vm) { if (!Game.IsMe(p.TargetId)) return; @@ -90,7 +90,7 @@ static void CheckAurasBegin(S_ABNORMALITY_BEGIN p, MysticLayoutViewModel vm) } } - static void CheckAurasRefresh(S_ABNORMALITY_REFRESH p, MysticLayoutViewModel vm) + private static void CheckAurasRefresh(S_ABNORMALITY_REFRESH p, MysticLayoutViewModel vm) { if (!Game.IsMe(p.TargetId)) return; @@ -128,7 +128,7 @@ static void CheckAurasRefresh(S_ABNORMALITY_REFRESH p, MysticLayoutViewModel vm) } } - static void CheckAurasEnd(S_ABNORMALITY_END p, MysticLayoutViewModel vm) + private static void CheckAurasEnd(S_ABNORMALITY_END p, MysticLayoutViewModel vm) { if (!Game.IsMe(p.TargetId)) return; @@ -166,7 +166,7 @@ static void CheckAurasEnd(S_ABNORMALITY_END p, MysticLayoutViewModel vm) } } - static void CheckVolleyOfCursesBegin(S_ABNORMALITY_BEGIN p) + private static void CheckVolleyOfCursesBegin(S_ABNORMALITY_BEGIN p) { if (VolleyOfCursesId != p.AbnormalityId) return; if (!WindowManager.ViewModels.NpcVM.TryFindNPC(p.TargetId, out _)) return; @@ -175,7 +175,7 @@ static void CheckVolleyOfCursesBegin(S_ABNORMALITY_BEGIN p) InvokeMarkingRefreshed(p.Duration); } - static void CheckVolleyOfCursesRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckVolleyOfCursesRefresh(S_ABNORMALITY_REFRESH p) { if (VolleyOfCursesId != p.AbnormalityId) return; if (!WindowManager.ViewModels.NpcVM.TryFindNPC(p.TargetId, out _)) return; @@ -184,7 +184,7 @@ static void CheckVolleyOfCursesRefresh(S_ABNORMALITY_REFRESH p) InvokeMarkingRefreshed(p.Duration); } - static void CheckVolleyOfCursesEnd(S_ABNORMALITY_END p) + private static void CheckVolleyOfCursesEnd(S_ABNORMALITY_END p) { if (VolleyOfCursesId != p.AbnormalityId) return; diff --git a/TCC.Core/Data/Abnormalities/NinjaAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/NinjaAbnormalityTracker.cs index 16642a94..a910fbe1 100644 --- a/TCC.Core/Data/Abnormalities/NinjaAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/NinjaAbnormalityTracker.cs @@ -5,8 +5,8 @@ namespace TCC.Data.Abnormalities; public class NinjaAbnormalityTracker : AbnormalityTracker { - const int FocusId = 10154030; - const int InnerHarmonyBuffId = 10154480; + private const int FocusId = 10154030; + private const int InnerHarmonyBuffId = 10154480; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { @@ -32,7 +32,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckInnerHarmonyEnd(p); } - static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) + private static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -40,7 +40,7 @@ static void CheckFocusBegin(S_ABNORMALITY_BEGIN p) vm.FocusOn = true; } - static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -48,7 +48,7 @@ static void CheckFocusRefresh(S_ABNORMALITY_REFRESH p) vm.FocusOn = true; } - static void CheckFocusEnd(S_ABNORMALITY_END p) + private static void CheckFocusEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != FocusId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -56,7 +56,7 @@ static void CheckFocusEnd(S_ABNORMALITY_END p) vm.FocusOn = false; } - static void CheckInnerHarmonyBegin(S_ABNORMALITY_BEGIN p) + private static void CheckInnerHarmonyBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != InnerHarmonyBuffId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -64,7 +64,7 @@ static void CheckInnerHarmonyBegin(S_ABNORMALITY_BEGIN p) vm.InnerHarmony.StartEffect(p.Duration); } - static void CheckInnerHarmonyRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckInnerHarmonyRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != InnerHarmonyBuffId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -72,7 +72,7 @@ static void CheckInnerHarmonyRefresh(S_ABNORMALITY_REFRESH p) vm.InnerHarmony.RefreshEffect(p.Duration); } - static void CheckInnerHarmonyEnd(S_ABNORMALITY_END p) + private static void CheckInnerHarmonyEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != InnerHarmonyBuffId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/PriestAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/PriestAbnormalityTracker.cs index b9495155..12551ce7 100644 --- a/TCC.Core/Data/Abnormalities/PriestAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/PriestAbnormalityTracker.cs @@ -7,11 +7,11 @@ namespace TCC.Data.Abnormalities; public class PriestAbnormalityTracker : AbnormalityTracker { - static readonly uint[] EnergyStarsIDs = [801500, 801501, 801502, 801503, 98000107]; - const int GraceId = 801700; - const int TripleNemesisId = 28090; - const int DivineId = 805713; - static readonly uint[] EdictIDs = [805800]; + private static readonly uint[] EnergyStarsIDs = [801500, 801501, 801502, 801503, 98000107]; + private const int GraceId = 801700; + private const int TripleNemesisId = 28090; + private const int DivineId = 805713; + private static readonly uint[] EdictIDs = [805800]; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { @@ -49,7 +49,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckEdictEnd(p); } - static void CheckTripleNemesisBegin(S_ABNORMALITY_BEGIN p) + private static void CheckTripleNemesisBegin(S_ABNORMALITY_BEGIN p) { if (TripleNemesisId != p.AbnormalityId) return; if (!WindowManager.ViewModels.NpcVM.TryFindNPC(p.TargetId, out _)) return; @@ -58,7 +58,7 @@ static void CheckTripleNemesisBegin(S_ABNORMALITY_BEGIN p) InvokeMarkingRefreshed(p.Duration); } - static void CheckTripleNemesisRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckTripleNemesisRefresh(S_ABNORMALITY_REFRESH p) { if (TripleNemesisId != p.AbnormalityId) return; if (!WindowManager.ViewModels.NpcVM.TryFindNPC(p.TargetId, out _)) return; @@ -67,7 +67,7 @@ static void CheckTripleNemesisRefresh(S_ABNORMALITY_REFRESH p) InvokeMarkingRefreshed(p.Duration); } - static void CheckTripleNemesisEnd(S_ABNORMALITY_END p) + private static void CheckTripleNemesisEnd(S_ABNORMALITY_END p) { if (TripleNemesisId != p.AbnormalityId) return; @@ -75,7 +75,7 @@ static void CheckTripleNemesisEnd(S_ABNORMALITY_END p) if (MarkedTargets.Count == 0) InvokeMarkingExpired(); } - static void CheckEnergyStarsBegin(S_ABNORMALITY_BEGIN p) + private static void CheckEnergyStarsBegin(S_ABNORMALITY_BEGIN p) { if (!EnergyStarsIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -83,7 +83,7 @@ static void CheckEnergyStarsBegin(S_ABNORMALITY_BEGIN p) vm.EnergyStars.StartEffect(p.Duration); } - static void CheckEnergyStarsRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckEnergyStarsRefresh(S_ABNORMALITY_REFRESH p) { if (!EnergyStarsIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -91,7 +91,7 @@ static void CheckEnergyStarsRefresh(S_ABNORMALITY_REFRESH p) vm.EnergyStars.RefreshEffect(p.Duration); } - static void CheckEnergyStarsEnd(S_ABNORMALITY_END p) + private static void CheckEnergyStarsEnd(S_ABNORMALITY_END p) { if (!EnergyStarsIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -99,7 +99,7 @@ static void CheckEnergyStarsEnd(S_ABNORMALITY_END p) vm.EnergyStars.StopEffect(); } - static void CheckGraceBegin(S_ABNORMALITY_BEGIN p) + private static void CheckGraceBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != GraceId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -107,7 +107,7 @@ static void CheckGraceBegin(S_ABNORMALITY_BEGIN p) vm.Grace.StartEffect(p.Duration); } - static void CheckGraceRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckGraceRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != GraceId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -115,7 +115,7 @@ static void CheckGraceRefresh(S_ABNORMALITY_REFRESH p) vm.Grace.RefreshEffect(p.Duration); } - static void CheckGraceEnd(S_ABNORMALITY_END p) + private static void CheckGraceEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != GraceId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -123,7 +123,7 @@ static void CheckGraceEnd(S_ABNORMALITY_END p) vm.Grace.StopEffect(); } - static void CheckEdictBegin(S_ABNORMALITY_BEGIN p) + private static void CheckEdictBegin(S_ABNORMALITY_BEGIN p) { if (!EdictIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -131,7 +131,7 @@ static void CheckEdictBegin(S_ABNORMALITY_BEGIN p) vm.EdictOfJudgment.StartEffect(p.Duration); } - static void CheckEdictRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckEdictRefresh(S_ABNORMALITY_REFRESH p) { if (!EdictIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -139,7 +139,7 @@ static void CheckEdictRefresh(S_ABNORMALITY_REFRESH p) vm.EdictOfJudgment.RefreshEffect(p.Duration); } - static void CheckEdictEnd(S_ABNORMALITY_END p) + private static void CheckEdictEnd(S_ABNORMALITY_END p) { if (!EdictIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -147,7 +147,7 @@ static void CheckEdictEnd(S_ABNORMALITY_END p) vm.EdictOfJudgment.StopEffect(); } - static void CheckDivineBegin(S_ABNORMALITY_BEGIN p) + private static void CheckDivineBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != DivineId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -155,7 +155,7 @@ static void CheckDivineBegin(S_ABNORMALITY_BEGIN p) vm.DivineCharge.StartEffect(p.Duration); } - static void CheckDivineRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckDivineRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != DivineId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -163,7 +163,7 @@ static void CheckDivineRefresh(S_ABNORMALITY_REFRESH p) vm.DivineCharge.RefreshEffect(p.Duration); } - static void CheckDivineEnd(S_ABNORMALITY_END p) + private static void CheckDivineEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != DivineId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/ReaperAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/ReaperAbnormalityTracker.cs index 04f00bdd..26f6a4a2 100644 --- a/TCC.Core/Data/Abnormalities/ReaperAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/ReaperAbnormalityTracker.cs @@ -7,15 +7,15 @@ namespace TCC.Data.Abnormalities; public class ReaperAbnormalityTracker : AbnormalityTracker { - const int ShadowReapingId = 10151010; - const int ShadowStepId = 10151000; - const int DeathSpiralId = 10151131; - const int AssassinateId = 10151192; - const int PowerlinkedDeathSpiralId = 29112; - const int PowerlinkedDoubleShearId = 29020; + private const int ShadowReapingId = 10151010; + private const int ShadowStepId = 10151000; + private const int DeathSpiralId = 10151131; + private const int AssassinateId = 10151192; + private const int PowerlinkedDeathSpiralId = 29112; + private const int PowerlinkedDoubleShearId = 29020; - readonly Skill _shadowStep; - readonly Skill _deathSpiral; + private readonly Skill _shadowStep; + private readonly Skill _deathSpiral; public ReaperAbnormalityTracker() { @@ -58,21 +58,21 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) PowerlinkedDoubleShearEnd(p); } - void CheckDeathSpiralBegin(S_ABNORMALITY_BEGIN p) + private void CheckDeathSpiralBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != DeathSpiralId) return; StartPrecooldown(_deathSpiral, p.Duration); } - void CheckShadowStepBegin(S_ABNORMALITY_BEGIN p) + private void CheckShadowStepBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != ShadowStepId) return; StartPrecooldown(_shadowStep, p.Duration); } - static void PowerlinkedDoubleShearBegin(S_ABNORMALITY_BEGIN p) + private static void PowerlinkedDoubleShearBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != PowerlinkedDoubleShearId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -80,7 +80,7 @@ static void PowerlinkedDoubleShearBegin(S_ABNORMALITY_BEGIN p) vm.PowerlinkedDoubleShear.RefreshEffect(p.Duration); } - static void PowerlinkedDoubleShearRefresh(S_ABNORMALITY_REFRESH p) + private static void PowerlinkedDoubleShearRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != PowerlinkedDoubleShearId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -88,7 +88,7 @@ static void PowerlinkedDoubleShearRefresh(S_ABNORMALITY_REFRESH p) vm.PowerlinkedDoubleShear.RefreshEffect(p.Duration); } - static void PowerlinkedDoubleShearEnd(S_ABNORMALITY_END p) + private static void PowerlinkedDoubleShearEnd(S_ABNORMALITY_END p) { if (PowerlinkedDoubleShearId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -96,7 +96,7 @@ static void PowerlinkedDoubleShearEnd(S_ABNORMALITY_END p) vm.PowerlinkedDoubleShear.StopEffect(); } - static void PowerlinkedDeathSpiralBegin(S_ABNORMALITY_BEGIN p) + private static void PowerlinkedDeathSpiralBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != PowerlinkedDeathSpiralId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -104,7 +104,7 @@ static void PowerlinkedDeathSpiralBegin(S_ABNORMALITY_BEGIN p) vm.PowerlinkedDeathSpiral.RefreshEffect(p.Duration); } - static void PowerlinkedDeathSpiralRefresh(S_ABNORMALITY_REFRESH p) + private static void PowerlinkedDeathSpiralRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != PowerlinkedDeathSpiralId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -112,7 +112,7 @@ static void PowerlinkedDeathSpiralRefresh(S_ABNORMALITY_REFRESH p) vm.PowerlinkedDeathSpiral.RefreshEffect(p.Duration); } - static void PowerlinkedDeathSpiralEnd(S_ABNORMALITY_END p) + private static void PowerlinkedDeathSpiralEnd(S_ABNORMALITY_END p) { if (PowerlinkedDeathSpiralId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -120,7 +120,7 @@ static void PowerlinkedDeathSpiralEnd(S_ABNORMALITY_END p) vm.PowerlinkedDeathSpiral.StopEffect(); } - static void CheckAssassinateBegin(S_ABNORMALITY_BEGIN p) + private static void CheckAssassinateBegin(S_ABNORMALITY_BEGIN p) { if (AssassinateId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -128,7 +128,7 @@ static void CheckAssassinateBegin(S_ABNORMALITY_BEGIN p) vm.ShroudedEscape.StartEffect(p.Duration); } - static void CheckAssassinateRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckAssassinateRefresh(S_ABNORMALITY_REFRESH p) { if (AssassinateId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -136,7 +136,7 @@ static void CheckAssassinateRefresh(S_ABNORMALITY_REFRESH p) vm.ShroudedEscape.RefreshEffect(p.Duration); } - static void CheckAssassinateEnd(S_ABNORMALITY_END p) + private static void CheckAssassinateEnd(S_ABNORMALITY_END p) { if (AssassinateId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -144,7 +144,7 @@ static void CheckAssassinateEnd(S_ABNORMALITY_END p) vm.ShroudedEscape.StopEffect(); } - static void CheckShadowReapingBegin(S_ABNORMALITY_BEGIN p) + private static void CheckShadowReapingBegin(S_ABNORMALITY_BEGIN p) { if (ShadowReapingId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -152,7 +152,7 @@ static void CheckShadowReapingBegin(S_ABNORMALITY_BEGIN p) vm.ShadowReaping.StartEffect(p.Duration); } - static void CheckShadowReapingRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckShadowReapingRefresh(S_ABNORMALITY_REFRESH p) { if (ShadowReapingId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -160,7 +160,7 @@ static void CheckShadowReapingRefresh(S_ABNORMALITY_REFRESH p) vm.ShadowReaping.RefreshEffect(p.Duration); } - static void CheckShadowReapingEnd(S_ABNORMALITY_END p) + private static void CheckShadowReapingEnd(S_ABNORMALITY_END p) { if (ShadowReapingId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/SlayerAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/SlayerAbnormalityTracker.cs index 11d58f64..a3a87449 100644 --- a/TCC.Core/Data/Abnormalities/SlayerAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/SlayerAbnormalityTracker.cs @@ -6,7 +6,7 @@ namespace TCC.Data.Abnormalities; public class SlayerAbnormalityTracker : AbnormalityTracker { - static readonly uint[] IcbIds = [300800, 300801, 300805]; + private static readonly uint[] IcbIds = [300800, 300801, 300805]; public override void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { @@ -29,7 +29,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckInColdBloodEnd(p); } - static void CheckInColdBloodBegin(S_ABNORMALITY_BEGIN p) + private static void CheckInColdBloodBegin(S_ABNORMALITY_BEGIN p) { if (!IcbIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -37,7 +37,7 @@ static void CheckInColdBloodBegin(S_ABNORMALITY_BEGIN p) vm.InColdBlood.StartEffect(p.Duration); } - static void CheckInColdBloodRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckInColdBloodRefresh(S_ABNORMALITY_REFRESH p) { if (!IcbIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -45,7 +45,7 @@ static void CheckInColdBloodRefresh(S_ABNORMALITY_REFRESH p) vm.InColdBlood.StartEffect(p.Duration); } - static void CheckInColdBloodEnd(S_ABNORMALITY_END p) + private static void CheckInColdBloodEnd(S_ABNORMALITY_END p) { if (!IcbIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/SorcererAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/SorcererAbnormalityTracker.cs index e5d31796..9e9801fe 100644 --- a/TCC.Core/Data/Abnormalities/SorcererAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/SorcererAbnormalityTracker.cs @@ -9,16 +9,16 @@ namespace TCC.Data.Abnormalities; public class SorcererAbnormalityTracker : AbnormalityTracker { - static readonly List ManaBoostIds = [500150, 501602, 503061]; - const int FlameFusionIncreaseId = 502070; // Equipoise-Flame - const int FrostFusionIncreaseId = 502071; // Equipoise-Frost - const int ArcaneFusionIncreaseId = 502072; // Equipoise-Arcane + private static readonly List ManaBoostIds = [500150, 501602, 503061]; + private const int FlameFusionIncreaseId = 502070; // Equipoise-Flame + private const int FrostFusionIncreaseId = 502071; // Equipoise-Frost + private const int ArcaneFusionIncreaseId = 502072; // Equipoise-Arcane - const int FireIceFusionId = 502020; + private const int FireIceFusionId = 502020; //private const int FireArcaneFusionId = 502030; //private const int IceArcaneFusionId = 502040; - readonly Skill _fireIceFusion; + private readonly Skill _fireIceFusion; //private static Skill _fireArcaneFusion; //private static Skill _iceArcaneFusion; @@ -56,7 +56,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckFusionsEnd(p); } - static void CheckManaBoostBegin(S_ABNORMALITY_BEGIN p) + private static void CheckManaBoostBegin(S_ABNORMALITY_BEGIN p) { if (!ManaBoostIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -64,7 +64,7 @@ static void CheckManaBoostBegin(S_ABNORMALITY_BEGIN p) vm.ManaBoost.StartEffect(p.Duration); } - static void CheckManaBoostRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckManaBoostRefresh(S_ABNORMALITY_REFRESH p) { if (!ManaBoostIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -72,7 +72,7 @@ static void CheckManaBoostRefresh(S_ABNORMALITY_REFRESH p) vm.ManaBoost.RefreshEffect(p.Duration); } - static void CheckManaBoostEnd(S_ABNORMALITY_END p) + private static void CheckManaBoostEnd(S_ABNORMALITY_END p) { if (!ManaBoostIds.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -80,7 +80,7 @@ static void CheckManaBoostEnd(S_ABNORMALITY_END p) vm.ManaBoost.StopEffect(); } - static void CheckFusionBoostBegin(S_ABNORMALITY_BEGIN p) + private static void CheckFusionBoostBegin(S_ABNORMALITY_BEGIN p) { FusionElements element; switch (p.AbnormalityId) @@ -104,7 +104,7 @@ static void CheckFusionBoostBegin(S_ABNORMALITY_BEGIN p) BoostChanged?.Invoke(element); } - static void CheckFusionBoostRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckFusionBoostRefresh(S_ABNORMALITY_REFRESH p) { FusionElements element; @@ -128,7 +128,7 @@ static void CheckFusionBoostRefresh(S_ABNORMALITY_REFRESH p) BoostChanged?.Invoke(element); } - static void CheckFusionBoostEnd(S_ABNORMALITY_END p) + private static void CheckFusionBoostEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId is not (FlameFusionIncreaseId @@ -139,7 +139,7 @@ or FrostFusionIncreaseId BoostChanged?.Invoke(FusionElements.None); } - void CheckFusionsBegin(S_ABNORMALITY_BEGIN p) + private void CheckFusionsBegin(S_ABNORMALITY_BEGIN p) { if (FireIceFusionId == p.AbnormalityId) { @@ -155,7 +155,7 @@ void CheckFusionsBegin(S_ABNORMALITY_BEGIN p) //} } - static void CheckFusionsEnd(S_ABNORMALITY_END p) + private static void CheckFusionsEnd(S_ABNORMALITY_END p) { if (FireIceFusionId != p.AbnormalityId) return; if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/Abnormalities/ValkyrieAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/ValkyrieAbnormalityTracker.cs index 573b822e..da344b37 100644 --- a/TCC.Core/Data/Abnormalities/ValkyrieAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/ValkyrieAbnormalityTracker.cs @@ -8,15 +8,15 @@ namespace TCC.Data.Abnormalities; public class ValkyrieAbnormalityTracker : AbnormalityTracker { - const uint RagnarokId = 10155130; - const uint GrugnirsBiteId = 10155530; - const uint GodsfallId = 10155512; - static readonly List GodsfallPreCdIds = [10155510, 10155512]; - static readonly List TwilightWaltzIds = [10155530, 10155540, 10155541, 10155542]; + private const uint RagnarokId = 10155130; + private const uint GrugnirsBiteId = 10155530; + private const uint GodsfallId = 10155512; + private static readonly List GodsfallPreCdIds = [10155510, 10155512]; + private static readonly List TwilightWaltzIds = [10155530, 10155540, 10155541, 10155542]; - readonly Skill _godsfall; - readonly Skill _twilightWaltz; - readonly Skill _grugnirsBite; + private readonly Skill _godsfall; + private readonly Skill _twilightWaltz; + private readonly Skill _grugnirsBite; public ValkyrieAbnormalityTracker() { @@ -56,7 +56,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) CheckGodsfallEnd(p); } - static void CheckRagnarokBegin(S_ABNORMALITY_BEGIN p) + private static void CheckRagnarokBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != RagnarokId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -64,7 +64,7 @@ static void CheckRagnarokBegin(S_ABNORMALITY_BEGIN p) vm.Ragnarok.StartEffect(p.Duration); } - static void CheckRagnarokEnd(S_ABNORMALITY_END p) + private static void CheckRagnarokEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != RagnarokId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -72,7 +72,7 @@ static void CheckRagnarokEnd(S_ABNORMALITY_END p) vm.Ragnarok.StopEffect(); } - static void CheckRagnarokRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckRagnarokRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != RagnarokId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -80,7 +80,7 @@ static void CheckRagnarokRefresh(S_ABNORMALITY_REFRESH p) vm.Ragnarok.RefreshEffect(p.Duration); } - static void CheckGodsfallBegin(S_ABNORMALITY_BEGIN p) + private static void CheckGodsfallBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != GodsfallId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -88,7 +88,7 @@ static void CheckGodsfallBegin(S_ABNORMALITY_BEGIN p) vm.Godsfall.StartEffect(p.Duration); } - static void CheckGodsfallRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckGodsfallRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != GodsfallId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -96,7 +96,7 @@ static void CheckGodsfallRefresh(S_ABNORMALITY_REFRESH p) vm.Godsfall.RefreshEffect(p.Duration); } - static void CheckGodsfallEnd(S_ABNORMALITY_END p) + private static void CheckGodsfallEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != GodsfallId) return; if (!TryGetClassViewModel(out var vm)) return; @@ -104,7 +104,7 @@ static void CheckGodsfallEnd(S_ABNORMALITY_END p) vm.Godsfall.StopEffect(); } - void CheckTwilightWaltzBegin(S_ABNORMALITY_BEGIN p) + private void CheckTwilightWaltzBegin(S_ABNORMALITY_BEGIN p) { if (!TwilightWaltzIds.Contains(p.AbnormalityId)) return; if (p is { AbnormalityId: 10155530, Duration: 7000 }) return; // ewww @@ -112,14 +112,14 @@ void CheckTwilightWaltzBegin(S_ABNORMALITY_BEGIN p) StartPrecooldown(_twilightWaltz, p.Duration); } - void CheckGodsfallPrecdBegin(S_ABNORMALITY_BEGIN p) + private void CheckGodsfallPrecdBegin(S_ABNORMALITY_BEGIN p) { if (!GodsfallPreCdIds.Contains(p.AbnormalityId)) return; StartPrecooldown(_godsfall, p.Duration); } - void CheckGrugnirsBiteBegin(S_ABNORMALITY_BEGIN p) + private void CheckGrugnirsBiteBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != GrugnirsBiteId) return; diff --git a/TCC.Core/Data/Abnormalities/WarriorAbnormalityTracker.cs b/TCC.Core/Data/Abnormalities/WarriorAbnormalityTracker.cs index 5094a12a..b2e8fd0a 100644 --- a/TCC.Core/Data/Abnormalities/WarriorAbnormalityTracker.cs +++ b/TCC.Core/Data/Abnormalities/WarriorAbnormalityTracker.cs @@ -10,17 +10,18 @@ public class WarriorAbnormalityTracker : AbnormalityTracker { public static event Action? StanceChanged; //private static readonly uint[] GambleIDs = { 100800, 100801, 100802, 100803 }; - const uint GambleID = 100801; - static readonly uint[] AstanceIDs = [100100, 100101, 100102, 100103]; - static readonly uint[] DstanceIDs = [100200, 100201, 100202, 100203]; - static readonly uint[] TraverseCutIDs = [101300/*, 101301*/]; - static readonly uint[] BladeWaltzIDs = [104100]; - static readonly uint[] SwiftGlyphs = [21010, 21070]; + private const uint GambleID = 100801; + private static readonly uint[] AstanceIDs = [100100, 100101, 100102, 100103]; + private static readonly uint[] DstanceIDs = [100200, 100201, 100202, 100203]; + private static readonly uint[] TraverseCutIDs = [101300/*, 101301*/]; + private static readonly uint[] BladeWaltzIDs = [104100]; + private static readonly uint[] SwiftGlyphs = [21010, 21070]; - readonly Skill _bladeWaltz; + private readonly Skill _bladeWaltz; - static WarriorStance _stance; - static WarriorStance Stance + private static WarriorStance _stance; + + private static WarriorStance Stance { set { @@ -75,7 +76,7 @@ public override void OnAbnormalityEnd(S_ABNORMALITY_END p) //CheckTempestAura(p); } - static void CheckAssaultStanceBegin(S_ABNORMALITY_BEGIN p) + private static void CheckAssaultStanceBegin(S_ABNORMALITY_BEGIN p) { if (!AstanceIDs.Contains(p.AbnormalityId)) return; @@ -86,7 +87,7 @@ static void CheckAssaultStanceBegin(S_ABNORMALITY_BEGIN p) vm.SetStance(WarriorStance.Assault); } - static void CheckAssaultStanceRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckAssaultStanceRefresh(S_ABNORMALITY_REFRESH p) { if (!AstanceIDs.Contains(p.AbnormalityId)) return; @@ -97,7 +98,7 @@ static void CheckAssaultStanceRefresh(S_ABNORMALITY_REFRESH p) vm.SetStance(WarriorStance.Assault); } - static void CheckAssaultStanceEnd(S_ABNORMALITY_END p) + private static void CheckAssaultStanceEnd(S_ABNORMALITY_END p) { if (!AstanceIDs.Contains(p.AbnormalityId)) return; @@ -108,7 +109,7 @@ static void CheckAssaultStanceEnd(S_ABNORMALITY_END p) vm.SetStance(WarriorStance.None); } - static void CheckDefensiveStanceBegin(S_ABNORMALITY_BEGIN p) + private static void CheckDefensiveStanceBegin(S_ABNORMALITY_BEGIN p) { if (!DstanceIDs.Contains(p.AbnormalityId)) return; @@ -119,7 +120,7 @@ static void CheckDefensiveStanceBegin(S_ABNORMALITY_BEGIN p) vm.SetStance(WarriorStance.Defensive); } - static void CheckDefensiveStanceRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckDefensiveStanceRefresh(S_ABNORMALITY_REFRESH p) { if (!DstanceIDs.Contains(p.AbnormalityId)) return; @@ -130,7 +131,7 @@ static void CheckDefensiveStanceRefresh(S_ABNORMALITY_REFRESH p) vm.SetStance(WarriorStance.Defensive); } - static void CheckDefensiveStanceEnd(S_ABNORMALITY_END p) + private static void CheckDefensiveStanceEnd(S_ABNORMALITY_END p) { if (!DstanceIDs.Contains(p.AbnormalityId)) return; @@ -141,7 +142,7 @@ static void CheckDefensiveStanceEnd(S_ABNORMALITY_END p) vm.SetStance(WarriorStance.None); } - static void CheckDeadlyGambleBegin(S_ABNORMALITY_BEGIN p) + private static void CheckDeadlyGambleBegin(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != GambleID) return; //if (!CheckByIconName(p.AbnormalityId, DeadlyGambleIconName)) return; //temporary @@ -150,7 +151,7 @@ static void CheckDeadlyGambleBegin(S_ABNORMALITY_BEGIN p) vm.DeadlyGamble.StartEffect(p.Duration); } - static void CheckDeadlyGambleRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckDeadlyGambleRefresh(S_ABNORMALITY_REFRESH p) { if (p.AbnormalityId != GambleID) return; if (!TryGetClassViewModel(out var vm)) return; @@ -160,7 +161,7 @@ static void CheckDeadlyGambleRefresh(S_ABNORMALITY_REFRESH p) vm.DeadlyGamble.RefreshEffect(p.Duration); } - static void CheckDeadlyGambleEnd(S_ABNORMALITY_END p) + private static void CheckDeadlyGambleEnd(S_ABNORMALITY_END p) { if (p.AbnormalityId != GambleID) return; if (!TryGetClassViewModel(out var vm)) return; @@ -170,14 +171,14 @@ static void CheckDeadlyGambleEnd(S_ABNORMALITY_END p) vm.DeadlyGamble.StopEffect(); } - void CheckBladeWaltzBegin(S_ABNORMALITY_BEGIN p) + private void CheckBladeWaltzBegin(S_ABNORMALITY_BEGIN p) { if (!BladeWaltzIDs.Contains(p.AbnormalityId)) return; StartPrecooldown(_bladeWaltz, p.Duration); } - static void CheckTraverseCutBegin(S_ABNORMALITY_BEGIN p) + private static void CheckTraverseCutBegin(S_ABNORMALITY_BEGIN p) { if (!TraverseCutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -186,7 +187,7 @@ static void CheckTraverseCutBegin(S_ABNORMALITY_BEGIN p) vm.TraverseCut.InvokeToZero(p.Duration); } - static void CheckTraverseCutRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckTraverseCutRefresh(S_ABNORMALITY_REFRESH p) { if (!TraverseCutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -195,7 +196,7 @@ static void CheckTraverseCutRefresh(S_ABNORMALITY_REFRESH p) vm.TraverseCut.InvokeToZero(p.Duration); } - static void CheckTraverseCutEnd(S_ABNORMALITY_END p) + private static void CheckTraverseCutEnd(S_ABNORMALITY_END p) { if (!TraverseCutIDs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -203,7 +204,7 @@ static void CheckTraverseCutEnd(S_ABNORMALITY_END p) vm.TraverseCut.Val = 0; } - static void CheckSwiftGlyphsBegin(S_ABNORMALITY_BEGIN p) + private static void CheckSwiftGlyphsBegin(S_ABNORMALITY_BEGIN p) { if (!SwiftGlyphs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -211,7 +212,7 @@ static void CheckSwiftGlyphsBegin(S_ABNORMALITY_BEGIN p) vm.SetSwift(p.Duration); } - static void CheckSwiftGlyphsRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckSwiftGlyphsRefresh(S_ABNORMALITY_REFRESH p) { if (!SwiftGlyphs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -219,7 +220,7 @@ static void CheckSwiftGlyphsRefresh(S_ABNORMALITY_REFRESH p) vm.SetSwift(p.Duration); } - static void CheckSwiftGlyphsEnd(S_ABNORMALITY_END p) + private static void CheckSwiftGlyphsEnd(S_ABNORMALITY_END p) { if (!SwiftGlyphs.Contains(p.AbnormalityId)) return; if (!TryGetClassViewModel(out var vm)) return; @@ -227,7 +228,7 @@ static void CheckSwiftGlyphsEnd(S_ABNORMALITY_END p) vm.SetSwift(0); } - static void CheckArushBegin(S_ABNORMALITY_BEGIN p) + private static void CheckArushBegin(S_ABNORMALITY_BEGIN p) { if (!CheckByIconName(p.AbnormalityId, LancerAbnormalityTracker.AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; @@ -235,7 +236,7 @@ static void CheckArushBegin(S_ABNORMALITY_BEGIN p) vm.SetArush(p.Duration); } - static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) + private static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) { if (!CheckByIconName(p.AbnormalityId, LancerAbnormalityTracker.AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; @@ -243,7 +244,7 @@ static void CheckArushRefresh(S_ABNORMALITY_REFRESH p) vm.SetArush(p.Duration); } - static void CheckArushEnd(S_ABNORMALITY_END p) + private static void CheckArushEnd(S_ABNORMALITY_END p) { if (!CheckByIconName(p.AbnormalityId, LancerAbnormalityTracker.AdrenalineRushIconName)) return; //temporary if (!TryGetClassViewModel(out var vm)) return; diff --git a/TCC.Core/Data/ApplyCommand.cs b/TCC.Core/Data/ApplyCommand.cs index 88ee44e1..5c4332fc 100644 --- a/TCC.Core/Data/ApplyCommand.cs +++ b/TCC.Core/Data/ApplyCommand.cs @@ -8,8 +8,8 @@ namespace TCC.Data; public class ApplyCommand : ICommand { - readonly Listing _listing; - readonly Timer _t; + private readonly Listing _listing; + private readonly Timer _t; public ApplyCommand(Listing listing) { _listing = listing; @@ -17,7 +17,7 @@ public ApplyCommand(Listing listing) _t.Elapsed += OnTimerElapsed; } - void OnTimerElapsed(object? s, ElapsedEventArgs ev) + private void OnTimerElapsed(object? s, ElapsedEventArgs ev) { _t.Stop(); _listing.CanApply = true; diff --git a/TCC.Core/Data/AurasTracker.cs b/TCC.Core/Data/AurasTracker.cs index 559cd239..b291ae70 100644 --- a/TCC.Core/Data/AurasTracker.cs +++ b/TCC.Core/Data/AurasTracker.cs @@ -7,7 +7,7 @@ public class AurasTracker : ThreadSafeObservableObject { public event Action? AuraChanged; - bool _crit, _mp, _res, _swift; + private bool _crit, _mp, _res, _swift; public bool CritAura { get => _crit; set diff --git a/TCC.Core/Data/BaseStackBuffTracker.cs b/TCC.Core/Data/BaseStackBuffTracker.cs index 972d90f3..ac9bcb0b 100644 --- a/TCC.Core/Data/BaseStackBuffTracker.cs +++ b/TCC.Core/Data/BaseStackBuffTracker.cs @@ -12,7 +12,7 @@ public class BaseStackBuffTracker : ThreadSafeObservableObject public event Action? BaseBuffRefreshed; public event Action? EmpoweredBuffStarted; - int _stacks; + private int _stacks; public static bool IsEmpoweredBuffRunning { get; set; } public int Stacks diff --git a/TCC.Core/Data/Chat/ActionMessagePiece.cs b/TCC.Core/Data/Chat/ActionMessagePiece.cs index cfd23997..fb7ebeca 100644 --- a/TCC.Core/Data/Chat/ActionMessagePiece.cs +++ b/TCC.Core/Data/Chat/ActionMessagePiece.cs @@ -7,7 +7,7 @@ namespace TCC.Data.Chat; public class ActionMessagePiece : SimpleMessagePiece { - bool _isHovered; + private bool _isHovered; public override bool IsHovered { diff --git a/TCC.Core/Data/Chat/ChatChannelOnOff.cs b/TCC.Core/Data/Chat/ChatChannelOnOff.cs index 70e8dad1..7e9ed891 100644 --- a/TCC.Core/Data/Chat/ChatChannelOnOff.cs +++ b/TCC.Core/Data/Chat/ChatChannelOnOff.cs @@ -5,7 +5,7 @@ namespace TCC.Data.Chat; public class ChatChannelOnOff : ThreadSafeObservableObject { - bool _enabled; + private bool _enabled; public bool Enabled { diff --git a/TCC.Core/Data/Chat/ChatMessage.cs b/TCC.Core/Data/Chat/ChatMessage.cs index 42ae4c3c..4f8db7d9 100644 --- a/TCC.Core/Data/Chat/ChatMessage.cs +++ b/TCC.Core/Data/Chat/ChatMessage.cs @@ -19,10 +19,10 @@ public class ChatMessage : ThreadSafeObservableObject, IDisposable { #region Properties - bool _animate = true; - bool _isVisible; - bool _hasTranslation; - ChatMessage? _translation; + private bool _animate = true; + private bool _isVisible; + private bool _hasTranslation; + private ChatMessage? _translation; public ChatChannel Channel { get; protected set; } public string Timestamp { get; } @@ -30,7 +30,7 @@ public class ChatMessage : ThreadSafeObservableObject, IDisposable public string Author { get; set; } = ""; public ulong AuthorGameId { get; set; } public uint AuthorPlayerId { get; set; } - uint AuthorServerId { get; } + private uint AuthorServerId { get; } public bool ContainsPlayerName { get; set; } public bool IsGm { get; protected set; } public bool ShowTimestamp => App.Settings.ShowTimestamp; @@ -220,13 +220,13 @@ internal void AddPiece(MessagePieceBase mp) Pieces.Add(mp); } - void InsertPiece(MessagePieceBase mp, int index) + private void InsertPiece(MessagePieceBase mp, int index) { mp.Container = this; Pieces.Insert(index, mp); } - void RemovePiece(MessagePieceBase mp) + private void RemovePiece(MessagePieceBase mp) { Pieces.Remove(mp); } @@ -285,34 +285,34 @@ public void SplitSimplePieces() } } - void NotifyShowChannelChanged() + private void NotifyShowChannelChanged() { InvokePropertyChanged(nameof(ShowChannel)); } - void NotifyShowTimestampChanged() + private void NotifyShowTimestampChanged() { InvokePropertyChanged(nameof(ShowTimestamp)); } - void NotifyFontSizeChanged() + private void NotifyFontSizeChanged() { InvokePropertyChanged(nameof(Size)); } - void NotifyTranslationModeChanged() + private void NotifyTranslationModeChanged() { InvokePropertyChanged(nameof(IsShowingTranslationFirst)); InvokePropertyChanged(nameof(DisplayedLines)); InvokePropertyChanged(nameof(SecondaryLines)); } - void ParseDirectMessage(string msg) + private void ParseDirectMessage(string msg) { AddPiece(new SimpleMessagePiece(msg, App.Settings.FontSize, false)); } - void ParseEmoteMessage(string msg) + private void ParseEmoteMessage(string msg) { const string header = "@social:"; var start = msg.IndexOf(header, StringComparison.Ordinal); @@ -327,7 +327,7 @@ void ParseEmoteMessage(string msg) AddPiece(new SimpleMessagePiece(text, App.Settings.FontSize, false)); } - void ParseHtmlMessage(string msg) + private void ParseHtmlMessage(string msg) { var html = new HtmlDocument(); html.LoadHtml(msg); var htmlPieces = html.DocumentNode.ChildNodes; @@ -338,7 +338,7 @@ void ParseHtmlMessage(string msg) } } - void ParseHtmlPiece(HtmlNode piece) + private void ParseHtmlPiece(HtmlNode piece) { if (piece.HasAttributes) { @@ -403,7 +403,7 @@ void ParseHtmlPiece(HtmlNode piece) } } - void CheckRedirect(string text) + private void CheckRedirect(string text) { //redirect trading message if it's in global if ((text.Contains("WTS", StringComparison.InvariantCultureIgnoreCase) || @@ -412,7 +412,7 @@ void CheckRedirect(string text) Channel == ChatChannel.Global) Channel = ChatChannel.TradeRedirect; } - string GetPieceContent(string text) + private string GetPieceContent(string text) { var textToSplit = text.Replace(" ", " [["); var split = textToSplit.Split(new[] { "[[" }, StringSplitOptions.RemoveEmptyEntries).ToList(); diff --git a/TCC.Core/Data/Chat/LFG.cs b/TCC.Core/Data/Chat/LFG.cs index 8c3882d8..607c0f0c 100644 --- a/TCC.Core/Data/Chat/LFG.cs +++ b/TCC.Core/Data/Chat/LFG.cs @@ -6,12 +6,12 @@ namespace TCC.Data.Chat; public class Lfg : ThreadSafeObservableObject { - string _name = ""; - string _message = ""; - bool _raid; - string _dungeonName = ""; - int _membersCount; - readonly Timer _removeDelay; + private string _name = ""; + private string _message = ""; + private bool _raid; + private string _dungeonName = ""; + private int _membersCount; + private readonly Timer _removeDelay; public uint Id { get; } public uint ServerId { get; } @@ -66,7 +66,7 @@ public Lfg(uint id, string name, string msg, bool raid, uint serverId) _removeDelay.Start(); } - void RemoveDelayElapsed(object? sender, ElapsedEventArgs e) + private void RemoveDelayElapsed(object? sender, ElapsedEventArgs e) { ChatManager.Instance.RemoveLfg(this); } @@ -84,7 +84,7 @@ public void Refresh() } } - void UpdateDungeonName() + private void UpdateDungeonName() { var a = Message.Split(' '); DungeonName = a[0].Length <= 5 ? a[0] : "LFG"; diff --git a/TCC.Core/Data/Chat/LfgMessage.cs b/TCC.Core/Data/Chat/LfgMessage.cs index 2ce0cfcb..d6c71c52 100644 --- a/TCC.Core/Data/Chat/LfgMessage.cs +++ b/TCC.Core/Data/Chat/LfgMessage.cs @@ -15,10 +15,10 @@ namespace TCC.Data.Chat; public class LfgMessage : ChatMessage { - int _tries = 10; - readonly ThreadSafeObservableCollection _members = []; - readonly Timer _timer; - Listing? _linkedListing; + private int _tries = 10; + private readonly ThreadSafeObservableCollection _members = []; + private readonly Timer _timer; + private Listing? _linkedListing; public uint AuthorId { get; } public uint ServerId { get; } //TODO: should be added to base class and assigned from S_CHAT, S_WHISPER, etc @@ -69,7 +69,7 @@ protected override void DisposeImpl() base.DisposeImpl(); } - void OnMembersChanged(object? sender, NotifyCollectionChangedEventArgs e) + private void OnMembersChanged(object? sender, NotifyCollectionChangedEventArgs e) { Task.Run(() => { @@ -90,7 +90,7 @@ void OnMembersChanged(object? sender, NotifyCollectionChangedEventArgs e) }); } - void OnTimerTick(object? sender, EventArgs e) + private void OnTimerTick(object? sender, EventArgs e) { if (_tries == 0) { @@ -109,7 +109,7 @@ void OnTimerTick(object? sender, EventArgs e) WindowManager.ViewModels.LfgVM.EnqueueRequest(LinkedListing.LeaderId, LinkedListing.ServerId); } - Listing? FindListing() + private Listing? FindListing() { return WindowManager.ViewModels.LfgVM.Listings.ToSyncList().FirstOrDefault(x => x.Players.ToSyncList().Any(p => p.Name == Author) || diff --git a/TCC.Core/Data/Chat/MessagePieceBase.cs b/TCC.Core/Data/Chat/MessagePieceBase.cs index ec55fffb..f994522c 100644 --- a/TCC.Core/Data/Chat/MessagePieceBase.cs +++ b/TCC.Core/Data/Chat/MessagePieceBase.cs @@ -14,8 +14,8 @@ public class MessagePieceBase : ThreadSafeObservableObject, IDisposable { protected bool _customSize; protected int _fontSize = 18; - bool _isVisible; - ChatMessage? _container; + private bool _isVisible; + private ChatMessage? _container; public string Text { get; set; } = ""; public int Size @@ -73,7 +73,7 @@ protected MessagePieceBase() ObjectTracker.Unregister(GetType()); } - void OnFontSizeChanged() + private void OnFontSizeChanged() { InvokePropertyChanged(nameof(Size)); } diff --git a/TCC.Core/Data/Chat/MessagePieceBuilder.cs b/TCC.Core/Data/Chat/MessagePieceBuilder.cs index 5921c077..8e0177aa 100644 --- a/TCC.Core/Data/Chat/MessagePieceBuilder.cs +++ b/TCC.Core/Data/Chat/MessagePieceBuilder.cs @@ -125,22 +125,22 @@ public static SimpleMessagePiece ParseChatLinkAction(HtmlNode chatLinkAction) return mp; } - static ActionMessagePiece ParseHtmlAchievement(HtmlNode node) + private static ActionMessagePiece ParseHtmlAchievement(HtmlNode node) { return new ActionMessagePiece(node.InnerText.UnescapeHtml(), node.GetAttributeValue("param", "")); } - static ActionMessagePiece ParseHtmlItem(HtmlNode node) + private static ActionMessagePiece ParseHtmlItem(HtmlNode node) { return new ActionMessagePiece(node.InnerText.UnescapeHtml(), node.GetAttributeValue("param", "")); } - static ActionMessagePiece ParseHtmlQuest(HtmlNode node) + private static ActionMessagePiece ParseHtmlQuest(HtmlNode node) { return new ActionMessagePiece(node.InnerText.UnescapeHtml(), node.GetAttributeValue("param", "")); } - static ActionMessagePiece ParseHtmlLocation(HtmlNode node) + private static ActionMessagePiece ParseHtmlLocation(HtmlNode node) { var linkData = node.GetAttributeValue("param", ""); var pars = linkData[6..].Split('@'); diff --git a/TCC.Core/Data/Chat/Money.cs b/TCC.Core/Data/Chat/Money.cs index 21109ab6..f1e41cbc 100644 --- a/TCC.Core/Data/Chat/Money.cs +++ b/TCC.Core/Data/Chat/Money.cs @@ -10,7 +10,7 @@ public class Money : ThreadSafeObservableObject public long Silver { get; set; } public long Copper { get; set; } - Money() + private Money() { Dispatcher = ChatManager.Instance.Dispatcher; } diff --git a/TCC.Core/Data/Chat/SystemMessage.cs b/TCC.Core/Data/Chat/SystemMessage.cs index 4678009c..9c1ad83d 100644 --- a/TCC.Core/Data/Chat/SystemMessage.cs +++ b/TCC.Core/Data/Chat/SystemMessage.cs @@ -9,7 +9,7 @@ namespace TCC.Data.Chat; public class SystemMessage : ChatMessage { - static readonly char[] CurlyBrackets = ['{', '}']; + private static readonly char[] CurlyBrackets = ['{', '}']; public SystemMessage(string parameters, SystemMessageData template, ChatChannel ch) { @@ -54,7 +54,7 @@ public SystemMessage(string parameters, SystemMessageData template, ChatChannel } } - void ParseSysHtmlPiece(HtmlNode piece, Dictionary prm) + private void ParseSysHtmlPiece(HtmlNode piece, Dictionary prm) { if (piece.Name == "img") { diff --git a/TCC.Core/Data/Chat/SystemMessagesProcessor.cs b/TCC.Core/Data/Chat/SystemMessagesProcessor.cs index 6128379f..5f59fd3c 100644 --- a/TCC.Core/Data/Chat/SystemMessagesProcessor.cs +++ b/TCC.Core/Data/Chat/SystemMessagesProcessor.cs @@ -26,7 +26,7 @@ public static void AnalyzeMessage(string parameters, string opcodeName) AnalyzeMessage(parameters, template, opcodeName); } - static void AnalyzeMessage(string parameters, SystemMessageData template, string opcodeName) + private static void AnalyzeMessage(string parameters, SystemMessageData template, string opcodeName) { if (!Pass(opcodeName)) return; if (Process(parameters, template, opcodeName)) return; @@ -34,7 +34,7 @@ static void AnalyzeMessage(string parameters, SystemMessageData template, string ChatManager.Instance.AddSystemMessage(parameters, template); } - static bool Pass(string opcodeName) + private static bool Pass(string opcodeName) { return !App.Settings.UserExcludedSysMsg.Contains(opcodeName); } @@ -45,12 +45,12 @@ static bool Pass(string opcodeName) // var templ = new SystemMessageData( ChatUtils.Font(template.Template, R.Colors.ChatSystemGenericColor.ToHex()), template.ChatChannel); // ChatWindowManager.Instance.AddSystemMessage(parameters, templ, ChatChannel.Enchant); //} - static void HandleFriendLogin(string parameters, SystemMessageData template) + private static void HandleFriendLogin(string parameters, SystemMessageData template) { ChatManager.Instance.AddSystemMessage(parameters, template, ChatChannel.Friend, ChatUtils.SplitDirectives(parameters)?["UserName"] ?? ""); } - static void HandleClearedGuardianQuestsMessage(string parameters, SystemMessageData template) + private static void HandleClearedGuardianQuestsMessage(string parameters, SystemMessageData template) { var currChar = WindowManager.ViewModels.DashboardVM.CurrentCharacter; if (currChar == null) return; @@ -69,7 +69,7 @@ static void HandleClearedGuardianQuestsMessage(string parameters, SystemMessageD ChatManager.Instance.AddChatMessage(msg); } - static void HandleNewGuildMasterMessage(string parameters, SystemMessageData template) + private static void HandleNewGuildMasterMessage(string parameters, SystemMessageData template) { var msg = ChatManager.Instance.Factory.CreateSystemMessage(parameters, template, ChatChannel.GuildNotice); Log.N("Guild", msg.ToString(), NotificationType.Info); @@ -77,7 +77,7 @@ static void HandleNewGuildMasterMessage(string parameters, SystemMessageData tem msg.ContainsPlayerName = true; } - static void HandleGuilBamSpawn(string parameters, SystemMessageData template) + private static void HandleGuilBamSpawn(string parameters, SystemMessageData template) { var msg = ChatManager.Instance.Factory.CreateSystemMessage(parameters, template, (ChatChannel)template.ChatChannel); Log.N("Guild BAM", msg.ToString(), NotificationType.Info, 2 * 60 * 1000); @@ -87,7 +87,7 @@ static void HandleGuilBamSpawn(string parameters, SystemMessageData template) GameEventManager.ExecuteGuildBamWebhook(); } - static void HandleDungeonEngagedMessage(string parameters, SystemMessageData template) + private static void HandleDungeonEngagedMessage(string parameters, SystemMessageData template) { const string s = "dungeon:"; var dgId = Convert.ToUInt32(parameters[(parameters.IndexOf(s, StringComparison.Ordinal) + s.Length)..]); @@ -97,7 +97,7 @@ static void HandleDungeonEngagedMessage(string parameters, SystemMessageData tem ChatManager.Instance.AddChatMessage(msg); } - static void HandleFriendInAreaMessage(string parameters, SystemMessageData template) + private static void HandleFriendInAreaMessage(string parameters, SystemMessageData template) { if (!App.Settings.ChatEnabled) return; @@ -109,7 +109,7 @@ static void HandleFriendInAreaMessage(string parameters, SystemMessageData templ ChatManager.Instance.AddChatMessage(msg); } - static void HandleRessMessage(string parameters, SystemMessageData template) + private static void HandleRessMessage(string parameters, SystemMessageData template) { if (!App.Settings.ChatEnabled) return; @@ -119,7 +119,7 @@ static void HandleRessMessage(string parameters, SystemMessageData template) ChatManager.Instance.AddChatMessage(msg); } - static void HandleDeathMessage(string parameters, SystemMessageData template) + private static void HandleDeathMessage(string parameters, SystemMessageData template) { if (!App.Settings.ChatEnabled) return; @@ -129,7 +129,7 @@ static void HandleDeathMessage(string parameters, SystemMessageData template) ChatManager.Instance.AddChatMessage(msg); } - static void HandleInvalidLink(string parameters, SystemMessageData template) + private static void HandleInvalidLink(string parameters, SystemMessageData template) { if (App.Settings.LfgWindowSettings.Enabled) WindowManager.ViewModels.LfgVM.RemoveDeadLfg(); @@ -140,7 +140,7 @@ static void HandleInvalidLink(string parameters, SystemMessageData template) ChatManager.Instance.AddChatMessage(ChatManager.Instance.Factory.CreateSystemMessage(parameters, template, (ChatChannel)template.ChatChannel)); } - static void HandleMerchantSpawn(string parameters, SystemMessageData template) + private static void HandleMerchantSpawn(string parameters, SystemMessageData template) { var msg = ChatManager.Instance.Factory.CreateSystemMessage(parameters, template, ChatChannel.MysteryMerchant); Log.N("Mystery Merchant", msg.ToString(), NotificationType.Info, 10000); @@ -148,26 +148,26 @@ static void HandleMerchantSpawn(string parameters, SystemMessageData template) ChatManager.Instance.AddChatMessage(msg); } - static void HandleMerchantDespawn(string parameters, SystemMessageData template) + private static void HandleMerchantDespawn(string parameters, SystemMessageData template) { var msg = ChatManager.Instance.Factory.CreateSystemMessage(parameters, template, ChatChannel.MysteryMerchant); Log.N("Mystery Merchant", msg.ToString(), NotificationType.Info, 10000); ChatManager.Instance.AddChatMessage(msg); } - static void HandleLfgNotListed(string parameters, SystemMessageData template) + private static void HandleLfgNotListed(string parameters, SystemMessageData template) { ChatManager.Instance.AddSystemMessage(parameters, template); WindowManager.ViewModels.LfgVM.ForceStopPublicize(); } - static void Redirect(string parameters, SystemMessageData template, ChatChannel ch) + private static void Redirect(string parameters, SystemMessageData template, ChatChannel ch) { ChatManager.Instance.AddSystemMessage(parameters, template, ch); } //by HQ 20181224 - static void HandleFieldBossAppear(string parameters, SystemMessageData template) + private static void HandleFieldBossAppear(string parameters, SystemMessageData template) { string notificationText; @@ -199,7 +199,7 @@ static void HandleFieldBossAppear(string parameters, SystemMessageData template) GameEventManager.ExecuteFieldBossSpawnWebhook(monsterName, regionName, notificationText); } - static void HandleFieldBossDie(string parameters, SystemMessageData template) + private static void HandleFieldBossDie(string parameters, SystemMessageData template) { string notificationText; @@ -234,7 +234,7 @@ static void HandleFieldBossDie(string parameters, SystemMessageData template) GameEventManager.ExecuteFieldBossDieWebhook(monsterName, notificationText, userName, guildName); } - static string GetFieldBossName(string parameters) + private static string GetFieldBossName(string parameters) { // only for 'SMT_FIELDBOSS_*' var srvMsgSplit = parameters.Split('\v'); @@ -246,7 +246,7 @@ static string GetFieldBossName(string parameters) return m.Name; } - static string GetFieldBossKillerName(string parameters) + private static string GetFieldBossKillerName(string parameters) { // only for 'SMT_FIELDBOSS_*' var ret = ""; @@ -257,7 +257,7 @@ static string GetFieldBossKillerName(string parameters) return ret; } - static string GetFieldBossKillerGuild(string parameters) + private static string GetFieldBossKillerGuild(string parameters) { // only for 'SMT_FIELDBOSS_*' var ret = ""; @@ -270,7 +270,7 @@ static string GetFieldBossKillerGuild(string parameters) #region Factory - static readonly Dictionary Processor = new() + private static readonly Dictionary Processor = new() { { "SMT_FRIEND_IS_CONNECTED", new Action(HandleFriendLogin) }, { "SMT_FRIEND_WALK_INTO_SAME_AREA", new Action(HandleFriendInAreaMessage) }, @@ -343,7 +343,7 @@ static string GetFieldBossKillerGuild(string parameters) { "SMT_WORLDSPAWN_NOTIFY_DESPAWN", new Action(HandleMerchantDespawn)} }; - static bool Process(string parameters, SystemMessageData template, string opcodeName) + private static bool Process(string parameters, SystemMessageData template, string opcodeName) { if (!Processor.TryGetValue(opcodeName, out var type)) return false; diff --git a/TCC.Core/Data/Chat/UrlMessagePiece.cs b/TCC.Core/Data/Chat/UrlMessagePiece.cs index a9e57ea4..53092bfc 100644 --- a/TCC.Core/Data/Chat/UrlMessagePiece.cs +++ b/TCC.Core/Data/Chat/UrlMessagePiece.cs @@ -7,7 +7,7 @@ namespace TCC.Data.Chat; public class UrlMessagePiece : SimpleMessagePiece { - bool _isHovered; + private bool _isHovered; public override bool IsHovered { @@ -16,7 +16,7 @@ public override bool IsHovered } public override ICommand ClickCommand { get; } - UrlMessagePiece(string url) : base(url) + private UrlMessagePiece(string url) : base(url) { ClickCommand = new RelayCommand(Click); } @@ -28,7 +28,7 @@ public UrlMessagePiece(string text, int fontSize, bool customSize, string col = Color = col; } - void Click() + private void Click() { try { diff --git a/TCC.Core/Data/Counter.cs b/TCC.Core/Data/Counter.cs index b10c14ce..b06c8523 100644 --- a/TCC.Core/Data/Counter.cs +++ b/TCC.Core/Data/Counter.cs @@ -8,9 +8,9 @@ namespace TCC.Data; public class Counter : ThreadSafeObservableObject { //TODO use events here - int _val; - bool _isMaxed; - readonly DispatcherTimer _expire; + private int _val; + private bool _isMaxed; + private readonly DispatcherTimer _expire; public int Val { @@ -28,7 +28,7 @@ public bool IsMaxed private set => RaiseAndSetIfChanged(value, ref _isMaxed); } public int MaxValue { get; private set; } - bool AutoExpire { get; set; } + private bool AutoExpire { get; set; } public Counter(int max, bool autoexpire) { @@ -39,12 +39,12 @@ public Counter(int max, bool autoexpire) _expire.Tick += OnExpireTick; } - void OnExpireTick(object? s, EventArgs ev) + private void OnExpireTick(object? s, EventArgs ev) { Val = 0; } - void RefreshTimer() + private void RefreshTimer() { _expire.Stop(); diff --git a/TCC.Core/Data/Databases/AchievementDatabase.cs b/TCC.Core/Data/Databases/AchievementDatabase.cs index c293542b..6cd1dc73 100644 --- a/TCC.Core/Data/Databases/AchievementDatabase.cs +++ b/TCC.Core/Data/Databases/AchievementDatabase.cs @@ -8,8 +8,8 @@ namespace TCC.Data.Databases; public class AchievementDatabase : DatabaseBase { - readonly Dictionary _achievements = []; - readonly Dictionary _achievementsByName = []; + private readonly Dictionary _achievements = []; + private readonly Dictionary _achievementsByName = []; protected override string FolderName => "achievements"; protected override string Extension => "tsv"; diff --git a/TCC.Core/Data/Databases/DatabaseBase.cs b/TCC.Core/Data/Databases/DatabaseBase.cs index d4287659..8b89ad87 100644 --- a/TCC.Core/Data/Databases/DatabaseBase.cs +++ b/TCC.Core/Data/Databases/DatabaseBase.cs @@ -7,7 +7,7 @@ namespace TCC.Data.Databases; public abstract class DatabaseBase { - int _outdatedCount; + private int _outdatedCount; protected readonly string Language; @@ -60,7 +60,7 @@ public virtual void Update(string custom = "") UpdateFromRemote(custom); } - void UpdateFromRemote(string custom) + private void UpdateFromRemote(string custom) { UpdateManager.UpdateDatabase(string.IsNullOrEmpty(custom) ? RelativePath : custom); } diff --git a/TCC.Core/Data/Databases/DatabaseQueryMeasure.cs b/TCC.Core/Data/Databases/DatabaseQueryMeasure.cs index 1bd0b697..612d063f 100644 --- a/TCC.Core/Data/Databases/DatabaseQueryMeasure.cs +++ b/TCC.Core/Data/Databases/DatabaseQueryMeasure.cs @@ -6,16 +6,16 @@ namespace TCC.Data.Databases; public class DatabaseQueryMeasure { - readonly Stopwatch _sw = new(); - static int _totalCount; - static int _hitCount; - static int _missCount; - static long _totTotalTime; - static long _totHitTime; - static long _totMissTime; - static double _avgTotalTime => _totalCount == 0 ? 0 : _totTotalTime / (double)_totalCount; - static double _avgHitTime => _hitCount == 0 ? 0 : _totHitTime / (double)_hitCount; - static double _avgMissTime => _missCount == 0 ? 0 : _totMissTime / (double)_missCount; + private readonly Stopwatch _sw = new(); + private static int _totalCount; + private static int _hitCount; + private static int _missCount; + private static long _totTotalTime; + private static long _totHitTime; + private static long _totMissTime; + private static double _avgTotalTime => _totalCount == 0 ? 0 : _totTotalTime / (double)_totalCount; + private static double _avgHitTime => _hitCount == 0 ? 0 : _totHitTime / (double)_hitCount; + private static double _avgMissTime => _missCount == 0 ? 0 : _totMissTime / (double)_missCount; public void StartQuery() { diff --git a/TCC.Core/Data/Databases/DungeonDatabase.cs b/TCC.Core/Data/Databases/DungeonDatabase.cs index b8128a8a..dd9ddd75 100644 --- a/TCC.Core/Data/Databases/DungeonDatabase.cs +++ b/TCC.Core/Data/Databases/DungeonDatabase.cs @@ -8,15 +8,15 @@ namespace TCC.Data.Databases; public class DungeonDatabase : DatabaseBase { - const string DefaultDefsRelativePath = "default-dungeon-defs.tsv"; - const string ImagesRelativePath = "section_images.tsv"; + private const string DefaultDefsRelativePath = "default-dungeon-defs.tsv"; + private const string ImagesRelativePath = "section_images.tsv"; protected override string FolderName => "dungeons"; protected override string Extension => "tsv"; - readonly string _customDefsPath = Path.Combine(App.DataPath, "dungeon-defs.tsv"); - readonly string _defaultDefsFullPath = Path.Combine(App.DataPath, "default-dungeon-defs.tsv"); - readonly string _imagesFullPath = Path.Combine(App.DataPath, "section_images.tsv"); + private readonly string _customDefsPath = Path.Combine(App.DataPath, "dungeon-defs.tsv"); + private readonly string _defaultDefsFullPath = Path.Combine(App.DataPath, "default-dungeon-defs.tsv"); + private readonly string _imagesFullPath = Path.Combine(App.DataPath, "section_images.tsv"); public readonly Dictionary Dungeons = []; @@ -83,7 +83,7 @@ public override void Load() ParseDungeonIcons(); } - void ParseDungeons() + private void ParseDungeons() { var lines = File.ReadAllLines(FullPath); foreach (var line in lines) @@ -102,7 +102,7 @@ void ParseDungeons() } } - void ParseDungeonDefs() + private void ParseDungeonDefs() { if (!File.Exists(_customDefsPath)) File.Copy(_defaultDefsFullPath, _customDefsPath); var lines = File.ReadAllLines(_customDefsPath); @@ -150,7 +150,7 @@ void ParseDungeonDefs() } } - void ParseDungeonIcons() + private void ParseDungeonIcons() { var lines = File.ReadAllLines(_imagesFullPath); foreach (var line in lines) diff --git a/TCC.Core/Data/Databases/ItemsDatabase.cs b/TCC.Core/Data/Databases/ItemsDatabase.cs index 7c68de2c..2ab1144d 100644 --- a/TCC.Core/Data/Databases/ItemsDatabase.cs +++ b/TCC.Core/Data/Databases/ItemsDatabase.cs @@ -85,7 +85,7 @@ public override void Load() AddOverride(new Item(139520, "Minify", RareGrade.Common, 0, 3, "icon_items.icon_janggoe_item_tex_minus")); } - void AddOverride(Item item) + private void AddOverride(Item item) { Items[item.Id] = item; } diff --git a/TCC.Core/Data/Databases/MonsterDatabase.cs b/TCC.Core/Data/Databases/MonsterDatabase.cs index 4df30f84..a6c5bd6d 100644 --- a/TCC.Core/Data/Databases/MonsterDatabase.cs +++ b/TCC.Core/Data/Databases/MonsterDatabase.cs @@ -12,14 +12,14 @@ public class MonsterDatabase : DatabaseBase public static event Action? OverrideChangedEvent; public static event Action? BlacklistChangedEvent; - readonly Dictionary _zones = []; + private readonly Dictionary _zones = []; protected override string FolderName => "monsters"; protected override string Extension => "xml"; public override bool Exists => base.Exists && File.Exists(OverrideFileFullPath); - string OverrideFileFullPath => FullPath.Replace($"{FolderName}-{Language}.{Extension}", $"{FolderName}-override.{Extension}"); - string OverrideFileRelativePath => RelativePath.Replace(Language, "override"); + private string OverrideFileFullPath => FullPath.Replace($"{FolderName}-{Language}.{Extension}", $"{FolderName}-override.{Extension}"); + private string OverrideFileRelativePath => RelativePath.Replace(Language, "override"); public MonsterDatabase(string lang) : base(lang) { @@ -122,7 +122,7 @@ public override void Load() } } - XDocument CleanAndLoadOverrideDoc() + private XDocument CleanAndLoadOverrideDoc() { var overrideDoc = XDocument.Load(OverrideFileFullPath); var toRemove = new List>(); diff --git a/TCC.Core/Data/Databases/RegionsDatabase.cs b/TCC.Core/Data/Databases/RegionsDatabase.cs index b9d6e1f1..53dc671e 100644 --- a/TCC.Core/Data/Databases/RegionsDatabase.cs +++ b/TCC.Core/Data/Databases/RegionsDatabase.cs @@ -9,7 +9,7 @@ public class RegionsDatabase : DatabaseBase protected override string FolderName => "regions"; protected override string Extension => "tsv"; - Dictionary Names { get; } = []; + private Dictionary Names { get; } = []; public RegionsDatabase(string lang) : base(lang) { diff --git a/TCC.Core/Data/Databases/SkillsDatabase.cs b/TCC.Core/Data/Databases/SkillsDatabase.cs index 524a84f3..321560f0 100644 --- a/TCC.Core/Data/Databases/SkillsDatabase.cs +++ b/TCC.Core/Data/Databases/SkillsDatabase.cs @@ -12,9 +12,9 @@ public class SkillsDatabase : DatabaseBase protected override string FolderName => "skills"; protected override string Extension => "tsv"; - Dictionary> Skills { get; } = []; + private Dictionary> Skills { get; } = []; - static readonly Dictionary> IgnoredSkills = new() + private static readonly Dictionary> IgnoredSkills = new() { { Class.Archer, @@ -154,7 +154,7 @@ public IEnumerable SkillsForClass(Class c, bool includeCommon = true) return ret; } - static bool IsIgnoredSkill(Skill skill) + private static bool IsIgnoredSkill(Skill skill) { return IgnoredSkills[skill.Class].Any(x => x == skill.IconName); } diff --git a/TCC.Core/Data/Databases/SystemMessagesDatabase.cs b/TCC.Core/Data/Databases/SystemMessagesDatabase.cs index 82c0af8c..c00a4e3f 100644 --- a/TCC.Core/Data/Databases/SystemMessagesDatabase.cs +++ b/TCC.Core/Data/Databases/SystemMessagesDatabase.cs @@ -13,7 +13,7 @@ public class SystemMessagesDatabase : DatabaseBase protected override string FolderName => "sys_msg"; protected override string Extension => "tsv"; - readonly List _handledInternally = ["SMT_FIELD_EVENT_REWARD_AVAILABLE"]; + private readonly List _handledInternally = ["SMT_FIELD_EVENT_REWARD_AVAILABLE"]; public Dictionary Messages { get; } = []; @@ -59,7 +59,7 @@ public override void Load() AddCustom(); } - void AddCustom() + private void AddCustom() { // party member login/out ------------------------------------------------------------------------ diff --git a/TCC.Core/Data/Databases/TccDatabases.cs b/TCC.Core/Data/Databases/TccDatabases.cs index 4bae8a6f..f8a9f1fa 100644 --- a/TCC.Core/Data/Databases/TccDatabases.cs +++ b/TCC.Core/Data/Databases/TccDatabases.cs @@ -26,7 +26,7 @@ public class TccDatabases public DungeonDatabase DungeonDatabase { get; } public SocialDatabase SocialDatabase { get; } - List Databases + private List Databases { get { diff --git a/TCC.Core/Data/Dungeon.cs b/TCC.Core/Data/Dungeon.cs index 06a3b0a1..adfe500b 100644 --- a/TCC.Core/Data/Dungeon.cs +++ b/TCC.Core/Data/Dungeon.cs @@ -4,12 +4,13 @@ namespace TCC.Data; public class Dungeon : ThreadSafeObservableObject { - string _shortName = ""; - bool _doublesOnElite; - bool _show; - int _index = -1; - short _maxBaseRuns = 1; - int _itemLevel; + private string _shortName = ""; + private bool _doublesOnElite; + private bool _show; + private int _index = -1; + private short _maxBaseRuns = 1; + + private int _itemLevel; //ItemLevelTier _requiredIlvl = ItemLevelTier.Tier0; public uint Id { get; } diff --git a/TCC.Core/Data/DungeonCooldown.cs b/TCC.Core/Data/DungeonCooldown.cs index 4914148c..27453f22 100644 --- a/TCC.Core/Data/DungeonCooldown.cs +++ b/TCC.Core/Data/DungeonCooldown.cs @@ -8,9 +8,9 @@ namespace TCC.Data; public class DungeonCooldown : ThreadSafeObservableObject { - int _entries; + private int _entries; - uint Id { get; } + private uint Id { get; } public int Clears { get; } public int Entries { @@ -77,7 +77,7 @@ public DungeonCooldown(uint id, Dispatcher d, Character owner) owner.PropertyChanged += OnOwnerPropertyChanged; } - void OnOwnerPropertyChanged(object? sender, PropertyChangedEventArgs args) + private void OnOwnerPropertyChanged(object? sender, PropertyChangedEventArgs args) { switch (args.PropertyName) { diff --git a/TCC.Core/Data/EpDataProvider.cs b/TCC.Core/Data/EpDataProvider.cs index 5748667b..1575bbef 100644 --- a/TCC.Core/Data/EpDataProvider.cs +++ b/TCC.Core/Data/EpDataProvider.cs @@ -7,7 +7,7 @@ public static class EpDataProvider public static float ManaBarrierMult = 1; // just keep this here, since it's the only perk we need - static readonly Dictionary ManaBarrierAmplification = new() + private static readonly Dictionary ManaBarrierAmplification = new() { { 0, 1.00f }, { 1, 1.11f }, diff --git a/TCC.Core/Data/EventGroup.cs b/TCC.Core/Data/EventGroup.cs index 4dc60497..6c2b0d2c 100644 --- a/TCC.Core/Data/EventGroup.cs +++ b/TCC.Core/Data/EventGroup.cs @@ -8,8 +8,8 @@ namespace TCC.Data; public class EventGroup : ThreadSafeObservableObject { - readonly DateTime _start; - readonly DateTime _end; + private readonly DateTime _start; + private readonly DateTime _end; public string Name { get; } public bool RemoteCheck { get; } diff --git a/TCC.Core/Data/FlyingGuardianDataProvider.cs b/TCC.Core/Data/FlyingGuardianDataProvider.cs index d1f8368d..65b3d261 100644 --- a/TCC.Core/Data/FlyingGuardianDataProvider.cs +++ b/TCC.Core/Data/FlyingGuardianDataProvider.cs @@ -12,13 +12,13 @@ public static class FlyingGuardianDataProvider public static event Action? IsInProgressChanged; - const uint AirEssenceId = 630400; - const uint FireEssenceId = 630500; - const uint SparkEssenceId = 631001; + private const uint AirEssenceId = 630400; + private const uint FireEssenceId = 630500; + private const uint SparkEssenceId = 631001; - static int _stacks; - static FlightStackType _stackType; - static bool _ignoreNextEnd; + private static int _stacks; + private static FlightStackType _stackType; + private static bool _ignoreNextEnd; public static int Stacks { @@ -89,7 +89,7 @@ public static void OnAbnormalityEnd(S_ABNORMALITY_END p) Stacks = 0; } - static FlightStackType IdToStackType(uint id) => id switch + private static FlightStackType IdToStackType(uint id) => id switch { FireEssenceId => FlightStackType.Fire, SparkEssenceId => FlightStackType.Spark, @@ -97,5 +97,5 @@ public static void OnAbnormalityEnd(S_ABNORMALITY_END p) _ => FlightStackType.None }; - static bool IsEssence(uint id) => id is AirEssenceId or FireEssenceId or SparkEssenceId; + private static bool IsEssence(uint id) => id is AirEssenceId or FireEssenceId or SparkEssenceId; } \ No newline at end of file diff --git a/TCC.Core/Data/FriendList.cs b/TCC.Core/Data/FriendList.cs index 8182839a..1f2afa76 100644 --- a/TCC.Core/Data/FriendList.cs +++ b/TCC.Core/Data/FriendList.cs @@ -8,8 +8,8 @@ namespace TCC.Data; public class FriendList { - bool _waitingForFirstUpdate = true; - readonly List _friends = []; + private bool _waitingForFirstUpdate = true; + private readonly List _friends = []; internal void UpdateFriendInfo(IReadOnlyCollection friendUpdates) { diff --git a/TCC.Core/Data/GearItem.cs b/TCC.Core/Data/GearItem.cs index b9e62b9b..b16df17c 100644 --- a/TCC.Core/Data/GearItem.cs +++ b/TCC.Core/Data/GearItem.cs @@ -53,7 +53,7 @@ public GearItem(GearItemData data) Piece = data.Piece; } - int CalculateLevel() + private int CalculateLevel() { var t = 0; if (Tier > GearTier.Low) diff --git a/TCC.Core/Data/GroupInfo.cs b/TCC.Core/Data/GroupInfo.cs index f474cb49..16d1c1df 100644 --- a/TCC.Core/Data/GroupInfo.cs +++ b/TCC.Core/Data/GroupInfo.cs @@ -19,8 +19,8 @@ public class GroupInfo public event Action? LeaderChanged; public event Action, GroupCompositionChangeReason>? CompositionChanged; - GroupMemberData _leader = new() { Class = Class.None, Name = "", PlayerId = 0 }; - List _members = []; + private GroupMemberData _leader = new() { Class = Class.None, Name = "", PlayerId = 0 }; + private List _members = []; public bool InGroup { get; private set; } public bool IsRaid { get; private set; } diff --git a/TCC.Core/Data/GuildInfo.cs b/TCC.Core/Data/GuildInfo.cs index 5e406172..1b0b4256 100644 --- a/TCC.Core/Data/GuildInfo.cs +++ b/TCC.Core/Data/GuildInfo.cs @@ -7,8 +7,8 @@ namespace TCC.Data; public class GuildInfo { - readonly object _lock = new object(); - readonly ThreadSafeObservableCollection _members = []; + private readonly object _lock = new object(); + private readonly ThreadSafeObservableCollection _members = []; public bool InGuild { get; private set; } public bool AmIMaster { get; private set; } diff --git a/TCC.Core/Data/Listing.cs b/TCC.Core/Data/Listing.cs index 1a042d8d..ef0a683a 100644 --- a/TCC.Core/Data/Listing.cs +++ b/TCC.Core/Data/Listing.cs @@ -15,16 +15,16 @@ namespace TCC.Data; public class Listing : ThreadSafeObservableObject { - bool _isRaid; - string _message = ""; - string _leaderName = ""; - bool _isExpanded; - bool _isPopupOpen; - int _playerCount; - bool _canApply = true; - bool _isMyLfg; - readonly DateTime _createdOn; - bool _isFullOffline; + private bool _isRaid; + private string _message = ""; + private string _leaderName = ""; + private bool _isExpanded; + private bool _isPopupOpen; + private int _playerCount; + private bool _canApply = true; + private bool _isMyLfg; + private readonly DateTime _createdOn; + private bool _isFullOffline; public uint LeaderId { get; set; } public uint ServerId { get; set; } @@ -159,7 +159,7 @@ public void UpdateIsMyLfg() }, DispatcherPriority.DataBind); } - void ExpandCollapse(object? force) // todo: use proper type + private void ExpandCollapse(object? force) // todo: use proper type { if (IsPopupOpen) return; @@ -199,14 +199,14 @@ void ExpandCollapse(object? force) // todo: use proper type } } - void BrowseTwitch() + private void BrowseTwitch() { if (!IsTwitch) return; Utils.Utilities.OpenUrl(TwitchLink); } - void Post() + private void Post() { var msg = Message; var isRaid = IsRaid; @@ -216,7 +216,7 @@ void Post() Task.Delay(200).ContinueWith(_ => StubInterface.Instance.StubClient.RequestListings(App.Settings.LfgWindowSettings.MinLevel, App.Settings.LfgWindowSettings.MaxLevel)); } - void Remove() + private void Remove() { if (Temp) { @@ -228,7 +228,7 @@ void Remove() } } - void WhisperLeader() + private void WhisperLeader() { if (!Game.InGameChatOpen) FocusManager.SendNewLine(); FocusManager.SendString($"/w {LeaderName} "); diff --git a/TCC.Core/Data/Map/Guard.cs b/TCC.Core/Data/Map/Guard.cs index 5ab93410..f96b5405 100644 --- a/TCC.Core/Data/Map/Guard.cs +++ b/TCC.Core/Data/Map/Guard.cs @@ -11,7 +11,7 @@ public readonly record struct Guard public uint NameId { get; } public uint ContinentId { get; } - Guard(uint gId, uint gNameId, uint continentId) + private Guard(uint gId, uint gNameId, uint continentId) { Id = gId; NameId = gNameId; diff --git a/TCC.Core/Data/Map/Section.cs b/TCC.Core/Data/Map/Section.cs index 37f2d1ca..d4591e24 100644 --- a/TCC.Core/Data/Map/Section.cs +++ b/TCC.Core/Data/Map/Section.cs @@ -10,7 +10,7 @@ public readonly record struct Section public string MapId { get; } public bool IsDungeon { get; } - Section(uint sId, uint sNameId, string mapId, bool dg) + private Section(uint sId, uint sNameId, string mapId, bool dg) { Id = sId; NameId = sNameId; diff --git a/TCC.Core/Data/Npc/EnragePattern.cs b/TCC.Core/Data/Npc/EnragePattern.cs index 08e7c24b..1f9d0336 100644 --- a/TCC.Core/Data/Npc/EnragePattern.cs +++ b/TCC.Core/Data/Npc/EnragePattern.cs @@ -2,7 +2,7 @@ public class EnragePattern { - readonly float _flatHp; + private readonly float _flatHp; public double Percentage { get; set; } public int Duration { get; set; } diff --git a/TCC.Core/Data/Npc/HpTriggeredTimerPattern.cs b/TCC.Core/Data/Npc/HpTriggeredTimerPattern.cs index 95d1de0d..d6d1f694 100644 --- a/TCC.Core/Data/Npc/HpTriggeredTimerPattern.cs +++ b/TCC.Core/Data/Npc/HpTriggeredTimerPattern.cs @@ -20,7 +20,7 @@ public override void SetTarget(Npc target) target.HpFactorChanged += OnTargetHpChanged; } - void OnTargetHpChanged(double hpFactor) + private void OnTargetHpChanged(double hpFactor) { if (IsRunning) return; if (hpFactor >= StartAt) return; diff --git a/TCC.Core/Data/Npc/Npc.cs b/TCC.Core/Data/Npc/Npc.cs index 9431ab2c..43ab63e3 100644 --- a/TCC.Core/Data/Npc/Npc.cs +++ b/TCC.Core/Data/Npc/Npc.cs @@ -17,20 +17,20 @@ public class Npc : ThreadSafeObservableObject, IDisposable public event Action? HpFactorChanged; public event Action? DeleteEvent; - string _name = ""; - bool _enraged; - double _maxHP; - double _currentHP; - uint _maxShield; - double _currentShield; - bool _visible; - ulong _target; - bool _isSelected = true; - int _remainingEnrageTime; - bool _isBoss; - double _hPFactor; - double _currentPercentage; - AggroCircle _currentAggroType = AggroCircle.None; + private string _name = ""; + private bool _enraged; + private double _maxHP; + private double _currentHP; + private uint _maxShield; + private double _currentShield; + private bool _visible; + private ulong _target; + private bool _isSelected = true; + private int _remainingEnrageTime; + private bool _isBoss; + private double _hPFactor; + private double _currentPercentage; + private AggroCircle _currentAggroType = AggroCircle.None; public bool HasGage { get; set; } public ICommand Override { get; } @@ -254,7 +254,7 @@ public void Delete() //TODO: make this a separate class //private readonly Timer _shieldDuration; - ShieldStatus _shield = ShieldStatus.Off; + private ShieldStatus _shield = ShieldStatus.Off; public ShieldStatus Shield { diff --git a/TCC.Core/Data/Npc/TimerPattern.cs b/TCC.Core/Data/Npc/TimerPattern.cs index 383482be..48424896 100644 --- a/TCC.Core/Data/Npc/TimerPattern.cs +++ b/TCC.Core/Data/Npc/TimerPattern.cs @@ -9,7 +9,7 @@ public class TimerPattern : ThreadSafeObservableObject, IDisposable public event Action? Started; public event Action? Ended; - readonly Timer _timer; + private readonly Timer _timer; protected bool IsRunning => _timer.Enabled; protected Npc? Target { get; set; } public int Duration { get; } @@ -31,8 +31,8 @@ public virtual void SetTarget(Npc target) { Target = target; } - - void OnTimerElapsed(object? sender, ElapsedEventArgs e) + + private void OnTimerElapsed(object? sender, ElapsedEventArgs e) { _timer.Stop(); Ended?.Invoke(); diff --git a/TCC.Core/Data/Pc/Character.cs b/TCC.Core/Data/Pc/Character.cs index e6f13388..29af7508 100644 --- a/TCC.Core/Data/Pc/Character.cs +++ b/TCC.Core/Data/Pc/Character.cs @@ -14,22 +14,22 @@ namespace TCC.Data.Pc; //TODO: remove INPC from properties where it's not needed public class Character : ThreadSafeObservableObject, IComparable { - string _name = ""; - Class _class; - Laurel _laurel = Laurel.None; - bool _isLoggedIn; - bool _isSelected; - int _elleonMarks; - int _dragonwingScales; - int _piecesOfDragonScroll; - float _itemLevel; - int _level; - Location _lastLocation = new(); - long _lastOnline; - string _serverName = ""; - bool _hidden; - uint _coins; - uint _maxCoins; + private string _name = ""; + private Class _class; + private Laurel _laurel = Laurel.None; + private bool _isLoggedIn; + private bool _isSelected; + private int _elleonMarks; + private int _dragonwingScales; + private int _piecesOfDragonScroll; + private float _itemLevel; + private int _level; + private Location _lastLocation = new(); + private long _lastOnline; + private string _serverName = ""; + private bool _hidden; + private uint _coins; + private uint _maxCoins; public uint Id { get; set; } public int Position { get; set; } diff --git a/TCC.Core/Data/Pc/DungeonCooldownData.cs b/TCC.Core/Data/Pc/DungeonCooldownData.cs index c1d60e90..5ae47c2b 100644 --- a/TCC.Core/Data/Pc/DungeonCooldownData.cs +++ b/TCC.Core/Data/Pc/DungeonCooldownData.cs @@ -4,8 +4,8 @@ namespace TCC.Data.Pc; public class DungeonCooldownData { - uint _coins; - uint _maxCoins; + private uint _coins; + private uint _maxCoins; public uint Id { get; set; } public int Entries { get; set; } diff --git a/TCC.Core/Data/Pc/GuardianInfo.cs b/TCC.Core/Data/Pc/GuardianInfo.cs index c1b32cea..dfb4bd4a 100644 --- a/TCC.Core/Data/Pc/GuardianInfo.cs +++ b/TCC.Core/Data/Pc/GuardianInfo.cs @@ -9,9 +9,9 @@ public class GuardianInfo : ThreadSafeObservableObject public const float MaxCredits = 100000; public const int MaxDailies = 100; - int _credits; - int _cleared; - int _claimed; + private int _credits; + private int _cleared; + private int _claimed; public int Credits { diff --git a/TCC.Core/Data/Pc/InventoryItem.cs b/TCC.Core/Data/Pc/InventoryItem.cs index 278cd015..8d5e273c 100644 --- a/TCC.Core/Data/Pc/InventoryItem.cs +++ b/TCC.Core/Data/Pc/InventoryItem.cs @@ -5,7 +5,7 @@ namespace TCC.Data.Pc; public class InventoryItem : ThreadSafeObservableObject { - int _amount; + private int _amount; public uint Id { get; } [JsonIgnore] diff --git a/TCC.Core/Data/Pc/Player.cs b/TCC.Core/Data/Pc/Player.cs index 094a2843..5d4cf212 100644 --- a/TCC.Core/Data/Pc/Player.cs +++ b/TCC.Core/Data/Pc/Player.cs @@ -20,32 +20,32 @@ public class Player : ThreadSafeObservableObject public event Action? CoinsUpdated; - string _name = ""; - ulong _entityId; - Class _playerclass = Class.None; - Laurel _laurel = Laurel.None; - int _level; - float _itemLevel; - float _currentHP; - float _currentMP; - float _currentST; - long _maxHP; - int _maxMP; - int _maxST; - uint _maxShield; - float _currentShield; - float _flightEnergy; - bool _isInCombat; - float _critFactor; - bool _isAlive; - uint _coins; - uint _maxCoins; - readonly List _debuffList = []; - readonly Dictionary _shields = []; - readonly object _listLock = new(); - ThreadSafeObservableCollection _buffs = []; - ThreadSafeObservableCollection _debuffs = []; - ThreadSafeObservableCollection _infBuffs = []; + private string _name = ""; + private ulong _entityId; + private Class _playerclass = Class.None; + private Laurel _laurel = Laurel.None; + private int _level; + private float _itemLevel; + private float _currentHP; + private float _currentMP; + private float _currentST; + private long _maxHP; + private int _maxMP; + private int _maxST; + private uint _maxShield; + private float _currentShield; + private float _flightEnergy; + private bool _isInCombat; + private float _critFactor; + private bool _isAlive; + private uint _coins; + private uint _maxCoins; + private readonly List _debuffList = []; + private readonly Dictionary _shields = []; + private readonly object _listLock = new(); + private ThreadSafeObservableCollection _buffs = []; + private ThreadSafeObservableCollection _debuffs = []; + private ThreadSafeObservableCollection _infBuffs = []; public string Name { @@ -298,7 +298,7 @@ public void DamageShield(uint damage) }); } - void AddShield(Abnormality ab) + private void AddShield(Abnormality ab) { _dispatcher.Invoke(() => { @@ -322,7 +322,7 @@ uint GetShieldSize(Abnormality a) } } - void EndShield(Abnormality ab) + private void EndShield(Abnormality ab) { _dispatcher.Invoke(() => { @@ -331,7 +331,7 @@ void EndShield(Abnormality ab) }); } - void RefreshShieldAmount() + private void RefreshShieldAmount() { if (_shields.Count == 0) { @@ -346,7 +346,7 @@ void RefreshShieldAmount() } } - void RefreshMaxShieldAmount() + private void RefreshMaxShieldAmount() { foreach (var amount in _shields.Values) { @@ -387,7 +387,7 @@ public void EndAbnormality(Abnormality ab) } } - void FindAndUpdateAbnormality(Abnormality ab, uint duration, int stacks) + private void FindAndUpdateAbnormality(Abnormality ab, uint duration, int stacks) { _dispatcher.Invoke(() => { @@ -410,7 +410,7 @@ void FindAndUpdateAbnormality(Abnormality ab, uint duration, int stacks) }); } - void FindAndRemove(Abnormality ab) + private void FindAndRemove(Abnormality ab) { var list = GetList(ab); var target = list.ToSyncList().FirstOrDefault(x => x.Abnormality.Id == ab.Id); @@ -487,7 +487,7 @@ public void SetAbnormalitiesVisibility(bool visible) } // utils - ThreadSafeObservableCollection GetList(Abnormality abnormality) + private ThreadSafeObservableCollection GetList(Abnormality abnormality) { var list = abnormality.Type switch { diff --git a/TCC.Core/Data/Pc/User.cs b/TCC.Core/Data/Pc/User.cs index f73a091d..ad1b0e56 100644 --- a/TCC.Core/Data/Pc/User.cs +++ b/TCC.Core/Data/Pc/User.cs @@ -15,38 +15,38 @@ namespace TCC.Data.Pc; //TODO: remove INPC from properties where it's not needed public class User : ThreadSafeObservableObject { - ulong _entityId; - uint _level; - Class _userClass; - Role _role; - bool _online; - uint _serverId; - uint _playerId; - int _order; - bool _canInvite; - Laurel _laurel; - string _name = ""; - long _currentHp = 1; - int _currentMp = 1; - int _currentSt = 1; - long _maxHp = 1; - int _maxMp = 1; - int _maxSt = 1; - ReadyStatus _ready = ReadyStatus.None; - bool _alive = true; - int _rollResult; - bool _isRolling; - bool _isWinning; - bool _isLeader; - bool _hasAggro; - string _location = ""; - readonly List _debuffList = []; - GearItem? _weapon; - GearItem? _armor; - GearItem? _gloves; - GearItem? _boots; - bool _visible = true; - bool _inRange; + private ulong _entityId; + private uint _level; + private Class _userClass; + private Role _role; + private bool _online; + private uint _serverId; + private uint _playerId; + private int _order; + private bool _canInvite; + private Laurel _laurel; + private string _name = ""; + private long _currentHp = 1; + private int _currentMp = 1; + private int _currentSt = 1; + private long _maxHp = 1; + private int _maxMp = 1; + private int _maxSt = 1; + private ReadyStatus _ready = ReadyStatus.None; + private bool _alive = true; + private int _rollResult; + private bool _isRolling; + private bool _isWinning; + private bool _isLeader; + private bool _hasAggro; + private string _location = ""; + private readonly List _debuffList = []; + private GearItem? _weapon; + private GearItem? _armor; + private GearItem? _gloves; + private GearItem? _boots; + private bool _visible = true; + private bool _inRange; public ulong EntityId { diff --git a/TCC.Core/Data/Pc/VanguardInfo.cs b/TCC.Core/Data/Pc/VanguardInfo.cs index b151ca90..a66182ef 100644 --- a/TCC.Core/Data/Pc/VanguardInfo.cs +++ b/TCC.Core/Data/Pc/VanguardInfo.cs @@ -9,10 +9,10 @@ public class VanguardInfo : ThreadSafeObservableObject public const float MAX_CREDITS = 100000; public const int MAX_DAILIES = 8; - int _credits; - int _dailiesDone; - int _weekliesDone; - int _weekliesMax; + private int _credits; + private int _dailiesDone; + private int _weekliesDone; + private int _weekliesMax; public int Credits { diff --git a/TCC.Core/Data/Skills/Cooldown.cs b/TCC.Core/Data/Skills/Cooldown.cs index 77ff2384..0422bae7 100644 --- a/TCC.Core/Data/Skills/Cooldown.cs +++ b/TCC.Core/Data/Skills/Cooldown.cs @@ -23,16 +23,16 @@ public class Cooldown : ThreadSafeObservableObject, IDisposable // fields - readonly DispatcherTimer _mainTimer; - readonly DispatcherTimer _offsetTimer; - readonly DispatcherTimer _secondsTimer; - double _seconds; - bool _flashOnAvailable; - bool _canFlash; - Skill _skill; - DateTime _endTime; - CooldownMode _mode; - bool _isAvailable = true; + private readonly DispatcherTimer _mainTimer; + private readonly DispatcherTimer _offsetTimer; + private readonly DispatcherTimer _secondsTimer; + private double _seconds; + private bool _flashOnAvailable; + private bool _canFlash; + private Skill _skill; + private DateTime _endTime; + private CooldownMode _mode; + private bool _isAvailable = true; // properties @@ -135,12 +135,12 @@ public Cooldown(Skill sk, ulong cooldown, CooldownType type = CooldownType.Skill ObjectTracker.Unregister(GetType()); } - void OnGlobalFlashChanged() + private void OnGlobalFlashChanged() { _dispatcher.InvokeAsync(OnCombatStatusChanged); } - void OnCombatStatusChanged() + private void OnCombatStatusChanged() { _dispatcher.InvokeAsync(() => { @@ -157,7 +157,7 @@ void OnCombatStatusChanged() // timers tick handlers - void CooldownEnded(object? sender, EventArgs? e) + private void CooldownEnded(object? sender, EventArgs? e) { StopMainTimer(); _secondsTimer.Stop(); @@ -165,13 +165,13 @@ void CooldownEnded(object? sender, EventArgs? e) _dispatcher.Invoke(() => Ended?.Invoke(Mode)); } - void StartSecondsTimer(object? sender, EventArgs? e) + private void StartSecondsTimer(object? sender, EventArgs? e) { _offsetTimer.Stop(); _secondsTimer.Start(); } - void DecreaseSeconds(object? sender, EventArgs? e) + private void DecreaseSeconds(object? sender, EventArgs? e) { if (Seconds > 0) { @@ -273,18 +273,18 @@ public void Refresh(Cooldown cd) Refresh(cd.Skill.Id, cd.Duration, cd.Mode); } - void ForceFlashing() + private void ForceFlashing() { _dispatcher.InvokeAsync(() => FlashingForced?.Invoke()); } - void StartMainTimer() + private void StartMainTimer() { IsAvailable = false; _mainTimer.Start(); } - void StopMainTimer() + private void StopMainTimer() { _mainTimer.Stop(); IsAvailable = true; diff --git a/TCC.Core/Data/Skills/Skill.cs b/TCC.Core/Data/Skills/Skill.cs index 9e8682f4..4a741223 100644 --- a/TCC.Core/Data/Skills/Skill.cs +++ b/TCC.Core/Data/Skills/Skill.cs @@ -6,7 +6,7 @@ namespace TCC.Data.Skills; public record struct Skill { - string _iconName = ""; + private string _iconName = ""; public string IconName { diff --git a/TCC.Core/Data/StanceTracker.cs b/TCC.Core/Data/StanceTracker.cs index df5e5e6d..1875f648 100644 --- a/TCC.Core/Data/StanceTracker.cs +++ b/TCC.Core/Data/StanceTracker.cs @@ -5,7 +5,7 @@ namespace TCC.Data; public class StanceTracker : ThreadSafeObservableObject where T : struct, IComparable { - T _currentStance; + private T _currentStance; public T CurrentStance { diff --git a/TCC.Core/Data/StatTracker.cs b/TCC.Core/Data/StatTracker.cs index 6106ac7d..283541ad 100644 --- a/TCC.Core/Data/StatTracker.cs +++ b/TCC.Core/Data/StatTracker.cs @@ -8,11 +8,11 @@ public class StatTracker : ThreadSafeObservableObject public event Action? ToZero; public event Action? FactorChanged; - int _max = 1; - int _val; - bool _status; - bool _maxed; - double _factor; + private int _max = 1; + private int _val; + private bool _status; + private bool _maxed; + private double _factor; public int Val { @@ -61,7 +61,7 @@ public void InvokeToZero(uint pDuration) ToZero?.Invoke(pDuration); } - void InvokeFactorChanged() + private void InvokeFactorChanged() { FactorChanged?.Invoke(_factor); } diff --git a/TCC.Core/Debugging/DebugWindow.xaml.cs b/TCC.Core/Debugging/DebugWindow.xaml.cs index 36756202..ead34c5f 100644 --- a/TCC.Core/Debugging/DebugWindow.xaml.cs +++ b/TCC.Core/Debugging/DebugWindow.xaml.cs @@ -19,9 +19,9 @@ public DebugWindow() InitializeComponent(); } - int _last; - int _sum; - int _max; + private int _last; + private int _sum; + private int _max; public int Last { @@ -34,14 +34,14 @@ public int Max private set { _max = value; NPC(); } } - int Sum + private int Sum { get => _sum; set { _sum = value; NPC(); } } public double Avg => _count == 0 ? 0 : Sum / (float)_count; - int _count; + private int _count; public void SetQueuedPackets(int val) { Last = val; @@ -59,12 +59,12 @@ public void SetQueuedPackets(int val) public event PropertyChangedEventHandler? PropertyChanged; - void NPC([CallerMemberName] string? propertyName = null) + private void NPC([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - void SwitchClass(object sender, RoutedEventArgs e) + private void SwitchClass(object sender, RoutedEventArgs e) { Game.Me.Class = Enum.Parse(((Button) sender).Content.ToString() ?? "None"); WindowManager.ViewModels.ClassVM.CurrentClass = Game.Me.Class; @@ -72,7 +72,7 @@ void SwitchClass(object sender, RoutedEventArgs e) WindowManager.ViewModels.CooldownsVM.LoadConfig(Game.Me.Class); } - void SetSorcElement(object sender, RoutedEventArgs e) + private void SetSorcElement(object sender, RoutedEventArgs e) { var el = ((Button) sender).Content.ToString(); @@ -116,7 +116,7 @@ static void SetSorcererElements(bool pFire, bool pIce, bool pArcane) } - void SetSorcElementBoost(object sender, RoutedEventArgs e) + private void SetSorcElementBoost(object sender, RoutedEventArgs e) { var el = ((Button) sender).Content.ToString()?.Split(' ')[0]; @@ -159,7 +159,7 @@ static void SetBoosts(bool pFire, bool pIce, bool pArcane) } - void ButtonBase_OnClick(object sender, RoutedEventArgs e) + private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { TccUtils.CurrentClassVM()?.ManaBoost.StartEffect(10000); @@ -169,7 +169,7 @@ void ButtonBase_OnClick(object sender, RoutedEventArgs e) //SkillManager.ResetSkill(400120); } - void SetStance(object sender, RoutedEventArgs e) + private void SetStance(object sender, RoutedEventArgs e) { TccUtils.CurrentClassVM()!.StanceTracker.CurrentStance = ((Button)sender).Content.ToString() switch { @@ -179,7 +179,7 @@ void SetStance(object sender, RoutedEventArgs e) }; } - void IncreaseEdge(object sender, RoutedEventArgs e) + private void IncreaseEdge(object sender, RoutedEventArgs e) { var edge = TccUtils.CurrentClassVM()!.EdgeCounter; if (edge.IsMaxed) edge.Val = 0; @@ -187,7 +187,7 @@ void IncreaseEdge(object sender, RoutedEventArgs e) } - void RegisterWebhook(object sender, RoutedEventArgs e) + private void RegisterWebhook(object sender, RoutedEventArgs e) { for (var i = 0; i < 80; i++) { @@ -196,7 +196,7 @@ void RegisterWebhook(object sender, RoutedEventArgs e) } } - void FireWebhook(object sender, RoutedEventArgs e) + private void FireWebhook(object sender, RoutedEventArgs e) { for (var i = 0; i < 80; i++) { @@ -205,7 +205,7 @@ void FireWebhook(object sender, RoutedEventArgs e) } } - void DungeonTest(object sender, RoutedEventArgs e) + private void DungeonTest(object sender, RoutedEventArgs e) { //i = 0; //WindowManager.Dashboard.VM.SetDungeons(20000078, new Dictionary() { { 9770U, i++ } }); @@ -214,29 +214,29 @@ void DungeonTest(object sender, RoutedEventArgs e) Game.Account.Characters[0].VanguardInfo.WeekliesDone = App.Random.Next(0, 16); } - void MaxEnchant(object sender, RoutedEventArgs e) + private void MaxEnchant(object sender, RoutedEventArgs e) { //"@464\vUserName\vHeve\vItemName\v@item:89607?dbid:327641239?enchantCount:11" Tester.AddFakeSystemMessage("SMT_MAX_ENCHANT_SUCCEED", "UserName", "Foglio", "ItemName", "@item:89607?dbid:327641239?enchantCount:11"); } - void NotifyGuildBam(object sender, RoutedEventArgs e) + private void NotifyGuildBam(object sender, RoutedEventArgs e) { Tester.AddFakeSystemMessage("SMT_GQUEST_URGENT_NOTIFY", "questName", "Frygaras", "npcName", "Frygaras", "zoneName", "Zone"); } - void NotifyFieldBoss(object sender, RoutedEventArgs e) + private void NotifyFieldBoss(object sender, RoutedEventArgs e) { Tester.AddFakeSystemMessage("SMT_FIELDBOSS_APPEAR", "npcName", "Ortan", "RegionName", "Zone"); } - void NotifyFieldBossDie(object sender, RoutedEventArgs e) + private void NotifyFieldBossDie(object sender, RoutedEventArgs e) { Tester.AddFakeSystemMessage("SMT_FIELDBOSS_DIE_NOGUILD", "userName", "Foglio", "npcName", "Ortan"); } - void SetAtkSpeed(object sender, RoutedEventArgs e) + private void SetAtkSpeed(object sender, RoutedEventArgs e) { switch (((Button)sender).Content.ToString()) { @@ -249,7 +249,7 @@ void SetAtkSpeed(object sender, RoutedEventArgs e) } } - void Unleash(object sender, RoutedEventArgs e) + private void Unleash(object sender, RoutedEventArgs e) { Tester.StartUnleash(); } diff --git a/TCC.Core/Debugging/ObjectTracker.cs b/TCC.Core/Debugging/ObjectTracker.cs index 551bd745..f0227e05 100644 --- a/TCC.Core/Debugging/ObjectTracker.cs +++ b/TCC.Core/Debugging/ObjectTracker.cs @@ -6,8 +6,8 @@ namespace TCC.Debugging; public static class ObjectTracker { - static ConcurrentDictionary Instances { get; } = new(); - static readonly object Lock = new(); + private static ConcurrentDictionary Instances { get; } = new(); + private static readonly object Lock = new(); public static void Register(Type t) { lock (Lock) diff --git a/TCC.Core/Game.cs b/TCC.Core/Game.cs index 2ae9dfaf..a15d2eb7 100644 --- a/TCC.Core/Game.cs +++ b/TCC.Core/Game.cs @@ -33,12 +33,12 @@ namespace TCC; public static class Game { - static ulong _foglioEid; - static bool _logged; - static bool _loadingScreen = true; - static bool _encounter; - static bool _inGameChatOpen; - static bool _inGameUiOn = true; + private static ulong _foglioEid; + private static bool _logged; + private static bool _loadingScreen = true; + private static bool _encounter; + private static bool _inGameChatOpen; + private static bool _inGameUiOn = true; public static readonly Dictionary NearbyNPCs = new(); public static readonly Dictionary NearbyPlayers = new(); @@ -173,12 +173,12 @@ await InitDatabasesAsync(string.IsNullOrEmpty(App.Settings.LastLanguage) StubMessageParser.HandleRawPacketEvent += OnRawPacket; } - static void OnRawPacket(Message msg) + private static void OnRawPacket(Message msg) { PacketAnalyzer.EnqueuePacket(msg); } - static void OnStubChatMessage(string author, uint channel, string message) + private static void OnStubChatMessage(string author, uint channel, string message) { if (!ChatManager.Instance.PrivateChannels.Any(x => x.Id == channel && x.Joined)) ChatManager.Instance.CachePrivateMessage(channel, author, message); @@ -187,28 +187,29 @@ static void OnStubChatMessage(string author, uint channel, string message) ChatManager.Instance.Factory.CreateMessage((ChatChannel)ChatManager.Instance.PrivateChannels.FirstOrDefault(x => x.Id == channel && x.Joined).Index + 11, author, message)); } - static void OnStubTranslatedMessage(string author, uint channel, string message, bool gm) + + private static void OnStubTranslatedMessage(string author, uint channel, string message, bool gm) { ChatManager.Instance.HandleTranslation(author, channel, message, gm); } - static void OnSetChatMode(bool b) + private static void OnSetChatMode(bool b) { InGameChatOpen = b; } - static void OnSetUiMode(bool b) + private static void OnSetUiMode(bool b) { InGameUiOn = b; } - static async Task InitDatabasesAsync(string lang) + private static async Task InitDatabasesAsync(string lang) { await Task.Run(() => InitDatabases(lang)); DatabaseLoaded?.Invoke(); } - static async Task InitDatabases(string lang) + private static async Task InitDatabases(string lang) { await UpdateManager.CheckDatabaseHash(); UpdateManager.CheckServersFile(); @@ -259,7 +260,7 @@ static async Task InitDatabases(string lang) } } - static void InstallHooks() + private static void InstallHooks() { PacketAnalyzer.Sniffer.NewConnection += OnConnected; PacketAnalyzer.Sniffer.EndConnection += OnDisconnected; @@ -339,7 +340,7 @@ static void InstallHooks() //PacketAnalyzer.Processor.Hook(OnFatigabilityPoint); } - static async Task OnCheckVersion(C_CHECK_VERSION p) + private static async Task OnCheckVersion(C_CHECK_VERSION p) { var opcPath = Path.Combine(App.DataPath, $"opcodes/protocol.{p.Versions[0]}.map").Replace("\\", "/"); if (!File.Exists(opcPath)) @@ -381,7 +382,7 @@ static async Task OnCheckVersion(C_CHECK_VERSION p) PacketAnalyzer.Sniffer.Connected = true; } - static void OnConnected(Server server) + private static void OnConnected(Server server) { Server = server; //if (App.Settings.DontShowFUBH == false) App.FUBH(); @@ -394,7 +395,7 @@ static void OnConnected(Server server) // "Official statement from Gameforge:\n\n don't combine partners or pets! It will lock you out of your character permanently.\n\n This message will keep showing until next release."); } - static Laurel GetLaurel(uint pId) + private static Laurel GetLaurel(uint pId) { var ch = Account.Characters.FirstOrDefault(x => x.Id == pId); return ch?.Laurel ?? Laurel.None; @@ -413,7 +414,7 @@ public static void SetEncounter(float curHP, float maxHP) } - static void OnReturnToLobbyHotkeyPressed() + private static void OnReturnToLobbyHotkeyPressed() { if (!Logged || LoadingScreen @@ -424,7 +425,7 @@ static void OnReturnToLobbyHotkeyPressed() StubInterface.Instance.StubClient.ReturnToLobby(); } - static void OnDisconnected() + private static void OnDisconnected() { WindowManager.TrayIcon.Connected = false; WindowManager.TrayIcon.Text = $"{App.AppVersion} - not connected"; @@ -436,7 +437,7 @@ static void OnDisconnected() if (App.ToolboxMode && UpdateManager.UpdateAvailable) App.Close(); } - static void SetAbnormalityTracker(Class c) + private static void SetAbnormalityTracker(Class c) { CurrentAbnormalityTracker = c switch { @@ -457,7 +458,7 @@ static void SetAbnormalityTracker(Class c) }; } - static void CheckChatMention(ParsedMessage m) + private static void CheckChatMention(ParsedMessage m) { string author = "", txt = "", strCh = ""; @@ -496,7 +497,7 @@ internal static void ShowLootDistributionWindow() #region Hooks - static void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) + private static void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) { Me.MaxCoins = m.MaxCoins; Me.Coins = m.Coins; @@ -512,70 +513,70 @@ static void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) Me.MagicalResistance = m.TotalMagicalResistance; } - static void OnCreatureLife(S_CREATURE_LIFE m) + private static void OnCreatureLife(S_CREATURE_LIFE m) { if (!IsMe(m.Target)) return; Me.IsAlive = m.Alive; } - static void OnTradeBrokerDealSuggested(S_TRADE_BROKER_DEAL_SUGGESTED m) + private static void OnTradeBrokerDealSuggested(S_TRADE_BROKER_DEAL_SUGGESTED m) { DB!.ItemsDatabase.Items.TryGetValue((uint)m.Item, out var i); TccUtils.CheckWindowNotify($"New broker offer for {m.Amount} <{i?.Name ?? m.Item.ToString()}> from {m.Name}", "Broker offer"); TccUtils.CheckDiscordNotify($"New broker offer for {m.Amount} **<{i?.Name ?? m.Item.ToString()}>**", m.Name); } - static void OnRequestContract(S_BEGIN_THROUGH_ARBITER_CONTRACT p) + private static void OnRequestContract(S_BEGIN_THROUGH_ARBITER_CONTRACT p) { if (p.Type != S_BEGIN_THROUGH_ARBITER_CONTRACT.RequestType.PartyInvite) return; TccUtils.CheckWindowNotify($"{p.Sender} invited you to join a party", "Party invite"); TccUtils.CheckDiscordNotify($"**{p.Sender}** invited you to join a party", "TCC"); } - static void OnBanPartyMember(S_BAN_PARTY_MEMBER obj) + private static void OnBanPartyMember(S_BAN_PARTY_MEMBER obj) { Group.RemoveMember(obj.PlayerId, obj.ServerId); } - static void OnLeavePartyMember(S_LEAVE_PARTY_MEMBER obj) + private static void OnLeavePartyMember(S_LEAVE_PARTY_MEMBER obj) { Group.RemoveMember(obj.PlayerId, obj.ServerId); } - static void OnChangePartyManager(S_CHANGE_PARTY_MANAGER p) + private static void OnChangePartyManager(S_CHANGE_PARTY_MANAGER p) { Group.ChangeLeader(p.Name); } - static void OnBanParty(S_BAN_PARTY p) + private static void OnBanParty(S_BAN_PARTY p) { Group.Disband(); } - static void OnLeaveParty(S_LEAVE_PARTY p) + private static void OnLeaveParty(S_LEAVE_PARTY p) { Group.Disband(); } - static void OnPartyMemberList(S_PARTY_MEMBER_LIST p) + private static void OnPartyMemberList(S_PARTY_MEMBER_LIST p) { Group.UpdateComposition(p.Members, p.Raid); } - static void OnBattleFieldEntranceInfo(S_BATTLE_FIELD_ENTRANCE_INFO p) + private static void OnBattleFieldEntranceInfo(S_BATTLE_FIELD_ENTRANCE_INFO p) { // TODO: add discord notification after events revamp Log.N("Instance Matching", SR.BgMatchingComplete, NotificationType.Success); Log.F($"Zone: {p.Zone}\nId: {p.Id}\nData: {p.Data.Array?.ToHexString()}", "S_BATTLE_FIELD_ENTRANCE_INFO.txt"); } - static void OnFinInterPartyMatch(S_FIN_INTER_PARTY_MATCH p) + private static void OnFinInterPartyMatch(S_FIN_INTER_PARTY_MATCH p) { Log.N("Instance Matching", SR.DungMatchingComplete, NotificationType.Success); Log.F($"Zone: {p.Zone}\nData: {p.Data.Array?.ToHexString()}", "S_FIN_INTER_PARTY_MATCH.txt"); } - static void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) + private static void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) { if (IsMe(m.Target)) { @@ -588,38 +589,38 @@ static void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) } } - static void OnPlayerChangeMp(S_PLAYER_CHANGE_MP m) + private static void OnPlayerChangeMp(S_PLAYER_CHANGE_MP m) { if (!IsMe(m.Target)) return; Me.MaxMP = m.MaxMP; Me.CurrentMP = m.CurrentMP; } - static void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA m) + private static void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA m) { Me.MaxST = m.MaxST + m.BonusST; Me.CurrentST = m.CurrentST; } - static void OnAbnormalityDamageAbsorb(S_ABNORMALITY_DAMAGE_ABSORB p) + private static void OnAbnormalityDamageAbsorb(S_ABNORMALITY_DAMAGE_ABSORB p) { // todo: add chat message too if (!IsMe(p.Target) || Me.CurrentShield < 0) return; Me.DamageShield(p.Damage); } - static void OnBossGageInfo(S_BOSS_GAGE_INFO m) + private static void OnBossGageInfo(S_BOSS_GAGE_INFO m) { SetEncounter(m.CurrentHP, m.MaxHP); } - static void OnWhisper(S_WHISPER p) + private static void OnWhisper(S_WHISPER p) { if (p.Recipient != Me.Name) return; CheckChatMention(p); } - static void OnChat(S_CHAT m) + private static void OnChat(S_CHAT m) { #region Greet meme @@ -648,35 +649,35 @@ static void OnChat(S_CHAT m) CheckChatMention(m); } - static void OnPrivateChat(S_PRIVATE_CHAT m) + private static void OnPrivateChat(S_PRIVATE_CHAT m) { if (BlockList.Contains(m.AuthorName)) return; CheckChatMention(m); } - static void OnSpawnNpc(S_SPAWN_NPC p) + private static void OnSpawnNpc(S_SPAWN_NPC p) { if (!DB!.MonsterDatabase.TryGetMonster(p.TemplateId, p.HuntingZoneId, out var m)) return; NearbyNPCs[p.EntityId] = m.Name; FlyingGuardianDataProvider.InvokeProgressChanged(); } - static void OnChangeFriendState(S_CHANGE_FRIEND_STATE p) + private static void OnChangeFriendState(S_CHANGE_FRIEND_STATE p) { Log.Chat($"Changed friend state: {p.PlayerId} {p.FriendStatus}"); } - static void OnUpdateFriendInfo(S_UPDATE_FRIEND_INFO p) + private static void OnUpdateFriendInfo(S_UPDATE_FRIEND_INFO p) { Friends.UpdateFriendInfo(p.FriendUpdates); } - static void OnAccomplishAchievement(S_ACCOMPLISH_ACHIEVEMENT x) + private static void OnAccomplishAchievement(S_ACCOMPLISH_ACHIEVEMENT x) { SystemMessagesProcessor.AnalyzeMessage($"@0\vAchievementName\v@achievement:{x.AchievementId}", "SMT_ACHIEVEMENT_GRADE0_CLEAR_MESSAGE"); } - static void OnSystemMessageLootItem(S_SYSTEM_MESSAGE_LOOT_ITEM x) + private static void OnSystemMessageLootItem(S_SYSTEM_MESSAGE_LOOT_ITEM x) { App.BaseDispatcher.InvokeAsync(() => { @@ -692,7 +693,7 @@ static void OnSystemMessageLootItem(S_SYSTEM_MESSAGE_LOOT_ITEM x) }); } - static void OnSystemMessage(S_SYSTEM_MESSAGE x) + private static void OnSystemMessage(S_SYSTEM_MESSAGE x) { if (DB!.SystemMessagesDatabase.IsHandledInternally(x.Message)) return; App.BaseDispatcher.InvokeAsync(() => @@ -709,14 +710,14 @@ static void OnSystemMessage(S_SYSTEM_MESSAGE x) }); } - static void OnDespawnNpc(S_DESPAWN_NPC p) + private static void OnDespawnNpc(S_DESPAWN_NPC p) { NearbyNPCs.Remove(p.Target); FlyingGuardianDataProvider.InvokeProgressChanged(); AbnormalityTracker.CheckMarkingOnDespawn(p.Target); } - static void OnDespawnUser(S_DESPAWN_USER p) + private static void OnDespawnUser(S_DESPAWN_USER p) { #region Aura meme @@ -727,7 +728,7 @@ static void OnDespawnUser(S_DESPAWN_USER p) NearbyPlayers.Remove(p.EntityId); } - static void OnSpawnUser(S_SPAWN_USER p) + private static void OnSpawnUser(S_SPAWN_USER p) { #region Aura meme @@ -749,7 +750,7 @@ static void OnSpawnUser(S_SPAWN_USER p) NearbyPlayers[p.EntityId] = new ValueTuple(p.Name, TccUtils.ClassFromModel(p.TemplateId)); } - static void OnSpawnMe(S_SPAWN_ME p) + private static void OnSpawnMe(S_SPAWN_ME p) { NearbyNPCs.Clear(); NearbyPlayers.Clear(); @@ -811,12 +812,12 @@ static void OnSpawnMe(S_SPAWN_ME p) }); } - static void OnAccountPackageList(S_ACCOUNT_PACKAGE_LIST m) + private static void OnAccountPackageList(S_ACCOUNT_PACKAGE_LIST m) { Account.IsElite = m.IsElite; } - static void OnLoadTopo(S_LOAD_TOPO m) + private static void OnLoadTopo(S_LOAD_TOPO m) { LoadingScreen = true; Encounter = false; @@ -825,7 +826,7 @@ static void OnLoadTopo(S_LOAD_TOPO m) Me.ClearAbnormalities(); } - static void OnGetUserList(S_GET_USER_LIST m) + private static void OnGetUserList(S_GET_USER_LIST m) { if (PacketAnalyzer.Factory!.ReleaseVersion == 0) Log.F("Warning: C_LOGIN_ARBITER not received."); @@ -866,12 +867,12 @@ static void OnGetUserList(S_GET_USER_LIST m) } } - static void OnUserStatus(S_USER_STATUS m) + private static void OnUserStatus(S_USER_STATUS m) { if (IsMe(m.GameId)) Combat = m.Status == S_USER_STATUS.UserStatus.InCombat; } - static void OnFieldEventOnLeave(S_FIELD_EVENT_ON_LEAVE p) + private static void OnFieldEventOnLeave(S_FIELD_EVENT_ON_LEAVE p) { SystemMessagesProcessor.AnalyzeMessage("", "SMT_FIELD_EVENT_LEAVE"); @@ -881,7 +882,7 @@ static void OnFieldEventOnLeave(S_FIELD_EVENT_ON_LEAVE p) StubInterface.Instance.StubClient.InvokeCommand("fps mode 1"); } - static void OnFieldEventOnEnter(S_FIELD_EVENT_ON_ENTER p) + private static void OnFieldEventOnEnter(S_FIELD_EVENT_ON_ENTER p) { SystemMessagesProcessor.AnalyzeMessage("", "SMT_FIELD_EVENT_ENTER"); @@ -891,7 +892,7 @@ static void OnFieldEventOnEnter(S_FIELD_EVENT_ON_ENTER p) StubInterface.Instance.StubClient.InvokeCommand("fps mode 3"); } - static void OnFieldPointInfo(S_FIELD_POINT_INFO p) + private static void OnFieldPointInfo(S_FIELD_POINT_INFO p) { if (Account.CurrentCharacter == null) return; var old = Account.CurrentCharacter.GuardianInfo.Cleared; @@ -901,7 +902,7 @@ static void OnFieldPointInfo(S_FIELD_POINT_INFO p) SystemMessagesProcessor.AnalyzeMessage("@0", "SMT_FIELD_EVENT_REWARD_AVAILABLE"); } - static void OnGetUserGuildLogo(S_GET_USER_GUILD_LOGO p) + private static void OnGetUserGuildLogo(S_GET_USER_GUILD_LOGO p) { S_IMAGE_DATA.Database[p.GuildId] = p.GuildLogo; @@ -920,36 +921,36 @@ static void OnGetUserGuildLogo(S_GET_USER_GUILD_LOGO p) } } - static void OnGuildMemberList(S_GUILD_MEMBER_LIST m) + private static void OnGuildMemberList(S_GUILD_MEMBER_LIST m) { Task.Run(() => Guild.Set(m.Members, m.MasterId, m.MasterName)); } - static void OnLoadEpInfo(S_LOAD_EP_INFO m) + private static void OnLoadEpInfo(S_LOAD_EP_INFO m) { if (!m.Perks.TryGetValue(851010, out var level)) return; EpDataProvider.SetManaBarrierPerkLevel(level); } - static void OnLearnEpPerk(S_LEARN_EP_PERK m) + private static void OnLearnEpPerk(S_LEARN_EP_PERK m) { if (!m.Perks.TryGetValue(851010, out var level)) return; EpDataProvider.SetManaBarrierPerkLevel(level); } - static void OnResetEpPerk(S_RESET_EP_PERK m) + private static void OnResetEpPerk(S_RESET_EP_PERK m) { if (!m.Success) return; EpDataProvider.SetManaBarrierPerkLevel(0); } - static void OnReturnToLobby(S_RETURN_TO_LOBBY m) + private static void OnReturnToLobby(S_RETURN_TO_LOBBY m) { Logged = false; Me.ClearAbnormalities(); } - static async Task OnLogin(S_LOGIN m) + private static async Task OnLogin(S_LOGIN m) { var account = string.IsNullOrEmpty(CurrentAccountNameHash) ? string.IsNullOrEmpty(App.Settings.LastAccountNameHash) @@ -1018,7 +1019,8 @@ static async Task OnLogin(S_LOGIN m) }); } } - static async Task OnLoginArbiter(C_LOGIN_ARBITER m) + + private static async Task OnLoginArbiter(C_LOGIN_ARBITER m) { CurrentAccountNameHash = HashUtils.GenerateHash(m.AccountName); App.Settings.LastAccountNameHash = CurrentAccountNameHash; @@ -1061,7 +1063,7 @@ static async Task OnLoginArbiter(C_LOGIN_ARBITER m) PacketAnalyzer.Factory.ReloadSysMsg(path); } - static void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) + private static void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { CurrentAbnormalityTracker.OnAbnormalityBegin(p); if (!IsMe(p.TargetId)) return; @@ -1082,7 +1084,7 @@ static void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) ChatManager.Instance.AddCooldownBombMessage(username); } - static void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) + private static void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) { CurrentAbnormalityTracker.OnAbnormalityRefresh(p); if (!IsMe(p.TargetId)) return; @@ -1092,7 +1094,7 @@ static void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) FlyingGuardianDataProvider.OnAbnormalityRefresh(p); } - static void OnAbnormalityEnd(S_ABNORMALITY_END p) + private static void OnAbnormalityEnd(S_ABNORMALITY_END p) { CurrentAbnormalityTracker.OnAbnormalityEnd(p); if (!IsMe(p.TargetId)) return; @@ -1101,23 +1103,23 @@ static void OnAbnormalityEnd(S_ABNORMALITY_END p) Me.EndAbnormality(ab); } - static void OnStartCooltimeItem(S_START_COOLTIME_ITEM m) + private static void OnStartCooltimeItem(S_START_COOLTIME_ITEM m) { App.BaseDispatcher.InvokeAsync(() => SkillStarted?.Invoke()); } - static void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) + private static void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) { App.BaseDispatcher.InvokeAsync(() => SkillStarted?.Invoke()); } - static void OnChangeGuildChief(S_CHANGE_GUILD_CHIEF m) + private static void OnChangeGuildChief(S_CHANGE_GUILD_CHIEF m) { SystemMessagesProcessor.AnalyzeMessage($"@0\vName\v{Guild.NameOf(m.PlayerId)}", "SMT_GC_SYSMSG_GUILD_CHIEF_CHANGED"); Guild.SetMaster(m.PlayerId, Guild.NameOf(m.PlayerId)); } - static void OnNotifyGuildQuestUrgent(S_NOTIFY_GUILD_QUEST_URGENT p) + private static void OnNotifyGuildQuestUrgent(S_NOTIFY_GUILD_QUEST_URGENT p) { if (p.Type != S_NOTIFY_GUILD_QUEST_URGENT.GuildBamQuestType.Announce) return; @@ -1130,17 +1132,17 @@ static void OnNotifyGuildQuestUrgent(S_NOTIFY_GUILD_QUEST_URGENT p) SystemMessagesProcessor.AnalyzeMessage($"@0\vquestName\v{questName}\vnpcName\v{name}\vzoneName\v{zone}", "SMT_GQUEST_URGENT_NOTIFY"); } - static void OnNotifyToFriendsWalkIntoSameArea(S_NOTIFY_TO_FRIENDS_WALK_INTO_SAME_AREA x) + private static void OnNotifyToFriendsWalkIntoSameArea(S_NOTIFY_TO_FRIENDS_WALK_INTO_SAME_AREA x) { Friends.NotifyWalkInSameArea(x.PlayerId, x.WorldId, x.GuardId, x.SectionId); } - static void OnFriendList(S_FRIEND_LIST m) + private static void OnFriendList(S_FRIEND_LIST m) { Friends.SetFrom(m.Friends); } - static void OnUserBlockList(S_USER_BLOCK_LIST m) + private static void OnUserBlockList(S_USER_BLOCK_LIST m) { m.BlockedUsers.ForEach(u => { diff --git a/TCC.Core/GameEventManager.cs b/TCC.Core/GameEventManager.cs index f78cdba3..1ee19be4 100644 --- a/TCC.Core/GameEventManager.cs +++ b/TCC.Core/GameEventManager.cs @@ -23,11 +23,11 @@ namespace TCC; //TODO: big refactor here public class GameEventManager : ThreadSafeObservableObject { - static GameEventManager? _instance; + private static GameEventManager? _instance; public static GameEventManager Instance => _instance ??= new GameEventManager(); // TODO: not sure about other regions reset days - readonly Dictionary _serverTimezones = new() + private readonly Dictionary _serverTimezones = new() { { RegionEnum.EU, new TeraServerTimeInfo("Central Europe Standard Time", 6, DayOfWeek.Wednesday, DayOfWeek.Thursday) }, { RegionEnum.NA, new TeraServerTimeInfo("Central Standard Time", 6, DayOfWeek.Tuesday, DayOfWeek.Thursday) }, @@ -39,7 +39,7 @@ public class GameEventManager : ThreadSafeObservableObject }; public const double SecondsInDay = 60 * 60 * 24; - const string BaseUrl = "https://tcc-web-99a64.firebaseapp.com/bam"; // todo: replace this + private const string BaseUrl = "https://tcc-web-99a64.firebaseapp.com/bam"; // todo: replace this public int ResetHour; public RegionEnum CurrentRegion { get; set; } @@ -48,14 +48,14 @@ public class GameEventManager : ThreadSafeObservableObject public DateTime CurrentServerTime => DateTime.Now.AddHours(ServerHourOffsetFromLocal); - GameEventManager() + private GameEventManager() { var s = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; s.Tick += CheckNewDay; s.Start(); } - void CheckCloseEvents() + private void CheckCloseEvents() { var closeEventsCount = WindowManager.ViewModels.DashboardVM.EventGroups.Count(evGroup => evGroup.Events.Any(x => x.IsClose)); if (closeEventsCount == 0) return; @@ -63,7 +63,7 @@ void CheckCloseEvents() } - void CheckNewDay(object? sender, EventArgs e) + private void CheckNewDay(object? sender, EventArgs e) { if (CurrentServerTime is { Hour: 0, Minute: 0 }) WindowManager.ViewModels.DashboardVM.LoadEvents(CurrentServerTime.DayOfWeek, CurrentRegion.ToString()); @@ -104,7 +104,7 @@ public void SetServerTimeZone(string lang) } - void CheckReset() + private void CheckReset() { var todayReset = DateTime.Today.AddHours(ResetHour + ServerHourOffsetFromLocal); if (App.Settings.LastRun > todayReset || DateTime.Now < todayReset) return; @@ -122,7 +122,7 @@ void CheckReset() App.Settings.Save(); } - async Task DownloadGuildBamTimestamp() + private async Task DownloadGuildBamTimestamp() { try { @@ -197,12 +197,12 @@ public static void ExecuteFieldBossDieWebhook(string monsterName, string default SendWebhook(content, App.Settings.WebhookUrlFieldBoss, testMessage); } - static void SendWebhook(string content, string url, bool test = false) + private static void SendWebhook(string content, string url, bool test = false) { Discord.FireWebhook(url, $"{content}{(test ? " (test message)" : "")}", App.AppVersion, Game.CurrentAccountNameHash); } - struct TeraServerTimeInfo + private struct TeraServerTimeInfo { public readonly string Timezone; public readonly int ResetHour; diff --git a/TCC.Core/Notice/NoticeChecker.cs b/TCC.Core/Notice/NoticeChecker.cs index 952a3e8a..f27cddc6 100644 --- a/TCC.Core/Notice/NoticeChecker.cs +++ b/TCC.Core/Notice/NoticeChecker.cs @@ -13,9 +13,9 @@ namespace TCC.Notice; public static class NoticeChecker { - const string Url = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/master/messages.json"; - static List _notices = new(); - static readonly Timer _checkTimer = new(60 * 5 * 1000); + private const string Url = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/master/messages.json"; + private static List _notices = new(); + private static readonly Timer _checkTimer = new(60 * 5 * 1000); public static void Init() { @@ -36,18 +36,18 @@ public static void Ready() FireNotices(NoticeTrigger.Ready); } - static void OnNewConnection(Server obj) + private static void OnNewConnection(Server obj) { FireNotices(NoticeTrigger.Connection); } - static void OnLoggedChanged() + private static void OnLoggedChanged() { if (!Game.Logged) return; FireNotices(NoticeTrigger.Login); } - static void FireNotices(NoticeTrigger trigger) + private static void FireNotices(NoticeTrigger trigger) { App.BaseDispatcher.Invoke(() => { @@ -59,12 +59,12 @@ static void FireNotices(NoticeTrigger trigger) }); } - static void OnTimerElapsed(object? sender, ElapsedEventArgs e) + private static void OnTimerElapsed(object? sender, ElapsedEventArgs e) { Check(); } - static void Check() + private static void Check() { try { diff --git a/TCC.Core/ResourceDictionaries/DataTemplates.xaml.cs b/TCC.Core/ResourceDictionaries/DataTemplates.xaml.cs index 1966bc39..145c4601 100644 --- a/TCC.Core/ResourceDictionaries/DataTemplates.xaml.cs +++ b/TCC.Core/ResourceDictionaries/DataTemplates.xaml.cs @@ -12,14 +12,14 @@ namespace TCC.ResourceDictionaries; public partial class DataTemplates { - void OnCharacterNameMouseLeftButtonDown(object? sender, MouseButtonEventArgs e) + private void OnCharacterNameMouseLeftButtonDown(object? sender, MouseButtonEventArgs e) { var dc = (sender as FrameworkElement)?.DataContext; if (dc != null) WindowManager.ViewModels.DashboardVM.SelectCharacter((Character)dc); } - void LfgMessage_OnKeyDown(object sender, KeyEventArgs e) + private void LfgMessage_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) return; @@ -36,18 +36,18 @@ void LfgMessage_OnKeyDown(object sender, KeyEventArgs e) Task.Delay(200).ContinueWith(_ => StubInterface.Instance.StubClient.RequestListings(App.Settings.LfgWindowSettings.MinLevel, App.Settings.LfgWindowSettings.MaxLevel)); } - void LfgMessage_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + private void LfgMessage_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { FocusManager.UndoUnfocusable(WindowManager.LfgListWindow.Handle); WindowManager.LfgListWindow.Activate(); } - void LfgMessage_OnTbLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + private void LfgMessage_OnTbLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { FocusManager.MakeUnfocusable(WindowManager.LfgListWindow.Handle); } - void LfgMessage_OnTbLoaded(object sender, RoutedEventArgs e) + private void LfgMessage_OnTbLoaded(object sender, RoutedEventArgs e) { FocusManager.UndoUnfocusable(WindowManager.LfgListWindow.Handle); WindowManager.LfgListWindow.Activate(); @@ -56,7 +56,7 @@ void LfgMessage_OnTbLoaded(object sender, RoutedEventArgs e) Keyboard.Focus((TextBox)sender); } - void LfgMessage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private void LfgMessage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FocusManager.UndoUnfocusable(WindowManager.LfgListWindow.Handle); ((TextBox)sender).Focus(); @@ -66,7 +66,7 @@ void LfgMessage_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) } - void LfgPopup_OnMouseLeave(object sender, MouseEventArgs e) + private void LfgPopup_OnMouseLeave(object sender, MouseEventArgs e) { if (sender is FrameworkElement { DataContext: Listing l }) l.IsPopupOpen = false; else FocusManager.PauseTopmost = false; diff --git a/TCC.Core/ResourceDictionaries/Styles.xaml.cs b/TCC.Core/ResourceDictionaries/Styles.xaml.cs index 76e1fc98..7acd67be 100644 --- a/TCC.Core/ResourceDictionaries/Styles.xaml.cs +++ b/TCC.Core/ResourceDictionaries/Styles.xaml.cs @@ -5,13 +5,13 @@ namespace TCC.ResourceDictionaries; public partial class Styles { - void ToolTip_Opened(object sender, RoutedEventArgs e) + private void ToolTip_Opened(object sender, RoutedEventArgs e) { FocusManager.PauseTopmost = true; //FocusManager.ForceVisible = true; //FocusTimer.Enabled = false; } - void ToolTip_Closed(object sender, RoutedEventArgs e) + private void ToolTip_Closed(object sender, RoutedEventArgs e) { FocusManager.PauseTopmost = false; diff --git a/TCC.Core/Settings/CooldownConfigParser.cs b/TCC.Core/Settings/CooldownConfigParser.cs index 533799b4..19e4cc3a 100644 --- a/TCC.Core/Settings/CooldownConfigParser.cs +++ b/TCC.Core/Settings/CooldownConfigParser.cs @@ -23,7 +23,7 @@ public CooldownConfigParser(Class c) Data = GetDefaults(c); } - static CooldownConfigData GetDefaults(Class c) + private static CooldownConfigData GetDefaults(Class c) { var ret = new CooldownConfigData(); switch (c) diff --git a/TCC.Core/Settings/JsonSettingsReader.cs b/TCC.Core/Settings/JsonSettingsReader.cs index b42ca379..3b4b5484 100644 --- a/TCC.Core/Settings/JsonSettingsReader.cs +++ b/TCC.Core/Settings/JsonSettingsReader.cs @@ -17,7 +17,7 @@ namespace TCC.Settings; /// public class JsonIgnoreResolver : DefaultContractResolver { - readonly Dictionary> _ignores = new(); + private readonly Dictionary> _ignores = new(); /// /// Explicitly ignore the given property(s) for the given type @@ -41,7 +41,7 @@ public void Ignore(Type type, params string[] propertyName) /// /// /// - bool IsIgnored(Type type, string propertyName) + private bool IsIgnored(Type type, string propertyName) { if (!_ignores.TryGetValue(type, out var props)) return false; diff --git a/TCC.Core/Settings/SettingsContainer.cs b/TCC.Core/Settings/SettingsContainer.cs index fd123e02..3fcd967c 100644 --- a/TCC.Core/Settings/SettingsContainer.cs +++ b/TCC.Core/Settings/SettingsContainer.cs @@ -17,10 +17,10 @@ namespace TCC.Settings; public class SettingsContainer { - string _lastLanguage; - bool _chatEnabled; - bool _enableProxy; - LootDistributionWindowSettings _lootDistributionWindowSettings; + private string _lastLanguage; + private bool _chatEnabled; + private bool _enableProxy; + private LootDistributionWindowSettings _lootDistributionWindowSettings; #region Misc diff --git a/TCC.Core/Settings/WindowSettings/BuffWindowSettings.cs b/TCC.Core/Settings/WindowSettings/BuffWindowSettings.cs index 111e6f99..daa7f14e 100644 --- a/TCC.Core/Settings/WindowSettings/BuffWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/BuffWindowSettings.cs @@ -14,8 +14,8 @@ public class BuffWindowSettings : WindowSettingsBase public event Action? DirectionChanged; public event Action? OverlapChanged; - FlowDirection _direction; - double _overlap; + private FlowDirection _direction; + private double _overlap; public bool ShowAll { get; set; } // by HQ public FlowDirection Direction diff --git a/TCC.Core/Settings/WindowSettings/CharacterWindowSettings.cs b/TCC.Core/Settings/WindowSettings/CharacterWindowSettings.cs index 03552924..99587e2b 100644 --- a/TCC.Core/Settings/WindowSettings/CharacterWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/CharacterWindowSettings.cs @@ -20,11 +20,11 @@ public class CharacterWindowSettings : WindowSettingsBase public event Action? ShowStaminaChanged; public event Action? CustomLaurelChanged; - bool _sorcererShowElements; - bool _warriorShowEdge; - bool _compactMode; - bool _showStamina; - CustomLaurel _customLaurel; + private bool _sorcererShowElements; + private bool _warriorShowEdge; + private bool _compactMode; + private bool _showStamina; + private CustomLaurel _customLaurel; public bool CompactMode { @@ -92,7 +92,7 @@ public CharacterWindowSettings() } - void ChooseCustomLaurel() + private void ChooseCustomLaurel() { var w = Application.Current.Windows.ToList().OfType().FirstOrDefault(); diff --git a/TCC.Core/Settings/WindowSettings/ChatWindowSettings.cs b/TCC.Core/Settings/WindowSettings/ChatWindowSettings.cs index a3fb62c1..bfc37c40 100644 --- a/TCC.Core/Settings/WindowSettings/ChatWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/ChatWindowSettings.cs @@ -7,15 +7,15 @@ namespace TCC.Settings.WindowSettings; public class ChatWindowSettings : WindowSettingsBase { - bool _fadeOut = true; - double _backgroundOpacity = .3; - double _frameOpacity = 1; - bool _lfgOn = true; - int _hideTimeout; - bool _canCollapse = true; - bool _staysCollapsed; - bool _showImportant = true; - int _collapsedHeight = 64; + private bool _fadeOut = true; + private double _backgroundOpacity = .3; + private double _frameOpacity = 1; + private bool _lfgOn = true; + private int _hideTimeout; + private bool _canCollapse = true; + private bool _staysCollapsed; + private bool _showImportant = true; + private int _collapsedHeight = 64; public event Action? FadeoutChanged; public event Action? OpacityChanged; diff --git a/TCC.Core/Settings/WindowSettings/ClassWindowSettings.cs b/TCC.Core/Settings/WindowSettings/ClassWindowSettings.cs index 5cb76582..2f8ae1c7 100644 --- a/TCC.Core/Settings/WindowSettings/ClassWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/ClassWindowSettings.cs @@ -15,15 +15,15 @@ public class ClassWindowSettings : WindowSettingsBase public event Action? SorcererShowElementsChanged; public event Action? FlashAvailableSkillsChanged; - bool _warriorShowEdge; - bool _warriorShowInfuriate; - bool _warriorShowTraverseCut; - bool _sorcererShowElements; - bool _valkyrieShowRagnarok; - bool _valkyrieShowGodsfall; - bool _flashAvailableSkills; + private bool _warriorShowEdge; + private bool _warriorShowInfuriate; + private bool _warriorShowTraverseCut; + private bool _sorcererShowElements; + private bool _valkyrieShowRagnarok; + private bool _valkyrieShowGodsfall; + private bool _flashAvailableSkills; - WarriorEdgeMode _warriorEdgeMode; + private WarriorEdgeMode _warriorEdgeMode; public bool WarriorShowEdge { diff --git a/TCC.Core/Settings/WindowSettings/CooldownWindowSettings.cs b/TCC.Core/Settings/WindowSettings/CooldownWindowSettings.cs index 9f68d561..72d647ac 100644 --- a/TCC.Core/Settings/WindowSettings/CooldownWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/CooldownWindowSettings.cs @@ -9,8 +9,8 @@ public class CooldownWindowSettings : WindowSettingsBase public event Action? ShowItemsChanged; public event Action? ModeChanged; - bool _showItems; - CooldownBarMode _mode; + private bool _showItems; + private CooldownBarMode _mode; public bool ShowItems { diff --git a/TCC.Core/Settings/WindowSettings/FlightWindowSettings.cs b/TCC.Core/Settings/WindowSettings/FlightWindowSettings.cs index 61a5275e..93fbe6f9 100644 --- a/TCC.Core/Settings/WindowSettings/FlightWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/FlightWindowSettings.cs @@ -9,8 +9,8 @@ public class FlightWindowSettings : WindowSettingsBase public event Action? RotationChanged; public event Action? FlipChanged; - bool _flip; - double _rotation; + private bool _flip; + private double _rotation; public bool Flip { diff --git a/TCC.Core/Settings/WindowSettings/FloatingButtonWindowSettings.cs b/TCC.Core/Settings/WindowSettings/FloatingButtonWindowSettings.cs index cfe2b300..c19e46c0 100644 --- a/TCC.Core/Settings/WindowSettings/FloatingButtonWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/FloatingButtonWindowSettings.cs @@ -5,7 +5,7 @@ namespace TCC.Settings.WindowSettings; public class FloatingButtonWindowSettings : WindowSettingsBase { - bool _showNotificationBubble; + private bool _showNotificationBubble; public bool ShowNotificationBubble { diff --git a/TCC.Core/Settings/WindowSettings/GroupWindowSettings.cs b/TCC.Core/Settings/WindowSettings/GroupWindowSettings.cs index be4bb207..cf1669e8 100644 --- a/TCC.Core/Settings/WindowSettings/GroupWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/GroupWindowSettings.cs @@ -13,21 +13,21 @@ public class GroupWindowSettings : WindowSettingsBase public event Action? ThresholdChanged; public event Action? LayoutChanged; - GroupHpLabelMode _hpLabelMode; - bool _ignoreMe; - uint _hideBuffsThreshold; - uint _hideDebuffsThreshold; - uint _hideHpThreshold; - uint _hideMpThreshold; - uint _hideStThreshold; - uint _disableAbnormalitiesThreshold; - uint _disableAbnormalitiesAnimationThreshold; - uint _groupSizeThreshold; - GroupWindowLayout _layout; - bool _showAwakenIcon; - bool _showDetails; - bool _showLaurels; - bool _showOnlyAggroStacks; + private GroupHpLabelMode _hpLabelMode; + private bool _ignoreMe; + private uint _hideBuffsThreshold; + private uint _hideDebuffsThreshold; + private uint _hideHpThreshold; + private uint _hideMpThreshold; + private uint _hideStThreshold; + private uint _disableAbnormalitiesThreshold; + private uint _disableAbnormalitiesAnimationThreshold; + private uint _groupSizeThreshold; + private GroupWindowLayout _layout; + private bool _showAwakenIcon; + private bool _showDetails; + private bool _showLaurels; + private bool _showOnlyAggroStacks; public GroupHpLabelMode HpLabelMode { diff --git a/TCC.Core/Settings/WindowSettings/LfgWindowSettings.cs b/TCC.Core/Settings/WindowSettings/LfgWindowSettings.cs index 681bb66c..7828ea93 100644 --- a/TCC.Core/Settings/WindowSettings/LfgWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/LfgWindowSettings.cs @@ -6,13 +6,13 @@ namespace TCC.Settings.WindowSettings; public class LfgWindowSettings : WindowSettingsBase { - const int MinAutoPublicizeCooldown = 20; + private const int MinAutoPublicizeCooldown = 20; public event Action? HideTradeListingsChangedEvent; - bool _hideTradeListings; - int _minLevel; - int _maxLevel; + private bool _hideTradeListings; + private int _minLevel; + private int _maxLevel; public int MinLevel { @@ -48,7 +48,7 @@ public bool HideTradeListings } } - int _autoPublicizeCooldown; + private int _autoPublicizeCooldown; public int AutoPublicizeCooldown { diff --git a/TCC.Core/Settings/WindowSettings/LootDistributionWindowSettings.cs b/TCC.Core/Settings/WindowSettings/LootDistributionWindowSettings.cs index 154c7e5d..0a5d890d 100644 --- a/TCC.Core/Settings/WindowSettings/LootDistributionWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/LootDistributionWindowSettings.cs @@ -11,13 +11,13 @@ public class LootDistributionWindowSettings : WindowSettingsBase public event Action? DelayChanged; public event Action? AutoRollPolicyChanged; - bool _alwaysRoll; - bool _alwaysPass; - HotKey _toggleHotKey = new(Keys.L, ModifierKeys.Control); - HotKey _rollHotKey = new(Keys.PageUp, ModifierKeys.None); - HotKey _passHotKey = new(Keys.Next, ModifierKeys.None); - int _autorollDelaySec = 10; - bool _autoShowUponRoll; + private bool _alwaysRoll; + private bool _alwaysPass; + private HotKey _toggleHotKey = new(Keys.L, ModifierKeys.Control); + private HotKey _rollHotKey = new(Keys.PageUp, ModifierKeys.None); + private HotKey _passHotKey = new(Keys.Next, ModifierKeys.None); + private int _autorollDelaySec = 10; + private bool _autoShowUponRoll; public int AutorollDelaySec { @@ -93,7 +93,7 @@ public bool AutoShowUponRoll set => RaiseAndSetIfChanged(value, ref _autoShowUponRoll); } - bool _autoRollItemsBlacklistMode; + private bool _autoRollItemsBlacklistMode; public bool AutoRollItemsBlacklistMode { @@ -101,7 +101,7 @@ public bool AutoRollItemsBlacklistMode set => RaiseAndSetIfChanged(value, ref _autoRollItemsBlacklistMode); } - bool _autoPassItemsBlacklistMode; + private bool _autoPassItemsBlacklistMode; public bool AutoPassItemsBlacklistMode { diff --git a/TCC.Core/Settings/WindowSettings/NotificationAreaSettings.cs b/TCC.Core/Settings/WindowSettings/NotificationAreaSettings.cs index 1c84ed70..84b97752 100644 --- a/TCC.Core/Settings/WindowSettings/NotificationAreaSettings.cs +++ b/TCC.Core/Settings/WindowSettings/NotificationAreaSettings.cs @@ -5,7 +5,7 @@ namespace TCC.Settings.WindowSettings; public class NotificationAreaSettings : WindowSettingsBase { - int _defaultNotificationDuration; + private int _defaultNotificationDuration; public int MaxNotifications { get; set; } public int DefaultNotificationDuration { diff --git a/TCC.Core/Settings/WindowSettings/NpcWindowSettings.cs b/TCC.Core/Settings/WindowSettings/NpcWindowSettings.cs index b8cdb02a..54319abe 100644 --- a/TCC.Core/Settings/WindowSettings/NpcWindowSettings.cs +++ b/TCC.Core/Settings/WindowSettings/NpcWindowSettings.cs @@ -9,9 +9,9 @@ public class NpcWindowSettings : WindowSettingsBase public event Action? AccurateHpChanged; public event Action? HideAddsChanged; - bool _accurateHp; - bool _hideAdds; - EnrageLabelMode _enrageLabelMode; + private bool _accurateHp; + private bool _hideAdds; + private EnrageLabelMode _enrageLabelMode; public bool HideAdds { diff --git a/TCC.Core/Settings/WindowSettings/WindowSettingsBase.cs b/TCC.Core/Settings/WindowSettings/WindowSettingsBase.cs index 83d3a6b4..c9bd8f5c 100644 --- a/TCC.Core/Settings/WindowSettings/WindowSettingsBase.cs +++ b/TCC.Core/Settings/WindowSettings/WindowSettingsBase.cs @@ -26,9 +26,9 @@ public class WindowSettingsBase : ThreadSafeObservableObject protected bool _showAlways; protected bool _enabled; protected bool _allowOffScreen; - bool _forcedClickable; - bool _forcedVisible; - bool _hideIngameUI = true; + private bool _forcedClickable; + private bool _forcedVisible; + private bool _hideIngameUI = true; public event Action? ResetToCenter; diff --git a/TCC.Core/UI/Controls/Abnormalities/AbnormalityIndicatorBase.cs b/TCC.Core/UI/Controls/Abnormalities/AbnormalityIndicatorBase.cs index 1de6c27b..e58d4678 100644 --- a/TCC.Core/UI/Controls/Abnormalities/AbnormalityIndicatorBase.cs +++ b/TCC.Core/UI/Controls/Abnormalities/AbnormalityIndicatorBase.cs @@ -11,8 +11,8 @@ namespace TCC.UI.Controls.Abnormalities; public class AbnormalityIndicatorBase : UserControl { - readonly DoubleAnimation _an; - AbnormalityDuration? _context; + private readonly DoubleAnimation _an; + private AbnormalityDuration? _context; protected FrameworkElement? DurationLabelRef; protected FrameworkElement? MainArcRef; @@ -23,7 +23,7 @@ protected AbnormalityIndicatorBase() Unloaded += UserControl_Unloaded; } - void UserControl_Loaded(object sender, RoutedEventArgs e) + private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (DesignerProperties.GetIsInDesignMode(this)) return; if (DataContext is not AbnormalityDuration ab) return; @@ -38,7 +38,7 @@ void UserControl_Loaded(object sender, RoutedEventArgs e) BeginAnimation(OpacityProperty, AnimationFactory.CreateDoubleAnimation(100, from: 0, to: 1)); } - void UserControl_Unloaded(object sender, RoutedEventArgs e) + private void UserControl_Unloaded(object sender, RoutedEventArgs e) { if (_context == null) return; _context.Refreshed -= OnRefreshed; @@ -50,7 +50,7 @@ void UserControl_Unloaded(object sender, RoutedEventArgs e) } - void OnRefreshed() + private void OnRefreshed() { if (_context == null) return; if (_context.Duration == uint.MaxValue) return; @@ -58,7 +58,7 @@ void OnRefreshed() Dispatcher?.Invoke(AnimateCooldown); } - void AnimateCooldown() + private void AnimateCooldown() { if (_context == null) return; _an.Duration = TimeSpan.FromMilliseconds(_context.DurationLeft); diff --git a/TCC.Core/UI/Controls/Abnormalities/AbnormalityToolTipControl.cs b/TCC.Core/UI/Controls/Abnormalities/AbnormalityToolTipControl.cs index 613f7813..ac53ba3d 100644 --- a/TCC.Core/UI/Controls/Abnormalities/AbnormalityToolTipControl.cs +++ b/TCC.Core/UI/Controls/Abnormalities/AbnormalityToolTipControl.cs @@ -33,12 +33,12 @@ public AbnormalityToolTipControl() Unloaded -= OnLoaded; } - void ParseToolTip(string t) + private void ParseToolTip(string t) { new TooltipParser(t).Parse().ForEach(ToolTipTb.Inlines.Add); } - void OnLoaded(object sender, RoutedEventArgs e) + private void OnLoaded(object sender, RoutedEventArgs e) { ToolTipTb.Text = ""; ToolTipTb.FontSize = 11; diff --git a/TCC.Core/UI/Controls/Abnormalities/TooltipParser.cs b/TCC.Core/UI/Controls/Abnormalities/TooltipParser.cs index f2b3a339..c659de68 100644 --- a/TCC.Core/UI/Controls/Abnormalities/TooltipParser.cs +++ b/TCC.Core/UI/Controls/Abnormalities/TooltipParser.cs @@ -10,17 +10,17 @@ namespace TCC.UI.Controls.Abnormalities; public class TooltipParser { - const string GoodMarker = "H_W_GOOD"; - const string BadMarker = "H_W_BAD"; - const string CustomMarker = "H_W_CSTM"; - const string EndMarker = "COLOR_END"; + private const string GoodMarker = "H_W_GOOD"; + private const string BadMarker = "H_W_BAD"; + private const string CustomMarker = "H_W_CSTM"; + private const string EndMarker = "COLOR_END"; - const string CarriageReturn1 = "$BR"; - const string CarriageReturn2 = "
"; + private const string CarriageReturn1 = "$BR"; + private const string CarriageReturn2 = "
"; - string _t; + private string _t; - readonly List _ret; + private readonly List _ret; public TooltipParser(string s) { @@ -55,7 +55,7 @@ public List Parse() return _ret; } - void Clean() + private void Clean() { _t = _t.Replace(CarriageReturn1, "\n") .Replace(CarriageReturn2, "\n") @@ -64,7 +64,7 @@ void Clean() .Replace("\">", "'>"); } - void CorrectOrder() + private void CorrectOrder() { var correctionSplit = _t.Split('$'); var swapped = false; @@ -93,7 +93,7 @@ void CorrectOrder() foreach (var s1 in correctionSplit) _t += s1; } - void ReplaceHTML() + private void ReplaceHTML() { while (_t.Contains("= _lyrics.Count) _testNotifIdx = 0; } - void OnKeyDown(object sender, KeyEventArgs e) + private void OnKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.LeftCtrl) return; ((SettingsWindowViewModel) DataContext).ShowDebugSettings = true; } - void OnKeyUp(object sender, KeyEventArgs e) + private void OnKeyUp(object sender, KeyEventArgs e) { if (e.Key != Key.LeftCtrl) return; ((SettingsWindowViewModel)DataContext).ShowDebugSettings = false; diff --git a/TCC.Core/UI/Windows/SkillConfigWindow.xaml.cs b/TCC.Core/UI/Windows/SkillConfigWindow.xaml.cs index 77e313cc..af59faf1 100644 --- a/TCC.Core/UI/Windows/SkillConfigWindow.xaml.cs +++ b/TCC.Core/UI/Windows/SkillConfigWindow.xaml.cs @@ -17,11 +17,11 @@ namespace TCC.UI.Windows; //TODO: make this inherit from TccWindow public partial class SkillConfigWindow { - static SkillConfigWindow? _instance; + private static SkillConfigWindow? _instance; public static SkillConfigWindow Instance => _instance ?? new SkillConfigWindow(); - CooldownWindowViewModel VM { get; } + private CooldownWindowViewModel VM { get; } public SkillConfigWindow() : base(true) { _instance = this; @@ -70,7 +70,7 @@ public override void HideWindow() } - void ClosewWindow(object? sender, RoutedEventArgs? e) + private void ClosewWindow(object? sender, RoutedEventArgs? e) { //var an = new DoubleAnimation(0, TimeSpan.FromMilliseconds(200)); //FocusManager.ForceFocused = false; @@ -115,12 +115,12 @@ public override void ShowWindow() //}); } - void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragMove(); } - void SkillSearch_OnTextChanged(object sender, TextChangedEventArgs e) + private void SkillSearch_OnTextChanged(object sender, TextChangedEventArgs e) { if (VM.SkillsView == null) return; var view = (ICollectionView)VM.SkillsView; @@ -128,21 +128,21 @@ void SkillSearch_OnTextChanged(object sender, TextChangedEventArgs e) view.Refresh(); } - void ItemSearch_OnTextChanged(object sender, TextChangedEventArgs e) + private void ItemSearch_OnTextChanged(object sender, TextChangedEventArgs e) { var view = (ICollectionView)VM.ItemsView; view.Filter = o => ((Item)o).Name.IndexOf(((TextBox)sender).Text, StringComparison.InvariantCultureIgnoreCase) != -1; view.Refresh(); } - void PassivitySearch_OnTextChanged(object sender, TextChangedEventArgs e) + private void PassivitySearch_OnTextChanged(object sender, TextChangedEventArgs e) { var view = (ICollectionView)VM.AbnormalitiesView; view.Filter = o => ((Abnormality)o).Name.IndexOf(((TextBox)sender).Text, StringComparison.InvariantCultureIgnoreCase) != -1; view.Refresh(); } - void RemoveHiddenSkill(object sender, RoutedEventArgs e) + private void RemoveHiddenSkill(object sender, RoutedEventArgs e) { VM.RemoveHiddenSkill((Cooldown) ((Button)sender).DataContext); } diff --git a/TCC.Core/UI/Windows/SplashScreenViewModel.cs b/TCC.Core/UI/Windows/SplashScreenViewModel.cs index ee4f0a5b..68aa0222 100644 --- a/TCC.Core/UI/Windows/SplashScreenViewModel.cs +++ b/TCC.Core/UI/Windows/SplashScreenViewModel.cs @@ -11,9 +11,9 @@ namespace TCC.UI.Windows; public class SplashScreenViewModel : ThreadSafeObservableObject { - int _progress; - bool _waiting; - string _bottomText = "Initializing..."; + private int _progress; + private bool _waiting; + private string _bottomText = "Initializing..."; public event Action? ProgressChangedEvent; diff --git a/TCC.Core/UI/Windows/SystemMessagesConfigWindow.xaml.cs b/TCC.Core/UI/Windows/SystemMessagesConfigWindow.xaml.cs index 3b8812d9..41a71b84 100644 --- a/TCC.Core/UI/Windows/SystemMessagesConfigWindow.xaml.cs +++ b/TCC.Core/UI/Windows/SystemMessagesConfigWindow.xaml.cs @@ -64,18 +64,18 @@ public SystemMessagesConfigWindow() ?? throw new Exception("Failed to create LiveCollectionView"); } - void OnTitleBarMouseDown(object sender, MouseButtonEventArgs e) + private void OnTitleBarMouseDown(object sender, MouseButtonEventArgs e) { DragMove(); } - void OnCloseButtonClick(object sender, RoutedEventArgs e) + private void OnCloseButtonClick(object sender, RoutedEventArgs e) { Close(); } //TODO: use commands - void ExcludeMessage(object sender, RoutedEventArgs e) + private void ExcludeMessage(object sender, RoutedEventArgs e) { var msgVm = (SystemMessageViewModel) ((FrameworkElement) sender).DataContext; if (HiddenMessages.Any(x => x.Opcode == msgVm?.Opcode)) return; @@ -83,7 +83,7 @@ void ExcludeMessage(object sender, RoutedEventArgs e) ShowedMessages.Remove(msgVm); } - void RestoreMessage(object sender, RoutedEventArgs e) + private void RestoreMessage(object sender, RoutedEventArgs e) { var msgVm = (SystemMessageViewModel) ((FrameworkElement) sender).DataContext; if (HiddenMessages.All(x => x.Opcode != msgVm?.Opcode)) return; @@ -91,7 +91,7 @@ void RestoreMessage(object sender, RoutedEventArgs e) HiddenMessages.Remove(msgVm); } - void FilterShowedMessages(object sender, TextChangedEventArgs e) + private void FilterShowedMessages(object sender, TextChangedEventArgs e) { var view = (ICollectionView)ShowedMessagesView; view.Filter = o => @@ -103,7 +103,7 @@ void FilterShowedMessages(object sender, TextChangedEventArgs e) } - void FilterHiddenMessages(object sender, TextChangedEventArgs e) + private void FilterHiddenMessages(object sender, TextChangedEventArgs e) { var view = (ICollectionView)HiddenMessagesView; view.Filter = o => diff --git a/TCC.Core/UI/Windows/TccMessageBox.xaml.cs b/TCC.Core/UI/Windows/TccMessageBox.xaml.cs index ffe82fae..9544fd3e 100644 --- a/TCC.Core/UI/Windows/TccMessageBox.xaml.cs +++ b/TCC.Core/UI/Windows/TccMessageBox.xaml.cs @@ -16,25 +16,25 @@ namespace TCC.UI.Windows; //TODO: refactor and make multiple messageboxes public partial class TccMessageBox { - static TccMessageBox _messageBox = null!; - static MessageBoxResult _result = MessageBoxResult.No; + private static TccMessageBox _messageBox = null!; + private static MessageBoxResult _result = MessageBoxResult.No; public static bool IsOpen { get; set; } - TccMessageBox() + private TccMessageBox() { InitializeComponent(); Closing += OnClosing; } - void OnClosing(object? sender, CancelEventArgs e) + private void OnClosing(object? sender, CancelEventArgs e) { e.Cancel = true; Hide(); IsOpen = false; } - static MessageBoxResult Show (string caption, string msg, MessageBoxType type) + private static MessageBoxResult Show (string caption, string msg, MessageBoxType type) { return type switch { @@ -76,7 +76,7 @@ public static MessageBoxResult Show (string caption, string text, MessageBoxButt return _result; } - static void SetVisibilityOfButtons(MessageBoxButton button) + private static void SetVisibilityOfButtons(MessageBoxButton button) { _messageBox.BtnCancel.Visibility = Visibility.Visible; _messageBox.BtnNo.Visibility = Visibility.Visible; @@ -108,7 +108,7 @@ static void SetVisibilityOfButtons(MessageBoxButton button) } } - static void SetImageOfMessageBox(MessageBoxImage image) + private static void SetImageOfMessageBox(MessageBoxImage image) { //return; switch (image) @@ -125,7 +125,7 @@ static void SetImageOfMessageBox(MessageBoxImage image) } } - void Button_Click(object sender, RoutedEventArgs e) + private void Button_Click(object sender, RoutedEventArgs e) { if (ReferenceEquals(sender, BtnOk)) _result = MessageBoxResult.OK; @@ -147,7 +147,7 @@ void Button_Click(object sender, RoutedEventArgs e) }); } - void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue != true) return; BeginAnimation(OpacityProperty, new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200)) { EasingFunction = new QuadraticEase() }); @@ -157,7 +157,7 @@ void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e //RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(.5, 1, TimeSpan.FromMilliseconds(500)) { EasingFunction = new ElasticEase() { Oscillations = 1 } }); } - void BG_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private void BG_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragMove(); } diff --git a/TCC.Core/UI/Windows/TccSplashScreen.xaml.cs b/TCC.Core/UI/Windows/TccSplashScreen.xaml.cs index 1ee07482..007691ec 100644 --- a/TCC.Core/UI/Windows/TccSplashScreen.xaml.cs +++ b/TCC.Core/UI/Windows/TccSplashScreen.xaml.cs @@ -12,7 +12,7 @@ namespace TCC.UI.Windows; public partial class TccSplashScreen { - readonly DoubleAnimation _progressAnimation; + private readonly DoubleAnimation _progressAnimation; public SplashScreenViewModel VM { get; } public TccSplashScreen() { @@ -40,7 +40,7 @@ protected override void OnLoaded(object sender, RoutedEventArgs e) } } - void OnProgressChanged() + private void OnProgressChanged() { Dispatcher?.InvokeAsync(() => { diff --git a/TCC.Core/UI/Windows/TccWindow.cs b/TCC.Core/UI/Windows/TccWindow.cs index 09a821bb..3d7c367a 100644 --- a/TCC.Core/UI/Windows/TccWindow.cs +++ b/TCC.Core/UI/Windows/TccWindow.cs @@ -14,14 +14,14 @@ namespace TCC.UI.Windows; public class TccWindow : Window { - static readonly List _createdWindows = new(); + private static readonly List _createdWindows = new(); public event Action? Hidden; public event Action? Showed; - readonly bool _canClose; + private readonly bool _canClose; //readonly DoubleAnimation _showAnim; - readonly DoubleAnimation _hideAnim; + private readonly DoubleAnimation _hideAnim; public IntPtr Handle { get; private set; } diff --git a/TCC.Core/UI/Windows/WelcomeWindow.xaml.cs b/TCC.Core/UI/Windows/WelcomeWindow.xaml.cs index e02f6f91..7acb8d65 100644 --- a/TCC.Core/UI/Windows/WelcomeWindow.xaml.cs +++ b/TCC.Core/UI/Windows/WelcomeWindow.xaml.cs @@ -11,12 +11,12 @@ public WelcomeWindow() InitializeComponent(); } - void OnOkButtonClick(object sender, RoutedEventArgs e) + private void OnOkButtonClick(object sender, RoutedEventArgs e) { Close(); } - void OnWikiButtonClick(object sender, RoutedEventArgs e) + private void OnWikiButtonClick(object sender, RoutedEventArgs e) { try { @@ -28,7 +28,7 @@ void OnWikiButtonClick(object sender, RoutedEventArgs e) } } - void OnTeraDpsDiscordButtonClick(object sender, RoutedEventArgs e) + private void OnTeraDpsDiscordButtonClick(object sender, RoutedEventArgs e) { try { @@ -40,7 +40,7 @@ void OnTeraDpsDiscordButtonClick(object sender, RoutedEventArgs e) } } - void OnToolboxDiscordButtonClick(object sender, RoutedEventArgs e) + private void OnToolboxDiscordButtonClick(object sender, RoutedEventArgs e) { try { @@ -52,7 +52,7 @@ void OnToolboxDiscordButtonClick(object sender, RoutedEventArgs e) } } - void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.TryDragMove(); } diff --git a/TCC.Core/UI/Windows/Widgets/BuffWindow.cs b/TCC.Core/UI/Windows/Widgets/BuffWindow.cs index d8a735b4..71775941 100644 --- a/TCC.Core/UI/Windows/Widgets/BuffWindow.cs +++ b/TCC.Core/UI/Windows/Widgets/BuffWindow.cs @@ -1,6 +1,5 @@ using Nostrum.WPF.Extensions; using Nostrum.WPF.Factories; -using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -13,9 +12,8 @@ namespace TCC.UI.Windows.Widgets; public partial class BuffWindow { - readonly DoubleAnimation _opacityUp; - readonly DoubleAnimation _opacityDown; - readonly AbnormalityWindowViewModel _vm; + private readonly DoubleAnimation _opacityUp; + private readonly DoubleAnimation _opacityDown; public BuffWindow(AbnormalityWindowViewModel vm) { @@ -25,8 +23,7 @@ public BuffWindow(AbnormalityWindowViewModel vm) InitializeComponent(); - _vm = vm; - DataContext = _vm; + DataContext = vm; ButtonsRef = Buttons; MainContent = WindowContent; BoundaryRef = Boundary; @@ -37,7 +34,7 @@ public BuffWindow(AbnormalityWindowViewModel vm) OnDirectionChanged(); } - void OnDirectionChanged() + private void OnDirectionChanged() { Dispatcher?.InvokeAsync(() => { @@ -56,20 +53,20 @@ void OnDirectionChanged() }); } - void OnAbnormalityShapeChanged() + private void OnAbnormalityShapeChanged() { Buffs.RefreshTemplate(R.TemplateSelectors.PlayerAbnormalityTemplateSelector); Debuffs.RefreshTemplate(R.TemplateSelectors.PlayerAbnormalityTemplateSelector); InfBuffs.RefreshTemplate(R.TemplateSelectors.PlayerAbnormalityTemplateSelector); } - void OnWindowMouseEnter(object sender, MouseEventArgs e) + private void OnWindowMouseEnter(object sender, MouseEventArgs e) { SetAbnormalitiesVisibility(true); SettingsButton.BeginAnimation(OpacityProperty, _opacityUp); } - void OnWindowMouseLeave(object sender, MouseEventArgs e) + private void OnWindowMouseLeave(object sender, MouseEventArgs e) { SettingsButton.BeginAnimation(OpacityProperty, _opacityDown); Task.Delay(1000).ContinueWith(_ => Dispatcher.InvokeAsync(() => @@ -79,33 +76,12 @@ void OnWindowMouseLeave(object sender, MouseEventArgs e) })); } - void SetAbnormalitiesVisibility(bool visible) + private void SetAbnormalitiesVisibility(bool visible) { - var normal = _vm.Player.Buffs.ToSyncList() - .Where(x => x.CanBeHidden) - .ToArray(); - var perma = _vm.Player.InfBuffs.ToSyncList() - .Where(x => x.CanBeHidden) - .ToArray(); - var debuffs = _vm.Player.Debuffs.ToSyncList() - .Where(x => x.CanBeHidden) - .ToArray(); - - foreach (var abnormality in normal) - { - abnormality.IsHidden = !visible; - } - foreach (var abnormality in perma) - { - abnormality.IsHidden = !visible; - } - foreach (var abnormality in debuffs) - { - abnormality.IsHidden = !visible; - } + Game.Me.SetAbnormalitiesVisibility(visible); } - void OpenBuffSettings(object sender, RoutedEventArgs e) + private void OpenBuffSettings(object sender, RoutedEventArgs e) { if (TccWindow.Exists(typeof(MyAbnormalConfigWindow))) return; new MyAbnormalConfigWindow().Show(); diff --git a/TCC.Core/UI/Windows/Widgets/CharacterWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/CharacterWindow.xaml.cs index 5da1078b..c795f895 100644 --- a/TCC.Core/UI/Windows/Widgets/CharacterWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/CharacterWindow.xaml.cs @@ -13,12 +13,12 @@ namespace TCC.UI.Windows.Widgets; //TODO: refactor more? public partial class CharacterWindow { - readonly DoubleAnimation _hpAnim; - readonly DoubleAnimation _mpAnim; - readonly DoubleAnimation _stAnim; - readonly DoubleAnimation _shAnim; + private readonly DoubleAnimation _hpAnim; + private readonly DoubleAnimation _mpAnim; + private readonly DoubleAnimation _stAnim; + private readonly DoubleAnimation _shAnim; - CharacterWindowViewModel _vm { get; } + private CharacterWindowViewModel _vm { get; } public CharacterWindow(CharacterWindowViewModel vm) { @@ -40,7 +40,7 @@ public CharacterWindow(CharacterWindowViewModel vm) } - void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) + private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) { Action action; switch (e.PropertyName) @@ -54,7 +54,7 @@ void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) Dispatcher?.InvokeAsync(action, DispatcherPriority.DataBind); } - void ChangeHP() + private void ChangeHP() { _hpAnim.From = (HpGovernor.LayoutTransform as ScaleTransform)?.ScaleX; _hpAnim.To = _vm.Player.HpFactor; @@ -73,7 +73,7 @@ void ChangeHP() } } - void ChangeMP() + private void ChangeMP() { _mpAnim.From = ((ScaleTransform)MpGovernor.LayoutTransform).ScaleX; _mpAnim.To = _vm.Player.MpFactor; @@ -91,7 +91,7 @@ void ChangeMP() } } - void ChangeStamina() + private void ChangeStamina() { _stAnim.From = ((ScaleTransform)StGovernor.LayoutTransform).ScaleX; _stAnim.To = _vm.Player.StFactor; @@ -111,7 +111,7 @@ void ChangeStamina() } - void ChangeShield() + private void ChangeShield() { _shAnim.From = (ShGovernor.LayoutTransform as ScaleTransform)?.ScaleX; _shAnim.To = _vm.Player.ShieldFactor; diff --git a/TCC.Core/UI/Windows/Widgets/ChatWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/ChatWindow.xaml.cs index 2cda1e01..b5f584d6 100644 --- a/TCC.Core/UI/Windows/Widgets/ChatWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/ChatWindow.xaml.cs @@ -15,7 +15,7 @@ namespace TCC.UI.Windows.Widgets; public partial class ChatWindow { - bool _bottom = true; + private bool _bottom = true; public ChatViewModel VM { get; } public bool IsPaused => VM.Paused; @@ -40,7 +40,7 @@ public ChatWindow(ChatViewModel vm) ((ChatWindowSettings)WindowSettings).FadeoutChanged += () => VM.RefreshHideTimer(); } - void OnForceSizePosUpdate() + private void OnForceSizePosUpdate() { if (WindowSettings == null) return; @@ -57,7 +57,7 @@ public void UpdateSettings() Dispatcher?.InvokeAsync(() => { VM.UpdateSettings(Left, Top); }); } - void TabLoaded(object sender, RoutedEventArgs e) + private void TabLoaded(object sender, RoutedEventArgs e) { if (sender is not FrameworkElement s) return; var p = s.FindVisualParent(); @@ -67,7 +67,7 @@ void TabLoaded(object sender, RoutedEventArgs e) SetTopBorder(s); } - void OpenTabSettings(object sender, MouseButtonEventArgs e) + private void OpenTabSettings(object sender, MouseButtonEventArgs e) { if (sender is not FrameworkElement s) return; if (s.DataContext is not HeaderedItemViewModel dc) return; @@ -105,12 +105,12 @@ void OpenTabSettings(object sender, MouseButtonEventArgs e) } } - void OnIsDraggingChanged(object sender, RoutedPropertyChangedEventArgs e) + private void OnIsDraggingChanged(object sender, RoutedPropertyChangedEventArgs e) { VM.HandleIsDraggingChanged(e.NewValue, TabControl.GetOrderedHeaders()); } - void OnWindowMouseLeave(object sender, MouseEventArgs e) + private void OnWindowMouseLeave(object sender, MouseEventArgs e) { VM.MouseOver = false; VM.RefreshHideTimer(); @@ -118,30 +118,30 @@ void OnWindowMouseLeave(object sender, MouseEventArgs e) UpdateSettings(); } - void OnWindowMouseEnter(object sender, MouseEventArgs e) + private void OnWindowMouseEnter(object sender, MouseEventArgs e) { VM.MouseOver = true; VM.StopHideTimer(); } - void OnSettingsButtonClick(object sender, RoutedEventArgs e) + private void OnSettingsButtonClick(object sender, RoutedEventArgs e) { SettingsPopup.IsOpen = !SettingsPopup.IsOpen; } - void OnWindowPreviewMouseUp(object sender, MouseButtonEventArgs e) + private void OnWindowPreviewMouseUp(object sender, MouseButtonEventArgs e) { ChatManager.Instance.RemoveEmptyChatWindows(); UpdateSettings(); } - new void OnLoaded(object sender, RoutedEventArgs e) + private new void OnLoaded(object sender, RoutedEventArgs e) { base.OnLoaded(sender, e); TabControl.SelectedIndex = 0; } - void ItemsControl_OnMouseWheel(object sender, MouseWheelEventArgs e) + private void ItemsControl_OnMouseWheel(object sender, MouseWheelEventArgs e) { var sw = ((ItemsControl)sender).FindVisualChild(); if (sw == null) return; @@ -194,7 +194,7 @@ public void ScrollToMessage(Tab tab, ChatMessage msg) }); } - void TabChanged(object sender, SelectionChangedEventArgs e) + private void TabChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) return; var tabVm = (TabViewModel?)e.AddedItems[0]; @@ -220,13 +220,13 @@ void TabChanged(object sender, SelectionChangedEventArgs e) } } - void SetLines(object sender, MouseButtonEventArgs e) + private void SetLines(object sender, MouseButtonEventArgs e) { if (VM.CurrentTab != (Tab)((TabViewModel)((FrameworkElement)sender).DataContext).Content) return; SetTopBorder((FrameworkElement)sender); } - void SetTopBorder(FrameworkElement s) + private void SetTopBorder(FrameworkElement s) { var w = s.ActualWidth; var left = s.TransformToAncestor(this).Transform(new Point()).X; diff --git a/TCC.Core/UI/Windows/Widgets/CivilUnrestWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/CivilUnrestWindow.xaml.cs index 1e8b43bd..3e51550b 100644 --- a/TCC.Core/UI/Windows/Widgets/CivilUnrestWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/CivilUnrestWindow.xaml.cs @@ -8,7 +8,7 @@ namespace TCC.UI.Windows.Widgets; ///
public partial class CivilUnrestWindow { - readonly CivilUnrestViewModel _vm; + private readonly CivilUnrestViewModel _vm; public CivilUnrestWindow(CivilUnrestViewModel vm) @@ -22,7 +22,7 @@ public CivilUnrestWindow(CivilUnrestViewModel vm) Init(App.Settings.CivilUnrestWindowSettings); } - void OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + private void OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { _vm.CopyToClipboard(); } diff --git a/TCC.Core/UI/Windows/Widgets/DefaultNotificationControl.xaml.cs b/TCC.Core/UI/Windows/Widgets/DefaultNotificationControl.xaml.cs index 41534481..dbd8a24c 100644 --- a/TCC.Core/UI/Windows/Widgets/DefaultNotificationControl.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/DefaultNotificationControl.xaml.cs @@ -8,8 +8,8 @@ namespace TCC.UI.Windows.Widgets; public partial class DefaultNotificationControl { - readonly DispatcherTimer _duration; - readonly DoubleAnimation _anim; + private readonly DispatcherTimer _duration; + private readonly DoubleAnimation _anim; public DefaultNotificationControl() { @@ -33,19 +33,19 @@ protected override void OnSlideInCompleted(object? sender, EventArgs e) } - void OnDisposed() + private void OnDisposed() { OnTimeExpired(null, null); } - void OnTimeExpired(object? sender, EventArgs? e) + private void OnTimeExpired(object? sender, EventArgs? e) { _duration.Stop(); _duration.Tick -= OnTimeExpired; AnimateDismiss(); } - void AnimateDismiss() + private void AnimateDismiss() { Dispatcher?.InvokeAsync(() => { diff --git a/TCC.Core/UI/Windows/Widgets/FlightDurationWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/FlightDurationWindow.xaml.cs index 9341f9cf..15c4f4f8 100644 --- a/TCC.Core/UI/Windows/Widgets/FlightDurationWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/FlightDurationWindow.xaml.cs @@ -10,9 +10,9 @@ namespace TCC.UI.Windows.Widgets; public partial class FlightDurationWindow { - readonly DoubleAnimation _arcAn; - readonly DoubleAnimation _winShow; - readonly DoubleAnimation _winHide; + private readonly DoubleAnimation _arcAn; + private readonly DoubleAnimation _winShow; + private readonly DoubleAnimation _winHide; public FlightDurationWindow(FlightGaugeViewModel vm) { @@ -51,7 +51,7 @@ public FlightDurationWindow(FlightGaugeViewModel vm) }; } - FlightGaugeViewModel VM { get; set; } + private FlightGaugeViewModel VM { get; set; } public void SetEnergy(double val) { @@ -65,12 +65,12 @@ public void SetEnergy(double val) }); } - void OnCombatChanged() + private void OnCombatChanged() { if (Game.Combat) HideWindow(); } - void SetStacks() + private void SetStacks() { Dispatcher?.InvokeAsync(() => { @@ -81,12 +81,12 @@ void SetStacks() }); } - void HideWindow() + private void HideWindow() { BeginAnimation(OpacityProperty, _winHide); } - void ShowWindow() + private void ShowWindow() { Opacity = 0; BeginAnimation(OpacityProperty, _winShow); diff --git a/TCC.Core/UI/Windows/Widgets/FloatingButtonViewModel.cs b/TCC.Core/UI/Windows/Widgets/FloatingButtonViewModel.cs index 07db9546..c744f2e5 100644 --- a/TCC.Core/UI/Windows/Widgets/FloatingButtonViewModel.cs +++ b/TCC.Core/UI/Windows/Widgets/FloatingButtonViewModel.cs @@ -15,10 +15,10 @@ public class FloatingButtonViewModel : TccWindowViewModel { public event Action? NotificationsAdded; public event Action? NotificationsCleared; - bool _pendingNotifications; - int _pendingNotificationsAmount; - int _currPP; - int _maxPP; + private bool _pendingNotifications; + private int _pendingNotificationsAmount; + private int _currPP; + private int _maxPP; public bool PendingNotifications { @@ -66,7 +66,7 @@ public FloatingButtonViewModel(FloatingButtonWindowSettings settings) : base(set Game.Me.CoinsUpdated += OnCoinsUpdated; } - void OnCoinsUpdated() + private void OnCoinsUpdated() { InvokePropertyChanged(nameof(CoinsFactor)); InvokePropertyChanged(nameof(CurrCoins)); @@ -78,7 +78,7 @@ protected override void InstallHooks() PacketAnalyzer.Processor.Hook(OnFatigabilityPoint); } - void OnFatigabilityPoint(S_FATIGABILITY_POINT p) + private void OnFatigabilityPoint(S_FATIGABILITY_POINT p) { CurrPP = p.CurrFatigability; MaxPP = p.MaxFatigability; diff --git a/TCC.Core/UI/Windows/Widgets/FloatingButtonWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/FloatingButtonWindow.xaml.cs index b057d567..34238513 100644 --- a/TCC.Core/UI/Windows/Widgets/FloatingButtonWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/FloatingButtonWindow.xaml.cs @@ -13,19 +13,19 @@ namespace TCC.UI.Windows.Widgets; public partial class FloatingButtonWindow { - readonly DoubleAnimation _slideInAnim; - readonly DoubleAnimation _slideOutAnim; - readonly DoubleAnimation _bubbleAnim; - readonly DoubleAnimation _bubbleSlideIn; - readonly DoubleAnimation _bubbleSlideOut; - readonly ScaleTransform _bubbleScaleTransform; - readonly TranslateTransform _bubbleTranslateTransform; - readonly Timer _animRepeatTimer; + private readonly DoubleAnimation _slideInAnim; + private readonly DoubleAnimation _slideOutAnim; + private readonly DoubleAnimation _bubbleAnim; + private readonly DoubleAnimation _bubbleSlideIn; + private readonly DoubleAnimation _bubbleSlideOut; + private readonly ScaleTransform _bubbleScaleTransform; + private readonly TranslateTransform _bubbleTranslateTransform; + private readonly Timer _animRepeatTimer; - readonly DoubleAnimation _s1Anim; - readonly DoubleAnimation _s2Anim; - readonly DoubleAnimation _s3Anim; + private readonly DoubleAnimation _s1Anim; + private readonly DoubleAnimation _s2Anim; + private readonly DoubleAnimation _s3Anim; public FloatingButtonWindow(FloatingButtonViewModel vm) @@ -68,7 +68,7 @@ public FloatingButtonWindow(FloatingButtonViewModel vm) SettingsWindowViewModel.IntegratedGpuSleepWorkaroundChanged += OnIntegratedGpuSleepWorkaroundChanged; } - void OnIntegratedGpuSleepWorkaroundChanged() + private void OnIntegratedGpuSleepWorkaroundChanged() { Dispatcher.InvokeAsync(() => { @@ -77,14 +77,14 @@ void OnIntegratedGpuSleepWorkaroundChanged() }); } - void StartGradientAnimation() + private void StartGradientAnimation() { Stop1.BeginAnimation(GradientStop.OffsetProperty, _s1Anim); Stop2.BeginAnimation(GradientStop.OffsetProperty, _s2Anim); Stop3.BeginAnimation(GradientStop.OffsetProperty, _s3Anim); } - void StopGradientAnimation() + private void StopGradientAnimation() { Stop1.BeginAnimation(GradientStop.OffsetProperty, null); Stop2.BeginAnimation(GradientStop.OffsetProperty, null); @@ -112,7 +112,7 @@ protected override void OnVisibilityChanged() }); } - void OnNotificationsAdded() + private void OnNotificationsAdded() { Dispatcher?.InvokeAsync(() => { @@ -121,7 +121,7 @@ void OnNotificationsAdded() }); } - void OnNotificationsCleared() + private void OnNotificationsCleared() { Dispatcher?.InvokeAsync(() => { @@ -131,19 +131,19 @@ void OnNotificationsCleared() }); } - void AnimateBubble() + private void AnimateBubble() { _bubbleScaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, _bubbleAnim); _bubbleScaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, _bubbleAnim); } - void OnMouseEnter(object sender, MouseEventArgs e) + private void OnMouseEnter(object sender, MouseEventArgs e) { RootGrid.RenderTransform.BeginAnimation(TranslateTransform.XProperty, _slideInAnim); _bubbleTranslateTransform.BeginAnimation(TranslateTransform.XProperty, _bubbleSlideIn); } - void OnMouseLeave(object sender, MouseEventArgs e) + private void OnMouseLeave(object sender, MouseEventArgs e) { Task.Delay(1000).ContinueWith(_ => { diff --git a/TCC.Core/UI/Windows/Widgets/GroupWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/GroupWindow.xaml.cs index d9fbb308..840bbe27 100644 --- a/TCC.Core/UI/Windows/Widgets/GroupWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/GroupWindow.xaml.cs @@ -9,7 +9,7 @@ namespace TCC.UI.Windows.Widgets; public partial class GroupWindow { - readonly GroupWindowViewModel _vm; + private readonly GroupWindowViewModel _vm; public GroupWindow(GroupWindowViewModel vm) { @@ -23,39 +23,39 @@ public GroupWindow(GroupWindowViewModel vm) } //TODO: to commands in VM - void DisbandButtonClicked(object sender, RoutedEventArgs e) + private void DisbandButtonClicked(object sender, RoutedEventArgs e) { if(!_vm.AmILeader) return; StubInterface.Instance.StubClient.DisbandGroup(); //ProxyOld.DisbandParty(); } //TODO: to commands in VM - void ResetButtonClicked(object sender, RoutedEventArgs e) + private void ResetButtonClicked(object sender, RoutedEventArgs e) { if(!_vm.AmILeader) return; StubInterface.Instance.StubClient.ResetInstance(); //ProxyOld.ResetInstance(); } - void GroupWindow_OnMouseEnter(object sender, MouseEventArgs e) + private void GroupWindow_OnMouseEnter(object sender, MouseEventArgs e) { GroupButtonsSingle.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(300))); GroupButtons.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(300))); } - void GroupWindow_OnMouseLeave(object sender, MouseEventArgs e) + private void GroupWindow_OnMouseLeave(object sender, MouseEventArgs e) { GroupButtonsSingle.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(300)) { BeginTime = TimeSpan.FromMilliseconds(500) }); GroupButtons.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(300)) { BeginTime = TimeSpan.FromMilliseconds(500) }); } //TODO: to commands in VM - void LeaveParty(object sender, RoutedEventArgs e) + private void LeaveParty(object sender, RoutedEventArgs e) { StubInterface.Instance.StubClient.LeaveGroup(); //ProxyOld.LeaveParty(); } //TODO: to commands in VM - void ShowAbnormalSettings(object sender, RoutedEventArgs e) + private void ShowAbnormalSettings(object sender, RoutedEventArgs e) { new GroupAbnormalConfigWindow().ShowWindow(); //WindowManager.GroupAbnormalConfigWindow.ShowWindow(); diff --git a/TCC.Core/UI/Windows/Widgets/NotificationAreaViewModel.cs b/TCC.Core/UI/Windows/Widgets/NotificationAreaViewModel.cs index 5122c040..9262958d 100644 --- a/TCC.Core/UI/Windows/Widgets/NotificationAreaViewModel.cs +++ b/TCC.Core/UI/Windows/Widgets/NotificationAreaViewModel.cs @@ -16,8 +16,8 @@ namespace TCC.UI.Windows.Widgets; [UsedImplicitly] public class NotificationAreaViewModel : TccWindowViewModel { - static int _id; - readonly ConcurrentQueue _queue; + private static int _id; + private readonly ConcurrentQueue _queue; public ThreadSafeObservableCollection Notifications { get; } public NotificationAreaViewModel(WindowSettingsBase settings) : base(settings) @@ -33,7 +33,7 @@ protected override void InstallHooks() PacketAnalyzer.Sniffer.NewConnection += OnNewConnection; } - void OnNewConnection(Server srv) + private void OnNewConnection(Server srv) { Enqueue("TCC", SR.ConnectedToServer(srv.Name), NotificationType.Success, template: NotificationTemplate.Progress, @@ -51,7 +51,7 @@ void OnNewConnection(Server srv) //Log.N("TCC", SR.ConnectedToServer(srv.Name), NotificationType.Success, forcedId: 10241024); } - void OnLoginArbiter(C_LOGIN_ARBITER obj) + private void OnLoginArbiter(C_LOGIN_ARBITER obj) { var notif = GetNotification(10241024); if (notif == null) return; @@ -59,7 +59,7 @@ void OnLoginArbiter(C_LOGIN_ARBITER obj) notif.Dispose(3000); } - void CheckShow() + private void CheckShow() { _dispatcher.Invoke(() => { @@ -73,12 +73,12 @@ void CheckShow() }); } - bool Pass(NotificationInfoBase infoBase) + private bool Pass(NotificationInfoBase infoBase) { return Notifications.ToSyncList().All(n => n.Message != infoBase.Message); } - int Enqueue(string title, string message, NotificationType type, int secDuration = -1, NotificationTemplate template = NotificationTemplate.Default, int forcedId = -1) + private int Enqueue(string title, string message, NotificationType type, int secDuration = -1, NotificationTemplate template = NotificationTemplate.Default, int forcedId = -1) { _dispatcher.Invoke(() => { diff --git a/TCC.Core/UI/Windows/Widgets/NotificationControlBase.cs b/TCC.Core/UI/Windows/Widgets/NotificationControlBase.cs index d4fc24fc..f8d43102 100644 --- a/TCC.Core/UI/Windows/Widgets/NotificationControlBase.cs +++ b/TCC.Core/UI/Windows/Widgets/NotificationControlBase.cs @@ -56,13 +56,13 @@ protected virtual void OnSlideInCompleted(object? sender, EventArgs e) _root.Effect = _rootEffect; } - void OnShrinkFinished(object? sender, EventArgs e) + private void OnShrinkFinished(object? sender, EventArgs e) { if (_dc == null) return; WindowManager.ViewModels.NotificationAreaVM.DeleteNotification(_dc); } - void OnFadeFinished(object? sender, EventArgs e) + private void OnFadeFinished(object? sender, EventArgs e) { Dispatcher?.InvokeAsync(() => { diff --git a/TCC.Core/UI/Windows/Widgets/NotificationInfoBase.cs b/TCC.Core/UI/Windows/Widgets/NotificationInfoBase.cs index b6e012c2..fea0f44d 100644 --- a/TCC.Core/UI/Windows/Widgets/NotificationInfoBase.cs +++ b/TCC.Core/UI/Windows/Widgets/NotificationInfoBase.cs @@ -9,7 +9,7 @@ namespace TCC.UI.Windows.Widgets; public class ProgressNotificationInfo : NotificationInfoBase { - double _progress; + private double _progress; public double Progress { get => _progress; @@ -40,8 +40,8 @@ public class NotificationInfoBase : ThreadSafeObservableObject public event Action? Disposed; public event Action? Disposing; - string _message = ""; - NotificationType _notificationType; + private string _message = ""; + private NotificationType _notificationType; public int Id { get; } public string Title { get; } @@ -57,7 +57,7 @@ public NotificationType NotificationType set => RaiseAndSetIfChanged(value, ref _notificationType); } - bool _canClose; + private bool _canClose; public bool CanClose { diff --git a/TCC.Core/UI/Windows/Widgets/PerfMonitorWindow.xaml.cs b/TCC.Core/UI/Windows/Widgets/PerfMonitorWindow.xaml.cs index 6aa8c48d..ddc58394 100644 --- a/TCC.Core/UI/Windows/Widgets/PerfMonitorWindow.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/PerfMonitorWindow.xaml.cs @@ -17,12 +17,12 @@ public PerfMonitorWindow(PerfMonitorViewModel vm) Init(vm.Settings!); } - void PerfMonitorWindow_OnMouseEnter(object sender, MouseEventArgs e) + private void PerfMonitorWindow_OnMouseEnter(object sender, MouseEventArgs e) { ((PerfMonitorViewModel) DataContext).ShowDumpButton = true; } - void PerfMonitorWindow_OnMouseLeave(object sender, MouseEventArgs e) + private void PerfMonitorWindow_OnMouseLeave(object sender, MouseEventArgs e) { ((PerfMonitorViewModel) DataContext).ShowDumpButton = false; } diff --git a/TCC.Core/UI/Windows/Widgets/ProgressNotificationControl.xaml.cs b/TCC.Core/UI/Windows/Widgets/ProgressNotificationControl.xaml.cs index e3695e45..48c8061b 100644 --- a/TCC.Core/UI/Windows/Widgets/ProgressNotificationControl.xaml.cs +++ b/TCC.Core/UI/Windows/Widgets/ProgressNotificationControl.xaml.cs @@ -21,7 +21,7 @@ protected override void OnLoaded(object sender, RoutedEventArgs e) ((ProgressNotificationInfo)_dc).Disposing += OnNotificationDisposing; } - void OnNotificationDisposing(int duration) + private void OnNotificationDisposing(int duration) { Dispatcher?.Invoke(() => { @@ -30,7 +30,7 @@ void OnNotificationDisposing(int duration) }); } - void OnNotificationDisposed() + private void OnNotificationDisposed() { Dispatcher?.InvokeAsync(() => { diff --git a/TCC.Core/UI/Windows/Widgets/TccWidget.cs b/TCC.Core/UI/Windows/Widgets/TccWidget.cs index b1d21864..9fdf0493 100644 --- a/TCC.Core/UI/Windows/Widgets/TccWidget.cs +++ b/TCC.Core/UI/Windows/Widgets/TccWidget.cs @@ -20,18 +20,18 @@ namespace TCC.UI.Windows.Widgets; public class TccWidget : Window { - static bool _showBoundaries; - static bool _hidden; - static event Action? ShowBoundariesToggled; - static event Action? HiddenToggled; - static readonly List _activeWidgets = new(); - - readonly DoubleAnimation _opacityAnimation = AnimationFactory.CreateDoubleAnimation(100, 0); - readonly DoubleAnimation _hideButtonsAnimation = AnimationFactory.CreateDoubleAnimation(1000, 0); - readonly DoubleAnimation _showButtonsAnimation = AnimationFactory.CreateDoubleAnimation(150, 1); - readonly DispatcherTimer _buttonsTimer; + private static bool _showBoundaries; + private static bool _hidden; + private static event Action? ShowBoundariesToggled; + private static event Action? HiddenToggled; + private static readonly List _activeWidgets = new(); + + private readonly DoubleAnimation _opacityAnimation = AnimationFactory.CreateDoubleAnimation(100, 0); + private readonly DoubleAnimation _hideButtonsAnimation = AnimationFactory.CreateDoubleAnimation(1000, 0); + private readonly DoubleAnimation _showButtonsAnimation = AnimationFactory.CreateDoubleAnimation(150, 1); + private readonly DispatcherTimer _buttonsTimer; protected bool _canMove = true; - Point WindowCenter => new(Left + ActualWidth / 2, Top + ActualHeight / 2); + private Point WindowCenter => new(Left + ActualWidth / 2, Top + ActualHeight / 2); protected WindowButtons? ButtonsRef; protected UIElement? MainContent; @@ -113,12 +113,12 @@ protected void Init(WindowSettingsBase settings) } } - void OnHiddenToggled() + private void OnHiddenToggled() { OnVisibilityChanged(); } - void OnTeraScreenChanged(System.Drawing.Point oldPos, System.Drawing.Point newPos, Size size) + private void OnTeraScreenChanged(System.Drawing.Point oldPos, System.Drawing.Point newPos, Size size) { var op = new Point(oldPos.X, oldPos.Y); //sigh var np = new Point(newPos.X, newPos.Y); //sigh @@ -128,7 +128,7 @@ void OnTeraScreenChanged(System.Drawing.Point oldPos, System.Drawing.Point newPo ReloadPosition(); } - void ShowHideBoundaries() + private void ShowHideBoundaries() { var anim = _showBoundaries ? _showButtonsAnimation : _hideButtonsAnimation; Dispatcher?.InvokeAsync(() => @@ -167,26 +167,26 @@ public void ResetToCenter() }); } - void OnFocusTick() + private void OnFocusTick() { if (FocusManager.PauseTopmost) return; if (WindowSettings?.ShowAlways == true || WindowManager.VisibilityManager.ForceVisible) RefreshTopmost(); if (WindowManager.VisibilityManager.Visible) RefreshTopmost(); } - void OnWindowVisibilityChanged(bool visible) + private void OnWindowVisibilityChanged(bool visible) { SetVisibility(visible); } - void OnButtonsTimerTick(object? sender, EventArgs e) + private void OnButtonsTimerTick(object? sender, EventArgs e) { _buttonsTimer.Stop(); if (IsMouseOver || _showBoundaries) return; ButtonsRef?.BeginAnimation(OpacityProperty, _hideButtonsAnimation); } - void OnSizeChanged(object sender, SizeChangedEventArgs e) + private void OnSizeChanged(object sender, SizeChangedEventArgs e) { if (WindowSettings == null) return; if (!WindowSettings.AllowOffScreen) CheckBounds(); @@ -205,7 +205,7 @@ protected virtual void OnLoaded(object sender, RoutedEventArgs e) if (WindowSettings?.Enabled == false) Hide(); } - void OnDimChanged() + private void OnDimChanged() { if (!WindowManager.VisibilityManager.Visible) return; if (WindowSettings == null) return; @@ -256,7 +256,7 @@ protected virtual void OnVisibilityChanged() RefreshTopmost(); } - void OnClickThruModeChanged() + private void OnClickThruModeChanged() { if (_showBoundaries) { @@ -307,7 +307,7 @@ protected virtual void OnEnabledChanged(bool enabled) } } - void AnimateContentOpacity(double opacity) + private void AnimateContentOpacity(double opacity) { if (MainContent == null) return; Dispatcher?.InvokeAsync(() => @@ -318,7 +318,7 @@ void AnimateContentOpacity(double opacity) , DispatcherPriority.DataBind); } - void RefreshTopmost() + private void RefreshTopmost() { Dispatcher?.InvokeAsync(() => { @@ -328,7 +328,7 @@ void RefreshTopmost() }, DispatcherPriority.DataBind); } - void SetVisibility(bool v) + private void SetVisibility(bool v) { if (Dispatcher?.Thread.IsAlive == false) return; Dispatcher?.Invoke(() => @@ -338,7 +338,7 @@ void SetVisibility(bool v) }); } - void CheckBounds() + private void CheckBounds() { if (WindowSettings == null) return; @@ -351,7 +351,7 @@ void CheckBounds() SetRelativeCoordinates(); } - void CheckIndividualScreensBounds() + private void CheckIndividualScreensBounds() { if (IsWindowFullyVisible()) return; var nearestScreen = FindNearestScreen(); @@ -364,7 +364,7 @@ void CheckIndividualScreensBounds() else if (Left < nearestScreen.Bounds.X) Left = nearestScreen.Bounds.X; } - Screen FindNearestScreen() + private Screen FindNearestScreen() { var screenFromWinCenter = ScreenFromWindowCenter(); if (screenFromWinCenter != null) return screenFromWinCenter; @@ -383,7 +383,7 @@ Screen FindNearestScreen() } - bool IsWindowFullyVisible() + private bool IsWindowFullyVisible() { var tl = false; var tr = false; @@ -400,33 +400,33 @@ bool IsWindowFullyVisible() return tl && tr && bl && br; } - bool IsTopLeftCornerInScreen(Screen screen) + private bool IsTopLeftCornerInScreen(Screen screen) { return screen.Bounds.Contains(Convert.ToInt32(Left), Convert.ToInt32(Top)); } - bool IsBottomRightCornerInScreen(Screen screen) + private bool IsBottomRightCornerInScreen(Screen screen) { return screen.Bounds.Contains(Convert.ToInt32(Left + ActualWidth), Convert.ToInt32(Top + ActualHeight)); } - bool IsTopRightCornerInScreen(Screen screen) + private bool IsTopRightCornerInScreen(Screen screen) { return screen.Bounds.Contains(Convert.ToInt32(Left + ActualWidth), Convert.ToInt32(Top)); } - bool IsBottomLeftCornerInScreen(Screen screen) + private bool IsBottomLeftCornerInScreen(Screen screen) { return screen.Bounds.Contains(Convert.ToInt32(Left), Convert.ToInt32(Top + ActualHeight)); } - Screen? ScreenFromWindowCenter() + private Screen? ScreenFromWindowCenter() { return Screen.AllScreens.FirstOrDefault(x => x.Bounds.Contains(Convert.ToInt32(WindowCenter.X), Convert.ToInt32(WindowCenter.Y))); } - void UpdateButtons() + private void UpdateButtons() { if (ButtonsRef == null) return; @@ -475,7 +475,7 @@ protected void Drag(object sender, MouseButtonEventArgs e) App.Settings.Save(); } - void SetRelativeCoordinates() + private void SetRelativeCoordinates() { if (WindowSettings == null) return; diff --git a/TCC.Core/UI/Windows/Widgets/TccWidgetBuilder.cs b/TCC.Core/UI/Windows/Widgets/TccWidgetBuilder.cs index cbd6db0a..c33f695e 100644 --- a/TCC.Core/UI/Windows/Widgets/TccWidgetBuilder.cs +++ b/TCC.Core/UI/Windows/Widgets/TccWidgetBuilder.cs @@ -72,7 +72,7 @@ public TccWidgetBuilder(WindowSettingsBase? ws) Create(ws); } - void Create(WindowSettingsBase? ws) + private void Create(WindowSettingsBase? ws) { var thread = new Thread(() => { diff --git a/TCC.Core/Update/IconsUpdater.cs b/TCC.Core/Update/IconsUpdater.cs index 89b0a481..6781b1b8 100644 --- a/TCC.Core/Update/IconsUpdater.cs +++ b/TCC.Core/Update/IconsUpdater.cs @@ -18,10 +18,10 @@ namespace TCC.Update; public class IconsUpdater { - static string DownloadedIconsDir => Path.Combine(App.BasePath, "tera-used-icons-master"); - const string IconsUrl = "https://github.com/Foglio1024/tera-used-icons/archive/master.zip"; + private static string DownloadedIconsDir => Path.Combine(App.BasePath, "tera-used-icons-master"); + private const string IconsUrl = "https://github.com/Foglio1024/tera-used-icons/archive/master.zip"; - ProgressNotificationInfo? _n; + private ProgressNotificationInfo? _n; public async Task CheckForUpdates() { @@ -36,7 +36,7 @@ public async Task CheckForUpdates() } } - async Task CheckHashes() + private async Task CheckHashes() { string hashFile; try @@ -82,7 +82,7 @@ async Task CheckHashes() //Log.N("TCC icon updater", "All icons are up to date.", NotificationType.Success); } - async Task DownloadArchive() + private async Task DownloadArchive() { using var c = new HttpClientProgress(); @@ -129,7 +129,7 @@ async Task DownloadArchive() } } - void DownloadMissingIcons(List missing) + private void DownloadMissingIcons(List missing) { var idx = 1; var fails = 0; @@ -166,7 +166,7 @@ void DownloadMissingIcons(List missing) _n.Dispose(2000); } - void Extract() + private void Extract() { try { @@ -229,7 +229,7 @@ void Extract() } } - static void CleanTempIcons() + private static void CleanTempIcons() { try { diff --git a/TCC.Core/Update/OpcodeDownloader.cs b/TCC.Core/Update/OpcodeDownloader.cs index a087eae7..6da08685 100644 --- a/TCC.Core/Update/OpcodeDownloader.cs +++ b/TCC.Core/Update/OpcodeDownloader.cs @@ -17,7 +17,7 @@ public static bool DownloadSysmsgIfNotExist(uint version, string directory, int return DownloadSysmsg(version, directory, revision); } - static bool IsFileValid(string filename) + private static bool IsFileValid(string filename) { return File.Exists(filename); //if (!File.Exists(filename)) return false; @@ -53,7 +53,7 @@ static bool IsFileValid(string filename) //return false; } - static bool DownloadOpcode(uint version, string directory) + private static bool DownloadOpcode(uint version, string directory) { Directory.CreateDirectory(directory); var ret = false; @@ -109,13 +109,13 @@ public static bool DownloadSysmsg(uint version, string directory, int revision = return false; } - static void Download(string remote, string local) + private static void Download(string remote, string local) { using var client = MiscUtils.GetDefaultHttpClient(); client.DownloadFileAsync(remote, local).Wait(); } - static void DownloadJson(string remote, string filename, uint version) + private static void DownloadJson(string remote, string filename, uint version) { using var client = MiscUtils.GetDefaultHttpClient(); var req = client.GetStringAsync(remote); diff --git a/TCC.Core/Update/UpdateManager.cs b/TCC.Core/Update/UpdateManager.cs index 7edf92de..f154aef0 100644 --- a/TCC.Core/Update/UpdateManager.cs +++ b/TCC.Core/Update/UpdateManager.cs @@ -22,12 +22,12 @@ namespace TCC.Update; public static class UpdateManager { - const string AppVersionUrl = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/master/version"; - const string AppVersionBetaUrl = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/beta/version"; - static readonly string DatabaseHashFileUrl = $"https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/{(App.Beta ? "beta" : "master")}/database-hashes.json"; + private const string AppVersionUrl = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/master/version"; + private const string AppVersionBetaUrl = "https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/beta/version"; + private static readonly string DatabaseHashFileUrl = $"https://raw.githubusercontent.com/Foglio1024/Tera-custom-cooldowns/{(App.Beta ? "beta" : "master")}/database-hashes.json"; - static readonly Timer _checkTimer = new((App.ToolboxMode ? 2 : 10) * 60 * 1000); - static bool _waitingDownload = true; + private static readonly Timer _checkTimer = new((App.ToolboxMode ? 2 : 10) * 60 * 1000); + private static bool _waitingDownload = true; public static Dictionary DatabaseHashes { get; } = new(); public static bool UpdateAvailable { get; private set; } @@ -158,7 +158,7 @@ public static void TryDeleteUpdater() } //--------------------------------------------------------------------- - static async Task Update(string url) + private static async Task Update(string url) { using var c = new HttpClientProgress(); try @@ -195,7 +195,7 @@ await App.SplashScreen.Dispatcher.InvokeAsync(() => } } - static void DownloadServersFile() + private static void DownloadServersFile() { if (!Directory.Exists(App.DataPath)) Directory.CreateDirectory(App.DataPath); using var c = MiscUtils.GetDefaultHttpClient(); @@ -211,14 +211,14 @@ static void DownloadServersFile() } } - static void CheckTimer_Elapsed(object? sender, ElapsedEventArgs e) + private static void CheckTimer_Elapsed(object? sender, ElapsedEventArgs e) { _checkTimer.Stop(); CheckAppVersionPeriodic(); if (!UpdateAvailable) _checkTimer.Start(); } - static void CheckAppVersionPeriodic() + private static void CheckAppVersionPeriodic() { try { @@ -236,7 +236,7 @@ static void CheckAppVersionPeriodic() } } - static async Task DownloadDatabaseHashes() + private static async Task DownloadDatabaseHashes() { DatabaseHashes.Clear(); using var c = MiscUtils.GetDefaultHttpClient(); @@ -252,9 +252,9 @@ static async Task DownloadDatabaseHashes() } - class VersionParser + private class VersionParser { - Version Version => Version.Parse(NewVersionNumber); + private Version Version => Version.Parse(NewVersionNumber); public string NewVersionNumber { get; } public string NewVersionUrl { get; } diff --git a/TCC.Core/Utilities/ExceptionReportBuilder.cs b/TCC.Core/Utilities/ExceptionReportBuilder.cs index 98a2970e..c2f4a717 100644 --- a/TCC.Core/Utilities/ExceptionReportBuilder.cs +++ b/TCC.Core/Utilities/ExceptionReportBuilder.cs @@ -86,7 +86,7 @@ public static JObject BuildJsonCrashReport(Exception ex) return ret; } - static JObject BuildInnerExceptionJObject(Exception ex) + private static JObject BuildInnerExceptionJObject(Exception ex) { var ret = new JObject { @@ -101,7 +101,7 @@ static JObject BuildInnerExceptionJObject(Exception ex) return ret; } - static string GetStackTraceClrmd(ClrThread runtimeThread) + private static string GetStackTraceClrmd(ClrThread runtimeThread) { var sb = new StringBuilder(); foreach (var frame in runtimeThread.EnumerateStackTrace()) @@ -113,7 +113,7 @@ static string GetStackTraceClrmd(ClrThread runtimeThread) return sb.ToString(); } - static JArray GetThreadTraces() + private static JArray GetThreadTraces() { using var dataTarget = DataTarget.CreateSnapshotAndAttach(Process.GetCurrentProcess().Id); @@ -141,7 +141,7 @@ static JArray GetThreadTraces() return ret; } - static JValue BuildExceptionMessage(Exception ex) + private static JValue BuildExceptionMessage(Exception ex) { if (ex is Win32Exception w32ex) { diff --git a/TCC.Core/Utilities/GlobalExceptionHandler.cs b/TCC.Core/Utilities/GlobalExceptionHandler.cs index 5d5ec7eb..d59c49e7 100644 --- a/TCC.Core/Utilities/GlobalExceptionHandler.cs +++ b/TCC.Core/Utilities/GlobalExceptionHandler.cs @@ -19,7 +19,7 @@ namespace TCC.Utilities; public static class GlobalExceptionHandler { - static readonly int[] _excludedWin32codes = + private static readonly int[] _excludedWin32codes = [ 1816 // "Not enough quota" ]; @@ -30,7 +30,7 @@ public static void OnGlobalException(object sender, UnhandledExceptionEventArgs HandleGlobalException(e); } - static void HandleGlobalException(UnhandledExceptionEventArgs e) + private static void HandleGlobalException(UnhandledExceptionEventArgs e) { var ex = (Exception)e.ExceptionObject; var js = ExceptionReportBuilder.BuildJsonCrashReport(ex); @@ -85,7 +85,7 @@ static void HandleGlobalException(UnhandledExceptionEventArgs e) Environment.Exit(-1); } - static void WriteCrashReportToFile(JObject js, Exception ex) + private static void WriteCrashReportToFile(JObject js, Exception ex) { var sb = new StringBuilder(); sb.AppendLine($"id: {js["id"]}"); @@ -108,7 +108,7 @@ static void WriteCrashReportToFile(JObject js, Exception ex) Log.F(sb.ToString(), "crash.log"); } - static void UploadCrashReport(JObject js) + private static void UploadCrashReport(JObject js) { try { diff --git a/TCC.Core/Utilities/TccUtils.cs b/TCC.Core/Utilities/TccUtils.cs index 6342cbdd..0cc72d04 100644 --- a/TCC.Core/Utilities/TccUtils.cs +++ b/TCC.Core/Utilities/TccUtils.cs @@ -215,13 +215,13 @@ public static void CheckWindowNotify(string message, string title) } // TODO: move to nostrum - const uint StdOutputHandle = 0xFFFFFFF5; + private const uint StdOutputHandle = 0xFFFFFFF5; [DllImport("kernel32.dll")] - static extern IntPtr GetStdHandle(uint nStdHandle); + private static extern IntPtr GetStdHandle(uint nStdHandle); [DllImport("kernel32.dll")] - static extern void SetStdHandle(uint nStdHandle, IntPtr handle); + private static extern void SetStdHandle(uint nStdHandle, IntPtr handle); public static void CreateConsole() { diff --git a/TCC.Core/ViewModels/ChatManager.cs b/TCC.Core/ViewModels/ChatManager.cs index 12190169..49eca8aa 100644 --- a/TCC.Core/ViewModels/ChatManager.cs +++ b/TCC.Core/ViewModels/ChatManager.cs @@ -31,16 +31,16 @@ namespace TCC.ViewModels; [TccModule] public class ChatManager : TccWindowViewModel { - static ChatManager? _instance; + private static ChatManager? _instance; public static ChatManager Instance => _instance ??= new ChatManager(App.Settings.ChatSettings); public ChatMessageFactory Factory { get; } - readonly ConcurrentQueue _pauseQueue; - readonly List _privateMessagesCache; + private readonly ConcurrentQueue _pauseQueue; + private readonly List _privateMessagesCache; public readonly PrivateChatChannel[] PrivateChannels = new PrivateChatChannel[8]; - readonly object _lock = new(); + private readonly object _lock = new(); public event Action? NewMessage; public event Action? PrivateChannelJoined; @@ -60,7 +60,7 @@ public class ChatManager : TccWindowViewModel #endif public ThreadSafeObservableCollection LFGs { get; } - ChatManager(WindowSettingsBase settings) : base(settings) + private ChatManager(WindowSettingsBase settings) : base(settings) { _pauseQueue = new ConcurrentQueue(); _privateMessagesCache = new List(); @@ -89,7 +89,7 @@ public class ChatManager : TccWindowViewModel Log.NewChatMessage += OnLogChatMessage; } - void OnLogChatMessage(ChatChannel ch, string msg, string auth) + private void OnLogChatMessage(ChatChannel ch, string msg, string auth) { AddChatMessage(Factory.CreateMessage(ch, auth, msg)); } @@ -152,22 +152,22 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnPlayerChangeExp); } - void OnConnected(Server srv) + private void OnConnected(Server srv) { AddTccMessage($"Connected to {srv.Name}."); } - void OnDisconnected() + private void OnDisconnected() { AddTccMessage("Disconnected from the server."); } - void OnPartyMemberInfo(S_PARTY_MEMBER_INFO m) + private void OnPartyMemberInfo(S_PARTY_MEMBER_INFO m) { UpdateLfgMembers(m.Id, m.Members.Count); } - void OnPartyMatchLink(S_PARTY_MATCH_LINK m) + private void OnPartyMatchLink(S_PARTY_MATCH_LINK m) { Task.Run(() => { @@ -179,17 +179,17 @@ void OnPartyMatchLink(S_PARTY_MATCH_LINK m) }); } - void OnOtherUserApplyParty(S_OTHER_USER_APPLY_PARTY m) + private void OnOtherUserApplyParty(S_OTHER_USER_APPLY_PARTY m) { AddChatMessage(new ApplyMessage(m.PlayerId, m.Class, m.Level, m.Name, m.ServerId)); } - void OnTradeBrokerDealSuggested(S_TRADE_BROKER_DEAL_SUGGESTED m) + private void OnTradeBrokerDealSuggested(S_TRADE_BROKER_DEAL_SUGGESTED m) { AddChatMessage(new BrokerChatMessage(m.PlayerId, m.Listing, m.Item, m.Amount, m.SellerPrice, m.OfferedPrice, m.Name)); } - void OnWhisper(S_WHISPER m) + private void OnWhisper(S_WHISPER m) { var isMe = m.Author == Game.Me.Name; var author = isMe ? m.Recipient : m.Author; @@ -197,18 +197,18 @@ void OnWhisper(S_WHISPER m) AddChatMessage(Factory.CreateMessage(channel, author, m.Message, authorServerId: m.SenderServerId, isGm: m.IsGm, authorGameId: m.GameId)); } - void OnLeavePrivateChannel(S_LEAVE_PRIVATE_CHANNEL m) + private void OnLeavePrivateChannel(S_LEAVE_PRIVATE_CHANNEL m) { var i = PrivateChannels.FirstOrDefault(c => c.Id == m.Id).Index; PrivateChannels[i].Joined = false; } - void OnJoinPrivateChannel(S_JOIN_PRIVATE_CHANNEL m) + private void OnJoinPrivateChannel(S_JOIN_PRIVATE_CHANNEL m) { JoinPrivateChannel(m.Id, m.Index, m.Name); } - void OnPrivateChat(S_PRIVATE_CHAT m) + private void OnPrivateChat(S_PRIVATE_CHAT m) { // ignore these since they're handled differently //if (m.Message.Contains(":tcc-chatMode:") || m.Message.Contains(":tcc-uiMode:")) return; @@ -219,7 +219,7 @@ void OnPrivateChat(S_PRIVATE_CHAT m) AddChatMessage(Factory.CreateMessage(ch, m.AuthorName, m.Message, isGm: false, authorGameId: m.AuthorId)); } - void OnChat(S_CHAT m) + private void OnChat(S_CHAT m) { Task.Run(() => { @@ -227,7 +227,7 @@ void OnChat(S_CHAT m) }); } - void OnPlayerChangeExp(S_PLAYER_CHANGE_EXP m) + private void OnPlayerChangeExp(S_PLAYER_CHANGE_EXP m) { if (Game.Me.Level == 70) return; @@ -247,7 +247,7 @@ void OnPlayerChangeExp(S_PLAYER_CHANGE_EXP m) AddChatMessage(Factory.CreateMessage(ChatChannel.Exp, "System", msg)); } - void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) + private void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) { if (!App.Settings.ChatEnabled) return; if (!Game.IsMe(m.Target) @@ -259,7 +259,7 @@ void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) Task.Run(() => AddDamageReceivedMessage(m.Source, m.Target, m.Diff, m.MaxHP, m.Crit)); } - void InitWindows() + private void InitWindows() { ChatWindows.Clear(); App.Settings.ChatWindowsSettings.ToList().ForEach(s => @@ -326,7 +326,7 @@ public void ScrollToBottom() } - bool Filtered(ChatMessage message) + private bool Filtered(ChatMessage message) { if (!App.Settings.ChatEnabled) { @@ -387,7 +387,7 @@ public void AddSystemMessage(string template, SystemMessageData sysMsg, ChatChan Task.Run(() => AddChatMessage(Factory.CreateSystemMessage(template, sysMsg, channelOverride, authorOverride))); } - void AddLfgMessage(uint id, string name, string msg, uint serverId) + private void AddLfgMessage(uint id, string name, string msg, uint serverId) { if (!App.Settings.ChatEnabled) return; Task.Run(() => AddChatMessage(Factory.CreateLfgMessage(id, name, msg, serverId))); @@ -443,7 +443,7 @@ public void AddTccMessage(string message) AddChatMessage(msg); } - void AddDamageReceivedMessage(ulong source, ulong target, long diff, long maxHP, bool crit) + private void AddDamageReceivedMessage(ulong source, ulong target, long diff, long maxHP, bool crit) { var srcName = TccUtils.GetEntityName(source); var parameters = $"@0\vAmount\v{-diff}\vPerc\v{-diff / (double)maxHP:P}{(srcName != "" ? $"\vSource\v{srcName}" : "")}"; @@ -497,7 +497,7 @@ public void ClearMessages() //ChatMessages.Clear(); } - static bool Pass(ChatMessage current, ChatMessage old) + private static bool Pass(ChatMessage current, ChatMessage old) { if (current.Author == "System") return true; if (current.Author == Game.Me.Name) return true; @@ -537,13 +537,13 @@ static bool Pass(ChatMessage current, ChatMessage old) }; } - void JoinPrivateChannel(uint id, int index, string name) + private void JoinPrivateChannel(uint id, int index, string name) { Instance.PrivateChannels[index] = new PrivateChatChannel(id, name, index); PrivateChannelJoined?.Invoke(index); } - void OnPrivateChannelJoined(int index) + private void OnPrivateChannelJoined(int index) { var messagesToAdd = _privateMessagesCache.Where(x => x.Channel == PrivateChannels[index].Id).ToList(); messagesToAdd.ForEach(x => @@ -561,7 +561,7 @@ public void CachePrivateMessage(uint channel, string author, string message) _privateMessagesCache.Add(new TempPrivateMessage { Channel = channel, Author = author, Message = message }); } - static void OnChatWindowsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + private static void OnChatWindowsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { if (e.Action != NotifyCollectionChangedAction.Remove) return; if (e.OldItems?.Count == 0) return; @@ -570,7 +570,7 @@ static void OnChatWindowsCollectionChanged(object? sender, NotifyCollectionChang App.Settings.ChatWindowsSettings.Remove(ws); } - void OnChatMessagesCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + private void OnChatMessagesCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { if (e.Action != NotifyCollectionChangedAction.Add) return; //TODO @@ -580,7 +580,7 @@ void OnChatMessagesCollectionChanged(object? sender, NotifyCollectionChangedEven } } - void AddOrRefreshLfg(ListingData x) + private void AddOrRefreshLfg(ListingData x) { if (TryGetLfg(x.LeaderId, x.Message, x.LeaderName, out var lfg)) { @@ -606,7 +606,7 @@ public void RemoveDeadLfg() LastClickedLfg = null; } - bool TryGetLfg(uint id, string msg, string name, out Lfg? lfg) + private bool TryGetLfg(uint id, string msg, string name, out Lfg? lfg) { lfg = LFGs.ToSyncList().FirstOrDefault(x => x.Id == id); if (lfg != null) return true; @@ -616,7 +616,7 @@ bool TryGetLfg(uint id, string msg, string name, out Lfg? lfg) return lfg != null; } - void UpdateLfgMembers(uint id, int count) + private void UpdateLfgMembers(uint id, int count) { if (!TryGetLfg(id, "", "", out var lfg)) return; lfg!.MembersCount = count; @@ -634,7 +634,7 @@ public void ScrollToMessage(Tab tab, ChatMessage msg) win?.ScrollToMessage(tab, msg); } - void ToggleForcedClickThru() + private void ToggleForcedClickThru() { App.Settings.ChatWindowsSettings.ToSyncList().ForEach(s => { s.ForcedClickable = !s.ForcedClickable; }); if (App.Settings.ChatWindowsSettings.Count == 0) return; diff --git a/TCC.Core/ViewModels/ChatMessageFactory.cs b/TCC.Core/ViewModels/ChatMessageFactory.cs index cdd441ae..946ddc6c 100644 --- a/TCC.Core/ViewModels/ChatMessageFactory.cs +++ b/TCC.Core/ViewModels/ChatMessageFactory.cs @@ -8,7 +8,7 @@ namespace TCC.ViewModels; public class ChatMessageFactory { - readonly Dispatcher _dispatcher; + private readonly Dispatcher _dispatcher; public ChatMessageFactory(Dispatcher d) { _dispatcher = d; diff --git a/TCC.Core/ViewModels/ClassManagers/ArcherLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/ArcherLayoutViewModel.cs index e1ffdb00..d91b51cf 100644 --- a/TCC.Core/ViewModels/ClassManagers/ArcherLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/ArcherLayoutViewModel.cs @@ -6,7 +6,7 @@ namespace TCC.ViewModels.ClassManagers; public class ArcherLayoutViewModel : BaseClassLayoutViewModel { - bool _windWalkProc; + private bool _windWalkProc; public ArcherFocusTracker Focus { get; private set; } public Cooldown Thunderbolt { get; set; } diff --git a/TCC.Core/ViewModels/ClassManagers/BerserkerLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/BerserkerLayoutViewModel.cs index f460a3ef..29bb77a3 100644 --- a/TCC.Core/ViewModels/ClassManagers/BerserkerLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/BerserkerLayoutViewModel.cs @@ -6,7 +6,7 @@ namespace TCC.ViewModels.ClassManagers; public class BerserkerLayoutViewModel : BaseClassLayoutViewModel { - bool _isUnleashOn; + private bool _isUnleashOn; public SkillWithEffect FieryRage { get; set; } public SkillWithEffect Bloodlust { get; set; } diff --git a/TCC.Core/ViewModels/ClassManagers/BrawlerLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/BrawlerLayoutViewModel.cs index 4d58c36b..b5e30fae 100644 --- a/TCC.Core/ViewModels/ClassManagers/BrawlerLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/BrawlerLayoutViewModel.cs @@ -6,8 +6,8 @@ namespace TCC.ViewModels.ClassManagers; public class BrawlerLayoutViewModel : BaseClassLayoutViewModel { - bool _isGfOn; - bool _counterProc; + private bool _isGfOn; + private bool _counterProc; public SkillWithEffect GrowingFury { get; } public Cooldown Counter { get; } diff --git a/TCC.Core/ViewModels/ClassManagers/LancerLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/LancerLayoutViewModel.cs index 10969fc7..e8e70454 100644 --- a/TCC.Core/ViewModels/ClassManagers/LancerLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/LancerLayoutViewModel.cs @@ -43,7 +43,7 @@ protected override bool StartSpecialSkillImpl(Cooldown sk) return true; } - void OnDeath() + private void OnDeath() { LH.Stop(); GuardianShout.StopEffect(); diff --git a/TCC.Core/ViewModels/ClassManagers/MysticLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/MysticLayoutViewModel.cs index a9f7dc40..1275378f 100644 --- a/TCC.Core/ViewModels/ClassManagers/MysticLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/MysticLayoutViewModel.cs @@ -7,7 +7,7 @@ namespace TCC.ViewModels.ClassManagers; internal class MysticLayoutViewModel : BaseClassLayoutViewModel { - bool _elementalize; + private bool _elementalize; public AurasTracker Auras { get; } public Cooldown Contagion { get; } public SkillWithEffect Vow { get; } @@ -107,7 +107,7 @@ public override void Dispose() VolleyOfCurse.Dispose(); } - void CheckAurasWarning() + private void CheckAurasWarning() { AuraMerciless.FlashOnAvailable = Auras is { CritAura: false, SwiftAura: false }; AuraSwift.FlashOnAvailable = Auras is { CritAura: false, SwiftAura: false }; @@ -118,7 +118,7 @@ void CheckAurasWarning() InvokePropertyChanged(nameof(SupportAuraWarning)); } - void OnCombatChanged() + private void OnCombatChanged() { InvokePropertyChanged(nameof(ElementalizeWarning)); InvokePropertyChanged(nameof(OffenseAuraWarning)); @@ -126,16 +126,16 @@ void OnCombatChanged() CheckAurasWarning(); } - void OnVowBuffStarted(ulong cd, CooldownMode obj) => Vow.Cooldown.FlashOnAvailable = true; - void OnVowBuffEnded(CooldownMode obj) => Vow.Cooldown.FlashOnAvailable = true; + private void OnVowBuffStarted(ulong cd, CooldownMode obj) => Vow.Cooldown.FlashOnAvailable = true; + private void OnVowBuffEnded(CooldownMode obj) => Vow.Cooldown.FlashOnAvailable = true; - void OnVocRefreshed(ulong duration) + private void OnVocRefreshed(ulong duration) { VolleyOfCurse.RefreshEffect(duration); VolleyOfCurse.Cooldown.FlashOnAvailable = false; } - void OnVocExpired() + private void OnVocExpired() { VolleyOfCurse.StopEffect(); VolleyOfCurse.Cooldown.FlashOnAvailable = true; diff --git a/TCC.Core/ViewModels/ClassManagers/NinjaLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/NinjaLayoutViewModel.cs index 8d64d941..f6b9299d 100644 --- a/TCC.Core/ViewModels/ClassManagers/NinjaLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/NinjaLayoutViewModel.cs @@ -6,7 +6,7 @@ namespace TCC.ViewModels.ClassManagers; public class NinjaLayoutViewModel : BaseClassLayoutViewModel { - bool _focusOn; + private bool _focusOn; public Cooldown BurningHeart { get; set; } public Cooldown FireAvalanche { get; set; } @@ -18,7 +18,7 @@ public bool FocusOn set => RaiseAndSetIfChanged(value, ref _focusOn); } - void FlashOnMaxSt(object? sender, PropertyChangedEventArgs e) + private void FlashOnMaxSt(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName != nameof(StaminaTracker.Maxed)) return; BurningHeart.FlashOnAvailable = StaminaTracker.Maxed; diff --git a/TCC.Core/ViewModels/ClassManagers/PriestLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/PriestLayoutViewModel.cs index d40170b5..6c6556f4 100644 --- a/TCC.Core/ViewModels/ClassManagers/PriestLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/PriestLayoutViewModel.cs @@ -45,24 +45,24 @@ public PriestLayoutViewModel() AbnormalityTracker.MarkingRefreshed += OnTripleNemesisRefreshed; } - void OnTripleNemesisRefreshed(ulong duration) + private void OnTripleNemesisRefreshed(ulong duration) { TripleNemesis.RefreshEffect(duration); TripleNemesis.Cooldown.FlashOnAvailable = false; } - void OnTripleNemesisExpired() + private void OnTripleNemesisExpired() { TripleNemesis.StopEffect(); TripleNemesis.Cooldown.FlashOnAvailable = true; } - void OnGraceBuffEnded(CooldownMode obj) => Grace.Cooldown.FlashOnAvailable = true; - void OnGraceBuffStarted(ulong cd, CooldownMode obj) => Grace.Cooldown.FlashOnAvailable = false; - void OnEdictBuffEnded(CooldownMode obj) => EdictOfJudgment.Cooldown.FlashOnAvailable = true; - void OnEdictBuffStarted(ulong cd, CooldownMode obj) => EdictOfJudgment.Cooldown.FlashOnAvailable = false; + private void OnGraceBuffEnded(CooldownMode obj) => Grace.Cooldown.FlashOnAvailable = true; + private void OnGraceBuffStarted(ulong cd, CooldownMode obj) => Grace.Cooldown.FlashOnAvailable = false; + private void OnEdictBuffEnded(CooldownMode obj) => EdictOfJudgment.Cooldown.FlashOnAvailable = true; + private void OnEdictBuffStarted(ulong cd, CooldownMode obj) => EdictOfJudgment.Cooldown.FlashOnAvailable = false; protected override bool StartSpecialSkillImpl(Cooldown sk) { diff --git a/TCC.Core/ViewModels/ClassManagers/SorcererLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/SorcererLayoutViewModel.cs index 34604ceb..c56870ae 100644 --- a/TCC.Core/ViewModels/ClassManagers/SorcererLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/SorcererLayoutViewModel.cs @@ -8,8 +8,8 @@ namespace TCC.ViewModels.ClassManagers; public class SorcererLayoutViewModel : BaseClassLayoutViewModel { - readonly Stopwatch _sw; - long _latestCooldown; + private readonly Stopwatch _sw; + private long _latestCooldown; public SkillWithEffect ManaBoost { get; set; } @@ -20,7 +20,7 @@ public class SorcererLayoutViewModel : BaseClassLayoutViewModel public Skill FusionSkill { get; set; } public Skill FusionSkillBoost { get; set; } - Skill CurrentFusionSkill + private Skill CurrentFusionSkill { get { @@ -73,7 +73,7 @@ public SorcererLayoutViewModel() } - void OnBoostChanged(FusionElements elements) + private void OnBoostChanged(FusionElements elements) { Boosts = elements; } diff --git a/TCC.Core/ViewModels/ClassManagers/ValkyrieLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/ValkyrieLayoutViewModel.cs index 257881f8..a64931f2 100644 --- a/TCC.Core/ViewModels/ClassManagers/ValkyrieLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/ValkyrieLayoutViewModel.cs @@ -46,7 +46,7 @@ public ValkyrieLayoutViewModel() Ragnarok.Effect.SecondsUpdated += OnEffectSecondsUpdated; } - void OnEffectSecondsUpdated() + private void OnEffectSecondsUpdated() { InvokePropertyChanged(nameof(RagnarokEffectSecondsText)); } diff --git a/TCC.Core/ViewModels/ClassManagers/WarriorLayoutViewModel.cs b/TCC.Core/ViewModels/ClassManagers/WarriorLayoutViewModel.cs index fc130b47..38c496ee 100644 --- a/TCC.Core/ViewModels/ClassManagers/WarriorLayoutViewModel.cs +++ b/TCC.Core/ViewModels/ClassManagers/WarriorLayoutViewModel.cs @@ -22,7 +22,7 @@ public class WarriorLayoutViewModel : BaseClassLayoutViewModel public Counter EdgeCounter { get; set; } = new(10, true); public StanceTracker StanceTracker { get; } = new(); - bool _warningStance; + private bool _warningStance; public bool WarningStance { @@ -100,7 +100,7 @@ protected override bool StartSpecialSkillImpl(Cooldown sk) return false; } - void CheckStanceWarning() + private void CheckStanceWarning() { WarningStance = StanceTracker.CurrentStance == WarriorStance.None && Game.Combat; } @@ -137,7 +137,7 @@ public void SetStance(WarriorStance stance) CheckStanceWarning(); } - void OnDeath() + private void OnDeath() { DeadlyGamble.StopEffect(); } diff --git a/TCC.Core/ViewModels/DailyEvent.cs b/TCC.Core/ViewModels/DailyEvent.cs index 2cdd35f6..d221416e 100644 --- a/TCC.Core/ViewModels/DailyEvent.cs +++ b/TCC.Core/ViewModels/DailyEvent.cs @@ -5,12 +5,12 @@ namespace TCC.ViewModels; public class DailyEvent : ThreadSafeObservableObject { - DateTime Start { get; set; } - TimeSpan Duration { get; set; } - readonly TimeSpan _realDuration; + private DateTime Start { get; set; } + private TimeSpan Duration { get; set; } + private readonly TimeSpan _realDuration; public double StartFactor => 60 * (Start.Hour * 60 + Start.Minute) / GameEventManager.SecondsInDay; public double DurationFactor => Duration.TotalSeconds / GameEventManager.SecondsInDay; - bool _happened; + private bool _happened; public bool IsClose { get diff --git a/TCC.Core/ViewModels/DashboardViewModel.cs b/TCC.Core/ViewModels/DashboardViewModel.cs index db436e54..2d2c205e 100644 --- a/TCC.Core/ViewModels/DashboardViewModel.cs +++ b/TCC.Core/ViewModels/DashboardViewModel.cs @@ -41,14 +41,14 @@ public class DashboardViewModel : TccWindowViewModel { /* -- Fields ----------------------------------------------- */ - bool _discardFirstVanguardPacket = true; - ICollectionViewLiveShaping? _sortedColumns; - ObservableCollection? _columns; - Character? _selectedCharacter; - readonly object _lock = new(); - readonly Timer _tabFlushTimer; - readonly List> _pendingTabs; - bool _showDetails; + private bool _discardFirstVanguardPacket = true; + private ICollectionViewLiveShaping? _sortedColumns; + private ObservableCollection? _columns; + private Character? _selectedCharacter; + private readonly object _lock = new(); + private readonly Timer _tabFlushTimer; + private readonly List> _pendingTabs; + private bool _showDetails; /* -- Properties ------------------------------------------- */ @@ -62,7 +62,7 @@ public Character? SelectedCharacter public bool ShowElleonMarks => App.Settings.LastLanguage.Contains("EU"); - ThreadSafeObservableCollection _characters { get; } + private ThreadSafeObservableCollection _characters { get; } public ICollectionViewLiveShaping SortedCharacters { get; } public ICollectionViewLiveShaping HiddenCharacters { get; } public ICollectionViewLiveShaping SortedColumns// { get; } @@ -141,7 +141,7 @@ public ThreadSafeObservableCollection CharacterViewModels //} } - void SyncViewModel(object? sender, NotifyCollectionChangedEventArgs e) + private void SyncViewModel(object? sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { @@ -200,7 +200,7 @@ public string InventoryFilter } } - void FilterInventory() + private void FilterInventory() { var view = (ICollectionView?)SelectedCharacterInventory; if (view == null) return; @@ -214,8 +214,8 @@ void FilterInventory() } /* -- Constructor ------------------------------------------ */ - bool _loaded; - string _inventoryFilter = ""; + private bool _loaded; + private string _inventoryFilter = ""; public DashboardViewModel(WindowSettingsBase? settings) : base(settings) { @@ -310,7 +310,7 @@ [new SortDescription($"{nameof(CharacterViewModel.Character)}.{nameof(Character. // new[] { new SortDescription($"{nameof(Dungeon)}.{nameof(Dungeon.Index)}", ListSortDirection.Ascending) }); } - void OnTabFlushTimerElapsed(object? sender, ElapsedEventArgs e) + private void OnTabFlushTimerElapsed(object? sender, ElapsedEventArgs e) { try { @@ -342,7 +342,7 @@ void OnTabFlushTimerElapsed(object? sender, ElapsedEventArgs e) } } - void OnShowDashboardHotkeyPressed() + private void OnShowDashboardHotkeyPressed() { if (WindowManager.DashboardWindow.IsVisible) WindowManager.DashboardWindow.HideWindow(); else WindowManager.DashboardWindow.ShowWindow(); @@ -376,7 +376,7 @@ public void SaveCharacters() }); } - void LoadCharacters() + private void LoadCharacters() { try { @@ -510,13 +510,13 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnDungeonClearCountList); } - void OnDisconnected() + private void OnDisconnected() { UpdateBuffs(); SaveCharacters(); } - void OnDungeonClearCountList(S_DUNGEON_CLEAR_COUNT_LIST m) + private void OnDungeonClearCountList(S_DUNGEON_CLEAR_COUNT_LIST m) { if (CurrentCharacter == null) return; if (m.Failed) return; @@ -527,28 +527,28 @@ void OnDungeonClearCountList(S_DUNGEON_CLEAR_COUNT_LIST m) } } - void OnAvailableEventMatchingList(S_AVAILABLE_EVENT_MATCHING_LIST m) + private void OnAvailableEventMatchingList(S_AVAILABLE_EVENT_MATCHING_LIST m) { SetVanguard(m.WeeklyDone,m.WeeklyMax, m.DailyDone, m.VanguardCredits); } - void OnDungeonCoolTimeList(S_DUNGEON_COOL_TIME_LIST m) + private void OnDungeonCoolTimeList(S_DUNGEON_COOL_TIME_LIST m) { SetDungeons(m.DungeonCooldowns); } - void OnReturnToLobby(S_RETURN_TO_LOBBY m) + private void OnReturnToLobby(S_RETURN_TO_LOBBY m) { UpdateBuffs(); } - void OnLogin(S_LOGIN m) + private void OnLogin(S_LOGIN m) { SetLoggedIn(m.PlayerId); SetGuildBamTime(false); } - void OnGetUserList(S_GET_USER_LIST m) + private void OnGetUserList(S_GET_USER_LIST m) { try { @@ -561,7 +561,7 @@ void OnGetUserList(S_GET_USER_LIST m) Dispatcher.BeginInvoke(SaveCharacters); } - void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) + private void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) { if (CurrentCharacter == null) return; CurrentCharacter.Coins = m.Coins; @@ -570,7 +570,7 @@ void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) CurrentCharacter.Level = m.Level; } - void OnItemList(S_ITEMLIST m) + private void OnItemList(S_ITEMLIST m) { if (m.Failed || m.Container == 14) return; lock (_lock) @@ -583,7 +583,7 @@ void OnItemList(S_ITEMLIST m) //UpdateInventory(m.Items); } - void OnNpcGuildList(S_NPCGUILD_LIST m) + private void OnNpcGuildList(S_NPCGUILD_LIST m) { if (!Game.IsMe(m.UserId)) return; m.NpcGuildList.Keys.ToList() @@ -601,7 +601,7 @@ void OnNpcGuildList(S_NPCGUILD_LIST m) }); } - void OnUpdateNpcGuild(S_UPDATE_NPCGUILD m) + private void OnUpdateNpcGuild(S_UPDATE_NPCGUILD m) { switch (m.Guild) { @@ -617,7 +617,7 @@ void OnUpdateNpcGuild(S_UPDATE_NPCGUILD m) /* -- TODO EVENTS: TO BE REFACTORED ------------------------- */ - readonly object _eventLock = new object(); + private readonly object _eventLock = new object(); public ThreadSafeObservableCollection EventGroups { get; } public ThreadSafeObservableCollection Markers { get; } public ThreadSafeObservableCollection SpecialEvents { get; } @@ -639,7 +639,7 @@ public void ClearEvents() SpecialEvents.Clear(); } - void LoadEventFile(DayOfWeek today, string region) + private void LoadEventFile(DayOfWeek today, string region) { var yesterday = today - 1; if (region.StartsWith("EU")) region = "EU"; diff --git a/TCC.Core/ViewModels/GroupAbnormalityViewModel.cs b/TCC.Core/ViewModels/GroupAbnormalityViewModel.cs index 1455a35b..8d94a0d7 100644 --- a/TCC.Core/ViewModels/GroupAbnormalityViewModel.cs +++ b/TCC.Core/ViewModels/GroupAbnormalityViewModel.cs @@ -9,7 +9,7 @@ namespace TCC.ViewModels; public class GroupAbnormalityViewModel : ThreadSafeObservableObject { - bool _hidden; + private bool _hidden; public bool Hidden { diff --git a/TCC.Core/ViewModels/GroupConfigVM.cs b/TCC.Core/ViewModels/GroupConfigVM.cs index 67afdf62..e5780f49 100644 --- a/TCC.Core/ViewModels/GroupConfigVM.cs +++ b/TCC.Core/ViewModels/GroupConfigVM.cs @@ -53,7 +53,7 @@ public GroupConfigVM() AbnormalitiesView.Filter = null; } //to keep view referenced - void OnAbnormalitiesViewOnCurrentChanged(object? s, EventArgs ev) + private void OnAbnormalitiesViewOnCurrentChanged(object? s, EventArgs ev) { } } \ No newline at end of file diff --git a/TCC.Core/ViewModels/LaurelSelectionViewModel.cs b/TCC.Core/ViewModels/LaurelSelectionViewModel.cs index 774db2a9..44ae528d 100644 --- a/TCC.Core/ViewModels/LaurelSelectionViewModel.cs +++ b/TCC.Core/ViewModels/LaurelSelectionViewModel.cs @@ -13,7 +13,7 @@ namespace TCC.ViewModels; internal class LaurelSelectionViewModel : ObservableObject { - CustomLaurel _currentLaurel; + private CustomLaurel _currentLaurel; public CustomLaurel CurrentLaurel { @@ -29,7 +29,7 @@ public CustomLaurel CurrentLaurel public readonly List AvailableLaurels = Enum.GetValues().ToList(); - int _laurelIdx; + private int _laurelIdx; public LaurelSelectionViewModel(Class cl, CustomLaurel selectedLaurel) { @@ -45,7 +45,7 @@ public LaurelSelectionViewModel(Class cl, CustomLaurel selectedLaurel) ConfirmCommand = new RelayCommand(Confirm); } - void Confirm() + private void Confirm() { var settings = (CharacterWindowSettings?)WindowManager.ViewModels.CharacterVM.Settings; if(settings != null) settings.CustomLaurel = CurrentLaurel; @@ -55,7 +55,7 @@ void Confirm() win?.Close(); } - void PrevLaurel() + private void PrevLaurel() { if (_laurelIdx == 0) _laurelIdx = AvailableLaurels.Count - 1; else _laurelIdx--; @@ -63,7 +63,7 @@ void PrevLaurel() CurrentLaurel = AvailableLaurels[_laurelIdx]; } - void NextLaurel() + private void NextLaurel() { if (_laurelIdx == AvailableLaurels.Count - 1) _laurelIdx = 0; else _laurelIdx++; diff --git a/TCC.Core/ViewModels/LfgListViewModel.cs b/TCC.Core/ViewModels/LfgListViewModel.cs index a2becfd2..78389e99 100644 --- a/TCC.Core/ViewModels/LfgListViewModel.cs +++ b/TCC.Core/ViewModels/LfgListViewModel.cs @@ -42,19 +42,19 @@ public class LfgListViewModel : TccWindowViewModel #endregion Events // ReSharper disable once NotAccessedField.Local - DispatcherTimer _requestTimer; + private DispatcherTimer _requestTimer; - readonly DispatcherTimer AutoPublicizeTimer; - static readonly Queue<(uint, uint)> _requestQueue = new(); - bool _creating; - bool _creatingRaid; - int _lastGroupSize; + private readonly DispatcherTimer AutoPublicizeTimer; + private static readonly Queue<(uint, uint)> _requestQueue = new(); + private bool _creating; + private bool _creatingRaid; + private int _lastGroupSize; public Listing? LastClicked; - string _newMessage = ""; - bool _isPopupOpen; - bool _isAutoPublicizeEnabled; - bool _stopAuto; - int _actualListingsAmount; + private string _newMessage = ""; + private bool _isPopupOpen; + private bool _isAutoPublicizeEnabled; + private bool _stopAuto; + private int _actualListingsAmount; public string LastSortDescr { get; set; } = "Message"; public int PublicizeCooldown => 5; @@ -121,7 +121,7 @@ public string NewMessage } } - bool _amIinLfg; + private bool _amIinLfg; public bool AmIinLfg { get => _amIinLfg; @@ -132,7 +132,7 @@ public bool AmIinLfg || (MyLfg != null && MyLfg?.LeaderId == Game.Me.PlayerId); - Listing? _myLfg; + private Listing? _myLfg; public Listing? MyLfg { get => _myLfg; @@ -237,7 +237,7 @@ public LfgListViewModel(LfgWindowSettings settings) : base(settings) ConfigureBlacklistCommand = new RelayCommand(_ => ConfigureBlacklist()); } - void ConfigureBlacklist() + private void ConfigureBlacklist() { FocusManager.PauseTopmost = true; new LfgFilterConfigWindow(this) @@ -258,7 +258,7 @@ void ConfigureBlacklist() StubInterface.Instance.StubClient.RequestListings(App.Settings.LfgWindowSettings.MinLevel, App.Settings.LfgWindowSettings.MaxLevel); } - void OnBlacklistedWordsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + private void OnBlacklistedWordsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { @@ -285,22 +285,22 @@ void OnBlacklistedWordsCollectionChanged(object? sender, NotifyCollectionChanged } } - void CollapseAll() + private void CollapseAll() { Listings.ToSyncList().ForEach(l => l.ExpandCollapseCommand.Execute(false)); } - void ExpandAll() + private void ExpandAll() { Listings.ToSyncList().ForEach(l => l.ExpandCollapseCommand.Execute(true)); } - bool CanCreateMessage() + private bool CanCreateMessage() { return Listings.ToSyncList().All(l => !l.Temp && !AmIinLfg); } - void CreateMessage() + private void CreateMessage() { var listing = new Listing(new ListingData { @@ -315,14 +315,14 @@ void CreateMessage() TempLfgCreated?.Invoke(); } - void RemoveMessage() + private void RemoveMessage() { ForceStopPublicize(); StubInterface.Instance.StubClient.RemoveListing(); StubInterface.Instance.StubClient.RequestListings(App.Settings.LfgWindowSettings.MinLevel, App.Settings.LfgWindowSettings.MaxLevel); } - void OnShowLfgHotkeyPressed() + private void OnShowLfgHotkeyPressed() { if (!Game.Logged) return; if (!StubInterface.Instance.IsStubAvailable) return; @@ -331,7 +331,7 @@ void OnShowLfgHotkeyPressed() else WindowManager.LfgListWindow.HideWindow(); } - void OnAutoPublicizeTimerTick(object? sender, EventArgs e) + private void OnAutoPublicizeTimerTick(object? sender, EventArgs e) { if (Game.IsInDungeon || !AmIinLfg) _stopAuto = true; @@ -350,7 +350,7 @@ void OnAutoPublicizeTimerTick(object? sender, EventArgs e) } } - void Publicize() + private void Publicize() { if (Game.IsInDungeon) return; //PublicizeTimer.Start(); @@ -360,12 +360,12 @@ void Publicize() Publicized?.Invoke(PublicizeCooldown); } - bool CanPublicize() + private bool CanPublicize() { return /*IsPublicizeEnabled &&*/ !IsAutoPublicizeRunning; } - void ToggleAutoPublicize() + private void ToggleAutoPublicize() { if (IsAutoPublicizeRunning) { @@ -399,7 +399,7 @@ void ToggleAutoPublicize() } } - bool CanToggleAutoPublicize() + private bool CanToggleAutoPublicize() { if (!IsAutoPublicizeEnabled) { @@ -412,7 +412,7 @@ bool CanToggleAutoPublicize() return StubInterface.Instance.IsStubAvailable; } - void RequestNextLfg(object? sender, EventArgs e) + private void RequestNextLfg(object? sender, EventArgs e) { if (!App.Settings.LfgWindowSettings.Enabled) return; if (_requestQueue.Count == 0) return; @@ -439,7 +439,7 @@ public void EnqueueRequest(uint playerId, uint serverId) }, DispatcherPriority.Background); } - void ListingsOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + private void ListingsOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { Task.Delay(500).ContinueWith(_ => _dispatcher.Invoke(NotifyMyLfg)); } @@ -467,7 +467,7 @@ public void ForceStopPublicize() InvokePropertyChanged(nameof(IsAutoPublicizeRunning)); //notify UI that CanPublicize changed } - void SyncListings(List listings) + private void SyncListings(List listings) { Task.Factory.StartNew(() => { @@ -519,7 +519,7 @@ public void AddOrRefreshListing(Listing l) } } - bool IsMessageBlacklisted(string lMessage) + private bool IsMessageBlacklisted(string lMessage) { var words = lMessage.Split(" "); return words.Any(w => @@ -527,12 +527,12 @@ bool IsMessageBlacklisted(string lMessage) w.ToLowerInvariant().Contains(b.ToLowerInvariant()))); } - void AddOrRefreshListing(ListingData l) + private void AddOrRefreshListing(ListingData l) { AddOrRefreshListing(new Listing(l)); } - void OnHideTradeChanged() + private void OnHideTradeChanged() { if (!((LfgWindowSettings)Settings!).HideTradeListings) return; var toRemove = Listings.ToSyncList().Where(l => l.IsTrade).Select(s => s.LeaderId).ToList(); @@ -543,7 +543,7 @@ void OnHideTradeChanged() }); } - void NotifyMyLfg() + private void NotifyMyLfg() { MyLfg = Listings.ToSyncList().FirstOrDefault(listing => // a lfg containing a player with my id @@ -592,13 +592,13 @@ protected override void RemoveHooks() #region Hooks - void OnLogin(S_LOGIN m) + private void OnLogin(S_LOGIN m) { //Listings.Clear(); EnqueueListRequest(); // need invoke? } - void OnShowCandidateList(S_SHOW_CANDIDATE_LIST p) + private void OnShowCandidateList(S_SHOW_CANDIDATE_LIST p) { if (MyLfg == null) return; @@ -611,7 +611,7 @@ void OnShowCandidateList(S_SHOW_CANDIDATE_LIST p) toRemove.ForEach(r => dest.Remove(r)); } - void OnPartyMemberInfo(S_PARTY_MEMBER_INFO m) + private void OnPartyMemberInfo(S_PARTY_MEMBER_INFO m) { //if (!App.Settings.LfgWindowSettings.Enabled) return; try @@ -683,17 +683,17 @@ void OnPartyMemberInfo(S_PARTY_MEMBER_INFO m) } } - void OnLeaveParty(S_LEAVE_PARTY m) + private void OnLeaveParty(S_LEAVE_PARTY m) { NotifyMyLfg(); } - void OnBanParty(S_BAN_PARTY m) + private void OnBanParty(S_BAN_PARTY m) { NotifyMyLfg(); } - void OnPartyMemberList(S_PARTY_MEMBER_LIST m) + private void OnPartyMemberList(S_PARTY_MEMBER_LIST m) { if (_lastGroupSize == 0) NotifyMyLfg(); _lastGroupSize = m.Members.Count; @@ -704,7 +704,7 @@ void OnPartyMemberList(S_PARTY_MEMBER_LIST m) StubInterface.Instance.StubClient.RequestListings(App.Settings.LfgWindowSettings.MinLevel, App.Settings.LfgWindowSettings.MaxLevel); } - void OnOtherUserApplyParty(S_OTHER_USER_APPLY_PARTY m) + private void OnOtherUserApplyParty(S_OTHER_USER_APPLY_PARTY m) { //if (!App.Settings.LfgWindowSettings.Enabled) return; if (MyLfg == null) return; @@ -721,7 +721,7 @@ void OnOtherUserApplyParty(S_OTHER_USER_APPLY_PARTY m) }); } - void OnShowPartyMatchInfo(S_SHOW_PARTY_MATCH_INFO m) + private void OnShowPartyMatchInfo(S_SHOW_PARTY_MATCH_INFO m) { if (!m.IsLast && StubInterface.Instance.IsStubAvailable && m.Page <= m.Pages) StubInterface.Instance.StubClient.RequestListingsPage(m.Page + 1); @@ -745,12 +745,12 @@ void OnShowPartyMatchInfo(S_SHOW_PARTY_MATCH_INFO m) //Dispatcher?.InvokeAsync(RefreshSorting, DispatcherPriority.Background); } - void OnChangePartyManager(S_CHANGE_PARTY_MANAGER obj) + private void OnChangePartyManager(S_CHANGE_PARTY_MANAGER obj) { InvokePropertyChanged(nameof(AmILeader)); } - void OnReturnToLobby(S_RETURN_TO_LOBBY m) + private void OnReturnToLobby(S_RETURN_TO_LOBBY m) { ForceStopPublicize(); } @@ -760,9 +760,9 @@ void OnReturnToLobby(S_RETURN_TO_LOBBY m) public class SortCommand : ICommand { - readonly ICollectionViewLiveShaping _view; - bool _refreshing; - ListSortDirection _direction = ListSortDirection.Ascending; + private readonly ICollectionViewLiveShaping _view; + private bool _refreshing; + private ListSortDirection _direction = ListSortDirection.Ascending; #pragma warning disable CS0067 public event EventHandler? CanExecuteChanged; diff --git a/TCC.Core/ViewModels/LootDistributionViewModel.cs b/TCC.Core/ViewModels/LootDistributionViewModel.cs index cc121046..7988790f 100644 --- a/TCC.Core/ViewModels/LootDistributionViewModel.cs +++ b/TCC.Core/ViewModels/LootDistributionViewModel.cs @@ -25,8 +25,7 @@ namespace TCC.ViewModels; [TccModule] public class LootDistributionViewModel : TccWindowViewModel { - - readonly IReadOnlyCollection _itemExclusions = + private readonly IReadOnlyCollection _itemExclusions = [ 8008, 8009, @@ -45,19 +44,20 @@ public class LootDistributionViewModel : TccWindowViewModel 8022, 8023 ]; - readonly Dictionary _droppedItems = new(); - readonly Dictionary<(uint, uint), uint> _amountsDistributed = new(); - readonly DispatcherTimer _countdown; - readonly DispatcherTimer _commitDelay; - readonly DispatcherTimer _clear; - LootDistributionWindowSettings _settings => (LootDistributionWindowSettings)Settings!; + private readonly Dictionary _droppedItems = new(); + private readonly Dictionary<(uint, uint), uint> _amountsDistributed = new(); + private readonly DispatcherTimer _countdown; + private readonly DispatcherTimer _commitDelay; + private readonly DispatcherTimer _clear; + + private LootDistributionWindowSettings _settings => (LootDistributionWindowSettings)Settings!; - LootItemViewModel? _itemInDistribution; - bool _isListVisible; - int _itemsLeftAmount; - int _timeLeft = 59; - float _delayFactor; + private LootItemViewModel? _itemInDistribution; + private bool _isListVisible; + private int _itemsLeftAmount; + private int _timeLeft = 59; + private float _delayFactor; public LootItemViewModel? ItemInDistribution { @@ -145,30 +145,30 @@ public LootDistributionViewModel(LootDistributionWindowSettings settings) : base Game.LootDistributionWindowShowRequest += OnShowRequest; } - void OnShowRequest() + private void OnShowRequest() { _settings.Visible = true; } - void SetWaitForCurrentCategory() + private void SetWaitForCurrentCategory() { if (ItemInDistribution == null) return; SetWaitForCategory((int)ItemInDistribution.DbItem.Id); } - void SetPassForCurrentCategory() + private void SetPassForCurrentCategory() { if (ItemInDistribution == null) return; SetPassForCategory((int)ItemInDistribution.DbItem.Id); } - void SetRollForCurrentCategory() + private void SetRollForCurrentCategory() { if (ItemInDistribution == null) return; SetRollForCategory((int)ItemInDistribution.DbItem.Id); } - void OnAutoRollPolicyChanged() + private void OnAutoRollPolicyChanged() { var policy = _settings.AlwaysRoll ? BidAction.Roll : _settings.AlwaysPass ? BidAction.Pass : BidAction.Unset; @@ -180,20 +180,20 @@ void OnAutoRollPolicyChanged() } } - void OnClearTick(object? sender, EventArgs e) + private void OnClearTick(object? sender, EventArgs e) { _clear.Stop(); _settings.Visible = false; ClearLoot(); } - void OnShowLootWindowHotkeyPressed() + private void OnShowLootWindowHotkeyPressed() { if (!Game.Group.InGroup) return; _settings.Visible = true; } - void OnLoginStatusChanged() + private void OnLoginStatusChanged() { if (Game.Logged) return; _settings.Visible = false; @@ -212,13 +212,13 @@ protected override void OnEnabledChanged(bool enabled) StubInterface.Instance.StubClient.UpdateSetting("LootWindowEnabled", enabled); } - void ClearAll() + private void ClearAll() { Members.Clear(); ClearLoot(); } - void ClearLoot() + private void ClearLoot() { DistributionList.Clear(); _droppedItems.Clear(); @@ -234,13 +234,13 @@ void ClearLoot() ItemsLeftAmount = 0; } - void OnDelaySettingChanged(int newValue) + private void OnDelaySettingChanged(int newValue) { _commitDelay.Interval = TimeSpan.FromSeconds(newValue); DelayFactor = newValue / 59f; } - void OnDelayTick(object? sender, EventArgs e) + private void OnDelayTick(object? sender, EventArgs e) { if (ItemInDistribution != null && ItemInDistribution.BidIntent != BidAction.Unset) { @@ -249,25 +249,25 @@ void OnDelayTick(object? sender, EventArgs e) _commitDelay.Stop(); } - void OnCountdownTick(object? sender, EventArgs e) + private void OnCountdownTick(object? sender, EventArgs e) { TimeLeft--; if (TimeLeft == 0) _countdown.Stop(); } - void ResetTimeLeft() + private void ResetTimeLeft() { _countdown.Stop(); TimeLeft = 59; _countdown.Start(); } - void ToggleListView() + private void ToggleListView() { IsListVisible = !IsListVisible; } - void SetRollForCategory(int itemId) + private void SetRollForCategory(int itemId) { DistributionList.ToSyncList().Where(x => x.DbItem.Id == itemId && !x.BidSent).ToList().ForEach(x => { @@ -276,7 +276,7 @@ void SetRollForCategory(int itemId) }); } - void SetPassForCategory(int itemId) + private void SetPassForCategory(int itemId) { DistributionList.ToSyncList().Where(x => x.DbItem.Id == itemId && !x.BidSent).ToList().ForEach(x => { @@ -285,7 +285,7 @@ void SetPassForCategory(int itemId) }); } - void SetWaitForCategory(int itemId) + private void SetWaitForCategory(int itemId) { DistributionList.ToSyncList().Where(x => x.DbItem.Id == itemId && !x.BidSent).ToList().ForEach(x => { @@ -293,7 +293,7 @@ void SetWaitForCategory(int itemId) }); } - void OnGroupCompositionChanged(ReadOnlyCollection members, GroupCompositionChangeReason reason) + private void OnGroupCompositionChanged(ReadOnlyCollection members, GroupCompositionChangeReason reason) { switch (reason) { @@ -314,7 +314,7 @@ void OnGroupCompositionChanged(ReadOnlyCollection members, Grou Dispatcher.InvokeAsync(() => UpdateGroupMembers(members, reason)); } - void UpdateGroupMembers(ReadOnlyCollection members, GroupCompositionChangeReason reason) + private void UpdateGroupMembers(ReadOnlyCollection members, GroupCompositionChangeReason reason) { switch (reason) { @@ -374,7 +374,7 @@ protected override void RemoveHooks() /// /// A new item is presented for distribution. /// - void OnAskBiddingRareItem(S_ASK_BIDDING_RARE_ITEM m) + private void OnAskBiddingRareItem(S_ASK_BIDDING_RARE_ITEM m) { Log.CW($"> S_ASK_BIDDING_RARE_ITEM: itemId:{m.ItemId} amount:{m.Amount}"); @@ -450,7 +450,7 @@ void OnAskBiddingRareItem(S_ASK_BIDDING_RARE_ITEM m) /// /// Updats the amount of items left. /// - void OnUpdateItemBiddingCount(S_UPDATE_BIDDING_COUNT p) + private void OnUpdateItemBiddingCount(S_UPDATE_BIDDING_COUNT p) { Log.CW($"> S_UPDATE_BIDDING_COUNT.count = {p.Count}"); ItemsLeftAmount = p.Count + 1; @@ -459,7 +459,7 @@ void OnUpdateItemBiddingCount(S_UPDATE_BIDDING_COUNT p) /// /// A player rolled or passed for the item. /// - void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) + private void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) { Log.CW($"> S_RESULT_BIDDING_DICE_THROW: gameId:{m.EntityId} result:{m.RollResult}"); @@ -514,7 +514,7 @@ void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) /// /// Distribution is finished for the item. /// - void OnResultItemBidding(S_RESULT_ITEM_BIDDING p) + private void OnResultItemBidding(S_RESULT_ITEM_BIDDING p) { Log.CW("> S_RESULT_ITEM_BIDDING"); @@ -576,7 +576,7 @@ void OnResultItemBidding(S_RESULT_ITEM_BIDDING p) /// /// An item is set/unset for distribution. /// - void OnSetItemBiddingFlag(S_SET_ITEM_BIDDING_FLAG p) + private void OnSetItemBiddingFlag(S_SET_ITEM_BIDDING_FLAG p) { Log.CW($"> S_SET_ITEM_BIDDING_FLAG: gameId:{p.GameId} flag:{p.Flag}"); @@ -620,7 +620,7 @@ void OnSetItemBiddingFlag(S_SET_ITEM_BIDDING_FLAG p) /// /// An item is spawned on the ground. /// - void OnSpawnDropitem(S_SPAWN_DROPITEM p) + private void OnSpawnDropitem(S_SPAWN_DROPITEM p) { if (_itemExclusions.Contains(p.ItemId)) return; Log.CW($"> S_SPAWN_DROPITEM: gameId:{p.GameId} itemId:{p.ItemId} amount:{p.Amount}"); diff --git a/TCC.Core/ViewModels/LootFilterConfigurationViewModel.cs b/TCC.Core/ViewModels/LootFilterConfigurationViewModel.cs index c6e37093..a37d052d 100644 --- a/TCC.Core/ViewModels/LootFilterConfigurationViewModel.cs +++ b/TCC.Core/ViewModels/LootFilterConfigurationViewModel.cs @@ -12,7 +12,7 @@ public class LootFilterConfigurationViewModel : ThreadSafeObservableObject public ICollectionViewLiveShaping? ItemsView { get; } public LootDistributionWindowSettings Settings { get; } - string _searchFilter = ""; + private string _searchFilter = ""; public string SearchFilter { get => _searchFilter; diff --git a/TCC.Core/ViewModels/LootItemViewModel.cs b/TCC.Core/ViewModels/LootItemViewModel.cs index 22a53c6b..148d521a 100644 --- a/TCC.Core/ViewModels/LootItemViewModel.cs +++ b/TCC.Core/ViewModels/LootItemViewModel.cs @@ -12,12 +12,12 @@ namespace TCC.ViewModels; public class LootItemViewModel : ThreadSafeObservableObject { - readonly DispatcherTimer _commitCheckTimer; - BidAction _bidIntent; - DistributionStatus _distributionStatus; - bool _bidSent; - string _winnerName = ""; - int _winnerRoll = -1; + private readonly DispatcherTimer _commitCheckTimer; + private BidAction _bidIntent; + private DistributionStatus _distributionStatus; + private bool _bidSent; + private string _winnerName = ""; + private int _winnerRoll = -1; public DropItem Item { get; } public Item DbItem { get; } @@ -91,7 +91,7 @@ public LootItemViewModel(DropItem item) _commitCheckTimer.Tick += OnCommitCheck; } - void OnCommitCheck(object? sender, EventArgs e) + private void OnCommitCheck(object? sender, EventArgs e) { _commitCheckTimer.Stop(); @@ -100,7 +100,7 @@ void OnCommitCheck(object? sender, EventArgs e) CommitIntent(); } - void SetBidIntent(BidAction intent) + private void SetBidIntent(BidAction intent) { BidIntent = BidIntent == intent ? BidAction.Unset : intent; CommitIntent(); diff --git a/TCC.Core/ViewModels/LootingGroupMember.cs b/TCC.Core/ViewModels/LootingGroupMember.cs index fd3ebe01..ec40d2af 100644 --- a/TCC.Core/ViewModels/LootingGroupMember.cs +++ b/TCC.Core/ViewModels/LootingGroupMember.cs @@ -7,7 +7,7 @@ public class LootingGroupMember : ThreadSafeObservableObject { public GroupMemberData Member { get; } - int _roll; + private int _roll; public int Roll { @@ -15,7 +15,7 @@ public int Roll set => RaiseAndSetIfChanged(value, ref _roll); } - bool _isWinning; + private bool _isWinning; public bool IsWinning { @@ -23,7 +23,7 @@ public bool IsWinning set => RaiseAndSetIfChanged(value, ref _isWinning); } - BidAction _bidAction; + private BidAction _bidAction; public BidAction BidAction { diff --git a/TCC.Core/ViewModels/MyAbnormalityVM.cs b/TCC.Core/ViewModels/MyAbnormalityVM.cs index 99b6e38e..5f304fab 100644 --- a/TCC.Core/ViewModels/MyAbnormalityVM.cs +++ b/TCC.Core/ViewModels/MyAbnormalityVM.cs @@ -17,8 +17,8 @@ namespace TCC.ViewModels; public class MyAbnormalityVM : ThreadSafeObservableObject { - bool _special; - bool _hidden; + private bool _special; + private bool _hidden; public Abnormality Abnormality { get; } public ICommand SpecialCommand { get; } public ICommand HiddenCommand { get; } diff --git a/TCC.Core/ViewModels/PlayerMenuViewModel.cs b/TCC.Core/ViewModels/PlayerMenuViewModel.cs index b6ae3420..5300c232 100644 --- a/TCC.Core/ViewModels/PlayerMenuViewModel.cs +++ b/TCC.Core/ViewModels/PlayerMenuViewModel.cs @@ -15,23 +15,23 @@ namespace TCC.ViewModels; public class PlayerMenuViewModel : ThreadSafeObservableObject { - string _name = ""; - string _info = ""; - int _level; - Class _class = Class.Warrior; - uint _serverId; - bool _showPartyInvite; - bool _showGuildInvite; - bool _isFromOtherServer; - bool _unfriending; - bool _blocking; - bool _kicking; - bool _gkicking; - uint _playerId; - - string _kickLabelText = "Kick"; - string _gkickLabelText = "Kick from guild"; - readonly PlayerMenuWindow _win; + private string _name = ""; + private string _info = ""; + private int _level; + private Class _class = Class.Warrior; + private uint _serverId; + private bool _showPartyInvite; + private bool _showGuildInvite; + private bool _isFromOtherServer; + private bool _unfriending; + private bool _blocking; + private bool _kicking; + private bool _gkicking; + private uint _playerId; + + private string _kickLabelText = "Kick"; + private string _gkickLabelText = "Kick from guild"; + private readonly PlayerMenuWindow _win; public MoongourdPopupViewModel MoongourdPopupViewModel { get; } public event Action? UnfriendConfirmationRequested; @@ -409,7 +409,7 @@ public void Reset() Unfriending = false; } - void OnAnswerInteractive(S_ANSWER_INTERACTIVE x) + private void OnAnswerInteractive(S_ANSWER_INTERACTIVE x) { if (!App.Settings.EnablePlayerMenu) return; @@ -430,7 +430,7 @@ void OnAnswerInteractive(S_ANSWER_INTERACTIVE x) }); } - void Refresh() + private void Refresh() { InvokePropertyChanged(nameof(ShowPartyInvite)); InvokePropertyChanged(nameof(ShowGuildInvite)); @@ -451,7 +451,7 @@ void Refresh() InvokePropertyChanged(nameof(ShowSeparator2)); } - void AskInteractive() + private void AskInteractive() { if (_serverId == 0 || string.IsNullOrEmpty(Name) || !StubInterface.Instance.IsStubAvailable) return; diff --git a/TCC.Core/ViewModels/SettingsWindowViewModel.cs b/TCC.Core/ViewModels/SettingsWindowViewModel.cs index b6fbd5d9..f9e5f690 100644 --- a/TCC.Core/ViewModels/SettingsWindowViewModel.cs +++ b/TCC.Core/ViewModels/SettingsWindowViewModel.cs @@ -208,8 +208,8 @@ public HotKey ToggleHideAllHotkey } } - int _khCount; - bool _kh; + private int _khCount; + private bool _kh; public bool KylosHelper { get => _kh; @@ -719,8 +719,8 @@ public IEnumerable ClickThruModes public IEnumerable TranslationModes => EnumUtils.ListFromEnum(); - ThreadSafeObservableCollection? _blacklistedMonsters; - bool _showDebugSettings; + private ThreadSafeObservableCollection? _blacklistedMonsters; + private bool _showDebugSettings; public ThreadSafeObservableCollection BlacklistedMonsters { @@ -831,17 +831,17 @@ public SettingsWindowViewModel() MessageFactory.ReleaseVersionChanged += OnReleaseVersionChanged; } - void OnReleaseVersionChanged(int obj) + private void OnReleaseVersionChanged(int obj) { InvokePropertyChanged(nameof(ClickThruModes)); } - void MonsterDatabase_BlacklistChangedEvent(uint arg1, uint arg2, bool arg3) + private void MonsterDatabase_BlacklistChangedEvent(uint arg1, uint arg2, bool arg3) { InvokePropertyChanged(nameof(BlacklistedMonsters)); } - void OnShowSettingsWindowHotkeyPressed() + private void OnShowSettingsWindowHotkeyPressed() { if (WindowManager.SettingsWindow.IsVisible) WindowManager.SettingsWindow.HideWindow(); else WindowManager.SettingsWindow.ShowWindow(); diff --git a/TCC.Core/ViewModels/Tab.cs b/TCC.Core/ViewModels/Tab.cs index d310d5bb..0c06d845 100644 --- a/TCC.Core/ViewModels/Tab.cs +++ b/TCC.Core/ViewModels/Tab.cs @@ -38,7 +38,7 @@ public TabInfo(string name) } public class TabInfoVM : ThreadSafeObservableObject { - string _tabName = ""; + private string _tabName = ""; public string TabName { get => _tabName; @@ -156,7 +156,7 @@ public class Tab : ThreadSafeObservableObject public TabInfo TabInfo { get; } public TabInfoVM TabInfoVM { get; set; } - ChatMessage? _pinnedMessage; + private ChatMessage? _pinnedMessage; public string TabName @@ -250,7 +250,7 @@ public Tab(TabInfo tabInfo) // ApplyFilter(); //} - void SyncImportant(Tab source, ImportantRemovedArgs e) + private void SyncImportant(Tab source, ImportantRemovedArgs e) { if (source == this) return; switch (e.Action) diff --git a/TCC.Core/ViewModels/TabViewModel.cs b/TCC.Core/ViewModels/TabViewModel.cs index 04c1eb97..029aa20c 100644 --- a/TCC.Core/ViewModels/TabViewModel.cs +++ b/TCC.Core/ViewModels/TabViewModel.cs @@ -17,7 +17,7 @@ public static void InvokeImportantRemoved(Tab source, ImportantRemovedArgs e) ImportantRemoved?.Invoke(source, e); } - bool _showImportantPopup; + private bool _showImportantPopup; public bool ShowImportantPopup { get => _showImportantPopup; @@ -44,14 +44,14 @@ public TabViewModel(object header, object content, bool isSelected = false) : ba TabOpened += OnTabOpened; } - void SetPopupStatus(object? par) + private void SetPopupStatus(object? par) { var val = Convert.ToBoolean(par); ShowImportantPopup = val; if (val) TabOpened?.Invoke(this); } - void OnTabOpened(TabViewModel vm) + private void OnTabOpened(TabViewModel vm) { if (vm == this) return; ShowImportantPopup = false; diff --git a/TCC.Core/ViewModels/TimeMarker.cs b/TCC.Core/ViewModels/TimeMarker.cs index 113c1a8b..c29f68c7 100644 --- a/TCC.Core/ViewModels/TimeMarker.cs +++ b/TCC.Core/ViewModels/TimeMarker.cs @@ -6,9 +6,9 @@ namespace TCC.ViewModels; public class TimeMarker : ThreadSafeObservableObject { - readonly DispatcherTimer _t = new(); - DateTime _dateTime; - readonly int _hourOffset; + private readonly DispatcherTimer _t = new(); + private DateTime _dateTime; + private readonly int _hourOffset; public string TimeString => _dateTime.ToShortTimeString(); public double TimeFactor => (_dateTime.Hour * 60 + _dateTime.Minute) * 60 / GameEventManager.SecondsInDay; @@ -25,7 +25,7 @@ public TimeMarker(int hourOffset, string name, string color = "ffffff") _t.Start(); } - void T_Tick(object? sender, EventArgs e) + private void T_Tick(object? sender, EventArgs e) { _dateTime = DateTime.Now.AddHours(_hourOffset); InvokePropertyChanged(nameof(TimeString)); diff --git a/TCC.Core/ViewModels/Widgets/AbnormalityWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/AbnormalityWindowViewModel.cs index 110472cf..98ed44e9 100644 --- a/TCC.Core/ViewModels/Widgets/AbnormalityWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/AbnormalityWindowViewModel.cs @@ -22,14 +22,14 @@ public class AbnormalityWindowViewModel : TccWindowViewModel public Player Player => Game.Me; public FlowDirection Direction => ((BuffWindowSettings)Settings!).Direction; - Thickness _globalMargin; + private Thickness _globalMargin; public Thickness GlobalMargin { get => _globalMargin; set => RaiseAndSetIfChanged(value, ref _globalMargin); } - Thickness _containersMargin; + private Thickness _containersMargin; public Thickness ContainersMargin { get => _containersMargin; @@ -82,7 +82,7 @@ public AbnormalityWindowViewModel(WindowSettingsBase settings) : base(settings) OnOverlapChanged(); } - void OnOverlapChanged() + private void OnOverlapChanged() { GlobalMargin = Direction switch { @@ -94,7 +94,7 @@ void OnOverlapChanged() ContainersMargin = new Thickness { Right = ((BuffWindowSettings)Settings!).Overlap }; } - void OnShowAbnormalConfigHotkeyPressed() + private void OnShowAbnormalConfigHotkeyPressed() { _dispatcher.InvokeAsync(() => { diff --git a/TCC.Core/ViewModels/Widgets/CharacterWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/CharacterWindowViewModel.cs index 260c0942..ee02bb7c 100644 --- a/TCC.Core/ViewModels/Widgets/CharacterWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/CharacterWindowViewModel.cs @@ -89,7 +89,8 @@ private void OnSorcererBoostChanged(FusionElements element) { SorcererFusionBoost = element; } - void OnLogin(S_LOGIN m) + + private void OnLogin(S_LOGIN m) { switch (m.CharacterClass) { @@ -105,14 +106,14 @@ void OnLogin(S_LOGIN m) } } - void OnGetUserList(S_GET_USER_LIST m) + private void OnGetUserList(S_GET_USER_LIST m) { PacketAnalyzer.Processor.Unhook(OnPlayerStatUpdate); WarriorAbnormalityTracker.StanceChanged -= OnWarriorStanceChanged; SorcererAbnormalityTracker.BoostChanged -= OnSorcererBoostChanged; } - void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) + private void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) { switch (Game.Me.Class) { @@ -126,12 +127,12 @@ void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) } } - void OnLeaderChanged() + private void OnLeaderChanged() { InvokePropertyChanged(nameof(ShowLeaderIcon)); } - void MePropertyChanged(object? sender, PropertyChangedEventArgs e) + private void MePropertyChanged(object? sender, PropertyChangedEventArgs e) { InvokePropertyChanged(e.PropertyName); // TODO: remove???? if (e.PropertyName != nameof(Data.Pc.Player.Class)) return; diff --git a/TCC.Core/ViewModels/Widgets/ChatViewModel.cs b/TCC.Core/ViewModels/Widgets/ChatViewModel.cs index 64d447e3..b560ef90 100644 --- a/TCC.Core/ViewModels/Widgets/ChatViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/ChatViewModel.cs @@ -41,13 +41,13 @@ public class ChatViewModel : ThreadSafeObservableObject { public event Action? ForceSizePosUpdateEvent; - bool _paused; - bool _visible = true; - readonly DispatcherTimer _hideTimer; - bool _collapsed; - bool _mouseOver; - Tab? _currentTab; - bool _showCollapsedSettingsButton; + private bool _paused; + private bool _visible = true; + private readonly DispatcherTimer _hideTimer; + private bool _collapsed; + private bool _mouseOver; + private Tab? _currentTab; + private bool _showCollapsedSettingsButton; public bool Paused { @@ -152,19 +152,19 @@ public ChatViewModel(ChatWindowSettings s) if (WindowSettings.StaysCollapsed) _collapsed = true; } - void CheckCollapsed() + private void CheckCollapsed() { Collapsed = !(Game.InGameUiOn || Game.InGameChatOpen) || WindowSettings.StaysCollapsed; ShowCollapsedSettingsButton = Game.InGameUiOn; } - void ChangeTimerInterval() + private void ChangeTimerInterval() { _hideTimer.Interval = TimeSpan.FromSeconds(WindowSettings.HideTimeout); _hideTimer.Refresh(); } - void OnHideTimerTick(object? sender, EventArgs e) + private void OnHideTimerTick(object? sender, EventArgs e) { if (!WindowSettings.FadeOut) { @@ -177,7 +177,7 @@ void OnHideTimerTick(object? sender, EventArgs e) _hideTimer.Stop(); } - void CheckAttention(ChatMessage chatMessage) + private void CheckAttention(ChatMessage chatMessage) { if (!WindowSettings.ShowImportant) return; if (!chatMessage.ContainsPlayerName && chatMessage.Channel != ChatChannel.ReceivedWhisper) return; diff --git a/TCC.Core/ViewModels/Widgets/CivilUnrestViewModel.cs b/TCC.Core/ViewModels/Widgets/CivilUnrestViewModel.cs index 480fbc3b..fd777b32 100644 --- a/TCC.Core/ViewModels/Widgets/CivilUnrestViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/CivilUnrestViewModel.cs @@ -17,9 +17,9 @@ namespace TCC.ViewModels.Widgets; public class CivilUnrestGuild : ThreadSafeObservableObject { - float _towerHp; - uint _towersDestroyed; - string _name; + private float _towerHp; + private uint _towersDestroyed; + private string _name; public CivilUnrestGuild(uint id, string name, float towerHp, uint towersDestroyed) { @@ -52,7 +52,7 @@ public uint TowersDestroyed public class CivilUnrestViewModel : TccWindowViewModel { public bool CivilUnrest => Game.CivilUnrestZone; - readonly ThreadSafeObservableCollection _guilds; + private readonly ThreadSafeObservableCollection _guilds; public ICollectionViewLiveShaping Guilds //TODO: fix getter { @@ -115,7 +115,7 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnDestroyGuildTower); } - void OnDestroyGuildTower(S_DESTROY_GUILD_TOWER m) + private void OnDestroyGuildTower(S_DESTROY_GUILD_TOWER m) { Task.Run(() => { @@ -130,7 +130,7 @@ void OnDestroyGuildTower(S_DESTROY_GUILD_TOWER m) }); } - void OnRequestCityWarMapInfo(S_REQUEST_CITY_WAR_MAP_INFO m) + private void OnRequestCityWarMapInfo(S_REQUEST_CITY_WAR_MAP_INFO m) { Task.Run(() => { @@ -145,7 +145,7 @@ void OnRequestCityWarMapInfo(S_REQUEST_CITY_WAR_MAP_INFO m) }); } - void OnRequestCityWarMapInfoDetail(S_REQUEST_CITY_WAR_MAP_INFO_DETAIL m) + private void OnRequestCityWarMapInfoDetail(S_REQUEST_CITY_WAR_MAP_INFO_DETAIL m) { try { @@ -194,7 +194,7 @@ public void AddDestroyedGuildTower(uint id) } } - void NotifyTeleported() + private void NotifyTeleported() { InvokePropertyChanged(nameof(CivilUnrest)); } diff --git a/TCC.Core/ViewModels/Widgets/ClassWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/ClassWindowViewModel.cs index efb779db..ee9b3c0e 100644 --- a/TCC.Core/ViewModels/Widgets/ClassWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/ClassWindowViewModel.cs @@ -16,8 +16,8 @@ namespace TCC.ViewModels.Widgets; [UsedImplicitly] public class ClassWindowViewModel : TccWindowViewModel { - Class _currentClass = Class.None; - BaseClassLayoutViewModel _currentManager = new NullClassLayoutViewModel(); + private Class _currentClass = Class.None; + private BaseClassLayoutViewModel _currentManager = new NullClassLayoutViewModel(); public Class CurrentClass { @@ -92,32 +92,32 @@ protected override void OnEnabledChanged(bool enabled) } } - void OnValkyrieShowRagnarokChanged() + private void OnValkyrieShowRagnarokChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(ValkyrieLayoutViewModel.ShowRagnarok)); } - void OnValkyrieShowGodsfallChanged() + private void OnValkyrieShowGodsfallChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(ValkyrieLayoutViewModel.ShowGodsfall)); } - void OnWarriorEdgeModeChanged() + private void OnWarriorEdgeModeChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(WarriorLayoutViewModel.WarriorEdgeMode)); } - void OnWarriorShowTraverseCutChanged() + private void OnWarriorShowTraverseCutChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(WarriorLayoutViewModel.ShowTraverseCut)); } - void OnWarriorShowInfuriateChanged() + private void OnWarriorShowInfuriateChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(WarriorLayoutViewModel.ShowInfuriate)); } - void OnWarriorShowEdgeChanged() + private void OnWarriorShowEdgeChanged() { TccUtils.CurrentClassVM()?.ExN(nameof(WarriorLayoutViewModel.ShowEdge)); } @@ -145,7 +145,7 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnCrestMessage); } - void OnLogin(S_LOGIN m) + private void OnLogin(S_LOGIN m) { _dispatcher.InvokeAsync(() => { @@ -163,12 +163,12 @@ void OnLogin(S_LOGIN m) PacketAnalyzer.Processor.Unhook(OnWeakPoint); } - void OnGetUserList(S_GET_USER_LIST m) + private void OnGetUserList(S_GET_USER_LIST m) { CurrentClass = Class.None; } - void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) + private void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) { // check enabled? switch (CurrentClass) @@ -183,31 +183,31 @@ void OnPlayerStatUpdate(S_PLAYER_STAT_UPDATE m) } } - void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA m) + private void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA m) { CurrentManager.SetMaxST(Convert.ToInt32(m.MaxST)); CurrentManager.SetST(Convert.ToInt32(m.CurrentST)); } - void OnWeakPoint(S_WEAK_POINT p) + private void OnWeakPoint(S_WEAK_POINT p) { if (CurrentManager is not ValkyrieLayoutViewModel vvm) return; vvm.RunemarksCounter.Val = p.TotalRunemarks; } - void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) + private void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) { if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill)) return; CurrentManager.StartSpecialSkill(new Cooldown(skill, m.Cooldown)); } - void OnDecreaseCooltimeSkill(S_DECREASE_COOLTIME_SKILL m) + private void OnDecreaseCooltimeSkill(S_DECREASE_COOLTIME_SKILL m) { if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill)) return; CurrentManager.ChangeSpecialSkill(skill, m.Cooldown); } - void OnCrestMessage(S_CREST_MESSAGE m) + private void OnCrestMessage(S_CREST_MESSAGE m) { if (m.Type != 6) return; if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill)) return; diff --git a/TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs index da8c33ad..d87c2faf 100644 --- a/TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs @@ -27,7 +27,7 @@ namespace TCC.ViewModels.Widgets; [TccModule] public class CooldownWindowViewModel : TccWindowViewModel { - bool _isDragging; + private bool _isDragging; public bool IsDragging { @@ -38,7 +38,7 @@ public bool IsDragging public bool ShowItems => App.Settings.CooldownWindowSettings.ShowItems; public event Action? SkillsLoaded; - const int LongSkillTreshold = 40000; //TODO: make configurable? + private const int LongSkillTreshold = 40000; //TODO: make configurable? public ThreadSafeObservableCollection ShortSkills { get; } public ThreadSafeObservableCollection LongSkills { get; } @@ -54,7 +54,7 @@ public bool IsDragging public ThreadSafeCollection Items { get; } = [.. Game.DB!.ItemsDatabase.ItemSkills]; public ThreadSafeCollection Passivities { get; } = [.. Game.DB.AbnormalityDatabase.Abnormalities.Values.ToList()]; - static bool FindAndUpdate(ThreadSafeObservableCollection list, Cooldown sk) + private static bool FindAndUpdate(ThreadSafeObservableCollection list, Cooldown sk) { var existing = list.ToSyncList().FirstOrDefault(x => x.Skill.IconName == sk.Skill.IconName); if (existing == null) @@ -74,7 +74,7 @@ static bool FindAndUpdate(ThreadSafeObservableCollection list, Cooldow return true; } - bool NormalMode_Update(Cooldown sk) + private bool NormalMode_Update(Cooldown sk) { if (!App.Settings.CooldownWindowSettings.Enabled) return false; @@ -117,7 +117,7 @@ bool NormalMode_Update(Cooldown sk) } } - void NormalMode_Change(Skill skill, uint cd) + private void NormalMode_Change(Skill skill, uint cd) { if (!App.Settings.CooldownWindowSettings.Enabled) return; @@ -177,7 +177,7 @@ internal void DeleteFixedSkill(Cooldown context) SaveConfig(); } - void NormalMode_Remove(Skill sk) + private void NormalMode_Remove(Skill sk) { if (!App.Settings.CooldownWindowSettings.Enabled) return; @@ -208,7 +208,7 @@ void NormalMode_Remove(Skill sk) } - bool FixedMode_Update(Cooldown sk) + private bool FixedMode_Update(Cooldown sk) { if (!App.Settings.CooldownWindowSettings.Enabled) { @@ -241,7 +241,7 @@ bool FixedMode_Update(Cooldown sk) return true; } - void FixedMode_Change(Skill sk, uint cd) + private void FixedMode_Change(Skill sk, uint cd) { if (!App.Settings.CooldownWindowSettings.Enabled) return; @@ -273,7 +273,7 @@ void FixedMode_Change(Skill sk, uint cd) } } - void FixedMode_Remove(Skill sk) + private void FixedMode_Remove(Skill sk) { //sk.SetDispatcher(Dispatcher); if (!App.Settings.CooldownWindowSettings.Enabled) return; @@ -313,7 +313,7 @@ void FixedMode_Remove(Skill sk) } } - bool UpdateOther(Cooldown sk) + private bool UpdateOther(Cooldown sk) { if (!App.Settings.CooldownWindowSettings.Enabled) { @@ -496,7 +496,7 @@ protected override void OnEnabledChanged(bool enabled) public bool Combat => Game.Combat; - void OnCombatChanged() + private void OnCombatChanged() { InvokePropertyChanged(nameof(Combat)); } @@ -566,14 +566,14 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnAbnormalityEnd); } - void OnDisconnected() + private void OnDisconnected() { SaveConfig(); ClearSkills(); } - void CheckPassivity(Abnormality ab, uint cd) + private void CheckPassivity(Abnormality ab, uint cd) { if (!PassivityDatabase.TryGetPassivitySkill(ab.Id, out var skill)) return; if (PassivityDatabase.Passivities.TryGetValue(ab.Id, out var cdFromDb)) @@ -589,7 +589,7 @@ void CheckPassivity(Abnormality ab, uint cd) } - void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) + private void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { if (App.Settings.EthicalMode) return; if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; @@ -597,7 +597,7 @@ void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) if (Game.IsMe(p.CasterId) || Game.IsMe(p.TargetId)) CheckPassivity(ab, p.Duration); } - void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) + private void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) { if (App.Settings.EthicalMode) return; if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; @@ -605,7 +605,7 @@ void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) if (Game.IsMe(p.TargetId)) CheckPassivity(ab, p.Duration); } - void OnAbnormalityEnd(S_ABNORMALITY_END p) + private void OnAbnormalityEnd(S_ABNORMALITY_END p) { if (App.Settings.EthicalMode) return; if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; @@ -613,37 +613,37 @@ void OnAbnormalityEnd(S_ABNORMALITY_END p) if (Game.IsMe(p.TargetId)) CheckPassivity(ab, 0); } - void OnLogin(S_LOGIN m) + private void OnLogin(S_LOGIN m) { ClearSkills(); LoadConfig(m.CharacterClass); } - void OnReturnToLobby(S_RETURN_TO_LOBBY m) + private void OnReturnToLobby(S_RETURN_TO_LOBBY m) { SaveConfig(); ClearSkills(); } - void OnGetUserList(S_GET_USER_LIST m) + private void OnGetUserList(S_GET_USER_LIST m) { ClearSkills(); } - void OnDecreaseCooltimeSkill(S_DECREASE_COOLTIME_SKILL m) + private void OnDecreaseCooltimeSkill(S_DECREASE_COOLTIME_SKILL m) { if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill)) return; if (!Pass(skill)) return; Change(skill, m.Cooldown); } - void OnStartCooltimeItem(S_START_COOLTIME_ITEM m) + private void OnStartCooltimeItem(S_START_COOLTIME_ITEM m) { if (!Game.DB!.ItemsDatabase.TryGetItemSkill(m.ItemId, out var itemSkill)) return; RouteSkill(new Cooldown(itemSkill, m.Cooldown, CooldownType.Item)); } - void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) + private void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) { if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill) && !Game.DB.SkillsDatabase.TryGetSkill(m.SkillId, Class.Common, out skill)) @@ -655,7 +655,7 @@ void OnStartCooltimeSkill(S_START_COOLTIME_SKILL m) RouteSkill(new Cooldown(skill, cd)); } - void OnCrestMessage(S_CREST_MESSAGE m) + private void OnCrestMessage(S_CREST_MESSAGE m) { if (m.Type != 6) return; if (!Game.DB!.SkillsDatabase.TryGetSkill(m.SkillId, Game.Me.Class, out var skill)) return; @@ -664,7 +664,7 @@ void OnCrestMessage(S_CREST_MESSAGE m) } - void RouteSkill(Cooldown skillCooldown) + private void RouteSkill(Cooldown skillCooldown) { if (skillCooldown.Duration == 0) { @@ -677,12 +677,12 @@ void RouteSkill(Cooldown skillCooldown) } } - void OnPrecooldownStarted(Skill sk, uint duration) + private void OnPrecooldownStarted(Skill sk, uint duration) { RouteSkill(new Cooldown(sk, duration, CooldownType.Skill, CooldownMode.Pre)); } - static bool Pass(Skill sk) + private static bool Pass(Skill sk) { if (sk.Detail is "off" or "mount" or "eventseed") return false; if (sk.Id == 245109 && Game.Me.Class == Class.Valkyrie) return false; // bad but idk diff --git a/TCC.Core/ViewModels/Widgets/FlightGaugeViewModel.cs b/TCC.Core/ViewModels/Widgets/FlightGaugeViewModel.cs index f84c0a5e..a57aa797 100644 --- a/TCC.Core/ViewModels/Widgets/FlightGaugeViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/FlightGaugeViewModel.cs @@ -35,7 +35,7 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnPlayerChangeFlightEnergy); } - void OnPlayerChangeFlightEnergy(S_PLAYER_CHANGE_FLIGHT_ENERGY m) + private void OnPlayerChangeFlightEnergy(S_PLAYER_CHANGE_FLIGHT_ENERGY m) { EnergyChanged?.Invoke(m.Energy); } diff --git a/TCC.Core/ViewModels/Widgets/GroupWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/GroupWindowViewModel.cs index fde09e4d..f06be5db 100644 --- a/TCC.Core/ViewModels/Widgets/GroupWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/GroupWindowViewModel.cs @@ -28,11 +28,11 @@ namespace TCC.ViewModels.Widgets; [UsedImplicitly] public class GroupWindowViewModel : TccWindowViewModel { - bool _raid; - bool _firstCheck = true; - readonly object _lock = new(); - bool _leaderOverride; - ulong _aggroHolder; + private bool _raid; + private bool _firstCheck = true; + private readonly object _lock = new(); + private bool _leaderOverride; + private ulong _aggroHolder; public event Action? SettingsUpdated; @@ -99,13 +99,13 @@ [new SortDescription(nameof(User.UserClass), ListSortDirection.Ascending)]) ShowLootWindowCommand = new RelayCommand(Game.ShowLootDistributionWindow); } - void OnEncounterChanged() + private void OnEncounterChanged() { if (!Game.Encounter) SetAggro(0); } - void OnLayoutChanged() + private void OnLayoutChanged() { InvokePropertyChanged(nameof(GroupWindowLayout)); InvokePropertyChanged(nameof(All)); @@ -114,7 +114,7 @@ void OnLayoutChanged() InvokePropertyChanged(nameof(Tanks)); } - void OnTeleported() + private void OnTeleported() { if (!Game.CivilUnrestZone) PacketAnalyzer.Processor.Hook(OnPartyMemberIntervalPosUpdate); @@ -124,7 +124,7 @@ void OnTeleported() } - void Members_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + private void Members_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { //Task.Delay(0).ContinueWith(t => //{ @@ -138,21 +138,25 @@ void Members_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs InvokePropertyChanged(nameof(ReadyCount)); InvokePropertyChanged(nameof(ShowLeaderButtons)); } - void NotifySettingUpdated() + + private void NotifySettingUpdated() { SettingsUpdated?.Invoke(); InvokePropertyChanged(nameof(ShowDetails)); } - bool Exists(ulong id) + + private bool Exists(ulong id) { return Members.ToSyncList().Any(x => x.EntityId == id); } - bool Exists(string name) + + private bool Exists(string name) { return Members.ToSyncList().Any(x => x.Name == name); } - bool Exists(uint pId, uint sId) + + private bool Exists(uint pId, uint sId) { return Members.ToSyncList().Any(x => x.PlayerId == pId && x.ServerId == sId); } @@ -201,7 +205,8 @@ public void SetAggro(ulong target) item.HasAggro = item.EntityId == target; } } - void SetAggroCircle(AggroCircle circle, AggroAction action, ulong user) + + private void SetAggroCircle(AggroCircle circle, AggroAction action, ulong user) { if (WindowManager.ViewModels.NpcVM.CurrentHHphase != HarrowholdPhase.None) return; @@ -239,7 +244,8 @@ internal void BeginOrRefreshAbnormality(Abnormality ab, int stacks, uint duratio } }); } - void EndAbnormality(Abnormality ab, uint playerId, uint serverId) + + private void EndAbnormality(Abnormality ab, uint playerId, uint serverId) { _dispatcher.InvokeAsync(() => { @@ -262,7 +268,7 @@ void EndAbnormality(Abnormality ab, uint playerId, uint serverId) }); } - void ClearAbnormality(uint playerId, uint serverId) + private void ClearAbnormality(uint playerId, uint serverId) { _dispatcher.Invoke(() => { @@ -297,7 +303,8 @@ public void AddOrUpdateMember(User p) user.Visible = !(((GroupWindowSettings)Settings).IgnoreMe && p.IsPlayer); } } - void AddOrUpdateMember(GroupMemberData p) + + private void AddOrUpdateMember(GroupMemberData p) { var visible = true; if (((GroupWindowSettings)Settings!).IgnoreMe && p.Name == Game.Me.Name) @@ -326,12 +333,12 @@ void AddOrUpdateMember(GroupMemberData p) //} } - static void SendOnlineMessage(string name, bool newVal) + private static void SendOnlineMessage(string name, bool newVal) { SystemMessagesProcessor.AnalyzeMessage($"@0\vUserName\v{name}", newVal ? "TCC_PARTY_MEMBER_LOGON" : "TCC_PARTY_MEMBER_LOGOUT"); } - void SendAddMessage(string name) + private void SendAddMessage(string name) { string msg; string opcode; @@ -347,12 +354,14 @@ void SendAddMessage(string name) } SystemMessagesProcessor.AnalyzeMessage(msg, opcode); } - void SendDeathMessage(string name) + + private void SendDeathMessage(string name) { var msg = Raid ? $"@0\vPartyPlayerName\v{name}" : $"@0\vPartyPlayerName\v{name}\vparty\vparty"; SystemMessagesProcessor.AnalyzeMessage(msg, "SMT_BATTLE_PARTY_DIE"); } - void SendLeaveMessage(string name) + + private void SendLeaveMessage(string name) { string msg; string opcode; @@ -369,7 +378,8 @@ void SendLeaveMessage(string name) SystemMessagesProcessor.AnalyzeMessage(msg, opcode); } - void RemoveMember(uint playerId, uint serverId, bool kick = false) + + private void RemoveMember(uint playerId, uint serverId, bool kick = false) { var u = Members.ToSyncList().FirstOrDefault(x => x.PlayerId == playerId && x.ServerId == serverId); if (u == null) return; @@ -377,7 +387,8 @@ void RemoveMember(uint playerId, uint serverId, bool kick = false) Members.Remove(u); if (!kick) SendLeaveMessage(u.Name); } - void ClearAll() + + private void ClearAll() { if (!((GroupWindowSettings)Settings!).Enabled || !_dispatcher.Thread.IsAlive) return; Members.ToSyncList().ForEach(x => x.ClearAbnormalities()); @@ -385,20 +396,23 @@ void ClearAll() Raid = false; _leaderOverride = false; } - void LogoutMember(uint playerId, uint serverId) + + private void LogoutMember(uint playerId, uint serverId) { var u = Members.ToSyncList().FirstOrDefault(x => x.PlayerId == playerId && x.ServerId == serverId); if (u == null) return; SendOnlineMessage(u.Name, false); u.Online = false; } - void ToggleMe() + + private void ToggleMe() { var me = Members.ToSyncList().FirstOrDefault(x => x.IsPlayer); if (me == null) return; me.Visible = !((GroupWindowSettings)Settings!).IgnoreMe; } - void ClearAllAbnormalities() + + private void ClearAllAbnormalities() { foreach (var x in Members.ToSyncList()) { @@ -414,7 +428,8 @@ void ClearAllAbnormalities() x.Debuffs.Clear(); } } - void SetNewLeader(string name) + + private void SetNewLeader(string name) { foreach (var m in Members.ToSyncList()) { @@ -434,7 +449,8 @@ public void StartRoll() m.IsRolling = true; } } - void SetRoll(ulong entityId, int rollResult) + + private void SetRoll(ulong entityId, int rollResult) { if (rollResult == int.MaxValue) rollResult = -1; Members.ToSyncList().ForEach(member => @@ -446,7 +462,8 @@ void SetRoll(ulong entityId, int rollResult) member.IsWinning = member.EntityId == GetWinningUser() && member.RollResult != -1; }); } - void SetRoll(uint serverId, uint playerId, int rollResult) + + private void SetRoll(uint serverId, uint playerId, int rollResult) { if (rollResult == int.MaxValue) rollResult = -1; Members.ToSyncList().ForEach(member => @@ -458,7 +475,8 @@ void SetRoll(uint serverId, uint playerId, int rollResult) member.IsWinning = member.EntityId == GetWinningUser() && member.RollResult != -1; }); } - void EndRoll() + + private void EndRoll() { Rolling = false; @@ -476,7 +494,8 @@ void EndRoll() //u.RollResult = 0; //}); } - ulong GetWinningUser() + + private ulong GetWinningUser() { return Members.ToSyncList().OrderByDescending(u => u.RollResult).First().EntityId; //Members.ToList().ForEach(user => user.IsWinning = user.EntityId == Members.OrderByDescending(u => u.RollResult).First().EntityId); @@ -496,7 +515,8 @@ public void SetReadyStatus(ReadyPartyMember p) _firstCheck = false; InvokePropertyChanged(nameof(ReadyCount)); } - void EndReadyCheck() + + private void EndReadyCheck() { Task.Delay(4000).ContinueWith(_ => { @@ -508,7 +528,8 @@ void EndReadyCheck() }); _firstCheck = true; } - void UpdateMemberHp(uint playerId, uint serverId, int curHp, int maxHp) + + private void UpdateMemberHp(uint playerId, uint serverId, int curHp, int maxHp) { _dispatcher.InvokeAsync(() => { @@ -518,7 +539,8 @@ void UpdateMemberHp(uint playerId, uint serverId, int curHp, int maxHp) u.MaxHp = maxHp; }); } - void UpdateMemberMp(uint playerId, uint serverId, int curMp, int maxMp) + + private void UpdateMemberMp(uint playerId, uint serverId, int curMp, int maxMp) { _dispatcher.InvokeAsync(() => { @@ -528,7 +550,8 @@ void UpdateMemberMp(uint playerId, uint serverId, int curMp, int maxMp) u.MaxMp = maxMp; }); } - void UpdateMemberStamina(uint playerId, uint serverId, int curSt, int maxSt) + + private void UpdateMemberStamina(uint playerId, uint serverId, int curSt, int maxSt) { _dispatcher.InvokeAsync(() => { @@ -538,11 +561,13 @@ void UpdateMemberStamina(uint playerId, uint serverId, int curSt, int maxSt) u.MaxSt = maxSt; }); } - void SetRaid(bool raid) + + private void SetRaid(bool raid) { _dispatcher.InvokeAsync(new Action(() => Raid = raid)); } - void UpdateMember(GroupMemberData update) + + private void UpdateMember(GroupMemberData update) { _dispatcher.InvokeAsync(() => { @@ -563,19 +588,21 @@ void UpdateMember(GroupMemberData update) if (!update.Alive) current.HasAggro = false; }); } - void NotifyThresholdChanged() + + private void NotifyThresholdChanged() { InvokePropertyChanged(nameof(Size)); } - void UpdateMemberLocation(uint playerId, uint serverId, int channel, uint continentId) + private void UpdateMemberLocation(uint playerId, uint serverId, int channel, uint continentId) { var u = Members.ToSyncList().FirstOrDefault(x => x.PlayerId == playerId && x.ServerId == serverId); if (u == null) return; var ch = channel > 1000 ? "" : " ch." + channel; u.Location = Game.DB!.TryGetGuardOrDungeonNameFromContinentId(continentId, out var l) ? l + ch : "Unknown"; } - void UpdatePartyMemberAbnormality(uint playerId, uint serverId, uint id, uint duration, int stacks) + + private void UpdatePartyMemberAbnormality(uint playerId, uint serverId, uint id, uint duration, int stacks) { _dispatcher.InvokeAsync(() => { @@ -583,7 +610,8 @@ void UpdatePartyMemberAbnormality(uint playerId, uint serverId, uint id, uint du BeginOrRefreshAbnormality(ab, stacks, duration, playerId, serverId); }); } - void EndPartyMemberAbnormality(uint playerId, uint serverId, uint id) + + private void EndPartyMemberAbnormality(uint playerId, uint serverId, uint id) { _dispatcher.InvokeAsync(() => { @@ -666,12 +694,12 @@ protected override void RemoveHooks() } - void OnDisconnected() + private void OnDisconnected() { ClearAllAbnormalities(); } - void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) + private void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { if (Game.IsMe(p.TargetId)) { @@ -692,7 +720,8 @@ void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) UpdatePartyMemberAbnormality(u.PlayerId, u.ServerId, p.AbnormalityId, p.Duration, p.Stacks); } } - void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) + + private void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) { if (!Game.IsMe(p.TargetId)) return; @@ -702,7 +731,8 @@ void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) BeginOrRefreshAbnormality(ab, p.Stacks, p.Duration, Game.Me.PlayerId, Game.Me.ServerId); } - void OnAbnormalityEnd(S_ABNORMALITY_END p) + + private void OnAbnormalityEnd(S_ABNORMALITY_END p) { if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; @@ -719,44 +749,54 @@ void OnAbnormalityEnd(S_ABNORMALITY_END p) EndAbnormality(ab, u.PlayerId, u.ServerId); } } - void OnCheckToReadyPartyFin(S_CHECK_TO_READY_PARTY_FIN p) + + private void OnCheckToReadyPartyFin(S_CHECK_TO_READY_PARTY_FIN p) { EndReadyCheck(); } - void OnCheckToReadyParty(S_CHECK_TO_READY_PARTY p) + + private void OnCheckToReadyParty(S_CHECK_TO_READY_PARTY p) { _dispatcher.InvokeAsync(() => p.Party.ForEach(SetReadyStatus)); } - void OnPartyMemberStatUpdate(S_PARTY_MEMBER_STAT_UPDATE p) + + private void OnPartyMemberStatUpdate(S_PARTY_MEMBER_STAT_UPDATE p) { UpdateMember(p.GroupMemberData); } - void OnPartyMemberChangeMp(S_PARTY_MEMBER_CHANGE_MP p) + + private void OnPartyMemberChangeMp(S_PARTY_MEMBER_CHANGE_MP p) { UpdateMemberMp(p.PlayerId, p.ServerId, p.CurrentMP, p.MaxMP); } - void OnPartyMemberChangeStamina(S_PARTY_MEMBER_CHANGE_STAMINA p) + + private void OnPartyMemberChangeStamina(S_PARTY_MEMBER_CHANGE_STAMINA p) { UpdateMemberStamina(p.PlayerId, p.ServerId, p.CurrentST, p.MaxST); } - void OnPartyMemberChangeHp(S_PARTY_MEMBER_CHANGE_HP p) + + private void OnPartyMemberChangeHp(S_PARTY_MEMBER_CHANGE_HP p) { UpdateMemberHp(p.PlayerId, p.ServerId, p.CurrentHP, p.MaxHP); } - void OnLogoutPartyMember(S_LOGOUT_PARTY_MEMBER p) + + private void OnLogoutPartyMember(S_LOGOUT_PARTY_MEMBER p) { LogoutMember(p.PlayerId, p.ServerId); ClearAbnormality(p.PlayerId, p.ServerId); } - void OnBanPartyMember(S_BAN_PARTY_MEMBER p) + + private void OnBanPartyMember(S_BAN_PARTY_MEMBER p) { RemoveMember(p.PlayerId, p.ServerId, true); } - void OnLeavePartyMember(S_LEAVE_PARTY_MEMBER p) + + private void OnLeavePartyMember(S_LEAVE_PARTY_MEMBER p) { RemoveMember(p.PlayerId, p.ServerId); } - void OnPartyMemberList(S_PARTY_MEMBER_LIST p) + + private void OnPartyMemberList(S_PARTY_MEMBER_LIST p) { SetRaid(p.Raid); _dispatcher.InvokeAsync(() => @@ -764,47 +804,57 @@ void OnPartyMemberList(S_PARTY_MEMBER_LIST p) foreach (var member in p.Members) AddOrUpdateMember(member); }); } - void OnChangePartyManager(S_CHANGE_PARTY_MANAGER m) + + private void OnChangePartyManager(S_CHANGE_PARTY_MANAGER m) { SetNewLeader(m.Name); } - void OnPartyMemberAbnormalRefresh(S_PARTY_MEMBER_ABNORMAL_REFRESH m) + + private void OnPartyMemberAbnormalRefresh(S_PARTY_MEMBER_ABNORMAL_REFRESH m) { UpdatePartyMemberAbnormality(m.PlayerId, m.ServerId, m.Id, m.Duration, m.Stacks); } - void OnPartyMemberAbnormalClear(S_PARTY_MEMBER_ABNORMAL_CLEAR m) + + private void OnPartyMemberAbnormalClear(S_PARTY_MEMBER_ABNORMAL_CLEAR m) { ClearAbnormality(m.PlayerId, m.ServerId); } - void OnPartyMemberAbnormalDel(S_PARTY_MEMBER_ABNORMAL_DEL m) + + private void OnPartyMemberAbnormalDel(S_PARTY_MEMBER_ABNORMAL_DEL m) { EndPartyMemberAbnormality(m.PlayerId, m.ServerId, m.Id); } - void OnPartyMemberAbnormalAdd(S_PARTY_MEMBER_ABNORMAL_ADD m) + + private void OnPartyMemberAbnormalAdd(S_PARTY_MEMBER_ABNORMAL_ADD m) { UpdatePartyMemberAbnormality(m.PlayerId, m.ServerId, m.Id, m.Duration, m.Stacks); } - void OnPartyMemberBuffUpdate(S_PARTY_MEMBER_BUFF_UPDATE m) + + private void OnPartyMemberBuffUpdate(S_PARTY_MEMBER_BUFF_UPDATE m) { foreach (var buff in m.Abnormals) UpdatePartyMemberAbnormality(m.PlayerId, m.ServerId, buff.Id, buff.Duration, buff.Stacks); } - void OnSpawnUser(S_SPAWN_USER m) + + private void OnSpawnUser(S_SPAWN_USER m) { if (!TryGetUser(m.PlayerId, m.ServerId, out var u)) return; u.InRange = true; u.EntityId = m.EntityId; //UpdateMemberGear(m.PlayerId, m.ServerId, m.Weapon, m.Armor, m.Gloves, m.Boots); } - void OnDespawnUser(S_DESPAWN_USER m) + + private void OnDespawnUser(S_DESPAWN_USER m) { if (!TryGetUser(m.EntityId, out var u)) return; u.InRange = false; } - void OnResultItemBidding(S_RESULT_ITEM_BIDDING m) + + private void OnResultItemBidding(S_RESULT_ITEM_BIDDING m) { EndRoll(); } - void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) + + private void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) { if (!Rolling) StartRoll(); if (m.EntityId != 0) @@ -812,45 +862,54 @@ void OnResultBiddingDiceThrow(S_RESULT_BIDDING_DICE_THROW m) else SetRoll(m.ServerId, m.PlayerId, m.RollResult); } - void OnAskBiddingRareItem(S_ASK_BIDDING_RARE_ITEM m) + + private void OnAskBiddingRareItem(S_ASK_BIDDING_RARE_ITEM m) { StartRoll(); } - void OnLoadTopo(S_LOAD_TOPO m) + private void OnLoadTopo(S_LOAD_TOPO m) { ClearAllAbnormalities(); SetAggro(0); } - void OnReturnToLobby(S_RETURN_TO_LOBBY m) + + private void OnReturnToLobby(S_RETURN_TO_LOBBY m) { ClearAll(); } - void OnLogin(S_LOGIN m) + + private void OnLogin(S_LOGIN m) { ClearAll(); } - void OnBanParty(S_BAN_PARTY m) + + private void OnBanParty(S_BAN_PARTY m) { ClearAll(); } - void OnLeaveParty(S_LEAVE_PARTY m) + + private void OnLeaveParty(S_LEAVE_PARTY m) { ClearAll(); } - void OnGetUserList(S_GET_USER_LIST m) + + private void OnGetUserList(S_GET_USER_LIST m) { ClearAll(); } - void OnUserEffect(S_USER_EFFECT m) + + private void OnUserEffect(S_USER_EFFECT m) { SetAggroCircle(m.Circle, m.Action, m.User); } - void OnPartyMemberIntervalPosUpdate(S_PARTY_MEMBER_INTERVAL_POS_UPDATE p) + + private void OnPartyMemberIntervalPosUpdate(S_PARTY_MEMBER_INTERVAL_POS_UPDATE p) { UpdateMemberLocation(p.PlayerId, p.ServerId, p.Channel, p.ContinentId); } - void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA p) + + private void OnPlayerChangeStamina(S_PLAYER_CHANGE_STAMINA p) { UpdateMemberStamina(Game.Me.PlayerId, Game.Me.ServerId, p.CurrentST, Game.Me.MaxST); } diff --git a/TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs b/TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs index d561a033..9a51b78f 100644 --- a/TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/NpcWindowViewModel.cs @@ -30,11 +30,11 @@ namespace TCC.ViewModels.Widgets; [UsedImplicitly] public class NpcWindowViewModel : TccWindowViewModel { - readonly ThreadSafeObservableCollection _npcList; + private readonly ThreadSafeObservableCollection _npcList; - readonly Dictionary _towerNames = new(); - readonly Dictionary _savedHp = new(); - readonly Dictionary _cache = new(); + private readonly Dictionary _towerNames = new(); + private readonly Dictionary _savedHp = new(); + private readonly Dictionary _cache = new(); public event Action? NpcListChanged; @@ -84,7 +84,7 @@ void InitFlushTimer() } } - void RefreshBlacklist(uint zoneId, uint templateId, bool b) + private void RefreshBlacklist(uint zoneId, uint templateId, bool b) { if (!b) return; _npcList.ToSyncList() @@ -93,7 +93,7 @@ void RefreshBlacklist(uint zoneId, uint templateId, bool b) .ForEach(RemoveAndDisposeNPC); } - void OnHideAddsChanged() + private void OnHideAddsChanged() { if (!((NpcWindowSettings)Settings!).HideAdds) return; _npcList.ToSyncList().Where(x => !x.IsBoss).ToList().ForEach(RemoveAndDisposeNPC); @@ -113,7 +113,7 @@ public void AddOrUpdateNpc(ulong entityId, float maxHp, float curHp, bool isBoss }); } - void CheckPendingAbnormalities(Npc npc) + private void CheckPendingAbnormalities(Npc npc) { if (PendingAbnormalities.Count == 0) return; var npcAbs = PendingAbnormalities.Where(x => x.Target == npc.EntityId).ToList(); @@ -230,7 +230,7 @@ public bool TryFindNPC(ulong entityId, out Npc found) return true; } - void RefreshOverride(uint zoneId, uint templateId, bool b) + private void RefreshOverride(uint zoneId, uint templateId, bool b) { _npcList.ToSyncList() .Where(n => n.ZoneId == zoneId && n.TemplateId == templateId) @@ -238,7 +238,7 @@ void RefreshOverride(uint zoneId, uint templateId, bool b) .ForEach(n => n.IsBoss = b); } - Npc GetOrAddNpc(ulong eid, uint zone, uint template, bool isBoss, bool visible) + private Npc GetOrAddNpc(ulong eid, uint zone, uint template, bool isBoss, bool visible) { if (TryFindNPC(eid, out var npc)) { @@ -250,7 +250,7 @@ Npc GetOrAddNpc(ulong eid, uint zone, uint template, bool isBoss, bool visible) return npc; } - void AddOrUpdateNpc(S_SPAWN_NPC spawn, Monster npcData) + private void AddOrUpdateNpc(S_SPAWN_NPC spawn, Monster npcData) { _dispatcher.InvokeAsync(() => { @@ -264,25 +264,25 @@ void AddOrUpdateNpc(S_SPAWN_NPC spawn, Monster npcData) }); } - void SetEnrageStatus(ulong entityId, bool enraged) + private void SetEnrageStatus(ulong entityId, bool enraged) { if (!TryFindNPC(entityId, out var boss)) return; boss.Enraged = enraged; } - void SetEnrageTime(ulong entityId, int remainingEnrageTime) + private void SetEnrageTime(ulong entityId, int remainingEnrageTime) { if (remainingEnrageTime == 0 || !TryFindNPC(entityId, out var boss)) return; boss.RemainingEnrageTime = remainingEnrageTime; } - void OnAccurateHpChanged() + private void OnAccurateHpChanged() { if (App.Settings.NpcWindowSettings.AccurateHp) PacketAnalyzer.Processor.Hook(OnShowHp); else PacketAnalyzer.Processor.Unhook(OnShowHp); } - void FlushCache() + private void FlushCache() { _dispatcher.InvokeAsync(() => { @@ -300,13 +300,13 @@ void FlushCache() }, DispatcherPriority.Background); } - void SetFromCache(ulong hpcEntityId, double hpcCurrentHp) + private void SetFromCache(ulong hpcEntityId, double hpcCurrentHp) { if (!TryFindNPC(hpcEntityId, out var npc)) return; npc.CurrentHP = hpcCurrentHp; } - void AddNPC(ulong entityId, uint zoneId, uint templateId, bool isBoss, bool visibility) + private void AddNPC(ulong entityId, uint zoneId, uint templateId, bool isBoss, bool visibility) { if (App.Settings.NpcWindowSettings.HideAdds && !isBoss) return; if (templateId == 0 || zoneId == 0) return; @@ -333,14 +333,14 @@ void AddNPC(ulong entityId, uint zoneId, uint templateId, bool isBoss, bool visi NpcListChanged?.Invoke(); } - void AddNormalNPC(Npc boss) + private void AddNormalNPC(Npc boss) { SetVergos(boss); if (_savedHp.TryGetValue(boss.EntityId, out var cached)) boss.CurrentHP = cached; _npcList.Add(boss); } - void HandleNewTower(Npc tower, ulong entityId) + private void HandleNewTower(Npc tower, ulong entityId) { if (_towerNames.TryGetValue(entityId, out var towerName)) { @@ -352,7 +352,7 @@ void HandleNewTower(Npc tower, ulong entityId) if (_savedHp.TryGetValue(entityId, out var hp)) tower.CurrentHP = hp; } - void SetHP(Npc boss, double maxHp, double curHp, HpChangeSource src) + private void SetHP(Npc boss, double maxHp, double curHp, HpChangeSource src) { boss.MaxHP = maxHp; @@ -371,12 +371,12 @@ void SetHP(Npc boss, double maxHp, double curHp, HpChangeSource src) if (src == HpChangeSource.Me) FlushCache(); } - void CacheHP(ulong entityId, double curHp) + private void CacheHP(ulong entityId, double curHp) { _cache[entityId] = curHp; } - void SetAggroTarget(ulong entityId, ulong user) + private void SetAggroTarget(ulong entityId, ulong user) { if (!TryFindNPC(entityId, out var boss)) return; boss.Target = user; @@ -384,18 +384,18 @@ void SetAggroTarget(ulong entityId, ulong user) if (boss.Visible) WindowManager.ViewModels.GroupVM.SetAggro(entityId); } - void UnsetAggroTarget(ulong entityId) + private void UnsetAggroTarget(ulong entityId) { if (!TryFindNPC(entityId, out var boss)) return; boss.Target = 0; } - void ClearGuildTowers() + private void ClearGuildTowers() { _towerNames.Clear(); } - void AddGuildTower(ulong towerId, string guildName, uint guildId) + private void AddGuildTower(ulong towerId, string guildName, uint guildId) { GuildIds[towerId] = guildId; @@ -407,13 +407,13 @@ void AddGuildTower(ulong towerId, string guildName, uint guildId) _towerNames[towerId] = guildName; } - void UpdateShield(ulong target, uint damage) + private void UpdateShield(ulong target, uint damage) { if (!TryFindNPC(target, out var boss)) return; boss.CurrentShield -= damage; } - void RemoveAndDisposeNPC(Npc b) + private void RemoveAndDisposeNPC(Npc b) { b.Dispose(); _npcList.Remove(b); @@ -464,24 +464,24 @@ protected override void RemoveHooks() PacketAnalyzer.Processor.Unhook(OnAbnormalityEnd); } - void OnDisconnected() + private void OnDisconnected() { Clear(); } #region Hooks - void OnPlayerLocation(C_PLAYER_LOCATION p) + private void OnPlayerLocation(C_PLAYER_LOCATION p) { SelectDragon(p.X, p.Y); } - void OnGuildTowerInfo(S_GUILD_TOWER_INFO m) + private void OnGuildTowerInfo(S_GUILD_TOWER_INFO m) { AddGuildTower(m.TowerId, m.GuildName, m.GuildId); } - void OnSpawnNpc(S_SPAWN_NPC p) + private void OnSpawnNpc(S_SPAWN_NPC p) { if (p.Villager) return; CheckHarrowholdPhase(p.HuntingZoneId, p.TemplateId); @@ -490,39 +490,39 @@ void OnSpawnNpc(S_SPAWN_NPC p) AddOrUpdateNpc(p, m); } - void OnSpawnMe(S_SPAWN_ME m) + private void OnSpawnMe(S_SPAWN_ME m) { Clear(); } - void OnLoadTopo(S_LOAD_TOPO m) + private void OnLoadTopo(S_LOAD_TOPO m) { CurrentHHphase = HarrowholdPhase.None; ClearGuildTowers(); _dispatcher.Invoke(() => PendingAbnormalities.Clear()); } - void OnReturnToLobby(S_RETURN_TO_LOBBY m) + private void OnReturnToLobby(S_RETURN_TO_LOBBY m) { Clear(); } - void OnLogin(S_LOGIN m) + private void OnLogin(S_LOGIN m) { Clear(); } - void OnGetUserList(S_GET_USER_LIST m) + private void OnGetUserList(S_GET_USER_LIST m) { Clear(); } - void OnUserEffect(S_USER_EFFECT m) + private void OnUserEffect(S_USER_EFFECT m) { SetAggroTarget(m.Source, m.User); } - void OnNpcStatus(S_NPC_STATUS m) + private void OnNpcStatus(S_NPC_STATUS m) { if (m.Target == 0) UnsetAggroTarget(m.EntityId); @@ -532,7 +532,7 @@ void OnNpcStatus(S_NPC_STATUS m) SetAggroTarget(m.EntityId, m.Target); } - void OnDespawnNpc(S_DESPAWN_NPC p) + private void OnDespawnNpc(S_DESPAWN_NPC p) { _dispatcher.InvokeAsync(() => { @@ -569,29 +569,29 @@ void OnDespawnNpc(S_DESPAWN_NPC p) }); } - void OnBossGageInfo(S_BOSS_GAGE_INFO m) + private void OnBossGageInfo(S_BOSS_GAGE_INFO m) { AddOrUpdateNpc(m.EntityId, m.MaxHP, m.CurrentHP, true, HpChangeSource.BossGage, m.TemplateId, m.HuntingZoneId); } - void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) + private void OnCreatureChangeHp(S_CREATURE_CHANGE_HP m) { if (Game.IsMe(m.Target)) return; AddOrUpdateNpc(m.Target, m.MaxHP, m.CurrentHP, false, Game.IsMe(m.Source) ? HpChangeSource.Me : HpChangeSource.CreatureChangeHp); } - void OnShowHp(S_SHOW_HP m) + private void OnShowHp(S_SHOW_HP m) { AddOrUpdateNpc(m.GameId, m.MaxHp, m.CurrentHp, false, HpChangeSource.CreatureChangeHp); } - void OnAbnormalityDamageAbsorb(S_ABNORMALITY_DAMAGE_ABSORB p) + private void OnAbnormalityDamageAbsorb(S_ABNORMALITY_DAMAGE_ABSORB p) { if (Game.IsMe(p.Target)) return; UpdateShield(p.Target, p.Damage); } - void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) + private void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) { if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; if (p.Duration == int.MaxValue) ab.Infinity = true; @@ -599,7 +599,7 @@ void OnAbnormalityBegin(S_ABNORMALITY_BEGIN p) UpdateAbnormality(ab, p.Stacks, p.Duration, p.TargetId); } - void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) + private void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) { if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; if (p.Duration == int.MaxValue) ab.Infinity = true; @@ -607,7 +607,7 @@ void OnAbnormalityRefresh(S_ABNORMALITY_REFRESH p) UpdateAbnormality(ab, p.Stacks, p.Duration, p.TargetId); } - void OnAbnormalityEnd(S_ABNORMALITY_END p) + private void OnAbnormalityEnd(S_ABNORMALITY_END p) { if (!Game.DB!.AbnormalityDatabase.GetAbnormality(p.AbnormalityId, out var ab) || !ab.CanShow) return; EndAbnormality(p.TargetId, ab); @@ -619,11 +619,11 @@ void OnAbnormalityEnd(S_ABNORMALITY_END p) public const int Ph1ShieldDuration = 16; - Npc? _selectedDragon; - Npc? _vergos; - readonly List _holdedDragons = new(); - HarrowholdPhase _currentHHphase; - ICollectionView? _dragons; + private Npc? _selectedDragon; + private Npc? _vergos; + private readonly List _holdedDragons = new(); + private HarrowholdPhase _currentHHphase; + private ICollectionView? _dragons; public Npc? SelectedDragon { @@ -668,7 +668,7 @@ public ICollectionView? Dragons } } - void SelectDragon(float x, float y) + private void SelectDragon(float x, float y) { var dragon = CheckCurrentDragon(new Point(x, y)); foreach (var item in _npcList.ToSyncList().Where(d => d.TemplateId is > 1099 and < 1104)) @@ -678,7 +678,7 @@ void SelectDragon(float x, float y) } } - void AddSortedDragons() + private void AddSortedDragons() { var umbradrax = _holdedDragons.FirstOrDefault(x => x.TemplateId == 1102); var ignidrax = _holdedDragons.FirstOrDefault(x => x.TemplateId == 1100); @@ -692,7 +692,7 @@ void AddSortedDragons() _holdedDragons.Clear(); } - void OnDungeonEventMessage(S_DUNGEON_EVENT_MESSAGE p) + private void OnDungeonEventMessage(S_DUNGEON_EVENT_MESSAGE p) { switch (p.MessageId) { @@ -730,14 +730,14 @@ void OnDungeonEventMessage(S_DUNGEON_EVENT_MESSAGE p) } } - void SetVergos(Npc boss) + private void SetVergos(Npc boss) { Vergos = boss is { ZoneId: 950, TemplateId: 1000 or 2000 or 3000 or 4000 } ? boss : null; } - void HandleNewPh1Dragon(Npc boss) + private void HandleNewPh1Dragon(Npc boss) { var d = _holdedDragons.FirstOrDefault(x => x.TemplateId == boss.TemplateId && x.ZoneId == boss.ZoneId); if (d != null) return; @@ -753,7 +753,7 @@ void HandleNewPh1Dragon(Npc boss) } } - void CheckHarrowholdPhase(ushort zoneId, uint templateId) + private void CheckHarrowholdPhase(ushort zoneId, uint templateId) { if (zoneId != 950) return; if (templateId is >= 1100 and <= 1103) @@ -771,7 +771,7 @@ void CheckHarrowholdPhase(ushort zoneId, uint templateId) }; } - static Dragon CheckCurrentDragon(Point p) + private static Dragon CheckCurrentDragon(Point p) { var rel = p.RelativeTo(new Point(-7672, -84453)); diff --git a/TCC.Core/ViewModels/Widgets/PerfMonitorViewModel.cs b/TCC.Core/ViewModels/Widgets/PerfMonitorViewModel.cs index 0038ea3d..6651d509 100644 --- a/TCC.Core/ViewModels/Widgets/PerfMonitorViewModel.cs +++ b/TCC.Core/ViewModels/Widgets/PerfMonitorViewModel.cs @@ -16,11 +16,11 @@ namespace TCC.ViewModels.Widgets; [UsedImplicitly] public class PerfMonitorViewModel : TccWindowViewModel { - double _memory; - double _cpu; - PerformanceCounter _cpuCounter = null!; - PerformanceCounter _ramCounter = null!; - Process _process = null!; + private double _memory; + private double _cpu; + private PerformanceCounter _cpuCounter = null!; + private PerformanceCounter _ramCounter = null!; + private Process _process = null!; public double Memory { @@ -45,8 +45,8 @@ public double CPU public bool MemoryAAAAAAAAAAAAAAA => _memory > 3000; public ICommand DumpThreadAllocationCommand { get; } - readonly object _lock = new(); - bool _showDumpButton; + private readonly object _lock = new(); + private bool _showDumpButton; public bool ShowDumpButton { @@ -94,7 +94,7 @@ public PerfMonitorViewModel(PerfMonitorSettings settings) : base(settings) Task.Run(OnTick); } - string BuildThreadString(Dispatcher dispatcher, ref int count) + private string BuildThreadString(Dispatcher dispatcher, ref int count) { var ret = ""; var name = $"- {dispatcher.Thread.Name} "; @@ -110,7 +110,7 @@ string BuildThreadString(Dispatcher dispatcher, ref int count) return ret; } - void OnTick() + private void OnTick() { _process = Process.GetCurrentProcess(); var name = string.Empty; diff --git a/TCC.Interop/Cloud.cs b/TCC.Interop/Cloud.cs index 59996c58..e8cf1950 100644 --- a/TCC.Interop/Cloud.cs +++ b/TCC.Interop/Cloud.cs @@ -8,7 +8,8 @@ namespace TCC.Interop; public static class Cloud { - readonly record struct UsageStat(string Region, + // ReSharper disable NotAccessedPositionalProperty.Local + private readonly record struct UsageStat(string Region, uint ServerId, string ServerName, string ServerIp, diff --git a/TCC.Interop/Firebase.cs b/TCC.Interop/Firebase.cs index 32e77b00..aedd01a6 100644 --- a/TCC.Interop/Firebase.cs +++ b/TCC.Interop/Firebase.cs @@ -13,9 +13,9 @@ namespace TCC.Interop; public static class Firebase { - readonly record struct Webhook(string URL, string AccountHash); - - static readonly List _registeredWebhooks = []; + private readonly record struct Webhook(string URL, string AccountHash); + + private static readonly List _registeredWebhooks = []; public static async void RegisterWebhook(string? url, bool online, string accountHash) { if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(accountHash)) return; diff --git a/TCC.Interop/Moongourd/KabedonManager.cs b/TCC.Interop/Moongourd/KabedonManager.cs index 6cb081cc..c0a986a3 100644 --- a/TCC.Interop/Moongourd/KabedonManager.cs +++ b/TCC.Interop/Moongourd/KabedonManager.cs @@ -9,11 +9,11 @@ namespace TCC.Interop.Moongourd; public class KabedonManager : IMoongourdManager { - const string SEARCH_URL = "https://moongourd.com/api/mg/search?"; - const string LOG_URL = "https://storage.googleapis.com/mg-uploads/#region#/#zoneId#/#bossId#/1/#logId#.json"; - const int MAX_ENCOUNTERS = 5; + private const string SEARCH_URL = "https://moongourd.com/api/mg/search?"; + private const string LOG_URL = "https://storage.googleapis.com/mg-uploads/#region#/#zoneId#/#bossId#/1/#logId#.json"; + private const int MAX_ENCOUNTERS = 5; - bool _requestInProgress; + private bool _requestInProgress; public event Action? Started; @@ -21,12 +21,12 @@ public class KabedonManager : IMoongourdManager public event Action? Failed; - static string BuildSearchUrl(string region, string server, string name) + private static string BuildSearchUrl(string region, string server, string name) { return $"{SEARCH_URL}region={region}&name={name}&server={server}"; } - static string BuildLogUrl(string region, int zoneId, int bossId, long logId) + private static string BuildLogUrl(string region, int zoneId, int bossId, long logId) { return LOG_URL.Replace("#region#", region) .Replace("#zoneId#", zoneId.ToString()) diff --git a/TCC.Interop/Proxy/RpcServer.cs b/TCC.Interop/Proxy/RpcServer.cs index 9afa7e07..f1ac7e88 100644 --- a/TCC.Interop/Proxy/RpcServer.cs +++ b/TCC.Interop/Proxy/RpcServer.cs @@ -20,8 +20,8 @@ public class RpcServer public event Action? ResponseReceived; public event Action? RequestReceived; - readonly HttpListener _server; - bool _listening; + private readonly HttpListener _server; + private bool _listening; public RpcServer() { _server = new HttpListener { Prefixes = { "http://127.0.0.51:9551/" } }; @@ -48,7 +48,7 @@ public void Stop() _listening = false; } - void Listen() + private void Listen() { while (_listening) { @@ -90,9 +90,9 @@ public class RpcServer2 public event Action? RequestReceived; public event Action? ConnectionChanged; - TcpClient _socket; - bool _listening; - bool _connected; + private TcpClient _socket; + private bool _listening; + private bool _connected; public bool Connected { @@ -130,7 +130,7 @@ public void Stop() _listening = false; } - async Task Listen() + private async Task Listen() { _socket = new TcpClient(); diff --git a/TCC.Interop/Proxy/StubClient.cs b/TCC.Interop/Proxy/StubClient.cs index c1201570..d1251ce7 100644 --- a/TCC.Interop/Proxy/StubClient.cs +++ b/TCC.Interop/Proxy/StubClient.cs @@ -10,7 +10,7 @@ namespace TCC.Interop.Proxy; /// public class StubClient { - ToolboxHttpClient TccStub { get; } + private ToolboxHttpClient TccStub { get; } public StubClient() { diff --git a/TCC.Interop/Proxy/StubInterface.cs b/TCC.Interop/Proxy/StubInterface.cs index 1bacbd99..96f9fac1 100644 --- a/TCC.Interop/Proxy/StubInterface.cs +++ b/TCC.Interop/Proxy/StubInterface.cs @@ -5,18 +5,18 @@ namespace TCC.Interop.Proxy; public class StubInterface { - static StubInterface? _instance; + private static StubInterface? _instance; public static StubInterface Instance => _instance ?? new StubInterface(); public readonly StubClient StubClient; - readonly RpcServer2 _stubServer; - readonly StubMessageParser _messageParser; + private readonly RpcServer2 _stubServer; + private readonly StubMessageParser _messageParser; public bool IsFpsModAvailable { get; set; } public bool IsStubAvailable { get; private set; } public bool IsConnected => _stubServer.Connected; - StubInterface() + private StubInterface() { _instance = this; @@ -52,7 +52,7 @@ public async Task InitAsync(bool useLfg, bool enablePlayerMenu, bool enableProxy } - void OnStubConnectionChanged(bool connected) + private void OnStubConnectionChanged(bool connected) { if(!connected) { diff --git a/TCC.Interop/Proxy/StubMessageParser.cs b/TCC.Interop/Proxy/StubMessageParser.cs index c49fc8af..da3bc745 100644 --- a/TCC.Interop/Proxy/StubMessageParser.cs +++ b/TCC.Interop/Proxy/StubMessageParser.cs @@ -14,7 +14,7 @@ namespace TCC.Interop.Proxy; /// public class StubMessageParser { - readonly Dictionary Methods = new() + private readonly Dictionary Methods = new() { { "setUiMode", new Action(SetUiMode) }, { "setChatMode", new Action(SetChatMode) }, @@ -30,7 +30,7 @@ public class StubMessageParser public static event Action? HandleTranslatedMessageEvent; public static event Action? HandleRawPacketEvent; - static void SetUiMode(JObject parameters) + private static void SetUiMode(JObject parameters) { var jMode = parameters["uiMode"]; if (jMode == null) return; @@ -38,7 +38,7 @@ static void SetUiMode(JObject parameters) //Game.InGameUiOn = jMode.Value(); } - static void SetChatMode(JObject parameters) + private static void SetChatMode(JObject parameters) { var jMode = parameters["chatMode"]; if (jMode == null) return; @@ -47,7 +47,7 @@ static void SetChatMode(JObject parameters) //Game.InGameChatOpen = jMode.Value(); } - static void HandleChatMessage(JObject parameters) + private static void HandleChatMessage(JObject parameters) { var jAuthor = parameters["author"]; if (jAuthor == null) return; @@ -74,7 +74,7 @@ static void HandleChatMessage(JObject parameters) } - static void HandleTranslatedMessage(JObject parameters) + private static void HandleTranslatedMessage(JObject parameters) { var jAuthor = parameters["author"]; if (jAuthor == null) return; @@ -109,8 +109,7 @@ static void HandleTranslatedMessage(JObject parameters) } - - static void HandleRawPacket(JObject parameters) + private static void HandleRawPacket(JObject parameters) { var jDir = parameters["direction"]; if (jDir == null) return; @@ -126,7 +125,7 @@ static void HandleRawPacket(JObject parameters) //PacketAnalyzer.EnqueuePacket(content); } - static void HandleEnqueueNotification(JObject parameters) + private static void HandleEnqueueNotification(JObject parameters) { var jTitle = parameters["title"]; var message = parameters["message"]?.Value(); diff --git a/TCC.Updater/Program.cs b/TCC.Updater/Program.cs index fb7d8ac7..96bf3e8e 100644 --- a/TCC.Updater/Program.cs +++ b/TCC.Updater/Program.cs @@ -10,10 +10,10 @@ namespace TCC.Updater { internal class Program { - static string SourcePath = Path.GetDirectoryName(typeof(Program).Assembly.Location)+ "/tmp"; - static string DestinationPath = Path.GetDirectoryName(typeof(Program).Assembly.Location); + private static string SourcePath = Path.GetDirectoryName(typeof(Program).Assembly.Location)+ "/tmp"; + private static string DestinationPath = Path.GetDirectoryName(typeof(Program).Assembly.Location); - static void Main(string[] args) + private static void Main(string[] args) { if (!HasUpdateArg(args)) return; WaitForTccExit(); @@ -32,7 +32,7 @@ static void Main(string[] args) Environment.Exit(0); } - static void ReplaceFiles() + private static void ReplaceFiles() { foreach (var newPath in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories).Where(p => !p.Contains(@"\config\"))) { @@ -41,7 +41,7 @@ static void ReplaceFiles() } } - static void CreateDirectories() + private static void CreateDirectories() { foreach (var dirPath in Directory.GetDirectories(SourcePath, "*", SearchOption.AllDirectories)) { @@ -49,7 +49,7 @@ static void CreateDirectories() } } - static void WaitForTccExit() + private static void WaitForTccExit() { var pl = Process.GetProcesses(); var tries = 10; @@ -71,7 +71,7 @@ static void WaitForTccExit() } } - static bool HasUpdateArg(IEnumerable args) + private static bool HasUpdateArg(IEnumerable args) { if (args.Any(x => x == "update")) return true; MessageBox.Show("This is not meant to be launched manually!", "TCC Updater", MessageBoxButton.OK, diff --git a/TCC.Utils/HttpClientProgress.cs b/TCC.Utils/HttpClientProgress.cs index 81ea0c85..54b31f4c 100644 --- a/TCC.Utils/HttpClientProgress.cs +++ b/TCC.Utils/HttpClientProgress.cs @@ -49,7 +49,7 @@ public async Task DownloadFileAsync(Uri uri, string destinationPath) DownloadFileCompleted?.Invoke(true); } - void ReportProgress(long? totalLen, int totalBytesRead) + private void ReportProgress(long? totalLen, int totalBytesRead) { DownloadProgressChanged?.Invoke(totalBytesRead, totalLen ?? -1); } diff --git a/TCC.Utils/Log.cs b/TCC.Utils/Log.cs index c831caaa..d8a527f6 100644 --- a/TCC.Utils/Log.cs +++ b/TCC.Utils/Log.cs @@ -10,8 +10,8 @@ public static class Log public static event Func? NewNotification; public static event Action? NewMessageBox; - static string _logPath = "logs"; - static string _version = ""; + private static string _logPath = "logs"; + private static string _version = ""; public static void Config(string path, string version) { diff --git a/TCC.Utils/Utilities.cs b/TCC.Utils/Utilities.cs index 0464788d..7bd8ba6f 100644 --- a/TCC.Utils/Utilities.cs +++ b/TCC.Utils/Utilities.cs @@ -22,7 +22,7 @@ internal static void Initializer() _mainDispatcher = Dispatcher.CurrentDispatcher; } - static Dispatcher? _mainDispatcher; + private static Dispatcher? _mainDispatcher; public static Dispatcher GetMainDispatcher() { diff --git a/TeraPacketParser/Analysis/PacketAnalyzer.cs b/TeraPacketParser/Analysis/PacketAnalyzer.cs index 21da82ff..fd94ac26 100644 --- a/TeraPacketParser/Analysis/PacketAnalyzer.cs +++ b/TeraPacketParser/Analysis/PacketAnalyzer.cs @@ -17,7 +17,7 @@ namespace TeraPacketParser.Analysis; public static class PacketAnalyzer { - static readonly ConcurrentQueue Packets = new(); + private static readonly ConcurrentQueue Packets = new(); public static event Action? ProcessorReady; @@ -43,7 +43,7 @@ public static void InitServerDatabase(string path, string overridePath, string l ServerDatabase = new ServerDatabase(path, overridePath) { Language = Enum.Parse(lang.Replace("EU-", "")) }; } - static void Init(CaptureMode mode, bool toolboxMode) + private static void Init(CaptureMode mode, bool toolboxMode) { Factory = new MessageFactory(); @@ -58,7 +58,7 @@ static void Init(CaptureMode mode, bool toolboxMode) AnalysisThread.Start(); } - static void PacketAnalysisLoop() + private static void PacketAnalysisLoop() { Processor = new MessageProcessor(); @@ -86,18 +86,18 @@ static void PacketAnalysisLoop() // ReSharper disable once FunctionNeverReturns } - static void OnNewConnection(Server srv) + private static void OnNewConnection(Server srv) { if (Sniffer is not TeraSniffer) return; DetectClientVersionFromFile(); } - static void OnEndConnection() + private static void OnEndConnection() { Log.N("TCC", SR.Disconnected, NotificationType.None); } - static void DetectClientVersionFromFile() + private static void DetectClientVersionFromFile() { try { diff --git a/TeraPacketParser/Data/Angle.cs b/TeraPacketParser/Data/Angle.cs index 2e1d2d2a..a82721b7 100644 --- a/TeraPacketParser/Data/Angle.cs +++ b/TeraPacketParser/Data/Angle.cs @@ -4,7 +4,7 @@ namespace TeraPacketParser.Data; public struct Angle { - readonly short _raw; + private readonly short _raw; public Angle(short raw) : this() diff --git a/TeraPacketParser/Data/SkillId.cs b/TeraPacketParser/Data/SkillId.cs index aad0137c..4f1105b1 100644 --- a/TeraPacketParser/Data/SkillId.cs +++ b/TeraPacketParser/Data/SkillId.cs @@ -2,7 +2,7 @@ public struct SkillId { - readonly ulong _raw; + private readonly ulong _raw; public SkillId(TeraMessageReader reader) : this() { @@ -12,6 +12,6 @@ public SkillId(TeraMessageReader reader) : this() public int Id => (int)(_raw & 0x00000000_0FFFFFFF); public bool IsAction => (_raw & 0x00000000_10000000) != 0; public bool IsReaction => (_raw & 0x00000000_20000000) != 0; - bool HasHuntingZone => (_raw & 0x00000001_00000000) != 0; + private bool HasHuntingZone => (_raw & 0x00000001_00000000) != 0; public int HuntingZone => HasHuntingZone ? (int)((_raw & 0x00000000_0FFF0000) >> 16) : 0; } \ No newline at end of file diff --git a/TeraPacketParser/MessageFactory.cs b/TeraPacketParser/MessageFactory.cs index 89057e60..22b3c2cb 100644 --- a/TeraPacketParser/MessageFactory.cs +++ b/TeraPacketParser/MessageFactory.cs @@ -11,10 +11,10 @@ public class MessageFactory { public static event Action? ReleaseVersionChanged; - static readonly Delegate? UnknownMessageDelegate = Constructor>(); - static readonly Dictionary OpcodeNameToType = new() { { 19900, Constructor>() } }; + private static readonly Delegate? UnknownMessageDelegate = Constructor>(); + private static readonly Dictionary OpcodeNameToType = new() { { 19900, Constructor>() } }; - static readonly Dictionary TeraMessages = new() + private static readonly Dictionary TeraMessages = new() { { nameof(C_CHECK_VERSION), Constructor>()}, { nameof(C_LOGIN_ARBITER), Constructor>()}, @@ -136,7 +136,7 @@ public class MessageFactory public static readonly Dictionary Extras = new(); public uint Version { get; private set; } - int _releaseVersion; + private int _releaseVersion; public int ReleaseVersion { get => _releaseVersion; @@ -197,7 +197,7 @@ public void InjectExtra(string name, ushort code) } - ParsedMessage? Instantiate(ushort opCode, TeraMessageReader reader) + private ParsedMessage? Instantiate(ushort opCode, TeraMessageReader reader) { if (!OpcodeNameToType.TryGetValue(opCode, out var type)) type = UnknownMessageDelegate; return (ParsedMessage?)type?.DynamicInvoke(reader); diff --git a/TeraPacketParser/Messages/S_BAN_PARTY_MEMBER.cs b/TeraPacketParser/Messages/S_BAN_PARTY_MEMBER.cs index 3269c506..268a6695 100644 --- a/TeraPacketParser/Messages/S_BAN_PARTY_MEMBER.cs +++ b/TeraPacketParser/Messages/S_BAN_PARTY_MEMBER.cs @@ -5,8 +5,8 @@ namespace TeraPacketParser.Messages; public class S_BAN_PARTY_MEMBER : ParsedMessage { - uint _serverId, _playerId; - string _name; + private uint _serverId, _playerId; + private string _name; public uint ServerId => _serverId; public uint PlayerId => _playerId; diff --git a/TeraPacketParser/Messages/S_FRIEND_LIST.cs b/TeraPacketParser/Messages/S_FRIEND_LIST.cs index 3b4e3a7e..feb6f659 100644 --- a/TeraPacketParser/Messages/S_FRIEND_LIST.cs +++ b/TeraPacketParser/Messages/S_FRIEND_LIST.cs @@ -26,7 +26,7 @@ public S_FRIEND_LIST(TeraMessageReader reader) : base(reader) } } - static FriendEntry ParseFriend(TeraMessageReader reader) + private static FriendEntry ParseFriend(TeraMessageReader reader) { reader.Skip(4); // curr + next diff --git a/TeraPacketParser/Messages/S_IMAGE_DATA.cs b/TeraPacketParser/Messages/S_IMAGE_DATA.cs index ceef1a35..7ad40b31 100644 --- a/TeraPacketParser/Messages/S_IMAGE_DATA.cs +++ b/TeraPacketParser/Messages/S_IMAGE_DATA.cs @@ -10,7 +10,7 @@ namespace TeraPacketParser.Messages; public class S_IMAGE_DATA : ParsedMessage { - static Dictionary? _database; + private static Dictionary? _database; public static Dictionary Database => _database ??= new Dictionary(); public S_IMAGE_DATA(TeraMessageReader reader) : base(reader) diff --git a/TeraPacketParser/Messages/S_LEAVE_PARTY_MEMBER.cs b/TeraPacketParser/Messages/S_LEAVE_PARTY_MEMBER.cs index 6ddb7642..b5e92191 100644 --- a/TeraPacketParser/Messages/S_LEAVE_PARTY_MEMBER.cs +++ b/TeraPacketParser/Messages/S_LEAVE_PARTY_MEMBER.cs @@ -5,13 +5,13 @@ namespace TeraPacketParser.Messages; public class S_LEAVE_PARTY_MEMBER : ParsedMessage { - uint _serverId; + private uint _serverId; public uint ServerId => _serverId; - uint _playerId; + private uint _playerId; public uint PlayerId => _playerId; - string _name; + private string _name; public string Name => _name; public S_LEAVE_PARTY_MEMBER(TeraMessageReader reader) : base(reader) diff --git a/TeraPacketParser/Messages/S_LOGIN.cs b/TeraPacketParser/Messages/S_LOGIN.cs index fb8569b9..d9d8ec52 100644 --- a/TeraPacketParser/Messages/S_LOGIN.cs +++ b/TeraPacketParser/Messages/S_LOGIN.cs @@ -4,35 +4,35 @@ namespace TeraPacketParser.Messages; public class S_LOGIN : ParsedMessage { - short NameOffset { get; } + private short NameOffset { get; } public ulong EntityId { get; } public uint ServerId { get; } public uint PlayerId { get; } public short Level { get; } - uint Model { get; } + private uint Model { get; } // ReSharper disable UnusedAutoPropertyAccessor.Local - ulong Appearance { get; } - long RestCurr { get; } - long RestMax { get; } - int Weap { get; } - int Chest { get; } - int Gloves { get; } - int Boots { get; } - int InnerWear { get; } - int Head { get; } - int Face { get; } - int Title { get; } - int WeapMod { get; } - int ChestMod { get; } - int GlovesMod { get; } - int BootsMod { get; } - int WeapEnch { get; } - int HairAdorn { get; } - int Mask { get; } - int Back { get; } - int WeapSkin { get; } + private ulong Appearance { get; } + private long RestCurr { get; } + private long RestMax { get; } + private int Weap { get; } + private int Chest { get; } + private int Gloves { get; } + private int Boots { get; } + private int InnerWear { get; } + private int Head { get; } + private int Face { get; } + private int Title { get; } + private int WeapMod { get; } + private int ChestMod { get; } + private int GlovesMod { get; } + private int BootsMod { get; } + private int WeapEnch { get; } + private int HairAdorn { get; } + private int Mask { get; } + private int Back { get; } + private int WeapSkin { get; } - int Costume { get; } + private int Costume { get; } // ReSharper restore UnusedAutoPropertyAccessor.Local public string Name { get; } diff --git a/TeraPacketParser/Messages/S_LOGOUT_PARTY_MEMBER.cs b/TeraPacketParser/Messages/S_LOGOUT_PARTY_MEMBER.cs index e0679285..0bbb3354 100644 --- a/TeraPacketParser/Messages/S_LOGOUT_PARTY_MEMBER.cs +++ b/TeraPacketParser/Messages/S_LOGOUT_PARTY_MEMBER.cs @@ -5,10 +5,10 @@ namespace TeraPacketParser.Messages; public class S_LOGOUT_PARTY_MEMBER : ParsedMessage { - uint _serverId; + private uint _serverId; public uint ServerId => _serverId; - uint _playerId; + private uint _playerId; public uint PlayerId => _playerId; public S_LOGOUT_PARTY_MEMBER(TeraMessageReader reader) : base(reader) diff --git a/TeraPacketParser/Messages/S_PARTY_MEMBER_CHANGE_HP.cs b/TeraPacketParser/Messages/S_PARTY_MEMBER_CHANGE_HP.cs index 6510d35f..3291b233 100644 --- a/TeraPacketParser/Messages/S_PARTY_MEMBER_CHANGE_HP.cs +++ b/TeraPacketParser/Messages/S_PARTY_MEMBER_CHANGE_HP.cs @@ -5,8 +5,8 @@ namespace TeraPacketParser.Messages; public class S_PARTY_MEMBER_CHANGE_HP : ParsedMessage { - uint _serverId, _playerId; - int _currentHP, _maxHP; + private uint _serverId, _playerId; + private int _currentHP, _maxHP; public uint ServerId => _serverId; public uint PlayerId => _playerId; public int CurrentHP => _currentHP; diff --git a/TeraPacketParser/Messages/S_PLAYER_CHANGE_MP.cs b/TeraPacketParser/Messages/S_PLAYER_CHANGE_MP.cs index 60c2fff8..2bed3f4d 100644 --- a/TeraPacketParser/Messages/S_PLAYER_CHANGE_MP.cs +++ b/TeraPacketParser/Messages/S_PLAYER_CHANGE_MP.cs @@ -5,9 +5,9 @@ namespace TeraPacketParser.Messages; public class S_PLAYER_CHANGE_MP : ParsedMessage { - int _currentMP, _maxMP, _diff; - uint _type; - ulong _target, _source; + private int _currentMP, _maxMP, _diff; + private uint _type; + private ulong _target, _source; public int CurrentMP => _currentMP; public int MaxMP => _maxMP; diff --git a/TeraPacketParser/Messages/S_USER_BLOCK_LIST.cs b/TeraPacketParser/Messages/S_USER_BLOCK_LIST.cs index 97f7f8d9..fffa16b1 100644 --- a/TeraPacketParser/Messages/S_USER_BLOCK_LIST.cs +++ b/TeraPacketParser/Messages/S_USER_BLOCK_LIST.cs @@ -20,7 +20,7 @@ public S_USER_BLOCK_LIST(TeraMessageReader reader) : base(reader) } - string ParseBlockedUser(TeraMessageReader reader) + private string ParseBlockedUser(TeraMessageReader reader) { reader.Skip(4); var nameOffset = reader.ReadUInt16(); diff --git a/TeraPacketParser/Messages/S_USER_EFFECT.cs b/TeraPacketParser/Messages/S_USER_EFFECT.cs index d6589794..a9eafcc8 100644 --- a/TeraPacketParser/Messages/S_USER_EFFECT.cs +++ b/TeraPacketParser/Messages/S_USER_EFFECT.cs @@ -4,7 +4,7 @@ namespace TeraPacketParser.Messages; public class S_USER_EFFECT : ParsedMessage { - int _circle, _action; + private int _circle, _action; public ulong User { get; private set; } public ulong Source { get; private set; } public AggroAction Action => (AggroAction)_action; diff --git a/TeraPacketParser/OpCodeNamer.cs b/TeraPacketParser/OpCodeNamer.cs index b38cb1ab..3abd6715 100644 --- a/TeraPacketParser/OpCodeNamer.cs +++ b/TeraPacketParser/OpCodeNamer.cs @@ -12,8 +12,8 @@ namespace TeraPacketParser; // Since this mapping is version dependent, we can't use a sing global instance of this public class OpCodeNamer { - Dictionary _opCodeCodes; - Dictionary _opCodeNames; + private Dictionary _opCodeCodes; + private Dictionary _opCodeNames; public OpCodeNamer(IEnumerable> names) { @@ -31,7 +31,7 @@ public string GetName(ushort opCode) return _opCodeNames.TryGetValue(opCode, out var name) ? name : opCode.ToString("X4"); } - static async Task>> ReadOpCodeFile(string filename) + private static async Task>> ReadOpCodeFile(string filename) { if (!File.Exists(filename)) { diff --git a/TeraPacketParser/Processing/MessageProcessor.cs b/TeraPacketParser/Processing/MessageProcessor.cs index 652497be..42827a35 100644 --- a/TeraPacketParser/Processing/MessageProcessor.cs +++ b/TeraPacketParser/Processing/MessageProcessor.cs @@ -8,7 +8,7 @@ namespace TeraPacketParser.Processing; public class MessageProcessor { - readonly ConcurrentDictionary> _hooks; + private readonly ConcurrentDictionary> _hooks; public MessageProcessor() { diff --git a/TeraPacketParser/Sniffing/JsonRPC/Request.cs b/TeraPacketParser/Sniffing/JsonRPC/Request.cs index 2715200c..8f6bdd48 100644 --- a/TeraPacketParser/Sniffing/JsonRPC/Request.cs +++ b/TeraPacketParser/Sniffing/JsonRPC/Request.cs @@ -12,7 +12,7 @@ public class Request : JObject public string Method => ContainsKey(MethodKey) ? this[MethodKey]?.Value() ?? "" : ""; public JObject? Parameters => ContainsKey(ParametersKey) ? this[ParametersKey] as JObject : null; - static uint _nextId; + private static uint _nextId; public Request(string methodName, JObject? parameters = null) { this["jsonrpc"] = "2.0"; @@ -29,7 +29,7 @@ public Request(JObject j) this[IdKey] = j[IdKey]; } - static uint GetNextId() + private static uint GetNextId() { return _nextId++; } diff --git a/TeraPacketParser/Sniffing/ToolboxHttpClient.cs b/TeraPacketParser/Sniffing/ToolboxHttpClient.cs index abdb798c..8dee02be 100644 --- a/TeraPacketParser/Sniffing/ToolboxHttpClient.cs +++ b/TeraPacketParser/Sniffing/ToolboxHttpClient.cs @@ -11,15 +11,15 @@ namespace TeraPacketParser.Sniffing; /// public class ToolboxHttpClient { - readonly HttpClient _client; - readonly string _address; + private readonly HttpClient _client; + private readonly string _address; public ToolboxHttpClient(string address) { _address = address; _client = new HttpClient(); } - async Task Send(JObject obj) + private async Task Send(JObject obj) { var req = new StringContent(obj.ToString(), Encoding.UTF8, "application/json"); @@ -38,7 +38,7 @@ public ToolboxHttpClient(string address) return await CallAsync(new Request(methodName, parameters)); } - async Task CallAsync(Request req) + private async Task CallAsync(Request req) { var resp = await Send(req); if (resp?.Error != null) diff --git a/TeraPacketParser/Sniffing/ToolboxSniffer.cs b/TeraPacketParser/Sniffing/ToolboxSniffer.cs index ecf2d1d0..c3daf830 100644 --- a/TeraPacketParser/Sniffing/ToolboxSniffer.cs +++ b/TeraPacketParser/Sniffing/ToolboxSniffer.cs @@ -22,7 +22,7 @@ public class ToolboxSniffer : ITeraSniffer /// public class ToolboxControlInterface { - readonly ToolboxHttpClient _client; + private readonly ToolboxHttpClient _client; public ToolboxControlInterface(string address) { @@ -167,12 +167,12 @@ internal async Task GetLanguage() #if SERVER private readonly TcpListener _dataConnection; #else - TcpClient _dataConnection; + private TcpClient _dataConnection; #endif public readonly ToolboxControlInterface ControlConnection; - readonly bool _failed; - bool _enabled; - bool _connected; + private readonly bool _failed; + private bool _enabled; + private bool _connected; public bool Enabled { @@ -288,7 +288,7 @@ private async void Listen() } } #else - async Task ReceiveAsync() + private async Task ReceiveAsync() { if (_failed) return; while (Enabled) diff --git a/TeraPacketParser/TeraCommon/Game/Services/ServerDatabase.cs b/TeraPacketParser/TeraCommon/Game/Services/ServerDatabase.cs index 929f6b0a..860d0b73 100644 --- a/TeraPacketParser/TeraCommon/Game/Services/ServerDatabase.cs +++ b/TeraPacketParser/TeraCommon/Game/Services/ServerDatabase.cs @@ -8,11 +8,11 @@ namespace TeraPacketParser.TeraCommon.Game.Services; //TODO: make this the same as other DBs public class ServerDatabase { - const string DefaultOverride = "###########################################################\n# Add additional servers in this file (needed only for\n# VPN/Proxy that is not supported out-of-box)\n#\n# Format must follow the format IP Region ServerName\n#\n# Example:\n# 111.22.33.44 NA VPN Server 1\n#\n# Current possible regions: EU, NA, RU, KR, TW, JP\n#\n# Lines starting with '#' are ignored\n# Place servers below the next line\n###########################################################"; - LangEnum _language; + private const string DefaultOverride = "###########################################################\n# Add additional servers in this file (needed only for\n# VPN/Proxy that is not supported out-of-box)\n#\n# Format must follow the format IP Region ServerName\n#\n# Example:\n# 111.22.33.44 NA VPN Server 1\n#\n# Current possible regions: EU, NA, RU, KR, TW, JP\n#\n# Lines starting with '#' are ignored\n# Place servers below the next line\n###########################################################"; + private LangEnum _language; - readonly List _servers; - List _serverlist; + private readonly List _servers; + private List _serverlist; public string Region { get; set; } = ""; public LangEnum Language @@ -75,7 +75,7 @@ public ServerDatabase(string folder, string serversOverridePath) } - static IEnumerable GetServers(string filename) + private static IEnumerable GetServers(string filename) { return File.ReadAllLines(filename) .Where(s => !s.StartsWith("#") && !string.IsNullOrWhiteSpace(s)) @@ -99,7 +99,7 @@ public string GetServerName(uint serverId, Server? oldServer = null) return servers.FirstOrDefault(x => x.Region == Region)?.Name ?? servers.First().Name; } - void AddOverrides(IEnumerable newServers) + private void AddOverrides(IEnumerable newServers) { _serverlist = _serverlist.Concat(newServers.Where(sl => _serverlist.All(os => os.Ip != sl.Ip))).ToList(); } diff --git a/TeraPacketParser/TeraCommon/PacketLog/Parsing/BlockSplitter.cs b/TeraPacketParser/TeraCommon/PacketLog/Parsing/BlockSplitter.cs index 8672ca08..3cce6225 100644 --- a/TeraPacketParser/TeraCommon/PacketLog/Parsing/BlockSplitter.cs +++ b/TeraPacketParser/TeraCommon/PacketLog/Parsing/BlockSplitter.cs @@ -11,10 +11,10 @@ internal class BlockSplitter public event Action? Resync; public event Action? BlockFinished; - readonly MemoryStream _buffer = new(); - volatile int _last; - volatile int _prev; - volatile int _pPrev; + private readonly MemoryStream _buffer = new(); + private volatile int _last; + private volatile int _prev; + private volatile int _pPrev; protected virtual void OnBlockFinished(byte[] block) { @@ -22,13 +22,13 @@ protected virtual void OnBlockFinished(byte[] block) handler?.Invoke(block); } - static void RemoveFront(MemoryStream stream, int count) + private static void RemoveFront(MemoryStream stream, int count) { Array.Copy(stream.GetBuffer(), count, stream.GetBuffer(), 0, stream.Length - count); stream.SetLength(stream.Length - count); } - static byte[]? PopBlock(MemoryStream stream) + private static byte[]? PopBlock(MemoryStream stream) { if (stream.Length < 2) return null; diff --git a/TeraPacketParser/TeraCommon/PacketLog/Parsing/StreamHelper.cs b/TeraPacketParser/TeraCommon/PacketLog/Parsing/StreamHelper.cs index 52df869f..a3b17282 100644 --- a/TeraPacketParser/TeraCommon/PacketLog/Parsing/StreamHelper.cs +++ b/TeraPacketParser/TeraCommon/PacketLog/Parsing/StreamHelper.cs @@ -7,7 +7,7 @@ namespace TeraPacketParser.TeraCommon.PacketLog.Parsing; internal static class StreamHelper { - static void ReadBytes(Stream stream, byte[] buffer, int offset, int count) + private static void ReadBytes(Stream stream, byte[] buffer, int offset, int count) { while (count > 0) { diff --git a/TeraPacketParser/TeraCommon/Sniffing/ConnectionDecrypter.cs b/TeraPacketParser/TeraCommon/Sniffing/ConnectionDecrypter.cs index 489a79c6..62ebdc6f 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/ConnectionDecrypter.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/ConnectionDecrypter.cs @@ -10,17 +10,17 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class ConnectionDecrypter { - readonly string _region; - MemoryStream _client = new(); - MemoryStream _server = new(); - Session? _session; + private readonly string _region; + private MemoryStream _client = new(); + private MemoryStream _server = new(); + private Session? _session; public ConnectionDecrypter(string region = "Unknown") { _region = region; } - bool Initialized => _session != null; + private bool Initialized => _session != null; public event Action? ClientToServerDecrypted; public event Action? ServerToClientDecrypted; @@ -37,7 +37,7 @@ protected void OnServerToClientDecrypted(byte[] data) action?.Invoke(data); } - Session CreateSession(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, byte[] serverKey2) + private Session CreateSession(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, byte[] serverKey2) { var session = Session.Instance; session.ClientKey1 = clientKey1; @@ -50,7 +50,7 @@ Session CreateSession(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, b return session; } - void TryInitialize() + private void TryInitialize() { if (Initialized) throw new InvalidOperationException("Already initalized"); diff --git a/TeraPacketParser/TeraCommon/Sniffing/Crypt/Cryptor.cs b/TeraPacketParser/TeraCommon/Sniffing/Crypt/Cryptor.cs index 7bdc374b..9957b6b0 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/Crypt/Cryptor.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/Crypt/Cryptor.cs @@ -6,22 +6,22 @@ namespace TeraPacketParser.TeraCommon.Sniffing.Crypt; public class Cryptor { - readonly CryptorKey[] _key = + private readonly CryptorKey[] _key = [ new(55, 31), new(57, 50), new(58, 39) ]; - int _changeData; - int _changeLen; + private int _changeData; + private int _changeLen; public Cryptor(byte[] key) { GenerateKey(key); } - byte[] FillKey(byte[] src) + private byte[] FillKey(byte[] src) { var result = new byte[680]; @@ -33,7 +33,7 @@ byte[] FillKey(byte[] src) return result; } - void GenerateKey(byte[] src) + private void GenerateKey(byte[] src) { var buf = FillKey(src); for (var i = 0; i < 680; i += 20) diff --git a/TeraPacketParser/TeraCommon/Sniffing/Crypt/Session.cs b/TeraPacketParser/TeraCommon/Sniffing/Crypt/Session.cs index 7de21355..b6c28643 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/Crypt/Session.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/Crypt/Session.cs @@ -6,7 +6,7 @@ namespace TeraPacketParser.TeraCommon.Sniffing.Crypt; public class Session { - static Session? _instance; + private static Session? _instance; public byte[] ClientKey1 = new byte[128]; public byte[] ClientKey2 = new byte[128]; public byte[] DecryptKey = new byte[128]; @@ -21,7 +21,7 @@ public class Session public byte[] TmpKey2 = new byte[128]; - Session() { } + private Session() { } public static Session Instance => _instance ??= new Session(); diff --git a/TeraPacketParser/TeraCommon/Sniffing/EndpointIpv4.cs b/TeraPacketParser/TeraCommon/Sniffing/EndpointIpv4.cs index 33c6256c..147e9ee8 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/EndpointIpv4.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/EndpointIpv4.cs @@ -9,8 +9,8 @@ namespace TeraPacketParser.TeraCommon.Sniffing; internal struct EndpointIpv4 : IEquatable { - readonly uint _ip; - readonly ushort _port; + private readonly uint _ip; + private readonly ushort _port; public static bool operator ==(EndpointIpv4 x, EndpointIpv4 y) { @@ -43,7 +43,7 @@ public EndpointIpv4(uint ip, ushort port) _port = port; } - static IPAddress ToIpAddress(uint ip) + private static IPAddress ToIpAddress(uint ip) { var bytes = new byte[4]; bytes[0] = (byte) (ip >> 24); diff --git a/TeraPacketParser/TeraCommon/Sniffing/IpSniffer.cs b/TeraPacketParser/TeraCommon/Sniffing/IpSniffer.cs index 19b9d6d3..b7f59c9e 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/IpSniffer.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/IpSniffer.cs @@ -8,7 +8,7 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public abstract class IpSniffer { - bool _enabled; + private bool _enabled; public bool Enabled { diff --git a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketMultipleInterfaces.cs b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketMultipleInterfaces.cs index c7c9503c..2f6da8d6 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketMultipleInterfaces.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketMultipleInterfaces.cs @@ -12,10 +12,10 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class IpSnifferRawSocketMultipleInterfaces : IpSniffer { - readonly List _individualSniffers = + private readonly List _individualSniffers = new(); - readonly IEnumerable _ipAddresses; + private readonly IEnumerable _ipAddresses; public IpSnifferRawSocketMultipleInterfaces() : this(DefaultInterfaceIPs) diff --git a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketSingleInterface.cs b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketSingleInterface.cs index ac15fd31..80c0b06b 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketSingleInterface.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferRawSocketSingleInterface.cs @@ -16,17 +16,17 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class IpSnifferRawSocketSingleInterface : IpSniffer { - readonly IPAddress _localIp; + private readonly IPAddress _localIp; - bool _isInit; - Socket? _socket; + private bool _isInit; + private Socket? _socket; public IpSnifferRawSocketSingleInterface(IPAddress localIp) { _localIp = localIp; } - void Init() + private void Init() { Debug.Assert(_socket == null); _socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); @@ -39,7 +39,7 @@ void Init() Task.Run(()=>ReadAsync(_socket)); } - async Task ReadAsync(Socket s) + private async Task ReadAsync(Socket s) { // Reusable SocketAsyncEventArgs and awaitable wrapper var args = new SocketAsyncEventArgs(); @@ -57,7 +57,7 @@ async Task ReadAsync(Socket s) } } - void Finish() + private void Finish() { if (!_isInit) { @@ -97,10 +97,10 @@ public override string ToString() public sealed class SocketAwaitable : INotifyCompletion { - static readonly Action Sentinel = () => { }; + private static readonly Action Sentinel = () => { }; internal bool MWasCompleted; - Action? _mContinuation; + private Action? _mContinuation; internal readonly SocketAsyncEventArgs MEventArgs; public SocketAwaitable(SocketAsyncEventArgs eventArgs) diff --git a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferWinPcap.cs b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferWinPcap.cs index eede6cba..a8ac52d2 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/IpSnifferWinPcap.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/IpSnifferWinPcap.cs @@ -20,11 +20,11 @@ public class IpSnifferWinPcap : IpSniffer //private static readonly ILog Logger = LogManager.GetLogger // (MethodBase.GetCurrentMethod().DeclaringType); - readonly string _filter; - NpcapDeviceList? _devices; - volatile uint _droppedPackets; - volatile uint _interfaceDroppedPackets; - DateTime _nextCheck; + private readonly string _filter; + private NpcapDeviceList? _devices; + private volatile uint _droppedPackets; + private volatile uint _interfaceDroppedPackets; + private DateTime _nextCheck; public IpSnifferWinPcap(string filter) { @@ -52,12 +52,12 @@ protected override void SetEnabled(bool value) Finish(); } - static bool IsInteresting(NpcapDevice device) + private static bool IsInteresting(NpcapDevice device) { return true; } - void Start() + private void Start() { Debug.Assert(_devices == null); _devices = NpcapDeviceList.New(); @@ -93,7 +93,7 @@ void Start() } } - void Finish() + private void Finish() { Debug.Assert(_devices != null); foreach (var device in _devices.Where(device => device.Opened)) @@ -121,7 +121,7 @@ protected virtual void OnWarning(string obj) handler?.Invoke(obj); } - void device_OnPacketArrival(object sender, CaptureEventArgs e) + private void device_OnPacketArrival(object sender, CaptureEventArgs e) { IPv4Packet? ipPacket; try diff --git a/TeraPacketParser/TeraCommon/Sniffing/MessageSplitter.cs b/TeraPacketParser/TeraCommon/Sniffing/MessageSplitter.cs index b7557dfa..97f1b606 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/MessageSplitter.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/MessageSplitter.cs @@ -6,9 +6,9 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class MessageSplitter { - readonly BlockSplitter _clientSplitter = new(); - readonly BlockSplitter _serverSplitter = new(); - DateTime _time; + private readonly BlockSplitter _clientSplitter = new(); + private readonly BlockSplitter _serverSplitter = new(); + private DateTime _time; public MessageSplitter() { @@ -21,12 +21,12 @@ public MessageSplitter() public event Action? MessageReceived; public event Action? Resync; - void ClientResync(int skipped, int size) + private void ClientResync(int skipped, int size) { OnResync(MessageDirection.ClientToServer, skipped, size); } - void ServerResync(int skipped, int size) + private void ServerResync(int skipped, int size) { OnResync(MessageDirection.ServerToClient, skipped, size); } @@ -37,12 +37,12 @@ protected void OnResync(MessageDirection direction, int skipped, int size) handler?.Invoke(direction,skipped,size); } - void ClientBlockFinished(byte[] block) + private void ClientBlockFinished(byte[] block) { OnMessageReceived(new Message(_time, MessageDirection.ClientToServer, new ArraySegment(block))); } - void ServerBlockFinished(byte[] block) + private void ServerBlockFinished(byte[] block) { OnMessageReceived(new Message(_time, MessageDirection.ServerToClient, new ArraySegment(block))); } diff --git a/TeraPacketParser/TeraCommon/Sniffing/TcpConnection.cs b/TeraPacketParser/TeraCommon/Sniffing/TcpConnection.cs index a8fd5601..6d218c2f 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/TcpConnection.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/TcpConnection.cs @@ -8,7 +8,7 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class TcpConnection { - readonly SortedDictionary _bufferedPackets = new(); + private readonly SortedDictionary _bufferedPackets = new(); public readonly IPEndPoint Destination; public readonly IPEndPoint Source; internal readonly ConnectionId ConnectionId; @@ -41,7 +41,7 @@ internal string BufferedPacketDescription public uint CurrentSequenceNumber => unchecked((uint) (InitialSequenceNumber + 1 + BytesReceived)); // ReSharper disable once UnusedAutoPropertyAccessor.Local - static uint NextSequenceNumber { get; set; } + private static uint NextSequenceNumber { get; set; } public event Action? DataReceived; diff --git a/TeraPacketParser/TeraCommon/Sniffing/TcpSniffer.cs b/TeraPacketParser/TeraCommon/Sniffing/TcpSniffer.cs index acd68c47..16ae9418 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/TcpSniffer.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/TcpSniffer.cs @@ -7,10 +7,10 @@ namespace TeraPacketParser.TeraCommon.Sniffing; public class TcpSniffer { - readonly ConcurrentDictionary _connections = new(); + private readonly ConcurrentDictionary _connections = new(); - readonly object _lock = new(); - readonly string? _snifferType; + private readonly object _lock = new(); + private readonly string? _snifferType; public TcpSniffer(IpSniffer ipSniffer) { ipSniffer.PacketReceived += Receive; @@ -50,7 +50,7 @@ internal void RemoveConnection(TcpConnection connection) // } //} - void Receive(IPv4Packet ipData) + private void Receive(IPv4Packet ipData) { var tcpPacket = ipData.PayloadPacket as TcpPacket; if (tcpPacket == null || tcpPacket.DataOffset*4 > ipData.PayloadLength) return; diff --git a/TeraPacketParser/TeraCommon/Sniffing/TeraSniffer.cs b/TeraPacketParser/TeraCommon/Sniffing/TeraSniffer.cs index 42c36900..829c37a8 100644 --- a/TeraPacketParser/TeraCommon/Sniffing/TeraSniffer.cs +++ b/TeraPacketParser/TeraCommon/Sniffing/TeraSniffer.cs @@ -17,17 +17,17 @@ public class TeraSniffer : ITeraSniffer // Only take this lock in callbacks from tcp sniffing, not in code that can be called by the user. // Otherwise this could cause a deadlock if the user calls such a method from a callback that already holds a lock //private readonly object _eventLock = new object(); - readonly IpSniffer _ipSniffer; + private readonly IpSniffer _ipSniffer; - readonly ConcurrentDictionary _isNew = new(); + private readonly ConcurrentDictionary _isNew = new(); - readonly Dictionary _serversByIp; - TcpConnection? _clientToServer; - ConnectionDecrypter? _decrypter; - MessageSplitter? _messageSplitter; - TcpConnection? _serverToClient; + private readonly Dictionary _serversByIp; + private TcpConnection? _clientToServer; + private ConnectionDecrypter? _decrypter; + private MessageSplitter? _messageSplitter; + private TcpConnection? _serverToClient; public int ClientProxyOverhead; - bool _connected; + private bool _connected; public bool Connected { @@ -105,7 +105,7 @@ protected virtual void OnWarning(string obj) } - void HandleEndConnection(TcpConnection? connection) + private void HandleEndConnection(TcpConnection? connection) { if (connection == _clientToServer || connection == _serverToClient) { @@ -119,7 +119,7 @@ void HandleEndConnection(TcpConnection? connection) } // called from the tcp sniffer, so it needs to lock - void HandleNewConnection(TcpConnection? connection) + private void HandleNewConnection(TcpConnection? connection) { { if (Connected || !_serversByIp.ContainsKey(connection!.Destination.Address.ToString()) && @@ -130,7 +130,7 @@ void HandleNewConnection(TcpConnection? connection) } // called from the tcp sniffer, so it needs to lock - void HandleTcpDataReceived(TcpConnection connection, byte[] data, int needToSkip) + private void HandleTcpDataReceived(TcpConnection connection, byte[] data, int needToSkip) { { if (data.Length == 0) @@ -182,25 +182,25 @@ void HandleTcpDataReceived(TcpConnection connection, byte[] data, int needToSkip } } - void OnResync(MessageDirection direction, int skipped, int size) + private void OnResync(MessageDirection direction, int skipped, int size) { //Log.F("Resync occured " + direction + ", skipped:" + skipped + ", block size:" + size); } // called indirectly from HandleTcpDataReceived, so the current thread already holds the lock - void HandleMessageReceived(Message message) + private void HandleMessageReceived(Message message) { OnMessageReceived(message); } // called indirectly from HandleTcpDataReceived, so the current thread already holds the lock - void HandleServerToClientDecrypted(byte[] data) + private void HandleServerToClientDecrypted(byte[] data) { _messageSplitter?.ServerToClient(DateTime.UtcNow, data); } // called indirectly from HandleTcpDataReceived, so the current thread already holds the lock - void HandleClientToServerDecrypted(byte[] data) + private void HandleClientToServerDecrypted(byte[] data) { _messageSplitter?.ClientToServer(DateTime.UtcNow, data); } diff --git a/TeraPacketParser/TeraMessageReader.cs b/TeraPacketParser/TeraMessageReader.cs index b7db634f..825e7f54 100644 --- a/TeraPacketParser/TeraMessageReader.cs +++ b/TeraPacketParser/TeraMessageReader.cs @@ -27,7 +27,7 @@ public void RepositionAt(int position) internal OpCodeNamer SysMsgNamer { get; private set; } public MessageFactory Factory { get; set; } - static MemoryStream GetStream(Message message) + private static MemoryStream GetStream(Message message) { return message.Payload.Array != null ? new MemoryStream(message.Payload.Array, message.Payload.Offset, message.Payload.Count, false, true)