Progress on Upgrade Details

This commit is contained in:
Sam 2016-08-13 22:40:33 +01:00
parent 60a46c8c10
commit 8f4303cf39
16 changed files with 299 additions and 170 deletions

View File

@ -1,18 +1,18 @@
package mineplex.core.progression;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.math.Calculations;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.progression.math.Calculations;
/**
* The API class all kits with the new system must use
*/
@ -50,11 +50,10 @@ public interface ProgressiveKit
/**
* This method gives the GUI information to display about the kit's upgrades and what they do
* This information is being directly displayed in a GUI, so make sure it looks good
* For more information, see the {@link KitAbilityDetail} class
*
* @return The map of upgrades and their details
* @return The map of upgrade level to a list of upgrade details
*/
Map<Integer, List<KitAbilityDetail>> getAbilityDetails();
Map<Integer, List<String>> getUpgradeDetails();
/**
* Determines whether or not the kit UI is displayed with "Coming Soon" or actual upgrade details.

View File

@ -1,38 +0,0 @@
package mineplex.core.progression.data;
import org.bukkit.Material;
/**
* General wrapper for Ability Details (The display properties of this kits Abilities) for a GUI
* The purpose is to limit the amount of hard coded data Kit's do and make it as flexible as possible.
*/
public class KitAbilityDetail
{
private Material _icon;
private String _displayName;
private String[] _description;
public KitAbilityDetail(Material icon, String displayName, String[] description)
{
_icon = icon;
_displayName = displayName;
_description = description;
}
public String getDisplayName()
{
return _displayName;
}
public Material getIcon()
{
return _icon;
}
public String[] getDescription()
{
return _description;
}
}

View File

@ -16,13 +16,11 @@ public class KitUpgradeButton extends KitButton
{
private int _upgradeLevel;
private String _upggradeName;
public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel, String upggradeName)
public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel)
{
super(kit, itemStack);
_upgradeLevel = upgradeLevel;
_upggradeName = upggradeName;
}
@Override
@ -30,7 +28,7 @@ public class KitUpgradeButton extends KitButton
{
UUID uuid = player.getUniqueId();
if (!getKit().canPurchaseUpgrade(uuid, _upgradeLevel))
if (!getKit().canPurchaseUpgrade(uuid, _upgradeLevel) || getKit().ownsUpgrade(uuid, _upgradeLevel))
{
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 10.0F, 1.0F);
player.sendMessage(F.main("Kit Progression", "You cannot purchase this upgrade!"));
@ -41,7 +39,7 @@ public class KitUpgradeButton extends KitButton
player.playSound(player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f);
player.sendMessage(F.main("Kit Progression", "Purchased " + _upggradeName));
player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + getKit().getDisplayName() + " level " + _upgradeLevel));
Menu.remove(uuid);

View File

