Esempio n. 1
0
        private void AddAdditionalInventory(ObjectPart part, string sectionName)
        {
            IConfig config  = m_Loader.Config.Configs[sectionName];
            var     creator = new UGUIWithName(config.GetString("Creator", m_ObjectCreator.ToString()))
            {
                IsAuthoritative = true
            };
            var owner = new UGUIWithName(config.GetString("Owner", m_ObjectOwner.ToString()))
            {
                IsAuthoritative = true
            };
            var lastOwner = new UGUIWithName(config.GetString("LastOwner", m_ObjectLastOwner.ToString()))
            {
                IsAuthoritative = true
            };

            m_AvatarNameService.Store(creator);
            m_AvatarNameService.Store(owner);
            m_AvatarNameService.Store(lastOwner);
            var item = new ObjectPartInventoryItem(new UUID(config.GetString("ItemID", UUID.Random.ToString())))
            {
                Name              = config.GetString("Name"),
                Description       = config.GetString("Description", string.Empty),
                AssetID           = new UUID(config.GetString("AssetID", UUID.Random.ToString())),
                AssetTypeName     = config.GetString("AssetType"),
                Creator           = creator,
                Owner             = owner,
                LastOwner         = lastOwner,
                InventoryTypeName = config.GetString("InventoryType"),
                Flags             = (InventoryFlags)config.GetInt("Flags", 0),
                IsGroupOwned      = config.GetBoolean("IsGroupOwned", false)
            };

            item.Permissions.Base      = (InventoryPermissionsMask)config.GetInt("BasePermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.Current   = (InventoryPermissionsMask)config.GetInt("CurrentPermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.EveryOne  = (InventoryPermissionsMask)config.GetInt("EveryOnePermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.Group     = (InventoryPermissionsMask)config.GetInt("GroupPermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.NextOwner = (InventoryPermissionsMask)config.GetInt("NextOwnerPermissions", (int)InventoryPermissionsMask.Every);

            part.Inventory.Add(item);
        }
Esempio n. 2
0
        public void Startup(ConfigurationLoader loader)
        {
            m_Scenes        = loader.Scenes;
            m_Loader        = loader;
            m_GatekeeperURI = loader.GatekeeperURI;
            IConfig config = loader.Config.Configs[GetType().FullName];

            /* we use same asset id keying here so to make them compatible with the other scripts */
            foreach (string key in config.GetKeys())
            {
                if (UUID.TryParse(key, out m_AssetID))
                {
                    m_ScriptFile = config.GetString(key);
                    break;
                }
            }

            m_ObjectPermissionsBase     = GetPermissions(config, "ObjectPermisionsBase");
            m_ObjectPermissionsOwner    = GetPermissions(config, "ObjectPermisionsOwner");
            m_ObjectPermissionsGroup    = GetPermissions(config, "ObjectPermisionsGroup");
            m_ObjectPermissionsNext     = GetPermissions(config, "ObjectPermisionsNext");
            m_ObjectPermissionsEveryone = GetPermissions(config, "ObjectPermisionsEveryone");

            m_ScriptPermissionsBase     = GetPermissions(config, "ScriptPermisionsBase");
            m_ScriptPermissionsOwner    = GetPermissions(config, "ScriptPermisionsOwner");
            m_ScriptPermissionsGroup    = GetPermissions(config, "ScriptPermisionsGroup");
            m_ScriptPermissionsNext     = GetPermissions(config, "ScriptPermisionsNext");
            m_ScriptPermissionsEveryone = GetPermissions(config, "ScriptPermisionsEveryone");

            m_LoadOarFileName = config.GetString("OarFilename", string.Empty);

            m_TimeoutMs   = config.GetInt("RunTimeout", 1000);
            m_RegionID    = UUID.Parse(config.GetString("RegionID"));
            m_RegionOwner = new UGUIWithName(config.GetString("RegionOwner"))
            {
                IsAuthoritative = true
            };
            m_EstateOwner = new UGUIWithName(config.GetString("EstateOwner", m_RegionOwner.ToString()))
            {
                IsAuthoritative = true
            };
            m_EstateID   = (uint)config.GetInt("EstateID", 100);
            m_EstateName = config.GetString("EstateName", "My Estate");

            m_ObjectID       = UUID.Parse(config.GetString("ID", UUID.Random.ToString()));
            m_RegionName     = config.GetString("RegionName", "Testing Region");
            m_ProductName    = config.GetString("RegionProductName", "Mainland");
            m_RegionLocation = new GridVector(config.GetString("RegionLocation", "10000,10000"), 256);
            m_RegionSize     = new GridVector(config.GetString("RegionSize", "1,1"), 256);
            m_RegionAccess   = (RegionAccess)Enum.Parse(typeof(RegionAccess), config.GetString("RegionAccess", "PG"));
            m_RegionPort     = config.GetInt("RegionPort", 9300);
            m_Runner         = loader.GetServicesByValue <TestRunner>()[0];
            m_Position       = Vector3.Parse(config.GetString("Position", "<128, 128, 23>"));
            m_Rotation       = Quaternion.Parse(config.GetString("Rotation", "<0,0,0,1>"));

            m_ItemID       = UUID.Parse(config.GetString("ScriptItemID", UUID.Random.ToString()));
            m_RezzingObjID = UUID.Parse(config.GetString("RezzingObjectID", UUID.Zero.ToString()));
            m_ObjectName   = config.GetString("ObjectName", "Object");
            m_ScriptName   = config.GetString("ScriptName", "Script");
            string experienceName = config.GetString("ExperienceName", "My Experience");
            UUID   experienceID;

            UUID.TryParse(config.GetString("ExperienceID", UUID.Zero.ToString()), out experienceID);
            m_ExperienceID = new UEI(experienceID, experienceName, null);

            m_ObjectDescription = config.GetString("ObjectDescription", "");
            m_ScriptDescription = config.GetString("ScriptDescription", "");

            m_RegionStorage      = loader.GetService <GridServiceInterface>("RegionStorage");
            m_SceneFactory       = loader.GetService <SceneFactoryInterface>("DefaultSceneImplementation");
            m_EstateService      = loader.GetService <EstateServiceInterface>("EstateService");
            m_AvatarNameService  = loader.GetService <AvatarNameServiceInterface>("AvatarNameStorage");
            m_UserAccountService = loader.GetService <UserAccountServiceInterface>("UserAccountService");

            m_AvatarNameService.Store(m_RegionOwner);
            m_AvatarNameService.Store(m_EstateOwner);
            try
            {
                m_UserAccountService.Add(new UserAccount
                {
                    Principal     = m_RegionOwner,
                    IsLocalToGrid = true,
                });
            }
            catch
            {
                m_Log.Info("UserAccount creation failed for RegionOwner");
            }

            if (!m_EstateOwner.EqualsGrid(m_RegionOwner))
            {
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_RegionOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    m_Log.Info("UserAccount creation failed for EstateOwner");
                }
            }

            m_ObjectOwner = new UGUIWithName(config.GetString("ObjectOwner"))
            {
                IsAuthoritative = true
            };
            m_AvatarNameService.Store(m_ObjectOwner);
            if (config.Contains("ObjectCreator"))
            {
                m_ObjectCreator = new UGUIWithName(config.GetString("ObjectCreator"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ObjectCreator);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ObjectCreator,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ObjectCreator = m_ObjectOwner;
            }
            if (config.Contains("ObjectLastOwner"))
            {
                m_ObjectLastOwner = new UGUIWithName(config.GetString("ObjectLastOwner"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ObjectLastOwner);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ObjectLastOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ObjectLastOwner = m_ObjectOwner;
            }

            m_ScriptOwner = new UGUIWithName(config.GetString("ScriptOwner"))
            {
                IsAuthoritative = true
            };
            m_AvatarNameService.Store(m_ScriptOwner);
            if (config.Contains("ScriptCreator"))
            {
                m_ScriptCreator = new UGUIWithName(config.GetString("ScriptCreator"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ScriptCreator);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ScriptCreator,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ScriptCreator = m_ScriptOwner;
            }
            if (config.Contains("ScriptLastOwner"))
            {
                m_ScriptLastOwner = new UGUIWithName(config.GetString("ScriptLastOwner"))
                {
                    IsAuthoritative = true
                };
                m_AvatarNameService.Store(m_ScriptLastOwner);
                try
                {
                    m_UserAccountService.Add(new UserAccount
                    {
                        Principal     = m_ScriptLastOwner,
                        IsLocalToGrid = true,
                    });
                }
                catch
                {
                    /* intentionally ignored */
                }
            }
            else
            {
                m_ScriptLastOwner = m_ScriptOwner;
            }

            m_StartParameter = config.GetInt("StartParameter", 0);

            if (string.IsNullOrEmpty(m_ScriptFile))
            {
                throw new ArgumentException("Script filename and UUID missing");
            }

            m_AdditionalObjectConfigs = config.GetString("AdditionalObjects", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (m_AdditionalObjectConfigs.Length == 1 && m_AdditionalObjectConfigs[0] == string.Empty)
            {
                m_AdditionalObjectConfigs = new string[0];
            }

            m_AdditionalInventoryConfigs = config.GetString("AdditionalInventories", string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (m_AdditionalInventoryConfigs.Length == 1 && m_AdditionalInventoryConfigs[0] == string.Empty)
            {
                m_AdditionalInventoryConfigs = new string[0];
            }

            m_AssetSourcesConfig = config.GetString("AssetSources", string.Empty);

            m_ScriptStatesConfig = config.GetString("ScriptStates", string.Empty);

            CompilerRegistry.ScriptCompilers.DefaultCompilerName = config.GetString("DefaultCompiler");
        }
 public void Setup()
 {
     /* intentionally left empty */
     m_AvatarNameService.Store(m_Founder);
     m_AvatarNameService.Store(m_Invitee);
 }
        public bool Run()
        {
            var uui1 = new UGUIWithName(UUID.Random, "First", "User", new Uri("http://example.com/"))
            {
                IsAuthoritative = true
            };
            var uui2 = new UGUIWithName(UUID.Random, "Second", "User", new Uri("http://example.com/"))
            {
                IsAuthoritative = true
            };
            List <UGUIWithName> reslist;

            m_Log.Info("---- Step 1 ----");
            if (!CheckNonExistance(1, uui1))
            {
                return(false);
            }

            if (!CheckNonExistance(2, uui2))
            {
                return(false);
            }

            m_Log.Info("Testing that entries are not searchable by last name");
            reslist = m_AvatarNameService.Search(new string[] { "User" });
            if (reslist.Count != 0)
            {
                m_Log.Info("Result list is not empty");
                return(false);
            }

            m_Log.Info("---- Create entry 1 ----");
            m_AvatarNameService.Store(uui1);

            if (!CheckExistance(1, uui1))
            {
                return(false);
            }

            if (!CheckNonExistance(2, uui2))
            {
                return(false);
            }

            m_Log.Info("Testing that one entry is searchable by last name");
            reslist = m_AvatarNameService.Search(new string[] { "User" });
            if (reslist.Count != 1)
            {
                m_Log.Info("Result list does not contain exactly one entry");
                return(false);
            }

            m_Log.Info("Testing equality");
            if (!IsEqual(reslist[0], uui1))
            {
                return(false);
            }

            m_Log.Info("---- Create entry 2 ----");
            m_AvatarNameService.Store(uui2);

            if (!CheckExistance(1, uui1))
            {
                return(false);
            }

            if (!CheckExistance(2, uui2))
            {
                return(false);
            }

            m_Log.Info("Testing that both entries is searchable by last name");
            reslist = m_AvatarNameService.Search(new string[] { "User" });
            if (reslist.Count != 2)
            {
                m_Log.Info("Result list does not contain exactly two entries");
                return(false);
            }

            m_Log.Info("Testing equality");
            if (!((IsEqual(reslist[0], uui1) && IsEqual(reslist[1], uui2)) ||
                  (IsEqual(reslist[0], uui2) && IsEqual(reslist[1], uui1))))
            {
                return(false);
            }


            m_Log.Info("---- Remove entry 1 ----");
            m_AvatarNameService.Remove(uui1.ID);

            if (!CheckNonExistance(1, uui1))
            {
                return(false);
            }

            if (!CheckExistance(2, uui2))
            {
                return(false);
            }

            m_Log.Info("Testing that one entry is searchable by last name");
            reslist = m_AvatarNameService.Search(new string[] { "User" });
            if (reslist.Count != 1)
            {
                m_Log.Info("Result list does not contain exactly one entry");
                return(false);
            }

            m_Log.Info("Testing equality");
            if (!IsEqual(reslist[0], uui2))
            {
                return(false);
            }

            m_Log.Info("---- Remove entry 2 ----");
            m_AvatarNameService.Remove(uui2.ID);

            if (!CheckNonExistance(1, uui1))
            {
                return(false);
            }

            if (!CheckNonExistance(2, uui2))
            {
                return(false);
            }

            m_Log.Info("Testing that entries are not searchable by last name");
            reslist = m_AvatarNameService.Search(new string[] { "User" });
            if (reslist.Count != 0)
            {
                m_Log.Info("Result list is not empty");
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
 public void Setup()
 {
     m_AvatarNameService.Store(m_Founder);
 }