コード例 #1
0
            public void Restore(SimDescription sim)
            {
                try
                {
                    sim.mGenderPreferenceMale   = mMalePreference;
                    sim.mGenderPreferenceFemale = mFemalePreference;

                    if (sim.Pregnancy != null)
                    {
                        sim.Pregnancy.mGender = mPregnantGender;
                    }

                    if (sim.CreatedSim != null)
                    {
                        if (mPreviousOutfitCategory != OutfitCategories.None)
                        {
                            SimOutfit outfit = sim.GetOutfit(mPreviousOutfitCategory, mPreviousOutfitIndex);
                            if (outfit != null)
                            {
                                sim.CreatedSim.mPreviousOutfitKey = outfit.Key;
                            }
                        }

                        if (sim.CreatedSim.DreamsAndPromisesManager != null)
                        {
                            ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                            if (node != null)
                            {
                                node.InternalCount = mLifetimeWishTally;
                            }
                        }
                    }

                    foreach (TraitNames trait in mTraits)
                    {
                        if (sim.TraitManager.HasElement(trait))
                        {
                            continue;
                        }

                        sim.TraitManager.AddElement(trait);
                    }

                    SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);
                    if (networkSkill != null)
                    {
                        networkSkill.mNumberOfFollowers = mNumberOfFollowers;
                        networkSkill.mBlogsCreated      = mBlogsCreated;
                    }

                    RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);
                    if (bandSkill != null)
                    {
                        bandSkill.mBandInfo = mBandInfo;
                    }

                    Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);
                    if (collecting != null)
                    {
                        collecting.mGlowBugData        = mGlowBugData;
                        collecting.mMushroomsCollected = mMushroomsCollected;
                    }

                    NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                    if (nectar != null)
                    {
                        nectar.mHashesMade = mNectarHashesMade;
                    }

                    Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);
                    if (photography != null)
                    {
                        // Forces a recalculation of the completion count
                        // photography.mCollectionsCompleted = uint.MaxValue;
                        photography.mCollectionsCompleted = mCollectionsCompleted;

                        if (mSubjectRecords != null)
                        {
                            photography.mSubjectRecords = mSubjectRecords;
                        }

                        if (mStyleRecords != null)
                        {
                            photography.mStyleRecords = mStyleRecords;
                        }

                        if (mSizeRecords != null)
                        {
                            photography.mSizeRecords = mSizeRecords;
                        }
                    }

                    RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);
                    if (riding != null)
                    {
                        if (mCrossCountryCompetitionsWon != null)
                        {
                            riding.mCrossCountryCompetitionsWon = mCrossCountryCompetitionsWon.ToArray();
                        }

                        if (mJumpCompetitionsWon != null)
                        {
                            riding.mJumpCompetitionsWon = mJumpCompetitionsWon.ToArray();
                        }
                    }

                    Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);
                    if (mixology != null)
                    {
                        if (mCustomDrinks != null)
                        {
                            mixology.mUniqueDrinks = mCustomDrinks;
                        }
                    }

                    if (mOccult != null)
                    {
                        foreach (OccultBaseClass occult in mOccult)
                        {
                            if (OccultTypeHelper.Add(sim, occult.ClassOccultType, false, false))
                            {
                                OccultTransfer transfer = OccultTransfer.Get(occult.ClassOccultType);
                                if (transfer != null)
                                {
                                    transfer.Perform(sim, occult);
                                }
                            }
                        }
                    }

                    mOccult = null;

                    if (mOutfitCache != null)
                    {
                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.Outfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, false))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        foreach (SavedOutfit.Cache.Key outfit in mOutfitCache.AltOutfits)
                        {
                            using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, outfit.mKey, true))
                            {
                                builder.Builder.SkinTone      = mSkinToneKey;
                                builder.Builder.SkinToneIndex = mSkinToneIndex;

                                outfit.Apply(builder, true, null, null);
                            }
                        }

                        int count         = 0;
                        int originalCount = mOutfitCache.GetOutfitCount(OutfitCategories.Everyday, false);

                        while ((originalCount > 0) && (originalCount < sim.GetOutfitCount(OutfitCategories.Everyday)) && (count < originalCount))
                        {
                            CASParts.RemoveOutfit(sim, new CASParts.Key(OutfitCategories.Everyday, sim.GetOutfitCount(OutfitCategories.Everyday) - 1), false);
                            count++;
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }
            }
