Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
32bbecd01a
@ -10,7 +10,7 @@
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<module name="Classpath.Dummy" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
|
@ -15,8 +15,8 @@
|
||||
<orderEntry type="module" module-name="Mineplex.Core.Common" />
|
||||
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class MorphBlaze extends MorphGadget
|
||||
C.cPurple + "Unlocked with Hero Rank",
|
||||
},
|
||||
-1,
|
||||
Material.FIRE, (byte)0);
|
||||
Material.BLAZE_POWDER, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,9 +13,9 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
|
||||
/**
|
||||
@ -214,14 +214,15 @@ public class Treasure
|
||||
ChestData data = getChestData(block);
|
||||
if (data != null && !data.isOpened())
|
||||
{
|
||||
data.setOpened(true);
|
||||
data.getReward().giveReward(_player);
|
||||
String text = data.getReward().giveReward(_player);
|
||||
|
||||
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data);
|
||||
data.setOpened(true);
|
||||
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, text);
|
||||
_animations.add(chestOpenTask);
|
||||
|
||||
if (isFinished())
|
||||
{
|
||||
// TODO figure out finish event
|
||||
System.out.println("finished");
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,16 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -29,10 +18,10 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
import mineplex.core.treasure.reward.rewards.GemReward;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -54,12 +43,18 @@ public class TreasureManager extends MiniPlugin
|
||||
_playerTreasureMap = new NautHashMap<Player, Treasure>();
|
||||
_rewardManager = new RewardManager();
|
||||
|
||||
// Very Rare
|
||||
_rewardManager.addReward(new GemReward(donationManager, 1000, 2000, 1000, RewardRarity.VERY_RARE));
|
||||
|
||||
// Rare
|
||||
_rewardManager.addReward(new GemReward(donationManager, 500, 1000, 1000, RewardRarity.RARE));
|
||||
|
||||
// Uncommon
|
||||
_rewardManager.addReward(new GemReward(donationManager, 100, 500, 1000, RewardRarity.UNCOMMON));
|
||||
|
||||
// Common
|
||||
_rewardManager.addReward(new GemReward(donationManager, 0, 100, 1000, RewardRarity.COMMON));
|
||||
|
||||
_rewardManager.addReward(new GemReward(_donationManager, 5));
|
||||
_rewardManager.addReward(new GemReward(_donationManager, 50));
|
||||
_rewardManager.addReward(new GemReward(_donationManager, 200));
|
||||
_rewardManager.addReward(new GemReward(_donationManager, 500));
|
||||
_rewardManager.addReward(new GemReward(_donationManager, 5000));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -22,14 +21,16 @@ import mineplex.core.treasure.Treasure;
|
||||
public class ChestOpenAnimation extends Animation
|
||||
{
|
||||
private ChestData _chestData;
|
||||
private String _text;
|
||||
|
||||
private Item _itemEntity;
|
||||
private SimpleHologram _hologram;
|
||||
|
||||
public ChestOpenAnimation(Treasure treasure, ChestData chestData)
|
||||
public ChestOpenAnimation(Treasure treasure, ChestData chestData, String text)
|
||||
{
|
||||
super(treasure);
|
||||
_chestData = chestData;
|
||||
_text = text;
|
||||
|
||||
// Send chest open packet
|
||||
Block block = chestData.getBlock();
|
||||
@ -53,7 +54,7 @@ public class ChestOpenAnimation extends Animation
|
||||
}
|
||||
else if (getTicks() == 15)
|
||||
{
|
||||
_hologram = new SimpleHologram(_chestData.getBlock().getLocation().add(0.5, 1.1, 0.5), _chestData.getReward().getText());
|
||||
_hologram = new SimpleHologram(_chestData.getBlock().getLocation().add(0.5, 1.1, 0.5), _text);
|
||||
_hologram.spawnWithPackets();
|
||||
|
||||
_chestData.setFinishedOpen(true);
|
||||
|
@ -8,13 +8,22 @@ import org.bukkit.inventory.ItemStack;
|
||||
*/
|
||||
public interface ITreasureReward
|
||||
{
|
||||
public String getText();
|
||||
|
||||
public ItemStack getItem();
|
||||
|
||||
public RewardRarity getRarity();
|
||||
|
||||
public void giveReward(Player player);
|
||||
/**
|
||||
* Give the reward to the player.
|
||||
*
|
||||
* @return String detailing the reward. This will be shown to the player
|
||||
*/
|
||||
public String giveReward(Player player);
|
||||
|
||||
public boolean canGiveReward(Player player);
|
||||
|
||||
/**
|
||||
* This is used to weight rewards across different rarities. Rewards with a larger weight
|
||||
* will have a higher chance of being selected
|
||||
*/
|
||||
public int getWeight();
|
||||
}
|
||||
|
@ -37,12 +37,6 @@ public class RewardManager
|
||||
|
||||
public ITreasureReward nextReward(Player player)
|
||||
{
|
||||
/*
|
||||
This is potentially blocking, need to make sure each RewardRarity has at least one reward that
|
||||
players can recieve no matter what. May need to touch on this later.
|
||||
*/
|
||||
//todo
|
||||
|
||||
double rand = _random.nextDouble();
|
||||
RewardRarity rarity;
|
||||
|
||||
@ -69,15 +63,34 @@ public class RewardManager
|
||||
|
||||
|
||||
List<ITreasureReward> treasureList = _treasureMap.get(rarity);
|
||||
ITreasureReward reward;
|
||||
|
||||
do
|
||||
int totalWeight = 0;
|
||||
ArrayList<ITreasureReward> possibleRewards = new ArrayList<ITreasureReward>();
|
||||
for (ITreasureReward treasure : treasureList)
|
||||
{
|
||||
reward = treasureList.get(_random.nextInt(treasureList.size()));
|
||||
if (treasure.canGiveReward(player))
|
||||
{
|
||||
possibleRewards.add(treasure);
|
||||
totalWeight += treasure.getWeight();
|
||||
}
|
||||
}
|
||||
while (!reward.canGiveReward(player));
|
||||
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
int weight = _random.nextInt(totalWeight);
|
||||
int currentWeight = 0;
|
||||
|
||||
for (ITreasureReward reward : possibleRewards)
|
||||
{
|
||||
if (weight <= currentWeight)
|
||||
return reward;
|
||||
|
||||
weight += reward.getWeight();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
public abstract class AbstractReward implements ITreasureReward
|
||||
{
|
||||
protected static final Random RANDOM = new Random();
|
||||
|
||||
private ItemStack _itemStack;
|
||||
private RewardRarity _rarity;
|
||||
private int _weight;
|
||||
|
||||
public AbstractReward(ItemStack itemStack, RewardRarity rarity, int weight)
|
||||
{
|
||||
_itemStack = itemStack;
|
||||
_rarity = rarity;
|
||||
_weight = weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return _itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight()
|
||||
{
|
||||
return _weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return _rarity;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-08.
|
||||
*/
|
||||
public class CoinReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private Random _random;
|
||||
private int _minCoinCount;
|
||||
private int _maxCoinCount;
|
||||
|
||||
public CoinReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
|
||||
{
|
||||
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
|
||||
}
|
||||
|
||||
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity, Random random)
|
||||
{
|
||||
super(new ItemStack(Material.EMERALD), rarity, weight);
|
||||
_donationManager = donationManager;
|
||||
_minCoinCount = minCoinCount;
|
||||
_maxCoinCount = maxCoinCount;
|
||||
|
||||
_random = random;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
int gemsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
||||
|
||||
_donationManager.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
|
||||
}
|
||||
}, "Treasure Chest", player.getName(), gemsToReward);
|
||||
|
||||
return C.cYellow + gemsToReward + " Coins";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/2/2014.
|
||||
*/
|
||||
public class ExampleReward implements ITreasureReward
|
||||
{
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return C.cGreen + "100 Gems";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(Material.EMERALD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return RewardRarity.COMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveReward(Player player)
|
||||
{
|
||||
player.sendMessage("give example reward...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGiveReward(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -3,49 +3,31 @@ package mineplex.core.treasure.reward.rewards;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class GadgetReward implements ITreasureReward
|
||||
public class GadgetReward extends AbstractReward
|
||||
{
|
||||
private Gadget _gadget;
|
||||
private DonationManager _donationManager;
|
||||
private Gadget _gadget;
|
||||
|
||||
public GadgetReward(Gadget gadget, DonationManager donationManager)
|
||||
public GadgetReward(Gadget gadget, DonationManager donationManager, RewardRarity rarity, int weight)
|
||||
{
|
||||
super(new ItemStack(gadget.GetDisplayMaterial()), rarity, weight);
|
||||
_gadget = gadget;
|
||||
_donationManager = donationManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return _gadget.GetDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(_gadget.GetDisplayMaterial());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return RewardRarity.VERY_RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveReward(Player player)
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
_donationManager.Get(player.getName()).AddUnknownSalesPackagesOwned(_gadget.GetName());
|
||||
|
||||
return _gadget.GetDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,4 +35,5 @@ public class GadgetReward implements ITreasureReward
|
||||
{
|
||||
return !(_donationManager.Get(player.getName()).OwnsUnknownPackage(_gadget.GetName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.treasure.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -7,47 +9,38 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.treasure.reward.ITreasureReward;
|
||||
import mineplex.core.treasure.reward.RewardRarity;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
public class GemReward implements ITreasureReward
|
||||
public class GemReward extends AbstractReward
|
||||
{
|
||||
private DonationManager _donationManager;
|
||||
private ItemStack _itemStack;
|
||||
private int _gemAmount;
|
||||
private Random _random;
|
||||
private int _minGemCount;
|
||||
private int _maxGemCount;
|
||||
|
||||
public GemReward(DonationManager donationManager, int gemAmount)
|
||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
|
||||
{
|
||||
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
|
||||
}
|
||||
|
||||
public GemReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity, Random random)
|
||||
{
|
||||
super(new ItemStack(Material.EMERALD), rarity, weight);
|
||||
_donationManager = donationManager;
|
||||
_gemAmount = gemAmount;
|
||||
_minGemCount = minGemCount;
|
||||
_maxGemCount = maxGemCount;
|
||||
|
||||
_itemStack = new ItemStack(Material.EMERALD);
|
||||
_random = random;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
public String giveReward(Player player)
|
||||
{
|
||||
return C.cGreen + _gemAmount + " Gems";
|
||||
}
|
||||
int gemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount;
|
||||
|
||||
@Override
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return _itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RewardRarity getRarity()
|
||||
{
|
||||
return RewardRarity.COMMON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveReward(Player player)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
@ -55,7 +48,9 @@ public class GemReward implements ITreasureReward
|
||||
{
|
||||
|
||||
}
|
||||
}, "Treasure Chest", player.getName(), _gemAmount);
|
||||
}, "Treasure Chest", player.getName(), gemsToReward);
|
||||
|
||||
return C.cGreen + gemsToReward + " Gems";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,4 +58,5 @@ public class GemReward implements ITreasureReward
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database.tables;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = -2050960225;
|
||||
private static final long serialVersionUID = 1795216465;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account.tournamentLeaderboard</code>
|
||||
@ -57,9 +57,9 @@ public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.data
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Integer> total = createField("total", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* The column <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> ratio = createField("ratio", org.jooq.impl.SQLDataType.FLOAT, this, "");
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> score = createField("score", org.jooq.impl.SQLDataType.DOUBLE, this, "");
|
||||
|
||||
/**
|
||||
* Create a <code>Account.tournamentLeaderboard</code> table reference
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database.tables.records;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Double> {
|
||||
|
||||
private static final long serialVersionUID = -1193236965;
|
||||
private static final long serialVersionUID = 1130073862;
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.id</code>.
|
||||
@ -98,16 +98,16 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Setter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public void setRatio(java.lang.Double value) {
|
||||
public void setScore(java.lang.Double value) {
|
||||
setValue(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Getter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public java.lang.Double getRatio() {
|
||||
public java.lang.Double getScore() {
|
||||
return (java.lang.Double) getValue(6);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Double> field7() {
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.ratio;
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.score;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,7 +252,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Double value7() {
|
||||
return getRatio();
|
||||
return getScore();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,7 +314,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public TournamentLeaderboard value7(java.lang.Double value) {
|
||||
setRatio(value);
|
||||
setScore(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
/**
|
||||
* Create a detached, initialised TournamentLeaderboard
|
||||
*/
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double ratio) {
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double score) {
|
||||
super(mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard);
|
||||
|
||||
setValue(0, id);
|
||||
@ -349,6 +349,6 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
setValue(3, gameId);
|
||||
setValue(4, wins);
|
||||
setValue(5, total);
|
||||
setValue(6, ratio);
|
||||
setValue(6, score);
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class Immolate extends Skill
|
||||
int level = getLevel(cur);
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
fire.setVelocity(new Vector((Math.random() - 0.5)/3,Math.random()/3,(Math.random() - 0.5)/3));
|
||||
Factory.Fire().Add(fire, cur, 2, 0, 0.25 + (level * 0.25), 0, GetName());
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class Inferno extends SkillActive
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), 1, GetName());
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -121,7 +121,7 @@ public class NapalmShot extends SkillActive
|
||||
|
||||
for (int i = 0 ; i < 8 + (8 * level) ; i++)
|
||||
{
|
||||
Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE, 1));
|
||||
Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, 1));
|
||||
Factory.Fire().Add(fire, damager, 16, 0.25, 2, 0, GetName());
|
||||
fire.setVelocity(fire.getVelocity().multiply(1 + (0.15 * level)));
|
||||
}
|
||||
|
@ -105,13 +105,13 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(slot + 18, new ShopItem(Material.ANVIL, "Edit Build", new String[] { }, 1, locked, true), new EditAndSaveCustomBuildButton(this, customBuild));
|
||||
AddButton(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true), new DeleteCustomBuildButton(this, customBuild));
|
||||
AddButton(slot + 36, new ShopItem(Material.TNT, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true), new DeleteCustomBuildButton(this, customBuild));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getInventory().setItem(slot + 18, new ShopItem(Material.ANVIL, "Edit Build", new String[] { }, 1, locked, true).getHandle());
|
||||
getInventory().setItem(slot + 36, new ShopItem(Material.FIRE, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true).getHandle());
|
||||
getInventory().setItem(slot + 36, new ShopItem(Material.TNT, "Delete Build", new String[] { "§rIt will never come back..."}, 1, locked, true).getHandle());
|
||||
}
|
||||
|
||||
slot += 2;
|
||||
|
@ -127,7 +127,7 @@ public abstract class SoloGame extends Game
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
{
|
||||
if (GetPlayers(true).size() <= 1)
|
||||
if (GetState().ordinal() >= GameState.End.ordinal())
|
||||
{
|
||||
List<Player> places = _players.GetPlacements(true);
|
||||
|
||||
|
@ -413,7 +413,7 @@ public class Halloween extends SoloGame
|
||||
{
|
||||
Material type = event.getEntity().getItemStack().getType();
|
||||
|
||||
if (type == Material.DIAMOND_AXE || type == Material.FIRE || type == Material.SNOW_BALL)
|
||||
if (type == Material.DIAMOND_AXE || type == Material.BLAZE_POWDER || type == Material.SNOW_BALL)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
@ -146,7 +146,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
return;
|
||||
|
||||
//Effect
|
||||
Host.Manager.GetBlood().Effects(event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.FIRE, (byte)0, 10, false);
|
||||
Host.Manager.GetBlood().Effects(event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.BLAZE_POWDER, (byte)0, 10, false);
|
||||
event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 51);
|
||||
|
||||
//Remove
|
||||
|
@ -58,7 +58,6 @@ public class Armor extends StrikeItem
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class AWP extends Gun
|
||||
10, 3, //Clip Size, Spare Ammo
|
||||
1500, 3600, //ROF, Reload Time
|
||||
115, 0, 0.97, //Damage, Dropoff, Armor Penetration
|
||||
0.1, 0.1, //COF Min, COF Max
|
||||
0.14, 0.14, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_SPADE, Sound.DRINK);
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class KitSkeletalHorse extends SmashKit
|
||||
}));
|
||||
|
||||
if (Manager.GetGame().GetState() == GameState.Recruit)
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FIRE, (byte)0, 1,
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infernal Horror",
|
||||
new String[]
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ public class PerkBoneRush extends Perk implements IThrown
|
||||
}
|
||||
else
|
||||
{
|
||||
Item fire = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.FIRE));
|
||||
Item fire = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BLAZE_POWDER));
|
||||
UtilAction.velocity(fire, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false);
|
||||
Manager.GetProjectile().AddThrow(fire, player, this, -1, true, true, true, false, 1d);
|
||||
}
|
||||
@ -169,7 +169,7 @@ public class PerkBoneRush extends Perk implements IThrown
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
boolean burning = ((Item)data.GetThrown()).getItemStack().getType() == Material.FIRE;
|
||||
boolean burning = ((Item)data.GetThrown()).getItemStack().getType() == Material.BLAZE_POWDER;
|
||||
|
||||
data.GetThrown().remove();
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class PerkFlamingSword extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -100,7 +100,7 @@ public class PerkInferno extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -85,7 +85,7 @@ public class PerkInfernoFinn extends Perk
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 2, 2, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
|
@ -53,7 +53,7 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
|
||||
{
|
||||
Arrow arrow = (Arrow) edbee.getDamager();
|
||||
|
||||
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64)
|
||||
if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) >= 64 * 64)
|
||||
addStat(killer, "TheLongestShot", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
125
Webpages/leaderboard.php
Normal file
125
Webpages/leaderboard.php
Normal file
@ -0,0 +1,125 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The Fall Invitational Leaderboard</title>
|
||||
<meta http-equiv="refresh" content="30">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<style type="text/css">
|
||||
.table td.center, .table th.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
text-align: center;
|
||||
font-size: 18pt;
|
||||
font-weight: bold;
|
||||
color: orange!important;
|
||||
background-color: #333!important;
|
||||
border-color: #333!important;
|
||||
}
|
||||
|
||||
.panel-primary {
|
||||
border-color: #333!important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="jumbotron" style="text-align: center">
|
||||
<div class="container" style="text-align: center">
|
||||
<img src="mineplex.png" alt="Mineplex"/>
|
||||
<h1>The Fall Invitational</h1>
|
||||
<h2>Tournament Leaderboard</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
$tournamentTypes = array('Super Smash Mobs', 'Survival Games', 'Mixed Arcade');
|
||||
|
||||
$con = mysqli_connect('db.mineplex.com', 'root', 'tAbechAk3wR7tuTh', 'Account');
|
||||
|
||||
for ($i = 0; $i < count($tournamentTypes); $i++)
|
||||
{
|
||||
?>
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><?php echo $tournamentTypes[$i] ?></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 40%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<tr>
|
||||
<th class="center">Rank</th>
|
||||
<th>Player</th>
|
||||
<th class="center">Wins</th>
|
||||
<th class="center">Losses</th>
|
||||
<th class="center">Score*</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$query = <<<QUERY
|
||||
SELECT name, wins, total, score
|
||||
FROM tournamentLeaderboard
|
||||
JOIN accounts ON accounts.id = accountId
|
||||
WHERE tournamentId = 0
|
||||
AND gameId = $i
|
||||
AND score IS NOT NULL
|
||||
ORDER BY score DESC, name ASC
|
||||
LIMIT 50;
|
||||
QUERY;
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
$index = 1;
|
||||
$rank = 1;
|
||||
$lastScore = null;
|
||||
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
$score = $row['score'];
|
||||
|
||||
if ($score != $lastScore)
|
||||
{
|
||||
$rank = $index;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="center"><?php echo $rank ?></td>
|
||||
<td><?php echo $row['name'] ?></td>
|
||||
<td class="center"><?php echo $row['wins'] ?></td>
|
||||
<td class="center"><?php echo ($row['total'] - $row['wins']) ?></td>
|
||||
<td class="center"><?php echo round($score*100, 3) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$index++;
|
||||
$lastScore = $score;
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<p style="text-align: center; font-style: italic">*Score = 100 × Wins × (Wins / Total)<sup>3</sup></p>
|
||||
<hr/>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user