New Blizzard Particle and make Gingerbread Chests "Featrued"

This commit is contained in:
Sam 2017-11-20 18:31:26 +00:00 committed by Alexander Meech
parent a9fbbc2e27
commit 8919ffb1d6
11 changed files with 220 additions and 107 deletions

View File

@ -222,12 +222,13 @@ import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager;
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleBlizzard;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
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.ParticleFidgetSpinner;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleFidgetSpinner;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
@ -240,7 +241,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
import mineplex.core.gadget.gadgets.particle.ParticleWingsChristmas;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleWingsChristmas;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
@ -645,6 +646,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleHalloween(this));
addGadget(new ParticleWingsChristmas(this));
addGadget(new ParticleBlizzard(this));
addGadget(new ParticleFidgetSpinner(this));
// Arrow Trails

View File

@ -0,0 +1,73 @@
package mineplex.core.gadget.gadgets.particle.christmas;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.LineFormat;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.gadget.util.CostConstants;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleBlizzard extends ParticleGadget
{
private static final double DELTA_THETA = Math.PI / 12;
private static final double RADIUS = 0.6;
private static final double HEIGHT = 1.9;
private double _theta;
public ParticleBlizzard(GadgetManager manager)
{
super(manager, "Blizzard Aura",
UtilText.splitLineToArray("TODO", LineFormat.LORE),
CostConstants.FOUND_IN_GINGERBREAD_CHESTS, Material.ICE, (byte) 0);
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
Location location = player.getLocation();
if (Manager.isMoving(player))
{
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, Math.sin(_theta) * 2, 0), null, 0, 1, ViewDist.NORMAL);
return;
}
location.add(0, HEIGHT, 0);
double x = RADIUS * Math.cos(_theta);
double z = RADIUS * Math.sin(_theta);
location.add(x, 0, z);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0, 1, ViewDist.NORMAL);
location.subtract(x * 2, 0, z * 2);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, location.subtract(0, HEIGHT - 0.6, 0), 0.7F, 0.4F, 0.7F, 0, 2, ViewDist.NORMAL);
}
@Override
@EventHandler
public void Caller(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
super.Caller(event);
_theta += DELTA_THETA;
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.particle;
package mineplex.core.gadget.gadgets.particle.christmas;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.particle;
package mineplex.core.gadget.gadgets.particle.christmas;
import java.util.ArrayList;
import java.util.List;
@ -39,7 +39,7 @@ public class ParticleFidgetSpinner extends ParticleGadget
UtilText.splitLineToArray(C.cGray + "The best gift this Christmas!", LineFormat.LORE),
CostConstants.FOUND_IN_GINGERBREAD_CHESTS, Material.RECORD_3, (byte) 0);
for (int rotation = 0; rotation < MAX_ROTATION; rotation += 2)
for (int rotation = 0; rotation < MAX_ROTATION; rotation += 8)
{
_shapes.add(new ShapeFidgetSpinner(PETAL_COUNT, rotation));
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.particle;
package mineplex.core.gadget.gadgets.particle.christmas;
import java.awt.*;

View File

@ -81,13 +81,13 @@ public class TreasureManager extends MiniPlugin
addTreasureType(new OmegaTreasure());
addTreasureType(new MinestrikeTreasure());
addTreasureType(new MOBATreasure());
addTreasureType(new TrickOrTreatTreasure2016());
addTreasureType(new GingerbeardTreasure());
addTreasureType(new TrickOrTreatTreasure2017());
addTreasureType(new TrickOrTreatTreasure2016());
addTreasureType(new ThankfulTreasure());
addTreasureType(new StPatricksTreasure());
addTreasureType(new HauntedTreasure());
addTreasureType(new LoveTreasure());
addTreasureType(new GingerbeardTreasure());
addTreasureType(new ChristmasTreasure());
addTreasureType(new SpringTreasure());
addTreasureType(new FreedomTreasure());

View File

@ -1,14 +1,18 @@
package mineplex.core.treasure.animation.animations;
import java.util.List;
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.ArmorStand;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.skin.SkinData;
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;
@ -19,13 +23,17 @@ import mineplex.core.treasure.types.Treasure;
public class GingerbreadChestAnimation extends TreasureOpenAnimation
{
private static final ItemStack HELMET = new ItemStack(Material.STAINED_CLAY, 1, (short) 12);
private static final ItemStack HELMET = SkinData.PRESENT.getSkull();
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 static final FireworkEffect FIREWORK_EFFECT = FireworkEffect.builder()
.with(Type.STAR)
.withFade(Color.YELLOW)
.withFade(Color.RED, Color.GREEN)
.withFlicker()
.build();
private double _deltaTheta;
private double _totalTheta;
public GingerbreadChestAnimation(Treasure treasure, TreasureLocation treasureLocation)
@ -36,16 +44,12 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
@Override
protected void onStart()
{
changeFloor(Material.STAINED_CLAY, 12, Material.WOOL, 15);
changeFloor(Material.WOOL, 5, Material.WOOL, 14);
List<Location> chests = getTreasureLocation().getChestLocations();
_deltaTheta = Math.PI * 2 / (double) chests.size();
Location spawn = getTreasureLocation().getChestLocations().get(0);
for (Location location : chests)
{
ArmorStand stand = spawnArmourStand(location);
stand.setHelmet(HELMET);
}
ArmorStand stand = spawnArmourStand(spawn);
stand.setHelmet(HELMET);
}
@Override
@ -53,36 +57,36 @@ public class GingerbreadChestAnimation extends TreasureOpenAnimation
{
_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);
double x = RADIUS * Math.cos(_totalTheta);
double z = RADIUS * Math.sin(_totalTheta);
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);
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location.add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0.01F, 1, ViewDist.NORMAL);
index++;
for (Location chest : getTreasureLocation().getChestLocations())
{
if (UtilMath.offsetSquared(chest, location) < 1)
{
UtilFirework.playFirework(chest, FIREWORK_EFFECT);
createChestAt(location, Material.ENDER_CHEST);
}
}
if (getTicks() % 4 == 0)
{
stand.getWorld().playSound(location, Sound.ORB_PICKUP, 1, 1);
}
}
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.CHEST);
}
setRunning(false);
}
}

