void Awake()
        {
            Debug.Log("Begin mod init: TravelOptions");

            Mod  roadsMod        = ModManager.Instance.GetMod(ROADS_MODNAME);
            bool roadsModEnabled = roadsMod != null && roadsMod.Enabled;

            ModSettings settings = mod.GetSettings();

            RoadsIntegration = settings.GetValue <bool>("RoadsIntegration", "Enable") && roadsModEnabled;
            if (RoadsIntegration)
            {
                VariableSizeDots = settings.GetValue <bool>("RoadsIntegration", "VariableSizeDots");
                followKeyCode    = followKeys[settings.GetValue <int>("RoadsIntegration", "FollowPathsKey")];
            }

            enableWeather   = settings.GetValue <bool>("GeneralOptions", "AllowWeather");
            enableSounds    = settings.GetValue <bool>("GeneralOptions", "AllowAnnoyingSounds");
            enableRealGrass = settings.GetValue <bool>("GeneralOptions", "AllowRealGrass");
            locationPause   = settings.GetValue <int>("GeneralOptions", "LocationPause");

            CautiousTravel = settings.GetValue <bool>("CautiousTravel", "PlayerControlledCautiousTravel");
            int speedPenalty = settings.GetValue <int>("CautiousTravel", "SpeedPenalty");

            CautiousTravelMultiplier = 1 - ((float)speedPenalty / 100);
            maxAvoidChance           = settings.GetValue <int>("CautiousTravel", "MaxChanceToAvoidEncounter");
            CautiousHealthMinPc      = settings.GetValue <int>("CautiousTravel", "HealthMinimumPercentage");
            CautiousFatigueMin       = settings.GetValue <int>("CautiousTravel", "FatigueMinimumValue") + 1;

            StopAtInnsTravel               = settings.GetValue <bool>("StopAtInnsTravel", "PlayerControlledInnsTravel");
            ShipTravelPortsOnly            = settings.GetValue <bool>("ShipTravel", "OnlyFromPorts");
            ShipTravelDestinationPortsOnly = settings.GetValue <bool>("ShipTravel", "OnlyToPorts");

            defaultStartingAccel   = startAccelVals[settings.GetValue <int>("TimeAcceleration", "DefaultStartingAcceleration")];
            alwaysUseStartingAccel = settings.GetValue <bool>("TimeAcceleration", "AlwaysUseStartingAcceleration");
            accelerationLimit      = settings.GetValue <int>("TimeAcceleration", "AccelerationLimit");

            UIWindowFactory.RegisterCustomUIWindow(UIWindowType.TravelMap, typeof(TravelOptionsMapWindow));
            UIWindowFactory.RegisterCustomUIWindow(UIWindowType.TravelPopUp, typeof(TravelOptionsPopUp));

            baseFixedDeltaTime = Time.fixedDeltaTime;

            travelControlUI           = new TravelControlUI(DaggerfallUI.UIManager, defaultStartingAccel, accelerationLimit);
            travelControlUI.OnCancel += (sender) => { ClearTravelDestination(); };
            travelControlUI.OnClose  += () => { InterruptTravel(); };
            travelControlUI.OnTimeAccelerationChanged += (timeAcceleration) => { SetTimeScale(timeAcceleration); };

            // Clear destination on new game or load game.
            SaveLoadManager.OnLoad                    += (saveData) => { ClearTravelDestination(); };
            StartGameBehaviour.OnNewGame              += () => { ClearTravelDestination(); };
            GameManager.OnEncounter                   += GameManager_OnEncounter;
            PlayerGPS.OnEnterLocationRect             += PlayerGPS_OnEnterLocationRect;
            PlayerGPS.OnMapPixelChanged               += PlayerGPS_OnMapPixelChanged;
            StreamingWorld.OnUpdateLocationGameObject += StreamingWorld_OnUpdateLocationGameObject;

            mod.MessageReceiver = MessageReceiver;
            mod.IsReady         = true;

            Debug.Log("Finished mod init: TravelOptions");
        }
Exemple #2
0
 public void Start()
 {
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Trade, typeof(LGSTradeWindowText));
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.MerchantRepairPopup, typeof(LGSMerchantTradeRepairPopupWindowReplace));
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.MerchantServicePopup, typeof(LGSMerchantTradeServicePopupWindowReplace));
     Debug.Log("registered windows");
 }
