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

This commit is contained in:
Jonathan Williams 2015-01-29 22:19:12 -08:00
commit 352a29390b
31 changed files with 867 additions and 211 deletions

View File

@ -1,44 +0,0 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class TreasureButton implements IButton
{
private Menu _menu;
private boolean _hasEnoughChests;
private boolean _hasEnoughKeys;
private boolean _canPurchaseKey;
public TreasureButton(Menu menu, boolean hasEnoughChests, boolean hasEnoughKeys, boolean canPurchaseKey)
{
_menu = menu;
_hasEnoughChests = hasEnoughChests;
_hasEnoughKeys = hasEnoughKeys;
_canPurchaseKey = canPurchaseKey;
}
public void onClick(Player player, ClickType clickType)
{
if (clickType.isLeftClick())
{
if (_hasEnoughChests && _hasEnoughKeys)
{
_menu.openTreasure(player);
player.closeInventory();
}
else if (_hasEnoughChests && _canPurchaseKey)
{
_menu.attemptPurchaseKey(player);
}
}
else if (clickType.isRightClick())
{
if (_canPurchaseKey)
_menu.attemptPurchaseKey(player);
}
}
}

View File

@ -1,7 +1,5 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
@ -12,8 +10,6 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.OpenCostumes;
@ -23,7 +19,6 @@ import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenMusic;
import mineplex.core.cosmetic.ui.button.OpenParticles;
import mineplex.core.cosmetic.ui.button.OpenPets;
import mineplex.core.cosmetic.ui.button.TreasureButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -33,7 +28,6 @@ import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureManager;
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -47,7 +41,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@Override
protected void BuildPage()
{
AddItem(2, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", new String[]
AddItem(4, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", new String[]
{
" ",
ChatColor.RESET + C.cYellow + "Purchase Coins",
@ -60,54 +54,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
ChatColor.RESET + "Receives 15000 Coins per Month",
}, 1, false));
int treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
int treasureKeyCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Key");
boolean canPurchaseKey = DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= 1000;
ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.RESET + "You can find all kinds of rare");
lore.add(ChatColor.RESET + "and exciting loot inside!");
lore.add(" ");
lore.add(ChatColor.RESET + C.cYellow + "Treasure Chests: " + ChatColor.RESET + treasureChestCount);
lore.add(ChatColor.RESET + C.cYellow + "Treasure Keys: " + ChatColor.RESET + treasureKeyCount);
lore.add(" ");
if (treasureChestCount > 0 && treasureKeyCount > 0)
{
lore.add(ChatColor.RESET + C.cGreen + "Left-Click to open Treasure Chest");
lore.add(ChatColor.RESET + " Uses 1 Treasure Chest");
lore.add(ChatColor.RESET + " Uses 1 Treasure Key");
}
else if (treasureChestCount > 0)
{
lore.add(ChatColor.RESET + C.cRed + "Left-Click to open Treasure Chest");
lore.add(ChatColor.RESET + " This requires 1 Treasure Key");
lore.add(ChatColor.RESET + " You do not have any Treasure Keys");
}
else
{
lore.add(ChatColor.RESET + C.cRed + "Left-Click to open Treasure Chest");
lore.add(ChatColor.RESET + " This requires 1 Treasure Chest");
lore.add(ChatColor.RESET + " Find Treasure Chests by playing games");
}
lore.add(" ");
if (canPurchaseKey)
{
lore.add(ChatColor.RESET + C.cGreen + "Right-Click to purchase Treasure Key");
lore.add(ChatColor.RESET + " Costs 1000 Coins");
}
else
{
lore.add(ChatColor.RESET + C.cRed + "Right-Click to purchase Treasure Key");
lore.add(ChatColor.RESET + " Costs 1000 Coins");
lore.add(ChatColor.RESET + " You cannot afford a Treasure Key");
}
AddButton(4, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGreen + C.Bold + "Treasure Chest", lore.toArray(new String[0]), 1, false), new TreasureButton(this, treasureChestCount > 0, treasureKeyCount > 0, canPurchaseKey));
AddButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
AddButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
AddButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
@ -212,19 +158,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
Shop.OpenPageForPlayer(player, new MusicPage(Plugin, Shop, ClientManager, DonationManager, "Music", player));
}
public void openTreasure(Player player)
{
TreasureManager treasureManager = Plugin.getTreasureManager();
if (treasureManager == null)
{
UtilPlayer.message(player, F.main("Treasure", "You cannot open Treasure Chests on this server"));
}
else
{
// treasureManager.attemptOpenTreasure(player);
}
}
public void attemptPurchaseKey(Player player)
{
Shop.OpenPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()

View File

@ -24,6 +24,7 @@ import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.treasure.animation.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation;
import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.LegendaryAnimation;
@ -38,8 +39,9 @@ public class Treasure
{
private BlockRestore _blockRestore;
private List<BlockInfo> _chestBlockInfo = new ArrayList<>();
private List<BlockInfo> _openedChestBlockInfo = new ArrayList<>();
private List<BlockInfo> _chestBlockInfo = new ArrayList<BlockInfo>();
private List<BlockInfo> _openedChestBlockInfo = new ArrayList<BlockInfo>();
private List<BlockInfo> _otherBlockInfo = new ArrayList<BlockInfo>();
private Player _player;
private Random _random;
@ -87,6 +89,9 @@ public class Treasure
{
_chestData[i] = new ChestData(chestBlocks[i]);
}
if (_treasureType == TreasureType.HEROIC || _treasureType == TreasureType.LEGENDARY)
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
}
public int getFinishedTickCount()
@ -115,7 +120,7 @@ public class Treasure
for (BlockInfo blockInfo : _chestBlockInfo)
{
Block block = blockInfo.getBlock();
openChest(block);
openChest(block, false);
}
}
@ -160,6 +165,11 @@ public class Treasure
}
public void openChest(Block block)
{
openChest(block, true);
}
public void openChest(Block block, boolean swapList)
{
ChestData data = getChestData(block);
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
@ -168,9 +178,12 @@ public class Treasure
RewardData rewardData = reward.giveReward("Treasure", _player);
_currentReward++;
BlockInfo info = getBlockInfo(block);
_chestBlockInfo.remove(info);
_openedChestBlockInfo.add(info);
if (swapList)
{
BlockInfo info = getBlockInfo(block);
_chestBlockInfo.remove(info);
_openedChestBlockInfo.add(info);
}
data.setOpened(true);
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, rewardData, _hologramManager);
@ -263,6 +276,7 @@ public class Treasure
// Remove any extra blocks
resetBlockInfo(_chestBlockInfo);
resetBlockInfo(_openedChestBlockInfo);
resetBlockInfo(_otherBlockInfo);
for (Animation animation : _animations)
{

View File

@ -23,11 +23,13 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
@ -38,6 +40,7 @@ import mineplex.core.updater.event.UpdateEvent;
public class TreasureLocation implements Listener
{
private TreasureManager _treasureManager;
private InventoryManager _inventoryManager;
private Hologram _hologram;
private HologramManager _hologramManager;
private Treasure _currentTreasure;
@ -45,18 +48,21 @@ public class TreasureLocation implements Listener
private byte _chestBlockData;
private Block[] _chestSpawns;
private TreasureShop _shop;
private Location _resetLocation;
public TreasureLocation(TreasureManager treasureManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, HologramManager hologramManager)
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager)
{
_treasureManager = treasureManager;
_resetLocation = resetLocation;
_inventoryManager = inventoryManager;
_chestBlock = chestBlock;
_chestBlockData = _chestBlock.getData();
_chestSpawns = chestSpawns;
_hologramManager = hologramManager;
_currentTreasure = null;
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 1.5, 0.5), C.cGreen + "Treasure Chest");
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure");
setHoloChestVisible(true);
_shop = new TreasureShop(treasureManager, clientManager, donationManager, this);
_shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this);
}
@EventHandler
@ -71,6 +77,18 @@ public class TreasureLocation implements Listener
public void attemptOpenTreasure(Player player, TreasureType treasureType)
{
if (isTreasureInProgress())
{
player.sendMessage(F.main("Treasure", "Please wait for the current chest to be opened"));
return;
}
if (!chargeAccount(player, treasureType))
{
player.sendMessage(F.main("Treasure", "You dont have any chests to open!"));
return;
}
TreasureStartEvent event = new TreasureStartEvent(player);
Bukkit.getPluginManager().callEvent(event);
@ -81,13 +99,15 @@ public class TreasureLocation implements Listener
setHoloChestVisible(false);
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + C.cGreen + "Treasure Chest"));
if (treasureType == TreasureType.HEROIC || treasureType == TreasureType.LEGENDARY)
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
Treasure treasure = new Treasure(player, rewards, _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
_currentTreasure = treasure;
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open");
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);
UtilPlayer.message(player, F.main("Treasure", "Choose 4 Chests To Open"));
Location teleportLocation = treasure.getCenterBlock().getLocation().add(0.5, 0, 0.5);
teleportLocation.setPitch(player.getLocation().getPitch());
@ -102,6 +122,17 @@ public class TreasureLocation implements Listener
}
private boolean chargeAccount(Player player, TreasureType treasureType)
{
int itemCount = _inventoryManager.Get(player).getItemCount(treasureType.getItemName());
if (itemCount > 0)
{
_inventoryManager.addItemToInventory(player, "Item", treasureType.getItemName(), -1);
return true;
}
return false;
}
private void setHoloChestVisible(boolean visible)
{
if (visible)
@ -153,6 +184,8 @@ public class TreasureLocation implements Listener
{
if (event.getTreasure().equals(_currentTreasure))
{
Player player = _currentTreasure.getPlayer();
player.teleport(_resetLocation);
_currentTreasure = null;
setHoloChestVisible(true);
}
@ -235,7 +268,7 @@ public class TreasureLocation implements Listener
Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5);
double toDistanceFromCenter = centerLocation.distanceSquared(toLocation);
if (toDistanceFromCenter <= 9)
if (toDistanceFromCenter <= 16 && player.getVelocity().lengthSquared() < 10)
{
// Only cancel movement if they are moving towards the center
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -58,7 +59,8 @@ public class TreasureManager extends MiniPlugin
Block chestLoc6 = world.getBlockAt(-20, 72, -16);
Block chestLoc7 = world.getBlockAt(-18, 72, -16);
Block chestLoc8 = world.getBlockAt(-16, 72, -18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
Location resetLocation = new Location(world, -23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
}
{
@ -71,7 +73,8 @@ public class TreasureManager extends MiniPlugin
Block chestLoc6 = world.getBlockAt(20, 72, 16);
Block chestLoc7 = world.getBlockAt(18, 72, 16);
Block chestLoc8 = world.getBlockAt(16, 72, 18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
Location resetLocation = new Location(world, 23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
}
{
@ -84,7 +87,8 @@ public class TreasureManager extends MiniPlugin
Block chestLoc6 = world.getBlockAt(20, 72, -16);
Block chestLoc7 = world.getBlockAt(18, 72, -16);
Block chestLoc8 = world.getBlockAt(16, 72, -18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
Location resetLocation = new Location(world, 23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
}
{
@ -97,7 +101,8 @@ public class TreasureManager extends MiniPlugin
Block chestLoc6 = world.getBlockAt(-20, 72, 16);
Block chestLoc7 = world.getBlockAt(-18, 72, 16);
Block chestLoc8 = world.getBlockAt(-16, 72, 18);
_treasureLocations.add(new TreasureLocation(this, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, _hologramManager));
Location resetLocation = new Location(world, -23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
}
for (TreasureLocation treasureLocation : _treasureLocations)

View File

@ -7,18 +7,20 @@ import mineplex.core.reward.RewardType;
public enum TreasureType
{
BASIC(C.cYellow + "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.NATURE),
HEROIC(C.cGold + "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.WATER),
LEGENDARY(C.cRed + "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.NETHER);
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.NATURE),
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.WATER),
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.NETHER);
private String _name;
private RewardType _rewardType;
private Material _material;
private TreasureStyle _treasureStyle;
private final String _name;
private final RewardType _rewardType;
private final Material _material;
private final TreasureStyle _treasureStyle;
private final String _itemName;
TreasureType(String name, RewardType rewardType, Material material, TreasureStyle treasureStyle)
TreasureType(String name, String itemName, RewardType rewardType, Material material, TreasureStyle treasureStyle)
{
_name = name;
_itemName = itemName;
_rewardType = rewardType;
_material = material;
_treasureStyle = treasureStyle;
@ -43,4 +45,9 @@ public enum TreasureType
{
return _treasureStyle;
}
public String getItemName()
{
return _itemName;
}
}

View File

@ -0,0 +1,76 @@
package mineplex.core.treasure.animation;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure;
import mineplex.core.treasure.TreasureType;
public class BlockChangeAnimation extends Animation
{
private static final int MAX_RADIUS = 4;
private int _currentRadius;
private List<BlockInfo> _blockInfoList;
public BlockChangeAnimation(Treasure treasure, List<BlockInfo> blockInfoList)
{
super(treasure);
_currentRadius = 0;
_blockInfoList = blockInfoList;
}
@Override
protected void tick()
{
if (_currentRadius == MAX_RADIUS)
{
finish();
return;
}
else if (getTicks() % 10 == 0)
{
Block centerBlock = getTreasure().getCenterBlock().getRelative(BlockFace.DOWN);
for (int x = -_currentRadius; x <= _currentRadius; x++)
{
for (int y = 0; y <= _currentRadius; y++)
{
for (int z = -_currentRadius; z <= _currentRadius; z++)
{
Block b = centerBlock.getRelative(x, y, z);
if (y > 0 && b.getType() == Material.SMOOTH_BRICK || b.getType() == Material.STEP || b.getType() == Material.SMOOTH_STAIRS)
{
_blockInfoList.add(new BlockInfo(b));
b.setType(Material.AIR);
}
else if (b.getType() == Material.SMOOTH_BRICK)
{
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK : Material.QUARTZ_BLOCK;
_blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial);
}
else if (b.getType() == Material.SMOOTH_STAIRS || b.getType() == Material.COBBLESTONE_STAIRS)
{
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK_STAIRS : Material.QUARTZ_STAIRS;
_blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial);
}
}
}
}
_currentRadius++;
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -24,7 +24,7 @@ public class OpenTreasureButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
// TODO
_treasureLocation.attemptOpenTreasure(player, _treasureType);
player.closeInventory();
}
}

View File

@ -1,10 +1,17 @@
package mineplex.core.treasure.gui;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
@ -14,12 +21,14 @@ import mineplex.core.treasure.TreasureType;
public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
{
private TreasureLocation _treasureLocation;
private InventoryManager _inventoryManager;
public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, Player player)
public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 9);
_treasureLocation = treasureLocation;
_inventoryManager = inventoryManager;
BuildPage();
}
@ -27,11 +36,35 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
@Override
protected void BuildPage()
{
//1 2 3 4 5 6 7 8 9
int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.BASIC.getItemName());
int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.HEROIC.getItemName());
int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.LEGENDARY.getItemName());
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Basic Chest", new String[] {}, 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Heroic Chest", new String[] {}, 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Legendary Chest", new String[] {}, 0, false, false);
List<String> basicLore = new ArrayList<String>();
basicLore.add(" ");
basicLore.add(F.value("Basic Chests Owned", "" + basicCount));
basicLore.add(" ");
if (basicCount > 0)
basicLore.add(ChatColor.RESET + "Click to open!");
List<String> heroicLore = new ArrayList<String>();
heroicLore.add(" ");
heroicLore.add(F.value("Heroic Chests Owned", "" + heroicCount));
heroicLore.add(" ");
if (heroicCount > 0)
heroicLore.add(ChatColor.RESET + "Click to open!");
List<String> legendaryLore = new ArrayList<String>();
legendaryLore.add(" ");
legendaryLore.add(F.value("Legendary Chests Owned", "" + legendaryCount));
legendaryLore.add(" ");
if (legendaryCount > 0)
legendaryLore.add(ChatColor.RESET + "Click to open!");
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Basic Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Heroic Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Legendary Chest", legendaryLore.toArray(new String[0]), 0, false, false);
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.BASIC));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.HEROIC));

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
@ -12,16 +13,18 @@ import mineplex.core.treasure.TreasureManager;
public class TreasureShop extends ShopBase<TreasureManager>
{
private TreasureLocation _treasureLocation;
private InventoryManager _inventoryManager;
public TreasureShop(TreasureManager plugin, CoreClientManager clientManager, DonationManager donationManager, TreasureLocation treasureLocation)
public TreasureShop(TreasureManager plugin, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, TreasureLocation treasureLocation)
{
super(plugin, clientManager, donationManager, "Treasure Shop");
_treasureLocation = treasureLocation;
_inventoryManager = inventoryManager;
}
@Override
protected ShopPageBase<TreasureManager, ? extends ShopBase<TreasureManager>> BuildPagesFor(Player player)
{
return new TreasurePage(Plugin, this, _treasureLocation, ClientManager, DonationManager, player);
return new TreasurePage(Plugin, this, _treasureLocation, ClientManager, DonationManager, _inventoryManager, player);
}
}

View File

@ -1,5 +1,8 @@
package mineplex.game.clans;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.blockrestore.BlockRestore;
@ -25,9 +28,6 @@ import mineplex.core.updater.Updater;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.shop.building.BuildingShop;
import mineplex.game.clans.shop.pvp.PvpShop;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import org.bukkit.plugin.java.JavaPlugin;
public class Clans extends JavaPlugin
{
@ -79,7 +79,7 @@ public class Clans extends JavaPlugin
new MemoryFix(this);
new Explosion(this, blockRestore);
new FriendManager(this, _clientManager, preferenceManager);
new FriendManager(this, _clientManager, preferenceManager, portal);
new InventoryManager(this, _clientManager);
ClansManager clans = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, webServerAddress);

View File

@ -64,7 +64,7 @@ public class SuperSmash extends SoloGame
private Location _powerupCurrent = null;
private Location _powerupTarget = null;
private EnderCrystal _powerup = null;
private long _lastPowerup = 0;
private long _nextPowerup = 0;
private HashSet<BlockData> _restoreBlock = new HashSet<BlockData>();
@ -141,6 +141,8 @@ public class SuperSmash extends SoloGame
for (Player player : GetPlayers(true))
_lives.put(player, 4);
_nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random());
}
@EventHandler
@ -242,7 +244,7 @@ public class SuperSmash extends SoloGame
if (_powerup == null)
{
if (!UtilTime.elapsed(_lastPowerup, 12000))
if (System.currentTimeMillis() < _nextPowerup)
return;
if (WorldData.GetDataLocs("RED").isEmpty())
@ -253,7 +255,7 @@ public class SuperSmash extends SoloGame
Location newTarget = UtilAlg.Random(WorldData.GetDataLocs("RED"));
_powerupTarget = newTarget;
_powerupCurrent = _powerupTarget.clone().add(0, 160, 0);
_powerupCurrent = _powerupTarget.clone().add(0, 120, 0);
//Blocks
for (int x=-1 ; x<=1 ; x++)
@ -285,8 +287,7 @@ public class SuperSmash extends SoloGame
_powerupTarget = null;
_powerupCurrent = null;
_lastPowerup = System.currentTimeMillis();
//Restore Blocks
for (BlockData block : _restoreBlock)
block.restore(true);
@ -332,11 +333,9 @@ public class SuperSmash extends SoloGame
best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(),
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName()));
_lastPowerup = System.currentTimeMillis();
_nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random());
Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
best.setHealth(20);
}
}

