Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/mineplex

This commit is contained in:
Chiss 2014-04-14 09:27:44 +10:00
commit 1c23cf7b4e
6 changed files with 155 additions and 133 deletions

View File

@ -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);
}
}

View File

@ -268,11 +268,7 @@ public class ClientClass
_lastArmor[1] = ItemStackFactory.Instance.CreateStack(_lastClass.GetLeggings());
_lastArmor[0] = ItemStackFactory.Instance.CreateStack(_lastClass.GetBoots());
for (ISkill skill : _lastClass.GetDefaultSkills().keySet())
{
if (skill.GetSkillType() != SkillType.Class)
_lastSkillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry<ISkill, Integer>(skill, _lastClass.GetDefaultSkills().get(skill)));
}
EquipCustomBuild(_customBuilds.get(_lastClass).get(0));
}
SetGameClass(_lastClass);
@ -329,12 +325,6 @@ public class ClientClass
ClearSkills();
for (ISkill cur : _gameClass.GetDefaultSkills().keySet())
{
if (cur.GetSkillType() == SkillType.Class)
AddSkill(cur, _gameClass.GetDefaultSkills().get(cur));
}
for (Entry<ISkill, Integer> skill : _lastSkillMap.values())
{
AddSkill(skill.getKey(), skill.getValue());
@ -508,7 +498,6 @@ public class ClientClass
if (ValidSkill(customBuild.GlobalPassiveSkill, globalPassive, SkillType.GlobalPassive))
SkillTokens -= globalPassive.GetTokenCost() * customBuild.GlobalPassiveSkillLevel;
}
public void DisplaySkills(Player player)

View File

@ -30,7 +30,6 @@ public interface IPvpClass
Material GetLeggings();
Material GetBoots();
HashSet<ISkill> GetSkills();
HashMap<ISkill, Integer> GetDefaultSkills();
void checkEquip();
Integer GetCost();

View File

@ -1,6 +1,5 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.UtilGear;
@ -33,7 +32,6 @@ public class PvpClass implements IPvpClass
private Color _leatherColor = null;
private HashSet<ISkill> _skillSet;
private HashMap<ISkill, Integer> _skillDefault;
private ClassManager _classes;
@ -58,8 +56,6 @@ public class PvpClass implements IPvpClass
_skillSet.addAll(_classes.GetSkillFactory().GetSkillsFor(this));
_skillSet.addAll(_classes.GetSkillFactory().GetGlobalSkillsFor(this));
_skillDefault = _classes.GetSkillFactory().GetDefaultSkillsFor(this);
_leatherColor = leatherColor;
}
@ -105,12 +101,6 @@ public class PvpClass implements IPvpClass
return _skillSet;
}
@Override
public HashMap<ISkill, Integer> GetDefaultSkills()
{
return _skillDefault;
}
public void checkEquip()
{
for (Player cur : Bukkit.getOnlinePlayers())

View File

@ -1,6 +1,5 @@
package mineplex.minecraft.game.classcombat.Skill;
import java.util.ArrayList;
import java.util.Set;
import org.bukkit.entity.Entity;
@ -28,6 +27,7 @@ public interface ISkill
int GetGemCost();
int GetTokenCost();
boolean IsFree();
void setFree(boolean free);
String[] GetDesc(int level);
void Reset(Player player);

View File

@ -8,7 +8,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilDisplay;
import mineplex.core.common.util.UtilGear;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
@ -303,12 +302,16 @@ public abstract class Skill implements ISkill, Listener
{
return _free;
}
@Override
public void setFree(boolean free)
{
_free = free;
}
public void Update(SkillToken skillToken)
{
_salesPackageId = skillToken.SalesPackage.GameSalesPackageId;
_free = skillToken.SalesPackage.Free;
_gemCost = skillToken.SalesPackage.Gems;
}
public void DisplayProgress(Player player, String ability, float amount)