use of com.solinia.solinia.Interfaces.ISoliniaSpell in project solinia3-core by mixxit.
the class CommandPet method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// TODO Auto-generated method stub
if (sender instanceof Player) {
try {
Player player = (Player) sender;
LivingEntity pet = StateManager.getInstance().getEntityManager().getPet(player);
if (pet == null) {
player.sendMessage("You don't have a pet");
return true;
}
if (args.length > 0) {
String petcommand = args[0];
if (petcommand.equals("back")) {
Wolf c = (Wolf) pet;
player.setLastDamageCause(null);
player.sendMessage("* As you wish my master");
c.setTarget(null);
}
}
player.sendMessage("Pet Name: " + pet.getName());
player.sendMessage("Pet HP: " + pet.getHealth() + "/" + pet.getMaxHealth());
ISoliniaLivingEntity petLivingEntity = SoliniaLivingEntityAdapter.Adapt(pet);
EntityInsentient entityhandle = (EntityInsentient) ((org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity) pet).getHandle();
double dmg = entityhandle.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue();
player.sendMessage("Pet DMG: " + dmg);
player.sendMessage("STR: " + petLivingEntity.getStrength() + " STA: " + petLivingEntity.getStamina() + " AGI: " + petLivingEntity.getAgility() + " DEX: " + petLivingEntity.getDexterity() + " INT: " + petLivingEntity.getIntelligence() + " WIS: " + petLivingEntity.getWisdom() + " CHA: " + petLivingEntity.getCharisma());
player.sendMessage("Pet Armour Class Mitigation : " + petLivingEntity.getMitigationAC());
player.sendMessage("Pet Attack Value: " + petLivingEntity.getAttk());
player.sendMessage("Pet Total Rune of: " + petLivingEntity.getRune());
player.sendMessage("Active Effects:");
SoliniaEntitySpells spells = StateManager.getInstance().getEntityManager().getActiveEntitySpells(pet);
for (SoliniaActiveSpell activeSpell : spells.getActiveSpells()) {
ISoliniaSpell spell = StateManager.getInstance().getConfigurationManager().getSpell(activeSpell.getSpellId());
String removetext = "";
ChatColor spellcolor = ChatColor.GREEN;
if (spell.isBeneficial()) {
removetext = "Removable spell";
} else {
removetext = "Unremovable spell";
spellcolor = ChatColor.RED;
}
TextComponent tc = new TextComponent();
tc.setText("- " + spellcolor + spell.getName() + ChatColor.RESET + " " + activeSpell.getTicksLeft() + " ticks left - ");
TextComponent tc2 = new TextComponent();
tc2.setText(removetext);
tc.addExtra(tc2);
sender.spigot().sendMessage(tc);
}
return true;
} catch (CoreStateInitException e) {
}
}
return true;
}
use of com.solinia.solinia.Interfaces.ISoliniaSpell in project solinia3-core by mixxit.
the class CommandRebuildSpellItems method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player) && !(sender instanceof CommandSender)) {
sender.sendMessage("This is a Player/Console only command");
return false;
}
if (sender instanceof Player) {
Player player = (Player) sender;
if (!player.isOp()) {
player.sendMessage("This is an operator only command");
return true;
}
}
int updated = 0;
sender.sendMessage("Rebuilding Item Lists, this may take some time");
try {
for (ISoliniaSpell spell : StateManager.getInstance().getConfigurationManager().getSpells()) {
int worth = 10;
int minLevel = 1;
int lowestLevel = 1000;
for (SoliniaSpellClass spellClass : spell.getAllowedClasses()) {
if (spellClass.getMinlevel() < lowestLevel)
lowestLevel = spellClass.getMinlevel();
}
if (lowestLevel > minLevel && lowestLevel < 100)
minLevel = lowestLevel;
worth = worth * minLevel;
// Spell exists
if (StateManager.getInstance().getConfigurationManager().getSpellItem(spell.getId()).size() > 0) {
for (ISoliniaItem item : StateManager.getInstance().getConfigurationManager().getSpellItem(spell.getId())) {
item.setAbilityid(spell.getId());
item.setDisplayname("Spell: " + spell.getName());
item.setSpellscroll(true);
item.setAllowedClassNames(new ArrayList<String>());
item.setLore("This appears to be some sort of magical spell that could be learned");
item.setWorth(worth);
StateManager.getInstance().getConfigurationManager().updateItem(item);
updated++;
}
} else {
// Doesnt exist, create it
ISoliniaItem item = SoliniaItemFactory.CreateItem(new ItemStack(Material.ENCHANTED_BOOK), sender.isOp());
item.setAbilityid(spell.getId());
item.setDisplayname("Spell: " + spell.getName());
item.setSpellscroll(true);
item.setAllowedClassNames(new ArrayList<String>());
item.setLore("This appears to be some sort of magical spell that could be learned");
item.setWorth(worth);
StateManager.getInstance().getConfigurationManager().updateItem(item);
updated++;
}
}
} catch (Exception e) {
e.printStackTrace();
sender.sendMessage(e.getMessage());
}
sender.sendMessage("Updated " + updated + " items");
return true;
}
use of com.solinia.solinia.Interfaces.ISoliniaSpell in project solinia3-core by mixxit.
the class ItemStackAdapter method generateWeaponAbilityLoreText.
private static Collection<String> generateWeaponAbilityLoreText(ISoliniaItem soliniaItem) {
List<String> loreTxt = new ArrayList<String>();
ISoliniaSpell spell;
try {
spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getWeaponabilityid());
loreTxt.add(ChatColor.WHITE + "Chance to Proc on Hit: " + ChatColor.YELLOW + spell.getName() + ChatColor.RESET);
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return loreTxt;
}
use of com.solinia.solinia.Interfaces.ISoliniaSpell in project solinia3-core by mixxit.
the class ItemStackAdapter method generateSpellLoreText.
private static List<String> generateSpellLoreText(ISoliniaItem soliniaItem) {
List<String> loreTxt = new ArrayList<String>();
ISoliniaSpell spell;
try {
spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getAbilityid());
if (spell.getEffectid1() != 254 && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid1()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue1() == 0) && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue1() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid1()).name() + ChatColor.RESET);
}
if (spell.getEffectid2() != 254 && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid2()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue2() == 0) && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue2() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid2()).name() + ChatColor.RESET);
}
if (spell.getEffectid3() != 254 && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid3()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue3() == 0) && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue3() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid3()).name() + ChatColor.RESET);
}
if (spell.getEffectid4() != 254 && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid4()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue4() == 0) && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue4() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid4()).name() + ChatColor.RESET);
}
if (spell.getEffectid5() != 254 && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid5()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue5() == 0) && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue5() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid5()).name() + ChatColor.RESET);
}
if (spell.getEffectid6() != 254 && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid6()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue6() == 0) && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue6() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid6()).name() + ChatColor.RESET);
}
if (spell.getEffectid7() != 254 && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid7()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue7() == 0) && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue7() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid7()).name() + ChatColor.RESET);
}
if (spell.getEffectid8() != 254 && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid8()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue8() == 0) && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue8() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid8()).name() + ChatColor.RESET);
}
if (spell.getEffectid9() != 254 && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid9()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue9() == 0) && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue9() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid9()).name() + ChatColor.RESET);
}
if (spell.getEffectid10() != 254 && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid10()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue10() == 0) && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue10() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid10()).name() + ChatColor.RESET);
}
if (spell.getEffectid11() != 254 && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid11()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue11() == 0) && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue11() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid11()).name() + ChatColor.RESET);
}
if (spell.getEffectid12() != 254 && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid12()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue12() == 0) && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("StackingCommand_")) {
String pos = "+";
if (spell.getEffectBaseValue12() < 0)
pos = "-";
loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid12()).name() + ChatColor.RESET);
}
loreTxt.add(ChatColor.WHITE + "Mana/Power: " + ChatColor.YELLOW + spell.getMana() + ChatColor.RESET);
loreTxt.add(ChatColor.WHITE + "Spell Skill: " + ChatColor.YELLOW + Utils.getSkillType(spell.getSkill()).name().toUpperCase() + ChatColor.RESET);
loreTxt.add(ChatColor.WHITE + "Range: " + ChatColor.YELLOW + spell.getRange() + ChatColor.RESET);
if (spell.isAASpell()) {
loreTxt.add(ChatColor.WHITE + "This spell is an AA spell" + ChatColor.RESET);
}
if (spell.isBuffSpell() && spell.getBuffduration() > 0) {
loreTxt.add(ChatColor.WHITE + "Buff Duration: " + ChatColor.YELLOW + (spell.getBuffduration() * 6) + " seconds" + ChatColor.RESET);
}
loreTxt.add(ChatColor.WHITE + "Target Type: " + ChatColor.YELLOW + Utils.getSpellTargetType(spell.getTargettype()).name() + ChatColor.RESET);
String classesBuilder = "";
List<SoliniaSpellClass> allowedSpellClasses = spell.getAllowedClasses();
int rowcount = 0;
for (SoliniaSpellClass spellclass : allowedSpellClasses) {
if (StateManager.getInstance().getConfigurationManager().getClassObj(spellclass.getClassname().toUpperCase()) == null)
continue;
classesBuilder += ChatColor.WHITE + spellclass.getClassname() + " (" + ChatColor.YELLOW + spellclass.getMinlevel() + ChatColor.WHITE + ") " + ChatColor.RESET;
rowcount++;
if (rowcount > 2) {
loreTxt.add(classesBuilder);
classesBuilder = "";
}
}
// If we never reached 2 classes on a row, handle the overspill here
if (!classesBuilder.equals(""))
loreTxt.add(classesBuilder);
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return loreTxt;
}
use of com.solinia.solinia.Interfaces.ISoliniaSpell in project solinia3-core by mixxit.
the class ItemStackAdapter method generateConsumableAbilityLoreText.
private static Collection<String> generateConsumableAbilityLoreText(ISoliniaItem soliniaItem) {
List<String> loreTxt = new ArrayList<String>();
ISoliniaSpell spell;
String consumable = "";
if (soliniaItem.isConsumable()) {
consumable += "Consumable ";
}
try {
spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getAbilityid());
if (spell.getEffectid1() != 254 && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid1()).name() + "(" + spell.getEffectBaseValue1() + ")" + ChatColor.RESET);
if (spell.getEffectid2() != 254 && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid2()).name() + "(" + spell.getEffectBaseValue2() + ")" + ChatColor.RESET);
if (spell.getEffectid3() != 254 && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid3()).name() + "(" + spell.getEffectBaseValue3() + ")" + ChatColor.RESET);
if (spell.getEffectid4() != 254 && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid4()).name() + "(" + spell.getEffectBaseValue4() + ")" + ChatColor.RESET);
if (spell.getEffectid5() != 254 && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid5()).name() + "(" + spell.getEffectBaseValue5() + ")" + ChatColor.RESET);
if (spell.getEffectid6() != 254 && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid6()).name() + "(" + spell.getEffectBaseValue6() + ")" + ChatColor.RESET);
if (spell.getEffectid7() != 254 && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid7()).name() + "(" + spell.getEffectBaseValue7() + ")" + ChatColor.RESET);
if (spell.getEffectid8() != 254 && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid8()).name() + "(" + spell.getEffectBaseValue8() + ")" + ChatColor.RESET);
if (spell.getEffectid9() != 254 && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid9()).name() + "(" + spell.getEffectBaseValue9() + ")" + ChatColor.RESET);
if (spell.getEffectid10() != 254 && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid10()).name() + "(" + spell.getEffectBaseValue10() + ")" + ChatColor.RESET);
if (spell.getEffectid11() != 254 && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid11()).name() + "(" + spell.getEffectBaseValue11() + ")" + ChatColor.RESET);
if (spell.getEffectid12() != 254 && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("LIMIT_"))
loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid12()).name() + "(" + spell.getEffectBaseValue12() + ")" + ChatColor.RESET);
if (spell.isBuffSpell() && spell.getBuffduration() > 0) {
loreTxt.add(ChatColor.WHITE + consumable + "Buff Duration: " + ChatColor.YELLOW + (spell.getBuffduration() * 6) + " seconds" + ChatColor.RESET);
}
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return loreTxt;
}
Aggregations