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