View File

@ -47,7 +47,7 @@ public class KitBlaze extends SmashKit
},
EntityType.BLAZE,
new ItemStack(Material.BLAZE_ROD),
"Phoenix", 16000, Sound.BLAZE_DEATH);
"Phoenix", 18000, Sound.BLAZE_DEATH);
}

View File

@ -104,10 +104,7 @@ public class KitCreeper extends SmashKit
@Override
public void giveSuperItems(Player player)
{
player.getInventory().remove(Material.IRON_SPADE);
player.getInventory().remove(Material.IRON_AXE);
UtilInv.Update(player);
}
@Override

View File

@ -43,7 +43,7 @@ public class KitSkeleton extends SmashKit
new PerkKnockbackArrow(1.75),
new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 5000),
new PerkBarrage(5, 300, true, false),
new PerkBarrage(5, 300, true, true),
new PerkSkeletonArrowStorm()
},
EntityType.SKELETON,

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -18,6 +19,7 @@ import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkSpiderLeap;
import nautilus.game.arcade.kit.perks.PerkNeedler;
import nautilus.game.arcade.kit.perks.PerkSpidersNest;
import nautilus.game.arcade.kit.perks.PerkWebShot;
public class KitSpider extends SmashKit
@ -32,14 +34,15 @@ public class KitSpider extends SmashKit
new Perk[]
{
new PerkSmashStats(7, 1.6, 0.3, 5.5),
new PerkSmashStats(7, 1.5, 0.3, 6),
new PerkSpiderLeap(),
new PerkNeedler(),
new PerkWebShot(),
new PerkSpidersNest()
},
EntityType.SPIDER,
new ItemStack(Material.WEB),
"", 0, null);
"Spider Nest", 30000, Sound.SPIDER_DEATH);
}
@Override
@ -88,8 +91,20 @@ public class KitSpider extends SmashKit
ChatColor.RESET + "",
ChatColor.RESET + C.cAqua + "Wall Climb uses Energy (Experience Bar)",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spiders Nest",
new String[]
{
ChatColor.RESET + "Spawn a nest of webs around you to trap",
ChatColor.RESET + "enemy players. Your attacks heal you and",
ChatColor.RESET + "permanently increase your health. ",
ChatColor.RESET + "",
ChatColor.RESET + "Your abilities have a one second recharge.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));

View File

@ -2,14 +2,17 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.KitAvailability;
@ -37,7 +40,7 @@ public class KitWolf extends SmashKit
},
EntityType.WOLF,
new ItemStack(Material.BONE),
"", 0, null);
"Frenzy", 30000, Sound.WOLF_HOWL);
}
@Override
@ -74,6 +77,16 @@ public class KitWolf extends SmashKit
ChatColor.RESET + "+1 Damage for 3 seconds. Bonus damage",
ChatColor.RESET + "stacks from multiple hits.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Frenzy",
new String[]
{
ChatColor.RESET + "Gain incredible speed, regeneration",
ChatColor.RESET + "and damage. All your abilities recharge",
ChatColor.RESET + "extremely rapidly.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
@ -101,4 +114,30 @@ public class KitWolf extends SmashKit
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@Override
public void activateSuperCustom(Player player)
{
Manager.GetCondition().Factory().Strength(GetName(), player, player, 30, 1, false, false, false);
Manager.GetCondition().Factory().Speed(GetName(), player, player, 30, 2, false, false, false);
Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 2, false, false, false);
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise instanceof DisguiseWolf)
{
((DisguiseWolf)disguise).setAngry(true);
Manager.GetDisguise().updateDisguise(disguise);
}
}
@Override
public void deactivateSuperCustom(Player player)
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise instanceof DisguiseWolf)
{
((DisguiseWolf)disguise).setAngry(false);
Manager.GetDisguise().updateDisguise(disguise);
}
}
}

