Skip to content

Commit

Permalink
fix(starrail): Occationally skip one row
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed May 9, 2024
1 parent 730e067 commit a39c151
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{cell::RefCell, ops::{Coroutine, CoroutineState}, pin::Pin, rc::Rc, sync::{mpsc::{self, Sender}}, time::SystemTime};
use std::{cell::RefCell, ops::{Coroutine, CoroutineState}, pin::Pin, rc::Rc, sync::mpsc::{self, Sender}, time::SystemTime};

use anyhow::Result;
use clap::FromArgMatches;
Expand Down
2 changes: 1 addition & 1 deletion yas-starrail/src/export/relic/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::export::relic::export_format::StarRailRelicExportFormat;

#[derive(clap::Args)]
pub struct ExportRelicConfig {
#[arg(id = "format", long = "format", short = 'f', default_value_t = StarRailRelicExportFormat::March7th, help = "输出格式")]
#[arg(id = "format", long = "format", short = 'f', default_value_t = StarRailRelicExportFormat::HSR, help = "输出格式")]
#[arg(value_enum)]
pub format: StarRailRelicExportFormat,

Expand Down
2 changes: 1 addition & 1 deletion yas-starrail/src/export/relic/export_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ pub enum StarRailRelicExportFormat {

impl Default for StarRailRelicExportFormat {
fn default() -> Self {
Self::March7th
Self::HSR
}
}
5 changes: 5 additions & 0 deletions yas-starrail/src/export/relic/hsr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::HashMap;
use std::ops::Deref;
use nanoid::nanoid;
use serde::{Serialize, Serializer};
Expand Down Expand Up @@ -178,6 +179,10 @@ impl<'a> Serialize for StarRailHSRFormat<'a> {
root.serialize_entry("relics", &self.results)?;
root.serialize_entry::<str, [usize; 0]>("characters", &[])?;

let mut metadata: HashMap<String, String> = HashMap::new();
metadata.insert(String::from("trailblazer"), String::from("Stelle"));
root.serialize_entry("metadata", &metadata);

root.end()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,6 @@ impl StarRailRepositoryScanController {

#[inline(always)]
fn estimate_scroll_length(&self, count: i32) -> i32 {
((self.avg_scroll_one_row * count as f64 - 2.0).round() as i32).max(0)
((self.avg_scroll_one_row * count as f64 - 3.0).round() as i32).max(0)
}
}

0 comments on commit a39c151

Please sign in to comment.