Merge remote-tracking branch 'origin/master'
Conflicts: Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java
This commit is contained in:
commit
9d0b99b7fc
@ -93,15 +93,7 @@ public class AntiStack extends MiniPlugin
|
||||
|
||||
Item item = event.getItem();
|
||||
|
||||
//Get Name
|
||||
String name = ((CraftItemStack)item.getItemStack()).getHandle().getName();
|
||||
|
||||
//Remove UID
|
||||
if (name.contains(":"))
|
||||
name = name.substring(0, name.indexOf(":" + item.getUniqueId()));
|
||||
|
||||
//Set Name
|
||||
((CraftItemStack)item.getItemStack()).getHandle().c(name);
|
||||
removeUID(item);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -130,4 +122,17 @@ public class AntiStack extends MiniPlugin
|
||||
{
|
||||
_enabled = var;
|
||||
}
|
||||
|
||||
public static void removeUID(Item item)
|
||||
{
|
||||
//Get Name
|
||||
String name = ((CraftItemStack)item.getItemStack()).getHandle().getName();
|
||||
|
||||
//Remove UID
|
||||
if (name.contains(":"))
|
||||
name = name.substring(0, name.indexOf(":" + item.getUniqueId()));
|
||||
|
||||
//Set Name
|
||||
((CraftItemStack)item.getItemStack()).getHandle().c(name);
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
package mineplex.core.join;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
|
||||
public class JoinQuit
|
||||
{
|
||||
@EventHandler
|
||||
public void Join(PlayerJoinEvent event)
|
||||
{
|
||||
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
event.setQuitMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
package mineplex.core.reward;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -6,7 +6,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
/**
|
||||
* Created by Shaun on 9/2/2014.
|
||||
*/
|
||||
public interface ITreasureReward
|
||||
public interface IReward
|
||||
{
|
||||
public ItemStack getItem();
|
||||
|
@ -0,0 +1,327 @@
|
||||
package mineplex.core.reward;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.rewards.CoinReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class RewardManager
|
||||
{
|
||||
private HashMap<RewardRarity, List<IReward>> _treasureMap;
|
||||
private Random _random;
|
||||
|
||||
private boolean _doubleGadgetValue;
|
||||
|
||||
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager,
|
||||
int commonValueMin, int commonValueMax,
|
||||
int uncommonValueMin, int uncommonValueMax,
|
||||
int rareValueMin, int rareValueMax,
|
||||
int legendValueMin, int legendValueMax,
|
||||
boolean doubleGadgetValue)
|
||||
{
|
||||
_treasureMap = new HashMap<RewardRarity, List<IReward>>();
|
||||
_random = new Random();
|
||||
|
||||
for (RewardRarity rarity : RewardRarity.values())
|
||||
{
|
||||
_treasureMap.put(rarity, new ArrayList<IReward>());
|
||||
}
|
||||
|
||||
_doubleGadgetValue = doubleGadgetValue;
|
||||
|
||||
addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addUncommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addRare(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addLegendary(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
}
|
||||
|
||||
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
|
||||
{
|
||||
// Coins
|
||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1, RewardRarity.COMMON));
|
||||
|
||||
//Increase Value
|
||||
if (_doubleGadgetValue)
|
||||
{
|
||||
minValue *= 2;
|
||||
maxValue *= 2;
|
||||
}
|
||||
|
||||
// Gadgets
|
||||
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
|
||||
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
||||
new ItemStack(Material.GOLD_BARDING), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
|
||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
|
||||
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
||||
new ItemStack(Material.getMaterial(131)), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
|
||||
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
|
||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||
new ItemStack(Material.IRON_BARDING), RewardRarity.COMMON, 1));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||
new ItemStack(Material.TNT), RewardRarity.COMMON, 1));
|
||||
}
|
||||
|
||||
public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
|
||||
{
|
||||
// Coins
|
||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON));
|
||||
|
||||
//Increase Value
|
||||
if (_doubleGadgetValue)
|
||||
{
|
||||
minValue *= 2;
|
||||
maxValue *= 2;
|
||||
}
|
||||
|
||||
// Gadgets
|
||||
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
|
||||
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
||||
new ItemStack(Material.GOLD_BARDING), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
|
||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook",
|
||||
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
||||
new ItemStack(Material.getMaterial(131)), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
|
||||
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
|
||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||
new ItemStack(Material.IRON_BARDING), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250));
|
||||
|
||||
// Pets
|
||||
addReward(new UnknownPackageReward(donationManager, "Cow Pet", "Cow",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.COW.getTypeId()), RewardRarity.UNCOMMON, 500));
|
||||
addReward(new UnknownPackageReward(donationManager, "Sheep Pet", "Sheep",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.SHEEP.getTypeId()), RewardRarity.UNCOMMON, 333));
|
||||
addReward(new UnknownPackageReward(donationManager, "Mooshroom Pet", "Mooshroom",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.MUSHROOM_COW.getTypeId()), RewardRarity.UNCOMMON, 200));
|
||||
addReward(new UnknownPackageReward(donationManager, "Pig Pet", "Pig",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.PIG.getTypeId()), RewardRarity.UNCOMMON, 200));
|
||||
addReward(new UnknownPackageReward(donationManager, "Ocelot Pet", "Ocelot",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.OCELOT.getTypeId()), RewardRarity.UNCOMMON, 167));
|
||||
addReward(new UnknownPackageReward(donationManager, "Chicken Pet", "Chicken",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.CHICKEN.getTypeId()), RewardRarity.RARE, 143));
|
||||
addReward(new UnknownPackageReward(donationManager, "Wolf Pet", "Wolf",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), RewardRarity.RARE, 125));
|
||||
}
|
||||
|
||||
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
|
||||
{
|
||||
// Coins
|
||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
|
||||
|
||||
// Mounts
|
||||
addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
|
||||
new ItemStack(Material.HAY_BLOCK), RewardRarity.RARE, 200));
|
||||
addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart",
|
||||
new ItemStack(Material.MINECART), RewardRarity.RARE, 100));
|
||||
addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount",
|
||||
new ItemStack(Material.SLIME_BALL), RewardRarity.RARE, 67));
|
||||
addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
|
||||
new ItemStack(Material.SNOW_BALL), RewardRarity.RARE, 50));
|
||||
|
||||
// Morphs
|
||||
addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
|
||||
new ItemStack(Material.LEATHER), RewardRarity.RARE, 167));
|
||||
addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph",
|
||||
new ItemStack(Material.EMERALD), RewardRarity.RARE, 83));
|
||||
addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
|
||||
new ItemStack(Material.FEATHER), RewardRarity.RARE, 50));
|
||||
addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 33));
|
||||
addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
|
||||
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 25));
|
||||
}
|
||||
|
||||
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
|
||||
{
|
||||
// Coins
|
||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, RewardRarity.LEGENDARY));
|
||||
|
||||
// Mounts
|
||||
addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",
|
||||
new ItemStack(Material.BONE), RewardRarity.LEGENDARY, 33));
|
||||
|
||||
// Morphs
|
||||
addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.LEGENDARY, 20));
|
||||
|
||||
// Particles
|
||||
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
||||
new ItemStack(Material.LEATHER_BOOTS), RewardRarity.LEGENDARY, 33));
|
||||
addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted",
|
||||
new ItemStack(Material.BOOK), RewardRarity.LEGENDARY, 25));
|
||||
addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings",
|
||||
new ItemStack(Material.BLAZE_POWDER), RewardRarity.LEGENDARY, 17));
|
||||
addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud",
|
||||
new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), RewardRarity.LEGENDARY, 13));
|
||||
addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix",
|
||||
new ItemStack(Material.REDSTONE), RewardRarity.LEGENDARY, 10));
|
||||
addReward(new UnknownPackageReward(donationManager, "Emerald Twirl Particles", "Green Ring",
|
||||
new ItemStack(Material.EMERALD), RewardRarity.LEGENDARY, 8));
|
||||
}
|
||||
|
||||
public void addReward(IReward reward)
|
||||
{
|
||||
RewardRarity rarity = reward.getRarity();
|
||||
|
||||
List<IReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
treasureList.add(reward);
|
||||
}
|
||||
|
||||
public IReward[] getRewards(Player player, boolean isChestOpening)
|
||||
{
|
||||
int currentReward = 0;
|
||||
IReward[] rewards = new IReward[4];
|
||||
boolean hasUncommon = false;
|
||||
|
||||
while (currentReward < 4)
|
||||
{
|
||||
IReward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, isChestOpening);
|
||||
|
||||
if (reward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (reward.getRarity().ordinal() >= RewardRarity.UNCOMMON.ordinal())
|
||||
{
|
||||
hasUncommon = true;
|
||||
}
|
||||
rewards[currentReward] = reward;
|
||||
currentReward++;
|
||||
}
|
||||
|
||||
// Swap the last reward with another one, this makes the uncommon added at the end of some chests seem more random
|
||||
int slotToSwitch = _random.nextInt(4);
|
||||
if (slotToSwitch != 3)
|
||||
{
|
||||
IReward thirdReward = rewards[3];
|
||||
IReward otherReward = rewards[slotToSwitch];
|
||||
|
||||
rewards[3] = otherReward;
|
||||
rewards[slotToSwitch] = thirdReward;
|
||||
}
|
||||
|
||||
return rewards;
|
||||
}
|
||||
|
||||
// private IReward nextReward(Player player, IReward[] excludedRewards)
|
||||
// {
|
||||
// return nextReward(player, excludedRewards, false, isChestOpening);
|
||||
// }
|
||||
|
||||
public IReward nextReward(Player player, IReward[] excludedRewards, boolean requiresUncommon, boolean isChestOpening)
|
||||
{
|
||||
double rand = _random.nextDouble();
|
||||
RewardRarity rarity;
|
||||
|
||||
if (isChestOpening ? rand <= 0.01 : rand <= 0.0001)
|
||||
{
|
||||
// 1% or 0.01%
|
||||
rarity = RewardRarity.LEGENDARY;
|
||||
}
|
||||
else if (isChestOpening ? rand <= 0.05 : rand <= 0.001)
|
||||
{
|
||||
// 4% or 0.09%
|
||||
rarity = RewardRarity.RARE;
|
||||
}
|
||||
else if ((isChestOpening ? rand <= 0.3 : rand <= 0.03) || requiresUncommon)
|
||||
{
|
||||
// 25% or 2.9%
|
||||
rarity = RewardRarity.UNCOMMON;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 70% or 97%
|
||||
rarity = RewardRarity.COMMON;
|
||||
}
|
||||
|
||||
List<IReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
int totalWeight = 0;
|
||||
ArrayList<IReward> possibleRewards = new ArrayList<IReward>();
|
||||
for (IReward treasure : treasureList)
|
||||
{
|
||||
boolean isExcluded = false;
|
||||
|
||||
if (excludedRewards != null)
|
||||
{
|
||||
for (int i = 0; i < excludedRewards.length && !isExcluded; i++)
|
||||
{
|
||||
if (excludedRewards[i] != null && excludedRewards[i].equals(treasure))
|
||||
{
|
||||
isExcluded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((player == null || treasure.canGiveReward(player)) && !isExcluded)
|
||||
{
|
||||
possibleRewards.add(treasure);
|
||||
totalWeight += treasure.getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
int weight = _random.nextInt(totalWeight);
|
||||
int currentWeight = 0;
|
||||
|
||||
for (IReward reward : possibleRewards)
|
||||
{
|
||||
currentWeight += reward.getWeight();
|
||||
|
||||
if (weight <= currentWeight)
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
package mineplex.core.reward;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import static mineplex.core.common.util.C.*;
|
||||
@ -14,12 +14,14 @@ public enum RewardRarity
|
||||
* (Fireworks, sounds, etc)
|
||||
*/
|
||||
|
||||
COMMON(cAqua), UNCOMMON(cGreen), RARE(cGold), VERY_RARE(cRed);
|
||||
COMMON("Common", cAqua), UNCOMMON("Uncommon", cGreen), RARE("Rare", cGold), LEGENDARY("Legendary", cRed);
|
||||
|
||||
private String _name;
|
||||
private String _color;
|
||||
|
||||
RewardRarity(String color)
|
||||
RewardRarity(String name, String color)
|
||||
{
|
||||
_name = name;
|
||||
_color = color;
|
||||
}
|
||||
|
||||
@ -28,4 +30,9 @@ public enum RewardRarity
|
||||
return _color;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.IReward;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
public abstract class AbstractReward implements ITreasureReward
|
||||
public abstract class AbstractReward implements IReward
|
||||
{
|
||||
protected static final Random RANDOM = new Random();
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
@ -69,5 +69,4 @@ public class CoinReward extends AbstractReward
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
@ -1,10 +1,10 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.reward.IReward;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/29/2014.
|
||||
@ -16,10 +16,10 @@ import mineplex.core.treasure.reward.ITreasureReward;
|
||||
public class ChestData
|
||||
{
|
||||
private Block _block;
|
||||
private ITreasureReward _reward;
|
||||
private IReward _reward;
|
||||
private boolean _opened;
|
||||
|
||||
public ChestData(Block block, ITreasureReward reward)
|
||||
public ChestData(Block block, IReward reward)
|
||||
{
|
||||
_block = block;
|
||||
_opened = false;
|
||||
@ -41,7 +41,7 @@ public class ChestData
|
||||
return _block;
|
||||
}
|
||||
|
||||
public ITreasureReward getReward()
|
||||
public IReward getReward()
|
||||
{
|
||||
return _reward;
|
||||
}
|
||||
|
@ -19,21 +19,22 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.reward.IReward;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.treasure.animation.ChestExplodeAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
import mineplex.core.treasure.animation.CircleAnimation;
|
||||
import mineplex.core.treasure.animation.FireworksAnimation;
|
||||
import mineplex.core.treasure.animation.LegendaryAnimation;
|
||||
import mineplex.core.treasure.animation.RareAnimation;
|
||||
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.treasure.animation.UncommonAnimation;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/27/2014.
|
||||
*/
|
||||
public class Treasure
|
||||
{
|
||||
|
||||
// Decay Sets
|
||||
private HashSet<BlockInfo> _wallsBlockInfo = new HashSet<>();
|
||||
private HashSet<BlockInfo> _outerRingBlockInfo = new HashSet<>();
|
||||
@ -53,12 +54,12 @@ public class Treasure
|
||||
|
||||
private TreasureStyle _style;
|
||||
|
||||
public Treasure(Player player, ITreasureReward[] rewards)
|
||||
public Treasure(Player player, IReward[] rewards)
|
||||
{
|
||||
this(player, new Random(), rewards);
|
||||
}
|
||||
|
||||
public Treasure(Player player, Random seed, ITreasureReward[] rewards)
|
||||
public Treasure(Player player, Random seed, IReward[] rewards)
|
||||
{
|
||||
_player = player;
|
||||
_random = seed;
|
||||
@ -259,16 +260,16 @@ public class Treasure
|
||||
// Extra effects based off the rarity of the treasure
|
||||
if (data.getReward().getRarity() == RewardRarity.UNCOMMON)
|
||||
{
|
||||
_animations.add(new FireworksAnimation(this, data.getBlock()));
|
||||
_animations.add(new UncommonAnimation(this, data.getBlock()));
|
||||
}
|
||||
else if (data.getReward().getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
_animations.add(new CircleAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
|
||||
_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 " + text));
|
||||
}
|
||||
else if (data.getReward().getRarity() == RewardRarity.VERY_RARE)
|
||||
else if (data.getReward().getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
_animations.add(new ChestExplodeAnimation(this, data.getBlock()));
|
||||
_animations.add(new LegendaryAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + text));
|
||||
}
|
||||
|
||||
|
@ -35,14 +35,14 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.IReward;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.rewards.CoinReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.treasure.reward.rewards.CoinReward;
|
||||
import mineplex.core.treasure.reward.rewards.InventoryReward;
|
||||
import mineplex.core.treasure.reward.rewards.UnknownPackageReward;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -53,171 +53,18 @@ public class TreasureManager extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<Player, Treasure> _playerTreasureMap;
|
||||
private RewardManager _rewardManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public TreasureManager(JavaPlugin plugin, DonationManager donationManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("Treasure", plugin);
|
||||
|
||||
_donationManager = donationManager;
|
||||
_playerTreasureMap = new NautHashMap<Player, Treasure>();
|
||||
_rewardManager = new RewardManager();
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
// Very Rare
|
||||
{
|
||||
// Coins
|
||||
{
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 10000, 20000, 25, RewardRarity.VERY_RARE));
|
||||
}
|
||||
// Mounts
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",
|
||||
new ItemStack(Material.BONE), RewardRarity.VERY_RARE, 33));
|
||||
}
|
||||
// Morphs
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
|
||||
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.VERY_RARE, 20));
|
||||
}
|
||||
// Particles
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
||||
new ItemStack(Material.LEATHER_BOOTS), RewardRarity.VERY_RARE, 33));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted",
|
||||
new ItemStack(Material.BOOK), RewardRarity.VERY_RARE, 25));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings",
|
||||
new ItemStack(Material.BLAZE_POWDER), RewardRarity.VERY_RARE, 17));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud",
|
||||
new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), RewardRarity.VERY_RARE, 13));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix",
|
||||
new ItemStack(Material.REDSTONE), RewardRarity.VERY_RARE, 10));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Emerald Twirl Particles", "Green Ring",
|
||||
new ItemStack(Material.EMERALD), RewardRarity.VERY_RARE, 8));
|
||||
}
|
||||
}
|
||||
|
||||
// Rare
|
||||
{
|
||||
// Coins
|
||||
{
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 1000, 2000, 100, RewardRarity.RARE));
|
||||
}
|
||||
// Gadgets
|
||||
{
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 200, 400,
|
||||
// new ItemStack(Material.GOLD_BARDING), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",100, 200,
|
||||
// new ItemStack(Material.FIREWORK), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 100, 200,
|
||||
// new ItemStack(Material.MELON_BLOCK), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 80, 160,
|
||||
// new ItemStack(Material.getMaterial(131)), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 60, 120,
|
||||
// new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 40, 80,
|
||||
// new ItemStack(Material.IRON_BARDING), RewardRarity.RARE, 100));
|
||||
// _rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 40, 80,
|
||||
// new ItemStack(Material.TNT), RewardRarity.RARE, 100));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Coin Party Bomb", "Coin Party Bomb", 1, 1,
|
||||
new ItemStack(Material.getMaterial(175)), RewardRarity.RARE, 100));
|
||||
}
|
||||
// Pets
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Pet", "Chicken",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.CHICKEN.getTypeId()), RewardRarity.RARE, 143));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Wolf Pet", "Wolf",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), RewardRarity.RARE, 125));
|
||||
}
|
||||
// Mounts
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
|
||||
new ItemStack(Material.HAY_BLOCK), RewardRarity.RARE, 200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart",
|
||||
new ItemStack(Material.MINECART), RewardRarity.RARE, 100));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount",
|
||||
new ItemStack(Material.SLIME_BALL), RewardRarity.RARE, 67));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
|
||||
new ItemStack(Material.SNOW_BALL), RewardRarity.RARE, 50));
|
||||
}
|
||||
// Morphs
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
|
||||
new ItemStack(Material.LEATHER), RewardRarity.RARE, 167));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph",
|
||||
new ItemStack(Material.EMERALD), RewardRarity.RARE, 83));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
|
||||
new ItemStack(Material.FEATHER), RewardRarity.RARE, 50));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 33));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
|
||||
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 25));
|
||||
}
|
||||
}
|
||||
|
||||
// Uncommon
|
||||
{
|
||||
// Coins
|
||||
{
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 500, 1000, 250, RewardRarity.UNCOMMON));
|
||||
}
|
||||
// Gadgets
|
||||
{
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 100, 200,
|
||||
new ItemStack(Material.GOLD_BARDING), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 50, 100,
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 50, 100,
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 40, 80,
|
||||
new ItemStack(Material.getMaterial(131)), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 30, 60,
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 20, 40,
|
||||
new ItemStack(Material.IRON_BARDING), RewardRarity.UNCOMMON, 250));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 20, 40,
|
||||
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250));
|
||||
}
|
||||
// Pets
|
||||
{
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Pet", "Cow",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.COW.getTypeId()), RewardRarity.UNCOMMON, 500));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Sheep Pet", "Sheep",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.SHEEP.getTypeId()), RewardRarity.UNCOMMON, 333));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Mooshroom Pet", "Mooshroom",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.MUSHROOM_COW.getTypeId()), RewardRarity.UNCOMMON, 200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Pig Pet", "Pig",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.PIG.getTypeId()), RewardRarity.UNCOMMON, 200));
|
||||
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Ocelot Pet", "Ocelot",
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.OCELOT.getTypeId()), RewardRarity.UNCOMMON, 167));
|
||||
}
|
||||
}
|
||||
|
||||
// Common
|
||||
{
|
||||
// Coins
|
||||
{
|
||||
_rewardManager.addReward(new CoinReward(donationManager, 250, 500, 1, RewardRarity.COMMON));
|
||||
}
|
||||
// Gadgets
|
||||
{
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 50, 100,
|
||||
new ItemStack(Material.GOLD_BARDING), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 25, 50,
|
||||
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 25, 50,
|
||||
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 20, 40,
|
||||
new ItemStack(Material.getMaterial(131)), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 15, 30,
|
||||
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 10, 20,
|
||||
new ItemStack(Material.IRON_BARDING), RewardRarity.COMMON, 1));
|
||||
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 10, 20,
|
||||
new ItemStack(Material.TNT), RewardRarity.COMMON, 1));
|
||||
}
|
||||
}
|
||||
_rewardManager = new RewardManager(donationManager, inventoryManager,
|
||||
250, 500,
|
||||
750, 1500,
|
||||
2000, 3000,
|
||||
10000, 20000,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -244,7 +91,7 @@ public class TreasureManager extends MiniPlugin
|
||||
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + C.cGreen + "Treasure Chest"));
|
||||
|
||||
ITreasureReward[] rewards = _rewardManager.getRewards(player);
|
||||
IReward[] rewards = _rewardManager.getRewards(player, true);
|
||||
Treasure treasure = new Treasure(player, rewards);
|
||||
_playerTreasureMap.put(player, treasure);
|
||||
|
||||
@ -482,10 +329,39 @@ public class TreasureManager extends MiniPlugin
|
||||
//TODO Remove
|
||||
if (event.getMessage().startsWith("/treasuredebug"))
|
||||
{
|
||||
event.getPlayer().sendMessage("Attempting to open treasure...");
|
||||
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Treasure Debug...");
|
||||
attemptOpenTreasure(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (event.getMessage().startsWith("/rewardchest") || event.getMessage().startsWith("/rewardgame"))
|
||||
{
|
||||
int common = 0;
|
||||
int uncommon = 0;
|
||||
int rare = 0;
|
||||
int legend = 0;
|
||||
|
||||
int toTest = 10000000;
|
||||
|
||||
for (int i=0 ; i<toTest ; i++)
|
||||
{
|
||||
IReward reward = _rewardManager.nextReward(null, null, false, event.getMessage().startsWith("/rewardchest"));
|
||||
|
||||
if (reward.getRarity() == RewardRarity.COMMON) common++;
|
||||
if (reward.getRarity() == RewardRarity.UNCOMMON) uncommon++;
|
||||
if (reward.getRarity() == RewardRarity.RARE) rare++;
|
||||
if (reward.getRarity() == RewardRarity.LEGENDARY) legend++;
|
||||
}
|
||||
|
||||
event.getPlayer().sendMessage(C.cGreen + C.Bold + (event.getMessage().startsWith("/rewardchest") ? "Chest Rewards" : "Post-Game Rewards"));
|
||||
|
||||
event.getPlayer().sendMessage("Common: " + common + " " + UtilMath.trim(3, (double)common/(double)toTest*100d) + "%");
|
||||
event.getPlayer().sendMessage("Uncommon: " + uncommon + " " + UtilMath.trim(3, (double)uncommon/(double)toTest*100d) + "%");
|
||||
event.getPlayer().sendMessage("Rare: " + rare + " " + UtilMath.trim(3, (double)rare/(double)toTest*100d) + "%");
|
||||
event.getPlayer().sendMessage("Legendary: " + legend + " " + UtilMath.trim(3, (double)legend/(double)toTest*100d) + "%");
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
*/
|
||||
public class ChestExplodeAnimation extends Animation
|
||||
public class LegendaryAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Very Rare" chest is opened
|
||||
@ -23,7 +23,7 @@ public class ChestExplodeAnimation extends Animation
|
||||
private Random _random = new Random();
|
||||
private Block _chestBlock;
|
||||
|
||||
public ChestExplodeAnimation(Treasure treasure, Block chestBlock)
|
||||
public LegendaryAnimation(Treasure treasure, Block chestBlock)
|
||||
{
|
||||
super(treasure);
|
||||
|
@ -12,7 +12,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class CircleAnimation extends Animation
|
||||
public class RareAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when a "Rare" chest is opened
|
||||
@ -20,7 +20,7 @@ public class CircleAnimation extends Animation
|
||||
|
||||
private Location _centerLocation;
|
||||
|
||||
public CircleAnimation(Treasure treasure, Location centerLocation)
|
||||
public RareAnimation(Treasure treasure, Location centerLocation)
|
||||
{
|
||||
super(treasure);
|
||||
|
@ -13,7 +13,7 @@ import mineplex.core.treasure.Treasure;
|
||||
/**
|
||||
* Created by shaun on 2014-09-09.
|
||||
*/
|
||||
public class FireworksAnimation extends Animation
|
||||
public class UncommonAnimation extends Animation
|
||||
{
|
||||
/**
|
||||
* Played when an "Uncommon" chest is opened
|
||||
@ -22,7 +22,7 @@ public class FireworksAnimation extends Animation
|
||||
private Random _random = new Random();
|
||||
private Block _block;
|
||||
|
||||
public FireworksAnimation(Treasure treasure, Block block)
|
||||
public UncommonAnimation(Treasure treasure, Block block)
|
||||
{
|
||||
super(treasure);
|
||||
|
@ -1,149 +0,0 @@
|
||||
package mineplex.core.treasure.reward;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class RewardManager
|
||||
{
|
||||
private HashMap<RewardRarity, List<ITreasureReward>> _treasureMap;
|
||||
private Random _random;
|
||||
|
||||
public RewardManager()
|
||||
{
|
||||
_treasureMap = new HashMap<RewardRarity, List<ITreasureReward>>();
|
||||
_random = new Random();
|
||||
|
||||
for (RewardRarity rarity : RewardRarity.values())
|
||||
{
|
||||
_treasureMap.put(rarity, new ArrayList<ITreasureReward>());
|
||||
}
|
||||
}
|
||||
|
||||
public void addReward(ITreasureReward reward)
|
||||
{
|
||||
RewardRarity rarity = reward.getRarity();
|
||||
|
||||
List<ITreasureReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
treasureList.add(reward);
|
||||
}
|
||||
|
||||
public ITreasureReward[] getRewards(Player player)
|
||||
{
|
||||
int currentReward = 0;
|
||||
ITreasureReward[] rewards = new ITreasureReward[4];
|
||||
boolean hasUncommon = false;
|
||||
|
||||
while (currentReward < 4)
|
||||
{
|
||||
ITreasureReward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon);
|
||||
|
||||
if (reward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (reward.getRarity().ordinal() >= RewardRarity.UNCOMMON.ordinal())
|
||||
{
|
||||
hasUncommon = true;
|
||||
}
|
||||
rewards[currentReward] = reward;
|
||||
currentReward++;
|
||||
}
|
||||
|
||||
// Swap the last reward with another one, this makes the uncommon added at the end of some chests seem more random
|
||||
int slotToSwitch = _random.nextInt(4);
|
||||
if (slotToSwitch != 3)
|
||||
{
|
||||
ITreasureReward thirdReward = rewards[3];
|
||||
ITreasureReward otherReward = rewards[slotToSwitch];
|
||||
|
||||
rewards[3] = otherReward;
|
||||
rewards[slotToSwitch] = thirdReward;
|
||||
}
|
||||
|
||||
return rewards;
|
||||
}
|
||||
|
||||
private ITreasureReward nextReward(Player player, ITreasureReward[] excludedRewards)
|
||||
{
|
||||
return nextReward(player, excludedRewards, false);
|
||||
}
|
||||
|
||||
private ITreasureReward nextReward(Player player, ITreasureReward[] excludedRewards, boolean requiresUncommon)
|
||||
{
|
||||
double rand = _random.nextDouble();
|
||||
RewardRarity rarity;
|
||||
|
||||
if (rand <= 0.01)
|
||||
{
|
||||
// 1%
|
||||
rarity = RewardRarity.VERY_RARE;
|
||||
}
|
||||
else if (rand <= 0.05)
|
||||
{
|
||||
// 4%
|
||||
rarity = RewardRarity.RARE;
|
||||
}
|
||||
else if (rand <= 0.30 || requiresUncommon)
|
||||
{
|
||||
// 25%
|
||||
rarity = RewardRarity.UNCOMMON;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 70%
|
||||
rarity = RewardRarity.COMMON;
|
||||
}
|
||||
|
||||
List<ITreasureReward> treasureList = _treasureMap.get(rarity);
|
||||
|
||||
int totalWeight = 0;
|
||||
ArrayList<ITreasureReward> possibleRewards = new ArrayList<ITreasureReward>();
|
||||
for (ITreasureReward treasure : treasureList)
|
||||
{
|
||||
boolean isExcluded = false;
|
||||
|
||||
if (excludedRewards != null)
|
||||
{
|
||||
for (int i = 0; i < excludedRewards.length && !isExcluded; i++)
|
||||
{
|
||||
if (excludedRewards[i] != null && excludedRewards[i].equals(treasure))
|
||||
{
|
||||
isExcluded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (treasure.canGiveReward(player) && !isExcluded)
|
||||
{
|
||||
possibleRewards.add(treasure);
|
||||
totalWeight += treasure.getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
int weight = _random.nextInt(totalWeight);
|
||||
int currentWeight = 0;
|
||||
|
||||
for (ITreasureReward reward : possibleRewards)
|
||||
{
|
||||
currentWeight += reward.getWeight();
|
||||
|
||||
if (weight <= currentWeight)
|
||||
return reward;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -92,6 +92,7 @@ import nautilus.game.arcade.managers.GameGemManager;
|
||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.managers.GameManager;
|
||||
import nautilus.game.arcade.managers.GamePlayerManager;
|
||||
import nautilus.game.arcade.managers.GameLootManager;
|
||||
import nautilus.game.arcade.managers.GameWorldManager;
|
||||
import nautilus.game.arcade.managers.IdleManager;
|
||||
import nautilus.game.arcade.managers.MiscManager;
|
||||
@ -243,6 +244,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new GameFlagManager(this);
|
||||
_gamePlayerManager = new GamePlayerManager(this);
|
||||
new GameAchievementManager(this);
|
||||
new GameLootManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
new IdleManager(this);
|
||||
|
@ -539,7 +539,7 @@ public class CastleSiege extends TeamGame
|
||||
|
||||
if (this.WorldTimeSet > 24100)
|
||||
{
|
||||
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the seige!");
|
||||
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!");
|
||||
|
||||
AnnounceEnd(GetTeam(ChatColor.AQUA));
|
||||
|
||||
|
@ -188,7 +188,8 @@ public class HideSeek extends TeamGame
|
||||
{
|
||||
new KitHiderSwapper(manager),
|
||||
new KitHiderQuick(manager),
|
||||
new KitHiderShocker(manager),
|
||||
//new KitHiderShocker(manager),
|
||||
new NullKit(manager),
|
||||
new NullKit(manager),
|
||||
new KitSeekerLeaper(manager),
|
||||
new KitSeekerTNT(manager),
|
||||
|
@ -49,6 +49,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.antistack.AntiStack;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -88,16 +89,13 @@ import nautilus.game.arcade.game.games.minestrike.data.Bomb;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.DefusalKit;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.Glock18;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.P2000;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.rifle.AWP;
|
||||
import nautilus.game.arcade.game.games.minestrike.kits.KitPlayer;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts.ShredBlockEvent;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_7_R4.EntityArrow;
|
||||
|
||||
@ -379,21 +377,37 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
for (Player other : team.GetPlayers(false))
|
||||
if (!other.equals(player))
|
||||
{
|
||||
UtilTitle.display(null, player.getName() + " has the Bomb", 10, 80, 10, other);
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + player.getName() + " has the Bomb!");
|
||||
}
|
||||
|
||||
//Chat
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "You have the Bomb!");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "Hold Right-Click to place at a Bomb Site!");
|
||||
|
||||
//Title
|
||||
UtilTitle.display(C.cRed + "You have the Bomb", "Hold Right-Click to place at a Bomb Site!", 10, 80, 10, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player other : team.GetPlayers(false))
|
||||
if (!other.equals(player))
|
||||
{
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + player.getName() + " picked up the Bomb!");
|
||||
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "You picked up the Bomb!");
|
||||
}
|
||||
//Title
|
||||
UtilTitle.display(null, player.getName() + " picked up the Bomb", 10, 50, 10, other);
|
||||
}
|
||||
|
||||
|
||||
//Chat
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "You picked up the Bomb!");
|
||||
|
||||
//Title
|
||||
UtilTitle.display(null, "You picked up the Bomb", 10, 50, 10, player);
|
||||
}
|
||||
|
||||
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
_bombHolder = player;
|
||||
@ -762,6 +776,8 @@ public class MineStrike extends TeamGame
|
||||
if (UtilInv.contains(event.getPlayer(), Material.SHEARS, (byte)0, 1))
|
||||
return;
|
||||
|
||||
AntiStack.removeUID(event.getItem());
|
||||
|
||||
event.getPlayer().getInventory().setItem(8, event.getItem().getItemStack());
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You equipped Defusal Kit."));
|
||||
@ -1168,7 +1184,6 @@ public class MineStrike extends TeamGame
|
||||
|
||||
while (!hitHead(damagee, loc) && !hitBody(damagee, loc) && UtilMath.offset(damagee.getLocation(), loc) < 6)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, loc, 0, 0, 0, 0, 1);
|
||||
loc.add(trajectory.clone().multiply(0.1));
|
||||
}
|
||||
|
||||
@ -1412,6 +1427,8 @@ public class MineStrike extends TeamGame
|
||||
_bombPlanter = null;
|
||||
_bombHolder = null;
|
||||
|
||||
//Title
|
||||
UtilTitle.display(null, C.cRed + C.Bold + "Bomb has been planted!", 10, 50, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1722,7 +1739,7 @@ public class MineStrike extends TeamGame
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
|
||||
UtilTitle.display(winnerLine, _winText, 20, 120, 20);
|
||||
UtilTitle.display(null, winnerLine, 20, 120, 20);
|
||||
|
||||
//Check for total game win
|
||||
EndCheck();
|
||||
@ -2089,7 +2106,10 @@ public class MineStrike extends TeamGame
|
||||
|
||||
ItemStack stack = _scoped.remove(player);
|
||||
|
||||
|
||||
player.getInventory().setHelmet(stack);
|
||||
UtilInv.Update(player);
|
||||
|
||||
Manager.GetCondition().EndCondition(player, null, "Scope");
|
||||
|
||||
player.getWorld().playSound(player.getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 1f);
|
||||
|
@ -163,11 +163,11 @@ public abstract class Gun extends StrikeItem
|
||||
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3));
|
||||
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1);
|
||||
|
||||
game.registerBullet(fireBullet(player, game));
|
||||
|
||||
//Unscope
|
||||
if (_gunType == GunType.SNIPER)
|
||||
game.removeScope(player);
|
||||
|
||||
game.registerBullet(fireBullet(player, game));
|
||||
}
|
||||
|
||||
public Bullet fireBullet(Player player, MineStrike game)
|
||||
|
@ -75,7 +75,7 @@ public class KitPig extends SmashKit
|
||||
{
|
||||
ChatColor.RESET + "When your health drops below 4, you morph",
|
||||
ChatColor.RESET + "into a Nether Pig. This gives you Speed I,",
|
||||
ChatColor.RESET + "10 Armor and half Energy costs for skills.",
|
||||
ChatColor.RESET + "8 Armor and reduces Energy costs by 33%.",
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "When your health returns to 8, you return",
|
||||
ChatColor.RESET + "back to Pig Form.",
|
||||
|
@ -71,7 +71,7 @@ public class PerkPigBaconBomb extends Perk
|
||||
|
||||
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
|
||||
if (disguise != null && disguise instanceof DisguisePigZombie)
|
||||
energy = 0.2f;
|
||||
energy = energy * 0.7f;
|
||||
|
||||
//Energy
|
||||
if (player.getExp() < energy)
|
||||
|
@ -73,7 +73,7 @@ public class PerkPigBaconBounce extends Perk implements IThrown
|
||||
|
||||
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
|
||||
if (disguise != null && disguise instanceof DisguisePigZombie)
|
||||
energy = 0.1f;
|
||||
energy = energy * 0.7f;
|
||||
|
||||
//Energy
|
||||
if (player.getExp() < energy)
|
||||
|
@ -60,10 +60,10 @@ public class PerkPigZombie extends Perk
|
||||
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
|
||||
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
|
||||
|
||||
player.getInventory().remove(Material.DIAMOND_HELMET);
|
||||
player.getInventory().remove(Material.DIAMOND_CHESTPLATE);
|
||||
player.getInventory().remove(Material.DIAMOND_LEGGINGS);
|
||||
player.getInventory().remove(Material.DIAMOND_BOOTS);
|
||||
player.getInventory().remove(Material.IRON_HELMET);
|
||||
player.getInventory().remove(Material.IRON_CHESTPLATE);
|
||||
player.getInventory().remove(Material.IRON_LEGGINGS);
|
||||
player.getInventory().remove(Material.IRON_BOOTS);
|
||||
|
||||
//Disguise
|
||||
DisguisePig disguise = new DisguisePig(player);
|
||||
@ -93,10 +93,10 @@ public class PerkPigZombie extends Perk
|
||||
_active.add(player);
|
||||
|
||||
//Armor
|
||||
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
player.getInventory().setHelmet(new ItemStack(Material.IRON_HELMET));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
|
||||
player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
|
||||
|
||||
//Disguise
|
||||
DisguisePigZombie disguise = new DisguisePigZombie(player);
|
||||
|
@ -0,0 +1,172 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTitle;
|
||||
import mineplex.core.reward.IReward;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class GameLootManager implements Listener
|
||||
{
|
||||
private ArcadeManager Manager;
|
||||
|
||||
private RewardManager _rewardManager;
|
||||
|
||||
private HashSet<Player> _players = new HashSet<Player>();
|
||||
|
||||
private long _startTime = 0;
|
||||
|
||||
public GameLootManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
|
||||
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(),
|
||||
100, 250,
|
||||
750, 1500,
|
||||
2000, 3000,
|
||||
10000, 20000,
|
||||
false);
|
||||
|
||||
//Chest
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 3));
|
||||
|
||||
//Key
|
||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
|
||||
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 500));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void registerPlayers(GameStateChangeEvent event)
|
||||
{
|
||||
if (!Manager.IsRewardAchievements())
|
||||
return;
|
||||
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : event.GetGame().GetPlayers(true))
|
||||
_players.add(player);
|
||||
|
||||
_startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void unregisterPlayer(PlayerQuitEvent event)
|
||||
{
|
||||
_players.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void giveLoot(final GameStateChangeEvent event)
|
||||
{
|
||||
if (!Manager.IsRewardAchievements())
|
||||
return;
|
||||
|
||||
if (event.GetState() != GameState.Dead)
|
||||
return;
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (Player player : _players)
|
||||
{
|
||||
giveReward(player);
|
||||
}
|
||||
}
|
||||
}, 240);
|
||||
//Delay after Achievements
|
||||
|
||||
_players.clear();
|
||||
}
|
||||
|
||||
public void giveReward(Player player)
|
||||
{
|
||||
double chance = (System.currentTimeMillis() - _startTime)/3600000d;
|
||||
|
||||
if (Math.random() > chance)
|
||||
return;
|
||||
|
||||
IReward reward = _rewardManager.nextReward(player, null, false, false);
|
||||
|
||||
String name = reward.giveReward(player);
|
||||
|
||||
String outputName = reward.getRarity().getColor() + name;
|
||||
|
||||
//Self Display
|
||||
UtilTitle.display(C.cDGreen + C.Bold + "Loot", "You found " + outputName, 20, 120, 20, player);
|
||||
|
||||
Random _random = new Random();
|
||||
|
||||
//Announce
|
||||
if (reward.getRarity() != RewardRarity.COMMON)
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Loot", F.name(player.getName()) + " found the " + reward.getRarity().getName() + " treasure " + outputName));
|
||||
}
|
||||
|
||||
//Effect
|
||||
if (reward.getRarity() == RewardRarity.UNCOMMON)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.with(FireworkEffect.Type.STAR)
|
||||
.build();
|
||||
|
||||
UtilFirework.playFirework(player.getEyeLocation(), effect);
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL).withColor(Color.YELLOW).withFade(Color.WHITE).build();
|
||||
UtilFirework.playFirework(player.getEyeLocation(), effect);
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
|
||||
UtilFirework.playFirework(player.getEyeLocation(), effect);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void command(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!event.getPlayer().isOp())
|
||||
return;
|
||||
|
||||
//TODO Remove
|
||||
if (event.getMessage().startsWith("/lootdebug"))
|
||||
{
|
||||
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Loot Debug...");
|
||||
giveReward(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,8 +23,15 @@ public class DamageTakenStatTracker extends StatTracker<Game>
|
||||
return;
|
||||
|
||||
addStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
if (event.GetDamagerPlayer(true) != null)
|
||||
addStat(damagee, "Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false);
|
||||
|
||||
if (getGame().GetKit(damagee) != null)
|
||||
{
|
||||
addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||
|
||||
if (event.GetDamagerPlayer(true) != null)
|
||||
addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user