Exemple #1
0
        public void rm_non_group_vis
            (UUID client, int level, string[] additionalArgs,
            Destinations source,
            UUID agentKey, string agentName)
        {
            List <Visitor> toRemove = new List <Visitor>();

            // dump the visitors
            foreach (Visitor v in VisitorLog.Instance.Visitors)
            {
                if (v.IsMemberOfMyActiveGroup)
                {
                    continue;
                }
                else
                {
                    toRemove.Add(v);
                }
            }

            foreach (Visitor v in toRemove)
            {
                VisitorLog.Instance.Visitors.Remove(v);
                VisitorLog.SaveMemory();
            }

            MHE(source, client, "Operations complete");
        }
Exemple #2
0
        public void getTick()
        {
            if (MainConfiguration.Instance.VisitorLogEnabled == false)
            {
                return;                                                        // We can't even use the greeter without the log
            }
            // Every 2 seconds, tick
            // cant implement yet- visitor log needed
            if (tickCounter == null)
            {
                tickCounter = new TimeSpan();
                tickCounter = tickCounter.Add(TimeSpan.FromSeconds(2));
            }
            else
            {
                tickCounter = tickCounter.Add(TimeSpan.FromSeconds(2));
            }


            if (tickCounter > TimeSpan.FromMinutes(1))
            {
                tickCounter = new TimeSpan();
                // update everyones' seen minute count who is on sim
                Dictionary <UUID, Vector3> dict = BotSession.Instance.grid.Network.CurrentSim.AvatarPositions.Copy();

                foreach (KeyValuePair <UUID, Vector3> kvp in dict)
                {
                    if (VisitorLog.Instance.Visitors.Where(x => x.ID == kvp.Key).Count() > 0)
                    {
                        Visitor V     = VisitorLog.Instance.Visitors.Where(x => x.ID == kvp.Key).First();
                        int     index = VisitorLog.Instance.Visitors.IndexOf(V);
                        V.LastSeen = DateTime.Now;
                        // get today's entry if it exists
                        if (V.MinutesSeenPerDay.ContainsKey(DateTime.Today))
                        {
                            V.MinutesSeenPerDay[DateTime.Today] = V.MinutesSeenPerDay[DateTime.Today].Add(TimeSpan.FromMinutes(1));
                        }
                        else
                        {
                            V.MinutesSeenPerDay.Add(DateTime.Today, TimeSpan.FromMinutes(1));
                        }
                        if (!V.IsMemberOfMyActiveGroup)
                        {
                            UUID botgroup = BotSession.Instance.grid.Self.ActiveGroup;

                            if (BotSession.Instance.grid.Network.CurrentSim.ObjectsAvatars.Copy().Where(x => x.Value.ID == kvp.Key).Count() > 0)
                            {
                                // the avatar's instance was found
                                Avatar avi = BotSession.Instance.grid.Network.CurrentSim.ObjectsAvatars.Copy().Where(x => x.Value.ID == kvp.Key).First().Value;

                                if (botgroup == avi.GroupID || avi.Groups.Contains(botgroup))
                                {
                                    V.IsMemberOfMyActiveGroup = true;
                                }
                            }
                        }
                        VisitorLog.Instance.Visitors[index] = V;
                    }
                    else
                    {
                        // does not yet contain this visitor
                        Visitor V = new Visitor(kvp.Key);

                        VisitorLog.Instance.Visitors.Add(V);
                    }



                    if (MainConfiguration.Instance.GreeterEnabled)
                    {
                        Visitor V     = VisitorLog.Instance.Visitors.Where(x => x.ID == kvp.Key).First();
                        int     index = VisitorLog.Instance.Visitors.IndexOf(V);
                        if (!V.Greeted)
                        {
                            MHE(Destinations.DEST_AGENT, V.ID, MainConfiguration.Instance.GreeterMessage);
                            V.Greeted = true;
                            VisitorLog.Instance.Visitors[index] = V;
                            // This is also where the give on greet action will go
                        }
                    }
                }



                VisitorLog.SaveMemory();
            }
        }