ago

[RELEASED] Client mod loader

Recommended Posts

1 hour ago, Romen said:

Appreciate the quick response Razor - was actually thinking of trying out your server, but wanted to make sure it wouldn't mess up the vanilla game I have going with a friend on my own server and that I could switch back and forth between the two.

The only thing you will have to worry about is toolbelt saves from server to server if you use the same toon name. Until someone *cough* creates the client mod *cough* for making toobelt and skill tracker save for each server you visit.

 

Share this post


Link to post
Share on other sites

can you modify this launcher so that you can directly connect to your favorite server? maybe with a setting in a properties file?

 

Eject

Share this post


Link to post
Share on other sites

Made a video for installing the loader. 

 

 

 

Ago’s Modloader

The modloader is what's needed to get the custom updates for our server. Everyone should have this, and it's the first thing you should do after joining the server and creating a character.

https://github.com/ago1024/WurmClientModLauncher/releases/latest

- Download from link above
- Unzip the contents of the compressed folder into this directory:

C:\Program Files (x86)\Steam\steamapps\common\Wurm Unlimited\WurmLauncher
Note that the contents of the modloader.zip folder need to be dragged into the WurmLauncher directory, not just the whole unzipped Modloader folder itself.

- Once the contents are in the folder, you should see a “mods” folder, javassist jar file, modlauncher jar file, patcher .bat file and patcher jar file.

- Go into the “mods” folder and rename the custommap.disabled and connectionfix.disabled serverpacks.disabled file to serverpacks.properties, custommap.properties and connectionfix.properties.


General Instructions for Installing New Patches:

- Go back to the Wurmlauncher directory and find the patcher.bat file and double click to run it. If the patcher ran successfully you'll see a new file called "client-patched.jar" in the same folder. Nothing else is required.

- Restart Wurm from Steam

- Make sure you STAY logged in for at least 8-10 mins before disconnecting again – the client needs to download the files.

- To make sure the mods were added, look to the menu bar of your Wurm gui and click the “Console” button. Scroll to the middle/end of data and look for
INFO: Got server pack (ServerPackIDNumber)

You should see one of these lines for each server pack being installed.


- If you have those messages, enjoy the game for about 10 mins then check your console again for
INFO: Added server pack (ServerPackIDNumber)

Again, you should see one of these lines for each server pack installed.

- Only when you see those final INFO messages should you relog. Upon relogging, you should have access to the mods.

Edited by razoreqx
  • Like 2

Share this post


Link to post
Share on other sites
37 minutes ago, Trake said:

Which coins are you mining, Razor? :)

Nice guide.

 

 

Oh back in the day?   feather :) 

Share this post


Link to post
Share on other sites

Small issue/suggestion:

 

Currently if i try to use normal java reflection into wurm code in init or preInit - it causes the class to be properly loaded and frozen, which means javaassist can't modify it later if some other mod wants to do that.

 

What i'd suggest is adding another "step" - postInit and defining in documentation (i'm not sure if enforcing that in code would be possible) what mods should do in every initialization "step". Eg:

 

  • Pre - setup their own internal stuff
  • Init - add hooks and patch classes, no interaction with wurm classes in "normal" code
  • Post - wurm classes can be accessed from normal code, javaassist stuff is not allowed anymore

 

Share this post


Link to post
Share on other sites
11 hours ago, bdew said:

Small issue/suggestion:

 

Currently if i try to use normal java reflection into wurm code in init or preInit - it causes the class to be properly loaded and frozen, which means javaassist can't modify it later if some other mod wants to do that.

 

 

Did you use the hooks as described here: https://github.com/ago1024/WurmServerModLauncher/wiki/ModStructure?

I know that is for server but the concept is the same for the client.

 

 

I do agree somewhat here as when I made Season Configure Mod I wanted to find whatever was equivalent to the server's onServerstarted() and ServerStartedListener. Those don't exists in the client so I had to make the "Registering Hooks" technique explained in that link above.

Share this post


Link to post
Share on other sites
27 minutes ago, joedobo said:

 

Did you use the hooks as described here: https://github.com/ago1024/WurmServerModLauncher/wiki/ModStructure?

I know that is for server but the concept is the same for the client.

 

 

I do agree somewhat here as when I made Season Configure Mod I wanted to find whatever was equivalent to the server's onServerstarted() and ServerStartedListener. Those don't exists in the client so I had to make the "Registering Hooks" technique explained in that link above.

 

I did. The problem is if you touch any wurm class in a "normal" way - e.g. using reflection on it or accessing a public field - it makes the class "frozen" and from that point any attempt to add hooks or rewrite methods in it will fail. This can break mods loaded after you.

 

Hence my suggestion - add another event that will fire after every mod has finished hooking/replacing stuff.

 

Share this post


Link to post
Share on other sites
4 minutes ago, bdew said:

 

I did. The problem is if you touch any wurm class in a "normal" way - e.g. using reflection on it or accessing a public field - it makes the class "frozen" and from that point any attempt to add hooks or rewrite methods in it will fail. This can break mods loaded after you.

 

Hence my suggestion - add another event that will fire after every mod has finished hooking/replacing stuff.

 

I understand Javassist only works by modifying classes before they are loaded, a load this code instead type of process. Further, if you try to use Javassist to modify classes that have already been loaded it will error. This is why we have the modLauncher so it can coordinate loading of classes and let javassist do its thing first. Whereas reflection modifies things that have already been loaded and initialized. 

 

I thought the hook managr's purpose was to run reflection related stuff once the classes have been loaded, constructor run, etc. I didn't know that the hook manager is forcing classes to be loaded and initiated.

 

 

