adds support for WaitSecsToStart for on events
This commit is contained in:
parent
3792241774
commit
b615300985
3 changed files with 33 additions and 1 deletions
|
|
@ -135,6 +135,7 @@ ENV basic_Username='' \
|
||||||
chatgpt_RedisCountIm='60' \
|
chatgpt_RedisCountIm='60' \
|
||||||
onevent_Enabled='false' \
|
onevent_Enabled='false' \
|
||||||
onevent_Count=0 \
|
onevent_Count=0 \
|
||||||
|
onevent_WaitSecsToStart=10 \
|
||||||
onevent_HideStatusOutput='false' \
|
onevent_HideStatusOutput='false' \
|
||||||
smtp_Enabled='false' \
|
smtp_Enabled='false' \
|
||||||
smtp_AllowEmailAsReplyTarget='false' \
|
smtp_AllowEmailAsReplyTarget='false' \
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,16 @@ namespace SecondBotEvents.Config
|
||||||
filename = "onevent";
|
filename = "onevent";
|
||||||
settings.Add("Enabled");
|
settings.Add("Enabled");
|
||||||
settings.Add("Count");
|
settings.Add("Count");
|
||||||
|
settings.Add("WaitSecsToStart");
|
||||||
settings.Add("HideStatusOutput");
|
settings.Add("HideStatusOutput");
|
||||||
settings.Add("DebugMe");
|
settings.Add("DebugMe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetWaitSecsToStart()
|
||||||
|
{
|
||||||
|
return ReadSettingAsInt("WaitSecsToStart", 10);
|
||||||
|
}
|
||||||
|
|
||||||
public void unloadEvents()
|
public void unloadEvents()
|
||||||
{
|
{
|
||||||
int loop = 1;
|
int loop = 1;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
public class TriggerOnEventService : BotServices
|
public class TriggerOnEventService : BotServices
|
||||||
{
|
{
|
||||||
protected OnEventConfig myConfig;
|
protected new OnEventConfig myConfig;
|
||||||
protected bool botConnected = false;
|
protected bool botConnected = false;
|
||||||
Dictionary<string,List<CustomOnEvent>> MyCustomEvents = new Dictionary<string, List<CustomOnEvent>>();
|
Dictionary<string,List<CustomOnEvent>> MyCustomEvents = new Dictionary<string, List<CustomOnEvent>>();
|
||||||
Dictionary<string, long> lockouts = new Dictionary<string, long>();
|
Dictionary<string, long> lockouts = new Dictionary<string, long>();
|
||||||
|
|
@ -472,6 +472,10 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
protected void TriggerEvent(string eventName, Dictionary<string,string> args)
|
protected void TriggerEvent(string eventName, Dictionary<string,string> args)
|
||||||
{
|
{
|
||||||
|
if (waitingForTimer == true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (myConfig.GetDebugMe() == true)
|
if (myConfig.GetDebugMe() == true)
|
||||||
{
|
{
|
||||||
StringBuilder debugoutme = new StringBuilder();
|
StringBuilder debugoutme = new StringBuilder();
|
||||||
|
|
@ -809,6 +813,10 @@ namespace SecondBotEvents.Services
|
||||||
long lastAvUpdate = 0;
|
long lastAvUpdate = 0;
|
||||||
protected void TimedEvents()
|
protected void TimedEvents()
|
||||||
{
|
{
|
||||||
|
if(waitingForTimer == true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
TrackAvatarsOnParcel();
|
TrackAvatarsOnParcel();
|
||||||
CleanLockouts();
|
CleanLockouts();
|
||||||
ClockEvent();
|
ClockEvent();
|
||||||
|
|
@ -837,14 +845,27 @@ namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
return "Waiting for bot";
|
return "Waiting for bot";
|
||||||
}
|
}
|
||||||
|
else if(waitingForTimer == true)
|
||||||
|
{
|
||||||
|
if(SecondbotHelpers.UnixTimeNow() >= waitUntil)
|
||||||
|
{
|
||||||
|
waitingForTimer = false;
|
||||||
|
return "Ready for on events";
|
||||||
|
}
|
||||||
|
return "Waiting for timer";
|
||||||
|
}
|
||||||
return "Active";
|
return "Active";
|
||||||
}
|
}
|
||||||
|
protected bool waitingForTimer = false;
|
||||||
|
protected long waitUntil = 0;
|
||||||
|
|
||||||
protected void BotLoggedIn(object o, SimConnectedEventArgs e)
|
protected void BotLoggedIn(object o, SimConnectedEventArgs e)
|
||||||
{
|
{
|
||||||
GetClient().Network.SimConnected -= BotLoggedIn;
|
GetClient().Network.SimConnected -= BotLoggedIn;
|
||||||
botConnected = true;
|
botConnected = true;
|
||||||
LogFormater.Info("OnEvent Service [Active]");
|
LogFormater.Info("OnEvent Service [Active]");
|
||||||
|
waitingForTimer = true;
|
||||||
|
waitUntil = SecondbotHelpers.UnixTimeNow() + myConfig.GetWaitSecsToStart();
|
||||||
AttachEvents();
|
AttachEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -861,6 +882,8 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
Stop();
|
Stop();
|
||||||
running = true;
|
running = true;
|
||||||
|
waitingForTimer = true;
|
||||||
|
waitUntil = SecondbotHelpers.UnixTimeNow() + 9999;
|
||||||
master.BotClientNoticeEvent += BotClientRestart;
|
master.BotClientNoticeEvent += BotClientRestart;
|
||||||
LogFormater.Info("OnEvent Service [Starting]");
|
LogFormater.Info("OnEvent Service [Starting]");
|
||||||
}
|
}
|
||||||
|
|
@ -878,6 +901,8 @@ namespace SecondBotEvents.Services
|
||||||
}
|
}
|
||||||
master.BotClientNoticeEvent -= BotClientRestart;
|
master.BotClientNoticeEvent -= BotClientRestart;
|
||||||
RemoveEvents();
|
RemoveEvents();
|
||||||
|
waitingForTimer = true;
|
||||||
|
waitUntil = SecondbotHelpers.UnixTimeNow() + 9999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue