mongots

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mongots

  • Rank
    Settler

Recent Profile Visitors

477 profile views
  1. Thanks for the explanation! This shows me that I didn't understand working with bytecode in Modloader, and that it's not as reliable as I thought it would be. So that option is best left off the table. Taking a closer look at the suggestion Ausimus posted (here), it certainly works, but I made a small change to limit the effects of the mod to players only. This is a working mod as it stands, but I'll also try using the expression editor to change the call to isSubmerged() instead of editing the whole isSubmerged() method its self. Thanks again for pointing me in the right direction!
  2. Link to new [WIP] post. http://forum.wurmonline.com/index.php?/topic/146156-wip-life-jacket-mod/ Thanks!
  3. I would like to build a simple mod to remove drowning while swimming from the game. The code I need to change is located in com.wurmonline.server.creatures.MovementScheme.move(), a code snippet of the specific block is below... if(this.creature.getStatus().getStamina() < 50 && !this.creature.isSubmerged() && !this.creature.isUndead() && Server.rand.nextInt(100) == 0) { this.creature.addWoundOfType((Creature)null, 7, 2, false, 1.0F, false, (double)((4000.0F + Server.rand.nextFloat() * 3000.0F) * ItemBonus.getDrownDamReduction(this.creature))); this.creature.getCommunicator().sendAlertServerMessage("You are drowning!"); } I have tried several ways to make this change through Ago's modloader with not much success. my current code (trying out bytecode manipulation) is below Some of this does actually work: changing the text to read something else, and changing the alert server message into a standard server message. bytecode.addLdc("You are drowning!"); bytecode.addInvokevirtual(ctCommunicator, "sendAlertServerMessage", Descriptor.ofMethod(CtPrimitiveType.voidType, new CtClass[]{ctString})); replacing these two lines together actually works, but adding any other instructions to the bytecode results in a NotFound exception being thrown by CodeReplacer. I have tried replacing the entire body of the move() method in the class, but apparently Javassist does not play well with enum types when compiling new code. It was also suggested to override the isSubmerged() method, which does work but may have unexpected side effects elsewhere in the game that I would rather not introduce. Any help or suggestions? Thanks in advance!
  4. I've been having trouble using bytecode manipulation on a simple mod I've been asked to make. My goal is to remove drowning while swimming. Easy enough, the code is found in com.wurmonline.server.creatures.MovementScheme.move(), here is the code snippet I want to change... if(this.creature.getStatus().getStamina() < 50 && !this.creature.isSubmerged() && !this.creature.isUndead() && Server.rand.nextInt(100) == 0) { this.creature.addWoundOfType((Creature)null, 7, 2, false, 1.0F, false, (double)((4000.0F + Server.rand.nextFloat() * 3000.0F) * ItemBonus.getDrownDamReduction(this.creature))); this.creature.getCommunicator().sendAlertServerMessage("You are drowning!"); } and the bytecode that IntelliJ give me to work with.... I've tried changing the contents of the if() statement to always be false, I've also tried removing the addWound() and ServerMessage() lines. I always end up with a NotFound exception being thrown when I call CodeReplacer.replaceCode() I'm sure things are setup properly, and I'm just having an issue understanding how to build the bytecode properly for the CodeReplacer to find. Any help or suggestions would be greatly appreciated! Here is my code as it is...
  5. I know about breaking an integer (or other data types down) into smaller pieces to store multiple values, I was just giving ideas, My Java-foo just isn't up to snuff to tackle the problem, and real life prevents me from getting too deep into programming. The farming was something I enjoy and wanted to throw around ideas on how to break the 16 crop barrier. I do like the idea of weeds, dryness and pests. Fertilizer would be another possible thing to add bringing alchemy into farming a bit. But all of that should come after getting a first run proof of concept running IMHO. I wish I could contribute more than just ideas though.
  6. With two integers, and the Auxdata byte you have access to just about all you need. One integer for the type of crop, the other for growth stage and Aux data to track tending. Throw in a model and some textures via a server pack and the rest is coding. As for the polling code, what if one of the two remaining crop types for the actual terrain tile be 'I've got a farm bed object on me, send it a poll message'.... if that's possible. I don't know quite how deep the hooks go for farming.
  7. Sorry to resurrect an old post, but I was wondering about a possible solution to the limit of 16 different crops. Would it be possible to build an item placed on flat ground similar to a flower bed that could be farmed in the same way as a regular dirt tile? I figure being a separate object it's Aux Data could be used to identify which crop is growing? Just a thought, would love to see extended farming to grow herbs and mushrooms.