Added RareItemFactory (will add shine when lib helps me with it) and other small little fixes. Added a way to specify the amount of items in a single line in GearPage, so that armor and weapon type listings look more aesthetically pleasing.
This commit is contained in:
parent
63406e9ce1
commit
eb350a79c3
@ -96,5 +96,20 @@ public class UtilMath
|
|||||||
return null;
|
return null;
|
||||||
return array[random.nextInt(array.length)];
|
return array[random.nextInt(array.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double clamp(double num, double min, double max)
|
||||||
|
{
|
||||||
|
return num < min ? min : (num > max ? max : num);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long clamp(long num, long min, long max)
|
||||||
|
{
|
||||||
|
return num < min ? min : (num > max ? max : num);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int clamp(int num, int min, int max)
|
||||||
|
{
|
||||||
|
return num < min ? min : (num > max ? max : num);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
|
||||||
|
|
||||||
import mineplex.core.FoodDupeFix;
|
import mineplex.core.FoodDupeFix;
|
||||||
import mineplex.core.TablistFix;
|
import mineplex.core.TablistFix;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -26,12 +24,9 @@ import mineplex.core.itemstack.ItemStackFactory;
|
|||||||
import mineplex.core.memory.MemoryFix;
|
import mineplex.core.memory.MemoryFix;
|
||||||
import mineplex.core.message.MessageManager;
|
import mineplex.core.message.MessageManager;
|
||||||
import mineplex.core.monitor.LagMeter;
|
import mineplex.core.monitor.LagMeter;
|
||||||
import mineplex.game.clans.clans.observer.ObserverManager;
|
|
||||||
import mineplex.game.clans.items.GearManager;
|
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.portal.Portal;
|
import mineplex.core.portal.Portal;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.core.profileCache.ProfileCacheManager;
|
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.serverConfig.ServerConfiguration;
|
import mineplex.core.serverConfig.ServerConfiguration;
|
||||||
@ -43,11 +38,14 @@ import mineplex.core.updater.FileUpdater;
|
|||||||
import mineplex.core.updater.Updater;
|
import mineplex.core.updater.Updater;
|
||||||
import mineplex.core.visibility.VisibilityManager;
|
import mineplex.core.visibility.VisibilityManager;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.items.GearManager;
|
||||||
|
import mineplex.game.clans.items.RareItemFactory;
|
||||||
import mineplex.game.clans.shop.building.BuildingShop;
|
import mineplex.game.clans.shop.building.BuildingShop;
|
||||||
import mineplex.game.clans.shop.farming.FarmingShop;
|
import mineplex.game.clans.shop.farming.FarmingShop;
|
||||||
import mineplex.game.clans.shop.mining.MiningShop;
|
import mineplex.game.clans.shop.mining.MiningShop;
|
||||||
import mineplex.game.clans.shop.pvp.PvpShop;
|
import mineplex.game.clans.shop.pvp.PvpShop;
|
||||||
import mineplex.game.clans.spawn.travel.TravelShop;
|
import mineplex.game.clans.spawn.travel.TravelShop;
|
||||||
|
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||||
|
|
||||||
public class Clans extends JavaPlugin
|
public class Clans extends JavaPlugin
|
||||||
{
|
{
|
||||||
@ -77,6 +75,7 @@ public class Clans extends JavaPlugin
|
|||||||
CommandCenter.Instance.setClientManager(_clientManager);
|
CommandCenter.Instance.setClientManager(_clientManager);
|
||||||
|
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
|
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this);
|
VisibilityManager.Initialize(this);
|
||||||
// new ProfileCacheManager(this);
|
// new ProfileCacheManager(this);
|
||||||
|
@ -52,7 +52,6 @@ import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
|||||||
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
||||||
import mineplex.game.clans.items.commands.GearCommand;
|
import mineplex.game.clans.items.commands.GearCommand;
|
||||||
import mineplex.game.clans.items.economy.GoldToken;
|
import mineplex.game.clans.items.economy.GoldToken;
|
||||||
import mineplex.game.clans.items.gear.GearShop;
|
|
||||||
import mineplex.game.clans.items.generation.Weight;
|
import mineplex.game.clans.items.generation.Weight;
|
||||||
import mineplex.game.clans.items.generation.WeightSet;
|
import mineplex.game.clans.items.generation.WeightSet;
|
||||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||||
@ -62,6 +61,7 @@ import mineplex.game.clans.items.legendaries.LegendaryItem;
|
|||||||
import mineplex.game.clans.items.legendaries.MagneticBlade;
|
import mineplex.game.clans.items.legendaries.MagneticBlade;
|
||||||
import mineplex.game.clans.items.legendaries.WindBlade;
|
import mineplex.game.clans.items.legendaries.WindBlade;
|
||||||
import mineplex.game.clans.items.smelting.SmeltingListener;
|
import mineplex.game.clans.items.smelting.SmeltingListener;
|
||||||
|
import mineplex.game.clans.items.ui.GearShop;
|
||||||
import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
|
import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_7_R4.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
|
||||||
|
@ -29,7 +29,7 @@ private static ValueDistribution knockbackGen = generateDistribution(-0.5d, 1.0d
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return String.format("Reverse knockback and modify amount to %.2f percent!", (1.0d + _knockbackModifier) * 100d);
|
return String.format("Reverse knockback and modify amount to %.2f percent", (1.0d + _knockbackModifier) * 100d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,7 +30,7 @@ public class LeechingAttribute extends ItemAttribute
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return String.format("Heal yourself for %d percentage of damage dealt to enemy players", _healPercent);
|
return String.format("Heal for %d percentage of damage dealt", _healPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,7 +26,7 @@ public class RecursiveAttribute extends DamageAttribute
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return String.format("Increase damage by %.2f half-hearts!", getBonusDamage());
|
return String.format("Increase damage by %.2f half-hearts", getBonusDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,7 @@ public class SlayingAttribute extends DamageAttribute
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return String.format("Increase damage by %.2f half-hearts against mobs & bosses!", getBonusDamage());
|
return String.format("Increase damage by %.2f half-hearts against mobs & bosses", getBonusDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,7 +12,7 @@ public class GearCommand extends CommandBase<GearManager>
|
|||||||
|
|
||||||
public GearCommand(GearManager plugin)
|
public GearCommand(GearManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, "gear", "custom-gear");
|
super(plugin, Rank.ALL, "gear", "custom-gear");
|
||||||
_gearManager = plugin;
|
_gearManager = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
|
||||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.game.clans.items.generation.ValueDistribution;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class AlligatorsTooth extends LegendaryItem
|
public class AlligatorsTooth extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class GiantsBroadsword extends LegendaryItem
|
public class GiantsBroadsword extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final int SLOW_AMPLIFIER = 4;
|
public static final int SLOW_AMPLIFIER = 4;
|
||||||
public static final int REGEN_AMPLIFIER = 1;
|
public static final int REGEN_AMPLIFIER = 1;
|
||||||
public static final int EFFECT_DURATION = 10; // Duration of potion effect (in ticks)
|
public static final int EFFECT_DURATION = 10; // Duration of potion effect (in ticks)
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.game.clans.items.generation.ValueDistribution;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class HyperBlade extends LegendaryItem
|
public class HyperBlade extends LegendaryItem
|
||||||
{
|
{
|
||||||
public static final long ATTACK_RATE_DURATION = 100;
|
public static final long ATTACK_RATE_DURATION = 100;
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class MagneticBlade extends LegendaryItem
|
public class MagneticBlade extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final double PULL_RANGE = 10d;
|
public static final double PULL_RANGE = 10d;
|
||||||
|
|
||||||
public MagneticBlade()
|
public MagneticBlade()
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
|
||||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
|
|
||||||
public class MeteorBow extends LegendaryItem
|
public class MeteorBow extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final int MAX_FLIGHT_TIME = 80; // Max flight of 80 ticks
|
public static final int MAX_FLIGHT_TIME = 80; // Max flight of 80 ticks
|
||||||
|
|
||||||
private long _flightTime; // Time (in ticks) since last touching ground and flying
|
private long _flightTime; // Time (in ticks) since last touching ground and flying
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
package mineplex.game.clans.items.legendaries;
|
package mineplex.game.clans.items.legendaries;
|
||||||
|
|
||||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
|
||||||
import mineplex.game.clans.items.generation.ValueDistribution;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class WindBlade extends LegendaryItem
|
public class WindBlade extends LegendaryItem
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final double FLIGHT_VELOCITY = 0.75d;
|
public static final double FLIGHT_VELOCITY = 0.75d;
|
||||||
public static final int MAX_FLIGHT_TIME = 80; // Max flight of 80 ticks
|
public static final int MAX_FLIGHT_TIME = 80; // Max flight of 80 ticks
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package mineplex.game.clans.items.gear;
|
package mineplex.game.clans.items.ui;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -11,13 +11,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.Pair;
|
import mineplex.core.common.Pair;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.items.CustomItem;
|
|
||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
import mineplex.game.clans.items.ItemType;
|
import mineplex.game.clans.items.ItemType;
|
||||||
|
import mineplex.game.clans.items.RareItemFactory;
|
||||||
import mineplex.game.clans.items.attributes.ItemAttribute;
|
import mineplex.game.clans.items.attributes.ItemAttribute;
|
||||||
import mineplex.game.clans.items.attributes.armor.ConqueringArmorAttribute;
|
import mineplex.game.clans.items.attributes.armor.ConqueringArmorAttribute;
|
||||||
import mineplex.game.clans.items.attributes.armor.LavaAttribute;
|
import mineplex.game.clans.items.attributes.armor.LavaAttribute;
|
||||||
@ -38,7 +39,6 @@ import mineplex.game.clans.items.attributes.weapon.HasteAttribute;
|
|||||||
import mineplex.game.clans.items.attributes.weapon.HeavyAttribute;
|
import mineplex.game.clans.items.attributes.weapon.HeavyAttribute;
|
||||||
import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
||||||
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
||||||
import mineplex.game.clans.items.attributes.weapon.VampiricAttribute;
|
|
||||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||||
import mineplex.game.clans.items.legendaries.HyperBlade;
|
import mineplex.game.clans.items.legendaries.HyperBlade;
|
||||||
@ -52,8 +52,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
private int _stage = 0;
|
private int _stage = 0;
|
||||||
|
|
||||||
private ItemType _itemType;
|
private RareItemFactory _factory;
|
||||||
private CustomItem _item;
|
|
||||||
|
|
||||||
private final IButton _nextButton;
|
private final IButton _nextButton;
|
||||||
private final IButton _backButton;
|
private final IButton _backButton;
|
||||||
@ -62,22 +61,22 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
private Class<? extends ItemAttribute> _prefix;
|
private Class<? extends ItemAttribute> _prefix;
|
||||||
private Class<? extends ItemAttribute> _suffix;
|
private Class<? extends ItemAttribute> _suffix;
|
||||||
|
|
||||||
private Set<Class<? extends ItemAttribute>> _armourSuperPrefixes;
|
private List<Class<? extends ItemAttribute>> _armourSuperPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _armourPrefixes;
|
private List<Class<? extends ItemAttribute>> _armourPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _armourSuffixes;
|
private List<Class<? extends ItemAttribute>> _armourSuffixes;
|
||||||
|
|
||||||
private Set<Class<? extends ItemAttribute>> _weaponSuperPrefixes;
|
private List<Class<? extends ItemAttribute>> _weaponSuperPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _weaponPrefixes;
|
private List<Class<? extends ItemAttribute>> _weaponPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _weaponSuffixes;
|
private List<Class<? extends ItemAttribute>> _weaponSuffixes;
|
||||||
|
|
||||||
private Set<Class<? extends ItemAttribute>> _bowSuperPrefixes;
|
private List<Class<? extends ItemAttribute>> _bowSuperPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _bowPrefixes;
|
private List<Class<? extends ItemAttribute>> _bowPrefixes;
|
||||||
private Set<Class<? extends ItemAttribute>> _bowSuffixes;
|
private List<Class<? extends ItemAttribute>> _bowSuffixes;
|
||||||
|
|
||||||
private Set<Class<? extends LegendaryItem>> _legendaryItems;
|
private List<Class<? extends LegendaryItem>> _legendaryItems;
|
||||||
|
|
||||||
private Set<Material> _weaponTypes;
|
private List<Material> _weaponTypes;
|
||||||
private Set<Material> _armourTypes;
|
private List<Material> _armourTypes;
|
||||||
|
|
||||||
public GearPage(final GearManager gearManager, final GearShop shop, final CoreClientManager clientManager, final DonationManager donationManager, final String name, final Player player)
|
public GearPage(final GearManager gearManager, final GearShop shop, final CoreClientManager clientManager, final DonationManager donationManager, final String name, final Player player)
|
||||||
{
|
{
|
||||||
@ -99,149 +98,48 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_armourSuperPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperBlade.class, MagneticBlade.class);
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
_armourSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LavaAttribute.class);
|
||||||
add(LavaAttribute.class);
|
_armourPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(PaddedAttribute.class, ReinforcedAttribute.class, SlantedAttribute.class);
|
||||||
}
|
_armourSuffixes = Arrays.<Class<? extends ItemAttribute>> asList(ConqueringArmorAttribute.class);
|
||||||
};
|
|
||||||
|
|
||||||
_armourPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
_weaponSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(FlamingAttribute.class, FrostedAttribute.class);
|
||||||
{
|
_weaponPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(HeavyAttribute.class, JaggedAttribute.class, SharpAttribute.class);
|
||||||
private static final long serialVersionUID = 1L;
|
_weaponSuffixes = Arrays.<Class<? extends ItemAttribute>> asList(ConqueringAttribute.class, HasteAttribute.class);
|
||||||
|
|
||||||
{
|
_bowSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LeechingAttribute.class, ScorchingAttribute.class);
|
||||||
add(PaddedAttribute.class);
|
_bowPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(HeavyArrowsAttribute.class, HuntingAttribute.class, InverseAttribute.class, RecursiveAttribute.class);
|
||||||
add(ReinforcedAttribute.class);
|
_bowSuffixes = Arrays.<Class<? extends ItemAttribute>> asList(SlayingAttribute.class);
|
||||||
add(SlantedAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_armourSuffixes = new HashSet<Class<? extends ItemAttribute>>()
|
_armourTypes = Arrays.asList(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS);
|
||||||
{
|
_weaponTypes = Arrays.asList(Material.DIAMOND_SWORD, Material.DIAMOND_AXE, Material.IRON_SWORD, Material.IRON_AXE, Material.GOLD_SWORD, Material.GOLD_AXE, Material.STONE_SWORD, Material.STONE_AXE);
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(ConqueringArmorAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_weaponSuperPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(FlamingAttribute.class);
|
|
||||||
add(FrostedAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_weaponPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(HeavyAttribute.class);
|
|
||||||
add(JaggedAttribute.class);
|
|
||||||
add(SharpAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_legendaryItems = new HashSet<Class<? extends LegendaryItem>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(AlligatorsTooth.class);
|
|
||||||
add(WindBlade.class);
|
|
||||||
add(GiantsBroadsword.class);
|
|
||||||
add(HyperBlade.class);
|
|
||||||
add(MagneticBlade.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_weaponSuffixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(ConqueringAttribute.class);
|
|
||||||
add(HasteAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_bowSuperPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(LeechingAttribute.class);
|
|
||||||
add(ScorchingAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_bowPrefixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(HeavyArrowsAttribute.class);
|
|
||||||
add(HuntingAttribute.class);
|
|
||||||
add(InverseAttribute.class);
|
|
||||||
add(RecursiveAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_bowSuffixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(SlayingAttribute.class);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_armourTypes = new HashSet<Material>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(Material.DIAMOND_HELMET);
|
|
||||||
add(Material.DIAMOND_CHESTPLATE);
|
|
||||||
add(Material.DIAMOND_LEGGINGS);
|
|
||||||
add(Material.DIAMOND_BOOTS);
|
|
||||||
add(Material.IRON_HELMET);
|
|
||||||
add(Material.IRON_CHESTPLATE);
|
|
||||||
add(Material.IRON_LEGGINGS);
|
|
||||||
add(Material.IRON_BOOTS);
|
|
||||||
add(Material.GOLD_HELMET);
|
|
||||||
add(Material.GOLD_CHESTPLATE);
|
|
||||||
add(Material.GOLD_LEGGINGS);
|
|
||||||
add(Material.GOLD_BOOTS);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_weaponTypes = new HashSet<Material>()
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
{
|
|
||||||
add(Material.DIAMOND_SWORD);
|
|
||||||
add(Material.IRON_SWORD);
|
|
||||||
add(Material.GOLD_SWORD);
|
|
||||||
add(Material.STONE_SWORD);
|
|
||||||
add(Material.DIAMOND_AXE);
|
|
||||||
add(Material.IRON_AXE);
|
|
||||||
add(Material.GOLD_AXE);
|
|
||||||
add(Material.STONE_AXE);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int[] getIndicesFor(int size, int itemsPerLine)
|
||||||
|
{
|
||||||
|
itemsPerLine = UtilMath.clamp(itemsPerLine, 1, 5);
|
||||||
|
|
||||||
|
int[] indices = new int[size];
|
||||||
|
|
||||||
|
int lines = (int) Math.ceil(size / ((double) itemsPerLine));
|
||||||
|
|
||||||
|
for (int ln = 0; ln < lines; ln++)
|
||||||
|
{
|
||||||
|
int items = ln == lines - 1 ? size - (ln * itemsPerLine) : itemsPerLine;
|
||||||
|
int start = 9 * ln - items + 14;
|
||||||
|
|
||||||
|
for (int item = 0; item < items; item++)
|
||||||
|
{
|
||||||
|
indices[(ln * itemsPerLine) + item] = start + (item * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indices;
|
||||||
|
}
|
||||||
|
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
clearPage();
|
clearPage();
|
||||||
@ -327,7 +225,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -344,37 +241,37 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_itemType = ItemType.LEGENDARY;
|
_factory = RareItemFactory.begin(ItemType.LEGENDARY);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { ItemType.LEGENDARY.equals(_itemType) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
}, new String[] { _factory != null && ItemType.LEGENDARY.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
|
|
||||||
addButton(9 + 3, Material.DIAMOND_AXE, 0, C.cDAqua + "Weapon", new IButton()
|
addButton(9 + 3, Material.DIAMOND_AXE, 0, C.cDAqua + "Weapon", new IButton()
|
||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_itemType = ItemType.WEAPON;
|
_factory = RareItemFactory.begin(ItemType.WEAPON);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { ItemType.WEAPON.equals(_itemType) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
}, new String[] { _factory != null && ItemType.WEAPON.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
|
|
||||||
addButton(9 + 5, Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armour", new IButton()
|
addButton(9 + 5, Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armour", new IButton()
|
||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_itemType = ItemType.ARMOUR;
|
_factory = RareItemFactory.begin(ItemType.ARMOUR);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { ItemType.ARMOUR.equals(_itemType) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
}, new String[] { _factory != null && ItemType.ARMOUR.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
|
|
||||||
addButton(9 + 7, Material.BOW, 0, C.cDGreen + "Bow", new IButton()
|
addButton(9 + 7, Material.BOW, 0, C.cDGreen + "Bow", new IButton()
|
||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_itemType = ItemType.BOW;
|
_factory = RareItemFactory.begin(ItemType.BOW);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { ItemType.BOW.equals(_itemType) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
}, new String[] { _factory != null && ItemType.BOW.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
|
|
||||||
return Pair.create(stageTitle, null);
|
return Pair.create(stageTitle, null);
|
||||||
}
|
}
|
||||||
@ -385,21 +282,21 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
Material stageMaterial = null;
|
Material stageMaterial = null;
|
||||||
boolean _return = false;
|
boolean _return = false;
|
||||||
|
|
||||||
if (_itemType == null)
|
if (_factory.getItemType() == null)
|
||||||
{
|
{
|
||||||
performBack();
|
performBack();
|
||||||
return Triple.of(true, stageTitle, stageMaterial);
|
return Triple.of(true, stageTitle, stageMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_itemType.equals(ItemType.LEGENDARY))
|
if (_factory.getItemType().equals(ItemType.LEGENDARY))
|
||||||
{
|
{
|
||||||
stageTitle = "2. Select Legendary Item";
|
stageTitle = "2. Select Legendary Item";
|
||||||
stageMaterial = _item == null ? stageMaterial : _item.toItemStack().getType();
|
stageMaterial = _factory.getMaterial() == null ? stageMaterial : _factory.getMaterial();
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_legendaryItems.size());
|
int[] indices = getIndicesFor(_legendaryItems.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Class<? extends LegendaryItem> legendary : _legendaryItems)
|
for (final Class<? extends LegendaryItem> legendary : _legendaryItems)
|
||||||
{
|
{
|
||||||
final LegendaryItem item = legendary.newInstance();
|
final LegendaryItem item = legendary.newInstance();
|
||||||
|
|
||||||
@ -407,23 +304,23 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_item = item;
|
_factory.setLegendary(legendary);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { C.cWhite + item.getDescription(), "", item.getDisplayName().equals(_item == null ? null : _item.getDisplayName()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
}, new String[] { C.cWhite + item.getDescription(), "", item.getDisplayName().equals(_factory.getWrapper() == null ? null : _factory.getWrapper().getDisplayName()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (_itemType)
|
switch (_factory.getItemType())
|
||||||
{
|
{
|
||||||
case WEAPON:
|
case WEAPON:
|
||||||
{
|
{
|
||||||
stageTitle = "Select Weapon Type";
|
stageTitle = "Select Weapon Type";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_weaponTypes.size());
|
int[] indices = getIndicesFor(_weaponTypes.size(), 2);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Material type : _weaponTypes)
|
for (final Material type : _weaponTypes)
|
||||||
@ -432,10 +329,10 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_item = new CustomItem(type);
|
_factory.setType(type);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { _item == null ? C.cRed + "Not Selected" : (_item.toItemStack().getType().equals(type) ? C.cGreen + "Selected" : C.cRed + "Not Selected") });
|
}, new String[] { type.equals(_factory.getMaterial()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -444,7 +341,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Armour Type";
|
stageTitle = "Select Armour Type";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_armourTypes.size());
|
int[] indices = getIndicesFor(_armourTypes.size(), 4);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Material type : _armourTypes)
|
for (final Material type : _armourTypes)
|
||||||
@ -453,10 +350,10 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
_item = new CustomItem(type);
|
_factory.setType(type);
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
}, new String[] { _item == null ? C.cRed + "Not Selected" : (_item.toItemStack().getType().equals(type) ? C.cGreen + "Selected" : C.cRed + "Not Selected") });
|
}, new String[] { type.equals(_factory.getMaterial()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -470,7 +367,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
* seperately, and ARMOUR, and WEAPON have their own cases.
|
* seperately, and ARMOUR, and WEAPON have their own cases.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_item = new CustomItem(Material.BOW);
|
_factory.setType(Material.BOW);
|
||||||
_stage = 2;
|
_stage = 2;
|
||||||
buildPage();
|
buildPage();
|
||||||
_return = true;
|
_return = true;
|
||||||
@ -484,27 +381,27 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
String stageTitle;
|
String stageTitle;
|
||||||
|
|
||||||
if (_item == null)
|
if (_factory.getMaterial() == null)
|
||||||
{
|
{
|
||||||
return Triple.of(true, null, null);
|
return Triple.of(true, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Material stageMaterial = _item.toItemStack().getType();
|
Material stageMaterial = _factory.getMaterial();
|
||||||
|
|
||||||
if (_item != null && _itemType.equals(ItemType.LEGENDARY))
|
if (_factory.getItemType().equals(ItemType.LEGENDARY))
|
||||||
{
|
{
|
||||||
finish();
|
finish();
|
||||||
stageTitle = "The End";
|
stageTitle = "The End";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (_itemType)
|
switch (_factory.getItemType())
|
||||||
{
|
{
|
||||||
case WEAPON:
|
case WEAPON:
|
||||||
{
|
{
|
||||||
stageTitle = "Select Super Prefix";
|
stageTitle = "Select Super Prefix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_weaponSuperPrefixes.size());
|
int[] indices = getIndicesFor(_weaponSuperPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _weaponSuperPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _weaponSuperPrefixes)
|
||||||
@ -528,7 +425,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
case ARMOUR:
|
case ARMOUR:
|
||||||
{
|
{
|
||||||
stageTitle = "Select Super Prefix";
|
stageTitle = "Select Super Prefix";
|
||||||
int[] indices = getIndicesFor(_armourSuperPrefixes.size());
|
int[] indices = getIndicesFor(_armourSuperPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _armourSuperPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _armourSuperPrefixes)
|
||||||
@ -553,7 +450,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Super Prefix";
|
stageTitle = "Select Super Prefix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_bowSuperPrefixes.size());
|
int[] indices = getIndicesFor(_bowSuperPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _bowSuperPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _bowSuperPrefixes)
|
||||||
@ -588,22 +485,22 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
private Pair<String, Material> doStageFour() throws InstantiationException, IllegalAccessException
|
private Pair<String, Material> doStageFour() throws InstantiationException, IllegalAccessException
|
||||||
{
|
{
|
||||||
String stageTitle;
|
String stageTitle;
|
||||||
Material stageMaterial = _item.toItemStack().getType();
|
Material stageMaterial = _factory.getMaterial();
|
||||||
|
|
||||||
if (_item != null && _itemType.equals(ItemType.LEGENDARY))
|
if (_factory.getItemType().equals(ItemType.LEGENDARY))
|
||||||
{
|
{
|
||||||
finish();
|
finish();
|
||||||
stageTitle = "The End";
|
stageTitle = "The End";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (_itemType)
|
switch (_factory.getItemType())
|
||||||
{
|
{
|
||||||
case WEAPON:
|
case WEAPON:
|
||||||
{
|
{
|
||||||
stageTitle = "Select Prefix";
|
stageTitle = "Select Prefix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_weaponPrefixes.size());
|
int[] indices = getIndicesFor(_weaponPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _weaponPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _weaponPrefixes)
|
||||||
@ -628,7 +525,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Prefix";
|
stageTitle = "Select Prefix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_armourPrefixes.size());
|
int[] indices = getIndicesFor(_armourPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _armourPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _armourPrefixes)
|
||||||
@ -653,7 +550,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Prefix";
|
stageTitle = "Select Prefix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_bowPrefixes.size());
|
int[] indices = getIndicesFor(_bowPrefixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _bowPrefixes)
|
for (final Class<? extends ItemAttribute> attribute : _bowPrefixes)
|
||||||
@ -688,22 +585,22 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
private Pair<String, Material> doStageFive() throws InstantiationException, IllegalAccessException
|
private Pair<String, Material> doStageFive() throws InstantiationException, IllegalAccessException
|
||||||
{
|
{
|
||||||
String stageTitle;
|
String stageTitle;
|
||||||
Material stageMaterial = _item.toItemStack().getType();
|
Material stageMaterial = _factory.getMaterial();
|
||||||
|
|
||||||
if (_item != null && _itemType.equals(ItemType.LEGENDARY))
|
if (_factory.getItemType().equals(ItemType.LEGENDARY))
|
||||||
{
|
{
|
||||||
finish();
|
finish();
|
||||||
stageTitle = "The End";
|
stageTitle = "The End";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (_itemType)
|
switch (_factory.getItemType())
|
||||||
{
|
{
|
||||||
case WEAPON:
|
case WEAPON:
|
||||||
{
|
{
|
||||||
stageTitle = "Select Suffix";
|
stageTitle = "Select Suffix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_weaponSuffixes.size());
|
int[] indices = getIndicesFor(_weaponSuffixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _weaponSuffixes)
|
for (final Class<? extends ItemAttribute> attribute : _weaponSuffixes)
|
||||||
@ -728,7 +625,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Suffix";
|
stageTitle = "Select Suffix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_armourSuffixes.size());
|
int[] indices = getIndicesFor(_armourSuffixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _armourSuffixes)
|
for (final Class<? extends ItemAttribute> attribute : _armourSuffixes)
|
||||||
@ -752,7 +649,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
stageTitle = "Select Suffix";
|
stageTitle = "Select Suffix";
|
||||||
|
|
||||||
int[] indices = getIndicesFor(_bowSuffixes.size());
|
int[] indices = getIndicesFor(_bowSuffixes.size(), 5);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final Class<? extends ItemAttribute> attribute : _bowSuffixes)
|
for (final Class<? extends ItemAttribute> attribute : _bowSuffixes)
|
||||||
@ -784,26 +681,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
return Pair.create(stageTitle, stageMaterial);
|
return Pair.create(stageTitle, stageMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] getIndicesFor(int size)
|
|
||||||
{
|
|
||||||
int[] indices = new int[size];
|
|
||||||
|
|
||||||
int lines = (int) Math.ceil(size / 5D);
|
|
||||||
|
|
||||||
for (int line = 0; line < lines; line++)
|
|
||||||
{
|
|
||||||
int itemsInLine = line == lines - 1 ? size - (line * 5) : 5;
|
|
||||||
int startingPoint = 9 + (line * 9) + (4 - (itemsInLine - 1));
|
|
||||||
|
|
||||||
for (int i = 0; i < itemsInLine; i++)
|
|
||||||
{
|
|
||||||
indices[line * 5 + i] = startingPoint + (i * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addButton(final int index, final Material type, final int data, final String name, final IButton ibutton, final String... description)
|
private void addButton(final int index, final Material type, final int data, final String name, final IButton ibutton, final String... description)
|
||||||
{
|
{
|
||||||
addButton(index, new ShopItem(type, (byte) data, name, description, 1, ibutton == null, false), ibutton);
|
addButton(index, new ShopItem(type, (byte) data, name, description, 1, ibutton == null, false), ibutton);
|
||||||
@ -827,33 +704,17 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|||||||
{
|
{
|
||||||
clearPage();
|
clearPage();
|
||||||
|
|
||||||
try
|
_factory.setSuperPrefix(_superPrefix);
|
||||||
{
|
_factory.setPrefix(_prefix);
|
||||||
if (_superPrefix != null)
|
_factory.setSuffix(_suffix);
|
||||||
{
|
|
||||||
_item.getAttributes().addAttribute(_superPrefix.newInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_prefix != null)
|
final ItemStack item = _factory.fabricate();
|
||||||
{
|
|
||||||
_item.getAttributes().addAttribute(_prefix.newInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_suffix != null)
|
addButton(9 + 4, item, new IButton()
|
||||||
{
|
|
||||||
_item.getAttributes().addAttribute(_suffix.newInstance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (InstantiationException | IllegalAccessException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(9 + 4, _item.toItemStack(), new IButton()
|
|
||||||
{
|
{
|
||||||
public void onClick(Player player, ClickType clickType)
|
public void onClick(Player player, ClickType clickType)
|
||||||
{
|
{
|
||||||
player.getInventory().addItem(_item.toItemStack());
|
player.getInventory().addItem(item);
|
||||||
}
|
}
|
||||||
}, new String[] { C.cWhite + "Click to get item" });
|
}, new String[] { C.cWhite + "Click to get item" });
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package mineplex.game.clans.items.gear;
|
package mineplex.game.clans.items.ui;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user