X-Git-Url: http://git.veekun.com/zzz-dywypi.git/blobdiff_plain/7df67daaf3dd30241afa7dfe9f857bbe2f809c55..26a61c922cf86919eb7e3af2aa59a0d4662fcbb7:/plugins/Pokedex/plugin.py diff --git a/plugins/Pokedex/plugin.py b/plugins/Pokedex/plugin.py index 9b35221..62f11b6 100644 --- a/plugins/Pokedex/plugin.py +++ b/plugins/Pokedex/plugin.py @@ -67,7 +67,7 @@ class Pokedex(callbacks.Plugin): self.__parent = super(Pokedex, self) self.__parent.__init__(irc) self.db = pokedex.db.connect(self.registryValue('databaseURL')) - self.indices = pokedex.lookup.open_index( + self.lookup = pokedex.lookup.PokedexLookup( directory=conf.supybot.directories.data.dirize('pokedex-index'), session=self.db, ) @@ -86,8 +86,7 @@ class Pokedex(callbacks.Plugin): thing = ascii_thing.decode('latin1') # Similar logic to the site, here. - results = pokedex.lookup.lookup(thing, session=self.db, - indices=self.indices) + results = self.lookup.lookup(thing) # Nothing found if len(results) == 0: @@ -272,7 +271,20 @@ class Pokedex(callbacks.Plugin): """http://veekun.com/dex/abilities/{link_name}""" self._reply(irc, reply_template.format( name=obj.name, - effect=obj.effect, + effect=obj.short_effect.as_text, + link_name=urllib.quote(obj.name.lower().encode('utf8')), + ) + ) + + elif isinstance(obj, tables.Nature): + reply_template = \ + u"""{name}, a nature. """ \ + u"""Raises \x0303{up}\x0f, lowers \x0304{down}\x0f. """ \ + u"""http://veekun.com/dex/natures/{link_name}""" + self._reply(irc, reply_template.format( + name=obj.name, + up=obj.increased_stat.name, + down=obj.decreased_stat.name, link_name=urllib.quote(obj.name.lower().encode('utf8')), ) )