Skip to content

Commit

Permalink
allow users to change the timeouts of backend and anti-afk
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Oct 25, 2024
1 parent c0728ac commit 10d91ac
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bf-seeder"
description = ""
version = "0.3.5"
version = "0.3.8"
edition = "2018"
authors = ["iiTzArcur <[email protected]>"]
default-run = "bf-seeder"
Expand Down
8 changes: 7 additions & 1 deletion build/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ message_timeout_mins = 8
# Which game you want to use the script for (Bf1 or Bf4) (dont forget the Capital B in the game name)
game = 'Bf1'
# Which launcher it needs to use to start the game (EADesktop, Origin or Steam) (dont forget the Capital in the launcher name)
game = 'EADesktop'
launcher = 'EADesktop'
# Which backend it has to use to request seeding info
endpoint = "https://manager-api.gametools.network"
# time between anti-afk actions, to keep the bot within the server
anti_afk_timeout_secs = 120
# time between backend checks, for new commands to follow
backend_check_timeout_secs = 10
8 changes: 5 additions & 3 deletions config.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group_id = 'aac4c3fa-8a72-11ec-80d7-0a58a9feac02'
game_location = 'C:\Program Files (x86)\Steam\steamapps\common\Battlefield 1\bf1.exe'
group_id = "80aa1f90-03af-11ee-a011-02420a0009e7"
game_location = 'C:\Program Files (x86)\Steam\steamapps\common\Battlefield 1\\bf1.exe'
link2ea_location = 'C:\Program Files\Electronic Arts\EA Desktop\EA Desktop\Link2EA.exe'
hostname = "JOBSE-PC"
hostname = "jobse-pc"
allow_shutdown = false
send_messages = false
usable_client = true
Expand All @@ -14,3 +14,5 @@ message_timeout_mins = 8
game = "Bf1"
launcher = "Steam"
endpoint = "https://manager-api.gametools.network"
anti_afk_timeout_secs = 120
backend_check_timeout_secs = 10
2 changes: 2 additions & 0 deletions src/ea_desktop_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ fn main() {
game: structs::Games::from("bf1"),
launcher: structs::Launchers::from("ea_desktop"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
cfg.game_location = actions::game::find_game(&cfg);
cfg.link2ea_location = actions::launchers::find_link2ea();
Expand Down
2 changes: 1 addition & 1 deletion src/functions/anti_afk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ pub fn start(
message_timeout.store(timeout + 1, atomic::Ordering::Relaxed);
}
}
sleep(Duration::from_secs(120));
sleep(Duration::from_secs(cfg.anti_afk_timeout_secs));
}
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ fn main() {
game: structs::Games::from("bf1"),
launcher: structs::Launchers::from("ea_desktop"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
cfg.game_location = actions::game::find_game(&cfg);
cfg.link2ea_location = actions::launchers::find_link2ea();
Expand Down Expand Up @@ -165,6 +167,6 @@ fn main() {
log::info!("reconnecting...");
}
}
sleep(Duration::from_secs(10));
sleep(Duration::from_secs(cfg.backend_check_timeout_secs));
}
}
2 changes: 2 additions & 0 deletions src/message_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ fn main() {
game: structs::Games::from("bf1"),
launcher: structs::Launchers::from("steam"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
let message_running = Arc::new(atomic::AtomicU32::new(1));

Expand Down
2 changes: 2 additions & 0 deletions src/origin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ fn main() {
game: structs::Games::from("bf1"),
launcher: structs::Launchers::from("origin"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
cfg.game_location = actions::game::find_game(&cfg);
cfg.link2ea_location = actions::launchers::find_link2ea();
Expand Down
4 changes: 3 additions & 1 deletion src/steam_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ fn main() {
game: structs::Games::from("bf1"),
launcher: structs::Launchers::from("steam"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
cfg.game_location = actions::game::find_game(&cfg);
cfg.link2ea_location = actions::launchers::find_link2ea();
log::info!("{}", cfg.link2ea_location);
log::info!("{}", cfg.game_location);

actions::launchers::launch_game_steam(&cfg, "9654489130726", "soldier");
actions::launchers::launch_game_steam(&cfg, "9654542690814", "soldier");
}
4 changes: 4 additions & 0 deletions src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct SeederConfig {
pub game: Games,
pub launcher: Launchers,
pub endpoint: String,
pub anti_afk_timeout_secs: u64,
pub backend_check_timeout_secs: u64,
}

#[derive(Deserialize, PartialEq, Eq, Clone, Debug)]
Expand Down Expand Up @@ -77,6 +79,8 @@ impl ::std::default::Default for SeederConfig {
game: Games::from("bf1"),
launcher: Launchers::from("ea_desktop"),
endpoint: "https://manager-api.gametools.network".into(),
anti_afk_timeout_secs: 120,
backend_check_timeout_secs: 10,
};
cfg.game_location = actions::game::find_game(&cfg);
cfg.link2ea_location = actions::launchers::find_link2ea();
Expand Down

0 comments on commit 10d91ac

Please sign in to comment.