コード例 #1
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            Common.StringBuilder msg = new Common.StringBuilder();

            msg += Common.NewLine + "GameStates.IsOnVacation = " + GameStates.IsOnVacation;
            msg += Common.NewLine + "GameUtils.IsOnVacation = " + GameUtils.IsOnVacation();

            msg += Common.NewLine + " CurrentWorldType = " + GameUtils.GetCurrentWorldType();

            if (GameStates.sTravelData != null)
            {
                msg += Common.NewLine + "sTravelData";
                msg += Common.NewLine + "  mCurrentDayOfTrip = " + GameStates.sTravelData.mCurrentDayOfTrip;
                msg += Common.NewLine + "  mHomeWorld = " + GameStates.sTravelData.mHomeWorld;
                msg += Common.NewLine + "  mSaveName = " + GameStates.sTravelData.mSaveName;
                msg += Common.NewLine + "  mTimeInHomeworld = " + GameStates.sTravelData.mTimeInHomeworld;

                if (GameStates.sTravelData.mTravelHouse != null)
                {
                    msg += Common.NewLine + "  mTravelHouse = " + GameStates.sTravelData.mTravelHouse.Name;

                    foreach (SimDescription member in Households.All(GameStates.sTravelData.mTravelHouse))
                    {
                        msg += Common.NewLine + "    " + member.FullName;
                    }
                }
                else
                {
                    msg += Common.NewLine + "  mTravelHouse = null";
                }
            }
            else
            {
                msg += Common.NewLine + "sTravelData = null";
            }

            msg += FileNameBooter.LookupToString();

            msg += WorldData.GetWorldDataToString();

            Common.Notify(msg);

            Common.WriteLog(msg);

            return(OptionResult.SuccessClose);
        }
