Code:
private void drawChatArea() {
int offsetY = (screenMode == 0 ? 0 : frameHeight - 165);
int chat_shadow = (screenMode == 0 ? -1 : 0);
if(screenMode == 0)
chatAreaProducer.initDrawingArea();
Rasterizer.lineOffsets = chatImage;
if(screenMode == 0 || (screenMode > 0 && needsPrompt())) {
chatBackground[0].drawSpriteWithOpacity((screenMode == 0 ? 7 : 0), (screenMode == 0 ? 7 : offsetY), (screenMode == 0 ? 256 : chatbox_transparency));
drawChatFrame();
} else {
DrawingArea.drawAlphaGradient2(7, 7 + offsetY, 506, 130, 0, 0, 70);
}
if (needsPrompt()) {
drawChatInterfaces();
} else {
int messageCount = 0;
DrawingArea.setDrawingArea(119 + offsetY, 8, 497, 8 + offsetY);
for (int index = 0; index < 500; index++)
if (chatMessages[index] != null) {
int chatType = chatTypes[index];
int privilege = chatPrivileges[index];
int yPos = (70 - messageCount * 14) + chatScroll + 45;
String name = chatNames[index];
/**
* Filtering
*/
if (channelState[1] != 0 && privilege != 3 && privilege != 4) {
if (channelState[1] == 1 && chatType != 0 || channelState[1] == 1 && chatMessages[index].startsWith("[")
|| channelState[1] == 2 && chatType != 2
|| channelState[1] == 3 && chatType != 5 && chatType != 6
|| channelState[1] == 4 && !chatMessages[index].startsWith("[")) {
continue;
}
}
/*if(Configuration.profanity_filter && chatMessages[index].startsWith("[")) {
chatMessages[index] = Censor.doCensor(chatMessages[index]);
}*/
if (chatType == 0) {
if (yPos > 0 && yPos < 210)
newRegularFont.drawString(chatMessages[index], 11,
yPos + offsetY, getHexColor(0), chat_shadow);
messageCount++;
}
if ((chatType == 1 || chatType == 2)
&& (chatType == 1 || publicChatMode == 0 || publicChatMode == 1
&& isFriendOrSelf(name))) {
if (yPos > 0 && yPos < 210) {
int xPos = 11;
if (privilege > 0 && getRankIcon(privilege) != -1) {
chatIcon[getRankIcon(privilege)]
.drawSprite(xPos, yPos - chatIcon[getRankIcon(privilege)].myHeight + offsetY);
xPos += chatIcon[getRankIcon(privilege)].myWidth;
}
newRegularFont.drawString(name + ":", xPos, yPos + offsetY,
getHexColor(0), chat_shadow);
xPos += newRegularFont.getTextWidth(name) + 7;
newRegularFont.drawString(chatMessages[index],
xPos, yPos + offsetY, getHexColor(1), chat_shadow);
}
messageCount++;
}
if ((chatType == 3 || chatType == 7)
&& splitPrivateChat == 0
&& (chatType == 7 || privateChatMode == 0 || privateChatMode == 1
&& isFriendOrSelf(name))) {
if (yPos > 0 && yPos < 210) {
int xPos = 11;
newRegularFont
.drawString("From", xPos, yPos + offsetY, getHexColor(0), chat_shadow);
xPos += newRegularFont.getTextWidth("From ");
if (privilege > 0 && getRankIcon(privilege) != -1) {
chatIcon[getRankIcon(privilege)]
.drawSprite(xPos, yPos - chatIcon[getRankIcon(privilege)].myHeight + offsetY);
xPos += chatIcon[getRankIcon(privilege)].myWidth;
}
newRegularFont.drawString(name + ":", xPos, yPos + offsetY,
getHexColor(0), chat_shadow);
xPos += newRegularFont.getTextWidth(name) + 7;
newRegularFont.drawString(chatMessages[index],
xPos, yPos + offsetY, getHexColor(2), chat_shadow);
}
messageCount++;
}
if (chatType == 4
&& (tradeMode == 0 || tradeMode == 1
&& isFriendOrSelf(name))) {
if (yPos > 0 && yPos < 210)
newRegularFont.drawString(name + " "
+ chatMessages[index], 11, yPos + offsetY, getHexColor(3),
chat_shadow);
messageCount++;
}
if (chatType == 5 && splitPrivateChat == 0
&& privateChatMode < 2) {
if (yPos > 0 && yPos < 210)
newRegularFont.drawString(chatMessages[index], 11,
yPos + offsetY, getHexColor(1), chat_shadow);
messageCount++;
}
if (chatType == 6 && splitPrivateChat == 0
&& privateChatMode < 2) {
if (yPos > 0 && yPos < 210) {
newRegularFont.drawString("To " + name + ":", 11,
yPos + offsetY, getHexColor(0), chat_shadow);
newRegularFont.drawString(
chatMessages[index],
20 + newRegularFont.getTextWidth("To "
+ name), yPos + offsetY, getHexColor(2), chat_shadow);
}
messageCount++;
}
if (chatType == 8
&& (tradeMode == 0 || tradeMode == 1
&& isFriendOrSelf(name))) {
if (yPos > 0 && yPos < 210)
newRegularFont.drawString(name + " "
+ chatMessages[index], 11, yPos + offsetY, getHexColor(4),
chat_shadow);
messageCount++;
}
}
DrawingArea.defaultDrawingAreaSize();
if(screenMode == 0) {
DrawingArea.drawLine(121, 0x807660, 492, 7);
} else {
DrawingArea.drawLine(121 + offsetY, 0x6d6a57, 505, 7);
DrawingArea474.drawAlphaHorizontalLine2(7, 6 + offsetY, 405, 0x6d6a57, 256);
}
String playerName = myPlayer != null && myPlayer.name != null ? myPlayer.name
: TextClass.fixName(usernameInput);
int xPosOffset = playerRights > 0 ? 14 : 0;
DrawingArea.setDrawingArea(140 + offsetY, 8, 509, 120 + offsetY);
if (playerRights > 0 && getRankIcon(playerRights) != -1)
chatIcon[getRankIcon(playerRights)].drawSprite(12, 122 + offsetY);
newRegularFont.drawString(playerName, 11 + xPosOffset, 133 + offsetY, getHexColor(0), chat_shadow);
newRegularFont.drawString(":",
newRegularFont.getTextWidth(playerName) + 24 + xPosOffset,
133 + offsetY, getHexColor(0), chat_shadow);
newRegularFont.drawString(inputString, 29 + xPosOffset
+ newRegularFont.getTextWidth(playerName), 133 + offsetY, getHexColor(1), chat_shadow);
newRegularFont.drawString(loopCycle % 40 < 20 ? "|" : "",
29 + xPosOffset + newRegularFont.getTextWidth(playerName)
+ newRegularFont.getTextWidth(inputString), 134 + offsetY,
(newRegularFont.getTextWidth(inputString) > 345 ? 0xFF0000
: getHexColor(1)), chat_shadow);
chatFrame[11].drawSprite(newRegularFont.getTextWidth(playerName)
+ 11 + xPosOffset, 123 + offsetY);
DrawingArea.defaultDrawingAreaSize();
if(hoverPos[0] == 1)
emoticon[0].drawSpriteWithOpacity(497, 121 + offsetY, 128);
else
emoticon[0].drawSprite(497, 121 + offsetY);
if(displayEmoticonBox) {
drawEmoticonBox();
}
chatScrollPos = messageCount * 14 + 7 + 5;
if (chatScrollPos < 111)
chatScrollPos = 111;
if(screenMode == 0)
drawScrollBar(114, chatScrollPos - chatScroll - 113, 7 + offsetY, 497, chatScrollPos);
else
drawTransparentScrollBar(114, chatScrollPos - chatScroll - 113, 7 + offsetY, 497, chatScrollPos);
}
if(screenMode == 0) {
chatAreaProducer.drawGraphics(338, super.graphics, 0);
gameScreenProducer.initDrawingArea();
}
Rasterizer.lineOffsets = gameScreen;
}