Exemple #1
0
        /// <summary>
        ///     The mod entry point, called after the mod is first loaded.
        /// </summary>
        /// <param name="helper">
        ///     Provides simplified APIs for writing mods.
        /// </param>
        public override void Entry(IModHelper helper)
        {
            // Read the configuration file.
            ModEntry.config = helper.ReadConfig <ModConfig>();

            // Initialization.
            ClickToMoveManager.Init(ModEntry.config, this.Monitor, helper, this.Helper.Reflection);

            HarmonyInstance.DEBUG = true;

            // Add patches.
            HarmonyInstance harmony = HarmonyInstance.Create(this.ModManifest.UniqueID);

            BuildingsPatcher.Hook(harmony);
            CharactersPatcher.Hook(harmony);
            EventPatcher.Hook(harmony);
            FarmAnimalPatcher.Hook(harmony);
            FarmerPatcher.Hook(harmony, this.Monitor);
            FarmerSpritePatcher.Hook(harmony);
            GamePatcher.Hook(harmony);
            GameLocationPatcher.Hook(harmony);
            LocationsPatcher.Hook(harmony);
            MenusPatcher.Hook(harmony);
            MinigamesPatcher.Hook(harmony);
            ObjectsPatcher.Hook(harmony);
            ShedPatcher.Hook(harmony);
            ToolsPatcher.Hook(harmony);
            UtilityPatcher.Hook(harmony);

            // Hook events.
            helper.Events.Display.RenderedWorld += this.OnRenderedWorld;

            // Log info
            this.Monitor.VerboseLog("Initialized.");
        }
Exemple #2
0
 private void SetIp(string ip)
 {
     _loginIp = GamePatcher.CreateIpPatch(ip, 0x152B88);
     if (!_patcher.IsPatched(_loginIp))
     {
         _patcher.AddPatch(_loginIp);
     }
 }
Exemple #3
0
        public void SavePatches(string ip, ushort port, bool removeXTrap)
        {
            byte[] file = App.ReadFile(_file.FullName);
            if (file == null)
            {
                return;
            }
            _patcher = new GamePatcher(file);

            _xTrap.Add(new GamePatch(0x8628F, 0x52, 0x90));
            _xTrap.Add(new GamePatch(0x86290, 0xFF, 0x90));
            _xTrap.Add(new GamePatch(0x86291, 0x15, 0x90));
            _xTrap.Add(new GamePatch(0x86292, 0x74, 0x90));
            _xTrap.Add(new GamePatch(0x86293, 0xF2, 0x90));
            _xTrap.Add(new GamePatch(0x86294, 0x54, 0x90));
            _xTrap.Add(new GamePatch(0x86295, 0x00, 0x90));

            _xTrap.Add(new GamePatch(0x11B7C8, 0x55, 0xC3));

            _xTrap.Add(new GamePatch(0x11DAF0, 0x0F, 0xE9));
            _xTrap.Add(new GamePatch(0x11DAF1, 0x84, 0xD3));
            _xTrap.Add(new GamePatch(0x11DAF2, 0xD2, 0x01));
            _xTrap.Add(new GamePatch(0x11DAF3, 0x01, 0x00));
            _xTrap.Add(new GamePatch(0x11DAF5, 0x00, 0x90));

            _xTrap.Add(new GamePatch(0x11F9F5, 0x74, 0x90));
            _xTrap.Add(new GamePatch(0x11F9F6, 0x18, 0x90));

            _xTrap.Add(new GamePatch(0x11FE9C, 0x75, 0xEB));

            _xTrap.Add(new GamePatch(0x11FEF9, 0x90, 0xFF));
            _xTrap.Add(new GamePatch(0x11FEFA, 0x5F, 0xFF));
            _xTrap.Add(new GamePatch(0x11FEFB, 0x01, 0xFF));
            _xTrap.Add(new GamePatch(0x11FEFC, 0x00, 0xFF));

            _xTrap.Add(new GamePatch(0x120D60, 0x30, 0xFF));
            _xTrap.Add(new GamePatch(0x120D61, 0x75, 0xFF));
            _xTrap.Add(new GamePatch(0x120D62, 0x00, 0xFF));
            _xTrap.Add(new GamePatch(0x120D63, 0x00, 0xFF));

            _xTrapIp1 = GamePatcher.CreateIpPatch("127.0.0.1", 0x196714);
            _xTrapIp2 = GamePatcher.CreateIpPatch("127.0.0.1", 0x196750);
            _xTrapIp3 = GamePatcher.CreateIpPatch("127.0.0.1", 0x1967B4);

            SetIp(ip);
            SetPort(port);
            if (removeXTrap)
            {
                RemoveXtrap();
            }

            _patcher.Patch();
            byte[] patched = _patcher.GetFile();
            App.WriteFile(patched, _file.FullName);
        }
        private void StartUnpackingFiles()
        {
            currentProgressBar.Value = 0;
            totalProgressBar.Value = 0;

            InsertOnLogListBox(Language.Patching1Done);
            InsertOnLogListBox(Language.Patching1Unpacking);

            GamePatcher.UnpackPatchList(
                Directory.GetCurrentDirectory(),
                patchesToBeDownloaded,
                OnStartUnpackingPatch,
                OnUnpackPatch);
        }
