Titan rewards from mythical chests
This commit is contained in:
parent
e6bec41ca8
commit
e3e7dd4694
@ -229,7 +229,8 @@ public class AccountRepository extends RepositoryBase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
callback.run(response);
|
||||
if (callback != null)
|
||||
callback.run(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -755,6 +755,9 @@ public enum Achievement
|
||||
|
||||
;
|
||||
|
||||
private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray };
|
||||
private static int _negativeCount = 0;
|
||||
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
private String[] _stats;
|
||||
@ -820,7 +823,10 @@ public enum Achievement
|
||||
public static String getExperienceString(int level)
|
||||
{
|
||||
if (level < 0)
|
||||
return C.cAqua + level;
|
||||
{
|
||||
_negativeCount++;
|
||||
return _colors[_negativeCount % _colors.length] + level;
|
||||
}
|
||||
|
||||
if (level < 20)
|
||||
return C.cGray + level;
|
||||
|
@ -41,6 +41,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.database.Tables;
|
||||
@ -164,7 +165,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -173,7 +174,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_npcManager = npcManager;
|
||||
_hologramManager = hologramManager;
|
||||
|
||||
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager, statsManager,
|
||||
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
4000, 6000,
|
||||
|
@ -109,7 +109,7 @@ public class SpinGui extends SimpleGui
|
||||
}
|
||||
}
|
||||
|
||||
_rewardData = _reward.giveReward("Carls Spinner", getPlayer());
|
||||
_rewardData = _reward.giveReward(RewardType.SpinnerReal, getPlayer());
|
||||
}
|
||||
|
||||
private void tick()
|
||||
|
@ -20,12 +20,12 @@ public abstract class Reward
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
public final RewardData giveReward(String type, Player player)
|
||||
public final RewardData giveReward(RewardType rewardType, Player player)
|
||||
{
|
||||
return giveRewardCustom(player);
|
||||
return giveRewardCustom(player, rewardType);
|
||||
}
|
||||
|
||||
protected abstract RewardData giveRewardCustom(Player player);
|
||||
protected abstract RewardData giveRewardCustom(Player player, RewardType rewardType);
|
||||
|
||||
public abstract RewardData getFakeRewardData(Player player);
|
||||
|
||||
|
@ -25,6 +25,7 @@ import mineplex.core.reward.rewards.PetReward;
|
||||
import mineplex.core.reward.rewards.RankReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
|
||||
public class RewardManager
|
||||
@ -35,10 +36,11 @@ public class RewardManager
|
||||
private boolean _carlSpinner;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
|
||||
private boolean _doubleGadgetValue;
|
||||
|
||||
public RewardManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager,
|
||||
public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager,
|
||||
int commonValueMin, int commonValueMax,
|
||||
int uncommonValueMin, int uncommonValueMax,
|
||||
int rareValueMin, int rareValueMax,
|
||||
@ -55,6 +57,7 @@ public class RewardManager
|
||||
}
|
||||
|
||||
_clientManager = clientManager;
|
||||
_statusManager = statusManager;
|
||||
|
||||
_doubleGadgetValue = doubleGadgetValue;
|
||||
_carlSpinner = carlSpinner;
|
||||
@ -304,6 +307,7 @@ public class RewardManager
|
||||
addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph",
|
||||
new ItemStack(Material.SLIME_BALL), rarity, 10));
|
||||
|
||||
|
||||
// Particles
|
||||
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
||||
new ItemStack(Material.LEATHER_BOOTS), rarity, 33));
|
||||
@ -321,8 +325,6 @@ public class RewardManager
|
||||
new ItemStack(Material.APPLE), rarity, 4));
|
||||
addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You",
|
||||
new ItemStack(Material.BLAZE_POWDER), rarity, 2));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void addReward(Reward reward)
|
||||
@ -388,16 +390,20 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
||||
|
||||
//Dont give Rank Upgrade if already has Legend
|
||||
//Dont give Rank Upgrade if already has Titan
|
||||
if (rarity == RewardRarity.MYTHICAL)
|
||||
{
|
||||
if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
||||
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
|
||||
{
|
||||
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||
}
|
||||
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
||||
{
|
||||
rarity = RewardRarity.LEGENDARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new RankReward(_clientManager, 0, rarity);
|
||||
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,6 +433,19 @@ public class RewardManager
|
||||
}
|
||||
}
|
||||
|
||||
if (possibleRewards.size() == 0)
|
||||
{
|
||||
// go again, ignore excluded
|
||||
for (Reward treasure : treasureList)
|
||||
{
|
||||
if ((player == null || treasure.canGiveReward(player)))
|
||||
{
|
||||
possibleRewards.add(treasure);
|
||||
totalWeight += treasure.getWeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
int weight = _random.nextInt(totalWeight);
|
||||
|
@ -9,8 +9,8 @@ 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.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
|
||||
public class CoinReward extends Reward
|
||||
{
|
||||
@ -35,7 +35,7 @@ public class CoinReward extends Reward
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardData giveRewardCustom(Player player)
|
||||
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
public class ExperienceReward extends Reward
|
||||
@ -29,7 +30,7 @@ public class ExperienceReward extends Reward
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RewardData giveRewardCustom(Player player)
|
||||
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
int experience = _random.nextInt(_maxExperience - _minExperience) + _minExperience;
|
||||
|
||||
|
@ -10,8 +10,8 @@ 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.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
|
||||
public class GemReward extends Reward
|
||||
{
|
||||
@ -36,7 +36,7 @@ public class GemReward extends Reward
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardData giveRewardCustom(Player player)
|
||||
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
int GemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount;
|
||||
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-12.
|
||||
@ -44,7 +44,7 @@ public class InventoryReward extends Reward
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardData giveRewardCustom(Player player)
|
||||
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
int amountToGive;
|
||||
|
||||
|
@ -11,8 +11,8 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
/**
|
||||
@ -34,7 +34,7 @@ public class PetReward extends UnknownPackageReward
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RewardData giveRewardCustom(Player player)
|
||||
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
PetChangeToken token = new PetChangeToken();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.reward.rewards;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -8,35 +8,51 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
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;
|
||||
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||
|
||||
public class RankReward extends Reward
|
||||
{
|
||||
private Random _random;
|
||||
private CoreClientManager _clientManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
|
||||
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
|
||||
public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity)
|
||||
{
|
||||
super(rarity, weight);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_statusManager = statusManager;
|
||||
_random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardData giveRewardCustom(Player player)
|
||||
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
Rank rank = null;
|
||||
if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA;
|
||||
else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO;
|
||||
else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND;
|
||||
else if (rewardType == RewardType.MythicalChest && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN;
|
||||
|
||||
if (rewardType == RewardType.MythicalChest && _random.nextDouble() < 0.02) // 2 Percent
|
||||
rank = Rank.TITAN;
|
||||
|
||||
if (rank == null)
|
||||
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
|
||||
|
||||
_clientManager.Get(player).SetRank(rank);
|
||||
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
|
||||
|
||||
if (rank == Rank.TITAN)
|
||||
{
|
||||
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
|
||||
message.publish();
|
||||
}
|
||||
|
||||
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ 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 UnknownPackageReward extends Reward
|
||||
{
|
||||
@ -25,7 +26,7 @@ public class UnknownPackageReward extends Reward
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RewardData giveRewardCustom(Player player)
|
||||
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||
{
|
||||
DonationManager.PurchaseUnknownSalesPackage(null, player.getName(), DonationManager.getClientManager().Get(player).getAccountId(), _packageName, true, 0, true);
|
||||
|
||||
@ -40,7 +41,7 @@ public class UnknownPackageReward extends Reward
|
||||
System.out.println("Could not give reward " + _packageName + " to Offline Player: " + player.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return !DonationManager.Get(player.getName()).OwnsUnknownPackage(_packageName);
|
||||
}
|
||||
|
||||
@ -65,7 +66,7 @@ public class UnknownPackageReward extends Reward
|
||||
{
|
||||
if (obj instanceof UnknownPackageReward)
|
||||
{
|
||||
return ((UnknownPackageReward) obj).getPackageName().equals(_packageName);
|
||||
return _packageName.equals(((UnknownPackageReward) obj).getPackageName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package mineplex.core.titangiveaway;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -13,6 +10,10 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.titangiveaway.redis.GiveawayMessageHandler;
|
||||
import mineplex.core.titangiveaway.redis.TitanChestGiveawayHandler;
|
||||
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||
import mineplex.core.titangiveaway.redis.TitanGiveawayMessage;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
@ -36,6 +37,7 @@ public class TitanGiveawayManager extends MiniPlugin
|
||||
_random = new Random();
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("TitanGiveawayMessage", TitanGiveawayMessage.class, new GiveawayMessageHandler(plugin));
|
||||
ServerCommandManager.getInstance().registerCommandType("TitanChestGiveawayMessage", TitanChestGiveawayMessage.class, new TitanChestGiveawayHandler(_statusManager));
|
||||
}
|
||||
|
||||
public void openPumpkin(final Player player, final Runnable onSuccess)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.titangiveaway;
|
||||
package mineplex.core.titangiveaway.redis;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
@ -10,6 +10,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.titangiveaway.LightFlicker;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
@ -31,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback
|
||||
String playerName = message.getPlayerName();
|
||||
int count = message.getTitanCount();
|
||||
String countString = count + UtilTime.getDayOfMonthSuffix(count);
|
||||
String chatMessage = C.cRed + playerName + C.cWhite + " has become the " + C.cRed + countString + " Titan ";
|
||||
String chatMessage = C.cRed + playerName + C.cWhite + " found Titan in a " + C.cRed + "Flaming Pumpkin";
|
||||
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers());
|
||||
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
|
||||
LightFlicker lightFlicker = new LightFlicker(world);
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.titangiveaway.redis;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class TitanChestGiveawayHandler implements CommandCallback
|
||||
{
|
||||
private static final long COOLDOWN = 60000L * 90; // 90 Minutes
|
||||
|
||||
private ServerStatusManager _statusManager;
|
||||
private long _lastTimer;
|
||||
|
||||
public TitanChestGiveawayHandler(ServerStatusManager statusManager)
|
||||
{
|
||||
_statusManager = statusManager;
|
||||
_lastTimer = 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof TitanChestGiveawayMessage)
|
||||
{
|
||||
TitanChestGiveawayMessage chestCommand = ((TitanChestGiveawayMessage) command);
|
||||
if (chestCommand.getServer().equals(_statusManager.getCurrentServerName()) || System.currentTimeMillis() >= _lastTimer + COOLDOWN)
|
||||
{
|
||||
String chatMessage = C.cRed + chestCommand.getPlayerName() + C.cWhite + " found Titan in a " + C.cRed + "Mythical Chest";
|
||||
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers());
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.sendMessage(chatMessage);
|
||||
player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1);
|
||||
}
|
||||
|
||||
_lastTimer = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.titangiveaway.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class TitanChestGiveawayMessage extends ServerCommand
|
||||
{
|
||||
private String _playerName;
|
||||
private String _server;
|
||||
|
||||
public TitanChestGiveawayMessage(String playerName, String server)
|
||||
{
|
||||
_playerName = playerName;
|
||||
_server = server;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getServer()
|
||||
{
|
||||
return _server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
// Handled in Command Callback
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.titangiveaway;
|
||||
package mineplex.core.titangiveaway.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
@ -25,6 +25,7 @@ import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.treasure.animation.BlockChangeAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
@ -56,6 +57,7 @@ public class Treasure
|
||||
private int _currentChest;
|
||||
|
||||
private Reward[] _rewards;
|
||||
private RewardType _rewardType;
|
||||
private int _currentReward;
|
||||
|
||||
private boolean _finished;
|
||||
@ -65,14 +67,14 @@ public class Treasure
|
||||
|
||||
private HologramManager _hologramManager;
|
||||
|
||||
public Treasure(Player player, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
|
||||
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
|
||||
{
|
||||
this(player, new Random(), rewards, centerBlock, chestBlocks, treasureType, hologramManager);
|
||||
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager);
|
||||
|
||||
_blockRestore = blockRestore;
|
||||
}
|
||||
|
||||
public Treasure(Player player, Random seed, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
|
||||
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
|
||||
{
|
||||
_player = player;
|
||||
_random = seed;
|
||||
@ -85,6 +87,7 @@ public class Treasure
|
||||
|
||||
_currentChest = 0;
|
||||
_currentReward = 0;
|
||||
_rewardType = rewardType;
|
||||
_rewards = rewards;
|
||||
|
||||
_chestData = new ChestData[chestBlocks.length];
|
||||
@ -196,7 +199,7 @@ public class Treasure
|
||||
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
|
||||
{
|
||||
Reward reward = _rewards[_currentReward];
|
||||
RewardData rewardData = reward.giveReward("Treasure", _player);
|
||||
RewardData rewardData = reward.giveReward(_rewardType, _player);
|
||||
_currentReward++;
|
||||
|
||||
if (swapList)
|
||||
@ -296,7 +299,7 @@ public class Treasure
|
||||
|
||||
for (int i = _currentReward; i < _rewards.length; i++)
|
||||
{
|
||||
_rewards[_currentReward].giveReward("Treasure", _player);
|
||||
_rewards[_currentReward].giveReward(_rewardType, _player);
|
||||
}
|
||||
|
||||
_currentReward = _rewards.length;
|
||||
|
@ -107,7 +107,7 @@ public class TreasureLocation implements Listener
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
||||
|
||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
|
||||
Treasure treasure = new Treasure(player, rewards, _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
|
||||
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
|
||||
_currentTreasure = treasure;
|
||||
|
||||
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);
|
||||
|
@ -21,6 +21,7 @@ import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/27/2014.
|
||||
@ -34,7 +35,7 @@ public class TreasureManager extends MiniPlugin
|
||||
private StatsManager _statsManager;
|
||||
private List<TreasureLocation> _treasureLocations;
|
||||
|
||||
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager)
|
||||
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager)
|
||||
{
|
||||
super("Treasure", plugin);
|
||||
|
||||
@ -42,7 +43,7 @@ public class TreasureManager extends MiniPlugin
|
||||
_blockRestore = blockRestore;
|
||||
_hologramManager = hologramManager;
|
||||
_statsManager = statsManager;
|
||||
_rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager,
|
||||
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
4000, 6000,
|
||||
|
@ -126,7 +126,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
|
||||
|
||||
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish);
|
||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager);
|
||||
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
||||
|
||||
|
@ -48,6 +48,7 @@ import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -158,7 +159,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Admin
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish)
|
||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager)
|
||||
{
|
||||
super("Hub Manager", plugin);
|
||||
|
||||
@ -191,7 +192,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
new BenefitManager(plugin, clientManager, _inventoryManager);
|
||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager);
|
||||
|
||||
_treasureManager = new TreasureManager(_plugin, clientManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager);
|
||||
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager);
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
|
||||
|
||||
new SoccerManager(this, _gadgetManager);
|
||||
@ -217,7 +218,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||
|
||||
|
||||
new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||
|
||||
// _halloweenManager = new HalloweenSpookinessManager(this);
|
||||
|
||||
|
@ -304,7 +304,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
new NotificationManager(getPlugin(), clientManager);
|
||||
|
||||
new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||
|
||||
//Champions Modules
|
||||
_energy = new Energy(plugin);
|
||||
|
@ -50,7 +50,7 @@ public class GameLootManager implements Listener
|
||||
|
||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||
|
||||
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(),
|
||||
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(),
|
||||
100, 250,
|
||||
500, 1000,
|
||||
1500, 2500,
|
||||
@ -164,7 +164,7 @@ public class GameLootManager implements Listener
|
||||
|
||||
Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true);
|
||||
|
||||
RewardData rewardData = reward.giveReward("GameLoot", player);
|
||||
RewardData rewardData = reward.giveReward(RewardType.GameLoot, player);
|
||||
|
||||
String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user