Gacha System implementation #1
2 changed files with 15 additions and 1 deletions
|
@ -7,11 +7,19 @@ use rand::{thread_rng, Rng};
|
|||
use std::collections::{HashMap, HashSet};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct GachaModel {
|
||||
pub gacha_bin: GachaModelBin,
|
||||
}
|
||||
|
||||
impl Default for GachaModel {
|
||||
fn default() -> GachaModel {
|
||||
let result = GachaModel {
|
||||
gacha_bin: GachaModelBin::default(),
|
||||
};
|
||||
result.post_deserialize()
|
||||
}
|
||||
}
|
||||
|
||||
impl GachaModel {
|
||||
pub fn from_bin(gacha_bin: GachaModelBin) -> Self {
|
||||
let result = Self { gacha_bin };
|
||||
|
|
|
@ -62,6 +62,12 @@ impl Player {
|
|||
.add_resource(ItemStatic::FrontendGold as u32, 1_000_000);
|
||||
self.item_model
|
||||
.add_resource(ItemStatic::GameDiamond as u32, 1_000_000);
|
||||
self.item_model
|
||||
.add_resource(ItemStatic::GachaTicketEvent as u32, 30_000);
|
||||
self.item_model
|
||||
.add_resource(ItemStatic::GachaTicketStandard as u32, 30_000);
|
||||
self.item_model
|
||||
.add_resource(ItemStatic::GachaTicketBangboo as u32, 30_000);
|
||||
self.item_model.add_resource(ItemStatic::Energy as u32, 240);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue