chore: initial commit

This commit is contained in:
Anna
2021-12-29 14:31:45 -05:00
commit f17a913405
29 changed files with 2677 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
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);
private ChatSource SourceFrom(ushort shift) => (ChatSource) (1 << ((this.Raw >> shift) & 0xF));
internal ChatCode(ushort raw) {
this.Raw = raw;
}
internal ChatType Parent() => this.Type switch {
ChatType.Say => ChatType.Say,
ChatType.GmSay => ChatType.Say,
ChatType.Shout => ChatType.Shout,
ChatType.GmShout => ChatType.Shout,
ChatType.TellOutgoing => ChatType.TellOutgoing,
ChatType.TellIncoming => ChatType.TellOutgoing,
ChatType.GmTell => ChatType.TellOutgoing,
ChatType.Party => ChatType.Party,
ChatType.CrossParty => ChatType.Party,
ChatType.GmParty => ChatType.Party,
ChatType.Linkshell1 => ChatType.Linkshell1,
ChatType.GmLinkshell1 => ChatType.Linkshell1,
ChatType.Linkshell2 => ChatType.Linkshell2,
ChatType.GmLinkshell2 => ChatType.Linkshell2,
ChatType.Linkshell3 => ChatType.Linkshell3,
ChatType.GmLinkshell3 => ChatType.Linkshell3,
ChatType.Linkshell4 => ChatType.Linkshell4,
ChatType.GmLinkshell4 => ChatType.Linkshell4,
ChatType.Linkshell5 => ChatType.Linkshell5,
ChatType.GmLinkshell5 => ChatType.Linkshell5,
ChatType.Linkshell6 => ChatType.Linkshell6,
ChatType.GmLinkshell6 => ChatType.Linkshell6,
ChatType.Linkshell7 => ChatType.Linkshell7,
ChatType.GmLinkshell7 => ChatType.Linkshell7,
ChatType.Linkshell8 => ChatType.Linkshell8,
ChatType.GmLinkshell8 => ChatType.Linkshell8,
ChatType.FreeCompany => ChatType.FreeCompany,
ChatType.GmFreeCompany => ChatType.FreeCompany,
ChatType.NoviceNetwork => ChatType.NoviceNetwork,
ChatType.GmNoviceNetwork => ChatType.NoviceNetwork,
ChatType.CustomEmote => ChatType.CustomEmote,
ChatType.StandardEmote => ChatType.StandardEmote,
ChatType.Yell => ChatType.Yell,
ChatType.GmYell => ChatType.Yell,
ChatType.GainBuff => ChatType.GainBuff,
ChatType.LoseBuff => ChatType.GainBuff,
ChatType.GainDebuff => ChatType.GainDebuff,
ChatType.LoseDebuff => ChatType.GainDebuff,
ChatType.System => ChatType.System,
ChatType.Alarm => ChatType.System,
ChatType.RetainerSale => ChatType.System,
ChatType.PeriodicRecruitmentNotification => ChatType.System,
ChatType.Sign => ChatType.System,
ChatType.Orchestrion => ChatType.System,
ChatType.MessageBook => ChatType.System,
ChatType.NpcDialogue => ChatType.NpcDialogue,
ChatType.NpcAnnouncement => ChatType.NpcDialogue,
ChatType.LootRoll => ChatType.LootRoll,
ChatType.RandomNumber => ChatType.LootRoll,
ChatType.FreeCompanyAnnouncement => ChatType.FreeCompanyAnnouncement,
ChatType.FreeCompanyLoginLogout => ChatType.FreeCompanyAnnouncement,
ChatType.PvpTeamAnnouncement => ChatType.PvpTeamAnnouncement,
ChatType.PvpTeamLoginLogout => ChatType.PvpTeamAnnouncement,
_ => this.Type,
};
internal bool IsBattle() {
switch (this.Type) {
case ChatType.Damage:
case ChatType.Miss:
case ChatType.Action:
case ChatType.Item:
case ChatType.Healing:
case ChatType.GainBuff:
case ChatType.LoseBuff:
case ChatType.GainDebuff:
case ChatType.LoseDebuff:
case ChatType.BattleSystem:
return true;
default:
return false;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
namespace ChatTwo.Code;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32")]
[Flags]
internal enum ChatSource : ushort {
Self = 2,
PartyMember = 4,
AllianceMember = 8,
Other = 16,
EngagedEnemy = 32,
UnengagedEnemy = 64,
FriendlyNpc = 128,
SelfPet = 256,
PartyPet = 512,
AlliancePet = 1024,
OtherPet = 2048,
}
+16
View File
@@ -0,0 +1,16 @@
namespace ChatTwo.Code;
internal static class ChatSourceExt {
internal const ChatSource All =
ChatSource.Self
| ChatSource.PartyMember
| ChatSource.AllianceMember
| ChatSource.Other
| ChatSource.EngagedEnemy
| ChatSource.UnengagedEnemy
| ChatSource.FriendlyNpc
| ChatSource.SelfPet
| ChatSource.PartyPet
| ChatSource.AlliancePet
| ChatSource.OtherPet;
}
+87
View File
@@ -0,0 +1,87 @@
namespace ChatTwo.Code;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32")]
internal enum ChatType : ushort {
Debug = 1,
Urgent = 2,
Notice = 3,
Say = 10,
Shout = 11,
TellOutgoing = 12,
TellIncoming = 13,
Party = 14,
Alliance = 15,
Linkshell1 = 16,
Linkshell2 = 17,
Linkshell3 = 18,
Linkshell4 = 19,
Linkshell5 = 20,
Linkshell6 = 21,
Linkshell7 = 22,
Linkshell8 = 23,
FreeCompany = 24,
NoviceNetwork = 27,
CustomEmote = 28,
StandardEmote = 29,
Yell = 30,
// 31 - also party?
CrossParty = 32,
PvpTeam = 36,
CrossLinkshell1 = 37,
Damage = 41,
Miss = 42,
Action = 43,
Item = 44,
Healing = 45,
GainBuff = 46,
GainDebuff = 47,
LoseBuff = 48,
LoseDebuff = 49,
Alarm = 55,
Echo = 56,
System = 57,
BattleSystem = 58,
GatheringSystem = 59,
Error = 60,
NpcDialogue = 61,
LootNotice = 62,
Progress = 64,
LootRoll = 65,
Crafting = 66,
Gathering = 67,
NpcAnnouncement = 68,
FreeCompanyAnnouncement = 69,
FreeCompanyLoginLogout = 70,
RetainerSale = 71,
PeriodicRecruitmentNotification = 72,
Sign = 73,
RandomNumber = 74,
NoviceNetworkSystem = 75,
Orchestrion = 76,
PvpTeamAnnouncement = 77,
PvpTeamLoginLogout = 78,
MessageBook = 79,
GmTell = 80,
GmSay = 81,
GmShout = 82,
GmYell = 83,
GmParty = 84,
GmFreeCompany = 85,
GmLinkshell1 = 86,
GmLinkshell2 = 87,
GmLinkshell3 = 88,
GmLinkshell4 = 89,
GmLinkshell5 = 90,
GmLinkshell6 = 91,
GmLinkshell7 = 92,
GmLinkshell8 = 93,
GmNoviceNetwork = 94,
CrossLinkshell2 = 101,
CrossLinkshell3 = 102,
CrossLinkshell4 = 103,
CrossLinkshell5 = 104,
CrossLinkshell6 = 105,
CrossLinkshell7 = 106,
CrossLinkshell8 = 107,
}
+209
View File
@@ -0,0 +1,209 @@
using ChatTwo.Util;
namespace ChatTwo.Code;
internal static class ChatTypeExt {
internal static string? Name(this ChatType type) {
return type switch {
ChatType.Debug => "Debug",
ChatType.Urgent => "Urgent",
ChatType.Notice => "Notice",
ChatType.Say => "Say",
ChatType.Shout => "Shout",
ChatType.TellOutgoing => "Tell (Outgoing)",
ChatType.TellIncoming => "Tell (Incoming)",
ChatType.Party => "Party",
ChatType.Alliance => "Alliance",
ChatType.Linkshell1 => "Linkshell [1]",
ChatType.Linkshell2 => "Linkshell [2]",
ChatType.Linkshell3 => "Linkshell [3]",
ChatType.Linkshell4 => "Linkshell [4]",
ChatType.Linkshell5 => "Linkshell [5]",
ChatType.Linkshell6 => "Linkshell [6]",
ChatType.Linkshell7 => "Linkshell [7]",
ChatType.Linkshell8 => "Linkshell [8]",
ChatType.FreeCompany => "Free Company",
ChatType.NoviceNetwork => "Novice Network",
ChatType.CustomEmote => "Custom Emotes",
ChatType.StandardEmote => "Standard Emotes",
ChatType.Yell => "Yell",
ChatType.CrossParty => "Cross-world Party",
ChatType.PvpTeam => "PvP Team",
ChatType.CrossLinkshell1 => "Cross-world Linkshell [1]",
ChatType.Damage => "Damage dealt",
ChatType.Miss => "Failed attacks",
ChatType.Action => "Actions used",
ChatType.Item => "Items used",
ChatType.Healing => "Healing",
ChatType.GainBuff => "Beneficial effects granted",
ChatType.GainDebuff => "Detrimental effects inflicted",
ChatType.LoseBuff => "Beneficial effects lost",
ChatType.LoseDebuff => "Detrimental effects cured",
ChatType.Alarm => "Alarm Notifications",
ChatType.Echo => "Echo",
ChatType.System => "System Messages",
ChatType.BattleSystem => "Battle System Messages",
ChatType.GatheringSystem => "Gathering System Messages",
ChatType.Error => "Error Messages",
ChatType.NpcDialogue => "NPC Dialogue",
ChatType.LootNotice => "Loot Notices",
ChatType.Progress => "Progression Messages",
ChatType.LootRoll => "Loot Messages",
ChatType.Crafting => "Synthesis Messages",
ChatType.Gathering => "Gathering Messages",
ChatType.NpcAnnouncement => "NPC Dialogue (Announcements)",
ChatType.FreeCompanyAnnouncement => "Free Company Announcements",
ChatType.FreeCompanyLoginLogout => "Free Company Member Login Notifications",
ChatType.RetainerSale => "Retainer Sale Notifications",
ChatType.PeriodicRecruitmentNotification => "Periodic Recruitment Notifications",
ChatType.Sign => "Sign Messages for PC Targets",
ChatType.RandomNumber => "Random Number Messages",
ChatType.NoviceNetworkSystem => "Novice Network Notifications",
ChatType.Orchestrion => "Current Orchestrion Track Messages",
ChatType.PvpTeamAnnouncement => "PvP Team Announcements",
ChatType.PvpTeamLoginLogout => "PvP Team Member Login Notifications",
ChatType.MessageBook => "Message Book Alert",
ChatType.GmTell => "Tell (GM)",
ChatType.GmSay => "Say (GM)",
ChatType.GmShout => "Shout (GM)",
ChatType.GmYell => "Yell (GM)",
ChatType.GmParty => "Party (GM)",
ChatType.GmFreeCompany => "Free Company (GM)",
ChatType.GmLinkshell1 => "Linkshell [1] (GM)",
ChatType.GmLinkshell2 => "Linkshell [2] (GM)",
ChatType.GmLinkshell3 => "Linkshell [3] (GM)",
ChatType.GmLinkshell4 => "Linkshell [4] (GM)",
ChatType.GmLinkshell5 => "Linkshell [5] (GM)",
ChatType.GmLinkshell6 => "Linkshell [6] (GM)",
ChatType.GmLinkshell7 => "Linkshell [7] (GM)",
ChatType.GmLinkshell8 => "Linkshell [8] (GM)",
ChatType.GmNoviceNetwork => "Novice Network (GM)",
ChatType.CrossLinkshell2 => "Cross-world Linkshell [2]",
ChatType.CrossLinkshell3 => "Cross-world Linkshell [3]",
ChatType.CrossLinkshell4 => "Cross-world Linkshell [4]",
ChatType.CrossLinkshell5 => "Cross-world Linkshell [5]",
ChatType.CrossLinkshell6 => "Cross-world Linkshell [6]",
ChatType.CrossLinkshell7 => "Cross-world Linkshell [7]",
ChatType.CrossLinkshell8 => "Cross-world Linkshell [8]",
_ => type.ToString(),
};
}
internal static uint? DefaultColour(this ChatType type) {
switch (type) {
case ChatType.Debug:
return ColourUtil.ComponentsToRgba(204, 204, 204);
case ChatType.Urgent:
return ColourUtil.ComponentsToRgba(255, 127, 127);
case ChatType.Notice:
return ColourUtil.ComponentsToRgba(179, 140, 255);
case ChatType.Say:
case ChatType.GmSay:
return ColourUtil.ComponentsToRgba(247, 247, 247);
case ChatType.Shout:
case ChatType.GmShout:
return ColourUtil.ComponentsToRgba(255, 166, 102);
case ChatType.TellIncoming:
case ChatType.TellOutgoing:
case ChatType.GmTell:
return ColourUtil.ComponentsToRgba(255, 184, 222);
case ChatType.Party:
case ChatType.CrossParty:
case ChatType.GmParty:
return ColourUtil.ComponentsToRgba(102, 229, 255);
case ChatType.Alliance:
return ColourUtil.ComponentsToRgba(255, 127, 0);
case ChatType.NoviceNetwork:
case ChatType.NoviceNetworkSystem:
case ChatType.GmNoviceNetwork:
return ColourUtil.ComponentsToRgba(212, 255, 125);
case ChatType.Linkshell1:
case ChatType.Linkshell2:
case ChatType.Linkshell3:
case ChatType.Linkshell4:
case ChatType.Linkshell5:
case ChatType.Linkshell6:
case ChatType.Linkshell7:
case ChatType.Linkshell8:
case ChatType.CrossLinkshell1:
case ChatType.CrossLinkshell2:
case ChatType.CrossLinkshell3:
case ChatType.CrossLinkshell4:
case ChatType.CrossLinkshell5:
case ChatType.CrossLinkshell6:
case ChatType.CrossLinkshell7:
case ChatType.CrossLinkshell8:
case ChatType.GmLinkshell1:
case ChatType.GmLinkshell2:
case ChatType.GmLinkshell3:
case ChatType.GmLinkshell4:
case ChatType.GmLinkshell5:
case ChatType.GmLinkshell6:
case ChatType.GmLinkshell7:
case ChatType.GmLinkshell8:
return ColourUtil.ComponentsToRgba(212, 255, 125);
case ChatType.StandardEmote:
return ColourUtil.ComponentsToRgba(186, 255, 240);
case ChatType.CustomEmote:
return ColourUtil.ComponentsToRgba(186, 255, 240);
case ChatType.Yell:
case ChatType.GmYell:
return ColourUtil.ComponentsToRgba(255, 255, 0);
case ChatType.Echo:
return ColourUtil.ComponentsToRgba(204, 204, 204);
case ChatType.System:
case ChatType.GatheringSystem:
case ChatType.PeriodicRecruitmentNotification:
case ChatType.Orchestrion:
case ChatType.Alarm:
case ChatType.RetainerSale:
case ChatType.Sign:
case ChatType.MessageBook:
return ColourUtil.ComponentsToRgba(204, 204, 204);
case ChatType.NpcAnnouncement:
case ChatType.NpcDialogue:
return ColourUtil.ComponentsToRgba(171, 214, 71);
case ChatType.Error:
return ColourUtil.ComponentsToRgba(255, 74, 74);
case ChatType.FreeCompany:
case ChatType.FreeCompanyAnnouncement:
case ChatType.FreeCompanyLoginLogout:
case ChatType.GmFreeCompany:
return ColourUtil.ComponentsToRgba(171, 219, 229);
case ChatType.PvpTeam:
return ColourUtil.ComponentsToRgba(171, 219, 229);
case ChatType.PvpTeamAnnouncement:
case ChatType.PvpTeamLoginLogout:
return ColourUtil.ComponentsToRgba(171, 219, 229);
case ChatType.Action:
case ChatType.Item:
case ChatType.LootNotice:
return ColourUtil.ComponentsToRgba(255, 255, 176);
case ChatType.Progress:
return ColourUtil.ComponentsToRgba(255, 222, 115);
case ChatType.LootRoll:
case ChatType.RandomNumber:
return ColourUtil.ComponentsToRgba(199, 191, 158);
case ChatType.Crafting:
case ChatType.Gathering:
return ColourUtil.ComponentsToRgba(222, 191, 247);
case ChatType.Damage:
return ColourUtil.ComponentsToRgba(255, 125, 125);
case ChatType.Miss:
return ColourUtil.ComponentsToRgba(204, 204, 204);
case ChatType.Healing:
return ColourUtil.ComponentsToRgba(212, 255, 125);
case ChatType.GainBuff:
case ChatType.LoseBuff:
return ColourUtil.ComponentsToRgba(148, 191, 255);
case ChatType.GainDebuff:
case ChatType.LoseDebuff:
return ColourUtil.ComponentsToRgba(255, 138, 196);
case ChatType.BattleSystem:
return ColourUtil.ComponentsToRgba(204, 204, 204);
default:
return null;
}
}
}
+32
View File
@@ -0,0 +1,32 @@
namespace ChatTwo.Code;
internal enum InputChannel : uint {
Tell = 0,
Say = 1,
Party = 2,
Alliance = 3,
Yell = 4,
Shout = 5,
FreeCompany = 6,
PvpTeam = 7,
NoviceNetwork = 8,
CrossLinkshell1 = 9,
CrossLinkshell2 = 10,
CrossLinkshell3 = 11,
CrossLinkshell4 = 12,
CrossLinkshell5 = 13,
CrossLinkshell6 = 14,
CrossLinkshell7 = 15,
CrossLinkshell8 = 16,
// 17 - unused?
// 18 - unused?
Linkshell1 = 19,
Linkshell2 = 20,
Linkshell3 = 21,
Linkshell4 = 22,
Linkshell5 = 23,
Linkshell6 = 24,
Linkshell7 = 25,
Linkshell8 = 26,
}
+34
View File
@@ -0,0 +1,34 @@
namespace ChatTwo.Code;
internal static class InputChannelExt {
internal static ChatType ToChatType(this InputChannel input) {
return input switch {
InputChannel.Tell => ChatType.TellOutgoing,
InputChannel.Say => ChatType.Say,
InputChannel.Party => ChatType.Party,
InputChannel.Alliance => ChatType.Alliance,
InputChannel.Yell => ChatType.Yell,
InputChannel.Shout => ChatType.Shout,
InputChannel.FreeCompany => ChatType.FreeCompany,
InputChannel.PvpTeam => ChatType.PvpTeam,
InputChannel.NoviceNetwork => ChatType.NoviceNetwork,
InputChannel.CrossLinkshell1 => ChatType.CrossLinkshell1,
InputChannel.CrossLinkshell2 => ChatType.CrossLinkshell2,
InputChannel.CrossLinkshell3 => ChatType.CrossLinkshell3,
InputChannel.CrossLinkshell4 => ChatType.CrossLinkshell4,
InputChannel.CrossLinkshell5 => ChatType.CrossLinkshell5,
InputChannel.CrossLinkshell6 => ChatType.CrossLinkshell6,
InputChannel.CrossLinkshell7 => ChatType.CrossLinkshell7,
InputChannel.CrossLinkshell8 => ChatType.CrossLinkshell8,
InputChannel.Linkshell1 => ChatType.Linkshell1,
InputChannel.Linkshell2 => ChatType.Linkshell2,
InputChannel.Linkshell3 => ChatType.Linkshell3,
InputChannel.Linkshell4 => ChatType.Linkshell4,
InputChannel.Linkshell5 => ChatType.Linkshell5,
InputChannel.Linkshell6 => ChatType.Linkshell6,
InputChannel.Linkshell7 => ChatType.Linkshell7,
InputChannel.Linkshell8 => ChatType.Linkshell8,
_ => throw new ArgumentOutOfRangeException(nameof(input), input, null),
};
}
}