Search in sources :

Example 1 with Ideal

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

the class CommandCreateCharacterFull method createCharacter.

private void createCharacter(ISoliniaPlayer solPlayer, int raceId, int classId, String gender, int ideal, int firstTrait, int secondTrait, int flaw, int bond, String foreName, String lastName) throws Exception {
    Player player = solPlayer.getBukkitPlayer();
    ISoliniaRace solRace = StateManager.getInstance().getConfigurationManager().getRace(raceId);
    if (solRace == null)
        throw new Exception("Invalid race");
    ISoliniaClass solClass = StateManager.getInstance().getConfigurationManager().getClassObj(classId);
    if (solClass == null)
        throw new Exception("Invalid class");
    if (!StateManager.getInstance().getConfigurationManager().isValidRaceClass(solRace.getId(), solClass.getId()))
        throw new Exception("Invalid race/class combination");
    if (!gender.equals("MALE") && !gender.equals("FEMALE"))
        throw new Exception("Invalid gender");
    Ideal ideal1 = StateManager.getInstance().getConfigurationManager().getIdeal(ideal);
    if (ideal1 == null)
        throw new Exception("Invalid ideal");
    if (firstTrait == secondTrait)
        throw new Exception("Two traits sharing the same value is not allowed");
    Trait trait1 = StateManager.getInstance().getConfigurationManager().getTrait(firstTrait);
    if (trait1 == null)
        throw new Exception("Invalid trait (1st)");
    Trait trait2 = StateManager.getInstance().getConfigurationManager().getTrait(secondTrait);
    if (trait2 == null)
        throw new Exception("Invalid trait (2nd)");
    Flaw flaw1 = StateManager.getInstance().getConfigurationManager().getFlaw(flaw);
    if (flaw1 == null)
        throw new Exception("Invalid flaw");
    Bond bond1 = StateManager.getInstance().getConfigurationManager().getBond(bond);
    if (bond1 == null)
        throw new Exception("Invalid bond");
    if (!StateManager.getInstance().getPlayerManager().IsNewNameValid(foreName, lastName))
        throw new Exception("Invalid firstname+lastname");
    ISoliniaPlayer newPlayer = StateManager.getInstance().getPlayerManager().createNewPlayerAlt(plugin, player, true);
    if (newPlayer == null)
        throw new Exception("Failed to create character object");
    newPlayer.setRaceId(solRace.getId());
    newPlayer.setChosenRace(true);
    newPlayer.setClassId(solClass.getId());
    newPlayer.setChosenClass(true);
    newPlayer.setGender(gender);
    newPlayer.getPersonality().setIdealId(ideal1.id);
    newPlayer.getPersonality().setFirstTraitId(trait1.id);
    newPlayer.getPersonality().setSecondTraitId(trait2.id);
    newPlayer.getPersonality().setFlawId(flaw1.id);
    newPlayer.getPersonality().setBondId(bond1.id);
    newPlayer.setForenameAndLastName(foreName, lastName);
    newPlayer.updateMaxHp();
    SoliniaPlayerAdapter.Adapt(player).updateDisplayName();
    EntityUtils.teleportSafely(player, solClass.getRaceClass(solRace.getId()).getStartLocation());
    newPlayer.setBindPoint(solClass.getRaceClass(solRace.getId()).getStartWorld() + "," + solClass.getRaceClass(solRace.getId()).getStartX() + "," + solClass.getRaceClass(solRace.getId()).getStartY() + "," + solClass.getRaceClass(solRace.getId()).getStartZ());
    player.sendMessage("Your character has been stored and a new character created");
}
Also used : ISoliniaClass(com.solinia.solinia.Interfaces.ISoliniaClass) Player(org.bukkit.entity.Player) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) Ideal(com.solinia.solinia.Models.Ideal) Trait(com.solinia.solinia.Models.Trait) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) Bond(com.solinia.solinia.Models.Bond) ISoliniaRace(com.solinia.solinia.Interfaces.ISoliniaRace) Flaw(com.solinia.solinia.Models.Flaw) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException)

Example 2 with Ideal

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

the class ConfigurationManager method generateIdeals.

