Thread: Adding all Loyalty Titles

Page 1 of 28 12311 ... LastLast
Results 1 to 10 of 276
  1. #1 Adding all Loyalty Titles 
    Super Donator


    Join Date
    Sep 2008
    Age
    30
    Posts
    1,894
    Thanks given
    677
    Thanks received
    776
    Rep Power
    456
    Updated: Now loads titles from file and titles can be instantly assigned


    These are all the titles Jagex added as Loyalty Rewards - RuneScape - MMORPG - Titles.
    You can easily add your own titles too.

    Server

    In player.java declare this
    Code:
    public int playerTitle;
    Find
    Code:
    playerProps.writeByte(combatLevel);
    Below it you will see something like
    Code:
    playerProps.writeWord(0);
    REPLACE the 0 with playerTitle like this
    Code:
    playerProps.writeWord(playerTitle);
    Ensure that the playerTitle variable is saved upon logout and use this method to give a player a title.

    Code:
    	public void giveTitle(int titleId) {
    		this.playerTitle = titleId;
    		this.setAppearanceUpdateRequired(true);
    	}
    Client

    Create class Loyalty.java (you will have to change the cache path String)

    add

    Code:
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    
    public class Loyalty {
    
    	public static String[] title = new String[30];
            public static final String CACHE_PATH = "C:/RuneScape/"; //Change this to your cache directory
    	public static final String TITLE_PATH = CACHE_PATH + "titles.dat";
    
    	/**
    	 * Loads the loyalty titles from the cache
    	 */
    	public static void loadTitles() {
    		DataInputStream dataInputStream;
    		try {
    			dataInputStream = new DataInputStream(new FileInputStream(
    					TITLE_PATH));
    			for (int i = 0; i < title.length; i++) {
    				title[i] = dataInputStream.readUTF();
    			}
    			dataInputStream.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    	/**
    	 * Adds a title to the cache
    	 * 
    	 * @param the
    	 *            loyalty title added
    	 */
    	public static void addTitle(String title) {
    		DataOutputStream dataOutputStream;
    		try {
    			dataOutputStream = new DataOutputStream(new FileOutputStream(
    					TITLE_PATH));
    			dataOutputStream.writeUTF(title);
    			dataOutputStream.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    }
    Download the titles.dat file and add it to your cache directory

    http://**********/jlg6bmrbrtw4/titles.dat

    Now find
    Code:
    private void buildAtPlayerMenu
    You should see something like
    Code:
    		if (player.skill == 0) {
    			s = player.name
    					+ combatDiffColor(myPlayer.combatLevel, player.combatLevel)
    					+ " (level-" + player.combatLevel + ")";
    		} else {
    			s = player.name + " (skill-" + player.skill + ")";
    		}
    Replace all that with this
    Code:
    		if (player.skill == 0) {
    			s = player.name
    					+ combatDiffColor(myPlayer.combatLevel, player.combatLevel)
    					+ " (level-" + player.combatLevel + ")";
    		} else {
    			s = Loyalty.title[player.skill] + "@whi@ " + player.name
    					+ combatDiffColor(myPlayer.combatLevel, player.combatLevel)
    					+ " (level-" + player.combatLevel + ")";
    		}

    Done, you will notice there is also a method in the Loyalty class to add custom titles
    Reply With Quote  
     


  2. #2  
    Registered Member
    Join Date
    Nov 2009
    Posts
    3,052
    Thanks given
    112
    Thanks received
    838
    Rep Power
    740
    Don't like the whole thing, but goodjob on this, it looks neat and bugless
    Reply With Quote  
     

  3. #3  
    Extreme Donator


    Join Date
    Feb 2009
    Posts
    361
    Thanks given
    53
    Thanks received
    85
    Rep Power
    177
    Very nice, thanks for releasing!
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2010
    Age
    29
    Posts
    1,186
    Thanks given
    513
    Thanks received
    340
    Rep Power
    35
    Very nice release, will be using. ;3

    Does it show up in chatbox as well?
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    DystopiaPS

    Bells's Avatar
    Join Date
    Dec 2008
    Age
    27
    Posts
    3,788
    Thanks given
    600
    Thanks received
    1,449
    Rep Power
    4098
    Tysm!
    Reply With Quote  
     

  7. #6  
    Banned

    Join Date
    Nov 2010
    Age
    29
    Posts
    2,682
    Thanks given
    824
    Thanks received
    404
    Rep Power
    0
    Thanks man.
    Reply With Quote  
     

  8. #7  
    Super Donator


    Join Date
    Sep 2008
    Age
    30
    Posts
    1,894
    Thanks given
    677
    Thanks received
    776
    Rep Power
    456
    The default color is or2, if you want to have different colors for different titles just add the color in front of the String.

    eg;
    Code:
    			case 15:
    			return "@gre@Donator";
    Reply With Quote  
     

  9. #8  
    Banned

    Join Date
    May 2011
    Posts
    915
    Thanks given
    20
    Thanks received
    178
    Rep Power
    0
    Great Job Robbie, Showed me this over msn, Thank's for yet another contribution.
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Banned

    Join Date
    Nov 2010
    Age
    29
    Posts
    2,682
    Thanks given
    824
    Thanks received
    404
    Rep Power
    0
    Works fully. Nice Tut.
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    Super Donator


    Join Date
    Sep 2008
    Age
    30
    Posts
    1,894
    Thanks given
    677
    Thanks received
    776
    Rep Power
    456
    Quote Originally Posted by arrowzfly View Post
    For the people non-ranked it shows, but people ranked it doesn't.

    I need that fix and the fix for my correct combat level to show up:
    You must have added it wrongly in appendPlayerAppearance, its sending the combat level as the rank and the rank as the combat level.
    That's why a level 3 character has rank 3 and his combat level is showing as 0.

    Bottom of the method should look like this.

    Code:
    			playerProps.writeByte(combatLevel); // combat level
    			playerProps.writeWord(playerRank);
    
    			str.writeByteC(playerProps.currentOffset);
    			str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
    Reply With Quote  
     

Page 1 of 28 12311 ... 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. All new rs Emote's ( of loyalty )
    By Tony12 in forum Configuration
    Replies: 9
    Last Post: 10-30-2011, 01:02 AM
  2. 562+ Loyalty flags
    By Beuner in forum Help
    Replies: 3
    Last Post: 09-17-2011, 03:51 PM
  3. Some Loyalty Interfaces
    By killdogz in forum Graphics
    Replies: 4
    Last Post: 08-18-2011, 09:29 AM
  4. Members Loyalty
    By Kaiser Btw in forum Show-off
    Replies: 22
    Last Post: 08-15-2011, 05:53 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •