improvements to tracking and onevents

This commit is contained in:
Madpeterz 2021-05-23 22:37:40 +01:00
parent 879139d5cf
commit 1b072db244
3 changed files with 44 additions and 47 deletions

View file

@ -52,7 +52,7 @@ namespace BetterSecondBot
{ {
return false; return false;
} }
return true; return getBot()._AllowActions;
} }
public string getFolderUsed() public string getFolderUsed()

View file

@ -98,23 +98,7 @@ namespace BetterSecondbot.Tracking
protected bool hasBot() protected bool hasBot()
{ {
if (controler == null) return controler.BotReady();
{
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;
} }
protected void StatusPing(object o, StatusMessageEvent e) protected void StatusPing(object o, StatusMessageEvent e)
@ -193,37 +177,46 @@ namespace BetterSecondbot.Tracking
protected void TrackerEventAdd(object av) 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) protected void addToSeen(UUID av)

View file

@ -404,6 +404,9 @@ namespace BetterSecondBot.bottypes
} }
public bool _AllowActions { get { return AllowActions; } }
protected bool AllowActions = false;
public override void AfterBotLoginHandler() public override void AfterBotLoginHandler()
{ {
if (reconnect == false) if (reconnect == false)
@ -418,6 +421,7 @@ namespace BetterSecondBot.bottypes
Client.Network.SimChanged += ChangeSim; Client.Network.SimChanged += ChangeSim;
delay_group_fetch = helpers.UnixTimeNow() + 10; delay_group_fetch = helpers.UnixTimeNow() + 10;
} }
AllowActions = true;
base.AfterBotLoginHandler(); base.AfterBotLoginHandler();
} }