Aida-Enna / XIVPlugins

A collection of plugins for Final Fantasy XIV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding a delay on Loot master.

swolewizard opened this issue · comments

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!

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;
                }
            }

[Command("/pass")]
[HelpMessage("Pass on things you haven't rolled for yet.")]
public void PassCommand(string command, string args)
{
int num = 0;
for (int index = 0; index < LootItems.Count; ++index)
{
if (!LootItems[index].Rolled)
{
RollItem(RollOption.Pass, index);
++num;
}
}

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.

I added this instead of Thread.Sleep

await Task.Delay(1000);

and now it works as intended

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.

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

Solved by #6. Thanks again!