Treasures!
This commit is contained in:
parent
c508b5ea96
commit
4afca01ad0
@ -12,7 +12,7 @@ public class HatGrinch extends HatGadget
|
|||||||
|
|
||||||
public HatGrinch(GadgetManager manager)
|
public HatGrinch(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "The Grinch",
|
super(manager, "The Grinch Hat",
|
||||||
UtilText.splitLineToArray(C.cGray + "Great! Now where’s the Roast Beast?!", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cGray + "Great! Now where’s the Roast Beast?!", LineFormat.LORE),
|
||||||
-3,
|
-3,
|
||||||
SkinData.THE_GRINCH.getSkull());
|
SkinData.THE_GRINCH.getSkull());
|
||||||
|
@ -12,7 +12,7 @@ public class HatPresent extends HatGadget
|
|||||||
|
|
||||||
public HatPresent(GadgetManager manager)
|
public HatPresent(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Present",
|
super(manager, "Present Hat",
|
||||||
UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE),
|
||||||
-3,
|
-3,
|
||||||
SkinData.PRESENT.getSkull());
|
SkinData.PRESENT.getSkull());
|
||||||
|
@ -12,7 +12,7 @@ public class HatSanta extends HatGadget
|
|||||||
|
|
||||||
public HatSanta(GadgetManager manager)
|
public HatSanta(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Santa",
|
super(manager, "Santa Hat",
|
||||||
UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE),
|
||||||
-3,
|
-3,
|
||||||
SkinData.SANTA.getSkull());
|
SkinData.SANTA.getSkull());
|
||||||
|
@ -12,7 +12,7 @@ public class HatSnowman extends HatGadget
|
|||||||
|
|
||||||
public HatSnowman(GadgetManager manager)
|
public HatSnowman(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Snowmans Head",
|
super(manager, "Snowman Head",
|
||||||
UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE),
|
||||||
-3,
|
-3,
|
||||||
SkinData.SNOWMAN.getSkull());
|
SkinData.SNOWMAN.getSkull());
|
||||||
|
@ -127,7 +127,7 @@ public class ItemCoal extends ItemGadget
|
|||||||
Manager.getPetManager(),
|
Manager.getPetManager(),
|
||||||
Manager.getInventoryManager(),
|
Manager.getInventoryManager(),
|
||||||
Manager.getDonationManager(),
|
Manager.getDonationManager(),
|
||||||
"Coal Apparition", "Coal Apparition", EntityType.PIG_ZOMBIE, RewardRarity.OTHER, 0);
|
"Coal Apparition", "Coal Apparition", EntityType.PIG_ZOMBIE, RewardRarity.OTHER, 0, 0);
|
||||||
|
|
||||||
if (reward.canGiveReward(player))
|
if (reward.canGiveReward(player))
|
||||||
reward.giveReward(null, player, new Callback<RewardData>()
|
reward.giveReward(null, player, new Callback<RewardData>()
|
||||||
|
@ -31,7 +31,7 @@ public class MountBabyReindeer extends HorseMount
|
|||||||
|
|
||||||
public MountBabyReindeer(MountManager manager)
|
public MountBabyReindeer(MountManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Baby Rainder",
|
super(manager, "Baby Reindeer",
|
||||||
UtilText.splitLineToArray(C.cGray + "One of Santas baby reindeers. He's still learning how to fly...", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cGray + "One of Santas baby reindeers. He's still learning how to fly...", LineFormat.LORE),
|
||||||
Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
|
Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,19 @@ public abstract class Reward
|
|||||||
|
|
||||||
private RewardRarity _rarity;
|
private RewardRarity _rarity;
|
||||||
private int _weight;
|
private int _weight;
|
||||||
|
private int _shardValue;
|
||||||
private boolean _requiresCallback;
|
private boolean _requiresCallback;
|
||||||
|
|
||||||
public Reward(RewardRarity rarity, int weight)
|
public Reward(RewardRarity rarity, int weight, int shardValue)
|
||||||
{
|
{
|
||||||
this(rarity, weight, false);
|
this(rarity, weight, shardValue, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reward(RewardRarity rarity, int weight, boolean requiresCallback)
|
public Reward(RewardRarity rarity, int weight, int shardValue, boolean requiresCallback)
|
||||||
{
|
{
|
||||||
_rarity = rarity;
|
_rarity = rarity;
|
||||||
_weight = weight;
|
_weight = weight;
|
||||||
|
_shardValue = shardValue;
|
||||||
_requiresCallback = requiresCallback;
|
_requiresCallback = requiresCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +60,19 @@ public abstract class Reward
|
|||||||
return _weight;
|
return _weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getShardValue()
|
||||||
|
{
|
||||||
|
return _shardValue;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRequiresCallback()
|
public boolean isRequiresCallback()
|
||||||
{
|
{
|
||||||
return _requiresCallback;
|
return _requiresCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
return obj == null ? false : getClass().equals(obj.getClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,25 @@ public class RewardData
|
|||||||
private final String _friendlyName;
|
private final String _friendlyName;
|
||||||
private final ItemStack _displayItem;
|
private final ItemStack _displayItem;
|
||||||
private final RewardRarity _rarity;
|
private final RewardRarity _rarity;
|
||||||
|
private final boolean _rewardedShards;
|
||||||
|
private final int _shards;
|
||||||
|
|
||||||
|
public RewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, int shards)
|
||||||
|
{
|
||||||
|
_friendlyName = friendlyName;
|
||||||
|
_displayItem = displayItem;
|
||||||
|
_rarity = rarity;
|
||||||
|
_rewardedShards = true;
|
||||||
|
_shards = shards;
|
||||||
|
}
|
||||||
|
|
||||||
public RewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity)
|
public RewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity)
|
||||||
{
|
{
|
||||||
_friendlyName = friendlyName;
|
_friendlyName = friendlyName;
|
||||||
_displayItem = displayItem;
|
_displayItem = displayItem;
|
||||||
_rarity = rarity;
|
_rarity = rarity;
|
||||||
|
_rewardedShards = false;
|
||||||
|
_shards = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFriendlyName()
|
public String getFriendlyName()
|
||||||
@ -33,4 +46,13 @@ public class RewardData
|
|||||||
return _rarity;
|
return _rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRewardedShards()
|
||||||
|
{
|
||||||
|
return _rewardedShards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShards()
|
||||||
|
{
|
||||||
|
return _shards;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package mineplex.core.reward;
|
package mineplex.core.reward;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -14,28 +13,26 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.giveaway.GiveawayManager;
|
import mineplex.core.giveaway.GiveawayManager;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.reward.rewards.CoinReward;
|
|
||||||
import mineplex.core.reward.rewards.ExperienceReward;
|
import mineplex.core.reward.rewards.ExperienceReward;
|
||||||
import mineplex.core.reward.rewards.GemReward;
|
import mineplex.core.reward.rewards.GemReward;
|
||||||
import mineplex.core.reward.rewards.GiveawayReward;
|
|
||||||
import mineplex.core.reward.rewards.InventoryReward;
|
import mineplex.core.reward.rewards.InventoryReward;
|
||||||
import mineplex.core.reward.rewards.PetReward;
|
import mineplex.core.reward.rewards.PetReward;
|
||||||
import mineplex.core.reward.rewards.RankReward;
|
import mineplex.core.reward.rewards.RankReward;
|
||||||
|
import mineplex.core.reward.rewards.TreasureShardReward;
|
||||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
import mineplex.core.status.ServerStatusManager;
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.timing.TimingManager;
|
|
||||||
import mineplex.serverdata.Region;
|
|
||||||
|
|
||||||
public class RewardManager
|
public class RewardManager
|
||||||
{
|
{
|
||||||
private JavaPlugin _plugin;
|
private JavaPlugin _plugin;
|
||||||
private HashMap<RewardRarity, List<Reward>> _treasureMap;
|
private EnumMap<RewardPool.Type, RewardPool> _rewardPools;
|
||||||
private Random _random;
|
private Random _random;
|
||||||
private boolean _carlSpinner;
|
private boolean _carlSpinner;
|
||||||
|
|
||||||
@ -54,12 +51,12 @@ public class RewardManager
|
|||||||
boolean doubleGadgetValue, boolean carlSpinner)
|
boolean doubleGadgetValue, boolean carlSpinner)
|
||||||
{
|
{
|
||||||
_plugin = donationManager.getPlugin();
|
_plugin = donationManager.getPlugin();
|
||||||
_treasureMap = new HashMap<RewardRarity, List<Reward>>();
|
_rewardPools = new EnumMap<RewardPool.Type, RewardPool>(RewardPool.Type.class);
|
||||||
_random = new Random();
|
_random = new Random();
|
||||||
|
|
||||||
for (RewardRarity rarity : RewardRarity.values())
|
for (RewardPool.Type type : RewardPool.Type.values())
|
||||||
{
|
{
|
||||||
_treasureMap.put(rarity, new ArrayList<Reward>());
|
_rewardPools.put(type, new RewardPool());
|
||||||
}
|
}
|
||||||
|
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
@ -83,13 +80,13 @@ public class RewardManager
|
|||||||
// Coins
|
// Coins
|
||||||
if (_carlSpinner)
|
if (_carlSpinner)
|
||||||
{
|
{
|
||||||
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
|
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 25, 0, rarity));
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
|
||||||
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 25, rarity));
|
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 25, 0, rarity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 5, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 5, rarity));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Increase Value
|
//Increase Value
|
||||||
@ -99,34 +96,40 @@ public class RewardManager
|
|||||||
maxValue *= 2;
|
maxValue *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Coal", "Coal", 10, 100,
|
||||||
|
new ItemStack(Material.COAL), rarity, 10, 0));
|
||||||
|
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Snowballs", "Snowball", 5, 20,
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 10, 0));
|
||||||
|
|
||||||
// Gadgets
|
// Gadgets
|
||||||
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
|
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
|
||||||
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
||||||
new ItemStack(Material.GOLD_BARDING), rarity, 10));
|
new ItemStack(Material.GOLD_BARDING), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
||||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||||
new ItemStack(Material.FIREWORK), rarity, 10));
|
new ItemStack(Material.FIREWORK), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
|
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
|
||||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||||
new ItemStack(Material.MELON_BLOCK), rarity, 10));
|
new ItemStack(Material.MELON_BLOCK), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
|
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
|
||||||
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
||||||
new ItemStack(Material.getMaterial(131)), rarity, 10));
|
new ItemStack(Material.getMaterial(131)), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
|
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
|
||||||
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
||||||
new ItemStack(Material.ENDER_PEARL), rarity, 10));
|
new ItemStack(Material.ENDER_PEARL), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
|
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
|
||||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||||
new ItemStack(Material.IRON_BARDING), rarity, 10));
|
new ItemStack(Material.IRON_BARDING), rarity, 10, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
||||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||||
new ItemStack(Material.TNT), rarity, 10));
|
new ItemStack(Material.TNT), rarity, 10, 0));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,13 +141,13 @@ public class RewardManager
|
|||||||
// Coins
|
// Coins
|
||||||
if (_carlSpinner)
|
if (_carlSpinner)
|
||||||
{
|
{
|
||||||
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity));
|
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 1200, 0, rarity));
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 1200, rarity));
|
||||||
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 1200, rarity));
|
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 1200, 0, rarity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Increase Value
|
//Increase Value
|
||||||
@ -154,76 +157,85 @@ public class RewardManager
|
|||||||
maxValue *= 2;
|
maxValue *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Freeze Cannon Ammo", "Freeze Cannon", 5, 10,
|
||||||
|
new ItemStack(Material.ICE), rarity, 10, 0));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Party Popper Ammo", "Party Popper", 5, 10,
|
||||||
|
new ItemStack(Material.GOLDEN_CARROT), rarity, 10, 0));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Present Hat", "Present Hat",
|
||||||
|
SkinData.PRESENT.getSkull(), rarity, 5, 100));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Snowman Head", "Snowman Head",
|
||||||
|
SkinData.SNOWMAN.getSkull(), rarity, 5, 100));
|
||||||
|
|
||||||
// Gadgets
|
// Gadgets
|
||||||
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
|
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
|
||||||
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
|
||||||
new ItemStack(Material.GOLD_BARDING), rarity, 250));
|
new ItemStack(Material.GOLD_BARDING), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",
|
||||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||||
new ItemStack(Material.FIREWORK), rarity, 250));
|
new ItemStack(Material.FIREWORK), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
|
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
|
||||||
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
|
||||||
new ItemStack(Material.MELON_BLOCK), rarity, 250));
|
new ItemStack(Material.MELON_BLOCK), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
|
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
|
||||||
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
|
||||||
new ItemStack(Material.getMaterial(131)), rarity, 250));
|
new ItemStack(Material.getMaterial(131)), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
|
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
|
||||||
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
|
||||||
new ItemStack(Material.ENDER_PEARL), rarity, 250));
|
new ItemStack(Material.ENDER_PEARL), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
|
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
|
||||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||||
new ItemStack(Material.IRON_BARDING), rarity, 250));
|
new ItemStack(Material.IRON_BARDING), rarity, 250, 0));
|
||||||
|
|
||||||
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
addReward(new InventoryReward(inventoryManager, "TNT", "TNT",
|
||||||
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
|
||||||
new ItemStack(Material.TNT), rarity, 250));
|
new ItemStack(Material.TNT), rarity, 250, 0));
|
||||||
|
|
||||||
// Pets
|
// Pets
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow",
|
||||||
EntityType.COW, rarity, 500));
|
EntityType.COW, rarity, 500, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep",
|
||||||
EntityType.SHEEP, rarity, 333));
|
EntityType.SHEEP, rarity, 333, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom",
|
||||||
EntityType.MUSHROOM_COW, rarity, 200));
|
EntityType.MUSHROOM_COW, rarity, 200, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig",
|
||||||
EntityType.PIG, rarity, 200));
|
EntityType.PIG, rarity, 200, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat",
|
||||||
EntityType.OCELOT, rarity, 167));
|
EntityType.OCELOT, rarity, 167, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken",
|
||||||
EntityType.CHICKEN, rarity, 143));
|
EntityType.CHICKEN, rarity, 143, 100));
|
||||||
addReward(new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog",
|
addReward(new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog",
|
||||||
EntityType.WOLF, rarity, 125));
|
EntityType.WOLF, rarity, 125, 100));
|
||||||
|
|
||||||
// Music Discs
|
// Music Discs
|
||||||
addReward(new UnknownPackageReward(donationManager, "13 Disc", "13 Disc",
|
addReward(new UnknownPackageReward(donationManager, "13 Disc", "13 Disc",
|
||||||
new ItemStack(2256), rarity, 25));
|
new ItemStack(2256), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Cat Disc", "Cat Disc",
|
addReward(new UnknownPackageReward(donationManager, "Cat Disc", "Cat Disc",
|
||||||
new ItemStack(2257), rarity, 25));
|
new ItemStack(2257), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Blocks Disc", "Blocks Disc",
|
addReward(new UnknownPackageReward(donationManager, "Blocks Disc", "Blocks Disc",
|
||||||
new ItemStack(2258), rarity, 25));
|
new ItemStack(2258), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Chirp Disc", "Chirp Disc",
|
addReward(new UnknownPackageReward(donationManager, "Chirp Disc", "Chirp Disc",
|
||||||
new ItemStack(2259), rarity, 25));
|
new ItemStack(2259), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Far Disc", "Far Disc",
|
addReward(new UnknownPackageReward(donationManager, "Far Disc", "Far Disc",
|
||||||
new ItemStack(2260), rarity, 25));
|
new ItemStack(2260), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Mall Disc", "Mall Disc",
|
addReward(new UnknownPackageReward(donationManager, "Mall Disc", "Mall Disc",
|
||||||
new ItemStack(2261), rarity, 25));
|
new ItemStack(2261), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Mellohi Disc", "Mellohi Disc",
|
addReward(new UnknownPackageReward(donationManager, "Mellohi Disc", "Mellohi Disc",
|
||||||
new ItemStack(2262), rarity, 25));
|
new ItemStack(2262), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Stal Disc", "Stal Disc",
|
addReward(new UnknownPackageReward(donationManager, "Stal Disc", "Stal Disc",
|
||||||
new ItemStack(2263), rarity, 25));
|
new ItemStack(2263), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Strad Disc", "Strad Disc",
|
addReward(new UnknownPackageReward(donationManager, "Strad Disc", "Strad Disc",
|
||||||
new ItemStack(2264), rarity, 25));
|
new ItemStack(2264), rarity, 25, 100));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Ward Disc", "Ward Disc",
|
addReward(new UnknownPackageReward(donationManager, "Ward Disc", "Ward Disc",
|
||||||
new ItemStack(2265), rarity, 25));
|
new ItemStack(2265), rarity, 25, 100));
|
||||||
// addReward(new UnknownPackageReward(donationManager, "11 Disc", "11 Disc",
|
// addReward(new UnknownPackageReward(donationManager, "11 Disc", "11 Disc",
|
||||||
// new ItemStack(2266), rarity, 25));
|
// new ItemStack(2266), rarity, 25));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Wait Disc", "Wait Disc",
|
addReward(new UnknownPackageReward(donationManager, "Wait Disc", "Wait Disc",
|
||||||
new ItemStack(2267), rarity, 25));
|
new ItemStack(2267), rarity, 25, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue)
|
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue)
|
||||||
@ -233,58 +245,65 @@ public class RewardManager
|
|||||||
// Coins
|
// Coins
|
||||||
if (_carlSpinner)
|
if (_carlSpinner)
|
||||||
{
|
{
|
||||||
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 150, rarity));
|
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 150, 0, rarity));
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 150, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 150, rarity));
|
||||||
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 150, rarity));
|
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 150, 0, rarity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Santa Hat", "Santa Hat",
|
||||||
|
SkinData.SANTA.getSkull(), rarity, 5, 500));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new PetReward(petManager, inventoryManager, donationManager, "Elf Pet", "Christmas Elf", EntityType.VILLAGER, rarity, 5, 500));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Fall of the Frost Lord", "Fall of the Frost Lord",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, 500));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Candy Cane Remains", "Candy Cane Remains",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, 500));
|
||||||
|
|
||||||
// Mounts
|
// Mounts
|
||||||
addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
|
addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
|
||||||
new ItemStack(Material.HAY_BLOCK), rarity, 200));
|
new ItemStack(Material.HAY_BLOCK), rarity, 200, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart",
|
addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart",
|
||||||
new ItemStack(Material.MINECART), rarity, 100));
|
new ItemStack(Material.MINECART), rarity, 100, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount",
|
addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount",
|
||||||
new ItemStack(Material.SLIME_BALL), rarity, 67));
|
new ItemStack(Material.SLIME_BALL), rarity, 67, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
|
addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
|
||||||
new ItemStack(Material.SNOW_BALL), rarity, 50));
|
new ItemStack(Material.SNOW_BALL), rarity, 50, 500));
|
||||||
|
|
||||||
// Morphs
|
// Morphs
|
||||||
addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
|
addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
|
||||||
new ItemStack(Material.LEATHER), rarity, 167));
|
new ItemStack(Material.LEATHER), rarity, 167, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph",
|
addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph",
|
||||||
new ItemStack(Material.EMERALD), rarity, 83));
|
new ItemStack(Material.EMERALD), rarity, 83, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
|
addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
|
||||||
new ItemStack(Material.FEATHER), rarity, 50));
|
new ItemStack(Material.FEATHER), rarity, 50, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
|
addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
|
||||||
new ItemStack(Material.ENDER_PEARL), rarity, 33));
|
new ItemStack(Material.ENDER_PEARL), rarity, 33, 500));
|
||||||
|
|
||||||
|
|
||||||
// Gadgets
|
// Gadgets
|
||||||
addReward(new InventoryReward(inventoryManager, "Coin Party Bomb", "Coin Party Bomb", 1, 1,
|
addReward(new InventoryReward(inventoryManager, "Treasure Party Bomb", "Coin Party Bomb", 1, 1,
|
||||||
new ItemStack(Material.getMaterial(175)), rarity, 100));
|
new ItemStack(Material.getMaterial(175)), rarity, 100, 500));
|
||||||
|
|
||||||
// Costumes
|
// Costumes
|
||||||
addReward(new UnknownPackageReward(donationManager, "Rave Hat", "Rave Hat",
|
addReward(new UnknownPackageReward(donationManager, "Rave Hat", "Rave Hat",
|
||||||
new ItemStack(Material.LEATHER_HELMET), rarity, 30));
|
new ItemStack(Material.LEATHER_HELMET), rarity, 30, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Rave Shirt", "Rave Shirt",
|
addReward(new UnknownPackageReward(donationManager, "Rave Shirt", "Rave Shirt",
|
||||||
new ItemStack(Material.LEATHER_CHESTPLATE), rarity, 30));
|
new ItemStack(Material.LEATHER_CHESTPLATE), rarity, 30, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Rave Pants", "Rave Pants",
|
addReward(new UnknownPackageReward(donationManager, "Rave Pants", "Rave Pants",
|
||||||
new ItemStack(Material.LEATHER_LEGGINGS), rarity, 30));
|
new ItemStack(Material.LEATHER_LEGGINGS), rarity, 30, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Rave Boots", "Rave Boots",
|
addReward(new UnknownPackageReward(donationManager, "Rave Boots", "Rave Boots",
|
||||||
new ItemStack(Material.LEATHER_BOOTS), rarity, 30));
|
new ItemStack(Material.LEATHER_BOOTS), rarity, 30, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Space Helmet", "Space Helmet",
|
addReward(new UnknownPackageReward(donationManager, "Space Helmet", "Space Helmet",
|
||||||
new ItemStack(Material.GLASS), rarity, 50));
|
new ItemStack(Material.GLASS), rarity, 50, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Space Jacket", "Space Jacket",
|
addReward(new UnknownPackageReward(donationManager, "Space Jacket", "Space Jacket",
|
||||||
new ItemStack(Material.GOLD_CHESTPLATE), rarity, 50));
|
new ItemStack(Material.GOLD_CHESTPLATE), rarity, 50, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Space Pants", "Space Pants",
|
addReward(new UnknownPackageReward(donationManager, "Space Pants", "Space Pants",
|
||||||
new ItemStack(Material.GOLD_LEGGINGS), rarity, 50));
|
new ItemStack(Material.GOLD_LEGGINGS), rarity, 50, 500));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Space Boots", "Space Boots",
|
addReward(new UnknownPackageReward(donationManager, "Space Boots", "Space Boots",
|
||||||
new ItemStack(Material.GOLD_BOOTS), rarity, 50));
|
new ItemStack(Material.GOLD_BOOTS), rarity, 50, 500));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue)
|
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, double minValue, double maxValue)
|
||||||
@ -294,57 +313,80 @@ public class RewardManager
|
|||||||
// Coins
|
// Coins
|
||||||
if (_carlSpinner)
|
if (_carlSpinner)
|
||||||
{
|
{
|
||||||
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 10, rarity));
|
addReward(new GemReward(donationManager, (int)minValue, (int)maxValue, 10, 0, rarity));
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 10, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 10, rarity));
|
||||||
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 10, rarity));
|
addReward(new ExperienceReward(statsManager, (int)minValue*5, (int)maxValue*5, 10, 0, rarity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
|
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
|
||||||
}
|
}
|
||||||
|
int legendaryShards = 2000;
|
||||||
|
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "The Grinch Hat", "The Grinch Hat",
|
||||||
|
SkinData.THE_GRINCH.getSkull(), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Olaf Morph", "Olaf Morph",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
|
||||||
|
new ItemStack(Material.SADDLE), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Baby Reindeer", "Baby Reindeer",
|
||||||
|
new ItemStack(Material.GOLDEN_CARROT), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Wind of the Frost Lord", "Wind of the Frost Lord",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Arrows of the Frost Lord", "Arrows of the Frost Lord",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Gust of the Frost Lord", "Gust of the Frost Lord",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Crushed Candy Cane", "Crushed Candy Cane",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Candy Cane Arrows", "Candy Cane Arrows",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Candy Cane Blast", "Candy Cane Blast",
|
||||||
|
new ItemStack(Material.SNOW_BALL), rarity, 5, legendaryShards));
|
||||||
|
|
||||||
// Mounts
|
// Mounts
|
||||||
addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",
|
addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",
|
||||||
new ItemStack(Material.BONE), rarity, 33));
|
new ItemStack(Material.BONE), rarity, 33, legendaryShards));
|
||||||
|
|
||||||
// Morphs
|
// Morphs
|
||||||
addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
|
addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
|
||||||
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), rarity, 25));
|
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), rarity, 25, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
|
addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
|
||||||
new ItemStack(Material.EMERALD_BLOCK), rarity, 20));
|
new ItemStack(Material.EMERALD_BLOCK), rarity, 20, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph",
|
addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph",
|
||||||
new ItemStack(Material.SLIME_BALL), rarity, 10));
|
new ItemStack(Material.SLIME_BALL), rarity, 10, legendaryShards));
|
||||||
|
|
||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
||||||
new ItemStack(Material.LEATHER_BOOTS), rarity, 33));
|
new ItemStack(Material.LEATHER_BOOTS), rarity, 33, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted",
|
addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted",
|
||||||
new ItemStack(Material.BOOK), rarity, 25));
|
new ItemStack(Material.BOOK), rarity, 25, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings",
|
addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings",
|
||||||
new ItemStack(Material.BLAZE_POWDER), rarity, 17));
|
new ItemStack(Material.BLAZE_POWDER), rarity, 17, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud",
|
addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud",
|
||||||
new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), rarity, 13));
|
new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), rarity, 13, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix",
|
addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix",
|
||||||
new ItemStack(Material.REDSTONE), rarity, 10));
|
new ItemStack(Material.REDSTONE), rarity, 10, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Green Rings Particles", "Green Ring",
|
addReward(new UnknownPackageReward(donationManager, "Green Rings Particles", "Green Ring",
|
||||||
new ItemStack(Material.EMERALD), rarity, 8));
|
new ItemStack(Material.EMERALD), rarity, 8, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Flame Fairy Particles", "Flame Fairy",
|
addReward(new UnknownPackageReward(donationManager, "Flame Fairy Particles", "Flame Fairy",
|
||||||
new ItemStack(Material.APPLE), rarity, 4));
|
new ItemStack(Material.APPLE), rarity, 4, legendaryShards));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You",
|
addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You",
|
||||||
new ItemStack(Material.BLAZE_POWDER), rarity, 2));
|
new ItemStack(Material.BLAZE_POWDER), rarity, 2, legendaryShards));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addReward(Reward reward)
|
public void addReward(Reward reward)
|
||||||
{
|
{
|
||||||
RewardRarity rarity = reward.getRarity();
|
addReward(RewardPool.Type.NORMAL, reward);
|
||||||
|
|
||||||
List<Reward> treasureList = _treasureMap.get(rarity);
|
|
||||||
|
|
||||||
treasureList.add(reward);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reward[] getRewards(Player player, RewardType type)
|
public void addReward(RewardPool.Type pool, Reward reward)
|
||||||
|
{
|
||||||
|
_rewardPools.get(pool).add(reward);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type)
|
||||||
{
|
{
|
||||||
int currentReward = 0;
|
int currentReward = 0;
|
||||||
Reward[] rewards = new Reward[4];
|
Reward[] rewards = new Reward[4];
|
||||||
@ -353,7 +395,7 @@ public class RewardManager
|
|||||||
|
|
||||||
while (currentReward < 4)
|
while (currentReward < 4)
|
||||||
{
|
{
|
||||||
Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical);
|
Reward reward = nextReward(player, pool, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical);
|
||||||
|
|
||||||
if (reward == null)
|
if (reward == null)
|
||||||
{
|
{
|
||||||
@ -395,19 +437,20 @@ public class RewardManager
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical)
|
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical)
|
||||||
|
{
|
||||||
|
return nextReward(player, RewardPool.Type.NORMAL, excludedRewards, requiresUncommon, type, canGiveMythical);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Reward nextReward(Player player, RewardPool.Type pool, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical)
|
||||||
{
|
{
|
||||||
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
||||||
|
|
||||||
//Dont give Rank Upgrade if already has Titan
|
//Dont give Rank Upgrade if already has Titan
|
||||||
if (rarity == RewardRarity.MYTHICAL)
|
if (rarity == RewardRarity.MYTHICAL)
|
||||||
{
|
{
|
||||||
if (_statusManager.getRegion() == Region.US && canGiveMythical && type == RewardType.MythicalChest && Math.random() <= 0.1)
|
|
||||||
{
|
|
||||||
return getLogitechPrize();
|
|
||||||
}
|
|
||||||
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
|
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
|
||||||
{
|
{
|
||||||
return new RankReward(_clientManager, 0, rarity);
|
return new RankReward(_clientManager, 0, 0, rarity);
|
||||||
}
|
}
|
||||||
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
||||||
{
|
{
|
||||||
@ -415,11 +458,11 @@ public class RewardManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new RankReward(_clientManager, 0, rarity);
|
return new RankReward(_clientManager, 0, 0, rarity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Reward> treasureList = _treasureMap.get(rarity);
|
List<Reward> treasureList = _rewardPools.get(pool).getRewards(rarity);
|
||||||
|
|
||||||
int totalWeight = 0;
|
int totalWeight = 0;
|
||||||
ArrayList<Reward> possibleRewards = new ArrayList<Reward>();
|
ArrayList<Reward> possibleRewards = new ArrayList<Reward>();
|
||||||
@ -438,25 +481,19 @@ public class RewardManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((player == null || treasure.canGiveReward(player)) && !isExcluded)
|
|
||||||
{
|
|
||||||
possibleRewards.add(treasure);
|
possibleRewards.add(treasure);
|
||||||
totalWeight += treasure.getWeight();
|
totalWeight += treasure.getWeight();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (possibleRewards.size() == 0)
|
if (possibleRewards.size() == 0)
|
||||||
{
|
{
|
||||||
// go again, ignore excluded
|
// go again, ignore excluded
|
||||||
for (Reward treasure : treasureList)
|
for (Reward treasure : treasureList)
|
||||||
{
|
|
||||||
if ((player == null || treasure.canGiveReward(player)))
|
|
||||||
{
|
{
|
||||||
possibleRewards.add(treasure);
|
possibleRewards.add(treasure);
|
||||||
totalWeight += treasure.getWeight();
|
totalWeight += treasure.getWeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (totalWeight > 0)
|
if (totalWeight > 0)
|
||||||
{
|
{
|
||||||
@ -468,43 +505,15 @@ public class RewardManager
|
|||||||
currentWeight += reward.getWeight();
|
currentWeight += reward.getWeight();
|
||||||
|
|
||||||
if (weight <= currentWeight)
|
if (weight <= currentWeight)
|
||||||
|
{
|
||||||
|
if (reward.canGiveReward(player))
|
||||||
return reward;
|
return reward;
|
||||||
|
else
|
||||||
|
return new TreasureShardReward(_donationManager, reward, 1, reward.getRarity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Reward getLogitechPrize()
|
|
||||||
{
|
|
||||||
double rand = Math.random();
|
|
||||||
|
|
||||||
String name;
|
|
||||||
String cooldown = "logitech";
|
|
||||||
Material mat = Material.DIAMOND;
|
|
||||||
String displayName;
|
|
||||||
|
|
||||||
if (rand < 0.2)
|
|
||||||
{
|
|
||||||
name = "logitechKeyboard";
|
|
||||||
displayName = C.cRed + "Logitech G910 RGB Keyboard";
|
|
||||||
}
|
|
||||||
else if (rand < 0.4)
|
|
||||||
{
|
|
||||||
name = "logitechMouse";
|
|
||||||
displayName = C.cRed + "Logitech G303 Gaming Mouse";
|
|
||||||
}
|
|
||||||
else if (rand < 0.6)
|
|
||||||
{
|
|
||||||
name = "logitechHeadset";
|
|
||||||
displayName = C.cRed + "Logitech G430 Gaming Headset";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name = "logitechMousePad";
|
|
||||||
displayName = C.cRed + "Logitech G240 Gaming Mousepad";
|
|
||||||
}
|
|
||||||
|
|
||||||
return new GiveawayReward(_giveawayManager, _clientManager, _donationManager, _statusManager, name, cooldown, displayName , mat, (byte) 0, RewardRarity.MYTHICAL, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package mineplex.core.reward;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to separate different "Reward Pools". This allows us to have treasure chests with different loot.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RewardPool
|
||||||
|
{
|
||||||
|
private EnumMap<RewardRarity, List<Reward>> _rewardMap;
|
||||||
|
|
||||||
|
public RewardPool()
|
||||||
|
{
|
||||||
|
_rewardMap = new EnumMap<RewardRarity, List<Reward>>(RewardRarity.class);
|
||||||
|
|
||||||
|
for (RewardRarity rarity : RewardRarity.values())
|
||||||
|
{
|
||||||
|
_rewardMap.put(rarity, new ArrayList<Reward>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(Reward reward)
|
||||||
|
{
|
||||||
|
_rewardMap.get(reward.getRarity()).add(reward);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Reward> getRewards(RewardRarity rarity)
|
||||||
|
{
|
||||||
|
return _rewardMap.get(rarity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum Type
|
||||||
|
{
|
||||||
|
NORMAL,
|
||||||
|
WINTER_HOLIDAY;
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ public enum RewardType
|
|||||||
OldChest( 0, 0.05, 0.4, 5),
|
OldChest( 0, 0.05, 0.4, 5),
|
||||||
AncientChest( 0, 1, 4, 25),
|
AncientChest( 0, 1, 4, 25),
|
||||||
MythicalChest( 0.3, 3, 12, 75),
|
MythicalChest( 0.3, 3, 12, 75),
|
||||||
|
WinterChest( 0, 3, 10, 40),
|
||||||
|
|
||||||
SpinnerFiller( 0.1, 1, 4, 20),
|
SpinnerFiller( 0.1, 1, 4, 20),
|
||||||
SpinnerReal( 0.000001, 0.05, 0.4, 5);
|
SpinnerReal( 0.000001, 0.05, 0.4, 5);
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
package mineplex.core.reward.rewards;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.reward.Reward;
|
|
||||||
import mineplex.core.reward.RewardData;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
|
||||||
import mineplex.core.reward.RewardType;
|
|
||||||
|
|
||||||
public class CoinReward extends Reward
|
|
||||||
{
|
|
||||||
private DonationManager _donationManager;
|
|
||||||
private Random _random;
|
|
||||||
private int _minCoinCount;
|
|
||||||
private int _maxCoinCount;
|
|
||||||
|
|
||||||
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity)
|
|
||||||
{
|
|
||||||
this(donationManager, minCoinCount, maxCoinCount, weight, rarity, RANDOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity, Random random)
|
|
||||||
{
|
|
||||||
super(rarity, weight);
|
|
||||||
_donationManager = donationManager;
|
|
||||||
_minCoinCount = minCoinCount;
|
|
||||||
_maxCoinCount = maxCoinCount;
|
|
||||||
|
|
||||||
_random = random;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
|
||||||
{
|
|
||||||
int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
|
||||||
|
|
||||||
_donationManager.RewardCoins(new Callback<Boolean>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run(Boolean data)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}, "Treasure Chest", player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), coinsToReward);
|
|
||||||
|
|
||||||
return new RewardData(getRarity().getColor() + coinsToReward + " Coins", new ItemStack(175), getRarity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RewardData getFakeRewardData(Player player)
|
|
||||||
{
|
|
||||||
return new RewardData(getRarity().getColor() + "Coins", new ItemStack(175), getRarity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canGiveReward(Player player)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj instanceof CoinReward)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,9 +19,9 @@ public class ExperienceReward extends Reward
|
|||||||
private int _minExperience;
|
private int _minExperience;
|
||||||
private int _maxExperience;
|
private int _maxExperience;
|
||||||
|
|
||||||
public ExperienceReward(StatsManager statsManager, int minExperience, int maxExperience, int weight, RewardRarity rarity)
|
public ExperienceReward(StatsManager statsManager, int minExperience, int maxExperience, int weight, int shardValue, RewardRarity rarity)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight, shardValue);
|
||||||
|
|
||||||
_statsManager = statsManager;
|
_statsManager = statsManager;
|
||||||
_random = new Random();
|
_random = new Random();
|
||||||
|
@ -20,14 +20,14 @@ public class GemReward extends Reward
|
|||||||
private int _minGemCount;
|
private int _minGemCount;
|
||||||
private int _maxGemCount;
|
private int _maxGemCount;
|
||||||
|
|
||||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
|
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, int shardValue, RewardRarity rarity)
|
||||||
{
|
{
|
||||||
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
|
this(donationManager, minGemCount, maxGemCount, weight, shardValue, rarity, RANDOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity, Random random)
|
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, int shardValue, RewardRarity rarity, Random random)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight, shardValue);
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_minGemCount = minGemCount;
|
_minGemCount = minGemCount;
|
||||||
_maxGemCount = maxGemCount;
|
_maxGemCount = maxGemCount;
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
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.common.util.Callback;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.giveaway.GiveawayManager;
|
|
||||||
import mineplex.core.giveaway.GiveawayResponse;
|
|
||||||
import mineplex.core.reward.Reward;
|
|
||||||
import mineplex.core.reward.RewardData;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
|
||||||
import mineplex.core.reward.RewardType;
|
|
||||||
import mineplex.core.status.ServerStatusManager;
|
|
||||||
|
|
||||||
public class GiveawayReward extends Reward
|
|
||||||
{
|
|
||||||
private GiveawayManager _giveawayManager;
|
|
||||||
private CoreClientManager _clientManager;
|
|
||||||
private DonationManager _donationManager;
|
|
||||||
private ServerStatusManager _serverStatusManager;
|
|
||||||
private String _giveawayName;
|
|
||||||
private String _cooldownName;
|
|
||||||
private String _displayName;
|
|
||||||
private Material _icon;
|
|
||||||
private byte _data;
|
|
||||||
|
|
||||||
public GiveawayReward(GiveawayManager giveawayManager, CoreClientManager clientManager, DonationManager donationManager, ServerStatusManager serverStatusManager, String giveawayName, String cooldownName, String displayName, Material icon, byte data, RewardRarity rarity, int weight)
|
|
||||||
{
|
|
||||||
super(rarity, weight, true);
|
|
||||||
_giveawayManager = giveawayManager;
|
|
||||||
_clientManager = clientManager;
|
|
||||||
_donationManager = donationManager;
|
|
||||||
_serverStatusManager = serverStatusManager;
|
|
||||||
_giveawayName = giveawayName;
|
|
||||||
_cooldownName = cooldownName;
|
|
||||||
_displayName = displayName;
|
|
||||||
_icon = icon;
|
|
||||||
_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void giveRewardCallback(final RewardType rewardType, final Player player, final Callback<RewardData> rewardDataCallback)
|
|
||||||
{
|
|
||||||
_giveawayManager.attemptToGiveaway(_giveawayName, _cooldownName, player, new Callback<GiveawayResponse>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run(GiveawayResponse data)
|
|
||||||
{
|
|
||||||
if (data.isSuccess())
|
|
||||||
{
|
|
||||||
RewardData rewardData = new RewardData(_displayName, new ItemStack(_icon, 1, (short) 0, _data), getRarity());
|
|
||||||
if (rewardDataCallback != null) rewardDataCallback.run(rewardData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("GIVEAWAY FAILED: " + data.getFailReason().name());
|
|
||||||
|
|
||||||
// Dang, I guess we failed!
|
|
||||||
if (!_clientManager.hasRank(player, Rank.TITAN))
|
|
||||||
{
|
|
||||||
Reward reward = new RankReward(_clientManager, 0, getRarity());
|
|
||||||
reward.giveReward(rewardType, player, rewardDataCallback);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Reward reward = new CoinReward(_donationManager, 20000, 30000, 0, getRarity());
|
|
||||||
reward.giveReward(rewardType, player, rewardDataCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
|
||||||
{
|
|
||||||
// This is a little hacky, this should never be called!
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RewardData getFakeRewardData(Player player)
|
|
||||||
{
|
|
||||||
// Let's pretend we are coins!
|
|
||||||
return new RewardData(getRarity().getColor() + "Coins", new ItemStack(175), getRarity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canGiveReward(Player player)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,14 +25,14 @@ public class InventoryReward extends Reward
|
|||||||
private int _minAmount;
|
private int _minAmount;
|
||||||
private int _maxAmount;
|
private int _maxAmount;
|
||||||
|
|
||||||
public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
|
public InventoryReward(InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue)
|
||||||
{
|
{
|
||||||
this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight);
|
this(RANDOM, inventoryManager, name, packageName, minAmount, maxAmount, itemStack, rarity, weight, shardValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight)
|
public InventoryReward(Random random, InventoryManager inventoryManager, String name, String packageName, int minAmount, int maxAmount, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight, shardValue);
|
||||||
|
|
||||||
_random = random;
|
_random = random;
|
||||||
_name = name;
|
_name = name;
|
||||||
|
@ -24,9 +24,9 @@ public class PetReward extends UnknownPackageReward
|
|||||||
private PetManager _petManager;
|
private PetManager _petManager;
|
||||||
private EntityType _petEntity;
|
private EntityType _petEntity;
|
||||||
|
|
||||||
public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, EntityType petEntity, RewardRarity rarity, int weight)
|
public PetReward(PetManager petManager, InventoryManager inventoryManager, DonationManager donationManager, String name, String packageName, EntityType petEntity, RewardRarity rarity, int weight, int shardValue)
|
||||||
{
|
{
|
||||||
super(donationManager, name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petEntity.getTypeId()), rarity, weight);
|
super(donationManager, name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petEntity.getTypeId()), rarity, weight, shardValue);
|
||||||
|
|
||||||
_petManager = petManager;
|
_petManager = petManager;
|
||||||
_inventoryManager = inventoryManager;
|
_inventoryManager = inventoryManager;
|
||||||
|
@ -19,9 +19,9 @@ public class RankReward extends Reward
|
|||||||
private Random _random;
|
private Random _random;
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
|
|
||||||
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
|
public RankReward(CoreClientManager clientManager, int weight, int shardValue, RewardRarity rarity)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight, shardValue);
|
||||||
|
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_random = new Random();
|
_random = new Random();
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package mineplex.core.reward.rewards;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.reward.Reward;
|
||||||
|
import mineplex.core.reward.RewardData;
|
||||||
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
|
public class TreasureShardReward extends Reward
|
||||||
|
{
|
||||||
|
private DonationManager _donationManager;
|
||||||
|
private Reward _otherReward;
|
||||||
|
private int _shards;
|
||||||
|
|
||||||
|
public TreasureShardReward(DonationManager donationManager, Reward otherReward, int weight, RewardRarity rarity)
|
||||||
|
{
|
||||||
|
super(rarity, weight, 0);
|
||||||
|
|
||||||
|
_donationManager = donationManager;
|
||||||
|
_otherReward = otherReward;
|
||||||
|
|
||||||
|
_shards = (int) (otherReward.getShardValue() + (Math.random() * otherReward.getShardValue() / 2.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
|
{
|
||||||
|
RewardData fakeData = _otherReward.getFakeRewardData(player);
|
||||||
|
RewardData rewardData = new RewardData(fakeData.getFriendlyName(), fakeData.getDisplayItem(), fakeData.getRarity(), _shards);
|
||||||
|
|
||||||
|
_donationManager.RewardCoins(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(Boolean data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}, "Treasure Chest", player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _shards);
|
||||||
|
|
||||||
|
return rewardData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RewardData getFakeRewardData(Player player)
|
||||||
|
{
|
||||||
|
return new RewardData(getRarity().getColor() + "Treasure Shards", new ItemStack(Material.PRISMARINE_SHARD), getRarity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canGiveReward(Player player)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if (obj instanceof TreasureShardReward)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -21,9 +21,9 @@ public class UnknownPackageReward extends Reward
|
|||||||
private String _name;
|
private String _name;
|
||||||
private String _packageName;
|
private String _packageName;
|
||||||
|
|
||||||
public UnknownPackageReward(DonationManager donationManager, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight)
|
public UnknownPackageReward(DonationManager donationManager, String name, String packageName, ItemStack itemStack, RewardRarity rarity, int weight, int shardValue)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight, shardValue);
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_name = name;
|
_name = name;
|
||||||
_packageName = packageName;
|
_packageName = packageName;
|
||||||
|
@ -124,7 +124,7 @@ public class TreasureLocation implements Listener
|
|||||||
if (treasureType == TreasureType.MYTHICAL)
|
if (treasureType == TreasureType.MYTHICAL)
|
||||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
||||||
|
|
||||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
|
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardPool(), treasureType.getRewardType());
|
||||||
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
|
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
|
||||||
_currentTreasure = treasure;
|
_currentTreasure = treasure;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import mineplex.core.inventory.InventoryManager;
|
|||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardManager;
|
import mineplex.core.reward.RewardManager;
|
||||||
|
import mineplex.core.reward.RewardPool;
|
||||||
import mineplex.core.reward.RewardType;
|
import mineplex.core.reward.RewardType;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
import mineplex.core.status.ServerStatusManager;
|
import mineplex.core.status.ServerStatusManager;
|
||||||
@ -132,9 +133,9 @@ public class TreasureManager extends MiniPlugin
|
|||||||
_statsManager.incrementStat(player, "Global.Treasure." + treasureType.getStatName(), 1);
|
_statsManager.incrementStat(player, "Global.Treasure." + treasureType.getStatName(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reward[] getRewards(Player player, RewardType rewardType)
|
public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType rewardType)
|
||||||
{
|
{
|
||||||
return _rewardManager.getRewards(player, rewardType);
|
return _rewardManager.getRewards(player, pool, rewardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpening(Player player)
|
public boolean isOpening(Player player)
|
||||||
|
@ -3,17 +3,18 @@ package mineplex.core.treasure;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.reward.RewardPool;
|
||||||
import mineplex.core.reward.RewardType;
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
public enum TreasureType
|
public enum TreasureType
|
||||||
{
|
{
|
||||||
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
|
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL),
|
||||||
|
|
||||||
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
|
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL),
|
||||||
|
|
||||||
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL),
|
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL),
|
||||||
|
|
||||||
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.MythicalChest, Material.CHEST, TreasureStyle.CHRISTMAS);
|
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY);
|
||||||
|
|
||||||
private final String _name;
|
private final String _name;
|
||||||
private final RewardType _rewardType;
|
private final RewardType _rewardType;
|
||||||
@ -21,8 +22,9 @@ public enum TreasureType
|
|||||||
private final TreasureStyle _treasureStyle;
|
private final TreasureStyle _treasureStyle;
|
||||||
private final String _itemName;
|
private final String _itemName;
|
||||||
private final String _statName;
|
private final String _statName;
|
||||||
|
private final RewardPool.Type _rewardPool;
|
||||||
|
|
||||||
TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle)
|
TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool)
|
||||||
{
|
{
|
||||||
_name = name;
|
_name = name;
|
||||||
_itemName = itemName;
|
_itemName = itemName;
|
||||||
@ -30,6 +32,7 @@ public enum TreasureType
|
|||||||
_rewardType = rewardType;
|
_rewardType = rewardType;
|
||||||
_material = material;
|
_material = material;
|
||||||
_treasureStyle = treasureStyle;
|
_treasureStyle = treasureStyle;
|
||||||
|
_rewardPool = rewardPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RewardType getRewardType()
|
public RewardType getRewardType()
|
||||||
@ -61,4 +64,9 @@ public enum TreasureType
|
|||||||
{
|
{
|
||||||
return _statName;
|
return _statName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RewardPool.Type getRewardPool()
|
||||||
|
{
|
||||||
|
return _rewardPool;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ import net.minecraft.server.v1_8_R3.BlockPosition;
|
|||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||||
import net.minecraft.server.v1_8_R3.TileEntityEnderChest;
|
import net.minecraft.server.v1_8_R3.TileEntityEnderChest;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.hologram.Hologram;
|
import mineplex.core.hologram.Hologram;
|
||||||
@ -78,6 +80,13 @@ public class ChestOpenAnimation extends Animation
|
|||||||
_rewardData.getFriendlyName());
|
_rewardData.getFriendlyName());
|
||||||
_hologram.start();
|
_hologram.start();
|
||||||
}
|
}
|
||||||
|
else if (getTicks() == 25)
|
||||||
|
{
|
||||||
|
if (_rewardData.isRewardedShards())
|
||||||
|
{
|
||||||
|
_hologram.setText(C.cWhite + "You already own this", C.cAqua + "+" + _rewardData.getShards() + " Treasure Shards", " ", _rewardData.getFriendlyName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinish()
|
public void onFinish()
|
||||||
|
@ -145,6 +145,6 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
|||||||
else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
|
else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
|
||||||
|
|
||||||
if (christmasCount > 0) addButton(4, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS));
|
if (christmasCount > 0) addButton(4, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS));
|
||||||
else addButton(4, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, "Winter Holiday Chest", Material.SNOW_BALL, 10000));
|
else addButton(4, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, TreasureType.CHRISTMAS.getItemName(), Material.SNOW_BALL, 10000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1346,7 +1346,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
if (!player.isOnline())
|
if (!player.isOnline())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0);
|
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0, 0);
|
||||||
|
|
||||||
if (reward.canGiveReward(player))
|
if (reward.canGiveReward(player))
|
||||||
reward.giveReward(null, player, new Callback<RewardData>()
|
reward.giveReward(null, player, new Callback<RewardData>()
|
||||||
|
@ -61,13 +61,13 @@ public class GameLootManager implements Listener
|
|||||||
|
|
||||||
//Chest
|
//Chest
|
||||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Old Chest", "Old Chest", 1, 1,
|
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Old Chest", "Old Chest", 1, 1,
|
||||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 2));
|
new ItemStack(Material.CHEST), RewardRarity.COMMON, 2, 0));
|
||||||
|
|
||||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Ancient Chest", "Ancient Chest", 1, 1,
|
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Ancient Chest", "Ancient Chest", 1, 1,
|
||||||
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40));
|
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40, 0));
|
||||||
|
|
||||||
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Mythical Chest", "Mythical Chest", 1, 1,
|
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Mythical Chest", "Mythical Chest", 1, 1,
|
||||||
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1));
|
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user