added a hint to how many more coal you need to your next prize.

This commit is contained in:
Cheese 2015-12-11 23:09:06 +11:00
parent 39f5f70a5f
commit d5612a8f27

View File

@ -73,13 +73,17 @@ public class ItemCoal extends ItemGadget
@Override @Override
public void ActivateCustom(final Player player) public void ActivateCustom(final Player player)
{ {
int goal = -1;
//Coal Hat //Coal Hat
if (!Manager.getGadget(HatCoal.class).ownsGadget(player)) if (!Manager.getGadget(HatCoal.class).ownsGadget(player))
{ {
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 50) goal = 250;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 250)
{ {
Recharge.Instance.recharge(player, GetName()); Recharge.Instance.recharge(player, GetName());
Recharge.Instance.use(player, GetName(), 60000, true, true); Recharge.Instance.use(player, GetName(), 30000, true, true);
Manager.getInventoryManager().addItemToInventory(new Callback<Boolean>() Manager.getInventoryManager().addItemToInventory(new Callback<Boolean>()
{ {
@ -88,12 +92,12 @@ public class ItemCoal extends ItemGadget
{ {
if(data) if(data)
{ {
player.sendMessage(F.main("Coal", "You unlocked " + C.cGreen + "Legendary Coal Hat" + C.cGray + ".")); Bukkit.broadcastMessage(F.main("Treasure", C.cGreen + player.getName() + C.cGray + " crafted " + C.cGreen + "Legendary Coal Hat"));
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.1f, 0.5f, 0.1f, 0, 100, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.1f, 0.5f, 0.1f, 0, 100, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 100, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 100, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0);
Manager.getInventoryManager().addItemToInventory(player, GetName(), -50); Manager.getInventoryManager().addItemToInventory(player, GetName(), -250);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat"); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat");
@ -111,10 +115,12 @@ public class ItemCoal extends ItemGadget
//Coal Apparition //Coal Apparition
if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE)) if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE))
{ {
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 500) goal = 1000;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 1000)
{ {
Recharge.Instance.recharge(player, GetName()); Recharge.Instance.recharge(player, GetName());
Recharge.Instance.use(player, GetName(), 60000, true, true); Recharge.Instance.use(player, GetName(), 30000, true, true);
PetReward reward = new PetReward( PetReward reward = new PetReward(
Manager.getPetManager(), Manager.getPetManager(),
@ -128,12 +134,12 @@ public class ItemCoal extends ItemGadget
@Override @Override
public void run(RewardData data) public void run(RewardData data)
{ {
player.sendMessage(F.main("Coal", "You unlocked " + C.cGreen + "Legendary Coal Apparition Pet" + C.cGray + ".")); Bukkit.broadcastMessage(F.main("Treasure", C.cGreen + player.getName() + C.cGray + " crafted " + C.cGreen + "Legendary Coal Apparition Pet"));
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.15f, 0.5f, 0.15f, 0, 250, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.15f, 0.5f, 0.15f, 0, 250, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1f, 0.0f, 1f, 0, 250, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1f, 0.0f, 1f, 0, 250, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0);
Manager.getInventoryManager().addItemToInventory(player, GetName(), -500); Manager.getInventoryManager().addItemToInventory(player, GetName(), -1000);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition"); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition");
@ -147,10 +153,12 @@ public class ItemCoal extends ItemGadget
//Coal Particle //Coal Particle
if (!Manager.getGadget(ParticleCoalFumes.class).ownsGadget(player)) if (!Manager.getGadget(ParticleCoalFumes.class).ownsGadget(player))
{ {
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 1000) goal = 2500;
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= 2500)
{ {
Recharge.Instance.recharge(player, GetName()); Recharge.Instance.recharge(player, GetName());
Recharge.Instance.use(player, GetName(), 60000, true, true); Recharge.Instance.use(player, GetName(), 30000, true, true);
Manager.getInventoryManager().addItemToInventory(new Callback<Boolean>() Manager.getInventoryManager().addItemToInventory(new Callback<Boolean>()
{ {
@ -159,12 +167,12 @@ public class ItemCoal extends ItemGadget
{ {
if(data) if(data)
{ {
player.sendMessage(F.main("Coal", "You unlocked " + C.cRed + "Mythical Coal Fumes Particle" + C.cGray + ".")); Bukkit.broadcastMessage(F.main("Treasure", C.cRed + player.getName() + C.cGray + " crafted " + C.cRed + "Mythical Coal Fumes Particles"));
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.2f, 0.5f, 0.2f, 0, 500, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.2f, 0.5f, 0.2f, 0, 500, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG);
player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0);
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1000); Manager.getInventoryManager().addItemToInventory(player, GetName(), -2500);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes"); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes");
@ -179,11 +187,24 @@ public class ItemCoal extends ItemGadget
} }
} }
goal -= Manager.getInventoryManager().Get(player).getItemCount(GetName());
if (goal > 0 && Math.random() > 0.95)
{
player.sendMessage(F.main("Coal", "Only " + goal + " to go..."));
player.playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 0.2f, 0.5f);
}
else
{
int i = UtilMath.r(Messages.length); int i = UtilMath.r(Messages.length);
String msg = Messages[i]; String msg = Messages[i];
player.sendMessage(F.main("Coal", msg)); player.sendMessage(F.main("Coal", msg));
player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.2f, 1.5f*(i/(float)Messages.length)); player.playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.2f, 1.5f*(i/(float)Messages.length));
} }
}
@EventHandler @Override @EventHandler @Override
public void Activate(PlayerInteractEvent event) public void Activate(PlayerInteractEvent event)