Example #1
0
        public static bool SimCanLearnSkill(SkillNames skillName, SimDescription simDesc)
        {
            Skill skill = SkillManager.GetStaticSkill(skillName);

            if (skill == null)
            {
                return(false);
            }

            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | simDesc.Species) & skill.AvailableAgeSpecies) != CASAGSAvailabilityFlags.None)
            {
                return(true);
            }

            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Teen | simDesc.Species) & skill.AvailableAgeSpecies) != CASAGSAvailabilityFlags.None)
            {
                return(true);
            }

            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Child | simDesc.Species) & skill.AvailableAgeSpecies) != CASAGSAvailabilityFlags.None)
            {
                return(true);
            }

            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Toddler | simDesc.Species) & skill.AvailableAgeSpecies) != CASAGSAvailabilityFlags.None)
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        private static void OnAcceptClick(WindowBase sender, UIButtonClickEventArgs eventArgs)
        {
            try
            {
                CASTattoo ths = CASTattoo.gSingleton;

                if (ths.HasAnyPartsInUse())
                {
                    Responder.Instance.CASModel.RequestFinalizeCommitPresetToPart();
                    AdvancedMode = false;
                    ths.PopulateTattooGrid(false, true);
                    ths.mTattooGrid.ShowSelectedItem(false);
                }
                else
                {
                    ths.ClearAllParts();
                    ths.ClearTemplates();
                    ths.CurrentPreset.mPresetId     = 0x0;
                    ths.CurrentPreset.mPresetString = CASUtils.PartDataGetPreset(ths.mActiveTattooPart.Key, 0x0);
                    AdvancedMode            = false;
                    ths.mRemoveTattooOnUndo = true;
                    Responder.Instance.CASModel.RequestUndo();
                }
                eventArgs.Handled = true;
            }
            catch (Exception e)
            {
                Common.Exception("OnAcceptClick", e);
            }
        }
Example #3
0
            private static Color[] ExtractEyebrowColor(string preset)
            {
                if (string.IsNullOrEmpty(preset))
                {
                    return(null);
                }

                return(CASUtils.ExtractEyebrowColor(preset));
            }
Example #4
0
        protected override OptionResult Run(GameHitParameters <Sim> parameters)
        {
            SimOutfit outfit = new SimOutfit(CASUtils.GetOutfitInGameObject(parameters.mTarget.Proxy.ObjectId));

            string msg = "";

            foreach (CASPart part in outfit.Parts)
            {
                msg += CASParts.PartToString(part);
            }

            Common.WriteLog(msg);

            SimpleMessageDialog.Show(Name, Common.Localize(GetTitlePrefix() + ":Success", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }));

            return(OptionResult.SuccessClose);
        }
Example #5
0
            public Item(CASParts.Wrapper part)
                : base(part.mPart.Key, "0x" + part.mPart.Key.InstanceId.ToString("X16"), 0)
            {
                CASParts.PartPreset preset = new CASParts.PartPreset(part.mPart);
                if (!preset.Valid)
                {
                    uint num2 = CASUtils.PartDataNumPresets(part.mPart.Key);
                    if (num2 > 0)
                    {
                        preset = new CASParts.PartPreset(part.mPart, 0);
                        if (!preset.Valid)
                        {
                            return;
                        }
                    }
                }

                mThumbnail = new ThumbnailKey(preset.mPart.Key, (preset.mPresetId != uint.MaxValue) ? ((int)preset.mPresetId) : -1, (uint)preset.mPart.BodyType, (uint)preset.mPart.AgeGenderSpecies, ThumbnailSize.Large);
            }
Example #6
0
            public List <CASParts.PartPreset> GetPresets()
            {
                List <CASParts.PartPreset> presets = new List <CASParts.PartPreset>();

                CASParts.PartPreset preset = new CASParts.PartPreset(mPart);
                if (preset.Valid)
                {
                    presets.Add(preset);
                }

                for (uint index = 0; index < CASUtils.PartDataNumPresets(mPart.Key); index++)
                {
                    preset = new CASParts.PartPreset(mPart, index);
                    if (preset.Valid)
                    {
                        presets.Add(preset);
                    }
                }

                return(presets);
            }
Example #7
0
        public Sim _NInstantiate(Vector3 position, ResourceKey outfitKey, bool addInitialObjects, bool forceAlwaysAnimate)
        {
            if (runI)
            {
                return(null);
            }

            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null)
                {
                    NFinalizeDeath.RUNIACORE(false);
                }
                else
                {
                    NFinalizeDeath.CheckNHSP();
                }
            }

            if (CreatedSim != null)
            {
                return(CreatedSim);
            }

            if (AgingState != null)
            {
                bool isDefaultOutfit = outfitKey == mDefaultOutfitKey;
                AgingState.PreInstantiateSim(ref outfitKey);
                if (isDefaultOutfit)
                {
                    mDefaultOutfitKey = outfitKey;
                }
            }

            Hashtable hashtable = new Hashtable(forceAlwaysAnimate ? 4 : 2);

            hashtable["simOutfitKey"] = outfitKey;
            hashtable["rigKey"]       = CASUtils.GetRigKeyForAgeGenderSpecies(Age | Gender | Species);

            if (forceAlwaysAnimate)
            {
                hashtable["enableSimPoseProcessing"] = 1u;
                hashtable["animationRunsInRealtime"] = 1u;
            }

            string         instanceName = "GameSim";
            ProductVersion version      = ProductVersion.BaseGame;

            if (Species != CASAgeGenderFlags.Human)
            {
                instanceName = "Game" + Species;
                version      = ProductVersion.EP5;
            }

            bool shouldNullHousehold = false;

            if (Household == null)
            {
                mHousehold          = Household.NpcHousehold ?? Household.ActiveHousehold;
                shouldNullHousehold = true;
            }

            Sim sim = GlobalFunctions.CreateObjectWithOverrides(instanceName, version, position, 0, Vector3.UnitZ, hashtable, new SimInitParameters(this)) as Sim;

            if (sim != null)
            {
                sim.mSimDescription = this;
                this.mSim           = sim;

                if (sim.SimRoutingComponent != null)
                {
                    sim.SimRoutingComponent.EnableDynamicFootprint();
                    sim.SimRoutingComponent.ForceUpdateDynamicFootprint();
                }

                try
                {
                    if (sim.IsSelectable)
                    {
                        sim.AddInitialObjects(true);
                    }
                }
                catch (ResetException)
                { throw; }
                catch (Exception)
                { }

                PushAgingEnabledToAgingManager();

                if (OccultManager != null)
                {
                    OccultManager.SetupForInstantiatedSim();
                }

                if (GameUtils.IsFutureWorld())
                {
                    CauseEffectService.ApplyCauseAndEffectModsToSim(sim);
                }
                if (IsAlien)
                {
                    World.ObjectSetVisualOverride(sim.ObjectId, eVisualOverrideTypes.Alien, null);
                }

                if (EventTracker.sInstance != null)
                {
                    EventTracker.SendEvent(EventTypeId.kSimInstantiated, null, sim);
                }

                MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId);
                if (miniSimDescription != null && (GameStates.IsTravelling || mHomeWorld != GameUtils.GetCurrentWorld()))
                {
                    miniSimDescription.UpdateInWorldRelationships(this);
                }

                if (HealthManager != null)
                {
                    HealthManager.Startup();
                }

                if (Household.RoommateManager != null && Household.RoommateManager.IsNPCRoommate(SimDescriptionId))
                {
                    Household.RoommateManager.AddRoommateInteractions(sim);
                }
            }

            if (OccultManager != null && SkinToneKey.InstanceId == 15475186560318337848uL && !OccultManager.HasOccultType(OccultTypes.Vampire) && !OccultManager.HasOccultType(OccultTypes.Werewolf) && !IsGhost)
            {
                World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
            }

            if (Household != null && Household.IsAlienHousehold)
            {
                (Sims3.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, this);
            }

            if (shouldNullHousehold && mHousehold == Household.NpcHousehold)
            {
                mHousehold = null;
            }

            sim.mSimDescription = this;
            this.mSim           = sim;

            return(sim);
        }
Example #8
0
        protected static bool PopulateGrid()
        {
            CASClothingCategory ths = CASClothingCategory.gSingleton;

            if (ths == null)
            {
                return(false);
            }

            ths.mClothingTypesGrid.Clear();

            ths.mCurrentPreset       = null;
            ths.mCurrentFocusedRow   = null;
            ths.mTempFocusedRow      = null;
            ths.mSelectedType        = CASClothingRow.SelectedTypes.None;
            ths.mShareButton.Enabled = false;
            ths.mTrashButton.Enabled = false;
            ths.mSaveButton.Enabled  = false;
            ths.mSortButton.Enabled  = false;
            ths.mSortButton.Tag      = false;

            bool hasFilterableContent = false;

            List <object> parts = new List <object>();

            bool compactCAS = false;

            if (ths.mCurrentPart == BodyTypes.Accessories)
            {
                compactCAS = MasterController.Settings.mCompactAccessoryCAS;
            }
            else
            {
                compactCAS = MasterController.Settings.mCompactClothingCAS;
            }

            if (compactCAS)
            {
                List <CASParts.PartPreset> triPart = new List <CASParts.PartPreset>();
                parts.Add(triPart);

                foreach (object uncastPart in ths.mPartsList)
                {
                    if (uncastPart is CASPart)
                    {
                        CASPart part = (CASPart)uncastPart;

                        CASParts.PartPreset preset = new CASParts.PartPreset(part);
                        if (!preset.Valid)
                        {
                            uint num2 = CASUtils.PartDataNumPresets(part.Key);
                            if (num2 > 0)
                            {
                                preset = new CASParts.PartPreset(part, 0);
                                if (!preset.Valid)
                                {
                                    preset = null;
                                }
                            }
                        }

                        if (preset == null)
                        {
                            continue;
                        }

                        if (!ths.mContentTypeFilter.ObjectMatchesFilter(preset, ref hasFilterableContent))
                        {
                            continue;
                        }

                        triPart.Add(preset);

                        if (triPart.Count == 3)
                        {
                            triPart = new List <CASParts.PartPreset>();
                            parts.Add(triPart);
                        }
                    }
                }
            }
            else
            {
                foreach (object part in ths.mPartsList)
                {
                    if (part is CASPart)
                    {
                        List <CASParts.PartPreset> uniPart = new List <CASParts.PartPreset>();
                        uniPart.Add(new CASParts.PartPreset((CASPart)part));
                        parts.Add(uniPart);
                    }
                    else
                    {
                        parts.Add(part);
                    }
                }
            }

            if (ths.PartPresetsList != null)
            {
                ths.PartPresetsList.Clear();
            }

            sCompleted.Clear();
            sRows.Clear();

            ths.mClothingTypesGrid.ItemRowsChanged -= OnItemRowsChanged;
            ths.mClothingTypesGrid.ItemRowsChanged += OnItemRowsChanged;

            if (parts.Count == 0)
            {
                return(false);
            }

            ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("CASClothingRow", 0x0);

            ths.mClothingTypesGrid.BeginPopulating(AddGridItem, parts, 0x3, layoutKey, null);
            return(true);
        }
