Search in sources :

Example 1 with Trait

use of com.solinia.solinia.Models.Trait 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 Trait

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

the class CommandPersonality method setTraitChoice.

private void setTraitChoice(CommandSender sender, int id) {
    try {
        ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt((Player) sender);
        if (solPlayer.getPersonality().getFirstTraitId() > 0 && solPlayer.getPersonality().getSecondTraitId() > 0) {
            sender.sendMessage("You have already set your traits");
            return;
        }
        Trait trait = StateManager.getInstance().getConfigurationManager().getTrait(id);
        if (trait == null) {
            sender.sendMessage("That trait does not exist");
            return;
        }
        if (solPlayer.getPersonality().getFirstTraitId() == 0) {
            solPlayer.getPersonality().setFirstTraitId(trait.id);
            sender.sendMessage("Personality change confirmed");
        } else {
            solPlayer.getPersonality().setSecondTraitId(trait.id);
            sender.sendMessage("Personality change confirmed");
        }
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) Trait(com.solinia.solinia.Models.Trait)

Example 3 with Trait

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

the class ConfigurationManager method generateTraits.

public List<Trait> generateTraits() {
    List<Trait> traits = new ArrayList<Trait>() {

        /**
         */
        private static final long serialVersionUID = -7029458265461728023L;

        {
            add(new Trait(1, "I idolize a particular hero of my faith and constantly refer to that person's deeds and example."));
            add(new Trait(2, "I can find common ground between the fiercest enemies, empathizing with them and always working toward peace."));
            add(new Trait(3, "I see omens in every event and action. The gods try to speak to us, we just need to listen."));
            add(new Trait(4, "Nothing can shake my optimistic attitude."));
            add(new Trait(5, "I quote (or misquote) the sacred texts and proverbs in almost every situation."));
            add(new Trait(6, "I am tolerant (or intolerant) of other faiths and respect (or condemn) the worship of other gods."));
            add(new Trait(7, "I've enjoyed fine food, drink, and high society among my temple's elite. Rough living grates on me."));
            add(new Trait(8, "I've spent so long in the temple that I have little practical experience dealing with people in the outside world."));
            add(new Trait(9, "I fall in and out of love easily, and am always pursuing someone."));
            add(new Trait(10, "I have a joke for every occasion, especially occasions where humor is inappropriate."));
            add(new Trait(11, "Flattery is my preferred trick for getting what I want."));
            add(new Trait(12, "I'm a born gambler who can't resist taking a risk for a potential payoff."));
            add(new Trait(13, "I lie about almost everything, even when there's no good reason to."));
            add(new Trait(14, "Sarcasm and insults are my weapons of choice."));
            add(new Trait(15, "I keep multiple holy symbols on me and invoke whatever deity might come in useful at any given moment."));
            add(new Trait(16, "I pocket anything I see that might have some value."));
            add(new Trait(17, "I always have plan for what to do when things go wrong."));
            add(new Trait(18, "I am always calm, no matter what the situation. I never raise my voice or let my emotions control me."));
            add(new Trait(19, "The first thing I do in a new place is note the locations of everything valuable--or where such things could be hidden."));
            add(new Trait(20, "I would rather make a new friend than a new enemy."));
            add(new Trait(21, "I am incredibly slow to trust. Those who seem the fairest often have the most to hide."));
            add(new Trait(22, "I don't pay attention to the risks in a situation. Never tell me the odds."));
            add(new Trait(23, "The best way to get me to do something is to tell me I can't do it."));
            add(new Trait(24, "I blow up at the slightest insult."));
            add(new Trait(25, "I know a story relevant to almost every situation."));
            add(new Trait(26, "Whenever I come to a new place, I collect local rumors and spread gossip."));
            add(new Trait(27, "I'm a hopeless romantic, always searching for that 'special someone'."));
            add(new Trait(28, "Nobody stays angry at me or around me for long, since I can defuse any amount of tension."));
            add(new Trait(29, "I love a good insult, even one directed at me."));
            add(new Trait(30, "I get bitter if I'm not the center of attention."));
            add(new Trait(31, "I'll settle for nothing less than perfection."));
            add(new Trait(32, "I change my mood or my mind as quickly as I change key in a song."));
            add(new Trait(33, "I judge people by their actions, not their words."));
            add(new Trait(34, "If someone is in trouble, I'm always willing to lend help."));
            add(new Trait(35, "When I set my mind to something, I follow through no matter what gets in my way."));
            add(new Trait(36, "I have a strong sense of fair play and always try to find the most equitable solution to arguments."));
            add(new Trait(37, "I'm confident in my own abilities and do what I can to instill confidence in others."));
            add(new Trait(38, "Thinking is for other people. I prefer action."));
            add(new Trait(39, "I misuse long words in an attempt to sound smarter."));
            add(new Trait(40, "I get bored easily. When am I going to get on with my destiny."));
            add(new Trait(41, "I believe that everything worth doing is worth doing right. I can't help it--I'm a perfectionist."));
            add(new Trait(42, "I'm a snob who looks down on those who can't appreciate fine art."));
            add(new Trait(43, "I always want to know how things work and what makes people tick."));
            add(new Trait(44, "I'm full of witty aphorisms and have a proverb for every occasion."));
            add(new Trait(45, "I'm rude to people who lack my commitment to hard work and fair play."));
            add(new Trait(46, "I like to talk at length about my profession."));
            add(new Trait(47, "I don't part with my money easily and will haggle tirelessly to get the best deal possible."));
            add(new Trait(48, "I'm well known for my work, and I want to make sure everyone appreciates it. I'm always taken aback when people haven't heard of me."));
            add(new Trait(49, "I've been isolated for so long that I rarely speak, preferring gestures and the occasional grunt."));
            add(new Trait(50, "I am utterly serene, even in the face of disaster."));
            add(new Trait(51, "The leader of my community has something wise to say on every topic, and I am eager to share that wisdom."));
            add(new Trait(52, "I feel tremendous empathy for all who suffer."));
            add(new Trait(53, "I'm oblivious to etiquette and social expectations."));
            add(new Trait(54, "I connect everything that happens to me to a grand cosmic plan."));
            add(new Trait(55, "I often get lost in my own thoughts and contemplations, becoming oblivious to my surroundings."));
            add(new Trait(56, "I am working on a grand philosophical theory and love sharing my ideas."));
            add(new Trait(57, "My eloquent flattery makes everyone I talk to feel like the most wonderful and important person in the world."));
            add(new Trait(58, "The common folk love me for my kindness and generosity."));
            add(new Trait(59, "No one could doubt by looking at my regal bearing that I am a cut above the unwashed masses."));
            add(new Trait(60, "I take great pains to always look my best and follow the latest fashions."));
            add(new Trait(61, "I don't like to get my hands dirty, and I won't be caught dead in unsuitable accommodations."));
            add(new Trait(62, "Despite my birth, I do not place myself above other folk. We all have the same blood."));
            add(new Trait(63, "My favor, once lost, is lost forever."));
            add(new Trait(64, "If you do me an injury, I will crush you, ruin your name, and salt your fields."));
            add(new Trait(65, "I'm driven by a wanderlust that led me away from home."));
            add(new Trait(66, "I watch over my friends as if they were a litter of newborn pups."));
            add(new Trait(67, "I once ran twenty-five miles without stopping to warn my clan of an approaching orc horde. I'd do it again if I had to."));
            add(new Trait(68, "I have a lesson for every situation, drawn from observing nature."));
            add(new Trait(69, "I place no stock in wealthy or well-mannered folk. Money and manners won't save you from a hungry owlbear."));
            add(new Trait(70, "I'm always picking things up, absently fiddling with them, and sometimes accidentally breaking them."));
            add(new Trait(71, "I feel far more comfortable around animals than people."));
            add(new Trait(72, "I was, in fact, raised by wolves."));
            add(new Trait(73, "I use polysyllabic words to convey the impression of great erudition."));
            add(new Trait(74, "I've read every book in the world's greatest libraries--or like to boast that I have."));
            add(new Trait(75, "I'm used to helping out those who aren't as smart as I am, and I patiently explain anything and everything to others."));
            add(new Trait(76, "There's nothing I like more than a good mystery."));
            add(new Trait(77, "I'm willing to listen to every side of an argument before I make my own judgment."));
            add(new Trait(78, "I...speak...slowly...when talking...to idiots...which...almost...everyone...is...compared ...to me."));
            add(new Trait(79, "I am horribly, horribly awkward in social situations."));
            add(new Trait(80, "I'm convinced that people are always trying to steal my secrets."));
            add(new Trait(81, "My friends know they can rely on me, no matter what."));
            add(new Trait(82, "I work hard so that I can play hard when the work is done."));
            add(new Trait(83, "I enjoy sailing into new ports and making new friends over a flagon of ale."));
            add(new Trait(84, "I stretch the truth for the sake of a good story."));
            add(new Trait(85, "To me, a tavern brawl is a nice way to get to know a new city."));
            add(new Trait(86, "I never pass up a friendly wager."));
            add(new Trait(87, "My language is as foul as an otyugh nest."));
            add(new Trait(88, "I like a job well done, especially if I can convince someone else to do it."));
            add(new Trait(89, "I'm always polite and respectful."));
            add(new Trait(90, "I'm haunted by memories of war. I can't get the images of violence out of my mind."));
            add(new Trait(91, "I've lost too many friends, and I'm slow to make new ones."));
            add(new Trait(92, "I'm full of inspiring and cautionary tales from my military experience relevant to almost every combat situation."));
            add(new Trait(93, "I can stare down a hellhound without flinching."));
            add(new Trait(94, "I enjoy being strong and like breaking things."));
            add(new Trait(95, "I have a crude sense of humor."));
            add(new Trait(96, "I face problems head-on. A simple direct solution is the best path to success."));
            add(new Trait(97, "I hide scraps of food and trinkets away in my pockets."));
            add(new Trait(98, "I ask a lot of questions."));
            add(new Trait(99, "I like to squeeze into small places where no one else can get to me."));
            add(new Trait(100, "I sleep with my back to a wall or tree, with everything I own wrapped in a bundle in my arms."));
            add(new Trait(101, "I eat like a pig and have bad manners."));
            add(new Trait(102, "I think anyone who's nice to me is hiding evil intent."));
            add(new Trait(103, "I don't like to bathe."));
            add(new Trait(104, "I bluntly say what other people are hinting or hiding."));
        }
    };
    return traits;
}
Also used : ArrayList(java.util.ArrayList) Trait(com.solinia.solinia.Models.Trait)

Example 4 with Trait

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

the class CommandPersonality method sendTraitChoices.

public void sendTraitChoices(CommandSender sender) {
    try {
        sender.sendMessage(ChatColor.GOLD + "TRAITS:" + ChatColor.RESET);
        TextComponent tc = new TextComponent();
        tc.setText(ChatColor.AQUA + "[Click-to-Select] " + ChatColor.RESET);
        for (Trait trait : StateManager.getInstance().getConfigurationManager().getTraits()) {
            TextComponent tc2 = new TextComponent();
            int maxLength = 6;
            if (trait.description.length() < 6)
                maxLength = trait.description.length();
            tc2.setText("[" + trait.description.substring(0, maxLength) + "..] ");
            String changetext = "/personality trait " + trait.id;
            tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, changetext));
            tc2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(trait.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) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) Trait(com.solinia.solinia.Models.Trait) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Aggregations

Trait (com.solinia.solinia.Models.Trait)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 Ideal (com.solinia.solinia.Models.Ideal)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