Exemple #3
0
        public static void InitMod()
        {
            // Register new inventory window
            UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Inventory, typeof(ModernMenuWindow));
            UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Trade, typeof(ModernMenuTradeWindow));

            Debug.Log("Modern Menu initialized.");
        }
Exemple #4
0
 //binds key settings to script strings for input detection in update routine.
 void Start()
 {
     NextOutfitKey   = settings.GetValue <string>("Settings", "NextOutfitKey");
     PrevOutfitKey   = settings.GetValue <string>("Settings", "PrevOutfitKey");
     EquipOutfitKey  = settings.GetValue <string>("Settings", "EquipOutfitKey");
     ToggleGuiKey    = settings.GetValue <string>("Settings", "ToggleGuiKey");
     SaveOutfitKey   = settings.GetValue <string>("Settings", "SaveOutfitKey");
     DeleteOutfitKey = settings.GetValue <string>("Settings", "DeleteOutfitKey");
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Inventory, typeof(OutfitManagerInventoryWindow));
     UIWindow          = (OutfitManagerInventoryWindow)UIWindowFactory.GetInstance(UIWindowType.Inventory, uiManager, null);
     dfAudioSource     = GameManager.Instance.PlayerObject.AddComponent <DaggerfallAudioSource>();
     console           = GameObject.Find("Console");
     consoleController = console.GetComponent <ConsoleController>();
 }
Exemple #5
0
 public void Start()
 {
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.CharacterSheet, typeof(AsesinoCharSheetWindow));
     Debug.Log("registered Rest window");
 }
 void Awake()
 {
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.GuildServicePopup, typeof(FlynsarmyGuildServicePopupWindow));
     Debug.Log("GuildsCurePoison: GuildServicePopup registered windows");
 }
