Mthec

[Released] Mthec's NPCs - Crafter, Buyer, DeliveryContracts, MerchantCap, CustomTrader, ToolPurchaser, Banker, BeastSummoner

Recommended Posts

15 hours ago, Batta said:

I felt sure that this used to apply to our regular personal merchants, but now they will take only 100 items again.  Am I remembering incorrectly?  Or perhaps when we were disabling mods, we accidentally disabled something required thing to make this work?  

That is how it should work.

 

In the logs, just after the server is up and running (between "Starting the server" and "Wurm Server launcher finished at..."), you should get a line saying "Buyer and merchant max items set to <your max setting>".

 

The only limitations are:

  1. Players can only carry 100 items (GMs are not limited), so they can't receive in trade more than 100 minus the number of currently carried items.
  2. You can only drag 100 items between windows at a time.  Since items don't leave your inventory until the trade is complete, you will need to select the lower items separately when dragging.  i.e. You can't just drag across a stack as it will only drag the first 100 items.

Anything else, just let me know what message you are getting and I'll take another look.

Share this post


Link to post
Share on other sites
2 hours ago, Mthec said:

That is how it should work.

 

In the logs, just after the server is up and running (between "Starting the server" and "Wurm Server launcher finished at..."), you should get a line saying "Buyer and merchant max items set to <your max setting>".

 

I'm checking in server.log, on a hosted server, and I'm not getting any of the three lines you mentioned.  I've checked back to previous logs, as well.  

Is it a different log I'm supposed to be checking, other than server.log?

 

I checked on my WU Dedicated server.log too, and don't find these lines there either.  When I start the LAN, I see "Starting the server" briefly flash by, then a bunch of lines flashing past so fast I can't see them, and then "Wurm Server launcher finished at" but when I scroll up on the black screen with white writing, it doesn't go back as far as "Starting the server" so I can see only some of it.

 

In the server.log, I see this, so I know it's loading.  But no sign of "Buyer and merchant max items"

Quote

[10:14:54 AM] INFO org.gotti.wurmunlimited.modloader.ModLoaderShared: Reading mods\buyermerchant.properties

 

EDIT:  I searched the log by Buyer, buyer, Max, max, Merchant, and merchant, but still didn't find it.  

I also tried to post the log in a spoiler here, but froze the screen for 5 minutes and then got a message saying it wasn't possible to edit this post at this time.  

I guess it was too long?

Edited by Batta
  • Like 1

Share this post


Link to post
Share on other sites

BuyerMerchant fix

Download

 

Fixed apply_max_to_merchants was not being applied when destroy_bought_items was also true.

 

53 minutes ago, Batta said:

In the server.log, I see this, so I know it's loading.  But no sign of "Buyer and merchant max items"

I think I may have found the issue, do you also have destroy_bought_items set to true?  If so, then the above fix should sort things out.

 

Otherwise, sorry, I was looking at the output rather than the server.log.

 

In my server.log I get:

[03:42:45 PM] INFO com.wurmonline.server.steam.SteamHandler: Starting the server
***
[03:42:47 PM] INFO com.wurmonline.server.steam.SteamHandler: Server connected to steam

With the *** being any number of lines depending on how many mods you have that put messages here.  Although I think the "Server connected to steam" line can vary in timing, so it may appear in the middle.

In there, you should find a line like:

[03:42:46 PM] INFO mod.wurmunlimited.buyermerchant.BuyerMerchant: Buyer and merchant max items set to 200

 

 

 

  • Like 1

Share this post


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

BuyerMerchant fix

Download

 

Fixed apply_max_to_merchants was not being applied when destroy_bought_items was also true.

 

I think I may have found the issue, do you also have destroy_bought_items set to true?  If so, then the above fix should sort things out.

 

Yes!  I did have that setting.  Thank you very much for the fix.

 

  • Like 1

Share this post


Link to post
Share on other sites

@Mthec is there anyway to have a buyer that buys everything at the same price as the trader/salesmen does for example if the normal trader buys a Black Opal for 3s then the buyer would accept any item and sell it for that price so i could sell the Black Opal to him and get 3s without setting up the sell list and prices etc?

 

if so how ? - i'd be fine editing the source my end - if i knew where to look 

Share this post


Link to post
Share on other sites
22 hours ago, Triadian said:

@Mthec is there anyway to have a buyer that buys everything at the same price as the trader/salesmen does for example if the normal trader buys a Black Opal for 3s then the buyer would accept any item and sell it for that price so i could sell the Black Opal to him and get 3s without setting up the sell list and prices etc?

 

if so how ? - i'd be fine editing the source my end - if i knew where to look 

If you're sure, that shouldn't be too difficult.

 

