Some attempt at per player kits

This commit is contained in:
Sam 2016-08-15 17:45:24 +01:00
parent 8f4303cf39
commit ea7d877d36
3 changed files with 37 additions and 7 deletions

View File

@ -5,6 +5,8 @@ import mineplex.core.common.util.*;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.*;
@ -45,8 +47,17 @@ public abstract class Kit implements Listener
_kitDesc = kitDesc;
_kitPerks = kitPerks;
Bukkit.broadcastMessage(kitPerks.length + "");
for (Perk perk : _kitPerks)
{
if (perk == null)
{
break;
}
perk.SetHost(this);
}
_kitAvailability = kitAvailability;
_cost = cost;
@ -112,7 +123,14 @@ public abstract class Kit implements Listener
UtilInv.Clear(player);
for (Perk perk : _kitPerks)
{
if (perk == null)
{
break;
}
perk.Apply(player);
}
GiveItemsCall(player);

View File

@ -41,6 +41,8 @@ import mineplex.core.shop.item.SalesPackageProcessor;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.skywars.kits.KitIce;
import nautilus.game.arcade.kit.perks.PerkIceBridge;
import nautilus.game.arcade.shop.KitPackage;
import net.minecraft.server.v1_8_R3.EntityFireworks;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
@ -67,7 +69,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_perks = new Perk[6][kitPerks.length];
_perks = new Perk[kitPerks.length][kitPerks.length];
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
@ -76,7 +78,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitUpgradeDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
_perks = new Perk[kitPerks.length][kitPerks.length];
for (int level = 0; level < kitPerks.length; level++)
{
@ -94,9 +96,11 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
}
Perk[] perks = kitPerks[level];
int index = 0;
for (Perk perk : perks)
{
_perks[level][index++] = perk;
perk.SetHost(this);
}
}
@ -108,7 +112,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_perks = new Perk[6][kitPerks.length];
_perks = new Perk[kitPerks.length][kitPerks.length];
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[][] kitPerks, String[][] upgradeDetails, EntityType entityType, ItemStack itemInHand)
@ -117,7 +121,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitUpgradeDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
_perks = new Perk[kitPerks.length][kitPerks.length];
for (int level = 0; level < kitPerks.length; level++)
{
@ -135,9 +139,11 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
}
Perk[] perks = kitPerks[level];
int index = 0;
for (Perk perk : perks)
{
_perks[level][index++] = perk;
perk.SetHost(this);
}
}
@ -145,11 +151,17 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
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());
super(progressingKit.Manager, progressingKit.GetName(), progressingKit.GetAvailability(), progressingKit.GetCost(), progressingKit.GetDesc(), progressingKit.getPerks()[progressingKit.Manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()).getUpgradeLevel(progressingKit.getInternalName())], progressingKit.getEntityType(), progressingKit.GetItemInHand());
if (progressingKit instanceof KitIce)
{
PerkIceBridge perk = (PerkIceBridge) progressingKit.GetPerks()[0];
Bukkit.broadcastMessage(getDisplayName() + " " + perk.GetName() + " " + perk._cooldown);
}
_internalName = progressingKit.getInternalName();
_dataManager = progressingKit.Manager.getKitProgressionManager().getDataManager();
progressingKit.Manager.GetGame().SetKit(player, progressingKit, false);
progressingKit.Manager.GetGame().SetKit(player, this, false, false);
}
@Override

View File

@ -32,7 +32,7 @@ public class PerkIceBridge extends Perk
{
private HashSet<IcePathData> _data = new HashSet<IcePathData>();
private long _cooldown;
public long _cooldown;
private long _bridgeUpTime;
public PerkIceBridge(long cooldown, long bridgeUpTime)