This commit is contained in:
nossr50 2019-05-31 19:46:14 -07:00
parent ff1bb0deed
commit 9111590dc2
6 changed files with 47 additions and 5 deletions

View File

@ -1,3 +1,18 @@
Version 2.1.67
The XP bar now reflects whether or not the player is receiving the early game boost
Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP
New locale string 'XPBar.Template.EarlyGameBoost'
NOTES:
You can turn off this system in experience.yml 'EarlyGameBoost.Enabled'
The Early Game Boost is a system in which players receive drastically increased XP gains for the first few levels (until the first set of skills are unlocked)
With default settings, this means players will be receiving boosted XP for the first 5 levels (50 for Retro)
The Early Game Boost ends when players get the first skill in each ability under default settings
The main purpose of this system is to alleviate progression issues with a few skills where the first set of unlocked abilities drastically increase how fun it is to level the skill
The secondary purpose of this system is to alleviate any psychological issues when grinding towards the first set of unlocks by making the first set of unlocks happen quickly
This system has been in place for a few versions now, but without an in game indicator of what was going on.
If you have XP bars off there is still no indicator that this system is in place, I'll address that at some point.
Version 2.1.66
Fixed a bug that could happen if a player was removed from the DB when using MySQL/MariaDB when the user was offline
Fixed a minor memory leak for MySQL

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.66</version>
<version>2.1.67</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.RankUtils;
@ -101,7 +102,7 @@ public class SelfListener implements Listener {
int earlyGameBonusXP = 0;
//Give some bonus XP for low levels
if(mcMMOPlayer.getSkillLevel(primarySkillType) <= mcMMO.getPlayerLevelUtils().getEarlyGameCutoff(primarySkillType))
if(PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
{
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
@ -156,4 +157,6 @@ public class SelfListener implements Listener {
}
}
}

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import org.bukkit.Server;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
@ -20,7 +21,6 @@ public class ExperienceBarWrapper {
private final PrimarySkillType primarySkillType; //Primary Skill
private BossBar bossBar;
private final Server server;
protected final McMMOPlayer mcMMOPlayer;
private int lastLevelUpdated;
@ -33,7 +33,6 @@ public class ExperienceBarWrapper {
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer)
{
this.mcMMOPlayer = mcMMOPlayer;
this.server = mcMMOPlayer.getPlayer().getServer(); //Might not be good for bungee to do this
this.primarySkillType = primarySkillType;
title = "";
lastLevelUpdated = 0;
@ -58,7 +57,10 @@ public class ExperienceBarWrapper {
private String getTitleTemplate() {
//If they are using extra details
if(ExperienceConfig.getInstance().getAddExtraDetails())
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
return LocaleLoader.getString("XPBar.Template.EarlyGameBoost");
} else if(ExperienceConfig.getInstance().getAddExtraDetails())
return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
return LocaleLoader.getString("XPBar."+niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
@ -106,6 +108,13 @@ public class ExperienceBarWrapper {
else
bossBar.setProgress(v);
//Check player level
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
setColor(BarColor.YELLOW);
} else {
setColor(ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType));
}
//Every time progress updates we need to check for a title update
if(getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle())
{

View File

@ -2,7 +2,9 @@ package com.gmail.nossr50.util.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import java.util.HashMap;
@ -37,4 +39,15 @@ public class PlayerLevelUtils {
{
return earlyGameBoostCutoffs.get(primarySkillType);
}
/**
* Check if a player is currently qualifying for the early game boosted XP
* Will return false only if a player is above the boost level cutoff, it does not check config settings to see if the early game boost is on
* @param mcMMOPlayer target player
* @param primarySkillType target skill
* @return if the player would qualify for the XP boost if its enabled
*/
public static boolean qualifiesForEarlyGameBoost(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
return mcMMOPlayer.getSkillLevel(primarySkillType) < mcMMO.getPlayerLevelUtils().getEarlyGameCutoff(primarySkillType);
}
}

View File

@ -103,6 +103,8 @@ Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
Commands.Party.Features.Header=[[RED]]-----[][[GREEN]]FEATURES[[RED]][]-----
# XP BAR Allows for the following variables -- {0} = Skill Level, {1} Current XP, {2} XP Needed for next level, {3} Power Level, {4} Percentage of Level
# Make sure you turn on Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained if you want the XP bar title to update every time a player gains XP!
XPBar.Template={0}
XPBar.Template.EarlyGameBoost=[[GOLD]]Learning a new skill...
XPBar.Acrobatics=Acrobatics Lv.[[GOLD]]{0}
XPBar.Alchemy=Alchemy Lv.[[GOLD]]{0}
XPBar.Archery=Archery Lv.[[GOLD]]{0}