View File

@ -17,12 +17,13 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFleshArrow;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkNightLivingDead;
import nautilus.game.arcade.kit.perks.PerkOvercharge;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
import nautilus.game.arcade.kit.perks.PerkDeathsGrasp;
import nautilus.game.arcade.kit.perks.PerkZombieBile;
public class KitZombie extends SmashKit
{
@ -39,8 +40,9 @@ public class KitZombie extends SmashKit
new PerkSmashStats(6, 1.25, 0.3, 4.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(2, 2, false),
new PerkKnockbackArrow(2),
new PerkFleshArrow(),
new PerkKnockbackArrow(1.5),
new PerkOvercharge(6, 250, true),
new PerkZombieBile(),
new PerkDeathsGrasp(),
new PerkNightLivingDead()
@ -54,35 +56,37 @@ public class KitZombie extends SmashKit
public void giveCoreItems(Player player)
{
UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp",
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster",
new String[]
{
ChatColor.RESET + "Leap forwards. If you collide with an opponent,",
ChatColor.RESET + "you deal damage, throw them behind you and",
ChatColor.RESET + "instantly recharges the ability.",
ChatColor.RESET + "Spew up your dinner from last night.",
ChatColor.RESET + "Deals damage and knockback to enemies.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flesh Arrow",
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp",
new String[]
{
ChatColor.RESET + "Instantly fires an arrow with a baby ",
ChatColor.RESET + "zombie impaled on it. The zombie will",
ChatColor.RESET + "attack enemies after the arrow hits.",
ChatColor.RESET + "Leap forwards. If you collide with an ",
ChatColor.RESET + "opponent, you deal damage, throw them ",
ChatColor.RESET + "behind you and recharge the ability.",
ChatColor.RESET + "",
ChatColor.RESET + "Arrows deal double damage to enemies",
ChatColor.RESET + "recently hit by Deaths Grasp.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Combo Shot",
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Corrupted Arrow",
new String[]
{
ChatColor.RESET + "Your arrows deal 2x damage to oppoents",
ChatColor.RESET + "who are airborne from Deaths Grasp.",
ChatColor.RESET + "",
ChatColor.RESET + "Charge your arrows to corrupt them,",
ChatColor.RESET + "adding up to an additional 6 damage.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Night of the Living Dead",

View File

@ -109,6 +109,9 @@ public abstract class SmashKit extends Kit
activateSuper(event.getPlayer());
//Heal
event.getPlayer().setHealth(event.getPlayer().getMaxHealth());
//Inform + Effect
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), _superSound, 20f, 1f);

View File

@ -126,7 +126,7 @@ public class PerkBarrage extends SmashPerk
{
if (_useExp)
{
cur.setLevel(_charge.get(cur));
cur.setExp(0f);
}
_charge.remove(cur);
_chargeLast.remove(cur);
@ -138,7 +138,7 @@ public class PerkBarrage extends SmashPerk
if (_useExp)
{
cur.setLevel(_charge.get(cur));
cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max));
}
_chargeLast.put(cur, System.currentTimeMillis());
@ -204,7 +204,7 @@ public class PerkBarrage extends SmashPerk
_charge.put(cur, arrows - 1);
if (_useExp)
{
cur.setLevel(_charge.get(cur));
cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max));
}
// Fire Arrow
@ -219,7 +219,7 @@ public class PerkBarrage extends SmashPerk
{
if (_useExp)
{
cur.setLevel(0);
cur.setExp(0f);
}
_charge.remove(cur);
_chargeLast.remove(cur);

View File

@ -135,7 +135,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown
event.AddKnockback(GetName(), 10);
if (event.GetReason() != null && event.GetReason().contains("Bone Storm"))
event.AddKnockback(GetName(), 15);
event.AddKnockback(GetName(), 6);
}
@Override
@ -153,7 +153,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown
if (isSuperActive(damager))
{
damage = 1.4;
damage = 3;
reason = "Bone Storm";
}

View File

@ -50,7 +50,7 @@ public class PerkDeadlyBones extends SmashPerk
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 400, true, true))
if (!Recharge.Instance.use(player, GetName(), 400, false, false))
return;
_active.put(player.getWorld().dropItemNaturally(player.getLocation().add(0, 0.5, 0),
@ -70,7 +70,7 @@ public class PerkDeadlyBones extends SmashPerk
Item item = itemIter.next();
//Not Ready
if (item.isValid() && item.getTicksLived() < 60)
if (item.isValid() && item.getTicksLived() < 50)
continue;
//Effect
@ -80,14 +80,14 @@ public class PerkDeadlyBones extends SmashPerk
Player player = _active.get(item);
//Damage
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), 4);
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(item.getLocation(), 4);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
continue;
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, 4 * targets.get(cur) + 0.5, true, true, false,
DamageCause.CUSTOM, 4 * targets.get(cur) + 1, true, true, false,
player.getName(), GetName());
}

