|
|
|
@ -7,7 +7,9 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
|
|
|
|
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
|
|
|
|
|
import mineplex.core.MiniClientPlugin;
|
|
|
|
|
import mineplex.core.account.CoreClientManager;
|
|
|
|
|
import mineplex.core.account.event.ClientWebResponseEvent;
|
|
|
|
@ -29,24 +31,25 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|
|
|
|
private ClassRepository _repository;
|
|
|
|
|
private HashMap<String, IPvpClass> _classes;
|
|
|
|
|
private HashMap<Integer, IPvpClass> _classSalesPackageIdMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Object _clientLock = new Object();
|
|
|
|
|
|
|
|
|
|
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SkillFactory skillFactory, String webAddress)
|
|
|
|
|
|
|
|
|
|
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
|
|
|
|
|
SkillFactory skillFactory, String webAddress)
|
|
|
|
|
{
|
|
|
|
|
super("Class Manager", plugin);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_plugin = plugin;
|
|
|
|
|
_clientManager = clientManager;
|
|
|
|
|
_donationManager = donationManager;
|
|
|
|
|
_skillFactory = skillFactory;
|
|
|
|
|
_repository = new ClassRepository(webAddress);
|
|
|
|
|
_classes = new HashMap<String, IPvpClass>();
|
|
|
|
|
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
|
|
|
|
|
|
|
|
|
PopulateClasses();
|
|
|
|
|
_repository = new ClassRepository(webAddress);
|
|
|
|
|
_classes = new HashMap<String, IPvpClass>();
|
|
|
|
|
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
|
|
|
|
|
|
|
|
|
PopulateClasses();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void OnClientWebResponse(ClientWebResponseEvent event)
|
|
|
|
|
{
|
|
|
|
@ -58,7 +61,9 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|
|
|
|
{
|
|
|
|
|
synchronized (_clientLock)
|
|
|
|
|
{
|
|
|
|
|
Set(token.Name, new ClientClass(this, _skillFactory, _clientManager.Get(token.Name), _donationManager.Get(token.Name), token.DonorToken));
|
|
|
|
|
Set(token.Name,
|
|
|
|
|
new ClientClass(this, _skillFactory, _clientManager.Get(token.Name), _donationManager
|
|
|
|
|
.Get(token.Name), token.DonorToken));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -69,137 +74,173 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|
|
|
|
return super.Get(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void PopulateClasses()
|
|
|
|
|
{
|
|
|
|
|
_classes.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AddKnight();
|
|
|
|
|
AddRanger();
|
|
|
|
|
AddBrute();
|
|
|
|
|
AddMage();
|
|
|
|
|
AddAssassin();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
AddClass(new PvpClass(this, 6, ClassType.Shapeshifter,
|
|
|
|
|
new String[] { "Able to transform into various creatures." },
|
|
|
|
|
Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS,
|
|
|
|
|
Color.fromRGB(20, 100, 0)));
|
|
|
|
|
*/
|
|
|
|
|
* AddClass(new PvpClass(this, 6, ClassType.Shapeshifter, new String[] {
|
|
|
|
|
* "Able to transform into various creatures." },
|
|
|
|
|
* Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE,
|
|
|
|
|
* Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, Color.fromRGB(20,
|
|
|
|
|
* 100, 0)));
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
for (IPvpClass pvpClass : GetAllClasses())
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = pvpClass.getDefaultBuild();
|
|
|
|
|
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 (swordSkill != null)
|
|
|
|
|
swordSkill.setFree(true);
|
|
|
|
|
|
|
|
|
|
if (axeSkill != null)
|
|
|
|
|
axeSkill.setFree(true);
|
|
|
|
|
|
|
|
|
|
if (bowSkill != null)
|
|
|
|
|
bowSkill.setFree(true);
|
|
|
|
|
|
|
|
|
|
if (classPassiveASkill != null)
|
|
|
|
|
classPassiveASkill.setFree(true);
|
|
|
|
|
|
|
|
|
|
if (classPassiveBSkill != null)
|
|
|
|
|
classPassiveBSkill.setFree(true);
|
|
|
|
|
|
|
|
|
|
if (globalPassive != null)
|
|
|
|
|
globalPassive.setFree(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddAssassin()
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = new CustomBuildToken();
|
|
|
|
|
customBuild.Name = "Default Build";
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Evade";
|
|
|
|
|
customBuild.AxeSkill = "Blink";
|
|
|
|
|
customBuild.BowSkill = "Marked for Death";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Stealth";
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Repeated Strikes";
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Break Fall";
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(
|
|
|
|
|
this,
|
|
|
|
|
5,
|
|
|
|
|
ClassType.Assassin,
|
|
|
|
|
customBuild,
|
|
|
|
|
new String[] { "Extremely nimble and smart.", "Excels at ambushing and takedowns.", "", "Permanent Speed II" },
|
|
|
|
|
Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS,
|
|
|
|
|
null));
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Evade";
|
|
|
|
|
customBuild.SwordSkillLevel = 2;
|
|
|
|
|
customBuild.AxeSkill = "Leap";
|
|
|
|
|
customBuild.AxeSkillLevel = 3;
|
|
|
|
|
customBuild.BowSkill = "Smoke Arrow";
|
|
|
|
|
customBuild.BowSkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveASkill = "Smoke Bomb";
|
|
|
|
|
customBuild.ClassPassiveASkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Combo Attack";
|
|
|
|
|
customBuild.ClassPassiveBSkillLevel = 2;
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Break Fall";
|
|
|
|
|
customBuild.GlobalPassiveSkillLevel = 1;
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this, 5, ClassType.Assassin, customBuild, new String[] { "Extremely nimble and smart.",
|
|
|
|
|
"Excels at ambushing and takedowns.", "", "Permanent Speed II" }, Material.LEATHER_HELMET,
|
|
|
|
|
Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddMage()
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = new CustomBuildToken();
|
|
|
|
|
customBuild.Name = "Default Build";
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Blizzard";
|
|
|
|
|
customBuild.AxeSkill = "Freezing Blast";
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Arctic Armor";
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Glacial Blade";
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Fitness";
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this,
|
|
|
|
|
4,
|
|
|
|
|
ClassType.Mage,
|
|
|
|
|
customBuild,
|
|
|
|
|
new String[] { "Trained in the ancient arts.", "Able to adapt to many roles in combat."},
|
|
|
|
|
Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS,
|
|
|
|
|
null));
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Blizzard";
|
|
|
|
|
customBuild.SwordSkillLevel = 3;
|
|
|
|
|
customBuild.AxeSkill = "Ice Prison";
|
|
|
|
|
customBuild.AxeSkillLevel = 3;
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Arctic Armor";
|
|
|
|
|
customBuild.ClassPassiveASkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Glacial Blade";
|
|
|
|
|
customBuild.ClassPassiveBSkillLevel = 2;
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Mana Pool";
|
|
|
|
|
customBuild.GlobalPassiveSkillLevel = 2;
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this, 4, ClassType.Mage, customBuild, new String[] { "Trained in the ancient arts.",
|
|
|
|
|
"Able to adapt to many roles in combat." }, Material.GOLD_HELMET, Material.GOLD_CHESTPLATE,
|
|
|
|
|
Material.GOLD_LEGGINGS, Material.GOLD_BOOTS, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddBrute()
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = new CustomBuildToken();
|
|
|
|
|
customBuild.Name = "Default Build";
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Dwarf Toss";
|
|
|
|
|
customBuild.AxeSkill = "Seismic Slam";
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Stampede";
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Crippling Blow";
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Recharge";
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this,
|
|
|
|
|
3,
|
|
|
|
|
ClassType.Brute,
|
|
|
|
|
customBuild,
|
|
|
|
|
new String[] { "Uses pure strength to dominate.", "Great at crowd control."},
|
|
|
|
|
Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS,
|
|
|
|
|
null));
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Block Toss";
|
|
|
|
|
customBuild.SwordSkillLevel = 4;
|
|
|
|
|
customBuild.AxeSkill = "Seismic Slam";
|
|
|
|
|
customBuild.AxeSkillLevel = 3;
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.BowSkillLevel = 0;
|
|
|
|
|
customBuild.ClassPassiveASkill = "Stampede";
|
|
|
|
|
customBuild.ClassPassiveASkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Crippling Blow";
|
|
|
|
|
customBuild.ClassPassiveBSkillLevel = 2;
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Recharge";
|
|
|
|
|
customBuild.GlobalPassiveSkillLevel = 1;
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this, 3, ClassType.Brute, customBuild, new String[] { "Uses pure strength to dominate.",
|
|
|
|
|
"Great at crowd control." }, Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE,
|
|
|
|
|
Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddRanger()
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = new CustomBuildToken();
|
|
|
|
|
customBuild.Name = "Default Build";
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Disengage";
|
|
|
|
|
customBuild.AxeSkill = "Agility";
|
|
|
|
|
customBuild.BowSkill = "Napalm Shot";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Barrage";
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Barbed Arrows";
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Quick Recovery";
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this,
|
|
|
|
|
-1,
|
|
|
|
|
ClassType.Ranger,
|
|
|
|
|
customBuild,
|
|
|
|
|
new String[] { "Mastery with a Bow and Arrow.", "Adept in Wilderness Survival" },
|
|
|
|
|
Material.CHAINMAIL_HELMET, Material.CHAINMAIL_CHESTPLATE, Material.CHAINMAIL_LEGGINGS, Material.CHAINMAIL_BOOTS,
|
|
|
|
|
null));
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Disengage";
|
|
|
|
|
customBuild.SwordSkillLevel = 3;
|
|
|
|
|
customBuild.AxeSkill = "Agility";
|
|
|
|
|
customBuild.AxeSkillLevel = 2;
|
|
|
|
|
customBuild.BowSkill = "Napalm Shot";
|
|
|
|
|
customBuild.BowSkillLevel = 3;
|
|
|
|
|
customBuild.ClassPassiveASkill = "Barrage";
|
|
|
|
|
customBuild.ClassPassiveASkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Barbed Arrows";
|
|
|
|
|
customBuild.ClassPassiveBSkillLevel = 1;
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Resistance";
|
|
|
|
|
customBuild.GlobalPassiveSkillLevel = 1;
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this, -1, ClassType.Ranger, customBuild, new String[] { "Mastery with a Bow and Arrow.",
|
|
|
|
|
"Adept in Wilderness Survival" }, Material.CHAINMAIL_HELMET, Material.CHAINMAIL_CHESTPLATE,
|
|
|
|
|
Material.CHAINMAIL_LEGGINGS, Material.CHAINMAIL_BOOTS, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddKnight()
|
|
|
|
|
{
|
|
|
|
|
CustomBuildToken customBuild = new CustomBuildToken();
|
|
|
|
|
customBuild.Name = "Default Build";
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Hilt Smash";
|
|
|
|
|
customBuild.AxeSkill = "Bulls Charge";
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Swordsmanship";
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Fortitude";
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Resistance";
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(
|
|
|
|
|
this,
|
|
|
|
|
-1,
|
|
|
|
|
ClassType.Knight,
|
|
|
|
|
customBuild,
|
|
|
|
|
new String[] { "Trained in the arts of melee combat.", "Able to stand his ground against foes."},
|
|
|
|
|
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS,
|
|
|
|
|
null));
|
|
|
|
|
|
|
|
|
|
customBuild.SwordSkill = "Hilt Smash";
|
|
|
|
|
customBuild.SwordSkillLevel = 3;
|
|
|
|
|
customBuild.AxeSkill = "Bulls Charge";
|
|
|
|
|
customBuild.AxeSkillLevel = 3;
|
|
|
|
|
customBuild.BowSkill = "";
|
|
|
|
|
customBuild.ClassPassiveASkill = "Swordsmanship";
|
|
|
|
|
customBuild.ClassPassiveASkillLevel = 2;
|
|
|
|
|
customBuild.ClassPassiveBSkill = "Vengeance";
|
|
|
|
|
customBuild.ClassPassiveBSkillLevel = 2;
|
|
|
|
|
customBuild.GlobalPassiveSkill = "Resistance";
|
|
|
|
|
customBuild.GlobalPassiveSkillLevel = 2;
|
|
|
|
|
|
|
|
|
|
AddClass(new PvpClass(this, -1, ClassType.Knight, customBuild, new String[] {
|
|
|
|
|
"Trained in the arts of melee combat.", "Able to stand his ground against foes." },
|
|
|
|
|
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IPvpClass GetClass(String className)
|
|
|
|
|
{
|
|
|
|
|
return _classes.get(className);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IPvpClass GetClass(int id)
|
|
|
|
|
{
|
|
|
|
|
return _classSalesPackageIdMap.get(id);
|
|
|
|
@ -216,26 +257,26 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Collection<IPvpClass> GetGameClasses()
|
|
|
|
|
public Collection<IPvpClass> GetGameClasses()
|
|
|
|
|
{
|
|
|
|
|
return _classes.values();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void update(UpdateEvent event)
|
|
|
|
|
{
|
|
|
|
|
if (event.getType() != UpdateType.FAST)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (IPvpClass cur : _classes.values())
|
|
|
|
|
cur.checkEquip();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SkillFactory GetSkillFactory()
|
|
|
|
|
public SkillFactory GetSkillFactory()
|
|
|
|
|
{
|
|
|
|
|
return _skillFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected ClientClass AddPlayer(String player)
|
|
|
|
|
{
|
|
|
|
@ -246,21 +287,21 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|
|
|
|
{
|
|
|
|
|
return _repository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void SkillDisplay(PlayerCommandPreprocessEvent event)
|
|
|
|
|
{
|
|
|
|
|
if (event.getMessage().equals("/skill"))
|
|
|
|
|
{
|
|
|
|
|
ClientClass client = Get(event.getPlayer().getName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (client == null)
|
|
|
|
|
event.getPlayer().sendMessage("You do not have a ClientClass.");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
client.DisplaySkills(event.getPlayer());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event.setCancelled(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|