 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.settings;
28 import java.util.HashMap;
30 import java.util.regex.Matcher;
31 import java.util.regex.Pattern;
32 import org.jetbrains.annotations.NotNull;
44 private static final String
REPLY_TO =
"reply_to";
50 private final Pattern
macroPattern = Pattern.compile(
"<<([a-z_]+)>>");
56 private final Map<String, String>
expansions =
new HashMap<>();
62 @SuppressWarnings(
"FieldCanBeLocal")
66 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
86 final int index = message.indexOf(
" tells you:");
88 final String name = message.substring(0, index);
105 public void setDebugMode(
final boolean printMessageTypes) {
128 StringBuilder result =
null;
130 final Matcher macroMatcher =
macroPattern.matcher(
string);
131 while (macroMatcher.find()) {
132 if (result ==
null) {
133 result =
new StringBuilder();
136 final String name = macroMatcher.group(1);
138 if (expansion ==
null) {
139 expansion = macroMatcher.group();
141 result.append(
string, index, macroMatcher.start());
142 result.append(expansion);
143 index = macroMatcher.end();
145 if (result !=
null) {
146 result.append(
string.substring(index));
148 return result ==
null ? string : result.toString();
static final int MSG_TYPE_MONUMENT
drawextinfo message type: character did read a monument.
static final String REPLY_TO
The "reply_to" macro name.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
static final int MSG_TYPE_SKILL
drawextinfo message type: message related to using skills.
Macros(@NotNull final CrossfireServerConnection crossfireServerConnection)
Creates a new instance.
final Pattern macroPattern
The Pattern matching macro names.
static final int MSG_TYPE_MOTD
drawextinfo message type: motd text.
static final int MSG_TYPE_BOOK
drawextinfo message type: character did read a book.
Encapsulates the message type numbers for drawextinfo messages.
static final int MSG_TYPE_SIGN
drawextinfo message type: character did read a sign.
static final int MSG_TYPE_CARD
drawextinfo message type: character did read a card.
static final int MSG_TYPE_APPLY
drawextinfo message type: an object was applied.
static final int MSG_TYPE_COMMAND
drawextinfo message type: response to command processing.
static final int MSG_TYPE_MISC
drawextinfo message type: message that does not fit in any other category.
Manages macro expansion in command strings.
static final int MSG_TYPE_ADMIN
drawextinfo message type: general server message.
static final int MSG_TYPE_CLIENT
drawextinfo message type: client originated messages.
static final int MSG_TYPE_ATTRIBUTE
drawextinfo message type: attribute (stats, resistances, etc.) change message.
static final int MSG_TYPE_DIALOG
drawextinfo message type: a NPC/magic mouth/altar/etc.
static final int MSG_TYPE_PAPER
drawextinfo message type: character did read a paper.
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
The CrossfireDrawextinfoListener for tracking tells.
Interface for listeners interested in drawextinfo messages received from the Crossfire server.
static final int MSG_TYPE_ATTACK
drawextinfo message type: attack related message.
static final int MSG_SUBTYPE_COMMUNICATION_TELL
String expandMacros(@NotNull final String string)
Expands all macro references.
static final int MSG_TYPE_ITEM
drawextinfo message type: item related information.
static final int MSG_TYPE_SHOP
drawextinfo message type: shop related message.
static final int MSG_TYPE_SPELL
drawextinfo message type: spell related information.
static final int MSG_TYPE_COMMUNICATION
drawextinfo message type: communication between players.
static final int MSG_TYPE_VICTIM
drawextinfo message type: something bad is happening to the player.
final Map< String, String > expansions
The macro expansions.