Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -6,7 +6,10 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
private string m_Name;
|
||||
private string m_Password;
|
||||
private List<ChatUser> m_Users, m_Banned, m_Moderators, m_Voices;
|
||||
private readonly List<ChatUser> m_Users;
|
||||
private readonly List<ChatUser> m_Banned;
|
||||
private readonly List<ChatUser> m_Moderators;
|
||||
private readonly List<ChatUser> m_Voices;
|
||||
private bool m_VoiceRestricted;
|
||||
|
||||
public Channel(string name)
|
||||
|
|
@ -66,9 +69,9 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public bool AlwaysAvailable{ get; set; }
|
||||
public bool AlwaysAvailable { get; set; }
|
||||
|
||||
public static List<Channel> Channels{ get; } = new List<Channel>();
|
||||
public static List<Channel> Channels { get; } = new List<Channel>();
|
||||
|
||||
public bool Contains(ChatUser user) => m_Users.Contains(user);
|
||||
|
||||
|
|
@ -100,7 +103,6 @@ namespace Server.Engines.Chat
|
|||
|
||||
from.Mobile.SendMessage("Your access level is too low to do this.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public bool AddUser(ChatUser user, string password = null)
|
||||
|
|
@ -132,7 +134,7 @@ namespace Server.Engines.Chat
|
|||
m_Users.Add(user);
|
||||
user.CurrentChannel = this;
|
||||
|
||||
if (user.Mobile.AccessLevel >= AccessLevel.GameMaster || !AlwaysAvailable && m_Users.Count == 1)
|
||||
if (user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!AlwaysAvailable && m_Users.Count == 1))
|
||||
AddModerator(user);
|
||||
|
||||
SendUsersTo(user);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public class ChatSystem
|
||||
{
|
||||
public static bool Enabled{ get; set; } = true;
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -128,9 +128,10 @@ namespace Server.Engines.Chat
|
|||
Channel channel = user.CurrentChannel;
|
||||
|
||||
if (handler.RequireConference && channel == null)
|
||||
user.SendMessage(31); /* You must be in a conference to do this.
|
||||
* To join a conference, select one from the Conference menu.
|
||||
*/
|
||||
/* You must be in a conference to do this.
|
||||
* To join a conference, select one from the Conference menu.
|
||||
*/
|
||||
user.SendMessage(31);
|
||||
else if (handler.RequireModerator && !user.IsModerator)
|
||||
user.SendMessage(29); // You must have operator status to do this.
|
||||
else
|
||||
|
|
@ -147,4 +148,4 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ namespace Server.Engines.Chat
|
|||
Callback = callback;
|
||||
}
|
||||
|
||||
public bool RequireModerator{ get; }
|
||||
public bool RequireModerator { get; }
|
||||
|
||||
public bool RequireConference{ get; }
|
||||
public bool RequireConference { get; }
|
||||
|
||||
public OnChatAction Callback{ get; }
|
||||
public OnChatAction Callback { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
public class ChatActionHandlers
|
||||
{
|
||||
private static ChatActionHandler[] m_Handlers;
|
||||
private static readonly ChatActionHandler[] m_Handlers;
|
||||
|
||||
static ChatActionHandlers()
|
||||
{
|
||||
|
|
@ -111,9 +111,10 @@ namespace Server.Engines.Chat
|
|||
public static void DisallowPrivateMessages(ChatUser from, Channel channel, string param)
|
||||
{
|
||||
from.IgnorePrivateMessage = true;
|
||||
from.SendMessage(38); /* You will no longer receive private messages.
|
||||
* Those who send you a message will be notified that you are blocking incoming messages.
|
||||
*/
|
||||
/* You will no longer receive private messages.
|
||||
* Those who send you a message will be notified that you are blocking incoming messages.
|
||||
*/
|
||||
from.SendMessage(38);
|
||||
}
|
||||
|
||||
public static void TogglePrivateMessages(ChatUser from, Channel channel, string param)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace Server.Engines.Chat
|
|||
public const char ModeratorColorCharacter = '1';
|
||||
public const char VoicedColorCharacter = '2';
|
||||
|
||||
private static List<ChatUser> m_Users = new List<ChatUser>();
|
||||
private static Dictionary<Mobile, ChatUser> m_Table = new Dictionary<Mobile, ChatUser>();
|
||||
private static readonly List<ChatUser> m_Users = new List<ChatUser>();
|
||||
private static readonly Dictionary<Mobile, ChatUser> m_Table = new Dictionary<Mobile, ChatUser>();
|
||||
|
||||
public ChatUser(Mobile m)
|
||||
{
|
||||
|
|
@ -19,11 +19,11 @@ namespace Server.Engines.Chat
|
|||
Ignoring = new List<ChatUser>();
|
||||
}
|
||||
|
||||
public Mobile Mobile{ get; }
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public List<ChatUser> Ignored{ get; }
|
||||
public List<ChatUser> Ignored { get; }
|
||||
|
||||
public List<ChatUser> Ignoring{ get; }
|
||||
public List<ChatUser> Ignoring { get; }
|
||||
|
||||
public string Username
|
||||
{
|
||||
|
|
@ -41,13 +41,13 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public Channel CurrentChannel{ get; set; }
|
||||
public Channel CurrentChannel { get; set; }
|
||||
|
||||
public bool IsOnline => Mobile.NetState != null;
|
||||
|
||||
public bool Anonymous{ get; set; }
|
||||
public bool Anonymous { get; set; }
|
||||
|
||||
public bool IgnorePrivateMessage{ get; set; }
|
||||
public bool IgnorePrivateMessage { get; set; }
|
||||
|
||||
public bool IsModerator => CurrentChannel?.IsModerator(this) == true;
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ namespace Server.Engines.Chat
|
|||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
// ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
|
||||
return user;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ namespace Server.Engines.Chat
|
|||
|
||||
EnsureCapacity(13 + (param1.Length + param2.Length) * 2);
|
||||
|
||||
m_Stream.Write((ushort)(number - 20));
|
||||
Stream.Write((ushort)(number - 20));
|
||||
|
||||
if (who != null)
|
||||
m_Stream.WriteAsciiFixed(who.Language, 4);
|
||||
Stream.WriteAsciiFixed(who.Language, 4);
|
||||
else
|
||||
m_Stream.Write(0);
|
||||
Stream.Write(0);
|
||||
|
||||
m_Stream.WriteBigUniNull(param1);
|
||||
m_Stream.WriteBigUniNull(param2);
|
||||
Stream.WriteBigUniNull(param1);
|
||||
Stream.WriteBigUniNull(param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue