Skip to content

Commit 1ef796e

Browse files
committed
Merge branch 'master' of https://github.com/ffxivcode/AutoDuty
2 parents 19a4ad9 + 64711c9 commit 1ef796e

File tree

112 files changed

+3541
-2060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3541
-2060
lines changed

.github/workflows/md5filecreation.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: path-mdf-calc-onanychange
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
env:
8+
BASE_BRANCH: master
9+
10+
jobs:
11+
workflow:
12+
if: github.event.pull_request.merged == true
13+
runs-on: ubuntu-latest
14+
name: path-mdf-calc-onanychange
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Get changed files in the paths folder
20+
id: changed-files-specific
21+
uses: tj-actions/[email protected]
22+
with:
23+
safe_output: "false"
24+
quotepath: "false"
25+
files: AutoDuty/Paths/**
26+
separator: ","
27+
28+
- name: Calculate MD5 hashes and create JSON
29+
if: steps.changed-files-specific.outputs.any_changed == 'true'
30+
id: calculate-md5
31+
run: |
32+
mkdir -p AutoDuty/Paths
33+
md5sum AutoDuty/Paths/* > md5sums.txt
34+
python -c "
35+
import json
36+
md5_dict = {}
37+
with open('md5sums.txt', 'r') as f:
38+
for line in f:
39+
hash, filename = line.strip().split(' ')
40+
filename = filename.replace('AutoDuty/Paths/', '')
41+
md5_dict[filename] = hash
42+
with open('AutoDuty/Resources/md5s.json', 'w') as f:
43+
json.dump(md5_dict, f, indent=4)
44+
"
45+
cat AutoDuty/Resources/md5s.json
46+
47+
- name: Commit changes to new branch
48+
if: steps.changed-files-specific.outputs.any_changed == 'true'
49+
run: |
50+
git config --global user.name 'github-actions'
51+
git config --global user.email '[email protected]'
52+
git checkout -b md5 origin/${{ env.BASE_BRANCH }}
53+
git add AutoDuty/Resources/md5s.json
54+
git commit -m 'Add MD5 hashes for changed files'
55+
git push origin md5
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Create pull request
60+
if: steps.changed-files-specific.outputs.any_changed == 'true'
61+
run: gh pr create -B ${{ env.BASE_BRANCH }} -H md5 --title 'Update Path MD5' --body 'Created by Github action'
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Merge pull request
66+
if: steps.changed-files-specific.outputs.any_changed == 'true'
67+
run: |
68+
PR_NUMBER=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/ffxivcode/AutoDuty/pulls?head=ffxivcode:md5 | jq '.[0].number')
69+
gh pr merge $PR_NUMBER --merge --delete-branch
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
version_number: ${{ github.ref_name }}
4141
path: "AutoDuty/bin/Release/AutoDuty/latest.zip"
4242
type: "latest"
43-
dalamud_version: "10"
43+
dalamud_version: "11"
4444
changelog: ${{ github.event.release.body }}
4545
env:
4646
PUBLISHER_KEY: ${{ secrets.PUBLISHER_KEY }}

.github/workflows/publishtesting.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
version_number: ${{ github.ref_name }}
4848
path: "AutoDuty/bin/Release/AutoDuty/latest.zip"
4949
type: "testing"
50-
dalamud_version: "10"
50+
dalamud_version: "11"
5151
changelog: ${{ github.event.release.body }}
5252
env:
5353
PUBLISHER_KEY: ${{ secrets.PUBLISHER_KEY }}

AutoDuty/AutoDuty.cs

+110-75
Large diffs are not rendered by default.

AutoDuty/AutoDuty.csproj

+1-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131

3232
<ItemGroup>
3333
<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj" />
34-
<PackageReference Include="DalamudPackager" Version="2.1.13" />
35-
<PackageReference Include="Octokit" Version="13.0.1" />
36-
<PackageReference Include="TinyIpc" Version="4.3.1" />
34+
<PackageReference Include="DalamudPackager" Version="11.0.0" />
3735
<Reference Include="Serilog">
3836
<HintPath>$(DalamudLibPath)Serilog.dll</HintPath>
3937
<Private>false</Private>
@@ -81,8 +79,4 @@
8179
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
8280
</EmbeddedResource>
8381
</ItemGroup>
84-
85-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
86-
<Exec Command="cp &quot;$(ProjectDir)Paths\&quot;* &quot;$(ProjectDir)$(OutDir)&quot;" />
87-
</Target>
8882
</Project>

AutoDuty/AutoDuty.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Punchline": "AutoDuty",
55
"Description": "A plugin to run dungeons for you with Trust, Duty Support, Squadrons, Variants, and Regular, Requires BossMod, vnavmesh and a Rotation Plugin (BossMod AutoRotation or RotationSolverReborn)",
66
"InternalName": "AutoDuty",
7-
"DalamudApiLevel": "10",
7+
"DalamudApiLevel": "11",
88
"RepoUrl": "https://github.com/ffxivcode/AutoDuty",
99
"IconUrl": "https://s3.puni.sh/media/plugin/54/icon-15ug2vnr9m1.png",
1010
"ImageUrls": [

AutoDuty/Data/Classes.cs

+94-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
using Serilog.Events;
1+
using ECommons;
2+
using FFXIVClientStructs.FFXIV.Client.Game;
3+
using Serilog.Events;
24
using System.Collections.Generic;
5+
using System.IO;
36
using System.Linq;
47
using System.Numerics;
58
using System.Text.Json.Serialization;
69

710
namespace AutoDuty.Data
811
{
12+
using Lumina.Excel.Sheets;
13+
914
public class Classes
1015
{
1116
public class LogMessage
@@ -47,14 +52,17 @@ public class TrustMember
4752
{
4853
public uint Index { get; set; }
4954
public TrustRole Role { get; set; } // 0 = DPS, 1 = Healer, 2 = Tank, 3 = G'raha All Rounder
50-
public Lumina.Excel.GeneratedSheets.ClassJob? Job { get; set; } = null;//closest actual job that applies. G'raha gets Blackmage
55+
public ClassJob? Job { get; set; } = null;//closest actual job that applies. G'raha gets Blackmage
5156
public string Name { get; set; } = string.Empty;
5257
public TrustMemberName MemberName { get; set; }
5358

5459
public uint Level { get; set; }
5560
public uint LevelCap { get; set; }
5661
public uint LevelInit { get; set; }
5762
public bool LevelIsSet { get; set; }
63+
public uint UnlockQuest { get; init; }
64+
65+
public bool Available => this.UnlockQuest <= 0 || QuestManager.IsQuestComplete(this.UnlockQuest);
5866

5967
public void ResetLevel()
6068
{
@@ -77,9 +85,6 @@ public class PathFile
7785
[JsonPropertyName("actions")]
7886
public List<PathAction> Actions { get; set; } = [];
7987

80-
[JsonPropertyName("interactables")]
81-
public uint[] Interactables { get; set; } = [];
82-
8388
[JsonPropertyName("meta")]
8489
public PathFileMetaData Meta { get; set; } = new()
8590
{
@@ -129,5 +134,89 @@ public class PathFileChangelogEntry
129134
[JsonPropertyName("change")]
130135
public string Change { get; set; } = string.Empty;
131136
}
137+
138+
public class PollResponseClass
139+
{
140+
[JsonPropertyName("interval")]
141+
public int Interval { get; set; } = -1;
142+
143+
[JsonPropertyName("error")]
144+
public string Error { get; set; } = string.Empty;
145+
146+
[JsonPropertyName("error_description")]
147+
public string Error_Description { get; set; } = string.Empty;
148+
149+
[JsonPropertyName("error_uri")]
150+
public string Error_Uri { get; set; } = string.Empty;
151+
152+
[JsonPropertyName("access_token")]
153+
public string Access_Token = string.Empty;
154+
155+
[JsonPropertyName("expires_in")]
156+
public int Expires_In { get; set; } = 0;
157+
158+
[JsonPropertyName("refresh_token")]
159+
public string Refresh_Token = string.Empty;
160+
161+
[JsonPropertyName("refresh_token_expires_in")]
162+
public int Refresh_Token_Expires_In = 0;
163+
164+
[JsonPropertyName("token_type")]
165+
public string Token_Type = string.Empty;
166+
167+
[JsonPropertyName("scope")]
168+
public string Scope = string.Empty;
169+
}
170+
171+
public class UserCode
172+
{
173+
[JsonPropertyName("device_code")]
174+
public string Device_Code { get; set; } = string.Empty;
175+
176+
[JsonPropertyName("expires_in")]
177+
public int Expires_In { get; set; } = 0;
178+
179+
[JsonPropertyName("user_code")]
180+
public string User_Code { get; set; } = string.Empty;
181+
182+
[JsonPropertyName("verification_uri")]
183+
public string Verification_Uri { get; set; } = string.Empty;
184+
185+
[JsonPropertyName("interval")]
186+
public int Interval { get; set; } = 500;
187+
}
188+
189+
public class GitHubIssue
190+
{
191+
[JsonPropertyName("title")]
192+
public string Title { get; set; } = "[Bug] ";
193+
194+
[JsonPropertyName("body")]
195+
public string Body { get; set; } = string.Empty;
196+
197+
[JsonPropertyName("labels")]
198+
public List<string> Labels = ["bug", "unconfirmed"];
199+
200+
public static string Version => $"{Plugin.Configuration.Version}";
201+
202+
public static string LogFile => Plugin.DalamudLogEntries.SelectMulti(x => x.Message).ToList().ToCustomString("\n");
203+
204+
public static string InstalledPlugins => PluginInterface.InstalledPlugins.Select(x => $"{x.InternalName}, Version= {x.Version}").ToList().ToCustomString("\n");
205+
206+
public static string ConfigFile => ReadConfigFile().ToCustomString("\n");
207+
208+
private static List<string> ReadConfigFile()
209+
{
210+
using FileStream fs = new(Plugin.ConfigFile.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
211+
using StreamReader sr = new(fs);
212+
string? x;
213+
List<string> strings = [];
214+
while ((x = sr.ReadLine()) != null)
215+
{
216+
strings.Add(x);
217+
}
218+
return strings;
219+
}
220+
}
132221
}
133222
}

AutoDuty/Data/Enums.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Lumina.Excel.GeneratedSheets;
2-
using System;
1+
using System;
32

43
namespace AutoDuty.Data
54
{

AutoDuty/Helpers/AutoEquipHelper.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ internal static void AutoEquipUpdate(IFramework framework)
7979
if (!_statesExecuted.HasFlag(AutoEquipState.Setting_Up))
8080
{
8181
Svc.Log.Debug($"AutoEquipHelper - RecommendEquipModule - SetupForClassJob");
82-
RecommendEquipModule.Instance()->SetupForClassJob((byte)Svc.ClientState.LocalPlayer!.ClassJob.Id);
82+
RecommendEquipModule.Instance()->SetupForClassJob((byte)Svc.ClientState.LocalPlayer!.ClassJob.RowId);
8383
_statesExecuted |= AutoEquipState.Setting_Up;
8484
}
8585
else if (!_statesExecuted.HasFlag(AutoEquipState.Equipping))
@@ -122,7 +122,7 @@ internal static void AutoEquipGearSetterUpdate(IFramework framework)
122122
else if (_gearset != null && !_statesExecuted.HasFlag(AutoEquipState.Getting_Ring_Count))
123123
{
124124
Svc.Log.Debug($"AutoEquipHelper - Gearsetter_IPCSubscriber - GettingRingCountFromRecommendation");
125-
_ringCount = _equippedRingCount = _gearset.Where(x => InventoryHelper.GetEquippedSlot(InventoryHelper.GetExcelItem(x.ItemId)!).EqualsAny(EquippedSlotIndex.Ring1, EquippedSlotIndex.Ring2)).Count();
125+
_ringCount = _equippedRingCount = _gearset.Count(x => InventoryHelper.GetEquippedSlot(InventoryHelper.GetExcelItem(x.ItemId).Value).EqualsAny(EquippedSlotIndex.Ring1, EquippedSlotIndex.Ring2));
126126
_statesExecuted |= AutoEquipState.Getting_Ring_Count;
127127
}
128128
else if (_gearset != null && _index < _gearset.Count)
@@ -134,18 +134,18 @@ internal static void AutoEquipGearSetterUpdate(IFramework framework)
134134
{
135135
var itemData = InventoryHelper.GetExcelItem(itemId);
136136
if (itemData == null) return;
137-
var equipSlotIndex = InventoryHelper.GetEquippedSlot(itemData);
137+
var equipSlotIndex = InventoryHelper.GetEquippedSlot(itemData.Value);
138138
if (equipSlotIndex.EqualsAny(EquippedSlotIndex.Ring1, EquippedSlotIndex.Ring2))
139139
{
140140
if (_ringCount == 2)
141141
equipSlotIndex = _equippedRingCount == _ringCount ? EquippedSlotIndex.Ring1 : EquippedSlotIndex.Ring2;
142142
else
143143
equipSlotIndex = InventoryHelper.GetRingSlot();
144144
}
145-
InventoryHelper.EquipGear(itemData, (InventoryType)inventoryType, (int)sourceInventorySlot, equipSlotIndex);
145+
InventoryHelper.EquipGear(itemData.Value, (InventoryType)inventoryType, (int)sourceInventorySlot, equipSlotIndex);
146146
if (InventoryManager.Instance()->GetInventoryContainer(InventoryType.EquippedItems)->Items[(int)equipSlotIndex].ItemId == itemId)
147147
{
148-
Svc.Log.Debug($"AutoEquipGearSetter: Successfully Equipped {itemData.Name} to {equipSlotIndex.ToCustomString()}");
148+
Svc.Log.Debug($"AutoEquipGearSetter: Successfully Equipped {itemData.Value.Name} to {equipSlotIndex.ToCustomString()}");
149149
if (equipSlotIndex.EqualsAny(EquippedSlotIndex.Ring1, EquippedSlotIndex.Ring2))
150150
_equippedRingCount--;
151151
_index++;

AutoDuty/Helpers/ConfigHelper.cs

+31-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace AutoDuty.Helpers
66
{
7+
using System.Globalization;
8+
79
internal static class ConfigHelper
810
{
911
private const BindingFlags All = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
@@ -35,18 +37,41 @@ internal static bool ModifyConfig(string configName, string configValue)
3537
return false;
3638
else
3739
{
38-
var configType = ConfigType(field);
39-
if (configType == "System.Boolean" && (configValue.ToLower().Equals("true") || configValue.ToLower().Equals("false")))
40-
field.SetValue(Plugin.Configuration, bool.Parse(configValue));
41-
else if (configType == "System.Int32" && int.TryParse(configValue, out var i))
42-
field.SetValue(Plugin.Configuration, i);
43-
else if (configType == "System.String")
40+
var configType = field.FieldType;// ConfigType(field);
41+
42+
if (configType == typeof(string))
43+
{
4444
field.SetValue(Plugin.Configuration, configValue);
45+
} else if (configType.IsEnum)
46+
{
47+
if(Enum.TryParse(configType, configValue, true, out object? configEnum))
48+
{
49+
field.SetValue(Plugin.Configuration, configEnum);
50+
} else
51+
{
52+
Svc.Log.Error($"Unable to set config setting: {field.Name.Replace(">k__BackingField", "").Replace("<", "")}, value must be of type: {field.FieldType.ToString().Replace("System.", "")}");
53+
return false;
54+
}
55+
}
56+
else if(configType.GetInterface(nameof(IConvertible)) != null)
57+
{
58+
object newConfigValue = Convert.ChangeType(configValue, configType, CultureInfo.InvariantCulture);
59+
if(newConfigValue != null)
60+
{
61+
field.SetValue(Plugin.Configuration, newConfigValue);
62+
}
63+
else
64+
{
65+
Svc.Log.Error($"Unable to set config setting: {field.Name.Replace(">k__BackingField", "").Replace("<", "")}, value must be of type: {field.FieldType.ToString().Replace("System.", "")}");
66+
return false;
67+
}
68+
}
4569
else
4670
{
4771
Svc.Log.Error($"Unable to set config setting: {field.Name.Replace(">k__BackingField", "").Replace("<", "")}, value must be of type: {field.FieldType.ToString().Replace("System.", "")}");
4872
return false;
4973
}
74+
5075
Plugin.Configuration.Save();
5176
}
5277
return false;

0 commit comments

Comments
 (0)