Firstly, prices are defined in BuyerHandler.getTraderBuyPriceForItem.  If you want to add any item exceptions you can do it here (e.g. you only want to accept gems), and then just call the parent method.  So something like:

@Override
public int getTraderBuyPriceForItem(Item item) {
    PriceList.Entry entry = priceList.getEntryFor(item);
    if (entry == null)
        super.getTraderBuyPriceForItem(item);
    return getTraderBuyPriceForItem(entry, item);
}

Which will also handle all the local buy price stuff I have never really looked into.

 

The other part you'll need to change is in suckInterestingItems, which decides what items traders will accept, and for Buyers ignores anything not on their PriceList.  Starting here.

Then you'll need to extract, or copy, this section to add the items to the trade.  The stuff inbetween only relates to PriceLists.

 

I think that should be it, just let me know if you have any problems.

  • Like 1

Share this post


Link to post
Share on other sites

Getting an error trying to trade crafters a 2nd time. Says there is items waiting for collection but there is none. this makes all crafters on the server untradable.

 


[09:12:18 AM] WARNING com.wurmonline.server.creatures.CrafterTradeHandler: Item for completed Job could not be found, removing from workbook.
[09:12:18 AM] SEVERE org.gotti.wurmunlimited.modsupport.actions.WrappedBehaviour: null
java.util.ConcurrentModificationException
    at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
    at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
    at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
    at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169)
    at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
    at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
    at mod.wurmunlimited.npcs.WorkBook$1.hasNext(WorkBook.java:194)
    at com.wurmonline.server.creatures.CrafterTradeHandler.addItemsToTrade(CrafterTradeHandler.java:111)
    at com.wurmonline.server.behaviours.TradeAction.action(TradeAction.java:113)
    at org.gotti.wurmunlimited.modsupport.actions.ActionPerformerBehaviour.action(ActionPerformerBehaviour.java:92)
    at org.gotti.wurmunlimited.modsupport.actions.WrappedBehaviour.lambda$action$11(WrappedBehaviour.java:110)
    at org.gotti.wurmunlimited.modsupport.actions.WrappedBehaviour.action(WrappedBehaviour.java:211)
    at org.gotti.wurmunlimited.modsupport.actions.WrappedBehaviour.action(WrappedBehaviour.java:110)
    at org.gotti.wurmunlimited.modsupport.actions.ActionPerformerChain.action(ActionPerformerChain.java:85)
    at com.wurmonline.server.behaviours.Action.poll(Action.java:3548)
    at com.wurmonline.server.behaviours.ActionStack.poll(ActionStack.java:247)
    at com.wurmonline.server.players.Player.pollActions(Player.java:6695)
    at com.wurmonline.server.Players.pollPlayers$1(Players.java:4641)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gotti.wurmunlimited.modloader.server.ProxyServerHook$6$1.invoke(ProxyServerHook.java:181)
    at org.gotti.wurmunlimited.modloader.classhooks.HookManager.invoke(HookManager.java:384)
    at com.wurmonline.server.Players.pollPlayers(Players.java)
    at com.wurmonline.server.Server.run(Server.java:1916)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

  • Like 1

Share this post


Link to post
Share on other sites

Crafter Fix

Download

 

Fix for error when removing Job.

On 2/3/2020 at 4:14 PM, WesncIsMe said:

Getting an error trying to trade crafters a 2nd time. Says there is items waiting for collection but there is none. this makes all crafters on the server untradable.

Not sure what the original cause of this was.  Trading multiple times seems to run okay on my end, and I'm not sure why it would affect all crafters.

 

However there was definitely a problem, which I've now fixed.  See if that clears things up, if not let me know and I'll keep looking.

  • Like 1

Share this post


Link to post
Share on other sites

Really Liking this mod. Couple questions:

1.How do I get into setting to edit these? 2. Can these be set for each individual buyer? 

update_traders

In order for already placed traders to stock the new buyer contracts the mod needs to add the item to their inventories.  There should be no perceptible performance impact, however you can change or just remove this entry in the property file to stop the search after the first run.  New traders will be stocked automatically.

contracts_on_traders

If false then new traders will not have buyer contracts added to them, and if update_traders is set to true then any contracts already on traders will be removed.  Default is true .

free_money

Buyers will create unlimited money on demand, instead of needing it in their inventory before hand.

destroy_bought_items

Destroys items on a successful trade.  Useful for when GMs control buyers and don't want to keep getting rid of items.

max_items

Sets the maximum number of items a buyer can hold. Technically it can go up to 2,147,483,647, but I wouldn't recommend it.  Coins are not counted in the limit, but the buyer's Price List item is.

apply_max_to_merchants

If true merchants will use the above value as well.

turn_to_player_max_power

