Coder Social home page Coder Social logo

pq-cli's Introduction

Progress Quest

Relive the great adventure… this time in the terminal realm!

Features

  • Faithful port of the game logic
  • Saves (with backups) to $XDG_CONFIG_HOME/pqcli/save.dat
  • Terminal interface that comes in 2 flavors:
    • Rich and colorful (--curses, default)
    • Minimal, suitable for raw grind (--basic)
  • Ideal to run on your server

How it looks like

Curses interface:

Screenshot Screenshot

Basic interface:

Screenshot

How to install

If you have Python 3.7, just run pip install --user pqcli and you're good to go! Then type pqcli to run the game.

In case if you want to use the git version, the process is just a bit more complex:

$ git clone https://github.com/rr-/pq-cli.git
$ cd pq-cli
$ pip install --user .

Contributing

# Clone the repository:
git clone https://github.com/rr-/pqcli.git
cd pqcli

# Install to a local venv:
poetry install

# Install pre-commit hooks:
poetry run pre-commit install

# Enter the venv:
poetry shell

This project uses poetry for packaging. Install instructions are available at poetry#installation.

Troubleshooting

_curses.error: init_pair() returned ERR

If running on Linux and you get the error _curses.error: init_pair() returned ERR, try making sure that your $TERM variable is set to a value which supports 256 colors, such as via the following:

TERM=xterm-256color pqcli

pq-cli's People

Contributors

anakojm avatar apocalyptech avatar dependabot[bot] avatar petrgasparik avatar rr- avatar txtsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pq-cli's Issues

XDG Dependency Renaming

Hello! It seems that the xdg dependency was renamed xdg-base-dirs last year as of version 6.0.0. This seems to present some packaging problems in distributions that have made this name change, such as Arch. pqcli now tries to import the pyxdg package and crashes with the message:

module xdg has no attribute 'XDG_CONFIG_HOME'

I believe the fix for this is to bump the dependency version to at least 6.0.0, rename it to xdg-base-dirs, and change the import statement to xdg-base-dirs.

I'm not familiar with poetry at all, but if a pull request would be helpful, I can try to figure it out.

Thank you!

Game Mechanic Update

Is it possible to update the game mechanic such that it behaves the same as the latest version of Progress Quest (v6.4)?

This error occurs immediately after finalizing character creation, before anything pops up...:

`Traceback (most recent call last):
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli_main_.py", line 56, in main
ui.run()
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\ui\curses_init_.py", line 95, in run
self._view.keypress(key)
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\ui\curses\views\create_character_view\choose_character_stats_view.py", line 58, in keypress
self.on_confirm(self.stats)
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\ui\curses\event_handler.py", line 10, in call
callback(*args, **kwargs)
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\ui\curses_init
.py", line 145, in
view.on_confirm += lambda stats: self.create_character(
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\ui\curses_init
.py", line 188, in _create_character
self.roster.save()
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\roster.py", line 32, in save
self.path.rename(old_path)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1358, in rename
self._accessor.rename(self, target)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: '$HOME\.config\pqcli\save.dat' -> '$HOME\.config\pqcli\save.dat.old'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli_main
.py", line 63, in
main()
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli_main
.py", line 59, in main
roster.save()
File "C:\Users\eyedp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pqcli\roster.py", line 32, in save
self.path.rename(old_path)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1358, in rename
self._accessor.rename(self, target)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: '$HOME\.config\pqcli\save.dat' -> '$HOME\.config\pqcli\save.dat.old'`

Sorry for the dump! Big error.

getting "addnwstr() returned ERR" when the 'game' starts

from latest github I get this error after I create, or continue with, a player:

