Increase outpost costs and add mounts to pvp shop
This commit is contained in:
parent
97c8dc7cf4
commit
97efeca225
@ -78,7 +78,7 @@ public enum ClansShopItem
|
||||
QUARTZ_BLOCK(75, 15, Material.QUARTZ_BLOCK, 1),
|
||||
CLAY(30, 6, Material.CLAY, 1),
|
||||
GOLD_TOKEN(50000, 50000, Material.GOLD_RECORD, 1, (byte) 0, "Gold Token"),
|
||||
OUTPOST(30000, 0, Material.BEACON, 1, (byte) 0, C.cBlue + "Outpost"),
|
||||
OUTPOST(100000, 0, Material.BEACON, 1, (byte) 0, C.cBlue + "Outpost"),
|
||||
CANNON(25000, 0, Material.SPONGE, 1, (byte) 1, C.cBlue + "Cannon");
|
||||
|
||||
private int _buyPrice;
|
||||
|
@ -0,0 +1,74 @@
|
||||
package mineplex.game.clans.shop.pvp;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.clans.mounts.Mount.MountType;
|
||||
import mineplex.game.clans.clans.mounts.MountClaimToken;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
|
||||
public class MountBuyButton<T extends ShopPageBase<?, ?>> implements IButton
|
||||
{
|
||||
private int _buyPrice;
|
||||
private ItemStack _item;
|
||||
private T _page;
|
||||
|
||||
public MountBuyButton(T page)
|
||||
{
|
||||
_page = page;
|
||||
_buyPrice = 150000;
|
||||
_item = new MountClaimToken(1, 1, 1, MountType.HORSE).toItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Attempt Buy Clans Shop Item", 1500, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.LEFT)
|
||||
{
|
||||
int goldCount = GoldManager.getInstance().getGold(player);
|
||||
|
||||
if (goldCount >= _buyPrice)
|
||||
{
|
||||
GoldManager.getInstance().deductGold(success ->
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
giftItem(player, 1);
|
||||
GoldManager.notify(player, String.format("You have purchased %d item(s) for %dg", 1, _buyPrice));
|
||||
|
||||
_page.playAcceptSound(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
GoldManager.notify(player, "You cannot afford that item! Please relog to update your gold count.");
|
||||
_page.playDenySound(player);
|
||||
}
|
||||
|
||||
_page.refresh();
|
||||
}, player, _buyPrice);
|
||||
}
|
||||
else
|
||||
{
|
||||
GoldManager.notify(player, "You cannot afford that item.");
|
||||
_page.playDenySound(player);
|
||||
}
|
||||
}
|
||||
|
||||
_page.refresh();
|
||||
}
|
||||
|
||||
private void giftItem(Player player, int amount)
|
||||
{
|
||||
ItemStack item = _item.clone();
|
||||
item.setAmount(amount);
|
||||
player.getInventory().addItem(item);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package mineplex.game.clans.shop.pvp;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -57,6 +59,7 @@ public class PvpPage extends ClansShopPage<PvpShop>
|
||||
addShopItem(33, ClansShopItem.BOW, "Standard Bow");
|
||||
addShopItem(34, ClansShopItem.ARROW, (byte) 0, "Arrows", 16);
|
||||
|
||||
addButton(51 - 9, new ItemBuilder(Material.IRON_BARDING).setTitle(C.cGreenB + "Standard Mount").setLore(C.cRed, C.cYellow + "Left-Click" + C.cWhite + " to buy " + C.cGreen + "1", C.cWhite + "Costs " + C.cGreen + "150000g").build(), new MountBuyButton<>(this));
|
||||
addShopItem(52 - 9, ClansShopItem.CANNON, C.cBlue + "Cannon");
|
||||
addShopItem(53 - 9, ClansShopItem.OUTPOST, C.cBlue + "Outpost");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user