Add in xpMultiplier

This commit is contained in:
NuclearW 2012-05-17 22:21:35 -04:00
parent 1185ea4f96
commit 7f0803c3f6
3 changed files with 17 additions and 3 deletions

View File

@ -67,4 +67,11 @@ public interface Repairable {
* @return the minimum level to repair this item, or 0 for no minimum
*/
public int getMinimumLevel();
/**
* Gets the xpMultiplier for this repairable
*
* @return the xpMultiplier of this repairable
*/
public double getXpMultiplier();
}

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.skills.repair;
public class RepairableFactory {
public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType) {
public static Repairable getRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
// TODO: Add in loading from config what type of manager we want.
return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType);
return new SimpleRepairable(itemId, repairMaterialId, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
}
}

View File

@ -6,8 +6,9 @@ public class SimpleRepairable implements Repairable {
private final byte repairMetadata;
private final RepairItemType repairItemType;
private final RepairMaterialType repairMaterialType;
private final double xpMultiplier;
protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType) {
protected SimpleRepairable(int itemId, int repairMaterialId, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
this.itemId = itemId;
this.repairMaterialId = repairMaterialId;
this.repairMetadata = repairMetadata;
@ -17,6 +18,7 @@ public class SimpleRepairable implements Repairable {
this.minimumQuantity = minimumQuantity;
this.maximumDurability = maximumDurability;
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
this.xpMultiplier = xpMultiplier;
}
@Override
@ -63,4 +65,9 @@ public class SimpleRepairable implements Repairable {
public int getMinimumLevel() {
return minimumLevel;
}
@Override
public double getXpMultiplier() {
return xpMultiplier;
}
}