Normally GMs do not trigger trader NPCs to turn when trading.  This setting allows you to raise or lower that.  Default 1.  Note, Traders and Merchants will mostly obey this setting, but will always turn to face players of power 1 or lower.

  • Like 1

Share this post


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

1.How do I get into setting to edit these?

You set the values in buyermerchant.properties in your mod folder.  It should look like this.

 

22 minutes ago, Segomo said:

2. Can these be set for each individual buyer?

No, these settings apply to all buyers.  I could look into it, but am currently working on another mod and don't have much spare time.  Sorry.

Share this post


Link to post
Share on other sites

Getting a null pointer error one of the crafters which spams the console constantly. 

 


12:13:34 PM] INFO com.wurmonline.server.creatures.Creatures: null
java.lang.NullPointerException
    at mod.wurmunlimited.npcs.CrafterAIData.sendNextAction(CrafterAIData.java:258)
    at mod.wurmunlimited.npcs.CrafterAI.pollCreature(CrafterAI.java:54)
    at com.wurmonline.server.creatures.Creature.poll(Creature.java:6017)
    at com.wurmonline.server.creatures.Creatures.pollAllCreatures(Creatures.java:1834)
    at com.wurmonline.server.zones.Zones.pollNextZones(Zones.java:1975)
    at com.wurmonline.server.Server.run(Server.java:1911)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
 

  • Like 1

Share this post


Link to post
Share on other sites

Crafter fix

Download

 

Fixed potential issue with workbooks being invalid/not being found and causing NullPointerException.

20 hours ago, WesncIsMe said:

Getting a null pointer error one of the crafters which spams the console constantly.

Not doing very well, am I?

 

I've dealt with the error itself, but it is likely caused by a problem with one of the crafters workbooks being missing, or not being valid.  I've added a couple more error messages that should clear things up, or maybe I'm wrong and it'll all be fine now.

 

Let me know if you get any more problems.

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Mthec said:

Crafter fix

Download

 

Fixed potential issue with workbooks being invalid/not being found and causing NullPointerException.

Not doing very well, am I?

 

I've dealt with the error itself, but it is likely caused by a problem with one of the crafters workbooks being missing, or not being valid.  I've added a couple more error messages that should clear things up, or maybe I'm wrong and it'll all be fine now.

 

Let me know if you get any more problems.

 

 

I think your doing great! Keep up the amazing work ❤️ Thank you!

  • Like 2

Share this post


Link to post
Share on other sites

  

New Mod Beta Release

Custom Trader

Download

 

A new type of NPC based on the standard trader, that can only be placed by GMs.  Has various options for a custom inventory, including restocking rules.  Use a 'tag' to share the same inventory between multiple custom traders, or just use a unique inventory.

 

Placing a Custom Trader

As a GM, activate your wand and right-click on the tile you wish the trader to appear.  Choose Place Npc>Custom Trader.  A menu will pop-up offering three settings, name, tag and gender.  Leave the tag blank if you wish them to only supply the items you specifically set for that custom trader.

 

Setting up stock

With a wand, right-click on the custom trader and select Manage.  In the first window you can change the tag of the custom trader, as well as empty their inventory and restock them to full capacity.  Item List is where you add/remove items.  Adding an item is very similar to BuyerMerchant, with the addition of specifying enchantments, and restocking rules.

 

Restocking Rules:

Rate

How many items are added each interval, up to the maximum.  0 restocks to the maximum every time.

 

Interval

How often the trader should be restocked, in hours.  0 restocks the custom trader after each sale.

 

Stock

The maximum number of this item to be available on the trader at any one time.

 

Some possible uses:

  • A replacement for the normal trader, with fewer or more items available.
  • A starter trader, offering some basic supplies for new players.
  • A mine "foreman".  Add a small amount of ore on a regular basis to simulate a public mine.

Think it is about feature complete.  Don't want to overcomplicate things.  Would like some feedback on the text in the menus, is there anything that needs clarifying, etc.

I've set the range of items that can be used very wide, similar to BuyerMerchant.  Quite a few items will not be ones you want to offer, but I thought it best to be flexible for any custom server setups.

I've mainly been testing on the beta version of Wurm Unlimited, however it seems to work on the non-beta.

 

Screeenshots:

Spoiler

item_list.jpg?raw=1manage.jpg?raw=1restocking_options.jpg?raw=1

 

Edited by Mthec
Fixed images
  • Like 2

Share this post


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

Screeenshots:

  Hide contents

p.jpeg?fv_content=true&size_mode=5p.jpeg?fv_content=true&size_mode=5p.jpeg?fv_content=true&size_mode=5

 

The screenshots aren't coming up for me.

 

  • Like 1

Share this post


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

The screenshots aren't coming up for me.

 

