From 2e2e44566df888219f321b3f0e38e908eb622679 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 18 Oct 2022 17:43:19 -0500 Subject: [PATCH] Revert item action bar --- scripts/client/item.js | 4 ++-- scripts/server/casino.js | 42 +++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/scripts/client/item.js b/scripts/client/item.js index 30eb6fdb..6513adb9 100644 --- a/scripts/client/item.js +++ b/scripts/client/item.js @@ -11,8 +11,8 @@ let itemActionDelayDuration = 0; let itemActionDelayStart = 0; let itemActionDelayEnabled = false; -let itemActionDelayPosition = toVector2(0, game.height - 10); -let itemActionDelaySize = toVector2(game.width, 10); +let itemActionDelayPosition = toVector2(game.width / 2 - 100, game.height - 10); +let itemActionDelaySize = toVector2(200, 5); // =========================================================================== diff --git a/scripts/server/casino.js b/scripts/server/casino.js index 0a0299c4..bddcaadf 100644 --- a/scripts/server/casino.js +++ b/scripts/server/casino.js @@ -118,20 +118,7 @@ function blackJackHitCommand(command, params, client) { hand.push(deck.pop()); - let tempHandValue = 0; - - for (let i in hand) { - if (hand[i].value == 1) { - - if ((tempHandValue + 11) > 21) { - tempHandValue += 1; - } else { - tempHandValue += 11; - } - } else { - tempHandValue += hand[i].value; - } - } + let tempHandValue = getValueOfBlackJackHand(hand); if (handValue > 21) { playerBustBlackJack(client); @@ -155,14 +142,6 @@ function blackJackStandCommand(command, params, client) { // =========================================================================== -function blackJackHit(hand, deck) { - - - return handValue; -} - -// =========================================================================== - function dealPlayerBlackJackHand(deck, players) { // Alternate handing cards to each player, 2 cards each for (var i = 0; i < 2; i++) { @@ -174,4 +153,23 @@ function dealPlayerBlackJackHand(deck, players) { } } +// =========================================================================== + +function calculateValueOfBlackJackHand(hand) { + let tempHandValue = 0; + + for (let i in hand) { + if (hand[i].value == 1) { + + if ((tempHandValue + 11) > 21) { + tempHandValue += 1; + } else { + tempHandValue += 11; + } + } else { + tempHandValue += hand[i].value; + } + } +} + // =========================================================================== \ No newline at end of file