Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2015-02-10 21:15:53 -05:00
commit 1b4d1d94e9
4 changed files with 39 additions and 27 deletions

View File

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

View File

@ -1,18 +1,17 @@
package mineplex.core.treasure;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
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;
OneTimePurchaseOnly = false;
}

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.gui;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -9,24 +10,29 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.OldChest;
import mineplex.core.treasure.ChestPackage;
import mineplex.core.treasure.TreasureManager;
public class BuyBasicChestButton implements IButton
public class BuyChestButton implements IButton
{
private Player _player;
private InventoryManager _inventoryManager;
private TreasurePage _page;
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page)
{
_player = player;
private String _chestName;
private Material _chestMat;
private int _chestCost;
public BuyChestButton(Player player, InventoryManager inventoryManager, TreasurePage page,
String chestName, Material chestMat, int chestCost)
{
_inventoryManager = inventoryManager;
_page = page;
_chestName = chestName;
_chestMat = chestMat;
_chestCost = chestCost;
}
@Override
@ -37,9 +43,9 @@ public class BuyBasicChestButton implements IButton
{
public void run()
{
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
_inventoryManager.addItemToInventory(player, "Item", _chestName, 1);
_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!");
else
{
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins");
basicLore.add(ChatColor.RESET + "Click to Purchase!");
basicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "1000 Coins");
basicLore.add(" ");
basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
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!");
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>();
@ -94,18 +97,22 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
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 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);
if (basicCount > 0)
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
else
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
if (basicCount > 0) AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
else AddButton(2, basic, new BuyChestButton(Player, _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
if (heroicCount > 0) AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
else AddButton(4, heroic, new BuyChestButton(Player, _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
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));
}
}