Example #9
0
 public static void PopulatePieMenuPickerWithOutfits(CustomPedestal pedestal, Sim actor, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows, OutfitUtils.GreyedOutOutfitCallback greyed)
 {
     if (pedestal == null)
     {
         CMShopping.PrintMessage("Pedestal null");
     }
     NumSelectableRows = 1;
     headers           = new List <ObjectPicker.HeaderInfo>();
     listObjs          = new List <ObjectPicker.TabInfo>();
     headers.Add(new ObjectPicker.HeaderInfo("Ui/Caption/ObjectPicker:Outfit", "Ui/Tooltip/ObjectPicker:Outfit"));
     headers[0].Width = 250;
     if (actor != null)
     {
         SimDescription simDescription = actor.SimDescription;
         ResourceKey    resourceKey    = CASUtils.GetOutfitInGameObject(actor.ObjectId);
         if (simDescription.HasSupernaturalOutfit(resourceKey) && simDescription.CreatedSim != null)
         {
             OutfitCategories currentOutfitCategory = simDescription.CreatedSim.CurrentOutfitCategory;
             int       currentOutfitIndex           = simDescription.CreatedSim.CurrentOutfitIndex;
             SimOutfit outfit = simDescription.GetOutfit(currentOutfitCategory, currentOutfitIndex);
             if (outfit != null && outfit.Key != ResourceKey.kInvalidResourceKey)
             {
                 resourceKey = outfit.Key;
             }
         }
         ObjectPicker.TabInfo tabInfo = new ObjectPicker.TabInfo("glb_all_r2", Localization.LocalizeString("Ui/Caption/ObjectPicker:All", new object[0]), new List <ObjectPicker.RowInfo>());
         string text   = Localization.LocalizeString("Ui/Caption/ObjectPicker:Everyday", new object[0]);
         string text2  = Localization.LocalizeString("Ui/Caption/ObjectPicker:Formalwear", new object[0]);
         string text3  = Localization.LocalizeString("Ui/Caption/ObjectPicker:Sleepwear", new object[0]);
         string text4  = null;
         string text5  = null;
         string text6  = null;
         string text7  = null;
         string text8  = null;
         string text9  = null;
         string text10 = null;
         ObjectPicker.TabInfo tabInfo2  = new ObjectPicker.TabInfo(actor.IsHorse ? "cas_acc_riding" : "shopping_clothing_everyday_r2", text, new List <ObjectPicker.RowInfo>());
         ObjectPicker.TabInfo tabInfo3  = new ObjectPicker.TabInfo("shopping_clothing_formal_r2", text2, new List <ObjectPicker.RowInfo>());
         ObjectPicker.TabInfo tabInfo4  = new ObjectPicker.TabInfo("shopping_clothing_sleepwear_r2", text3, new List <ObjectPicker.RowInfo>());
         ObjectPicker.TabInfo tabInfo5  = null;
         ObjectPicker.TabInfo tabInfo6  = null;
         ObjectPicker.TabInfo tabInfo7  = null;
         ObjectPicker.TabInfo tabInfo8  = null;
         ObjectPicker.TabInfo tabInfo9  = null;
         ObjectPicker.TabInfo tabInfo10 = null;
         ObjectPicker.TabInfo tabInfo11 = null;
         ObjectPicker.TabInfo tabInfo12 = null;
         if (simDescription.ToddlerOrAbove)
         {
             if (!simDescription.Toddler)
             {
                 text4    = Localization.LocalizeString("Ui/Caption/ObjectPicker:Swimwear", new object[0]);
                 text5    = Localization.LocalizeString("Ui/Caption/ObjectPicker:Athletic", new object[0]);
                 tabInfo5 = new ObjectPicker.TabInfo("shopping_clothing_swimwear_r2", text4, new List <ObjectPicker.RowInfo>());
                 tabInfo6 = new ObjectPicker.TabInfo("shopping_clothing_athletic_r2", text5, new List <ObjectPicker.RowInfo>());
             }
             if (GameUtils.IsInstalled(ProductVersion.EP8))
             {
                 text10    = Localization.LocalizeString("Ui/Caption/ObjectPicker:Outerwear", new object[0]);
                 tabInfo12 = new ObjectPicker.TabInfo("cas_clothing_i_outerwear", text10, new List <ObjectPicker.RowInfo>());
             }
         }
         if (simDescription.IsHorse)
         {
             text7     = Localization.LocalizeString("Ui/Caption/ObjectPicker:Racing", new object[0]);
             tabInfo9  = new ObjectPicker.TabInfo("cas_acc_racing", text7, new List <ObjectPicker.RowInfo>());
             text8     = Localization.LocalizeString("Ui/Caption/ObjectPicker:Jumping", new object[0]);
             tabInfo10 = new ObjectPicker.TabInfo("cas_acc_jumping", text8, new List <ObjectPicker.RowInfo>());
             text9     = Localization.LocalizeString("Ui/Caption/ObjectPicker:BridleOnly", new object[0]);
             tabInfo11 = new ObjectPicker.TabInfo("cas_acc_horse_bridles", text9, new List <ObjectPicker.RowInfo>());
         }
         SkillManager skillManager = actor.SkillManager;
         if (skillManager != null && skillManager.HasElement(SkillNames.MartialArts) && !simDescription.IsVisuallyPregnant)
         {
             headers[0].Width += 50;
             text6             = Localization.LocalizeString("Ui/Caption/ObjectPicker:MartialArts", new object[0]);
             tabInfo7          = new ObjectPicker.TabInfo("w_simple_martialarts_skill_s", text6, new List <ObjectPicker.RowInfo>());
         }
         if (actor.Occupation != null)
         {
             SimOutfit outfit2 = simDescription.GetOutfit(OutfitCategories.Career, 0);
             if (outfit2 != null)
             {
                 headers[0].Width += 50;
                 string tabText = Localization.LocalizeString("Ui/Caption/ObjectPicker:Miscellaneous", new object[0]);
                 tabInfo8 = new ObjectPicker.TabInfo("glb_i_options32", tabText, new List <ObjectPicker.RowInfo>());
             }
         }
         string textLabel = Localization.LocalizeString("Ui/Caption/ObjectPicker:Career", new object[0]);
         if (!actor.IsFoal)
         {
             OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Everyday, text, tabInfo2, greyed);
         }
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Formalwear, text2, tabInfo3, greyed);
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Sleepwear, text3, tabInfo4, greyed);
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Swimwear, text4, tabInfo5, greyed);
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Athletic, text5, tabInfo6, greyed);
         if (tabInfo12 != null)
         {
             OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Outerwear, text10, tabInfo12, greyed);
         }
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.MartialArts, text6, tabInfo7, greyed);
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Career, textLabel, tabInfo8, greyed);
         OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Bridle, text9, tabInfo11, greyed);
         Racing racing = skillManager.GetElement(SkillNames.Racing) as Racing;
         if (racing != null && racing.HasRacingSaddleOutfit)
         {
             OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Racing, text7, tabInfo9, greyed);
         }
         Jumping jumping = skillManager.GetElement(SkillNames.Jumping) as Jumping;
         if (jumping != null && jumping.HasJumpOutfit)
         {
             OutfitPicker.PopulatePieMenuPickerWithCategoryOutfits(pedestal, simDescription, resourceKey, tabInfo, OutfitCategories.Jumping, text8, tabInfo10, greyed);
         }
         listObjs.Add(tabInfo);
         if (tabInfo2.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo2);
         }
         if (tabInfo3.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo3);
         }
         if (tabInfo4.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo4);
         }
         if (tabInfo5 != null && tabInfo5.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo5);
         }
         if (tabInfo6 != null && tabInfo6.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo6);
         }
         if (tabInfo12 != null && tabInfo12.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo12);
         }
         if (tabInfo7 != null && tabInfo7.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo7);
         }
         if (tabInfo11 != null && tabInfo11.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo11);
         }
         if (tabInfo9 != null && tabInfo9.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo9);
         }
         if (tabInfo10 != null && tabInfo10.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo10);
         }
         if (tabInfo8 != null && tabInfo8.RowInfo.Count > 0)
         {
             listObjs.Add(tabInfo8);
         }
     }
 }
Example #10
0
        private static void PopulateTypesGrid(CASHair ths)
        {
            if (ths == null)
            {
                return;
            }

            ICASModel cASModel = Responder.Instance.CASModel;

            Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) };
            ths.mHairTypesGrid.Clear();
            CASPart     wornPart = ths.GetWornPart();
            ResourceKey resKey   = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0);

            bool isHat = false;
            bool flag  = false;

            if (ths.mHairType == CASHair.HairType.Hat)
            {
                ths.mHatsShareButton.Enabled  = false;
                ths.mHatsDeleteButton.Enabled = false;
                ths.mDesignButton.Enabled     = CASHair.PartIsHat(wornPart);

                isHat = true;
            }

            bool shouldEnableCatalogProductFilter = false;

            List <object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat);

            ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter);

            if (!MasterController.Settings.mCompactHatCAS)
            {
                foreach (object obj2 in objectList)
                {
                    IFeaturedStoreItem item = obj2 as IFeaturedStoreItem;

                    if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000)))
                    {
                        WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                        if (windowByExportID != null)
                        {
                            windowByExportID.Tag = item;
                            windowByExportID.GetChildByID(0x23, true);
                            Window childByID = windowByExportID.GetChildByID(0x20, true) as Window;
                            if (childByID != null)
                            {
                                ImageDrawable drawable = childByID.Drawable as ImageDrawable;
                                if (drawable != null)
                                {
                                    drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey);
                                    childByID.Invalidate();
                                }
                            }
                            childByID     = windowByExportID.GetChildByID(0x300, true) as Window;
                            childByID.Tag = item;
                            childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip;
                            childByID.Visible = true;
                            childByID         = windowByExportID.GetChildByID(0x303, true) as Window;
                            childByID.Visible = item.IsSale;

                            Button button = windowByExportID.GetChildByID(0x301, true) as Button;
                            button.Caption        = item.PriceString;
                            button.Tag            = windowByExportID;
                            button.Click         += ths.OnBuyButtonClick;
                            button.FocusAcquired += ths.OnBuyButtonFocusAcquired;
                            button.FocusLost     += ths.OnBuyButtonFocusLost;
                            ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item));
                        }
                    }
                }
            }

            foreach (CASPart part2 in ths.mPartsList)
            {
                bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2);
                uint num3           = CASUtils.PartDataNumPresets(part2.Key);
                ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key);
                if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key)))
                {
                    ObjectDesigner.SetCASPart(part2.Key);
                    string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId));
                    if (string.IsNullOrEmpty(designPreset))
                    {
                        ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId);
                        designPreset = Simulator.LoadXMLString(key2);
                    }

                    CASPartPreset preset = new CASPartPreset(part2, designPreset);
                    string        str2   = "";
                    string        str3   = "";
                    if (wornPart.Key == preset.mPart.Key)
                    {
                        str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                        str3 = CASUtils.ReplaceHairColors(str2, colors);
                    }

                    if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue)))
                    {
                        ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                        if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset)))
                        {
                            ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                            flag = true;
                        }
                    }

                    if (ths.mHairType == CASHair.HairType.Hat)
                    {
                        if (MasterController.Settings.mCompactHatCAS)
                        {
                            num3 = 1;
                        }

                        for (int i = 0x0; i < num3; i++)
                        {
                            uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i);
                            customContentType = UIUtils.GetCustomContentType(part2.Key, presetId);

                            preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i));
                            if (preset.Valid)
                            {
                                bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter);
                                if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors)))
                                {
                                    ths.mSavedPresetId = preset.mPresetId;
                                    flag = true;
                                    if (flag4)
                                    {
                                        ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1;
                                        if (ObjectDesigner.IsUserDesignPreset((uint)i))
                                        {
                                            ths.mHatsShareButton.Enabled  = true;
                                            ths.mHatsDeleteButton.Enabled = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter;
            if (ths.mHairStylesGrid.Tag == null)
            {
                ths.mHairStylesGrid.Tag = false;
            }

            ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag;
            if (flag)
            {
                ths.mSaveButton.Enabled = false;
            }
            else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart))
            {
                WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1);
                if (win != null)
                {
                    Window window2 = win.GetChildByID(0x20, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = false;
                    }
                    window2 = win.GetChildByID(0x24, true) as Window;
                    if (window2 != null)
                    {
                        window2.Visible = true;
                    }
                    ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null));
                }
                ths.mSaveButton.Enabled = true;
            }
            ths.mUndoOnDelete = false;
            ths.mContentTypeFilter.UpdateFilterButtonState();
        }
