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

97 lines
2.6 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.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;
private double baseIncome, baseXp;
private Parser moneyEquation, xpEquation;
private int fromLevel;
private int untilLevel;
2015-08-21 15:10:08 +02:00
2016-01-22 13:42:25 +01:00
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation, int fromLevel,
int untilLevel) {
this.actionType = actionType;
this.id = id;
this.meta = meta;
this.name = name;
this.baseIncome = baseIncome;
this.moneyEquation = moneyEquation;
this.baseXp = baseXp;
this.xpEquation = xpEquation;
this.fromLevel = fromLevel;
this.untilLevel = untilLevel;
}
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;
}
public double getIncome(int level, int numjobs) {
moneyEquation.setVariable("joblevel", level);
moneyEquation.setVariable("numjobs", numjobs);
moneyEquation.setVariable("baseincome", baseIncome);
return moneyEquation.getValue();
}
public double getExperience(int level, int numjobs) {
xpEquation.setVariable("joblevel", level);
xpEquation.setVariable("numjobs", numjobs);
xpEquation.setVariable("baseexperience", baseXp);
return xpEquation.getValue();
}
2015-08-21 15:10:08 +02:00
}