mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 06:42:38 +08:00
Avoid using enum
This commit is contained in:
parent
fd2edcbd3b
commit
54a0967efa
@ -2,167 +2,295 @@
|
||||
|
||||
package net.mamoe.mirai.message
|
||||
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
/**
|
||||
* @author LamGC
|
||||
*/
|
||||
@Suppress("EnumEntryName", "unused", "SpellCheckingInspection")
|
||||
enum class FaceID constructor(val value: UByte) {
|
||||
unknown(0xffu),
|
||||
// TODO: 2019/9/1 添加更多表情
|
||||
jingya(0u),
|
||||
piezui(1u),
|
||||
se(2u),
|
||||
fadai(3u),
|
||||
deyi(4u),
|
||||
liulei(5u),
|
||||
haixiu(6u),
|
||||
bizui(7u),
|
||||
shui(8u),
|
||||
daku(9u),
|
||||
ganga(10u),
|
||||
fanu(11u),
|
||||
tiaopi(12u),
|
||||
ciya(13u),
|
||||
weixiao(14u),
|
||||
nanguo(15u),
|
||||
ku(16u),
|
||||
zhuakuang(18u),
|
||||
tu(19u),
|
||||
touxiao(20u),
|
||||
keai(21u),
|
||||
baiyan(22u),
|
||||
aoman(23u),
|
||||
ji_e(24u),
|
||||
kun(25u),
|
||||
jingkong(26u),
|
||||
liuhan(27u),
|
||||
hanxiao(28u),
|
||||
dabing(29u),
|
||||
fendou(30u),
|
||||
zhouma(31u),
|
||||
yiwen(32u),
|
||||
yun(34u),
|
||||
zhemo(35u),
|
||||
shuai(36u),
|
||||
kulou(37u),
|
||||
qiaoda(38u),
|
||||
zaijian(39u),
|
||||
fadou(41u),
|
||||
aiqing(42u),
|
||||
tiaotiao(43u),
|
||||
zhutou(46u),
|
||||
yongbao(49u),
|
||||
dan_gao(53u),
|
||||
shandian(54u),
|
||||
zhadan(55u),
|
||||
dao(56u),
|
||||
zuqiu(57u),
|
||||
bianbian(59u),
|
||||
kafei(60u),
|
||||
fan(61u),
|
||||
meigui(63u),
|
||||
diaoxie(64u),
|
||||
aixin(66u),
|
||||
xinsui(67u),
|
||||
liwu(69u),
|
||||
taiyang(74u),
|
||||
yueliang(75u),
|
||||
qiang(76u),
|
||||
ruo(77u),
|
||||
woshou(78u),
|
||||
shengli(79u),
|
||||
feiwen(85u),
|
||||
naohuo(86u),
|
||||
xigua(89u),
|
||||
lenghan(96u),
|
||||
cahan(97u),
|
||||
koubi(98u),
|
||||
guzhang(99u),
|
||||
qiudale(100u),
|
||||
huaixiao(101u),
|
||||
zuohengheng(102u),
|
||||
youhengheng(103u),
|
||||
haqian(104u),
|
||||
bishi(105u),
|
||||
weiqu(106u),
|
||||
kuaikule(107u),
|
||||
yinxian(108u),
|
||||
qinqin(109u),
|
||||
xia(110u),
|
||||
kelian(111u),
|
||||
caidao(112u),
|
||||
pijiu(113u),
|
||||
lanqiu(114u),
|
||||
pingpang(115u),
|
||||
shiai(116u),
|
||||
piaochong(117u),
|
||||
baoquan(118u),
|
||||
gouyin(119u),
|
||||
quantou(120u),
|
||||
chajin(121u),
|
||||
aini(122u),
|
||||
bu(123u),
|
||||
hao(124u),
|
||||
zhuanquan(125u),
|
||||
ketou(126u),
|
||||
huitou(127u),
|
||||
tiaosheng(128u),
|
||||
huishou(129u),
|
||||
jidong(130u),
|
||||
jiewu(131u),
|
||||
xianwen(132u),
|
||||
zuotaiji(133u),
|
||||
youtaiji(134u),
|
||||
shuangxi(136u),
|
||||
bianpao(137u),
|
||||
denglong(138u),
|
||||
facai(139u),
|
||||
K_ge(140u),
|
||||
gouwu(141u),
|
||||
youjian(142u),
|
||||
shuai_qi(143u),
|
||||
hecai(144u),
|
||||
qidao(145u),
|
||||
baojin(146u),
|
||||
bangbangtang(147u),
|
||||
he_nai(148u),
|
||||
xiamian(149u),
|
||||
xiangjiao(150u),
|
||||
feiji(151u),
|
||||
kaiche(152u),
|
||||
gaotiezuochetou(153u),
|
||||
chexiang(154u),
|
||||
gaotieyouchetou(155u),
|
||||
duoyun(156u),
|
||||
xiayu(157u),
|
||||
chaopiao(158u),
|
||||
xiongmao(159u),
|
||||
dengpao(160u),
|
||||
fengche(161u),
|
||||
naozhong(162u),
|
||||
dasan(163u),
|
||||
caiqiu(164u),
|
||||
zuanjie(165u),
|
||||
shafa(166u),
|
||||
zhijin(167u),
|
||||
yao(168u),
|
||||
shouqiang(169u),
|
||||
qingwa(170u);
|
||||
|
||||
override fun toString(): String {
|
||||
return "$name($value)"
|
||||
}
|
||||
|
||||
@Suppress("SpellCheckingInspection", "unused")
|
||||
inline class FaceId(inline val value: UByte) {
|
||||
companion object {
|
||||
|
||||
fun ofId(id: UByte): FaceID {
|
||||
for (value in values()) {
|
||||
if (value.value == id) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
return unknown
|
||||
}
|
||||
@JvmStatic
|
||||
val unknown: FaceId = FaceId(0xffu)
|
||||
@JvmStatic
|
||||
val jingya: FaceId = FaceId(0u)
|
||||
@JvmStatic
|
||||
val piezui: FaceId = FaceId(1u)
|
||||
@JvmStatic
|
||||
val se: FaceId = FaceId(2u)
|
||||
@JvmStatic
|
||||
val fadai: FaceId = FaceId(3u)
|
||||
@JvmStatic
|
||||
val deyi: FaceId = FaceId(4u)
|
||||
@JvmStatic
|
||||
val liulei: FaceId = FaceId(5u)
|
||||
@JvmStatic
|
||||
val haixiu: FaceId = FaceId(6u)
|
||||
@JvmStatic
|
||||
val bizui: FaceId = FaceId(7u)
|
||||
@JvmStatic
|
||||
val shui: FaceId = FaceId(8u)
|
||||
@JvmStatic
|
||||
val daku: FaceId = FaceId(9u)
|
||||
@JvmStatic
|
||||
val ganga: FaceId = FaceId(10u)
|
||||
@JvmStatic
|
||||
val fanu: FaceId = FaceId(11u)
|
||||
@JvmStatic
|
||||
val tiaopi: FaceId = FaceId(12u)
|
||||
@JvmStatic
|
||||
val ciya: FaceId = FaceId(13u)
|
||||
@JvmStatic
|
||||
val weixiao: FaceId = FaceId(14u)
|
||||
@JvmStatic
|
||||
val nanguo: FaceId = FaceId(15u)
|
||||
@JvmStatic
|
||||
val ku: FaceId = FaceId(16u)
|
||||
@JvmStatic
|
||||
val zhuakuang: FaceId = FaceId(18u)
|
||||
@JvmStatic
|
||||
val tu: FaceId = FaceId(19u)
|
||||
@JvmStatic
|
||||
val touxiao: FaceId = FaceId(20u)
|
||||
@JvmStatic
|
||||
val keai: FaceId = FaceId(21u)
|
||||
@JvmStatic
|
||||
val baiyan: FaceId = FaceId(22u)
|
||||
@JvmStatic
|
||||
val aoman: FaceId = FaceId(23u)
|
||||
@JvmStatic
|
||||
val ji_e: FaceId = FaceId(24u)
|
||||
@JvmStatic
|
||||
val kun: FaceId = FaceId(25u)
|
||||
@JvmStatic
|
||||
val jingkong: FaceId = FaceId(26u)
|
||||
@JvmStatic
|
||||
val liuhan: FaceId = FaceId(27u)
|
||||
@JvmStatic
|
||||
val hanxiao: FaceId = FaceId(28u)
|
||||
@JvmStatic
|
||||
val dabing: FaceId = FaceId(29u)
|
||||
@JvmStatic
|
||||
val fendou: FaceId = FaceId(30u)
|
||||
@JvmStatic
|
||||
val zhouma: FaceId = FaceId(31u)
|
||||
@JvmStatic
|
||||
val yiwen: FaceId = FaceId(32u)
|
||||
@JvmStatic
|
||||
val yun: FaceId = FaceId(34u)
|
||||
@JvmStatic
|
||||
val zhemo: FaceId = FaceId(35u)
|
||||
@JvmStatic
|
||||
val shuai: FaceId = FaceId(36u)
|
||||
@JvmStatic
|
||||
val kulou: FaceId = FaceId(37u)
|
||||
@JvmStatic
|
||||
val qiaoda: FaceId = FaceId(38u)
|
||||
@JvmStatic
|
||||
val zaijian: FaceId = FaceId(39u)
|
||||
@JvmStatic
|
||||
val fadou: FaceId = FaceId(41u)
|
||||
@JvmStatic
|
||||
val aiqing: FaceId = FaceId(42u)
|
||||
@JvmStatic
|
||||
val tiaotiao: FaceId = FaceId(43u)
|
||||
@JvmStatic
|
||||
val zhutou: FaceId = FaceId(46u)
|
||||
@JvmStatic
|
||||
val yongbao: FaceId = FaceId(49u)
|
||||
@JvmStatic
|
||||
val dan_gao: FaceId = FaceId(53u)
|
||||
@JvmStatic
|
||||
val shandian: FaceId = FaceId(54u)
|
||||
@JvmStatic
|
||||
val zhadan: FaceId = FaceId(55u)
|
||||
@JvmStatic
|
||||
val dao: FaceId = FaceId(56u)
|
||||
@JvmStatic
|
||||
val zuqiu: FaceId = FaceId(57u)
|
||||
@JvmStatic
|
||||
val bianbian: FaceId = FaceId(59u)
|
||||
@JvmStatic
|
||||
val kafei: FaceId = FaceId(60u)
|
||||
@JvmStatic
|
||||
val fan: FaceId = FaceId(61u)
|
||||
@JvmStatic
|
||||
val meigui: FaceId = FaceId(63u)
|
||||
@JvmStatic
|
||||
val diaoxie: FaceId = FaceId(64u)
|
||||
@JvmStatic
|
||||
val aixin: FaceId = FaceId(66u)
|
||||
@JvmStatic
|
||||
val xinsui: FaceId = FaceId(67u)
|
||||
@JvmStatic
|
||||
val liwu: FaceId = FaceId(69u)
|
||||
@JvmStatic
|
||||
val taiyang: FaceId = FaceId(74u)
|
||||
@JvmStatic
|
||||
val yueliang: FaceId = FaceId(75u)
|
||||
@JvmStatic
|
||||
val qiang: FaceId = FaceId(76u)
|
||||
@JvmStatic
|
||||
val ruo: FaceId = FaceId(77u)
|
||||
@JvmStatic
|
||||
val woshou: FaceId = FaceId(78u)
|
||||
@JvmStatic
|
||||
val shengli: FaceId = FaceId(79u)
|
||||
@JvmStatic
|
||||
val feiwen: FaceId = FaceId(85u)
|
||||
@JvmStatic
|
||||
val naohuo: FaceId = FaceId(86u)
|
||||
@JvmStatic
|
||||
val xigua: FaceId = FaceId(89u)
|
||||
@JvmStatic
|
||||
val lenghan: FaceId = FaceId(96u)
|
||||
@JvmStatic
|
||||
val cahan: FaceId = FaceId(97u)
|
||||
@JvmStatic
|
||||
val koubi: FaceId = FaceId(98u)
|
||||
@JvmStatic
|
||||
val guzhang: FaceId = FaceId(99u)
|
||||
@JvmStatic
|
||||
val qiudale: FaceId = FaceId(100u)
|
||||
@JvmStatic
|
||||
val huaixiao: FaceId = FaceId(101u)
|
||||
@JvmStatic
|
||||
val zuohengheng: FaceId = FaceId(102u)
|
||||
@JvmStatic
|
||||
val youhengheng: FaceId = FaceId(103u)
|
||||
@JvmStatic
|
||||
val haqian: FaceId = FaceId(104u)
|
||||
@JvmStatic
|
||||
val bishi: FaceId = FaceId(105u)
|
||||
@JvmStatic
|
||||
val weiqu: FaceId = FaceId(106u)
|
||||
@JvmStatic
|
||||
val kuaikule: FaceId = FaceId(107u)
|
||||
@JvmStatic
|
||||
val yinxian: FaceId = FaceId(108u)
|
||||
@JvmStatic
|
||||
val qinqin: FaceId = FaceId(109u)
|
||||
@JvmStatic
|
||||
val xia: FaceId = FaceId(110u)
|
||||
@JvmStatic
|
||||
val kelian: FaceId = FaceId(111u)
|
||||
@JvmStatic
|
||||
val caidao: FaceId = FaceId(112u)
|
||||
@JvmStatic
|
||||
val pijiu: FaceId = FaceId(113u)
|
||||
@JvmStatic
|
||||
val lanqiu: FaceId = FaceId(114u)
|
||||
@JvmStatic
|
||||
val pingpang: FaceId = FaceId(115u)
|
||||
@JvmStatic
|
||||
val shiai: FaceId = FaceId(116u)
|
||||
@JvmStatic
|
||||
val piaochong: FaceId = FaceId(117u)
|
||||
@JvmStatic
|
||||
val baoquan: FaceId = FaceId(118u)
|
||||
@JvmStatic
|
||||
val gouyin: FaceId = FaceId(119u)
|
||||
@JvmStatic
|
||||
val quantou: FaceId = FaceId(120u)
|
||||
@JvmStatic
|
||||
val chajin: FaceId = FaceId(121u)
|
||||
@JvmStatic
|
||||
val aini: FaceId = FaceId(122u)
|
||||
@JvmStatic
|
||||
val bu: FaceId = FaceId(123u)
|
||||
@JvmStatic
|
||||
val hao: FaceId = FaceId(124u)
|
||||
@JvmStatic
|
||||
val zhuanquan: FaceId = FaceId(125u)
|
||||
@JvmStatic
|
||||
val ketou: FaceId = FaceId(126u)
|
||||
@JvmStatic
|
||||
val huitou: FaceId = FaceId(127u)
|
||||
@JvmStatic
|
||||
val tiaosheng: FaceId = FaceId(128u)
|
||||
@JvmStatic
|
||||
val huishou: FaceId = FaceId(129u)
|
||||
@JvmStatic
|
||||
val jidong: FaceId = FaceId(130u)
|
||||
@JvmStatic
|
||||
val jiewu: FaceId = FaceId(131u)
|
||||
@JvmStatic
|
||||
val xianwen: FaceId = FaceId(132u)
|
||||
@JvmStatic
|
||||
val zuotaiji: FaceId = FaceId(133u)
|
||||
@JvmStatic
|
||||
val youtaiji: FaceId = FaceId(134u)
|
||||
@JvmStatic
|
||||
val shuangxi: FaceId = FaceId(136u)
|
||||
@JvmStatic
|
||||
val bianpao: FaceId = FaceId(137u)
|
||||
@JvmStatic
|
||||
val denglong: FaceId = FaceId(138u)
|
||||
@JvmStatic
|
||||
val facai: FaceId = FaceId(139u)
|
||||
@JvmStatic
|
||||
val K_ge: FaceId = FaceId(140u)
|
||||
@JvmStatic
|
||||
val gouwu: FaceId = FaceId(141u)
|
||||
@JvmStatic
|
||||
val youjian: FaceId = FaceId(142u)
|
||||
@JvmStatic
|
||||
val shuai_qi: FaceId = FaceId(143u)
|
||||
@JvmStatic
|
||||
val hecai: FaceId = FaceId(144u)
|
||||
@JvmStatic
|
||||
val qidao: FaceId = FaceId(145u)
|
||||
@JvmStatic
|
||||
val baojin: FaceId = FaceId(146u)
|
||||
@JvmStatic
|
||||
val bangbangtang: FaceId = FaceId(147u)
|
||||
@JvmStatic
|
||||
val he_nai: FaceId = FaceId(148u)
|
||||
@JvmStatic
|
||||
val xiamian: FaceId = FaceId(149u)
|
||||
@JvmStatic
|
||||
val xiangjiao: FaceId = FaceId(150u)
|
||||
@JvmStatic
|
||||
val feiji: FaceId = FaceId(151u)
|
||||
@JvmStatic
|
||||
val kaiche: FaceId = FaceId(152u)
|
||||
@JvmStatic
|
||||
val gaotiezuochetou: FaceId = FaceId(153u)
|
||||
@JvmStatic
|
||||
val chexiang: FaceId = FaceId(154u)
|
||||
@JvmStatic
|
||||
val gaotieyouchetou: FaceId = FaceId(155u)
|
||||
@JvmStatic
|
||||
val duoyun: FaceId = FaceId(156u)
|
||||
@JvmStatic
|
||||
val xiayu: FaceId = FaceId(157u)
|
||||
@JvmStatic
|
||||
val chaopiao: FaceId = FaceId(158u)
|
||||
@JvmStatic
|
||||
val xiongmao: FaceId = FaceId(159u)
|
||||
@JvmStatic
|
||||
val dengpao: FaceId = FaceId(160u)
|
||||
@JvmStatic
|
||||
val fengche: FaceId = FaceId(161u)
|
||||
@JvmStatic
|
||||
val naozhong: FaceId = FaceId(162u)
|
||||
@JvmStatic
|
||||
val dasan: FaceId = FaceId(163u)
|
||||
@JvmStatic
|
||||
val caiqiu: FaceId = FaceId(164u)
|
||||
@JvmStatic
|
||||
val zuanjie: FaceId = FaceId(165u)
|
||||
@JvmStatic
|
||||
val shafa: FaceId = FaceId(166u)
|
||||
@JvmStatic
|
||||
val zhijin: FaceId = FaceId(167u)
|
||||
@JvmStatic
|
||||
val yao: FaceId = FaceId(168u)
|
||||
@JvmStatic
|
||||
val shouqiang: FaceId = FaceId(169u)
|
||||
@JvmStatic
|
||||
val qingwa: FaceId = FaceId(170u)
|
||||
}
|
||||
|
||||
override fun toString(): String = "$FaceId($value)"
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ inline class At(val targetQQ: UInt) : Message {
|
||||
/**
|
||||
* QQ 自带表情
|
||||
*/
|
||||
inline class Face(val id: FaceID) : Message {
|
||||
inline class Face(val id: FaceId) : Message {
|
||||
override val stringValue: String get() = "[face${id.value}]"
|
||||
override fun toString(): String = stringValue
|
||||
|
||||
|
@ -11,7 +11,7 @@ internal fun IoBuffer.parseMessageFace(): Face {
|
||||
//00 01 0C 0B 00 08 00 01 00 04 52 CC F5 D0 FF 00 02 14 4D
|
||||
discardExact(1)
|
||||
|
||||
val id1 = FaceID.ofId(readLVNumber().toInt().toUByte())//可能这个是id, 也可能下面那个
|
||||
val id1 = FaceId(readLVNumber().toInt().toUByte())//可能这个是id, 也可能下面那个
|
||||
discardExact(readByte().toLong()) // -1
|
||||
readLVNumber()//某id?
|
||||
return Face(id1)
|
||||
|
Loading…
Reference in New Issue
Block a user