예제 #1
0
        public static void Init(InitParams initParams)
        {
            mod = initParams.Mod;
            var go = new GameObject(mod.Title);

            go.AddComponent <RealisticWagon>();
            instance = go.AddComponent <RealisticWagon>();
            mod.SaveDataInterface = instance;

            PlayerActivate.RegisterCustomActivation(mod, 41241, MountWagon);
            PlayerActivate.RegisterCustomActivation(mod, 201, 0, MountHorse);

            PlayerEnterExit.OnPreTransition             += OnPreInterior_PlaceMounts;
            PlayerEnterExit.OnTransitionInterior        += OnTransitionInterior_GiveTempWagon;
            PlayerEnterExit.OnTransitionExterior        += OnTransitionExterior_DropTempWagon;
            PlayerEnterExit.OnTransitionExterior        += OnTransitionExterior_AdjustTransport;
            PlayerEnterExit.OnTransitionExterior        += OnTransitionExterior_InventoryCleanup;
            PlayerEnterExit.OnTransitionExterior        += OnTransitionExterior_HeightExitCorrection;
            PlayerEnterExit.OnTransitionDungeonInterior += OnTransitionInterior_GiveTempWagon;
            PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionExterior_DropTempWagon;
            PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionExterior_AdjustTransport;
            PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionExterior_InventoryCleanup;
            PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionExterior_HeightExitCorrection;
            //PlayerGPS.OnMapPixelChanged += OnMapPixelChanged_RegisterONMR;
            EntityEffectBroker.OnNewMagicRound += OnNewMagicRound_PlaceMounts;


            ModVersion  = mod.ModInfo.ModVersion;
            mod.IsReady = true;
        }
예제 #2
0
        public static void Init(InitParams initParams)
        {
            Debug.Log("[ThiefOverhaul] Mod Init.");
            mod = initParams.Mod;
            var go = new GameObject(mod.Title);

            go.AddComponent <ThiefOverhaul>();

            EntityEffectBroker.OnNewMagicRound   += ThiefEffects_OnNewMagicRound;
            PlayerEnterExit.OnTransitionExterior += SneakCounter_OnTransitionExterior;
            PlayerActivate.RegisterCustomActivation(mod, 182, 25, ShadowAppraiserClicked);
            PlayerActivate.RegisterCustomActivation(mod, 182, 35, ShadowAppraiserClicked);
            PlayerActivate.RegisterCustomActivation(mod, 186, 26, ShadowAppraiserClicked);
            PlayerActivate.RegisterCustomActivation(mod, 182, 35, ShadowAppraiserClicked);
            PlayerActivate.OnLootSpawned += TheftItems_OnLootSpawned;

            ItemHelper itemHelper = DaggerfallUnity.Instance.ItemHelper;

            itemHelper.RegisterCustomItem(templateIndex_Ring, ItemGroups.MiscItems, typeof(ItemLockpicks));
            itemHelper.RegisterCustomItem(templateIndex_Mark, ItemGroups.MiscItems, typeof(ItemMark));
            itemHelper.RegisterCustomItem(templateIndex_Bracelet, ItemGroups.MiscItems, typeof(ItemBracelet));
            itemHelper.RegisterCustomItem(templateIndex_Bracer, ItemGroups.MiscItems, typeof(ItemRope));
            itemHelper.RegisterCustomItem(templateIndex_Crystal, ItemGroups.MiscItems, typeof(ItemPebbles));

            PlayerActivate.RegisterCustomActivation(mod, 41006, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41011, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41017, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41018, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41028, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41031, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41040, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41042, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41044, ShopShelfBurglar);
            PlayerActivate.RegisterCustomActivation(mod, 41046, ShopShelfBurglar);
        }
예제 #3
0
        public static void InitAtStartState(InitParams initParams)
        {
            mod = initParams.Mod;
            var go = new GameObject(mod.Title);

            mod.SaveDataInterface = go.AddComponent <TentDemoModLoader>();

            Debug.Log("Started setup of : " + mod.Title);

            DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler(templateIndex_Tent, UseTent);
            DaggerfallUnity.Instance.ItemHelper.RegisterCustomItem(templateIndex_Tent, ItemGroups.UselessItems2);
            PlayerActivate.RegisterCustomActivation(mod, 41606, PackUpTent);

            mod.IsReady = true;
        }
예제 #4
0
        public static void Init(InitParams initParams)
        {
            mod = initParams.Mod;
            var go = new GameObject(mod.Title);

            go.AddComponent <TorchTaker>();
            instance = go.AddComponent <TorchTaker>();
            mod.SaveDataInterface = instance;

            PlayerActivate.RegisterCustomActivation(mod, 210, 16, TakeTorch);
            PlayerActivate.RegisterCustomActivation(mod, 210, 17, TakeTorch);
            PlayerActivate.RegisterCustomActivation(mod, 210, 18, TakeTorch);

            PlayerEnterExit.OnTransitionExterior        += OnTransitionExterior_ListCleanup;
            PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionExterior_ListCleanup;
        }
예제 #5
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)
        {
            Debug.Log("Begin mod init: RoleplayRealism");

            Mod         rrItemsMod      = ModManager.Instance.GetMod("RoleplayRealismItems");
            ModSettings rrItemsSettings = rrItemsMod != null?rrItemsMod.GetSettings() : 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 CureDiseaseRR(), true);
            }

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

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

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

            // 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
            Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor");

            Debug.Log("Finished mod init: RoleplayRealism");
        }