Skip to content

Commit

Permalink
Loading sailing gear
Browse files Browse the repository at this point in the history
  • Loading branch information
sibgit committed Oct 18, 2024
1 parent f82a1f5 commit 73c1291
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .script/quest_functions.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
KEY_1="lock_1/key_1"
KEY_2="lock_2/key_2"
KEY_3="lock_3/key_3"
KEY_1="treasure_chest/lock_1/key_1"
KEY_2="treasure_chest/lock_2/key_2"
KEY_3="treasure_chest/lock_3/key_3"
CREW="pirate_code.md"
PIRATES=( "Captain" "Quartermaster" "First mate" )
FLAG="supplies/flag.ascii"
RHUM="supplies/rhum.ascii"
SHIP="supplies/ship.ascii"

function random_exclamation {
exclamations=( "Blimey!" "Sail Ho!" "Shiver me timbers!" "Sink me!" "Aaaarrrrgggghhhh!" "Blimey!" "Sail Ho!" "All Hand Hoy!" "Sink me!" "Scupper that!" )
echo ${exclamations[$(date | cut -f5 -d " " | cut -c 8)]}
echo ${exclamations[$(date +%s | cut -c10)]}
}

function pirate_say {
Expand All @@ -19,7 +22,19 @@ function parrot_say {
echo -e "$1"
}

function fake_checksum {
input_file=$1
tail -1 ${input_file} | cut -c 1-64
}

function get_key_code {
key_nb=$1
cat .support_files/$(sha256sum "lock_${key_nb}/key_${key_nb}" | cut -c1-64) | cut -c$(($key_nb*2-1)),$(($key_nb*2+3))
checksum=$(fake_checksum "treasure_chest/lock_${key_nb}/key_${key_nb}")
cat .support_files/${checksum} | cut -c$(($key_nb*2-1)),$(($key_nb*2+3))
}

function is_valid_key {
key_file=$1
[[ -f .support_files/$(fake_checksum "$key_file") ]] && return 0
return 1
}

0 comments on commit 73c1291

Please sign in to comment.