コード例 #2
0
            public CrossWorldData(SimDescription sim)
            {
                mName = sim.FullName;

                mOutfitCache = new SavedOutfit.Cache(sim);

                SimOutfit outfit = sim.GetOutfit(OutfitCategories.Everyday, 0);

                if (outfit != null)
                {
                    mSkinToneKey   = outfit.SkinToneKey;
                    mSkinToneIndex = outfit.SkinToneIndex;
                }
                else
                {
                    mSkinToneKey   = sim.SkinToneKey;
                    mSkinToneIndex = sim.SkinToneIndex;
                }

                mMalePreference   = sim.mGenderPreferenceMale;
                mFemalePreference = sim.mGenderPreferenceFemale;

                if (sim.CreatedSim != null)
                {
                    if (sim.CreatedSim.mPreviousOutfitKey != null)
                    {
                        try
                        {
                            mPreviousOutfitCategory = sim.GetOutfitCategoryFromResKey(sim.CreatedSim.mPreviousOutfitKey, out mPreviousOutfitIndex);
                        }
                        catch
                        { }
                    }

                    if (sim.CreatedSim.DreamsAndPromisesManager != null)
                    {
                        ActiveDreamNode node = sim.CreatedSim.DreamsAndPromisesManager.LifetimeWishNode;
                        if (node != null)
                        {
                            mLifetimeWishTally = node.InternalCount;
                        }
                    }
                }

                if (sim.Pregnancy != null)
                {
                    mPregnantGender = sim.Pregnancy.mGender;
                }

                foreach (Trait trait in sim.TraitManager.List)
                {
                    if (trait.IsReward)
                    {
                        continue;
                    }

                    mTraits.Add(trait.Guid);
                }

                SocialNetworkingSkill networkSkill = sim.SkillManager.GetSkill <SocialNetworkingSkill>(SkillNames.SocialNetworking);

                if (networkSkill != null)
                {
                    // This value is set to mNumberOfBlogFollowers for some reason
                    mNumberOfFollowers = networkSkill.mNumberOfFollowers;

                    // Not transitioned at all
                    mBlogsCreated = networkSkill.mBlogsCreated;
                }

                RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);

                if (bandSkill != null)
                {
                    mBandInfo = bandSkill.mBandInfo;
                }

                Collecting collecting = sim.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);

                if (collecting != null)
                {
                    // Error in CollectingPropertyStreamWriter:Export() requires that mGlowBugData by transfered manually
                    //   Exported as two Int64, but Imported as a Int64 and Int32
                    mGlowBugData = collecting.mGlowBugData;

                    mMushroomsCollected = collecting.mMushroomsCollected;
                }

                NectarSkill nectar = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);

                if (nectar != null)
                {
                    mNectarHashesMade = nectar.mHashesMade;
                }

                Photography photography = sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);

                if (photography != null)
                {
                    mCollectionsCompleted = photography.mCollectionsCompleted;
                    mSubjectRecords       = photography.mSubjectRecords;
                    mStyleRecords         = photography.mStyleRecords;
                    mSizeRecords          = photography.mSizeRecords;
                }

                RidingSkill riding = sim.SkillManager.GetSkill <RidingSkill>(SkillNames.Riding);

                if (riding != null)
                {
                    // Error in the Import (Copy/Paste fail by the looks of it), where the CrossCountry Wins are imported instead
                    mCrossCountryCompetitionsWon = new List <uint>(riding.mCrossCountryCompetitionsWon);
                    mJumpCompetitionsWon         = new List <uint>(riding.mJumpCompetitionsWon);
                }

                // EA hosed the color, glass and drink picks
                Bartending mixology = sim.SkillManager.GetSkill <Bartending>(SkillNames.Bartending);

                if (mixology != null)
                {
                    mCustomDrinks = mixology.mUniqueDrinks;
                }

                if ((sim.OccultManager != null) && (sim.OccultManager.mOccultList != null))
                {
                    mOccult = new List <OccultBaseClass>(sim.OccultManager.mOccultList);
                }
            }
