1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Loot system plugin
//!
//! Generic loot and drop system with rarity tiers and drop rate calculations.
//!
//! # Overview
//!
//! The loot plugin provides a foundation for implementing item drops in games:
//! - 5-tier rarity system (Common → Legendary)
//! - Weighted random rarity selection
//! - Drop rate calculations with multipliers
//! - Event-driven loot generation
//! - Customizable loot tables via hooks
//!
//! # Usage Example
//!
//! ```ignore
//! use issun::prelude::*;
//! use issun::plugin::loot::{LootPlugin, LootHook, Rarity};
//!
//! // Custom loot hook
//! struct MyLootHook;
//!
//! #[async_trait]
//! impl LootHook for MyLootHook {
//! async fn generate_loot(
//! &self,
//! source_id: &str,
//! rarity: Rarity,
//! resources: &ResourceContext,
//! ) -> Vec<String> {
//! // Return items based on source and rarity
//! vec![]
//! }
//! }
//!
//! let game = GameBuilder::new()
//! .with_plugin(LootPlugin::new().with_hook(MyLootHook))
//! .build()
//! .await?;
//!
//! // Generate loot via events
//! bus.publish(LootGenerateRequested {
//! source_id: "goblin_1".to_string(),
//! drop_rate: 0.5,
//! });
//! ```
pub use LootConfig;
pub use *;
pub use ;
pub use LootPlugin;
pub use LootService;
pub use LootSystem;
pub use ;