ago

[RELEASED] Server mod loader + priest + crops + seasons + server packs + bag of holding

Recommended Posts

....the modlauncher.jar doesnt come with the source files does it, because i think thats what i was downloading. it wasnt there i just downloaded a new one and it was there and its working now. thank you very much for your help and im officially a noob.


Share this post


Link to post
Share on other sites

Edit:  NEVER MIND, FIGURED IT OUT.


 


Turns out that I just needed to read some JavaAssist documentation.  It wasn't finding the method because the getMethod function requires me to give it the proper return variable and input parameters.  The return variable was a boolean type, but the input parameters should have been two int types for those two specific functions.


 


Now time to test and hopefully release the mod!


 


 


 


I could use some help writing a mod for your modloader.


 


I am trying to make it so that grass tiles are always foragable and botanizable.  I have identified that this is determined in com.wurmonline.server.behaviors.TileBehavior where the functions botanizeV11 and forageV11 call isBotanizable and isForagable respectively to determine if the tile has stuff on it or has been picked bare.


 


isBotanizable and isForagable are defined in com.wurmonline.server.Server.  However, when I attempt to use getMethod on them, I get the error


 


org.gotti.wurmunlimited.modloader.classhooks.HookException: javassist.NotFoundException: isForagable(..) is not found in com.wurmonline.server.Server


 


Full startup log for the error here on pastebin.


 


My code is very simple, directly adapted from Ulviirala's BetterGamemasters mod also using your modloader.  It is located below:



//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.wurmonline.cantorsdust.mods;

import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtPrimitiveType;
import javassist.NotFoundException;
import javassist.bytecode.Descriptor;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.interfaces.Configurable;
import org.gotti.wurmunlimited.modloader.interfaces.PreInitable;
import org.gotti.wurmunlimited.modloader.interfaces.WurmMod;

public class AlwaysForage implements WurmMod, Configurable, PreInitable {
private Logger _logger = Logger.getLogger(this.getClass().getName());
private boolean _foragingOn = true;
private int _foragingOnPower = 1;
private boolean _botanizingOn = true;
private int _botanizingOnPower = 1;

public AlwaysForage() {
}

public void configure(Properties properties) {
this._foragingOn = Boolean.valueOf(properties.getProperty("foragingOn", Boolean.toString(this._foragingOn))).booleanValue();
this._foragingOnPower = Integer.valueOf(properties.getProperty("foragingOnPower", Integer.toString(this._foragingOnPower))).intValue();
this.Log("Foraging On: ", this._foragingOn, this._foragingOnPower);
this._botanizingOn = Boolean.valueOf(properties.getProperty("botanizingOn", Boolean.toString(this._botanizingOn))).booleanValue();
this._botanizingOnPower = Integer.valueOf(properties.getProperty("botanizingOnPower", Integer.toString(this._botanizingOnPower))).intValue();
this.Log("Botanizing On: ", this._botanizingOn, this._botanizingOnPower);
}

private void Log(String forFeature, boolean activated, int power) {
this._logger.log(Level.INFO, forFeature + activated + (activated?" for MGMT powers " + power + " and above.":"."));
}

public void preInit() {
if(this._foragingOn) {
this.ForagingFunction();
}
if(this._botanizingOn) {
this.BotanizingFunction();
}
}

private void ForagingFunction() {
try {
CtClass ex = HookManager.getInstance().getClassPool().get("com.wurmonline.server.Server");
CtClass[] parameters = new CtClass[]{CtPrimitiveType.intType};
CtMethod method = ex.getMethod("isForagable", Descriptor.ofMethod(CtPrimitiveType.booleanType, parameters));
method.insertBefore("{ if (this.getPower() >= " + this._foragingOnPower + ") return true; }");
method = null;
parameters = null;
ex = null;
} catch (NotFoundException | CannotCompileException var4) {
throw new HookException(var4);
}
}

private void BotanizingFunction() {
try {
CtClass ex = HookManager.getInstance().getClassPool().get("com.wurmonline.server.Server");
CtClass[] parameters = new CtClass[]{CtPrimitiveType.intType};
CtMethod method = ex.getMethod("isBotanizable", Descriptor.ofMethod(CtPrimitiveType.booleanType, parameters));
method.insertBefore("{ if (this.getPower() >= " + this._botanizingOnPower + ") return true; }");
method = null;
parameters = null;
ex = null;
} catch (NotFoundException | CannotCompileException var4) {
throw new HookException(var4);
}
}
}


I don't actually know any Java.  Only some basic python scripting experience.  Do you have any idea why it isn't finding my method?  I have confirmed that isForagable and isBotanizable are located in com.wurmonline.server.Server.


 


edit:  The only difference I can tell between my situation and the one used in BetterGamemasters reference code is that isForagable and isBotanizable are functions of the form "public static boolean" and the reference code's function is of the form "public boolean".  Again, I know literally nothing about Java.  Would that affect how the Descriptor.ofMethod(CtPrimitiveType.booleanType, parameters) part works?


Edited by cantorsdust

Share this post


Link to post
Share on other sites

The Bag of Holding spell is really overpowered. I casted it on a waterskin with a power of [5] and now the waterskin can hold 13.00 weight in water. The normal is like 2.5 weight!


Share this post


Link to post
Share on other sites

Released my mod using your modloader.  Allows you to always forage, botanize, or rummage on a tile repeatedly without waiting 24 hours since the last forage attempt.


Share this post


Link to post
Share on other sites

Now if someone could create a mod to remove the restrictions on meditation...


Share this post


Link to post
Share on other sites

Now if someone could create a mod to remove the restrictions on meditation...

 

Working on that right now, actually.  Assuming ago doesn't beat me to it.

 