Sorry about that, Dropbox links being funny again where it appears on my end.  Fixed.

Share this post


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

Sorry about that, Dropbox links being funny again where it appears on my end.  Fixed.

Thanks!

 

 

Edited by Batta
  • Like 1

Share this post


Link to post
Share on other sites

Thank You so much Mthec, the custom trader mod is going to come in SO handy on our server.

*****

  • Like 1

Share this post


Link to post
Share on other sites

@Mthec The default items on the custom trader are coming up free.  I logged on an alt to confirm that he could just take whatever he wanted with no charge.  FYI

Edited by Batta

Share this post


Link to post
Share on other sites
6 hours ago, Batta said:

@Mthec The default items on the custom trader are coming up free.  I logged on an alt to confirm that he could just take whatever he wanted with no charge.  FYI

There shouldn't be any default items.  Did you create the custom trader with the Place Npc>Custom Trader menu, or by using summon?  Because I just tried summon (I hadn't been using that) and it came with the default trader items, whereas the other way removes them.

 

For the moment, you can just use Manage and tick the "Remove all items from inventory?" option after creation.  I shall have a look into removing the items another way.

Share this post


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

Did you create the custom trader with the Place Npc>Custom Trader menu, or by using summon? 

I summoned the custom trader.  Whoops.  Thanks for the clarification.  🙂

Would it be possible to add a config to the item sizes?  I like to stock a "GM merchant" with exotic wood logs, but only 4.00kgs each.

Edited by Batta
  • Like 1

Share this post


Link to post
Share on other sites

CustomTrader update

Download

 

Fixed creating custom traders using Summon.  Added weight option for trader items.

 

Important - This update will not work with the previous database, so you should dismiss any already created custom traders and then delete customtrader.db in the individual servers sqlite folder (e.g. WurmServerLauncher/Creative/sqlite).

Sorry about this, whilst I could have worked around it, as the mod is still so new I thought it best to keep things clean rather than leaving code to update old databases.

14 hours ago, Batta said:

I summoned the custom trader.  Whoops.  Thanks for the clarification.  🙂

Would it be possible to add a config to the item sizes?  I like to stock a "GM merchant" with exotic wood logs, but only 4.00kgs each.

I should have thought about it, but since I don't run a server I can miss things like that.

 

Also, added the weight option, it didn't take long.  Thank you for the suggestion.

  • Like 2

Share this post


Link to post
Share on other sites
On 3/2/2020 at 2:46 PM, Mthec said:

CustomTrader update

Download

 

Fixed creating custom traders using Summon.  Added weight option for trader items.

 

Important - This update will not work with the previous database, so you should dismiss any already created custom traders and then delete customtrader.db in the individual servers sqlite folder (e.g. WurmServerLauncher/Creative/sqlite).

Sorry about this, whilst I could have worked around it, as the mod is still so new I thought it best to keep things clean rather than leaving code to update old databases.

I should have thought about it, but since I don't run a server I can miss things like that.

 

Also, added the weight option, it didn't take long.  Thank you for the suggestion.

 

I've got this error coming up:
 

Spoiler

[04:31:01 PM] INFO com.wurmonline.server.creatures.Creatures: null
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at mod.wurmunlimited.npcs.customtrader.CustomTraderMod.poll(CustomTraderMod.java:92)
    at org.gotti.wurmunlimited.modloader.classhooks.HookManager.invoke(HookManager.java:384)
    at com.wurmonline.server.creatures.Creature.poll(Creature.java)
    at com.wurmonline.server.creatures.Creatures.pollAllCreatures(Creatures.java:1834)
    at com.wurmonline.server.zones.Zones.pollNextZones(Zones.java:1975)
    at com.wurmonline.server.Server.run(Server.java:1911)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NullPointerException

java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at mod.wurmunlimited.npcs.customtrader.CustomTraderMod.poll(CustomTraderMod.java:92)
    at org.gotti.wurmunlimited.modloader.classhooks.HookManager.invoke(HookManager.java:384)
    at com.wurmonline.server.creatures.Creature.poll(Creature.java)
    at com.wurmonline.server.creatures.Creatures.pollAllCreatures(Creatures.java:1834)
    at com.wurmonline.server.zones.Zones.pollNextZones(Zones.java:1975)
    at com.wurmonline.server.Server.run(Server.java:1911)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NullPointerException
java.lang.ArrayIndexOutOfBoundsException

 

Share this post


Link to post
Share on other sites
17 hours ago, Zera said:

I've got this error coming up:

As it is I cannot see what the problem could be.  There should be some more to the error message, if you could post more I will take a look.

Share this post


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

As it is I cannot see what the problem could be.  There should be some more to the error message, if you could post more I will take a look.

Unfortunately that's all it gave me. :(

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