Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
libraryaddict 2015-02-11 00:59:45 +13:00
commit 5a516e4c78
15 changed files with 233 additions and 58 deletions

View File

@ -61,11 +61,16 @@ public class PacketPlayOutPlayerInfo extends Packet {
}
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
return updateDisplayName(player, getFormattedName(player));
}
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName)
{
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 3;
packet.username = player.listName;
packet.player = player.getProfile();
packet._tabName = getFormattedName(player);
packet._tabName = displayName;
return packet;
}

View File

@ -74,7 +74,7 @@ public class RewardManager
}
// Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), rarity, 1));
@ -82,7 +82,7 @@ public class RewardManager
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), rarity, 1));
@ -90,11 +90,11 @@ public class RewardManager
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), rarity, 1));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), rarity, 1));
@ -118,7 +118,7 @@ public class RewardManager
}
// Gadgets
addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun",
addReward(new InventoryReward(inventoryManager, "Paintballs", "Paintball Gun",
(int)(100*(minValue/500)), (int)(100*(maxValue/500)),
new ItemStack(Material.GOLD_BARDING), rarity, 250));
@ -126,19 +126,19 @@ public class RewardManager
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.FIREWORK), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher",
addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher",
(int)(50*(minValue/500)), (int)(50*(maxValue/500)),
new ItemStack(Material.MELON_BLOCK), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook",
addReward(new InventoryReward(inventoryManager, "Flesh Hooks", "Flesh Hook",
(int)(40*(minValue/500)), (int)(40*(maxValue/500)),
new ItemStack(Material.getMaterial(131)), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl",
addReward(new InventoryReward(inventoryManager, "Pearls", "Ethereal Pearl",
(int)(30*(minValue/500)), (int)(30*(maxValue/500)),
new ItemStack(Material.ENDER_PEARL), rarity, 250));
addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster",
addReward(new InventoryReward(inventoryManager, "Bat Swarms", "Bat Blaster",
(int)(20*(minValue/500)), (int)(20*(maxValue/500)),
new ItemStack(Material.IRON_BARDING), rarity, 250));
@ -291,10 +291,11 @@ public class RewardManager
int currentReward = 0;
Reward[] rewards = new Reward[4];
boolean hasUncommon = false;
boolean canGiveMythical = true;
while (currentReward < 4)
{
Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type);
Reward reward = nextReward(player, rewards, currentReward == 3 && !hasUncommon, type, canGiveMythical);
if (reward == null)
{
@ -305,6 +306,13 @@ public class RewardManager
{
hasUncommon = true;
}
//Only allow 1 Mythical
if (reward.getRarity().ordinal() >= RewardRarity.MYTHICAL.ordinal())
{
canGiveMythical = false;
}
rewards[currentReward] = reward;
currentReward++;
}
@ -328,14 +336,14 @@ public class RewardManager
// return nextReward(player, excludedRewards, false, isChestOpening);
// }
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type)
public Reward nextReward(Player player, Reward[] excludedRewards, boolean requiresUncommon, RewardType type, boolean canGiveMythical)
{
RewardRarity rarity = type.generateRarity(requiresUncommon);
//Dont give Rank Upgrade if already has Legend
if (rarity == RewardRarity.MYTHICAL)
{
if (_clientManager.Get(player).GetRank().Has(Rank.LEGEND))
if (!canGiveMythical || _clientManager.Get(player).GetRank().Has(Rank.LEGEND))
{
rarity = RewardRarity.LEGENDARY;
}

View File

@ -3,10 +3,10 @@ package mineplex.core.reward;
public enum RewardType
{
//% Chances Mythic Legend Rare Uncommon
GameLoot( 0.000001, 0.001, 0.004, 3),
BasicChest( 0, 0.01, 0.04, 5),
HeroicChest( 0, 1, 4, 25),
LegendaryChest( 0.5, 2.5, 10, 40);
GameLoot( 0.000001, 0.00001, 0.0001, 3),
OldChest( 0, 0.01, 0.04, 5),
AncientChest( 0, 1, 4, 25),
MythicalChest( 0.5, 2.5, 10, 40);
private double _mythicalChance;
private double _legendaryChance;

View File

@ -0,0 +1,25 @@
package mineplex.core.treasure;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
public class OldChest extends SalesPackageBase
{
public OldChest()
{
super("Old Chest", Material.CHEST, (byte) 0, new String[] {}, 1000);
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void Sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -91,7 +91,6 @@ public class Treasure
_chestData[i] = new ChestData(chestBlocks[i]);
}
if (_treasureType == TreasureType.HEROIC || _treasureType == TreasureType.LEGENDARY)
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
}

View File

@ -99,7 +99,7 @@ public class TreasureLocation implements Listener
setHoloChestVisible(false);
if (treasureType == TreasureType.HEROIC || treasureType == TreasureType.LEGENDARY)
if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.MYTHICAL)
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());

View File

@ -1,33 +1,24 @@
package mineplex.core.treasure;
import org.bukkit.Material;
import org.bukkit.Sound;
import mineplex.core.common.util.UtilParticle.ParticleType;
/**
* Created by Shaun on 8/28/2014.
*/
public enum TreasureStyle
{
/**
* These are examples, not final!
*/
BASIC(
OLD(
ParticleType.EXPLODE,
ParticleType.EXPLODE,
Sound.FIZZ,
Sound.HORSE_ARMOR),
HEROIC(
ANCIENT(
ParticleType.FLAME,
ParticleType.LAVA,
Sound.LAVA_POP,
Sound.EXPLODE),
LEGENDARY(
MYTHICAL(
ParticleType.HAPPY_VILLAGER,
ParticleType.LARGE_EXPLODE,
Sound.PORTAL_TRAVEL,

View File

@ -7,11 +7,11 @@ import mineplex.core.reward.RewardType;
public enum TreasureType
{
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.BASIC),
OLD(C.cYellow + "Old Chest", "Old Chest", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.HEROIC),
ANCIENT(C.cGold + "Ancient Chest", "Ancient Chest", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.LEGENDARY);
MYTHICAL(C.cRed + "Mythical Chest", "Mythical Chest", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL);
private final String _name;
private final RewardType _rewardType;

View File

@ -51,13 +51,19 @@ public class BlockChangeAnimation extends Animation
}
else if (b.getType() == Material.SMOOTH_BRICK)
{
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK : Material.QUARTZ_BLOCK;
if (getTreasure().getTreasureType() == TreasureType.OLD)
continue;
Material newMaterial = getTreasure().getTreasureType() == TreasureType.ANCIENT ? Material.NETHER_BRICK : Material.QUARTZ_BLOCK;
_blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial);
}
else if (b.getType() == Material.SMOOTH_STAIRS || b.getType() == Material.COBBLESTONE_STAIRS)
{
Material newMaterial = getTreasure().getTreasureType() == TreasureType.HEROIC ? Material.NETHER_BRICK_STAIRS : Material.QUARTZ_STAIRS;
if (getTreasure().getTreasureType() == TreasureType.OLD)
continue;
Material newMaterial = getTreasure().getTreasureType() == TreasureType.ANCIENT ? Material.NETHER_BRICK_STAIRS : Material.QUARTZ_STAIRS;
_blockInfoList.add(new BlockInfo(b));
b.setType(newMaterial);
}

View File

@ -80,11 +80,11 @@ public class ChestSpawnAnimation extends Animation
_particleLocation.add(_particleDirection);
//Play Particels
if (getTreasure().getTreasureType() == TreasureType.BASIC)
if (getTreasure().getTreasureType() == TreasureType.OLD)
{
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1);
}
else if (getTreasure().getTreasureType() == TreasureType.HEROIC)
else if (getTreasure().getTreasureType() == TreasureType.ANCIENT)
{
float x = (float) (Math.sin(getTicks()/4D));
float z = (float) (Math.cos(getTicks()/4D));
@ -95,7 +95,7 @@ public class ChestSpawnAnimation extends Animation
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1);
}
else if (getTreasure().getTreasureType() == TreasureType.LEGENDARY)
else if (getTreasure().getTreasureType() == TreasureType.MYTHICAL)
{
float y = 5 * scale;
double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION);

View File

@ -0,0 +1,45 @@
package mineplex.core.treasure.gui;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.OldChest;
import mineplex.core.treasure.TreasureManager;
public class BuyBasicChestButton implements IButton
{
private Player _player;
private InventoryManager _inventoryManager;
private TreasurePage _page;
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page)
{
_player = player;
_inventoryManager = inventoryManager;
_page = page;
}
@Override
public void onClick(final Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ConfirmationPage<TreasureManager, TreasureShop>(
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{
public void run()
{
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
_page.Refresh();
}
}, _page, new OldChest(), CurrencyType.Coins, player));
}
}

View File

@ -8,12 +8,17 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType;
@ -36,38 +41,71 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
@Override
protected void BuildPage()
{
int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.BASIC.getItemName());
int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.HEROIC.getItemName());
int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.LEGENDARY.getItemName());
int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.OLD.getItemName());
int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.ANCIENT.getItemName());
int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.MYTHICAL.getItemName());
List<String> basicLore = new ArrayList<String>();
basicLore.add(" ");
basicLore.add(F.value("Basic Chests Owned", "" + basicCount));
basicLore.add(F.value("Old Chests Owned", "" + basicCount));
basicLore.add(" ");
basicLore.add(C.cGray + "We've scoured the lands of Minecraft");
basicLore.add(C.cGray + "and found these abandoned chests.");
basicLore.add(C.cGray + "The contents are unknown, but");
basicLore.add(C.cGray + "according to the inscriptions on the");
basicLore.add(C.cGray + "the straps they appear to contain");
basicLore.add(C.cGray + "many kinds of loot.");
basicLore.add(" ");
if (basicCount > 0)
basicLore.add(ChatColor.RESET + "Click to open!");
basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins");
basicLore.add(ChatColor.RESET + "Click to Purchase!");
}
List<String> heroicLore = new ArrayList<String>();
heroicLore.add(" ");
heroicLore.add(F.value("Heroic Chests Owned", "" + heroicCount));
heroicLore.add(F.value("Ancient Chests Owned", "" + heroicCount));
heroicLore.add(" ");
heroicLore.add(C.cGray + "Some of our bravest adventurers");
heroicLore.add(C.cGray + "have discovered these chests within ");
heroicLore.add(C.cGray + "temples hidden in Minecrafts worlds.");
heroicLore.add(" ");
if (heroicCount > 0)
heroicLore.add(ChatColor.RESET + "Click to open!");
heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
heroicLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
List<String> legendaryLore = new ArrayList<String>();
legendaryLore.add(" ");
legendaryLore.add(F.value("Legendary Chests Owned", "" + legendaryCount));
legendaryLore.add(F.value("Mythical Chests Owned", "" + legendaryCount));
legendaryLore.add(" ");
legendaryLore.add(C.cGray + "All our previous adventurers have");
legendaryLore.add(C.cGray + "perished in search of these chests.");
legendaryLore.add(C.cGray + "However, legends of their existence");
legendaryLore.add(C.cGray + "convinced Sterling, Chiss and Defek7");
legendaryLore.add(C.cGray + "to venture out and discover the");
legendaryLore.add(C.cGray + "location of these chests on their own.");
legendaryLore.add(" ");
if (legendaryCount > 0)
legendaryLore.add(ChatColor.RESET + "Click to open!");
legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
legendaryLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Basic Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Heroic Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Legendary Chest", legendaryLore.toArray(new String[0]), 0, false, false);
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.BASIC));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.HEROIC));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.LEGENDARY));
if (basicCount > 0)
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
else
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
}
}

