treasssssurreeeeees

This commit is contained in:
Shaun Bennett 2014-09-18 21:03:46 -05:00
parent c93fee2b53
commit 5d643c00d5
8 changed files with 103 additions and 38 deletions

View File

@ -14,8 +14,10 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.rewards.CoinReward;
import mineplex.core.reward.rewards.InventoryReward;
import mineplex.core.reward.rewards.PetReward;
import mineplex.core.reward.rewards.UnknownPackageReward;
/**
@ -30,7 +32,7 @@ public class RewardManager
private boolean _doubleGadgetValue;
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager,
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager,
int commonValueMin, int commonValueMax,
int uncommonValueMin, int uncommonValueMax,
int rareValueMin, int rareValueMax,
@ -49,13 +51,13 @@ public class RewardManager
_doubleGadgetValue = doubleGadgetValue;
addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
addUncommon(donationManager, inventoryManager, uncommonValueMin, uncommonValueMax);
addRare(donationManager, inventoryManager, rareValueMin, rareValueMax);
addLegendary(donationManager, inventoryManager, legendValueMin, legendValueMax);
addCommon(donationManager, inventoryManager, petManager, commonValueMin, commonValueMax);
addUncommon(donationManager, inventoryManager, petManager, uncommonValueMin, uncommonValueMax);
addRare(donationManager, inventoryManager, petManager, rareValueMin, rareValueMax);
addLegendary(donationManager, inventoryManager, petManager, legendValueMin, legendValueMax);
}
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(this, donationManager, (int)minValue, (int)maxValue, 1, RewardRarity.COMMON));
@ -97,7 +99,7 @@ public class RewardManager
new ItemStack(Material.TNT), RewardRarity.COMMON, 1));
}
public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
public void addUncommon(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(this, donationManager, (int)minValue, (int)maxValue, 250, RewardRarity.UNCOMMON));
@ -139,20 +141,20 @@ public class RewardManager
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250));
// Pets
addReward(new UnknownPackageReward(this, donationManager, "Cow Pet", "Cow",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.COW.getTypeId()), RewardRarity.UNCOMMON, 500));
addReward(new UnknownPackageReward(this, donationManager, "Sheep Pet", "Sheep",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.SHEEP.getTypeId()), RewardRarity.UNCOMMON, 333));
addReward(new UnknownPackageReward(this, donationManager, "Mooshroom Pet", "Mooshroom",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.MUSHROOM_COW.getTypeId()), RewardRarity.UNCOMMON, 200));
addReward(new UnknownPackageReward(this, donationManager, "Pig Pet", "Pig",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.PIG.getTypeId()), RewardRarity.UNCOMMON, 200));
addReward(new UnknownPackageReward(this, donationManager, "Ocelot Pet", "Cat",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.OCELOT.getTypeId()), RewardRarity.UNCOMMON, 167));
addReward(new UnknownPackageReward(this, donationManager, "Chicken Pet", "Chicken",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.CHICKEN.getTypeId()), RewardRarity.RARE, 143));
addReward(new UnknownPackageReward(this, donationManager, "Wolf Pet", "Dog",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), RewardRarity.RARE, 125));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Cow Pet", "Cow",
EntityType.COW, RewardRarity.UNCOMMON, 500));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Sheep Pet", "Sheep",
EntityType.SHEEP, RewardRarity.UNCOMMON, 333));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Mooshroom Pet", "Mooshroom",
EntityType.MUSHROOM_COW, RewardRarity.UNCOMMON, 200));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Pig Pet", "Pig",
EntityType.PIG, RewardRarity.UNCOMMON, 200));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Ocelot Pet", "Cat",
EntityType.OCELOT, RewardRarity.UNCOMMON, 167));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Chicken Pet", "Chicken",
EntityType.CHICKEN, RewardRarity.UNCOMMON, 143));
addReward(new PetReward(petManager, inventoryManager, this, donationManager, "Wolf Pet", "Dog",
EntityType.WOLF, RewardRarity.UNCOMMON, 125));
// Music Discs
addReward(new UnknownPackageReward(this, donationManager, "13 Disc", "13 Disc",
@ -181,7 +183,7 @@ public class RewardManager
new ItemStack(2267), RewardRarity.UNCOMMON, 30));
}
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
public void addRare(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(this, donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
@ -231,7 +233,7 @@ public class RewardManager
}
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
public void addLegendary(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, double minValue, double maxValue)
{
// Coins
addReward(new CoinReward(this, donationManager, (int)minValue, (int)maxValue, 25, RewardRarity.LEGENDARY));

View File

@ -0,0 +1,54 @@
package mineplex.core.reward.rewards;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
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;
/**
* Created by shaun on 14-09-18.
*/
public class PetReward extends UnknownPackageReward
{
private InventoryManager _inventoryManager;
private PetManager _petManager;
private EntityType _petEntity;
public PetReward(PetManager petManager, InventoryManager inventoryManager, RewardManager rewardManager, DonationManager donationManager, String name, String packageName, EntityType petEntity, RewardRarity rarity, int weight)
{
super(rewardManager, donationManager, name, packageName, new ItemStack(Material.MONSTER_EGG, 1, petEntity.getTypeId()), rarity, weight);
_petManager = petManager;
_inventoryManager = inventoryManager;
_petEntity = petEntity;
}
@Override
protected RewardData giveRewardCustom(Player player)
{
PetChangeToken token = new PetChangeToken();
token.Name = player.getName();
token.PetType = _petEntity.toString();
token.PetName = getPackageName();
PetToken petToken = new PetToken();
petToken.PetType = token.PetType;
_petManager.GetRepository().AddPet(token);
// _petManager.addPetOwnerToQueue(player.getName(), _petEntity);
_petManager.Get(player).GetPets().put(_petEntity, token.PetName);
_inventoryManager.addItemToInventory(player, "Pet", _petEntity.toString(), 1);
return super.giveRewardCustom(player);
}
}

