Skip to content

Commit

Permalink
Fixes announcements, and the green if someone mentions your nime
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbere committed Mar 29, 2010
1 parent 6207207 commit fc8e7cf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Client/src/org/pokenet/client/ui/frames/ChatWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ public void scroll(int indexMod){
// Make system messages red
if (m_wrappedText.get(m_scrollIndex + i).charAt(0) == '*'){
m_shownChat.get(i).setForeground(Color.red);
// m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).replaceFirst("*",""));
m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).substring(1));
}
// Make announcements yellow
if (m_wrappedText.get(m_scrollIndex + i).charAt(0) == '%'){
m_shownChat.get(i).setForeground(Color.yellow);
// m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).replaceFirst("%",""));
m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).substring(1));
}
// Highlight chat when named.
if (m_wrappedText.get(m_scrollIndex + i).charAt(0) == '!'){
m_shownChat.get(i).setForeground(Color.green);
// m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).replaceFirst("!",""));
m_wrappedText.set(m_scrollIndex + i, m_wrappedText.get(m_scrollIndex + i).substring(1));
}
m_shownChat.get(i).setText(m_wrappedText.get(m_scrollIndex + i));
} catch (Exception e) {}
Expand Down Expand Up @@ -202,7 +202,13 @@ public void wrap(){
char messageType = '\u0000';
if (loopLine.charAt(0) == '*')
messageType = '*';
else if (loopLine.charAt(0) == '!')
else if (loopLine.charAt(0) == '%')
messageType = '%';
else if (loopLine.charAt(0) == '!' || (!loopLine.contains(
'<' + GameClient.getInstance().getOurPlayer()
.getUsername() + '>') && loopLine
.contains(GameClient.getInstance().getOurPlayer()
.getUsername())))
messageType = '!';
while (GameClient.getFontSmall().getWidth(loopLine) > getWidth()){
int linesToDrop = 1;
Expand All @@ -220,7 +226,7 @@ else if (loopLine.charAt(0) == '!')
loopList.size() - 1).length());
loopList.add(loopLine);
}
m_wrappedText.add(loopLine);
m_wrappedText.add(messageType + loopLine);
}
} catch (IndexOutOfBoundsException e) {}
catch (Exception e) {e.printStackTrace();}
Expand Down

0 comments on commit fc8e7cf

Please sign in to comment.