[Challenging] Change exp table behaviour

Discussion in 'Archived: Plugin Requests' started by iwitrag, Jun 1, 2014.

  1. Offline

    iwitrag

    Hello,

    I'm here with another plugin request. This plugin should alter the behaviour of minecraft vanilla exp needed for each level.

    Motivation:
    With this plugin, exp table could be changed in a custom way, so you will be able to give your server more RPG feel.

    Vanilla formula for exp needed:

    Code:java
    1. int expCost(int currentLevel) {
    2. if (currentLevel >= 30) {
    3. return 62 + (currentLevel - 30) * 7;
    4. } else if (currentLevel >= 15) {
    5. return 17 + (currentLevel - 15) * 3;
    6. } else {
    7. return 17;
    8. }
    9. }


    So as you can see, you need only 17 experience in first 14 (15 including zero) levels.
    I don't think this system is good, so I'm coming with suggestion to change it.

    Sadly,
    XP needed for each level is hard-coded in Minecraft itself, so it's not possible to change it.

    But,
    this plugin will make a workaround and define it's own XP table.

    How?
    This plugin could listen to any exp change. Those exp changes should contain:
    - Player picks-up exp orbs
    - Player gains exp by mining diamonds
    - Player gains exp by smelting in a furnace
    - Player gains exp given by plugin (for example essentials)
    - Player gains exp by ...
    Basically this plugin will save player experience and if player's experience suddenly changes, the plugin will change it appropriately.

    When player gains exp, this plugin will save this amount of exp to it's internal save-files for each player.
    Now, when true amount of exp is saved, this plugin will look in config and get exp needed for next level from exp table and SCALE exp bar, so it will look like the amount of exp needed is different.

    Example:
    Let's say you have level 27, according to vanilla Minecraft you need 53 experience points to reach level 28. But in custom exp-table you need (for example) 279 experience points. So if player kills
    wither, which drops 50 experience points, in vanilla minecraft you would have almost full exp bar (50 / 53), but with this plugin your exp bar would be about 23% filled.

    If you kill another wither, vanilla minecraft would update your level to 28, but you need 279 exp points for level 28, so this plugin will turn it back to level 27 and scale exp bar accordingly...

    It's not easy to understand, I know.

    Config:
    Well, let's say we have this config:


    Code:java
    1. custom: true
    2. customtable:
    3. - 1: 5
    4. - 2: 10
    5. - 3: 18
    6. - 4: 32
    7. - 5: 40
    8. formula: 20 + ({curlevel}^1.1) * 7


    If custom is true, custom table is used.
    This table defines exp needed for each level (not total exp player has, only needed).
    As you can see, there are only 5 levels in that table. So this is the cap and maximum level is 5. This plugin should automatically disable exp gaining, when maximum level is reached.

    If custom is false, formula containing basic mathematic is used to define exp table.
    There is not any max level.

    When player dies:
    He will drop experience like in vanilla minecraft, because exp dropped depends on player's level, and level will not be changed by this plugin.

    From wiki:
    • A killed player drops 7 for each level they had, up to a maximum of 100 points.
    Warning:
    This plugin should be able to re-scale exp backwards too, in case that any plugin will decrease player's exp.
    This plugin should also workout any level changes due to enchanting. So it will alter total amount of experience player has in a right way according to new exp-table.

    Thanks and if you have any questions, ask :)
     
  2. Offline

    iwitrag

    Refresh [sheep]
     
  3. Offline

    iwitrag

    Refresh [pig]
     
  4. Offline

    iwitrag

    Refresh [spider]
     
  5. Offline

    iwitrag

    Refresh [zombie]
     
  6. You could also do it the other way around.

    Instead of forcefully altering the vanilla sytem (which will lead to problems if and when it goes out of sync) - just disable exp orbs in your sever, and make a plugin that drops currency. That currency is your exp. You can then set the player levels depending on this currency via player.setLevel(value).

    The troublesome thing is that you have to replace _everything_ that would normally drop exp and set them by yourself.
     
  7. Offline

    iwitrag

    wutata
    The problem is, that I'm not developer. This is plugin request section.
    I don't want to disable exp orbs and I'm using currency (dollars) for economy :confused:

    Also lot of plugins are altering exps drops from mobs, these are things, which cannot be simply "rewritten"

    Thanks for understanding
     
  8. Offline

    iwitrag

    Refresh [sheep]
     
  9. Offline

    iwitrag

    Refresh [pig]
     
  10. Offline

    iwitrag

    Refresh
     
  11. Offline

    iwitrag

    Refresh
     
  12. Offline

    AnorZaken

    Interesting idea, I like it.
    However I'm busy with other plugins (as well as non-mc stuff), sorry...
    But I believe it's possible* and I support this idea *thumbs up*

    Edit:
    *well maybe except for one thing: regarding rescale backwards, how would you know if a plugin that decreased the players exp was paying for a cost defined in x-number-of-levels or x-amount-of-exp??
    If the cost for some action is defined as say... 2 levels, than no rescaling should be done, however if the cost for the action was say 25exp then it would need rescaling. But how can you tell what the other plugins intention was???
     
  13. Offline

    iwitrag

    If any plugin decreases 2 levels, then it need to decrease XY amount of XP in order to decrease level. So it's still exp which get decreased.

    Refresh
     

Share This Page