Aida-Enna / XIVPlugins

A collection of plugins for Final Fantasy XIV
31 stars 4 forks source link

Adding a delay on Loot master. #5

Closed swolewizard closed 1 year ago

swolewizard commented 1 year ago

If possible would you be able to add a delay on the plugin Loot Master, as of now if you use the plugin, it'll roll/pass on everything at the same exact time, which with 3-4+ items to roll/pass on It's quite obvious to other players that you're using a plugin to roll/pass on everything, as you and other members of your party will see in chat that you 'cast your lot' on all items instantly, with 9+ Items It's without a shadow of a doubt obvious.

On average for default vanilla players, it'll take 1-2+ seconds to roll/pass per piece of loot. It'll be great if you could add a 0.750ms delay on each roll/pass the plugin does for each piece of loot. or even make the delay timing customizable. or even have it random between 0.500ms-1500ms

This would make users of this plugin less susceptible to reports and bans. Thanks!

swolewizard commented 1 year ago

Something like adding Thread.Sleep(750) in the loop

int ms = 750;
int num = 0;
            for (int index = 0; index < LootItems.Count; ++index)
            {
                if (!LootItems[index].Rolled)
                {
                    RollItem(RollOption.Pass, index);
                    Thread.Sleep(ms);
                    ++num;
                }
            }

https://github.com/Aida-Enna/XIVPlugins/blob/fd75f6ba3b2d7de62c404a815d04403d5416c104/LootMaster/Plugin.cs#L212-L224

swolewizard commented 1 year ago

Did a lil testing, you'd have to use something a little more elegant than Thread.Sleep as it freezes the entire game, until the Thread.Sleep is done.

swolewizard commented 1 year ago

I added this instead of Thread.Sleep

await Task.Delay(1000);

and now it works as intended

swolewizard commented 1 year ago

I didn't really know how to make dalamud plugins but after 4-5 hours, I've got the hang of it. I managed to create this for myself in a fork, I added configuration to toggle enable Delay and set the min/max random delay, by default its 500ms-750ms and each command has the option to be delayed.

If you'd like to use the code I added in the fork for this plugin, let me know and I'll send a merge request.

Aida-Enna commented 1 year ago

Heya, nice work! Sure, send over a PR and I'll add it in. 👍

Aida-Enna commented 1 year ago

Solved by #6. Thanks again!