Thread: [718] Titles { Enum }

Results 1 to 10 of 10
  1. #1 [718] Titles { Enum } 
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    30
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,055
    Discord
    View profile
    Rep Power
    709
    Did this in response to a snippet that was posted by Rediculous, everyone complaining about using enums, so here ya go, ENUMS. Wrote this ages ago, been in most of the rune-evo releases forever >.>

    Code:
    package com.foxtrot.game.player.content.custom;
    
    import com.foxtrot.cache.loaders.ClientScriptMap;
    
    public class TitleHandler {
    
        public enum Titles {
            
            JUNIOR_CADET(1, "Junior Cadet ", "AA44AA", null, false),
            SERJEANT(2, "Serjeant ", "AA44AA", null, false),
            COMMANDER(3, "Commander ", "AA44AA", null, false),
            WAR_CHIEF(4, "War-chief ", "AA44AA", null, false),
            SIR(5, "Sir ", "C86400", null, false),
            LORD(6, "Lord ", "C86400", null, false),
            DUDERINO(7, "Duderino ", "C86400", null, false),
            LIONHEART(8, "Lionheart ", "C86400", null, false),
            HELLRAISER(9, "Hellraiser ", "C86400", null, false),
            CRUSADER(10, "Crusader ", "C86400", null, false),
            DESPERADO(11, "Desperado ", "C86400", null, false),
            BARON(12, "Baron ", "C86400", null, false),
            COUNT(13, "Count ", "C86400", null, false),
            OVERLORD(14, "Overlord ", "C86400", null, false),
            BANDITO(15, "Bandito ", "C86400", null, false),
            DUKE(16, "Duke ", "C86400", null, false),
            KING(17, "King ", "C86400", null, false),
            BIG_CHEESE_(18, "Big Cheese ", "C86400", null, false),
            BIGWIG_(19, "Bigwig ", "C86400", null, false),
            WUNDERKIND(20, "Wunderkind ", "C86400", null, false),
            VYRELING(21, "Vyreling ", "466AFA", null, false),
            VYRE_GRUNT(22, "Vyre Grunt ", "7D3FEC", null, false),
            VYREWATCH(23, "Vyrewatch ", "6C0B2B", null, false),
            VYRELORD(24, "Vyrelord ", "C12006", null, false),
            YT_HAAR(25, "Yt?Haar ", "C12006", null, false),
            EMPEROR(26, "Emperor ", "C86400", null, false),
            PRINCE(27, "Prince ", "C86400", null, false),
            WITCH_KING(28, "Witch king ", "C86400", null, false),
            ARCHON(29, "Archon ", "C86400", null, false),
            JUSTICIAR(30, "Justiciar ", "C86400", null, false),
            THE_AWESOME(31, "The Awesome ", "C86400", null, false),
            THE_MAGNIFICENT(32, " the magnificent", "C86400", null, true),
            THE_UNDEFEATED(33, " the undefeated", "C86400", null, true),
            THE_STRANGE(34, " the strange", "C86400", null, true),
            THE_DIVINE(35, " the divine", "C86400", null, true),
            THE_FALLEN(36, " the fallen", "C86400", null, true),
            THE_WARRIOR(37, " the warrior", "C86400", null, true),
            THE_REAL_(38, "The Real ", "C86400", null, false),
            COWARDLY_(39, "Cowardly ", "AA44AA", null, false),
            THE_REDUNDANT(40, " the Redundant", "AA44AA", null, true),
            EVERYONE_ATTACK(41, "Everyone attack ", "AA44AA", null, false),
            SMELLY(42, "Smelly ", "AA44AA", null, false),
            THE_IDIOT(43, " the Idiot", "AA44AA", null, true),
            SIR_LAME(44, "Sir Lame ", "AA44AA", null, false),
            THE_FLAMBOYANT(45, " the Flamboyant", "AA44AA", null, true),
            WEAKLING(46, "Weakling ", "AA44AA", null, false),
            WAS_PUNISHED(47, " was punished", "AA44AA", null, true),
            LOST(48, " lost", "AA44AA", null, true),
            YOU_FAIL(49, " ...you fail", "AA44AA", null, true),
            NO_MATES_(50, "No-mates ", "AA44AA", null, false),
            ATE_DIRT(51, " ate dirt", "AA44AA", null, true),
            DELUSIONAL_(52, "Delusional ", "AA44AA", null, false),
            THE_RESPAWNER(53, " the Respawner", "AA44AA", null, true),
            CUTIE_PIE_(54, "Cutie-pie ", "AA44AA", null, false),
            THE_FAIL_MAGNET(55, " the Fail Magnet", "AA44AA", null, true),
            WAS_TERMINATED(56, " was terminated", "AA44AA", null, true),
            LAZY(57, "Lazy ", "AA44AA", null, false),
            WHO(58, "? Who?", "AA44AA", null, true);
            
            private int id;
            private String title, color, shade;
            private boolean after;
            
            Titles(int id, String title, String color, String shade, boolean after) {
                this.id = id;
                this.title = title;
                this.color = color;
                this.shade = shade;
                this.after = after;
            }
            
            public int getId() {
                return id;
            }
            
            public String getTitle() {
                return title;
            }
            
            public String getColor() {
                return color;
            }
            
            public String getShade() {
                return shade;
            }
            
            public boolean goesAfter() {
                return after;
            }
            
        }
        
        public static Titles getTitle(int id) {
            for (Titles t : Titles.values()) {
                if (t.getId() == id) {
                    return t;
                }
            }
            return null;
        }
        
        public static boolean goesAfterName(int titleId) {
            Titles title = getTitle(titleId);
            
            if (title == null)
                return false;
            
            return title.goesAfter();
        }
        
         public static String getFullTitle(boolean male, int titleId) {		if (titleId < 60) {
    			return ClientScriptMap.getMap(male ? 1093 : 3872).getStringValue(titleId);
    		}
    		
    		Titles title = getTitle(titleId);
    		
    		if (title == null)
    			return "";
    		
    		String color = title.getColor() == null ? "" : "<col="+title.getColor()+">";
    		String shade = title.getShade() == null ? "" : "<shad="+title.getShade()+">";
    		String pref1 = title.getColor() == null ? "" : "</col>";
    		String pref2 = title.getShade() == null ? "" : "</shad>";
    		String t = color + shade + title.getTitle() + pref1 + pref2;
    		return t;
    	}
        
    }
    Reason behind the default titles is because they're there incase you want to change them and so that they go before/after name properly.

    Now, you'll need some modifications to appearence.java:

    Code:
    stream.writeGJString(TitleHandler.getFullTitle(male, title));
    Code:
    if (title != 0)
        flag |= TitleHandler.goesAfterName(title) ? 0x80 : 0x40; // after/before
    To add more titles, its simple, see the last one:

    Code:
    WHO(58, "? Who?", "AA44AA", null, true);
    we can easily remove the ; at the end, replace it with a comma, and add a new one like so:

    Code:
    WHO(58, "? Who?", "AA44AA", null, true),
    
    SOME_NAME(58, "the Obvious", "AA6600", null, true); // this is the new title

    SOME_NAME(58, "the Obvious", "AA6600", null, true);
    TITLE(id, title_string, color, shading, true/false);

    color coordination or naw? lel

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Donator


    Join Date
    Jan 2014
    Posts
    1,650
    Thanks given
    426
    Thanks received
    497
    Rep Power
    221
    Okay, i've seen enough title shit for the rest of my life.

    ot; Nice job haha
    Reply With Quote  
     

  4. #3  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    30
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,055
    Discord
    View profile
    Rep Power
    709
    Quote Originally Posted by Joris View Post
    Okay, i've seen enough title shit for the rest of my life.

    ot; Nice job haha
    u started it

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #4  
    Banned

    Join Date
    Jul 2011
    Posts
    1,772
    Thanks given
    495
    Thanks received
    426
    Rep Power
    0
    that's pretty nice good job =D
    Reply With Quote  
     

  6. #5  
    Developer


    Join Date
    Aug 2012
    Age
    22
    Posts
    2,491
    Thanks given
    179
    Thanks received
    1,703
    Rep Power
    2470
    Code:
     JUNIOR_CADET(1, "Junior Cadet ", "AA44AA", null, false),
            SERJEANT(2, "Serjeant ", "AA44AA", null, false),
            COMMANDER(3, "Commander ", "AA44AA", null, false),
            WAR_CHIEF(4, "War-chief ", "AA44AA", null, false),
            SIR(5, "Sir ", "C86400", null, false),
            LORD(6, "Lord ", "C86400", null, false),
            DUDERINO(7, "Duderino ", "C86400", null, false),
            LIONHEART(8, "Lionheart ", "C86400", null, false),
            HELLRAISER(9, "Hellraiser ", "C86400", null, false),
            CRUSADER(10, "Crusader ", "C86400", null, false),
            DESPERADO(11, "Desperado ", "C86400", null, false),
            BARON(12, "Baron ", "C86400", null, false),
            COUNT(13, "Count ", "C86400", null, false),
            OVERLORD(14, "Overlord ", "C86400", null, false),
            BANDITO(15, "Bandito ", "C86400", null, false),
            DUKE(16, "Duke ", "C86400", null, false),
            KING(17, "King ", "C86400", null, false),
            BIG_CHEESE_(18, "Big Cheese ", "C86400", null, false),
            BIGWIG_(19, "Bigwig ", "C86400", null, false),
            WUNDERKIND(20, "Wunderkind ", "C86400", null, false),
            VYRELING(21, "Vyreling ", "466AFA", null, false),
            VYRE_GRUNT(22, "Vyre Grunt ", "7D3FEC", null, false),
            VYREWATCH(23, "Vyrewatch ", "6C0B2B", null, false),
            VYRELORD(24, "Vyrelord ", "C12006", null, false),
            YT_HAAR(25, "Yt?Haar ", "C12006", null, false),
    Are you aware that you can load these from the cache
    Reply With Quote  
     

  7. #6  
    KNOWLEDGE IS POWER

    OG KingFox's Avatar
    Join Date
    Dec 2006
    Age
    30
    Posts
    1,683
    Thanks given
    628
    Thanks received
    1,055
    Discord
    View profile
    Rep Power
    709
    Quote Originally Posted by Savions sw View Post
    Code:
     JUNIOR_CADET(1, "Junior Cadet ", "AA44AA", null, false),
            SERJEANT(2, "Serjeant ", "AA44AA", null, false),
            COMMANDER(3, "Commander ", "AA44AA", null, false),
            WAR_CHIEF(4, "War-chief ", "AA44AA", null, false),
            SIR(5, "Sir ", "C86400", null, false),
            LORD(6, "Lord ", "C86400", null, false),
            DUDERINO(7, "Duderino ", "C86400", null, false),
            LIONHEART(8, "Lionheart ", "C86400", null, false),
            HELLRAISER(9, "Hellraiser ", "C86400", null, false),
            CRUSADER(10, "Crusader ", "C86400", null, false),
            DESPERADO(11, "Desperado ", "C86400", null, false),
            BARON(12, "Baron ", "C86400", null, false),
            COUNT(13, "Count ", "C86400", null, false),
            OVERLORD(14, "Overlord ", "C86400", null, false),
            BANDITO(15, "Bandito ", "C86400", null, false),
            DUKE(16, "Duke ", "C86400", null, false),
            KING(17, "King ", "C86400", null, false),
            BIG_CHEESE_(18, "Big Cheese ", "C86400", null, false),
            BIGWIG_(19, "Bigwig ", "C86400", null, false),
            WUNDERKIND(20, "Wunderkind ", "C86400", null, false),
            VYRELING(21, "Vyreling ", "466AFA", null, false),
            VYRE_GRUNT(22, "Vyre Grunt ", "7D3FEC", null, false),
            VYREWATCH(23, "Vyrewatch ", "6C0B2B", null, false),
            VYRELORD(24, "Vyrelord ", "C12006", null, false),
            YT_HAAR(25, "Yt?Haar ", "C12006", null, false),
    Are you aware that you can load these from the cache
    yea how u think i got the list? >..>

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  8. #7  
    WVWVWVWVWVWVWVW

    _jordan's Avatar
    Join Date
    Nov 2012
    Age
    23
    Posts
    2,865
    Thanks given
    62
    Thanks received
    1,528
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by King Fox View Post
    yea how u think i got the list? >..>
    Why would you make a list if you can just use the ones inside the clientscripts?

    Spoiler for signature:
    When your vision is crystal clear, they say it's razor-sharp
    A focused mind is said to be like a knife, but the scalpel is wisdom
    All one can do is accept that life is a double-edged sword
    Stay on the edge

    -



    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Registered Member

    Join Date
    Dec 2012
    Posts
    3,006
    Thanks given
    899
    Thanks received
    929
    Rep Power
    2548
    Quote Originally Posted by _Jordan View Post
    Why would you make a list if you can just use the ones inside the clientscripts?
    If you're in a situation where you constantly edit titles or have personalized-titles per player, it becomes easier to define titles server-sided, since constantly editing the cache would be unfeasible (But it would come down to personal preference)
    Reply With Quote  
     

  11. #9  
    Registered Member
    Join Date
    Aug 2015
    Posts
    2
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by King Fox View Post
    Did this in response to a snippet that was posted by Rediculous, everyone complaining about using enums, so here ya go, ENUMS. Wrote this ages ago, been in most of the rune-evo releases forever >.>

    Code:
    package com.foxtrot.game.player.content.custom;
    
    import com.foxtrot.cache.loaders.ClientScriptMap;
    
    public class TitleHandler {
    
        public enum Titles {
            
            JUNIOR_CADET(1, "Junior Cadet ", "AA44AA", null, false),
            SERJEANT(2, "Serjeant ", "AA44AA", null, false),
            COMMANDER(3, "Commander ", "AA44AA", null, false),
            WAR_CHIEF(4, "War-chief ", "AA44AA", null, false),
            SIR(5, "Sir ", "C86400", null, false),
            LORD(6, "Lord ", "C86400", null, false),
            DUDERINO(7, "Duderino ", "C86400", null, false),
            LIONHEART(8, "Lionheart ", "C86400", null, false),
            HELLRAISER(9, "Hellraiser ", "C86400", null, false),
            CRUSADER(10, "Crusader ", "C86400", null, false),
            DESPERADO(11, "Desperado ", "C86400", null, false),
            BARON(12, "Baron ", "C86400", null, false),
            COUNT(13, "Count ", "C86400", null, false),
            OVERLORD(14, "Overlord ", "C86400", null, false),
            BANDITO(15, "Bandito ", "C86400", null, false),
            DUKE(16, "Duke ", "C86400", null, false),
            KING(17, "King ", "C86400", null, false),
            BIG_CHEESE_(18, "Big Cheese ", "C86400", null, false),
            BIGWIG_(19, "Bigwig ", "C86400", null, false),
            WUNDERKIND(20, "Wunderkind ", "C86400", null, false),
            VYRELING(21, "Vyreling ", "466AFA", null, false),
            VYRE_GRUNT(22, "Vyre Grunt ", "7D3FEC", null, false),
            VYREWATCH(23, "Vyrewatch ", "6C0B2B", null, false),
            VYRELORD(24, "Vyrelord ", "C12006", null, false),
            YT_HAAR(25, "Yt?Haar ", "C12006", null, false),
            EMPEROR(26, "Emperor ", "C86400", null, false),
            PRINCE(27, "Prince ", "C86400", null, false),
            WITCH_KING(28, "Witch king ", "C86400", null, false),
            ARCHON(29, "Archon ", "C86400", null, false),
            JUSTICIAR(30, "Justiciar ", "C86400", null, false),
            THE_AWESOME(31, "The Awesome ", "C86400", null, false),
            THE_MAGNIFICENT(32, " the magnificent", "C86400", null, true),
            THE_UNDEFEATED(33, " the undefeated", "C86400", null, true),
            THE_STRANGE(34, " the strange", "C86400", null, true),
            THE_DIVINE(35, " the divine", "C86400", null, true),
            THE_FALLEN(36, " the fallen", "C86400", null, true),
            THE_WARRIOR(37, " the warrior", "C86400", null, true),
            THE_REAL_(38, "The Real ", "C86400", null, false),
            COWARDLY_(39, "Cowardly ", "AA44AA", null, false),
            THE_REDUNDANT(40, " the Redundant", "AA44AA", null, true),
            EVERYONE_ATTACK(41, "Everyone attack ", "AA44AA", null, false),
            SMELLY(42, "Smelly ", "AA44AA", null, false),
            THE_IDIOT(43, " the Idiot", "AA44AA", null, true),
            SIR_LAME(44, "Sir Lame ", "AA44AA", null, false),
            THE_FLAMBOYANT(45, " the Flamboyant", "AA44AA", null, true),
            WEAKLING(46, "Weakling ", "AA44AA", null, false),
            WAS_PUNISHED(47, " was punished", "AA44AA", null, true),
            LOST(48, " lost", "AA44AA", null, true),
            YOU_FAIL(49, " ...you fail", "AA44AA", null, true),
            NO_MATES_(50, "No-mates ", "AA44AA", null, false),
            ATE_DIRT(51, " ate dirt", "AA44AA", null, true),
            DELUSIONAL_(52, "Delusional ", "AA44AA", null, false),
            THE_RESPAWNER(53, " the Respawner", "AA44AA", null, true),
            CUTIE_PIE_(54, "Cutie-pie ", "AA44AA", null, false),
            THE_FAIL_MAGNET(55, " the Fail Magnet", "AA44AA", null, true),
            WAS_TERMINATED(56, " was terminated", "AA44AA", null, true),
            LAZY(57, "Lazy ", "AA44AA", null, false),
            WHO(58, "? Who?", "AA44AA", null, true);
            
            private int id;
            private String title, color, shade;
            private boolean after;
            
            Titles(int id, String title, String color, String shade, boolean after) {
                this.id = id;
                this.title = title;
                this.color = color;
                this.shade = shade;
                this.after = after;
            }
            
            public int getId() {
                return id;
            }
            
            public String getTitle() {
                return title;
            }
            
            public String getColor() {
                return color;
            }
            
            public String getShade() {
                return shade;
            }
            
            public boolean goesAfter() {
                return after;
            }
            
        }
        
        public static Titles getTitle(int id) {
            for (Titles t : Titles.values()) {
                if (t.getId() == id) {
                    return t;
                }
            }
            return null;
        }
        
        public static boolean goesAfterName(int titleId) {
            Titles title = getTitle(titleId);
            
            if (title == null)
                return false;
            
            return title.goesAfter();
        }
        
         public static String getFullTitle(boolean male, int titleId) {		if (titleId < 60) {
    			return ClientScriptMap.getMap(male ? 1093 : 3872).getStringValue(titleId);
    		}
    		
    		Titles title = getTitle(titleId);
    		
    		if (title == null)
    			return "";
    		
    		String color = title.getColor() == null ? "" : "<col="+title.getColor()+">";
    		String shade = title.getShade() == null ? "" : "<shad="+title.getShade()+">";
    		String pref1 = title.getColor() == null ? "" : "</col>";
    		String pref2 = title.getShade() == null ? "" : "</shad>";
    		String t = color + shade + title.getTitle() + pref1 + pref2;
    		return t;
    	}
        
    }
    Reason behind the default titles is because they're there incase you want to change them and so that they go before/after name properly.

    Now, you'll need some modifications to appearence.java:

    Code:
    stream.writeGJString(TitleHandler.getFullTitle(male, title));
    Code:
    if (title != 0)
        flag |= TitleHandler.goesAfterName(title) ? 0x80 : 0x40; // after/before
    To add more titles, its simple, see the last one:

    Code:
    WHO(58, "? Who?", "AA44AA", null, true);
    we can easily remove the ; at the end, replace it with a comma, and add a new one like so:

    Code:
    WHO(58, "? Who?", "AA44AA", null, true),
    
    SOME_NAME(58, "the Obvious", "AA6600", null, true); // this is the new title

    SOME_NAME(58, "the Obvious", "AA6600", null, true);
    TITLE(id, title_string, color, shading, true/false);

    color coordination or naw? lel
    How would you add a command for like [Only registered and activated users can see links. ]
    in this? please i want this and that :/

    bump
    Reply With Quote  
     

  12. #10  
    Registered Member Archeon's Avatar
    Join Date
    Jun 2015
    Posts
    345
    Thanks given
    17
    Thanks received
    5
    Rep Power
    2
    When I make a title it says you have chosen this title, but it doesn't show up
    Reply With Quote  
     


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] Title Command
    By Formality in forum Help
    Replies: 0
    Last Post: 12-16-2013, 10:14 PM
  2. 718 Custom Titles & Colors
    By Taylor Moon in forum Snippets
    Replies: 24
    Last Post: 10-02-2013, 12:31 PM
  3. [718] Titles
    By -Robbie in forum Help
    Replies: 7
    Last Post: 09-14-2013, 05:08 PM
  4. [718+] Titles
    By -Robbie in forum RS 503+ Client & Server
    Replies: 1
    Last Post: 07-12-2013, 11:05 PM
  5. [req]custom loyalty titles 718
    By Cocaine in forum Requests
    Replies: 14
    Last Post: 08-09-2012, 09:17 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
  •