Drop the champ select helpers the text view used (#74)
ChampSelect::remaining and current_row only served the text champ select view that #74 removed. The follow test now looks the current pick up in the statistics rows and builds the pickable, not Completed set from can_pick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a457a19fe5
commit
28d86d48b7
2 files changed
+10
-15
No files matched your search
@@ -4,9 +4,9 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::ClientError;
|
||||
use crate::client::Gameflow;
|
||||
use crate::league_client::{lock, parse};
|
||||
use crate::{ChampionRow, ChampionState, ClientError};
|
||||
|
||||
pub(crate) const PICKABLE_EVENT: &str = "OnJsonApiEvent_lol-champ-select_v1_pickable-champion-ids";
|
||||
pub(crate) const DISABLED_EVENT: &str = "OnJsonApiEvent_lol-champ-select_v1_disabled-champion-ids";
|
||||
@@ -143,11 +143,6 @@ impl ChampSelect {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn current_row<'a>(&self, rows: &'a [ChampionRow]) -> Option<&'a ChampionRow> {
|
||||
let id = self.current?;
|
||||
rows.iter().find(|r| r.champion.id == id)
|
||||
}
|
||||
|
||||
/// Whether the local player can still pick this champion. Their own pick always stays
|
||||
/// pickable.
|
||||
pub fn can_pick(&self, id: u32) -> bool {
|
||||
@@ -179,13 +174,6 @@ impl ChampSelect {
|
||||
&& self.banned == other.banned
|
||||
&& self.taken_by_ally == other.taken_by_ally
|
||||
}
|
||||
|
||||
/// A champion still to complete in the Challenge and pickable in this champ select. The
|
||||
/// player's own hovered or locked champion stays in the list while not Completed: they can
|
||||
/// pick it.
|
||||
pub fn remaining(&self, row: &ChampionRow) -> bool {
|
||||
row.state.is_some_and(|s| s != ChampionState::Completed) && self.can_pick(row.champion.id)
|
||||
}
|
||||
}
|
||||
|
||||
/// The live champ select, read the one way both the real client and the tests read it: the
|
||||
|
||||
Reference in new issue
Block a user