Exemple #7
0
        public static void InitMod(bool bedSleeping, bool archery, bool riding, bool encumbrance, bool bandaging, bool shipPorts, bool expulsion, bool climbing, bool weaponSpeed, bool weaponMaterials, bool equipDamage, bool enemyAppearance,
                                   bool purifyPot, bool autoExtinguishLight, bool classicStrDmgBonus, bool variantNpcs, bool variantResidents, bool training)
        {
            Debug.Log("Begin mod init: RoleplayRealism");

            Mod         rrItemsMod      = ModManager.Instance.GetMod(ROLEPLAYREALISMITEMS_MODNAME);
            ModSettings rrItemsSettings = rrItemsMod != null?rrItemsMod.GetSettings() : null;

            Mod travelOptionsMod = ModManager.Instance.GetMod(TRAVELOPTIONS_MODNAME);

            travelOptionsEnabled = travelOptionsMod != null && travelOptionsMod.Enabled;

            villagerVarietyMod = ModManager.Instance.GetMod(VILLAGERVARIETY_MODNAME);
            if (villagerVarietyMod != null && !villagerVarietyMod.Enabled)
            {
                villagerVarietyMod = null;
            }


            if (bedSleeping)
            {
                PlayerActivate.RegisterCustomActivation(mod, 41000, BedActivation);
                PlayerActivate.RegisterCustomActivation(mod, 41001, BedActivation);
                PlayerActivate.RegisterCustomActivation(mod, 41002, BedActivation);
            }

            if (archery)
            {
                // Override adjust to hit and damage formulas
                FormulaHelper.RegisterOverride(mod, "AdjustWeaponHitChanceMod", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponHitChanceMod);
                FormulaHelper.RegisterOverride(mod, "AdjustWeaponAttackDamage", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponAttackDamage);
            }

            if (riding)
            {
                GameObject playerAdvGO = GameObject.Find("PlayerAdvanced");
                if (playerAdvGO)
                {
                    EnhancedRiding enhancedRiding = playerAdvGO.AddComponent <EnhancedRiding>();
                    if (enhancedRiding != null)
                    {
                        enhancedRiding.RealisticMovement = mod.GetSettings().GetBool("EnhancedRiding", "RealisticMovement");
                        enhancedRiding.TerrainFollowing  = mod.GetSettings().GetBool("EnhancedRiding", "followTerrainEnabled");
                        enhancedRiding.SetFollowTerrainSoftenFactor(mod.GetSettings().GetInt("EnhancedRiding", "followTerrainSoftenFactor"));
                    }
                }
            }

            if (encumbrance)
            {
                EntityEffectBroker.OnNewMagicRound += EncumbranceEffects_OnNewMagicRound;
            }

            if (rrItemsMod == null && bandaging)
            {
                DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler((int)UselessItems2.Bandage, UseBandage);
            }

            if (shipPorts)
            {
                GameManager.Instance.TransportManager.ShipAvailiable = IsShipAvailiable;
            }

            if (expulsion)
            {
                // Register the TG/DB Guild classes
                if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GeneralPopulace, typeof(ThievesGuildRR)))
                {
                    throw new Exception("GuildGroup GeneralPopulace is already overridden, unable to register ThievesGuildRR guild class.");
                }

                if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.DarkBrotherHood, typeof(DarkBrotherhoodRR)))
                {
                    throw new Exception("GuildGroup DarkBrotherHood is already overridden, unable to register DarkBrotherhoodRR guild class.");
                }
            }

            if (climbing)
            {
                FormulaHelper.RegisterOverride(mod, "CalculateClimbingChance", (Func <PlayerEntity, int, int>)CalculateClimbingChance);
            }

            if (weaponSpeed && (rrItemsSettings == null || !rrItemsSettings.GetBool("Modules", "weaponBalance")))
            {
                FormulaHelper.RegisterOverride(mod, "GetMeleeWeaponAnimTime", (Func <PlayerEntity, WeaponTypes, ItemHands, float>)GetMeleeWeaponAnimTime);
            }

            if (weaponMaterials)
            {
                FormulaHelper.RegisterOverride(mod, "CalculateWeaponToHit", (Func <DaggerfallUnityItem, int>)CalculateWeaponToHit);
            }

            if (equipDamage)
            {
                FormulaHelper.RegisterOverride(mod, "ApplyConditionDamageThroughPhysicalHit", (Func <DaggerfallUnityItem, DaggerfallEntity, int, bool>)ApplyConditionDamageThroughPhysicalHit);
            }

            if (enemyAppearance)
            {
                UpdateEnemyClassAppearances();
            }

            if (purifyPot)
            {
                GameManager.Instance.EntityEffectBroker.RegisterEffectTemplate(new CureDiseasePotionRR(), true);
            }

            if (autoExtinguishLight)
            {
                PlayerEnterExit.OnPreTransition += OnTransitionToDungeonExterior_ExtinguishLight;
            }

            if (classicStrDmgBonus)
            {
                FormulaHelper.RegisterOverride(mod, "DamageModifier", (Func <int, int>)DamageModifier_classicDisplay);
            }

            if (variantNpcs)
            {
                PlayerEnterExit.OnTransitionInterior += OnTransitionToInterior_VariantShopTavernNPCsprites;
            }

            if (variantResidents)
            {
                PlayerEnterExit.OnTransitionInterior += OnTransitionToInterior_VariantResidenceNPCsprites;
            }

            if (training)
            {
                UIWindowFactory.RegisterCustomUIWindow(UIWindowType.GuildServiceTraining, typeof(GuildServiceTrainingRR));
            }

            // Initialise the FG master quest.
            if (!QuestListsManager.RegisterQuestList("RoleplayRealism"))
            {
                throw new Exception("Quest list name is already in use, unable to register RoleplayRealism quest list.");
            }

            RegisterFactionIds();

            // Add additional data into the quest machine for the quests
            QuestMachine questMachine = GameManager.Instance.QuestMachine;

            questMachine.PlacesTable.AddIntoTable(placesTable);
            questMachine.FactionsTable.AddIntoTable(factionsTable);

            // Register the custom armor service and location detection
            Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor");
            PlayerGPS.OnEnterLocationRect += PlayerGPS_OnEnterLocationRect;
            PlayerGPS.OnMapPixelChanged   += PlayerGPS_OnMapPixelChanged;

            Debug.Log("Finished mod init: RoleplayRealism");
        }
Exemple #8
0
 public void Start()
 {
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Inventory, typeof(AsesinoInventoryWindow));
     UIWindowFactory.RegisterCustomUIWindow(UIWindowType.Trade, typeof(AsesinoTradeWindow));
     Debug.Log("Inventory registered windows");
 }