Skip to content

Commit

Permalink
✨ Add CalculatorConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
luoshuijs committed Oct 25, 2023
1 parent e4283ad commit 0625e07
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
30 changes: 30 additions & 0 deletions character.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from typing import List

from python_genshin_artifact.assets import Assets

assets = Assets()

character = assets.character.get("Yelan")
locale = assets.locale.get("zh-cn")

print(f"name {locale[character.get('name_locale')]}")

for skill_map1 in character.get("skill_map1"):
index = skill_map1.get("index")
locale_index = skill_map1.get("locale_index")
print(f"skill_map1 index {index} locale {locale[locale_index]}")


for skill_map2 in character.get("skill_map2"):
index = skill_map2.get("index")
locale_index = skill_map2.get("locale_index")
print(f"skill_map2 index {index} locale {locale[locale_index]}")

for skill_map3 in character.get("skill_map3"):
index = skill_map3.get("index")
locale_index = skill_map3.get("locale_index")
print(f"skill_map3 index {index} locale {locale[locale_index]}")

print(locale.index("夜兰"))


33 changes: 4 additions & 29 deletions python_genshin_artifact_core/src/applications/input/calculator.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
use mona::artifacts::Artifact;
use mona::artifacts::effect_config::ArtifactConfigInterface;
use mona_wasm::applications::common::{BuffInterface, CharacterInterface, EnemyInterface, SkillInterface, WeaponInterface};
use pyo3::prelude::*;
use crate::applications::input::common::PyCharacterInterface;

#[derive(Debug, Clone)]
#[pyclass]
pub struct CalculatorConfig {
pub character: CharacterInterface,
// pub weapon: WeaponInterface,
// pub buffs: Vec<BuffInterface>,
// pub artifacts: Vec<Artifact>,
// pub artifact_config: Option<ArtifactConfigInterface>,
// pub skill: SkillInterface,
// pub enemy: Option<EnemyInterface>,
pub character: PyCharacterInterface,
}

#[pymethods]
impl CalculatorConfig {
#[new]
// #[args(buffs="Vec::new()", artifacts="Vec::new()", artifact_config="None", enemy="None")]
fn new(character: CharacterInterface,
// weapon: WeaponInterface,
// buffs: Vec<BuffInterface>,
// artifacts: Vec<Artifact>,
// artifact_config: Option<ArtifactConfigInterface>,
// skill: SkillInterface,
// enemy: Option<EnemyInterface>,
) -> Self {
CalculatorConfig {
character,
// weapon,
// buffs,
// artifacts,
// artifact_config,
// skill,
// enemy,
}
pub fn py_new( character: PyCharacterInterface) -> PyResult<Self> {
Ok(Self {character})
}
}
3 changes: 1 addition & 2 deletions python_genshin_artifact_core/src/applications/input/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod calculator;
pub mod common;
pub mod character;
pub mod common;
2 changes: 1 addition & 1 deletion python_genshin_artifact_core/src/applications/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod generate;
pub mod wasm;
pub mod input;
pub mod input;

0 comments on commit 0625e07

Please sign in to comment.