EDIT: Just to confirm, when you say restrictions, you mean the time and distance requirements between meditations for skillgain?  Or did you mean something else?

Edited by WalkerInTheVoid

Share this post


Link to post
Share on other sites

Yup, the 20 minute between meditations, 5 x a day and 20 tiles away.


Share this post


Link to post
Share on other sites

The Bag of Holding spell is really overpowered. I casted it on a waterskin with a power of [5] and now the waterskin can hold 13.00 weight in water. The normal is like 2.5 weight!

Yes, I know. I'll probably add some quadratic scaling to make a 100 cast give 10x additional volume and a 50 cast give 2.5x additional volume

  • Like 1

Share this post


Link to post
Share on other sites

Saw that you modified the courier spell for a new use.  Would you be able to do it with other spells like making Web Armor, Aura of Shared Pain, Demise Shields (Fo's Touch, Libilia's Shielding etc) work on jewelry?


 


Or in the same vein as the courier rework, could you rework Nolocate to do something else?


 


Just curious if there is a way to make jewelry worth using/making for solo play.


Share this post


Link to post
Share on other sites

Hey Ago, are you familiar with Feed The Beast and Tekkit for Minecraft? They work for both servers and clients to be able to set up better mod verification and consolidation. Basically, the server owner sets up a package of mods, then provides a link. The clients enter that link into the launcher, which installs all the mods for that server. Of course, that requires a central storage location to upload and download to/from, but it could be something to look into. :)


Share this post


Link to post
Share on other sites

I was thinking about it for texture packs and whatnot. New Animals would require textures be placed in the proper places, etc.


Share this post


Link to post
Share on other sites

manual for modloader?

There isn't much besides the wiki on github: https://github.com/ago1024/WurmServerModLauncher/wiki

 

Saw that you modified the courier spell for a new use. Would you be able to do it with other spells like making Web Armor, Aura of Shared Pain, Demise Shields (Fo's Touch, Libilia's Shielding etc) work on jewelry?

Or in the same vein as the courier rework, could you rework Nolocate to do something else?

Just curious if there is a way to make jewelry worth using/making for solo play.

I reused the courier spell because there are only 255 (or maybe just 127) possible spelleffects and if I picked one free number there would probably be a conflict when Rolf introduced a new spell. So I just went with courier, well aware that courier on a forge would probably break my mod.

There sure are possibilites like less visibility vs. aggressive creatures for jewelry but I don't plan on doing that (soon).

Edited by ago

Share this post


Link to post
Share on other sites

There isn't much besides the wiki on github: https://github.com/ago1024/WurmServerModLauncher/wiki

 

I reused the courier spell because there are only 255 (or maybe just 127) possible spelleffects and if I picked one free number there would probably be a conflict when Rolf introduced a new spell. So I just went with courier, well aware that courier on a forge would probably break my mod.

There sure are possibilites like less visibility vs. aggressive creatures for jewelry but I don't plan on doing that (soon).

 

Makes sense for new spells, do you know if its possible to allow the armour based spells to also work on jewelry?

Share this post


Link to post
Share on other sites

One thing I am noticing is that with priests having restrictions off the alignment ends up all over the place. Not sure if anyone else has that happen? Is there a way to have the mod lock alignment so it wont change?


Share this post


Link to post
Share on other sites

Have you had any success using setBody(String src)?


Edited by Luceat

Share this post


Link to post
Share on other sites

Is there any way to get this running headless? 


 


I run a batch file that runs " start WurmServerLauncher.exe start=RazorsEdge4096 "   No quotes.   


 


I do this so i can run the server in FireDaemon as a service.  It will auto restart the server in case of a crash and does not require the "START SERVER" button


 


Any help is appreciated.


 


 


Jim


Edited by razoreqx

Share this post


Link to post
Share on other sites

You can pass the Start=RazorsEdge4096 parameter and any other server paramters to the bat file too.

Share this post


Link to post
Share on other sites

You can pass the Start=RazorsEdge4096 parameter and any other server paramters to the bat file too.

 

 

Thanks Ago.  I was guessing it might work but had not tested it.  Will do that tonight.     

 

So without fear of sounding like a newbie.   

Im running Wurm in 

C:\wurm and the map file is listed above.    This is a windows server obviously.    

 

1. What would the modlauncher.bat file need to look like in my situation?     

 

2. Or am i just replacing the command in my startserver.bat file to look like this:

"start modlauncher.bat start=RazorsEdge4096"  

 

Ive copied your bat file: 

 

f exist logging.properties set LOGGING=-Djava.util.logging.config.file=logging.properties

runtime\bin\java "-Dworkdir=%CD%" "-Djava.library.path=%CD%\nativelibs" %LOGGING% -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar modlauncher.jar  %*

Edited by razoreqx

Share this post


Link to post
Share on other sites

start modlauncher.bat start=RazorsEdge4096

Yes, this should work.

There was a report that firedaemon has some problems with starting .bat files. So to start java directly from firedaemon the command would be

C:\Wurm\runtime\bin\java -Dworkdir=C:\Wurm -Djava.library.path=C:\Wurm\nativelibs -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar C:\Wurm\modlauncher.jar  Start=RazorsEdge4096
  • Like 1

Share this post


Link to post
Share on other sites

Yes, this should work.

There was a report that firedaemon has some problems with starting .bat files. So to start java directly from firedaemon the command would be

 

C:\Wurm\runtime\bin\java -Dworkdir=C:\Wurm -Djava.library.path=C:\Wurm\nativelibs -Xmn256M -Xms512m -Xmx2048m -XX:+OptimizeStringConcat -XX:+AggressiveOpts -jar C:\Wurm\modlauncher.jar  Start=RazorsEdge4096

 

 

You rock!!   Thanks Brother!!!  

Share this post


Link to post
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