[WIP] RCAchievements - You never saw Achievements like this before!

Discussion in 'WIP and Development Status' started by silthus, Jun 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    silthus

    [​IMG]

    Mine 1000 diamonds and hit grass blocks 100 times sounds boring?
    It is!
    Now you can create real Achievements with multiple requirements and events chained together to create the epic and fun Achievement experience you know from other MMOs and Games.

    Do you want to award your players for...
    • ... finding that secret dungeon without beeing hit by Skeletons?
    • ... completing the difficult jump pacour in under 10 minutes without falling?
    • ... killing 10 different players without armor on?
    • ... gathering all of the achievements above?
    • ...
    Now you can!
    Of course the old fashion achievements like gather, break, place kill of that are still available.

    Here are some already finished Features:

    • Customizable Achievements that can be put together by combining multiple so called Requirements and Rewards.
    • API for developers to tag methods and provide them for the admin to configure.
    • Push based Event dispatching, for fast handling of achievements.
    • MySQL and SQLite Support
    • Here are some already finished Requirements you can use:
      • LOCATION - When a player reaches a location (can be configured in game via command)
      • TIME - Supports a timer that works especially well with locations, e.g. you can make the player run from one waypoint to an other in 10 seconds.
      • CRAFT - Monitor any item a player crafts and award achievements accordingly
      • BLOCK - Monitor block placement and breaking of blocks
      • ENCHANT - Monitor players enchanting items
      • ACHIEVEMENT - Give an achievement when players gathered other achievements
      • ITEM - Be able to track items the player has in his inventory, equiped or in the hand
      • MOVE - Track player movement like jumping, sneaking, swimming, driving and so on...
      • CUSTOM - Use any tagged methods from your favorite plugins
    • Some of the requirements can be counted, that means it will save the player progress to the database, e.g. make the player destroy 10 crop and make him craft 10 bread with that
    • Possible Rewards:
      • COMMAND
      • MONEY
      • ITEM
    • Spout Achievements PopUp on Achievement Gain
    • Configurable Custom Sound on Achievement Gain
    Here is a documented example file of how you could design an achievement. The achievement will be triggered and awarded to the player when all or some requirements are true. Requirements can be done in order or not.

    But you should take a look at this file it will explain most requirements currently working and available:

    Show Spoiler

    Code:
    achievements:
        # you can add a new achievement template from ingame with
        # /rca addachievement/-aa <id> [radius]
        # where id is the unique name, e.g. default
        # if you specify a radius a new location requirement will be added
        # you can specify 0 as the radius too
        default:
            # name of the achievement
            # if using spout this should be < 25 letters
            name: "Up in the Air!"
            # a description that tells the player what to to
            description: "Find the World Spawn Point"
            # a list of worlds this achievement is checked for
            # if this is missing it will check all worlds
            worlds:
            - world
            - world_nether
            # how many points does the player getInstance for this achivement?
            points: 10
        # If broadcast is set to true all online players will
        # be notified if the user gains the achievement
        broadcast: true
            # requirements need to be solved in order?
            # if this is false the requirements can be
            # solved in any order. When all are met the
            # player gets the achivement
            ordered-requirements: true
        # set this if you want to award the achievement when
        # some of the requirements below are met
        # don't use this with ordered-requirements: true
        needed-requirements: 5
        # the list of requirements
            requirements:
                0:
                    # possible types:
                    # * LOCATION
                    # * TIME
                    # * ACHIEVEMENT
                    # * CRAFT
                    # * ENCHANT
                    # * BLOCK
                    # * ITEM
                    # You can set a location requirement from InGame by typing
                    # /rcachievement addlocation <achievement> [radius]
                    # where <achievement> is the UID from above and
                    # the optional radius
                    type: LOCATION
                    # if you dont specify the coordinates
                    # and only a world the achievement will be
                    # linked to the world only
                    x: 0
                    y: 128
                    z: 0
                    # this message is displayed when the requirement comes true
                    message: "You have reached the point!"
                    world: "world"
                    # if you leave this out you will have to reach the exact spot
                    radius: 10
                2:
                    # a time requirement has 2 actions:
                    # * START
                    # * STOP
                    # In the STOP action you need to reference you start
                    # requirement with start-id: <id>
                    type: TIME
                    action: START
                    # time in seconds the player has
                    # to reach the point where the STOP action is called
                    time: 30
                    message: "Countdown started"
                    # this message is displayed when the countdown runs our
                    fail-message: "Countdown is over!"
                3:
                    # a requirement that checks if the player is in the nether
                    type: LOCATION
                    world: "world_nether"
                    message: "Reached the nether"
            # if the counter is set it will reset all requirements
            # of this achievement and increase the counter by one
            # when the player reaches the location
            counter: 5
                4:
                    type: TIME
                    action: STOP
                    # %d will be replaced by the time it took the player to get here
                    message: "You reached the target in %d seconds"
                5:
                    type: ACHIEVEMENT
                    # the achievement required to get this achievement
                    achievement: default
                6:
                    # the block requirement has two actions:
                    # BREAK
                    # PLACE
                    type: BLOCK
                    action: BREAK
                    # you can use the name of the block or the id
                    item: IRON_ORE
                    # BLOCK, ENCHANT and CRAFT requirements are countable
                    count: 50
                7:
                    # the item requirement checks the items the player has
                    # in his HAND, EQUIPED or INVENTORY
                    type: ITEM
                    action: HAND
                    item: STICK
                8:
                    type: ITEM
                    action: INVENTORY
                    items:
                        # checks the inventor for 20 stone blocks
                        STONE: 20
                        # and 35 CobbleStone blocks
                        4: 35
                9:
                    type: ITEM
                    action: EQUIPED
                    helmet: IRON_HELMET
                    leggings: 0
                    chest: DIAMOND_CHEST
                    # here you could write boots
                    # if not it will be the same as leggings: 0 - e.g. AIR
                10:
                    # tracks if any item was enchanted with silktouch
                    # needs to be repeated 10 times
                    type: ENCHANT
                    item: ANY
                    # list of enchantments here:
                    # http://jd.bukkit.org/doxygen/db/d2b/Enchantment_8java_source.html
                    enchantment: SILK_TOUCH
                    level: 1
                    count: 10
                11:
                    type: CRAFT
                    item: DIAMOND_SWORD
                    count: 5
                12:
            # this is an example of a custom plugin requirement
            # provided by our RCSkills plugin
                    type: CUSTOM
            # the "name" of the requirement is put together by
            # <plugin>.<classname>.<method>
                    name: "rcskills.player.level"
            # it will match the returned value from the method with this value
            # they need to have the same return type
            value: 10
            # specifies an operator to check
            # in this case the requirement is true when the player level is greater then 10
            operator: ">"
            rewards:
                0:
                    type: COMMAND
                    # again %s is replaced by the player name
                    command: "rcs addxp %s 5"
                1:
                    # gives the player the specified amount of money
                    type: MONEY
                    money: 200.0


    Here is an example of how the API currently works. This will change soon and become much more flexiable.

    In your main class:
    Show Spoiler

    Code:
    private void registerAchievements() {
            // register a class for the achievement plugin
            Plugin rcAchievements = Bukkit.getPluginManager().getPlugin("RCAchievements");
            if (rcAchievements != null && rcAchievements.isEnabled()) {
                AchievementHandler.registerPlugin(this, RCSkillAchievements.class);
            }
        }


    And the RCSkillAchievements.class:
    Show Spoiler

    Code:
    @ClassName("player")
    public class RCSkillAchievements implements TaggedAchievement {
     
        @MethodName("level")
        public static int getLevel(AchievementPlayer player) {
            return PlayerManager.getPlayer(player.getPlayer()).getRank().getId();
        }
     
        @MethodName("exp")
        public static int getExp(AchievementPlayer player) {
            return PlayerManager.getPlayer(player.getPlayer()).getExp();
        }
     
        @MethodName("skillpoints")
        public static int getSkillpoints(AchievementPlayer player) {
            return PlayerManager.getPlayer(player.getPlayer()).getSkillpoints();
        }
    }


    Finally here are some achievements we configured four the Beta Test on our server: http://pastebin.com/03FajmML

    Whats ToDo and what will come:
    • Tracking Shift Click Crafting is currently broken
    • More Requirements and Rewards (let me know what you want!)
    • English Localization and language.yml config
    • Web Support with list of all configured Achievements
    Oh and if you want to try a demo you can get the mostly stable version here. But be warned it is in german and still has some bugs. You will also need the RaidCraftCore (Base API for our plugins). You will not need the RCAchievements-API since it is compiled into the RCAchievements.jar:

    http://ci.raid-craft.de

    I am happy about any feedback good or bad ;)
     
    ThatBox and CarlosArias604 like this.
  2. Offline

    silthus

    Let me give you a small status update here:

    • SQLite is done and fully supported now.
    • I added Move Requirements so you can track how often a player jumps or how many blocks he moved jumping, diving, sneaking, running, falling or driving.
    • The WebPart is also almost finished and contains a Wizard to create Achievements and directly load them into the mySQL Database. That means that you can add new achievements via Web and deploy them directly InGame and the only thing you have to do is type /rca reload
    The plugin is already running on my production server and the feedback has been great so far. I still need to do localization to support multiple languages and fix the damn Shift-Click Crafting Bug.

    As always you can already try out the mostly stable Version from http://ci.raid-craft.de

    And also if you are German and want to see the Achievement System in Action you can visit us on http://www.raid-craft.de
     
    CarlosArias604 likes this.
  3. Offline

    silthus

    I will try to polish it up and release it this weekend so stay tuned for awesome achievements!
     
    CarlosArias604 likes this.
Thread Status:
Not open for further replies.

Share This Page