Added max/min float to skininfo
This commit is contained in:
18
src/skins.rs
18
src/skins.rs
@@ -26,6 +26,8 @@ pub struct SkinInfo {
|
|||||||
paint_index: i32,
|
paint_index: i32,
|
||||||
color: String,
|
color: String,
|
||||||
float: f64,
|
float: f64,
|
||||||
|
min_float: f64,
|
||||||
|
max_float: f64,
|
||||||
pattern: i32,
|
pattern: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +116,8 @@ pub async fn skin_info(
|
|||||||
struct Info {
|
struct Info {
|
||||||
id: Uuid,
|
id: Uuid,
|
||||||
float: f64,
|
float: f64,
|
||||||
|
min_float: f64,
|
||||||
|
max_float: f64,
|
||||||
pattern: i32,
|
pattern: i32,
|
||||||
team: i32,
|
team: i32,
|
||||||
name: String,
|
name: String,
|
||||||
@@ -124,10 +128,10 @@ pub async fn skin_info(
|
|||||||
}
|
}
|
||||||
let user_skin = match default.category.as_str() {
|
let user_skin = match default.category.as_str() {
|
||||||
"Gloves" | "Knives" => {
|
"Gloves" | "Knives" => {
|
||||||
query_as!(Info, "SELECT us.id, us.float, us.pattern, us.team, w.name, w.display as wd, s.display as sd, s.paint_index, r.color FROM user_skins us JOIN skins s ON us.skin_id = s.id JOIN weapons w ON s.weapon = w.id JOIN rarity r ON r.id = s.rarity WHERE us.user_id = $1 AND w.category = $2", uuid, default.category).fetch_all(&pool).await?
|
query_as!(Info, "SELECT us.id, us.float, us.pattern, us.team, w.name, w.display as wd, s.display as sd, s.paint_index, s.min_float, s.max_float, r.color FROM user_skins us JOIN skins s ON us.skin_id = s.id JOIN weapons w ON s.weapon = w.id JOIN rarity r ON r.id = s.rarity WHERE us.user_id = $1 AND w.category = $2", uuid, default.category).fetch_all(&pool).await?
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
query_as!(Info, "SELECT us.id, us.float, us.pattern, us.team, w.name, w.display as wd, s.display as sd, s.paint_index, r.color FROM user_skins us JOIN skins s ON us.skin_id = s.id JOIN weapons w ON s.weapon = w.id JOIN rarity r ON r.id = s.rarity WHERE us.user_id = $1 AND w.id = $2", uuid, default.id).fetch_all(&pool).await?
|
query_as!(Info, "SELECT us.id, us.float, us.pattern, us.team, w.name, w.display as wd, s.display as sd, s.paint_index, s.min_float, s.max_float, r.color FROM user_skins us JOIN skins s ON us.skin_id = s.id JOIN weapons w ON s.weapon = w.id JOIN rarity r ON r.id = s.rarity WHERE us.user_id = $1 AND w.id = $2", uuid, default.id).fetch_all(&pool).await?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let user_skin = if let Some(team) = info_query.team {
|
let user_skin = if let Some(team) = info_query.team {
|
||||||
@@ -138,6 +142,8 @@ pub async fn skin_info(
|
|||||||
.unwrap_or(Info {
|
.unwrap_or(Info {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
float: 0.0,
|
float: 0.0,
|
||||||
|
min_float: 0.0,
|
||||||
|
max_float: 1.0,
|
||||||
pattern: 0,
|
pattern: 0,
|
||||||
team: 2,
|
team: 2,
|
||||||
name: default.name,
|
name: default.name,
|
||||||
@@ -153,6 +159,8 @@ pub async fn skin_info(
|
|||||||
.unwrap_or(Info {
|
.unwrap_or(Info {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
float: 0.0,
|
float: 0.0,
|
||||||
|
min_float: 0.0,
|
||||||
|
max_float: 1.0,
|
||||||
pattern: 0,
|
pattern: 0,
|
||||||
team: 2,
|
team: 2,
|
||||||
name: default.name,
|
name: default.name,
|
||||||
@@ -174,6 +182,8 @@ pub async fn skin_info(
|
|||||||
paint_index: user_skin.paint_index,
|
paint_index: user_skin.paint_index,
|
||||||
color: user_skin.color,
|
color: user_skin.color,
|
||||||
float: user_skin.float,
|
float: user_skin.float,
|
||||||
|
min_float: user_skin.min_float,
|
||||||
|
max_float: user_skin.max_float,
|
||||||
pattern: user_skin.pattern,
|
pattern: user_skin.pattern,
|
||||||
};
|
};
|
||||||
skin_infos.push(info);
|
skin_infos.push(info);
|
||||||
@@ -205,6 +215,8 @@ pub async fn agent_info(
|
|||||||
paint_index: 0,
|
paint_index: 0,
|
||||||
color: agent.color,
|
color: agent.color,
|
||||||
float: 0.0,
|
float: 0.0,
|
||||||
|
min_float: 0.0,
|
||||||
|
max_float: 0.0,
|
||||||
pattern: 0,
|
pattern: 0,
|
||||||
})),
|
})),
|
||||||
None => {
|
None => {
|
||||||
@@ -216,6 +228,8 @@ pub async fn agent_info(
|
|||||||
paint_index: 0,
|
paint_index: 0,
|
||||||
color: default.color,
|
color: default.color,
|
||||||
float: 0.0,
|
float: 0.0,
|
||||||
|
min_float: 0.0,
|
||||||
|
max_float: 0.0,
|
||||||
pattern: 0,
|
pattern: 0,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user