Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/mineplex
Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java
This commit is contained in:
commit
ddc8e435e8
@ -77,9 +77,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
|
||||
{
|
||||
if (slot > inventory.getSize() - 1)
|
||||
{
|
||||
// Magic slot conversion
|
||||
int playerSlot = slot >= (inventory.getSize() + 27) ? slot - (inventory.getSize() + 27) : slot - (inventory.getSize() - 9);
|
||||
Player.getInventory().setItem(playerSlot, item);
|
||||
Player.getInventory().setItem(getPlayerSlot(slot), item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -87,6 +85,11 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
|
||||
}
|
||||
}
|
||||
|
||||
protected int getPlayerSlot(int slot)
|
||||
{
|
||||
return slot >= (inventory.getSize() + 27) ? slot - (inventory.getSize() + 27) : slot - (inventory.getSize() - 9);
|
||||
}
|
||||
|
||||
protected void AddButton(int slot, ShopItem item, IButton button)
|
||||
{
|
||||
AddItem(slot, item);
|
||||
|
@ -125,7 +125,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
|
||||
private void AddAssassin()
|
||||
{
|
||||
CustomBuildToken customBuild = new CustomBuildToken();
|
||||
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Assassin);
|
||||
customBuild.Name = "Default Build";
|
||||
|
||||
customBuild.SwordSkill = "Evade";
|
||||
@ -148,7 +148,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
|
||||
private void AddMage()
|
||||
{
|
||||
CustomBuildToken customBuild = new CustomBuildToken();
|
||||
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Mage);
|
||||
customBuild.Name = "Default Build";
|
||||
|
||||
customBuild.SwordSkill = "Blizzard";
|
||||
@ -170,7 +170,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
|
||||
private void AddBrute()
|
||||
{
|
||||
CustomBuildToken customBuild = new CustomBuildToken();
|
||||
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Brute);
|
||||
customBuild.Name = "Default Build";
|
||||
|
||||
customBuild.SwordSkill = "Block Toss";
|
||||
@ -193,7 +193,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
|
||||
private void AddRanger()
|
||||
{
|
||||
CustomBuildToken customBuild = new CustomBuildToken();
|
||||
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Ranger);
|
||||
customBuild.Name = "Default Build";
|
||||
|
||||
customBuild.SwordSkill = "Disengage";
|
||||
@ -216,7 +216,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
|
||||
private void AddKnight()
|
||||
{
|
||||
CustomBuildToken customBuild = new CustomBuildToken();
|
||||
CustomBuildToken customBuild = new CustomBuildToken(ClassType.Knight);
|
||||
customBuild.Name = "Default Build";
|
||||
|
||||
customBuild.SwordSkill = "Hilt Smash";
|
||||
|
@ -7,6 +7,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -21,14 +22,13 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassToken;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
|
||||
public class ClientClass
|
||||
{
|
||||
public static int MAX_TOKENS = 12;
|
||||
|
||||
{
|
||||
private ClassManager _classFactory;
|
||||
private SkillFactory _skillFactory;
|
||||
private CoreClient _client;
|
||||
@ -47,9 +47,6 @@ public class ClientClass
|
||||
|
||||
private CustomBuildToken _savingCustomBuild;
|
||||
|
||||
|
||||
public int SkillTokens = MAX_TOKENS;
|
||||
|
||||
public ClientClass(ClassManager classFactory, SkillFactory skillFactory, CoreClient client, Donor donor, ClientClassToken token)
|
||||
{
|
||||
_classFactory = classFactory;
|
||||
@ -106,6 +103,47 @@ public class ClientClass
|
||||
if (!buildToken.GlobalPassiveSkill.isEmpty() && !ValidSkill(buildToken.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
|
||||
continue;
|
||||
|
||||
boolean allEmpty = true;
|
||||
|
||||
for (SlotToken slotToken : buildToken.Slots)
|
||||
{
|
||||
if (slotToken == null)
|
||||
continue;
|
||||
|
||||
if (slotToken.Material == null)
|
||||
continue;
|
||||
|
||||
if (slotToken.Material.isEmpty())
|
||||
continue;
|
||||
|
||||
allEmpty = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (allEmpty)
|
||||
{
|
||||
buildToken.SkillTokens = CustomBuildToken.MAX_SKILL_TOKENS;
|
||||
buildToken.ItemTokens = CustomBuildToken.MAX_ITEM_TOKENS;
|
||||
|
||||
if (!buildToken.SwordSkill.isEmpty() && !ValidSkill(buildToken.SwordSkill, swordSkill, SkillType.Sword))
|
||||
buildToken.SkillTokens -= swordSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.AxeSkill.isEmpty() && !ValidSkill(buildToken.AxeSkill, axeSkill, SkillType.Axe))
|
||||
buildToken.SkillTokens -= axeSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.BowSkill.isEmpty() && !ValidSkill(buildToken.BowSkill, bowSkill, SkillType.Bow))
|
||||
buildToken.SkillTokens -= bowSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.ClassPassiveASkill.isEmpty() && !ValidSkill(buildToken.ClassPassiveASkill, classPassiveASkill, SkillType.PassiveA))
|
||||
buildToken.SkillTokens -= classPassiveASkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.ClassPassiveBSkill.isEmpty() && !ValidSkill(buildToken.ClassPassiveBSkill, classPassiveBSkill, SkillType.PassiveB))
|
||||
buildToken.SkillTokens -= classPassiveBSkill.GetTokenCost();
|
||||
|
||||
if (!buildToken.GlobalPassiveSkill.isEmpty() && !ValidSkill(buildToken.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
|
||||
buildToken.SkillTokens -= globalPassive.GetTokenCost();
|
||||
}
|
||||
|
||||
_customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken);
|
||||
}
|
||||
}
|
||||
@ -155,8 +193,6 @@ public class ClientClass
|
||||
{
|
||||
customBuild.Active = true;
|
||||
_activeCustomBuilds.put(pvpClass, customBuild);
|
||||
|
||||
calculateTokens();
|
||||
}
|
||||
|
||||
public CustomBuildToken GetActiveCustomBuild(IPvpClass pvpClass)
|
||||
@ -186,6 +222,8 @@ public class ClientClass
|
||||
|
||||
public void EquipCustomBuild(CustomBuildToken customBuild, boolean notify)
|
||||
{
|
||||
System.out.println("Equipped custombuild " + customBuild.CustomBuildId);
|
||||
|
||||
_lastClass = _classFactory.GetClass(customBuild.PvpClass);
|
||||
|
||||
if (_lastClass == null)
|
||||
@ -227,7 +265,25 @@ public class ClientClass
|
||||
_lastSkillMap.put(SkillType.GlobalPassive, new AbstractMap.SimpleEntry<ISkill, Integer>(_skillFactory.GetSkill(customBuild.GlobalPassiveSkill), customBuild.GlobalPassiveSkillLevel));
|
||||
else
|
||||
_lastSkillMap.remove(SkillType.GlobalPassive);
|
||||
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
SlotToken token = customBuild.Slots.get(i);
|
||||
|
||||
if (token == null || token.Material == null || token.Material.isEmpty())
|
||||
{
|
||||
_lastItems.put(i, null);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = ItemStackFactory.Instance.CreateStack(Enum.valueOf(Material.class, token.Material), (byte)0, token.Amount, token.Name);
|
||||
|
||||
if (token.Name.contains("Booster"))
|
||||
itemStack.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
|
||||
|
||||
_lastItems.put(i, itemStack);
|
||||
}
|
||||
|
||||
ResetToDefaults(true, true);
|
||||
|
||||
if (notify)
|
||||
@ -289,32 +345,7 @@ public class ClientClass
|
||||
}
|
||||
|
||||
if (equipItems)
|
||||
{
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), 0);
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), 1);
|
||||
|
||||
for (int i = 2; i < 9; i++)
|
||||
{
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), i);
|
||||
}
|
||||
|
||||
if (_gameClass.GetType() == ClassType.Assassin || _gameClass.GetType() == ClassType.Ranger)
|
||||
{
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.BOW), 2);
|
||||
PutDefaultItem( ItemStackFactory.Instance.CreateStack(Material.ARROW, _gameClass.GetType() == ClassType.Assassin ? 16 : 32), 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_gameClass.GetType() != ClassType.Mage)
|
||||
{
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.POTION), 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
PutDefaultItem(ItemStackFactory.Instance.CreateStack(Material.WEB, 2), 8);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
_client.GetPlayer().getInventory().clear();
|
||||
|
||||
for (Entry<Integer, ItemStack> defaultItem : GetDefaultItems().entrySet())
|
||||
@ -416,8 +447,6 @@ public class ClientClass
|
||||
|
||||
if (IsSavingCustomBuild())
|
||||
_savingCustomBuild.setSkill(skill, level);
|
||||
|
||||
calculateTokens();
|
||||
}
|
||||
|
||||
public void RemoveSkill(ISkill skill)
|
||||
@ -432,11 +461,9 @@ public class ClientClass
|
||||
_lastSkillMap.remove(skill.GetSkillType());
|
||||
|
||||
if (IsSavingCustomBuild())
|
||||
_savingCustomBuild.removeSkill(skill.GetSkillType());
|
||||
_savingCustomBuild.removeSkill(skill);
|
||||
|
||||
skill.RemoveUser(_client.GetPlayer());
|
||||
|
||||
calculateTokens();
|
||||
}
|
||||
|
||||
public ItemStack[] GetDefaultArmor()
|
||||
@ -444,11 +471,6 @@ public class ClientClass
|
||||
return _lastArmor;
|
||||
}
|
||||
|
||||
public void PutDefaultItem(ItemStack value, Integer key)
|
||||
{
|
||||
_lastItems.put(key, value);
|
||||
}
|
||||
|
||||
public void ClearDefaults()
|
||||
{
|
||||
_lastItems.clear();
|
||||
@ -466,44 +488,6 @@ public class ClientClass
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void calculateTokens()
|
||||
{
|
||||
if (_gameClass == null)
|
||||
return;
|
||||
|
||||
CustomBuildToken customBuild = _activeCustomBuilds.get(_gameClass);
|
||||
|
||||
SkillTokens = MAX_TOKENS;
|
||||
|
||||
if (customBuild == null)
|
||||
return;
|
||||
|
||||
ISkill swordSkill = _skillFactory.GetSkill(customBuild.SwordSkill);
|
||||
ISkill axeSkill = _skillFactory.GetSkill(customBuild.AxeSkill);
|
||||
ISkill bowSkill = _skillFactory.GetSkill(customBuild.BowSkill);
|
||||
ISkill classPassiveASkill = _skillFactory.GetSkill(customBuild.ClassPassiveASkill);
|
||||
ISkill classPassiveBSkill = _skillFactory.GetSkill(customBuild.ClassPassiveBSkill);
|
||||
ISkill globalPassive = _skillFactory.GetSkill(customBuild.GlobalPassiveSkill);
|
||||
|
||||
if (ValidSkill(customBuild.SwordSkill, swordSkill, SkillType.Sword))
|
||||
SkillTokens -= swordSkill.GetTokenCost() * customBuild.SwordSkillLevel;
|
||||
|
||||
if (ValidSkill(customBuild.AxeSkill, axeSkill, SkillType.Axe))
|
||||
SkillTokens -= axeSkill.GetTokenCost() * customBuild.AxeSkillLevel;
|
||||
|
||||
if (ValidSkill(customBuild.BowSkill, bowSkill, SkillType.Bow))
|
||||
SkillTokens -= bowSkill.GetTokenCost() * customBuild.BowSkillLevel;
|
||||
|
||||
if (ValidSkill(customBuild.ClassPassiveASkill, classPassiveASkill, SkillType.PassiveA))
|
||||
SkillTokens -= classPassiveASkill.GetTokenCost() * customBuild.ClassPassiveASkillLevel;
|
||||
|
||||
if (ValidSkill(customBuild.ClassPassiveBSkill, classPassiveBSkill, SkillType.PassiveB))
|
||||
SkillTokens -= classPassiveBSkill.GetTokenCost() * customBuild.ClassPassiveBSkillLevel;
|
||||
|
||||
if (ValidSkill(customBuild.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
|
||||
SkillTokens -= globalPassive.GetTokenCost() * customBuild.GlobalPassiveSkillLevel;
|
||||
}
|
||||
|
||||
public void DisplaySkills(Player player)
|
||||
{
|
||||
|
@ -3,11 +3,17 @@ package mineplex.minecraft.game.classcombat.Class.repository.token;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
|
||||
public class CustomBuildToken
|
||||
{
|
||||
public static int MAX_SKILL_TOKENS = 12;
|
||||
public static int MAX_ITEM_TOKENS = 12;
|
||||
|
||||
public int CustomBuildId;
|
||||
|
||||
public String PlayerName;
|
||||
@ -36,8 +42,52 @@ public class CustomBuildToken
|
||||
public String GlobalPassiveSkill = "";
|
||||
public Integer GlobalPassiveSkillLevel = 0;
|
||||
|
||||
public List<SlotToken> Slots = new ArrayList<SlotToken>();
|
||||
public List<SlotToken> Slots = new ArrayList<SlotToken>(9);
|
||||
|
||||
public int SkillTokens = MAX_SKILL_TOKENS;
|
||||
public int ItemTokens = 1;
|
||||
|
||||
public CustomBuildToken() { }
|
||||
|
||||
public CustomBuildToken(ClassType gameClassType)
|
||||
{
|
||||
PvpClass = gameClassType.name();
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
Slots.add(new SlotToken());
|
||||
}
|
||||
|
||||
Slots.set(0, new SlotToken("Standard Sword", Material.IRON_SWORD, 1));
|
||||
Slots.set(1, new SlotToken("Standard Axe", Material.IRON_AXE, 1));
|
||||
|
||||
for (int i = 2; i < 9; i++)
|
||||
{
|
||||
Slots.set(i, new SlotToken("Mushroom Soup", Material.MUSHROOM_SOUP, 1));
|
||||
}
|
||||
|
||||
if (gameClassType == ClassType.Assassin || gameClassType == ClassType.Ranger)
|
||||
{
|
||||
Slots.set(2, new SlotToken("Standard Bow", Material.BOW, 1));
|
||||
Slots.set(3, new SlotToken(gameClassType.name() + " Arrows", Material.ARROW, gameClassType == ClassType.Assassin ? 12 : 24));
|
||||
ItemTokens = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameClassType != ClassType.Mage)
|
||||
{
|
||||
Slots.set(7, new SlotToken("Water Bottle", Material.POTION, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Slots.set(7, new SlotToken("Cobweb", Material.WEB, 3));
|
||||
}
|
||||
|
||||
Slots.set(8, new SlotToken());
|
||||
ItemTokens = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void printInfo()
|
||||
{
|
||||
System.out.println("CustomBuildId : " + CustomBuildId);
|
||||
@ -106,41 +156,53 @@ public class CustomBuildToken
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SkillTokens -= skill.GetTokenCost() * level;
|
||||
}
|
||||
|
||||
public void removeSkill(SkillType type)
|
||||
public void removeSkill(ISkill skill)
|
||||
{
|
||||
switch (type)
|
||||
int level = 0;
|
||||
|
||||
switch (skill.GetSkillType())
|
||||
{
|
||||
case Axe:
|
||||
AxeSkill = "";
|
||||
level = AxeSkillLevel;
|
||||
AxeSkillLevel = 0;
|
||||
break;
|
||||
case Bow:
|
||||
BowSkill = "";
|
||||
level = BowSkillLevel;
|
||||
BowSkillLevel = 0;
|
||||
break;
|
||||
case Class:
|
||||
break;
|
||||
case GlobalPassive:
|
||||
GlobalPassiveSkill = "";
|
||||
level = GlobalPassiveSkillLevel;
|
||||
GlobalPassiveSkillLevel = 0;
|
||||
break;
|
||||
case PassiveA:
|
||||
ClassPassiveASkill = "";
|
||||
level = ClassPassiveASkillLevel;
|
||||
ClassPassiveASkillLevel = 0;
|
||||
break;
|
||||
case PassiveB:
|
||||
ClassPassiveBSkill = "";
|
||||
level = ClassPassiveBSkillLevel;
|
||||
ClassPassiveBSkillLevel = 0;
|
||||
break;
|
||||
case Sword:
|
||||
SwordSkill = "";
|
||||
level = SwordSkillLevel;
|
||||
SwordSkillLevel = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SkillTokens += skill.GetTokenCost() * level;
|
||||
}
|
||||
|
||||
public boolean hasSkill(ISkill skill)
|
||||
@ -173,4 +235,128 @@ public class CustomBuildToken
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasItem(Material material, String name)
|
||||
{
|
||||
for (SlotToken token : Slots)
|
||||
{
|
||||
// Stupid json crap giving me null values.
|
||||
if (token == null)
|
||||
continue;
|
||||
|
||||
if (token.Material == null)
|
||||
continue;
|
||||
|
||||
if (token.Name == null)
|
||||
continue;
|
||||
|
||||
if (token.Material.equalsIgnoreCase(material.name()) && token.Name.equalsIgnoreCase(name))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasItemType(Material material)
|
||||
{
|
||||
for (SlotToken token : Slots)
|
||||
{
|
||||
// Stupid json crap giving me null values.
|
||||
if (token == null)
|
||||
continue;
|
||||
|
||||
if (token.Material == null)
|
||||
continue;
|
||||
|
||||
if (token.Material.equalsIgnoreCase(material.name()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasItemWithNameLike(String name)
|
||||
{
|
||||
for (SlotToken token : Slots)
|
||||
{
|
||||
// Stupid json crap giving me null values.
|
||||
if (token == null)
|
||||
continue;
|
||||
|
||||
token.printInfo();
|
||||
|
||||
if (token.Name == null)
|
||||
continue;
|
||||
|
||||
if (token.Name.contains(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLastItemIndexWithNameLike(String name)
|
||||
{
|
||||
for (int i = Slots.size() - 1; i >= 0; i--)
|
||||
{
|
||||
SlotToken token = Slots.get(i);
|
||||
|
||||
// Stupid json crap giving me null values.
|
||||
if (token == null)
|
||||
continue;
|
||||
|
||||
if (token.Name == null)
|
||||
continue;
|
||||
|
||||
if (token.Name.contains(name))
|
||||
return Slots.indexOf(token);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getItemIndexWithNameLike(String name)
|
||||
{
|
||||
for (SlotToken token : Slots)
|
||||
{
|
||||
// Stupid json crap giving me null values.
|
||||
if (token == null)
|
||||
continue;
|
||||
|
||||
if (token.Name == null)
|
||||
continue;
|
||||
|
||||
if (token.Name.contains(name))
|
||||
return Slots.indexOf(token);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void addItem(Item item, int index)
|
||||
{
|
||||
SlotToken token = Slots.get(index);
|
||||
|
||||
token.Material = item.GetType().name();
|
||||
token.Amount = item.GetAmount();
|
||||
token.Name = item.GetName();
|
||||
|
||||
ItemTokens -= item.getTokenCost();
|
||||
}
|
||||
|
||||
public void removeItem(Item item, int index)
|
||||
{
|
||||
SlotToken token = Slots.get(index);
|
||||
|
||||
token.Material = null;
|
||||
token.Amount = 0;
|
||||
token.Name = null;
|
||||
|
||||
ItemTokens += item.getTokenCost();
|
||||
|
||||
System.out.println("Removed slot " + index);
|
||||
token.printInfo();
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,25 @@
|
||||
package mineplex.minecraft.game.classcombat.Class.repository.token;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class SlotToken
|
||||
{
|
||||
public String Material;
|
||||
public int Amount;
|
||||
public String Name = "";
|
||||
public String Material = "";
|
||||
public int Amount = 0;
|
||||
|
||||
public SlotToken() { }
|
||||
|
||||
public SlotToken(String name, Material material, int amount)
|
||||
{
|
||||
Name = name;
|
||||
Material = material.name();
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public void printInfo()
|
||||
{
|
||||
System.out.println("Name : " + Name);
|
||||
System.out.println("Material : " + Material);
|
||||
System.out.println("Amount : " + Amount);
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class Apple extends ItemUsable
|
||||
{
|
||||
public Apple(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public Apple(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Apple", new String[] { "Consume:", "Heals two hunger points.", " ", "Thrown:", "Does half a heart of damage on hit." }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Apple", new String[] { "Consume:", "Heals two hunger points.", " ", "Thrown:", "Does half a heart of damage on hit." }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -17,14 +17,14 @@ import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
|
||||
public class Soup extends ItemUsable
|
||||
{
|
||||
public Soup(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public Soup(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Mushroom Soup", new String[] { "Consume:", "Heals two hunger points.", "Gives Regen II boost for 4 seconds" }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Mushroom Soup", new String[] { "Consume:", "Heals two hunger points.", "Gives Regen II boost for 4 seconds" }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -7,7 +7,6 @@ public interface IItem
|
||||
Material GetType();
|
||||
int GetAmount();
|
||||
int GetGemCost();
|
||||
int GetSalesPackageId();
|
||||
String GetName();
|
||||
String[] GetDesc();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mineplex.minecraft.game.classcombat.item;
|
||||
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.minecraft.game.classcombat.item.repository.ItemToken;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -13,7 +12,6 @@ public class Item implements IItem, Listener
|
||||
{
|
||||
protected ItemFactory Factory;
|
||||
|
||||
private int _salesPackageId;
|
||||
private Material _type;
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
@ -21,16 +19,18 @@ public class Item implements IItem, Listener
|
||||
private boolean _free;
|
||||
private int _gemCost;
|
||||
private boolean _canDamage;
|
||||
|
||||
private int _tokenCost;
|
||||
|
||||
public Item(ItemFactory factory, int salesPackageId, String name, String[] desc, Material type, int amount, boolean canDamage, int gemCost)
|
||||
public Item(ItemFactory factory, String name, String[] desc, Material type, int amount, boolean canDamage, int gemCost, int tokenCost)
|
||||
{
|
||||
Factory = factory;
|
||||
_salesPackageId = salesPackageId;
|
||||
_name = name;
|
||||
_desc = desc;
|
||||
_type = type;
|
||||
_amount = amount;
|
||||
_gemCost = gemCost;
|
||||
_tokenCost = tokenCost;
|
||||
_canDamage = canDamage;
|
||||
}
|
||||
|
||||
@ -52,12 +52,6 @@ public class Item implements IItem, Listener
|
||||
return _gemCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int GetSalesPackageId()
|
||||
{
|
||||
return _salesPackageId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetName()
|
||||
{
|
||||
@ -76,17 +70,20 @@ public class Item implements IItem, Listener
|
||||
if (!_canDamage)
|
||||
event.SetCancelled("Item Damage Cancel");
|
||||
}
|
||||
|
||||
public void Update(ItemToken itemToken)
|
||||
{
|
||||
_salesPackageId = itemToken.SalesPackage.GameSalesPackageId;
|
||||
_gemCost = itemToken.SalesPackage.Gems;
|
||||
_free = itemToken.SalesPackage.Free;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] GetDesc()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public boolean isFree()
|
||||
{
|
||||
return _free;
|
||||
}
|
||||
|
||||
public int getTokenCost()
|
||||
{
|
||||
return _tokenCost;
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,19 @@
|
||||
package mineplex.minecraft.game.classcombat.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.donation.repository.GameSalesPackageToken;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.item.Consume.*;
|
||||
import mineplex.minecraft.game.classcombat.item.Throwable.*;
|
||||
import mineplex.minecraft.game.classcombat.item.Tools.Scanner;
|
||||
import mineplex.minecraft.game.classcombat.item.repository.ItemRepository;
|
||||
import mineplex.minecraft.game.classcombat.item.repository.ItemToken;
|
||||
import mineplex.minecraft.game.classcombat.item.weapon.*;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
@ -38,6 +33,11 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
private HashMap<String, Item> _items;
|
||||
private HashSet<String> _ignore;
|
||||
|
||||
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ClassManager classManager, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress)
|
||||
{
|
||||
this(plugin, blockRestore, classManager, condition, damage, energy, fire, projectileManager, webAddress, new HashSet<String>());
|
||||
}
|
||||
|
||||
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ClassManager classManager, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress, HashSet<String> ignore)
|
||||
{
|
||||
super("Item Factory", plugin);
|
||||
@ -79,48 +79,40 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
AddThrowable();
|
||||
AddTools();
|
||||
AddOther();
|
||||
addWeapons();
|
||||
|
||||
for (Item cur : _items.values())
|
||||
RegisterEvents(cur);
|
||||
|
||||
List<ItemToken> itemTokens = new ArrayList<ItemToken>();
|
||||
|
||||
for (Item item : _items.values())
|
||||
{
|
||||
ItemToken itemToken = new ItemToken();
|
||||
itemToken.Name = item.GetName();
|
||||
itemToken.Material = item.GetType().toString();
|
||||
itemToken.SalesPackage = new GameSalesPackageToken();
|
||||
itemToken.SalesPackage.GameSalesPackageId = item.GetSalesPackageId();
|
||||
itemToken.SalesPackage.Gems = item.GetGemCost();
|
||||
|
||||
itemTokens.add(itemToken);
|
||||
}
|
||||
|
||||
for (ItemToken itemToken : new ItemRepository(webAddress).GetItems(itemTokens))
|
||||
{
|
||||
if (_items.containsKey(itemToken.Name))
|
||||
{
|
||||
_items.get(itemToken.Name).Update(itemToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddConsumables()
|
||||
{
|
||||
AddItem(new Apple(this, 100,
|
||||
Material.APPLE, 1, false, 0,
|
||||
/*
|
||||
AddItem(new Apple(this, Material.APPLE, 1, false, 0, 1,
|
||||
ActionType.R, true, 500, 0,
|
||||
ActionType.L, true, 500, 4, 1.2f,
|
||||
-1, true, true, true, false));
|
||||
|
||||
AddItem(new Soup(this, 103,
|
||||
Material.MUSHROOM_SOUP, 1, true, 0,
|
||||
*/
|
||||
AddItem(new Soup(this, Material.MUSHROOM_SOUP, 1, true, 0, 1,
|
||||
ActionType.R, true, 500, 0,
|
||||
null, false, 0, 0, 0f,
|
||||
-1, true, true, true, false));
|
||||
}
|
||||
|
||||
private void addWeapons()
|
||||
{
|
||||
AddItem(new StandardSword(this, 0, 2));
|
||||
AddItem(new StandardAxe(this, 0, 2));
|
||||
|
||||
AddItem(new BoosterSword(this, 0, 4));
|
||||
AddItem(new BoosterAxe(this, 0, 4));
|
||||
|
||||
AddItem(new PowerSword(this, 0, 4));
|
||||
AddItem(new PowerAxe(this, 0, 4));
|
||||
|
||||
AddItem(new StandardBow(this, 0, 1));
|
||||
}
|
||||
|
||||
private void AddPassive()
|
||||
{
|
||||
|
||||
@ -128,32 +120,29 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
|
||||
private void AddThrowable()
|
||||
{
|
||||
AddItem(new WaterBottle(this, 301,
|
||||
Material.POTION, 1, false, 0,
|
||||
AddItem(new WaterBottle(this, Material.POTION, 1, false, 0, 1,
|
||||
ActionType.R, true, 500, 0,
|
||||
ActionType.L, true, 500, 4, 1f,
|
||||
-1, true, true, true, false));
|
||||
|
||||
AddItem(new Web(this, 30,
|
||||
Material.WEB, 2, false, 500,
|
||||
AddItem(new Web(this, Material.WEB, 3, false, 500, 1,
|
||||
null, true, 0, 0,
|
||||
ActionType.L, true, 250, 8, 1f,
|
||||
-1, true, true, true, false));
|
||||
|
||||
AddItem(new PoisonBall(this, 304,
|
||||
Material.SLIME_BALL, 1, false, 1500,
|
||||
/*
|
||||
AddItem(new PoisonBall(this, Material.SLIME_BALL, 1, false, 1500, 2,
|
||||
null, true, 0, 0,
|
||||
ActionType.L, true, 0, 6, 1.2f,
|
||||
-1, true, true, true, false));
|
||||
*/
|
||||
|
||||
AddItem(new ProximityExplosive(this, 307,
|
||||
Material.COMMAND, 1, false, 1000,
|
||||
AddItem(new ProximityExplosive(this, Material.COMMAND, 1, false, 1000, 2,
|
||||
null, true, 0, 0,
|
||||
ActionType.L, true, 250, 10, 0.8f,
|
||||
4000, false, false, false, true));
|
||||
|
||||
AddItem(new ProximityZapper(this, 308,
|
||||
Material.REDSTONE_LAMP_ON, 1, false, 1000,
|
||||
AddItem(new ProximityZapper(this, Material.REDSTONE_LAMP_OFF, 1, false, 1000, 2,
|
||||
null, true, 0, 0,
|
||||
ActionType.L, true, 250, 10, 0.8f,
|
||||
4000, false, false, false, true));
|
||||
@ -161,17 +150,19 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
|
||||
private void AddTools()
|
||||
{
|
||||
/*
|
||||
AddItem(new Scanner(this, 303,
|
||||
Material.SHEARS, 1, true, 1000,
|
||||
ActionType.R, false, 2000, 20,
|
||||
null, true, 250, 6, 1.8f,
|
||||
-1, true, true, true, false));
|
||||
*/
|
||||
}
|
||||
|
||||
private void AddOther()
|
||||
{
|
||||
AddItem(new Item(this, 401, "Arrows", new String[] { "Standard Arrows" }, Material.ARROW, 8, true, 0));
|
||||
//AddItem(new Item(this, 402, "Pistol Ammo", new String[] { "Pistol Ammo" }, Material.MELON_SEEDS, 5, true, 5, 0));
|
||||
AddItem(new Item(this, "Assassin Arrows", new String[] { "Arrows for your bow." }, Material.ARROW, 12, true, 0, 1));
|
||||
AddItem(new Item(this, "Ranger Arrows", new String[] { "Arrows for your bow." }, Material.ARROW, 24, true, 0, 1));
|
||||
}
|
||||
|
||||
public IItem GetItem(String weaponName)
|
||||
|
@ -40,13 +40,13 @@ public abstract class ItemUsable extends Item implements IThrown
|
||||
private boolean _throwIdle;
|
||||
private boolean _throwPickup;
|
||||
|
||||
public ItemUsable(ItemFactory factory, int salesPackageId, String name, String[] desc,
|
||||
Material type, int amount, boolean canDamage, int gemCost,
|
||||
public ItemUsable(ItemFactory factory, String name, String[] desc,
|
||||
Material type, int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay, int useEnergy,
|
||||
ActionType throwAction, boolean throwStock, long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, name, desc, type, amount, canDamage, gemCost);
|
||||
super(factory, name, desc, type, amount, canDamage, gemCost, tokenCost);
|
||||
_useAction = useAction;
|
||||
_throwAction = throwAction;
|
||||
_useStock = useStock;
|
||||
|
@ -24,14 +24,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class Pistol extends ItemUsable
|
||||
{
|
||||
public Pistol(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public Pistol(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Pistol", new String[] { "Pew pew pew." }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Pistol", new String[] { "Pew pew pew." }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -17,14 +17,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class PoisonBall extends ItemUsable
|
||||
{
|
||||
public PoisonBall(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public PoisonBall(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Poison Ball", new String[] { "Thrown:", "Poisons for 6 seconds on hit.", "Bounces back to you.", "Can be intercepted by enemy on return." }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Poison Ball", new String[] { "Thrown:", "Poisons for 6 seconds on hit.", "Bounces back to you.", "Can be intercepted by enemy on return." }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -34,14 +34,14 @@ public class ProximityExplosive extends ItemUsable
|
||||
{
|
||||
private HashMap<Entity, LivingEntity> _armed = new HashMap<Entity, LivingEntity>();
|
||||
|
||||
public ProximityExplosive(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public ProximityExplosive(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Proximity Explosive", new String[] {
|
||||
super(factory, "Proximity Explosive", new String[] {
|
||||
"Thrown Item:",
|
||||
"Activates after 4 seconds.",
|
||||
"Detonates on player proximity;",
|
||||
@ -49,7 +49,7 @@ public class ProximityExplosive extends ItemUsable
|
||||
"* 1 Damage" ,
|
||||
"* Strong Knockback" ,
|
||||
"All effects scale down with range."
|
||||
}, type, amount, canDamage, creditCost,
|
||||
}, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -31,14 +31,14 @@ public class ProximityZapper extends ItemUsable
|
||||
{
|
||||
private HashMap<Entity, LivingEntity> _armed = new HashMap<Entity, LivingEntity>();
|
||||
|
||||
public ProximityZapper(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public ProximityZapper(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Proximity Zapper", new String[] {
|
||||
super(factory, "Proximity Zapper", new String[] {
|
||||
"Thrown Item:",
|
||||
"Activates after 4 seconds.",
|
||||
"Detonates on player proximity;",
|
||||
@ -46,7 +46,7 @@ public class ProximityZapper extends ItemUsable
|
||||
"* Silence for 6 seconds" ,
|
||||
"* Shock for 6 seconds" ,
|
||||
"* Slow IV for 6 seconds"
|
||||
}, type, amount, canDamage, creditCost,
|
||||
}, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -17,14 +17,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class WaterBottle extends ItemUsable
|
||||
{
|
||||
public WaterBottle(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public WaterBottle(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Water Bottle", new String[] {
|
||||
super(factory, "Water Bottle", new String[] {
|
||||
"Thrown, giving AoE effect;",
|
||||
"* 3 Range",
|
||||
"* Douses Players",
|
||||
@ -32,7 +32,7 @@ public class WaterBottle extends ItemUsable
|
||||
"Used, giving personal effect;",
|
||||
"* Douses Player",
|
||||
"* Fire Resistance for 4 Seconds"
|
||||
}, type, amount, canDamage, creditCost,
|
||||
}, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -17,14 +17,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class Web extends ItemUsable
|
||||
{
|
||||
public Web(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public Web(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Web", new String[] { "Thrown:", "Used to trap enemies." }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Web", new String[] { "Thrown:", "Used to trap enemies." }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -15,14 +15,14 @@ import mineplex.minecraft.game.classcombat.item.ItemUsable;
|
||||
|
||||
public class Scanner extends ItemUsable
|
||||
{
|
||||
public Scanner(ItemFactory factory, int salesPackageId, Material type,
|
||||
int amount, boolean canDamage, int creditCost,
|
||||
public Scanner(ItemFactory factory, Material type,
|
||||
int amount, boolean canDamage, int gemCost, int tokenCost,
|
||||
ActionType useAction, boolean useStock, long useDelay,
|
||||
int useEnergy, ActionType throwAction, boolean throwStock,
|
||||
long throwDelay, int throwEnergy, float throwPower,
|
||||
long throwExpire, boolean throwPlayer, boolean throwBlock, boolean throwIdle, boolean throwPickup)
|
||||
{
|
||||
super(factory, salesPackageId, "Scanner VR-9000", new String[] { "Displays target players skills." }, type, amount, canDamage, creditCost,
|
||||
super(factory, "Scanner VR-9000", new String[] { "Displays target players skills." }, type, amount, canDamage, gemCost, tokenCost,
|
||||
useAction, useStock, useDelay, useEnergy, throwAction, throwStock,
|
||||
throwDelay, throwEnergy, throwPower,
|
||||
throwExpire, throwPlayer, throwBlock, throwIdle, throwPickup);
|
||||
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class BoosterAxe extends Item
|
||||
{
|
||||
public BoosterAxe(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Booster Axe", new String [] { "Increases Axe Skill level by 1." }, Material.GOLD_AXE, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class BoosterBow extends Item
|
||||
{
|
||||
public BoosterBow(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Booster Bow", new String [] { "Increases Bow Skill level by 1." }, Material.BOW, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class BoosterSword extends Item
|
||||
{
|
||||
public BoosterSword(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Booster Sword", new String[] { "Increases Sword Skill level by 1" }, Material.GOLD_SWORD, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class PowerAxe extends Item
|
||||
{
|
||||
public PowerAxe(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Power Axe", new String [] { "Increases Axe damage by 1." }, Material.DIAMOND_AXE, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class PowerBow extends Item
|
||||
{
|
||||
public PowerBow(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Power Bow", new String [] { "Increases Bow damage by 1." }, Material.BOW, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class PowerSword extends Item
|
||||
{
|
||||
public PowerSword(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Power Sword", new String[] { "Increases sword damage by 1." }, Material.DIAMOND_SWORD, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class StandardAxe extends Item
|
||||
{
|
||||
public StandardAxe(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Standard Axe", new String[] { "Pretty standard." }, Material.IRON_AXE, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class StandardBow extends Item
|
||||
{
|
||||
public StandardBow(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Standard Bow", new String[] { "Pretty standard." }, Material.BOW, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.minecraft.game.classcombat.item.weapon;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class StandardSword extends Item
|
||||
{
|
||||
public StandardSword(ItemFactory factory, int gemCost, int tokenCost)
|
||||
{
|
||||
super(factory, "Standard Sword", new String[] { "Pretty standard." }, Material.IRON_SWORD, 1, false, gemCost, tokenCost);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package mineplex.minecraft.game.classcombat.itempack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemPack
|
||||
{
|
||||
private List<ItemStack> _items = new ArrayList<ItemStack>(9);
|
||||
|
||||
public void AddItem(ItemStack itemStack)
|
||||
{
|
||||
_items.add(itemStack);
|
||||
}
|
||||
|
||||
public void ApplyToPlayer(Player player)
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
player.getInventory().setItem(i, _items.size() > i ? _items.get(i) : null);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetCost()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
package mineplex.minecraft.game.classcombat.itempack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
public class ItemPackFactory extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<ClassType, List<ItemPack>> _classItemPackMap = new NautHashMap<ClassType, List<ItemPack>>();
|
||||
|
||||
public ItemPackFactory(JavaPlugin plugin)
|
||||
{
|
||||
super("Item Pack Factory", plugin);
|
||||
|
||||
AddItemPacks();
|
||||
}
|
||||
|
||||
/*
|
||||
public List<ItemPack> GetItemPacks(IPvpClass pvpClass)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
private void AddItemPacks()
|
||||
{
|
||||
for (ClassType pvpClassType : ClassType.values())
|
||||
_classItemPackMap.put(pvpClassType, new ArrayList<ItemPack>());
|
||||
|
||||
AddAssassin();
|
||||
AddBrute();
|
||||
AddKnight();
|
||||
AddMage();
|
||||
AddRanger();
|
||||
//AddShifter();
|
||||
AddGlobal();
|
||||
}
|
||||
|
||||
private void AddGlobal()
|
||||
{
|
||||
/*
|
||||
for (ClassType pvpClassType : ClassType.values())
|
||||
_classItemPackMap.get(pvpClassType).add(itemPack);
|
||||
*/
|
||||
}
|
||||
|
||||
private void AddRanger()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void AddMage()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void AddKnight()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void AddBrute()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void AddAssassin()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -5,21 +5,21 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.itempack.ItemPackFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
|
||||
public class ClassShopManager extends MiniPlugin
|
||||
{
|
||||
private ClassManager _classManager;
|
||||
private SkillFactory _skillFactory;
|
||||
private ItemPackFactory _itemPackFactory;
|
||||
private ItemFactory _itemFactory;
|
||||
|
||||
public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemPackFactory itemPackFactory)
|
||||
public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemFactory itemFactory)
|
||||
{
|
||||
super("Class Shop Manager", plugin);
|
||||
|
||||
_classManager = classManager;
|
||||
_skillFactory = skillFactory;
|
||||
_itemPackFactory = itemPackFactory;
|
||||
_itemFactory = itemFactory;
|
||||
}
|
||||
|
||||
public ClassManager GetClassManager()
|
||||
@ -32,8 +32,8 @@ public class ClassShopManager extends MiniPlugin
|
||||
return _skillFactory;
|
||||
}
|
||||
|
||||
public ItemPackFactory GetItemPackFactory()
|
||||
public ItemFactory GetItemFactory()
|
||||
{
|
||||
return _itemPackFactory;
|
||||
return _itemFactory;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
|
||||
|
||||
public class DeselectItemButton implements IButton
|
||||
{
|
||||
private SkillPage _page;
|
||||
private Item _item;
|
||||
private int _index;
|
||||
|
||||
public DeselectItemButton(SkillPage page, Item item, int index)
|
||||
{
|
||||
_page = page;
|
||||
_item = item;
|
||||
_index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_page.DeselectItem(player, _item, _index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
|
||||
_page.DeselectItem(player, _item, _index);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.button;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PurchaseItemButton implements IButton
|
||||
{
|
||||
private SkillPage _page;
|
||||
private Item _item;
|
||||
|
||||
public PurchaseItemButton(SkillPage page, Item item)
|
||||
{
|
||||
_page = page;
|
||||
_item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_page.PurchaseItem(player, _item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
ClickedLeft(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.button;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
|
||||
|
||||
public class SelectItemButton implements IButton
|
||||
{
|
||||
private SkillPage _page;
|
||||
private Item _item;
|
||||
private boolean _canAfford;
|
||||
|
||||
public SelectItemButton(SkillPage page, Item item, boolean canAfford)
|
||||
{
|
||||
_page = page;
|
||||
_item = item;
|
||||
_canAfford = canAfford;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
if (!_canAfford)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.5f);
|
||||
return;
|
||||
}
|
||||
|
||||
_page.SelectItem(player, _item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
_page.DeselectItem(player, _item);
|
||||
}
|
||||
}
|
@ -96,7 +96,8 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
||||
{
|
||||
if (customBuild == null)
|
||||
{
|
||||
customBuild = new CustomBuildToken();
|
||||
System.out.println("new build");
|
||||
customBuild = new CustomBuildToken(_pvpClass.GetType());
|
||||
customBuild.CustomBuildNumber = i;
|
||||
customBuild.Name = "Build " + (i + 1);
|
||||
customBuild.PvpClass = _pvpClass.GetName();
|
||||
|
@ -8,21 +8,31 @@ import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.DeselectItemButton;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.PurchaseItemButton;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.PurchaseSkillButton;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.SelectItemButton;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.SelectSkillButton;
|
||||
import mineplex.minecraft.game.classcombat.shop.salespackage.ItemSalesPackage;
|
||||
import mineplex.minecraft.game.classcombat.shop.salespackage.SkillSalesPackage;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
{
|
||||
@ -57,16 +67,92 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
clear();
|
||||
|
||||
ClientClass clientClass = Plugin.GetClassManager().Get(Player);
|
||||
|
||||
//System.out.println("Custombuild being displayed.");
|
||||
//clientClass.GetSavingCustomBuild().printInfo();
|
||||
|
||||
BuildClassSkills(_pvpClass, clientClass);
|
||||
BuildGlobalSkills(clientClass);
|
||||
//BuildItemPacks();
|
||||
BuildItems(_pvpClass, clientClass);
|
||||
}
|
||||
|
||||
private void BuildItems(IPvpClass gameClass, ClientClass clientClass)
|
||||
{
|
||||
if (clientClass.GetSavingCustomBuild().ItemTokens > 0)
|
||||
AddItem(62, new ShopItem(Material.IRON_INGOT, clientClass.GetSavingCustomBuild().ItemTokens + " Item Tokens", null, clientClass.GetSavingCustomBuild().ItemTokens, true, true));
|
||||
else
|
||||
AddItem(62, new ShopItem(Material.REDSTONE_BLOCK, "0 Item Tokens", null, 1, true, true));
|
||||
|
||||
|
||||
int slotNumber = 54;
|
||||
|
||||
int swordSlotNumber = 72;
|
||||
int axeSlotNumber = 73;
|
||||
int bowSlotNumber = 74;
|
||||
|
||||
for (Item item : Plugin.GetItemFactory().GetItems())
|
||||
{
|
||||
if (item.GetName().contains("Sword"))
|
||||
{
|
||||
slotNumber = swordSlotNumber;
|
||||
swordSlotNumber -= 9;
|
||||
}
|
||||
else if (item.GetName().contains("Axe"))
|
||||
{
|
||||
slotNumber = axeSlotNumber;
|
||||
axeSlotNumber -= 9;
|
||||
}
|
||||
else if (item.GetName().contains("Bow"))
|
||||
{
|
||||
if (gameClass.GetType() != ClassType.Assassin && gameClass.GetType() != ClassType.Ranger)
|
||||
continue;
|
||||
|
||||
slotNumber = bowSlotNumber;
|
||||
bowSlotNumber -= 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameClass.GetType() != ClassType.Assassin && gameClass.GetType() != ClassType.Ranger && item.GetName().contains("Arrow"))
|
||||
continue;
|
||||
|
||||
if (gameClass.GetType() == ClassType.Assassin && item.GetName().contains("Ranger"))
|
||||
continue;
|
||||
|
||||
if (gameClass.GetType() == ClassType.Ranger && item.GetName().contains("Assassin"))
|
||||
continue;
|
||||
|
||||
if (item.GetType() == Material.ARROW)
|
||||
slotNumber = 65;
|
||||
else if (item.GetType() == Material.MUSHROOM_SOUP)
|
||||
slotNumber = 67;
|
||||
else if (item.GetType() == Material.COMMAND)
|
||||
slotNumber = 68;
|
||||
else if (item.GetType() == Material.WEB)
|
||||
slotNumber = 69;
|
||||
else if (item.GetType() == Material.POTION)
|
||||
slotNumber = 76;
|
||||
else if (item.GetType() == Material.REDSTONE_LAMP_OFF)
|
||||
slotNumber = 77;
|
||||
}
|
||||
|
||||
BuildItem(item, slotNumber, clientClass);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack itemStack = Player.getInventory().getItem(i);
|
||||
|
||||
if (itemStack != null && itemStack.getType() == item.GetType() && itemStack.getAmount() == item.GetAmount())
|
||||
{
|
||||
ButtonMap.put(81 + i, new DeselectItemButton(this, item, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildClassSkills(IPvpClass gameClass, ClientClass clientClass)
|
||||
{
|
||||
if (clientClass.GetSavingCustomBuild().SkillTokens > 0)
|
||||
getInventory().setItem(8, new ShopItem(Material.GOLD_INGOT, clientClass.GetSavingCustomBuild().SkillTokens + " Skill Tokens", null, clientClass.GetSavingCustomBuild().SkillTokens, true, true).getHandle());
|
||||
else
|
||||
getInventory().setItem(8, new ShopItem(Material.REDSTONE_BLOCK, "0 Skill Tokens", null, 1, true, true).getHandle());
|
||||
|
||||
getInventory().setItem(0, new ShopItem(Material.IRON_SWORD, "Sword Skills", null, 1, true, true).getHandle());
|
||||
getInventory().setItem(9, new ShopItem(Material.IRON_AXE, "Axe Skills", null, 1, true, true).getHandle());
|
||||
getInventory().setItem(18, new ShopItem(Material.BOW, "Bow Skills", null, 1, true, true).getHandle());
|
||||
@ -82,32 +168,32 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
int passiveBSlotNumber = 37;
|
||||
|
||||
for (ISkill skill : Plugin.GetSkillFactory().GetSkillsFor(gameClass))
|
||||
{
|
||||
{
|
||||
switch (skill.GetSkillType())
|
||||
{
|
||||
case Sword:
|
||||
slotNumber = swordSlotNumber;
|
||||
swordSlotNumber++;
|
||||
break;
|
||||
case Axe:
|
||||
slotNumber = axeSlotNumber;
|
||||
axeSlotNumber++;
|
||||
break;
|
||||
case Bow:
|
||||
slotNumber = bowSlotNumber;
|
||||
bowSlotNumber++;
|
||||
break;
|
||||
case PassiveA:
|
||||
slotNumber = passiveASlotNumber;
|
||||
passiveASlotNumber++;
|
||||
break;
|
||||
case PassiveB:
|
||||
slotNumber = passiveBSlotNumber;
|
||||
passiveBSlotNumber++;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
case Sword:
|
||||
slotNumber = swordSlotNumber;
|
||||
swordSlotNumber++;
|
||||
break;
|
||||
case Axe:
|
||||
slotNumber = axeSlotNumber;
|
||||
axeSlotNumber++;
|
||||
break;
|
||||
case Bow:
|
||||
slotNumber = bowSlotNumber;
|
||||
bowSlotNumber++;
|
||||
break;
|
||||
case PassiveA:
|
||||
slotNumber = passiveASlotNumber;
|
||||
passiveASlotNumber++;
|
||||
break;
|
||||
case PassiveB:
|
||||
slotNumber = passiveBSlotNumber;
|
||||
passiveBSlotNumber++;
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
BuildSkillItem(skill, slotNumber, clientClass);
|
||||
@ -130,7 +216,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
{
|
||||
List<String> skillLore = new ArrayList<String>();
|
||||
|
||||
boolean locked = isSkillLocked(skill.GetSalesPackageId(), skill);
|
||||
boolean locked = isSkillLocked(skill);
|
||||
Material material = locked ? Material.EMERALD : (clientClass.GetSavingCustomBuild().hasSkill(skill) ? Material.WRITTEN_BOOK : Material.BOOK);
|
||||
boolean hasSkill = clientClass.GetSavingCustomBuild().hasSkill(skill);
|
||||
int level = hasSkill ? clientClass.GetSavingCustomBuild().getLevel(skill) : 1;
|
||||
@ -153,10 +239,10 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
if (!hasSkill || level < skill.getMaxLevel())
|
||||
{
|
||||
skillLore.add(C.cYellow + "Skill Token Cost: " + C.cWhite + skill.GetTokenCost());
|
||||
skillLore.add(C.cYellow + "Skill Tokens Remaining: " + C.cWhite + clientClass.SkillTokens + "/" + ClientClass.MAX_TOKENS);
|
||||
skillLore.add(C.cYellow + "Skill Tokens Remaining: " + C.cWhite + clientClass.GetSavingCustomBuild().SkillTokens + "/" + CustomBuildToken.MAX_SKILL_TOKENS);
|
||||
skillLore.add("");
|
||||
|
||||
if (clientClass.SkillTokens >= skill.GetTokenCost())
|
||||
if (clientClass.GetSavingCustomBuild().SkillTokens >= skill.GetTokenCost())
|
||||
{
|
||||
if (hasSkill)
|
||||
skillLore.add(C.cGreen + "Left-Click to Upgrade to Level " + (level + 1));
|
||||
@ -185,58 +271,61 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
if (locked)
|
||||
AddButton(slotNumber, skillItem, new PurchaseSkillButton(this, skill));
|
||||
else
|
||||
AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill, Math.min((hasSkill ? level + 1 : level), skill.getMaxLevel()), clientClass.SkillTokens >= skill.GetTokenCost()));
|
||||
AddButton(slotNumber, skillItem, new SelectSkillButton(this, skill, Math.min((hasSkill ? level + 1 : level), skill.getMaxLevel()), clientClass.GetSavingCustomBuild().SkillTokens >= skill.GetTokenCost()));
|
||||
}
|
||||
|
||||
protected void BuildItem(Item item, int slotNumber, ClientClass clientClass)
|
||||
{
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
/*
|
||||
private void BuildItemPacks()
|
||||
{
|
||||
Player.getInventory().setItem(18, new ShopItem(Material.WORKBENCH, (byte)11, "Item packs", null, 1, true, true));
|
||||
boolean locked = isItemLocked(item);
|
||||
Material material = locked ? Material.EMERALD : item.GetType();
|
||||
boolean hasItem = locked ? false : clientClass.GetSavingCustomBuild().hasItem(material, item.GetName());
|
||||
|
||||
String name = (locked ? ChatColor.RED + item.GetName() + " (Locked)" : item.GetName());
|
||||
|
||||
if (locked)
|
||||
{
|
||||
itemLore.add(C.cYellow + item.GetGemCost() + " Gems");
|
||||
itemLore.add(C.cBlack);
|
||||
}
|
||||
|
||||
int slotNumber = 19;
|
||||
//Add Lore
|
||||
itemLore.addAll(java.util.Arrays.asList(item.GetDesc()));
|
||||
|
||||
for (ItemPack item : Plugin.GetItemPackFactory().GetItemPacks(_pvpClass))
|
||||
{
|
||||
BuildItemPack(item, slotNumber++);
|
||||
}
|
||||
}
|
||||
//Add Select Information
|
||||
itemLore.add("");
|
||||
itemLore.add("");
|
||||
if (!hasItem)
|
||||
{
|
||||
itemLore.add(C.cYellow + "Item Token Cost: " + C.cWhite + item.getTokenCost());
|
||||
itemLore.add(C.cYellow + "Item Tokens Remaining: " + C.cWhite + clientClass.GetSavingCustomBuild().ItemTokens + "/" + CustomBuildToken.MAX_ITEM_TOKENS);
|
||||
itemLore.add("");
|
||||
|
||||
private void BuildItemPack(ItemPack itemPack, int slotNumber)
|
||||
{
|
||||
List<String> skillLore = new ArrayList<String>();
|
||||
if (clientClass.GetSavingCustomBuild().ItemTokens >= item.getTokenCost())
|
||||
{
|
||||
itemLore.add(C.cGreen + "Left-Click to Select");
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cRed + "You don't have enough Item Tokens.");
|
||||
}
|
||||
}
|
||||
|
||||
if (_purchasing)
|
||||
{
|
||||
skillLore.add(C.cYellow + itemPack.GetCost() + " Gems");
|
||||
skillLore.add(C.cBlack);
|
||||
}
|
||||
//Color Gray
|
||||
for (int i = 0; i < itemLore.size(); i++)
|
||||
{
|
||||
itemLore.set(i, C.cGray + itemLore.get(i));
|
||||
}
|
||||
|
||||
skillLore.addAll(Arrays.asList(itemPack.GetDesc()));
|
||||
|
||||
for (int i = 0; i < skillLore.size(); i++)
|
||||
{
|
||||
skillLore.set(i, C.cGray + skillLore.get(i));
|
||||
}
|
||||
|
||||
boolean locked = !itemPack.IsFree() && !DonationManager.Get(Player.getName()).OwnsUnknownPackage("Competitive itempack " + itemPack.GetName()) && !Client.GetRank().Has(Rank.ULTRA);
|
||||
ShopItem skillItem = new ShopItem(locked ? Material.BOOK_AND_QUILL : ((skill.GetUsers().contains(Player) || _purchasing) ? Material.WRITTEN_BOOK : Material.BOOK), (locked ? ChatColor.RED + skill.GetName() + " (Locked)" : skill.GetName()), skillLore.toArray(new String[skillLore.size()]), 1, locked, true);
|
||||
|
||||
if (_purchasing)
|
||||
{
|
||||
if (locked)
|
||||
AddButton(slotNumber, skillItem, new PurchaseItemPackButton(this, itemPack));
|
||||
else
|
||||
AddItem(slotNumber, skillItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (locked)
|
||||
AddItem(slotNumber, skillItem);
|
||||
else
|
||||
AddButton(slotNumber, skillItem, new SelectItemPackButton(this, itemPack));
|
||||
}
|
||||
}
|
||||
*/
|
||||
ShopItem itemGUI = new ShopItem(material, name, itemLore.toArray(new String[itemLore.size()]), item.GetAmount(), locked, true);
|
||||
|
||||
if (locked)
|
||||
AddButton(slotNumber, itemGUI, new PurchaseItemButton(this, item));
|
||||
else
|
||||
AddButton(slotNumber, itemGUI, new SelectItemButton(this, item, clientClass.GetSavingCustomBuild().ItemTokens >= item.getTokenCost()));
|
||||
}
|
||||
|
||||
public void SelectSkill(Player player, ISkill skill, int level)
|
||||
{
|
||||
ClientClass clientClass = Plugin.GetClassManager().Get(player);
|
||||
@ -295,11 +384,117 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
}, this, new SkillSalesPackage(skill), CurrencyType.Gems, player));
|
||||
}
|
||||
|
||||
private boolean isSkillLocked(int skillId, ISkill skill)
|
||||
private boolean isSkillLocked(ISkill skill)
|
||||
{
|
||||
if (skill.IsFree() || DonationManager.Get(Player.getName()).Owns(skillId) || ClientManager.Get(Player.getName()).GetRank().Has(Rank.ULTRA) || DonationManager.Get(Player.getName()).OwnsUnknownPackage("Competitive ULTRA"))
|
||||
if (skill.IsFree() || ClientManager.Get(Player.getName()).GetRank().Has(Rank.ULTRA) || DonationManager.Get(Player.getName()).OwnsUnknownPackage("Champions ULTRA") || DonationManager.Get(Player.getName()).OwnsUnknownPackage("Champions " + skill.GetName()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isItemLocked(Item item)
|
||||
{
|
||||
if (item.isFree() || ClientManager.Get(Player.getName()).GetRank().Has(Rank.ULTRA) || DonationManager.Get(Player.getName()).OwnsUnknownPackage("Champions ULTRA") || DonationManager.Get(Player.getName()).OwnsUnknownPackage("Champions " + item.GetName()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void PurchaseItem(Player player, Item item)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new ConfirmationPage<ClassShopManager, ClassCombatShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
BuildPage();
|
||||
}
|
||||
}, this, new ItemSalesPackage(item), CurrencyType.Gems, player));
|
||||
}
|
||||
|
||||
public void SelectItem(Player player, Item item)
|
||||
{
|
||||
int index = -1;
|
||||
ClientClass clientClass = Plugin.GetClassManager().Get(player);
|
||||
|
||||
/*
|
||||
if (item.GetName().contains("Sword") || item.GetName().contains("Axe") || item.GetName().contains("Bow"))
|
||||
{
|
||||
if (clientClass.GetSavingCustomBuild().hasItem(item.GetType(), item.GetName()))
|
||||
{
|
||||
PlayDenySound(player);
|
||||
System.out.println("Denying because of matching material and name.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.GetName().contains("Sword"))
|
||||
{
|
||||
System.out.println("Sword");
|
||||
if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Sword"))
|
||||
index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Sword");
|
||||
}
|
||||
else if (item.GetName().contains("Axe"))
|
||||
{
|
||||
System.out.println("Axe");
|
||||
if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Axe"))
|
||||
index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Axe");
|
||||
}
|
||||
else if (item.GetName().contains("Bow"))
|
||||
{
|
||||
System.out.println("Bow");
|
||||
if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Bow"))
|
||||
index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Bow");
|
||||
}
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
System.out.println("Triggering ClickedRight on slot " + (81 + index));
|
||||
ButtonMap.get(81 + index).ClickedRight(player);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (index == -1 && player.getInventory().firstEmpty() < 9)
|
||||
index = player.getInventory().firstEmpty();
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
PlayAcceptSound(player);
|
||||
|
||||
clientClass.GetSavingCustomBuild().addItem(item, index);
|
||||
|
||||
ItemStack itemStack = ItemStackFactory.Instance.CreateStack(item.GetType(), (byte)0, item.GetAmount(), item.GetName());
|
||||
|
||||
if (item.GetName().contains("Booster"))
|
||||
itemStack.addUnsafeEnchantment(Enchantment.DURABILITY, 5);
|
||||
|
||||
player.getInventory().setItem(index, itemStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayDenySound(player);
|
||||
}
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
public void DeselectItem(Player player, Item item)
|
||||
{
|
||||
DeselectItem(player, item, Plugin.GetClassManager().Get(player).GetSavingCustomBuild().getLastItemIndexWithNameLike(item.GetName()));
|
||||
}
|
||||
|
||||
public void DeselectItem(Player player, Item item, int index)
|
||||
{
|
||||
if (index != -1)
|
||||
{
|
||||
PlayAcceptSound(player);
|
||||
|
||||
Plugin.GetClassManager().Get(player).GetSavingCustomBuild().removeItem(item, index);
|
||||
player.getInventory().setItem(index, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayDenySound(player);
|
||||
}
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.salespackage;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.minecraft.game.classcombat.item.Item;
|
||||
|
||||
public class ItemSalesPackage extends SalesPackageBase
|
||||
{
|
||||
public ItemSalesPackage(Item item)
|
||||
{
|
||||
super(item.GetName(), Material.BOOK, item.GetDesc());
|
||||
Free = item.isFree();
|
||||
KnownPackage = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Sold(Player player, CurrencyType currencyType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ public class SkillSalesPackage extends SalesPackageBase
|
||||
public SkillSalesPackage(ISkill skill)
|
||||
{
|
||||
super(skill.GetName(), Material.BOOK, skill.GetDesc(0));
|
||||
SalesPackageId = skill.GetSalesPackageId();
|
||||
Free = skill.IsFree();
|
||||
KnownPackage = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,225 @@
|
||||
package net.minecraft.server.v1_7_R2;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityBat
|
||||
extends EntityAmbient
|
||||
{
|
||||
private ChunkCoordinates h;
|
||||
|
||||
public boolean Vegetated = false;
|
||||
|
||||
public EntityBat(World paramWorld)
|
||||
{
|
||||
super(paramWorld);
|
||||
|
||||
a(0.5F, 0.9F);
|
||||
setStartled(true);
|
||||
}
|
||||
|
||||
protected void c()
|
||||
{
|
||||
super.c();
|
||||
|
||||
this.datawatcher.a(16, new Byte((byte)0));
|
||||
}
|
||||
|
||||
protected float be()
|
||||
{
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
protected float bf()
|
||||
{
|
||||
return super.bf() * 0.95F;
|
||||
}
|
||||
|
||||
protected String t()
|
||||
{
|
||||
if ((isStartled()) && (this.random.nextInt(4) != 0)) {
|
||||
return null;
|
||||
}
|
||||
return "mob.bat.idle";
|
||||
}
|
||||
|
||||
protected String aS()
|
||||
{
|
||||
return "mob.bat.hurt";
|
||||
}
|
||||
|
||||
protected String aT()
|
||||
{
|
||||
return "mob.bat.death";
|
||||
}
|
||||
|
||||
public boolean R()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void o(Entity paramEntity) {}
|
||||
|
||||
protected void bn() {}
|
||||
|
||||
protected void aC()
|
||||
{
|
||||
super.aC();
|
||||
|
||||
getAttributeInstance(GenericAttributes.a).setValue(6.0D);
|
||||
}
|
||||
|
||||
public boolean isStartled()
|
||||
{
|
||||
return (this.datawatcher.getByte(16) & 0x1) != 0;
|
||||
}
|
||||
|
||||
public void setStartled(boolean paramBoolean)
|
||||
{
|
||||
int i = this.datawatcher.getByte(16);
|
||||
if (paramBoolean) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte)(i | 0x1)));
|
||||
} else {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte)(i & 0xFFFFFFFE)));
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean bj()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void h()
|
||||
{
|
||||
super.h();
|
||||
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
if (isStartled())
|
||||
{
|
||||
this.motX = (this.motY = this.motZ = 0.0D);
|
||||
this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.motY *= 0.6000000238418579D;
|
||||
}
|
||||
}
|
||||
|
||||
protected void bm()
|
||||
{
|
||||
super.bm();
|
||||
|
||||
if (Vegetated)
|
||||
return;
|
||||
|
||||
if (isStartled())
|
||||
{
|
||||
if (!this.world.getType(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ)).r())
|
||||
{
|
||||
setStartled(false);
|
||||
this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.random.nextInt(200) == 0) {
|
||||
this.aO = this.random.nextInt(360);
|
||||
}
|
||||
if (this.world.findNearbyPlayer(this, 4.0D) != null)
|
||||
{
|
||||
setStartled(false);
|
||||
this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((this.h != null) && ((!this.world.isEmpty(this.h.x, this.h.y, this.h.z)) || (this.h.y < 1))) {
|
||||
this.h = null;
|
||||
}
|
||||
if ((this.h == null) || (this.random.nextInt(30) == 0) || (this.h.e((int)this.locX, (int)this.locY, (int)this.locZ) < 4.0F)) {
|
||||
this.h = new ChunkCoordinates((int)this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int)this.locY + this.random.nextInt(6) - 2, (int)this.locZ + this.random.nextInt(7) - this.random.nextInt(7));
|
||||
}
|
||||
double d1 = this.h.x + 0.5D - this.locX;
|
||||
double d2 = this.h.y + 0.1D - this.locY;
|
||||
double d3 = this.h.z + 0.5D - this.locZ;
|
||||
|
||||
this.motX += (Math.signum(d1) * 0.5D - this.motX) * 0.1000000014901161D;
|
||||
this.motY += (Math.signum(d2) * 0.699999988079071D - this.motY) * 0.1000000014901161D;
|
||||
this.motZ += (Math.signum(d3) * 0.5D - this.motZ) * 0.1000000014901161D;
|
||||
|
||||
float f1 = (float)(Math.atan2(this.motZ, this.motX) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||
float f2 = MathHelper.g(f1 - this.yaw);
|
||||
this.be = 0.5F;
|
||||
this.yaw += f2;
|
||||
if ((this.random.nextInt(100) == 0) && (this.world.getType(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ)).r())) {
|
||||
setStartled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean g_()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b(float paramFloat) {}
|
||||
|
||||
protected void a(double paramDouble, boolean paramBoolean) {}
|
||||
|
||||
public boolean ay()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource paramDamageSource, float paramFloat)
|
||||
{
|
||||
if (isInvulnerable()) {
|
||||
return false;
|
||||
}
|
||||
if ((!this.world.isStatic) &&
|
||||
(isStartled() &&
|
||||
!Vegetated)) {
|
||||
setStartled(false);
|
||||
}
|
||||
return super.damageEntity(paramDamageSource, paramFloat);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound paramNBTTagCompound)
|
||||
{
|
||||
super.a(paramNBTTagCompound);
|
||||
|
||||
this.datawatcher.watch(16, Byte.valueOf(paramNBTTagCompound.getByte("BatFlags")));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound paramNBTTagCompound)
|
||||
{
|
||||
super.b(paramNBTTagCompound);
|
||||
|
||||
paramNBTTagCompound.setByte("BatFlags", this.datawatcher.getByte(16));
|
||||
}
|
||||
|
||||
public boolean canSpawn()
|
||||
{
|
||||
int i = MathHelper.floor(this.boundingBox.b);
|
||||
if (i >= 63) {
|
||||
return false;
|
||||
}
|
||||
int j = MathHelper.floor(this.locX);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
int m = this.world.getLightLevel(j, i, k);
|
||||
int n = 4;
|
||||
Calendar localCalendar = this.world.V();
|
||||
if (((localCalendar.get(2) + 1 == 10) && (localCalendar.get(5) >= 20)) || ((localCalendar.get(2) + 1 == 11) && (localCalendar.get(5) <= 3))) {
|
||||
n = 7;
|
||||
} else if (this.random.nextBoolean()) {
|
||||
return false;
|
||||
}
|
||||
if (m > this.random.nextInt(n)) {
|
||||
return false;
|
||||
}
|
||||
return super.canSpawn();
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package net.minecraft.server.v1_7_R2;
|
||||
|
||||
public class FoodMetaData {
|
||||
|
||||
// CraftBukkit start - All made public
|
||||
public int foodLevel = 20;
|
||||
public float saturationLevel = 7.0F;
|
||||
public float exhaustionLevel;
|
||||
public int foodTickTimer;
|
||||
private EntityHuman entityhuman;
|
||||
// CraftBukkit end
|
||||
private int e = 20;
|
||||
|
||||
public FoodMetaData() { throw new AssertionError("Whoopsie, we missed the bukkit."); } // CraftBukkit start - throw an error
|
||||
|
||||
// CraftBukkit start - added EntityHuman constructor
|
||||
public FoodMetaData(EntityHuman entityhuman) {
|
||||
org.apache.commons.lang.Validate.notNull(entityhuman);
|
||||
this.entityhuman = entityhuman;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void eat(int i, float f) {
|
||||
this.foodLevel = Math.min(i + this.foodLevel, 20);
|
||||
this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel);
|
||||
}
|
||||
|
||||
public void a(ItemFood itemfood, ItemStack itemstack) {
|
||||
// CraftBukkit start
|
||||
int oldFoodLevel = foodLevel;
|
||||
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.v1_7_R2.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, itemfood.getNutrition(itemstack) + oldFoodLevel);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.eat(event.getFoodLevel() - oldFoodLevel, itemfood.getSaturationModifier(itemstack));
|
||||
}
|
||||
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
EnumDifficulty enumdifficulty = entityhuman.world.difficulty;
|
||||
|
||||
this.e = this.foodLevel;
|
||||
if (this.exhaustionLevel > 4.0F) {
|
||||
this.exhaustionLevel -= 4.0F;
|
||||
if (this.saturationLevel > 0.0F) {
|
||||
this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
|
||||
} else if (enumdifficulty != EnumDifficulty.PEACEFUL) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.v1_7_R2.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.max(this.foodLevel - 1, 0));
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.foodLevel = event.getFoodLevel();
|
||||
}
|
||||
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.bQ()) {
|
||||
++this.foodTickTimer;
|
||||
if (this.foodTickTimer >= 80) {
|
||||
// CraftBukkit - added RegainReason
|
||||
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
|
||||
this.a(3.0F);
|
||||
this.foodTickTimer = 0;
|
||||
}
|
||||
} else if (this.foodLevel <= 0) {
|
||||
++this.foodTickTimer;
|
||||
if (this.foodTickTimer >= 80) {
|
||||
if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) {
|
||||
entityhuman.damageEntity(DamageSource.STARVE, 1.0F);
|
||||
}
|
||||
|
||||
this.foodTickTimer = 0;
|
||||
}
|
||||
} else {
|
||||
this.foodTickTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.hasKeyOfType("foodLevel", 99)) {
|
||||
this.foodLevel = nbttagcompound.getInt("foodLevel");
|
||||
this.foodTickTimer = nbttagcompound.getInt("foodTickTimer");
|
||||
this.saturationLevel = nbttagcompound.getFloat("foodSaturationLevel");
|
||||
this.exhaustionLevel = nbttagcompound.getFloat("foodExhaustionLevel");
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInt("foodLevel", this.foodLevel);
|
||||
nbttagcompound.setInt("foodTickTimer", this.foodTickTimer);
|
||||
nbttagcompound.setFloat("foodSaturationLevel", this.saturationLevel);
|
||||
nbttagcompound.setFloat("foodExhaustionLevel", this.exhaustionLevel);
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.foodLevel;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.foodLevel < 20;
|
||||
}
|
||||
|
||||
public void a(float f) {
|
||||
this.exhaustionLevel = Math.min(this.exhaustionLevel + f, 40.0F);
|
||||
}
|
||||
|
||||
public float e() {
|
||||
return this.saturationLevel;
|
||||
}
|
||||
}
|
@ -26,7 +26,6 @@ import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -36,11 +35,10 @@ import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.minecraft.game.classcombat.itempack.ItemPackFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.core.IRelation;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
@ -102,6 +100,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private SkillFactory _skillFactory;
|
||||
private ClassShopManager _classShopManager;
|
||||
private ClassCombatShop _classShop;
|
||||
|
||||
private MiscManager _miscManager;
|
||||
|
||||
//Server Games
|
||||
private GameServerConfig _serverConfig;
|
||||
@ -149,15 +149,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_firework = new FireworkHandler();
|
||||
_fire = new Fire(plugin, _conditionManager, damageManager);
|
||||
|
||||
|
||||
_projectileManager = new ProjectileManager(plugin);
|
||||
|
||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate) || serverConfig.GameList.contains(GameType.ChampionsTDM) || serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
{
|
||||
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport, new Energy(plugin), webAddress);
|
||||
Energy energy = new Energy(plugin);
|
||||
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport, energy, webAddress);
|
||||
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, webAddress);
|
||||
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, new ItemPackFactory(_plugin));
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, new ItemFactory(_plugin, _blockRestore, _classManager, _conditionManager, damageManager, energy, _fire, _projectileManager, webAddress));
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
|
||||
}
|
||||
|
||||
@ -181,7 +182,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new GamePlayerManager(this);
|
||||
_gameStatsManager = new GameStatsManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
_miscManager = new MiscManager(this);
|
||||
new IdleManager(this);
|
||||
|
||||
//Game Addons
|
||||
|
@ -1,5 +1,8 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -8,18 +11,22 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class MiscManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
private List<String> _dontGiveClockList = new ArrayList<String>();
|
||||
private ArcadeManager Manager;
|
||||
|
||||
public MiscManager(ArcadeManager manager)
|
||||
{
|
||||
@ -69,6 +76,24 @@ public class MiscManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void addClockPrevent(InventoryOpenEvent event)
|
||||
{
|
||||
if (event.getPlayer() instanceof Player)
|
||||
{
|
||||
_dontGiveClockList.add(event.getPlayer().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removeClockPrevent(InventoryCloseEvent event)
|
||||
{
|
||||
if (event.getPlayer() instanceof Player)
|
||||
{
|
||||
_dontGiveClockList.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HubClockUpdate(UpdateEvent event)
|
||||
{
|
||||
@ -85,7 +110,7 @@ public class MiscManager implements Listener
|
||||
{
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
{
|
||||
if (!player.getInventory().contains(Material.WATCH))
|
||||
if (!_dontGiveClockList.contains(player.getName()) && !player.getInventory().contains(Material.WATCH))
|
||||
{
|
||||
Manager.HubClock(player);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import nautilus.game.core.player.IGamePlayer;
|
||||
|
||||
public interface IScoreHandler<PlayerType extends IGamePlayer>
|
||||
{
|
||||
void RewardForDeath(PlayerType player);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import nautilus.game.core.engine.ITeam;
|
||||
import nautilus.game.core.player.ITeamGamePlayer;
|
||||
|
||||
public interface ITeamScoreHandler<PlayerType extends ITeamGamePlayer<PlayerTeamType>, PlayerTeamType extends ITeam<PlayerType>> extends IScoreHandler<PlayerType>
|
||||
{
|
||||
void RewardForTeamKill(PlayerType killer, PlayerType victim);
|
||||
|
||||
void RewardForKill(PlayerType killer, PlayerType victim, int assists);
|
||||
|
||||
void RewardForAssist(PlayerType assistant, PlayerType victim);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet201PlayerInfo;
|
||||
|
||||
public class LineTracker
|
||||
{
|
||||
private String _line = null;
|
||||
private String _oldLine = null;
|
||||
private Packet201PlayerInfo _clearOldPacket;
|
||||
private Packet201PlayerInfo _addNewPacket;
|
||||
private Packet201PlayerInfo _clearNewPacket;
|
||||
|
||||
public LineTracker()
|
||||
{
|
||||
_line = null;
|
||||
}
|
||||
|
||||
public void SetLine(String s)
|
||||
{
|
||||
if (s != null && s.length() > 16)
|
||||
s = s.substring(0, 16);
|
||||
|
||||
_oldLine = _line;
|
||||
_line = s;
|
||||
|
||||
if (_oldLine != null)
|
||||
{
|
||||
_clearOldPacket = new Packet201PlayerInfo(_oldLine, false, 0);
|
||||
}
|
||||
|
||||
if (_line != null)
|
||||
{
|
||||
_addNewPacket = new Packet201PlayerInfo(_line, true, 0);
|
||||
_clearNewPacket = new Packet201PlayerInfo(_line, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayLineToPlayer(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (_oldLine != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_clearOldPacket);
|
||||
}
|
||||
|
||||
if (_line != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_addNewPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveLineForPlayer(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (_line != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_clearNewPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearOldLine()
|
||||
{
|
||||
_oldLine = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import nautilus.game.core.player.IGamePlayer;
|
||||
|
||||
public class PlayerPointSorter<PlayerType extends IGamePlayer> implements Comparator<PlayerType>
|
||||
{
|
||||
public int compare(PlayerType a, PlayerType b)
|
||||
{
|
||||
if (a.GetPoints() != b.GetPoints())
|
||||
return b.GetPoints() - a.GetPoints();
|
||||
|
||||
return a.getName().toLowerCase().compareTo(b.getName().toLowerCase());
|
||||
}
|
||||
}
|
@ -0,0 +1,304 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.packethandler.IPacketRunnable;
|
||||
import mineplex.core.packethandler.PacketArrayList;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import nautilus.game.core.engine.ITeam;
|
||||
import nautilus.game.core.game.ITeamGame;
|
||||
import nautilus.game.core.player.ITeamGamePlayer;
|
||||
import nautilus.minecraft.core.utils.TimeStuff;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.Packet201PlayerInfo;
|
||||
|
||||
public class TabScoreboard<GameType extends ITeamGame<?, PlayerType, TeamType>, PlayerType extends ITeamGamePlayer<TeamType>, TeamType extends ITeam<PlayerType>> implements IPacketRunnable
|
||||
{
|
||||
protected CoreClientManager ClientManager;
|
||||
protected ClassManager ClassManager;
|
||||
protected PacketHandler PacketHandler;
|
||||
protected NautHashMap<String, NautHashMap<Integer, LineTracker>> MainColumn;
|
||||
|
||||
protected GameType Game;
|
||||
protected NautHashMap<Integer, LineTracker> RedColumn;
|
||||
protected NautHashMap<Integer, LineTracker> BlueColumn;
|
||||
|
||||
private boolean _updating = false;
|
||||
|
||||
public TabScoreboard(JavaPlugin plugin, CoreClientManager clientManager, ClassManager classManager, PacketHandler packetHandler, GameType game)
|
||||
{
|
||||
ClientManager = clientManager;
|
||||
ClassManager = classManager;
|
||||
PacketHandler = packetHandler;
|
||||
Game = game;
|
||||
RedColumn = new NautHashMap<Integer, LineTracker>();
|
||||
BlueColumn = new NautHashMap<Integer, LineTracker>();
|
||||
MainColumn = new NautHashMap<String, NautHashMap<Integer, LineTracker>>();
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
RedColumn.put(i, new LineTracker());
|
||||
}
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
BlueColumn.put(i, new LineTracker());
|
||||
}
|
||||
|
||||
PacketHandler.AddPacketRunnable(this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
SetRedTeamInfo();
|
||||
SetBlueTeamInfo();
|
||||
|
||||
for (PlayerType player : Game.GetPlayers())
|
||||
{
|
||||
UpdateForPlayer(player);
|
||||
|
||||
if (player.isOnline())
|
||||
SendPlayerScoreboard(player);
|
||||
}
|
||||
|
||||
for (PlayerType player : Game.GetSpectators())
|
||||
{
|
||||
UpdateForPlayer(player);
|
||||
SendPlayerScoreboard(player);
|
||||
}
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
RedColumn.get(i).ClearOldLine();
|
||||
}
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
BlueColumn.get(i).ClearOldLine();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSpectator(PlayerType spectator)
|
||||
{
|
||||
UpdateForPlayer(spectator);
|
||||
SendPlayerScoreboard(spectator);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
RedColumn.get(i).SetLine("");
|
||||
}
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
BlueColumn.get(i).SetLine("");
|
||||
}
|
||||
|
||||
Packet201PlayerInfo clearPacket = new Packet201PlayerInfo("", false, 0);
|
||||
|
||||
_updating = true;
|
||||
for (PlayerType player : Game.GetPlayers())
|
||||
{
|
||||
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
|
||||
|
||||
// If player quit as game was preparing and never reconnected...
|
||||
if (playerLines != null)
|
||||
{
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
playerLines.get(i).SetLine("");
|
||||
}
|
||||
|
||||
SendPlayerScoreboard(player);
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
|
||||
|
||||
entityPlayer.playerConnection.sendPacket(clearPacket);
|
||||
}
|
||||
}
|
||||
|
||||
for (PlayerType player : Game.GetSpectators())
|
||||
{
|
||||
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
playerLines.get(i).SetLine("");
|
||||
}
|
||||
|
||||
SendPlayerScoreboard(player);
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
|
||||
|
||||
entityPlayer.playerConnection.sendPacket(clearPacket);
|
||||
}
|
||||
_updating = false;
|
||||
|
||||
PacketHandler.RemovePacketRunnable(this);
|
||||
}
|
||||
|
||||
public void UpdateForPlayer(PlayerType player)
|
||||
{
|
||||
SetMainInfo(player);
|
||||
}
|
||||
|
||||
protected void SetRedTeamInfo()
|
||||
{
|
||||
RedColumn.get(0).SetLine(ChatColor.RED + " [RED]");
|
||||
RedColumn.get(1).SetLine(ChatColor.RED + "Score: " + ChatColor.WHITE + Game.GetRedTeam().GetScore());
|
||||
RedColumn.get(8).SetLine(ChatColor.RED + " [Players]");
|
||||
RedColumn.get(9).SetLine(ChatColor.RED + " [K/D/A S]");
|
||||
|
||||
String spacer = "";
|
||||
for (int i=0; i < 5; i++)
|
||||
{
|
||||
int lineIndex = 10 + i * 2;
|
||||
spacer += " ";
|
||||
|
||||
if (i < Game.GetRedTeam().GetPlayers().size())
|
||||
{
|
||||
PlayerType player = Game.GetRedTeam().GetPlayers().get(i);
|
||||
|
||||
ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE;
|
||||
RedColumn.get(lineIndex).SetLine(playerColor + player.getName());
|
||||
RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer);
|
||||
}
|
||||
else
|
||||
{
|
||||
RedColumn.get(lineIndex).SetLine(ChatColor.RED + "" + ChatColor.GREEN + spacer);
|
||||
RedColumn.get(lineIndex+1).SetLine(ChatColor.RED + "" + ChatColor.BLUE + spacer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetMainInfo(PlayerType player)
|
||||
{
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
|
||||
ClientClass clientPlayer = ClassManager.Get(player.GetPlayer());
|
||||
|
||||
if (!MainColumn.containsKey(player.getName()))
|
||||
{
|
||||
NautHashMap<Integer, LineTracker> playerLines = new NautHashMap<Integer, LineTracker>();
|
||||
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
playerLines.put(i, new LineTracker());
|
||||
}
|
||||
|
||||
MainColumn.put(player.getName(), playerLines);
|
||||
}
|
||||
|
||||
NautHashMap<Integer, LineTracker> playerLines = MainColumn.get(player.getName());
|
||||
|
||||
playerLines.get(0).SetLine(ChatColor.GREEN + " [Dominate]");
|
||||
playerLines.get(1).SetLine(ChatColor.GREEN + "Map:");
|
||||
playerLines.get(2).SetLine(Game.GetArena().GetName());
|
||||
playerLines.get(3).SetLine(ChatColor.GREEN + "Win Limit:");
|
||||
playerLines.get(4).SetLine(Game.GetWinLimit() + "");
|
||||
playerLines.get(5).SetLine(ChatColor.GREEN + "Duration:");
|
||||
playerLines.get(6).SetLine((Game.GetStartTime() == 0 ? "0" : TimeStuff.GetTimespanString(System.currentTimeMillis() - Game.GetStartTime())));
|
||||
playerLines.get(7).SetLine(ChatColor.GREEN + "");
|
||||
playerLines.get(8).SetLine(ChatColor.GREEN + " [Stats]");
|
||||
playerLines.get(9).SetLine(ChatColor.GREEN + "Class:" );
|
||||
playerLines.get(10).SetLine((clientPlayer.GetGameClass() == null ? "None" : clientPlayer.GetGameClass().GetName()));
|
||||
playerLines.get(11).SetLine(ChatColor.GREEN + "Kills:");
|
||||
playerLines.get(12).SetLine(player.GetKills() + " ");
|
||||
playerLines.get(13).SetLine(ChatColor.GREEN + "Deaths:");
|
||||
playerLines.get(14).SetLine(player.GetDeaths() + " ");
|
||||
playerLines.get(15).SetLine(ChatColor.GREEN + "Assists:");
|
||||
playerLines.get(16).SetLine(player.GetAssists() + " ");
|
||||
playerLines.get(17).SetLine(ChatColor.GREEN + "Score:");
|
||||
playerLines.get(18).SetLine(player.GetPoints() + " ");
|
||||
playerLines.get(19).SetLine(ChatColor.GREEN + " ");
|
||||
}
|
||||
|
||||
protected void SetBlueTeamInfo()
|
||||
{
|
||||
BlueColumn.get(0).SetLine(ChatColor.BLUE + " [BLUE]");
|
||||
BlueColumn.get(1).SetLine(ChatColor.BLUE + "Score: " + ChatColor.WHITE + Game.GetBlueTeam().GetScore());
|
||||
BlueColumn.get(8).SetLine(ChatColor.BLUE + " [Players]");
|
||||
BlueColumn.get(9).SetLine(ChatColor.BLUE + " [K/D/A S]");
|
||||
|
||||
String spacer = "";
|
||||
for (int i=0; i < 5; i++)
|
||||
{
|
||||
int lineIndex = 10 + i * 2;
|
||||
spacer += " ";
|
||||
|
||||
if (i < Game.GetBlueTeam().GetPlayers().size())
|
||||
{
|
||||
PlayerType player = Game.GetBlueTeam().GetPlayers().get(i);
|
||||
|
||||
ChatColor playerColor = !player.isOnline() ? ChatColor.DARK_GRAY : ChatColor.WHITE;
|
||||
BlueColumn.get(lineIndex).SetLine(playerColor + player.getName());
|
||||
BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + "" + player.GetKills() + "/" + player.GetDeaths() + "/" + player.GetAssists() + " " + player.GetPoints() + spacer);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlueColumn.get(lineIndex).SetLine(ChatColor.BLUE + " " + ChatColor.GREEN + spacer);
|
||||
BlueColumn.get(lineIndex+1).SetLine(ChatColor.BLUE + " " + ChatColor.RED + spacer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearScoreboardForSpectator(PlayerType player)
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
|
||||
NautHashMap<Integer, LineTracker> playersLines = MainColumn.get(player.getName());
|
||||
|
||||
if (playersLines == null)
|
||||
return;
|
||||
|
||||
_updating = true;
|
||||
for (Integer i=0; i < 20; i++)
|
||||
{
|
||||
RedColumn.get(i).RemoveLineForPlayer(entityPlayer);
|
||||
playersLines.get(i).RemoveLineForPlayer(entityPlayer);
|
||||
BlueColumn.get(i).RemoveLineForPlayer(entityPlayer);
|
||||
}
|
||||
_updating = false;
|
||||
|
||||
MainColumn.remove(player.getName());
|
||||
}
|
||||
|
||||
public void SendPlayerScoreboard(PlayerType player)
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player.GetPlayer()).getHandle();
|
||||
NautHashMap<Integer, LineTracker> playersLines = MainColumn.get(player.getName());
|
||||
|
||||
_updating = true;
|
||||
for (int i=0; i < 20; i++)
|
||||
{
|
||||
RedColumn.get(i).DisplayLineToPlayer(entityPlayer);
|
||||
playersLines.get(i).DisplayLineToPlayer(entityPlayer);
|
||||
BlueColumn.get(i).DisplayLineToPlayer(entityPlayer);
|
||||
|
||||
playersLines.get(i).ClearOldLine();
|
||||
}
|
||||
_updating = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(Packet packet, Player owner, PacketArrayList packetList)
|
||||
{
|
||||
if (packet instanceof Packet201PlayerInfo)
|
||||
{
|
||||
if (Game.IsPlayerInGame(owner) && Game.IsActive())
|
||||
return _updating;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package nautilus.game.core.scoreboard;
|
||||
|
||||
import nautilus.game.core.arena.ITeamArena;
|
||||
import nautilus.game.core.engine.ITeam;
|
||||
import nautilus.game.core.game.ITeamGame;
|
||||
import nautilus.game.core.notifier.TeamPlayerNotifier;
|
||||
import nautilus.game.core.player.ITeamGamePlayer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public abstract class TeamGameScoreHandler<NotifierType extends TeamPlayerNotifier<GameType, ArenaType, PlayerTeamType, PlayerType>, GameType extends ITeamGame<ArenaType, PlayerType, PlayerTeamType>, ArenaType extends ITeamArena, PlayerTeamType extends ITeam<PlayerType>, PlayerType extends ITeamGamePlayer<PlayerTeamType>> implements ITeamScoreHandler<PlayerType, PlayerTeamType>, Listener
|
||||
{
|
||||
protected NotifierType Notifier;
|
||||
|
||||
public TeamGameScoreHandler(JavaPlugin plugin, NotifierType notifier)
|
||||
{
|
||||
Notifier = notifier;
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
public void RewardForDeath(PlayerType player)
|
||||
{
|
||||
player.AddPoints(-5);
|
||||
Notifier.BroadcastMessageToPlayer("Your score was reduced by " + ChatColor.YELLOW + 5 + ChatColor.GRAY + " for dying!", player.GetPlayer());
|
||||
}
|
||||
|
||||
public void RewardForTeamKill(PlayerType killer, PlayerType victim)
|
||||
{
|
||||
killer.AddPoints(-25);
|
||||
|
||||
Notifier.BroadcastMessageToPlayer("You team killed " + victim.getName() + " and reduced your score by " + ChatColor.YELLOW + -25 + ChatColor.GRAY + "!", killer.GetPlayer());
|
||||
}
|
||||
|
||||
public void RewardForKill(PlayerType killer, PlayerType victim, int assists)
|
||||
{
|
||||
int deathValue = 15;
|
||||
int deathPoints = deathValue + GetKillModifierValue(killer, victim, assists);
|
||||
|
||||
killer.AddPoints(deathPoints - (assists * 2));
|
||||
|
||||
Notifier.BroadcastMessageToPlayer("You killed " + victim.getName() + " for an additional +" + ChatColor.YELLOW + (deathPoints - (assists * 2)) + ChatColor.GRAY + " to your score!", killer.GetPlayer());
|
||||
}
|
||||
|
||||
public void RewardForAssist(PlayerType assistant, PlayerType victim)
|
||||
{
|
||||
assistant.AddPoints(2);
|
||||
Notifier.BroadcastMessageToPlayer("You helped kill " + victim.getName() + " for an additional +" + ChatColor.YELLOW + 2 + ChatColor.GRAY + " to your score!", assistant.GetPlayer());
|
||||
}
|
||||
|
||||
protected abstract int GetKillModifierValue(PlayerType killer, PlayerType victim, int assists);
|
||||
}
|
@ -16,6 +16,9 @@
|
||||
|
||||
[StringLength(40)]
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Uuid { get; set; }
|
||||
|
||||
public Rank Rank { get; set; }
|
||||
public bool RankPerm { get; set; }
|
||||
public DateTime RankExpire { get; set; }
|
||||
|
@ -12,10 +12,6 @@
|
||||
|
||||
public int CustomBuildNumber { get; set; }
|
||||
|
||||
public int SkillTokensBalance { get; set; }
|
||||
|
||||
public int ItemTokensBalance { get; set; }
|
||||
|
||||
public string PvpClass { get; set; }
|
||||
|
||||
public string SwordSkill { get; set; }
|
||||
@ -36,30 +32,43 @@
|
||||
public string GlobalPassiveSkill { get; set; }
|
||||
public int GlobalPassiveSkillLevel { get; set; }
|
||||
|
||||
public int SkillTokens { get; set; }
|
||||
|
||||
public int ItemTokens { get; set; }
|
||||
|
||||
public string Slot1Name { get; set; }
|
||||
public string Slot1Material { get; set; }
|
||||
public int Slot1Amount { get; set; }
|
||||
|
||||
public string Slot2Name { get; set; }
|
||||
public string Slot2Material { get; set; }
|
||||
public int Slot2Amount { get; set; }
|
||||
|
||||
public string Slot3Name { get; set; }
|
||||
public string Slot3Material { get; set; }
|
||||
public int Slot3Amount { get; set; }
|
||||
|
||||
public string Slot4Name { get; set; }
|
||||
public string Slot4Material { get; set; }
|
||||
public int Slot4Amount { get; set; }
|
||||
|
||||
public string Slot5Name { get; set; }
|
||||
public string Slot5Material { get; set; }
|
||||
public int Slot5Amount { get; set; }
|
||||
|
||||
public string Slot6Name { get; set; }
|
||||
public string Slot6Material { get; set; }
|
||||
public int Slot6Amount { get; set; }
|
||||
|
||||
public string Slot7Name { get; set; }
|
||||
public string Slot7Material { get; set; }
|
||||
public int Slot7Amount { get; set; }
|
||||
|
||||
public string Slot8Name { get; set; }
|
||||
public string Slot8Material { get; set; }
|
||||
public int Slot8Amount { get; set; }
|
||||
|
||||
public string Slot9Name { get; set; }
|
||||
public string Slot9Material { get; set; }
|
||||
public int Slot9Amount { get; set; }
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
FilterChat = account.FilterChat;
|
||||
Name = account.Name;
|
||||
Uuid = account.Uuid;
|
||||
Rank = account.Rank.Name;
|
||||
|
||||
EconomyBalance = account.EconomyBalance;
|
||||
@ -112,6 +113,9 @@
|
||||
public bool FilterChat { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Uuid { get; set; }
|
||||
|
||||
public string Rank { get; set; }
|
||||
|
||||
public int EconomyBalance { get; set; }
|
||||
|
@ -13,8 +13,6 @@
|
||||
Name = customBuild.Name;
|
||||
Active = customBuild.Active;
|
||||
CustomBuildNumber = customBuild.CustomBuildNumber;
|
||||
SkillTokensBalance = customBuild.SkillTokensBalance;
|
||||
ItemTokensBalance = customBuild.ItemTokensBalance;
|
||||
PvpClass = customBuild.PvpClass;
|
||||
|
||||
SwordSkill = customBuild.SwordSkill;
|
||||
@ -35,17 +33,20 @@
|
||||
GlobalPassiveSkill = customBuild.GlobalPassiveSkill;
|
||||
GlobalPassiveSkillLevel = customBuild.GlobalPassiveSkillLevel;
|
||||
|
||||
SkillTokens = customBuild.SkillTokens;
|
||||
ItemTokens = customBuild.ItemTokens;
|
||||
|
||||
Slots = new List<SlotToken>();
|
||||
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot1Material, Amount = customBuild.Slot1Amount});
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot2Material, Amount = customBuild.Slot2Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot3Material, Amount = customBuild.Slot3Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot4Material, Amount = customBuild.Slot4Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot5Material, Amount = customBuild.Slot5Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot6Material, Amount = customBuild.Slot6Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot7Material, Amount = customBuild.Slot7Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot8Material, Amount = customBuild.Slot8Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot9Material, Amount = customBuild.Slot9Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot1Material, Name = customBuild.Slot1Name, Amount = customBuild.Slot1Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot2Material, Name = customBuild.Slot2Name, Amount = customBuild.Slot2Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot3Material, Name = customBuild.Slot3Name, Amount = customBuild.Slot3Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot4Material, Name = customBuild.Slot4Name, Amount = customBuild.Slot4Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot5Material, Name = customBuild.Slot5Name, Amount = customBuild.Slot5Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot6Material, Name = customBuild.Slot6Name, Amount = customBuild.Slot6Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot7Material, Name = customBuild.Slot7Name, Amount = customBuild.Slot7Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot8Material, Name = customBuild.Slot8Name, Amount = customBuild.Slot8Amount });
|
||||
Slots.Add(new SlotToken { Material = customBuild.Slot9Material, Name = customBuild.Slot9Name, Amount = customBuild.Slot9Amount });
|
||||
}
|
||||
|
||||
public int CustomBuildId { get; set; }
|
||||
@ -58,10 +59,6 @@
|
||||
|
||||
public int CustomBuildNumber { get; set; }
|
||||
|
||||
public int SkillTokensBalance { get; set; }
|
||||
|
||||
public int ItemTokensBalance { get; set; }
|
||||
|
||||
public string PvpClass { get; set; }
|
||||
|
||||
public string SwordSkill { get; set; }
|
||||
@ -84,6 +81,10 @@
|
||||
|
||||
public List<SlotToken> Slots { get; set; }
|
||||
|
||||
public int SkillTokens { get; set; }
|
||||
|
||||
public int ItemTokens { get; set; }
|
||||
|
||||
public CustomBuild GetCustomBuild()
|
||||
{
|
||||
var customBuild = new CustomBuild();
|
||||
@ -99,8 +100,6 @@
|
||||
customBuild.Active = Active;
|
||||
customBuild.CustomBuildNumber = CustomBuildNumber;
|
||||
customBuild.PvpClass = PvpClass;
|
||||
customBuild.SkillTokensBalance = SkillTokensBalance;
|
||||
customBuild.ItemTokensBalance = ItemTokensBalance;
|
||||
|
||||
customBuild.SwordSkill = SwordSkill;
|
||||
customBuild.SwordSkillLevel = SwordSkillLevel;
|
||||
@ -118,33 +117,46 @@
|
||||
customBuild.GlobalPassiveSkill = GlobalPassiveSkill;
|
||||
customBuild.GlobalPassiveSkillLevel = GlobalPassiveSkillLevel;
|
||||
|
||||
customBuild.ItemTokens = ItemTokens;
|
||||
customBuild.SkillTokens = SkillTokens;
|
||||
|
||||
if (Slots != null && Slots.Count > 0)
|
||||
{
|
||||
var slots = Slots.ToArray();
|
||||
customBuild.Slot1Material = slots[0].Material;
|
||||
|
||||
customBuild.Slot1Name = slots[0].Name;
|
||||
customBuild.Slot1Material = slots[0].Material;
|
||||
customBuild.Slot1Amount = slots[0].Amount;
|
||||
|
||||
customBuild.Slot2Name = slots[1].Name;
|
||||
customBuild.Slot2Material = slots[1].Material;
|
||||
customBuild.Slot2Amount = slots[1].Amount;
|
||||
|
||||
customBuild.Slot3Name = slots[2].Name;
|
||||
customBuild.Slot3Material = slots[2].Material;
|
||||
customBuild.Slot3Amount = slots[2].Amount;
|
||||
|
||||
customBuild.Slot4Name = slots[3].Name;
|
||||
customBuild.Slot4Material = slots[3].Material;
|
||||
customBuild.Slot4Amount = slots[3].Amount;
|
||||
|
||||
customBuild.Slot5Name = slots[4].Name;
|
||||
customBuild.Slot5Material = slots[4].Material;
|
||||
customBuild.Slot5Amount = slots[4].Amount;
|
||||
|
||||
customBuild.Slot6Name = slots[5].Name;
|
||||
customBuild.Slot6Material = slots[5].Material;
|
||||
customBuild.Slot6Amount = slots[5].Amount;
|
||||
|
||||
customBuild.Slot7Name = slots[6].Name;
|
||||
customBuild.Slot7Material = slots[6].Material;
|
||||
customBuild.Slot7Amount = slots[6].Amount;
|
||||
|
||||
customBuild.Slot8Name = slots[7].Name;
|
||||
customBuild.Slot8Material = slots[7].Material;
|
||||
customBuild.Slot8Amount = slots[7].Amount;
|
||||
|
||||
customBuild.Slot9Name = slots[8].Name;
|
||||
customBuild.Slot9Material = slots[8].Material;
|
||||
customBuild.Slot9Amount = slots[8].Amount;
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ namespace LOC.Core.Tokens.Client
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Uuid { get; set; }
|
||||
|
||||
public Server Server { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
public class SlotToken
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Material { get; set; }
|
||||
public int Amount { get; set; }
|
||||
}
|
||||
|
@ -79,6 +79,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Insert UUID if not there
|
||||
if (String.IsNullOrEmpty(account.Uuid) && !String.IsNullOrEmpty(loginToken.Uuid))
|
||||
{
|
||||
account.Uuid = loginToken.Uuid;
|
||||
edited = true;
|
||||
}
|
||||
|
||||
// Expire ranks
|
||||
if ((account.Rank.Name == "ULTRA") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0)
|
||||
{
|
||||
@ -557,6 +564,7 @@
|
||||
var newAccount = new Account
|
||||
{
|
||||
Name = loginToken.Name,
|
||||
Uuid = loginToken.Uuid,
|
||||
Rank = repository.Where<Rank>(x => x.RankId == 1).First(),
|
||||
Gems = 0,
|
||||
Transactions = new List<Transaction>(),
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user