Skip to content

Commit ce36e42

Browse files
committed
Discard improvements
1 parent 1083773 commit ce36e42

28 files changed

+96
-78
lines changed

AutoRetainer/AutoRetainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,15 +557,15 @@ private void Tick(object _)
557557
if(!retainer.VentureID.EqualsAny(0u, LastVentureID))
558558
{
559559
LastVentureID = retainer.VentureID;
560-
PluginLog.Debug($"Retainer {retainer.Name} current venture={LastVentureID}");
560+
DebugLog($"Retainer {retainer.Name} current venture={LastVentureID}");
561561
}
562562
}
563563
else
564564
{
565565
if(LastVentureID != 0)
566566
{
567567
LastVentureID = 0;
568-
PluginLog.Debug($"Last venture ID reset");
568+
DebugLog($"Last venture ID reset");
569569
}
570570
}
571571
//if(C.RetryItemSearch) RetryItemSearch.Tick();

AutoRetainer/AutoRetainer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<Authors>Puni.sh</Authors>
5-
<Version>4.5.1.19</Version>
5+
<Version>4.5.1.21</Version>
66
</PropertyGroup>
77

88
<PropertyGroup>

AutoRetainer/Helpers/Utils.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
using FFXIVClientStructs.FFXIV.Component.GUI;
2626
using Lumina.Excel.Sheets;
2727
using Lumina.Text.ReadOnly;
28+
using System;
29+
2830
//using OtterGui.Text.EndObjects;
2931
using System.Text.RegularExpressions;
3032
using CharaData = (string Name, ushort World);
@@ -903,7 +905,7 @@ public static bool IsItemSellableByHardList(Number item, Number quantity)
903905

904906
internal static void ExtraLog(string s)
905907
{
906-
if(C.ExtraDebug) PluginLog.Debug(s);
908+
if(C.ExtraDebug) DebugLog(s);
907909
}
908910

