Jump to content
Corncob

Title System

Recommended Posts

 

Preview:
0qI0b7m.gif

Download:

Please login or register to see this link.


or Create a new File and paste:

Please login or register to see this link.

Place this file in your cache directory.

CLIENTCreate a new file named PlayerTitles

Please login or register to see this code.


 

In your client class replace pushMessage(String, int, String) with

Please login or register to see this code.


    
  

Please login or register to see this code.

 

Add the class instance

Please login or register to see this code.

Declare our new string (follow chatNames and place under)

Please login or register to see this code.

Please login or register to see this code.

Scroll down and replace similar


   

Please login or register to see this code.

Please login or register to see this code.

Search

Please login or register to see this code.

 

Search buildAtPlayerMenu


 

Please login or register to see this code.

In your Player class,
 

Please login or register to see this code.

 


CLIENT]


In your Interface class, add:
 

Please login or register to see this code.


This uses the 'minigame' tab in the quest tab for the titles. I would recommend changing the tooltip and getting the button id for later.

Search "(action == 315)" and add this above

        

Please login or register to see this code.

In "buildInterfaceMenu" add (firstMenuAction = menuActionCmd2 : secondMenuAction = menuActionCmd3)
       

Please login or register to see this code.

Search "updateStrings(String, int)"
Add this above the switch:
 

Please login or register to see this code.

 

 

 

SERVER:

Change the packet size for the new packet we created to 6.
For example, If I used opcode 220, go to //220 and change the first index in the line to 6.

 

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

In Player add
 

Please login or register to see this code.

In your login method, add

Please login or register to see this code.

In PlayerSave add
 

Please login or register to see this code.


         

Please login or register to see this code.


           

Please login or register to see this code.

 


In your packet handler class, add:


 

Please login or register to see this code.

Create a new packet class (Add your imports and package yourself)
 

Please login or register to see this code.

 

Create a new class (Add your imports and package yourself)
 

Please login or register to see this code.


 

Share this post


Link to post
Share on other sites

This is poorly made.

  1. You chose to store titles in the cache which isn't 100% bad, only problem is that you're not actually properly storing it in the cache; just the directory.
  2. If you don't want to store it in the cache, then write a Server->Client packet and let your server handle all the titles and formatting of names (which should be how you do this due to how dynamic a title system is).

It all needs to be re-written tbh. All of that can be condensed into 1/3rd or even 1/4th of the size you have it as.

Share this post


Link to post
Share on other sites
On 10/5/2016 at 6:23 PM, Hope said:

This is poorly made.

  1. You chose to store titles in the cache which isn't 100% bad, only problem is that you're not actually properly storing it in the cache; just the directory.
  2. If you don't want to store it in the cache, then write a Server->Client packet and let your server handle all the titles and formatting of names (which should be how you do this due to how dynamic a title system is).

It all needs to be re-written tbh. All of that can be condensed into 1/3rd or even 1/4th of the size you have it as.

You don't even need a packet for it either. You should write this how RS writes their titles. They edit the appearance block for revisions over.. uhmmm 600? (if I'm not mistaken) so much unnecessary code.. man.

Share this post


Link to post
Share on other sites
32 minutes ago, Teek said:

You don't even need a packet for it either. You should write this how RS writes their titles. They edit the appearance block for revisions over.. uhmmm 600? (if I'm not mistaken) so much unnecessary code.. man.

Yeah, but that would require:

  • Knowledge on client based interface interaction.
  • Knowledge on how to read the cache via the client.
  • And knowledge of how to edit said appearance block.

Which is way beyond the knowledge of most people hosting servers today. Even a packet can be considered difficult for the majority unfortunately.

 

BUT even if RS edits the appearance block; they still need a packet or joint packet to verify the title with the server (so it can update and render on others' clients).

Edited by Hope

Share this post


Link to post
Share on other sites
9 hours ago, Hope said:

Yeah, but that would require:

  • Knowledge on client based interface interaction.
  • Knowledge on how to read the cache via the client.
  • And knowledge of how to edit said appearance block.

Which is way beyond the knowledge of most people hosting servers today. Even a packet can be considered difficult for the majority unfortunately.

 

BUT even if RS edits the appearance block; they still need a packet or joint packet to verify the title with the server (so it can update and render on others' clients).

That's correct however, you wouldn't need a packet if you have client knowledge. (it updates the same way it updates players name psure it's local player updating which renders that stuff)

Share this post


Link to post
Share on other sites
23 minutes ago, Teek said:

That's correct however, you wouldn't need a packet if you have client knowledge. (it updates the same way it updates players name psure it's local player updating which renders that stuff)

You will need at least 1 packet (or include it in the player appearance packet). The title has to show up on other players' clients somehow.

Clients don't just connect to each other (unless it's peer-to-peer, which it's not).

Edited by Hope

Share this post


Link to post
Share on other sites

A whole new packet isn't needed to get titles to work on for other players. You can just add another byte value to a player's appearance update packet, which should represent a player's title. However, I'm not sure what the best way is to handle both prefix and suffix. 

Edit: My bad, I didn't realize this thread was so old, but I still believe it's worth reviving, as I have a few bits of code I'll be sharing that could improve this quite a bit.

Edited by Mayhem'
Incidental Gravedig

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×