Skip to content

Commit

Permalink
API10 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jukkales committed Jul 3, 2024
1 parent 4ca23a2 commit 76163c7
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Download Dalamud Latest
run: |
wget https://goatcorp.github.io/dalamud-distrib/latest.zip -O ${{ env.DALAMUD_HOME }}.zip
wget https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -O ${{ env.DALAMUD_HOME }}.zip
unzip ${{ env.DALAMUD_HOME }}.zip -d ${{ env.DALAMUD_HOME }}
- name: Restore
Expand Down
2 changes: 1 addition & 1 deletion ECommons
Submodule ECommons updated 148 files
6 changes: 3 additions & 3 deletions HoardFarm/HoardFarm.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using AutoRetainerAPI;
using Dalamud;
using Dalamud.Game;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using ECommons;
using ECommons.Automation;
using ECommons.Automation.LegacyTaskManager;
using ECommons.Reflection;
using HoardFarm.IPC;
using HoardFarm.Model;
Expand All @@ -28,7 +28,7 @@ public sealed class HoardFarm : IDalamudPlugin
private readonly RetainerService retainerService;
public readonly WindowSystem WindowSystem = new("HoardFarm");

public HoardFarm(DalamudPluginInterface? pluginInterface)
public HoardFarm(IDalamudPluginInterface? pluginInterface)
{
pluginInterface?.Create<PluginService>();
P = this;
Expand Down
2 changes: 2 additions & 0 deletions HoardFarm/HoardFarm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<DalamudDevPlugins>$(appdata)\XIVLauncher\devPlugins\HoardFarm\</DalamudDevPlugins>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

Expand All @@ -30,6 +31,7 @@

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DefineConstants>TRACE</DefineConstants>
<OutputPath>$(DalamudDevPlugins)</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions HoardFarm/HoardFarm.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"Description": "Plugin to help farming DeepDungeon Hoards (...for you)",
"InternalName": "HoardFarm",
"ApplicableVersion": "any",
"DalamudApiLevel": 10,
"Tags": [
"hoard",
"farm",
Expand Down
8 changes: 4 additions & 4 deletions HoardFarm/Service/HoardFarmService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ private unsafe bool SearchLogic()
if (!TaskManager.IsBusy) {
if (!objectPositions.Where(e => !visitedObjectIds.Contains(e.Value.ObjectId))
.Where(e => ChestIDs.Contains(e.Value.DataId))
.OrderBy(e => e.Value.Position.Distance(Player.GameObject->Position))
.OrderBy(e => e.Value.Position.Distance(Player.Position))
.Select(e => e.Value)
.TryGetFirst(out var next))
{
if (!objectPositions.Where(e => !visitedObjectIds.Contains(e.Value.ObjectId))
.OrderBy(e => e.Value.Position.Distance(Player.GameObject->Position))
.OrderBy(e => e.Value.Position.Distance(Player.Position))
.Select(e => e.Value)
.TryGetFirst(out next))
{
Expand Down Expand Up @@ -342,7 +342,7 @@ private void SafetyChecks()
private void UpdateObjectPositions()
{
foreach (var gameObject in ObjectTable)
objectPositions.TryAdd(gameObject.ObjectId, new MapObject(gameObject.ObjectId, gameObject.DataId, gameObject.Position));
objectPositions.TryAdd(gameObject.EntityId, new MapObject(gameObject.EntityId, gameObject.DataId, gameObject.Position));
}

private bool CheckRetainer()
Expand Down Expand Up @@ -427,7 +427,7 @@ private void OnMapChange(ushort territoryType)
}

private void OnChatMessage(
XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
XivChatType type, int timestamp, ref SeString sender, ref SeString message, ref bool isHandled)
{
if (senseHoardMessage.Equals(message.TextValue))
{
Expand Down
4 changes: 2 additions & 2 deletions HoardFarm/Service/PluginService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using ECommons.Automation;
using ECommons.Automation.LegacyTaskManager;
using HoardFarm.Model;

namespace HoardFarm.Service;
Expand All @@ -13,7 +13,7 @@ public class PluginService
public static HoardFarm P = null!;

[PluginService]
public static DalamudPluginInterface PluginInterface { get; private set; } = null!;
public static IDalamudPluginInterface PluginInterface { get; private set; } = null!;
[PluginService]
public static IChatGui ChatGui { get; private set; } = null!;
[PluginService]
Expand Down
4 changes: 2 additions & 2 deletions HoardFarm/Service/RetainerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ private unsafe void OnTimerUpdate(object? sender, ElapsedEventArgs e)

if (ObjectTable.TryGetFirst(gameObject => gameObject.DataId == RetainerBellDataId, out var bell))
{
if (bell.Position.Distance(Player.GameObject->Position) > 3)
if (bell.Position.Distance(Player.Position) > 3)
{
Enqueue(new PathfindTask(RetainerBellLocation, true, 1f), "Move to bell");
EnqueueWait(2000); // SE server are just slow
return;
}
}

if (NotBusy() || TargetSystem.Instance()->Target == null || TargetSystem.Instance()->Target->DataID != RetainerBellDataId)
if (NotBusy() || TargetSystem.Instance()->Target == null || TargetSystem.Instance()->Target->BaseId != RetainerBellDataId)
{
Enqueue(new InteractObjectTask(RetainerBellDataId), "Interact Bell");
if (GetOpenBellBehavior() != OpenBellBehavior.Enable_AutoRetainer)
Expand Down
2 changes: 1 addition & 1 deletion HoardFarm/Tasks/PathfindTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PathfindTask(Vector3 targetPosition, bool sprint = false, float tol
{
public override unsafe bool? Run()
{
if (targetPosition.Distance(Player.GameObject->Position) <= toleranceDistance)
if (targetPosition.Distance(Player.Position) <= toleranceDistance)
{
NavmeshIPC.PathStop();
return true;
Expand Down
2 changes: 1 addition & 1 deletion HoardFarm/Tasks/TaskGroups/LeaveDutyTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ArrayList GetTaskList()
return false;
}

var eventObject = stackalloc EventObject[1];
var eventObject = stackalloc AtkValue[1];
var atkValues = CreateEventParams();
if (atkValues != null)
{
Expand Down
10 changes: 5 additions & 5 deletions HoardFarm/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static unsafe bool NotBusy()
var target = TargetSystem.Instance()->Target;

if (occupied && Svc.Condition[ConditionFlag.OccupiedInQuestEvent] && target != null &&
target->DataID == KyuseiDataId) occupied = false;
target->BaseId == KyuseiDataId) occupied = false;

return Player.Available
&& Player.Object.CastActionId == 0
Expand All @@ -62,7 +62,7 @@ public static unsafe bool NotBusy()
{
if (node == null || ids.Length <= 0) return null;

if (node->NodeID == ids[0])
if (node->NodeId == ids[0])
{
if (ids.Length == 1) return node;

Expand Down Expand Up @@ -119,7 +119,7 @@ public static unsafe bool NotBusy()
public static unsafe bool KyuseiInteractable()
{
if (ObjectTable.TryGetFirst(e => e.DataId == KyuseiDataId, out var npc))
return npc.Position.Distance(Player.GameObject->Position) < 7f;
return npc.Position.Distance(Player.Position) < 7f;
return false;
}

Expand All @@ -134,7 +134,7 @@ public static unsafe bool CanUsePomander(Pomander pomander)
Pomander.Safety => SafetyChain,
_ => []
};
return chain.Length != 0 && GetNodeByIDChain(addon->GetRootNode(), chain)->IsVisible;
return chain.Length != 0 && GetNodeByIDChain(addon->GetRootNode(), chain)->IsVisible();
}

return false;
Expand All @@ -143,7 +143,7 @@ public static unsafe bool CanUsePomander(Pomander pomander)
public static unsafe bool CanUseMagicite()
{
if (TryGetAddonByName<AtkUnitBase>("DeepDungeonStatus", out var addon) && IsAddonReady(addon))
return GetNodeByIDChain(addon->GetRootNode(), MagiciteChain)->IsVisible;
return GetNodeByIDChain(addon->GetRootNode(), MagiciteChain)->IsVisible();

return false;
}
Expand Down

0 comments on commit 76163c7

Please sign in to comment.