(Somewhat) Simple RPG Leveling System

Discussion in 'Plugin Requests' started by Xp10d3, Jun 29, 2020.

  1. Offline

    Xp10d3

    Before anyone decides that they don't want to do this and hasn't read the whole thing, I am a rather inexperienced Bukkit developer but I know enough to make things easier for other developers. So please read through this before deciding that you don't want to do this plugin. I go through in detail of how the plugin should/likely will work.

    Plugin category: RPG

    Minecraft version: 1.8.9

    Suggested name: Endran Leveling System

    What I want:
    Dependencies
    Vault (for permissions, money, etc.)

    Soft-Dependencies
    PlaceholderAPI
    MySQL (optional)

    Brief Overview

    Basically, I need a permission based leveling system. In the config or other YML files, please add a function that allows the plugin to target players that do certain actions with %player%.

    Races + Classes GUI
    Anyways, I need classes and races. Upon joining the server for the first time, a GUI should appear. It should not be closable. Meaning that if they use escape or try to close the GUI, it shouldn't be closable. Anyways, they will be displayed with different races. I'll go through how to create those later. Upon clicking on a race, another GUI should appear (again, not closable) displaying all classes.

    Races + Creating Races
    To create a race, an Admin with the permission rpg.createrace will do the command /createrace. In chat, the Admin will be prompted to type the name of the race (please add Vanilla color support). Upon doing so, another GUI will appear. There should be different properties including base health (how many hearts a certain race has; for example 4 hearts instead of the normal 10), base saturation (same as base health except for saturation), how much money is given upon clicking the race (by default 0), whether a permission is required, and the icon for the race. Upon clicking on the base health icon, in chat again an user will be prompted to type the amount of hearts the base health is. By default it is 10 (normal Vanilla), but it can be modified. Same goes for saturation. Upon clicking on the base saturation icon, the user will be prompted in chat to type how much saturation is given upon clicking the race. If needed, an Admin can also configure whether the race requires a permission or not (for ranks and such). Again in chat, the user will be prompted to type in the permission node required for the race. If they type toggle it will toggle whether the permission is required or not. Upon clicking the money icon, again in chat the user will be prompted to type how much money will be given upon clicking the race. You can use Vault to add the money. Once the race has been created, in the config file I'd like there to be a command ran if set to true. The part of the config file should look like this:
    Code:
    command_on_race: true /* If set to false, no command will be ran upon selecting a race. */
    race_command: /* The command(s) ran if command_on_race is set to true */
    - lp user %player% parent set rpg.race.%race%
    - money give %player% 500
    - some-other-command
    
    Please add placeholders such as %player% and %race%. %player% is the IGN of the player that selected the race, %race% is the race they chose. Upon clicking the icon icon, whatever item the player is holding will be set to the icon for the race. Please include the lore, name, NBT data, etc.

    Classes + Creating Classes
    This is quite similar to raees. However, this is a bit more complex. Basically, classes are more defined than races. Races just give players access to different dungeons, areas, languages, etc (which is not relevant). However classes give players the ability to level up, get better loot, etc. Anyways, to create a class an Admin with the permission rpg.createclass will do the command /createclass. In chat again, the Admin will be prompted to type the name of the class (again with Vanilla color support). Upon doing so, a GUI will appear with the different properties of the class that can be configured in-game. The properties include an icon to set the starter gear, whether a permission is required to use the class, and the icon for the class. There isn't much to explain here. Anyways, upon clicking the icon for starter gear any items (including armor) that the player has in their inventory will be set to the starter gear for that class. Please include NBT data, lore, name, etc. Upon clicking the icon for whether a permission is required for the class, in chat the user will be prompted to type the permission. For the icon, same thing as races. Upon clicking, whatever item that is held will be set to the icon for the class.
    Again, I'd like there to be a command that is ran upon selecting a class. Here is an example:
    Code:
    command_on_class: true /* If set to false, no command will be ran upon selecting a class. */
    class_command: /* The command(s) ran if command_on_class is set to true */
    - lp user %player% parent set rpg.class.%class%
    - money give %player% 500
    - some-other-command
    
    Please add placeholders such as %player% and %class%. %player% is the IGN of the player that selected the class, %class% is the class they chose.

    Finishing Classes + Races

    Once the GUI has been exited, in the config I'd like there to be a section specified for what will happen upon closing the class + race GUI.
    Here is an example:
    Code:
    command_on_close: true /* Whether a command will be ran upon closing the GUI */
    close_command: /* The command(s) that is ran upon closing the GUI IF command_on_close is set to true. */
    - ban %player% You chose %race% and %class%.
    - money give %player% 500
    - some-other-command
    
    In this case, %player% is the player that closed the GUI, %race% is the race they chose, and %class% is the class they chose.


    Leveling System
    The leveling system is somewhat complex. At least, killing the mobs. I am using Mythic Mobs, and would like to give money based on what mob is killed. For example, if the mob is low level I'd like to give a smaller portion of experience, but if the player kills a boss mob obviously a larger portion should be given. Anyways, upon killing a certain mob, exp should be given to the player obviously. I can handle money pretty easily as I can run a command using Mythic Mobs to give money to a player. However, this also means that I can run a command to give experience to the player using server commands. That means that I could easily use this command if you add it to the plugin:
    Code:
    /rpg %player% experience add <amount>
    
    %player% is on the Mythic Mobs side, but if you could add user (a targeted user by their IGN), @p, @a, or @r that would be great :) Obviously, there is experience add <amount>. experience add means to add a certain amount of experience that is specified by <amount>. There should also be a few other commands:
    /rpg %player% experience subtract <amount>: Removes a specified experience.
    /rpg %player% experience clear: Clears all experience from a player.
    Other then that, that's pretty much it for killing mobs. There is a few other things that I'd like to add. In the config, there should be a specification for whether the leveling system grows exponentially and by how much. For example, Vanilla Minecraft's experience system grows exponentially which is what I want. So in the config:
    Code:
    level_exponential: false /* Whether the leveling system grows exponentially. */
    exponential_amount: 2 /* How much the leveling system grows by. */
    base_level: 50 /* How much experience is required to reach level 2 if you are level 1. */
    level_static_amount: 500 /* If level_exponential is set to false, how much experience is required to reach the next level. */
    
    In the exponential_amount area, I specified 2. That means if base_level is 50, it will require 100 experience to reach level 3 since it requires 50 experience to reach from level 1 to level 2. If this doesn't make sense let me know.

    Gaining Experience
    I already specified how to gain experience from mob kills. There are also other ways to gain experience such as:
    Code:
    Travelling long distances
    Cutting Trees
    Mining
    Vanilla mobs (killing pigs, cows, squids, guardians, etc.)
    Spending time on the server
    
    I specify in each part of the config how many ___ is required before gaining experience. If -1 is specified, it is toggled off.

    Travelling Long Distances
    This is pretty self explanatory. If a player has travelled a certain amount of blocks (that should be specified in the experience.yml file), they should gain a certain amount of experience (also specified in the experience.yml file). This means that part of the experience.yml file should look like this:
    Code:
    long_distances: 50 /* How many blocks is required to travel without stopping to gain experience */
    long_distances_experience: 50 /* How much experience is given once travelling x amount of blocks */
    
    In this case, if a player has travelled 50 blocks without stopping, they will gain 50 points of experience.
    Cutting Trees
    Also pretty self explanatory. If a player has cut down a certain type of tree (eg. oak, birch, etc.), they will gain x amount of experience. In the experience.yml file...
    Code:
    trees: 1 /* How many logs is required to cut down before gaining experience */
    oak: 5 /* How much experience is given for cutting down oak logs */
    birch: 5 /* How much experience is given for cutting down birch logs */
    dark_oak: 5 /* How much experience is given for cutting down dark oak logs */
    spruce: 5 /* How much experience is given for cutting down spruce logs */
    acacia: 5 /* How much experience is given for cutting down acacia logs */
    jungle: 5 /* How much experience is given for cutting down jungle logs */
    
    All properties are specified above. If you have any questions feel free to ask them.
    Mining
    Do I have to explain?
    Code:
    blocks: 1 /* How many blocks (whether it be stone, iron ore, etc.) is required before gaining experience */
    stones: 5 /* How much experience is given for mining stone, cobblestone, andesite, diorite, etc. */
    iron_ore: 15 /* How much experience is given for mining iron ore */
    gold_ore: 25 /* How much experience is given for mining gold ore */
    redstone_ore: 30 /* How much experience is given for mining redstone ore */
    emerald_ore: 50 /* How much experience is given for mining emerald ore */
    diamond_ore: 100 /* How much experience is given for mining diamond ore */
    
    This works EXACTLY like cutting trees, except it is for mining ores + stone.
    Vanilla Mobs
    This is pretty simple. You basically gain experience from whatever Vanilla mob you kill. Please include all 1.8.9 mobs.

    Level Milestones
    Once a player has reached a certain leveling milestone, I'd like there to be an ability to send a console command once they have reached that point. The config should look like this:
    Code:
    level_10_permission: rpg.level.10 /* What permission the level 10 is. */
    level_10_commands:
    - lp user %player% permission set rpg.level.10
    - msg %player% Congrats on level 10!
    - say You can add as many commands as you want.
    level_50_permission: rpg.level.50 /* What permission the level 50 is. */
    level_50_commands:
    - lp user %player% permission set rpg.level.50
    - msg %player% Congrats on level 50!
    - say You can add as many commands as you want.
    level_100_permission: rpg.level.100 /* What permission the level 50 is. */
    level_100_commands:
    - lp user %player% permission set rpg.level.100
    - msg %player% Congrats on level 100!
    - say You can add as many commands as you want.
    
    I'd like there to be an option to add as many levels as possible. I can insert level_<some_level>_permission, level_<some_level>_commands, etc. Then I can insert milestones when necessary.

    Ideas for commands:
    /rpg %player% experience <add | subtract | clear> <amount>: Adds experience, subtracts experience, or clears them.
    /createclass: Creates a class.
    /createrace: Creates a race.

    Ideas for permissions:

    Quite a few...
    rpg.level.<integer>: Specifies what level an user is at. Default: OP
    rpg.gainexp: Whether a player can gain exp or not. Default: everyone
    rpg.createclass: Whether a player can create a class or not. Default: OP
    rpg.createrace: Whether a player can create a race or not. Default: OP
    rpg.race.<some_race>: Specifies what race an user is. Default: OP
    rpg.class.<some_class>: Specifies what class an user is. Default: OP
    rpg.giveexp: Whether a player can use /rpg <user> experience. Default: OP

    When I'd like it by: A.S.A.P.

    Some additional notes:
    I understand that this seems like a lot. In all honesty, this really isn't. However creating permissions might be a bit tricky, but by my understanding you can use Vault to create permissions. That's why I set Vault as a dependency. It is NOT required as I can just use my economy plugin (XConomy) to add money, but Vault might make your life a bit easier. If you have any questions, need me to configure some plugins, add some, etc. Let me know. This plugin is quite easy as a concept but it will take a long time. I understand that. Thanks for reading this. Please let me know if you're willing to do this plugin.
    -Xp10d3/Eltik
     
    Last edited: Jul 4, 2020 at 5:40 PM
  2. Offline

    gochi9

    Well if you cut out the guis and add the classes and races by hand in a yml i might make it
     
  3. Offline

    Xp10d3

    @gochi9 Sure. GUI stuff is not necessary except for picking the classes + races for new players. That I would like to be in a GUI.
    EDIT @gochi9 sorry can you add MySQL connection? If I need to expand it will make things a lot easier for me :) Please store class, race, level, and UUID in the database upon first join. Thank you so much
     
    Last edited: Jun 29, 2020
  4. Offline

    gochi9

    @Xp10d3 Can you continue to bump this.I still have some porjects to work on so bumping it will help me remeber to make it when i have time
     
    Xp10d3 likes this.
  5. Offline

    Xp10d3

    Alright. Sounds good :)
     
  6. Offline

    Xp10d3

  7. Offline

    Xp10d3

    Bump. Also @gochi9 if possible can you set the command_on_class: option to be a list? So instead of:
    Code:
    command_on_class: true /* If set to false, no command will be ran upon selecting a class. */
    class_command: lp user %player% parent set rpg.class.%class% /* The command ran if command_on_class is set to true */
    
    It should be:
    Code:
    command_on_class: true
    class_command: 
    - lp user %player% parent set rpg.class.%class%
    - money give %player% 500
    
    Thanks :)
     
  8. Offline

    gochi9

    Will do
     
    Xp10d3 likes this.
  9. Offline

    Xp10d3

    (same with command_on_race if possible. Sorry forgot to mention that -__0)
     
  10. Offline

    gochi9

    And same with command_on_close i think you forgot
     
  11. Offline

    Xp10d3

    @gochi9 Wow... can't believe I forgot that as well. So sorry. Anyways yea that's pretty much the whole plugin lol. I'll go edit my post.

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 5, 2020 at 9:09 AM
  12. Offline

    Xp10d3

  13. Offline

    gochi9

    @Xp10d3
    Ah yes i got a little extra time so i made a little progress.This is how to config is going to look like: config
     
    Xp10d3 likes this.
  14. Offline

    Xp10d3

    @gochi9 Thanks so much! Everything is great, however if possible can you make the starter gear be made in-game? I'll be using MyItems (same as what I used for the past plugins you made for me <3) and it's easier for me to set up all the lore, NBT data, and name. This plugin is for an RPG obviously however the loot will have to be the same. Item names, classification, rarity, etc. will be connected with other plugins based on the data they have. So in a nutshell:
    Every single aspect of an item has to be unique and include NBT data + lore.
    Sorry, hope this is alright with you. Also one more thing: will all classes, races, and player data be in a MySQL database? Can you make that work? I came up with this idea shortly after posting the thread and forgot to edit it... Sorry... It's needed because I won't have to hire a developer to constantly make changes to one specific plugin, and I can always expand my server using that one database :) You can have two choices as to how you want to execute the MySQL database usage:
    Option One: Hardcode it.
    Hard code the creation of the database and insert player data. This means in the plugin itself there will be something like this:
    Code:
    CREATE TABLE rpg_data (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    UUID VARCHAR(30) NOT NULL,
    race VARCHAR(30) NOT NULL,
    class VARCHAR(50),
    level INT(6),
    total_exp DOUBLE(50),
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    );
    CREATE TABLE rpg_race_data (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    some_other_data,
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    );
    CREATE TABLE rpg_class_data (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    some_other_data,
    reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    );
    
    Create three tables, one with the general data. The ID of each player, the UUID of that player, what race they chose, what class they chose, what level they are currently, and the total experience they have. There should also be two other tables of the races and classes. Those tables are totally optional and don't have to be made unless you want to add them. It should contain the ID of course but also possibly some other data of the race/class. I just thought it might be helpful for server backups and such, but it's totally fine if you don't want to add it, but the rpg_data is necessary.
    Option Two: Customizable in the config.
    It might be a bit easier for you, however I'm not exactly sure. You could possibly have the MySQL database connection default to a JSON or YML file if the connection fails. Anyways, in the config you could have one or three sections that could look like this:
    Code:
    mysql: true /* Set to true to allow MySQL connections or set to false to disable MySQL connections. */
    host: localhost
    username: some_username
    password: some_password
    database: some_database
    player_data:
      table_name: rpg_data
      additional columns:
      - column1
         type: INT
         notnull: true
         length: 6
      - column2
         type: VARCHAR
         notnull: false
         length: 50
         default: asdf
    race:
      table_name: rpg_race_data
      additional columns:
      - column1
         type: INT
         notnull: true
         length: 6
         default: 7
      - column2
         type: VARCHAR
         notnull: false
         length: 50
         default -1
    class:
      table_name: rpg_class_data
      additional columns:
      - column1
         type: INT
         notnull: true
         length: 6
         default: -1
      - column2
         type: VARCHAR
         notnull: false
         length: 50
         default: hello
    
    Let me break this down. Basically, you can turn MySQL on/off using the first attribute, mysql:. Setting it to true will enable MySQL connection, setting it to false will disable MySQL connection. If it is set to true, the plugin will try and connect to the database. If it can't, there will be an error in console and default to a JSON or config file. If it can connect to the database, it will create a player data table, race table, and class table (if you want to do races + classes in a database). The attributes will be set in a list. What the table name should be and any additional columns. The plugin will NOT mess with the additional columns. I only added the additional columns in case I want to add another custom plugin (which I'm having another dev work on right now) that hooks into a MySQL database. I won't go into any details, but it's basically a Guild plugin that will prove useful in the case that it needs to get other player data like how much exp they have, class, race, etc. Anyways, the additional columns can be added. There is no limit, but I just added two just for an example. First off is what the column name should be called. Next is the type (INT, VARCHAR, DOUBLE, BOOLEAN, LONGTEXT, etc.), whether it's null or not, how many characters it should be, and the default. If the default is -1, there will be no default.

    Sorry if this is a bit more complex... the config looks great so far, though! Thank you <3
     
  15. Offline

    gochi9

    Yes putting the items in a gui would be much simpler.No mysql since i did some work i would have to change it and i don't have time for that(everything is going to be saved in a yml file).Or you could wait for someone else to make it.Tell me which one you like it
     
    Xp10d3 likes this.
  16. Offline

    Xp10d3

    Alright. That's fine :) Just a quick question: is it possible to get values in another plugin's YML file? I could get another dev to get the plugin's YML file and then send it to a database if it's possible.
     
  17. Offline

    Xp10d3

  18. Offline

    gochi9

    Well you could read the yml file and send it to a database but the plugin won't read/write from that databse so you would do that for nothing really
     
  19. Offline

    Xp10d3

    So it is possible with another plugin? I just want to have this feature so that I can read user data and configure it. For example if I were to add a bonus buff to the Elf race, I could check if an user based on it's UUID has that race using the database and then give that specific player like strength II or something. I really do need the SQL connection...
    EDIT: Never mind I just realized it is possible lol. LuckPerms does it with PermissionsEx.
    EDIT2: If possible can you make the config look like this when storing user data?
    Code:
    <uuid_of_user>:
      uuid: <uuid>
      race: Elf
      exp: 6373
      level: 48
    <uuid_of_user2>:
      uuid: <uuid>
      race: Orc
      exp: 1834
      level: 13
    
    It'll make things a bit easier when having another dev work on the importing of the config file.
     
    Last edited: Jul 9, 2020 at 9:05 AM
  20. Offline

    gochi9

    Ok so let me get it straight.I am not going to add a sql support of any kind because i don't have time and neither do i want to to.The plugin will be able to read or write from your database and there is no way it.I will keep it simple since it is a free plugin and everything in going to be kept in a yml file.If you do not like it then i will not continue to develop this plugin and you can wait for someone else to take over
     
  21. Offline

    Xp10d3

    Alright. It’s totally fine; you can keep the storage in the YML file. I opened a new thread that will take the data in the YML file and import it into a database. It’ll be another plugin so don’t worry about it. I appreciate that you even are willing to do this, so make it however you want :)


    Sent from my iPhone using Tapatalk
     

Share This Page