From 1305481a352534f85d821bc7153355fb874d97ff Mon Sep 17 00:00:00 2001 From: jcweaver997 Date: Sun, 4 May 2025 19:18:55 -0500 Subject: [PATCH] added drop item function --- Cargo.toml | 3 ++- src/steam.rs | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0e93b9e..d185baa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,8 @@ image = "0.24.7" # Image processing walkdir = "2.4.0" # Directory traversal global-hotkey = "0.4.2" # Global hotkey registration lazy_static = "1.4.0" # Thread-safe static initialization -steamworks = "0.11.0" +steamworks = { version = "0.11.0", features = ["raw-bindings"] } +anyhow = "1.0.98" # Platform-specific dependencies [target.'cfg(windows)'.dependencies] diff --git a/src/steam.rs b/src/steam.rs index 847f0b5..ffb3467 100644 --- a/src/steam.rs +++ b/src/steam.rs @@ -1,16 +1,24 @@ -use steamworks::{AppId, Client, SingleClient}; - +use steamworks::{ + sys::{SteamAPI_ISteamInventory_TriggerItemDrop, SteamAPI_SteamInventory_v003}, + AppId, Client, SingleClient, +}; +#[allow(dead_code)] pub struct Steam { client: Client, - single: SingleClient + single: SingleClient, } impl Steam { pub fn new() -> Self { let (client, single) = Client::init_app(AppId(1430270)).unwrap(); - Self { - client, single + Self { client, single } + } + + pub fn drop_item(&self) { + unsafe { + let mut r = 0; + SteamAPI_ISteamInventory_TriggerItemDrop(SteamAPI_SteamInventory_v003(), &mut r, 1); } } -} \ No newline at end of file +}