- This topic has 6 replies, 4 voices, and was last updated 12 years, 8 months ago by JewManGroup.
-
AuthorPosts
-
April 16, 2012 at 8:57 pm #1441EncrypticMember
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 appearWhat this would NOT affect:
– Outcome of the enchantsHere’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.
April 17, 2012 at 12:03 am #1445PseudoKnightMemberI 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.
April 19, 2012 at 5:09 pm #1487JewManGroupMemberI 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.
April 19, 2012 at 8:53 pm #1490PseudoKnightMemberIf that can be done client side, is there a client mod that exists already that does it?
April 20, 2012 at 7:06 am #1500Coder JMemberThere 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 =(
April 20, 2012 at 7:17 am #1504Coder JMember….
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,
April 20, 2012 at 11:12 am #1506JewManGroupMemberThat 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 -
AuthorPosts
- The forum ‘General’ is closed to new topics and replies.