Search in sources :

Example 1 with CharacterCreation

use of com.solinia.solinia.Models.CharacterCreation in project solinia3-core by mixxit.

the class ConfigurationManager method getCharacterCreationChoices.

@Override
public CharacterCreation getCharacterCreationChoices() {
    CharacterCreation characterCreation = new CharacterCreation();
    List<ISoliniaClass> classes = getClasses();
    for (ISoliniaRace race : this.getRaces()) {
        if (race.isAdmin())
            continue;
        for (ISoliniaClass solclass : classes) {
            if (!solclass.getValidRaceClasses().containsKey(race.getId()))
                continue;
            RaceChoice raceChoice = new RaceChoice(race.getId(), solclass.getId(), race.getName(), solclass.getName(), race.getShortName(), solclass.getShortName(), race.getDescription(), solclass.getDescription(), race.getStrength(), race.getStamina(), race.getAgility(), race.getDexterity(), race.getIntelligence(), race.getWisdom(), race.getCharisma(), race.getAlignment());
            characterCreation.raceChoices.put(raceChoice.RaceName + "_" + raceChoice.ClassName, raceChoice);
        }
    }
    return characterCreation;
}
Also used : ISoliniaClass(com.solinia.solinia.Interfaces.ISoliniaClass) RaceChoice(com.solinia.solinia.Models.RaceChoice) ISoliniaRace(com.solinia.solinia.Interfaces.ISoliniaRace) CharacterCreation(com.solinia.solinia.Models.CharacterCreation)

Example 2 with CharacterCreation

use of com.solinia.solinia.Models.CharacterCreation in project solinia3-core by mixxit.

the class PlayerUtils method sendCharCreationNoMod.

private static void sendCharCreationNoMod(Player sender) {
    ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
    BookMeta bookMeta = (BookMeta) book.getItemMeta();
    bookMeta.setTitle("Creation");
    bookMeta.setAuthor("Server");
    try {
        CharacterCreation choices = StateManager.getInstance().getConfigurationManager().getCharacterCreationChoices();
        String pageText = "";
        BaseComponent[] introPage = new ComponentBuilder(ChatColor.RED + "Race/Class Selection\n" + ChatColor.RESET + "---------------\n" + "\n" + "Please cycle through\n" + "our choice of races\n" + "and classes\n" + "\n" + "When you are ready \n" + "click " + ChatColor.BLUE + "SELECT" + ChatColor.RESET + " on the page\n").create();
        bookMeta.spigot().addPage(introPage);
        for (String choiceKey : choices.raceChoices.keySet()) {
            RaceChoice choice = choices.raceChoices.get(choiceKey);
            int passiveId = StateManager.getInstance().getConfigurationManager().getRace(choice.RaceId).getPassiveAbilityId();
            ISoliniaSpell passiveSpell = StateManager.getInstance().getConfigurationManager().getSpell(passiveId);
            String header = ChatColor.RED + "" + choice.RaceName + " " + choice.ClassName + ChatColor.RESET + "\n";
            String hover = "[" + ChatColor.RED + "Hover for More Info" + ChatColor.RESET + "]\n";
            String text = "";
            text += "\n";
            text += "STR " + ChatColor.BLUE + choice.STR + ChatColor.RESET + " STA " + ChatColor.BLUE + choice.STA + ChatColor.RESET + " AGI " + ChatColor.BLUE + choice.AGI + ChatColor.RESET + "\n";
            text += "DEX " + ChatColor.BLUE + choice.DEX + ChatColor.RESET + " INT " + ChatColor.BLUE + choice.INT + ChatColor.RESET + " WIS " + ChatColor.BLUE + choice.WIS + ChatColor.RESET + "\n";
            text += "CHA " + ChatColor.BLUE + choice.CHA + ChatColor.RESET + "\n";
            text += "\n";
            text += "Racial Benefit: " + ChatColor.RED + passiveSpell.getName() + ChatColor.RESET + "\n";
            text += "\n";
            String details = ChatColor.GOLD + choice.RaceName + ChatColor.RESET + System.lineSeparator() + "Recommended Alignment: " + ChatColor.GOLD + choice.Alignment + ChatColor.RESET + System.lineSeparator() + choice.RaceDescription + System.lineSeparator() + ChatColor.GOLD + choice.ClassName + ChatColor.RESET + System.lineSeparator() + choice.ClassDescription;
            String click = "\n[" + ChatColor.BLUE + "SELECT" + ChatColor.RESET + "]\n";
            BaseComponent[] racePage = new ComponentBuilder(header).append(new ComponentBuilder(hover).event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(details).create())).create()).append(new ComponentBuilder(text).create()).append(new ComponentBuilder(click).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/createcharactershort " + choice.RaceId + " " + choice.ClassId)).create()).create();
            // 
            // )
            bookMeta.spigot().addPage(racePage);
        }
        /*			        .event(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://spigotmc.org"))
			        .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Go to the spigot website!").create()))
			        .create();*/
        book.setItemMeta(bookMeta);
        sender.openBook(book);
    } catch (CoreStateInitException e) {
    }
}
Also used : HoverEvent(net.md_5.bungee.api.chat.HoverEvent) BaseComponent(net.md_5.bungee.api.chat.BaseComponent) ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) PacketOpenCharacterCreation(com.solinia.solinia.Models.PacketOpenCharacterCreation) CharacterCreation(com.solinia.solinia.Models.CharacterCreation) RaceChoice(com.solinia.solinia.Models.RaceChoice) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) CraftItemStack(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack) BookMeta(org.bukkit.inventory.meta.BookMeta) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Aggregations

CharacterCreation (com.solinia.solinia.Models.CharacterCreation)2 RaceChoice (com.solinia.solinia.Models.RaceChoice)2 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)1 ISoliniaClass (com.solinia.solinia.Interfaces.ISoliniaClass)1 ISoliniaRace (com.solinia.solinia.Interfaces.ISoliniaRace)1 ISoliniaSpell (com.solinia.solinia.Interfaces.ISoliniaSpell)1 PacketOpenCharacterCreation (com.solinia.solinia.Models.PacketOpenCharacterCreation)1 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)1 ClickEvent (net.md_5.bungee.api.chat.ClickEvent)1 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)1 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)1 CraftItemStack (org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack)1 ItemStack (org.bukkit.inventory.ItemStack)1 BookMeta (org.bukkit.inventory.meta.BookMeta)1