From b6aa5b2cb3860cf17ebb2b94641a7b1a6b8a431a Mon Sep 17 00:00:00 2001 From: Zefanja Jobse Date: Tue, 6 Jun 2023 11:49:52 +0200 Subject: [PATCH] add public chat of bf2042 --- Readme.md | 4 ++-- src/actions.rs | 11 ++++++++++- src/structs.rs | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 00f1dfd..c96dae7 100644 --- a/Readme.md +++ b/Readme.md @@ -18,8 +18,8 @@ messages = [ 'test2', 'test3', ] -# In which chat it has to send the messages (can be 'Public', 'Team' or 'Squad') -# The 'Public' chat can only be used by the server owner in Battlefield 2042! +# In which chat it has to send the messages (can be 'Announce', 'Public', 'Team' or 'Squad') +# The 'Announce' chat can only be used by the server owner in Battlefield 2042, on older titles it will use public chat when selected. chat_type = 'Public' # When it will start sending messages, based on the UTC timezone message_start_time_utc = '12:00' diff --git a/src/actions.rs b/src/actions.rs index 28ea4b5..a2d808e 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -118,13 +118,22 @@ pub fn send_message( sleep(Duration::from_millis(1808)); match cfg.chat_type { - structs::ChatType::Public => { + structs::ChatType::Announce => { if game_name == "Battlefield™ 2042" { bf2042_message_action(current_message); } else { message_action(current_message, 0x24); } } + structs::ChatType::Public => { + if game_name == "Battlefield™ 2042" { + send_keys::key_enter(0x26, 50); + sleep(Duration::from_secs(1)); + message_action(current_message, 0x0F); + } else { + message_action(current_message, 0x24); + } + } structs::ChatType::Team => message_action(current_message, 0x25), structs::ChatType::Squad => message_action(current_message, 0x26), } diff --git a/src/structs.rs b/src/structs.rs index c72fa1c..7bbb598 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -3,6 +3,7 @@ use winapi::shared::windef::HWND__; #[derive(Serialize, Deserialize, Clone)] pub enum ChatType { + Announce, Public, Team, Squad,