Thread: [718] Basic Version System

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 [718] Basic Version System 
    Super Donator

    Benji's Avatar
    Join Date
    Feb 2010
    Age
    26
    Posts
    1,526
    Thanks given
    920
    Thanks received
    501
    Discord
    View profile
    Rep Power
    555
    I decided about an hour ago to come back to RsPs haha, leaving the 317 scene for this revision where I hopefully won't have to hardcode client content into lower revision clients. Been planning a collaboration/repository update system for development, needed some way of standardizing patch notes/authors.

    Here is what I did for my server:

    Code:
    package com.rs;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Map;
    import java.io.IOException;  
    import java.io.BufferedReader;  
    import java.io.File;
    import java.io.FileReader;
    
    
    
    
    /** 
     * @author Benji
     * Stores commit-specific data and handles revision-related queries
     */
    
    
    public final class Runehub {
        
        /** constant value, set per revision */
        public static final String revisionID = "1.0";
        
        /** constant, referenceable HashMap with a String key (in this case, the revision ID)  tied to an arraylist of strings - patch notes for that revision id, contributor for that revision id, etc)*/
        private static final Map<String, ArrayList<String>> updateNotes = new HashMap<String, ArrayList<String>>();
        
        public static final void init() { 
            /** Load patch notes into string collection */
            /** loadNotes is put in try-catch because the method throws IOException if it runs into errors */
            try {
                loadNotes();
                System.out.println(updateNotes);  
            } catch(IOException io) {
                 System.out.println("Unable to load patch note files.");
            }
    
    
        }
        
        private static void loadNotes() throws IOException {
            /** first three lines takes the revision string, e.g. "1.0"  and splits the string around the period, giving us a string array with two strings, "1" and "0", or the revision or version values */
            String[] values = revisionID.split("\\.");  
            int revisionnumber = Integer.parseInt(values[0]);
            int versionnumber = Integer.parseInt(values[1]);
            /** two nested for loops follow, looping through all the revisions (1, 2, 3, and so on)  and the individual version of each revision (1.2, 1.24, 3.6, and so on)
            for(int r = 1; r <= revisionnumber; r++) {
                for(int i = 0; i <= versionnumber; i++) {
                    String versionIndex = Integer.toString(r) + "." + Integer.toString(i);
                    File notetxt = new File("resources/notes/" + versionIndex + ".txt");  
                    if(notetxt.exists()) {
                        ArrayList<String> info = new ArrayList<String>();
                        String currentline;
                        BufferedReader bufferedReader = new BufferedReader(new FileReader(notetxt));  
                        /** loops through every line fed to us by the bufferedReader of the txt and adds it to the expandable arraylist we declared earlier */  
                        while ((currentline = bufferedReader.readLine()) != null) {
                            info.add(currentline);
                        }
                        /** stuffs the loaded arraylist into our original hashmap with the revision id serving as the key, or the initial slot */
                        updateNotes.put(versionIndex, info);
                        bufferedReader.close();
                    } else {
                        /** this is in case there is no patch note txt for the particular version, so we skip this iteration of the version number for the next, e.g from 1.0 to 1.1 */
                        continue;
                    }
                }
            }
        }
        
        
        public static final String currentNotes() {
            return updateNotes.get(revisionID).get(0);
        }
        
        public static final String retrieveNote(String revision) {
            return updateNotes.get(revision).get(0);
        }
        
        public static final String currentContributor() {
            return updateNotes.get(revisionID).get(1);
        }
        
        public static final String specificContributor(String revision) {
            return updateNotes.get(revision).get(1);
        }
        
    }
    Remove your latest update crap in class Settings and replace the login stuff with something nice (I used that interface ids someone released in this section) that references the static values current/specific author and current/retrieveNote notes.

    Oh yea and create a folder resources, another folder notes inside that, then txt files with revision history number titles.

    Since I used an arraylist/while loop for loading the files, you can add as many lines of extra info (I was thinking repository commit comments for mine) in the txt and just reference them with get (line index).

    Pictures:


    using println to output the contents of the arraylist, the raw output



    patch notes themselves


    P.S. can someone tell me where projectile handling is done in Matrix? downloaded the source/got into 503+ devo today and I'm still getting used to the structure

    Reply With Quote  
     

  2. Thankful user:

    Lee

  3. #2  
    Donator


    Join Date
    Jul 2012
    Age
    23
    Posts
    1,954
    Thanks given
    1,035
    Thanks received
    459
    Rep Power
    89
    Hm, Nice idea. Good Luck with 503+ sir.
    Reply With Quote  
     

  4. #3  
    Registered Member

    Join Date
    Jan 2013
    Age
    23
    Posts
    783
    Thanks given
    159
    Thanks received
    170
    Rep Power
    360
    Very nice man, thanks for this
    Reply With Quote  
     

  5. #4  
    Lee
    Lee is offline
    Registered Member

    Join Date
    Feb 2012
    Age
    27
    Posts
    786
    Thanks given
    135
    Thanks received
    90
    Rep Power
    171
    Great, looks nice.

    Keep up the work and welcome back
    Reply With Quote  
     

  6. #5  
    Donator
    Unlucky4ever's Avatar
    Join Date
    Nov 2007
    Age
    27
    Posts
    524
    Thanks given
    46
    Thanks received
    72
    Rep Power
    37
    Looks nice, keep it up, and welcome back!
    Reply With Quote  
     

  7. #6  
    Banned
    Join Date
    May 2013
    Posts
    202
    Thanks given
    0
    Thanks received
    40
    Rep Power
    0
    Why did you switch revisions?
    Reply With Quote  
     

  8. #7  
    Super Donator

    Benji's Avatar
    Join Date
    Feb 2010
    Age
    26
    Posts
    1,526
    Thanks given
    920
    Thanks received
    501
    Discord
    View profile
    Rep Power
    555
    Quote Originally Posted by Neurons View Post
    Why did you switch revisions?
    317 loading higher revisions is a lost cause. Too much time used on hard loading newer revision client content could be applied to more server development.

    I fleshed out the snippet with some comments explaining what's happening thanks to a nice little reminder pm Lee sent me. Thanks for the input guys!

    Reply With Quote  
     

  9. #8  
    Registered Member Taylor Moon's Avatar
    Join Date
    Aug 2012
    Posts
    2,568
    Thanks given
    625
    Thanks received
    1,301
    Rep Power
    66
    Fantastic idea, will consider making my own.
    Reply With Quote  
     

  10. #9  
    Super Donator

    Benji's Avatar
    Join Date
    Feb 2010
    Age
    26
    Posts
    1,526
    Thanks given
    920
    Thanks received
    501
    Discord
    View profile
    Rep Power
    555
    2nd day tutorial out - [Only registered and activated users can see links. ]

    Reply With Quote  
     

  11. #10  
    Registered Member
    maffia-rpg's Avatar
    Join Date
    Jul 2011
    Posts
    2,776
    Thanks given
    587
    Thanks received
    759
    Rep Power
    120
    version != string
    Quote Originally Posted by Nando View Post
    why would I care about trying to get you to care about me homosexual?
    back to coding shit revisions
    1080% lost.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [718+] Basic LootShare System
    By kalo93 in forum Tutorials
    Replies: 49
    Last Post: 02-20-2016, 01:31 AM
  2. Basic membership system
    By Sub in forum Website Development
    Replies: 13
    Last Post: 08-02-2010, 11:18 PM
  3. [NEW] Basic Loans System!
    By Inside Sin in forum Tutorials
    Replies: 54
    Last Post: 11-21-2008, 11:59 AM
  4. Fix for T X's Basic Quest System.
    By k1ng 0f k1ngs in forum Tutorials
    Replies: 7
    Last Post: 10-11-2008, 12:24 AM
  5. My Basic clan system
    By Phinal in forum Tutorials
    Replies: 7
    Last Post: 05-22-2008, 10:52 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
  •