コード例 #3
0
        public override bool Run()
        {
            try
            {
                if ((!Target.RouteToBarrelSlot(Actor) || ((Target.CurrentState != NectarMaker.NectarMakerState.FruitAddable) && (Target.CurrentState != NectarMaker.NectarMakerState.SquishingFruit))) || !Target.HasFruit)
                {
                    return(false);
                }
                Target.CurrentState = NectarMaker.NectarMakerState.SquishingFruit;
                Actor.SkillManager.AddElement(SkillNames.Nectar);
                foreach (GameObject obj2 in Inventories.QuickFind <GameObject>(Target.Inventory))
                {
                    Target.Inventory.SetInUse(obj2);
                }
                Actor.SwitchToOutfitWithSpin(Sim.ClothesChangeReason.GoingToSwim);
                StandardEntry();
                BeginCommodityUpdates();
                AcquireStateMachine("NectarMaker");
                SetActorAndEnter("x", Actor, "Enter Squish Grapes");
                SetActor("nectarMaker", Target);
                AnimateSim("Squish Grapes Loop");
                StartStages();
                bool flag = false;

                try
                {
                    flag = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));

                    if (flag)
                    {
                        Target.CurrentState = NectarMaker.NectarMakerState.SquishedFruit;
                        Target.UpdateVisualState();
                        NectarSkill skill = Actor.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                        if ((skill != null) && skill.IsFlavorfulFeet())
                        {
                            Target.mMultiplierFromFeet = NectarSkill.kFlavorfulFeetValueMultiplier;
                        }
                        if (skill != null)
                        {
                            skill.SquishGrapes();
                        }
                        Target.mSquishAmountRemaining = 1f;
                    }
                    else if (ActiveStage != null)
                    {
                        Target.mSquishAmountRemaining *= ActiveStage.TimeRemaining((InteractionInstance)this) / ActiveStage.TotalTime();
                    }
                    AnimateSim("Exit");
                }
                finally
                {
                    EndCommodityUpdates(true);
                    StandardExit();
                }

                Actor.SwitchToPreviousOutfitWithSpin();
                if ((this.mMakeStyleToPush != NectarMaker.MakeNectarStyle.None) && flag)
                {
                    Actor.InteractionQueue.PushAsContinuation(new MakeNectarEx.Definition(mMakeStyleToPush), Target, true);
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
コード例 #4
0
ファイル: Consignments.cs プロジェクト: yakoder/NRaas
        public static void NotifySell(SimDescription sim, GameObject obj, int value)
        {
            try
            {
                obj.SoldFor(value);

                if (obj.CanBeSold())
                {
                    if (IsCollectable(obj))
                    {
                        foreach (SimDescription member in sim.Household.AllSimDescriptions)
                        {
                            Collecting skill = member.SkillManager.GetSkill <Collecting>(SkillNames.Collecting);
                            if (skill != null)
                            {
                                skill.UpdateXpForEarningMoney(value);
                            }
                        }
                    }

                    if (obj.HasFlags(GameObject.FlagField.WasHarvested))
                    {
                        Gardening gardening = sim.SkillManager.GetSkill <Gardening>(SkillNames.Gardening);
                        if (gardening != null)
                        {
                            gardening.HarvestableSold(value);
                        }
                        foreach (SimDescription member in sim.Household.AllSimDescriptions)
                        {
                            gardening = member.SkillManager.GetSkill <Gardening>(SkillNames.Gardening);
                            if (gardening != null)
                            {
                                gardening.UpdateXpForEarningMoney(value);
                            }
                        }
                    }

                    if (obj is INectarBottle)
                    {
                        INectarBottle bottle = obj as INectarBottle;

                        NectarSkill skill = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                        if (skill != null)
                        {
                            skill.SellNectarBottle(value);
                        }

                        if ((bottle.Creator != null) && (bottle.Creator.IsValid))
                        {
                            skill = bottle.Creator.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                            if (skill != null)
                            {
                                skill.UpdateXpForEarningMoney(value);
                            }
                        }
                    }

                    if (obj is IInvention)
                    {
                        IInvention invention = obj as IInvention;

                        SimDescription inventor = invention.Inventor;

                        if ((inventor != null) && (inventor.IsValid))
                        {
                            InventingSkill skill2 = inventor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing);
                            if (skill2 != null)
                            {
                                skill2.UpdateXpForEarningMoney(value);
                            }
                        }
                    }

                    if (obj is IScubaCollectible)
                    {
                        ScubaDivingSkill skill3 = sim.SkillManager.AddElement(SkillNames.ScubaDiving) as ScubaDivingSkill;
                        if (skill3 != null)
                        {
                            skill3.SimoleonsFromSellingCollectibles += value;
                            skill3.UpdateXpForEarningMoney(value);
                        }
                    }

                    if (sim.CreatedSim != null)
                    {
                        obj.SendObjectSoldEvent(sim.CreatedSim);
                    }
                }
            }
            catch (Exception e)
            {
                Common.DebugException(sim.CreatedSim, obj, e);
            }
        }
コード例 #5
0
ファイル: MakeNectarEx.cs プロジェクト: yakoder/NRaas
        protected void FinishedMakingNectarCallback()
        {
            string msg = null;

            try
            {
                List <Ingredient> fruitsUsed = Inventories.QuickFind <Ingredient>(Target.Inventory);
                foreach (GameObject obj2 in fruitsUsed)
                {
                    Target.Inventory.SetNotInUse(obj2);
                }

                msg += "1";

                if (((fruitsUsed != null) && (fruitsUsed.Count > 0x0)) && (Target.mLastSimToMake != null))
                {
                    float num        = 0f;
                    float num2       = (((float)RandomGen.NextDouble()) * (NectarMaker.kMaxGlobalValueVariance - NectarMaker.kMinGlobalValueVariance)) + NectarMaker.kMinGlobalValueVariance;
                    int   skillLevel = Target.mLastSimToMake.SkillManager.GetSkillLevel(SkillNames.Nectar);
                    float num4       = ((NectarMaker.kLevel10Multiplier - NectarMaker.kLevel0Multiplier) * (((float)skillLevel) / 10f)) + NectarMaker.kLevel0Multiplier;
                    fruitsUsed.Sort();
                    string     str        = "";
                    bool       flag       = true;
                    Ingredient ingredient = fruitsUsed[0x0];
                    string     key        = "";
                    Dictionary <string, int> ingredients = new Dictionary <string, int>();
                    if (ingredient != null)
                    {
                        key = ingredient.Data.Key;
                    }

                    msg += "2";

                    float num5 = 0f;
                    foreach (Ingredient ingredient2 in fruitsUsed)
                    {
                        if (flag && !key.Equals(ingredient2.Data.Key))
                        {
                            flag = false;
                        }
                        str = str + ingredient2.Data.Key;
                        if (!ingredients.ContainsKey(ingredient2.Data.Key))
                        {
                            ingredients.Add(ingredient2.Data.Key, 0x1);
                        }
                        else
                        {
                            ingredients[ingredient2.Data.Key]++;
                        }
                        num  += ingredient2.Data.NectarValue;
                        num5 += (float)ingredient2.GetQuality();
                        Target.Inventory.TryToRemove(ingredient2);
                    }

                    msg += "3";

                    num5 /= (float)fruitsUsed.Count;
                    uint  hash = ResourceUtils.HashString32(str);
                    float num7 = 1f;
                    if (!flag)
                    {
                        num7 = NectarMaker.CalculateHashMultiplier(hash);
                    }

                    msg += "4";

                    float       makeStyleValueModifier  = Target.GetMakeStyleValueModifier(Target.mLastUsedMakeStyle);
                    int         makeStyleBottleModifier = Target.GetMakeStyleBottleModifier(Target.mLastUsedMakeStyle);
                    float       baseValue  = ((((((num * num2) * num4) * Target.mFlavorMultiplier) * num7) * NectarMaker.kQualityLevelMultiplier[((int)num5) - 0x1]) * Target.mMultiplierFromFeet) * makeStyleValueModifier;
                    int         numBottles = (NectarMaker.kNumBottlesPerBatch + Target.mBottleDifference) + makeStyleBottleModifier;
                    NectarSkill skill      = Target.mLastSimToMake.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                    if ((skill != null) && skill.IsNectarMaster())
                    {
                        numBottles += NectarSkill.kExtraBottlesNectarMaster;
                    }

                    msg += "5";

                    List <NectarMaker.IngredientNameCount> list2 = new List <NectarMaker.IngredientNameCount>();
                    foreach (string str3 in ingredients.Keys)
                    {
                        list2.Add(new NectarMaker.IngredientNameCount(str3, ((float)ingredients[str3]) / ((float)fruitsUsed.Count)));
                    }

                    msg += "6";

                    list2.Sort();
                    string str4 = "";
                    string str5 = "";
                    if (list2.Count > 0x0)
                    {
                        str4 = IngredientData.NameToDataMap[list2[0x0].IngredientName].Name;
                    }
                    if (list2.Count > 0x1)
                    {
                        str5 = IngredientData.NameToDataMap[list2[0x1].IngredientName].Name;
                    }

                    msg += "7";

                    List <NectarSkill.NectarBottleInfo> topNectarsMade = new List <NectarSkill.NectarBottleInfo>();
                    if (skill != null)
                    {
                        topNectarsMade = skill.mTopNectarsMade;
                    }

                    msg += "8";

                    string defaultEntryText = "";
                    if (string.IsNullOrEmpty(str5))
                    {
                        defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarNameOneFruit", new object[] { str4 });
                    }
                    else
                    {
                        defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarName", new object[] { str4, str5 });
                        if (defaultEntryText.Length > 0x28)
                        {
                            defaultEntryText = Common.LocalizeEAString(false, "Gameplay/Objects/CookingObjects/NectarBottle:NectarNameOneFruit", new object[] { str4 });
                        }
                    }

                    msg += "9";

                    bool nameFound = false;
                    foreach (NectarSkill.NectarBottleInfo info in topNectarsMade)
                    {
                        if (info.mFruitHash == hash)
                        {
                            defaultEntryText = info.mBottleName;
                            nameFound        = true;
                        }
                    }

                    msg += "A";

                    bool promptName = false;

                    string entryKey = "Gameplay/Objects/HobbiesSkills/NectarMaker:";
                    if (flag)
                    {
                        entryKey = entryKey + "NameBottleDialogJustOneFruit";
                    }
                    else if (num7 < NectarMaker.kPoorComboThreshold)
                    {
                        entryKey = entryKey + "NameBottleDialogTerribly";
                    }
                    else if (num7 < NectarMaker.kWellComboThreshold)
                    {
                        entryKey = entryKey + "NameBottleDialogPoor";
                    }
                    else if (num7 < NectarMaker.kGreatComboThreshold)
                    {
                        entryKey = entryKey + "NameBottleDialogWell";
                    }
                    else if (num7 < NectarMaker.kAmazingComboThreshold)
                    {
                        entryKey   = entryKey + "NameBottleDialogGreat";
                        promptName = true;
                    }
                    else
                    {
                        entryKey   = entryKey + "NameBottleDialogAmazing";
                        promptName = true;
                    }

                    msg += "B";

                    string name = defaultEntryText;

                    if (promptName)
                    {
                        if ((!nameFound) && (NRaas.StoryProgression.Main.GetValue <NectarPushScenario.NameGreatNectarOption, bool>()))
                        {
                            name = StringInputDialog.Show(Actor.SimDescription.FullName, Common.LocalizeEAString(entryKey), defaultEntryText, 0x28, StringInputDialog.Validation.ObjectRequireName);
                        }
                        else
                        {
                            List <object> parameters = StoryProgression.Main.Stories.AddGenderNouns(Actor.SimDescription);
                            parameters.Add(defaultEntryText);

                            Common.Notify(Common.Localize("MadeNectar:Results", Actor.IsFemale, parameters.ToArray()), Actor.ObjectId);
                        }
                    }

                    msg += "C";

                    bool flag2 = false;
                    if (skill != null)
                    {
                        skill.MadeXBottles(numBottles);
                        skill.UsedFruits(fruitsUsed);
                        skill.NectarTypeMade(new NectarSkill.NectarBottleInfo(hash, name, ingredients, (int)baseValue));
                        flag2 = skill.ReachedMaxLevel();
                    }

                    msg += "D";

                    int dateNum = ((int)SimClock.ConvertFromTicks(GameStates.TimeInHomeworld.Ticks, TimeUnit.Weeks)) + 0x1;
                    for (int i = 0x0; i < numBottles; i++)
                    {
                        NectarBottle item = GlobalFunctions.CreateObjectOutOfWorld("NectarBottle", null, new NectarBottleObjectInitParams(hash, name, list2, "Gameplay/Objects/HobbiesSkills/NectarMaker:Weeks", dateNum, baseValue, baseValue, Target.mLastSimToMake, flag2)) as NectarBottle;
                        Target.mBottles.Add(item);
                        EventTracker.SendEvent(EventTypeId.kMadeNectar, Target.mLastSimToMake.CreatedSim, item);
                    }
                    if (Target.mBottles.Count > 0x0)
                    {
                        Target.mCurrentStateMachine.SetActor("nectarBottle", Target.mBottles[0x0]);
                    }

                    msg += "E";

                    Target.mCurrentStateMachine.RequestState("nectarMaker", "Exit");
                    Target.mCurrentStateMachine.Dispose();
                    Target.mCurrentStateMachine = null;
                    Target.mMultiplierFromFeet  = 1f;
                    Target.mLastUsedMakeStyle   = NectarMaker.MakeNectarStyle.Basic;
                    Target.mLastSimToMake       = null;
                    Target.CurrentState         = NectarMaker.NectarMakerState.FruitAddable;

                    msg += "F";
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, msg, e);
            }
        }
