Skip to content

Commit

Permalink
fix the blackjack cheating scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
JayAgra committed Apr 1, 2024
1 parent ed71c2a commit 9d52788
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F51BC0B42BB71AF5009587C1"
BuildableName = "stickers.app"
BlueprintIdentifier = "F51BC0B72BB71AF5009587C1"
BuildableName = "stickers.appex"
BlueprintName = "stickers"
ReferencedContainer = "container:bearTracks.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -67,15 +67,6 @@
ReferencedContainer = "container:bearTracks.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F51BC0B42BB71AF5009587C1"
BuildableName = "stickers.app"
BlueprintName = "stickers"
ReferencedContainer = "container:bearTracks.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -89,8 +80,8 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F51BC0B42BB71AF5009587C1"
BuildableName = "stickers.app"
BlueprintIdentifier = "F51BC0B72BB71AF5009587C1"
BuildableName = "stickers.appex"
BlueprintName = "stickers"
ReferencedContainer = "container:bearTracks.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion ios/beartracks/beartracks-scout/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct LoginView: View {
} else {
if httpResponse.statusCode == 400 {
alertMessage =
"you supplied some data the server didn't like very much. your username, full name, and/or password contained characters other than a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ [ _ ] { } | ? . ,"
"you supplied some data the server didn't like very much. your username, full name, and/or password contained characters other than a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ { } | ? . ,"
} else if httpResponse.statusCode == 409 {
alertMessage = "username taken"
} else if httpResponse.statusCode == 403 {
Expand Down
22 changes: 9 additions & 13 deletions src/casino.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,40 +333,30 @@ impl BlackjackSession {
// if player busts
if self.game.player.score > 21 {
result = "LB".to_string();
tokio::spawn(async move {
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, -10)
.await
.unwrap_or("bad".to_string());
});
// if dealer busts
} else if self.game.dealer.score > 21 {
result = "WD".to_string();
tokio::spawn(async move {
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10)
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 20)
.await
.unwrap_or("bad".to_string());
});
// if player score is more than dealer score
} else if self.game.player.score > self.game.dealer.score {
result = "WN".to_string();
tokio::spawn(async move {
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10)
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 20)
.await
.unwrap_or("bad".to_string());
});
// if dealer score is more than player score
} else if self.game.player.score < self.game.dealer.score {
result = "LS".to_string();
tokio::spawn(async move {
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, -10)
.await
.unwrap_or("bad".to_string());
});
// draw
} else {
result = "DR".to_string();
tokio::spawn(async move {
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 0)
credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10)
.await
.unwrap_or("bad".to_string());
});
Expand Down Expand Up @@ -415,6 +405,12 @@ fn credit_points_run(

// websocket route
pub async fn websocket_route(req: HttpRequest, stream: web::Payload, db: web::Data<Databases>, user: db_auth::User) -> Result<HttpResponse, Error> {
let db_clones = db.clone();

credit_points(db_clones.auth.clone(), db_clones.transact.clone(), user.id.clone(), -10)
.await
.unwrap_or("bad".to_string());

// start websocket connection with clean game state
ws::start(
BlackjackSession {
Expand Down
2 changes: 1 addition & 1 deletion static/public/js/create/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function uploadForm() {
.then(async (response) => {
switch (response.status) {
case "you_sketchy_motherfucker": {
errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ [ _ ] { } | ? . ,";
errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ { } | ? . ,";
errorReload();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion static/public/js/create/create.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/public/js/create/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function uploadForm() {
.then(async (response: { status: String }) => {
switch (response.status) {
case "you_sketchy_motherfucker": {
errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ [ _ ] { } | ? . ,";
errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ { } | ? . ,";
errorReload();
break;
}
Expand Down

0 comments on commit 9d52788

Please sign in to comment.