Example #11
0
 public PartPreset(CASPart part, uint index)
     : base(part, CASUtils.PartDataGetPresetId(part.Key, index), CASUtils.PartDataGetPreset(part.Key, index))
 {
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            /*2.5. /serviceValidate [CAS 2.0]
             *
             * /serviceValidate checks the validity of a service ticket and returns an XML-fragment response. /serviceValidate MUST also generate and issue proxy-granting tickets when requested. /serviceValidate MUST NOT return a successful authentication if it receives a proxy ticket. It is RECOMMENDED that if /serviceValidate receives a proxy ticket, the error message in the XML response SHOULD explain that validation failed because a proxy ticket was passed to /serviceValidate.
             *
             * 2.5.1. parameters
             * The following HTTP request parameters MAY be specified to /serviceValidate. They are case sensitive and MUST all be handled by /serviceValidate.
             * service [REQUIRED] - the identifier of the service for which the ticket was issued, as discussed in Section 2.2.1. As a HTTP request parameter, the "service" value MUST be URL-encoded as described in Section 2.2 of RFC 1738 [4].
             * ticket [REQUIRED] - the service ticket issued by /login. Service tickets are described in Section 3.1.
             * pgtUrl [OPTIONAL] - the URL of the proxy callback. Discussed in Section 2.5.4. As a HTTP request parameter, the "pgtUrl" value MUST be URL-encoded as described in Section 2.2 of RFC 1738 [4].
             * renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed if the service ticket was issued from the presentation of the user's primary credentials. It will fail if the ticket was issued from a single sign-on session.
             *
             * 2.5.2. response
             * /serviceValidate will return an XML-formatted CAS serviceResponse as described in the XML schema in Appendix A. Below are example responses:
             *
             * On ticket validation success:
             * <cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
             * <cas:authenticationSuccess>
             * <cas:user>username</cas:user>
             * <cas:proxyGrantingTicket>PGTIOU-84678-8a9d...</cas:proxyGrantingTicket>
             * </cas:authenticationSuccess>
             * </cas:serviceResponse>
             *
             * On ticket validation failure:
             * <cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
             * <cas:authenticationFailure code="INVALID_TICKET">
             *  Ticket ST-1856339-aA5Yuvrxzpv8Tau1cYQ7 not recognized`
             * </cas:authenticationFailure>
             * </cas:serviceResponse>
             *
             * For proxy responses, see section 2.6.2.
             *
             * 2.5.3. error codes
             * The following values MAY be used as the "code" attribute of authentication failure responses. The following is the minimum set of error codes that all CAS servers MUST implement. Implementations MAY include others.
             * INVALID_REQUEST - not all of the required request parameters were present
             * INVALID_TICKET_SPEC - failure to meet the requirements of validation specification
             * UNAUTHORIZED_SERVICE_PROXY - the service is not authorized to perform proxy authentication
             * INVALID_PROXY_CALLBACK - The proxy callback specified is invalid. The credentials specified for proxy authentication do not meet the security requirements
             * INVALID_TICKET - the ticket provided was not valid, or the ticket did not come from an initial login and "renew" was set on validation. The body of the <cas:authenticationFailure> block of the XML response SHOULD describe the exact details.
             * INVALID_SERVICE - the ticket provided was valid, but the service specified did not match the service associated with the ticket. CAS MUST invalidate the ticket and disallow future validation of that same ticket.
             * INTERNAL_ERROR - an internal error occurred during ticket validation
             *
             * For all error codes, it is RECOMMENDED that CAS provide a more detailed message as the body of the <cas:authenticationFailure> block of the XML response.
             */

            Boolean renew  = (!String.IsNullOrEmpty(Request["renew"]) && (Request["renew"].ToString().ToLower() == "true"));
            String  ticket = (!String.IsNullOrEmpty(Request.QueryString["ticket"]) ? Request.QueryString["ticket"].ToString() : "");

            Page.Response.ContentType     = "application/xml; charset=UTF-8";
            Page.Response.ContentEncoding = Encoding.UTF8;

            try
            {
                Uri svc = null;
                try
                {
                    svc = new Uri(Request.QueryString["service"]);
                }
                catch { }

                using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
                {
                    CASConnectorBase connector = CASUtils.GetService(db, this, svc);

                    if (svc == null)
                    {
                        //Serviço não informado ou não encontrado
                        Response.Write(getError(retCode.INVALID_REQUEST, "Service"));
                    }
                    else if ((connector == null) || (connector is EmptyPlugin))
                    {
                        //Serviço não informado ou não encontrado
                        Response.Write(getError(retCode.INVALID_SERVICE, svc.AbsoluteUri));
                    }
                    else if (ticket == "")
                    {
                        //Ticket não informado
                        Response.Write(getError(retCode.INVALID_REQUEST, "Ticket"));
                    }
                    else
                    {
                        CASTicketResult loginRes = connector.Grant(ticket, renew, false);
                        if (loginRes.Success)
                        {
                            StringBuilder xml = new StringBuilder();

                            xml.AppendLine("<cas:serviceResponse xmlns:cas=\"http://www.yale.edu/tp/cas\">");
                            xml.AppendLine("  <cas:authenticationSuccess>");
                            xml.AppendLine("    <cas:user>" + loginRes.UserName + "</cas:user>");
                            if ((loginRes.Attributes != null) && (loginRes.Attributes.Count > 0))
                            {
                                xml.AppendLine("    <cas:attributes>");
                                foreach (String key in loginRes.Attributes.Keys)
                                {
                                    xml.AppendLine("        <cas:" + key + ">" + loginRes.Attributes[key] + "</cas:" + key + ">");
                                }

                                xml.AppendLine("    </cas:attributes>");
                            }
                            xml.AppendLine("    <cas:proxyGrantingTicket>" + ticket + "</cas:proxyGrantingTicket>");
                            xml.AppendLine("  </cas:authenticationSuccess>");
                            xml.AppendLine("</cas:serviceResponse>");

                            Response.Write(xml.ToString());
                        }
                        else
                        {
                            Response.Write(getError(retCode.INVALID_TICKET, ticket));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                getError(retCode.INTERNAL_ERROR, "");
            }

            Page.Response.Status     = "200 OK";
            Page.Response.StatusCode = 200;
            //Page.Response.OutputStream.Write(bRet, 0, bRet.Length);
            //Page.Response.OutputStream.Flush();
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             * 2.4. /validate [CAS 1.0]
             * /validate checks the validity of a service ticket. /validate is part of the CAS 1.0 protocol and thus does not handle proxy authentication. CAS MUST respond with a ticket validation failure response when a proxy ticket is passed to /validate.
             * 2.4.1. parameters
             * The following HTTP request parameters MAY be specified to /validate. They are case sensitive and MUST all be handled by /validate.
             * service [REQUIRED] - the identifier of the service for which the ticket was issued, as discussed in Section 2.2.1. As a HTTP request parameter, the "service" value MUST be URL-encoded as described in Section 2.2 of RFC 1738 [4].
             * ticket [REQUIRED] - the service ticket issued by /login. Service tickets are described in Section 3.1.
             * renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed if the service ticket was issued from the presentation of the user's primary credentials. It will fail if the ticket was issued from a single sign-on session.
             *
             * 2.4.2. response
             * /validate will return one of the following two responses:
             *
             * On ticket validation success:
             * yes<LF>
             *
             * On ticket validation failure:
             * no<LF>
             *
             * 2.4.3. URL examples of /validate
             * Simple validation attempt:
             * https://cas.example.org/cas/validate?service=http%3A%2F%2Fwww.example.org%2Fservice&ticket=ST-1856339-aA5Yuvrxzpv8Tau1cYQ7
             *
             * Ensure service ticket was issued by presentation of primary credentials:
             * https://cas.example.org/cas/validate?service=http%3A%2F%2Fwww.example.org%2Fservice&ticket=ST-1856339-aA5Yuvrxzpv8Tau1cYQ7&renew=true
             *
             */

            Boolean renew  = (!String.IsNullOrEmpty(Request["renew"]) && (Request["renew"].ToString().ToLower() == "true"));
            String  ticket = (!String.IsNullOrEmpty(Request.QueryString["ticket"]) ? Request.QueryString["ticket"].ToString() : "");

            Page.Response.ContentType     = "text/plain; charset=UTF-8";
            Page.Response.ContentEncoding = Encoding.UTF8;


            Uri svc = null;

            try
            {
                svc = new Uri(Request.QueryString["service"]);
            }
            catch { }

            using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
            {
                CASConnectorBase connector = CASUtils.GetService(db, this, svc);

                if ((connector == null) || (connector is EmptyPlugin))
                {
                    //Ticket não informado
                    Response.Write("no\n");
                }
                else if (connector.Grant(ticket, renew, false).Success)
                {
                    Response.Write("yes\n");
                }
                else
                {
                    Response.Write("no\n");
                }
            }
            Page.Response.Status     = "200 OK";
            Page.Response.StatusCode = 200;
            //Page.Response.OutputStream.Write(bRet, 0, bRet.Length);
            //Page.Response.OutputStream.Flush();
        }
Example #14
0
        private static bool IsSimGoodForRoleCommonTest(IMiniSimDescription desc, RoleData data, IRoleGiver roleGiver, out string reason)
        {
            WorldName homeWorld = desc.HomeWorld;

            /*
             * bool isCelebrity = desc.IsCelebrity;
             * if (!data.CanBeCelebrity && isCelebrity)
             * {
             *  reason = "Celebrity Fail";
             *  return false;
             * }
             */
            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(desc.Age | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)
            {
                reason = "Age/Species Fail";
                return(false);
            }

            SimDescription description = desc as SimDescription;

            if (((description != null) && (description.CreatedSim == null)) && (description.WillAgeUpOnInstantiation && ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(AgingState.GetNextOlderAge(desc.Age, desc.Species) | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)))
            {
                reason = "Age/Species Fail";
                return(false);
            }

            if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld)
            {
                if ((homeWorld != WorldName.TouristWorld) && (GameUtils.GetWorldType(homeWorld) != WorldType.Vacation) && (GameUtils.GetWorldType(homeWorld) != WorldType.Future))
                {
                    reason = "Vacation World Fail";
                    return(false);
                }
                if (homeWorld == GameUtils.GetCurrentWorld())
                {
                    reason = "Home World Fail";
                    return(false);
                }
                if (GameUtils.GetWorldType(homeWorld) == WorldType.Future)
                {
                    if (Sims3.Gameplay.Queries.CountObjects <ITimePortal>() == 0)
                    {
                        reason = "Time Portal Fail";
                        return(false);
                    }
                }
            }

            /*
             * else if (data.FillRoleFrom == RoleFillFrom.CustomCreatedSim)
             * {
             *  return false;
             * }
             */

            IRoleGiverCustomIsSimGoodTest test = roleGiver as IRoleGiverCustomIsSimGoodTest;

            if ((test != null) && (!test.IsSimGoodForRole(desc)))
            {
                reason = "Role Giver Fail";
                return(false);
            }

            reason = "Success";
            return(true);
        }
Example #15
0
        protected string SetTraits(SimDescription me, IEnumerable <SimTrait.Item> choices)
        {
            string result = Name + Common.NewLine + me.FullName;

            bool success = false;

            foreach (SimTrait.Item selection in choices)
            {
                if (me.TraitManager.HasElement(selection.Value))
                {
                    continue;
                }

                Trait selected = TraitManager.GetTraitFromDictionary(selection.Value);
                if (selected != null)
                {
                    if (!selected.TraitValidForAgeSpecies(CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | me.Species)))
                    {
                        continue;
                    }

                    if (me.mSpendableHappiness < selected.Score)
                    {
                        continue;
                    }

                    me.mSpendableHappiness -= selected.Score;

                    result += Common.NewLine + "  " + selected.TraitName(me.IsFemale);

                    success = true;

                    if (Traits.IsObjectBaseReward(selected.Guid))
                    {
                        if (me.Household == null)
                        {
                            continue;
                        }

                        if (me.CreatedSim == null)
                        {
                            continue;
                        }

                        HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
                        if (hudModel != null)
                        {
                            bool showTNS          = SimTypes.IsSelectable(me);
                            bool inHouseInventory = false;
                            Sim  rewardedSim      = me.CreatedSim;
                            hudModel.GiveRewardObjects(me.CreatedSim, selected.Guid, selected.ProductVersion, ref showTNS, ref inHouseInventory, ref rewardedSim);
                        }
                    }
                    else
                    {
                        switch (selected.Guid)
                        {
                        case TraitNames.ForeverYoung:
                            me.AgingEnabled = false;
                            break;

                        default:
                            if (selected.Guid == TraitNames.SuperVampire)
                            {
                                me.AgingEnabled = false;
                            }

                            if (!me.AddTrait(selected))
                            {
                                me.mSpendableHappiness += selected.Score;
                            }
                            break;
                        }
                    }
                }
            }

            if (!success)
            {
                result += Common.NewLine + "  " + Common.Localize(GetTitlePrefix() + ":None");
            }

            return(result);
        }
Example #16
0
        protected IEnumerable <SimTrait.Item> GetChoices(SimDescription me, int max)
        {
            List <SimTrait.Item> allOptions = new List <SimTrait.Item>();

            foreach (Trait trait in TraitManager.GetDictionaryTraits)
            {
                if (!trait.IsReward)
                {
                    continue;
                }

                if (me != null)
                {
                    if (mPreviousChoices.ContainsKey(trait.Guid))
                    {
                        continue;
                    }

                    if (me.TraitManager.HasElement(trait.Guid))
                    {
                        continue;
                    }
                    else if (!trait.TraitValidForAgeSpecies(CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | me.Species)))
                    {
                        continue;
                    }

                    switch (trait.Guid)
                    {
                    case TraitNames.ForeverYoung:
                        if (!me.AgingEnabled)
                        {
                            continue;
                        }
                        break;
                    }
                }

                if (Traits.IsObjectBaseReward(trait.Guid))
                {
                    if ((me != null) && (me.CreatedSim == null))
                    {
                        continue;
                    }
                }

                allOptions.Add(new SimTrait.Item(trait.Guid, trait.Score));
            }

            if (allOptions.Count == 0)
            {
                return(null);
            }

            string title = Name;

            if (me != null)
            {
                title = me.FullName + Common.NewLine + Common.LocalizeEAString(false, "Ui/Caption/HUD/RewardTraitsShopDialog:Available", new object[] { (int)me.mSpendableHappiness });
            }

            CommonSelection <SimTrait.Item> .Results selection = new CommonSelection <SimTrait.Item>(Name, title, allOptions).SelectMultiple(max);
            if ((selection == null) || (selection.Count == 0))
            {
                return(null);
            }

            if (me != null)
            {
                foreach (SimTrait.Item item in selection)
                {
                    mPreviousChoices[item.Value] = true;
                }
            }

            return(selection);
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html  = "";
            String error = "";

            html += "<div id=\"recover_container\"><form id=\"pwdChange\" name=\"pwdChange\" method=\"post\"><div class=\"login_form\">";

            if ((Session["cas_ticket"] == null) || !(Session["cas_ticket"] is CASTicketResult))
            {
                //Serviço não informado ou não encontrado
                html += "    <ul>";
                html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("invalid_session") + "</div>";
                html += "    </ul>";
            }
            else
            {
                CASTicketResult ticket = (CASTicketResult)Session["cas_ticket"];
                using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
                {
                    CASConnectorBase connector = CASUtils.GetService(db, this, ticket.Service);

                    if ((connector == null) || (connector is EmptyPlugin))
                    {
                        //Serviço não informado ou não encontrado
                        html += "    <ul>";
                        html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_invalid_uri") + "</div>";
                        html += "    </ul>";
                    }
                    else if ((connector.State != null) && (connector.State is CASPluginService) && !(((CASPluginService)connector.State).Config.PermitChangePassword))
                    {
                        CASPluginService p = (CASPluginService)connector.State;
                        //Serviço não informado ou não encontrado
                        html += "    <ul>";
                        html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_not_permit_change_pwd") + (!String.IsNullOrEmpty(p.Config.Admin) ? "<br /><br />" + p.Config.Admin : "") + "</div>";
                        html += "    </ul>";
                    }
                    else
                    {
                        if (Request.HttpMethod == "POST")
                        {
                            try
                            {
                                String password  = Tools.Tool.TrataInjection(Request["password"]);
                                String password2 = Request["password2"];
                                if ((password == null) || (password == ""))
                                {
                                    error = MessageResource.GetMessage("type_password");
                                }
                                else if ((password2 == null) || (password2 == ""))
                                {
                                    error = MessageResource.GetMessage("type_password_confirm");
                                }
                                else if (password != password2)
                                {
                                    error = MessageResource.GetMessage("password_not_equal");
                                }
                                else
                                {
                                    CASChangePasswordResult res = connector.ChangePassword(ticket, password);
                                    if (res.Success)
                                    {
                                        connector.SaveTicket(ticket);

                                        CASUtils.AddCoockie(this, ticket);

                                        Session["user_info"] = new CASUserInfo(ticket);

                                        Response.Redirect(Session["ApplicationVirtualPath"] + "cas/passwordchanged/", false);
                                        return;
                                    }
                                    else
                                    {
                                        if (res.ErrorText == null)
                                        {
                                            throw new Exception("");
                                        }

                                        error = res.ErrorText;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Tools.Tool.notifyException(ex);
                                error = MessageResource.GetMessage("internal_error");
                            }
                        }

                        html += "    <ul>";
                        html += "        <li>";
                        html += "            <p style=\"width:270px;padding:0 0 20px 0;color:#000;\">" + MessageResource.GetMessage("password_expired_text") + "</p>";
                        html += "        </li>";
                        html += "    <li>";
                        html += "        <span class=\"inputWrap\">";
                        html += "			<input type=\"password\" id=\"password\" tabindex=\"1\" name=\"password\" value=\"\" style=\"\"  placeholder=\""+ MessageResource.GetMessage("new_password") + "\" onkeyup=\"cas.passwordStrength('#password');\" onfocus=\"$('#password').addClass('focus');\" onblur=\"$('#password').removeClass('focus');\" />";
                        html += "			<span id=\"ph_passwordIcon\" onclick=\"$('#password').focus();\"></span>";
                        html += "        </span>";
                        html += "    </li>";
                        html += "    <li>";
                        html += "        <span class=\"inputWrap\">";
                        html += "			<input type=\"password\" id=\"password2\" tabindex=\"1\" name=\"password2\" value=\"\" style=\"\" placeholder=\""+ MessageResource.GetMessage("new_password_confirm") + "\" onfocus=\"$('#password2').addClass('focus');\" onblur=\"$('#password2').removeClass('focus');\" />";
                        html += "			<span id=\"ph_passwordIcon\" onclick=\"$('#password2').focus();\"></span>";
                        html += "        </span>";
                        html += "    </li>";
                        html += "    <li>";
                        html += "        <div id=\"passwordStrength\"><span>" + MessageResource.GetMessage("password_strength") + ": " + MessageResource.GetMessage("unknow") + "</span><div class=\"bar\"></div></div>";
                        html += "    </li>";

                        if (error != "")
                        {
                            html += "        <li><div class=\"error-box\">" + error + "</div>";
                        }

                        html += "        <li>";
                        html += "           <span class=\"forgot\"> <a href=\"" + Session["ApplicationVirtualPath"] + "cas/login/?service=" + HttpUtility.UrlEncode(connector.Service.AbsoluteUri) + "\">" + MessageResource.GetMessage("cancel") + "</a> </span>";
                        html += "           <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("change_password") + "</button>";
                        html += "        </li>";
                        html += "    </ul>";
                    }
                }

                html += "</div>";
                html += "</form>";
                html += "</div>";
            }
            holderContent.Controls.Add(new LiteralControl(html));
        }
Example #18
0
        private static void OnColorsSaved(Color[] colors)
        {
            try
            {
                CASMakeup ths = CASMakeup.gSingleton;
                if (ths == null)
                {
                    return;
                }

                bool flag  = false;
                bool flag2 = false;
                if (CASMakeup.sCategory != BodyTypes.CostumeMakeup)
                {
                    foreach (ItemGridCellItem item in ths.mGridMakeupPresets.Items)
                    {
                        flag2 = true;
                        ResourceKey mTag = (ResourceKey)item.mTag;
                        ColorInfo   info = ColorInfo.FromResourceKey(mTag);
                        for (int i = 0x0; i < info.Colors.Length; i++)
                        {
                            Vector3 vector = CompositorUtil.ColorToVector3(colors[i]);
                            Vector3 v      = CompositorUtil.ColorToVector3(info.Colors[i]);
                            if (!vector.IsSimilarTo(v))
                            {
                                flag2 = false;
                                break;
                            }
                        }
                        if (flag2)
                        {
                            break;
                        }
                    }

                    if (!flag2)
                    {
                        ColorInfo info2 = new ColorInfo();
                        info2.Usage = ColorInfo.PreferredUse.Makeup;
                        switch (CASMakeup.sCategory)
                        {
                        case BodyTypes.FirstFace:
                            info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupLipstick;
                            break;

                        case BodyTypes.EyeShadow:
                            info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupEyeshadow;
                            break;

                        case BodyTypes.EyeLiner:
                            info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupEyeliner;
                            break;

                        case BodyTypes.Blush:
                            info2.UsageSubCategory = ColorInfo.eUsageSubCategory.MakeupBlush;
                            break;
                        }
                        info2.Colors = colors;
                        flag         = info2.SaveMakeupPreset(info2.UsageSubCategory) != ResourceKey.kInvalidResourceKey;
                        ths.PopulatePresetsGrid(CASMakeup.sCategory, ths.mCurrentPreset.mPart, ths.mButtonFilter.Selected);
                    }
                }
                else
                {
                    CASPart wornPart = ths.mCurrentPreset.mPart;

                    ObjectDesigner.SetCASPart(wornPart.Key);
                    Vector3[] makeupVectorColors = ths.GetMakeupVectorColors(wornPart);
                    uint      num = CASUtils.PartDataNumPresets(wornPart.Key);
                    for (uint j = 0x0; j < num; j++)
                    {
                        KeyValuePair <string, Dictionary <string, Complate> > presetEntryFromPresetString = (KeyValuePair <string, Dictionary <string, Complate> >)SimBuilder.GetPresetEntryFromPresetString(CASUtils.PartDataGetPreset(wornPart.Key, j));
                        Vector3[] vectorArray2 = ths.GetMakeupVectorColors(presetEntryFromPresetString);
                        flag2 = true;
                        for (uint k = 0x0; k < vectorArray2.Length; k++)
                        {
                            if (!makeupVectorColors[k].IsSimilarTo(vectorArray2[k]))
                            {
                                flag2 = false;
                                break;
                            }
                        }
                        if (flag2)
                        {
                            break;
                        }
                    }

                    if (!flag2)
                    {
                        uint index = ObjectDesigner.AddDesignPreset(Responder.Instance.CASModel.GetDesignPreset(wornPart));
                        flag = index != uint.MaxValue;
                        CASClothingRow row = ths.FindRow(wornPart);
                        if (row != null)
                        {
                            row.CreateGridItems(true);
                            row.PopulateGrid(true);
                        }
                        ths.mButtonCostumeFilter.Tag = true;
                        ths.mContentTypeFilter.UpdateFilterButtonState();
                        ThumbnailKey key = new ThumbnailKey(wornPart.Key, (int)CASUtils.PartDataGetPresetId(wornPart.Key, index), (uint)wornPart.BodyType, (uint)wornPart.AgeGenderSpecies, ThumbnailSize.Large);
                        ThumbnailManager.InvalidateThumbnail(key);
                    }
                }

                if (flag)
                {
                    CASController.Singleton.ErrorMsg(CASErrorCode.SaveSuccess);
                }
                else if (flag2)
                {
                    Simulator.AddObject(new OneShotFunctionTask(delegate
                    {
                        string messageText = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/CAS/Hair:SaveDuplicate", new object[0x0]);
                        SimpleMessageDialog.Show(null, messageText, ModalDialog.PauseMode.PauseTask, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                    }));
                }
                else
                {
                    CASController.Singleton.ErrorMsg(CASErrorCode.SaveFailed);
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnColorsSaved", e);
            }
        }
Example #19
0
        public static void PopulateEyebrowGrid()
        {
            try
            {
                CASEyebrows ths = CASEyebrows.gSingleton;
                if (ths == null)
                {
                    return;
                }

                ths.mEyebrowPresetsGrid.Clear();
                CASPart wornPart     = ths.GetWornPart(BodyTypes.Eyebrows);
                string  designPreset = null;

                // Custom
                try
                {
                    designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                }
                catch
                { }

                ResourceKey layoutKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0);
                int         num       = 0x0;
                foreach (CASPart part2 in Responder.Instance.CASModel.GetVisibleCASParts(BodyTypes.Eyebrows))
                {
                    ObjectDesigner.SetCASPart(part2.Key);
                    CASPartPreset preset = null;
                    uint          num2   = CASUtils.PartDataNumPresets(part2.Key);
                    for (uint i = 0x0; i < num2; i++)
                    {
                        preset = new CASPartPreset(part2, CASUtils.PartDataGetPresetId(part2.Key, i), CASUtils.PartDataGetPreset(part2.Key, i));
                        ths.AddPresetGridItem(ths.mEyebrowPresetsGrid, layoutKey, preset, part2, i + 0x1);
                        if ((wornPart.Key == part2.Key) && (designPreset == preset.mPresetString))
                        {
                            ths.mCurrentEyebrowPreset            = preset;
                            ths.mEyebrowPresetsGrid.SelectedItem = num;
                        }
                        num++;
                    }

                    if (num2 == 0x0)
                    {
                        preset = new CASPartPreset(part2, Responder.Instance.CASModel.GetDesignPreset(part2));
                        if (preset.Valid)
                        {
                            ths.AddPresetGridItem(ths.mEyebrowPresetsGrid, layoutKey, preset, part2, 0x0);
                            if (wornPart.Key == part2.Key)
                            {
                                ths.mCurrentEyebrowPreset            = preset;
                                ths.mEyebrowPresetsGrid.SelectedItem = num;
                            }
                            num++;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("PopulateEyebrowGrid", e);
            }
        }
Example #20
0
        // From SimDescription.Instantiate
        private static Sim Perform(SimDescription ths, Vector3 position, ResourceKey outfitKey, bool forceAlwaysAnimate, OnReset reset)
        {
            Household.HouseholdSimsChangedCallback changedCallback = null;
            Household changedHousehold = null;

            bool isChangingWorlds = GameStates.sIsChangingWorlds;

            bool isLifeEventManagerEnabled = LifeEventManager.sIsLifeEventManagerEnabled;

            Corrections.RemoveFreeStuffAlarm(ths);

            using (SafeStore store = new SafeStore(ths, SafeStore.Flag.LoadFixup | SafeStore.Flag.Selectable | SafeStore.Flag.Unselectable))
            {
                try
                {
                    // Stops the memories system from interfering
                    LifeEventManager.sIsLifeEventManagerEnabled = false;

                    // Stops UpdateInformationKnownAboutRelationships()
                    GameStates.sIsChangingWorlds = true;

                    if (ths.Household != null)
                    {
                        changedCallback  = ths.Household.HouseholdSimsChanged;
                        changedHousehold = ths.Household;

                        ths.Household.HouseholdSimsChanged = null;
                    }

                    if (ths.CreatedSim != null)
                    {
                        AttemptToPutInSafeLocation(ths.CreatedSim, false);

                        if (reset != null)
                        {
                            ths.CreatedSim.SetObjectToReset();

                            reset(ths.CreatedSim, false);
                        }

                        return(ths.CreatedSim);
                    }

                    if (ths.AgingState != null)
                    {
                        bool flag = outfitKey == ths.mDefaultOutfitKey;

                        ths.AgingState.SimBuilderTaskDeferred = false;

                        ths.AgingState.PreInstantiateSim(ref outfitKey);
                        if (flag)
                        {
                            ths.mDefaultOutfitKey = outfitKey;
                        }
                    }

                    int       capacity  = forceAlwaysAnimate ? 0x4 : 0x2;
                    Hashtable overrides = new Hashtable(capacity);
                    overrides["simOutfitKey"] = outfitKey;
                    overrides["rigKey"]       = CASUtils.GetRigKeyForAgeGenderSpecies((ths.Age | ths.Gender) | ths.Species);
                    if (forceAlwaysAnimate)
                    {
                        overrides["enableSimPoseProcessing"] = 0x1;
                        overrides["animationRunsInRealtime"] = 0x1;
                    }

                    string         instanceName = "GameSim";
                    ProductVersion version      = ProductVersion.BaseGame;
                    if (ths.Species != CASAgeGenderFlags.Human)
                    {
                        instanceName = "Game" + ths.Species;
                        version      = ProductVersion.EP5;
                    }

                    SimInitParameters initData = new SimInitParameters(ths);
                    Sim target = GlobalFunctions.CreateObjectWithOverrides(instanceName, version, position, 0x0, Vector3.UnitZ, overrides, initData) as Sim;
                    if (target != null)
                    {
                        if (target.SimRoutingComponent == null)
                        {
                            // Performed to ensure that a useful error message is produced when the Sim construction fails
                            target.OnCreation();
                            target.OnStartup();
                        }

                        target.SimRoutingComponent.EnableDynamicFootprint();
                        target.SimRoutingComponent.ForceUpdateDynamicFootprint();

                        ths.PushAgingEnabledToAgingManager();

                        /* This code is idiotic
                         * if ((ths.Teen) && (target.SkillManager != null))
                         * {
                         *  Skill skill = target.SkillManager.AddElement(SkillNames.Homework);
                         *  while (skill.SkillLevel < SimDescription.kTeenHomeworkSkillStartLevel)
                         *  {
                         *      skill.ForceGainPointsForLevelUp();
                         *  }
                         * }
                         */

                        // Custom
                        OccultTypeHelper.SetupForInstantiatedSim(ths.OccultManager);

                        if (ths.IsAlien)
                        {
                            World.ObjectSetVisualOverride(target.ObjectId, eVisualOverrideTypes.Alien, null);
                        }

                        AttemptToPutInSafeLocation(target, false);

                        EventTracker.SendEvent(EventTypeId.kSimInstantiated, null, target);

                        /*
                         * MiniSimDescription description = MiniSimDescription.Find(ths.SimDescriptionId);
                         * if ((description == null) || (!GameStates.IsTravelling && (ths.mHomeWorld == GameUtils.GetCurrentWorld())))
                         * {
                         *  return target;
                         * }
                         * description.UpdateInWorldRelationships(ths);
                         */

                        if (ths.HealthManager != null)
                        {
                            ths.HealthManager.Startup();
                        }

                        if (((ths.SkinToneKey.InstanceId == 15475186560318337848L) && !ths.OccultManager.HasOccultType(OccultTypes.Vampire)) && (!ths.OccultManager.HasOccultType(OccultTypes.Werewolf) && !ths.IsGhost))
                        {
                            World.ObjectSetVisualOverride(ths.CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
                        }

                        if (ths.Household.IsAlienHousehold)
                        {
                            (Sims3.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, ths);
                        }

                        if (Household.RoommateManager.IsNPCRoommate(ths.SimDescriptionId))
                        {
                            Household.RoommateManager.AddRoommateInteractions(target);
                        }
                    }

                    return(target);
                }
                finally
                {
                    LifeEventManager.sIsLifeEventManagerEnabled = isLifeEventManagerEnabled;

                    GameStates.sIsChangingWorlds = isChangingWorlds;

                    if ((changedHousehold != null) && (changedCallback != null))
                    {
                        changedHousehold.HouseholdSimsChanged = changedCallback;

                        if (changedHousehold.HouseholdSimsChanged != null)
                        {
                            changedHousehold.HouseholdSimsChanged(Sims3.Gameplay.CAS.HouseholdEvent.kSimAdded, ths.CreatedSim, null);
                        }
                    }
                }
            }
        }
Example #21
0
 /// <summary>
 /// Initializes all ScriptCore classes that data to the App Domain
 /// and initialize any other static members in Sims3.SimIFace classes.
 /// </summary>
 public static void Initialize()
 {
     if (!sInitialized)
     {
         if (gAnimation == null)
         {
             gAnimation = new Animation();
         }
         if (gAudio == null)
         {
             gAudio = new Audio();
         }
         if (gAutomationUtils == null)
         {
             gAutomationUtils = new AutomationUtils();
         }
         if (gCacheManager == null)
         {
             gCacheManager = new CacheManager();
         }
         if (gCameraController == null)
         {
             gCameraController = new CameraController();
         }
         if (gCASUtils == null)
         {
             gCASUtils = new CASUtils();
         }
         if (gCommandSystem == null)
         {
             gCommandSystem = new CommandSystem();
         }
         if (gCTProductModularObject == null)
         {
             gCTProductModularObject = new CTProductModularObject();
         }
         if (gDataFactory == null)
         {
             gDataFactory = new DataFactory();
         }
         if (gDebugDraw == null)
         {
             gDebugDraw = new DebugDraw();
         }
         if (gDeviceConfig == null)
         {
             gDeviceConfig = new DeviceConfig();
         }
         if (gDownloadContent == null)
         {
             gDownloadContent = new DownloadContent();
         }
         if (gEAText == null)
         {
             gEAText = new EAText();
         }
         if (gEATrace == null)
         {
             gEATrace = new EATrace();
         }
         if (gEventQueueInitializer == null)
         {
             gEventQueueInitializer = new EventQueueInitializer();
         }
         if (gGameUtils == null)
         {
             gGameUtils = new GameUtils();
         }
         if (gLoadSaveManager == null)
         {
             gLoadSaveManager = new LoadSaveManager();
         }
         if (gLocalizedStringService == null)
         {
             gLocalizedStringService = new LocalizedStringService();
         }
         if (gLookAtMgr == null)
         {
             gLookAtMgr = new LookAtMgr();
         }
         if (gNameGuidMapService == null)
         {
             gNameGuidMapService = new NameGuidMapService();
         }
         if (gObjects == null)
         {
             gObjects = new Objects();
         }
         if (gOnlineFeatures == null)
         {
             gOnlineFeatures = new OnlineFeatures();
         }
         //if (gProfilerUtils == null) gProfilerUtils = new ProfilerUtils();
         if (gQueries == null)
         {
             gQueries = new Queries();
         }
         if (gRandom == null)
         {
             gRandom = new ScriptCore.Random();
         }
         if (gReflection == null)
         {
             gReflection = new ScriptCore.Reflection();
         }
         if (gRouteManager == null)
         {
             gRouteManager = new RouteManager();
         }
         if (gSACS == null)
         {
             gSACS = new SACS();
         }
         if (gSimulator == null)
         {
             gSimulator = new Simulator();
         }
         if (gSlots == null)
         {
             gSlots = new Slots();
         }
         if (gSocialFeatures == null)
         {
             gSocialFeatures = new SocialFeatures();
         }
         if (gStopWatch == null)
         {
             gStopWatch = new StopWatch();
         }
         if (gStreamHost == null)
         {
             gStreamHost = new StreamHost();
         }
         if (gSwarm == null)
         {
             gSwarm = new Swarm();
         }
         if (gThumbnailManager == null)
         {
             gThumbnailManager = new ThumbnailManager();
         }
         if (gUIManager == null)
         {
             gUIManager = new UIManager();
         }
         if (gUserToolUtils == null)
         {
             gUserToolUtils = new UserToolUtils();
         }
         if (gVideoRecorder == null)
         {
             gVideoRecorder = new VideoRecorder();
         }
         if (gWorld == null)
         {
             gWorld = new World();
         }
         // Will this still be reached if any of the constructors throw an Exception? Hopefully not
         sInitialized = true;
     }
 }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Boolean renew   = (!String.IsNullOrEmpty(Request["renew"]) && (Request["renew"].ToString().ToLower() == "true"));
            Boolean gateway = (!String.IsNullOrEmpty(Request["gateway"]) && (Request["gateway"].ToString().ToLower() == "true"));
            Boolean warn    = (!String.IsNullOrEmpty(Request["warn"]) && (Request["warn"].ToString().ToLower() == "true"));

            if (renew || warn)
            {
                gateway = false;
            }

            if (warn)
            {
                renew = true;
            }

            String html  = "";
            String error = "";

            html += "<form id=\"serviceLogin\" name=\"serviceLogin\" method=\"post\" action=\"/cas/login/?" + Request.QueryString + "\"><div class=\"login_form\">";

            try
            {
                Session.Remove("cas_ticket");
            }
            catch { }


            Uri svc = null;

            try
            {
                svc = new Uri(Request.QueryString["service"]);
            }
            catch { }

            using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
            {
                CASConnectorBase connector = CASUtils.GetService(db, this, svc);

                if ((connector == null) || (connector is EmptyPlugin))
                {
                    //Serviço não informado ou não encontrado
                    html += "    <ul>";
                    html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_invalid_uri") + "</div>";
                    html += "    </ul>";
                }
                else
                {
                    if (Request.HttpMethod == "GET")
                    {
                        //Serviço encontrado

                        //verifica se há cookie com token
                        HttpCookie tgc = Request.Cookies["TGC-SafeID"];
                        if (tgc != null)
                        {
                            //Verifica autenticação através do cookie
                            if (connector.Grant(tgc, renew, warn).Success)
                            {
                                Redirect(tgc.Value);//Autenticado redireciona
                                return;
                            }
                        }
                        else if (gateway)//é Gateway, ou seja não mostra opção do usuário digitar a senha
                        {
                            Redirect("");
                            return;
                        }
                    }
                    else
                    {
                        //Valida usuário e senha
                        try
                        {
                            if (String.IsNullOrEmpty(Request["username"]) || String.IsNullOrEmpty(Request["password"]))
                            {
                                error = MessageResource.GetMessage("valid_username_pwd");
                            }
                            else
                            {
                                CASTicketResult casTicket = connector.Grant(Request["username"], Request["password"]);
                                CASUtils.ClearCookie(Page);
                                if ((casTicket.Success) && (casTicket.ChangePasswordNextLogon))
                                {
                                    //Cria a sessão com as informações necessárias e redireciona
                                    Session["cas_ticket"] = casTicket;
                                    Response.Redirect(Session["ApplicationVirtualPath"] + "cas/changepassword/", false);
                                    return;
                                }
                                else if (casTicket.Success)
                                {
                                    connector.SaveTicket(casTicket);//Salva o token recebido

                                    //Salva o token no cookie
                                    CASUtils.AddCoockie(this, casTicket);

                                    Redirect(casTicket.GrantTicket);//Autenticação OK redireciona
                                    return;
                                }
                                else
                                {
                                    error = casTicket.ErrorText;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                            Tools.Tool.notifyException(ex);
                            error = MessageResource.GetMessage("internal_error");
                        }
                    }

                    html += "    <ul>";
                    html += "        <li>";
                    html += "            <span class=\"inputWrap\">";
                    html += "				<input type=\"text\" id=\"username\" tabindex=\"1\" name=\"username\" value=\""+ Request["username"] + "\" style=\"\" placeholder=\"" + MessageResource.GetMessage("login_user_name") + "\" onfocus=\"$('#username').addClass('focus');\" onblur=\"$('#username').removeClass('focus');\" />";
                    html += "				<span id=\"ph_usernameIcon\" onclick=\"$('#username').focus();\"></span>";
                    html += "            </span>";
                    html += "        </li>";
                    html += "        <li>";
                    html += "            <span class=\"inputWrap\">";
                    html += "				<input type=\"password\" id=\"password\" tabindex=\"2\" name=\"password\" value=\"\" style=\"\" placeholder=\""+ MessageResource.GetMessage("login_password") + "\" onfocus=\"$('#password').addClass('focus');\" onblur=\"$('#password').removeClass('focus');\" />";
                    html += "				<span id=\"ph_passwordIcon\" onclick=\"$('#password').focus();\"></span>";
                    html += "			</span>";
                    html += "        </li>";
                    if (error != "")
                    {
                        html += "        <li><div class=\"error-box\">" + error + "</div>";
                    }
                    html += "        </li>";
                    html += "        <li>";
                    html += "            <span class=\"forgot\"> <a href=\"" + Session["ApplicationVirtualPath"] + "cas/recover/?service=" + HttpUtility.UrlEncode(connector.Service.AbsoluteUri) + "\">" + MessageResource.GetMessage("login_forgot") + "</a> </span>";
                    html += "            <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("login_log") + "</button>";
                    html += "        </li>";
                    html += "    </ul>     ";
                }

                html += "</div></form>";
            }

            holderContent.Controls.Add(new LiteralControl(html));
        }
Example #23
0
        public static void PopulateHornColors()
        {
            try
            {
                CAPUnicorn ths = CAPUnicorn.gSingleton;
                if (ths == null)
                {
                    return;
                }

                CASPartPreset preset;
                ths.mHornColorsGrid.Clear();
                List <CASPart> wornHornParts = new List <CASPart>();

                CASPart wornPart = ths.GetWornHornPart();

                CASLogic singleton = CASLogic.GetSingleton();

                foreach (CASPart part in singleton.mCasParts)
                {
                    if ((part.BodyType == BodyTypes.PetHorn) &&
                        (part.Species == CASAgeGenderFlags.Horse) &&
                        ((part.Age & singleton.Age) != CASAgeGenderFlags.None))
                    {
                        wornHornParts.Add(part);
                    }
                }

                CompositorUtil.GetPatternsFromCASPart(wornPart);
                ObjectDesigner.SetCASPart(wornPart.Key);
                ResourceKey layoutKey    = ResourceKey.CreateUILayoutKey("EyeColorPresetGridItem", 0x0);
                string      designPreset = null;

                // Custom
                try
                {
                    designPreset = Responder.Instance.CASModel.GetDesignPreset(wornPart);
                }
                catch
                { }

                foreach (CASPart wornHornPart in wornHornParts)
                {
                    uint num = CASUtils.PartDataNumPresets(wornHornPart.Key);

                    int i = 0;

                    for (uint j = 0x0; j < num; j++)
                    {
                        preset = new CASPartPreset(wornHornPart, CASUtils.PartDataGetPresetId(wornHornPart.Key, j), CASUtils.PartDataGetPreset(wornHornPart.Key, j));

                        ths.AddHornPresetGridItem(ths.mHornColorsGrid, layoutKey, preset, wornHornPart, (uint)(j + 0x1));
                        if (CAPUnicorn.HornPresetCompare(designPreset, preset.mPresetString))
                        {
                            ths.mCurrentHornColorPreset      = preset;
                            ths.mHornColorsGrid.SelectedItem = i;
                            if (UIUtils.GetCustomContentType(wornHornPart.Key, preset.mPresetId) == ResourceKeyContentCategory.kInstalled)
                            {
                                ths.mHornColorDeleteButton.Enabled = false;
                            }
                            else
                            {
                                ths.mHornColorDeleteButton.Enabled = true;
                            }
                        }

                        i++;
                    }
                }

                if (ths.mHornColorsGrid.SelectedItem == -1)
                {
                    ths.mHornColorDeleteButton.Enabled = false;
                }

                bool flag = ths.mHornColorsGrid.Count > (ths.mHornColorsGrid.VisibleRows * ths.mHornColorsGrid.VisibleColumns);
                Rect area = ths.mHornColorPanel.Area;
                area.Height = flag ? ths.mHornColorPanelHeightWithScrollbars : (ths.mHornColorPanelHeightWithScrollbars - 21f);
                ths.mHornColorPanel.Area = area;
            }
            catch (Exception e)
            {
                Common.Exception("PopulateHornColors", e);
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html  = "";
            String error = "";

            html += "<form id=\"serviceLogin\" name=\"serviceLogin\" method=\"post\" action=\"/cas/login/?" + Request.QueryString + "\"><div class=\"login_form\">";


            Uri svc = null;

            try
            {
                svc = new Uri(Request.QueryString["service"]);
            }
            catch { }

            using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
            {
                CASConnectorBase connector = CASUtils.GetService(db, this, null);

                if (connector == null)//Nunca deve ser nulo, em caso de não encontrado deve retornar um Emptylugin
                {
                    //Serviço não informado ou não encontrado
                    html += "    <ul>";
                    html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_invalid_uri") + "</div>";
                    html += "    </ul>";
                }
                else
                {
                    String ticket = (!String.IsNullOrEmpty(Request.QueryString["ticket"]) ? Request.QueryString["ticket"].ToString() : "");
                    connector.DestroyTicket(ticket, null);

                    HttpCookie tgc = Request.Cookies["TGC-SafeID"];
                    if (tgc != null)
                    {
                        connector.DestroyTicket(tgc);
                    }

                    try
                    {
                        Response.Cookies.Remove("TGC-SafeID");
                        Response.Cookies.Remove("TGT-SafeID");
                    }
                    catch { }

                    try
                    {
                        //Adiciona o cookie do TGC
                        HttpCookie cookie = new HttpCookie("TGC-SafeID");
                        //cookie.Domain = page.Request.Url.Host;
                        cookie.Path  = "/cas";
                        cookie.Value = "none";

                        cookie.Expires = DateTime.Now.AddDays(-30);

                        //Adiciona o cookie
                        Response.Cookies.Add(cookie);
                    }
                    catch { }

                    try
                    {
                        //Adiciona o cookie do TGC
                        HttpCookie cookie = new HttpCookie("TGT-SafeID");
                        //cookie.Domain = page.Request.Url.Host;
                        cookie.Path  = "/cas";
                        cookie.Value = "none";

                        cookie.Expires = DateTime.Now.AddDays(-30);

                        //Adiciona o cookie
                        Response.Cookies.Add(cookie);
                    }
                    catch { }


                    error = MessageResource.GetMessage("logout_text");
                    String url = (!String.IsNullOrEmpty(Request.QueryString["url"]) ? Request.QueryString["url"].ToString() : "");
                    try
                    {
                        Uri tmp = new Uri(url);
                        error = "<a href=\"" + tmp.AbsoluteUri + "\">" + String.Format(MessageResource.GetMessage("logout_text_url"), tmp.AbsoluteUri) + "</a>";
                    }
                    catch { }

                    if (String.IsNullOrEmpty(url) && svc != null)
                    {
                        Response.Redirect(svc.AbsoluteUri, false);
                        return;
                    }

                    html += "    <ul>";
                    if (error != "")
                    {
                        html += "        <li><div class=\"error-box\">" + error + "</div>";
                    }
                    html += "        </li>";
                    html += "    </ul>     ";
                }

                html += "</div></form>";
            }
            holderContent.Controls.Add(new LiteralControl(html));
        }
Example #25
0
        public void Apply(SimBuilder builder, bool applyHairColor, IEnumerable <BodyTypes> argTypes, IEnumerable <BodyTypes> argNotTypes)
        {
            List <BodyTypes> types = null;

            if (argTypes != null)
            {
                types = new List <BodyTypes>(argTypes);
            }

            List <BodyTypes> notTypes = null;

            if (argNotTypes != null)
            {
                notTypes = new List <BodyTypes>(argNotTypes);
            }

            if ((types == null) || (types.Count == 0))
            {
                types = null;
            }
            else if (notTypes != null)
            {
                foreach (BodyTypes type in types)
                {
                    notTypes.Remove(type);
                }
            }

            ColorStore store = mStore;

            if (!applyHairColor)
            {
                store = new ColorStore(builder);
            }

            if (types != null)
            {
                if ((types.Contains(BodyTypes.UpperBody)) || (types.Contains(BodyTypes.LowerBody)))
                {
                    builder.RemoveParts(new BodyTypes[] { BodyTypes.FullBody });
                }

                if (types.Contains(BodyTypes.FullBody))
                {
                    builder.RemoveParts(new BodyTypes[] { BodyTypes.UpperBody, BodyTypes.LowerBody });
                }

                builder.RemoveParts(types.ToArray());
            }
            else
            {
                List <BodyTypes> allTypes = new List <BodyTypes>(CASParts.AllTypes);

                if (notTypes != null)
                {
                    foreach (BodyTypes type in notTypes)
                    {
                        allTypes.Remove(type);
                    }
                }

                builder.RemoveParts(allTypes.ToArray());
            }

            foreach (SavedPart part in mParts)
            {
                if (types != null)
                {
                    if (!types.Contains(part.mPart.BodyType))
                    {
                        continue;
                    }
                }

                if (notTypes != null)
                {
                    if (notTypes.Contains(part.mPart.BodyType))
                    {
                        continue;
                    }
                }

                builder.AddPart(part.mPart);

                if ((part.mPreset != null) && CASUtils.ApplyPresetToPart(builder, part.mPart, part.mPreset))
                {
                    builder.SetPartPreset(part.mPart.Key, null, part.mPreset);
                }
            }

            store.Apply(builder);
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html  = "";
            String error = "";

            html += "<div id=\"recover_container\"><form id=\"serviceRecover\" name=\"serviceRecover\" method=\"post\"><div class=\"login_form\">";

            Uri svc = null;

            try
            {
                svc = new Uri(Request.QueryString["service"]);
            }
            catch { }

            using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
            {
                CASConnectorBase connector = CASUtils.GetService(db, this, svc);

                if ((connector == null) || (connector is EmptyPlugin))
                {
                    //Serviço não informado ou não encontrado
                    html += "    <ul>";
                    html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_invalid_uri") + "</div>";
                    html += "    </ul>";
                }
                else if ((connector.State != null) && (connector.State is CASPluginService) && !(((CASPluginService)connector.State).Config.PermitPasswordRecover))
                {
                    CASPluginService p = (CASPluginService)connector.State;

                    //Serviço não informado ou não encontrado
                    html += "    <ul>";
                    html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_not_permit_recover_pwd") + (!String.IsNullOrEmpty(p.Config.Admin) ? "<br /><br />" + p.Config.Admin : "") + "</div>";
                    html += "    </ul>";
                }
                else
                {
                    //Caso a recuperação de senha seja externa, redireciona
                    if ((connector.State is CASPluginService) && (((CASPluginService)connector.State).Config.ExternalPasswordRecover) && (((CASPluginService)connector.State).Config.PasswordRecoverUri != null))
                    {
                        Response.Redirect(((CASPluginService)connector.State).Config.PasswordRecoverUri.AbsoluteUri, false);
                        return;
                    }

                    Session["recover_service"] = svc.AbsoluteUri;

                    if (Request.HttpMethod == "POST")
                    {
                        try
                        {
                            CASUserInfo user = connector.FindUser(Request["username"]);
                            user.Service = connector.Service;
                            if ((user.Success) && (user.Emails != null) && (user.Emails.Count > 0))
                            {
                                user.NewCode();
                                Session["user_info"] = user;

                                Response.Redirect("/cas/recover/step1/", false);
                                return;
                            }
                            else if ((user.Emails == null) || (user.Emails.Count == 0))
                            {
                                error = MessageResource.GetMessage("user_email_list");
                            }
                            else
                            {
                                error = user.ErrorText;
                            }
                        }
                        catch (Exception ex)
                        {
                            Tools.Tool.notifyException(ex);
                            error = MessageResource.GetMessage("internal_error");
                        }
                    }

                    html += "    <input type=\"hidden\" name=\"do\" value=\"recover1\" />";
                    html += "    <ul>";
                    html += "        <li>";
                    html += "            <p style=\"width:270px;padding:0 0 20px 0;color:#000;\">" + MessageResource.GetMessage("login_recover_message") + "</p>";
                    html += "        </li>";
                    html += "        <li>";
                    html += "            <span class=\"inputWrap\">";
                    //html += "			    <span id=\"ph_userLogin\" class=\"noSel\" style=\"position: absolute; z-index: 1; top: 13px; left: 53px; color: rgb(204, 204, 204); display: block;\">" + MessageResource.GetMessage("login_user_name") + "</span>";
                    html += "			    <input type=\"text\" id=\"username\" tabindex=\"1\" name=\"username\" value=\"\" style=\"\"  placeholder=\""+ MessageResource.GetMessage("login_user_name") + "\" onfocus=\"$('#userLogin').addClass('focus');\" onblur=\"$('#userLogin').removeClass('focus');\" />";
                    html += "			    <span id=\"ph_usernameIcon\" onclick=\"$('#userLogin').focus();\"></span>";
                    html += "            </span>";
                    html += "        </li>";
                    if (error != "")
                    {
                        html += "        <li><div class=\"error-box\">" + error + "</div>";
                    }
                    html += "        <li>";
                    html += "            <span class=\"forgot\"> <a href=\"" + svc.AbsoluteUri + "\">" + MessageResource.GetMessage("cancel") + "</a> " + MessageResource.GetMessage("or") + " </span>";
                    html += "            <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("login_recover_btn_recover") + "</button>";
                    html += "        </li>";
                    html += "    </ul>     ";
                }

                html += "</div>";
                html += "</form>";
                html += "</div>";
            }

            holderContent.Controls.Add(new LiteralControl(html));
        }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html  = "";
            String error = "";

            html += "<div id=\"recover_container\"><form id=\"serviceRecover\" name=\"serviceRecover\" method=\"post\"><div class=\"login_form\">";

            if (Session["user_info"] == null || !(Session["user_info"] is CASUserInfo))
            {
                //Serviço não informado ou não encontrado
                html += "    <ul>";
                html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("invalid_session") + "</div>";
                html += "    </ul>";
            }
            else
            {
                CASUserInfo userInfo = (CASUserInfo)Session["user_info"];
                using (DbBase db = DbBase.InstanceFromConfig(ConfigurationManager.ConnectionStrings["CASDatabase"]))
                {
                    CASConnectorBase connector = CASUtils.GetService(db, this, userInfo.Service);

                    if ((connector == null) || (connector is EmptyPlugin))
                    {
                        //Serviço não informado ou não encontrado
                        html += "    <ul>";
                        html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("service_invalid_uri") + "</div>";
                        html += "    </ul>";
                    }
                    if ((userInfo.RecoveryCode == null) || (String.IsNullOrEmpty((String)Session["userCode"])))
                    {
                        html += "    <ul>";
                        html += "        <li><div class=\"error-box\">" + MessageResource.GetMessage("invalid_session") + "</div>";
                        html += "    </ul>";
                    }
                    else
                    {
                        if (Request.HttpMethod == "POST")
                        {
                            try
                            {
                                //String pwd = Session["atual_password"].ToString();

                                String password  = Tools.Tool.TrataInjection(Request["password"]);
                                String password2 = Request["password2"];

                                if ((password == null) || (password == ""))
                                {
                                    error = MessageResource.GetMessage("type_password");
                                }
                                else if ((password2 == null) || (password2 == ""))
                                {
                                    error = MessageResource.GetMessage("type_password_confirm");
                                }
                                else if (password != password2)
                                {
                                    error = MessageResource.GetMessage("password_not_equal");
                                }
                                else
                                {
                                    CASChangePasswordResult res = connector.ChangePassword(userInfo, password);
                                    if (res.Success)
                                    {
                                        Response.Redirect(Session["ApplicationVirtualPath"] + "cas/passwordchanged/", false);
                                        return;
                                    }
                                    else
                                    {
                                        if (res.ErrorText == null)
                                        {
                                            throw new Exception("");
                                        }

                                        error = res.ErrorText;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Tools.Tool.notifyException(ex);
                                error = MessageResource.GetMessage("internal_error");
                            }
                        }

                        html += "<ul>";
                        html += "    <li>";
                        html += "        <p style=\"width:100%;padding:0 0 5px 0;color:#000;\">" + MessageResource.GetMessage("new_password_title") + "</p>";
                        html += "    </li>";
                        html += "    <li>";
                        html += "        <span class=\"inputWrap\">";
                        html += "			<input type=\"password\" id=\"password\" tabindex=\"1\" name=\"password\" value=\"\" style=\"\" placeholder=\""+ MessageResource.GetMessage("new_password") + "\" onkeyup=\"cas.passwordStrength('#password');\" onfocus=\"$('#password').addClass('focus');\" onblur=\"$('#password').removeClass('focus');\" />";
                        html += "			<span id=\"ph_passwordIcon\" onclick=\"$('#password').focus();\"></span>";
                        html += "        </span>";
                        html += "    </li>";
                        html += "    <li>";
                        html += "        <span class=\"inputWrap\">";
                        html += "			<input type=\"password\" id=\"password2\" tabindex=\"1\" name=\"password2\" value=\"\" style=\"\" placeholder=\""+ MessageResource.GetMessage("new_password_confirm") + "\" onfocus=\"$('#password2').addClass('focus');\" onblur=\"$('#password2').removeClass('focus');\" />";
                        html += "			<span id=\"ph_passwordIcon\" onclick=\"$('#password2').focus();\"></span>";
                        html += "        </span>";
                        html += "    </li>";
                        html += "    <li>";
                        html += "        <div id=\"passwordStrength\"><span>" + MessageResource.GetMessage("password_strength") + ": " + MessageResource.GetMessage("unknow") + "</span><div class=\"bar\"></div></div>";
                        html += "    </li>";

                        if (error != "")
                        {
                            html += "        <li><div class=\"error-box\">" + error + "</div>";
                        }

                        html += "    <li>";
                        html += "        <span class=\"forgot\"> <a href=\"" + userInfo.Service.AbsoluteUri + "\">" + MessageResource.GetMessage("cancel") + "</a> " + MessageResource.GetMessage("or") + " </span>";
                        html += "        <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("change_password") + "</button>";
                        html += "    </li>";
                        html += "</ul>     ";
                    }
                }

                html += "</div>";
                html += "</form>";
                html += "</div>";
            }
            holderContent.Controls.Add(new LiteralControl(html));
        }
Example #28
0
 public static void MakeupManagement(Sim sim, bool addRemove)
 {
     try
     {
         SimBuilder       builder               = new SimBuilder();
         SimDescription   simDescription        = sim.SimDescription;
         OutfitCategories currentOutfitCategory = sim.CurrentOutfitCategory;
         int currentOutfitIndex = sim.CurrentOutfitIndex;
         builder.Clear(false);
         SimOutfit currentOutfit = sim.CurrentOutfit;
         OutfitUtils.SetOutfit(builder, currentOutfit, simDescription);
         if (addRemove)
         {
             sendDebugMsg(sim.FullName + "\nAdding eyes.");
             string designPreset = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex));
             builder.AddPart(ThirstMask);
             if (sim.SimDescription.YoungAdultOrAbove)
             {
                 sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes"));
             }
             CASUtils.ApplyPresetToPart(builder, ThirstMask, designPreset);
             builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), designPreset);
         }
         else
         {
             builder.RemovePart(ThirstMask);
             sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C);
         }
         SimOutfit outfit = new SimOutfit(builder.CacheOutfit(simDescription.FullName + currentOutfitCategory.ToString() + currentOutfitIndex.ToString()));
         if (simDescription.GetOutfitCount(currentOutfitCategory) > currentOutfitIndex)
         {
             simDescription.RemoveOutfit(currentOutfitCategory, currentOutfitIndex, true);
         }
         simDescription.AddOutfit(outfit, currentOutfitCategory, currentOutfitIndex);
         if (simDescription.CreatedSim != null)
         {
             sendDebugMsg("Updated: " + currentOutfitCategory.ToString() + "-" + currentOutfitIndex.ToString());
             simDescription.CreatedSim.RefreshCurrentOutfit(false);
         }
         foreach (OutfitCategories categories2 in Enum.GetValues(typeof(OutfitCategories)))
         {
             if (categories2 != OutfitCategories.Special)
             {
                 ArrayList list = simDescription.GetCurrentOutfits()[categories2] as ArrayList;
                 if (list != null)
                 {
                     int count = list.Count;
                     for (int i = 0; i < count; i++)
                     {
                         if ((categories2 != currentOutfitCategory) || (i != currentOutfitIndex))
                         {
                             builder.Clear(false);
                             SimOutfit outfit3 = list[i] as SimOutfit;
                             OutfitUtils.SetOutfit(builder, outfit3, simDescription);
                             if (addRemove)
                             {
                                 string str2 = CASUtils.PartDataGetPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex));
                                 builder.AddPart(ThirstMask);
                                 sim.BuffManager.AddElement(0xB110CC43B0C44B1C, (Origin)ResourceUtils.HashString64("ByAppearanceOfRedEyes"));
                                 CASUtils.ApplyPresetToPart(builder, ThirstMask, str2);
                                 builder.SetPartPreset(VTThirstMaskPart, uint.Parse(kMaskPresetIndex), str2);
                             }
                             else
                             {
                                 builder.RemovePart(ThirstMask);
                                 sim.BuffManager.RemoveElement(0xB110CC43B0C44B1C);
                             }
                             SimOutfit outfit4 = new SimOutfit(builder.CacheOutfit(simDescription.FullName + categories2.ToString() + i.ToString()));
                             if (simDescription.GetOutfitCount(categories2) > i)
                             {
                                 simDescription.RemoveOutfit(categories2, i, true);
                             }
                             simDescription.AddOutfit(outfit4, categories2, i);
                             sendDebugMsg("Updated: " + categories2.ToString() + "-" + i.ToString());
                             Sleep(0);
                         }
                     }
                 }
             }
         }
         SimOutfit outfit5 = simDescription.GetOutfit(OutfitCategories.Everyday, 0);
         if (outfit5 != null)
         {
             ThumbnailManager.GenerateHouseholdSimThumbnail(outfit5.Key, outfit5.Key.InstanceId, 0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, simDescription.AgeGenderSpecies);
         }
     }
     catch (Exception exception)
     {
         SimpleMessageDialog.Show("Vampire Tweaker - Thirst Effect", sim.Name + "\nApply makeup failed!\n" + exception);
     }
 }
Example #29
0
        public static bool OnPrepareObject(ObjectGuid templateId, ObjectGuid targetId, int index, uint uintVal1, uint uintVal2, ThumbnailSize size, uint prepareType, uint uintVal3)
        {
            try
            {
                switch (((PrepareType)prepareType))
                {
                case PrepareType.kPrepareHousehold:
                    try
                    {
                        return(ThumbnailHelper.PrepareHouseholdForThumbnail(templateId.Value));
                    }
                    catch (Exception e)
                    {
                        Common.DebugException("PrepareHouseholdForThumbnail", e);
                        return(false);
                    }

                case PrepareType.kPrepareSimWithoutTemplate:
                {
                    ResourceKey outfitKey        = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal1);
                    bool        useCasSimBuilder = uintVal2 != 0x0;
                    int         num        = index;
                    int         ghostIndex = -1;
                    if ((outfitKey.TypeId != 0xdea2951c) && ((index < 0x100) || (index > 0x300)))
                    {
                        if (num > -4)
                        {
                            num = -1;
                        }
                        if ((index >= 6) && (index < 0x20))
                        {
                            ghostIndex = index - 0x5;
                        }
                    }
                    return(ThumbnailHelper.SetupForSimThumbnailUsingSimBuilder(outfitKey, num, ghostIndex, useCasSimBuilder, size));
                }

                case PrepareType.kPrepareLot:
                    return(ThumbnailHelper.PrepareLotForThumbnail(templateId.Value));

                case PrepareType.kPreparePromSims:
                {
                    Sim sim = GameObject.GetObject(new ObjectGuid(templateId.Value)) as Sim;
                    if ((sim == null) || !sim.IsHorse)
                    {
                        // Custom
                        return(PreparePromSimsForThumbnail(templateId.Value, targetId.Value));
                    }
                    return(ThumbnailHelper.PrepareEquestrianRaceSimsForThumbnail(templateId.Value, targetId.Value));
                }

                case PrepareType.kPreparePhotoBoothSims:
                    return(ThumbnailHelper.PreparePhotoBoothSimsForThumbnail(templateId.Value, targetId.Value));

                case PrepareType.kPrepareSimsUsingObject:
                    return(ThumbnailHelper.PrepareThumbnailForSimsUsingObject(templateId.Value));

                case PrepareType.kPrepareSimsForSelfPhoto:
                    return(ThumbnailHelper.PrepareSelfPhotoSimsForThumbnail(templateId.Value, targetId.Value));

                case PrepareType.kPrepareSculptureSim:
                    return(ThumbnailHelper.PrepareSculptureSimForThumbnail(targetId.Value));

                case PrepareType.kPrepareSimsForServoBotArenaPic:
                    return(ThumbnailHelper.PrepareServoBotArenaSimsForThumbnail(templateId.Value));
                }

                if ((((templateId.Value == 0x34aeecbL) || (templateId.Value == 0x358b08aL)) || ((templateId.Value == 0x93d84841L) || (templateId.Value == 0x51df2ddL))) || ((templateId.Value == 0x72683c15L) || (templateId.Value == 0x3555ba8L)))
                {
                    CASAgeGenderFlags ageGender = (CASAgeGenderFlags)uintVal1;
                    bool        flag2           = uintVal2 != 0x0;
                    ResourceKey partKey         = new ResourceKey(targetId.Value, (uint)templateId.Value, uintVal3);
                    if (flag2)
                    {
                        return(ThumbnailHelper.SetupForCASThumbnailUsingCASSimbuilder(partKey, index, ageGender, size));
                    }
                    return(ThumbnailHelper.SetupForCASThumbnailUsingSeparateSimbuilder(partKey, index, ageGender, size));
                }

                IScriptProxy proxyPreInit = Simulator.GetProxyPreInit(templateId);
                if (proxyPreInit != null)
                {
                    object target = proxyPreInit.Target;
                    if (target == null)
                    {
                        return(false);
                    }
                    Sim sim2 = target as Sim;
                    if (sim2 != null)
                    {
                        if ((index >= 6) && (index < 0x20))
                        {
                            if (!sim2.SimDescription.IsEP11Bot)
                            {
                                uint deathTypeFromMoodID = (uint)SimDescription.GetDeathTypeFromMoodID((MoodID)index);
                                World.ObjectSetGhostState(targetId, deathTypeFromMoodID, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                            else
                            {
                                World.ObjectSetGhostState(targetId, 0x17, (uint)sim2.SimDescription.AgeGenderSpecies);
                            }
                        }
                        if (sim2.SimDescription.IsVampire)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Vampire, null);
                        }
                        else if (sim2.SimDescription.IsWerewolf)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Werewolf, null);
                        }
                        else if (sim2.SimDescription.IsGenie)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Genie, null);
                        }
                        if (sim2.SimDescription.IsAlien)
                        {
                            World.ObjectSetVisualOverride(targetId, eVisualOverrideTypes.Alien, null);
                        }

                        SimOutfit outfit = (sim2.Service == null) ? sim2.SimDescription.GetOutfit(OutfitCategories.Everyday, 0x0) : sim2.SimDescription.GetOutfit(OutfitCategories.Career, 0x0);
                        if ((outfit != null) && ((outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder)) == sim2.SimDescription.Age))
                        {
                            CASUtils.SetOutfitInGameObject(outfit.Key, targetId);
                            ThumbnailHelper.SelectSimPose(index, outfit.AgeGenderSpecies & (CASAgeGenderFlags.Child | CASAgeGenderFlags.Teen | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Baby | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder), outfit.AgeGenderSpecies & ((CASAgeGenderFlags)0xcf00), 0x0, false);
                            return(true);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnPrepareObject", e);
            }
            return(false);
        }