added drop item function
This commit is contained in:
+2
-1
@@ -10,7 +10,8 @@ image = "0.24.7" # Image processing
|
|||||||
walkdir = "2.4.0" # Directory traversal
|
walkdir = "2.4.0" # Directory traversal
|
||||||
global-hotkey = "0.4.2" # Global hotkey registration
|
global-hotkey = "0.4.2" # Global hotkey registration
|
||||||
lazy_static = "1.4.0" # Thread-safe static initialization
|
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
|
# Platform-specific dependencies
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
|||||||
+14
-6
@@ -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 {
|
pub struct Steam {
|
||||||
client: Client,
|
client: Client,
|
||||||
single: SingleClient
|
single: SingleClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Steam {
|
impl Steam {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let (client, single) = Client::init_app(AppId(1430270)).unwrap();
|
let (client, single) = Client::init_app(AppId(1430270)).unwrap();
|
||||||
Self {
|
Self { client, single }
|
||||||
client, single
|
}
|
||||||
|
|
||||||
|
pub fn drop_item(&self) {
|
||||||
|
unsafe {
|
||||||
|
let mut r = 0;
|
||||||
|
SteamAPI_ISteamInventory_TriggerItemDrop(SteamAPI_SteamInventory_v003(), &mut r, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user