Exemple #5
0
    IEnumerator InitData()
    {
        UIManager.Inst.Clear();
        Res.Inst.Release();
        yield return(new WaitForSeconds(0.1f));

        //登陆
        LoginManager.Inst.Login();
        while (LoginManager.Inst.loginStatus == LoginManager.LoginStatus.LOGINING)
        {
            yield return(null);
        }
        DataManager.Inst.SetDefaultValue();
        GamePatcher.Patcher();
        ServerDataManager.Inst.Init();
        SceneLoadManager.Inst.LoadScene(SceneName.HomeScene);
        TableBI.InitTime(LoginManager.Inst.InitStepCostTime);
    }
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            Instance = this;

            this.Config            = helper.ReadConfig <Config>();
            this.Bridge            = new Bridge(helper.ModRegistry, this.Config.DebugMode);
            this.EventManager      = new EventManager(this.Monitor);
            this.QuestManager      = new QuestManager(this.Monitor);
            this.QuestStateStore   = new QuestStateStore(helper.Data, this.Monitor);
            this.StatsManager      = new StatsManager(helper.Multiplayer, helper.Data);
            this.ConditionManager  = new ConditionManager(this.Monitor);
            this.QuestOfferManager = new QuestOfferManager(this.ConditionManager, this.QuestManager);
            this.ContentPackLoader = new Loader(this.Monitor, this.QuestManager, this.QuestOfferManager);
            this.QuestController   = new QuestController(this.QuestManager, this.QuestOfferManager, this.Monitor);
            this.MailController    = new MailController(this.QuestManager, this.QuestOfferManager, this.Monitor);
            this.QuestLogWatchdog  = new QuestLogWatchdog(helper.Events, this.EventManager, this.StatsManager, this.Monitor);
            this.NetworkOperator   = new NetworkOperator(
                helper: helper.Multiplayer,
                events: helper.Events.Multiplayer,
                questStateStore: this.QuestStateStore,
                statsManager: this.StatsManager,
                questController: this.QuestController,
                modManifest: this.ModManifest,
                monitor: this.Monitor);

            helper.Content.AssetEditors.Add(this.QuestController);
            helper.Content.AssetEditors.Add(this.MailController);

            helper.Events.GameLoop.GameLaunched    += this.OnGameStarted;
            helper.Events.GameLoop.UpdateTicked    += this.OnUpdateTicked;
            helper.Events.GameLoop.SaveLoaded      += this.OnSaveLoaded;
            helper.Events.GameLoop.Saving          += this.OnSaving;
            helper.Events.GameLoop.DayStarted      += this.OnDayStarted;
            helper.Events.GameLoop.DayEnding       += this.OnDayEnding;
            helper.Events.GameLoop.ReturnedToTitle += this.OnReturnToTitle;
            helper.Events.Display.MenuChanged      += this.OnQuestLogMenuChanged;
            this.NetworkOperator.InitReceived      += this.OnNetworkInitMessageReceived;

            this.Patcher = new GamePatcher(this.ModManifest.UniqueID, this.Monitor, false);

            this.Patcher.Apply(
                new Patches.QuestPatch(this.QuestManager, this.EventManager),
                new Patches.LocationPatch(this.ConditionManager),
                new Patches.Game1Patch(this.QuestManager, this.QuestOfferManager),
                new Patches.DialoguePatch(this.QuestManager),
                new Patches.NPCPatch(this.QuestManager, this.QuestOfferManager),
                new Patches.BillboardPatch());

            helper.ConsoleCommands.Add("quests_list", "List all managed quests", Commands.ListQuests);
            helper.ConsoleCommands.Add("quests_log", "List all managed quests which are in player's quest log", Commands.ListLog);
            helper.ConsoleCommands.Add("quests_stats", "Show quest statistics", Commands.QuestStats);
            helper.ConsoleCommands.Add("quests_invalidate", "Invalidate quest assets cache", Commands.InvalidateCache);
            helper.ConsoleCommands.Add("quests_accept", "Accept managed quest and add it to questlog", Commands.AcceptQuest);
            helper.ConsoleCommands.Add("quests_complete", "Complete managed quest in questlog", Commands.CompleteQuest);
            helper.ConsoleCommands.Add("quests_remove", "Remove managed quest from questlog", Commands.RemoveQuest);
            helper.ConsoleCommands.Add("quests_customtypes", "List of exposed custom quest types", Commands.ListTypeFactories);

            var packs = helper.ContentPacks.GetOwned();

            if (packs.Any())
            {
                this.ContentPackLoader.LoadPacks(packs);
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     patcher = new GamePatcher(remoteRoot);
 }