Disable purchasing Christmas Treasure

This commit is contained in:
Shaun Bennett 2016-01-08 03:15:05 -05:00
parent d1e5669b85
commit 1d2f61db8c
2 changed files with 35 additions and 16 deletions

View File

@ -8,13 +8,13 @@ import mineplex.core.reward.RewardType;
public enum TreasureType public enum TreasureType
{ {
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL), OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000),
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL), ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000),
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL), MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000),
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY); CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000);
private final String _name; private final String _name;
private final RewardType _rewardType; private final RewardType _rewardType;
@ -23,8 +23,10 @@ public enum TreasureType
private final String _itemName; private final String _itemName;
private final String _statName; private final String _statName;
private final RewardPool.Type _rewardPool; private final RewardPool.Type _rewardPool;
private final int _purchasePrice;
private final boolean _purchasable;
TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool) TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool, boolean purchasable, int purchasePrice)
{ {
_name = name; _name = name;
_itemName = itemName; _itemName = itemName;
@ -33,6 +35,8 @@ public enum TreasureType
_material = material; _material = material;
_treasureStyle = treasureStyle; _treasureStyle = treasureStyle;
_rewardPool = rewardPool; _rewardPool = rewardPool;
_purchasePrice = purchasePrice;
_purchasable = purchasable;
} }
public RewardType getRewardType() public RewardType getRewardType()
@ -69,4 +73,14 @@ public enum TreasureType
{ {
return _rewardPool; return _rewardPool;
} }
public int getPurchasePrice()
{
return _purchasePrice;
}
public boolean isPurchasable()
{
return _purchasable;
}
} }

View File

@ -122,9 +122,11 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
/*
christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards"); christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards");
christmasLore.add(" "); christmasLore.add(" ");
christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
*/
} }
List<String> cosmicLore = new ArrayList<String>(); List<String> cosmicLore = new ArrayList<String>();
@ -143,18 +145,21 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
addItem(40, shards); addItem(40, shards);
if (basicCount > 0) addButton(20, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD)); addChest(20, basic, TreasureType.OLD, basicCount);
else addButton(20, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000)); addChest(22, heroic, TreasureType.ANCIENT, heroicCount);
addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount);
if (heroicCount > 0) addButton(22, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT)); addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount);
else addButton(22, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
if (legendaryCount > 0) addButton(24, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL));
else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
if (christmasCount > 0) addButton(12, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS));
else addButton(12, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, TreasureType.CHRISTMAS.getItemName(), Material.SNOW_BALL, 15000));
addItem(14, cosmic); addItem(14, cosmic);
} }
private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned)
{
if (owned > 0)
addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType));
else if (treasureType.isPurchasable())
addButton(slot, item, new BuyChestButton(getPlayer(), _inventoryManager, this, treasureType.getName(), Material.CHEST, treasureType.getPurchasePrice()));
else
setItem(slot, item);
}
} }