added drop item function

This commit is contained in:
2025-05-04 19:18:55 -05:00
parent 63525b28ea
commit 1305481a35
2 changed files with 16 additions and 7 deletions
+2 -1
View File
@@ -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]
+13 -5
View File
@@ -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);
}
}
}