public List<Ideal> generateIdeals() {
    List<Ideal> ideals = new ArrayList<Ideal>() {

        /**
         */
        private static final long serialVersionUID = 3921136482442842920L;

        {
            add(new Ideal(1, "Faith", "I trust that my deity will guide my actions. I have faith that if I work hard, things will go well.", AlignmentType.Lawful));
            add(new Ideal(2, "Tradition", "The ancient traditions of worship and sacrifice must be preserved and upheld.", AlignmentType.Lawful));
            add(new Ideal(3, "Charity", "I always try to help those in need, no matter what the personal cost.", AlignmentType.Good));
            add(new Ideal(4, "Change", "We must help bring about the changes the gods are constantly working in the world.", AlignmentType.Chaotic));
            add(new Ideal(5, "Power", "I hope to one day rise to the top of my faith's religious hierarchy.", AlignmentType.Lawful));
            add(new Ideal(6, "Aspiration", "I seek to prove my self worthy of my god's favor by matching my actions against his or her teachings.", AlignmentType.Any));
            add(new Ideal(7, "Independence", "I am a free spirit--no one tells me what to do.", AlignmentType.Chaotic));
            add(new Ideal(8, "Fairness", "I never target people who can't afford to lose a few coins.", AlignmentType.Lawful));
            add(new Ideal(9, "Charity", "I distribute money I acquire to the people who really need it.", AlignmentType.Good));
            add(new Ideal(10, "Creativity", "I never run the same con twice.", AlignmentType.Chaotic));
            add(new Ideal(11, "Friendship", "Material goods come and go. Bonds of friendship last forever.", AlignmentType.Good));
            add(new Ideal(12, "Aspiration", "I'm determined to make something of myself.", AlignmentType.Any));
            add(new Ideal(13, "Honor", "I don't steal from others in the trade.", AlignmentType.Lawful));
            add(new Ideal(14, "Freedom", "Chains are meant to be broken, as are those who would forge them.", AlignmentType.Chaotic));
            add(new Ideal(15, "Charity", "I steal from the wealthy so that I can help people in need.", AlignmentType.Good));
            add(new Ideal(16, "Greed", "I will do whatever it takes to become wealthy.", AlignmentType.Evil));
            add(new Ideal(17, "People", "I'm loyal to my friends, not to any ideals, and everyone else can take a trip down the Styx for all I care.", AlignmentType.Neutral));
            add(new Ideal(18, "Redemption", "There's a spark of good in everyone.", AlignmentType.Good));
            add(new Ideal(19, "Beauty", "When I perform, I make the world better than it was.", AlignmentType.Good));
            add(new Ideal(20, "Tradition", "The stories, legends, and songs of the past must never be forgotten.", AlignmentType.Lawful));
            add(new Ideal(21, "Creativity", "The world is in need of new ideas and bold action.", AlignmentType.Chaotic));
            add(new Ideal(22, "Greed", "I'm only in it for the money and fame.", AlignmentType.Evil));
            add(new Ideal(23, "People", "I like seeing the smiles on people's faces when I perform. That's all that matters.", AlignmentType.Neutral));
            add(new Ideal(24, "Honesty", "Art should reflect the soul; it should come from within and reveal who we really are.", AlignmentType.Any));
            add(new Ideal(25, "Respect", "People deserve to be treated with dignity and respect.", AlignmentType.Good));
            add(new Ideal(26, "Fairness", "No one should get preferential treatment before the law, and no one is above the law.", AlignmentType.Lawful));
            add(new Ideal(27, "Freedom", "Tyrants must not be allowed to oppress the people.", AlignmentType.Chaotic));
            add(new Ideal(28, "Might", "If I become strong, I can take what I want--what I deserve.", AlignmentType.Evil));
            add(new Ideal(29, "Sincerity", "There's no good pretending to be something I'm not.", AlignmentType.Neutral));
            add(new Ideal(30, "Destiny", "Nothing and no one can steer me away from my higher calling.", AlignmentType.Any));
            add(new Ideal(31, "Community", "It is the duty of all civilized people to strengthen the bonds of community and the security of civilization.", AlignmentType.Lawful));
            add(new Ideal(32, "Generosity", "My talents were given to me so that I could use them to benefit the world.", AlignmentType.Good));
            add(new Ideal(33, "Freedom", "Everyone should be free to pursue his or her livelihood.", AlignmentType.Chaotic));
            add(new Ideal(34, "Greed", "I'm only in it for the money.", AlignmentType.Evil));
            add(new Ideal(35, "People", "I'm committed to the people I care about, not to ideals.", AlignmentType.Neutral));
            add(new Ideal(36, "Aspiration", "I work hard to be the best there is at my craft.", AlignmentType.Any));
            add(new Ideal(37, "Greater Good", "My gifts are meant to be shared with all, not used for my own benefit.", AlignmentType.Good));
            add(new Ideal(38, "Logic", "Emotions must not cloud our sense of what is right and true, or our logical thinking.", AlignmentType.Lawful));
            add(new Ideal(39, "Free Thinking", "Inquiry and curiosity are the pillars of progress.", AlignmentType.Chaotic));
            add(new Ideal(40, "Power", "Solitude and contemplation are paths toward mystical or magical power.", AlignmentType.Evil));
            add(new Ideal(41, "Live and Let Live", "Meddling in the affairs of others only causes trouble.", AlignmentType.Neutral));
            add(new Ideal(42, "Self-Knowledge", "If you know yourself, there're nothing left to know.", AlignmentType.Any));
            add(new Ideal(43, "Respect", "Respect is due to me because of my position, but all people regardless of station deserve to be treated with dignity.", AlignmentType.Good));
            add(new Ideal(44, "Responsibility", "It is my duty to respect the authority of those above me, just as those below me must respect mine.", AlignmentType.Lawful));
            add(new Ideal(45, "Independence", "I must prove that I can handle myself without the coddling of my family.", AlignmentType.Chaotic));
            add(new Ideal(46, "Power", "If I can attain more power, no one will tell me what to do.", AlignmentType.Evil));
            add(new Ideal(47, "Family", "Blood runs thicker than water.", AlignmentType.Any));
            add(new Ideal(48, "Noble Obligation", "It is my duty to protect and care for the people beneath me.", AlignmentType.Good));
            add(new Ideal(49, "Change", "Life is like the seasons, in constant change, and we must change with it.", AlignmentType.Chaotic));
            add(new Ideal(50, "Greater Good", "It is each person's responsibility to make the most happiness for the whole tribe.", AlignmentType.Good));
            add(new Ideal(51, "Honor", "If I dishonor myself, I dishonor my whole clan.", AlignmentType.Lawful));
            add(new Ideal(52, "Might", "The strongest are meant to rule.", AlignmentType.Evil));
            add(new Ideal(53, "Nature", "The natural world is more important than all the constructs of civilization.", AlignmentType.Neutral));
            add(new Ideal(54, "Glory", "I must earn glory in battle, for myself and my clan.", AlignmentType.Any));
            add(new Ideal(55, "Knowledge", "The path to power and self-improvement is through knowledge.", AlignmentType.Neutral));
            add(new Ideal(56, "Beauty", "What is beautiful points us beyond itself toward what is true.", AlignmentType.Good));
            add(new Ideal(57, "Logic", "Emotions must not cloud our logical thinking.", AlignmentType.Lawful));
            add(new Ideal(58, "No Limits", "Nothing should fetter the infinite possibility inherent in all existence.", AlignmentType.Chaotic));
            add(new Ideal(59, "Power", "Knowledge is the path to power and domination.", AlignmentType.Evil));
            add(new Ideal(60, "Self-improvement", "The goal of a life of study is the betterment of oneself.", AlignmentType.Neutral));
            add(new Ideal(61, "Respect", "The thing that keeps a ship together is mutual respect between captain and crew.", AlignmentType.Good));
            add(new Ideal(62, "Fairness", "We all do the work, so we all share in the rewards.", AlignmentType.Lawful));
            add(new Ideal(63, "Freedom", "The sea is freedom--the freedom to go anywhere and do anything.", AlignmentType.Chaotic));
            add(new Ideal(64, "Master", "I'm a predator, and the other ships on the sea are my prey.", AlignmentType.Evil));
            add(new Ideal(65, "People", "I'm committed to my crewmates, not to ideals.", AlignmentType.Neutral));
            add(new Ideal(66, "Aspiration", "Someday I'll own my own ship and chart my own destiny.", AlignmentType.Any));
            add(new Ideal(67, "Greater Good", "Our lot is to lay down our lives in defense of others.", AlignmentType.Good));
            add(new Ideal(68, "Responsibility", "I do what I must and obey just authority.", AlignmentType.Lawful));
            add(new Ideal(69, "Independence", "When people follow orders blindly they embrace a kind of tyranny.", AlignmentType.Chaotic));
            add(new Ideal(70, "Might", "In life as in war, the stronger force wins.", AlignmentType.Evil));
            add(new Ideal(71, "Live and Let Live", "Ideals aren't worth killing for or going to war for.", AlignmentType.Neutral));
            add(new Ideal(72, "Nation", "My city, nation, or people are all that matter.", AlignmentType.Any));
            add(new Ideal(73, "Respect", "All people, rich or poor, deserve respect.", AlignmentType.Good));
            add(new Ideal(74, "Community", "We have to take care of each other, because no one else is going to do it.", AlignmentType.Lawful));
            add(new Ideal(75, "Change", "The low are lifted up, and the high and mighty are brought down. Change is the nature of things.", AlignmentType.Chaotic));
            add(new Ideal(76, "Retribution", "The rich need to be shown what life and death are like in the gutters.", AlignmentType.Evil));
            add(new Ideal(77, "People", "I help people who help me--that's what keeps us alive.", AlignmentType.Neutral));
            add(new Ideal(78, "Aspiration", "I'm going to prove that I'm worthy of a better life.", AlignmentType.Any));
        }
    };
    return ideals;
}
Also used : Ideal(com.solinia.solinia.Models.Ideal) ArrayList(java.util.ArrayList)