コード例 #6
0
ファイル: Corrections.cs プロジェクト: yakoder/NRaas
        public static void CleanupBrokenSkills(SimDescription sim, Logger log)
        {
            try
            {
                if (sim.SkillManager == null)
                {
                    return;
                }

                List <ulong> remove = new List <ulong>();
                foreach (KeyValuePair <ulong, Skill> value in sim.SkillManager.mValues)
                {
                    Skill skill = value.Value;

                    if (skill == null)
                    {
                        remove.Add(value.Key);
                    }
                    else
                    {
                        Skill staticSkill = SkillManager.GetStaticSkill(skill.Guid);
                        if (staticSkill != null)
                        {
                            if (skill.NonPersistableData == null)
                            {
                                skill.mNonPersistableData = staticSkill.mNonPersistableData;

                                if (skill.NonPersistableData != null)
                                {
                                    if (log != null)
                                    {
                                        log(" Broken Skill " + skill.Guid + " Repaired " + sim.FullName);
                                    }
                                }
                                else
                                {
                                    remove.Add(value.Key);
                                }
                            }

                            if (skill.SkillLevel > staticSkill.MaxSkillLevel)
                            {
                                skill.SkillLevel = staticSkill.MaxSkillLevel;

                                if (log != null)
                                {
                                    log(" Skill Level Reduced To Max " + skill.Guid + ": " + sim.FullName);
                                }
                            }
                        }
                        else
                        {
                            remove.Add(value.Key);
                        }
                    }
                }

                foreach (ulong guid in remove)
                {
                    sim.SkillManager.mValues.Remove(guid);

                    if (log != null)
                    {
                        log("Broken Skill " + guid + " Dropped " + sim.FullName);
                    }
                }

                NectarSkill nectarSkill = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                if (nectarSkill != null)
                {
                    if (nectarSkill.mSimIDsServed == null)
                    {
                        nectarSkill.mSimIDsServed = new List <ulong>();
                    }

                    if (nectarSkill.mHashesMade == null)
                    {
                        nectarSkill.mHashesMade = new List <uint>();
                    }
                }

                RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);
                if (bandSkill != null)
                {
                    if (bandSkill.mBandGigsStats != null)
                    {
                        bandSkill.mBandGigsStats.Remove(null);
                    }
                }

                BroomRidingSkill broomRidingSkill = sim.SkillManager.GetSkill <BroomRidingSkill>(SkillNames.BroomRiding);
                if (broomRidingSkill != null)
                {
                    if (broomRidingSkill.mLotsVisited == null)
                    {
                        broomRidingSkill.mLotsVisited = new List <Lot>();

                        if (log != null)
                        {
                            log(" Missing LotsVisited Added: " + sim.FullName);
                        }
                    }

                    for (int i = broomRidingSkill.mLotsVisited.Count - 1; i >= 0; i--)
                    {
                        if (broomRidingSkill.mLotsVisited[i] == null)
                        {
                            broomRidingSkill.mLotsVisited.RemoveAt(i);

                            if (log != null)
                            {
                                log(" Invalid LotsVisited Removed: " + sim.FullName);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(sim, e);
            }
        }