diff --git a/BetterSecondbot/Cli.cs b/BetterSecondbot/Cli.cs index e038bcc..66f2cd8 100644 --- a/BetterSecondbot/Cli.cs +++ b/BetterSecondbot/Cli.cs @@ -52,7 +52,7 @@ namespace BetterSecondBot { return false; } - return true; + return getBot()._AllowActions; } public string getFolderUsed() diff --git a/BetterSecondbot/Tracking/BetterTracking.cs b/BetterSecondbot/Tracking/BetterTracking.cs index 68017c8..4376f22 100644 --- a/BetterSecondbot/Tracking/BetterTracking.cs +++ b/BetterSecondbot/Tracking/BetterTracking.cs @@ -98,23 +98,7 @@ namespace BetterSecondbot.Tracking protected bool hasBot() { - if (controler == null) - { - return false; - } - if (controler.getBot() == null) - { - return false; - } - if (controler.getBot().GetClient == null) - { - return false; - } - if (controler.getBot().GetClient.Network == null) - { - return false; - } - return controler.getBot().GetClient.Network.Connected; + return controler.BotReady(); } protected void StatusPing(object o, StatusMessageEvent e) @@ -193,37 +177,46 @@ namespace BetterSecondbot.Tracking protected void TrackerEventAdd(object av) { - if (UUID.TryParse(av.ToString(), out UUID avuuid) == false) + if (controler.BotReady() == true) { - return; + if (UUID.TryParse(av.ToString(), out UUID avuuid) == false) + { + return; + } + if (AvatarSeen.ContainsKey(avuuid) == true) + { + return; + } + string name = controler.getBot().FindAvatarKey2Name(avuuid); + if (name == "lookup") + { + return; + } + if (controler.getBot().GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avuuid) == false) + { + return; + } + string parcelname = ""; + Vector3 pos = controler.getBot().GetClient.Network.CurrentSim.AvatarPositions[avuuid]; + int localp = controler.getBot().GetClient.Parcels.GetParcelLocalID(controler.getBot().GetClient.Network.CurrentSim, pos); + parcelname = "?"; + if (controler.getBot().GetClient.Network.CurrentSim.Parcels.ContainsKey(localp) == true) + { + Parcel P = controler.getBot().GetClient.Network.CurrentSim.Parcels[localp]; + parcelname = P.Name; + } + if (parcelname == "?") + { + return; + } + addToSeen(avuuid); + output(avuuid, "entry###" + name); + + string simname = ""; + + simname = controler.getBot().GetClient.Network.CurrentSim.Name; + controler.getBot().TriggerTrackingEvent(avuuid, name, parcelname, simname, false); } - if (AvatarSeen.ContainsKey(avuuid) == true) - { - return; - } - string name = controler.getBot().FindAvatarKey2Name(avuuid); - if (name == "lookup") - { - return; - } - if (controler.getBot().GetClient.Network.CurrentSim.AvatarPositions.ContainsKey(avuuid) == false) - { - return; - } - addToSeen(avuuid); - output(avuuid, "entry###" + name); - string parcelname = ""; - string simname = ""; - Vector3 pos = controler.getBot().GetClient.Network.CurrentSim.AvatarPositions[avuuid]; - simname = controler.getBot().GetClient.Network.CurrentSim.Name; - int localp = controler.getBot().GetClient.Parcels.GetParcelLocalID(controler.getBot().GetClient.Network.CurrentSim, pos); - parcelname = "?"; - if (controler.getBot().GetClient.Network.CurrentSim.Parcels.ContainsKey(localp) == true) - { - Parcel P = controler.getBot().GetClient.Network.CurrentSim.Parcels[localp]; - parcelname = P.Name; - } - controler.getBot().TriggerTrackingEvent(avuuid, name, parcelname, simname, false); } protected void addToSeen(UUID av) diff --git a/Core/bottypes/EventsBot.cs b/Core/bottypes/EventsBot.cs index 0d222d8..299383f 100644 --- a/Core/bottypes/EventsBot.cs +++ b/Core/bottypes/EventsBot.cs @@ -404,6 +404,9 @@ namespace BetterSecondBot.bottypes } + public bool _AllowActions { get { return AllowActions; } } + protected bool AllowActions = false; + public override void AfterBotLoginHandler() { if (reconnect == false) @@ -418,6 +421,7 @@ namespace BetterSecondBot.bottypes Client.Network.SimChanged += ChangeSim; delay_group_fetch = helpers.UnixTimeNow() + 10; } + AllowActions = true; base.AfterBotLoginHandler(); }