Skip to content

Commit

Permalink
changed repo url and build update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jukkales committed May 3, 2024
1 parent c938e96 commit 734070e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 56 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
89 changes: 57 additions & 32 deletions HoardFarm/HoardFarm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using AutoRetainerAPI;
using Dalamud;
Expand All @@ -18,20 +19,23 @@ 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");

public HoardFarm(DalamudPluginInterface? pluginInterface)
{
pluginInterface?.Create<PluginService>();
P = this;

ECommonsMain.Init(pluginInterface, this, Module.DalamudReflector);
DalamudReflector.RegisterOnInstalledPluginsChangedEvents(() =>
{
Expand All @@ -51,31 +55,31 @@ public HoardFarm(DalamudPluginInterface? pluginInterface)

hoardFarmService = new HoardFarmService();
HoardService = hoardFarmService;

achievementService = new AchievementService();
Achievements = achievementService;

autoRetainerApi = new AutoRetainerApi();
RetainerApi = autoRetainerApi;

retainerService = new RetainerService();
RetainerScv = retainerService;

PluginInterface.UiBuilder.Draw += DrawUI;
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
{
Expand All @@ -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();
Expand All @@ -112,7 +118,7 @@ private void DrawUI()
public void OnCommand(string? args = null)
{
args = args?.Trim().ToLower() ?? "";

switch (args)
{
case "c":
Expand All @@ -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":
Expand All @@ -139,12 +142,12 @@ public void OnCommand(string? args = null)
break;
}
}

public void ShowConfigWindow()
{
configWindow.IsOpen = true;
}

public void ShowMainWindow()
{
if (!mainWindow.IsOpen)
Expand All @@ -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;
}
}
}
}
2 changes: 1 addition & 1 deletion HoardFarm/HoardFarm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Jukkales</Authors>
<Version>1.5.2.3</Version>
<Version>0.0.0.0</Version>
<Description>HoardFarm Dalamud Plugin</Description>
<PackageProjectUrl>https://github.com/Jukkales/HoardFarm</PackageProjectUrl>
</PropertyGroup>
Expand Down

0 comments on commit 734070e

Please sign in to comment.