Search in sources :

Example 1 with Flaw

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

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

the class ConfigurationManager method generateFlaws.

public List<Flaw> generateFlaws() {
    List<Flaw> flaws = new ArrayList<Flaw>() {

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

        {
            add(new Flaw(1, "I judge others harshly, and myself even more severely."));
            add(new Flaw(2, "I put too much trust in those who wield power within my temple's hierarchy."));
            add(new Flaw(3, "My piety sometimes leads me to blindly trust those that profess faith in my god."));
            add(new Flaw(4, "I am inflexible in my thinking."));
            add(new Flaw(5, "I am suspicious of strangers and suspect the worst of them."));
            add(new Flaw(6, "Once I pick a goal, I become obsessed with it to the detriment of everything else in my life."));
            add(new Flaw(7, "I can't resist a pretty face."));
            add(new Flaw(8, "I'm always in debt. I spend my ill-gotten gains on decadent luxuries faster than I bring them in."));
            add(new Flaw(9, "I'm convinced that no one could ever fool me in the way I fool others."));
            add(new Flaw(10, "I'm too greedy for my own good. I can't resist taking a risk if there's money involved."));
            add(new Flaw(11, "I can't resist swindling people who are more powerful than me."));
            add(new Flaw(12, "I hate to admit it and will hate myself for it, but I'll run and preserve my own hide if the going gets tough."));
            add(new Flaw(13, "When I see something valuable, I can't think about anything but how to steal it."));
            add(new Flaw(14, "When faced with a choice between money and my friends, I usually choose the money."));
            add(new Flaw(15, "If there's a plan, I'll forget it. If I don't forget it, I'll ignore it."));
            add(new Flaw(16, "I have a 'tell' that reveals when I'm lying."));
            add(new Flaw(17, "I turn tail and run when things go bad."));
            add(new Flaw(18, "An innocent person is in prison for a crime that I committed. I'm okay with that."));
            add(new Flaw(19, "I'll do anything to win fame and renown."));
            add(new Flaw(20, "I'm a sucker for a pretty face."));
            add(new Flaw(21, "A scandal prevents me from ever going home again. That kind of trouble seems to follow me around."));
            add(new Flaw(22, "I once satirized a noble who still wants my head. It was a mistake that I will likely repeat."));
            add(new Flaw(23, "I have trouble keeping my true feelings hidden. My sharp tongue lands me in trouble."));
            add(new Flaw(24, "Despite my best efforts, I am unreliable to my friends."));
            add(new Flaw(25, "The tyrant who rules my land will stop at nothing to see me killed."));
            add(new Flaw(26, "I'm convinced of the significance of my destiny, and blind to my shortcomings and the risk of failure."));
            add(new Flaw(27, "The people who knew me when I was young know my shameful secret, so I can never go home again."));
            add(new Flaw(28, "I have a weakness for the vices of the city, especially hard drink."));
            add(new Flaw(29, "Secretly, I believe that things would be better if I were a tyrant lording over the land."));
            add(new Flaw(30, "I have trouble trusting in my allies."));
            add(new Flaw(31, "I'll do anything to get my hands on something rare or priceless."));
            add(new Flaw(32, "I'm quick to assume that someone is trying to cheat me."));
            add(new Flaw(33, "No one must ever learn that I once stole money from guild coffers."));
            add(new Flaw(34, "I'm never satisfied with what I have--I always want more."));
            add(new Flaw(35, "I would kill to acquire a noble title."));
            add(new Flaw(36, "I'm horribly jealous of anyone who outshines my handiwork. Everywhere I go, I'm surrounded by rivals."));
            add(new Flaw(37, "Now that I've returned to the world, I enjoy its delights a little too much."));
            add(new Flaw(38, "I harbor dark bloodthirsty thoughts that my isolation failed to quell."));
            add(new Flaw(39, "I am dogmatic in my thoughts and philosophy."));
            add(new Flaw(40, "I let my need to win arguments overshadow friendships and harmony."));
            add(new Flaw(41, "I'd risk too much to uncover a lost bit of knowledge."));
            add(new Flaw(42, "I like keeping secrets and won't share them with anyone."));
            add(new Flaw(43, "I secretly believe that everyone is beneath me."));
            add(new Flaw(44, "I hide a truly scandalous secret that could ruin my family forever."));
            add(new Flaw(45, "I too often hear veiled insults and threats in every word addressed to me, and I'm quick to anger."));
            add(new Flaw(46, "I have an insatiable desire for carnal pleasures."));
            add(new Flaw(47, "In fact, the world does revolve around me."));
            add(new Flaw(48, "By my words and actions, I often bring shame to my family."));
            add(new Flaw(49, "I am too enamored of ale, wine, and other intoxicants."));
            add(new Flaw(50, "There's no room for caution in a life lived to the fullest."));
            add(new Flaw(51, "I remember every insult I've received and nurse a silent resentment toward anyone who's ever wronged me."));
            add(new Flaw(52, "I am slow to trust members of other races"));
            add(new Flaw(53, "Violence is my answer to almost any challenge."));
            add(new Flaw(54, "Don't expect me to save those who can't save themselves. It is nature's way that the strong thrive and the weak perish."));
            add(new Flaw(55, "I am easily distracted by the promise of information."));
            add(new Flaw(56, "Most people scream and run when they see a demon. I stop and take notes on its anatomy."));
            add(new Flaw(57, "Unlocking an ancient mystery is worth the price of a civilization."));
            add(new Flaw(58, "I overlook obvious solutions in favor of complicated ones."));
            add(new Flaw(59, "I speak without really thinking through my words, invariably insulting others."));
            add(new Flaw(60, "I can't keep a secret to save my life, or anyone else's."));
            add(new Flaw(61, "I follow orders, even if I think they're wrong."));
            add(new Flaw(62, "I'll say anything to avoid having to do extra work."));
            add(new Flaw(63, "Once someone questions my courage, I never back down no matter how dangerous the situation."));
            add(new Flaw(64, "Once I start drinking, it's hard for me to stop."));
            add(new Flaw(65, "I can't help but pocket loose coins and other trinkets I come across."));
            add(new Flaw(66, "My pride will probably lead to my destruction"));
            add(new Flaw(67, "The monstrous enemy we faced in battle still leaves me quivering with fear."));
            add(new Flaw(68, "I have little respect for anyone who is not a proven warrior."));
            add(new Flaw(69, "I made a terrible mistake in battle that cost many lives--and I would do anything to keep that mistake secret."));
            add(new Flaw(70, "My hatred of my enemies is blind and unreasoning."));
            add(new Flaw(71, "I obey the law, even if the law causes misery."));
            add(new Flaw(72, "I'd rather eat my armor than admit when I'm wrong."));
            add(new Flaw(73, "If I'm outnumbered, I always run away from a fight."));
            add(new Flaw(74, "Gold seems like a lot of money to me, and I'll do just about anything for more of it."));
            add(new Flaw(75, "I will never fully trust anyone other than myself."));
            add(new Flaw(76, "I'd rather kill someone in their sleep than fight fair."));
            add(new Flaw(77, "It's not stealing if I need it more than someone else."));
            add(new Flaw(78, "People who don't take care of themselves get what they deserve."));
        }
    };
    return flaws;
}
Also used : ArrayList(java.util.ArrayList) Flaw(com.solinia.solinia.Models.Flaw)

Example 3 with Flaw

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

the class CommandPersonality method sendFlawChoices.

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

Example 4 with Flaw

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

the class CommandPersonality method setFlawChoice.

private void setFlawChoice(CommandSender sender, int id) {
    try {
        ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt((Player) sender);
        if (solPlayer.getPersonality().getFlawId() > 0) {
            sender.sendMessage("You have already set your flaw");
            return;
        }
        Flaw flaw = StateManager.getInstance().getConfigurationManager().getFlaw(id);
        if (flaw == null) {
            sender.sendMessage("That flaw does not exist");
            return;
        }
        solPlayer.getPersonality().setFlawId(flaw.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) Flaw(com.solinia.solinia.Models.Flaw)

Aggregations

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