46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
import shinycalc
|
|
|
|
class G7SCPlugin:
|
|
|
|
help = "Generates shiny chances for pokemon generation 7 shiny hunting! Subcommands: shiny, hidden_ability, perfect_ivs"
|
|
|
|
"""Handles lua execution"""
|
|
def __init__(self,bot,prefix):
|
|
self.bot = bot
|
|
self.prefix = prefix
|
|
|
|
def handleCommand(self,chan,sender,cmd):
|
|
if cmd.strip()==prefix:
|
|
self.bot.mention(chan,sender,G7SCPlugin.help)
|
|
elif not cmd.startswith(prefix+" "):
|
|
return
|
|
else:
|
|
try:
|
|
parts = cmd.strip().split()
|
|
if not hasattr(self,parts[1]):
|
|
self.bot.mention(chan,sender,G7SCPlugin.help)
|
|
raise Exception()
|
|
args = parts[2:]
|
|
# args.insert(0,self)
|
|
self.bot.mention(chan,sender,getattr(self,parts[1])(*args))
|
|
except:
|
|
pass
|
|
|
|
def shiny(self,*args):
|
|
shinycalc.setChain(int(args[0]))
|
|
shiny = shinycalc.generateShiny()
|
|
ret = "1/{!s} chance of the pokemon being shiny.".format(shiny[0])
|
|
if shiny[1]:
|
|
ret += " (Or not. Shiny values from 1-69 aren't known yet.)"
|
|
return ret
|
|
|
|
def hidden_ability(self,*args):
|
|
shinycalc.setChain(int(args[0]))
|
|
ha = shinycalc.generateHA()
|
|
return "{!s}% chance of a hidden ability.".format(ha)
|
|
|
|
def perfect_ivs(self,*args):
|
|
shinycalc.setChain(int(args[0]))
|
|
ivs = shinycalc.generateIVs()
|
|
return "{!s} guaranteed perfect IV(s).".format(ivs)
|