Update athome.cs

This commit is contained in:
Madpeterz 2020-12-28 22:45:36 +00:00
parent 23af638983
commit 3caf4f4ae6

View file

@ -13,6 +13,7 @@ namespace BSB.bottypes
protected override void AfterBotLoginHandler() protected override void AfterBotLoginHandler()
{ {
base.AfterBotLoginHandler(); base.AfterBotLoginHandler();
Info("Home regions count: " + myconfig.Basic_HomeRegions.Length.ToString() + "");
last_tp_attempt_unixtime = helpers.UnixTimeNow() + 30; last_tp_attempt_unixtime = helpers.UnixTimeNow() + 30;
if (reconnect == true) if (reconnect == true)
{ {
@ -286,7 +287,7 @@ namespace BSB.bottypes
if (avoid_sims.Keys.Contains(Client.Network.CurrentSim.Name) == true) if (avoid_sims.Keys.Contains(Client.Network.CurrentSim.Name) == true)
{ {
dif = helpers.UnixTimeNow() - last_tp_attempt_unixtime; dif = helpers.UnixTimeNow() - last_tp_attempt_unixtime;
if (dif > 30) if (dif > 45)
{ {
addon = GotoNextHomeRegion(true); addon = GotoNextHomeRegion(true);
} }
@ -345,24 +346,32 @@ namespace BSB.bottypes
{ {
if (myconfig.Basic_HomeRegions.Length > 0) if (myconfig.Basic_HomeRegions.Length > 0)
{ {
last_tp_attempt_unixtime = helpers.UnixTimeNow(); last_tp_attempt_unixtime = helpers.UnixTimeNow();
last_tested_home_id++; string UseSLurl = "";
if (myconfig.Basic_HomeRegions.Length >= last_tested_home_id) foreach (string Slurl in myconfig.Basic_HomeRegions)
{ {
last_tested_home_id = 0; string simname = helpers.RegionnameFromSLurl(Slurl);
if (avoid_sims.Keys.Contains(simname) == false)
{
UseSLurl = Slurl;
break;
}
} }
string Slurl = myconfig.Basic_HomeRegions[last_tested_home_id]; if (UseSLurl != "")
string simname = helpers.RegionnameFromSLurl(Slurl); {
if (avoid_sims.Keys.Contains(simname) == false) string simname = helpers.RegionnameFromSLurl(UseSLurl);
{ if (simname != last_attempted_teleport_region)
string whyrejected = TeleportWithSLurl(Slurl); {
if (whyrejected == "ok") AvoidSim(simname); // avoid this sim we are trying to teleport to incase something goes wrong
{ string whyrejected = TeleportWithSLurl(UseSLurl);
return "**** active teleport: " + last_attempted_teleport_region + "***"; if (whyrejected == "ok")
{
return "**** active teleport: " + last_attempted_teleport_region + "***";
}
return "TP to " + simname + " rejected - " + whyrejected;
} }
return "TP to " + simname + " rejected - " + whyrejected;
} }
return "unable to teleport to home region: " + simname + " currently in avoid list"; return "No other sims found to teleport to [Maybe only 1 home region?]";
} }
return "No home regions"; return "No home regions";
} }