Example 3 with Ideal

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

the class CommandPersonality method setIdealChoice.

private void setIdealChoice(CommandSender sender, int id) {
    try {
        ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt((Player) sender);
        if (solPlayer.getPersonality().getIdealId() > 0) {
            sender.sendMessage("You have already set your ideal");
            return;
        }
        Ideal ideal = StateManager.getInstance().getConfigurationManager().getIdeal(id);
        if (ideal == null) {
            sender.sendMessage("That ideal does not exist");
            return;
        }
        solPlayer.getPersonality().setIdealId(ideal.id);
        sender.sendMessage("Personality change confirmed");
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : Ideal(com.solinia.solinia.Models.Ideal) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 4 with Ideal

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

the class CommandPersonality method sendIdealChoices.

public void sendIdealChoices(CommandSender sender) {
    try {
        sender.sendMessage(ChatColor.GOLD + "IDEALS:" + ChatColor.RESET);
        TextComponent tc = new TextComponent();
        tc.setText(ChatColor.AQUA + "[Click-to-Select] " + ChatColor.RESET);
        for (Ideal ideal : StateManager.getInstance().getConfigurationManager().getIdeals()) {
            TextComponent tc2 = new TextComponent();
            int maxLength = 6;
            if (ideal.description.length() < 6)
                maxLength = ideal.description.length();
            tc2.setText("[" + ideal.description.substring(0, maxLength) + "....] ");
            String changetext = "/personality ideal " + ideal.id;
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ideal.description).create()));
            tc.addExtra(tc2);
        }
        sender.spigot().sendMessage(tc);
    } catch (CoreStateInitException e) {
        sender.sendMessage("Choices are not available right now");
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) Ideal(com.solinia.solinia.Models.Ideal) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Aggregations

Ideal (com.solinia.solinia.Models.Ideal)4 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)3 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)2 ISoliniaClass (com.solinia.solinia.Interfaces.ISoliniaClass)1 ISoliniaRace (com.solinia.solinia.Interfaces.ISoliniaRace)1 Bond (com.solinia.solinia.Models.Bond)1 Flaw (com.solinia.solinia.Models.Flaw)1 Trait (com.solinia.solinia.Models.Trait)1 ArrayList (java.util.ArrayList)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 TextComponent (net.md_5.bungee.api.chat.TextComponent)1 Player (org.bukkit.entity.Player)1