mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Allow soft limits to stop income increase after certain level, but allow
further leveling.
This commit is contained in:
parent
cf9db10eae
commit
4844547d19
@ -51,6 +51,7 @@ import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.container.JobPermission;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class ConfigManager {
|
||||
private Jobs plugin;
|
||||
@ -484,6 +485,16 @@ public class ConfigManager {
|
||||
job.setXpEquation(expEquation);
|
||||
job.setPointsEquation(pointsEquation);
|
||||
|
||||
Integer softIncomeLimit = null;
|
||||
Integer softExpLimit = null;
|
||||
Integer softPointsLimit = null;
|
||||
if (jobSection.isInt("softIncomeLimit"))
|
||||
softIncomeLimit = jobSection.getInt("softIncomeLimit");
|
||||
if (jobSection.isInt("softExpLimit"))
|
||||
softExpLimit = jobSection.getInt("softExpLimit");
|
||||
if (jobSection.isInt("softPointsLimit"))
|
||||
softPointsLimit = jobSection.getInt("softPointsLimit");
|
||||
|
||||
for (ActionType actionType : ActionType.values()) {
|
||||
ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
|
||||
ArrayList<JobInfo> jobInfo = new ArrayList<JobInfo>();
|
||||
@ -686,7 +697,7 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
jobInfo.add(new JobInfo(actionType, id, meta, type + subType, income, incomeEquation, experience, expEquation, pointsEquation, points, fromlevel,
|
||||
untilLevel, section.getCurrentPath()));
|
||||
untilLevel, section.getCurrentPath(), softIncomeLimit, softExpLimit, softPointsLimit));
|
||||
}
|
||||
}
|
||||
job.setJobInfo(actionType, jobInfo);
|
||||
|
@ -10,7 +10,7 @@ public class BossBarInfo {
|
||||
int id = -1;
|
||||
|
||||
public BossBarInfo(String PlayerName, String jobName, BossBar bar) {
|
||||
this.PlayerName =PlayerName;
|
||||
this.PlayerName = PlayerName;
|
||||
this.jobName = jobName;
|
||||
this.bar = bar;
|
||||
}
|
||||
|
@ -30,11 +30,19 @@ public class JobInfo {
|
||||
private Parser moneyEquation, xpEquation, pointsEquation;
|
||||
private int fromLevel = 0;
|
||||
private int untilLevel = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
private String configPath = "";
|
||||
private Integer softIncomeLevelLimit;
|
||||
private Integer softExpLevelLimit;
|
||||
private Integer softPointsLevelLimit;
|
||||
|
||||
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation,
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath) {
|
||||
this(actionType, id, meta, name, baseIncome, moneyEquation, baseXp, xpEquation, pointsEquation, basePoints, fromLevel, untilLevel, configPath, null, null, null);
|
||||
}
|
||||
|
||||
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation,
|
||||
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel, String configPath, Integer softIncomeLevelLimit, Integer softExpLevelLimit, Integer softPointsLevelLimit) {
|
||||
this.actionType = actionType;
|
||||
this.id = id;
|
||||
this.meta = meta;
|
||||
@ -48,7 +56,9 @@ public class JobInfo {
|
||||
this.fromLevel = fromLevel;
|
||||
this.untilLevel = untilLevel;
|
||||
this.configPath = configPath;
|
||||
|
||||
this.softIncomeLevelLimit = softIncomeLevelLimit;
|
||||
this.softExpLevelLimit = softExpLevelLimit;
|
||||
this.softPointsLevelLimit = softPointsLevelLimit;
|
||||
}
|
||||
|
||||
public int getFromLevel() {
|
||||
@ -92,6 +102,8 @@ public class JobInfo {
|
||||
}
|
||||
|
||||
public double getIncome(double level, double numjobs) {
|
||||
if (softIncomeLevelLimit != null && level > softIncomeLevelLimit)
|
||||
level = softIncomeLevelLimit;
|
||||
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney)
|
||||
return 0;
|
||||
moneyEquation.setVariable("joblevel", level);
|
||||
@ -101,6 +113,8 @@ public class JobInfo {
|
||||
}
|
||||
|
||||
public double getExperience(double level, double numjobs) {
|
||||
if (softExpLevelLimit != null && level > softExpLevelLimit)
|
||||
level = softExpLevelLimit;
|
||||
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp)
|
||||
return 0;
|
||||
xpEquation.setVariable("joblevel", level);
|
||||
@ -110,6 +124,8 @@ public class JobInfo {
|
||||
}
|
||||
|
||||
public double getPoints(double level, double numjobs) {
|
||||
if (softPointsLevelLimit != null && level > softPointsLevelLimit)
|
||||
level = softPointsLevelLimit;
|
||||
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints)
|
||||
return 0;
|
||||
pointsEquation.setVariable("joblevel", level);
|
||||
|
@ -151,7 +151,7 @@ public class JobsMySQL extends JobsDAO {
|
||||
statement.close();
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
Jobs.consoleMsg("Not a table |" + "SELECT * FROM " + table + "|");
|
||||
// Jobs.consoleMsg("Not a table |" + "SELECT * FROM " + table + "|");
|
||||
close(statement);
|
||||
return false;
|
||||
}
|
||||
|
@ -38,6 +38,12 @@ Jobs:
|
||||
# [OPTIONAL] - the maximum number of users on the server that can have this job at
|
||||
# any one time (includes offline players).
|
||||
slots: 1
|
||||
# Soft limits will allow to stop income/exp/point payment increase at some particular level but allow further general leveling.
|
||||
# In example if player is level 70, he will get paid as he would be at level 50, exp gain will be as he would be at lvl 40 and point gain will be as at level 60
|
||||
# This only aplies after players level is higher than provided particular limit.
|
||||
softIncomeLimit: 50
|
||||
softExpLimit: 40
|
||||
softPointsLimit: 60
|
||||
# Equation used for calculating how much experience is needed to go to the next level.
|
||||
# Available parameters:
|
||||
# numjobs - the number of jobs the player has
|
||||
|
Loading…
Reference in New Issue
Block a user