ago

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

Recommended Posts

On 28.6.2017 at 3:00 PM, joedobo said:

Is it possible to use the script-runner to do action performer/ behavior provider? If so, is there an example somewhere?

 

Yes. I initially rebuilt the christmas mod using just scripts.

 

imports/actions.js contains two helpers which check the argument lists and provide an interface to the target, item, tiles and so forth. I'll probably have to update that too to handle the the new case with the height difference.

You essentialy build an object BehaviourProvider with function getBehavioursFor and ActionPerfomer with functions action and getActionId, create a BehaviourParameters and ActionParameters to access the parameter values in the functions.

The BehaviourProvider and ActionPerformer must be registered as usual in the onServerStarted handler. The example below has it in onPlayerMessage handler so I could readd the handler through a message.

 


load('mods/scriptrunner/imports/actions.js');

var Logger = java.util.logging.Logger;

var Items = com.wurmonline.server.Items;
var Item = com.wurmonline.server.items.Item;
var ItemList = com.wurmonline.server.items.ItemList;
var ItemFactory = com.wurmonline.server.items.ItemFactory;
var Actions = com.wurmonline.server.behaviours.Actions;

var ModActions = org.gotti.wurmunlimited.modsupport.actions.ModActions;
var ActionPerformer = org.gotti.wurmunlimited.modsupport.actions.ActionPerformer;
var BehaviourProvider = org.gotti.wurmunlimited.modsupport.actions.BehaviourProvider;
var WrappedBehaviour = org.gotti.wurmunlimited.modsupport.actions.WrappedBehaviour;
var MessagePolicy = org.gotti.wurmunlimited.modloader.interfaces.MessagePolicy;

function log(message) {
	Logger.getLogger('script.festivity.gifts').info(message && message.toString() || 'null');
}

var gifts = {
		8: ItemList.spyglass
}

function awardPresent(performer, auxData) {
	var present = ItemFactory.createItem(ItemList.present, 99.0, null);
	present.setAuxData(auxData);
	performer.getInventory().insertItem(present, true);
}

/**
 * Check for gift BehaviourProvider.
 * 
 * 
 */
var checkForGiftBehaviourProvider = {
		getBehavioursFor : function (performer) {
			var args = new BehaviourParameters(arguments);
			var tile = args.getTile();
			if (tile) {
				log(tile);
				var actions = new java.util.ArrayList();
				actions.add(Actions.actionEntrys[Actions.ASK_GIFT]);
				return actions;
			}
			
			var itemdata = args.getItem();
			if (itemdata && itemdata.item.getTemplateId() === ItemList.snowman) {
				log(itemdata.item);
				var actions = new java.util.ArrayList();
				actions.add(Actions.actionEntrys[Actions.ASK_GIFT]);
				return actions;
			}
			
			return null;
		}
}

var checkForGiftActionPerformer = {
		action : function(action, performer) {
			var args = new ActionParameters(arguments);
			
			awardPresent(performer, 8);
			performer.getCommunicator().sendNormalServerMessage("Here is your present, " + performer.getName() + ".");
			ActionPerformer.setServerPropagation(action, false);
			return true;
		},
	
		getActionId : function() {
			return Actions.ASK_GIFT;
		}
}

var openPresentActionPerformer = {
		action: function(action, performer) {
			var args = new ActionParameters(arguments);
			
			var itemData = args.getItem();
			if (itemData && itemData.item.getTemplateId() === ItemList.present) {
				var target = itemData.item;
				var parentId = target.getParentId();
				var parent = parentId === -10 ? performer.getInventory() : Items.getItem(parentId);
				parent.dropItem(target.getWurmId(), false);
				
				var auxData = target.getAuxData();
				var templateId = gifts[auxData] || ItemList.charcoal;
				var gift = ItemFactory.createItem(templateId, 99.0, performer.getName());
				log(gift);
				parent.insertItem(gift, true);
				Items.decay(target.getWurmId(), target.getDbStrings());
				ActionPerformer.setServerPropagation(action, false);
				return true;
			}
			return false;
		},
		
		getActionId : function() {
			return Actions.OPEN;
		}
}


