This commit is contained in:
Shaun Bennett 2015-12-14 04:44:11 -05:00
parent 50bf97ae4a
commit daf1d29ce0
3 changed files with 81 additions and 10 deletions

View File

@ -17,6 +17,9 @@ public class BonusAmount
private int _experience;
private int _bonusExperience;
private int _tickets;
private int _oldChests;
private int _ancientChests;
private int _mythicalChests;
public BonusAmount()
{
@ -133,19 +136,52 @@ public class BonusAmount
_tickets = tickets;
}
public int getOldChests()
{
return _oldChests;
}
public void setOldChests(int oldChests)
{
_oldChests = oldChests;
}
public int getAncientChests()
{
return _ancientChests;
}
public void setAncientChests(int ancientChests)
{
_ancientChests = ancientChests;
}
public int getMythicalChests()
{
return _mythicalChests;
}
public void setMythicalChests(int mythicalChests)
{
_mythicalChests = mythicalChests;
}
public boolean isGreaterThanZero()
{
return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0;
return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0 || _oldChests > 0 || _ancientChests > 0 || _mythicalChests > 0;
}
public void addLore(List<String> lore)
{
lore.add(C.cYellow + "Rewards");
addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : ""));
addLore(lore, getCoins(), getBonusCoins(), "Coins");
addLore(lore, getCoins(), getBonusCoins(), "Treasure Shards");
addLore(lore, getGems(), getBonusGems(), "Gems");
addLore(lore, getGold(), getBonusGold(), "Gold");
addLore(lore, getExperience(), getBonusExperience(), "Experience");
addLore(lore, getOldChests(), 0, "Old Chest", "Old Chests");
addLore(lore, getAncientChests(), 0, "Ancient Chest", "Ancient Chests");
addLore(lore, getMythicalChests(), 0, "Mythical Chest", "Mythical Chests");
}
private void addLore(List<String> lore, int amount, int bonus, String suffix)
@ -156,4 +192,12 @@ public class BonusAmount
// if (bonus > 0)
// lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix);
}
private void addLore(List<String> lore, int amount, int bonus, String suffix, String plural)
{
if (amount == 1)
lore.add(" " + C.cWhite + amount + " " + plural);
else if (amount > 0)
lore.add(" " + C.cWhite + amount + " " + suffix);
}
}

View File

@ -43,6 +43,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.reward.RewardManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.TreasureType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.database.Tables;
@ -122,6 +123,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
private BonusRepository _repository;
private CoreClientManager _clientManager;
private InventoryManager _inventoryManager;
private DonationManager _donationManager;
private PollManager _pollManager;
private NpcManager _npcManager;
@ -174,6 +176,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_donationManager = donationManager;
_npcManager = npcManager;
_hologramManager = hologramManager;
_inventoryManager = inventoryManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
100, 250,
@ -673,21 +676,24 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
BonusAmount data = new BonusAmount();
if (rank.has(Rank.MODERATOR))
if (rank.has(Rank.TITAN))
{
data.setCoins(35000);
data.setAncientChests(6);
data.setMythicalChests(3);
}
if (rank.has(Rank.LEGEND))
else if (rank.has(Rank.LEGEND))
{
data.setCoins(30000);
data.setAncientChests(4);
data.setMythicalChests(1);
}
else if (rank.has(Rank.HERO))
{
data.setCoins(15000);
data.setAncientChests(3);
}
else if (rank.has(Rank.ULTRA))
{
data.setCoins(7500);
data.setOldChests(3);
data.setAncientChests(1);
}
return data;
@ -722,6 +728,27 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
final int coins = amount.getTotalCoins();
final int tickets = amount.getTickets();
int experience = amount.getTotalExperience();
int oldChests = amount.getOldChests();
int ancientChests = amount.getAncientChests();
int mythicalChests = amount.getMythicalChests();
if (oldChests > 0)
{
_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests);
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests")));
}
if (ancientChests > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests);
}
if (mythicalChests > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests")));
_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests);
}
if (gems > 0)
{
@ -750,7 +777,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (coins > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Coins")));
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards")));
_coinQueue.add(new GiveDonorData(player.getName(), coreClient.getAccountId(), player.getUniqueId(), coins));
}

View File

@ -265,7 +265,7 @@ public class BonusRepository extends RepositoryBase
final int accountId = _manager.getClientManager().Get(player).getAccountId();
final int coins = _manager.getRankBonusAmount(player).getCoins();
if (coins == 0/* && gems == 0 */) {
if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) {
result.run(false);
return;
}