Пример #1
0
 private void PopulateMonsterBox()
 {
     MonsterShowModeSelection.Items.Add(GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_MONSTER_BAR_MODE_0']"));
     MonsterShowModeSelection.Items.Add(GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_MONSTER_BAR_MODE_1']"));
     MonsterShowModeSelection.Items.Add(GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_MONSTER_BAR_MODE_2']"));
     MonsterShowModeSelection.Items.Add(GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_MONSTER_BAR_MODE_3']"));
 }
Пример #2
0
        private async void DownloadPlugin()
        {
            IsBusy = true;
            try
            {
                var moduleContent = await http.GetStringAsync(entry.Module);

                var modulePath = await Hunterpie.Instance.InstallPlugin(moduleContent);

#if !DEBUG
                // we don't actually care if this request is failed, nor interested in value, so we will not await it
                _ = PluginRegistryService.Instance.ReportInstall(entry.InternalName);
#endif
                DownloadReadme(modulePath);

                // when plugin is installed, we can open it's directory
                openDirAction = new PluginActionViewModel(
                    GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_DIRECTORY']"),
                    Application.Current.FindResource("ICON_FOLDER") as ImageSource,
                    new ArglessRelayCommand(() => Process.Start(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                                             "modules", this.InternalName)))
                    );
                this.Actions.Insert(0, openDirAction);

                pluginList.UpdatePluginsArrangement();

                OnPropertyChanged(nameof(CanDelete));
                OnPropertyChanged(nameof(CanInstall));
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #3
0
        public static string FormatLongDate(DateTime?dateTime)
        {
            if (dateTime == null)
            {
                return(null);
            }

            var    diffDate = DateTime.Now.Subtract(dateTime.Value);
            string diffStr;

            if (diffDate.TotalDays >= 1)
            {
                diffStr = GStrings
                          .GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_LAST_UPDATE_STRING_DAYS_PART']")
                          .Replace("{DaysAgo}", ((int)diffDate.TotalDays).ToString());
            }
            else
            {
                diffStr = GStrings
                          .GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_LAST_UPDATE_STRING_HOURS_PART']")
                          .Replace("{HoursAgo}", ((int)diffDate.TotalHours).ToString());
            }

            return(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_LAST_UPDATE_STRING']")
                   .Replace("{UpdateTime}", dateTime.Value.ToLongDateString())
                   .Replace("{TimeAgo}", diffStr));
        }
Пример #4
0
 private string GetDescription()
 {
     if (ctx is null || ctx?.Player is null || IsDisposed)
     {
         return("");
     }
     // Custom description for special zones
     switch (ctx.Player.ZoneID)
     {
     case 504:
         return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_TRAINING']"));
     }
     if (ctx.Player.InPeaceZone)
     {
         return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_IN_TOWN']"));
     }
     if (ctx.HuntedMonster == null)
     {
         return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_EXPLORING']"));
     }
     else
     {
         if (string.IsNullOrEmpty(ctx.HuntedMonster?.Name) || ctx.HuntedMonster?.Name == "Missing Translation")
         {
             return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_EXPLORING']"));
         }
         return(UserSettings.PlayerConfig.RichPresence.ShowMonsterHealth ? GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_HUNTING']").Replace("{Monster}", ctx.HuntedMonster.Name).Replace("{Health}", $"{(int)(ctx.HuntedMonster.HPPercentage * 100)}%") : GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_HUNTING']").Replace("{Monster}", ctx.HuntedMonster.Name).Replace("({Health})", null));
     }
 }
Пример #5
0
 public Hunterpie()
 {
     // Initialize debugger and theme
     Debugger.InitializeDebugger();
     UserSettings.InitializePlayerConfig();
     LoadCustomTheme();
     Debugger.LoadNewColors();
     InitializeComponent();
     OpenDebugger();
     AppDomain.CurrentDomain.UnhandledException += ExceptionLogger;
     // Initialize everything under this line
     if (!CheckIfUpdateEnableAndStart())
     {
         return;
     }
     InitializeTrayIcon();
     // Updates version_text
     this.version_text.Content = $"Version: {HUNTERPIE_VERSION} ({UserSettings.PlayerConfig.HunterPie.Update.Branch})";
     Debugger.Warn("Initializing HunterPie!");
     GStrings.InitStrings(UserSettings.PlayerConfig.HunterPie.Language);
     MonsterData.LoadMonsterData();
     AbnormalityData.LoadAbnormalityData();
     SetHotKeys();
     StartEverything();
 }
Пример #6
0
 private void LoadCustomTheme()
 {
     if (UserSettings.PlayerConfig.HunterPie.Theme == null || UserSettings.PlayerConfig.HunterPie.Theme == "Default")
     {
         return;
     }
     if (!Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Themes")))
     {
         Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Themes"));
     }
     if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"Themes/{UserSettings.PlayerConfig.HunterPie.Theme}")))
     {
         Debugger.Error(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_THEME_NOT_FOUND_ERROR']".Replace("{THEME_NAME}", UserSettings.PlayerConfig.HunterPie.Theme)));
         return;
     }
     try {
         using (FileStream stream = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"Themes/{UserSettings.PlayerConfig.HunterPie.Theme}"), FileMode.Open)) {
             XamlReader         reader          = new XamlReader();
             ResourceDictionary ThemeDictionary = (ResourceDictionary)reader.LoadAsync(stream);
             Application.Current.Resources.MergedDictionaries.Add(ThemeDictionary);
             Debugger.Warn(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_THEME_LOAD_WARN']"));
         }
     } catch (Exception err) {
         Debugger.Error($"{GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_THEME_NOT_LOAD_ERROR']")}\n{err}");
     }
 }
Пример #7
0
 private void argsTextBox_LostFocus(object sender, System.Windows.RoutedEventArgs e)
 {
     if (argsTextBox.Text == "")
     {
         argsTextBox.Text = GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_LAUNCHARGS_NOARGS']");
     }
 }
Пример #8
0
        public void HandlePresence(object source, EventArgs e)
        {
            if (Instance == null)
            {
                return;
            }

            // Do nothing if RPC is disabled
            if (!isVisible)
            {
                return;
            }

            if (!FailedToRegisterScheme)
            {
                if (ctx.Player.SteamSession != 0 && ctx.Player.InPeaceZone && UserSettings.PlayerConfig.RichPresence.LetPeopleJoinSession)
                {
                    Instance.Secrets.JoinSecret = $"{ctx.Player.SteamSession}/{ctx.Player.SteamID}";
                }
                else
                {
                    Instance.Secrets.JoinSecret = null;
                }
            }

            // Only update RPC if player isn't in loading screen
            switch (ctx.Player.ZoneID)
            {
            case 0:
                Instance.Details = ctx.Player.PlayerAddress == 0 ? GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_IN_MAIN_MENU']") : GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_IN_LOADING_SCREEN']");
                Instance.State   = null;
                GenerateAssets("main-menu", null, null, null);
                Instance.Party = null;
                break;

            default:
                if (ctx.Player.PlayerAddress == 0)
                {
                    Instance.Details = GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_DESCRIPTION_IN_MAIN_MENU']");
                    Instance.State   = null;
                    GenerateAssets("main-menu", null, null, null);
                    Instance.Party = null;
                    break;
                }
                Instance.Details = GetDescription();
                Instance.State   = GetState();
                GenerateAssets(ctx.Player.ZoneName == null ? "main-menu" : $"st{ctx.Player.ZoneID}", ctx.Player.ZoneID == 0 ? null : ctx.Player.ZoneName, ctx.Player.WeaponName == null ? "hunter-rank" : $"weap{ctx.Player.WeaponID}", $"{ctx.Player.Name} | HR: {ctx.Player.Level} | MR: {ctx.Player.MasterRank}");
                if (!ctx.Player.InPeaceZone)
                {
                    MakeParty(ctx.Player.PlayerParty.Size, ctx.Player.PlayerParty.MaxSize, ctx.Player.PlayerParty.PartyHash);
                }
                else
                {
                    MakeParty(ctx.Player.PlayerParty.LobbySize, ctx.Player.PlayerParty.MaxLobbySize, ctx.Player.SteamSession.ToString());
                }
                Instance.Timestamps = NewTimestamp(ctx.Time);
                break;
            }
            Client.SetPresence(Instance);
        }
Пример #9
0
 private void OnReady(object sender, ReadyMessage args)
 {
     Debugger.Discord(
         GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_DISCORD_USER_CONNECTED']")
         .Replace("{Username}", args.User.ToString())
         );
 }
Пример #10
0
 private void PopulateMonsterBox()
 {
     for (int i = 0; i < 5; i++)
     {
         MonsterShowModeSelection.Items.Add(
             GStrings.GetLocalizationByXPath($"/Settings/String[@ID='STATIC_MONSTER_BAR_MODE_{i}']"));
     }
 }
Пример #11
0
 private void PopulateProxyModeBox()
 {
     foreach (PluginProxyMode item in Enum.GetValues(typeof(PluginProxyMode)))
     {
         comboPluginUpdateProxy.Items.Add(
             GStrings.GetLocalizationByXPath($"/Settings/String[@ID='PLUGIN_PROXY_MODE_{item.ToString("G").ToUpperInvariant()}']"));
     }
 }
Пример #12
0
 private void PopulatePlotDisplayModeBox()
 {
     foreach (DamagePlotMode item in Enum.GetValues(typeof(DamagePlotMode)))
     {
         comboDamagePlotMode.Items.Add(
             GStrings.GetLocalizationByXPath($"/Settings/String[@ID='DAMAGE_PLOT_MODE_{(byte)item}']"));
     }
 }
Пример #13
0
        public Hunterpie()
        {
            if (CheckIfHunterPieOpen())
            {
                Close();
                return;
            }

            AppDomain.CurrentDomain.UnhandledException += ExceptionLogger;

            SetDPIAwareness();

            Buffers.Initialize(1024);
            Buffers.Add <byte>(64);

            // Initialize debugger and player config
            Debugger.InitializeDebugger();
            UserSettings.InitializePlayerConfig();

            // Initialize localization
            GStrings.InitStrings(UserSettings.PlayerConfig.HunterPie.Language);

            // Load custom theme and console colors
            LoadCustomTheme();
            Debugger.LoadNewColors();

            InitializeComponent();

            OpenDebugger();
            // Initialize everything under this line
            if (!CheckIfUpdateEnableAndStart())
            {
                return;
            }

            Width  = UserSettings.PlayerConfig.HunterPie.Width;
            Height = UserSettings.PlayerConfig.HunterPie.Height;

            // Convert the old HotKey to the new one
            ConvertOldHotkeyToNew(UserSettings.PlayerConfig.Overlay.ToggleDesignModeKey);

            IsUpdating = false;
            InitializeTrayIcon();

            // Update version text
            this.version_text.Text = GStrings.GetLocalizationByXPath("/Console/String[@ID='CONSOLE_VERSION']").Replace("{HunterPie_Version}", HUNTERPIE_VERSION).Replace("{HunterPie_Branch}", UserSettings.PlayerConfig.HunterPie.Update.Branch);

            // Initializes the rest of HunterPie
            LoadData();
            Debugger.Warn(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_HUNTERPIE_INITIALIZED']"));

            BUTTON_UPLOADBUILD.IsEnabled = false;
            BUTTON_UPLOADBUILD.Opacity   = 0.5;

            SetHotKeys();
            StartEverything();
        }
Пример #14
0
 public HunterPieXmlDataProvider()
 {
     // load embedded en-us localization if design time
     if (DesignUtils.IsInDesignMode && (Document == null || Document.ChildNodes.Count == 0))
     {
         using var res =
                   typeof(Hunterpie).Assembly.GetManifestResourceStream("HunterPie.Languages.en-us.xml");
         GStrings.LoadTranslationsFromStream(this, res);
     }
 }
Пример #15
0
        private void OnCloseWindowButtonClick(object sender, MouseButtonEventArgs e)
        {
            // X button function;
            bool ExitConfirmation = MessageBox.Show(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_QUIT']"), "HunterPie", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;

            if (ExitConfirmation)
            {
                Close();
            }
        }
Пример #16
0
 private bool CheckIfUpdateEnableAndStart()
 {
     if (UserSettings.PlayerConfig.HunterPie.Update.Enabled)
     {
         bool     justUpdated   = false;
         bool     latestVersion = false;
         string[] args          = Environment.GetCommandLineArgs();
         foreach (string argument in args)
         {
             if (argument.StartsWith("justUpdated"))
             {
                 string parsed = ParseArgs(argument);
                 justUpdated = parsed == "True";
             }
             if (argument.StartsWith("latestVersion"))
             {
                 string parsed = ParseArgs(argument);
                 latestVersion = parsed == "True";
             }
             if (argument.StartsWith("offlineMode"))
             {
                 OfflineMode = ParseArgs(argument) == "True";
             }
         }
         if (justUpdated)
         {
             OpenChangelog();
             return(true);
         }
         if (latestVersion)
         {
             return(true);
         }
         Debugger.Log("Updating updater.exe");
         // This will update Update.exe
         AutoUpdate au = new AutoUpdate(UserSettings.PlayerConfig.HunterPie.Update.Branch);
         au.Instance.DownloadFileCompleted += OnUpdaterDownloadComplete;
         OfflineMode = au.offlineMode;
         if (!au.CheckAutoUpdate() && !au.offlineMode)
         {
             HandleUpdaterUpdate();
         }
         else
         {
             return(true);
         }
         Hide();
         return(false);
     }
     else
     {
         Debugger.Warn(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_AUTOUPDATE_DISABLED_WARN']"));
         return(true);
     }
 }
        private void OnSongQueueUpdate(object source, HuntingHornSongEventArgs args)
        {
            if (args.IsCastingSongs)
            {
                return;
            }
            Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() =>
            {
                if (SongQueue.Children.Count == args.SongsQueued)
                {
                    int index = args.RawSongIndexesQueue[args.LastSongIndex];

                    if (args.Songs.Length < index + 1 || index < 0)
                    {
                        return;
                    }

                    sHuntingHornSong song = args.Songs[index];

                    SongComponent songComponent = new SongComponent()
                    {
                        SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0)
                    };
                    songComponent.SetSong(song.Notes, cachedBrushes);
                    SongQueue.Children.Insert(0, songComponent);

                    SongQueue.Children.RemoveAt(SongQueue.Children.Count - 1);
                }
                else
                {
                    bool insert = SongQueue.Children.Count > 0;
                    // Add remaning songs to the queue based on the SongQueue length
                    for (int i = 0; SongQueue.Children.Count < args.SongsQueued; i++)
                    {
                        int index             = args.SongIndexesQueue[i];
                        sHuntingHornSong song = args.Songs[index];

                        SongComponent songComponent = new SongComponent()
                        {
                            SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0)
                        };
                        songComponent.SetSong(song.Notes, cachedBrushes);

                        if (insert)
                        {
                            SongQueue.Children.Insert(0, songComponent);
                        }
                        else
                        {
                            SongQueue.Children.Add(songComponent);
                        }
                    }
                }
            }));
        }
