use of com.solinia.solinia.Interfaces.ISoliniaClass in project solinia3-core by mixxit.
the class ConfigurationManager method getSpellsByClassIdAndMaxLevel.
@Override
public List<ISoliniaSpell> getSpellsByClassIdAndMaxLevel(int classId, int level) {
List<ISoliniaSpell> returnSpells = new ArrayList<ISoliniaSpell>();
ISoliniaClass classObj;
try {
classObj = StateManager.getInstance().getConfigurationManager().getClassObj(classId);
} catch (CoreStateInitException e) {
return returnSpells;
}
for (ISoliniaSpell spell : getSpells()) {
boolean addSpell = false;
for (SoliniaSpellClass spellclass : spell.getAllowedClasses()) {
if (spellclass.getMinlevel() > level)
continue;
if (spellclass.getClassname().toUpperCase().equals(classObj.getName().toUpperCase())) {
addSpell = true;
break;
}
}
if (addSpell == true)
returnSpells.add(spell);
}
return returnSpells;
}
use of com.solinia.solinia.Interfaces.ISoliniaClass in project solinia3-core by mixxit.
the class SoliniaCraft method editSetting.
public void editSetting(String setting, String value) throws InvalidCraftSettingException, NumberFormatException, CoreStateInitException {
switch(setting.toLowerCase()) {
case "recipename":
if (value.equals(""))
throw new InvalidCraftSettingException("Name is empty");
if (StateManager.getInstance().getConfigurationManager().getCraft(value.toUpperCase()) != null)
throw new InvalidCraftSettingException("Recipe already exists with this name");
setRecipeName(value.toUpperCase());
break;
case "classid":
ISoliniaClass classObj = StateManager.getInstance().getConfigurationManager().getClassObj(Integer.parseInt(value));
if (classObj == null)
throw new InvalidCraftSettingException("Class does not exist");
setClassId(Integer.parseInt(value));
break;
case "skilltype":
setSkilltype(SkillType.valueOf(value));
break;
case "minskill":
if (Integer.parseInt(value) < 0)
throw new InvalidCraftSettingException("Skill must be greater than or equal to 0");
setMinSkill(Integer.parseInt(value));
break;
case "item1":
int itemId1 = Integer.parseInt(value);
ISoliniaItem solitem1 = StateManager.getInstance().getConfigurationManager().getItem(itemId1);
if (solitem1 == null) {
throw new InvalidCraftSettingException("Invalid item id (in item 1)");
}
setItem1(itemId1);
break;
case "item2":
int itemId2 = Integer.parseInt(value);
ISoliniaItem solitem2 = StateManager.getInstance().getConfigurationManager().getItem(itemId2);
if (solitem2 == null) {
throw new InvalidCraftSettingException("Invalid item id (in item 2)");
}
setItem2(itemId2);
break;
case "outputitem":
int outputitem = Integer.parseInt(value);
ISoliniaItem soloutitem = StateManager.getInstance().getConfigurationManager().getItem(outputitem);
if (soloutitem == null) {
throw new InvalidCraftSettingException("Invalid item id (out item)");
}
setOutputItem(outputitem);
break;
default:
throw new InvalidCraftSettingException("Invalid zone setting. Valid Options are: recipename,item1,item2,outputitem");
}
}
use of com.solinia.solinia.Interfaces.ISoliniaClass in project solinia3-core by mixxit.
the class Utils method sendRaceInfo.
public static void sendRaceInfo(CommandSender sender) throws CoreStateInitException {
List<ISoliniaClass> classes = StateManager.getInstance().getConfigurationManager().getClasses();
for (ISoliniaRace race : StateManager.getInstance().getConfigurationManager().getRaces()) {
if (race.isAdmin())
continue;
String classBuilder = "";
for (ISoliniaClass solclass : classes) {
if (solclass.getValidRaces().contains(race.getId()))
classBuilder += solclass.getName() + " ";
}
TextComponent tc = new TextComponent();
tc.setText(ChatColor.RED + "~ RACE: " + ChatColor.GOLD + race.getName().toUpperCase() + ChatColor.GRAY + " [" + race.getId() + "] - " + ChatColor.RESET);
TextComponent tc2 = new TextComponent();
tc2.setText("Hover for more details");
String details = ChatColor.GOLD + race.getName() + ChatColor.RESET + "\nRecommended Alignment: " + ChatColor.GOLD + race.getAlignment() + ChatColor.RESET + "\n" + race.getDescription() + "\nSTR: " + ChatColor.GOLD + race.getStrength() + ChatColor.RESET + " STA: " + ChatColor.GOLD + race.getStamina() + ChatColor.RESET + " AGI: " + ChatColor.GOLD + race.getAgility() + ChatColor.RESET + " DEX: " + ChatColor.GOLD + race.getDexterity() + ChatColor.RESET + " INT: " + ChatColor.GOLD + race.getIntelligence() + ChatColor.RESET + " WIS: " + ChatColor.GOLD + race.getWisdom() + ChatColor.RESET + " CHA: " + ChatColor.GOLD + race.getCharisma() + ChatColor.GOLD + " \nClasses: " + ChatColor.RESET + classBuilder;
tc2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(details).create()));
tc.addExtra(tc2);
sender.spigot().sendMessage(tc);
}
}
use of com.solinia.solinia.Interfaces.ISoliniaClass in project solinia3-core by mixxit.
the class CommandCreateAllArmourSets method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player) && !(sender instanceof CommandSender))
return false;
try {
if (sender instanceof Player) {
Player player = (Player) sender;
if (!player.isOp() && !player.hasPermission("solinia.createallarmorsets")) {
player.sendMessage("You do not have permission to access this command");
return false;
}
}
if (args.length < 3) {
return false;
}
// args
// lootdropid
// armourtier
// chance
// suffixname
int lootdropid = Integer.parseInt(args[0]);
int armourtier = Integer.parseInt(args[1]);
ISoliniaLootDrop lootdrop = StateManager.getInstance().getConfigurationManager().getLootDrop(lootdropid);
if (lootdrop == null) {
sender.sendMessage("Lootdrop ID does not exist");
return true;
}
if (lootdrop.isOperatorCreated() && !sender.isOp()) {
sender.sendMessage("This lootdrop was op created and you are not an op. Only ops can edit op lootdrop items");
return false;
}
int chance = Integer.parseInt(args[2]);
if (chance < 1 || chance > 100) {
sender.sendMessage("Chance must be between 1 and 100");
return true;
}
String partialname = "";
int count = 0;
for (String entry : args) {
if (count < 3) {
count++;
continue;
}
partialname += entry + " ";
count++;
}
partialname = partialname.trim();
if (partialname.equals("")) {
sender.sendMessage("Blank suffix name not allowed when creating armour set");
return false;
}
String itemscreated = "";
for (ISoliniaClass classEntry : StateManager.getInstance().getConfigurationManager().getClasses()) {
List<Integer> items = SoliniaItemFactory.CreateClassItemSet(classEntry, armourtier, partialname, true, sender.isOp());
for (Integer item : items) {
SoliniaLootFactory.CreateLootDropItem(lootdropid, item, 1, false, chance, sender.isOp());
itemscreated += item + " ";
}
}
sender.sendMessage("Created items as IDs: " + itemscreated + " with " + chance + "% chance in lootdrop: " + lootdropid);
} catch (CoreStateInitException e) {
sender.sendMessage(e.getMessage());
} catch (SoliniaItemException e) {
// TODO Auto-generated catch block
sender.sendMessage(e.getMessage());
}
return true;
}
use of com.solinia.solinia.Interfaces.ISoliniaClass in project solinia3-core by mixxit.
the class CommandCreateArmourSet method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player) && !(sender instanceof CommandSender))
return false;
try {
if (sender instanceof Player) {
Player player = (Player) sender;
if (!player.isOp()) {
player.sendMessage("This is an operator only command");
return false;
}
}
if (args.length < 2) {
return false;
}
// args
// classid
// armourtier
// suffixname
int classid = Integer.parseInt(args[0]);
int armourtier = Integer.parseInt(args[1]);
ISoliniaClass classtype = StateManager.getInstance().getConfigurationManager().getClassObj(classid);
if (classtype == null) {
sender.sendMessage("Class ID does not exist");
return true;
}
String partialname = "";
int count = 0;
for (String entry : args) {
if (count < 2) {
count++;
continue;
}
partialname += entry + " ";
count++;
}
partialname = partialname.trim();
if (partialname.equals("")) {
sender.sendMessage("Blank suffix name not allowed when creating armour set");
return false;
}
List<Integer> items = SoliniaItemFactory.CreateClassItemSet(classtype, armourtier, partialname, false, sender.isOp());
String itemscreated = "";
for (Integer item : items) {
itemscreated += item + " ";
}
sender.sendMessage("Created items as IDs: " + itemscreated);
} catch (CoreStateInitException e) {
sender.sendMessage(e.getMessage());
} catch (SoliniaItemException e) {
// TODO Auto-generated catch block
sender.sendMessage(e.getMessage());
}
return true;
}
Aggregations