KingEnderBrine / -RoR2-ProperSave

MIT License
24 stars 14 forks source link

May I make a request? How do I save other mod parameters when I use [ProperSave]? #79

Open BlankSDD opened 1 week ago

BlankSDD commented 1 week ago

May I make a request? How do I save other mod parameters when I use [ProperSave]? Recently, based on the [r2modman] tool, I've been using the [ProperSave] mod and the [PersistDesperado] mod, both mods downloaded from a search on the [r2modman] tool, and I've found an issue as follows:

First of all, let me introduce the following [PersistDesperado] mod, in the classic mode of the original game, the Bandit character's skill desperado is reset to 0 for every level, this mod preserves the number of stacking layers of this skill and nerfs it to 2%/per stack.

Yesterday was October 20, I had both the [ProperSave] mod and [PersistDesperado] mod on, and when I got to level 3, saved and exited, and re-entered the game, my desperado stack was reset to 0. I felt bad and frustrated.

May someone help me with this problem please? I really appreciate it if the problem can be solved !

KingEnderBrine commented 1 week ago

ProperSave has API that other mods can use to save the data they need. Anyone can write a mod to add support between some mod and ProperSave, or mod authors can add support for ProperSave in their mod. But I won't add specific mods support into ProperSave.

BlankSDD commented 1 week ago

Hi, I have tried to check and read the dll file of [ProperSave] mod and [PersistDesperado] mod. I have following 2 points.

  1. According to your description, I need to write a new mod OR I need to edit the [PersistDesperado] mod to support my requirement. Is that right ? OR I only need to edit the [PeoperSave] mod ?

  2. I am not familiar with dll. I will try to edit the [PersistDesperado] mod. Original [PersistDesperado] mod dll (the mod has only 1 dll file) : https://github.com/BlankSDD/UserScript/blob/main/bandito.cs

Now, I have some directions for my request. (1) In [PersistDesperado] mod dll , Using the [ProperSave.SaveFile.OnGatherSaveData] to save the data. Honestly, I have no idea how to use the API function [ProperSave.SaveFile.OnGatherSaveData]. (2) In [ProperSave] mod, [ProperSave.ModSupport.cs], to add a new [DataMember()] in [ProperSave.Data.ModdedData.cs] like : [DataMember(Name = "v")] [DiscoverObjectType(nameof(ObjectType))] public object Value { get; set; } (3) ...... I am confused. I have no idea how to go on ......

Thanks ! I really appreciate it if response me !

KingEnderBrine commented 1 week ago

Yes, you write a new mod, or edit PersistentDesperado. I would recommend you learning at least the basics of c# first. You don't need to copy code from ProperSave, you add it as a library and the subscribe to events from it.