Added differienciation for gloves when fetching paint_indexes
This commit is contained in:
@@ -260,7 +260,8 @@ pub struct PaintIndexInfo {
|
|||||||
pub struct PaintQuery {
|
pub struct PaintQuery {
|
||||||
weapon: Uuid,
|
weapon: Uuid,
|
||||||
team: Teams,
|
team: Teams,
|
||||||
agent: Option<bool>
|
agent: Option<bool>,
|
||||||
|
gloves: Option<bool>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn list_paint_index(
|
pub async fn list_paint_index(
|
||||||
@@ -271,6 +272,10 @@ pub async fn list_paint_index(
|
|||||||
Some(agent) => agent,
|
Some(agent) => agent,
|
||||||
None => false
|
None => false
|
||||||
};
|
};
|
||||||
|
let gloves = match paint_query.gloves {
|
||||||
|
Some(gloves) => gloves,
|
||||||
|
None => false
|
||||||
|
};
|
||||||
let paints = if agent {
|
let paints = if agent {
|
||||||
let values = query!("SELECT a.name, a.def_index, a.display, r.color FROM agents a JOIN rarity r ON r.id = a.rarity WHERE a.team=$1", paint_query.team.as_i32()).fetch_all(&pool).await?;
|
let values = query!("SELECT a.name, a.def_index, a.display, r.color FROM agents a JOIN rarity r ON r.id = a.rarity WHERE a.team=$1", paint_query.team.as_i32()).fetch_all(&pool).await?;
|
||||||
values.into_iter().map(|x| PaintIndexInfo {
|
values.into_iter().map(|x| PaintIndexInfo {
|
||||||
@@ -281,6 +286,8 @@ pub async fn list_paint_index(
|
|||||||
min_float: 0.0,
|
min_float: 0.0,
|
||||||
max_float: 0.0
|
max_float: 0.0
|
||||||
}).collect()
|
}).collect()
|
||||||
|
} else if gloves {
|
||||||
|
query_as!(PaintIndexInfo, "SELECT w.name, s.paint_index, s.display, r.color, s.min_float, s.max_float FROM skins s JOIN rarity r ON r.id = s.rarity JOIN weapons w ON w.id = s.weapon WHERE w.category='Gloves'").fetch_all(&pool).await?
|
||||||
} else {
|
} else {
|
||||||
query_as!(PaintIndexInfo, "SELECT w.name, s.paint_index, s.display, r.color, s.min_float, s.max_float FROM skins s JOIN rarity r ON r.id = s.rarity JOIN weapons w ON w.id = s.weapon WHERE s.weapon=$1", paint_query.weapon).fetch_all(&pool).await?
|
query_as!(PaintIndexInfo, "SELECT w.name, s.paint_index, s.display, r.color, s.min_float, s.max_float FROM skins s JOIN rarity r ON r.id = s.rarity JOIN weapons w ON w.id = s.weapon WHERE s.weapon=$1", paint_query.weapon).fetch_all(&pool).await?
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user