Пример #18
0
 private void OnUpdaterDownloadComplete(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Debugger.Error(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_UPDATE_ERROR']"));
         Debugger.Warn(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_OFFLINEMODE_WARN']"));
         this.OfflineMode = true;
         return;
     }
     HandleUpdaterUpdate();
 }
Пример #19
0
 private void LaunchGame()
 {
     try {
         Process createGameProcess = new Process();
         createGameProcess.StartInfo.FileName  = "steam://run/582010";
         createGameProcess.StartInfo.Arguments = UserSettings.PlayerConfig.HunterPie.Launch.LaunchArgs;
         createGameProcess.Start();
     } catch (Exception err) {
         Debugger.Error($"{GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_LAUNCH_ERROR']")}\n{err.ToString()}");
     }
 }
 private void UpdatePredictedSong(sHuntingHornSong[] predictions)
 {
     PredictionSheet.Children.Clear();
     foreach (sHuntingHornSong song in predictions)
     {
         SongPredComponent predDisplay = new SongPredComponent()
         {
             SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0)
         };
         predDisplay.UpdateNote(song.Notes[song.NotesLength - 1], cachedBrushes[song.Notes[song.NotesLength - 1] - 1]);
         PredictionSheet.Children.Add(predDisplay);
     }
 }
Пример #21
0
 private void LaunchGame()
 {
     try {
         ProcessStartInfo GameStartInfo = new ProcessStartInfo {
             FileName        = "steam://run/582010",
             Arguments       = UserSettings.PlayerConfig.HunterPie.Launch.LaunchArgs,
             UseShellExecute = true
         };
         Process.Start(GameStartInfo);
     } catch (Exception err) {
         Debugger.Error($"{GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_LAUNCH_ERROR']")}\n{err}");
     }
 }
