From 734070e129f95a9301f318f70c84b2a72833cebb Mon Sep 17 00:00:00 2001 From: Jukkales Date: Fri, 3 May 2024 14:28:36 +0200 Subject: [PATCH] changed repo url and build update --- .github/workflows/build-plugin.yml | 47 ++++++++-------- CHANGELOG.md | 3 + HoardFarm/HoardFarm.cs | 89 +++++++++++++++++++----------- HoardFarm/HoardFarm.csproj | 2 +- 4 files changed, 85 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build-plugin.yml b/.github/workflows/build-plugin.yml index 19ead04..ac3c798 100644 --- a/.github/workflows/build-plugin.yml +++ b/.github/workflows/build-plugin.yml @@ -6,43 +6,44 @@ on: jobs: build: - runs-on: windows-latest - permissions: - contents: write + runs-on: ubuntu-latest + env: + DALAMUD_HOME: /tmp/dalamud steps: - uses: actions/checkout@v4 with: submodules: true + + - name: Get Tag Name + run: echo "tag=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//')" >> $GITHUB_ENV - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: '8.x.x' + + - name: Download Dalamud Latest + run: | + wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O ${{ env.DALAMUD_HOME }}.zip + unzip ${{ env.DALAMUD_HOME }}.zip -d ${{ env.DALAMUD_HOME }} - name: Restore run: dotnet restore - - - name: Download Dalamud - run: | - Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip - Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\" - name: Build run: | - dotnet build --no-restore --configuration Release --nologo - - - uses: ncipollo/release-action@v1 - with: - artifacts: "./HoardFarm/bin/x64/Release/HoardFarm/latest.zip" - name: ${{ github.event.head_commit.message }} - makeLatest: true - - - run: | - rm -R ./HoardFarm/bin/x64/Release/HoardFarm - - - name: Upload Build Artifact - uses: actions/upload-artifact@v4 + dotnet build --no-restore --configuration Release --nologo -p:AssemblyVersion=${{ env.tag }} + + - name: Publish Version + uses: PunishXIV/dynamis-action@v1 + id: dynamis with: - name: latest - path: ./HoardFarm/bin/x64/Release/ + plugin_id: 52 + internal_name: 'HoardFarm' + version_number: ${{ env.tag }} + path: 'HoardFarm/bin/x64/Release/HoardFarm/latest.zip' + type: 'latest' + dalamud_version: '9' + env: + PUBLISHER_KEY: ${{ secrets.PUBLISHER_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2129425..f5eb0cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ I try to keep this changelog up to date with the latest changes in the project. +## [1.5.2.4] +- changed repo url + ## [1.5.2.3] - tamed AutoRetainer - camera now aligns to the player while running diff --git a/HoardFarm/HoardFarm.cs b/HoardFarm/HoardFarm.cs index 92d8ee2..7188a36 100644 --- a/HoardFarm/HoardFarm.cs +++ b/HoardFarm/HoardFarm.cs @@ -1,4 +1,5 @@ -using System.Diagnostics.CodeAnalysis; +using System.Collections; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using AutoRetainerAPI; using Dalamud; @@ -18,12 +19,15 @@ namespace HoardFarm; [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public sealed class HoardFarm : IDalamudPlugin { - private readonly HoardFarmService hoardFarmService; + private const string OldRepoUrl = "https://raw.githubusercontent.com/Jukkales/DalamudPlugins/master/repo.json"; + private const string NewRepoUrl = "https://puni.sh/api/repository/jukka"; private readonly AchievementService achievementService; - private readonly MainWindow mainWindow; + private readonly AutoRetainerApi autoRetainerApi; private readonly ConfigWindow configWindow; private readonly DeepDungeonMenuOverlay deepDungeonMenuOverlay; - private readonly AutoRetainerApi autoRetainerApi; + + private readonly HoardFarmService hoardFarmService; + private readonly MainWindow mainWindow; private readonly RetainerService retainerService; public readonly WindowSystem WindowSystem = new("HoardFarm"); @@ -31,7 +35,7 @@ public HoardFarm(DalamudPluginInterface? pluginInterface) { pluginInterface?.Create(); P = this; - + ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector); DalamudReflector.RegisterOnInstalledPluginsChangedEvents(() => { @@ -51,13 +55,13 @@ public HoardFarm(DalamudPluginInterface? pluginInterface) hoardFarmService = new HoardFarmService(); HoardService = hoardFarmService; - + achievementService = new AchievementService(); Achievements = achievementService; autoRetainerApi = new AutoRetainerApi(); RetainerApi = autoRetainerApi; - + retainerService = new RetainerService(); RetainerScv = retainerService; @@ -65,17 +69,17 @@ public HoardFarm(DalamudPluginInterface? pluginInterface) PluginInterface.UiBuilder.OpenMainUi += () => OnCommand(); PluginInterface.UiBuilder.OpenConfigUi += ShowConfigWindow; Framework.Update += FrameworkUpdate; - + PluginService.TaskManager = new TaskManager(); - - - EzCmd.Add("/hoardfarm", (_, args) => OnCommand(args) , - "Opens the Hoard Farm window.\n" + - "/hoardfarm config | c → Open the config window.\n" + - "/hoardfarm enable | e → Enable farming mode.\n" + - "/hoardfarm disable | d → Disable farming mode.\n" + - "/hoardfarm toggle | t → Toggle farming mode.\n" - ); + + + EzCmd.Add("/hoardfarm", (_, args) => OnCommand(args), + "Opens the Hoard Farm window.\n" + + "/hoardfarm config | c → Open the config window.\n" + + "/hoardfarm enable | e → Enable farming mode.\n" + + "/hoardfarm disable | d → Disable farming mode.\n" + + "/hoardfarm toggle | t → Toggle farming mode.\n" + ); CultureInfo.DefaultThreadCurrentUICulture = ClientState.ClientLanguage switch { @@ -84,26 +88,28 @@ public HoardFarm(DalamudPluginInterface? pluginInterface) ClientLanguage.Japanese => CultureInfo.GetCultureInfo("ja"), _ => CultureInfo.GetCultureInfo("en") }; - } - - - private void FrameworkUpdate(IFramework framework) - { - YesAlreadyManager.Tick(); + + TryUpdateRepo(); } public void Dispose() { WindowSystem.RemoveAllWindows(); hoardFarmService.Dispose(); - + autoRetainerApi.Dispose(); retainerService.Dispose(); - + Framework.Update -= FrameworkUpdate; ECommonsMain.Dispose(); } + + private void FrameworkUpdate(IFramework framework) + { + Tick(); + } + private void DrawUI() { WindowSystem.Draw(); @@ -112,7 +118,7 @@ private void DrawUI() public void OnCommand(string? args = null) { args = args?.Trim().ToLower() ?? ""; - + switch (args) { case "c": @@ -125,10 +131,7 @@ public void OnCommand(string? args = null) return; case "d": case "disable": - if (HoardService.HoardMode) - { - HoardService.FinishRun = true; - } + if (HoardService.HoardMode) HoardService.FinishRun = true; return; case "t": case "toggle": @@ -139,12 +142,12 @@ public void OnCommand(string? args = null) break; } } - + public void ShowConfigWindow() { configWindow.IsOpen = true; } - + public void ShowMainWindow() { if (!mainWindow.IsOpen) @@ -153,4 +156,26 @@ public void ShowMainWindow() mainWindow.IsOpen = true; } } + + private void TryUpdateRepo() + { + var conf = DalamudReflector.GetService("Dalamud.Configuration.Internal.DalamudConfiguration"); + var repos = (IEnumerable)conf.GetFoP("ThirdRepoList"); + if (repos != null) + { + foreach (var r in repos) + if (OldRepoUrl.EqualsIgnoreCase((string)r.GetFoP("Url"))) + { + PluginLog.Information("Updating HoardFarm repository URL"); + var pluginMgr = DalamudReflector.GetPluginManager(); + Safe(() => + { + r.SetFoP("Url", NewRepoUrl); + conf.Call("Save", []); + pluginMgr.Call("SetPluginReposFromConfigAsync", [true]); + }); + return; + } + } + } } diff --git a/HoardFarm/HoardFarm.csproj b/HoardFarm/HoardFarm.csproj index 747709a..07802b2 100644 --- a/HoardFarm/HoardFarm.csproj +++ b/HoardFarm/HoardFarm.csproj @@ -2,7 +2,7 @@ Jukkales - 1.5.2.3 + 0.0.0.0 HoardFarm Dalamud Plugin https://github.com/Jukkales/HoardFarm