This commit is contained in:
Ethan 2022-02-03 00:46:54 -05:00
parent d38ac076a4
commit 4eb7291a07
3 changed files with 28 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.Indyuce</groupId>
<artifactId>MMOCore</artifactId>
<version>1.9-SNAPSHOT</version>
<version>1.9.1-SNAPSHOT</version>
<name>MMOCore</name>
<description>Offer your players a brand new RPG experience!!</description>

View File

@ -7,7 +7,12 @@ import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
import io.lumine.mythic.lib.player.modifier.ModifierSource;
import io.lumine.mythic.lib.player.modifier.ModifierType;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.skill.ClassSkill;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Locale;
public class PlayerStats {
private final PlayerData data;
@ -37,6 +42,25 @@ public class PlayerStats {
return getMap().getInstance(stat);
}
/**
* Allows for stat type enum to have dynamic professions.
* ID FORMAT: STAT_TYPE_HERE_PROFESSION_HERE
*
* @param type the type of stat
* @param profession the stat's specific permission
* @return instance of found stat
* @author Ehhthan
*/
@NotNull
public StatInstance getInstance(StatType type, @Nullable Profession profession) {
if (profession == null)
return getInstance(type);
else {
String id = (type.name() + '_' + profession.getId()).replace('-', '_').replace(' ', '_').toUpperCase(Locale.ROOT);
return getInstance(id);
}
}
/*
* applies relative attributes on the base stat too
*/

View File

@ -10,6 +10,7 @@ import net.Indyuce.mmocore.api.SoundEvent;
import net.Indyuce.mmocore.api.event.PlayerExperienceGainEvent;
import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.stats.StatType;
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect;
import org.apache.commons.lang.Validate;
@ -163,6 +164,8 @@ public class PlayerProfessions {
}
value = MMOCore.plugin.boosterManager.calculateExp(profession, value);
// Adds functionality for additional experience per profession.
value *= 1 + playerData.getStats().getInstance(StatType.ADDITIONAL_EXPERIENCE, profession).getTotal() / 100;
// Display hologram
if (hologramLocation != null)