Complete animations for the 3 old chests

This commit is contained in:
Sam 2017-09-18 20:52:38 +01:00
parent efc1ffe9db
commit f7ae9ba982
26 changed files with 960 additions and 314 deletions

View File

@ -3,6 +3,7 @@ package mineplex.core.reward;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.treasure.reward.RewardRarity;
public class RankRewardData extends RewardData
@ -12,7 +13,7 @@ public class RankRewardData extends RewardData
public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, PermissionGroup rank)
{
super(null, friendlyName, displayItem, rarity);
super(C.cRed + "Rank Upgrade", friendlyName, displayItem, rarity);
_rank = rank;
}

View File

@ -7,7 +7,7 @@ public enum RewardType
//% Chances Mythic Legend Rare Uncommon Common
GAME_LOOT( 0.000001, 0.00001, 0.0001, 3, 0),
OLD_CHEST( 0, 0.06, 0.8, 16, 40),
OLD_CHEST( 20, 0.06, 0.8, 16, 40),
ANCIENT_CHEST( 0, 2, 8, 32, 0),
MYTHICAL_CHEST( 0.1, 4, 16, 72, 0),
WINTER_CHEST( 0, 5, 18, 32, 0),

View File

@ -25,7 +25,7 @@ public class RankReward extends Reward
_canPassLegend = canPassLegend;
}
private PermissionGroup getNext(PermissionGroup current, boolean canPassLegend)
private PermissionGroup getNext(PermissionGroup current)
{
PermissionGroup newGroup = null;
@ -41,16 +41,10 @@ public class RankReward extends Reward
newGroup = PermissionGroup.LEGEND;
break;
case LEGEND:
if (canPassLegend)
{
newGroup = PermissionGroup.TITAN;
}
break;
case TITAN:
if (canPassLegend)
{
newGroup = PermissionGroup.ETERNAL;
}
break;
default:
break;
@ -62,7 +56,7 @@ public class RankReward extends Reward
@Override
public RewardData giveRewardCustom(Player player)
{
PermissionGroup group = getNext(CLIENT_MANAGER.Get(player).getPrimaryGroup(), _canPassLegend);
PermissionGroup group = getNext(CLIENT_MANAGER.Get(player).getPrimaryGroup());
if (group == null)
{
@ -77,7 +71,7 @@ public class RankReward extends Reward
@Override
public RewardData getFakeRewardData(Player player)
{
PermissionGroup group = getNext(CLIENT_MANAGER.Get(player).getPrimaryGroup(), true);
PermissionGroup group = getNext(CLIENT_MANAGER.Get(player).getPrimaryGroup());
if (group == null)
{
@ -90,7 +84,7 @@ public class RankReward extends Reward
@Override
public boolean canGiveReward(Player player)
{
return !CLIENT_MANAGER.Get(player).getPrimaryGroup().inheritsFrom(PermissionGroup.ETERNAL);
return !CLIENT_MANAGER.Get(player).getPrimaryGroup().inheritsFrom(_canPassLegend ? PermissionGroup.ETERNAL : PermissionGroup.LEGEND);
}
@Override

View File

@ -197,7 +197,7 @@ public class TreasureLocation implements Listener
Bukkit.broadcastMessage(F.main(getManager().getName(), F.name(player.getName()) + " is opening " + (an ? "an" : "a") + " " + F.name(treasureName) + "."));
}
UtilTextMiddle.display(treasureName, "Choose " + C.cYellow + treasure.getRewardsPerChest() + C.cWhite + " to open");
UtilTextMiddle.display(treasureName, "Choose " + C.cYellow + treasure.getRewardsPerChest() + C.cWhite + " to open", 10, 30, 10, player);
}
}, player, treasure.getTreasureType().getItemName(), -1);

View File

@ -11,16 +11,20 @@ import org.bukkit.event.EventHandler;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.treasure.reward.TreasureRewardManager;
import mineplex.core.treasure.types.AncientTreasure;
import mineplex.core.treasure.types.MythicalTreasure;
import mineplex.core.treasure.types.OldTreasure;
import mineplex.core.treasure.types.Treasure;
@ -28,8 +32,9 @@ import mineplex.core.treasure.types.Treasure;
public class TreasureManager extends MiniPlugin
{
private final BonusManager _bonusManager;
private final BlockRestore _blockRestore;
private final CoreClientManager _clientManager;
private final DisguiseManager _disguiseManager;
private final DonationManager _donationManager;
private final InventoryManager _inventoryManager;
private final TreasureRewardManager _rewardManager;
@ -41,8 +46,9 @@ public class TreasureManager extends MiniPlugin
{
super("Treasure");
_bonusManager = require(BonusManager.class);
_blockRestore = require(BlockRestore.class);
_clientManager = require(CoreClientManager.class);
_disguiseManager = require(DisguiseManager.class);
_donationManager = require(DonationManager.class);
_inventoryManager = require(InventoryManager.class);
_rewardManager = require(TreasureRewardManager.class);
@ -56,6 +62,8 @@ public class TreasureManager extends MiniPlugin
private void populateTreasureTypes()
{
addTreasureType(new OldTreasure());
addTreasureType(new AncientTreasure());
addTreasureType(new MythicalTreasure());
}
private void addTreasureType(Treasure treasure)
@ -151,9 +159,9 @@ public class TreasureManager extends MiniPlugin
return false;
}
public BonusManager getBonusManager()
public BlockRestore getBlockRestore()
{
return _bonusManager;
return _blockRestore;
}
public CoreClientManager getClientManager()
@ -161,6 +169,11 @@ public class TreasureManager extends MiniPlugin
return _clientManager;
}
public DisguiseManager getDisguiseManager()
{
return _disguiseManager;
}
public DonationManager getDonationManager()
{
return _donationManager;

View File

@ -2,7 +2,9 @@ package mineplex.core.treasure;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
@ -13,6 +15,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
@ -20,10 +23,13 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.animation.TreasureAnimation;
import mineplex.core.treasure.animation.TreasureRewardAnimation;
import mineplex.core.treasure.reward.RewardRarity;
import mineplex.core.treasure.types.Treasure;
import mineplex.core.treasure.util.TreasureUtil;
import mineplex.core.updater.UpdateType;
@ -32,7 +38,8 @@ import mineplex.core.updater.event.UpdateEvent;
public class TreasureSession implements Listener
{
private static final int CHEST_RADIUS = 4;
private static final double CHEST_RADIUS = 3.2;
private static final long TIMEOUT = TimeUnit.MINUTES.toMillis(1);
private final Player _player;
private final TreasureLocation _treasureLocation;
@ -42,6 +49,7 @@ public class TreasureSession implements Listener
private final List<Reward> _rewards;
private final List<RewardData> _rewardData;
private final List<Location> _openedChests;
private final long _start;
TreasureSession(Player player, TreasureLocation treasureLocation, Treasure treasure)
{
@ -53,16 +61,11 @@ public class TreasureSession implements Listener
_rewards = Treasure.getRewardManager().getRewards(player, treasure);
_rewardData = new ArrayList<>(treasure.getRewardsPerChest());
_openedChests = new ArrayList<>(treasure.getRewardsPerChest());
_start = System.currentTimeMillis();
if (!hasFailed())
{
_rewards.forEach(reward -> reward.giveReward(player, _rewardData::add));
for (RewardData rewardData : _rewardData)
{
player.sendMessage(rewardData.getHeader() + " -> " + rewardData.getFriendlyName());
}
_animation.setRunning(true);
UtilServer.RegisterEvents(this);
}
@ -115,6 +118,7 @@ public class TreasureSession implements Listener
}
RewardData rewardData = _rewardData.get(_openedChests.size());
RewardRarity rarity = rewardData.getRarity();
TreasureRewardAnimation rewardAnimation = TreasureRewardAnimation.getAnimationFor(_treasure, _treasureLocation, location.clone().add(0.5, 1, 0.5), rewardData);
Material material = event.getClickedBlock().getType();
@ -123,6 +127,12 @@ public class TreasureSession implements Listener
TreasureUtil.playChestOpen(location, true);
}
if (rarity.ordinal() >= RewardRarity.RARE.ordinal())
{
boolean an = UtilText.startsWithVowel(rewardData.getFriendlyName());
Bukkit.broadcastMessage(F.main(_treasureLocation.getManager().getName(), F.name(player.getName()) + " found " + (an ? "an" : "a") + " " + F.name(rarity.getColor() + rarity.getName()) + " " + F.name(rewardData.getFriendlyName()) + "."));
}
if (rewardAnimation != null)
{
_rewardAnimations.add(rewardAnimation);
@ -165,6 +175,10 @@ public class TreasureSession implements Listener
return;
}
_rewardAnimations.stream()
.filter(TreasureAnimation::isRunning)
.forEach(TreasureAnimation::run);
if (_animation.isRunning())
{
_animation.run();
@ -186,7 +200,7 @@ public class TreasureSession implements Listener
{
for (LivingEntity entity : UtilEnt.getInRadius(_treasureLocation.getChest(), CHEST_RADIUS).keySet())
{
if (entity.equals(_player))
if (entity.equals(_player) || UtilEnt.hasFlag(entity, UtilEnt.FLAG_ENTITY_COMPONENT))
{
continue;
}
@ -205,12 +219,30 @@ public class TreasureSession implements Listener
return;
}
if (UtilMath.offsetSquared(player.getLocation(), _treasureLocation.getChest()) > CHEST_RADIUS * CHEST_RADIUS)
if (UtilMath.offset2dSquared(player.getLocation(), _treasureLocation.getChest()) > CHEST_RADIUS * CHEST_RADIUS)
{
event.setTo(event.getFrom());
}
}
@EventHandler
public void updateTimeout(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || !UtilTime.elapsed(_start, TIMEOUT))
{
return;
}
getPlayer().sendMessage(F.main(_treasureLocation.getManager().getName(), "You took too long opening your chest. I picked your rewards for you:"));
for (RewardData rewardData : _rewardData)
{
getPlayer().sendMessage(F.main(_treasureLocation.getManager().getName(), rewardData.getHeader() + " : " + rewardData.getFriendlyName()));
}
cleanup();
}
public Player getPlayer()
{
return _player;

View File

@ -7,6 +7,7 @@ import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
@ -14,6 +15,7 @@ import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureSession;
import mineplex.core.treasure.animation.event.TreasureAnimationFinishEvent;
@ -25,6 +27,7 @@ public abstract class TreasureAnimation implements Runnable
private final Treasure _treasure;
private final TreasureLocation _treasureLocation;
protected final List<LivingEntity> _entities;
protected final List<ArmorStand> _stands;
protected final List<Item> _items;
@ -36,6 +39,7 @@ public abstract class TreasureAnimation implements Runnable
_treasure = treasure;
_treasureLocation = treasureLocation;
_entities = new ArrayList<>();
_stands = new ArrayList<>();
_items = new ArrayList<>();
}
@ -63,12 +67,32 @@ public abstract class TreasureAnimation implements Runnable
public void cleanup()
{
_entities.forEach(Entity::remove);
_entities.clear();
_stands.forEach(Entity::remove);
_stands.clear();
_items.forEach(Entity::remove);
_items.clear();
}
protected <T extends LivingEntity> T spawnEntity(Location location, Class<T> clazz)
{
T entity = location.getWorld().spawn(location, clazz);
UtilEnt.vegetate(entity);
UtilEnt.ghost(entity, true, false);
UtilEnt.CreatureLook(entity, location.getPitch(), location.getYaw());
UtilEnt.addFlag(entity, UtilEnt.FLAG_ENTITY_COMPONENT);
_entities.add(entity);
return entity;
}
protected void disguise(DisguiseBase disguise)
{
_treasureLocation.getManager().getDisguiseManager().disguise(disguise);
}
protected ArmorStand spawnArmourStand(Location location)
{
float yaw = Math.round(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _treasureLocation.getChest())) / 90F) * 90F;
@ -139,7 +163,7 @@ public abstract class TreasureAnimation implements Runnable
{
_running = running;
if (_running)
if (running)
{
onStart();
}

View File

@ -1,9 +1,19 @@
package mineplex.core.treasure.animation;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilServer;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.types.Treasure;
import mineplex.core.treasure.util.TreasureUtil;
@ -11,13 +21,74 @@ import mineplex.core.treasure.util.TreasureUtil;
public abstract class TreasureOpenAnimation extends TreasureAnimation
{
private final List<Block> _blocksToRestore;
public TreasureOpenAnimation(Treasure treasure, TreasureLocation treasureLocation)
{
super(treasure, treasureLocation);
_blocksToRestore = new ArrayList<>();
}
protected void createChestAt(Location location, Material material)
{
MapUtil.QuickChangeBlockAt(location, material, TreasureUtil.getChestFacing(location.getYaw()));
}
protected int changeFloor(Material materialA, int dataA)
{
return changeFloor(materialA, dataA, materialA, dataA);
}
protected int changeFloor(Material materialA, int dataA, Material materialB, int dataB)
{
BlockRestore blockRestore = getTreasureLocation().getManager().getBlockRestore();
AtomicInteger size = new AtomicInteger();
AtomicBoolean tick = new AtomicBoolean();
Location center = getTreasureLocation().getChest().clone().subtract(0, 1, 0);
UtilServer.runSyncTimer(new BukkitRunnable()
{
@Override
public void run()
{
int aSize = size.get();
if (aSize > 3)
{
cancel();
return;
}
int id = tick.get() ? materialA.getId() : materialB.getId();
byte data = (byte) (tick.get() ? dataA : dataB);
for (Block block : UtilBlock.getInBoundingBox(center.clone().add(aSize, 0, aSize), center.clone().subtract(aSize, 0, aSize)))
{
if (blockRestore.contains(block))
{
continue;
}
_blocksToRestore.add(block);
blockRestore.add(block, id, data, Long.MAX_VALUE);
}
size.getAndIncrement();
tick.set(!tick.get());
}
}, 0, 10);
return getTicks() + 40;
}
@Override
public void cleanup()
{
super.cleanup();
BlockRestore blockRestore = getTreasureLocation().getManager().getBlockRestore();
_blocksToRestore.forEach(blockRestore::restore);
}
}

View File

@ -4,8 +4,10 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import mineplex.core.Managers;
import mineplex.core.common.currency.GlobalCurrency;
@ -17,6 +19,9 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.animations.reward.CommonRewardAnimation;
import mineplex.core.treasure.animation.animations.reward.LegendaryRewardAnimation;
import mineplex.core.treasure.animation.animations.reward.MythicalRewardAnimation;
import mineplex.core.treasure.animation.animations.reward.RareRewardAnimation;
import mineplex.core.treasure.animation.animations.reward.UncommonRewardAnimation;
import mineplex.core.treasure.types.Treasure;
@ -24,6 +29,7 @@ public abstract class TreasureRewardAnimation extends TreasureAnimation
{
private static final HologramManager HOLOGRAM_MANAGER = Managers.require(HologramManager.class);
private static final ItemStack FALL_BACK_ITEM = new ItemStack(Material.PRISMARINE_SHARD);
public static TreasureRewardAnimation getAnimationFor(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData)
{
@ -34,11 +40,11 @@ public abstract class TreasureRewardAnimation extends TreasureAnimation
case UNCOMMON:
return new UncommonRewardAnimation(treasure, treasureLocation, location, rewardData);
case RARE:
return null;
return new RareRewardAnimation(treasure, treasureLocation, location, rewardData);
case LEGENDARY:
return null;
return new LegendaryRewardAnimation(treasure, treasureLocation, location, rewardData);
case MYTHICAL:
return null;
return new MythicalRewardAnimation(treasure, treasureLocation, location, rewardData);
}
return null;
@ -65,7 +71,7 @@ public abstract class TreasureRewardAnimation extends TreasureAnimation
private void createHologramItemPair0()
{
ArmorStand itemHolder = spawnArmourStand(_location.clone().subtract(0, 1.5, 0));
Item item = spawnItem(_location, _rewardData.getDisplayItem(), false);
Item item = spawnItem(_location, _rewardData.getDisplayItem() == null ? FALL_BACK_ITEM : _rewardData.getDisplayItem(), false);
itemHolder.setPassenger(item);
List<String> text = new ArrayList<>();
@ -99,9 +105,4 @@ public abstract class TreasureRewardAnimation extends TreasureAnimation
{
return _location;
}
public RewardData getRewardData()
{
return _rewardData;
}
}

View File

@ -0,0 +1,81 @@
package mineplex.core.treasure.animation.animations;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseBlaze;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureOpenAnimation;
import mineplex.core.treasure.types.Treasure;
public class AncientChestAnimation extends TreasureOpenAnimation
{
public AncientChestAnimation(Treasure treasure, TreasureLocation treasureLocation)
{
super(treasure, treasureLocation);
}
@Override
protected void onStart()
{
changeFloor(Material.NETHER_BRICK, 0);
for (Location location : getTreasureLocation().getChestLocations())
{
location = location.clone().add(0, UtilMath.rRange(4, 6) + Math.random(), 0);
ArmorStand stand = spawnArmourStand(location);
disguise(new DisguiseBlaze(stand));
}
}
@Override
public void onTick()
{
double y = getTreasureLocation().getChest().getY() + 0.5;
_stands.removeIf(stand ->
{
Location location = stand.getLocation();
if (Math.random() < 0.05)
{
stand.getWorld().playSound(location, Sound.ZOMBIE_REMEDY, 1, 0.6F);
}
stand.teleport(location.subtract(0, 0.1, 0));
if (stand.isValid() && location.getY() < y)
{
stand.getWorld().playEffect(location, Effect.ENDER_SIGNAL, 0);
stand.getWorld().playSound(location, Sound.EXPLODE, 1, 0.4F);
UtilParticle.PlayParticleToAll(ParticleType.LAVA, location, 0.5F, 0.5F, 0.5F, 0.1F, 10, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0.2F, 0.2F, 0.2F, 0.1F, 10, ViewDist.NORMAL);
stand.remove();
createChestAt(location, Material.TRAPPED_CHEST);
return true;
}
return false;
});
if (_stands.isEmpty())
{
setRunning(false);
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -0,0 +1,95 @@
package mineplex.core.treasure.animation.animations;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureOpenAnimation;
import mineplex.core.treasure.types.Treasure;
public class MythicalChestAnimation extends TreasureOpenAnimation
{
private static final ItemStack HELMET = new ItemStack(Material.ENDER_CHEST);
private static final int RADIUS = 3;
private static final double OFFSET_THETA = Math.PI / 10;
private static final double DELTA_THETA = Math.PI / 40;
private static final double TOTAL_THETA = 2 * Math.PI;
private double _deltaTheta;
private double _totalTheta;
public MythicalChestAnimation(Treasure treasure, TreasureLocation treasureLocation)
{
super(treasure, treasureLocation);
}
@Override
protected void onStart()
{
changeFloor(Material.QUARTZ_BLOCK, 0, Material.QUARTZ_BLOCK, 1);
List<Location> chests = getTreasureLocation().getChestLocations();
_deltaTheta = Math.PI * 2 / (double) chests.size();
for (Location location : chests)
{
ArmorStand stand = spawnArmourStand(location);
stand.setHelmet(HELMET);
}
}
@Override
public void onTick()
{
_totalTheta += DELTA_THETA;
int index = 0;
for (ArmorStand stand : _stands)
{
Location location = getTreasureLocation().getChest().clone();
double x = RADIUS * Math.cos(_totalTheta + OFFSET_THETA + index * _deltaTheta);
double z = RADIUS * Math.sin(_totalTheta + OFFSET_THETA + index * _deltaTheta);
location.add(x, 0, z);
location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, getTreasureLocation().getChest())));
stand.teleport(location);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location.add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0.1F, 1, ViewDist.NORMAL);
index++;
}
if (_totalTheta >= TOTAL_THETA)
{
for (ArmorStand stand : _stands)
{
Location location = stand.getLocation();
stand.getWorld().playSound(location, Sound.ANVIL_LAND, 1, 0.8F);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, location, 0, 0, 0, 0.1F, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location, 0.8F, 0.8F, 0.8F, 0.1F, 20, ViewDist.NORMAL);
stand.remove();
createChestAt(location, Material.ENDER_CHEST);
}
setRunning(false);
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -19,6 +19,7 @@ public class CommonRewardAnimation extends TreasureRewardAnimation
protected void onStart()
{
createHologramItemPair();
setRunning(false);
}
@Override

View File

@ -0,0 +1,68 @@
package mineplex.core.treasure.animation.animations.reward;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureRewardAnimation;
import mineplex.core.treasure.types.Treasure;
public class LegendaryRewardAnimation extends TreasureRewardAnimation
{
private static final FireworkEffect FIREWORK_EFFECT = FireworkEffect.builder()
.with(Type.BALL_LARGE)
.withColor(Color.LIME)
.withFade(Color.GREEN)
.withFlicker()
.build();
private static final ItemStack ITEM_STACK = new ItemStack(Material.EMERALD);
public LegendaryRewardAnimation(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData)
{
super(treasure, treasureLocation, location, rewardData);
}
@Override
protected void onStart()
{
createHologramItemPair();
getLocation().getWorld().playSound(getLocation(), Sound.ENDERDRAGON_DEATH, 1, 1);
getLocation().getWorld().strikeLightningEffect(getLocation());
}
@Override
public void onTick()
{
if (getTicks() % 5 == 0)
{
UtilFirework.playFirework(getLocation(), FIREWORK_EFFECT);
for (int i = 0; i < 3; i++)
{
Item item = spawnItem(getLocation(), ITEM_STACK, true);
item.setVelocity(new Vector(Math.random() - 0.5, Math.random(), Math.random() - 0.5));
}
}
if (getTicks() > 80)
{
setRunning(false);
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -0,0 +1,77 @@
package mineplex.core.treasure.animation.animations.reward;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureRewardAnimation;
import mineplex.core.treasure.types.Treasure;
public class MythicalRewardAnimation extends TreasureRewardAnimation
{
private static final FireworkEffect FIREWORK_EFFECT = FireworkEffect.builder()
.with(Type.STAR)
.withColor(Color.RED)
.withFade(Color.MAROON)
.withFlicker()
.build();
private long _currentTime;
public MythicalRewardAnimation(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData)
{
super(treasure, treasureLocation, location, rewardData);
_currentTime = location.getWorld().getTime();
}
@Override
protected void onStart()
{
createHologramItemPair();
getLocation().getWorld().playSound(getLocation(), Sound.ENDERDRAGON_DEATH, 1, 0.5F);
UtilParticle.PlayParticleToAll(ParticleType.LAVA, getLocation(), 0.5F, 0.5F, 0.5F, 0.1F, 10, ViewDist.NORMAL);
}
@Override
public void onTick()
{
if (getTicks() % 5 == 0)
{
getLocation().getWorld().setTime(getLocation().getWorld().getTime() + 12000);
}
if (getTicks() % 2 == 0)
{
Location random = UtilAlg.getRandomLocation(getLocation(), 5, 0, 5);
if (Math.random() < 0.3)
{
random.getWorld().strikeLightningEffect(random);
}
UtilFirework.launchFirework(random, FIREWORK_EFFECT, null, UtilMath.r(3) + 1);
}
if (getTicks() > 80)
{
setRunning(false);
}
}
@Override
protected void onFinish()
{
getLocation().getWorld().setTime(_currentTime);
}
}

View File

@ -0,0 +1,66 @@
package mineplex.core.treasure.animation.animations.reward;
import org.bukkit.Location;
import org.bukkit.Sound;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureRewardAnimation;
import mineplex.core.treasure.types.Treasure;
public class RareRewardAnimation extends TreasureRewardAnimation
{
private double _radius = 3;
private double _height = -0.5;
public RareRewardAnimation(Treasure treasure, TreasureLocation treasureLocation, Location location, RewardData rewardData)
{
super(treasure, treasureLocation, location, rewardData);
}
@Override
protected void onStart()
{
createHologramItemPair();
getLocation().getWorld().playSound(getLocation(), Sound.WITHER_SPAWN, 1, 0.5F);
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, getLocation(), 0.5F, 0.5F, 0.5F, 0.1F, 10, ViewDist.NORMAL);
}
@Override
public void onTick()
{
UtilParticle.PlayParticleToAll(ParticleType.PORTAL, getLocation(), 0.5F, 0.5F, 0.5F, 0.1F, 4, ViewDist.NORMAL);
if (getTicks() % 2 == 0)
{
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
{
double x = _radius * Math.cos(theta);
double z = _radius * Math.sin(theta);
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, getLocation().clone().add(x, _height, z), 0, 0, 0, 0.001F, 1, ViewDist.NORMAL);
}
_radius -= 0.1;
_height += 0.1;
if (_radius <= 0)
{
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, getLocation().clone().add(0, _height, 0), 0, 0, 0, 0.5F, 30, ViewDist.NORMAL);
setRunning(false);
}
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -6,6 +6,9 @@ import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.animation.TreasureRewardAnimation;
@ -30,7 +33,9 @@ public class UncommonRewardAnimation extends TreasureRewardAnimation
protected void onStart()
{
createHologramItemPair();
UtilParticle.PlayParticleToAll(ParticleType.HEART, getLocation(), 0.25F, 0.25F, 0.25F, 0.1F, 4, ViewDist.NORMAL);
UtilFirework.playFirework(getLocation(), FIREWORK_EFFECT);
setRunning(false);
}
@Override

View File

@ -196,7 +196,7 @@ public class TreasureRewardManager extends MiniPlugin
// Due to the last reward always being an uncommon or better, we swap it randomly with another element as to
// appear more random.
Collections.swap(rewards, rewards.size() - 1, UtilMath.r(rewardMap.size()));
Collections.swap(rewards, rewards.size() - 1, UtilMath.r(rewards.size()));
return rewards;
}

View File

@ -0,0 +1,21 @@
package mineplex.core.treasure.types;
import mineplex.core.reward.RewardType;
import mineplex.core.treasure.animation.animations.AncientChestAnimation;
public class AncientTreasure extends NormalTreasure
{
public AncientTreasure()
{
super(TreasureType.ANCIENT);
setAnimation(treasureLocation -> new AncientChestAnimation(this, treasureLocation));
setRewards(RewardType.ANCIENT_CHEST);
setRewardsPerChest(4);
allowDuplicates();
setPurchasable(5000);
purchaseableFromStore();
enabledByDefault();
}
}

View File

@ -0,0 +1,45 @@
package mineplex.core.treasure.types;
import mineplex.core.gadget.gadgets.kitselector.HaloKitSelector;
import mineplex.core.gadget.gadgets.kitselector.RainbowDanceKitSelector;
import mineplex.core.gadget.gadgets.kitselector.ShimmeringRingKitSelector;
import mineplex.core.gadget.gadgets.kitselector.SingleParticleKitSelector;
import mineplex.core.reward.RewardType;
import mineplex.core.treasure.animation.animations.MythicalChestAnimation;
import mineplex.core.treasure.reward.RewardRarity;
public class MythicalTreasure extends NormalTreasure
{
public MythicalTreasure()
{
super(TreasureType.MYTHICAL);
setAnimation(treasureLocation -> new MythicalChestAnimation(this, treasureLocation));
setRewards(RewardType.MYTHICAL_CHEST);
setRewardsPerChest(4);
allowDuplicates();
setPurchasable(10000);
purchaseableFromStore();
enabledByDefault();
}
@Override
protected void addRare(RewardRarity rarity)
{
super.addRare(rarity);
addGadgetReward(getGadget(HaloKitSelector.class), rarity, 100);
addGadgetReward(getGadget(RainbowDanceKitSelector.class), rarity, 100);
addGadgetReward(getGadget(ShimmeringRingKitSelector.class), rarity, 150);
addGadgetReward(getKitSelector(SingleParticleKitSelector.SingleParticleSelectors.FLAMES_OF_FURY), rarity, 150);
addGadgetReward(getKitSelector(SingleParticleKitSelector.SingleParticleSelectors.EMBER), rarity, 100);
addGadgetReward(getKitSelector(SingleParticleKitSelector.SingleParticleSelectors.LOVE), rarity, 100);
}
@Override
protected void addMythical(RewardRarity rarity)
{
addRankReward(rarity, true, 100);
}
}

View File

@ -0,0 +1,277 @@
package mineplex.core.treasure.types;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
import mineplex.core.gadget.gadgets.balloons.BalloonType;
import mineplex.core.gadget.gadgets.death.DeathBlood;
import mineplex.core.gadget.gadgets.death.DeathEmerald;
import mineplex.core.gadget.gadgets.death.DeathEnchant;
import mineplex.core.gadget.gadgets.death.DeathMusic;
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.DeathShadow;
import mineplex.core.gadget.gadgets.death.DeathStorm;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
import mineplex.core.gadget.gadgets.item.ItemFirework;
import mineplex.core.gadget.gadgets.item.ItemFleshHook;
import mineplex.core.gadget.gadgets.item.ItemMelonLauncher;
import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphChicken;
import mineplex.core.gadget.gadgets.morph.MorphCow;
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
import mineplex.core.gadget.gadgets.morph.MorphSlime;
import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.mount.types.MountCart;
import mineplex.core.gadget.gadgets.mount.types.MountFrost;
import mineplex.core.gadget.gadgets.mount.types.MountMule;
import mineplex.core.gadget.gadgets.mount.types.MountSlime;
import mineplex.core.gadget.gadgets.mount.types.MountUndead;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.ParticleMusic;
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
import mineplex.core.pet.PetType;
import mineplex.core.reward.RewardType;
import mineplex.core.treasure.animation.animations.OldChestAnimation;
import mineplex.core.treasure.reward.RewardRarity;
public class NormalTreasure extends Treasure
{
NormalTreasure(TreasureType treasureType)
{
super(treasureType);
}
@Override
protected void addCommon(RewardRarity rarity)
{
// Gadgets
addGadgetReward(getGadget(ItemBatGun.class), rarity, 10, 4, 10);
addGadgetReward(getGadget(ItemEtherealPearl.class), rarity, 10, 6, 15);
addGadgetReward(getGadget(ItemFirework.class), rarity, 10, 10, 25);
addGadgetReward(getGadget(ItemFleshHook.class), rarity, 10, 8, 20);
addGadgetReward(getGadget(ItemMelonLauncher.class), rarity, 10, 10, 25);
addGadgetReward(getGadget(ItemPaintballGun.class), rarity, 10, 20, 50);
addGadgetReward(getGadget(ItemTNT.class), rarity, 10, 4, 10);
}
@Override
protected void addUncommon(RewardRarity rarity)
{
//Gadgets
addGadgetReward(getGadget(ItemBatGun.class), rarity, 250, 20, 40);
addGadgetReward(getGadget(ItemEtherealPearl.class), rarity, 250, 30, 60);
addGadgetReward(getGadget(ItemFirework.class), rarity, 250, 25, 50);
addGadgetReward(getGadget(ItemFleshHook.class), rarity, 250, 40, 80);
addGadgetReward(getGadget(ItemMelonLauncher.class), rarity, 250, 25, 50);
addGadgetReward(getGadget(ItemPaintballGun.class), rarity, 250, 100, 200);
addGadgetReward(getGadget(ItemTNT.class), rarity, 250, 20, 40);
//Pets
addPetReward(PetType.CHICKEN, rarity, 143);
addPetReward(PetType.COW, rarity, 500);
addPetReward(PetType.MUSHROOM_COW, rarity, 200);
addPetReward(PetType.OCELOT, rarity, 167);
addPetReward(PetType.PIG, rarity, 200);
addPetReward(PetType.SHEEP, rarity, 333);
addPetReward(PetType.WOLF, rarity, 125);
//Music Discs
addMusicReward("Blocks", rarity, 25);
addMusicReward("Cat", rarity, 25);
addMusicReward("Chirp", rarity, 25);
addMusicReward("Far", rarity, 25);
addMusicReward("Mall", rarity, 25);
addMusicReward("Mellohi", rarity, 25);
addMusicReward("Stal", rarity, 25);
addMusicReward("Strad", rarity, 25);
addMusicReward("Wait", rarity, 25);
addMusicReward("Ward", rarity, 25);
// Balloons
addBalloonReward(BalloonType.BABY_COW, rarity, 10, 100);
addBalloonReward(BalloonType.BABY_PIG, rarity, 10, 100);
addBalloonReward(BalloonType.BABY_SHEEP, rarity, 15, 100);
}
@Override
protected void addRare(RewardRarity rarity)
{
//Morphs
addGadgetReward(getGadget(MorphVillager.class), rarity, 83);
addGadgetReward(getGadget(MorphCow.class), rarity, 167);
addGadgetReward(getGadget(MorphChicken.class), rarity, 50);
addGadgetReward(getGadget(MorphEnderman.class), rarity, 33);
//Mounts
addGadgetReward(getGadget(MountFrost.class), rarity, 50);
addGadgetReward(getGadget(MountSlime.class), rarity, 67);
addGadgetReward(getGadget(MountCart.class), rarity, 100);
addGadgetReward(getGadget(MountMule.class), rarity, 200);
//Outfit Rave
addGadgetReward(getGadget(OutfitRaveSuitHelmet.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitChestplate.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitLeggings.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitBoots.class), rarity, 30);
//Outfit Space
addGadgetReward(getGadget(OutfitSpaceSuitHelmet.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitChestplate.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitLeggings.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitBoots.class), rarity, 50);
//Arrow Trails
addGadgetReward(getGadget(ArrowTrailConfetti.class), rarity, 27);
addGadgetReward(getGadget(ArrowTrailBlood.class), rarity, 50);
addGadgetReward(getGadget(ArrowTrailEmerald.class), rarity, 25);
addGadgetReward(getGadget(ArrowTrailMusic.class), rarity, 27);
addGadgetReward(getGadget(ArrowTrailStorm.class), rarity, 30);
addGadgetReward(getGadget(ArrowTrailShadow.class), rarity, 15);
//Double Jumps
addGadgetReward(getGadget(DoubleJumpFirecracker.class), rarity, 33);
addGadgetReward(getGadget(DoubleJumpEmerald.class), rarity, 25);
addGadgetReward(getGadget(DoubleJumpShadow.class), rarity, 15);
addGadgetReward(getGadget(DoubleJumpStorm.class), rarity, 30);
addGadgetReward(getGadget(DoubleJumpBlood.class), rarity, 50);
addGadgetReward(getGadget(DoubleJumpMusic.class), rarity, 20);
//Death Effects
addGadgetReward(getGadget(DeathPinataBurst.class), rarity, 27);
addGadgetReward(getGadget(DeathEmerald.class), rarity, 25);
addGadgetReward(getGadget(DeathShadow.class), rarity, 15);
addGadgetReward(getGadget(DeathStorm.class), rarity, 30);
addGadgetReward(getGadget(DeathBlood.class), rarity, 50);
addGadgetReward(getGadget(DeathMusic.class), rarity, 20);
//Particles
addGadgetReward(getGadget(ParticlePartyTime.class), rarity, 12);
//Titles
addTitleReward("shrug", rarity, 10, 500);
addTitleReward("tableflip", rarity, 10, 500);
addTitleReward("tablerespecter", rarity, 15, 500);
addTitleReward("tableflip-disgusted", rarity, 15, 500);
addTitleReward("tableflip-enraged", rarity, 15, 500);
addTitleReward("tableflip-riot", rarity, 10, 500);
addTitleReward("teddy-bear", rarity, 10, 500);
addTitleReward("disgust", rarity, 10, 500);
addTitleReward("old-man", rarity, 5, 500);
addTitleReward("jake", rarity, 5, 500);
addTitleReward("finn", rarity, 5, 500);
addTitleReward("finn-and-jake", rarity, 5, 500);
addTitleReward("boxer", rarity, 5, 500);
addTitleReward("zoidberg", rarity, 5, 500);
// Balloons
addBalloonReward(BalloonType.BABY_ZOMBIE, rarity, 25, 500);
addBalloonReward(BalloonType.BABY_MUSHROOM, rarity, 50, 500);
addBalloonReward(BalloonType.BABY_OCELOT, rarity, 50, 500);
addBalloonReward(BalloonType.BABY_WOLF, rarity, 75, 500);
addBalloonReward(BalloonType.BABY_VILLAGER, rarity, 25, 500);
addBalloonReward(BalloonType.BABY_SLIME, rarity, 25, 500);
addBalloonReward(BalloonType.BAT, rarity, 50, 500);
}
@Override
protected void addLegendary(RewardRarity rarity)
{
//Enchant set
addGadgetReward(getGadget(ArrowTrailEnchant.class), rarity, 10);
addGadgetReward(getGadget(DeathEnchant.class), rarity, 10);
addGadgetReward(getGadget(DoubleJumpEnchant.class), rarity, 10);
//Morphs
addGadgetReward(getGadget(MorphSlime.class), rarity, 10);
addGadgetReward(getGadget(MorphBat.class), rarity, 25);
addGadgetReward(getGadget(MorphBlock.class), rarity, 20);
//Mounts
addGadgetReward(getGadget(MountUndead.class), rarity, 33);
//Particle Trails
addGadgetReward(getGadget(ParticleWingsAngel.class), rarity, 15);
addGadgetReward(getGadget(ParticleBlood.class), rarity, 10);
addGadgetReward(getGadget(ParticleWingsDemons.class), rarity, 15);
addGadgetReward(getGadget(ParticleEnchant.class), rarity, 25);
addGadgetReward(getGadget(ParticleFairy.class), rarity, 4);
addGadgetReward(getGadget(ParticleFireRings.class), rarity, 17);
addGadgetReward(getGadget(ParticleEmerald.class), rarity, 8);
addGadgetReward(getGadget(ParticleHeart.class), rarity, 2);
addGadgetReward(getGadget(ParticleWingsInfernal.class), rarity, 4);
addGadgetReward(getGadget(ParticleMusic.class), rarity, 15);
addGadgetReward(getGadget(ParticleWingsPixie.class), rarity, 4);
addGadgetReward(getGadget(ParticleRain.class), rarity, 13);
addGadgetReward(getGadget(ParticleFoot.class), rarity, 33);
addGadgetReward(getGadget(ParticleYinYang.class), rarity, 20);
//Win Effects
addGadgetReward(getGadget(WinEffectBabyChicken.class), rarity, 10);
addGadgetReward(getGadget(WinEffectLavaTrap.class), rarity, 20);
addGadgetReward(getGadget(WinEffectLightningStrike.class), rarity, 20);
addGadgetReward(getGadget(WinEffectMrPunchMan.class), rarity, 33);
addGadgetReward(getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4);
// Titles
addTitleReward("ayyye", rarity, 25);
addTitleReward("ameno", rarity, 15);
addTitleReward("magician", rarity, 25);
addTitleReward("fireball", rarity, 75);
addTitleReward("magic-missile", rarity, 75);
addTitleReward("pewpewpew", rarity, 75);
addTitleReward("stardust", rarity, 60);
addTitleReward("blow-a-kiss", rarity, 60);
addTitleReward("cool-guy", rarity, 60);
addTitleReward("deal-with-it", rarity, 60);
addTitleReward("party-time", rarity, 55);
addTitleReward("lalala", rarity, 30);
addTitleReward("gotta-go", rarity, 30);
addTitleReward("whaaat", rarity, 30);
// Balloons
addBalloonReward(BalloonType.SQUID, rarity, 10);
addBalloonReward(BalloonType.SILVERFISH, rarity, 30);
addBalloonReward(BalloonType.GUARDIAN, rarity, 30);
addBalloonReward(BalloonType.EMERALD_BLOCK, rarity, 15);
}
}

View File

@ -1,80 +1,9 @@
package mineplex.core.treasure.types;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
import mineplex.core.gadget.gadgets.balloons.BalloonType;
import mineplex.core.gadget.gadgets.death.DeathBlood;
import mineplex.core.gadget.gadgets.death.DeathEmerald;
import mineplex.core.gadget.gadgets.death.DeathEnchant;
import mineplex.core.gadget.gadgets.death.DeathMusic;
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.DeathShadow;
import mineplex.core.gadget.gadgets.death.DeathStorm;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
import mineplex.core.gadget.gadgets.item.ItemFirework;
import mineplex.core.gadget.gadgets.item.ItemFleshHook;
import mineplex.core.gadget.gadgets.item.ItemMelonLauncher;
import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphChicken;
import mineplex.core.gadget.gadgets.morph.MorphCow;
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
import mineplex.core.gadget.gadgets.morph.MorphSlime;
import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.mount.types.MountCart;
import mineplex.core.gadget.gadgets.mount.types.MountFrost;
import mineplex.core.gadget.gadgets.mount.types.MountMule;
import mineplex.core.gadget.gadgets.mount.types.MountSlime;
import mineplex.core.gadget.gadgets.mount.types.MountUndead;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.ParticleMusic;
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
import mineplex.core.pet.PetType;
import mineplex.core.reward.RewardType;
import mineplex.core.treasure.animation.animations.OldChestAnimation;
import mineplex.core.treasure.reward.RewardRarity;
public class OldTreasure extends Treasure
public class OldTreasure extends NormalTreasure
{
public OldTreasure()
@ -86,200 +15,7 @@ public class OldTreasure extends Treasure
setRewardsPerChest(4);
allowDuplicates();
setPurchasable(1000);
purchaseAbleFromStore();
purchaseableFromStore();
enabledByDefault();
}
@Override
protected void addCommon(RewardRarity rarity)
{
// Gadgets
addGadgetReward(getGadget(ItemBatGun.class), rarity, 10, 4, 10);
addGadgetReward(getGadget(ItemEtherealPearl.class), rarity, 10, 6, 15);
addGadgetReward(getGadget(ItemFirework.class), rarity, 10, 10, 25);
addGadgetReward(getGadget(ItemFleshHook.class), rarity, 10, 8, 20);
addGadgetReward(getGadget(ItemMelonLauncher.class), rarity, 10, 10, 25);
addGadgetReward(getGadget(ItemPaintballGun.class), rarity, 10, 20, 50);
addGadgetReward(getGadget(ItemTNT.class), rarity, 10, 4, 10);
}
@Override
protected void addUncommon(RewardRarity rarity)
{
//Gadgets
addGadgetReward(getGadget(ItemBatGun.class), rarity, 250, 20, 40);
addGadgetReward(getGadget(ItemEtherealPearl.class), rarity, 250, 30, 60);
addGadgetReward(getGadget(ItemFirework.class), rarity, 250, 25, 50);
addGadgetReward(getGadget(ItemFleshHook.class), rarity, 250, 40, 80);
addGadgetReward(getGadget(ItemMelonLauncher.class), rarity, 250, 25, 50);
addGadgetReward(getGadget(ItemPaintballGun.class), rarity, 250, 100, 200);
addGadgetReward(getGadget(ItemTNT.class), rarity, 250, 20, 40);
//Pets
addPetReward(PetType.CHICKEN, rarity, 143);
addPetReward(PetType.COW, rarity, 500);
addPetReward(PetType.MUSHROOM_COW, rarity, 200);
addPetReward(PetType.OCELOT, rarity, 167);
addPetReward(PetType.PIG, rarity, 200);
addPetReward(PetType.SHEEP, rarity, 333);
addPetReward(PetType.WOLF, rarity, 125);
//Music Discs
addMusicReward("Blocks", rarity, 25);
addMusicReward("Cat", rarity, 25);
addMusicReward("Chirp", rarity, 25);
addMusicReward("Far", rarity, 25);
addMusicReward("Mall", rarity, 25);
addMusicReward("Mellohi", rarity, 25);
addMusicReward("Stal", rarity, 25);
addMusicReward("Strad", rarity, 25);
addMusicReward("Wait", rarity, 25);
addMusicReward("Ward", rarity, 25);
// Balloons
addBalloonReward(BalloonType.BABY_COW, rarity, 10, 100);
addBalloonReward(BalloonType.BABY_PIG, rarity, 10, 100);
addBalloonReward(BalloonType.BABY_SHEEP, rarity, 15, 100);
}
@Override
protected void addRare(RewardRarity rarity)
{
//Morphs
addGadgetReward(getGadget(MorphVillager.class), rarity, 83);
addGadgetReward(getGadget(MorphCow.class), rarity, 167);
addGadgetReward(getGadget(MorphChicken.class), rarity, 50);
addGadgetReward(getGadget(MorphEnderman.class), rarity, 33);
//Mounts
addGadgetReward(getGadget(MountFrost.class), rarity, 50);
addGadgetReward(getGadget(MountSlime.class), rarity, 67);
addGadgetReward(getGadget(MountCart.class), rarity, 100);
addGadgetReward(getGadget(MountMule.class), rarity, 200);
//Outfit Rave
addGadgetReward(getGadget(OutfitRaveSuitHelmet.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitChestplate.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitLeggings.class), rarity, 30);
addGadgetReward(getGadget(OutfitRaveSuitBoots.class), rarity, 30);
//Outfit Space
addGadgetReward(getGadget(OutfitSpaceSuitHelmet.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitChestplate.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitLeggings.class), rarity, 50);
addGadgetReward(getGadget(OutfitSpaceSuitBoots.class), rarity, 50);
//Arrow Trails
addGadgetReward(getGadget(ArrowTrailConfetti.class), rarity, 27);
addGadgetReward(getGadget(ArrowTrailBlood.class), rarity, 50);
addGadgetReward(getGadget(ArrowTrailEmerald.class), rarity, 25);
addGadgetReward(getGadget(ArrowTrailMusic.class), rarity, 27);
addGadgetReward(getGadget(ArrowTrailStorm.class), rarity, 30);
addGadgetReward(getGadget(ArrowTrailShadow.class), rarity, 15);
//Double Jumps
addGadgetReward(getGadget(DoubleJumpFirecracker.class), rarity, 33);
addGadgetReward(getGadget(DoubleJumpEmerald.class), rarity, 25);
addGadgetReward(getGadget(DoubleJumpShadow.class), rarity, 15);
addGadgetReward(getGadget(DoubleJumpStorm.class), rarity, 30);
addGadgetReward(getGadget(DoubleJumpBlood.class), rarity, 50);
addGadgetReward(getGadget(DoubleJumpMusic.class), rarity, 20);
//Death Effects
addGadgetReward(getGadget(DeathPinataBurst.class), rarity, 27);
addGadgetReward(getGadget(DeathEmerald.class), rarity, 25);
addGadgetReward(getGadget(DeathShadow.class), rarity, 15);
addGadgetReward(getGadget(DeathStorm.class), rarity, 30);
addGadgetReward(getGadget(DeathBlood.class), rarity, 50);
addGadgetReward(getGadget(DeathMusic.class), rarity, 20);
//Particles
addGadgetReward(getGadget(ParticlePartyTime.class), rarity, 12);
//Titles
addTitleReward("shrug", rarity, 10, 500);
addTitleReward("tableflip", rarity, 10, 500);
addTitleReward("tablerespecter", rarity, 15, 500);
addTitleReward("tableflip-disgusted", rarity, 15, 500);
addTitleReward("tableflip-enraged", rarity, 15, 500);
addTitleReward("tableflip-riot", rarity, 10, 500);
addTitleReward("teddy-bear", rarity, 10, 500);
addTitleReward("disgust", rarity, 10, 500);
addTitleReward("old-man", rarity, 5, 500);
addTitleReward("jake", rarity, 5, 500);
addTitleReward("finn", rarity, 5, 500);
addTitleReward("finn-and-jake", rarity, 5, 500);
addTitleReward("boxer", rarity, 5, 500);
addTitleReward("zoidberg", rarity, 5, 500);
// Balloons
addBalloonReward(BalloonType.BABY_ZOMBIE, rarity, 25, 500);
addBalloonReward(BalloonType.BABY_MUSHROOM, rarity, 50, 500);
addBalloonReward(BalloonType.BABY_OCELOT, rarity, 50, 500);
addBalloonReward(BalloonType.BABY_WOLF, rarity, 75, 500);
addBalloonReward(BalloonType.BABY_VILLAGER, rarity, 25, 500);
addBalloonReward(BalloonType.BABY_SLIME, rarity, 25, 500);
addBalloonReward(BalloonType.BAT, rarity, 50, 500);
}
@Override
protected void addLegendary(RewardRarity rarity)
{
//Enchant set
addGadgetReward(getGadget(ArrowTrailEnchant.class), rarity, 10);
addGadgetReward(getGadget(DeathEnchant.class), rarity, 10);
addGadgetReward(getGadget(DoubleJumpEnchant.class), rarity, 10);
//Morphs
addGadgetReward(getGadget(MorphSlime.class), rarity, 10);
addGadgetReward(getGadget(MorphBat.class), rarity, 25);
addGadgetReward(getGadget(MorphBlock.class), rarity, 20);
//Mounts
addGadgetReward(getGadget(MountUndead.class), rarity, 33);
//Particle Trails
addGadgetReward(getGadget(ParticleWingsAngel.class), rarity, 15);
addGadgetReward(getGadget(ParticleBlood.class), rarity, 10);
addGadgetReward(getGadget(ParticleWingsDemons.class), rarity, 15);
addGadgetReward(getGadget(ParticleEnchant.class), rarity, 25);
addGadgetReward(getGadget(ParticleFairy.class), rarity, 4);
addGadgetReward(getGadget(ParticleFireRings.class), rarity, 17);
addGadgetReward(getGadget(ParticleEmerald.class), rarity, 8);
addGadgetReward(getGadget(ParticleHeart.class), rarity, 2);
addGadgetReward(getGadget(ParticleWingsInfernal.class), rarity, 4);
addGadgetReward(getGadget(ParticleMusic.class), rarity, 15);
addGadgetReward(getGadget(ParticleWingsPixie.class), rarity, 4);
addGadgetReward(getGadget(ParticleRain.class), rarity, 13);
addGadgetReward(getGadget(ParticleFoot.class), rarity, 33);
addGadgetReward(getGadget(ParticleYinYang.class), rarity, 20);
//Win Effects
addGadgetReward(getGadget(WinEffectBabyChicken.class), rarity, 10);
addGadgetReward(getGadget(WinEffectLavaTrap.class), rarity, 20);
addGadgetReward(getGadget(WinEffectLightningStrike.class), rarity, 20);
addGadgetReward(getGadget(WinEffectMrPunchMan.class), rarity, 33);
addGadgetReward(getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4);
// Titles
addTitleReward("ayyye", rarity, 25);
addTitleReward("ameno", rarity, 15);
addTitleReward("magician", rarity, 25);
addTitleReward("fireball", rarity, 75);
addTitleReward("magic-missile", rarity, 75);
addTitleReward("pewpewpew", rarity, 75);
addTitleReward("stardust", rarity, 60);
addTitleReward("blow-a-kiss", rarity, 60);
addTitleReward("cool-guy", rarity, 60);
addTitleReward("deal-with-it", rarity, 60);
addTitleReward("party-time", rarity, 55);
addTitleReward("lalala", rarity, 30);
addTitleReward("gotta-go", rarity, 30);
addTitleReward("whaaat", rarity, 30);
// Balloons
addBalloonReward(BalloonType.SQUID, rarity, 10);
addBalloonReward(BalloonType.SILVERFISH, rarity, 30);
addBalloonReward(BalloonType.GUARDIAN, rarity, 30);
addBalloonReward(BalloonType.EMERALD_BLOCK, rarity, 15);
}
}

View File

@ -13,6 +13,7 @@ import mineplex.core.Managers;
import mineplex.core.common.util.C;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.balloons.BalloonType;
import mineplex.core.gadget.gadgets.kitselector.SingleParticleKitSelector;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
@ -22,6 +23,7 @@ import mineplex.core.reward.RewardType;
import mineplex.core.reward.rewards.GadgetReward;
import mineplex.core.reward.rewards.InventoryReward;
import mineplex.core.reward.rewards.PetReward;
import mineplex.core.reward.rewards.RankReward;
import mineplex.core.reward.rewards.TitleReward;
import mineplex.core.titles.tracks.TrackManager;
import mineplex.core.treasure.TreasureLocation;
@ -43,10 +45,12 @@ public class Treasure
.build();
private static final TreasureRewardManager TREASURE_REWARD_MANAGER = Managers.require(TreasureRewardManager.class);
public static TreasureRewardManager getRewardManager()
{
return TREASURE_REWARD_MANAGER;
}
private static final GadgetManager GADGET_MANAGER = Managers.require(GadgetManager.class);
private static final TrackManager TRACK_MANAGER = Managers.require(TrackManager.class);
@ -124,7 +128,7 @@ public class Treasure
return _rewardsPerChest;
}
protected void purchaseAbleFromStore()
protected void purchaseableFromStore()
{
addPurchaseMethod(PURCHASABLE_FROM_STORE);
}
@ -277,6 +281,18 @@ public class Treasure
return reward;
}
protected RankReward addRankReward(RewardRarity rarity, boolean canPassLegend, int weight)
{
RankReward reward = new RankReward(rarity, 0, canPassLegend);
addReward(reward, weight);
return reward;
}
protected SingleParticleKitSelector getKitSelector(SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors)
{
return GADGET_MANAGER.getSingleParticleKitSelector(singleParticleSelectors);
}
private int getShards(RewardRarity rarity)
{
return SHARD_WORTH.getOrDefault(rarity, 0);

View File

@ -20,8 +20,27 @@ public enum TreasureType
"the straps they appear to contain",
"many kinds of loot."
),
;
ANCIENT(
C.cGold + "Ancient Treasure",
"Ancient Chest",
"Ancient",
new ItemStack(Material.TRAPPED_CHEST),
"Some of our bravest adventurers",
"have discovered these chests within ",
"temples hidden in Minecrafts worlds."
),
MYTHICAL(
C.cRed + "Mythical Treasure",
"Mythical Chest",
"Mythical",
new ItemStack(Material.ENDER_CHEST),
"All our previous adventurers have",
"perished in search of these chests.",
"However, legends of their existence",
"convinced Sterling, Chiss and Defek7",
"to venture out and discover the",
"location of these chests on their own."
),;
private final String _name;
private final String _itemName;

View File

@ -69,7 +69,7 @@ public class PurchaseTreasurePage extends ShopPageBase<TreasureManager, Treasure
lore.add(C.cGray + (amount == 1 ? "Buy" : "Bulk buy") + " " + F.elem(amount) + " chest" + (amount == 1 ? "" : "s") + ".");
lore.add(C.cGray + "This will cost " + F.currency(GlobalCurrency.TREASURE_SHARD, _treasure.getPurchasePrice() * amount) + "!");
lore.add("");
lore.add(C.cGreen + "Click to purchase the chests!");
lore.add(C.cGreen + "Click to purchase!");
meta.setDisplayName(_treasure.getTreasureType().getName());
meta.setLore(lore);

View File

@ -74,9 +74,13 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
lore.add("");
lore.add(C.cGreen + "Left-Click to open!");
}
if (treasure.isPurchasable())
{
if (!canOpen)
{
lore.add("");
}
lore.add(C.cGreen + "Right-Click to purchase!");
}

View File

@ -1,7 +1,7 @@
package mineplex.core.treasure.util;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.TileEntityChest;
import net.minecraft.server.v1_8_R3.TileEntity;
import net.minecraft.server.v1_8_R3.World;
import org.bukkit.Location;
@ -17,9 +17,8 @@ public class TreasureUtil
{
World world = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition position = new BlockPosition(location.getX(), location.getY(), location.getZ());
TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(position);
world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
TileEntity tileEntity = world.getTileEntity(position);
world.playBlockAction(position, tileEntity.w(), 1, open ? 1 : 0);
}
public static byte getChestFacing(float yaw)