function addCheckForGiftHooks() {
	ModActions.registerBehaviourProvider(new BehaviourProvider(checkForGiftBehaviourProvider));
	ModActions.registerActionPerformer(new ActionPerformer(checkForGiftActionPerformer));
	ModActions.registerActionPerformer(new ActionPerformer(openPresentActionPerformer));
}

function onPlayerMessage(communicator, message, title) {

	if (message === '/fest') {
		log('Adding action');
		addCheckForGiftHooks();
		return MessagePolicy.DISCARD;
	}
}

 

Edited by ago
  • Like 1

Share this post


Link to post
Share on other sites

I am trying to make a server pack but am having issues. Any ideas on why the file is not found? Server loads it just fine, the client gets it but when it goes to add it, it cannot find the file.

Spoiler

[02:41:40 PM] INFO org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: Got server pack 8F38D1A39E0DA620B6CF9827D68462146BE2E532 (http://xx.xxx.xx.xx:xxxx/packs/8F38D1A39E0DA620B6CF9827D68462146BE2E532)

[02:41:40 PM] INFO org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: Added server pack 8F38D1A39E0DA620B6CF9827D68462146BE2E532 [02:41:40 PM] INFO org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: Got server pack 23F1962AC181C7193D21C9055DD69E76520D21EC (http://xx.xxx.xx.xx:xxxx/packs/23F1962AC181C7193D21C9055DD69E76520D21EC)

[02:41:40 PM] INFO org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: Got server pack 7890B820AD41D1AC211B28BB3A99390CC9ED6178 (http://xx.xxx.xx.xx:xxxx/packs/7890B820AD41D1AC211B28BB3A99390CC9ED6178)

[02:41:40 PM] INFO org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: Added server pack 7890B820AD41D1AC211B28BB3A99390CC9ED6178

 

[02:41:40 PM] SEVERE org.gotti.wurmonline.clientmods.serverpacks.ServerPacksMod: http://xx.xxx.xx.xx:xxxx/packs/23F1962AC181C7193D21C9055DD69E76520D21EC

java.io.FileNotFoundException:http://xx.xxx.xx.xx:xxxx/packs/23F1962AC181C7193D21C9055DD69E76520D21EC at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.URL.openStream(URL.java:1045) at org.gotti.wurmonline.clientmods.serverpacks.PackDownloader.run(PackDownloader.java:35) at java.lang.Thread.run(Thread.java:745)

 
 
 

 

Edited by Governor

Share this post


Link to post
Share on other sites

POST your server log too. may be a set-up issue
Also your serverpacks.properties file too.

Share this post


Link to post
Share on other sites

Is anyone using the Modloader with 1.4.0.1 ? I have tried disabling various mods but nothing seems to work. I just cant get the server up with mods enabled. Log attached:-

 

Spoiler

[06:37:55 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: ModLoader version v0.25-f37e7dd
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\bagofholding.properties
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\bagofholding\bagofholding.jar]
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\bulktransportmod.properties
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\bulktransportmod\bulktransportmod.jar]
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\christmasmod.properties
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\christmasmod\christmasmod.jar]
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\cropmod.properties
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\cropmod\cropmod.jar]
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\digtoground.properties
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\digtoground\digtoground.jar]
[06:37:56 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\harvesthelper.properties
[06:37:57 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\harvesthelper\harvesthelper.jar]
[06:37:57 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\serverpacks.properties
[06:37:57 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\serverpacks\serverpacks.jar]
[06:37:57 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Loading mods\spellmod.properties
[06:37:57 PM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Classpath: [mods\spellmod\spellmod.jar]
[06:37:57 PM] INFO org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod: spellCost: 30
[06:37:57 PM] INFO org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod: spellDifficulty: 20
[06:37:57 PM] INFO org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod: spellCooldown: 300000
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod: effectModifier: 10
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2015: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2016: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2017: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2018: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2019: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.christmasmod.ChristmasMod: present2020: 489
[06:37:58 PM] INFO org.gotti.wurmunlimited.mods.cropmod.CropMod: disableWeeds: true
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.cropmod.CropMod: extraHarvest: 0
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.digtoground.DigToGround: dredgeToShip: true
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.harvesthelper.HarvestHelperMod: allowMountedHarvest: true
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.harvesthelper.HarvestHelperMod: enableSeasonsCommand: true
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.harvesthelper.HarvestHelperMod: enableSeasonsMotd: true
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.serverpacks.ServerPackMod: serverPort: 27100
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.serverpacks.ServerPackMod: publicServerAddress: 145.255.241.186
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.serverpacks.ServerPackMod: publicServerPort: 27100
[06:37:59 PM] INFO org.gotti.wurmunlimited.mods.serverpacks.ServerPackMod: internalServerAddress: 10.44.1.5
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: removePriestRestrictions: true
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: favorLimit: 120
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: allowAllSpells: false
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: allowLightSpells: false
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: unlimitedPrayers: true
[06:38:00 PM] INFO org.gotti.wurmunlimited.mods.spellmod.SpellMod: noPrayerDelay: false
[06:38:01 PM] SEVERE org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher: javassist.CannotCompileException: [source error] getBehavioursFor(com.wurmonline.server.creatures.Creature,int,int,boolean,boolean,int,int) not found in org.gotti.wurmunlimited.modsupport.actions.BehaviourProvider
java.lang.RuntimeException: javassist.CannotCompileException: [source error] getBehavioursFor(com.wurmonline.server.creatures.Creature,int,int,boolean,boolean,int,int) not found in org.gotti.wurmunlimited.modsupport.actions.BehaviourProvider
    at org.gotti.wurmunlimited.modsupport.actions.ModActions.init(ModActions.java:128)
    at org.gotti.wurmunlimited.mods.bagofholding.BagOfHoldingMod.preInit(BagOfHoldingMod.java:90)
    at org.gotti.wurmunlimited.modloader.ModLoaderShared.lambda$loadModsFromModDir$3(ModLoaderShared.java:109)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.gotti.wurmunlimited.modloader.ModLoaderShared.loadModsFromModDir(ModLoaderShared.java:107)
    at org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher.main(DelegatedLauncher.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at javassist.Loader.run(Loader.java:288)
    at org.gotti.wurmunlimited.serverlauncher.ServerLauncher.main(ServerLauncher.java:33)
Caused by: javassist.CannotCompileException: [source error] getBehavioursFor(com.wurmonline.server.creatures.Creature,int,int,boolean,boolean,int,int) not found in org.gotti.wurmunlimited.modsupport.actions.BehaviourProvider
    at javassist.expr.MethodCall.replace(MethodCall.java:241)
    at org.gotti.wurmunlimited.modsupport.actions.ModActions$1.edit(ModActions.java:100)
    at javassist.expr.ExprEditor.loopBody(ExprEditor.java:192)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:91)
    at javassist.CtBehavior.instrument(CtBehavior.java:712)
    at org.gotti.wurmunlimited.modsupport.actions.ModActions.init(ModActions.java:87)
    ... 19 more

 

Share this post


Link to post
Share on other sites

There was a beta version avaiable for a few days. I just had to bump the version number and check if it's still working.

  • Like 1

Share this post


Link to post
Share on other sites

It is working Ago, seems theres issues with several mods but the modloader is doing great. Removal of priest restrictions seems to have an issue.

 

Share this post


Link to post
Share on other sites

I am getting no warnings in my IDE, but most everything doesn't want to work. Behaviours don't seem to be getting added, spellmod isn't working, can't communicate with login server from other servers.

Share this post


Link to post
Share on other sites

Seems the WUA server manager is causing many of my issues, disabling that mod an many things came back to working.

Share this post


Link to post
Share on other sites

If you have any mods with any custom actions it seems to be disconnecting clients when right clicking a tile border corner. Does not happen in vanilla so assume its something funky with the update and modloader.

Edited by Xyp

Share this post


Link to post
Share on other sites

https://github.com/ago1024/WurmServerModLauncher/releases/tag/v0.26.1

Version 0.26.1

Modloader

  • Fix disconnect when clicking a corner

 

At least one class was missing specific implementations for the new action methods with heightOffset on corners. This resulted in a null being returned instead of an empty list.

I could not get any custom actions to run on corners so there may be a another update tomorrow. Right now i'm to tired to figure out why those handlers are never called.

Share this post


Link to post
Share on other sites

thanks Ago, great work. I wouldn't worry too hard right now, was told the new fences in the next update will likely cause a lot more changes.

Share this post


Link to post
Share on other sites

When you start the server with the loader, it does not transition the GUI to the "Stop Server" window and instead stays on the Start Server window.

 

Is this a problem for properly shutting the server down?

 

<3 patches - still getting periodic crashes and trying to work it out.

Share this post


Link to post
Share on other sites

SEVERE com.wurmonline.server.Server: com/wurmonline/server/CounterTypes
java.lang.NoClassDefFoundError: com/wurmonline/server/CounterTypes

 

 

Think this is mod related?

Share this post


Link to post
Share on other sites
1 hour ago, Draco said:

SEVERE com.wurmonline.server.Server: com/wurmonline/server/CounterTypes
java.lang.NoClassDefFoundError: com/wurmonline/server/CounterTypes

 

 

Think this is mod related?

 

That class was moved to a different package in 1.4... something still refers to it at the old location. The rest of the stack trace should tell you what.

 

1 hour ago, Draco said:

When you start the server with the loader, it does not transition the GUI to the "Stop Server" window and instead stays on the Start Server window.

 

 

Very likely something errored out on startup. Post your log.

Share this post


Link to post
Share on other sites

https://www.dropbox.com/s/ik8h062rptdmb8i/server.log?dl=0

 

Sorry for the slow response. Sleep...

 

Not sure what part ya need so I dropped it in dropbox.

 

Spoiler

[02:02:47 AM] INFO com.wurmonline.server.Server: current mem in use: 1018M free mem: 502M Max mem: 2010M
player count: 4
bytes in: 318781 bytes out: 536928 total in: 4592221 total out: 15587856
Server uptime: 9900 seconds. Unanswered questions:0
[02:03:28 AM] WARNING com.wurmonline.server.creatures.Communicator: Argent last counts=50000
[02:05:04 AM] SEVERE com.wurmonline.server.Server: com/wurmonline/server/CounterTypes
java.lang.NoClassDefFoundError: com/wurmonline/server/CounterTypes
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at javassist.Loader.findClass(Loader.java:377)
    at org.gotti.wurmunlimited.modloader.classhooks.HookManager$1.findClass(HookManager.java:107)
    at javassist.Loader.loadClass(Loader.java:309)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.wurmonline.server.behaviours.Methods.sendFoundVillageQuestion(Methods.java:424)
    at com.wurmonline.server.behaviours.VillageDeedBehaviour.action(VillageDeedBehaviour.java:276)
    at com.wurmonline.server.behaviours.Action.poll(Action.java:3517)
    at com.wurmonline.server.behaviours.BehaviourDispatcher.action(BehaviourDispatcher.java:965)
    at com.wurmonline.server.creatures.Communicator.reallyHandle_CMD_ACTION(Communicator.java:7193)
    at com.wurmonline.server.creatures.Communicator.reallyHandle(Communicator.java:2408)
    at com.wurmonline.communication.SocketConnection.tick(SocketConnection.java:615)
    at com.wurmonline.communication.SocketServer.tick(SocketServer.java:172)
    at com.wurmonline.server.Server.run(Server.java:2459)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: com.wurmonline.server.CounterTypes
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at javassist.Loader.delegateToParent(Loader.java:426)
    at javassist.Loader.loadClass(Loader.java:312)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 18 more

[02:05:04 AM] INFO com.wurmonline.server.Server: Shutting down at:
java.lang.Exception
    at com.wurmonline.server.Server.shutDown(Server.java:3560)
    at com.wurmonline.server.Server.run(Server.java:2531)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

 

Share this post


Link to post
Share on other sites

nm got confused with another thread

Edited by bigsteve
error

Share this post


Link to post
Share on other sites

The counterTypes and not having the server shutdown hooks on the GUI were related to having WUAmod from coolboy. I got rid of both of those problems by disabling WUA

Share this post


Link to post
Share on other sites

Would that be upkeep mod or bounty mod?  I think at this point those are the only 2 I'm running that are not from Ago 

 

 

***** Turned out to be Upkeep mod -- Problem solved, I hope

Edited by Draco
.

Share this post


Link to post
Share on other sites

Edit: Rushing to get things fixed I moved over the actiondemo..Thanks for the help

Edited by Jerone0601

Share this post


Link to post
Share on other sites

Remove ActionDemo mod. This does nothing besides demonstrating some custom action options.

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