diff --git a/TextAdventures/README.md b/TextAdventures/README.md deleted file mode 100644 index 07624b9..0000000 --- a/TextAdventures/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Play interactive fiction Z-Machine games like the Infocom classic Zork. - -Requires limnoria, python 3, pexpect - -Uses the dfrotz (dumb frotz) interpreter https://github.com/DavidGriffith/frotz - -git clone https://github.com/DavidGriffith/frotz
-cd frotz
-make dumb
-sudo make install_dumb
- -config plugins.frotz.dfrotzPath (path_to_dfrotz_binary) (default /usr/local/bin/dfrotz) -Looks for games in ./games/ directory - -usage: - -adventure ex. adventure zork1.z5 - starts game - -Game will process channel messages as commands while a game is running. - -z ex. z open mailbox, z look - send command manually - -z - sends a blank line equivalent to [RETURN]/[ENTER] when needed - -end - ends the game - -games - lists contents of ./games/ directory - -one game allowed to run per channel/pm. will prompt you to stop running games before allowing a new one to be started. -this limits the number of potential child dfrotz processes and keeps this simpler in terms of routing the right game data -to the right place. - -python3 -m pip install pexpect - -Games included here are easily found and freely available all over the net, their owners are their respective owners -and if you believe a game should not be here contact me and I will remove it immediately. diff --git a/TextAdventures/__init__.py b/TextAdventures/__init__.py deleted file mode 100644 index da312cd..0000000 --- a/TextAdventures/__init__.py +++ /dev/null @@ -1,65 +0,0 @@ -### -# Copyright (c) 2020, oddluck -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -""" -TextAdventures: Play interactive fiction (z-machine) games -""" - -import supybot -import supybot.world as world - -# Use this for the version of this plugin. You may wish to put a CVS keyword -# in here if you're keeping the plugin in CVS or some similar system. -__version__ = "2020.02.24+git" - -# XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = supybot.Author("oddluck", "oddluck", "oddluck@riseup.net") - -# This is a dictionary mapping supybot.Author instances to lists of -# contributions. -__contributors__ = {} - -# This is a url where the most recent plugin package can be downloaded. -__url__ = "https://github.com/oddluck/limnoria-plugins/" - -from . import config -from . import plugin -from importlib import reload - -# In case we're being reloaded. -reload(config) -reload(plugin) -# Add more reloads here if you add third-party modules and want them to be -# reloaded when this plugin is reloaded. Don't forget to import them as well! - -if world.testing: - from . import test - -Class = plugin.Class -TextAdventures = config.TextAdventures diff --git a/TextAdventures/config.py b/TextAdventures/config.py deleted file mode 100644 index 553e7bc..0000000 --- a/TextAdventures/config.py +++ /dev/null @@ -1,81 +0,0 @@ -### -# Copyright (c) 2020, oddluck -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -import supybot.conf as conf -import supybot.registry as registry - -try: - from supybot.i18n import PluginInternationalization - - _ = PluginInternationalization("TextAdventures") -except: - # Placeholder that allows to run the plugin on a bot - # without the i18n module - _ = lambda x: x - - -def configure(advanced): - # This will be called by supybot to configure this module. advanced is - # a bool that specifies whether the user identified themself as an advanced - # user or not. You should effect your configuration by manipulating the - # registry as appropriate. - from supybot.questions import expect, anything, something, yn - - conf.registerPlugin("TextAdventures", True) - - -TextAdventures = conf.registerPlugin("TextAdventures") - -conf.registerGlobalValue( - TextAdventures, - "dfrotzPath", - registry.String( - "/usr/local/bin/dfrotz", _("""The path to the dfrotz executable.""") - ), -) - -conf.registerGlobalValue( - TextAdventures, - "allowPrivate", - registry.Boolean("True", _("""Allow games to be played over private message.""")), -) - -conf.registerChannelValue( - TextAdventures, - "requireCommand", - registry.Boolean( - "False", - _( - """Require game input to be sent via command. Disables - monitoring of chanel messages for game input.""" - ), - ), -) - -TextAdventures = conf.registerPlugin("TextAdventures") diff --git a/TextAdventures/games/a_mind_forever_voyaging.z4 b/TextAdventures/games/a_mind_forever_voyaging.z4 deleted file mode 100644 index 14e9010..0000000 Binary files a/TextAdventures/games/a_mind_forever_voyaging.z4 and /dev/null differ diff --git a/TextAdventures/games/adventure.z5 b/TextAdventures/games/adventure.z5 deleted file mode 100644 index 0f00627..0000000 Binary files a/TextAdventures/games/adventure.z5 and /dev/null differ diff --git a/TextAdventures/games/anchorhead.z8 b/TextAdventures/games/anchorhead.z8 deleted file mode 100644 index 3e99a47..0000000 Binary files a/TextAdventures/games/anchorhead.z8 and /dev/null differ diff --git a/TextAdventures/games/ballyhoo.z3 b/TextAdventures/games/ballyhoo.z3 deleted file mode 100644 index 5b6fb02..0000000 Binary files a/TextAdventures/games/ballyhoo.z3 and /dev/null differ diff --git a/TextAdventures/games/beyond_zork.z5 b/TextAdventures/games/beyond_zork.z5 deleted file mode 100644 index 30d7905..0000000 Binary files a/TextAdventures/games/beyond_zork.z5 and /dev/null differ diff --git a/TextAdventures/games/border_zone.z5 b/TextAdventures/games/border_zone.z5 deleted file mode 100644 index 60c1f03..0000000 Binary files a/TextAdventures/games/border_zone.z5 and /dev/null differ diff --git a/TextAdventures/games/cutthroats.z3 b/TextAdventures/games/cutthroats.z3 deleted file mode 100644 index a9d33fc..0000000 Binary files a/TextAdventures/games/cutthroats.z3 and /dev/null differ diff --git a/TextAdventures/games/deadline.z3 b/TextAdventures/games/deadline.z3 deleted file mode 100644 index ebbe260..0000000 Binary files a/TextAdventures/games/deadline.z3 and /dev/null differ diff --git a/TextAdventures/games/enchanter.z3 b/TextAdventures/games/enchanter.z3 deleted file mode 100644 index 749a4d9..0000000 Binary files a/TextAdventures/games/enchanter.z3 and /dev/null differ diff --git a/TextAdventures/games/hitchhikers_guide.z5 b/TextAdventures/games/hitchhikers_guide.z5 deleted file mode 100644 index 5387993..0000000 Binary files a/TextAdventures/games/hitchhikers_guide.z5 and /dev/null differ diff --git a/TextAdventures/games/hollywood_hijinx.z3 b/TextAdventures/games/hollywood_hijinx.z3 deleted file mode 100644 index 1d96059..0000000 Binary files a/TextAdventures/games/hollywood_hijinx.z3 and /dev/null differ diff --git a/TextAdventures/games/infidel.z3 b/TextAdventures/games/infidel.z3 deleted file mode 100644 index c31b145..0000000 Binary files a/TextAdventures/games/infidel.z3 and /dev/null differ diff --git a/TextAdventures/games/leather_goddesses_of_phobos.z5 b/TextAdventures/games/leather_goddesses_of_phobos.z5 deleted file mode 100644 index 03f2acc..0000000 Binary files a/TextAdventures/games/leather_goddesses_of_phobos.z5 and /dev/null differ diff --git a/TextAdventures/games/lostpig.z8 b/TextAdventures/games/lostpig.z8 deleted file mode 100644 index ea67fa9..0000000 Binary files a/TextAdventures/games/lostpig.z8 and /dev/null differ diff --git a/TextAdventures/games/lurking_horror.z3 b/TextAdventures/games/lurking_horror.z3 deleted file mode 100644 index a03dd60..0000000 Binary files a/TextAdventures/games/lurking_horror.z3 and /dev/null differ diff --git a/TextAdventures/games/moonmist.z3 b/TextAdventures/games/moonmist.z3 deleted file mode 100644 index d709327..0000000 Binary files a/TextAdventures/games/moonmist.z3 and /dev/null differ diff --git a/TextAdventures/games/nord_and_bert.z4 b/TextAdventures/games/nord_and_bert.z4 deleted file mode 100644 index 6836899..0000000 Binary files a/TextAdventures/games/nord_and_bert.z4 and /dev/null differ diff --git a/TextAdventures/games/planetfall.z5 b/TextAdventures/games/planetfall.z5 deleted file mode 100644 index 567e257..0000000 Binary files a/TextAdventures/games/planetfall.z5 and /dev/null differ diff --git a/TextAdventures/games/plundered_hearts.z3 b/TextAdventures/games/plundered_hearts.z3 deleted file mode 100644 index b5e076d..0000000 Binary files a/TextAdventures/games/plundered_hearts.z3 and /dev/null differ diff --git a/TextAdventures/games/sampler1.z3 b/TextAdventures/games/sampler1.z3 deleted file mode 100644 index 03f7608..0000000 Binary files a/TextAdventures/games/sampler1.z3 and /dev/null differ diff --git a/TextAdventures/games/sampler2.z3 b/TextAdventures/games/sampler2.z3 deleted file mode 100644 index 368700c..0000000 Binary files a/TextAdventures/games/sampler2.z3 and /dev/null differ diff --git a/TextAdventures/games/seastalker.z3 b/TextAdventures/games/seastalker.z3 deleted file mode 100644 index 5868bb6..0000000 Binary files a/TextAdventures/games/seastalker.z3 and /dev/null differ diff --git a/TextAdventures/games/shade.z5 b/TextAdventures/games/shade.z5 deleted file mode 100644 index e3dc9f6..0000000 Binary files a/TextAdventures/games/shade.z5 and /dev/null differ diff --git a/TextAdventures/games/sherlock_holmes.z5 b/TextAdventures/games/sherlock_holmes.z5 deleted file mode 100644 index 38d2c1d..0000000 Binary files a/TextAdventures/games/sherlock_holmes.z5 and /dev/null differ diff --git a/TextAdventures/games/sorcery.z3 b/TextAdventures/games/sorcery.z3 deleted file mode 100644 index 19df2e3..0000000 Binary files a/TextAdventures/games/sorcery.z3 and /dev/null differ diff --git a/TextAdventures/games/spellbreaker.z3 b/TextAdventures/games/spellbreaker.z3 deleted file mode 100644 index 254d479..0000000 Binary files a/TextAdventures/games/spellbreaker.z3 and /dev/null differ diff --git a/TextAdventures/games/starcross.z3 b/TextAdventures/games/starcross.z3 deleted file mode 100644 index 2116b60..0000000 Binary files a/TextAdventures/games/starcross.z3 and /dev/null differ diff --git a/TextAdventures/games/stationfall.z3 b/TextAdventures/games/stationfall.z3 deleted file mode 100644 index f7bc433..0000000 Binary files a/TextAdventures/games/stationfall.z3 and /dev/null differ diff --git a/TextAdventures/games/suspect.z3 b/TextAdventures/games/suspect.z3 deleted file mode 100644 index b40920e..0000000 Binary files a/TextAdventures/games/suspect.z3 and /dev/null differ diff --git a/TextAdventures/games/suspended.z3 b/TextAdventures/games/suspended.z3 deleted file mode 100644 index a3075f8..0000000 Binary files a/TextAdventures/games/suspended.z3 and /dev/null differ diff --git a/TextAdventures/games/trinity.z4 b/TextAdventures/games/trinity.z4 deleted file mode 100644 index 21644e3..0000000 Binary files a/TextAdventures/games/trinity.z4 and /dev/null differ diff --git a/TextAdventures/games/wishbringer.z5 b/TextAdventures/games/wishbringer.z5 deleted file mode 100644 index 8eeb63a..0000000 Binary files a/TextAdventures/games/wishbringer.z5 and /dev/null differ diff --git a/TextAdventures/games/witness.z3 b/TextAdventures/games/witness.z3 deleted file mode 100644 index 71b4659..0000000 Binary files a/TextAdventures/games/witness.z3 and /dev/null differ diff --git a/TextAdventures/games/zork1.z5 b/TextAdventures/games/zork1.z5 deleted file mode 100644 index c6787f9..0000000 Binary files a/TextAdventures/games/zork1.z5 and /dev/null differ diff --git a/TextAdventures/games/zork2.z3 b/TextAdventures/games/zork2.z3 deleted file mode 100644 index 59897ce..0000000 Binary files a/TextAdventures/games/zork2.z3 and /dev/null differ diff --git a/TextAdventures/games/zork3.z3 b/TextAdventures/games/zork3.z3 deleted file mode 100644 index 1aed086..0000000 Binary files a/TextAdventures/games/zork3.z3 and /dev/null differ diff --git a/TextAdventures/plugin.py b/TextAdventures/plugin.py deleted file mode 100644 index 79bbf9c..0000000 --- a/TextAdventures/plugin.py +++ /dev/null @@ -1,182 +0,0 @@ -### -# Copyright (c) 2020, oddluck -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -import supybot.utils as utils -from supybot.commands import * -import supybot.plugins as plugins -import supybot.ircutils as ircutils -import supybot.callbacks as callbacks -import supybot.ircmsgs as ircmsgs -import os -import pexpect -import re - -try: - from supybot.i18n import PluginInternationalization - - _ = PluginInternationalization("TextAdventures") -except ImportError: - # Placeholder that allows to run the plugin on a bot - # without the i18n module - _ = lambda x: x - - -class TextAdventures(callbacks.Plugin): - """ - Play Text Adventure Games (Infocom, Interactive Fiction, Z-Machine) . - """ - - threaded = True - - def __init__(self, irc): - self.__parent = super(TextAdventures, self) - self.__parent.__init__(irc) - self.game = {} - self.game_path = "{0}/games/".format(os.path.dirname(os.path.abspath(__file__))) - self.binary = self.registryValue("dFrotzPath") - - def adventure(self, irc, msg, args, input): - """ - Open . - """ - channel = msg.args[0] - if not self.registryValue("allowPrivate") and not irc.isChannel(channel): - irc.reply("Sorry, this game must be played in channel") - return - elif self.registryValue("allowPrivate") and not irc.isChannel(channel): - channel = msg.nick - game_name = input - self.game.setdefault(channel, None) - if self.game[channel]: - irc.reply( - "There is a game already in progress on {0}. Please stop that game" - " first.".format(channel) - ) - else: - irc.reply("Starting {0} on {1}. Please wait...".format(game_name, channel)) - game_file = "{0}{1}".format(self.game_path, game_name) - self.game[channel] = pexpect.spawn( - "{0} -m -S 0 {1}".format(self.binary, game_file) - ) - response = self.output(self.game[channel]) - for line in response: - if line.strip() and line.strip() != ".": - irc.reply(line, prefixNick=False) - - adventure = wrap(adventure, ["text"]) - - def output(self, output): - response = [] - prompts = ["\n> >", "\n>", "\n\)", pexpect.TIMEOUT] - output.expect(prompts, timeout=1) - response = output.before - response = response.decode().splitlines() - return response - - def doPrivmsg(self, irc, msg): - channel = msg.args[0] - if irc.isChannel(channel) and callbacks.addressed(irc.nick, msg): - return - if not irc.isChannel(channel): - channel = msg.nick - if not self.registryValue("requireCommand") or not irc.isChannel(msg.args[0]): - self.game.setdefault(channel, None) - if self.game[channel]: - try: - command = msg.args[1] - self.game[channel].sendline(r"{}".format(command)) - response = self.output(self.game[channel]) - for line in response[1:]: - if line.strip() and line.strip() != ".": - irc.reply(line, prefixNick=False) - except: - return - else: - return - else: - return - - def end(self, irc, msg, args): - """ - End text adventure game. - """ - channel = msg.args[0] - if not irc.isChannel(channel): - channel = msg.nick - self.game.setdefault(channel, None) - if self.game[channel]: - irc.reply("Stopping Game. Thanks for playing.") - else: - irc.reply("No game running in {0}".format(channel)) - try: - self.game[channel].terminate(force=True) - del self.game[channel] - except: - try: - del self.game[channel] - except: - return - return - - end = wrap(end) - - def z(self, irc, msg, args, command): - """[] - Send user input or blank line (ENTER/RETURN) to the game. - """ - channel = msg.args[0] - if not irc.isChannel(channel): - channel = msg.nick - self.game.setdefault(channel, None) - if self.game[channel]: - if command: - command = re.sub(r"^.?z", r"", r"{}".format(msg.args[1])).strip() - self.game[channel].sendline(r"{}".format(command)) - else: - self.game[channel].sendline() - response = self.output(self.game[channel]) - for line in response[1:]: - if line.strip() and line.strip() != ".": - irc.reply(line, prefixNick=False) - else: - irc.reply("No game running in {0}?".format(channel)) - - z = wrap(z, [optional("text")]) - - def games(self, irc, msg, args): - """ - List files in the game directory. - """ - reply = ", ".join(sorted(os.listdir(self.game_path))) - irc.reply(reply, prefixNick=False) - - games = wrap(games) - - -Class = TextAdventures diff --git a/TextAdventures/requirements.txt b/TextAdventures/requirements.txt deleted file mode 100644 index 808fb07..0000000 --- a/TextAdventures/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pexpect diff --git a/TextAdventures/setup.py b/TextAdventures/setup.py deleted file mode 100644 index bf6e843..0000000 --- a/TextAdventures/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -from supybot.setup import plugin_setup - -plugin_setup( - 'TextAdventures', - install_requires=[ - 'pexpect', - ], -)