View File

@ -31,7 +31,7 @@ public class UnknownPackageReward extends Reward
@Override
protected RewardData giveRewardCustom(Player player)
{
_donationManager.Get(player.getName()).AddUnknownSalesPackagesOwned(_packageName);
_donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _packageName, true, 0, true);
return new RewardData(getRarity().getColor() + _name, _itemStack);
}
@ -47,6 +47,11 @@ public class UnknownPackageReward extends Reward
return _packageName;
}
protected String getFriendlyName()
{
return _name;
}
@Override
public boolean equals(Object obj)
{

View File

@ -34,6 +34,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.event.StackerEvent;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardManager;
import mineplex.core.reward.RewardRarity;
@ -51,13 +52,13 @@ public class TreasureManager extends MiniPlugin
private RewardManager _rewardManager;
private InventoryManager _inventoryManager;
public TreasureManager(JavaPlugin plugin, DonationManager donationManager, InventoryManager inventoryManager)
public TreasureManager(JavaPlugin plugin, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager)
{
super("Treasure", plugin);
_playerTreasureMap = new NautHashMap<Player, Treasure>();
_inventoryManager = inventoryManager;
_rewardManager = new RewardManager(donationManager, inventoryManager,
_rewardManager = new RewardManager(donationManager, inventoryManager, petManager,
250, 500,
750, 1500,
2000, 3000,

View File

@ -160,7 +160,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
_inventoryManager = new InventoryManager(plugin);
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager);
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager);
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false, _treasureManager);
_partyManager = partyManager;

View File

@ -8,6 +8,10 @@ import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import mineplex.core.CustomTagFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
@ -15,7 +19,8 @@ import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.*;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
@ -45,10 +50,6 @@ import mineplex.core.updater.Updater;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import nautilus.game.arcade.game.GameServerConfig;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Arcade extends JavaPlugin
{
@ -119,7 +120,7 @@ public class Arcade extends JavaPlugin
new CustomTagFix(this, packetHandler);
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, webServerAddress);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, webServerAddress);
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
new MemoryFix(this);

View File

@ -54,6 +54,7 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
@ -91,9 +92,9 @@ import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager;
import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.managers.GameLootManager;
import nautilus.game.arcade.managers.GameManager;
import nautilus.game.arcade.managers.GamePlayerManager;
import nautilus.game.arcade.managers.GameLootManager;
import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager;
@ -159,7 +160,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
CosmeticManager cosmeticManager, ProjectileManager projectileManager, String webAddress)
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, String webAddress)
{
super("Game Manager", plugin);
@ -245,7 +246,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
new GameFlagManager(this);
_gamePlayerManager = new GamePlayerManager(this);
new GameAchievementManager(this);
new GameLootManager(this);
new GameLootManager(this, petManager);
_gameWorldManager = new GameWorldManager(this);
new MiscManager(this);
new IdleManager(this);

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTitle;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardManager;
@ -39,13 +40,13 @@ public class GameLootManager implements Listener
private long _startTime = 0;
public GameLootManager(ArcadeManager manager)
public GameLootManager(ArcadeManager manager, PetManager petManager)
{
Manager = manager;
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(),
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(), petManager,
100, 300,
750, 1500,
2000, 3000,