View File

@ -43,7 +43,7 @@ public class PerkDeathsGrasp extends Perk
super("Deaths Grasp", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Deaths Grasp",
C.cGray + "+4 Arrow Damage to enemies thrown by Deaths Grasp"
C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp"
});
}
@ -53,13 +53,13 @@ public class PerkDeathsGrasp extends Perk
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isAxe(event.getPlayer().getItemInHand()))
if (!UtilGear.isBow(event.getPlayer().getItemInHand()))
return;
Player player = event.getPlayer();
@ -114,7 +114,7 @@ public class PerkDeathsGrasp extends Perk
if (!UtilTime.elapsed(_live.get(ent), 1000))
continue;
_live.remove(ent);
leapIter.remove();
}
//Weakness End
@ -177,7 +177,7 @@ public class PerkDeathsGrasp extends Perk
if (!Manager.IsAlive(damager))
return;
event.AddMod(GetName(), GetName() + " Combo", 4, true);
event.AddMult(GetName(), GetName() + " Combo", 2, true);
UtilParticle.PlayParticle(ParticleType.RED_DUST, event.GetDamageeEntity().getLocation(), 0.5f, 0.5f, 0.5f, 0, 20);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.GetDamageeEntity().getLocation(), 0, 0, 0, 0, 1);

