Enchanting Improvements

Home Forums General Enchanting Improvements

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1441
    Encryptic
    Member

    Based upon some talk around the server, there’s more than a few people who seem to get annoyed with spending time clicking on an enchanting table trying to get a specific level, only to end up missing it or the other way around, getting all kinds of enchants that don’t apply to you.

    Because of these annoyances, I’ve been thinking about writing a plugin for Bukkit to improve the enchanting rules. I’ve experimented with the concept and the plugin is possible, I just need some help setting rules forth for it.

    What this would affect:
    – Levels of enchantments that appear

    What this would NOT affect:
    – Outcome of the enchants

    Here’s what I’m thinking for rules:
    – Each time an item is placed on the table, 3 levels are selected at random by the game. If any one of those levels is above your own, your level will be substituted automatically.
    – If enchantments are significantly below your level (I’m thinking 10 levels), the levels will be bumped up a closer to your level range by a random number between 7-10.
    — The bookshelves around would still be required to dictate whether the level randomly selected is possible, if not, it would be trimmed around to the maximum possible for the area.

    This would feel a lot less random and would result in hundreds less clicks.

    Anyway, if anyone has ideas for the rules you would like to see, please let me know.

    #1445
    PseudoKnight
    Member

    I think it should “re-roll” when it’s above your level, and that’s it.

    Note, you can already improve the time efficiency of the enchanting table with sticky pistons on the bookshelves.

    #1487
    JewManGroup
    Member

    I currently have an idea on how to write a mod to do this client side. So that the client would continuously ask the server to regenerate until it got a good number.

    #1490
    PseudoKnight
    Member

    If that can be done client side, is there a client mod that exists already that does it?

    #1500
    Coder J
    Member

    There are client mods that do this, along with client/server combination mods.

    Enchanting in SMP is handled almost exclusively by the server, however. The server does not actually assign an enchantment until after the experience cost has been paid by the player. That means until that cost is paid, it is possible with the Bukkit API to change the level costs for enchantments.

    —-
    Code (going to look bad because I hate code tags….)
    (Keep in mind I’m tired, there’s bound to be an error in here)
    —-
    [sourcecode language=”java”]
    public void PreppyEnchanter(PrepareItemEnchantEvent event){
    int MaxLevel = event.player.getLevel();
    Random r = new Random();

    for(int x=0; x MaxLevel; x++){
    if(event.getExpLevelCostOffered()[x] > MaxLevel){
    event.getExpLevelCostsOffered()[x] = r.nextInt(MaxLevel) + 1;
    }
    }
    }
    [/sourcecode]

    This code checks all 3 indexes of getExpLevelCostsOffered, and if that’s greater than MaxLevel, rolls a new number between 1 and MaxLevel (nextInt actually rolls between 0 and MaxLevel-1, hence the +1)

    • This reply was modified 12 years, 8 months ago by Coder J. Reason: somehow left out the if statement
    • This reply was modified 12 years, 8 months ago by Coder J. Reason: okay... lost the if and part of for.... strange
    • This reply was modified 12 years, 8 months ago by Coder J.
    • This reply was modified 12 years, 8 months ago by PseudoKnight. Reason: shouldn't be parsing shortcode in code tags =(
    #1504
    Coder J
    Member

    ….
    that em class=”bbcode-em” crud should be…. [ i ]

    Stupid me trying to use a variable the corresponds to the tag emphasis. Ugh. I’m going to bed now (and evidently I reached the limit for edits… maybe PK can fix this?)

    • This reply was modified 12 years, 8 months ago by Coder J. Reason: BED, not be.... argh! Good night,
    #1506
    JewManGroup
    Member

    That will work for server side, but for a client side implementation it’s different. The server does the rolling so there is no way the client can cheat. However all you need is a simple program that simulates reclicking over and over again until the level is 50. A mod like this already exists. http://www.youtube.com/watch?v=uQ21Ju5xJCk
    I did not write this, but I have decompiled it and worked similar code into my modpack I am writting

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General’ is closed to new topics and replies.