Share this post


Link to post
Share on other sites

The whole interface is not designed very well (or not at all).

 

I added preInit because init was meant to add the hooks. The hooks rename the original methods and replace them with stubs that call the InvocationHandler. preInit is meant to change the original methods before they are renamed and replaced by the hook manager.

 

There is currently no such thing like onServerStarted but I usually use a hook to accomplish them same. The LIveMap hooks into HeadsUpDisplay.init() and performs any non-javassist initialisation at this point. A postInit method would probably run before the client really starts (before WurmMain.main(String[]) is run) but some code really needs to run after the client is started. This would probably require a onClientStarted hook in some way.

 

The classes may also load if the mods main class references them in certain ways. In some cases this can be resolved by putting the code in a inner classes which are loaded later. The InvocationHandlerFactory is such an example. I also used Runnable in some cases to decouple the code from the mods main class if it caused the wurm classes to load. The server already prints warnings if a wurm class is loaded early. I may have to port this to the client too.

Share this post


Link to post
Share on other sites

a little question....if i change the png file from time to time, would it be updated from the client? i think about i like to use this for news or maybe for a map with updated deeds

 

great mod ago :)

Share this post


Link to post
Share on other sites
4 hours ago, Eject said:

a little question....if i change the png file from time to time, would it be updated from the client? i think about i like to use this for news or maybe for a map with updated deeds

Yes. Replacing the map in the jar will change the contents and create a new download id. But the contents are only checked on server start. Replacing the map would require a server restart.

Share this post


Link to post
Share on other sites

thank you ago, thats awesome

 

Edit: whith this, i can always implement the newest news

Edited by Eject

Share this post


Link to post
Share on other sites

https://github.com/ago1024/WurmClientModLauncher/releases/tag/v0.3.1

 

Version 0.3.1

  • Serverpacks can provide a custom mapunlimited.xml
  • Serverpacks can provide custom textures for armor
  • Linux patcher.sh script
  • Patcher.bat will pause after execution

 

For demonstration purposes I've added two serverpacks for a custom map (with annotations) and custom tabards.

https://github.com/ago1024/WurmClientModLauncher/releases/download/v0.3.1/demopack.with.custom.map.jar

https://github.com/ago1024/WurmClientModLauncher/releases/download/v0.3.1/demopack.with.custom.tabard.jar

 

The map is for an adventure server with the mapname "Playtime"

The custom tabards use an existing PMK texture for the PMK "test". It's possible to override the textures for existing kingdoms but wagons and banners for existing kingdoms can't be replaced that easily. But it should be possible to add new wagon and banner entries for the PMK by copying the wagon and banner model data to the serverpack and adding an entry to mappings.txt with the PMK name at the end.

Edited by ago
  • Like 1

Share this post


Link to post
Share on other sites
40 minutes ago, ago said:

https://github.com/ago1024/WurmClientModLauncher/releases/tag/v0.3.1

 

Version 0.3.1

  • Serverpacks can provide a custom mapunlimited.xml
  • Serverpacks can provide custom textures for armor
  • Linux patcher.sh script
  • Patcher.bat will pause after execution

 

For demonstration purposes I've added two serverpacks for a custom map (with annotations) and custom tabards.

https://github.com/ago1024/WurmClientModLauncher/releases/download/v0.3.1/demopack.with.custom.map.jar

https://github.com/ago1024/WurmClientModLauncher/releases/download/v0.3.1/demopack.with.custom.tabard.jar

 

The map is for an adventure server with the mapname "Playtime"

The custom tabards use an existing PMK texture for the PMK "test". It's possible to override the textures for existing kingdoms but wagons and banners for existing kingdoms can't be replaced that easily. But it should be possible to add new wagon and banner entries for the PMK by copying the wagon and banner model data to the serverpack and adding an entry to mappings.txt with the PMK name at the end.

I Love You AGO! Been waiting for this

-Mavis

Share this post


Link to post
Share on other sites

@ago, is this the mod to create a worldmap picture with links? 

Share this post


Link to post
Share on other sites
23 hours ago, Eject said:

is this the mod to create a worldmap picture with links?

Yes.

 

Version 0.3.1 can read a wurmunlimited.xml in a server pack and present the map structure to the user. This includes any submaps which could then display any image with announcements.

Share this post


Link to post
Share on other sites

sounds awesome ago but could you explain me how to create the xml file and is there an example for the xml file?

 

edit: and this files are all for the client side right?

 

thank you eject

Edited by Eject

Share this post


Link to post
Share on other sites

Mind you I like the simplistic Classic skin in Wurm....however, other's no doubt want more options....

 

What's the possibility of the client modloader gaining the ability to patch into the GUI aspect of WU and being able to allow custom user skin/themes?  a skin folder could be used to hold any downloaded themes in whatever format would be used.  Modloader could possibly allow for themes to appear in the settings menu in the launcher and/or ingame?

  • Like 1

Share this post


Link to post
Share on other sites

it should already be possible for a mod to set a different current theme name and provide a pack with matching gui graphics. Such a mod just hasn't been made yet.

  • Like 1

Share this post


Link to post
Share on other sites

Ago, I'd make a small request. Can you put the version number of the modlaunchers (server and client) in the name of either the download zip or the jar? Maybe that info is already there and I just don't know where to look.

Share this post


Link to post
Share on other sites

The jars contain the file META-INF/MANIFEST.MF which contains the version number of the build:

Implementation-Version: v0.13.1-9162af7

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.