Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-02-10 17:44:36 -08:00
commit f0d2ff1c9d
4 changed files with 39 additions and 27 deletions

View File

@ -4,9 +4,9 @@ public enum RewardType
{ {
//% Chances Mythic Legend Rare Uncommon //% Chances Mythic Legend Rare Uncommon
GameLoot( 0.000001, 0.00001, 0.0001, 3), GameLoot( 0.000001, 0.00001, 0.0001, 3),
OldChest( 0, 0.01, 0.04, 5), OldChest( 0, 0.1, 0.4, 5),
AncientChest( 0, 1, 4, 25), AncientChest( 0, 1, 4, 25),
MythicalChest( 0.5, 2.5, 10, 40); MythicalChest( 0.5, 3, 12, 75);
private double _mythicalChance; private double _mythicalChance;
private double _legendaryChance; private double _legendaryChance;

View File

@ -1,17 +1,16 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase; import mineplex.core.shop.item.SalesPackageBase;
public class OldChest extends SalesPackageBase public class ChestPackage extends SalesPackageBase
{ {
public OldChest() public ChestPackage(String name, Material mat, int cost)
{ {
super("Old Chest", Material.CHEST, (byte) 0, new String[] {}, 1000); super(name, mat, (byte) 0, new String[] {}, cost);
KnownPackage = false; KnownPackage = false;
OneTimePurchaseOnly = false; OneTimePurchaseOnly = false;

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.gui; package mineplex.core.treasure.gui;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -9,24 +10,29 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.OldChest; import mineplex.core.treasure.ChestPackage;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
public class BuyBasicChestButton implements IButton public class BuyChestButton implements IButton
{ {
private Player _player;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private TreasurePage _page; private TreasurePage _page;
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page) private String _chestName;
{ private Material _chestMat;
_player = player; private int _chestCost;
public BuyChestButton(Player player, InventoryManager inventoryManager, TreasurePage page,
String chestName, Material chestMat, int chestCost)
{
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_page = page; _page = page;
_chestName = chestName;
_chestMat = chestMat;
_chestCost = chestCost;
} }
@Override @Override
@ -37,9 +43,9 @@ public class BuyBasicChestButton implements IButton
{ {
public void run() public void run()
{ {
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1); _inventoryManager.addItemToInventory(player, "Item", _chestName, 1);
_page.Refresh(); _page.Refresh();
} }
}, _page, new OldChest(), CurrencyType.Coins, player)); }, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.Coins, player));
} }
} }

View File

@ -60,8 +60,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins"); basicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "1000 Coins");
basicLore.add(ChatColor.RESET + "Click to Purchase!"); basicLore.add(" ");
basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
List<String> heroicLore = new ArrayList<String>(); List<String> heroicLore = new ArrayList<String>();
@ -76,7 +77,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
heroicLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop"); heroicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "5000 Coins");
heroicLore.add(" ");
heroicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
List<String> legendaryLore = new ArrayList<String>(); List<String> legendaryLore = new ArrayList<String>();
@ -94,18 +97,22 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
legendaryLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop"); legendaryLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "10000 Coins");
legendaryLore.add(" ");
legendaryLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);
if (basicCount > 0) if (basicCount > 0) AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD)); else AddButton(2, basic, new BuyChestButton(Player, _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
else
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this)); if (heroicCount > 0) AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT)); else AddButton(4, heroic, new BuyChestButton(Player, _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
if (legendaryCount > 0) AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
else AddButton(6, legendary, new BuyChestButton(Player, _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
} }
} }