This commit is contained in:
Madpeterz 2021-05-19 21:42:20 +01:00
parent 258f180009
commit 1f407785b8
2 changed files with 35 additions and 18 deletions

View file

@ -188,27 +188,15 @@ namespace BetterSecondbot.Adverts
protected int lastTickMin = -1;
protected void StatusPing(object o, StatusMessageEvent e)
{
DateTime moment = DateTime.Now;
if (lastTickMin != moment.Minute)
if (controler.BotReady() == true)
{
lastTickMin = moment.Minute;
if (controler.getBot() == null)
DateTime moment = DateTime.Now;
if (lastTickMin != moment.Minute)
{
return;
lastTickMin = moment.Minute;
checkForWork();
}
if(controler.getBot().GetClient == null)
{
return;
}
if (controler.getBot().GetClient.Network == null)
{
return;
}
if (controler.getBot().GetClient.Network.CurrentSim == null)
{
return;
}
checkForWork();
}
}

View file

@ -9,6 +9,7 @@ using BetterSecondbot.BetterAtHome;
using BetterSecondbot.DataStorage;
using BetterSecondbot.Tracking;
using BetterSecondbot.Adverts;
using BetterSecondbot.OnEvents;
namespace BetterSecondBot
{
@ -21,6 +22,7 @@ namespace BetterSecondBot
protected BetterAtHome betterAtHomeService;
protected BetterTracking betterTracking;
protected advertsService Adverts;
protected onevent Events;
protected Datastorage datastorage;
public SecondBot getBot()
@ -28,6 +30,31 @@ namespace BetterSecondBot
return Bot;
}
public bool BotReady()
{
if (getBot() == null)
{
return false;
}
else if (getBot().GetClient == null)
{
return false;
}
else if (getBot().GetClient.Network == null)
{
return false;
}
else if (getBot().GetClient.Network.Connected == false)
{
return false;
}
else if (getBot().GetClient.Network.CurrentSim == null)
{
return false;
}
return true;
}
public string getFolderUsed()
{
return use_folder;
@ -50,6 +77,7 @@ namespace BetterSecondBot
Thread.Sleep(1500);
}
Adverts = null;
Events = null;
betterAtHomeService = null;
betterTracking = null;
datastorage = null;
@ -68,6 +96,7 @@ namespace BetterSecondBot
}).Start();
}
Adverts = new advertsService(this, as_docker);
Events = new onevent(this, as_docker);
betterAtHomeService = new BetterAtHome(this, Config);
betterTracking = new BetterTracking(this);
datastorage = new Datastorage(this);