Jump to content

Recommended Posts

So I'm considering trying to make a mod that allows you to reforge Soulbound weapons with the Durgan's Steel upgrade (and possibly other modifications like adding enchantments and quality as a separate option) once you have completed the soulbound challenges of the weapon.  

 

I've also gotten a request to look at whether class restrictions can be removed (and the relevant bonuses replaced) on the Soulbound items that I would like to look into.

 

Does anyone know if this may be possible and any particular place I should start looking within the code to accomplish this?

 

(This was originally posted in the general discussion forum until it was pointed out to me that this handy subforum existed.)

  • Like 1
Link to comment
Share on other sites

If you're decompiling the code, most of the logic for Soulbound equipment is in the class EquipmentSoulbind, and the entry point for enchanting is in UIItemInspectManager.Reload.  Hope that helps you get started!

  • Like 2
Link to comment
Share on other sites

Hey BMac, thank for the advice.  Unfortunately, in order to make good use of it I will need to first figure out how to decompile some file or set of files in order to actually look at various classes and methods and modify them.  I'm a bit inexperienced at modding (and coding in general), so I may not currently have the tools I need to do that.  As long as they're free though, I would be happy to continue to pursue the goal of my mod however.  

 

Should I try what this thread recommends? 

https://forums.obsidian.net/topic/68573-decompiling-the-beta/

Edited by Chesschamp09
Link to comment
Share on other sites

So I tried out the ILSpy from the linked thread to explore the code and make some trial changes, but I am having difficulty recompiling the code into a .dll file in order to actually test the changes I made.  The instructions microsoft provides for making these files did not prove helpful to me and I am concerned that the ILSpy may not have been able to properly decompile the code as the Visual Studio says there are build errors even though things looks fine to me. 

 

 Anyone have any advice or pointers on the decompile-recompile process?

Perhaps there is a way to only decompile and edit the parts of the original .dll file that I need to?

 

For reference, Assembly-CSharp.dll is the file I decompiled and found the items BMac pointed out.

Edited by Chesschamp09
Link to comment
Share on other sites

Update:

Since I couldnt seem to get compilation from C# code form to work, I tried to use the ildasm.exe and ilasm.exe tools that come with visual studio.  Though it is a bit more tedious and obscure to deal with, I believe I was able to edit the .il file (from ildasm) as desired.

 

However, the compiling using ilasm is stopped near the very end at the 1st byte array (which I did not alter) at line 1005630 character 10, which is just the white space character after "cil" in ".data cil I_001C7D90 = bytearray (\n" and throws an "irrecoverable syntax error" resulting in Failure.  

 

At this point, I am unsure of how to resolve this issue (or any of the others for the other compiling attempts) to get any one way to actually compile successfully, so if anyone has any advice to give I would greatly appreciate it.  

Link to comment
Share on other sites

yeah, my biggest letdown with PoE is primarily how hard it is to mod.  OItherwise, it's probably the most comprehensive iso rpg ever.

a lot of key features are bundled into Assembly-CSharp.dll, and as you have seen, it isn't exactly an easy thing to edit.

there is a mod on Nexus where someone edited that file to make changes to the focus levels for ciphers... but they are unforthcoming on how they did it.

 

Edited by Ichthyic
Link to comment
Share on other sites

Update:

Since I couldnt seem to get compilation from C# code form to work, I tried to use the ildasm.exe and ilasm.exe tools that come with visual studio.  Though it is a bit more tedious and obscure to deal with, I believe I was able to edit the .il file (from ildasm) as desired.

 

However, the compiling using ilasm is stopped near the very end at the 1st byte array (which I did not alter) at line 1005630 character 10, which is just the white space character after "cil" in ".data cil I_001C7D90 = bytearray (\n" and throws an "irrecoverable syntax error" resulting in Failure.  

 

At this point, I am unsure of how to resolve this issue (or any of the others for the other compiling attempts) to get any one way to actually compile successfully, so if anyone has any advice to give I would greatly appreciate it.  

"However, the compiling using ilasm is stopped near the very end at the 1st byte array"

 

security code is built into the file.  How people work around this must be to use an editor that does not decompile/recompile, but instead edits the assembly code directly.

 

way above my paygrade.

 

 

Link to comment
Share on other sites

Ah, all right then.  I suspect getting around this security code myself is not currently feasible, so I think I will just have to try to integrate my mod into/using the IEMod framework as that seems to be the most reasonable approach at this point.  

Link to comment
Share on other sites

^ Does it basically mean:

- find the needed .cs file using ILSpy

- save and then modify it

- use IEMod framework or this patchwork, to compile the modified class and inject it into Assembly-CSharp.dll?

Edited by MaxQuest
Link to comment
Share on other sites

^ Does it basically mean:

- find the needed .cs file using ILSpy

- save and then modify it

- use IEMod framework or this patchwork, to compile the modified class and inject it into Assembly-CSharp.dll?

 

Something like this yea.  As I understand it, IEMod framework uses the patchwork you linked to, but IEMod is already "setup" for use with Pillars of Eternity (as long as you tell it where the relevant files are on your PC).  Obviously, you need to have IEMod setup on your computer correctly before whatever mod you create can be used.  

 

Here's a link to Ineth's guide for setup in the "IEMod fork, new modding framework" thread

 

http://forums.obsidian.net/topic/81063-iemod-fork-new-modding-framework/page-9?do=findComment&comment=1786087

 