Пример #22
0
        private void Client_OnJoinRequested(object sender, DiscordRPC.Message.JoinRequestMessage args)
        {
            Debugger.Discord(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_DISCORD_JOIN_REQUEST']").Replace("{Username}", args.User.ToString()));

            App.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => {
                GUI.Widgets.Notification_Widget.DiscordNotify DiscordNotification = new GUI.Widgets.Notification_Widget.DiscordNotify(args);

                DiscordNotification.OnRequestAccepted += OnDiscordRequestAccepted;
                DiscordNotification.OnRequestRejected += OnDiscordRequestRejected;

                DiscordNotification.Show();
            }));
        }
Пример #23
0
        /* Connection */

        public void StartRPC()
        {
            if (isOffline)
            {
                return;
            }

            // Check if connection exists to avoid creating multiple connections
            Instance = new RichPresence();
            Debugger.Discord(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_DISCORD_CONNECTED']"));
            Instance.Secrets = new Secrets();

            try
            {
                Client = new DiscordRpcClient(AppId, autoEvents: true);
            } catch (Exception err)
            {
                Debugger.Error($"Failed to create Rich Presence connection:\n{err}");
                return;
            }


            try
            {
                Client.RegisterUriScheme("582010");
            }
            catch (Exception err)
            {
                Debugger.Error(err);
                FailedToRegisterScheme = true;
            }

            if (!FailedToRegisterScheme)
            {
                // Events
                Client.OnReady         += Client_OnReady;
                Client.OnJoinRequested += Client_OnJoinRequested;
                Client.OnJoin          += Client_OnJoin;

                Client.SetSubscription(EventType.JoinRequest | EventType.Join);
            }

            Client.Initialize();
            if (!UserSettings.PlayerConfig.RichPresence.Enabled && isVisible)
            {
                Client?.ClearPresence();
                isVisible = false;
            }
        }
Пример #24
0
 public Hunterpie()
 {
     InitializeComponent();
     OpenDebugger();
     // Initialize rich presence
     Discord = new Presence(MonsterHunter);
     // Initialize everything under this line
     UserSettings.InitializePlayerConfig();
     CheckIfUpdateEnableAndStart();
     // Updates version_text
     this.version_text.Content = $"Version: {HUNTERPIE_VERSION}";
     Debugger.Warn("Initializing HunterPie!");
     GStrings.InitStrings();
     StartEverything();
 }
        private void PopulateAbnormalities(IEnumerable <AbnormalityInfo> abnormalities, Panel panel)
        {
            foreach (AbnormalityInfo abnormality in abnormalities)
            {
                string      name      = GStrings.GetAbnormalityByID(abnormality.Type, abnormality.Id, 0);
                bool        isEnabled = bar.AcceptedAbnormalities.Contains(abnormality.InternalId);
                ImageSource icon      = (ImageSource)FindResource(abnormality.IconName);
                icon?.Freeze();

                AbnormalitySettingControl settingsControl = new AbnormalitySettingControl();
                settingsControl.SetAbnormalityInfo(icon, name, abnormality.InternalId, isEnabled);
                abnormalityControls.Add(settingsControl);
                panel.Children.Add(settingsControl);
            }
        }
        private void ReconstructQueue()
        {
            for (int i = 0; SongQueue.Children.Count < Context.SongsQueued; i++)
            {
                int index             = Context.SongIndexesQueue[i];
                sHuntingHornSong song = Context.Songs[index];

                SongComponent songComponent = new SongComponent()
                {
                    SongName = GStrings.GetAbnormalityByID("HUNTINGHORN", song.BuffId, 0)
                };
                songComponent.SetSong(song.Notes, cachedBrushes);

                SongQueue.Children.Add(songComponent);
            }
        }
Пример #27
0
        private void OnLaunchGameButtonClick(object sender, RoutedEventArgs e)
        {
            // Shorten the class name
            var launchOptions = UserSettings.PlayerConfig.HunterPie.Launch;

            if (launchOptions.GamePath == "")
            {
                if (MessageBox.Show(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_MISSING_PATH']"), GStrings.GetLocalizationByXPath("/Console/String[@ID='TITLE_MISSING_PATH']"), MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
                {
                    OpenSettings();
                }
            }
            else
            {
                LaunchGame();
            }
        }
 private void PopulateDebuffs()
 {
     foreach (XmlNode Abnorm in AbnormalityData.GetBlightAbnormalities())
     {
         string      Type       = "DEBUFF";
         int         ID         = int.Parse(Abnorm.Attributes["ID"].Value);
         string      Name       = GStrings.GetAbnormalityByID(Type, ID, 0);
         string      InternalID = $"DE_{ID}";
         bool        IsEnabled  = UserSettings.PlayerConfig.Overlay.AbnormalitiesWidget.BarPresets[BuffTrayIndex].AcceptedAbnormalities.Contains(InternalID);
         ImageSource Icon       = TryFindResource(Abnorm.Attributes["Icon"].Value) as ImageSource ?? FindResource("ICON_MISSING") as ImageSource;
         Icon?.Freeze();
         Parts.AbnormalitySettingControl AbnormDisplay = new Parts.AbnormalitySettingControl();
         AbnormDisplay.SetAbnormalityInfo(Icon, Name, InternalID, IsEnabled);
         AbnormalitiesList.Add(AbnormDisplay);
         Debuffs.Children.Add(AbnormDisplay);
     }
 }
Пример #29
0
        public static string GetLinkName(string name)
        {
            if (name == null)
            {
                return("");
            }
            switch (name.ToLowerInvariant())
            {
            case "home":
            case "homepage":
                return(GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_HOMEPAGE']"));

            case "discord":
                return(GStrings.GetLocalizationByXPath("/Settings/String[@ID='STATIC_DISCORD_SETTINGS']"));
            }

            return(name);
        }
Пример #30
0
 private string GetState()
 {
     if (ctx.Player.PlayerParty.Size > 1 || ctx.Player.PlayerParty.LobbySize > 1)
     {
         if (ctx.Player.InPeaceZone)
         {
             return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_STATE_LOBBY']"));
         }
         else
         {
             return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_STATE_PARTY']"));
         }
     }
     else
     {
         return(GStrings.GetLocalizationByXPath("/RichPresence/String[@ID='RPC_STATE_SOLO']"));
     }
 }