feat: add chat database
This commit is contained in:
@@ -1,17 +1,30 @@
|
||||
namespace ChatTwo.Code;
|
||||
using LiteDB;
|
||||
|
||||
namespace ChatTwo.Code;
|
||||
|
||||
internal class ChatCode {
|
||||
private const ushort Clear7 = ~(~0 << 7);
|
||||
|
||||
internal ushort Raw { get; }
|
||||
|
||||
internal ChatType Type => (ChatType) (this.Raw & Clear7);
|
||||
internal ChatSource Source => this.SourceFrom(11);
|
||||
internal ChatSource Target => this.SourceFrom(7);
|
||||
internal ChatType Type { get; }
|
||||
internal ChatSource Source { get; }
|
||||
internal ChatSource Target { get; }
|
||||
private ChatSource SourceFrom(ushort shift) => (ChatSource) (1 << ((this.Raw >> shift) & 0xF));
|
||||
|
||||
internal ChatCode(ushort raw) {
|
||||
this.Raw = raw;
|
||||
this.Type = (ChatType) (this.Raw & Clear7);
|
||||
this.Source = this.SourceFrom(11);
|
||||
this.Target = this.SourceFrom(7);
|
||||
}
|
||||
|
||||
[BsonCtor]
|
||||
public ChatCode(ushort raw, ChatType type, ChatSource source, ChatSource target) {
|
||||
this.Raw = raw;
|
||||
this.Type = type;
|
||||
this.Source = source;
|
||||
this.Target = target;
|
||||
}
|
||||
|
||||
internal ChatType Parent() => this.Type switch {
|
||||
|
||||
@@ -345,10 +345,16 @@ internal static class ChatTypeExt {
|
||||
ChatType.LoseDebuff => true,
|
||||
|
||||
// Announcements
|
||||
ChatType.System => true,
|
||||
ChatType.BattleSystem => true,
|
||||
ChatType.Error => true,
|
||||
ChatType.LootNotice => true,
|
||||
ChatType.Progress => true,
|
||||
ChatType.LootRoll => true,
|
||||
ChatType.Crafting => true,
|
||||
ChatType.Gathering => true,
|
||||
ChatType.FreeCompanyLoginLogout => true,
|
||||
ChatType.PvpTeamLoginLogout => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user