@ -9,18 +9,17 @@ import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.gui.buttons.misc.IconButton;
/**
* Representing this kits Abilities in a GUI
*/
public class KitAbilityButton extends IconButton
public class KitUpgradeDetailsButton extends IconButton
{
private ItemStack _item;
public KitAbilityButton(int level, List<KitAbilityDetail> details)
public KitUpgradeDetailsButton(int level, List<String> details)
{
super(null);
@ -30,17 +29,11 @@ public class KitAbilityButton extends IconButton
List<String> lore = Lists.newArrayList(" ");
for (KitAbilityDetail detail : details)
{
lore.add(C.cYellow + detail.getDisplayName());
for (String loreLine : detail.getDescription())
{
lore.add(C.cGray + loreLine);
}
lore.add(" ");
for (String detail : details)
{
lore.add(C.cGray + detail);
}
builder.setLore(lore.toArray(new String[lore.size()]));
_item = builder.build();

View File

@ -1,9 +1,8 @@
package mineplex.core.progression.gui.guis;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.gui.Button;
import mineplex.core.progression.gui.buttons.KitAbilityButton;
import mineplex.core.progression.gui.buttons.KitUpgradeDetailsButton;
import mineplex.core.progression.gui.buttons.KitIconButton;
import mineplex.core.progression.gui.buttons.KitPermanentDefaultButton;
import mineplex.core.progression.gui.buttons.KitSelectButton;
@ -79,7 +78,6 @@ public class KitDisplayMenu extends KitMenu
/**
* Set up the details (info) regarding the upgrades to this kit
* Lines commented out due to waiting to release upgrades
*
* @param buttons The array of buttons we're modifying
*/
@ -87,11 +85,11 @@ public class KitDisplayMenu extends KitMenu
{
if(getKit().showUpgrades())
{
Map<Integer, List<KitAbilityDetail>> details = getKit().getAbilityDetails();
int index = 1;
Map<Integer, List<String>> details = getKit().getUpgradeDetails();
int index = 0;
for(int i : UPGRADE_SLOTS)
{
buttons[i] = new KitAbilityButton(index, details.get(index++));
buttons[i] = new KitUpgradeDetailsButton(index + 1, details.get(index++));
}
return;
}

View File

@ -4,11 +4,9 @@ import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.gui.Button;
import mineplex.core.progression.gui.buttons.KitAbilityButton;
import mineplex.core.progression.gui.buttons.KitUpgradeDetailsButton;
import mineplex.core.progression.gui.buttons.KitUpgradeButton;
import mineplex.core.progression.gui.buttons.KitUpgradeMenuButton;
import mineplex.core.progression.gui.buttons.misc.BackButton;
import mineplex.core.progression.gui.buttons.misc.IconButton;
import mineplex.core.progression.math.Calculations;
@ -142,7 +140,7 @@ public class KitInformationTrackerMenu extends KitMenu
}
/**
* Set up the row of Dyes / Music discs symbolizing the players upgrade advancement
* Set up the row of items symbolizing the players upgrade advancement
*
* @param buttons The array of buttons we're modifying
* @param player The player whose data we'll be using
@ -151,26 +149,31 @@ public class KitInformationTrackerMenu extends KitMenu
{
if(getKit().showUpgrades())
{
int upgradeLevel = getKit().getUpgradeLevel(player.getUniqueId());
Map<Integer, List<KitAbilityDetail>> details = getKit().getAbilityDetails();
// List<KitAbilityDetail> list = details.get(upgradeLevel);
// if(list == null)
// {
// throw new IllegalArgumentException("No upgrades for player upgrade level " + upgradeLevel);
// }
int index = 1;
Map<Integer, List<String>> details = getKit().getUpgradeDetails();
int index = 0;
for(int i : UPGRADE_SLOTS)
{
// KitAbilityDetail detail = list.get(index++);
// ItemBuilder itemStack = new ItemBuilder(detail.getIcon()).setTitle(C.cYellow + detail.getDisplayName()).setLore(getKit().getDescription());
// if(getKit().canPurchaseUpgrade(player.getUniqueId(), upgradeLevel) && !getKit().ownsUpgrade(player.getUniqueId(), upgradeLevel))
// {
// itemStack.setGlow(true);
// }
// KitUpgradeButton button = new KitUpgradeButton(getKit(), itemStack.build(), upgradeLevel, detail.getDisplayName());
// buttons[i] = button;
List<String> list = details.get(index++);
KitUpgradeDetailsButton detailsButton = new KitUpgradeDetailsButton(index, list);
ItemBuilder itemStack = new ItemBuilder(detailsButton.getItemStack());
buttons[i] = new KitUpgradeButton(getKit(), new ItemBuilder(new KitAbilityButton(index, details.get(index)).getItemStack()).addLore(getKit().canPurchaseUpgrade(player.getUniqueId(), index) ? C.cGreen + "Click to purcahse this upgrade" : C.cRed + "You cannot purcahse this upgrade").build(), index++, getKit().getDisplayName() + " upgrade " + upgradeLevel);
if (getKit().ownsUpgrade(player.getUniqueId(), index))
{
itemStack.addLore("", C.cRed + "You already own this upgrade!");
}
else if (getKit().canPurchaseUpgrade(player.getUniqueId(), index) && Calculations.getNextUpgradeLevel(index) < getKit().getLevel(player.getUniqueId()))
{
itemStack.setGlow(true);
itemStack.addLore("", C.cGreen + "Click to purchase this upgrade!");
}
else
{
itemStack.addLore("", C.cRed + "You cannot purcahse this upgrade!");
}
KitUpgradeButton upgradeButton = new KitUpgradeButton(getKit(), itemStack.build(), index);
buttons[i] = upgradeButton;
}
return;
}

View File

@ -186,7 +186,6 @@ public class Calculations
return 100;
}
@SuppressWarnings("Duplicates")
public static int getLevelRequiredFor(int upgradeLevel)
{
switch (upgradeLevel)

View File

@ -54,6 +54,25 @@ public class KitAir extends ProgressingKit
new PerkDoubleJump(DOUBLE_JUMP, 1.2, 1, true, 27000, true)
},
};
private static final String[][] UPGRADE_DETAILS =
{
{
reduceCooldown(DOUBLE_JUMP, 1)
},
{
increase(DOUBLE_JUMP, "Range", 10)
},
{
reduceCooldown(DOUBLE_JUMP, 1)
},
{
increase(DOUBLE_JUMP, "Range", 10)
},
{
reduceCooldown(DOUBLE_JUMP, 1)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build() };
@ -61,7 +80,7 @@ public class KitAir extends ProgressingKit
public KitAir(ArcadeManager manager)
{
super(manager, "Air", "skywarsair", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
super(manager, "Air", "skywarsair", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -25,6 +25,9 @@ public class KitEarth extends ProgressingKit
"You take less knockback whlie on the ground."
};
private static final String DIRT_CANNON = "Throwable Dirt";
private static final String KNOCKBACK = "Knockback";
private static final Perk[][] PERKS =
{
{
@ -32,26 +35,45 @@ public class KitEarth extends ProgressingKit
new PerkKnockback(0.25, true)
},
{
new PerkDirtCannon(2.25),
new PerkDirtCannon(2.2),
new PerkKnockback(0.25, true)
},
{
new PerkDirtCannon(2.5),
new PerkDirtCannon(2.4),
new PerkKnockback(0.25, true)
},
{
new PerkDirtCannon(2.75),
new PerkDirtCannon(2.6),
new PerkKnockback(0.25, true)
},
{
new PerkDirtCannon(3),
new PerkDirtCannon(2.8),
new PerkKnockback(0.25, true)
},
{
new PerkDirtCannon(3.25),
new PerkDirtCannon(3),
new PerkKnockback(0.25, true)
},
};
private static final String[][] UPGRADE_DETAILS =
{
{
increase(DIRT_CANNON, KNOCKBACK, 20)
},
{
increase(DIRT_CANNON, KNOCKBACK, 20)
},
{
increase(DIRT_CANNON, KNOCKBACK, 20)
},
{
increase(DIRT_CANNON, KNOCKBACK, 20)
},
{
increase(DIRT_CANNON, KNOCKBACK, 20)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.WOOD_SPADE) };
@ -70,7 +92,7 @@ public class KitEarth extends ProgressingKit
public KitEarth(ArcadeManager manager)
{
super(manager, "Earth", "skywarsearth", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
super(manager, "Earth", "skywarsearth", KitAvailability.Achievement, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
setAchievementRequirements(ACHIEVEMENTS);
}

View File

@ -23,6 +23,8 @@ public class KitFire extends ProgressingKit
"around you."
};
private static final String FIRE_BURST = "Fire Burst";
private static final Perk[][] PERKS =
{
{
@ -35,13 +37,33 @@ public class KitFire extends ProgressingKit
new PerkFireBurst(43000, 4, 3)
},
{
new PerkFireBurst(43000, 4, 3)
new PerkFireBurst(42000, 4, 4)
},
{
new PerkFireBurst(43000, 4, 4)
new PerkFireBurst(41000, 4, 4)
},
{
new PerkFireBurst(42000, 4, 4)
new PerkFireBurst(40000, 4, 4)
},
};
private static final String[][] UPGRADE_DETAILS =
{
{
reduceCooldown(FIRE_BURST, 1)
},
{
reduceCooldown(FIRE_BURST, 1)
},
{
reduceCooldown(FIRE_BURST, 1),
increase(FIRE_BURST, "Range", 20)
},
{
reduceCooldown(FIRE_BURST, 1)
},
{
reduceCooldown(FIRE_BURST, 1)
},
};
@ -52,7 +74,7 @@ public class KitFire extends ProgressingKit
public KitFire(ArcadeManager manager)
{
super(manager, "Fire", "skywarsfire", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
super(manager, "Fire", "skywarsfire", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}

View File

@ -23,6 +23,8 @@ public class KitIce extends ProgressingKit
"that builds it\'s in the direction your\'re looking.",
};
private static final String ICE_BRIDGE = "Ice Bridge";
private static final Perk[][] PERKS =
{
{
@ -31,17 +33,38 @@ public class KitIce extends ProgressingKit
{
new PerkIceBridge(29000, 4000)
},
{
new PerkIceBridge(29000, 5000)
},
{
new PerkIceBridge(28000, 5000)
},
{
new PerkIceBridge(28000, 6000)
new PerkIceBridge(27000, 5000)
},
{
new PerkIceBridge(27000, 6000)
new PerkIceBridge(26000, 6000)
},
{
new PerkIceBridge(25000, 6000)
},
};
private static final String[][] UPGRADE_DETAILS =
{
{
reduceCooldown(ICE_BRIDGE, 1)
},
{
reduceCooldown(ICE_BRIDGE, 1),
increase(ICE_BRIDGE, "Uptime", 20)
},
{
reduceCooldown(ICE_BRIDGE, 1)
},
{
reduceCooldown(ICE_BRIDGE, 1),
increase(ICE_BRIDGE, "Uptime", 20)
},
{
reduceCooldown(ICE_BRIDGE, 1)
},
};
@ -51,7 +74,7 @@ public class KitIce extends ProgressingKit
public KitIce(ArcadeManager manager)
{
super(manager, "Ice", "skywarsice", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
super(manager, "Ice", "skywarsice", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -22,6 +22,9 @@ public class KitMetal extends ProgressingKit
C.cYellow + "Right Click " + C.cGreen + "Redstone Comparator" + C.cWhite + " activate the magnet.",
};
private static final String MAGNET = "Magnet";
private static final String POWER = "Power";
private static final Perk[][] PERKS =
{
{
@ -43,6 +46,25 @@ public class KitMetal extends ProgressingKit
new PerkMagnetism(15000, 10, 1.5)
},
};
private static final String[][] UPGRADE_DETAILS =
{
{
increase(MAGNET, POWER, 10)
},
{
increase(MAGNET, POWER, 10)
},
{
increase(MAGNET, POWER, 10)
},
{
increase(MAGNET, POWER, 10)
},
{
increase(MAGNET, POWER, 10)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.STONE_PICKAXE), new ItemBuilder(Material.REDSTONE_COMPARATOR).setTitle(C.cGreen + "Magnet").build() };
@ -50,7 +72,7 @@ public class KitMetal extends ProgressingKit
public KitMetal(ArcadeManager manager)
{
super(manager, "Metal", "skywarsmetal", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
super(manager, "Metal", "skywarsmetal", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -93,6 +93,11 @@ public abstract class Kit implements Listener
{
return _kitPerks;
}
public EntityType getEntityType()
{
return _entityType;
}
public boolean HasKit(Player player)
{

View File

@ -1,5 +1,26 @@
package nautilus.game.arcade.kit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -11,7 +32,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.Donor;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.data.KitAbilityDetail;
import mineplex.core.progression.data.PlayerKit;
import mineplex.core.progression.data.PlayerKitDataManager;
import mineplex.core.progression.gui.Menu;
@ -25,21 +45,6 @@ import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_8_R3.EntityFireworks;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_8_R3.World;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Kit wrapper for all new kits
@ -54,7 +59,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
private String _internalName;
private PlayerKitDataManager _dataManager;
private Map<Integer, List<KitAbilityDetail>> _kitAbilityDetails;
private Map<Integer, List<String>> _kitUpgradeDetails;
private Perk[][] _perks;
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
@ -62,36 +67,38 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
List<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
}
_kitAbilityDetails.put(0, details);
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[][] kitPerks, EntityType entityType, ItemStack itemInHand)
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks[0], entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_kitUpgradeDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
for (int level = 0; level < kitPerks.length; level++)
{
List<KitAbilityDetail> details = Lists.newArrayList();
if (level > 0)
{
List<String> details = Lists.newArrayList();
String[] kitDetails = upgradeDetails[level - 1];
for (String detail : kitDetails)
{
details.add(C.cGray + detail);
}
_kitUpgradeDetails.put(level - 1, details);
}
Perk[] perks = kitPerks[level];
for (Perk perk : perks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
perk.SetHost(this);
}
_kitAbilityDetails.put(level, details);
}
}
@ -101,39 +108,49 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
List<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
}
_kitAbilityDetails.put(0, details);
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[][] kitPerks, EntityType entityType, ItemStack itemInHand)
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks[0], entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_kitUpgradeDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
for (int level = 0; level < kitPerks.length; level++)
{
List<KitAbilityDetail> details = Lists.newArrayList();
if (level > 0)
{
List<String> details = Lists.newArrayList();
String[] kitDetails = upgradeDetails[level - 1];
for (String detail : kitDetails)
{
details.add(C.cGray + detail);
}
_kitUpgradeDetails.put(level - 1, details);
}
Perk[] perks = kitPerks[level];
for (Perk perk : perks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
perk.SetHost(this);
}
_kitAbilityDetails.put(level, details);
}
}
public ProgressingKit(ProgressingKit progressingKit, Player player)
{
super(progressingKit.Manager, progressingKit.GetName(), progressingKit.GetAvailability(), progressingKit.GetCost(), progressingKit.GetDesc(), progressingKit.getPerks()[progressingKit.Manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()).getLevel(progressingKit.getInternalName()) - 1], progressingKit.getEntityType(), progressingKit.GetItemInHand());
_internalName = progressingKit.getInternalName();
_dataManager = progressingKit.Manager.getKitProgressionManager().getDataManager();
progressingKit.Manager.GetGame().SetKit(player, progressingKit, false);
}
@Override
public String getDisplayName()
@ -160,9 +177,9 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
}
@Override
public Map<Integer, List<KitAbilityDetail>> getAbilityDetails()
public Map<Integer, List<String>> getUpgradeDetails()
{
return _kitAbilityDetails;
return _kitUpgradeDetails;
}
@Override
@ -379,7 +396,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
}
return false;
}
public Perk[][] getPerks()
{
return _perks;
@ -405,6 +422,16 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
return C.cWhite + "Receive " + C.cGreen + amount + C.cWhite + " arrow" + (amount == 1 ? "" : "s") + " every " + C.cGreen + per + C.cWhite + " seconds. Max " + C.cGreen + max;
}
public static String reduceCooldown(String perk, double time)
{
return C.cWhite + "Reduce the cooldown of " + C.cGreen + perk + C.cWhite + " by " + C.cGreen + time + C.cWhite + " seconds" + (time == 1 ? "" : "s") + ".";
}
public static String increase(String perk, String increasing, double percentage)
{
return C.cWhite + "Increase the " + C.cGreen + increasing + C.cWhite + " of " + C.cGreen + perk + C.cWhite + " by " + C.cGreen + percentage + C.cWhite + "%.";
}
public static class CustomFirework extends EntityFireworks
{

View File

@ -90,7 +90,7 @@ public class PerkFireBurst extends Perk
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, true, player.getName(), GetName());
}
for (double radius = 0; radius < _range; radius += 0.4)
for (double radius = 0; radius < _range; radius += 0.5)
{
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
{

View File

@ -163,19 +163,56 @@ public class ProgressingKitManager implements Listener
{
//This needs to stay in for testing sakes if the issue arises connor
String message = event.getMessage();
if(!event.getPlayer().getName().equalsIgnoreCase("TadahTech"))
String user = event.getPlayer().getName();
if(user.equalsIgnoreCase("TadahTech") || user.equalsIgnoreCase("Moppletop"))
{
if(message.startsWith("/kpsetlevel"))
{
event.setCancelled(true);
int level = Integer.parseInt(message.split(" ")[1]);
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
kit.setLevel(level, event.getPlayer().getUniqueId());
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
}
else if (message.startsWith("/kpclearupgrades"))
{
event.setCancelled(true);
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
kit.setUpgradeLevel(0, event.getPlayer().getUniqueId());
event.getPlayer().sendMessage("Cleared the upgrades for " + kit.GetName());
}
}
}
@EventHandler
public void onStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
if(!message.startsWith("/kpsetlevel"))
for (Player player : event.GetGame().GetPlayers(true))
{
return;
if (!(event.GetGame().GetKit(player) instanceof ProgressingKit))
{
continue;
}
ProgressingKit kit = (ProgressingKit) event.GetGame().GetKit(player);
new ProgressingKit(kit, player)
{
@Override
public void GiveItems(Player player)
{
player.sendMessage("Were you handled?");
kit.GiveItems(player);
}
};
}
event.setCancelled(true);
int level = Integer.parseInt(message.split(" ")[1]);
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
kit.setLevel(level, event.getPlayer().getUniqueId());
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
}
@EventHandler