Beispiel #1
0
        public UUID FindUUIDForName(string groupName)
        {
            UUID fnd = GetUserID(groupName);

            if (!CogbotHelpers.IsNullOrZero(fnd))
            {
                return(fnd);
            }
            return(UUID.Zero);
        }
        internal object GetAvatar()
        {
            var av = WorldSystem.m_TheSimAvatar;

            if (av != null)
            {
                return(av);
            }
            if (!CogbotHelpers.IsNullOrZero(Self.AgentID))
            {
                return(TheSimAvatar);
            }
            return(this);
        }
Beispiel #3
0
        public override void Friends_OnFriendNamesReceived(object sender, FriendNamesEventArgs e)
        {
            IEnumerable names = e.Names;

            base.Friends_OnFriendNamesReceived(sender, e);
            string clientMasterNameToLower = client.MasterName;

            foreach (KeyValuePair <UUID, string> kvp in names)
            {
                if (CogbotHelpers.IsNullOrZero(kvp.Key))
                {
                    continue;
                }
                string kvpValueToLower = kvp.Value;
                AddName2Key(kvpValueToLower, kvp.Key);
                if (clientMasterNameToLower == kvpValueToLower)
                {
                    MasterIsFriendYet = true;
                    client.MasterKey  = kvp.Key;
                }
                else if (kvp.Key == client.MasterKey && CogbotHelpers.IsNullOrZero(client.MasterKey))
                {
                    client.MasterName = kvp.Value;
                    MasterIsFriendYet = true;
                }
            }
            if (!MasterIsFriendYet)
            {
                if (!string.IsNullOrEmpty(clientMasterNameToLower))
                {
                    {
                        lock (Name2Key)
                        {
                            if (Name2Key.ContainsKey(clientMasterNameToLower))
                            {
                                var clientMasterKey = Name2Key[clientMasterNameToLower];
                                if (!MasterIsFriendYet && !CogbotHelpers.IsNullOrZero(clientMasterKey))
                                {
                                    client.Friends.OfferFriendship(clientMasterKey);
                                    MasterIsFriendYet = true;
                                }
                            }
                        }
                    }
                }
            }
            if (!MasterIsFriendYet)
            {
                var clientMasterKey = client.MasterKey;
                if (!CogbotHelpers.IsNullOrZero(clientMasterKey))
                {
                    client.Friends.OfferFriendship(clientMasterKey);
                    MasterIsFriendYet = true;
                }
            }
            if (!MasterIsFriendYet)
            {
                if (!string.IsNullOrEmpty(clientMasterNameToLower))
                {
                    UUID clientMasterKey = GetUserID(client.MasterName);
                    if (!CogbotHelpers.IsNullOrZero(clientMasterKey))
                    {
                        client.Friends.OfferFriendship(clientMasterKey);
                        MasterIsFriendYet = true;
                    }
                }
            }
        }
        private SimObject GetSource(Simulator sim, UUID sourceID, SimObject source, ref object s, PCode isAvatar)
        {
            if (source != null)
            {
                s = source;
                return(source);
            }
            source = GetSimObjectFromUUID(sourceID);
            if (source != null)
            {
                s = source;
                return(source);
            }
            //TODO can we ever find a Primitive we hadnt yet interned?!
            Primitive sp = null;// GetPrimitive(sourceID, null);

            if (sp != null)
            {
                source = GetSimObject(sp);
            }
            else
            {
                if (sim != null && !RequestParcelObjects)
                {
                    RequestParcelObjects = true;
                    client.Parcels.RequestAllSimParcels(sim, false, 250);
                    client.Grid.RequestMapItems(sim.Handle, GridItemType.AgentLocations, GridLayerType.Objects);
                }
                switch (isAvatar)
                {
                case PCode.Tree:
                case PCode.Grass:
                case PCode.NewTree:
                case PCode.Prim:
                    if (!CogbotHelpers.IsNullOrZero(sourceID))
                    {
                        source = CreateSimObject(sourceID, this, null);
                    }
                    break;

                case PCode.Avatar:
                    DeclareAvatar(sourceID);
                    break;

                case PCode.None:
                case PCode.ParticleSystem:
                    SourceDetect(sourceID);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("isAvatar hint = " + isAvatar);
                }
                // client.Self.RequestSit(sourceID,Vector3.Zero);
                //  client.Directory.
            }

            if (source != null)
            {
                s = source;
            }
            else
            {
                lock (AvatarRegion)
                    if (AvatarRegion.ContainsKey(sourceID))
                    {
                        Debug("found it!");
                    }
                    else
                    {
                        lock (Name2Key)
                        {
                            foreach (KeyValuePair <string, UUID> key in Name2Key)
                            {
                                string name = key.Key;
                                if (name.StartsWith("("))
                                {
                                }
                                if (key.Value == sourceID)
                                {
                                    var list = SimAccounts.CopyOf();
                                    foreach (SimAvatar set in list)
                                    {
                                        if (set.ID == sourceID)
                                        {
                                            s = source = set;
                                            return(source);
                                        }
                                    }
                                    foreach (SimAvatar set in list)
                                    {
                                        string n = set.GetName();
                                        if (n != null && n.Equals(name))
                                        {
                                            s = source = set;
                                            return(source);
                                        }
                                    }
                                    Debug("No avatar object for " + name);
                                    SimAvatar impl = CreateSimAvatar(key.Value, this, sim);
                                    impl.AspectName = name;
                                    s = source = impl;
                                    return(source);
                                }
                            }
                        }
                    }
            }
            if (isAvatar == PCode.Prim)
            {
                SimObject impl = CreateSimObject(sourceID, this, sim);
                s = source = impl;
                return(source);
            }
            if (s == null)
            {
                s = sourceID;
            }
            return(source);
        }