Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cs"></param>
        /// <param name="cpf"></param>
        /// <returns>ResourceDescriptor for the references String</returns>
        protected static SimPe.Interfaces.Files.IPackedFileDescriptor UpdateDescription(OWCloneSettings cs, SimPe.Packages.GeneratableFile package, SimPe.PackedFiles.Wrapper.ExtObjd obj)
        {
            obj.Price      = cs.Price;
            obj.Data[0x22] = (short)Math.Floor(cs.Price * 0.035); // sale price
            obj.Data[0x23] = (short)Math.Floor(cs.Price * 0.15);  // initial depreciation
            obj.Data[0x24] = (short)Math.Floor(cs.Price * 0.10);  // daily depreciation
            obj.Data[0x25] = 0;                                   // self depreciation
            obj.Data[0x26] = (short)Math.Floor(cs.Price * 0.40);  // depreciation limit
            obj.SynchronizeUserData();
            SimPe.Interfaces.Files.IPackedFileDescriptor pfd = package.FindFile(Data.MetaData.CTSS_FILE, 0, obj.FileDescriptor.Group, obj.CTSSInstance);

            return(pfd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Make sure the fixes for OBJd Resources are considered
        /// </summary>
        /// <remarks>
        /// Currently this implements the Fixes needed for Rugs
        /// </remarks>
        void FixOBJd()
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Updating Object Descriuptions");
            }
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(Data.MetaData.OBJD_FILE);                 //OBJd

            bool updaterugs = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
                objd.ProcessData(pfd, package);

                //is one of the objd's a rug?
                if (objd.FunctionSubSort == SimPe.Data.ObjFunctionSubSort.Decorative_Rugs)
                {
                    updaterugs = true;
                    break;
                }
            }

            //found at least one OBJd describing a Rug
            if (updaterugs)
            {
                foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
                    objd.ProcessData(pfd, package);

                    //make sure the Type of a Rug is not a Tile, but Normal
                    if (objd.Type == SimPe.Data.ObjectTypes.Tiles)
                    {
                        objd.Type = SimPe.Data.ObjectTypes.Normal;
                        objd.SynchronizeUserData(true, true);
                    }
                }
            }
        }