public static void Command(IClient client, String command, IClient target, String args) { if (command == "help") { Help(client); return; } if (!client.Captcha) { if (!command.StartsWith("login ")) { return; } } if (!client.Registered) { if (command.StartsWith("register ")) { AccountManager.Register(client, command.Substring(9)); return; } else if (command.StartsWith("login ")) { AccountManager.Login(client, command.Substring(6)); return; } } else { if (command == "unregister" && !client.Owner) { AccountManager.Unregister(client); return; } if (command == "logout" || command == "logoff") { AccountManager.Logout(client); return; } if (command.StartsWith("nick ")) { if (!Helpers.NameAvailable(client, command.Substring(5)) || command.Substring(5).Length < 2) { return; } if (Nick(client, command.Substring(5))) { client.Name = command.Substring(5); } return; } if (command.StartsWith("setlevel ")) { if (target != null && client.Owner) { if (target.Registered) { byte level; if (byte.TryParse(args, out level)) { if (level <= 3) { target.Level = (ILevel)level; AccountManager.UpdateAccount(client, target); } } } } return; } if (command == "idle" || command == "idles") { if (!IdleManager.CheckIfCanIdle(client)) { return; } IdleManager.Add(client); Events.Idled(client); return; } } if (target != null) { if (target.IUser.Link.IsLinked) { if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready && client.Level > ILevel.Regular) { ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafAdmin(ServerCore.Linker, client, command, target, args)); } return; } } if (DefaultCommands) { cmds.Command(client != null ? client.IUser : null, command, target != null ? target.IUser : null, args); } js.Command(client != null ? client.IUser : null, command, target != null ? target.IUser : null, args); ExtensionManager.Plugins.ForEach(x => { try { x.Plugin.Command(client != null ? client.IUser : null, command, target != null ? target.IUser : null, args); } catch { } }); }
private static void Emote(AresClient client, TCPPacketReader packet) { if (!client.Captcha) { return; } String text = packet.ReadString(client); if (text.Length > 300) { text = text.Substring(0, 300); } Events.EmoteReceived(client, text); if (client.SocketConnected) { text = Events.EmoteSending(client, text); if (!String.IsNullOrEmpty(text) && client.SocketConnected && !client.Muzzled) { if (client.Idled) { uint seconds_away = (uint)((Time.Now - client.IdleStart) / 1000); IdleManager.Remove(client); Events.Unidled(client, seconds_away); } if (client.SocketConnected) { if (text.StartsWith("idles")) { if (!IdleManager.CheckIfCanIdle(client)) { return; } IdleManager.Add(client); Events.Idled(client); } if (client.SocketConnected) { byte[] js_style = null; AresFont font = (AresFont)client.Font; if (font.Enabled) { font.IsEmote = true; js_style = TCPOutbound.Font(font); } UserPool.AUsers.ForEachWhere(x => { if (x.SupportsHTML && x.Ares) { if (js_style != null) { x.SendPacket(js_style); } } x.SendPacket(TCPOutbound.Emote(x, client.Name, text)); }, x => x.LoggedIn && x.Vroom == client.Vroom && !x.IgnoreList.Contains(client.Name) && !x.Quarantined); UserPool.WUsers.ForEachWhere(x => x.QueuePacket(ib0t.WebOutbound.EmoteTo(x, client.Name, text)), x => x.LoggedIn && x.Vroom == client.Vroom && !x.IgnoreList.Contains(client.Name) && !x.Quarantined); if (ServerCore.Linker.Busy && ServerCore.Linker.LoginPhase == LinkLeaf.LinkLogin.Ready) { ServerCore.Linker.SendPacket(LinkLeaf.LeafOutbound.LeafEmoteText(ServerCore.Linker, client.Name, text)); } Events.EmoteSent(client, text); } } } } }