Skip to content

Commit

Permalink
add MTG Forge app
Browse files Browse the repository at this point in the history
  • Loading branch information
janAkali committed Aug 29, 2024
1 parent 99d8af9 commit 7be7077
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/updates/Forge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

webVer=$(get_release card-forge/forge)

source $GITHUB_WORKSPACE/.github/workflows/update_github_script.sh
1 change: 1 addition & 0 deletions apps/Forge/credits
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Script created by ArcharGelod
12 changes: 12 additions & 0 deletions apps/Forge/description
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Forge is a "Rules Engine" for the most popular card game Magic: the Gathering.

Forge creates a unique experience by combining an enormous card library with some RPG elements in Quest mode (comparable to the 'Shandalar', the late 90's PC Game) and Planar Conquest on the mobile version.
Forge also includes a Graphical Map Based game mode called "Adventure Mode", which is more akin to 'Shandalar.' (Only in Mobile UI version)

Start Forge with Desktop UI: Menu -> Games -> MTG Forge
Start Forge with Mobile UI: Menu -> Games -> MTG Forge Adventure
Start with Desktop UI in terminal: ~/.local/share/mtg-forge/forge.sh
Start with Mobile UI in terminal: ~/.local/share/mtg-forge/forge-mobile.sh
Start Simulation mode in terminal: ~/.local/share/mtg-forge/forge.sh sim

Forge is open source software released under the GNU Public License and not related in any way with Wizards of the Coast.
Binary file added apps/Forge/icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/Forge/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions apps/Forge/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
version=forge-1.6.64
subversion=${version/forge-} # remove "forge-" from string

game_folder="$HOME/.local/share/mtg-forge"
repo_url="https://github.com/card-forge/forge/releases/download/${version}"
archive_name="forge-gui-desktop-${subversion}.tar.bz2"

#cleanup
trap "rm -f /tmp/$archive_name; exit" EXIT

status "Installing Java 17"
case "$__os_id" in
# Raspbian is not reported as a derivative of Debian (no /etc/upstream-release/lsb-release file)
Raspbian | Debian | Kali)
adoptium_installer || exit 1
install_packages temurin-17-jre || exit 1
;;
Ubuntu)
install_packages openjdk-17-jre || exit 1
;;
*)
error "$__os_id appears to be an unsupported OS"
;;
esac

status "Downloading snapshot archive."
[[ -f "/tmp/$archive_name" ]] && rm -f "/tmp/$archive_name"
wget "$repo_url/$archive_name" --directory-prefix /tmp || error 'Failed to download latest release!'

# check if folder already exists
if [[ -d "$game_folder" ]]; then
warning "Found existing Forge directory in $game_folder !!!" && echo "It will be moved to /tmp/mtg-forge-old !!!"
mv "$game_folder" /tmp/MTG-Forge-old || error "Failed to move $game_folder directory to /tmp/ !!! Please, move or delete it yourself and then try installing again."
fi

mkdir "$game_folder"

status "Extracting the game archive."
tar -xvf "/tmp/forge-gui-desktop-${subversion}.tar.bz2" --directory="$game_folder" || error 'Failed to extract the game archive!'

# problem: forge-adventure doesn't launch with java versions > 8
# workaround: create `forge-mobile.sh` script that's a modified copy of `forge.sh` script
status "Creating workaround for adventure shell script."
jarname="$(find "$game_folder" -name 'forge-gui-mobile*.jar' | xargs basename)"
cp "$game_folder/forge.sh" "$game_folder/forge-mobile.sh"
sed -i "s|forge-gui-desktop-.*-jar-with-dependencies.jar|$jarname|" "$game_folder/forge-mobile.sh"

# create desktop menu entries
echo "[Desktop Entry]
Type=Application
Name=MTG Forge
GenericName=Forge
Comment=Rules Engine for MTG card game.
Path=$game_folder
Exec=$game_folder/forge.sh
Icon=$game_folder/res/skins/default/hd_logo.png
Terminal=false
Categories=Game;Java;
Keywords=MTG;Forge;Adventure;Card;Game;Magic
StartupNotify=true" > "$HOME/.local/share/applications/Forge.desktop"

echo "[Desktop Entry]
Type=Application
Name=MTG Forge Adventure
GenericName=Forge-mobile
Comment=Mobile UI version of Forge with the Adventure mode.
Path=$game_folder
Exec=$game_folder/forge-mobile.sh
Icon=$game_folder/res/skins/default/adv_logo.png
Terminal=false
Categories=Game;Java;
Keywords=MTG;Forge;Adventure;Card;Game;Magic
StartupNotify=true" > "$HOME/.local/share/applications/Forge-Adventure.desktop"
11 changes: 11 additions & 0 deletions apps/Forge/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

purge_packages || exit 1
remove_repofile_if_unused /etc/apt/sources.list.d/adoptium.list

#remove game folder
rm -rf "$HOME/.local/share/mtg-forge"

#remove desktop menu entries
rm -f "$HOME/.local/share/applications/Forge.desktop"
rm -f "$HOME/.local/share/applications/Forge-Adventure.desktop"
1 change: 1 addition & 0 deletions apps/Forge/website
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/Card-Forge/forge/wiki

0 comments on commit 7be7077

Please sign in to comment.