909911
internal static bool ContainsAllItems<T>(this IEnumerable<T> a, IEnumerable<T> b)
@@ -1272,12 +1274,14 @@ internal static bool TrySelectSpecificEntry(Func<string, bool> inputTextTest, Fu
12721274
{
12731275
if(TryGetAddonByName<AddonSelectString>("SelectString", out var addon) && IsAddonReady(&addon->AtkUnitBase))
12741276
{
1277+
InternalLog.Debug($"Entries: {new AddonMaster.SelectString(addon).Entries.Select(x => x.Text).Print("\n")}");
12751278
if(new AddonMaster.SelectString(addon).Entries.TryGetFirst(x => inputTextTest(x.Text), out var entry))
12761279
{
1280+
InternalLog.Debug($"Entry found: {entry}");
12771281
if((Throttler?.Invoke() ?? GenericThrottle))
12781282
{
12791283
entry.Select();
1280-
DebugLog($"TrySelectSpecificEntry: selecting {entry}");
1284+
InternalLog.Debug($"TrySelectSpecificEntry: selecting {entry}");
12811285
return true;
12821286
}
12831287
}
@@ -1310,6 +1314,24 @@ internal static void TryNotify(string s)
13101314
}
13111315
}
13121316

1317+
public static int GenerateRandomDelay()
1318+
{
1319+
var roll = System.Random.Shared.NextSingle();
1320+
1321+
if(roll < 0.6f)
1322+
{
1323+
return System.Random.Shared.Next(300, 350);
1324+
}
1325+
else if(roll < 0.9f)
1326+
{
1327+
return System.Random.Shared.Next(350, 400);
1328+
}
1329+
else
1330+
{
1331+
return System.Random.Shared.Next(400, 500);
1332+
}
1333+
}
1334+
13131335
internal static float GetValidInteractionDistance(IGameObject bell)
13141336
{
13151337
if(bell.ObjectKind == ObjectKind.Housing)

AutoRetainer/Helpers/VentureUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ internal static void ProcessVenturePlanner(this GameRetainerManager.Retainer ret
7070
var adj = VentureUtils.GetAdjustedRetainerTask(next, (Job)ret.ClassJob);
7171
if(adj != next)
7272
{
73-
PluginLog.Debug($"Adjusted venture ID {next}->{adj}");
73+
DebugLog($"Adjusted venture ID {next}->{adj}");
7474
next = adj;
7575
}
7676
}

AutoRetainer/Internal/InventoryManagement/InventorySpaceManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static InventoryType[] GetAllowedToSellInventoryTypes()
2525

2626
public static bool? SafeSellSlot(SellSlotTask Task)
2727
{
28-
if(EzThrottler.Check("SellSlot") && Utils.GenericThrottle && EzThrottler.Throttle("SellSlot", Random.Shared.Next(300, 400)))
28+
if(EzThrottler.Check("SellSlot") && EzThrottler.Throttle("SellSlot", Utils.GenerateRandomDelay()))
2929
{
3030
var inv = InventoryManager.Instance()->GetInventoryContainer(Task.InventoryType);
3131
if(inv == null)
@@ -57,7 +57,7 @@ public static InventoryType[] GetAllowedToSellInventoryTypes()
5757
if(!Data.GetIMSettings().IMDry)
5858
{
5959
P.Memory.RetainerItemCommandDetour(AgentRetainerItemCommandModule, Task.Slot, Task.InventoryType, 0, RetainerItemCommand.HaveRetainerSellItem);
60-
PluginLog.Debug($"Sold slot {Task}");
60+
DebugLog($"Sold slot {Task}");
6161
}
6262
else
6363
{

AutoRetainer/Internal/Memory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal void RetainerItemCommandDetour(nint AgentRetainerItemCommandModule, uin
5757
{
5858
try
5959
{
60-
PluginLog.Debug($"RetainerItemCommandDetour: {AgentRetainerItemCommandModule:X16}, slot={slot}, type={inventoryType}, a4={a4}, command={command}");
60+
DebugLog($"RetainerItemCommandDetour: {AgentRetainerItemCommandModule:X16}, slot={slot}, type={inventoryType}, a4={a4}, command={command}");
6161
}
6262
catch(Exception e)
6363
{
@@ -73,7 +73,7 @@ internal void RetainerItemCommandDetour(nint AgentRetainerItemCommandModule, uin
7373
private nint ReceiveRetainerVentureListUpdateDetour(nint a1, int a2, nint a3)
7474
{
7575
var ret = ReceiveRetainerVentureListUpdateHook.Original(a1, a2, a3);
76-
PluginLog.Debug($"{a1:X16}, {a2:X8}, {a3:X16}");
76+
DebugLog($"{a1:X16}, {a2:X8}, {a3:X16}");
7777
P.ListUpdateFrame = CSFramework.Instance()->FrameCounter;
7878
return ret;
7979
}
@@ -122,7 +122,7 @@ internal void SelectRoutePointUnsafe(int which)
122122

123123
private void SellItemDetour(uint inventorySlot, InventoryType a2, uint a3)
124124
{
125-
PluginLog.Debug($"SellItemDetour: {inventorySlot}, {a2}, {a3}");
125+
DebugLog($"SellItemDetour: {inventorySlot}, {a2}, {a3}");
126126
SellItemHook.Original(inventorySlot, a2, a3);
127127
}
128128

AutoRetainer/Modules/FPSManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal static void Tick()
1717
Svc.GameConfig.System.Set("FPSInActive", FPSInactiveValue);
1818
if(C.UnlockFPSUnlimited) Svc.GameConfig.System.Set("Fps", FPSValue);
1919
UnlockChillFrames();
20-
PluginLog.Debug($"FPS restrictions restored");
20+
DebugLog($"FPS restrictions restored");
2121
}
2222
}
2323
else if(C.UnlockFPS)
@@ -30,7 +30,7 @@ internal static void Tick()
3030
Svc.GameConfig.System.Set("FPSInActive", 0);
3131
if(C.UnlockFPSUnlimited) Svc.GameConfig.System.Set("Fps", 0);
3232
if(C.UnlockFPSChillFrames) LockChillFrames();
33-
PluginLog.Debug($"FPS restrictions removed");
33+
DebugLog($"FPS restrictions removed");
3434
}
3535
}
3636
}
@@ -42,7 +42,7 @@ internal static void ForceRestore()
4242
WasChanged = false;
4343
Svc.GameConfig.System.Set("FPSInActive", FPSInactiveValue);
4444
Svc.GameConfig.System.Set("Fps", FPSValue);
45-
PluginLog.Debug($"FPS restrictions restored");
45+
DebugLog($"FPS restrictions restored");
4646
}
4747
}
4848

AutoRetainer/Modules/GcHandin/AutoGCHandin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ internal static void Tick()
6565
Safety.Check();
6666
if(Operation && HandleConfirmation())
6767
{
68-
PluginLog.Debug($"Handle 1");
68+
DebugLog($"Handle 1");
6969
//
7070
}
7171
else if(Operation && HandleYesno())
7272
{
73-
PluginLog.Debug($"Handle 2");
73+
DebugLog($"Handle 2");
7474
//
7575
}
7676
else

AutoRetainer/Modules/GcHandin/GCContinuation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal static bool SetVenturesExchangeAmount(int amount)
6464
var numeric = (AtkComponentNumericInput*)addon->UldManager.NodeList[8]->GetComponent();
6565
var set = Math.Min(amount, (int)(num.Value / 200));
6666
if(set < 1) throw new Exception($"Venture amount is too low, is {set}, expected 1 or more");
67-
PluginLog.Debug($"Setting {set} ventures");
67+
DebugLog($"Setting {set} ventures");
6868
numeric->SetValue((int)set);
6969
return true;
7070
}

AutoRetainer/Modules/MiniTA.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ internal static void SkipItemConfirmations()
4545
var x = Utils.GetSpecificYesno(s => s.Cleanup().ContainsAny(StringComparison.OrdinalIgnoreCase, Ref<string[]>.Get("Skip", () => ((uint[])[397, 398, 399, 4477, 102433, 102434]).Select(a => Svc.Data.GetExcelSheet<Addon>().GetRow(a).Text.GetText().Cleanup()).ToArray())));
4646
if(x != null && IsAddonReady(x))
4747
{
48-
new AddonMaster.SelectYesno(x).Yes();
48+
var m = new AddonMaster.SelectYesno(x);
49+
if(EzThrottler.Throttle($"Skip_Yesno_{m.Text}", 200))
50+
{
51+
m.Yes();
52+
}
4953
}
5054
}
5155

@@ -78,11 +82,11 @@ internal static void ConfirmCutsceneSkip()
7882
{
7983
return;
8084
}
81-
//PluginLog.Debug($"1: {selectStrAddon->AtkUnitBase.UldManager.NodeList[3]->GetAsAtkTextNode()->NodeText.ToString()}");
85+
//DebugLog($"1: {selectStrAddon->AtkUnitBase.UldManager.NodeList[3]->GetAsAtkTextNode()->NodeText.ToString()}");
8286
if(!Lang.SkipCutsceneStr.Contains(selectStrAddon->AtkUnitBase.UldManager.NodeList[3]->GetAsAtkTextNode()->NodeText.ToString())) return;
8387
if(EzThrottler.Throttle("SkipCutsceneConfirm"))
8488
{
85-
PluginLog.Debug("Selecting cutscene skipping");
89+
DebugLog("Selecting cutscene skipping");
8690
new AddonMaster.SelectString(addon).Entries[0].Select();
8791
}
8892
}

0 commit comments

Comments
 (0)