Reward stuffs

This commit is contained in:
Chiss 2014-09-18 14:36:22 +10:00
parent bb8e481c7f
commit 09a3cc16b0
4 changed files with 105 additions and 50 deletions

View File

@ -26,7 +26,12 @@ public class RewardManager
private boolean _doubleGadgetValue;
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager, boolean doubleGadgetValue)
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager,
int commonValueMin, int commonValueMax,
int uncommonValueMin, int uncommonValueMax,
int rareValueMin, int rareValueMax,
int legendValueMin, int legendValueMax,
boolean doubleGadgetValue)
{
_treasureMap = new HashMap<RewardRarity, List<IReward>>();
_random = new Random();
@ -38,54 +43,94 @@ public class RewardManager
_doubleGadgetValue = doubleGadgetValue;
addCommon(donationManager, inventoryManager, 250, 500);
addUncommon(donationManager, inventoryManager);
addRare(donationManager, inventoryManager);
addLegendary(donationManager, inventoryManager);
addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
addUncommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
addRare(donationManager, inventoryManager, commonValueMin, commonValueMax);
addLegendary(donationManager, inventoryManager, commonValueMin, commonValueMax);
}
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, int minValue, int maxValue)
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(donationManager, minValue, maxValue, 1, RewardRarity.COMMON));
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1, RewardRarity.COMMON));
//Increase Value
if (_doubleGadgetValue)
{
minValue *= 2;
maxValue *= 2;
}
// Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 100*(minValue/500), 100*(maxValue/500),
new ItemStack(Material.GOLD_BARDING), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 50*(minValue/500), 50*(maxValue/500),
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 50*(minValue/500), 50*(maxValue/500),
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook", 40*(minValue/500), 40*(maxValue/500),
new ItemStack(Material.getMaterial(131)), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 30*(minValue/500), 30*(maxValue/500),
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 20*(minValue/500), 20*(maxValue/500),
new ItemStack(Material.IRON_BARDING), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 20*(minValue/500), 20*(maxValue/500),
new ItemStack(Material.TNT), RewardRarity.COMMON, 1, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), RewardRarity.COMMON, 1));
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.TNT), RewardRarity.COMMON, 1));
}
public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager)
public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(donationManager, 750, 1500, 250, RewardRarity.UNCOMMON));
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON));
//Increase Value
if (_doubleGadgetValue)
{
minValue *= 2;
maxValue *= 2;
}
// Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 100, 200,
new ItemStack(Material.GOLD_BARDING), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 50, 100,
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 50, 100,
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 40, 80,
new ItemStack(Material.getMaterial(131)), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 30, 60,
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 20, 40,
new ItemStack(Material.IRON_BARDING), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 20, 40,
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250, _doubleGadgetValue));
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook",
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), RewardRarity.UNCOMMON, 250));
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250));
// Pets
addReward(new UnknownPackageReward(donationManager, "Cow Pet", "Cow",
@ -104,10 +149,10 @@ public class RewardManager
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), RewardRarity.RARE, 125));
}
public void addRare(DonationManager donationManager, InventoryManager inventoryManager)
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(donationManager, 1000, 2000, 100, RewardRarity.RARE));
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
// Mounts
addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
@ -132,10 +177,10 @@ public class RewardManager
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 25));
}
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager)
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(donationManager, 10000, 20000, 25, RewardRarity.LEGENDARY));
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, RewardRarity.LEGENDARY));
// Mounts
addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",

View File

@ -23,20 +23,20 @@ public class InventoryReward extends AbstractReward
private int _minAmount;
private int _maxAmount;
public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, boolean doubleAmount)
public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
{
this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight, doubleAmount);
this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight);
}
public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, boolean doubleAmount)
public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
{
super(itemStack, rarity, weight);
_random = random;
_name = name;
_packageName = packageName;
_minAmount = doubleAmount ? minAmount * 2 : minAmount;
_maxAmount = doubleAmount ? maxAmount * 2 : maxAmount;
_minAmount = minAmount;
_maxAmount = maxAmount;
_inventoryManager = inventoryManager;
}

View File

@ -59,7 +59,12 @@ public class TreasureManager extends MiniPlugin
super("Treasure", plugin);
_playerTreasureMap = new NautHashMap<Player, Treasure>();
_rewardManager = new RewardManager(donationManager, inventoryManager, true);
_rewardManager = new RewardManager(donationManager, inventoryManager,
250, 500,
750, 1500,
2000, 3000,
10000, 20000,
true);
}
@Override

View File

@ -48,15 +48,20 @@ public class GameLootManager implements Listener
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(), false);
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(),
100, 250,
750, 1500,
2000, 3000,
10000, 20000,
false);
//Chest
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 3, false));
new ItemStack(Material.CHEST), RewardRarity.COMMON, 3));
//Key
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 500, false));
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 500));
}
@EventHandler