Align AVA2 Windows behavior and improve mobile touch interactions
This commit is contained in:
@@ -120,6 +120,31 @@ Bytes whisper(const std::string& name, const std::string& text) {
|
||||
return out;
|
||||
}
|
||||
|
||||
Bytes mobile_message(const std::string& name,const std::string& text) {
|
||||
// AVA2 TPacketCGSMS: BYTE + WORD + char[25], followed by NUL text.
|
||||
if(text.size()>65535-29) return {}; // Do not emit a wrapped WORD frame.
|
||||
Bytes out{HEADER_CG_SMS};u16(out,static_cast<std::uint16_t>(29+text.size()));
|
||||
char recipient[25]{};std::strncpy(recipient,name.c_str(),24);
|
||||
out.insert(out.end(),recipient,recipient+25);
|
||||
out.insert(out.end(),text.begin(),text.end());out.push_back(0);return out;
|
||||
}
|
||||
Bytes attribute67(int material,int support,int support_pos,int item_pos) {
|
||||
Bytes out{HEADER_CG_67_ATTR,uint8_t(material),uint8_t(support)};
|
||||
u16(out,uint16_t(support_pos));u16(out,uint16_t(item_pos));return out;
|
||||
}
|
||||
Bytes calendar(uint8_t subheader,int day,int event,const std::string& start,const std::string& end) {
|
||||
Bytes out{HEADER_CG_CALENDAR_SYSTEM,subheader};
|
||||
u32(out,uint32_t(day));u32(out,uint32_t(event));
|
||||
for(const auto& text:{start,end}) {
|
||||
char value[6]{};std::strncpy(value,text.c_str(),6);out.insert(out.end(),value,value+6);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Bytes catch_king(uint8_t subheader,int argument) {
|
||||
Bytes out{HEADER_CG_MINI_GAME_CATCH_KING,uint8_t(subheader==0||subheader==2?5:4),0,subheader};
|
||||
if(subheader==0 || subheader==2)out.push_back(uint8_t(argument));return out;
|
||||
}
|
||||
|
||||
Bytes entergame(std::uint8_t language) {
|
||||
return {HEADER_CG_ENTERGAME, language};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user