forked from Upstream/mmocore
Merge branch 'master' of ssh://git@dev.lumine.io:7999/mmo/mmocore.git
This commit is contained in:
commit
b7368d7ffd
@ -62,6 +62,7 @@ import net.Indyuce.mmocore.listener.PlayerListener;
|
|||||||
import net.Indyuce.mmocore.listener.SpellCast;
|
import net.Indyuce.mmocore.listener.SpellCast;
|
||||||
import net.Indyuce.mmocore.listener.WaypointsListener;
|
import net.Indyuce.mmocore.listener.WaypointsListener;
|
||||||
import net.Indyuce.mmocore.listener.option.DeathExperienceLoss;
|
import net.Indyuce.mmocore.listener.option.DeathExperienceLoss;
|
||||||
|
import net.Indyuce.mmocore.listener.option.DisableRegeneration;
|
||||||
import net.Indyuce.mmocore.listener.option.HealthScale;
|
import net.Indyuce.mmocore.listener.option.HealthScale;
|
||||||
import net.Indyuce.mmocore.listener.option.NoSpawnerEXP;
|
import net.Indyuce.mmocore.listener.option.NoSpawnerEXP;
|
||||||
import net.Indyuce.mmocore.listener.option.VanillaExperienceOverride;
|
import net.Indyuce.mmocore.listener.option.VanillaExperienceOverride;
|
||||||
@ -231,20 +232,13 @@ public class MMOCore extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
for (PlayerData data : PlayerData.getAll())
|
for (PlayerData player : PlayerData.getAll())
|
||||||
if (data.isOnline() && !data.getPlayer().isDead()) {
|
if (player.isOnline() && !player.getPlayer().isDead())
|
||||||
|
for (PlayerResource resource : PlayerResource.values()) {
|
||||||
data.giveStellium(data.getStats().getStat(StatType.STELLIUM_REGENERATION));
|
double d = player.getProfess().getHandler(resource).getRegen(player);
|
||||||
|
if (d > 0)
|
||||||
if (data.canRegen(PlayerResource.HEALTH))
|
resource.regen(player, d);
|
||||||
data.heal(data.calculateRegen(PlayerResource.HEALTH));
|
}
|
||||||
|
|
||||||
if (data.canRegen(PlayerResource.MANA))
|
|
||||||
data.giveMana(data.calculateRegen(PlayerResource.MANA));
|
|
||||||
|
|
||||||
if (data.canRegen(PlayerResource.STAMINA))
|
|
||||||
data.giveStamina(data.calculateRegen(PlayerResource.STAMINA));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.runTaskTimerAsynchronously(MMOCore.plugin, 100, 20);
|
}.runTaskTimerAsynchronously(MMOCore.plugin, 100, 20);
|
||||||
|
|
||||||
@ -254,9 +248,9 @@ public class MMOCore extends JavaPlugin {
|
|||||||
* produced by people not reading the installation guide...
|
* produced by people not reading the installation guide...
|
||||||
*/
|
*/
|
||||||
if (Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
if (Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with the Mana & Stamina MMOItems!!!");
|
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!");
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with the Mana & Stamina MMOItems!!!");
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -288,6 +282,9 @@ public class MMOCore extends JavaPlugin {
|
|||||||
if (getConfig().getBoolean("death-exp-loss.enabled"))
|
if (getConfig().getBoolean("death-exp-loss.enabled"))
|
||||||
Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this);
|
Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this);
|
||||||
|
|
||||||
|
if (getConfig().getBoolean("disable-vanilla-regen"))
|
||||||
|
Bukkit.getPluginManager().registerEvents(new DisableRegeneration(), this);
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this);
|
Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
|
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this);
|
Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this);
|
||||||
|
@ -94,52 +94,29 @@ public class MMOCoreUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String intToRoman(int input) {
|
private static final String[] romanChars = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M" };
|
||||||
if (input < 1 || input > 499)
|
private static final int[] romanQuantities = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 };
|
||||||
return ">499";
|
|
||||||
|
|
||||||
String s = "";
|
public static String intToRoman(int input) {
|
||||||
while (input >= 400) {
|
if (input < 1)
|
||||||
s += "CD";
|
return "<1";
|
||||||
input -= 400;
|
if (input > 3999)
|
||||||
|
return ">3999";
|
||||||
|
|
||||||
|
String result = "";
|
||||||
|
|
||||||
|
for (int j = 0; j < romanChars.length; j++) {
|
||||||
|
int i = romanChars.length - j - 1;
|
||||||
|
int q = romanQuantities[i];
|
||||||
|
String c = romanChars[i];
|
||||||
|
|
||||||
|
while (input >= q) {
|
||||||
|
result += c;
|
||||||
|
input -= q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (input >= 100) {
|
|
||||||
s += "C";
|
return result;
|
||||||
input -= 100;
|
|
||||||
}
|
|
||||||
while (input >= 90) {
|
|
||||||
s += "XC";
|
|
||||||
input -= 90;
|
|
||||||
}
|
|
||||||
while (input >= 50) {
|
|
||||||
s += "L";
|
|
||||||
input -= 50;
|
|
||||||
}
|
|
||||||
while (input >= 40) {
|
|
||||||
s += "XL";
|
|
||||||
input -= 40;
|
|
||||||
}
|
|
||||||
while (input >= 10) {
|
|
||||||
s += "X";
|
|
||||||
input -= 10;
|
|
||||||
}
|
|
||||||
while (input >= 9) {
|
|
||||||
s += "IX";
|
|
||||||
input -= 9;
|
|
||||||
}
|
|
||||||
while (input >= 5) {
|
|
||||||
s += "V";
|
|
||||||
input -= 5;
|
|
||||||
}
|
|
||||||
while (input >= 4) {
|
|
||||||
s += "IV";
|
|
||||||
input -= 4;
|
|
||||||
}
|
|
||||||
while (input >= 1) {
|
|
||||||
s += "I";
|
|
||||||
input -= 1;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,40 +1,31 @@
|
|||||||
package net.Indyuce.mmocore.api.player;
|
package net.Indyuce.mmocore.api.player;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.ConfigFile;
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||||
|
|
||||||
public class OfflinePlayerData {
|
public abstract class OfflinePlayerData {
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final PlayerData data;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* supports offline player data operations like friend removals which can't
|
|
||||||
* be handled when their player data is not loaded in the data map.
|
|
||||||
*/
|
|
||||||
public OfflinePlayerData(UUID uuid) {
|
public OfflinePlayerData(UUID uuid) {
|
||||||
data = PlayerData.isLoaded(this.uuid = uuid) ? PlayerData.get(uuid) : null;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoaded() {
|
public UUID getUniqueId() {
|
||||||
return data != null;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFriend(UUID uuid) {
|
public abstract void removeFriend(UUID uuid);
|
||||||
if (isLoaded()) {
|
|
||||||
data.removeFriend(uuid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigFile config = new ConfigFile(this.uuid);
|
public abstract boolean hasFriend(UUID uuid);
|
||||||
List<String> friends = config.getConfig().getStringList("friends");
|
|
||||||
friends.remove(uuid.toString());
|
|
||||||
config.getConfig().set("friends", friends);
|
|
||||||
config.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasFriend(UUID uuid) {
|
public abstract PlayerClass getProfess();
|
||||||
return isLoaded() ? data.hasFriend(uuid) : new ConfigFile(this.uuid).getConfig().getStringList("friends").contains(uuid.toString());
|
|
||||||
|
public abstract int getLevel();
|
||||||
|
|
||||||
|
public abstract long getLastLogin();
|
||||||
|
|
||||||
|
public static OfflinePlayerData get(UUID uuid) {
|
||||||
|
return PlayerData.isLoaded(uuid) ? PlayerData.get(uuid) : new SimpleOfflinePlayerData(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
|||||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass.Subclass;
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass.Subclass;
|
||||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
|
||||||
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
||||||
import net.Indyuce.mmocore.api.player.social.Party;
|
import net.Indyuce.mmocore.api.player.social.Party;
|
||||||
import net.Indyuce.mmocore.api.player.social.guilds.Guild;
|
import net.Indyuce.mmocore.api.player.social.guilds.Guild;
|
||||||
@ -49,14 +48,13 @@ import net.Indyuce.mmocore.api.skill.Skill.SkillInfo;
|
|||||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||||
import net.Indyuce.mmocore.api.skill.SkillResult.CancelReason;
|
import net.Indyuce.mmocore.api.skill.SkillResult.CancelReason;
|
||||||
import net.Indyuce.mmocore.listener.SpellCast.SkillCasting;
|
import net.Indyuce.mmocore.listener.SpellCast.SkillCasting;
|
||||||
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.mmogroup.mmolib.MMOLib;
|
import net.mmogroup.mmolib.MMOLib;
|
||||||
import net.mmogroup.mmolib.version.VersionSound;
|
import net.mmogroup.mmolib.version.VersionSound;
|
||||||
|
|
||||||
public class PlayerData {
|
public class PlayerData extends OfflinePlayerData {
|
||||||
|
|
||||||
private final UUID uuid;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* is updated everytime the player joins the server. it is kept when the
|
* is updated everytime the player joins the server. it is kept when the
|
||||||
@ -66,24 +64,23 @@ public class PlayerData {
|
|||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
private PlayerClass profess;
|
private PlayerClass profess;
|
||||||
private final Map<String, SavedClassInformation> classSlots = new HashMap<>();
|
|
||||||
private int level, experience, classPoints, skillPoints, attributePoints, attributeReallocationPoints;// skillReallocationPoints,
|
private int level, experience, classPoints, skillPoints, attributePoints, attributeReallocationPoints;// skillReallocationPoints,
|
||||||
private double mana, stamina, stellium;
|
private double mana, stamina, stellium;
|
||||||
private final Professions collectSkills = new Professions(this);
|
|
||||||
private final PlayerQuests questData;
|
|
||||||
private final Set<String> waypoints = new HashSet<>();
|
|
||||||
private List<UUID> friends;
|
private List<UUID> friends;
|
||||||
private Party party;
|
private Party party;
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
|
private final Map<String, SavedClassInformation> classSlots = new HashMap<>();
|
||||||
private final List<SkillInfo> boundSkills = new ArrayList<>();
|
private final List<SkillInfo> boundSkills = new ArrayList<>();
|
||||||
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
||||||
|
private final Professions collectSkills = new Professions(this);
|
||||||
|
private final PlayerQuests questData;
|
||||||
|
private final Set<String> waypoints = new HashSet<>();
|
||||||
private final PlayerStats playerStats;
|
private final PlayerStats playerStats;
|
||||||
private long lastWaypoint, lastLogin, lastFriendRequest, actionBarTimeOut;
|
|
||||||
|
|
||||||
private final Map<String, Integer> skills = new HashMap<>();
|
private final Map<String, Integer> skills = new HashMap<>();
|
||||||
private final PlayerSkillData skillData = new PlayerSkillData(this);
|
private final PlayerSkillData skillData = new PlayerSkillData(this);
|
||||||
|
|
||||||
|
private long lastWaypoint, lastLogin, lastFriendRequest, actionBarTimeOut;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NON-FINAL player data stuff made public to facilitate field change
|
* NON-FINAL player data stuff made public to facilitate field change
|
||||||
*/
|
*/
|
||||||
@ -95,7 +92,8 @@ public class PlayerData {
|
|||||||
private static Map<UUID, PlayerData> playerData = new HashMap<>();
|
private static Map<UUID, PlayerData> playerData = new HashMap<>();
|
||||||
|
|
||||||
private PlayerData(Player player) {
|
private PlayerData(Player player) {
|
||||||
uuid = player.getUniqueId();
|
super(player.getUniqueId());
|
||||||
|
|
||||||
setPlayer(player);
|
setPlayer(player);
|
||||||
playerStats = new PlayerStats(this);
|
playerStats = new PlayerStats(this);
|
||||||
|
|
||||||
@ -114,7 +112,8 @@ public class PlayerData {
|
|||||||
this.mana = getStats().getStat(StatType.MAX_MANA);
|
this.mana = getStats().getStat(StatType.MAX_MANA);
|
||||||
this.stamina = getStats().getStat(StatType.MAX_STAMINA);
|
this.stamina = getStats().getStat(StatType.MAX_STAMINA);
|
||||||
this.stellium = getStats().getStat(StatType.MAX_STELLIUM);
|
this.stellium = getStats().getStat(StatType.MAX_STELLIUM);
|
||||||
if (config.contains("guild")) this.guild = MMOCore.plugin.guildManager.stillInGuild(getUniqueId(), config.getString("guild"));
|
if (config.contains("guild"))
|
||||||
|
this.guild = MMOCore.plugin.guildManager.stillInGuild(getUniqueId(), config.getString("guild"));
|
||||||
if (config.contains("attribute"))
|
if (config.contains("attribute"))
|
||||||
attributes.load(config.getConfigurationSection("attribute"));
|
attributes.load(config.getConfigurationSection("attribute"));
|
||||||
if (config.contains("profession"))
|
if (config.contains("profession"))
|
||||||
@ -161,8 +160,7 @@ public class PlayerData {
|
|||||||
config.set("waypoints", new ArrayList<>(waypoints));
|
config.set("waypoints", new ArrayList<>(waypoints));
|
||||||
config.set("friends", toStringList(friends));
|
config.set("friends", toStringList(friends));
|
||||||
config.set("last-login", lastLogin);
|
config.set("last-login", lastLogin);
|
||||||
if(guild != null) config.set("guild", guild.getId());
|
config.set("guild", guild != null ? guild.getId() : null);
|
||||||
else config.set("guild", null);
|
|
||||||
|
|
||||||
config.set("skill", null);
|
config.set("skill", null);
|
||||||
skills.entrySet().forEach(entry -> config.set("skill." + entry.getKey(), entry.getValue()));
|
skills.entrySet().forEach(entry -> config.set("skill." + entry.getKey(), entry.getValue()));
|
||||||
@ -245,44 +243,6 @@ public class PlayerData {
|
|||||||
return playerData.values();
|
return playerData.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* START OF EXPERIMENTAL CODE
|
|
||||||
*
|
|
||||||
* This must be more simple to do than my 2AM brain could think of...
|
|
||||||
* - Aria
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static Map<UUID, PlayerDataOfflineValues> offlineValues = new HashMap<>();
|
|
||||||
public static PlayerDataOfflineValues getOfflineValues(UUID uuid) {
|
|
||||||
if(!offlineValues.containsKey(uuid))
|
|
||||||
offlineValues.put(uuid, new PlayerDataOfflineValues(uuid));
|
|
||||||
return offlineValues.get(uuid) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PlayerDataOfflineValues {
|
|
||||||
// Values can be added as they are needed
|
|
||||||
private final PlayerClass profess;
|
|
||||||
private final int level;
|
|
||||||
private final long lastLogin;
|
|
||||||
|
|
||||||
public PlayerDataOfflineValues(UUID uuid) {
|
|
||||||
FileConfiguration config = new ConfigFile(uuid).getConfig();
|
|
||||||
this.profess = MMOCore.plugin.classManager.get(config.getString("class"));
|
|
||||||
this.level = config.getInt("level");
|
|
||||||
this.lastLogin = config.getLong("last-login");
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerClass getProfess()
|
|
||||||
{ return profess; }
|
|
||||||
public int getLevel()
|
|
||||||
{ return level; }
|
|
||||||
public long getLastLogin()
|
|
||||||
{ return lastLogin; }
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* END OF EXPERIMENTAL CODE
|
|
||||||
*/
|
|
||||||
|
|
||||||
private PlayerData setPlayer(Player player) {
|
private PlayerData setPlayer(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.lastLogin = System.currentTimeMillis();
|
this.lastLogin = System.currentTimeMillis();
|
||||||
@ -305,10 +265,7 @@ public class PlayerData {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getUniqueId() {
|
@Override
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastLogin() {
|
public long getLastLogin() {
|
||||||
return lastLogin;
|
return lastLogin;
|
||||||
}
|
}
|
||||||
@ -317,6 +274,7 @@ public class PlayerData {
|
|||||||
return lastFriendRequest;
|
return lastFriendRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getLevel() {
|
public int getLevel() {
|
||||||
return Math.max(1, level);
|
return Math.max(1, level);
|
||||||
}
|
}
|
||||||
@ -445,10 +403,12 @@ public class PlayerData {
|
|||||||
friends.add(uuid);
|
friends.add(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeFriend(UUID uuid) {
|
public void removeFriend(UUID uuid) {
|
||||||
friends.remove(uuid);
|
friends.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasFriend(UUID uuid) {
|
public boolean hasFriend(UUID uuid) {
|
||||||
return friends.contains(uuid);
|
return friends.contains(uuid);
|
||||||
}
|
}
|
||||||
@ -525,8 +485,10 @@ public class PlayerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// display hologram
|
// display hologram
|
||||||
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.exp.enabled")) {
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
|
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
||||||
|
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
value = MMOCore.plugin.boosterManager.calculateExp(null, value);
|
value = MMOCore.plugin.boosterManager.calculateExp(null, value);
|
||||||
value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100;
|
value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100;
|
||||||
@ -567,6 +529,7 @@ public class PlayerData {
|
|||||||
return experience;
|
return experience;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PlayerClass getProfess() {
|
public PlayerClass getProfess() {
|
||||||
return profess == null ? MMOCore.plugin.classManager.getDefaultClass() : profess;
|
return profess == null ? MMOCore.plugin.classManager.getDefaultClass() : profess;
|
||||||
}
|
}
|
||||||
@ -603,14 +566,6 @@ public class PlayerData {
|
|||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRegen(PlayerResource resource) {
|
|
||||||
return getProfess().getHandler(resource).isAvailable(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double calculateRegen(PlayerResource resource) {
|
|
||||||
return getProfess().getHandler(resource).getRegen(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMana(double amount) {
|
public void setMana(double amount) {
|
||||||
mana = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_MANA)));
|
mana = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_MANA)));
|
||||||
}
|
}
|
||||||
@ -821,6 +776,6 @@ public class PlayerData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj != null && obj instanceof PlayerData && ((PlayerData) obj).uuid.equals(uuid);
|
return obj != null && obj instanceof PlayerData && ((PlayerData) obj).getUniqueId().equals(getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmocore.api.player;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -86,8 +87,10 @@ public class Professions {
|
|||||||
exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value);
|
exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value);
|
||||||
|
|
||||||
// display hologram
|
// display hologram
|
||||||
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
if (MMOItems.plugin.getConfig().getBoolean("game-indicators.exp.enabled")) {
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
|
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
||||||
|
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
int needed, exp, level;
|
int needed, exp, level;
|
||||||
boolean check = false;
|
boolean check = false;
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package net.Indyuce.mmocore.api.player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.Indyuce.mmocore.api.ConfigFile;
|
||||||
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||||
|
|
||||||
|
public class SimpleOfflinePlayerData extends OfflinePlayerData {
|
||||||
|
private final ConfigFile config;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* supports offline player data operations like friend removals which can't
|
||||||
|
* be handled when their player data is not loaded in the data map.
|
||||||
|
*/
|
||||||
|
public SimpleOfflinePlayerData(UUID uuid) {
|
||||||
|
super(uuid);
|
||||||
|
|
||||||
|
config = new ConfigFile(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeFriend(UUID uuid) {
|
||||||
|
List<String> friends = config.getConfig().getStringList("friends");
|
||||||
|
friends.remove(uuid.toString());
|
||||||
|
config.getConfig().set("friends", friends);
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFriend(UUID uuid) {
|
||||||
|
return config.getConfig().getStringList("friends").contains(uuid.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayerClass getProfess() {
|
||||||
|
return config.getConfig().contains("class") ? MMOCore.plugin.classManager.get(config.getConfig().getString("class")) : MMOCore.plugin.classManager.getDefaultClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLevel() {
|
||||||
|
return config.getConfig().getInt("level");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getLastLogin() {
|
||||||
|
return config.getConfig().getLong("last-login");
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ import net.Indyuce.mmocore.api.load.MMOLoadException;
|
|||||||
import net.Indyuce.mmocore.api.math.formula.LinearValue;
|
import net.Indyuce.mmocore.api.math.formula.LinearValue;
|
||||||
import net.Indyuce.mmocore.api.math.particle.CastingParticle;
|
import net.Indyuce.mmocore.api.math.particle.CastingParticle;
|
||||||
import net.Indyuce.mmocore.api.player.profess.event.EventTrigger;
|
import net.Indyuce.mmocore.api.player.profess.event.EventTrigger;
|
||||||
|
import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions;
|
||||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||||
import net.Indyuce.mmocore.api.player.profess.resource.ResourceHandler;
|
import net.Indyuce.mmocore.api.player.profess.resource.ResourceHandler;
|
||||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||||
@ -51,9 +52,9 @@ public class PlayerClass {
|
|||||||
private final Map<String, SkillInfo> skills = new LinkedHashMap<>();
|
private final Map<String, SkillInfo> skills = new LinkedHashMap<>();
|
||||||
private final List<Subclass> subclasses = new ArrayList<>();
|
private final List<Subclass> subclasses = new ArrayList<>();
|
||||||
|
|
||||||
private Map<String, EventTrigger> eventTriggers = new HashMap<>();
|
private final Map<PlayerResource, ResourceHandler> resourceHandlers = new HashMap<>();
|
||||||
|
private final Map<String, EventTrigger> eventTriggers = new HashMap<>();
|
||||||
|
|
||||||
private final Map<PlayerResource, ResourceHandler> resources = new HashMap<>();
|
|
||||||
private CastingParticle castParticle = new CastingParticle(Particle.SPELL_INSTANT);
|
private CastingParticle castParticle = new CastingParticle(Particle.SPELL_INSTANT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -68,8 +69,8 @@ public class PlayerClass {
|
|||||||
name = ChatColor.translateAlternateColorCodes('&', config.getString("display.name"));
|
name = ChatColor.translateAlternateColorCodes('&', config.getString("display.name"));
|
||||||
icon = MMOCoreUtils.readIcon(config.getString("display.item"));
|
icon = MMOCoreUtils.readIcon(config.getString("display.item"));
|
||||||
|
|
||||||
if(config.contains("display.texture")) {
|
if (config.contains("display.texture")) {
|
||||||
if(icon.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) {
|
if (icon.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) {
|
||||||
ItemMeta meta = icon.getItemMeta();
|
ItemMeta meta = icon.getItemMeta();
|
||||||
try {
|
try {
|
||||||
Field profileField = meta.getClass().getDeclaredField("profile");
|
Field profileField = meta.getClass().getDeclaredField("profile");
|
||||||
@ -81,8 +82,7 @@ public class PlayerClass {
|
|||||||
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not apply playerhead texture: " + exception.getMessage());
|
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not apply playerhead texture: " + exception.getMessage());
|
||||||
}
|
}
|
||||||
icon.setItemMeta(meta);
|
icon.setItemMeta(meta);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not add player head texture. The item is not a playerhead!");
|
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not add player head texture. The item is not a playerhead!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,8 +141,6 @@ public class PlayerClass {
|
|||||||
for (String key : config.getConfigurationSection("triggers").getKeys(false)) {
|
for (String key : config.getConfigurationSection("triggers").getKeys(false)) {
|
||||||
try {
|
try {
|
||||||
String format = key.toLowerCase().replace("_", "-").replace(" ", "-");
|
String format = key.toLowerCase().replace("_", "-").replace(" ", "-");
|
||||||
// Validate.isTrue(MMOCore.plugin.classManager.isEventRegistered(format),
|
|
||||||
// "Could not find trigger event called '" + format + "'");
|
|
||||||
eventTriggers.put(format, new EventTrigger(format, config.getStringList("triggers." + key)));
|
eventTriggers.put(format, new EventTrigger(format, config.getStringList("triggers." + key)));
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] " + exception.getMessage());
|
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] " + exception.getMessage());
|
||||||
@ -150,8 +148,21 @@ public class PlayerClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PlayerResource resource : PlayerResource.values())
|
/*
|
||||||
resources.put(resource, new ResourceHandler(this, resource));
|
* must make sure all the resourceHandlers are registered when the
|
||||||
|
* placer class is initialized.
|
||||||
|
*/
|
||||||
|
for (PlayerResource resource : PlayerResource.values()) {
|
||||||
|
if (config.isConfigurationSection("resource." + resource.name().toLowerCase()))
|
||||||
|
try {
|
||||||
|
resourceHandlers.put(resource, new ResourceHandler(resource, config.getConfigurationSection("resource." + resource.name().toLowerCase())));
|
||||||
|
} catch (IllegalArgumentException exception) {
|
||||||
|
MMOCore.log(Level.WARNING, "[PlayerClasses:" + id + "] Could not load special resource regen for " + resource.name() + ": " + exception.getMessage());
|
||||||
|
resourceHandlers.put(resource, new ResourceHandler(resource));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
resourceHandlers.put(resource, new ResourceHandler(resource));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -170,7 +181,7 @@ public class PlayerClass {
|
|||||||
setOption(ClassOption.DEFAULT, false);
|
setOption(ClassOption.DEFAULT, false);
|
||||||
|
|
||||||
for (PlayerResource resource : PlayerResource.values())
|
for (PlayerResource resource : PlayerResource.values())
|
||||||
resources.put(resource, new ResourceHandler(this, resource));
|
resourceHandlers.put(resource, new ResourceHandler(resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadSubclasses(ClassManager manager) {
|
public void loadSubclasses(ClassManager manager) {
|
||||||
@ -193,7 +204,7 @@ public class PlayerClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResourceHandler getHandler(PlayerResource resource) {
|
public ResourceHandler getHandler(PlayerResource resource) {
|
||||||
return resources.get(resource);
|
return resourceHandlers.get(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxLevel() {
|
public int getMaxLevel() {
|
||||||
@ -311,26 +322,13 @@ public class PlayerClass {
|
|||||||
*/
|
*/
|
||||||
DISPLAY(true),
|
DISPLAY(true),
|
||||||
|
|
||||||
/*
|
|
||||||
* resource regeneration depends on max resource
|
|
||||||
*/
|
|
||||||
MISSING_HEALTH_REGEN,
|
|
||||||
MISSING_MANA_REGEN,
|
|
||||||
MISSING_STAMINA_REGEN,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* resource regeneration depends on missing resource
|
|
||||||
*/
|
|
||||||
MAX_HEALTH_REGEN,
|
|
||||||
MAX_MANA_REGEN,
|
|
||||||
MAX_STAMINA_REGEN,
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* only regen resource when out of combat
|
* only regen resource when out of combat
|
||||||
*/
|
*/
|
||||||
OFF_COMBAT_HEALTH_REGEN,
|
OFF_COMBAT_HEALTH_REGEN,
|
||||||
OFF_COMBAT_MANA_REGEN(true),
|
OFF_COMBAT_MANA_REGEN,
|
||||||
OFF_COMBAT_STAMINA_REGEN;
|
OFF_COMBAT_STAMINA_REGEN,
|
||||||
|
OFF_COMBAT_STELLIUM_REGEN;
|
||||||
|
|
||||||
private final boolean def;
|
private final boolean def;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmocore.api.player.profess;
|
package net.Indyuce.mmocore.api.player.profess.resource;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -27,8 +27,8 @@ public class ManaDisplayOptions {
|
|||||||
|
|
||||||
public ManaDisplayOptions(ChatColor color, String name, char barCharacter) {
|
public ManaDisplayOptions(ChatColor color, String name, char barCharacter) {
|
||||||
Validate.notNull(color, "Color cannot be null");
|
Validate.notNull(color, "Color cannot be null");
|
||||||
Validate.notNull(name, "name cannot be null");
|
Validate.notNull(name, "Name cannot be null");
|
||||||
Validate.notNull(barCharacter, "barCharacter cannot be null");
|
Validate.notNull(barCharacter, "Bar character cannot be null");
|
||||||
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.name = name;
|
this.name = name;
|
@ -1,5 +1,6 @@
|
|||||||
package net.Indyuce.mmocore.api.player.profess.resource;
|
package net.Indyuce.mmocore.api.player.profess.resource;
|
||||||
|
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
@ -13,44 +14,41 @@ public enum PlayerResource {
|
|||||||
/*
|
/*
|
||||||
* used to handle resource regeneration.
|
* used to handle resource regeneration.
|
||||||
*/
|
*/
|
||||||
HEALTH(StatType.HEALTH_REGENERATION, ClassOption.OFF_COMBAT_HEALTH_REGEN, ClassOption.MAX_HEALTH_REGEN, ClassOption.MISSING_HEALTH_REGEN, (data) -> data.getPlayer().getHealth(), (data) -> data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()),
|
HEALTH(StatType.HEALTH_REGENERATION, ClassOption.OFF_COMBAT_HEALTH_REGEN, (data) -> data.getPlayer().getHealth(), (data) -> data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), (data, d) -> data.heal(d)),
|
||||||
MANA(StatType.MANA_REGENERATION, ClassOption.OFF_COMBAT_MANA_REGEN, ClassOption.MAX_MANA_REGEN, ClassOption.MISSING_MANA_REGEN, (data) -> data.getMana(), (data) -> data.getStats().getStat(StatType.MAX_MANA)),
|
MANA(StatType.MANA_REGENERATION, ClassOption.OFF_COMBAT_MANA_REGEN, (data) -> data.getMana(), (data) -> data.getStats().getStat(StatType.MAX_MANA), (data, d) -> data.giveMana(d)),
|
||||||
STAMINA(StatType.STAMINA_REGENERATION, ClassOption.OFF_COMBAT_STAMINA_REGEN, ClassOption.MAX_STAMINA_REGEN, ClassOption.MISSING_STAMINA_REGEN, (data) -> data.getStamina(), (data) -> data.getStats().getStat(StatType.MAX_STAMINA));
|
STAMINA(StatType.STAMINA_REGENERATION, ClassOption.OFF_COMBAT_STAMINA_REGEN, (data) -> data.getStamina(), (data) -> data.getStats().getStat(StatType.MAX_STAMINA), (data, d) -> data.giveStamina(d)),
|
||||||
|
STELLIUM(StatType.STELLIUM_REGENERATION, ClassOption.OFF_COMBAT_STELLIUM_REGEN, (data) -> data.getStellium(), (data) -> data.getStats().getStat(StatType.MAX_STELLIUM), (data, d) -> data.giveStellium(d));
|
||||||
|
|
||||||
private final StatType regenStat;
|
private final StatType regenStat;
|
||||||
private final ClassOption offCombatRegen, maxRegen, missingRegen;
|
private final ClassOption offCombatRegen;
|
||||||
private final Function<PlayerData, Double> current, max;
|
private final Function<PlayerData, Double> current, max;
|
||||||
|
private final BiConsumer<PlayerData, Double> regen;
|
||||||
|
|
||||||
private PlayerResource(StatType regenStat, ClassOption offCombatRegen, ClassOption maxRegen, ClassOption missingRegen, Function<PlayerData, Double> current, Function<PlayerData, Double> max) {
|
private PlayerResource(StatType regenStat, ClassOption offCombatRegen, Function<PlayerData, Double> current, Function<PlayerData, Double> max, BiConsumer<PlayerData, Double> regen) {
|
||||||
this.regenStat = regenStat;
|
this.regenStat = regenStat;
|
||||||
this.offCombatRegen = offCombatRegen;
|
this.offCombatRegen = offCombatRegen;
|
||||||
this.maxRegen = maxRegen;
|
|
||||||
this.missingRegen = missingRegen;
|
|
||||||
this.current = current;
|
this.current = current;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
this.regen = regen;
|
||||||
|
|
||||||
public ClassOption getMaxRegen() {
|
|
||||||
return maxRegen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClassOption getMissingRegen() {
|
|
||||||
return missingRegen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClassOption getOffCombatRegen() {
|
|
||||||
return offCombatRegen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatType getRegenStat() {
|
public StatType getRegenStat() {
|
||||||
return regenStat;
|
return regenStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getCurrent(PlayerData data) {
|
public ClassOption getOffCombatRegen() {
|
||||||
return current.apply(data);
|
return offCombatRegen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMax(PlayerData data) {
|
public double getCurrent(PlayerData player) {
|
||||||
return max.apply(data);
|
return current.apply(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMax(PlayerData player) {
|
||||||
|
return max.apply(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void regen(PlayerData player, double amount) {
|
||||||
|
regen.accept(player, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,92 @@
|
|||||||
package net.Indyuce.mmocore.api.player.profess.resource;
|
package net.Indyuce.mmocore.api.player.profess.resource;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.api.math.formula.LinearValue;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
|
||||||
|
|
||||||
public class ResourceHandler {
|
public class ResourceHandler {
|
||||||
private final Function<PlayerData, Double> regen;
|
|
||||||
private final Predicate<PlayerData> available;
|
|
||||||
|
|
||||||
public ResourceHandler(PlayerClass profess, PlayerResource resource) {
|
/*
|
||||||
available = profess.hasOption(resource.getOffCombatRegen()) ? (data) -> !data.isInCombat() : (data) -> true;
|
* resource regeneration only applies when player is off combat
|
||||||
regen = profess.hasOption(resource.getMaxRegen()) ? (data) -> resource.getMax(data) * data.getStats().getStat(resource.getRegenStat()) / 100 : profess.hasOption(resource.getMissingRegen()) ? (data) -> Math.max(0, resource.getMax(data) - resource.getCurrent(data)) * data.getStats().getStat(resource.getRegenStat()) / 100 : (data) -> data.getStats().getStat(resource.getRegenStat());
|
*/
|
||||||
|
private final boolean offCombatOnly;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* percentage of scaling which the player regenerates every second
|
||||||
|
*/
|
||||||
|
private final LinearValue scalar;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* whether the resource regeneration scales on missing or max resource. if
|
||||||
|
* TYPE is null, then there is no special regeneration.
|
||||||
|
*/
|
||||||
|
private final HandlerType type;
|
||||||
|
private final PlayerResource resource;
|
||||||
|
|
||||||
|
public ResourceHandler(PlayerResource resource) {
|
||||||
|
this(resource, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAvailable(PlayerData data) {
|
public ResourceHandler(PlayerResource resource, ConfigurationSection config) {
|
||||||
return available.test(data);
|
this.resource = resource;
|
||||||
|
offCombatOnly = config.getBoolean("off-combat");
|
||||||
|
|
||||||
|
Validate.isTrue(config.contains("type"), "Could not find resource regen scaling type");
|
||||||
|
type = HandlerType.valueOf(config.getString("type").toUpperCase());
|
||||||
|
|
||||||
|
Validate.notNull(config.getConfigurationSection("value"), "Could not find resource regen value config section");
|
||||||
|
scalar = new LinearValue(config.getConfigurationSection("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getRegen(PlayerData data) {
|
public ResourceHandler(PlayerResource resource, HandlerType type, LinearValue scalar, boolean offCombatOnly) {
|
||||||
return regen.apply(data);
|
this.resource = resource;
|
||||||
|
this.type = type;
|
||||||
|
this.scalar = scalar;
|
||||||
|
this.offCombatOnly = offCombatOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* REGENERATION FORMULAS HERE.
|
||||||
|
*/
|
||||||
|
public double getRegen(PlayerData player) {
|
||||||
|
|
||||||
|
double d = 0;
|
||||||
|
|
||||||
|
// base resource regeneration = value of the corresponding regen stat
|
||||||
|
if (!player.isInCombat() || !player.getProfess().hasOption(resource.getOffCombatRegen()))
|
||||||
|
d += player.getStats().getStat(resource.getRegenStat());
|
||||||
|
|
||||||
|
// extra resource regeneration based on CLASS, scales on LEVEL
|
||||||
|
if (type != null && (!player.isInCombat() || !offCombatOnly))
|
||||||
|
d = this.scalar.calculate(player.getLevel()) / 100 * type.getScaling(player, resource);
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum HandlerType {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* resource regeneration scales on max resource
|
||||||
|
*/
|
||||||
|
MAX((player, resource) -> resource.getMax(player)),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* resource regeneration scales on missing resource
|
||||||
|
*/
|
||||||
|
MISSING((player, resource) -> resource.getMax(player) - resource.getCurrent(player));
|
||||||
|
|
||||||
|
private final BiFunction<PlayerData, PlayerResource, Double> calculation;
|
||||||
|
|
||||||
|
private HandlerType(BiFunction<PlayerData, PlayerResource, Double> calculation) {
|
||||||
|
this.calculation = calculation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getScaling(PlayerData player, PlayerResource resource) {
|
||||||
|
return calculation.apply(player, resource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.Indyuce.mmocore.api.quest.trigger;
|
package net.Indyuce.mmocore.api.quest.trigger;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
@ -8,7 +7,7 @@ import net.Indyuce.mmocore.api.load.MMOLineConfig;
|
|||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
|
||||||
public class MessageTrigger extends Trigger {
|
public class MessageTrigger extends Trigger {
|
||||||
private String message;
|
private final String message;
|
||||||
|
|
||||||
public MessageTrigger(MMOLineConfig config) {
|
public MessageTrigger(MMOLineConfig config) {
|
||||||
super(config);
|
super(config);
|
||||||
@ -23,7 +22,6 @@ public class MessageTrigger extends Trigger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String format(Player player) {
|
private String format(Player player) {
|
||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
|
||||||
return MMOCore.plugin.placeholderParser.parse(player, message.replace("%player%", player.getName()));
|
return MMOCore.plugin.placeholderParser.parse(player, message.replace("%player%", player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class FriendsCommand extends BukkitCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new OfflinePlayerData(((Player) sender).getUniqueId()).hasFriend(uuid)) {
|
if (OfflinePlayerData.get(((Player) sender).getUniqueId()).hasFriend(uuid)) {
|
||||||
MMOCore.plugin.requestManager.unregisterRequest(uuid);
|
MMOCore.plugin.requestManager.unregisterRequest(uuid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,10 @@ public class AdminCommandMap extends CommandMap {
|
|||||||
addFloor(new PointsCommandMap("attribute", this, (data, points) -> data.setAttributePoints(points), (data, points) -> data.giveAttributePoints(points), (data) -> data.getAttributePoints()));
|
addFloor(new PointsCommandMap("attribute", this, (data, points) -> data.setAttributePoints(points), (data, points) -> data.giveAttributePoints(points), (data) -> data.getAttributePoints()));
|
||||||
addFloor(new PointsCommandMap("attr-realloc", this, (data, points) -> data.setAttributeReallocationPoints(points), (data, points) -> data.giveAttributeReallocationPoints(points), (data) -> data.getAttributeReallocationPoints()));
|
addFloor(new PointsCommandMap("attr-realloc", this, (data, points) -> data.setAttributeReallocationPoints(points), (data, points) -> data.giveAttributeReallocationPoints(points), (data) -> data.getAttributeReallocationPoints()));
|
||||||
|
|
||||||
addFloor(new ResourcesCommandMap("mana", this, (data, value) -> data.setMana(value), (data, value) -> data.giveMana(value), (data, value) -> data.giveMana(-value), (data) -> data.getMana()));
|
addFloor(new ResourceCommandMap("health", this, (data, value) -> data.getPlayer().setHealth(value), (data, value) -> data.heal(value), (data, value) -> data.heal(-value), (data) -> data.getPlayer().getHealth()));
|
||||||
addFloor(new ResourcesCommandMap("stamina", this, (data, value) -> data.setStamina(value), (data, value) -> data.giveStamina(value), (data, value) -> data.giveStamina(-value), (data) -> data.getStamina()));
|
addFloor(new ResourceCommandMap("mana", this, (data, value) -> data.setMana(value), (data, value) -> data.giveMana(value), (data, value) -> data.giveMana(-value), (data) -> data.getMana()));
|
||||||
addFloor(new ResourcesCommandMap("stellium", this, (data, value) -> data.setStellium(value), (data, value) -> data.giveStellium(value), (data, value) -> data.giveStellium(-value), (data) -> data.getStellium()));
|
addFloor(new ResourceCommandMap("stamina", this, (data, value) -> data.setStamina(value), (data, value) -> data.giveStamina(value), (data, value) -> data.giveStamina(-value), (data) -> data.getStamina()));
|
||||||
|
addFloor(new ResourceCommandMap("stellium", this, (data, value) -> data.setStellium(value), (data, value) -> data.giveStellium(value), (data, value) -> data.giveStellium(-value), (data) -> data.getStellium()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,11 +13,11 @@ import net.Indyuce.mmocore.command.api.CommandEnd;
|
|||||||
import net.Indyuce.mmocore.command.api.CommandMap;
|
import net.Indyuce.mmocore.command.api.CommandMap;
|
||||||
import net.Indyuce.mmocore.command.api.Parameter;
|
import net.Indyuce.mmocore.command.api.Parameter;
|
||||||
|
|
||||||
public class ResourcesCommandMap extends CommandMap {
|
public class ResourceCommandMap extends CommandMap {
|
||||||
private final String type;
|
private final String type;
|
||||||
private final Function<PlayerData, Double> get;
|
private final Function<PlayerData, Double> get;
|
||||||
|
|
||||||
public ResourcesCommandMap(String type, CommandMap parent, BiConsumer<PlayerData, Double> set, BiConsumer<PlayerData, Double> give, BiConsumer<PlayerData, Double> take, Function<PlayerData, Double> get) {
|
public ResourceCommandMap(String type, CommandMap parent, BiConsumer<PlayerData, Double> set, BiConsumer<PlayerData, Double> give, BiConsumer<PlayerData, Double> take, Function<PlayerData, Double> get) {
|
||||||
super(parent, "resource-" + type);
|
super(parent, "resource-" + type);
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
@ -53,7 +53,7 @@ public class EditableFriendRemoval extends EditableInventory {
|
|||||||
public void whenClicked(InventoryClickEvent event, InventoryItem item) {
|
public void whenClicked(InventoryClickEvent event, InventoryItem item) {
|
||||||
if (item.getFunction().equals("yes")) {
|
if (item.getFunction().equals("yes")) {
|
||||||
playerData.removeFriend(friend.getUniqueId());
|
playerData.removeFriend(friend.getUniqueId());
|
||||||
new OfflinePlayerData(friend.getUniqueId()).removeFriend(playerData.getUniqueId());
|
OfflinePlayerData.get(friend.getUniqueId()).removeFriend(playerData.getUniqueId());
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("no-longer-friends", "unfriend", friend.getName()).send(player);
|
MMOCore.plugin.configManager.getSimpleMessage("no-longer-friends", "unfriend", friend.getName()).send(player);
|
||||||
last.open();
|
last.open();
|
||||||
|
@ -17,8 +17,8 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.input.PlayerInput.InputType;
|
import net.Indyuce.mmocore.api.input.PlayerInput.InputType;
|
||||||
import net.Indyuce.mmocore.api.math.format.DelayFormat;
|
import net.Indyuce.mmocore.api.math.format.DelayFormat;
|
||||||
|
import net.Indyuce.mmocore.api.player.OfflinePlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData.PlayerDataOfflineValues;
|
|
||||||
import net.Indyuce.mmocore.gui.api.EditableInventory;
|
import net.Indyuce.mmocore.gui.api.EditableInventory;
|
||||||
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||||
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
||||||
@ -36,8 +36,7 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventoryItem load(String function, ConfigurationSection config) {
|
public InventoryItem load(String function, ConfigurationSection config) {
|
||||||
return function.equals("member") ? new MemberItem(config) : (function.equals("next") || function.equals("previous")
|
return function.equals("member") ? new MemberItem(config) : (function.equals("next") || function.equals("previous") || function.equals("disband") || function.equals("invite")) ? new ConditionalItem(function, config) : new NoPlaceholderItem(config);
|
||||||
|| function.equals("disband") || function.equals("invite")) ? new ConditionalItem(function, config) : new NoPlaceholderItem(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MemberDisplayItem extends InventoryPlaceholderItem {
|
public class MemberDisplayItem extends InventoryPlaceholderItem {
|
||||||
@ -49,25 +48,16 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
public Placeholders getPlaceholders(PluginInventory inv, int n) {
|
public Placeholders getPlaceholders(PluginInventory inv, int n) {
|
||||||
UUID uuid = inv.getPlayerData().getGuild().getMembers().get(n);
|
UUID uuid = inv.getPlayerData().getGuild().getMembers().get(n);
|
||||||
Placeholders holders = new Placeholders();
|
Placeholders holders = new Placeholders();
|
||||||
/**
|
/*
|
||||||
* Will never be null since a players name
|
* Will never be null since a players name will always be recorded
|
||||||
* will always be recorded if they've been in a guild
|
* if they've been in a guild
|
||||||
*/
|
*/
|
||||||
holders.register("name", Bukkit.getOfflinePlayer(uuid).getName());
|
holders.register("name", Bukkit.getOfflinePlayer(uuid).getName());
|
||||||
|
|
||||||
if(PlayerData.get(uuid) == null) {
|
OfflinePlayerData offline = OfflinePlayerData.get(uuid);
|
||||||
PlayerDataOfflineValues pdov = PlayerData.getOfflineValues(uuid);
|
holders.register("class", offline.getProfess().getName());
|
||||||
holders.register("class", pdov.getProfess().getName());
|
holders.register("level", offline.getLevel());
|
||||||
holders.register("level", "" + pdov.getLevel());
|
holders.register("since", new DelayFormat(2).format(System.currentTimeMillis() - offline.getLastLogin()));
|
||||||
holders.register("since", new DelayFormat(2).format(System.currentTimeMillis() - pdov.getLastLogin()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayerData member = PlayerData.get(uuid);
|
|
||||||
holders.register("class", member.getProfess().getName());
|
|
||||||
holders.register("level", "" + member.getLevel());
|
|
||||||
holders.register("since", new DelayFormat(2).format(System.currentTimeMillis() - member.getLastLogin()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return holders;
|
return holders;
|
||||||
}
|
}
|
||||||
@ -134,13 +124,12 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
public ItemStack display(GeneratedInventory invpar, int n) {
|
public ItemStack display(GeneratedInventory invpar, int n) {
|
||||||
GuildViewInventory inv = (GuildViewInventory) invpar;
|
GuildViewInventory inv = (GuildViewInventory) invpar;
|
||||||
|
|
||||||
if(function.equals("next"))
|
if (function.equals("next"))
|
||||||
if(inv.getPage() == (int) Math.ceil((inv.getPlayerData().getGuild().getMembers().count() + 20) / inv.getByFunction("member").getSlots().size()))
|
if (inv.getPage() == (int) Math.ceil((inv.getPlayerData().getGuild().getMembers().count() + 20) / inv.getByFunction("member").getSlots().size()))
|
||||||
return null;
|
return null;
|
||||||
if(function.equals("previous") && inv.getPage() == 1)
|
if (function.equals("previous") && inv.getPage() == 1)
|
||||||
return null;
|
return null;
|
||||||
if((function.equals("disband") || function.equals("invite")) && !inv.getPlayerData()
|
if ((function.equals("disband") || function.equals("invite")) && !inv.getPlayerData().getGuild().getOwner().equals(inv.getPlayer().getUniqueId()))
|
||||||
.getGuild().getOwner().equals(inv.getPlayer().getUniqueId()))
|
|
||||||
return null;
|
return null;
|
||||||
return super.display(inv, n);
|
return super.display(inv, n);
|
||||||
}
|
}
|
||||||
@ -157,19 +146,12 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
public GuildViewInventory(PlayerData playerData, EditableInventory editable) {
|
public GuildViewInventory(PlayerData playerData, EditableInventory editable) {
|
||||||
super(playerData, editable);
|
super(playerData, editable);
|
||||||
|
|
||||||
maxpages = (int) Math.ceil((playerData.getGuild().getMembers().count() + 20) /
|
maxpages = (int) Math.ceil((playerData.getGuild().getMembers().count() + 20) / editable.getByFunction("member").getSlots().size());
|
||||||
editable.getByFunction("member").getSlots().size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String calculateName() {
|
public String calculateName() {
|
||||||
return getName()
|
return getName().replace("{online_players}", "" + getPlayerData().getGuild().getMembers().countOnline()).replace("{page}", "" + page).replace("{maxpages}", "" + maxpages).replace("{players}", "" + getPlayerData().getGuild().getMembers().count()).replace("{tag}", getPlayerData().getGuild().getTag()).replace("{name}", getPlayerData().getGuild().getName());
|
||||||
.replace("{online_players}", "" + getPlayerData().getGuild().getMembers().countOnline())
|
|
||||||
.replace("{page}", "" + page)
|
|
||||||
.replace("{maxpages}", "" + maxpages)
|
|
||||||
.replace("{players}", "" + getPlayerData().getGuild().getMembers().count())
|
|
||||||
.replace("{tag}", getPlayerData().getGuild().getTag())
|
|
||||||
.replace("{name}", getPlayerData().getGuild().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -181,11 +163,17 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getFunction().equals("next") && page != maxpages)
|
if (item.getFunction().equals("next") && page != maxpages) {
|
||||||
{ page++; open(); return; }
|
page++;
|
||||||
|
open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.getFunction().equals("previous") && page != 1)
|
if (item.getFunction().equals("previous") && page != 1) {
|
||||||
{ page--; open(); return; }
|
page--;
|
||||||
|
open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.getFunction().equals("disband")) {
|
if (item.getFunction().equals("disband")) {
|
||||||
if (!playerData.getGuild().getOwner().equals(playerData.getUniqueId()))
|
if (!playerData.getGuild().getOwner().equals(playerData.getUniqueId()))
|
||||||
@ -200,11 +188,12 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
if (!playerData.getGuild().getOwner().equals(playerData.getUniqueId()))
|
if (!playerData.getGuild().getOwner().equals(playerData.getUniqueId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/**if (playerData.getGuild().getMembers().count() >= max) {
|
/**
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("guild-is-full").send(player);
|
* if (playerData.getGuild().getMembers().count() >= max) {
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
|
* MMOCore.plugin.configManager.getSimpleMessage("guild-is-full").send(player);
|
||||||
return;
|
* player.playSound(player.getLocation(),
|
||||||
}*/
|
* Sound.ENTITY_VILLAGER_NO, 1, 1); return; }
|
||||||
|
*/
|
||||||
|
|
||||||
MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_INVITE, (input) -> {
|
MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_INVITE, (input) -> {
|
||||||
Player target = Bukkit.getPlayer(input);
|
Player target = Bukkit.getPlayer(input);
|
||||||
@ -251,7 +240,8 @@ public class EditableGuildView extends EditableInventory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPage()
|
public int getPage() {
|
||||||
{ return page; }
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package net.Indyuce.mmocore.listener.option;
|
||||||
|
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
|
|
||||||
|
public class DisableRegeneration implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void a(EntityRegainHealthEvent event) {
|
||||||
|
if (event.getEntityType() == EntityType.PLAYER)
|
||||||
|
if (event.getRegainReason() == RegainReason.SATIATED || event.getRegainReason() == RegainReason.REGEN || event.getRegainReason() == RegainReason.EATING)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
@ -124,17 +124,14 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatColor getColorOrDefault(String configKey, ChatColor defaultColor) {
|
private ChatColor getColorOrDefault(String key, ChatColor defaultColor) {
|
||||||
ChatColor newColor;
|
|
||||||
try {
|
try {
|
||||||
newColor = ChatColor.valueOf(MMOCore.plugin.getConfig().getString("resource-bar-colors." + configKey).toUpperCase());
|
return ChatColor.valueOf(MMOCore.plugin.getConfig().getString("resource-bar-colors." + key).toUpperCase());
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(IllegalArgumentException exception) {
|
||||||
MMOCore.log(Level.WARNING, "Resource Bar color config '" + configKey + "' is invalid... Using default color.");
|
MMOCore.log(Level.WARNING, "Could not read resource bar color from '" + key + "': using default.");
|
||||||
newColor = defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecimalFormat newFormat(String pattern) {
|
public DecimalFormat newFormat(String pattern) {
|
||||||
|
@ -70,6 +70,16 @@ health-scale:
|
|||||||
enabled: true
|
enabled: true
|
||||||
scale: 20
|
scale: 20
|
||||||
|
|
||||||
|
# Disable player health regen due to saturation and eating
|
||||||
|
# to control health regen via MMOCore resource regen.
|
||||||
|
# Requires a SERVER reload when changed.
|
||||||
|
disable-vanilla-regen: false
|
||||||
|
|
||||||
|
# Allows to toggle exp hologram from gaining experiences
|
||||||
|
game-indicators:
|
||||||
|
exp:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
# Players can swap their hotbar with the 9 inventory slots
|
# Players can swap their hotbar with the 9 inventory slots
|
||||||
# right above it by pressing [swap items] while crouching.
|
# right above it by pressing [swap items] while crouching.
|
||||||
hotbar-swap: true
|
hotbar-swap: true
|
||||||
|
@ -5,14 +5,6 @@ options:
|
|||||||
default: true
|
default: true
|
||||||
display: false
|
display: false
|
||||||
|
|
||||||
# Health/mana regen scales on missing health/mana
|
|
||||||
missing-health-regen: false
|
|
||||||
missing-mana-regen: false
|
|
||||||
|
|
||||||
# Resource regen scales on max mana/health
|
|
||||||
max-health-regen: false
|
|
||||||
max-mana-regen: false
|
|
||||||
|
|
||||||
# Only regens when out of combat
|
# Only regens when out of combat
|
||||||
off-combat-health-regen: false
|
off-combat-health-regen: false
|
||||||
off-combat-mana-regen: false
|
off-combat-mana-regen: false
|
||||||
|
@ -44,6 +44,25 @@ cast-particle:
|
|||||||
options:
|
options:
|
||||||
off-combat-health-regen: true
|
off-combat-health-regen: true
|
||||||
|
|
||||||
|
# Special resource regeneration: (when out of combat),
|
||||||
|
# players can regen a set % of their maximum mana/missing mana.
|
||||||
|
# This % can scale with the player level.
|
||||||
|
# It also works with other player resources: health, stellium and stamina!
|
||||||
|
resource:
|
||||||
|
mana:
|
||||||
|
|
||||||
|
# Scales with max mana.
|
||||||
|
type: MAX
|
||||||
|
|
||||||
|
# Regen from 3 to 10% of max mana every second
|
||||||
|
value:
|
||||||
|
base: 3
|
||||||
|
per-level: .1
|
||||||
|
max: 10
|
||||||
|
|
||||||
|
# Only regen when out of combat.
|
||||||
|
off-combat: true
|
||||||
|
|
||||||
attributes:
|
attributes:
|
||||||
max-health:
|
max-health:
|
||||||
base: 18
|
base: 18
|
||||||
|
@ -40,6 +40,25 @@ mana:
|
|||||||
cast-particle:
|
cast-particle:
|
||||||
particle: CRIT
|
particle: CRIT
|
||||||
|
|
||||||
|
# Special resource regeneration: (when out of combat),
|
||||||
|
# players can regen a set % of their stamina mana/missing stamina.
|
||||||
|
# This % can scale with the player level.
|
||||||
|
# It also works with other player resources: health, stellium and mana!
|
||||||
|
resource:
|
||||||
|
stamina:
|
||||||
|
|
||||||
|
# Regen scales with missing stamina.
|
||||||
|
type: MISSING
|
||||||
|
|
||||||
|
# Regen from 3 to 10% of missing stamina every second
|
||||||
|
value:
|
||||||
|
base: 5
|
||||||
|
per-level: .2
|
||||||
|
max: 13
|
||||||
|
|
||||||
|
# Only regen when out of combat.
|
||||||
|
off-combat: true
|
||||||
|
|
||||||
skills:
|
skills:
|
||||||
WEAKEN:
|
WEAKEN:
|
||||||
level: 3
|
level: 3
|
||||||
|
@ -35,7 +35,6 @@ triggers:
|
|||||||
options:
|
options:
|
||||||
off-combat-mana-regen: true
|
off-combat-mana-regen: true
|
||||||
off-combat-health-regen: true
|
off-combat-health-regen: true
|
||||||
missing-health-regen: true
|
|
||||||
|
|
||||||
cast-particle:
|
cast-particle:
|
||||||
particle: SPELL_WITCH
|
particle: SPELL_WITCH
|
||||||
|
Loading…
Reference in New Issue
Block a user