1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-11 11:51:54 +01:00
Jobs/com/gamingmesh/jobs/container/JobInfo.java

118 lines
3.3 KiB
Java
Raw Normal View History

2015-08-21 15:10:08 +02:00
/**
* Jobs Plugin for Bukkit
* Copyright (C) 2011 Zak Ford <zak.j.ford@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs;
2015-08-21 15:10:08 +02:00
import com.gamingmesh.jobs.resources.jfep.Parser;
public class JobInfo {
2016-01-22 13:42:25 +01:00
private ActionType actionType;
private int id;
private String meta;
private String name;
2016-03-30 15:42:36 +02:00
private double baseIncome, baseXp, basePoints;
private Parser moneyEquation, xpEquation, pointsEquation;
2016-11-20 10:53:19 +01:00
private int fromLevel = 0;
private int untilLevel = Integer.MAX_VALUE;
2015-08-21 15:10:08 +02:00
2016-03-30 15:42:36 +02:00
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) {
2016-01-22 13:42:25 +01:00
this.actionType = actionType;
this.id = id;
this.meta = meta;
this.name = name;
this.baseIncome = baseIncome;
this.moneyEquation = moneyEquation;
2016-03-30 15:42:36 +02:00
this.pointsEquation = pointsEquation;
this.basePoints = basePoints;
2016-01-22 13:42:25 +01:00
this.baseXp = baseXp;
this.xpEquation = xpEquation;
this.fromLevel = fromLevel;
this.untilLevel = untilLevel;
2016-03-30 15:42:36 +02:00
2016-01-22 13:42:25 +01:00
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public int getFromLevel() {
return this.fromLevel;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public int getUntilLevel() {
return this.untilLevel;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public boolean isInLevelRange(int level) {
return level >= fromLevel && (level <= untilLevel || untilLevel == -1);
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public String getName() {
return this.name;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public int getId() {
return this.id;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public ActionType getActionType() {
return this.actionType;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public String getMeta() {
return this.meta;
}
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public double getBaseIncome() {
return this.baseIncome;
}
public double getBaseXp() {
return this.baseXp;
}
2016-03-30 15:42:36 +02:00
public double getBasePoints() {
return this.basePoints;
}
public double getIncome(double level, double numjobs) {
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney)
return 0;
2016-01-22 13:42:25 +01:00
moneyEquation.setVariable("joblevel", level);
moneyEquation.setVariable("numjobs", numjobs);
moneyEquation.setVariable("baseincome", baseIncome);
return moneyEquation.getValue();
}
2016-03-30 15:42:36 +02:00
public double getExperience(double level, double numjobs) {
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp)
return 0;
2016-01-22 13:42:25 +01:00
xpEquation.setVariable("joblevel", level);
xpEquation.setVariable("numjobs", numjobs);
xpEquation.setVariable("baseexperience", baseXp);
return xpEquation.getValue();
}
2016-03-30 15:42:36 +02:00
public double getPoints(double level, double numjobs) {
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints)
return 0;
2016-03-30 15:42:36 +02:00
pointsEquation.setVariable("joblevel", level);
pointsEquation.setVariable("numjobs", numjobs);
pointsEquation.setVariable("basepoints", basePoints);
return pointsEquation.getValue();
}
2015-08-21 15:10:08 +02:00
}