Search in sources :

Example 1 with Bond

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

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

the class ConfigurationManager method generateBonds.

public List<Bond> generateBonds() {
    List<Bond> bonds = new ArrayList<Bond>() {

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

        {
            add(new Bond(1, "I would die to recover an ancient artifact of my faith that was lost long ago."));
            add(new Bond(2, "I will someday get revenge on the corrupt temple hierarchy who branded me a heretic."));
            add(new Bond(3, "I owe me life to the priest who took me in when my parents died."));
            add(new Bond(4, "Everything I do is for the common people."));
            add(new Bond(5, "I will do anything to protect the temple where I served."));
            add(new Bond(6, "I seek to preserve a sacred text that my enemies consider heretical and seek to destroy."));
            add(new Bond(7, "I fleeced the wrong person and must work to ensure that this individual never crosses paths with me or those I care about."));
            add(new Bond(8, "I owe everything to my mentor--a horrible person who's probably rotting in jail somewhere."));
            add(new Bond(9, "Somewhere out there I have a child who doesn't know me. I'm making the world better for him or her."));
            add(new Bond(10, "I come from a noble family, and one day I'll reclaim my lands and title from those who stole them from me."));
            add(new Bond(11, "A powerful person killed someone I love. Some day soon, I'll have my revenge."));
            add(new Bond(12, "I swindled and ruined a person who didn't deserve it. I seek to atone for my misdeeds but might never be able to forgive myself."));
            add(new Bond(13, "I'm trying to pay off an old debt I owe to a generous benefactor."));
            add(new Bond(14, "My ill-gotten gains go to support my family."));
            add(new Bond(15, "Something important was taken from me, and I aim to steal it back."));
            add(new Bond(16, "I will become the greatest thief that ever lived."));
            add(new Bond(17, "I'm guilty of a terrible crime. I hope I can redeem myself for it."));
            add(new Bond(18, "Someone I loved died because of a mistake I made. That will never happen again."));
            add(new Bond(19, "My instrument is my most treasured possession, and it reminds me of someone I love."));
            add(new Bond(20, "Someone stole my precious instrument, and someday I'll get it back."));
            add(new Bond(21, "I want to be famous, whatever it takes."));
            add(new Bond(22, "I idolize a hero of the old tales and measure my deeds against that person's."));
            add(new Bond(23, "I will do anything to prove myself superior to me hated rival."));
            add(new Bond(24, "I would do anything for the other members of my old troupe."));
            add(new Bond(25, "I have a family, but I have no idea where they are. One day, I hope to see them again."));
            add(new Bond(26, "I worked the land, I love the land, and I will protect the land."));
            add(new Bond(27, "A proud noble once gave me a horrible beating, and I will take my revenge on any bully I encounter."));
            add(new Bond(28, "My tools are symbols of my past life, and I carry them so that I will never forget my roots."));
            add(new Bond(29, "I protect those who cannot protect themselves."));
            add(new Bond(30, "I wish my childhood sweetheart had come with me to pursue my destiny."));
            add(new Bond(31, "The workshop where I learned my trade is the most important place in the world to me."));
            add(new Bond(32, "I created a great work for someone, and then found them unworthy to receive it. I'm still looking for someone worthy."));
            add(new Bond(33, "I owe my guild a great debt for forging me into the person I am today."));
            add(new Bond(34, "I pursue wealth to secure someone's love."));
            add(new Bond(35, "One day I will return to my guild and prove that I am the greatest artisan of them all."));
            add(new Bond(36, "I will get revenge on the evil forces that destroyed my place of business and ruined my livelihood."));
            add(new Bond(37, "Nothing is more important than the other members of my hermitage, order, or association."));
            add(new Bond(38, "I entered seclusion to hide from the ones who might still be hunting me. I must someday confront them."));
            add(new Bond(39, "I'm still seeking the enlightenment I pursued in my seclusion, and it still eludes me."));
            add(new Bond(40, "I entered seclusion because I loved someone I could not have."));
            add(new Bond(41, "Should my discovery come to light, it could bring ruin to the world."));
            add(new Bond(42, "My isolation gave me great insight into a great evil that only I can destroy."));
            add(new Bond(43, "I will face any challenge to win the approval of my family."));
            add(new Bond(44, "My house's alliance with another noble family must be sustained at all costs."));
            add(new Bond(45, "Nothing is more important that the other members of my family."));
            add(new Bond(46, "I am in love with the heir of a family that my family despises."));
            add(new Bond(47, "My loyalty to my sovereign is unwavering."));
            add(new Bond(48, "The common folk must see me as a hero of the people."));
            add(new Bond(49, "My family, clan, or tribe is the most important thing in my life, even when they are far from me."));
            add(new Bond(50, "An injury to the unspoiled wilderness of my home is an injury to me."));
            add(new Bond(51, "I will bring terrible wrath down on the evildoers who destroyed my homeland."));
            add(new Bond(52, "I am the last of my tribe, and it is up to me to ensure their names enter legend."));
            add(new Bond(53, "I suffer awful visions of a coming disaster and will do anything to prevent it."));
            add(new Bond(54, "It is my duty to provide children to sustain my tribe."));
            add(new Bond(55, "It is my duty to protect my students."));
            add(new Bond(56, "I have an ancient text that holds terrible secrets that must not fall into the wrong hands."));
            add(new Bond(57, "I work to preserve a library, university, scriptorium, or monastery."));
            add(new Bond(58, "My life's work is a series of tomes related to a specific field of lore."));
            add(new Bond(59, "I've been searching my whole life for the answer to a certain question."));
            add(new Bond(60, "I sold my soul for knowledge. I hope to do great deeds and win it back."));
            add(new Bond(61, "I'm loyal to my captain first, everything else second."));
            add(new Bond(62, "The ship is most important--crewmates and captains come and go."));
            add(new Bond(63, "I'll always remember my first ship."));
            add(new Bond(64, "In a harbor town, I have a paramour whose eyes nearly stole me from the sea."));
            add(new Bond(65, "I was cheated of my fair share of the profits, and I want to get my due."));
            add(new Bond(66, "Ruthless pirates murdered my captain and crewmates, plundered our ship, and left me to die. Vengeance will be mine."));
            add(new Bond(67, "I would lay down my life for the people I served with."));
            add(new Bond(68, "Someone saved my life on the battlefield. To this day, I will never leave a friend behind."));
            add(new Bond(69, "My honor is my life."));
            add(new Bond(70, "I'll never forget the crushing defeat my company suffered or the enemies who dealt it."));
            add(new Bond(71, "Those who fight beside me are those worth dying for."));
            add(new Bond(72, "I fight for those who cannot fight for themselves."));
            add(new Bond(73, "My town or city is my home, and I'll fight to defend it."));
            add(new Bond(74, "I sponsor an orphanage to keep others from enduring what I was forced to endure."));
            add(new Bond(75, "I owe my survival to another urchin who taught me to live on the streets."));
            add(new Bond(76, "I owe a debt I can never repay to the person who took pity on me."));
            add(new Bond(77, "I escaped my life of poverty by robbing an important person, and I'm wanted for it."));
            add(new Bond(78, "No one else is going to have to endure the hardships I've been through."));
        }
    };
    return bonds;
}
Also used : ArrayList(java.util.ArrayList) Bond(com.solinia.solinia.Models.Bond)

Example 3 with Bond

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

the class CommandPersonality method setBondChoice.

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

Example 4 with Bond

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

the class CommandPersonality method sendBondChoices.

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

Aggregations

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