and his edit:

 

 

It seems that my installation guide for the IE mod is missing one step: Copying the iemod folder from the launcher folder into the game's Managed folder.

 

Most of the mod's features work even you skip this step, but at least two features definitely don't work without it:

  • Custom UI
  • Generic names for backer NPCs

 

Edited by Chesschamp09
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

So once you have your file as a *.pw.dll type, the IEMod should be able to run it (as long as you coded things properly).

Unfortunately, I do not have a good idea how I am supposed to convert my .cs file into one of these.  

 

By looking at examples such as this, I believe I might be able to compile it using Visual Studios  and calling the correct .dll's with the "using" aspect of C#; however, my attempts so far have proved unsuccessful.  

 

The main issue (I think) I'm having with linking everything the code I made needs is I don't know where to find everything it references so that it will actually let me compile and presumably make a dll.

Edited by Chesschamp09
Link to comment
Share on other sites

Okay guys, listen. OP almost had the correct approach with the IL(D)ASM routine, you just need to remember a few things:

 

ILDASM must be called with the /quo parameter: ildasm.exe assembly-csharp.dll /out="code.il" /quo /typ

 

The /quo is very important, as it will ensure that variable names are 'quoted', if they are not then the assembly code will not recompile.

You should also add a /typ parameter after /quo to preserve type list and sorting. This will let your mod work with other mods, and is just a generally nice thing to do.

If you're planning on making a program that edits the assembly automatically then you can add a /utf parameter so you know what encoding to use.

 

Now, as for ILASM you need these parameters: ilasm.exe "code.il" /dll /res="code.res" /out="Assembly-CSharp.dll"

 

As for editing the disassembled code, well, sorry to burst your bathtub bubbles, but you'll have to learn the CIL language. I don't know of any tool that can convert disassembled CIL to C#. Fear not - it's easy once you get the hang of it, and is much better to work with than actual assembly code, as we had to do in the past. Here is a good starting point: http://www.codeproject.com/Articles/362076/Understanding-Common-Intermediate-Language-CIL

 

If you want you can also "cheat" by writing code in C# that looks like what you see in ILSpy when you open the game code, then make whatever changes you want in that code, and decompile your DLL and study the CIL to figure out how to make those changes in the actual code. Best to stick to simple stuff, like changing constants and possibly adding breaks to skip if-checks.

Link to comment
Share on other sites

  • 3 weeks later...

So once you have your file as a *.pw.dll type, the IEMod should be able to run it (as long as you coded things properly).

Unfortunately, I do not have a good idea how I am supposed to convert my .cs file into one of these.  

 

By looking at examples such as this, I believe I might be able to compile it using Visual Studios  and calling the correct .dll's with the "using" aspect of C#; however, my attempts so far have proved unsuccessful.

I've managed to do just that. I.e. generate a *.pw.dll. :)

You can take a look how I've modified the NotifyAttackComplete() method from AttackBase.cs, by download the project from the footer of this starting post.

Edited by MaxQuest
Link to comment
Share on other sites

 

So once you have your file as a *.pw.dll type, the IEMod should be able to run it (as long as you coded things properly).

Unfortunately, I do not have a good idea how I am supposed to convert my .cs file into one of these.  

 

By looking at examples such as this, I believe I might be able to compile it using Visual Studios  and calling the correct .dll's with the "using" aspect of C#; however, my attempts so far have proved unsuccessful.

I've managed to do just that. I.e. generate a *.pw.dll. :)

You can take a look how I've modified the NotifyAttackComplete() method from AttackBase.cs, by download the project from the footer of this starting post.

 

Awesome!  I haven't had much time to put into this myself recently so this'll be a big help.  I'll see if I can find time to give it a look over the weekend.  

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

It's done, the mod contains all soulbound items now: https://www.nexusmods.com/pillarsofeternity/mods/155?

 

Downloaded the mod so I could 'fix' the arbalest in the latest patch.  AIUI if all I want to do is modify that weapon, I should only install the files related to the arbalest.  But if I want to keep the requirements for upgrades/classes and ONLY change the reload speed, what should I change, if anything, before installing?

Link to comment
Share on other sites

 

But if I want to keep the requirements for upgrades/classes and ONLY change the reload speed, what should I change, if anything, before installing?

 

In that case you have to modify files yourself. Change the values like I did, more specifically:

- assets with path id 445 and 446 in px4_principi_arbalest.unity3d

- path id 28 in px4_attack_and_reload_1.unity3d and px4_attack_and_reload_2.unity3d

You can use my raw files as reference.

 

In order to be able to extract, modify and repack the files you need Unity Assets Bundle Extractor: https://7daystodie.com/forums/showthread.php?22675-Unity-Assets-Bundle-Extractor

 

 

I was afraid of that, thanks.  I'll consider diving in to that pool, but much later down the road.  Hopeully Obsidian will fix this before I decide whether or not to try to crack it. :)

Link to comment
Share on other sites

Well, I tried taking a look at the pirate outfits with this and - being completely inexperienced as I am with this stuff - didn't get anywhere. ^^

 

I really hope they take the time and fix the bugs related to the new items. Besides the "game mechanics" part, the fact that the pirate outfits are visually broken on male characters puts me off the most, because it hinders me to really enjoy using them.

Edited by Cerebro83
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...