[FUN] LevelUp v0.3 - Adds levels/experience and perks to Minecraft [766]

Discussion in 'Inactive/Unsupported Plugins' started by dgahimer, May 12, 2011.

  1. Offline

    dgahimer

    Plugin: LevelUp - A plugin to add levels and experience for certain tasks to Minecraft
    Version: 0.3

    LevelUp allows players to gain experience from various activities, gain levels, and use those levels to acquire perks to aid certain skills.

    <Edit by Moderator: Redacted mediafire url>
    Source

    Features:
    * Gain experience from mining, de-foresting, and digging
    * Track levels gained from experience
    * Use levels to gain perks (currently the perk is static: players have a (1 - .995^(level - 1))% chance of instantly destroying blocks )
    * Permissions support

    Install:
    * Always back up your server. Always. For this plugin, for other plugins, even if you aren't using plugins. Back up your server.
    * Download LevelUp.rar from the above Mediafire link
    * Extract the .rar to the plugins folder
    * If desired, navigate to plugins/LevelUp and open block_xp.prop in your favorite text editor. Change the numbers to change how much experience each block is worth
    * Currently, the amount of XP needed to reach a given level is found by the formula: XP = 10,000 * level

    Commands:
    Code:
    /levelup [username] - When used without an argument, /levelup sends the XP and level to the player who
        calls the command. If the caller is not a user, it tells the user that the command may not be used.
        With an argument, it returns the level and XP of the username sent
    Permissions:
    * levelup.command -- a user with this permission is able to use the command above
    * levelup.level -- a user with this permission is able to gain experience
    * levelup.perk -- a user with this permission is able to user level perks

    MySQL Support:
    The "properties.prop" file has 7 mandatory fields and 2 optional fields that need to be filled out to use a MySQL database. The fields are:
    *
    - * use-database= If this field is true, the server tries to use a database

    * database-type= In this field, you need to input the database software you are using. Currently, MySQL is the only software supported

    * database-host= This is the host name of the SQL server you are using

    * database-port= This is the port number of the SQL server (default is 3306)

    * database-name= This is the name of the database you with to use

    * database-user= This is the username you wish to use with the SQL server

    * database-password= This is the password you with to use with the SQL server

    * database-table-chars= This is the name of the table you wish to use for characters (default levelupcharacters)

    * database-table-blockxp= This is the name of the table you wish to use for block xpl (default levelupblockxp)

    For those of you who have previously used my plugin or who start without using a database and proceed to implement a DBMS solution, it will automatically convert from file to a database. This will delete your files once added to the database. Remember what I said about backing everything up earlier? I highly recommend you do that. If this ruins any characters, I apologize, but in my admittedly brief testing, it worked flawlessly.

    Changelog:
    v3.0
    * Added support for MySQL

    v0.2b
    * Reworked leveling algorithm. It now takes (20000 * level)xp to reach the next level

    v0.2
    * Added functionality to track blocks placed by users to prevent farming ores
    * Removed the ability to instantly destroy blocks the user interacts with (buttons, doors, levers, etc.)

    v0.1
    * Added levels, experience, Permission support, and level perks

    TODO:
    * Add more perks, and allow the user to choose between them (with the server-configurable choices on whether to allow or disallow the possible perks)
    * Add "give xp" and "remove xp" commands
    * Add support for more dbms's
    * Multiworld support
    * Feel free to make suggestions

    Thanks for reading this far!
     
    Last edited by a moderator: Dec 14, 2016
    ssdx123 likes this.
  2. Offline

    Chumber

    Since you can't place ores you don't have to track those...or am i wrong? And dirt / sand / stone isn't really worth it, you can find large quantities of them without placing some....unless you macro it but all you have to do, to prevent that, is log like 10 blocks.
     
  3. Offline

    dgahimer

    You can place iron ore and gold ore but not diamond, redstone, coal, etc. I didn't think you could either, but an earlier poster corrected me, so I tested it, and you can. And yeah, that was how I felt about all the "common" materials, so I think I'm just going to log uncommon ones, which should severely decrease the load on the server
     
  4. Offline

    Chumber

    Absolutely, limit it to like 100 blocks and you should be fine - no limit will flood the ram over time too.

    Ah and for a future version, add another file with
    a, n, b
    a = block you break where instahit fired
    n = chance to get b
    b = bonus drop if n is true

    i want the glowstones from dirt again but mcMMO is just bad for server performance...
     
  5. Offline

    dgahimer

    I can definitely do that do that

    A minor update is being released to fix two issues: First, leveling has been reworked. The new formula is (20000 * level)xp to get to the next. Old saves are preserved and fixed automatically. Second, I believe the .rar download released in the prior update was an incorrect one.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
    Chumber likes this.
  6. Offline

    Chumber

    /reload didn't work but my level adjusted fine after restart, nice :D

    EDIT: Woha and something is buggy :D

    I looged in with 136k XP, got me from level 9 to level 13, mined alot and just became level 4, i think it's time for a setLevel command... ^^

    Java has been a while but shouldn't you change
    Code:
    private void convertOldCharacters() {
            if (totalXp == null) {
                level = 1;
                totalXp = xp;
                while (xp > level * xpModifier) {
                    level++;
                    xp -= level * xpModifier;
                }
            }
        }
    
    
    that it saves totalXP to this.totalXP because otherwise totalXP outside that function is still zero....

    That would explain what happend, i got allt he xp needed to reach level 14, it fired the level up method, saw that my totalXP is zero and ran the loop again but this time the 130k needed to get to 14 from level 1 got me to level 4, math looks about right :) i also made a mistake in my table earlier, i had it running with 10000*level, 20000 is overkill :D

    Wishlist:
    1. add the xp to level modifier to a config file so ppl can select their own pace, in order for this to work you have to add a recalculate level method
    2. add a top #10 :)
    3. match partial names with levelup, check if there is a 100% match in player name and if not see if there is someone starting with that name and if yes, return that name ah and all to lower cases :)
     
  7. Offline

    dgahimer

    Hmmm. Since totalXp's scope is outside the function, then it should work... Let me look. I programmed it when it was tired which means I probably messed something up bad
     
  8. Offline

    Chumber

    Na i think it worked as intended, i looked into my 10k xpModifier table and that's why the numbers came up wrong since you are using 20k and 20k in fact, levels you down ^^

    Just rename it fromConvertOldChars to recalcLevel or something, invoke it with /lvlup recalc and let it run through all chars, add the xpModifier to the config file and tada :D
     
  9. Offline

    dgahimer

    Lol I dig. I'll do that
     
    Chumber likes this.
  10. Offline

    MJRamon

    Well, nicely done, but there is mcMMO already...
     
  11. Offline

    Chumber

    Which approaches at a completly different angel, its much more massive, complex and as a result much more hardware hungry than this leightweight solution.
     
  12. Offline

    unachemaxwell

    Love this, wanted to have something like this on my server for awhile but not have to switch over to the flow of the game and completely rechange it.... I will love it even more when the new perks come out but currently I give it 8/10 :p

    EDIT: Would also love database support such as SQlite.... or even MySQL to start putting leaderboards on my website:p
     
  13. Offline

    Chumber

    True, mySQL would be a real nice way to put a leaderboard on your website :)
     
  14. Offline

    dgahimer

    @unachemaxwell give me a couple days and I'll have a SQL solution in place. It is my next major project, but I'm glad you like what I've done so far
     
  15. Offline

    bcwebster123

    how can u check how much exp and wat level u r????
     
  16. Offline

    Chumber

  17. Offline

    dgahimer

    @Meister

    Hey, could you give me a list of the plugins that you're running?
     
  18. Offline

    unachemaxwell

    Thanks! Take your time and I know Ill enjoy what you do.
     
  19. loving it so far, little bit of feedback.

    it's not blatantly apparent how to level forging to start with. by the time you have enough stone to get to lv 5 and make a stone pick axe your mining is nearer lv 10, so feels a little slanted, the gathering skills move faster than their support skills, forcing a bottleneck for items.

    you might try assigning a difficulty level to each skill, i.e. 1.0 for forging, and 1.5 for mining, once you've done the 20,000 * lv then hit it with * difficulty as well. this would allow you to slow down whole skill trees, and give the admin/mod the ability to scale that factor.

    1.5 might be too much, so perhaps some balance testing from 1-5 forging should roughly be on par with 1-4 / 5 mining.

    Personally i recon it's better to have the tool and a desire to use it than to have the ability, then grind to get the tool.
     
  20. Offline

    Meister

    @dgahimer
    [​IMG] ChopTree
    [​IMG] CommandBook
    [​IMG] GoldenSprint
    [​IMG] iChat
    [​IMG] LWC
    [​IMG] WorldEdit
    [​IMG] WorldGuard
    [​IMG] MobRider
    [​IMG] ModTRS
    [​IMG] Nethrar
    [​IMG] Permissions
    [​IMG] PorteCoulissante
    [​IMG] SecretDoors
     
  21. Offline

    dgahimer

    I made a big old mess out of my code last night, but MySQL support is working now! I just need to clean everything up...

    @unachemaxwell @Chumber

    I have released a new version with MySQL support. If you have any errors, please let me know so that I can fix it. I'm very new to programming in databases with Java (read: I learned 2 days ago.) Please, remember to backup your data. The information on how to set up the server for MySQL correctly is in the initial post. Thanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
    Chumber likes this.
  22. Offline

    Chumber

    It didn't work :D

    I changed the properties file, you should add some default values like host (99% its localhost) the port is 99% 3306 too and the type since only one is available and how do you spell it? mysql? mySQL? MySQL like the exampe? (which didn't work)

    Anyway i edited the file, made a /reload, my dat files are gone and nothing in my DB, good thing i backed them up :D

    EDIT: okay i changed the type from MySQL to mysql, that didnt change a thing BUT after adding the OPTIONAL tablenames it created them, the optional part didn't work that well ^^ but the plugin does ah and in the server.log at startup it still says 0.2 :)

    Hmm and one of my player got -4675 XP haha
     
  23. Offline

    dgahimer

    Capitalization doesn't matter. Let me look into the rest... It works on my computer, but like I said, I'm new to JDBC, so I probably left out something important.

    Doh. I know what the problem is with the optional part. I do NOT know what the problem is with -4675 XP lol. So I'll have to look into that. And thanks, I'll update server.log stuff.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  24. Offline

    Chumber

    The usable item protection is gone, destroyed a furnace with my pickaxe and a chest with my bare hands *roar* :D

    RAM usage skyjumped, about 200-300mb more than usual, had to revert back to 0.2 :)

    Oh and one of my player had a nice idea, he said that the proc is sometimes annoying, that it would be really nice if you can accumulate them and activated / deactivate a "proc mode" with right click until they are used up? Would be awesome :)
     
  25. Offline

    vein_mx

    I am having a bit of trouble of trying to get this to work. I install it and configure it using MySQL, restart server and I log in and works fine. If I restart my server once more, nothing works and it spams my log with unable to send ____ action to LevelUp, and there the tables disappear from my mysql (or were never created in teh first place, dont know which)
     
  26. Offline

    dgahimer

    vein, I'll look into it for you. I'm trying to figure out what the unable to send action is all about. Also, it creates the tables on mine, but I haven't implemented a method to remove them, so it sounds like it isn't on yours. Sorry for the issues.
     
  27. Offline

    vein_mx

    im going to try a bunch of things. im going to test this now, but im wondering if its me changing the EXP values on first install that is causing problems.

    EDIT: I am actually trying to now without the use of MySQL. Where is the data stored? I dont see it creating anything. And everytime I restart server, my EXP info gets wiped.

    EDIT2: an as a small favor can you @vein_mx in your reply so I can get reply asap? I really wanna get this working
     
  28. Offline

    dgahimer

    @vien_mx When you run it without MySQL, it creates files in the "./plugins/LevelUp" folder. I don't know why it wouldn't be creating anything. It definitely is on my server (but only creates the files when you safely exit the world via "stop" or use "save-all" on the server.) I'm not sure about the other errors you're receiving, but I'll look into them in the morning.

    Could you post a list of the plugins you're using and your craftbukkit version?
     
  29. Offline

    unachemaxwell


    The MySQL stuffage seems to be working well.... with the -exp stuff it seems like when the person levels they start at -20K for the next level or somesuch... Tnx for the SQL support as it took a load from using flatfile.
     
  30. Offline

    vein_mx

    um sorry I didnt mean those files. I mean like files that store the user data.

    here are my plugins:
    BorderGuard, CommandBook, GroupManager, GroupBridge, Help, HeroChat, HeroicDeath, LWC, LogBlock, LyTreeHelper, MagicCarpet, MultiVerse, ScheduledAnnouncener, SignLift, SimpleReserve, SimpleSave, Superpickaxe, War, Warpz0r, WorldEdit, WorldGuard, blocktowers.

    And CB 766. All the plugins are up to date as I check for updates manually every day. Thank you!
     
  31. Offline

    Chumber

    Hmm i am no longer getting any xp with mysql, thats odd...
     

Share This Page