Thread: 2633 NPC Definitions w/Interactions (XML)

Results 1 to 8 of 8
  1. #1 6,390 NPC Definitions w/Interactions (XML) 
    Registered Member

    Join Date
    Aug 2009
    Posts
    1,443
    Thanks
    510
    Thanked 207 Times in 127 Posts
    Rep Power
    557
    Preview:
    Code:
    <list>
        <NPCDefinitions>
            <id>0</id>
            <size>1</size>
            <name>Hans</name>
            <description>Servant of the Duke of Lumbridge.</description>
            <combatLevel>0</combatLevel>
            <interactions>
                <string>TALK-TO</string>
            </interactions>
        </NPCDefinitions>
        <NPCDefinitions>
            <id>1</id>
            <size>1</size>
            <name>Man</name>
            <description>One of RuneScape's many citizens.</description>
            <combatLevel>2</combatLevel>
            <interactions>
                <string>TALK-TO</string>
                <string>ATTACK</string>
                <string>PICKPOCKET</string>
            </interactions>
        </NPCDefinitions>

    UPDATED*:

    There is now 6,390 NPC Definitions (474 npcs)
    created a loader, edited Graham's

    Code:
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.List;
    import java.util.logging.Logger;
    
    /**
     * @author warsaw
     */
    public class NPCDefinitions {
    
        /**
         * The XML file
         */
        private static String FILE = "./data/npcDefinitions.xml";
    
        /**
         * logger
         */
        private static final Logger logger = Logger.getLogger(NPCDefinitions.class.getName());
    
        /**
         * The definitions
         */
        private static NPCDefinitions[] definitions = null;
    
        /**
         * Loads NPC Definitions
         *
         * @throws FileNotFoundException The file isn't there / missing
         */
        @SuppressWarnings("unchecked")
        public static void main(String args[]) throws FileNotFoundException {
            logger.info("Loading NPC Definitions...");
            List<NPCDefinitions> list = (List<NPCDefinitions>) xStreamManager.load(new FileInputStream(FILE));
            definitions = new NPCDefinitions[list.size() + 1];
            for (NPCDefinitions def : list) {
                definitions[def.getId()] = def;
            }
            logger.info("Loaded " + list.size() + " npc definitions.");
        }
    
        /**
         * The Id
         */
        private int id;
    
        /**
         * The size
         */
        private int size;
    
        /**
         * The name
         */
        private String name;
    
        /**
         * The description
         */
        private String description;
    
        /**
         * The combat level
         */
        private int combatLevel;
    
        /**
         * The interactions.
         */
        private String[] interactions;
    
        /**
         * The constructor
         */
        public NPCDefinitions() {
    
        }
    
        /**
         * Gets npc by Id
         *
         * @param id The NPC Id
         * @return npcDefinition The npc definition
         */
        public static NPCDefinitions forId(int id) {
            NPCDefinitions definition = definitions[id];
            if (definition == null) {
                definition = createDefinition(id);
            }
            return definition;
        }
    
        /**
         * Creates a definition by Id
         *
         * @param id The id
         * @return def The NPC Definition
         */
        public static NPCDefinitions createDefinition(int id) {
            NPCDefinitions def = new NPCDefinitions();
            def.id = id;
            return def;
        }
    
        @Override
        public String toString() {
            return NPCDefinitions.class.getName() + "[id=" + id + " name=" + name + " description=" + description + " combat=" + combatLevel + "]";
        }
    
        /**
         * Gets the id
         *
         * @return id The id
         */
        public int getId() {
            return id;
        }
    
        /**
         * Gets the size
         *
         * @return size The size
         */
        public int getSize() {
            return size;
        }
    
        /**
         * Gets the name
         *
         * @return name The NPC name
         */
        public String getName() {
            return name;
        }
    
        /**
         * Gets the combat level
         *
         * @return combatLevel The combat level
         */
        public int getCombatLevel() {
            return combatLevel;
        }
    
        /**
         * Gets the description
         *
         * @return description The description
         */
        public String getDescription() {
            return description;
        }
    
        /**
         * Gets the interaction menu
         *
         * @return interactions The interactions
         */
        public String[] getInteractions() {
            return interactions;
        }
    
    }
    NOTE
    Getting interactions menu:

    Example:
    Code:
            <interactions>
                <string>TALK-TO</string>
                <string>ATTACK</string>
                <string>PICKPOCKET</string>
            </interactions>
    Code:
    System.out.println(NPCDefinitions.forId(NPC_ID).getInteractions[0]);
    Would print out
    Code:
    Talk-To
    0 = the first option
    1 = the second option
    etc



    File: Here
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Shake n Bake

    Organic's Avatar
    Join Date
    Apr 2010
    Posts
    2,462
    Thanks
    190
    Thanked 300 Times in 178 Posts
    Rep Power
    550
    I remember seeing this some were but I forget, nice release.

    Just live life at its fullest.

    LOL
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    I need object.xml
    Reply With Quote  
     

  5. #4  
    Registered Member

    Join Date
    Aug 2009
    Posts
    1,443
    Thanks
    510
    Thanked 207 Times in 127 Posts
    Rep Power
    557
    Quote Originally Posted by ratekas99 View Post
    I need object.xml
    wrong place
    Reply With Quote  
     

  6. #5  
    Donator

    Snake's Avatar
    Join Date
    May 2010
    Posts
    1,207
    Thanks
    913
    Thanked 104 Times in 85 Posts
    Rep Power
    172
    Thanks, needed this. also would be better if it has coordinates.

    EDIT: This isn't full, it only goes up to 208.
    Reply With Quote  
     

  7. #6  
    Registered Member

    Join Date
    Aug 2009
    Posts
    1,443
    Thanks
    510
    Thanked 207 Times in 127 Posts
    Rep Power
    557
    Quote Originally Posted by Solid Snake View Post
    Thanks, needed this. also would be better if it has coordinates.

    EDIT: This isn't full, it only goes up to 208.
    thanks for pointing that out, i'll upload the file in a bit

    EDIT: http://www.mediafire.com/?ga5c413yqnlx2cn
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member

    Join Date
    Aug 2009
    Posts
    1,443
    Thanks
    510
    Thanked 207 Times in 127 Posts
    Rep Power
    557
    re-uploaded & updated
    Reply With Quote  
     

  10. Thankful user:


  11. #8  
    Donator


    Join Date
    Sep 2007
    Age
    21
    Posts
    919
    Thanks
    48
    Thanked 106 Times in 54 Posts
    Rep Power
    81
    Quote Originally Posted by warsaw View Post
    re-uploaded & updated
    Thanks bro.
    Providing Java Programming Support Since 2011
    Skype: travis.mccorkle
    Reply With Quote  
     

  12. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 60% [ALL] NPC Combat Definitions
    By Sonicforce41 in forum Snippets
    Replies: 10
    Last Post: 11-05-2011, 05:14 PM
  2. Requesting NPC Definitions
    By `Eclipse™ in forum Requests
    Replies: 0
    Last Post: 10-10-2011, 01:04 AM
  3. 508 Items.xml, Objects.xml and Npcs.xml
    By owner blade in forum Configuration
    Replies: 2
    Last Post: 01-13-2011, 11:16 PM
  4. NPC definitions
    By legitizpro in forum Requests
    Replies: 1
    Last Post: 06-20-2010, 06:15 PM
  5. Replies: 3
    Last Post: 05-03-2010, 03:39 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •