|  |  |  | @ -5,61 +5,44 @@@@ -5,61 +5,44 @@ | 
			
		
	
		
			
				
					|  |  |  |  | // ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
 | 
			
		
	
		
			
				
					|  |  |  |  | //      Magicbane Emulator Project © 2013 - 2022
 | 
			
		
	
		
			
				
					|  |  |  |  | //                www.magicbane.com
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | package engine.objects; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import engine.net.ByteBufferWriter; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import java.nio.ByteBuffer; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | public enum CharacterTitle { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     NONE(0, 0, 0, ""), | 
			
		
	
		
			
				
					|  |  |  |  |     CSR_1(255, 0, 0, "CCR"), | 
			
		
	
		
			
				
					|  |  |  |  |     CSR_2(255, 0, 0, "CCR"), | 
			
		
	
		
			
				
					|  |  |  |  |     CSR_3(255, 0, 0, "CCR"), | 
			
		
	
		
			
				
					|  |  |  |  |     CSR_4(251, 181, 13, "CCR"), | 
			
		
	
		
			
				
					|  |  |  |  |     DEVELOPER(166, 153, 114, "Programmer"), | 
			
		
	
		
			
				
					|  |  |  |  |     PVE(0, 255, 0, "PvE"), | 
			
		
	
		
			
				
					|  |  |  |  |     QA(88, 250, 244, "GIRLFRIEND"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     QA(88, 250, 244, "GIRLFRIEND"), | 
			
		
	
		
			
				
					|  |  |  |  |     PVE(0, 250, 0, ""); | 
			
		
	
		
			
				
					|  |  |  |  |     int headerLength, footerLength; | 
			
		
	
		
			
				
					|  |  |  |  |     private ByteBuffer header; | 
			
		
	
		
			
				
					|  |  |  |  |     private ByteBuffer footer; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     CharacterTitle(int _r, int _g, int _b, String _prefix) { | 
			
		
	
		
			
				
					|  |  |  |  |         char[] str_header = ("^\\c" + | 
			
		
	
		
			
				
					|  |  |  |  |                 (((_r < 100) ? ((_r < 10) ? "00" : "0") : "") + ((byte) _r & 0xFF)) + | 
			
		
	
		
			
				
					|  |  |  |  |                 (((_g < 100) ? ((_g < 10) ? "00" : "0") : "") + ((byte) _g & 0xFF)) + | 
			
		
	
		
			
				
					|  |  |  |  |                 (((_b < 100) ? ((_b < 10) ? "00" : "0") : "") + ((byte) _b & 0xFF)) + | 
			
		
	
		
			
				
					|  |  |  |  |                 '<' + _prefix + "> ").toCharArray(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         char[] str_footer = ("^\\c255255255").toCharArray(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         this.headerLength = str_header.length; | 
			
		
	
		
			
				
					|  |  |  |  |         this.footerLength = str_footer.length; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         this.header = ByteBuffer.allocateDirect(headerLength << 1); | 
			
		
	
		
			
				
					|  |  |  |  |         this.footer = ByteBuffer.allocateDirect(footerLength << 1); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         ByteBufferWriter headWriter = new ByteBufferWriter(header); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         for (char c : str_header) { | 
			
		
	
		
			
				
					|  |  |  |  |             headWriter.putChar(c); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         ByteBufferWriter footWriter = new ByteBufferWriter(footer); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         for (char c : str_footer) { | 
			
		
	
		
			
				
					|  |  |  |  |             footWriter.putChar(c); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void _serializeFirstName(ByteBufferWriter writer, String firstName) { | 
			
		
	
		
			
				
					|  |  |  |  |         _serializeFirstName(writer, firstName, false); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void _serializeFirstName(ByteBufferWriter writer, String firstName, boolean smallString) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (this.ordinal() == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (smallString) | 
			
		
	
	
		
			
				
					|  |  |  | @ -68,24 +51,19 @@ public enum CharacterTitle {@@ -68,24 +51,19 @@ public enum CharacterTitle { | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putString(firstName); | 
			
		
	
		
			
				
					|  |  |  |  |             return; | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         char[] chars = firstName.toCharArray(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (smallString) | 
			
		
	
		
			
				
					|  |  |  |  |             writer.put((byte) (chars.length + this.footerLength)); | 
			
		
	
		
			
				
					|  |  |  |  |             writer.put((byte) (chars.length + this.headerLength)); | 
			
		
	
		
			
				
					|  |  |  |  |         else | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putInt(chars.length + this.footerLength); | 
			
		
	
		
			
				
					|  |  |  |  |         writer.putBB(footer); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putInt(chars.length + this.headerLength); | 
			
		
	
		
			
				
					|  |  |  |  |         writer.putBB(header); | 
			
		
	
		
			
				
					|  |  |  |  |         for (char c : chars) { | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putChar(c); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void _serializeLastName(ByteBufferWriter writer, String lastName, boolean haln, boolean asciiLastName) { | 
			
		
	
		
			
				
					|  |  |  |  |         _serializeLastName(writer, lastName, haln, asciiLastName, false); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void _serializeLastName(ByteBufferWriter writer, String lastName, boolean haln, boolean asciiLastName, boolean smallString) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (!haln || asciiLastName) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (this.ordinal() == 0) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -96,27 +74,22 @@ public enum CharacterTitle {@@ -96,27 +74,22 @@ public enum CharacterTitle { | 
			
		
	
		
			
				
					|  |  |  |  |                 return; | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (!haln || asciiLastName) { | 
			
		
	
		
			
				
					|  |  |  |  |             char[] chars = lastName.toCharArray(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             if (smallString) | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.put((byte) (chars.length + this.headerLength)); | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.put((byte) (chars.length + this.footerLength)); | 
			
		
	
		
			
				
					|  |  |  |  |             else | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putInt(chars.length + this.headerLength); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putInt(chars.length + this.footerLength); | 
			
		
	
		
			
				
					|  |  |  |  |             for (char c : chars) { | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putChar(c); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putBB(header); | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putBB(footer); | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             if (smallString) | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.put((byte) this.headerLength); | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.put((byte) this.footerLength); | 
			
		
	
		
			
				
					|  |  |  |  |             else | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putInt(this.headerLength); | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putBB(header); | 
			
		
	
		
			
				
					|  |  |  |  |                 writer.putInt(this.footerLength); | 
			
		
	
		
			
				
					|  |  |  |  |             writer.putBB(footer); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | } |