Sign in to follow this  
joedobo

[ABANDONED] Loading Unchained.

Recommended Posts

two ways to lower strength load requirment( I'm sure there are more):

1. make a new load action with modloaders action performer. That is somewhat complicated. 

2. use Javassist ExprEditor on the loadCargo and loadShip methods in CargoTransportationMethods class. Here is some code for loadCargo. Someone would need to set them up in modloader and compile into a mod in order to use it.

Spoiler

double loadStrength = 1.0d;
try {
	DecimalFormat decimalFormat = new DecimalFormat("#.###");
	String formattedLoad = decimalFormat.format(loadStrength);
	CtClass ctClassCargoTransportationMethods = HookManager.getInstance().getClassPool().get(
			"com.wurmonline.server.behaviours.CargoTransportationMethods");
	CtClass returnType = CtPrimitiveType.booleanType;
	CtClass[] paramTypes = {
			HookManager.getInstance().getClassPool().get("com.wurmonline.server.creatures.Creature"),
			HookManager.getInstance().getClassPool().get("com.wurmonline.server.items.Item"),
			CtPrimitiveType.floatType
	};
	CtMethod loadCargo = ctClassCargoTransportationMethods.getMethod("loadCargo", 
			Descriptor.ofMethod(returnType, paramTypes));
	loadCargo.instrument(new ExprEditor() {
		@Override
		public void edit(MethodCall methodCall) throws CannotCompileException {
			if (Objects.equals("strengthCheck", methodCall.getMethodName())) {
				methodCall.replace("$2 = " + formattedLoad + "; $_ = $proceed($$);");
			}
		}
	});
} catch (NotFoundException | CannotCompileException e) {
	;
}

 

 

  • Like 1

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
Sign in to follow this