View File

@ -122,10 +122,10 @@ public class PerkFirefly extends SmashPerk
if (_tick == 0)
{
//Firework
UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), Type.BURST, Color.RED, superActive, superActive);
UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), isSuperActive(data.Player) ? Type.BALL : Type.BURST, Color.RED, false, superActive);
}
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 5 : 4))
for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 6 : 4))
{
if (other.equals(data.Player))
continue;

View File

@ -22,8 +22,9 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkNeedler extends Perk
public class PerkNeedler extends SmashPerk
{
private HashMap<Player, Integer> _active = new HashMap<Player, Integer>();
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
@ -56,7 +57,7 @@ public class PerkNeedler extends Perk
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 1800, true, true))
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 600 : 1800, !isSuperActive(player), !isSuperActive(player)))
return;
_active.put(player, 8);

View File

@ -0,0 +1,202 @@
package nautilus.game.arcade.kit.perks;
import java.util.Iterator;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkOvercharge extends SmashPerk
{
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
private WeakHashMap<Arrow, Integer> _arrows = new WeakHashMap<Arrow, Integer>();
private int _max;
private long _tick;
private boolean _useExp;
public PerkOvercharge(int max, long tick, boolean useExpBar)
{
super("Corrupted Arrow", new String[]
{
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Corrupted Arrow"
});
_useExp = useExpBar;
_max = max;
_tick = tick;
}
@EventHandler
public void drawBow(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
return;
if (isSuperActive(player))
return;
if (!Kit.HasKit(player))
return;
if (!player.getInventory().contains(Material.ARROW))
return;
if (event.getClickedBlock() != null)
if (UtilBlock.usable(event.getClickedBlock()))
return;
// Start Charge
_charge.put(player, 0);
_chargeLast.put(player, System.currentTimeMillis());
}
@EventHandler
public void charge(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
// Not Charging
if (!_charge.containsKey(cur))
continue;
// Max Charge
if (_charge.get(cur) >= _max)
continue;
// Charge Interval
if (_charge.get(cur) == 0)
{
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
continue;
}
else
{
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
continue;
}
// No Longer Holding Bow
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
{
if (_useExp)
cur.setExp(0f);
_charge.remove(cur);
_chargeLast.remove(cur);
continue;
}
// Increase Charge
_charge.put(cur, _charge.get(cur) + 1);
if (_useExp)
cur.setExp(Math.min(0.9999f, (float)_charge.get(cur) / (float)_max));
_chargeLast.put(cur, System.currentTimeMillis());
// Effect
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
}
}
@EventHandler(priority = EventPriority.HIGH)
public void fireBow(EntityShootBowEvent event)
{
if (event.isCancelled())
return;
if (!Manager.GetGame().IsLive())
return;
if (!(event.getEntity() instanceof Player))
return;
if (!(event.getProjectile() instanceof Arrow))
return;
Player player = (Player) event.getEntity();
if (!_charge.containsKey(player))
return;
int charge = _charge.remove(player);
if (charge <= 0)
return;
// Start Barrage
_arrows.put((Arrow)event.getProjectile(), charge);
player.setExp(0f);
}
@EventHandler(priority = EventPriority.HIGH)
public void damageBonus(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
return;
if (!_arrows.containsKey(event.GetProjectile()))
return;
int charge = _arrows.remove(event.GetProjectile());
event.AddMod(GetName(), GetName(), charge, true);
}
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Iterator<Arrow> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 120)
arrowIterator.remove();
else
UtilParticle.PlayParticle(ParticleType.RED_DUST, arrow.getLocation(), 0, 0, 0, 0, 1);
}
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
_charge.remove(player);
_chargeLast.remove(player);
}
}