Traceback (most recent call last): File "/home/quester/pq-venv/bin/pqcli", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/__main__.py", line 88, in main ui.run() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 100, in run self._view.keypress(key) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/menu_view.py", line 40, in keypress self.main_menu.keypress(key) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/widgets/menu.py", line 66, in keypress self._choices[self._active_choice].callback() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/event_handler.py", line 10, in __call__ callback(*args, **kwargs) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 182, in _switch_to_game_view self._switch_view(view) File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 187, in _switch_view self._view.start() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/__init__.py", line 197, in start self._plot_win = PlotWindow( ^^^^^^^^^^^ File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 25, in __init__ self.sync() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 46, in sync self._sync_position() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/plot_window.py", line 69, in _sync_position self._render_progress_bar() File "/home/quester/pq-venv/lib/python3.11/site-packages/pqcli/ui/curses/views/game_view/progress_bar_window.py", line 68, in _render_progress_bar self._progress_bar_win.addnstr( _curses.error: addnwstr() returned ERR

random seed issue

def seed(source: T.Any) -> None:
random.seed(source)

random.seed() already uses the current system time to generate a seed. This seems very double.

At least on my system (Python 3.11.8) when creating a character, I get the following error:

Traceback (most recent call last):
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/bin/pqcli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/__main__.py", line 56, in main
    ui.run()
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 95, in run
    self._view.keypress(key)
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/ui/curses/views/create_character_view/choose_character_stats_view.py", line 58, in keypress
    self.on_confirm(self._stats)
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/ui/curses/event_handler.py", line 10, in __call__
    callback(*args, **kwargs)
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 145, in <lambda>
    view.on_confirm += lambda stats: self._create_character(
                                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/ui/curses/__init__.py", line 185, in _create_character
    player = create_player(name, race, class_, stats)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/mechanic.py", line 929, in create_player
    random.seed(now)
  File "/home/alwyn/.local/opt/pyenv/versions/progress-quest/lib/python3.11/site-packages/pqcli/random.py", line 6, in seed
    random.seed(source)
  File "/usr/lib/python3.11/random.py", line 160, in seed
    raise TypeError('The only supported seed types are: None,\n'
TypeError: The only supported seed types are: None,
int, float, str, bytes, and bytearray.

If I change the above code and remove the source parameter from random.seed() it works.

I installed Python 3.8 and it won't work

I'm running windows 10. I installed Python 3.8 from the store. I went into command line and typed pip install --user pqcli, everything went fine. I typed pqcli and it says that "pqcli is not recobnized as an internal or external command, operable program or batch file."

How can I fix this?

Run failed on missing _curses (Win10)

Hi,
I run pqcli from git source. After successfull build, I get "ModuleNotFoundError: No module named '_curses'"

What now? :) Thank you in advance!

Env: Win10, Python 3.7.1

Log and toggle view

Is there a way to toggle the view to a log view and see the log messages I might have missed in the past minutes?

Feature request: Command-line parameters to specify which character to run

It would help my character's progress if he didn't have to wait for me to run the game every time the server restarts. I'd like to specify which file to run on the command line so that I can script the game to auto-launch on startup. If this can already be done, then perhaps only the documentation needs to be updated.

Minimum Screen Size

Is there a minimum screen size the 'pretty' version can be run on? I'd like to miniaturize this as much as possible on a standalone pi.

Division By Zero

  • installed python3.7 and python3.7-venv package from ubuntu 18.04 repos

  • created a python3.7 env

  • activated the env

  • installed pqcli per intructions

  • python -V output is Python 3.7.1

  • pqcli runs with main menu and character creation up to stats but selecting "Continue" causes error:

pqcli Traceback (most recent call last): File "/home/francisco/py37env/bin/pqcli", line 11, in <module> load_entry_point('pqcli==1.0', 'console_scripts', 'pqcli')() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/__main__.py", line 56, in main ui.run() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/__init__.py", line 95, in run self._view.keypress(key) File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/views/menu_view.py", line 41, in keypress self.main_menu.keypress(key) File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/widgets/menu.py", line 66, in keypress self._choices[self._active_choice].callback() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/event_handler.py", line 10, in __call__ callback(*args, **kwargs) File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/__init__.py", line 175, in _switch_to_game_view self._switch_view(view) File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/__init__.py", line 180, in _switch_view self._view.start() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/views/game_view/__init__.py", line 214, in start x=0, File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/views/game_view/quest_book_window.py", line 24, in __init__ self.sync() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/views/game_view/quest_book_window.py", line 44, in sync self._sync_quests() File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/views/game_view/quest_book_window.py", line 51, in _sync_quests self._list_box.select(-1) File "/home/francisco/py37env/lib/python3.7/site-packages/pqcli/ui/curses/widgets/list_box.py", line 41, in select idx %= len(self._items) ZeroDivisionError: integer division or modulo by zero

Cannot edit names

Currently running this on ubuntu WSL. When creating a new character, I cannot press backspace to change the name, only add more characters to the existing name.

Not starting on a machine with python 3.10

Hi there,

I have tried installing from pip and downloading and yet I end up with the same message on my Fedora 35 box:

Traceback (most recent call last):
File "/home/gralavatarkoluk/.local/bin/pqcli", line 8, in <module>
sys.exit(main())
File "/home/gralavatarkoluk/.local/lib/python3.10/site-packages/pqcli/__main__.py", line 55, in main
ui = args.ui(roster, args)
File "/home/gralavatarkoluk/.local/lib/python3.10/site-packages/pqcli/ui/curses/__init__.py", line 49, in __init__
curses.curs_set(0)
_curses.error: curs_set() returned ERR

I have python 3.10. Can i do anything to start this program here? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.