|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
package mineplex.game.clans.items.gear;
|
|
|
|
|
package mineplex.game.clans.items.ui;
|
|
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
@ -11,13 +11,14 @@ import org.bukkit.inventory.ItemStack;
|
|
|
|
|
import mineplex.core.account.CoreClientManager;
|
|
|
|
|
import mineplex.core.common.Pair;
|
|
|
|
|
import mineplex.core.common.util.C;
|
|
|
|
|
import mineplex.core.common.util.UtilMath;
|
|
|
|
|
import mineplex.core.donation.DonationManager;
|
|
|
|
|
import mineplex.core.shop.item.IButton;
|
|
|
|
|
import mineplex.core.shop.item.ShopItem;
|
|
|
|
|
import mineplex.core.shop.page.ShopPageBase;
|
|
|
|
|
import mineplex.game.clans.items.CustomItem;
|
|
|
|
|
import mineplex.game.clans.items.GearManager;
|
|
|
|
|
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.armor.ConqueringArmorAttribute;
|
|
|
|
|
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.JaggedAttribute;
|
|
|
|
|
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.GiantsBroadsword;
|
|
|
|
|
import mineplex.game.clans.items.legendaries.HyperBlade;
|
|
|
|
@ -52,8 +52,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
private int _stage = 0;
|
|
|
|
|
|
|
|
|
|
private ItemType _itemType;
|
|
|
|
|
private CustomItem _item;
|
|
|
|
|
private RareItemFactory _factory;
|
|
|
|
|
|
|
|
|
|
private final IButton _nextButton;
|
|
|
|
|
private final IButton _backButton;
|
|
|
|
@ -62,22 +61,22 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
private Class<? extends ItemAttribute> _prefix;
|
|
|
|
|
private Class<? extends ItemAttribute> _suffix;
|
|
|
|
|
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _armourSuperPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _armourPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _armourSuffixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _armourSuperPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _armourPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _armourSuffixes;
|
|
|
|
|
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _weaponSuperPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _weaponPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _weaponSuffixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _weaponSuperPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _weaponPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _weaponSuffixes;
|
|
|
|
|
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _bowSuperPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _bowPrefixes;
|
|
|
|
|
private Set<Class<? extends ItemAttribute>> _bowSuffixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _bowSuperPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _bowPrefixes;
|
|
|
|
|
private List<Class<? extends ItemAttribute>> _bowSuffixes;
|
|
|
|
|
|
|
|
|
|
private Set<Class<? extends LegendaryItem>> _legendaryItems;
|
|
|
|
|
private List<Class<? extends LegendaryItem>> _legendaryItems;
|
|
|
|
|
|
|
|
|
|
private Set<Material> _weaponTypes;
|
|
|
|
|
private Set<Material> _armourTypes;
|
|
|
|
|
private List<Material> _weaponTypes;
|
|
|
|
|
private List<Material> _armourTypes;
|
|
|
|
|
|
|
|
|
|
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>>()
|
|
|
|
|
{
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
_legendaryItems = Arrays.<Class<? extends LegendaryItem>> asList(AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperBlade.class, MagneticBlade.class);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
add(LavaAttribute.class);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
_armourSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(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>>()
|
|
|
|
|
{
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
_weaponSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(FlamingAttribute.class, FrostedAttribute.class);
|
|
|
|
|
_weaponPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(HeavyAttribute.class, JaggedAttribute.class, SharpAttribute.class);
|
|
|
|
|
_weaponSuffixes = Arrays.<Class<? extends ItemAttribute>> asList(ConqueringAttribute.class, HasteAttribute.class);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
add(PaddedAttribute.class);
|
|
|
|
|
add(ReinforcedAttribute.class);
|
|
|
|
|
add(SlantedAttribute.class);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
_bowSuperPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(LeechingAttribute.class, ScorchingAttribute.class);
|
|
|
|
|
_bowPrefixes = Arrays.<Class<? extends ItemAttribute>> asList(HeavyArrowsAttribute.class, HuntingAttribute.class, InverseAttribute.class, RecursiveAttribute.class);
|
|
|
|
|
_bowSuffixes = Arrays.<Class<? extends ItemAttribute>> asList(SlayingAttribute.class);
|
|
|
|
|
|
|
|
|
|
_armourSuffixes = new HashSet<Class<? extends ItemAttribute>>()
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
_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);
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
clearPage();
|
|
|
|
@ -327,7 +225,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
_itemType = ItemType.LEGENDARY;
|
|
|
|
|
_factory = RareItemFactory.begin(ItemType.LEGENDARY);
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_itemType = ItemType.WEAPON;
|
|
|
|
|
_factory = RareItemFactory.begin(ItemType.WEAPON);
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_itemType = ItemType.ARMOUR;
|
|
|
|
|
_factory = RareItemFactory.begin(ItemType.ARMOUR);
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_itemType = ItemType.BOW;
|
|
|
|
|
_factory = RareItemFactory.begin(ItemType.BOW);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
@ -385,21 +282,21 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
Material stageMaterial = null;
|
|
|
|
|
boolean _return = false;
|
|
|
|
|
|
|
|
|
|
if (_itemType == null)
|
|
|
|
|
if (_factory.getItemType() == null)
|
|
|
|
|
{
|
|
|
|
|
performBack();
|
|
|
|
|
return Triple.of(true, stageTitle, stageMaterial);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_itemType.equals(ItemType.LEGENDARY))
|
|
|
|
|
if (_factory.getItemType().equals(ItemType.LEGENDARY))
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
for (Class<? extends LegendaryItem> legendary : _legendaryItems)
|
|
|
|
|
for (final Class<? extends LegendaryItem> legendary : _legendaryItems)
|
|
|
|
|
{
|
|
|
|
|
final LegendaryItem item = legendary.newInstance();
|
|
|
|
|
|
|
|
|
@ -407,23 +304,23 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_item = item;
|
|
|
|
|
_factory.setLegendary(legendary);
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (_itemType)
|
|
|
|
|
switch (_factory.getItemType())
|
|
|
|
|
{
|
|
|
|
|
case WEAPON:
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Weapon Type";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_weaponTypes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_weaponTypes.size(), 2);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Material type : _weaponTypes)
|
|
|
|
@ -432,10 +329,10 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_item = new CustomItem(type);
|
|
|
|
|
_factory.setType(type);
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -444,7 +341,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Armour Type";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_armourTypes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_armourTypes.size(), 4);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Material type : _armourTypes)
|
|
|
|
@ -453,10 +350,10 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
_item = new CustomItem(type);
|
|
|
|
|
_factory.setType(type);
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -470,7 +367,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
* seperately, and ARMOUR, and WEAPON have their own cases.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
_item = new CustomItem(Material.BOW);
|
|
|
|
|
_factory.setType(Material.BOW);
|
|
|
|
|
_stage = 2;
|
|
|
|
|
buildPage();
|
|
|
|
|
_return = true;
|
|
|
|
@ -484,27 +381,27 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
String stageTitle;
|
|
|
|
|
|
|
|
|
|
if (_item == null)
|
|
|
|
|
if (_factory.getMaterial() == 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();
|
|
|
|
|
stageTitle = "The End";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (_itemType)
|
|
|
|
|
switch (_factory.getItemType())
|
|
|
|
|
{
|
|
|
|
|
case WEAPON:
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Super Prefix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_weaponSuperPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_weaponSuperPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _weaponSuperPrefixes)
|
|
|
|
@ -528,7 +425,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
case ARMOUR:
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Super Prefix";
|
|
|
|
|
int[] indices = getIndicesFor(_armourSuperPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_armourSuperPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _armourSuperPrefixes)
|
|
|
|
@ -553,7 +450,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Super Prefix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_bowSuperPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_bowSuperPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
stageTitle = "The End";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (_itemType)
|
|
|
|
|
switch (_factory.getItemType())
|
|
|
|
|
{
|
|
|
|
|
case WEAPON:
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Prefix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_weaponPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_weaponPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _weaponPrefixes)
|
|
|
|
@ -628,7 +525,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Prefix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_armourPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_armourPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _armourPrefixes)
|
|
|
|
@ -653,7 +550,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Prefix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_bowPrefixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_bowPrefixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
stageTitle = "The End";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (_itemType)
|
|
|
|
|
switch (_factory.getItemType())
|
|
|
|
|
{
|
|
|
|
|
case WEAPON:
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Suffix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_weaponSuffixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_weaponSuffixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _weaponSuffixes)
|
|
|
|
@ -728,7 +625,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Suffix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_armourSuffixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_armourSuffixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _armourSuffixes)
|
|
|
|
@ -752,7 +649,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
{
|
|
|
|
|
stageTitle = "Select Suffix";
|
|
|
|
|
|
|
|
|
|
int[] indices = getIndicesFor(_bowSuffixes.size());
|
|
|
|
|
int[] indices = getIndicesFor(_bowSuffixes.size(), 5);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (final Class<? extends ItemAttribute> attribute : _bowSuffixes)
|
|
|
|
@ -784,26 +681,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (_superPrefix != null)
|
|
|
|
|
{
|
|
|
|
|
_item.getAttributes().addAttribute(_superPrefix.newInstance());
|
|
|
|
|
}
|
|
|
|
|
_factory.setSuperPrefix(_superPrefix);
|
|
|
|
|
_factory.setPrefix(_prefix);
|
|
|
|
|
_factory.setSuffix(_suffix);
|
|
|
|
|
|
|
|
|
|
if (_prefix != null)
|
|
|
|
|
{
|
|
|
|
|
_item.getAttributes().addAttribute(_prefix.newInstance());
|
|
|
|
|
}
|
|
|
|
|
final ItemStack item = _factory.fabricate();
|
|
|
|
|
|
|
|
|
|
if (_suffix != null)
|
|
|
|
|
{
|
|
|
|
|
_item.getAttributes().addAttribute(_suffix.newInstance());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (InstantiationException | IllegalAccessException e)
|
|
|
|
|
{
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addButton(9 + 4, _item.toItemStack(), new IButton()
|
|
|
|
|
addButton(9 + 4, item, new IButton()
|
|
|
|
|
{
|
|
|
|
|
public void onClick(Player player, ClickType clickType)
|
|
|
|
|
{
|
|
|
|
|
player.getInventory().addItem(_item.toItemStack());
|
|
|
|
|
player.getInventory().addItem(item);
|
|
|
|
|
}
|
|
|
|
|
}, new String[] { C.cWhite + "Click to get item" });
|
|
|
|
|
}
|