summaryrefslogtreecommitdiff
path: root/NET/worlds/network/textCmd.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/network/textCmd.java')
-rw-r--r--NET/worlds/network/textCmd.java233
1 files changed, 233 insertions, 0 deletions
diff --git a/NET/worlds/network/textCmd.java b/NET/worlds/network/textCmd.java
new file mode 100644
index 0000000..531bf78
--- /dev/null
+++ b/NET/worlds/network/textCmd.java
@@ -0,0 +1,233 @@
+/* */ package NET.worlds.network;
+/* */
+/* */ import NET.worlds.console.BBChatCommand;
+/* */ import NET.worlds.console.BlackBox;
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.GammaTextArea;
+/* */ import NET.worlds.console.MuteListPart;
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.scape.Drone;
+/* */ import NET.worlds.scape.Pilot;
+/* */ import NET.worlds.scape.PosableDrone;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class textCmd
+/* */ extends receivedNetPacket
+/* */ {
+/* */ public static final byte TEXTCMD = 14;
+/* */ protected ObjID _senderID;
+/* */ protected String _text;
+/* */
+/* */ public textCmd()
+/* */ {
+/* 79 */ this._commandType = 14;
+/* */ }
+/* */
+/* */ public textCmd(String text) {
+/* 83 */ super(null, 14);
+/* */
+/* 85 */ this._senderID = new ObjID("");
+/* 86 */ this._text = text;
+/* */ }
+/* */
+/* */ void parseNetData(ServerInputStream data) throws IOException
+/* */ {
+/* 91 */ this._senderID = new ObjID();
+/* 92 */ this._senderID.parseNetData(data);
+/* 93 */ this._text = data.readUTF();
+/* */ }
+/* */
+/* */ int packetSize()
+/* */ {
+/* 98 */ return ServerOutputStream.utfLength(this._text) + 1 + this._senderID.packetSize() +
+/* 99 */ super.packetSize();
+/* */ }
+/* */
+/* */ void send(ServerOutputStream o) throws IOException
+/* */ {
+/* 104 */ super.send(o);
+/* 105 */ this._senderID.send(o);
+/* 106 */ o.writeUTF(this._text);
+/* */ }
+/* */
+/* */ void process(WorldServer _serv) throws Exception {
+/* */ String name;
+/* */ String name;
+/* 112 */ if (this._senderID.longID() == null) {
+/* 113 */ name =
+/* 114 */ "[Unknown Name (#" + String.valueOf(this._senderID.shortID()) + ")]";
+/* */ } else {
+/* 116 */ name = this._senderID.longID();
+/* 117 */ if (MuteListPart.isMuted(_serv, name)) {
+/* 118 */ return;
+/* */ }
+/* */ }
+/* 121 */ handleActionText(_serv, this._text, name, this._senderID);
+/* */
+/* 123 */ if (!this._text.startsWith("&|+")) {
+/* 124 */ displayText(name, this._text);
+/* */ }
+/* */ }
+/* */
+/* */ protected void displayText(String name, String text) {
+/* 129 */ String filteredName = FilthFilter.get().filterName(name);
+/* 130 */ String line = "";
+/* */
+/* 132 */ if (IniFile.gamma().getIniInt("classicChatBox", 1) == 1) {
+/* 133 */ line = filteredName + "> ";
+/* 134 */ line = line + FilthFilter.get().filter(text);
+/* 135 */ BlackBox.getInstance().submitEvent(new BBChatCommand(line));
+/* 136 */ Console.println(line);
+/* 137 */ return;
+/* */ }
+/* */
+/* */
+/* 141 */ boolean colored = false;
+/* */
+/* 143 */ if (Drone.isEmployeeAccount(name)) {
+/* 144 */ line = GammaTextArea.colorStartBlueTag + " ";
+/* 145 */ colored = true;
+/* 146 */ } else if (name.toLowerCase().startsWith(Console.message("host"))) {
+/* 147 */ line = GammaTextArea.colorStartRedTag + " ";
+/* 148 */ colored = true;
+/* 149 */ } else if (name.toLowerCase().startsWith(Console.message("guest-"))) {
+/* 150 */ line = GammaTextArea.colorStartMagentaTag + " ";
+/* 151 */ colored = true;
+/* */ }
+/* */
+/* */
+/* 155 */ line = line + "<b> " + filteredName + "> </b> ";
+/* */
+/* 157 */ if (colored) {
+/* 158 */ line = line + " " + GammaTextArea.colorEndTag + " ";
+/* */ }
+/* */
+/* 161 */ line = line + FilthFilter.get().filter(text);
+/* */
+/* 163 */ BlackBox.getInstance().submitEvent(new BBChatCommand(line));
+/* */
+/* 165 */ Console.println(line);
+/* */ }
+/* */
+/* */
+/* */ public static void handleActionText(WorldServer _serv, String msg, String name, ObjID senderID)
+/* */ {
+/* 171 */ if (msg.startsWith("&|+action>")) {
+/* 172 */ NetworkObject o = _serv.getObject(senderID);
+/* 173 */ if (o == null)
+/* */ {
+/* 175 */ return;
+/* */ }
+/* */
+/* 178 */ String act = msg.substring(10);
+/* */
+/* 180 */ if (!(o instanceof PosableDrone)) {
+/* 181 */ return;
+/* */ }
+/* */
+/* 184 */ ((PosableDrone)o).animate(act);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* 190 */ if (msg.startsWith("&|+action2>"))
+/* */ {
+/* */
+/* */
+/* */
+/* 195 */ int idx = msg.indexOf("|sender|");
+/* 196 */ String senderAction = null;
+/* 197 */ String receiverAction = null;
+/* 198 */ if (idx != -1) {
+/* 199 */ senderAction = msg.substring(idx);
+/* 200 */ receiverAction = msg.substring(11, idx);
+/* */
+/* 202 */ NetworkObject o = _serv.getObject(senderID);
+/* 203 */ if ((o != null) &&
+/* 204 */ ((o instanceof PosableDrone))) {
+/* 205 */ ((PosableDrone)o).animate(senderAction);
+/* 206 */ Pilot.sendText("&|+action>" + senderAction);
+/* */ }
+/* */ }
+/* */ else {
+/* 210 */ receiverAction = msg.substring(11);
+/* */ }
+/* */ try
+/* */ {
+/* 214 */ Console.getActive().getPilot().animate(receiverAction);
+/* */ }
+/* */ catch (Exception e) {
+/* 217 */ System.out.println("Error animating pilot " + e.toString());
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public String toString(WorldServer serv)
+/* */ {
+/* 225 */ return "TEXT " + this._senderID.toString(serv) + ": " + this._text;
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\textCmd.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file