View File

@ -5,7 +5,12 @@ import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots;
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerAntlers;
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerChest;
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerHooves;
import mineplex.core.gadget.gadgets.outfit.reindeer.OutfitReindeerLegs;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleFidgetSpinner;
import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare;
import mineplex.core.pet.PetType;
import mineplex.core.reward.RewardType;
@ -22,24 +27,43 @@ public class GingerbeardTreasure extends Treasure
setAnimation(treasureLocation -> new GingerbreadChestAnimation(this, treasureLocation));
setRewards(RewardType.GINGERBREAD_CHEST);
setRewardsPerChest(1);
purchasableFromStore();
setFeaturedChest();
enabledByDefault();
}
@Override
protected void addRare(RewardRarity rarity)
{
addGadgetReward(getGadget(ParticleChristmasTree.class), rarity, 25);
// Outfits
addGadgetReward(getGadget(OutfitFreezeSuitHelmet.class), rarity, 50);
addGadgetReward(getGadget(OutfitFreezeSuitChestplate.class), rarity, 100);
addGadgetReward(getGadget(OutfitFreezeSuitLeggings.class), rarity, 100);
addGadgetReward(getGadget(OutfitFreezeSuitBoots.class), rarity, 50);
addGadgetReward(getGadget(OutfitReindeerAntlers.class), rarity, 50);
addGadgetReward(getGadget(OutfitReindeerChest.class), rarity, 100);
addGadgetReward(getGadget(OutfitReindeerLegs.class), rarity, 100);
addGadgetReward(getGadget(OutfitReindeerHooves.class), rarity, 50);
// Particle
addGadgetReward(getGadget(ParticleChristmasTree.class), rarity, 25);
}
@Override
protected void addLegendary(RewardRarity rarity)
{
// Death Effect
addGadgetReward(getGadget(DeathPresentDanger.class), rarity, 25);
addGadgetReward(getGadget(WinEffectWinterWarfare.class), rarity, 25);
// Particle
addGadgetReward(getGadget(ParticleFidgetSpinner.class), rarity, 20);
// Pet
addPetReward(PetType.GINGERBREAD_MAN, rarity, 10);
// Win Effect
addGadgetReward(getGadget(WinEffectWinterWarfare.class), rarity, 25);
}
@Override

View File

@ -96,7 +96,7 @@ import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.christmas.ParticleChristmasTree;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;

View File

@ -34,9 +34,6 @@ import mineplex.core.treasure.animation.TreasureAnimation;
import mineplex.core.treasure.reward.RewardRarity;
import mineplex.core.treasure.reward.TreasureRewardManager;
/**
*
*/
public class Treasure
{
@ -68,6 +65,7 @@ public class Treasure
private boolean _purchasable;
private int _purchasePrice;
private boolean _enabledDefault;
private boolean _featured;
Treasure(TreasureType treasureType)
{
@ -171,11 +169,6 @@ public class Treasure
return _purchasePrice;
}
public void setPurchasable(boolean purchasable)
{
_purchasable = purchasable;
}
protected void setPurchasable(int purchasePrice)
{
_purchasable = true;
@ -194,6 +187,16 @@ public class Treasure
_enabledDefault = true;
}
protected void setFeaturedChest()
{
_featured = true;
}
public boolean isFeaturedChest()
{
return _featured;
}
protected final <T extends Gadget> T getGadget(Class<T> clazz)
{
return GADGET_MANAGER.getGadget(clazz);

View File

@ -87,6 +87,13 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
List<String> lore = new ArrayList<>();
lore.add("");
if (treasure.isFeaturedChest())
{
lore.add(C.cAquaB + "FEATURED CHEST");
lore.add("");
}
lore.add(C.cGray + ChatColor.stripColor(treasure.getTreasureType().getName()) + "s Owned: " + F.elem(toOpen));
lore.add("");