Chest Update
This commit is contained in:
parent
79cde8f5cf
commit
14fc6f2145
@ -12,12 +12,15 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.reward.rewards.CoinReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.reward.rewards.PetReward;
|
||||
import mineplex.core.reward.rewards.RankReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
|
||||
public class RewardManager
|
||||
@ -26,9 +29,11 @@ public class RewardManager
|
||||
private HashMap<RewardRarity, List<Reward>> _treasureMap;
|
||||
private Random _random;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
private boolean _doubleGadgetValue;
|
||||
|
||||
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager,
|
||||
public RewardManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager,
|
||||
int commonValueMin, int commonValueMax,
|
||||
int uncommonValueMin, int uncommonValueMax,
|
||||
int rareValueMin, int rareValueMax,
|
||||
@ -44,6 +49,8 @@ public class RewardManager
|
||||
_treasureMap.put(rarity, new ArrayList<Reward>());
|
||||
}
|
||||
|
||||
_clientManager = clientManager;
|
||||
|
||||
_doubleGadgetValue = doubleGadgetValue;
|
||||
|
||||
addCommon(donationManager, inventoryManager, petManager, commonValueMin, commonValueMax);
|
||||
@ -325,6 +332,19 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
||||
|
||||
//Dont give Rank Upgrade if already has Legend
|
||||
if (rarity == RewardRarity.MYTHICAL)
|
||||
{
|
||||
if (_clientManager.Get(player).GetRank().Has(Rank.LEGEND))
|
||||
{
|
||||
rarity = RewardRarity.LEGENDARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new RankReward(_clientManager, 0, rarity);
|
||||
}
|
||||
}
|
||||
|
||||
List<Reward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
int totalWeight = 0;
|
||||
|
@ -15,11 +15,11 @@ public enum RewardRarity
|
||||
*/
|
||||
|
||||
OTHER("Other", cWhite),
|
||||
COMMON("Common", cAqua),
|
||||
UNCOMMON("Uncommon", cGreen),
|
||||
RARE("Rare", cGold),
|
||||
LEGENDARY("Legendary", cRed),
|
||||
MYTHICAL("Mythical", C.cBlack);
|
||||
COMMON("Common", cWhite),
|
||||
UNCOMMON("Uncommon", cAqua),
|
||||
RARE("Rare", cPurple),
|
||||
LEGENDARY("Legendary", cGreen),
|
||||
MYTHICAL("Mythical", cRed);
|
||||
|
||||
private String _name;
|
||||
private String _color;
|
||||
|
@ -6,7 +6,7 @@ public enum RewardType
|
||||
GameLoot( 0.000001, 0.001, 0.004, 3),
|
||||
BasicChest( 0, 0.01, 0.04, 5),
|
||||
HeroicChest( 0, 1, 4, 25),
|
||||
LegendaryChest( 1, 2, 8, 40);
|
||||
LegendaryChest( 1, 2.5, 10, 40);
|
||||
|
||||
private double _mythicalChance;
|
||||
private double _legendaryChance;
|
||||
|
@ -0,0 +1,56 @@
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
public class RankReward extends Reward
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
|
||||
{
|
||||
super(rarity, weight);
|
||||
|
||||
_clientManager = clientManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RewardData giveRewardCustom(Player player)
|
||||
{
|
||||
Rank rank = null;
|
||||
if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA;
|
||||
else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO;
|
||||
else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND;
|
||||
|
||||
if (rank == null)
|
||||
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER));
|
||||
|
||||
_clientManager.Get(player).SetRank(rank);
|
||||
_clientManager.getRepository().saveRank(null, player.getName(), rank, true);
|
||||
|
||||
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return !_clientManager.Get(player).GetRank().Has(Rank.LEGEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj instanceof RankReward)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -27,10 +27,11 @@ 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;
|
||||
import mineplex.core.treasure.animation.RareAnimation;
|
||||
import mineplex.core.treasure.animation.LootLegendaryAnimation;
|
||||
import mineplex.core.treasure.animation.LootMythicalAnimation;
|
||||
import mineplex.core.treasure.animation.LootRareAnimation;
|
||||
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
|
||||
import mineplex.core.treasure.animation.UncommonAnimation;
|
||||
import mineplex.core.treasure.animation.LootUncommonAnimation;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/27/2014.
|
||||
@ -108,13 +109,12 @@ public class Treasure
|
||||
|
||||
if (_tickCount % 10 == 0 && _currentChest < _chestData.length)
|
||||
{
|
||||
Block block = _chestData[_currentChest].getBlock();
|
||||
ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this, block, _chestBlockInfo);
|
||||
ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest);
|
||||
_animations.add(chestSpawn);
|
||||
|
||||
_currentChest++;
|
||||
}
|
||||
|
||||
//Auto-open after 1 minute
|
||||
if (_tickCount == 60 * 20)
|
||||
{
|
||||
for (BlockInfo blockInfo : _chestBlockInfo)
|
||||
@ -192,17 +192,22 @@ public class Treasure
|
||||
// Extra effects based off the rarity of the treasure
|
||||
if (reward.getRarity() == RewardRarity.UNCOMMON)
|
||||
{
|
||||
_animations.add(new UncommonAnimation(this, data.getBlock()));
|
||||
_animations.add(new LootUncommonAnimation(this, data.getBlock()));
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
_animations.add(new RareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGold + "Rare " + rewardData.getFriendlyName()));
|
||||
_animations.add(new LootRareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
_animations.add(new LegendaryAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + rewardData.getFriendlyName()));
|
||||
_animations.add(new LootLegendaryAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.MYTHICAL)
|
||||
{
|
||||
_animations.add(new LootMythicalAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
|
||||
}
|
||||
|
||||
if (isFinished())
|
||||
|
@ -39,7 +39,7 @@ public class TreasureManager extends MiniPlugin
|
||||
_inventoryManager = inventoryManager;
|
||||
_blockRestore = blockRestore;
|
||||
_hologramManager = hologramManager;
|
||||
_rewardManager = new RewardManager(donationManager, inventoryManager, petManager,
|
||||
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
1500, 2500,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
|
||||
@ -12,103 +13,37 @@ public enum TreasureStyle
|
||||
/**
|
||||
* These are examples, not final!
|
||||
*/
|
||||
NETHER(Material.NETHERRACK, (byte) 0,
|
||||
Material.NETHER_BRICK, (byte) 0,
|
||||
Material.NETHER_FENCE, (byte) 0,
|
||||
null,
|
||||
|
||||
|
||||
BASIC(
|
||||
ParticleType.EXPLODE,
|
||||
ParticleType.EXPLODE,
|
||||
Sound.FIZZ,
|
||||
Sound.HORSE_ARMOR),
|
||||
|
||||
HEROIC(
|
||||
ParticleType.FLAME,
|
||||
ParticleType.LAVA),
|
||||
|
||||
NATURE(Material.GRASS, (byte) 0,
|
||||
Material.LOG, (byte) 0,
|
||||
Material.LEAVES, (byte) 0,
|
||||
null,
|
||||
ParticleType.LAVA,
|
||||
Sound.LAVA_POP,
|
||||
Sound.EXPLODE),
|
||||
|
||||
LEGENDARY(
|
||||
ParticleType.HAPPY_VILLAGER,
|
||||
ParticleType.SLIME),
|
||||
ParticleType.LARGE_EXPLODE,
|
||||
Sound.PORTAL_TRAVEL,
|
||||
Sound.ANVIL_BREAK);
|
||||
|
||||
WATER(Material.ICE,(byte) 9,
|
||||
Material.PACKED_ICE, (byte) 5,
|
||||
Material.STAINED_GLASS_PANE, (byte) 8,
|
||||
null,
|
||||
ParticleType.SNOW_SHOVEL,
|
||||
ParticleType.SNOWBALL_POOF);
|
||||
|
||||
// FANCY(Material.DIAMOND_BLOCK,(byte) 0,
|
||||
// Material.GOLD_BLOCK, (byte) 0,
|
||||
// Material.AIR, (byte) 0,
|
||||
// ParticleType.FLAME,
|
||||
// ParticleType.CLOUD,
|
||||
// ParticleType.LAVA),
|
||||
//
|
||||
// FANCY_2(Material.IRON_BLOCK,(byte) 0,
|
||||
// Material.EMERALD_BLOCK, (byte) 0,
|
||||
// Material.AIR, (byte) 0,
|
||||
// ParticleType.FLAME,
|
||||
// ParticleType.HAPPY_VILLAGER,
|
||||
// null);
|
||||
|
||||
private Material _primaryMaterial;
|
||||
private byte _primaryData;
|
||||
|
||||
private Material _secondaryMaterial;
|
||||
private byte _secondaryData;
|
||||
|
||||
private Material _wallMaterial;
|
||||
private byte _wallData;
|
||||
|
||||
private ParticleType _primaryParticle;
|
||||
private ParticleType _secondaryParticle;
|
||||
private ParticleType _chestSpawnParticle;
|
||||
|
||||
TreasureStyle(Material primaryMaterial, byte primaryData, Material secondaryMaterial, byte secondaryData, Material wallMaterial, byte wallData, ParticleType primaryParticle, ParticleType secondaryParticle, ParticleType chestSpawnParticle)
|
||||
private Sound _sound;
|
||||
private Sound _chestSpawnSound;
|
||||
|
||||
TreasureStyle(ParticleType secondaryParticle, ParticleType chestSpawnParticle, Sound sound, Sound chestSpawnSound)
|
||||
{
|
||||
_primaryMaterial = primaryMaterial;
|
||||
_primaryData = primaryData;
|
||||
|
||||
_secondaryMaterial = secondaryMaterial;
|
||||
_secondaryData = secondaryData;
|
||||
|
||||
_wallMaterial = wallMaterial;
|
||||
_wallData = wallData;
|
||||
|
||||
_primaryParticle = primaryParticle;
|
||||
_secondaryParticle = secondaryParticle;
|
||||
_chestSpawnParticle = chestSpawnParticle;
|
||||
}
|
||||
|
||||
public Material getPrimaryMaterial()
|
||||
{
|
||||
return _primaryMaterial;
|
||||
}
|
||||
|
||||
public byte getPrimaryData()
|
||||
{
|
||||
return _primaryData;
|
||||
}
|
||||
|
||||
public Material getSecondaryMaterial()
|
||||
{
|
||||
return _secondaryMaterial;
|
||||
}
|
||||
|
||||
public byte getSecondaryData()
|
||||
{
|
||||
return _secondaryData;
|
||||
}
|
||||
|
||||
public Material getWallMaterial()
|
||||
{
|
||||
return _wallMaterial;
|
||||
}
|
||||
|
||||
public byte getWallData()
|
||||
{
|
||||
return _wallData;
|
||||
}
|
||||
|
||||
public ParticleType getPrimaryParticle()
|
||||
{
|
||||
return _primaryParticle;
|
||||
_sound = sound;
|
||||
_chestSpawnSound = chestSpawnSound;
|
||||
}
|
||||
|
||||
public ParticleType getSecondaryParticle()
|
||||
@ -120,4 +55,14 @@ public enum TreasureStyle
|
||||
{
|
||||
return _chestSpawnParticle;
|
||||
}
|
||||
|
||||
public Sound getSound()
|
||||
{
|
||||
return _sound;
|
||||
}
|
||||
|
||||
public Sound getChestSpawnSound()
|
||||
{
|
||||
return _chestSpawnSound;
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,11 @@ import mineplex.core.reward.RewardType;
|
||||
|
||||
public enum TreasureType
|
||||
{
|
||||
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);
|
||||
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.BASIC),
|
||||
|
||||
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.HEROIC),
|
||||
|
||||
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.LEGENDARY);
|
||||
|
||||
private final String _name;
|
||||
private final RewardType _rewardType;
|
||||
|
@ -44,7 +44,7 @@ public class BlockChangeAnimation extends Animation
|
||||
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)
|
||||
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);
|
||||
|
@ -2,30 +2,43 @@ package mineplex.core.treasure.animation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.BlockInfo;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/29/2014.
|
||||
*/
|
||||
public class ChestSpawnAnimation extends Animation
|
||||
{
|
||||
private static final int ANIMATION_DURATION = 10;
|
||||
private static final int ANIMATION_DURATION = 80;
|
||||
|
||||
private Block _block;
|
||||
private byte _direction;
|
||||
private Location _centerLocation;
|
||||
|
||||
private Location _particleLocation;
|
||||
private Vector _particleDirection;
|
||||
|
||||
private List<BlockInfo> _chestBlockInfo;
|
||||
|
||||
private double _radialOffset;
|
||||
|
||||
public ChestSpawnAnimation(Treasure tresure, Block block, List<BlockInfo> chestBlockInfo)
|
||||
public ChestSpawnAnimation(Treasure tresure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset)
|
||||
{
|
||||
super(tresure);
|
||||
_block = block;
|
||||
@ -36,7 +49,7 @@ public class ChestSpawnAnimation extends Animation
|
||||
if (relX > 0)
|
||||
_direction = (byte) 5;
|
||||
else
|
||||
_direction = (byte) 4;
|
||||
_direction = (byte) 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -45,11 +58,17 @@ public class ChestSpawnAnimation extends Animation
|
||||
else
|
||||
_direction = (byte) 2;
|
||||
}
|
||||
|
||||
_centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
_centerLocation.getWorld().playSound(_centerLocation, Sound.LAVA, 1, 1);
|
||||
_chestBlockInfo = chestBlockInfo;
|
||||
|
||||
|
||||
|
||||
_particleLocation = openingCenter.getLocation().add(0.5, 4, 0.5);
|
||||
|
||||
_particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation);
|
||||
_particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION);
|
||||
|
||||
|
||||
_radialOffset = radialOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,22 +76,47 @@ public class ChestSpawnAnimation extends Animation
|
||||
{
|
||||
float scale = (float)((double)(ANIMATION_DURATION - getTicks()) / (double)ANIMATION_DURATION);
|
||||
|
||||
float y = 5 * scale;
|
||||
double width = 1.4 * ((double) getTicks() / (double) ANIMATION_DURATION);
|
||||
|
||||
for (int i=0 ; i < 2 ; i++)
|
||||
//Move Paticle Forwards
|
||||
_particleLocation.add(_particleDirection);
|
||||
|
||||
//Play Particels
|
||||
if (getTreasure().getTreasureType() == TreasureType.BASIC)
|
||||
{
|
||||
double lead = i * ((2d * Math.PI)/2);
|
||||
float x = (float) (Math.sin(getTicks()/4D + lead));
|
||||
float z = (float) (Math.cos(getTicks()/4D + lead));
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1);
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1);
|
||||
}
|
||||
|
||||
else if (getTreasure().getTreasureType() == TreasureType.HEROIC)
|
||||
{
|
||||
float x = (float) (Math.sin(getTicks()/4D));
|
||||
float z = (float) (Math.cos(getTicks()/4D));
|
||||
|
||||
Location newLoc = _particleLocation.clone();
|
||||
newLoc.add(UtilAlg.getLeft(_particleDirection).multiply(x * scale));
|
||||
newLoc.add(UtilAlg.getUp(_particleDirection).multiply(z * scale));
|
||||
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1);
|
||||
}
|
||||
else if (getTreasure().getTreasureType() == TreasureType.LEGENDARY)
|
||||
{
|
||||
float y = 5 * scale;
|
||||
double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION);
|
||||
|
||||
for (int i=0 ; i < 2 ; i++)
|
||||
{
|
||||
double lead = i * ((2d * Math.PI)/2);
|
||||
|
||||
float x = (float) (Math.sin(getTicks()/4D + lead));
|
||||
float z = (float) (Math.cos(getTicks()/4D + lead));
|
||||
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Spawn Chest
|
||||
if (getTicks() >= ANIMATION_DURATION)
|
||||
{
|
||||
_chestBlockInfo.add(new BlockInfo(_block));
|
||||
getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction);
|
||||
_block.getLocation().getWorld().playSound(_centerLocation, Sound.ANVIL_LAND, 0.5f, 1f);
|
||||
_block.getLocation().getWorld().playSound(_centerLocation, getTreasure().getTreasureType().getStyle().getChestSpawnSound(), 0.5f, 1f);
|
||||
|
||||
UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle();
|
||||
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
@ -15,7 +16,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class LegendaryAnimation extends Animation
|
||||
public class LootLegendaryAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Very Rare" chest is opened
|
||||
@ -24,7 +25,7 @@ public class LegendaryAnimation extends Animation
|
||||
private Random _random = new Random();
|
||||
private Block _chestBlock;
|
||||
|
||||
public LegendaryAnimation(Treasure treasure, Block chestBlock)
|
||||
public LootLegendaryAnimation(Treasure treasure, Block chestBlock)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
@ -34,18 +35,16 @@ public class LegendaryAnimation extends Animation
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() < 12 && getTicks() % 3 == 0)
|
||||
{
|
||||
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.LIME, true, true);
|
||||
}
|
||||
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
// _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
|
||||
}
|
||||
if (getTicks() == 20)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
|
||||
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
// ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257);
|
||||
}
|
||||
else if (getTicks() < 15)
|
||||
else if (getTicks() < 35)
|
||||
{
|
||||
double radius = 2 - (getTicks() / 10D * 2);
|
||||
int particleAmount = 20 - (getTicks() * 2);
|
||||
@ -56,10 +55,10 @@ public class LegendaryAnimation extends Animation
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, 0, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.CLOUD, location, 0, 0, 0, 0, 1);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
else if (getTicks() < 20)
|
||||
else if (getTicks() < 40)
|
||||
{
|
||||
double xDif = _random.nextGaussian() * 0.5;
|
||||
double zDif = _random.nextGaussian() * 0.5;
|
@ -0,0 +1,65 @@
|
||||
package mineplex.core.treasure.animation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class LootMythicalAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Very Rare" chest is opened
|
||||
*/
|
||||
|
||||
private Random _random = new Random();
|
||||
private Block _chestBlock;
|
||||
|
||||
public LootMythicalAnimation(Treasure treasure, Block chestBlock)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
_chestBlock = chestBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() < 30 && getTicks() % 3 == 0)
|
||||
{
|
||||
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true);
|
||||
}
|
||||
|
||||
if (getTicks() == 1)
|
||||
{
|
||||
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.PORTAL_TRAVEL, 10F, 2.0F);
|
||||
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ZOMBIE_UNFECT, 10F, 0.1F);
|
||||
}
|
||||
else if (getTicks() < 60)
|
||||
{
|
||||
UtilFirework.launchFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true,
|
||||
new Vector((Math.random()-0.5)*0.05, 0.1, (Math.random()-0.5)*0.05), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -12,7 +13,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class RareAnimation extends Animation
|
||||
public class LootRareAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Rare" chest is opened
|
||||
@ -20,7 +21,7 @@ public class RareAnimation extends Animation
|
||||
|
||||
private Location _centerLocation;
|
||||
|
||||
public RareAnimation(Treasure treasure, Location centerLocation)
|
||||
public LootRareAnimation(Treasure treasure, Location centerLocation)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
@ -32,7 +33,8 @@ public class RareAnimation extends Animation
|
||||
{
|
||||
if (getTicks() == 2)
|
||||
{
|
||||
UtilFirework.playFirework(_centerLocation, FireworkEffect.builder().withColor(Color.ORANGE).with(FireworkEffect.Type.BURST).build());
|
||||
UtilFirework.playFirework(_centerLocation, Type.BALL, Color.FUCHSIA, false, false);
|
||||
|
||||
_centerLocation.getWorld().playSound(_centerLocation, Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
}
|
||||
else if (getTicks() >= 60)
|
||||
@ -40,6 +42,7 @@ public class RareAnimation extends Animation
|
||||
finish();
|
||||
}
|
||||
|
||||
//Particle Ground
|
||||
{
|
||||
double currentRotation = getTicks() / 20D;
|
||||
double radius = currentRotation;
|
||||
@ -49,9 +52,10 @@ public class RareAnimation extends Animation
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, yDiff, zDiff);
|
||||
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
//Particle Spiral Up
|
||||
double radius = getTicks() / 20D;
|
||||
int particleAmount = getTicks() / 2;
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
@ -60,7 +64,7 @@ public class RareAnimation extends Animation
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, -1.3, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.Random;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
@ -13,7 +14,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class UncommonAnimation extends Animation
|
||||
public class LootUncommonAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when an "Uncommon" chest is opened
|
||||
@ -22,7 +23,7 @@ public class UncommonAnimation extends Animation
|
||||
private Random _random = new Random();
|
||||
private Block _block;
|
||||
|
||||
public UncommonAnimation(Treasure treasure, Block block)
|
||||
public LootUncommonAnimation(Treasure treasure, Block block)
|
||||
{
|
||||
super(treasure);
|
||||
|
||||
@ -37,22 +38,12 @@ public class UncommonAnimation extends Animation
|
||||
|
||||
if (getTicks() == 10)
|
||||
{
|
||||
double xDif = 0;//_random.nextGaussian() * 1;
|
||||
double zDif = 0;//_random.nextGaussian() * 1;
|
||||
double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2;
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED)
|
||||
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.with(FireworkEffect.Type.STAR)
|
||||
.build();
|
||||
|
||||
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5).add(xDif, yDif, zDif), effect);
|
||||
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5), Type.BURST, Color.AQUA, false, false);
|
||||
}
|
||||
else if (getTicks() % 2 == 0)
|
||||
{
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _block.getLocation().add(0.5, 1.2, 0.5), 0.5F, 0.2F, 0.5F, 0, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
@ -54,7 +54,7 @@ public class ParticleAnimation extends Animation
|
||||
{
|
||||
Vector position = PATH.get(pathPosition);
|
||||
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getPrimaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1);
|
||||
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1);
|
||||
|
||||
pathPosition = (pathPosition + 1) % PATH.size();
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
|
@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
|
||||
{
|
||||
public GameCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "game");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "game");
|
||||
|
||||
AddCommand(new StartCommand(Plugin));
|
||||
AddCommand(new StopCommand(Plugin));
|
||||
|
@ -17,7 +17,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public SetCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "set");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "set");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
||||
{
|
||||
public StartCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "start");
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "start");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +98,7 @@ public class PerkDoubleJump extends Perk
|
||||
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FlightUpdate(UpdateEvent event)
|
||||
|
@ -21,7 +21,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.pet.PetManager;
|
||||
@ -51,7 +50,7 @@ public class GameLootManager implements Listener
|
||||
|
||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
|
||||
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(), petManager,
|
||||
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetDonation(), Manager.getInventoryManager(), petManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
1500, 2500,
|
||||
@ -59,15 +58,14 @@ public class GameLootManager implements Listener
|
||||
false);
|
||||
|
||||
//Chest
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
|
||||
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Basic Chest", "Basic Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1000));
|
||||
|
||||
//Key
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
|
||||
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000));
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Heroic Chest", "Heroic Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40));
|
||||
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Legendary Chest", "Legendary Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user