View File

@ -0,0 +1,116 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.WeakHashMap;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkSpidersNest extends SmashPerk
{
private WeakHashMap<LivingEntity, Double> _preHealth = new WeakHashMap<LivingEntity, Double>();
public PerkSpidersNest()
{
super("Spider Nest", new String[] {});
}
@Override
public void addSuperCustom(Player player)
{
//Nest
HashMap<Block, Double> blocks = UtilBlock.getInRadius(player.getLocation().getBlock(), 16);
for (Block block : blocks.keySet())
{
if (blocks.get(block) > 0.07)
continue;
if (!UtilBlock.airFoliage(block))
continue;
if (block.getY() > player.getLocation().getY() + 10)
continue;
if (block.getY() < player.getLocation().getY() - 10)
continue;
Manager.GetBlockRestore().Add(block, 30, (byte)0, (long) (30000 + 5000 * Math.random()));
}
//Regen
Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 0, false, false, false);
}
@EventHandler(priority = EventPriority.HIGH)
public void damagePre(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK &&
event.GetCause() != DamageCause.PROJECTILE &&
event.GetCause() != DamageCause.CUSTOM)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null)
return;
if (!isSuperActive(damager))
return;
_preHealth.put(damagee, damagee.getHealth());
}
@EventHandler(priority = EventPriority.MONITOR)
public void damagePost(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null)
return;
if (!isSuperActive(damager))
return;
if (!_preHealth.containsKey(damagee))
return;
double diff = (_preHealth.remove(damagee) - damagee.getHealth())/2d;
if (diff <= 0)
return;
damager.setMaxHealth(Math.min(60, damager.getMaxHealth() + diff));
damager.setHealth(damager.getHealth() + diff);
UtilParticle.PlayParticle(ParticleType.HEART, damager.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(ParticleType.RED_DUST, damagee.getLocation().add(0, 1, 0), 0.4f, 0.4f, 0.4f, 0, 12);
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1.5f, 1f);
}
}

