more set stuff

This commit is contained in:
Cheese 2015-12-11 20:30:41 +11:00
parent 0cda29e135
commit f717a5f8cc
7 changed files with 54 additions and 70 deletions

View File

@ -81,6 +81,23 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGray + gadget.getSet().getName() + " Set;");
//Elements
for (Gadget cur : gadget.getSet().getGadgets())
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen + '▪' : C.cDRed + '▪' ) + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
itemLore.add(C.cBlack);
//Bonus
itemLore.add(C.cGray + gadget.getSet().getName() + " Set Bonus;");
for (String bonus : gadget.getSet().getBonus())
itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus);
}
if (!gadget.ownsGadget(getPlayer()))
{
if (gadget.GetCost(CurrencyType.Coins) == -1)
@ -130,19 +147,6 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
else
{
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGray + gadget.getSet().getName() + " Set Cosmetics;");
for (Gadget cur : gadget.getSet().getGadgets())
{
itemLore.add(""+ (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
}
}
}
if (gadget instanceof ItemGadget)
{

View File

@ -57,8 +57,8 @@ public class ParticleFrostLord extends ParticleGadget
int amount = 4;
GadgetSet set = Manager.getGadgetSet(SetFrostLord.class);
if(set.isActive(player)) amount = 6;
if(getSet() != null && getSet().isActive(player))
amount = 6;
double ang = Math.PI*2/amount;

View File

@ -48,6 +48,10 @@ public class ParticleTitan extends ParticleGadget
continue;
double total = 3;
if(getSet() != null && getSet().isActive(player))
total = 4;
double step = (1/total)*Math.PI*2;
double offset1 = (step/20)*_tick%20;
double offset2 = (step/31)*_tick%31;

View File

@ -15,24 +15,10 @@ public class SetCandyCane extends GadgetSet
public SetCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane",
super(manager, "Candy Cane", "Coming Soon...",
manager.getGadget(ArrowTrailCandyCane.class),
manager.getGadget(DeathCandyCane.class),
manager.getGadget(DoubleJumpCandyCane.class),
manager.getGadget(ParticleCandyCane.class));
}
@Override
public void customEnable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Enabled full set of " + F.elem("Candy Cane")));
}
@Override
public void customDisable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Disabled full set of " + F.elem("Candy Cane")));
}
}

View File

@ -15,24 +15,10 @@ public class SetFrostLord extends GadgetSet
public SetFrostLord(GadgetManager manager)
{
super(manager, "Frost Lord",
super(manager, "Frost Lord", "Improved Wind of the Frost Lord",
manager.getGadget(ArrowTrailFrostLord.class),
manager.getGadget(DeathFrostLord.class),
manager.getGadget(DoubleJumpFrostLord.class),
manager.getGadget(ParticleFrostLord.class));
}
@Override
public void customEnable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Enabled full set of " + F.elem("Frost Lord")));
}
@Override
public void customDisable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Disabled full set of " + F.elem("Frost Lord")));
}
}

View File

@ -15,24 +15,10 @@ public class SetTitan extends GadgetSet
public SetTitan(GadgetManager manager)
{
super(manager, "The Titans",
super(manager, "The Titans", "Improved Flame of the Frost Lord",
manager.getGadget(ArrowTrailTitan.class),
manager.getGadget(DeathTitan.class),
manager.getGadget(DoubleJumpTitan.class),
manager.getGadget(ParticleTitan.class));
}
@Override
public void customEnable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Enabled full set of " + F.elem("Titan")));
}
@Override
public void customDisable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Disabled full set of " + F.elem("Titan")));
}
}

View File

@ -7,6 +7,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.GadgetDisableEvent;
@ -14,6 +18,7 @@ import mineplex.core.gadget.event.GadgetDisableEvent;
public abstract class GadgetSet implements Listener
{
private String _name;
private String[] _bonus;
private Gadget[] _gadgets;
@ -21,11 +26,13 @@ public abstract class GadgetSet implements Listener
HashSet<Player> _active = new HashSet<>();
public GadgetSet(GadgetManager manager, String name, Gadget... gadgets)
public GadgetSet(GadgetManager manager, String name, String bonus, Gadget... gadgets)
{
Manager = manager;
_gadgets = gadgets;
_name = name;
_bonus = UtilText.splitLineToArray(bonus, LineFormat.LORE);
for (Gadget gadget : gadgets)
gadget.setSet(this);
@ -44,7 +51,8 @@ public abstract class GadgetSet implements Listener
if(enable && g.equals(gadget)) continue;
_active.remove(player);
if(wasActive) customDisable(player);
if(wasActive)
customDisable(player);
return;
}
}
@ -72,10 +80,16 @@ public abstract class GadgetSet implements Listener
return _active.contains(player);
}
public abstract void customEnable(Player player);
public void customEnable(Player player)
{
player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName())));
}
public void customDisable(Player player)
{
player.sendMessage(F.main("Gadget", "Set Disabled: " + F.elem(C.cRed + getName())));
public abstract void customDisable(Player player);
}
public Gadget[] getGadgets()
{
@ -93,11 +107,15 @@ public abstract class GadgetSet implements Listener
return false;
}
public String getName() {
// TODO Auto-generated method stub
return null;
public String getName()
{
return _name;
}
public String[] getBonus()
{
return _bonus;
}
}