Esempio n. 1
0
        //process of creating a family
        // - other function provides persondata and bodystrings
        // - create FAMI with a new ID
        //   - generate GUID for each sim, and populate FamilyGUIDs
        // - set family in generated persondatas
        // - make the sims
        //   - AddNeighbour to NBRS as below (get back ID. do not set neighborID in personData, as the original doesn't)
        //   - gets a free user_#### id and makes that the name
        //   - replace relevant body strings in TemplatePerson
        //   - add/replace CTSS in TemplatePerson
        //   - change OBJD name to "user_#### - name". maybe change ctss id?
        //   - save sim to userdata

        public static void PrepareTemplatePerson(uint guid, SimTemplateCreateInfo info)
        {
            var neigh = Content.Content.Get().Neighborhood;
            //userid
            var userid = neigh.NextSim;

            var tempObj = Content.Content.Get().WorldObjects.Get(info.CustomGUID ?? TEMPLATE_GUID);

            tempObj.OBJ.ChunkParent.RetainChunkData = true;
            tempObj.OBJ.GUID       = guid;
            tempObj.OBJ.ChunkLabel = "user" + userid.ToString().PadLeft(5, '0') + " - " + info.Name;

            var ctss = tempObj.Resource.Get <CTSS>(2000);

            if (ctss == null)
            {
                ctss = new CTSS()
                {
                    ChunkLabel     = "",
                    ChunkID        = 2000,
                    ChunkProcessed = true,
                    ChunkType      = "CTSS",
                    ChunkParent    = tempObj.Resource.MainIff,
                    AddedByPatch   = true,
                };
                tempObj.Resource.MainIff.AddChunk(ctss);
                ctss.InsertString(0, new STRItem()
                {
                    Value = "", Comment = ""
                });
                ctss.InsertString(0, new STRItem()
                {
                    Value = "", Comment = ""
                });
            }
            ctss.SetString(0, info.Name);
            ctss.SetString(1, info.Bio);
            tempObj.OBJ.CatalogStringsID = 2000;

            var bodyStrings = tempObj.Resource.Get <STR>(200);

            foreach (var item in info.BodyStringReplace)
            {
                bodyStrings.SetString(item.Key, item.Value);
            }

            neigh.SaveNewNeighbour(tempObj);
            bodyStrings.SetString(1, "");
            bodyStrings.SetString(2, "");
        }
Esempio n. 2
0
 public static Neighbour CreateNeighbor(uint guid, SimTemplateCreateInfo info)
 {
     PrepareTemplatePerson(guid, info);
     return(AddNeighbor(guid, 9, info.MakePersonData()));
 }