View File

@ -84,6 +84,7 @@ import mineplex.minecraft.game.core.fire.Fire;
import nautilus.game.arcade.addons.CompassAddon;
import nautilus.game.arcade.addons.SoupAddon;
import nautilus.game.arcade.addons.TeamArmorAddon;
import nautilus.game.arcade.command.DisguiseCommand;
import nautilus.game.arcade.command.GameCommand;
import nautilus.game.arcade.command.WriteCommand;
import nautilus.game.arcade.command.YoutubeCommand;
@ -306,6 +307,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
addCommand(new GameCommand(this));
addCommand(new WriteCommand(this));
addCommand(new YoutubeCommand(this));
addCommand(new DisguiseCommand(this));
}
public GameServerConfig GetServerConfig()

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.command;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.ProfileLoader;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePlayer;
public class DisguiseCommand extends CommandBase<ArcadeManager>
{
public DisguiseCommand(ArcadeManager plugin)
{
super(plugin, Rank.OWNER, new Rank[] {Rank.OWNER}, "disguise");
}
@Override
public void Execute(final Player caller, final String[] args)
{
if (args.length == 0)
{
UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise <name>");
return;
}
Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.GetPlugin(), new Runnable()
{
@Override
public void run()
{
try
{
GameProfile profile = new ProfileLoader(UUIDFetcher.getUUIDOf(args[0]).toString(), args[0]).loadProfile();
DisguisePlayer playerDisguise = new DisguisePlayer(caller, profile);
Plugin.GetDisguise().disguise(playerDisguise);
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
}
catch (Exception e)
{
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
return;
}
}}
);
}
}

View File

@ -162,7 +162,7 @@ public class GameLootManager implements Listener
return false;
}
Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot);
Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true);
RewardData rewardData = reward.giveReward("GameLoot", player);