feat: add chat database

This commit is contained in:
Anna committed 2022-02-15 12:58:55 -05:00
1 parent 18c311ace5
commit 9b7b84a58d
25 files changed
+476 -95

No files matched your search

+17 -4
View File
@@ -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 {
+6
View File
@@ -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,
};
}