2022-02-04 09:45:38 +00:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using Shared.Packet;
|
|
|
|
|
using Shared.Packet.Packets;
|
|
|
|
|
|
2022-02-10 01:44:50 +00:00
|
|
|
|
namespace Shared;
|
2022-02-04 09:45:38 +00:00
|
|
|
|
|
|
|
|
|
public static class Constants {
|
2022-02-08 16:15:31 +00:00
|
|
|
|
public const int CostumeNameSize = 0x20;
|
2022-02-04 09:45:38 +00:00
|
|
|
|
|
|
|
|
|
// dictionary of packet types to packet
|
2022-02-10 04:29:10 +00:00
|
|
|
|
public static readonly Dictionary<Type, PacketAttribute> PacketMap = Assembly
|
2022-02-04 09:45:38 +00:00
|
|
|
|
.GetExecutingAssembly()
|
|
|
|
|
.GetTypes()
|
|
|
|
|
.Where(type => type.IsAssignableTo(typeof(IPacket)))
|
|
|
|
|
.ToDictionary(type => type, type => type.GetCustomAttribute<PacketAttribute>()!);
|
2022-02-10 04:29:10 +00:00
|
|
|
|
public static readonly Dictionary<PacketType, Type> PacketIdMap = Assembly
|
|
|
|
|
.GetExecutingAssembly()
|
|
|
|
|
.GetTypes()
|
2022-02-11 04:25:47 +00:00
|
|
|
|
.Where(type => type.IsAssignableTo(typeof(IPacket)) && type.GetCustomAttribute<PacketAttribute>() != null)
|
2022-02-10 04:29:10 +00:00
|
|
|
|
.ToDictionary(type => type.GetCustomAttribute<PacketAttribute>()!.Type, type => type);
|
2022-02-10 01:44:50 +00:00
|
|
|
|
|
|
|
|
|
public static int HeaderSize { get; } = Marshal.SizeOf<PacketHeader>();
|
2022-03-28 06:05:32 +00:00
|
|
|
|
|
|
|
|
|
public static readonly Dictionary<string, string> MapNames = new Dictionary<string, string>() {
|
2022-04-05 19:35:13 +00:00
|
|
|
|
{"cap", "CapWorldHomeStage"},
|
|
|
|
|
{"cascade", "WaterfallWorldHomeStage"},
|
|
|
|
|
{"sand", "SandWorldHomeStage"},
|
|
|
|
|
{"lake", "LakeWorldHomeStage"},
|
|
|
|
|
{"wooded", "ForestWorldHomeStage"},
|
|
|
|
|
{"cloud", "CloudWorldHomeStage"},
|
|
|
|
|
{"lost", "ClashWorldHomeStage"},
|
|
|
|
|
{"metro", "CityWorldHomeStage"},
|
|
|
|
|
{"sea", "SeaWorldHomeStage"},
|
|
|
|
|
{"snow", "SnowWorldHomeStage"},
|
|
|
|
|
{"lunch", "LavaWorldHomeStage"},
|
|
|
|
|
{"ruined", "BossRaidWorldHomeStage"},
|
|
|
|
|
{"bowser", "SkyWorldHomeStage"},
|
|
|
|
|
{"moon", "MoonWorldHomeStage"},
|
|
|
|
|
{"mush", "PeachWorldHomeStage"},
|
|
|
|
|
{"dark", "Special1WorldHomeStage"},
|
|
|
|
|
{"darker", "Special2WorldHomeStage"}
|
2022-03-28 06:05:32 +00:00
|
|
|
|
};
|
2021-11-29 04:04:34 +00:00
|
|
|
|
}
|