コード例 #2
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
        public void OnPreLoad()
        {
            sDefaultBarTuned = false;

            foreach (BookComicData bookData in BookData.BookComicDataList.Values)
            {
                bookData.AllowedWorldTypes.Add(WorldType.Vacation);
            }

            foreach (Opportunity opp in OpportunityManager.sLocationBasedOpportunityList.Values)
            {
                if (opp.SharedData.mTargetWorldRequired == WorldName.SunsetValley)
                {
                    opp.SharedData.mTargetWorldRequired = WorldName.Undefined;
                }
            }

            if (ServiceNPCSpecifications.sServiceSpecifications != null)
            {
                foreach (ServiceType type in Enum.GetValues(typeof(ServiceType)))
                {
                    ServiceNPCSpecifications.ServiceSpecifications spec;
                    if (ServiceNPCSpecifications.sServiceSpecifications.TryGetValue(type.ToString(), out spec))
                    {
                        spec.InvalidWorlds.Clear();
                    }
                }
            }

            foreach (List <MotiveTuning> tempTuning in MotiveTuning.sTuning.Values)
            {
                foreach (MotiveTuning tuning in tempTuning)
                {
                    tuning.WorldRestrictionType = WorldRestrictionType.None;
                }
            }

            Bartending.BarData defaultData;
            if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData))
            {
                sDefaultBarTuned = (defaultData.mFoods.Count > 0);
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.CommercialSubTypeData commData in Lot.sCommnunityTypeData)
            {
                commData.WorldAllowed     = null;
                commData.WorldTypeAllowed = null;
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.ResidentialSubTypeData residentData in Lot.sResidentialTypeData)
            {
                residentData.WorldAllowed     = null;
                residentData.WorldTypeAllowed = null;
            }

            foreach (ActionData action in ActionData.sData.Values)
            {
                if (action.mAllowedWorldTypes != null)
                {
                    List <WorldType> types = new List <WorldType>(action.mAllowedWorldTypes);

                    if (types.Count > 0)
                    {
                        if ((!types.Contains(WorldType.Vacation)))
                        {
                            types.Add(WorldType.Vacation);
                        }

                        if ((!types.Contains(WorldType.Future)))
                        {
                            types.Add(WorldType.Future);
                        }

                        action.mAllowedWorldTypes = types.ToArray();
                    }
                }
            }

            STCData.SetNumSocialsDuringConversation(int.MaxValue);

            foreach (InsectData insect in InsectData.sData.Values)
            {
                if (insect.RequiredWorld != WorldName.Undefined)
                {
                    insect.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + insect.Name);
                }
            }

            foreach (RockGemMetalData rock in RockGemMetalBase.sData.Values)
            {
                if (rock.RequiredWorld != WorldName.Undefined)
                {
                    rock.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + rock.Name);
                }
            }

            List <KeyValuePair <WorldName, WorldNameData> > data = new List <KeyValuePair <WorldName, WorldNameData> >();

            if (GameUtils.IsInstalled(ProductVersion.EP1))
            {
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.China, new WorldNameData("China.world", "China_0x0859db4c", TravelUtil.DestinationInfoImage[0], TravelUtil.DestinationInfoName[0], TravelUtil.DestinationInfoDescription[0], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[0], 0x0)), TravelUtil.DestinationInfoComfirmDescription[0])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.Egypt, new WorldNameData("Egypt.world", "Egypt_0x0859db48", TravelUtil.DestinationInfoImage[1], TravelUtil.DestinationInfoName[1], TravelUtil.DestinationInfoDescription[1], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[1], 0x0)), TravelUtil.DestinationInfoComfirmDescription[1])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.France, new WorldNameData("France.world", "France_0x0859db50", TravelUtil.DestinationInfoImage[2], TravelUtil.DestinationInfoName[2], TravelUtil.DestinationInfoDescription[2], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[2], 0x0)), TravelUtil.DestinationInfoComfirmDescription[2])));
            }

            List <WorldFileMetadata> worlds = new List <WorldFileMetadata>();

            WorldFileSearch search = new WorldFileSearch(0x0);

            foreach (string str in search)
            {
                WorldFileMetadata info = new WorldFileMetadata();

                info.mWorldFile = str;
                if (GetWorldFileDetails(ref info))
                {
                    worlds.Add(info);
                }
            }

            worlds.Sort(OnSort);

            foreach (WorldFileMetadata info in worlds)
            {
                string name = info.mWorldFile.Replace(".world", "");

                WorldName worldName = WorldName.Undefined;

                try
                {
                    worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", "")));
                }
                catch
                {
                    continue;
                }

                string saveFile = name;
                switch (name.ToLower())
                {
                case "islaparadiso":
                    if (!GameUtils.IsInstalled(ProductVersion.EP10))
                    {
                        continue;
                    }

                    worldName = WorldName.IslaParadiso;

                    saveFile += "_0x0c50c382";
                    break;

                case "sims university":
                    if (!GameUtils.IsInstalled(ProductVersion.EP9))
                    {
                        continue;
                    }

                    worldName = WorldName.University;

                    saveFile += "_0x0e41c954";
                    break;

                case "bridgeport":
                    if (!GameUtils.IsInstalled(ProductVersion.EP3))
                    {
                        continue;
                    }

                    worldName = WorldName.NewDowntownWorld;

                    saveFile += "_0x09ffe3d7";
                    break;

                case "twinbrook":
                    if (!GameUtils.IsInstalled(ProductVersion.EP2))
                    {
                        continue;
                    }

                    worldName = WorldName.TwinBrook;

                    saveFile += "_0x09b610fa";
                    break;

                case "appaloosaplains":
                    if (!GameUtils.IsInstalled(ProductVersion.EP5))
                    {
                        continue;
                    }

                    worldName = WorldName.AppaloosaPlains;

                    saveFile += "_0x0c50c56d";
                    break;

                case "riverview":
                    worldName = WorldName.RiverView;

                    saveFile += "_0x0859db43";
                    break;

                case "sunset valley":
                    worldName = WorldName.SunsetValley;

                    saveFile += "_0x0859db3c";
                    break;

                case "moonlight falls":
                    worldName = WorldName.MoonlightFalls;

                    saveFile += "_0x09b61110";
                    break;

                case "starlight shores":
                    if (!GameUtils.IsInstalled(ProductVersion.EP6))
                    {
                        continue;
                    }

                    worldName = WorldName.StarlightShores;

                    saveFile += "_0x09b610ff";
                    break;

                case "hidden springs":
                case "barnacle bay":
                case "lunar lakes":
                case "lucky palms":
                    saveFile += "_0x08866eb8";
                    break;

                case "roaring heights":
                    worldName = WorldName.DOT11;

                    saveFile += "_0x0de07e86";
                    break;

                case "midnight hollow":
                    worldName = WorldName.DOT10;

                    saveFile += "_0x0de07e7d";
                    break;

                case "dragon valley":
                    worldName = WorldName.DOT09;

                    saveFile += "_0x0de07c9c";
                    break;

                case "aurora skies":
                    worldName = WorldName.DOT08;

                    saveFile += "_0x0de07c8b";
                    break;

                case "monte vista":
                    worldName = WorldName.DOT07;

                    saveFile += "_0x0de07c83";
                    break;

                case "sunlit tides":
                    worldName = WorldName.DOT06;

                    saveFile += "_0x0de07c78";
                    break;

                case "oasis landing":
                    worldName = WorldName.FutureWorld;

                    saveFile += "_0x0f36012a";
                    break;

                case "egypt":
                case "china":
                case "france":
                    continue;

                default:
                    saveFile = FileNameBooter.GetFileName(saveFile);
                    break;
                }

                string infoIcon = "glb_i_suburb";
                switch (info.mWorldType)
                {
                case WorldType.Downtown:
                    infoIcon = "glb_i_downtown";
                    break;

                case WorldType.Vacation:
                    infoIcon = "glb_i_vacation";
                    break;

                default:
                    break;
                }

                if (!VisaManager.sDictionary.ContainsKey((ulong)worldName))
                {
                    Visa defaultVisa = new Visa();
                    defaultVisa.mWorldName          = worldName;
                    defaultVisa.mNonPersistableData = new NonPersistableVisaData();
                    defaultVisa.NonPersistableData.LevelUpStrings = new string[3] {
                        "", "", ""
                    };
                    defaultVisa.NonPersistableData.PointsForNextLevel = new int[3] {
                        0, 0, 0
                    };

                    Visa chinaVisa = VisaManager.GetStaticVisaData(WorldName.China);
                    if (chinaVisa != null)
                    {
                        defaultVisa.NonPersistableData.LevelUpStrings     = new List <string>(chinaVisa.NonPersistableData.LevelUpStrings).ToArray();
                        defaultVisa.NonPersistableData.PointsForNextLevel = new List <int>(chinaVisa.NonPersistableData.PointsForNextLevel).ToArray();
                    }

                    VisaManager.sDictionary.Add((ulong)worldName, defaultVisa);

                    data.Add(new KeyValuePair <WorldName, WorldNameData>(worldName, new WorldNameData(info.mWorldFile, saveFile, infoIcon, info.mCaption, info.mDescription, info.mWorldThumb, Common.Localize("Itinerary:Name", false, new object[] { info.mCaption }))));
                }
            }

            TravelUtil.kVacationWorldNames = new WorldName[data.Count];

            TravelUtil.DestinationInfoImage              = new string[data.Count];
            TravelUtil.DestinationInfoName               = new string[data.Count];
            TravelUtil.DestinationInfoDescription        = new string[data.Count];
            TravelUtil.DestinationInfoConfirmImage       = new string[data.Count];
            TravelUtil.DestinationInfoComfirmDescription = new string[data.Count];

            TravelUtil.DestinationInfoIndex = new int[data.Count];

            int index = 0;

            foreach (KeyValuePair <WorldName, WorldNameData> value in data)
            {
                TravelUtil.kVacationWorldNames[index] = value.Key;

                TravelUtil.DestinationInfoIndex[index] = index;

                TravelUtil.DestinationInfoImage[index]              = value.Value.mDestinationInfoImage;
                TravelUtil.DestinationInfoName[index]               = value.Value.mDestinationInfoName;
                TravelUtil.DestinationInfoDescription[index]        = value.Value.mDestinationInfoDescription;
                TravelUtil.DestinationInfoConfirmImage[index]       = "";
                TravelUtil.DestinationInfoComfirmDescription[index] = value.Value.mDestinationInfoConfirmDescription;

                sConfirmImages.Add(value.Value.mDestinationInfoConfirmImage);

                BooterLogger.AddTrace(value.Value.ToString());
                BooterLogger.AddTrace("  WorldName: " + (ulong)value.Key);

                index++;

                sData.Add(value.Key, value.Value);
            }

            //BooterLogger.AddError("WorldData");

            sOrigWorldNameToType = GameUtils.WorldNameToType;

            foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
            {
                switch (tuning.Availability.WorldRestrictionType)
                {
                case WorldRestrictionType.Allow:
                    if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Vacation);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }
                    else if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Downtown);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (C) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;

                case WorldRestrictionType.Disallow:
                    if ((tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Future)))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Vacation);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Downtown);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.University);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Future);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (B) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;
                }
            }
        }