Ejemplo n.º 1
0
 public Definition(string menuText, SculptingSkill.SkillSculptureData sculpture, SculptureComponent.SculptureMaterial material, string[] path) : base(menuText, sculpture, material, path)
 {
 }
Ejemplo n.º 2
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            List <SculptingStation> stations = new List <SculptingStation>();
            List <SculptingStation> empties  = new List <SculptingStation>();

            foreach (Lot lot in ManagerLot.GetOwnedLots(Sim))
            {
                foreach (SculptingStation station in lot.GetObjects <SculptingStation>())
                {
                    if (station.HasFinishedSculpture())
                    {
                        GameObject sculpture = station.GetCurrentSculpture();

                        station.OnHandToolChildUnslottedBase(sculpture, Slot.ContainmentSlot_0);

                        sculpture.UnParent();

                        if (!Sim.Household.SharedFamilyInventory.Inventory.TryToMove(sculpture))
                        {
                            int value = Money.Sell(Sim, sculpture);

                            AddStat("Sculpture Sold", value);
                        }
                        else
                        {
                            IncStat("Sculpture Stored");
                        }
                    }

                    if (station.HasUnfinishedSculpture())
                    {
                        GameObject currentSculpture = station.GetCurrentSculpture();
                        if ((currentSculpture != null) && (currentSculpture.SculptureComponent != null))
                        {
                            if (currentSculpture.SculptureComponent.Artist == Sim)
                            {
                                stations.Add(station);
                            }
                        }
                    }
                    else
                    {
                        empties.Add(station);
                    }
                }
            }

            if (stations.Count == 0)
            {
                stations.AddRange(empties);
            }

            if (stations.Count == 0)
            {
                IncStat("No Station");
                return(false);
            }

            SculptingStation choice = RandomUtil.GetRandomObjectFromList(stations);

            if (choice.HasUnfinishedSculpture())
            {
                IncStat("Sculpture Continued");

                return(Situations.PushInteraction(this, Sim, choice, ContinueSculptureEx.Singleton));
            }
            else
            {
                List <SculptureComponent.SculptureMaterial> materials = new List <SculptureComponent.SculptureMaterial>();

                int skillLevel = Sim.SkillManager.GetSkillLevel(SkillNames.Sculpting);

                skillLevel = Math.Max(0, skillLevel);

                foreach (SculptureComponent.SculptureMaterial material in Enum.GetValues(typeof(SculptureComponent.SculptureMaterial)))
                {
                    if (material == SculptureComponent.SculptureMaterial.None)
                    {
                        continue;
                    }

                    if (material == SculptureComponent.SculptureMaterial.Metal)
                    {
                        continue;
                    }

                    if (!SculptingSkill.HasLevelForMaterial(skillLevel, material))
                    {
                        continue;
                    }

                    if (!SculptingSkill.CanAfford(Sim.CreatedSim, material))
                    {
                        continue;
                    }

                    materials.Add(material);
                }

                if (materials.Count == 0)
                {
                    IncStat("No Material");
                    return(false);
                }

                SculptureComponent.SculptureMaterial materialChoice = RandomUtil.GetRandomObjectFromList(materials);

                List <SculptingSkill.SkillSculptureData> sculptures = SculptingSkill.ValidRandomSculpturesForLevelAndMaterial(skillLevel, materialChoice, Sim.CreatedSim);
                if (sculptures.Count == 0)
                {
                    IncStat("No Sculptures");
                    return(false);
                }

                SculptingSkill.SkillSculptureData sculptureChoice = RandomUtil.GetWeightedRandomObjectFromList(sculptures.ToArray()) as SculptingSkill.SkillSculptureData;

                IncStat("Sculpture Started");

                return(Situations.PushInteraction(this, Sim, choice, new CreateSculptureEx.Definition(null, sculptureChoice, materialChoice, new string[0])));
            }
        }
Ejemplo n.º 3
0
 public Definition(string menuText, SculptureComponent.SculptureMaterial material, string[] menuPath)
     : base(menuText, material, menuPath)
 {
 }
Ejemplo n.º 4
0
 protected Definition(SculptureComponent.SculptureMaterial material)
 {
     mMaterial = material;
 }