View File

@ -17,15 +17,14 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkWebShot extends Perk implements IThrown
public class PerkWebShot extends SmashPerk implements IThrown
{
public PerkWebShot()
{
@ -59,7 +58,7 @@ public class PerkWebShot extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 1000 : 10000, !isSuperActive(player), !isSuperActive(player)))
return;
event.setCancelled(true);

View File

@ -9,7 +9,6 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWolf;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
@ -34,11 +33,11 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
public class PerkWolf extends Perk
public class PerkWolf extends SmashPerk
{
private HashMap<Wolf, Player> _owner = new HashMap<Wolf, Player>();
private HashMap<Wolf, LivingEntity> _tackle = new HashMap<Wolf, LivingEntity>();
@ -83,7 +82,7 @@ public class PerkWolf extends Perk
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, "Cub Tackle", 8000, true, true))
if (!Recharge.Instance.use(player, "Cub Tackle", isSuperActive(player) ? 800 : 8000, !isSuperActive(player), !isSuperActive(player)))
return;
//Get Nearest Wolf
@ -256,7 +255,7 @@ public class PerkWolf extends Perk
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, "Wolf Strike", 8000, true, true))
if (!Recharge.Instance.use(player, "Wolf Strike", isSuperActive(player) ? 800 : 8000, !isSuperActive(player), !isSuperActive(player)))
return;
//Velocity
@ -426,4 +425,11 @@ public class PerkWolf extends Perk
player.setExp(Math.min(0.9999f, _repeat.get(player).size()/9f));
}
}
@Override
public void addSuperCustom(Player player)
{
Recharge.Instance.recharge(player, "Wolf Strike");
Recharge.Instance.recharge(player, "Cub Tackle");
}
}

View File

@ -0,0 +1,148 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkZombieBile extends SmashPerk implements IThrown
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkZombieBile()
{
super("Spew Bile", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Spew Bile"
});
}
@EventHandler
public void activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
return;
_active.put(player, System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> activeIter = _active.keySet().iterator();
while (activeIter.hasNext())
{
Player player = activeIter.next();
//Expire
if (UtilTime.elapsed(_active.get(player), 2000))
{
activeIter.remove();
continue;
}
//Sound
if (Math.random() > 0.85)
player.getWorld().playSound(player.getLocation(), Sound.BURP, 1f, (float)(Math.random() + 0.5));
//Projectiles
for (int i=0 ; i<3 ; i++)
{
Vector rand = new Vector((Math.random()-0.5)*0.6,(Math.random()-0.5)*0.6,(Math.random()-0.5)*0.6);
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.ROTTEN_FLESH));
UtilAction.velocity(ent, player.getLocation().getDirection().add(rand), 0.8, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, System.currentTimeMillis() + 2000, true, true, true, false, 1.5d);
}
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
data.GetThrown().remove();
if (target == null)
return;
if (target instanceof Player)
if (!Manager.GetGame().IsAlive((Player)target))
return;
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.CUSTOM, 3, true, false, false,
UtilEnt.getName(data.GetThrower()), GetName());
data.GetThrown().remove();
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 1);
}
}

View File

@ -0,0 +1,67 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.SmashPerk;
public class PerkZombieRot extends SmashPerk
{
public PerkZombieRot()
{
super("Rot", new String[]
{
C.cGray + "Leave a path that slows and prevents jumping.",
});
}
@EventHandler
public void SnowAura(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
//Blocks
HashMap<Block, Double> blocks = UtilBlock.getInRadius(player.getLocation(), 3);
for (Block block : blocks.keySet())
{
if (UtilBlock.solid(block.getRelative(BlockFace.UP)))
continue;
if (!UtilBlock.solid(block))
continue;
//Snow
Manager.GetBlockRestore().Add(block, 159, (byte)12, 3000);
}
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (Kit.HasKit(player))
continue;
if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.STAINED_CLAY ||
player.getLocation().getBlock().getRelative(BlockFace.DOWN).getData() != 12)
continue;
Manager.GetCondition().Factory().Slow(GetName(), player, null, 1.9, 1, false, false, false, false);
Manager.GetCondition().Factory().Jump(GetName(), player, null, 1.9, 244, false, false, false);
}
}
}