mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 20:41:21 -05:00
Various minor changes and deletions.
This commit is contained in:
parent
1350b58f76
commit
366da60c58
@ -40,7 +40,7 @@ question_cards_file_name = ['question_main', 'custom_question_cards']
|
||||
blank_format = '__________'
|
||||
|
||||
# Settings that are used
|
||||
#this is one level hire then it should be
|
||||
#this is one level higher than it should be
|
||||
base_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
class Deck(object):
|
||||
@ -59,7 +59,7 @@ class Deck(object):
|
||||
with open(path) as file_handle:
|
||||
file_data = file_handle.readlines()
|
||||
card_text_list.extend(file_data)
|
||||
if len(card_text_list) is 0:
|
||||
if len(card_text_list) == 0:
|
||||
raise IOError
|
||||
|
||||
# Deduplicate the text from the cards
|
||||
@ -80,7 +80,7 @@ class Deck(object):
|
||||
|
||||
def count_answers(self, text):
|
||||
blanks = text.count(blank_format)
|
||||
if blanks is 0:
|
||||
if blanks == 0:
|
||||
return 1
|
||||
else:
|
||||
return blanks
|
||||
@ -122,7 +122,7 @@ class Game(object):
|
||||
return player_list
|
||||
|
||||
def next_round(self):
|
||||
if self.round is None:
|
||||
if not self.round:
|
||||
self.round = 0
|
||||
if self.round < self.round_limit:
|
||||
self.round += 1
|
||||
|
@ -143,7 +143,7 @@ class Fun(callbacks.Plugin):
|
||||
if not data: # http fetch breaks.
|
||||
irc.reply("ERROR")
|
||||
return
|
||||
soup = BeautifulSoup(data.text)
|
||||
soup = BeautifulSoup(data.content)
|
||||
text = soup.find('center').getText()
|
||||
irc.reply("{0}".format(text))
|
||||
devexcuse = wrap(devexcuse)
|
||||
@ -263,7 +263,7 @@ class Fun(callbacks.Plugin):
|
||||
Get a random cat .gif
|
||||
"""
|
||||
try:
|
||||
response = utils.web.getUrl("http://edgecats.net/random").decode("utf8")
|
||||
response = utils.web.getUrl("http://edgecats.net/random").decode()
|
||||
# Expecting a link
|
||||
if "http" in response:
|
||||
irc.reply(response)
|
||||
|
@ -61,7 +61,7 @@ class IMDb(callbacks.Plugin):
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
data = requests.get(searchurl, headers=header, timeout=10)
|
||||
data.raise_for_status()
|
||||
soup = BeautifulSoup(data.text)
|
||||
soup = BeautifulSoup(data.content)
|
||||
elements = soup.select('.r a')
|
||||
url = urljoin(elements[0]['href'], urlparse(url).path)
|
||||
except Exception:
|
||||
@ -131,7 +131,7 @@ class IMDb(callbacks.Plugin):
|
||||
imdb_template = imdb_template.replace("$poster",response["Poster"])
|
||||
result = imdb_template
|
||||
else:
|
||||
log.error("IMDb OMDB API %s - %s" % (request.status_code, request.text))
|
||||
log.error("IMDb OMDB API %s - %s" % (request.status_code, request.content.decode()))
|
||||
except requests.exceptions.Timeout as e:
|
||||
log.error("IMDb Timeout: %s" % (str(e)))
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
|
@ -619,7 +619,7 @@ class Jeopardy(callbacks.Plugin):
|
||||
else:
|
||||
url = "{0}/search?query={1}".format(self.jserviceUrl, category)
|
||||
data = requests.get(url, timeout=5)
|
||||
soup = BeautifulSoup(data.text)
|
||||
soup = BeautifulSoup(data.content)
|
||||
searches = soup.find_all('a')
|
||||
for i in range(len(searches)):
|
||||
search = searches[i].get('href').split('/')[-1]
|
||||
|
@ -63,7 +63,7 @@ class Lyrics(callbacks.Plugin):
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
data = requests.get(searchurl, headers=header, timeout=10)
|
||||
data.raise_for_status()
|
||||
soup = BeautifulSoup(data.text)
|
||||
soup = BeautifulSoup(data.content)
|
||||
elements = soup.select('.r a')
|
||||
title = soup.find("h3").getText().replace(":", " - ").split('|')[0]
|
||||
url = urljoin(elements[0]['href'], urlparse(url).path)
|
||||
|
@ -316,7 +316,7 @@ class NHL(callbacks.Plugin):
|
||||
return self._cachedData()
|
||||
|
||||
def _extractJSON(self, body):
|
||||
return json.loads(body.decode('utf-8'))
|
||||
return json.loads(body.decode())
|
||||
|
||||
def _parseGames(self, json, team, tz='US/Eastern'):
|
||||
"""Extract all relevant fields from NHL.com's json
|
||||
|
@ -1,3 +0,0 @@
|
||||
Customizable Role Playing Game for IRC.
|
||||
|
||||
Forked from https://github.com/antb/StewieGriffin/tree/master/Rpg
|
@ -1,68 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2011, Anthony Boot
|
||||
# Copyright (c) 2020, oddluck <oddluck@riseup.net>
|
||||
# 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.
|
||||
###
|
||||
|
||||
"""
|
||||
RPG: simple IRC role-playing game for Limnoria
|
||||
"""
|
||||
|
||||
import supybot
|
||||
import supybot.world as world
|
||||
import importlib
|
||||
|
||||
# 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('Anthiny Boot', 'antb', '')
|
||||
__maintainer__ = getattr(supybot.authors, 'oddluck',
|
||||
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
|
||||
importlib.reload(plugin) # In case we're being reloaded.
|
||||
# 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
|
||||
configure = config.configure
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,49 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2011, Anthony Boot
|
||||
# Copyright (c) 2020, oddluck <oddluck@riseup.net>
|
||||
# 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
|
||||
|
||||
def configure(advanced):
|
||||
# This will be called by supybot to configure this module. advanced is
|
||||
# a bool that specifies whether the user identified himself 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('RPG', True)
|
||||
|
||||
|
||||
Rpg = conf.registerPlugin('RPG')
|
||||
# This is where your configuration variables (if any) should go. For example:
|
||||
# conf.registerGlobalValue(Rpg, 'someConfigVariableName',
|
||||
# registry.Boolean(False, """Help for someConfigVariableName."""))
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
@ -1,2 +0,0 @@
|
||||
{"modifiers": [["Legendary", 150, 200, 2], ["Sensational", 75, 150, 5], ["Rare", 75, 150, 5], ["Lucky", 100, 150, 2], ["Diamond", 64, 64, 15], ["Magical", 50, 70, 20], ["Strengthened", 50, 65, 22], ["Quartz", 50, 60, 25], ["Diamond", 45, 55, 30], ["Enchanted", 40, 50, 40], ["Improved", 35, 45, 50], ["Fine", 5, 15, 60], ["Cold-proof", 5, 10, 65], ["Fire-proof", 5, 12, 65], ["Polished", 5, 7, 65], ["Makeshift", 2, 5, 70], [["Crude", 1, 3, 80]], [["Damaged", 1, 2, 90]], ["", 0, 0, 100]], "swords": [["Wooden", 1, 5, 90], ["Short", 1, 10, 80], ["Long", 4, 13, 70], ["Dagger", 7, 13, 60], ["Broad", 6, 15, 50], ["Cutlass", 5, 15, 40], ["Katana", 8, 15, 30], ["Bastard", 10, 17, 20], ["Weighted", 15, 20, 10], ["Samurai", 17, 30, 5]], "defence": [["Tin", 1, 5, 90], ["Aluminium", 3, 8, 80], ["Iron", 6, 11, 70], ["Bronze", 9, 14, 60], ["Iron", 12, 17, 50], ["Steel", 15, 20, 40], ["Reinforced", 18, 23, 30], ["Mirrored", 21, 26, 20], ["Titanium", 24, 29, 10], ["Meteorite", 27, 32, 5]]}
|
||||
|
53
RPG/map.txt
53
RPG/map.txt
@ -1,53 +0,0 @@
|
||||
#####################################################
|
||||
#......:...................~......#.....#...##......#
|
||||
#.#......#....#..........~..............#~.......#..#
|
||||
#...........#...........#.........................:.#
|
||||
#.....##.....#........#..##.#..#..................###
|
||||
#..#...#...#..........#.........#....~.~..#.........#
|
||||
#...:.##....#....#...#..~.........:....#.#..........#
|
||||
#...#.....#..#.....#........:.....#...............#.#
|
||||
#.................#..........#....................#.#
|
||||
#....................#....#.............#...........#
|
||||
#..#...#...:.......................:.#....##........#
|
||||
#........#...#..#:..........#...................#...#
|
||||
#............................#.....:##:...#.#......##
|
||||
#:..~...........................:......#....#......##
|
||||
#....:...#...........#.:.....~.#....................#
|
||||
#.....#....:..#....:......#.....#:......#.....#.....#
|
||||
#....................##......##.#.....~..#..#.#...#.#
|
||||
#.....#..........~.........##....#...##..........##.#
|
||||
#.#......#...........#..........##..................#
|
||||
#..............#........#...........#...............#
|
||||
#.....###....#...~......#......:..##.#..............#
|
||||
#..#.....:.............#...#.............#....:.....#
|
||||
#..............#.:..#..#..~:....:.............:.#...#
|
||||
#...................#.......................#.......#
|
||||
#..........#.............................#..........#
|
||||
#.............#...................#..#..:~.......:..#
|
||||
#......:..#....#..##......@#...............#........#
|
||||
#.#...##...#............##......#....#....#.........#
|
||||
#.##...#.............~.##.~......#.#.........#......#
|
||||
#........#............#......#........~..#.....##.#.#
|
||||
#.#.#..........#........~.................:...#.:.#.#
|
||||
#...........#.................................#.....#
|
||||
#......#..:..................#.............~~.......#
|
||||
#.................~......:.....#..#.....:...........#
|
||||
#.....#...#........#......:.#.............:......:..#
|
||||
#.......:#.........#..........:.~...#..~.#...#....#.#
|
||||
#................................##..............#..#
|
||||
#............#.....~..........#.......#...........#.#
|
||||
#~#.........#..#...#.........##...........#....:.#..#
|
||||
#...................:......##..........#............#
|
||||
#...............#.....#............#........~.#:....#
|
||||
#.........#...#.........#...:..#..#.....#.#......#..#
|
||||
#.....##....#...............#..#..........~..##.....#
|
||||
#..............#.........#..................#....##.#
|
||||
#..................:#.#........................#....#
|
||||
#..........#.........................#........###:..#
|
||||
#..........#..:........##......#...........#.......##
|
||||
#.......::.....................##~#.....~...........#
|
||||
#:.......:.....##...........#......~...........#....#
|
||||
#............~.:...#.#:.....................#.....#.#
|
||||
##..#...#...#.......................................#
|
||||
#........#..#...##.#...............:.......#........#
|
||||
#####################################################
|
@ -1 +0,0 @@
|
||||
{"width": 52, "height": 52, "homeY": 26.0, "homeX": 26, "homeLoc": 1430, "desc": "Random Generation."}
|
@ -1 +0,0 @@
|
||||
{"monsters": ["Ruthless Doom Panther", "Primeval Frost Gorilla", "Elusive Corpse Leopard", "Blight Hog", "Electric Nether Wolf", "Savage Spite Owl", "Rabid Grief Frog", "Putrid Bulge Hound", "Howling Murder Yak", "Raging Ghost Spider"], "boss": {"pen": [{"luc": [50, 100]}, {"atk": [100, 10]}, {"def": [50, 5]}, {"atk": [5, 100]}], "names": ["Vexspawn", "Dreadtooth", "Thunderscream", "Doomfoot", "Germclaw", "Cinderface"]}}
|
@ -1 +0,0 @@
|
||||
{"oddluck": {"Lvl": 1, "Exp": 0, "MHP": 19, "HP": 19, "Atk": 1, "Def": 2, "Spd": 1, "Luc": 1, "Item": {"Head": {"Name": "Cloth", "Power": 0}, "Torso": {"Name": "Cloth", "Power": 0}, "lArm": {"Name": "Wooden", "Power": 0}, "rArm": {"Name": "Wooden", "Power": 0}}, "Deaths": 0, "Loc": 1430, "force": false}}
|
595
RPG/plugin.py
595
RPG/plugin.py
@ -1,595 +0,0 @@
|
||||
###
|
||||
# Copyright (c) 2011, Anthony Boot
|
||||
# Copyright (c) 2020, oddluck <oddluck@riseup.net>
|
||||
# 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 os
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.ircdb as ircdb
|
||||
import random
|
||||
try:
|
||||
import simplejson
|
||||
except:
|
||||
import json as simplejson
|
||||
|
||||
class RPG(callbacks.Plugin):
|
||||
'''A text based RPG for IRC channels. Requires the user to be registered
|
||||
with supybot to use it. all commands are prefixed with rpg. Command list:
|
||||
rpgmove rpgstats rpgrun rpgnew rpgloc rpgviewarea'''
|
||||
threaded = True
|
||||
playerData=mapData=mapInfo=monsterData=itemData={}
|
||||
consolechannel = None
|
||||
filepath = "{0}/".format(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
#########################
|
||||
### Game Commands ###
|
||||
#########################
|
||||
def reloaddata(self,irc,msg,args):
|
||||
"""Reload RPG data. """
|
||||
if not ircdb.users.getUser(msg.prefix)._checkCapability('admin'):
|
||||
irc.error('Only people with \'Admin\' can do that.')
|
||||
return
|
||||
else:
|
||||
self._getPlayerData()
|
||||
self._getMapData()
|
||||
self._getMapInfo()
|
||||
with open(self.filepath+'monsters.txt') as f:
|
||||
self.monsterData = simplejson.load(f)
|
||||
self._getItemsFile()
|
||||
irc.replySuccess()
|
||||
reloaddata = wrap(reloaddata)
|
||||
|
||||
def genmap(self,irc,msg,args,width,height):
|
||||
"""Generate map."""
|
||||
if not ircdb.users.getUser(msg.prefix)._checkCapability('owner'):
|
||||
irc.error('Only people with \'Admin\' can do that.')
|
||||
return
|
||||
else:
|
||||
if not width or not height:
|
||||
width=height=52
|
||||
else:
|
||||
try:
|
||||
width=int(width)
|
||||
height=int(height)
|
||||
except:
|
||||
irc.error('Invalid arguments given.')
|
||||
return
|
||||
random.seed()
|
||||
seed=random.random()
|
||||
random.seed(seed)
|
||||
terrain = []
|
||||
terrain += '#####:~...............................................'
|
||||
# # is wall : is boss ~ is item . is nothing.
|
||||
rand = {}
|
||||
terrainmap = ''
|
||||
self._sendDbg(irc,'Generating new usermap..')
|
||||
x = -1
|
||||
while x < width:
|
||||
terrainline=''
|
||||
x+=1
|
||||
y=-1
|
||||
while y < height:
|
||||
y+=1
|
||||
if x is 0 or x is width or y is 0 or y is height:
|
||||
terrainline+=terrain[0]
|
||||
continue
|
||||
if x is int(width/2) and y is int(height/2):
|
||||
terrainline+='@'
|
||||
y+=1
|
||||
rand[1]=int(random.random()*(len(terrain)-1))
|
||||
rand[2]=int(random.random()*(len(terrain)-1))
|
||||
rand[3]=int(random.random()*(len(terrain)-1))
|
||||
rand[4]=int(random.random()*(len(terrain)-1))
|
||||
if rand[1] is rand[2] and rand[1] is rand[3]:
|
||||
terrainline+=terrain[rand[1]]
|
||||
elif rand[1] is rand[2] or rand[1] is rand[3]:
|
||||
terrainline+=terrain[rand[1]]
|
||||
elif rand[2] is rand[3]:
|
||||
terrainline+=terrain[rand[2]]
|
||||
else:
|
||||
terrainline+=terrain[rand[4]]
|
||||
terrainmap+=terrainline+'\n'
|
||||
data = {'width':width,'height':height,'homeY':(height/2),'homeX':int(width/2),'homeLoc':int((height/2)+((width/2)*(width+2))),'desc':'Random Generation.'}
|
||||
with open(self.filepath+'mapData.txt','w') as f:
|
||||
simplejson.dump(data,f)
|
||||
self._saveMapData(terrainmap)
|
||||
irc.replySuccess('Map regeneration')
|
||||
self._sendDbg(irc,'Map created and saved to map.txt, info saved to mapData.txt')
|
||||
playerData=self.playerData
|
||||
for player in playerData:
|
||||
playerData[player]['Loc']=(height/2)+((width/2)*(width+2))
|
||||
self._savePlayerData(playerData)
|
||||
self._sendDbg(irc,'Players relocated successfully.')
|
||||
irc.replySuccess('Players Relocated to Home')
|
||||
genmap = wrap(genmap,[optional('somethingWithoutSpaces'),optional('somethingWithoutSpaces')])
|
||||
|
||||
def stats(self,irc,msg,args):
|
||||
"""Get player stats."""
|
||||
player = self._checkPlayer(irc,msg)
|
||||
playerData = self.playerData[player]
|
||||
level = playerData['Lvl']
|
||||
exp = playerData['Exp']
|
||||
next = self._getNextLevelXp(player)
|
||||
baseAtk = playerData['Atk']
|
||||
totalAtk = baseAtk+playerData['Item']['rArm']['Power']
|
||||
baseDef = playerData['Def']
|
||||
totalDef = baseDef+playerData['Item']['Head']['Power']+playerData['Item']['Torso']['Power']
|
||||
luck = playerData['Luc']
|
||||
block = playerData['Item']['lArm']['Power']
|
||||
deaths = playerData['Deaths']
|
||||
hp = playerData['HP']
|
||||
mhp = playerData['MHP']
|
||||
weapon = playerData['Item']['rArm']['Name']
|
||||
helmet = playerData['Item']['Head']['Name']
|
||||
shield = playerData['Item']['lArm']['Name']
|
||||
armour = playerData['Item']['Torso']['Name']
|
||||
irc.reply('%s is at Level %i with %i experience; %i is \
|
||||
needed for the next level. You have %i/%i HP. \
|
||||
Your base attack is %i and is boosted to %i by your %s Sword. Your base \
|
||||
defence is %i, boosted to %i with your %s Helmet and %s Armour. Your %s \
|
||||
Shield gives you a %i%s chance to block attacks. Your Luck \
|
||||
rating is %i. You have died %i times.\
|
||||
'%(player,level,exp,next,hp,mhp,baseAtk,totalAtk,weapon,baseDef,totalDef,helmet,armour,shield,block,'%',luck,deaths) )
|
||||
stats = wrap(stats)
|
||||
|
||||
def newplayer(self,irc,msg,args):
|
||||
"""Create new RPG player."""
|
||||
player = self._checkPlayer(irc,msg,1)
|
||||
playerData = self.playerData
|
||||
|
||||
playerData[player]={}
|
||||
playerData[player]['Lvl'] = 1
|
||||
playerData[player]['Exp'] = 0
|
||||
playerData[player]['MHP'] = int(random.random()*20)+15
|
||||
playerData[player]['HP'] = playerData[player]['MHP']
|
||||
playerData[player]['Atk'] = int(random.random()*5)+1
|
||||
playerData[player]['Def'] = int(random.random()*5)+1
|
||||
playerData[player]['Spd'] = int(random.random()*5)+1
|
||||
playerData[player]['Luc'] = int(random.random()*2)+1
|
||||
playerData[player]['Item']={}
|
||||
playerData[player]['Item']['Head'] = {'Name': 'Cloth', 'Power': int(random.random()*3)}
|
||||
playerData[player]['Item']['Torso'] = {'Name': 'Cloth', 'Power': int(random.random()*3)}
|
||||
playerData[player]['Item']['lArm'] = {'Name': 'Wooden', 'Power': int(random.random()*5)}
|
||||
playerData[player]['Item']['rArm'] = {'Name': 'Wooden', 'Power': int(random.random()*3)}
|
||||
playerData[player]['Deaths'] = 0
|
||||
playerData[player]['Loc']=self.mapInfo['homeLoc']
|
||||
playerData[player]['force']=False
|
||||
self._sendDbg(irc,player+' has been reset/created')
|
||||
self._savePlayerData(playerData)
|
||||
self.stats(irc,msg,args)
|
||||
newplayer = wrap(newplayer)
|
||||
|
||||
def location(self,irc,msg,args):
|
||||
"""Get player location"""
|
||||
player = self._checkPlayer(irc,msg)
|
||||
location = self.playerData[player]['Loc']
|
||||
mapInfo = self.mapInfo
|
||||
x=0
|
||||
while True:
|
||||
if location > mapInfo['width']:
|
||||
location-=(mapInfo['width']+2)
|
||||
x+=1
|
||||
else:
|
||||
break
|
||||
y = location
|
||||
irc.reply('You are located at (%i,%i). Home is at (%i,%i)'%(x,y,self.mapInfo['homeX'],self.mapInfo['homeY']))
|
||||
location = wrap(location)
|
||||
|
||||
def look(self,irc,msg,args):
|
||||
"""Look aroun."""
|
||||
player = self._checkPlayer(irc,msg)
|
||||
location = self.playerData[player]['Loc']
|
||||
mapData = self.mapData
|
||||
mapInfo = self.mapInfo
|
||||
area = []
|
||||
area += mapData[location-(mapInfo['width']+3)]
|
||||
area += mapData[location-(mapInfo['width']+2)]
|
||||
area += mapData[location-(mapInfo['width']+1)]
|
||||
area += mapData[location-1]
|
||||
area += mapData[location+1]
|
||||
area += mapData[location+(mapInfo['width']+1)]
|
||||
area += mapData[location+(mapInfo['width']+2)]
|
||||
area += mapData[location+(mapInfo['width']+3)]
|
||||
for x in area:
|
||||
line = area.index(x)
|
||||
if x is '.':
|
||||
area[line]='Nothing'
|
||||
elif x is '#':
|
||||
area[line]='Wall'
|
||||
elif x is '~':
|
||||
area[line]='Item'
|
||||
elif x is ':':
|
||||
area[line]='Boss'
|
||||
elif x is '@':
|
||||
area[line]='Home'
|
||||
irc.reply('NW: %s - N: %s - NE: %s - W: %s - E: %s - SW: %s - S: %s - SE: %s\
|
||||
'%(area[0],area[1],area[2],area[3],area[4],area[5],area[6],area[7])
|
||||
)
|
||||
look=wrap(look)
|
||||
|
||||
def forcebattle(self,irc,msg,args):
|
||||
"""Force battle nex turn."""
|
||||
player=self._checkPlayer(irc,msg)
|
||||
if self.playerData[player]['force']:
|
||||
self.playerData[player]['force']=False
|
||||
irc.reply('%s will no longer enter a battle on the next turn.'%player.capitalize(),prefixNick=False)
|
||||
else:
|
||||
self.playerData[player]['force']=True
|
||||
irc.reply('%s will enter a monster battle on their next turn.'%player.capitalize(),prefixNick=False)
|
||||
forcebattle=wrap(forcebattle)
|
||||
|
||||
def move(self,irc,msg,args,direction,number):
|
||||
"""[direction] [number]
|
||||
Move [direction] [number].
|
||||
"""
|
||||
player = self._checkPlayer(irc,msg)
|
||||
playerData = self.playerData
|
||||
mapData = self.mapData
|
||||
mapInfo = self.mapInfo
|
||||
direction = direction.upper()
|
||||
try: number = int(number)
|
||||
except: number = 1
|
||||
if number == 0: number=1
|
||||
x = 0
|
||||
while x < number:
|
||||
if direction == 'NW':
|
||||
if mapData[playerData[player]['Loc']-(mapInfo['width']+3)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']-=(mapInfo['width']+3)
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'N':
|
||||
if mapData[playerData[player]['Loc']-(mapInfo['width']+2)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']-=(mapInfo['width']+2)
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'NE':
|
||||
if mapData[playerData[player]['Loc']-(mapInfo['width']+1)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']-=(mapInfo['width']+1)
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'W':
|
||||
if mapData[playerData[player]['Loc']-1] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']-=1
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'E':
|
||||
if mapData[playerData[player]['Loc']+1] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']+=1
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'SW':
|
||||
if mapData[playerData[player]['Loc']+(mapInfo['width']+1)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']+=(mapInfo['width']+1)
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'S':
|
||||
if mapData[playerData[player]['Loc']+(mapInfo['width']+2)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']+=(mapInfo['width']+2)
|
||||
self._savePlayerData(playerData)
|
||||
elif direction == 'SE':
|
||||
if mapData[playerData[player]['Loc']+(mapInfo['width']+3)] is '#':
|
||||
irc.error('You can\'t move there.')
|
||||
return
|
||||
else:
|
||||
playerData[player]['Loc']+=(mapInfo['width']+3)
|
||||
self._savePlayerData(playerData)
|
||||
else:
|
||||
irc.error("Move failed. you gave %s as a direction. %s"%(direction,str(type(direction))))
|
||||
if mapData[playerData[player]['Loc']] is '~':
|
||||
itemFound = self._genItem(player,2)
|
||||
changedMap = list(mapData)
|
||||
changedMap[playerData[player]['Loc']]='.'
|
||||
mapData = "".join(changedMap)
|
||||
self._saveMapData(mapData)
|
||||
irc.reply("You found a %s %s!" % (itemFound['name'], itemFound['item'].capitalize()))
|
||||
elif mapData[playerData[player]['Loc']] is ':':
|
||||
self._doBattle(irc,player,2,msg.nick)
|
||||
elif mapData[playerData[player]['Loc']] is '.':
|
||||
if playerData[player]['force'] is True:
|
||||
self._sendDbg(irc,"Battle Forced")
|
||||
playerData[player]['force']=False
|
||||
self._doBattle(irc,player,1,msg.nick)
|
||||
self._savePlayerData(playerData)
|
||||
elif int(random.random()*100) < 5:
|
||||
self._doBattle(irc,player,1,msg.nick)
|
||||
elif mapData[playerData[player]['Loc']] is '@':
|
||||
playerData[player]['HP']=playerData[player]['MHP']
|
||||
# irc.reply("Your health has been restored.")
|
||||
irc.queueMsg(ircmsgs.IrcMsg('NOTICE {0} :Your health has been restored.'.format(msg.nick)))
|
||||
self._savePlayerData(playerData)
|
||||
x+=1
|
||||
move = wrap(move,['somethingWithoutSpaces',optional('int')])
|
||||
|
||||
############################
|
||||
### Engine functions ###
|
||||
############################
|
||||
def _checkPlayer(self,irc,msg,new=0):
|
||||
try:
|
||||
player = str(ircdb.users.getUser(msg.prefix))
|
||||
player = player.split('name=\"')[1].split('\",')[0]
|
||||
except KeyError:
|
||||
irc.errorNotRegistered()
|
||||
try:
|
||||
test=self.playerData[player]
|
||||
except:
|
||||
if new is 0:
|
||||
irc.error('Use rpg new to create an RPG character first.')
|
||||
return player
|
||||
|
||||
def _getPlayerData(self):
|
||||
with open(self.filepath+'players.txt','r') as f:
|
||||
self.playerData=simplejson.load(f)
|
||||
|
||||
def _savePlayerData(self,data):
|
||||
with open(self.filepath+'players.txt','w') as f:
|
||||
simplejson.dump(data,f)
|
||||
self._getPlayerData()
|
||||
|
||||
def _getMapData(self):
|
||||
with open(self.filepath+'map.txt','r') as f:
|
||||
self.mapData=f.read()
|
||||
self._getMapInfo()
|
||||
|
||||
def _saveMapData(self,data):
|
||||
with open(self.filepath+'map.txt','w') as f:
|
||||
f.write(data)
|
||||
self._getMapData()
|
||||
|
||||
def _getMapInfo(self):
|
||||
with open(self.filepath+'mapData.txt','r') as f:
|
||||
self.mapInfo = simplejson.load(f)
|
||||
|
||||
def _getItemsFile(self):
|
||||
with open(self.filepath+'items.txt','r') as f:
|
||||
self.itemData = simplejson.load(f)
|
||||
|
||||
def _sendDbg(self,irc,data):
|
||||
data = 'RPG: '+str(data)
|
||||
if(self.consolechannel): irc.queueMsg(ircmsgs.privmsg(self.consolechannel, data))
|
||||
self.log.debug(data)
|
||||
|
||||
def _doBattle(self,irc,player,level=1,nick='StewieGriffin'):
|
||||
random.seed()
|
||||
playerData = self.playerData
|
||||
if level is 1:
|
||||
monster=self._genMonster(player)
|
||||
if level is 2:
|
||||
monster=self._genBoss(player)
|
||||
|
||||
irc.reply('%s has encountered Level %i %s and could potentially earn %i experience!\
|
||||
'%(player,monster['Lvl'],monster['Name'],monster['Exp']),prefixNick=False)
|
||||
|
||||
self._sendDbg(irc,monster)
|
||||
battleData={'player':{'atks':0,'blocks':0,'crits':0},'monster':{'atks':0,'crits':0,'evades':0},'rounds':0}
|
||||
|
||||
def _doMonster():
|
||||
if (random.random()*100 < playerData[player]['Item']['rArm']['Power']):
|
||||
battleData['player']['blocks']+=1
|
||||
else:
|
||||
battleData['monster']['atks']+=1
|
||||
atkValue = int(random.random()*(monster['Atk']))+2
|
||||
if (random.random()*100 < 2):
|
||||
atkValue*=2
|
||||
battleData['monster']['crits']+=1
|
||||
playerData[player]['HP']-=(atkValue-(playerData[player]['Def']*playerData[player]['Item']['Torso']['Power']))
|
||||
if playerData[player]['HP'] <= 0:
|
||||
return monster['Name']
|
||||
|
||||
def _doPlayer():
|
||||
if(random.random()*100<10):
|
||||
battleData['monster']['evades']+=1
|
||||
else:
|
||||
battleData['player']['atks']+=1
|
||||
playerAtk=int(random.random()*(playerData[player]['Atk']+playerData[player]['Item']['lArm']['Power']))+2
|
||||
if(random.random()*100 < playerData[player]['Luc']):
|
||||
playerAtk*=2
|
||||
battleData['player']['crits']+=1
|
||||
monster['HP']-=playerAtk
|
||||
if monster['HP'] <=0:
|
||||
return player
|
||||
winner = None
|
||||
while winner is None:
|
||||
battleData['rounds']+=1
|
||||
if monster['Spd'] > playerData[player]['Spd']:
|
||||
winner = _doMonster()
|
||||
if winner is None:
|
||||
winner = _doPlayer()
|
||||
else:
|
||||
winner = _doPlayer()
|
||||
if winner is None:
|
||||
winner = _doMonster()
|
||||
if winner is player:
|
||||
self._playerWin(irc,player,monster,playerData)
|
||||
else:
|
||||
self._playerDead(irc,player,monster,playerData)
|
||||
bDataString='Battle lasted %i rounds, you scored %i hits, %i were critical and %i were evaded attacks. %s made %i attacks, %i were critical and %i were blocked.\
|
||||
'%(battleData['rounds'],battleData['player']['atks'],battleData['player']['crits'],battleData['monster']['evades'],monster['Name'],battleData['monster']['atks'],battleData['monster']['crits'],battleData['player']['blocks'])
|
||||
irc.queueMsg(ircmsgs.IrcMsg('NOTICE {0} :{1}'.format(nick,bDataString)))
|
||||
# irc.reply(bDataString,prefixNick=False)
|
||||
|
||||
def _playerDead(self,irc,player,monster,playerData):
|
||||
#irc.reply('OOOOOOH YOU JUST GOT PWNT! - You\'ve been sent back home and fully healed. Luckily theres no penalties for dying.')
|
||||
irc.reply('{0} HAS BEEN SLAIN! - You\'ve been sent back home and fully healed. Luckily there\'s no penalties for dying.'.format(player))
|
||||
playerData[player]['HP'] = playerData[player]['MHP']
|
||||
playerData[player]['Loc'] = self.mapInfo['homeLoc']
|
||||
playerData[player]['Deaths']+=1
|
||||
self._savePlayerData(playerData)
|
||||
|
||||
def _playerWin(self,irc,player,monster,playerData):
|
||||
winString='%s won the battle! %s gained %i experience.'%(player,player,monster['Exp'])
|
||||
self._checkLevelUp(irc,player,monster['Exp'])
|
||||
if(int(random.random()*100)<5):
|
||||
itemWon=self._genItem(player)
|
||||
winString=' You found a %s %s, '%(itemWon['name'],itemWon['item'].capitalize())
|
||||
better=False
|
||||
oldEquip={}
|
||||
if itemWon['item'] is 'sword':
|
||||
if itemWon['Power'] > playerData[player]['Item']['lArm']['Power']:
|
||||
oldEquip['Name']=playerData[player]['lArm']['Name']
|
||||
oldEquip['Power']=playerData[player]['lArm']['Power']
|
||||
playerData[player]['lArm']['Power']=itemWon['power']
|
||||
playerData[player]['lArm']['Name']=itemWon['name']
|
||||
better = True
|
||||
elif itemWon['item'] is 'shield':
|
||||
if itemWon['Power'] > playerData[player]['Item']['rArm']['Power']:
|
||||
oldEquip['Name']=playerData[player]['rArm']['Name']
|
||||
oldEquip['Power']=playerData[player]['rArm']['Power']
|
||||
playerData[player]['rArm']['Power']=itemWon['power']
|
||||
playerData[player]['rArm']['Name']=itemWon['name']
|
||||
better = True
|
||||
elif itemWon['item'] is 'helmet':
|
||||
if itemWon['Power'] > playerData[player]['Item']['Head']['Power']:
|
||||
oldEquip['Name']=playerData[player]['Head']['Name']
|
||||
oldEquip['Power']=playerData[player]['Head']['Power']
|
||||
playerData[player]['Head']['Power']=itemWon['power']
|
||||
playerData[player]['Head']['Name']=itemWon['name']
|
||||
better = True
|
||||
elif itemWon['item'] is 'armour':
|
||||
if itemWon['Power'] > playerData[player]['Item']['Torso']['Power']:
|
||||
oldEquip['Name']=playerData[player]['Torso']['Name']
|
||||
oldEquip['Power']=playerData[player]['Torso']['Power']
|
||||
playerData[player]['Torso']['Power']=itemWon['power']
|
||||
playerData[player]['Torso']['Name']=itemWon['name']
|
||||
better = True
|
||||
if better:
|
||||
winString+=' its better than your old %s %s, so you discard it and equip the %s %s\
|
||||
'%(oldEquip['Name'],itemWon['item'].capitalize(),itemWon['name'],itemWon['item'].capitalize())
|
||||
else:
|
||||
winString+=' unfortunlatly your old %s %s is better, so you throw the %s %s aside\
|
||||
'%(oldEquip['Name'],itemWon['item'].capitalize(),itemWon['name'],itemWon['item'].capitalize())
|
||||
self._savePlayerData(playerData)
|
||||
irc.reply(winString,prefixNick=False)
|
||||
|
||||
def _genItem(self,player,level=1):
|
||||
playerData = self.playerData
|
||||
itemData = self.itemData
|
||||
genChance=(100-playerData[player]['Luc'])/(level+1)
|
||||
itemType=int(random.random()*3)
|
||||
itemToReturn = possibleItem = {}
|
||||
if itemType is 0: #Sword
|
||||
possibleItem['item']='sword'
|
||||
itemBase = False
|
||||
while itemBase is False:
|
||||
possibleItem=itemData['swords'][int(random.random()*len(itemData['swords']))]
|
||||
if int(random.random()*genChance) < possibleItem[3]:
|
||||
itemBase=possibleItem
|
||||
itemToReturn['name']=possibleItem[0]
|
||||
itemToReturn['power']=int((random.random()*(possibleItem[2]-possibleItem[1]))+possibleItem[1])
|
||||
else:
|
||||
if itemType is 1: #Shield
|
||||
possibleItem['item']='shield'
|
||||
elif itemType is 2: #Helmet
|
||||
possibleItem['item']='helmet'
|
||||
elif itemType is 3: #Torso
|
||||
possibleItem['item']='armour'
|
||||
itemBase = False
|
||||
while itemBase is False:
|
||||
possibleItem=itemData['defence'][int(random.random()*len(itemData['defence']))]
|
||||
if int(random.random()*genChance < possibleItem[3]):
|
||||
itemBase=possibleItem
|
||||
itemToReturn['name']=possibleItem[0]
|
||||
itemToReturn['power']=int((random.random()*(possibleItem[2]-possibleItem[1]))+possibleItem[1])
|
||||
itemBoost = False
|
||||
while itemBoost is False:
|
||||
booster = itemData['modifiers'][random.randint(0,len(itemData['modifiers'])-1)]
|
||||
print(booster)
|
||||
if genChance < booster[3]:
|
||||
itemBoost = booster;
|
||||
itemToReturn['name']='%s %s'%(booster[0],itemToReturn['name'])
|
||||
itemToReturn['power']=itemToReturn['power']*(random.random()*(booster[2]-booster[1]))+booster[1]
|
||||
return itemToReturn
|
||||
|
||||
def _genMonster(self,player):
|
||||
monster={}
|
||||
monster['Lvl']=self.playerData[player]['Lvl']+(int(random.random()*5))
|
||||
monster['Atk']=int((random.random()*(7*monster['Lvl']))+1)+10
|
||||
monster['Def']=int((random.random()*(7*monster['Lvl']))+1)+10
|
||||
monster['MHP']=int((random.random()*(7*monster['Lvl']))+1)+15
|
||||
monster['HP']=monster['MHP']
|
||||
monster['Name']=self.monsterData['monsters'][int(random.random()*len(self.monsterData['monsters']))]
|
||||
monster['Spd']=int((random.random()*(5*monster['Lvl']))+1)
|
||||
monster['Exp']=int((random.random()*monster['Lvl'])+(self.playerData[player]['Lvl']/2))+1
|
||||
return monster
|
||||
|
||||
def _genBoss(self,player):
|
||||
monster={}
|
||||
monster['Lvl']=self.playerData[player]['Lvl']+(int(random.random()*5))
|
||||
monster['Atk']=int((random.random()*(14*monster['Lvl']))+1)+10
|
||||
monster['Def']=int((random.random()*(14*monster['Lvl']))+1)+10
|
||||
monster['MHP']=int((random.random()*(14*monster['Lvl']))+1)+15
|
||||
monster['HP']=monster['MHP']
|
||||
monster['Name']=self.monsterData['boss']['names'][int(random.random()*len(self.monsterData['boss']['names']))]+'\'s '+self.monsterData['monsters'][int(random.random()*len(self.monsterData['monsters']))]
|
||||
monster['Spd'] = int((random.random()*(7*monster['Lvl']))+1)
|
||||
monster['Exp'] = int((random.random()*monster['Lvl'])+(self.playerData[player]['Lvl']/2)+1)+5
|
||||
monster['pen'] = self.monsterData['boss']['pen'][int(random.random()*len(self.monsterData['boss']['pen']))]
|
||||
return monster
|
||||
|
||||
def _checkLevelUp(self,irc,player,xp):
|
||||
playerData = self.playerData
|
||||
nLvl = self._getNextLevelXp(player)
|
||||
playerData[player]['Exp']+=xp
|
||||
if playerData[player]['Exp'] >= nLvl:
|
||||
playerData[player]['MHP']+=int(random.random()*7)
|
||||
playerData[player]['Atk']+=int(random.random()*7)
|
||||
playerData[player]['Def']+=int(random.random()*7)
|
||||
playerData[player]['Spd']+=int(random.random()*7)
|
||||
playerData[player]['Luc']+=int(random.random()*4)
|
||||
playerData[player]['Lvl']+=1
|
||||
irc.reply('%s has leveled up, (s)he is now level %i. New stats are Attack: %i, Defence: %i, Speed: %i and Luck: %i\
|
||||
'%(player,playerData[player]['Lvl'],playerData[player]['Atk'],playerData[player]['Def'],playerData[player]['Spd'],playerData[player]['Luc']),prefixNick=False)
|
||||
self._savePlayerData(playerData)
|
||||
|
||||
def _getNextLevelXp(self,player):
|
||||
levelBaseXp = 50
|
||||
pLvl = self.playerData[player]['Lvl']
|
||||
return (levelBaseXp*pLvl)+((levelBaseXp*pLvl)/2)
|
||||
|
||||
Class = RPG
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
@ -40,7 +40,6 @@ import sys
|
||||
from urllib.parse import urlencode, urlparse, parse_qsl
|
||||
from bs4 import BeautifulSoup
|
||||
import random
|
||||
import json
|
||||
import time
|
||||
from jinja2 import Template
|
||||
import timeout_decorator
|
||||
@ -168,7 +167,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response is not None and "title" in response:
|
||||
video = response
|
||||
@ -185,7 +184,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
api_url)
|
||||
else:
|
||||
log.error("SpiffyTitles: dailymotion handler returned %s: %s" %
|
||||
(request.status_code, request.text[:200]))
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
if title is None:
|
||||
log.debug("SpiffyTitles: could not get dailymotion info for %s" % url)
|
||||
@ -223,7 +222,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response is not None and "title" in response[0]:
|
||||
video = response[0]
|
||||
@ -252,8 +251,8 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
log.debug("SpiffyTitles: received unexpected payload from video: %s" %
|
||||
api_url)
|
||||
else:
|
||||
log.error("SpiffyTitles: vimeo handler returned %s: %s" % (request.status_code,
|
||||
request.text[:200]))
|
||||
log.error("SpiffyTitles: vimeo handler returned %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
if title is None:
|
||||
log.debug("SpiffyTitles: could not get vimeo info for %s" % url)
|
||||
@ -289,7 +288,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response:
|
||||
video = response
|
||||
@ -302,7 +301,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
title = coub_template.render(video)
|
||||
else:
|
||||
log.error("SpiffyTitles: coub handler returned %s: %s" %
|
||||
(request.status_code, request.text[:200]))
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
if title is None:
|
||||
if coub_handler_enabled:
|
||||
@ -674,7 +673,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response:
|
||||
try:
|
||||
@ -748,7 +747,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
log.error("SpiffyTitles: Error parsing Youtube API JSON response")
|
||||
else:
|
||||
log.error("SpiffyTitles: Youtube API HTTP %s: %s" %
|
||||
(request.status_code, request.text))
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
# If we found a title, return that. otherwise, use default handler
|
||||
if title:
|
||||
@ -896,7 +895,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
data = {}
|
||||
extract = ""
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
if response:
|
||||
self.log.debug("SpiffyTitles: twitch - got response:\n%s" % (response))
|
||||
if 'error' in response:
|
||||
@ -915,9 +914,10 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
user_data = {}
|
||||
if not ok:
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" % (request.status_code, request.text))
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
else:
|
||||
response = json.loads(request.text)
|
||||
response = requests.json()
|
||||
if not response:
|
||||
self.log.error("SpiffyTitles: Error parsing Twitch JSON response")
|
||||
else:
|
||||
@ -953,7 +953,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
created_at = self._time_created_at(data['started_at'])
|
||||
if game_id:
|
||||
get_game = requests.get("https://api.twitch.tv/helix/games?id={}".format(game_id), timeout=10, headers=headers)
|
||||
game_data = json.loads(get_game.text)
|
||||
game_data = get_game.json()
|
||||
game_name = game_data["data"][0]["name"]
|
||||
template_vars = {
|
||||
"display_name": display_name,
|
||||
@ -973,9 +973,10 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
user_data = {}
|
||||
if not ok:
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" % (request.status_code, request.text))
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
else:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
if not response:
|
||||
self.log.error("SpiffyTitles: Error parsing Twitch JSON response")
|
||||
else:
|
||||
@ -994,7 +995,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
created_at = self._time_created_at(data['created_at'])
|
||||
if game_id:
|
||||
get_game = requests.get("https://api.twitch.tv/helix/games?id={}".format(game_id), timeout=10, headers=headers)
|
||||
game_data = json.loads(get_game.text)
|
||||
game_data = get_game.json()
|
||||
game_name = game_data["data"][0]["name"]
|
||||
template_vars = {
|
||||
"display_name": display_name,
|
||||
@ -1014,9 +1015,10 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
user_data = {}
|
||||
if not ok:
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" % (request.status_code, request.text))
|
||||
self.log.error("SpiffyTitles: twitch HTTP %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
else:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
if not response:
|
||||
self.log.error("SpiffyTitles: Error parsing Twitch JSON response")
|
||||
else:
|
||||
@ -1103,7 +1105,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
request = requests.get(omdb_url, timeout=10, headers=headers)
|
||||
|
||||
if request.status_code == requests.codes.ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
result = None
|
||||
imdb_template = Template(self.registryValue("imdb.template"))
|
||||
not_found = "Error" in response
|
||||
@ -1146,7 +1148,8 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
}
|
||||
result = imdb_template.render(template_vars)
|
||||
else:
|
||||
log.error("SpiffyTitles OMDB API %s - %s" % (request.status_code, request.text))
|
||||
log.error("SpiffyTitles OMDB API %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
except requests.exceptions.Timeout as e:
|
||||
log.error("SpiffyTitles imdb Timeout: %s" % (str(e)))
|
||||
@ -1221,7 +1224,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
ok = request.status_code == requests.codes.ok
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response:
|
||||
try:
|
||||
@ -1233,7 +1236,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
self.log.error("SpiffyTitles: Error parsing Wikipedia API JSON response")
|
||||
else:
|
||||
self.log.error("SpiffyTitles: Wikipedia API HTTP %s: %s" %
|
||||
(request.status_code, request.text))
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
if extract:
|
||||
if (self.registryValue("wikipedia.removeParentheses")):
|
||||
@ -1301,7 +1304,7 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
extract = ''
|
||||
|
||||
if ok:
|
||||
response = json.loads(request.text)
|
||||
response = request.json()
|
||||
|
||||
if response:
|
||||
try:
|
||||
@ -1320,7 +1323,8 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
else:
|
||||
self.log.error("SpiffyTitles: Error parsing Reddit JSON response")
|
||||
else:
|
||||
self.log.error("SpiffyTitles: Reddit HTTP %s: %s" % (request.status_code, request.text))
|
||||
self.log.error("SpiffyTitles: Reddit HTTP %s: %s" %
|
||||
(request.status_code, request.content.decode()[:200]))
|
||||
|
||||
if data:
|
||||
today = pendulum.now().date()
|
||||
@ -1742,4 +1746,3 @@ class SpiffyTitles(callbacks.Plugin):
|
||||
return template
|
||||
|
||||
Class = SpiffyTitles
|
||||
|
||||
|
@ -717,7 +717,7 @@ class TextArt(callbacks.Plugin):
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
r = requests.head(url, headers=header)
|
||||
if "text/plain" in r.headers["content-type"] or url.startswith('https://paste.ee/r/'):
|
||||
file = requests.get(url, headers=header)
|
||||
file = requests.get(url, headers=header, timeout=10)
|
||||
else:
|
||||
irc.reply("Invalid file type.", private=False, notice=False)
|
||||
return
|
||||
@ -767,26 +767,26 @@ class TextArt(callbacks.Plugin):
|
||||
if words:
|
||||
for word in words:
|
||||
if word.strip():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(word.strip(), font))
|
||||
for line in data.text.splitlines():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(word.strip(), font), timeout=10)
|
||||
for line in data.content.decode().splitlines():
|
||||
if line.strip():
|
||||
irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False)
|
||||
else:
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(text, font))
|
||||
for line in data.text.splitlines():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font={1}".format(text, font), timeout=10)
|
||||
for line in data.content.decode().splitlines():
|
||||
if line.strip():
|
||||
irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel)
|
||||
elif 'font' not in optlist:
|
||||
if words:
|
||||
for word in words:
|
||||
if word.strip():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(word.strip()))
|
||||
for line in data.text.splitlines():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(word.strip()), timeout=10)
|
||||
for line in data.content.decode().splitlines():
|
||||
if line.strip():
|
||||
irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel)
|
||||
else:
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(text))
|
||||
for line in data.text.splitlines():
|
||||
data = requests.get("https://artii.herokuapp.com/make?text={0}&font=univers".format(text), timeout=10)
|
||||
for line in data.content.decode().splitlines():
|
||||
if line.strip():
|
||||
irc.reply(ircutils.mircColor(line, color1, color2), prefixNick=False, private=False, notice=False, to=channel)
|
||||
|
||||
@ -796,8 +796,8 @@ class TextArt(callbacks.Plugin):
|
||||
"""
|
||||
Get list of artii figlet fonts.
|
||||
"""
|
||||
fontlist = requests.get("https://artii.herokuapp.com/fonts_list")
|
||||
response = sorted(fontlist.text.split('\n'))
|
||||
fontlist = requests.get("https://artii.herokuapp.com/fonts_list", timeout=10)
|
||||
response = sorted(fontlist.content.decode().split('\n'))
|
||||
irc.reply(str(response).replace('\'', '').replace('[', '').replace(']', ''))
|
||||
fontlist = wrap(fontlist)
|
||||
|
||||
@ -897,25 +897,23 @@ class TextArt(callbacks.Plugin):
|
||||
cols = self.registryValue('blockWidth', msg.args[0])
|
||||
if 's' in optlist:
|
||||
s = float(optlist.get('s'))
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
filepath = "{0}/tmp".format(path)
|
||||
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
||||
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
||||
r = requests.head(url, headers=header)
|
||||
if r.headers["content-type"] in image_formats:
|
||||
response = requests.get(url, headers=header)
|
||||
response = requests.get(url, stream=True, timeout=10, headers=header)
|
||||
else:
|
||||
irc.reply("Invalid file type.", private=False, notice=False)
|
||||
irc.reply("Error: Invalid file type.", private=False, notice=False)
|
||||
return
|
||||
if response.status_code == 200:
|
||||
with open("{0}".format(filename), 'wb') as f:
|
||||
f.write(response.content)
|
||||
response.raw.decode_content = True
|
||||
image = Image.open(response.raw)
|
||||
else:
|
||||
irc.reply("Error: Unable to open image.", private=False, notice=False)
|
||||
# open image and convert to grayscale
|
||||
start_time = time.time()
|
||||
self.source_colors = 0
|
||||
image = Image.open(filename)
|
||||
if image.mode == 'RGBA':
|
||||
if bg == 99:
|
||||
newbg = 1
|
||||
@ -1165,7 +1163,7 @@ class TextArt(callbacks.Plugin):
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
r = requests.head(url, headers=header)
|
||||
if "text/plain" in r.headers["content-type"]:
|
||||
file = requests.get(url, headers=header)
|
||||
file = requests.get(url, timeout=10, headers=header)
|
||||
else:
|
||||
irc.reply("Invalid file type.", private=False, notice=False)
|
||||
return
|
||||
@ -1217,7 +1215,7 @@ class TextArt(callbacks.Plugin):
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
filepath = "{0}/tmp".format(path)
|
||||
filename = "{0}/{1}".format(filepath, url.split('/')[-1])
|
||||
r = requests.get(url, headers=header)
|
||||
r = requests.get(url, timeout=10, headers=header)
|
||||
open(filename, 'wb').write(r.content.replace(b';5;', b';'))
|
||||
try:
|
||||
output = pexpect.run('a2m {0} {1}'.format(opts.strip(), str(filename)))
|
||||
@ -1300,7 +1298,7 @@ class TextArt(callbacks.Plugin):
|
||||
image_formats = ("image/png", "image/jpeg", "image/jpg", "image/gif")
|
||||
r = requests.head(url, headers=header)
|
||||
if r.headers["content-type"] in image_formats:
|
||||
response = requests.get(url, headers=header)
|
||||
response = requests.get(url, timeout=10, headers=header)
|
||||
else:
|
||||
irc.reply("Invalid file type.", private=False, notice=False)
|
||||
return
|
||||
@ -1513,7 +1511,7 @@ class TextArt(callbacks.Plugin):
|
||||
speed = 'slow'
|
||||
else:
|
||||
speed = 'fast'
|
||||
file = requests.get("http://wttr.in/{0}".format(location))
|
||||
file = requests.get("http://wttr.in/{0}".format(location), timeout=10)
|
||||
output = file.content.decode()
|
||||
output = self.ansi2irc(output)
|
||||
output = re.sub('⚡', '☇ ', output)
|
||||
@ -1568,7 +1566,7 @@ class TextArt(callbacks.Plugin):
|
||||
sub = 'usd'
|
||||
if not coin:
|
||||
coin = ''
|
||||
file = requests.get("http://{0}.rate.sx/{1}".format(sub, coin))
|
||||
file = requests.get("http://{0}.rate.sx/{1}".format(sub, coin), timeout=10)
|
||||
output = file.content.decode()
|
||||
output = self.ansi2irc(output)
|
||||
output = output.replace('\x1b(B', '')
|
||||
@ -1608,10 +1606,10 @@ class TextArt(callbacks.Plugin):
|
||||
type = optlist.get('type')
|
||||
else:
|
||||
type = 'default'
|
||||
data = requests.get("https://easyapis.soue.tk/api/cowsay?text={0}&type={1}".format(text, type))
|
||||
data = requests.get("https://easyapis.soue.tk/api/cowsay?text={0}&type={1}".format(text, type), tiemout=10)
|
||||
self.stopped[msg.args[0]] = False
|
||||
paste = ''
|
||||
for line in data.text.splitlines():
|
||||
for line in data.content.decode().splitlines():
|
||||
if self.registryValue('pasteEnable', msg.args[0]):
|
||||
paste += line + "\n"
|
||||
if not line.strip() and not self.stopped[msg.args[0]]:
|
||||
@ -1639,8 +1637,8 @@ class TextArt(callbacks.Plugin):
|
||||
else:
|
||||
delay = self.registryValue('delay', msg.args[0])
|
||||
self.stopped[msg.args[0]] = False
|
||||
data = requests.get("http://www.asciiartfarts.com/fortune.txt")
|
||||
fortunes = data.text.split('%\n')
|
||||
data = requests.get("http://www.asciiartfarts.com/fortune.txt", timeout=10)
|
||||
fortunes = data.content.decode().split('%\n')
|
||||
fortune = random.randrange(0, len(fortunes))
|
||||
for line in fortunes[fortune].splitlines():
|
||||
if not line.strip() and not self.stopped[msg.args[0]]:
|
||||
@ -1668,10 +1666,10 @@ class TextArt(callbacks.Plugin):
|
||||
self.stopped[msg.args[0]] = False
|
||||
ua = UserAgent(fallback="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0")
|
||||
header = {'User-Agent':str(ua.random)}
|
||||
data = requests.get("https://mircart.org/?s={0}".format(search), headers=header)
|
||||
soup = BeautifulSoup(data.text)
|
||||
data = requests.get("https://mircart.org/?s={0}".format(search), headers=header, timeout=10)
|
||||
soup = BeautifulSoup(data.content)
|
||||
url = soup.find(href=re.compile(".txt"))
|
||||
data = requests.get(url.get('href'), headers=header)
|
||||
data = requests.get(url.get('href'), headers=header, timeout=10)
|
||||
output = data.content.decode()
|
||||
for line in output.splitlines():
|
||||
if not line.strip() and not self.stopped[msg.args[0]]:
|
||||
|
@ -440,7 +440,7 @@ class Trackers(callbacks.Plugin):
|
||||
return
|
||||
|
||||
# Extract statuses
|
||||
status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)"', content.text)
|
||||
status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)"', content.content.decode())
|
||||
print(status_txt)
|
||||
status = []
|
||||
for i in range(0,4):
|
||||
@ -479,7 +479,7 @@ class Trackers(callbacks.Plugin):
|
||||
return
|
||||
|
||||
# Extract statuses
|
||||
status_txt = re.search(r'.*site.*\n.*status (.*)"[\S\s]+tracker.*\n.*status (.*)"[\S\s]+irc.*\n.*status (.*)"', content.text)
|
||||
status_txt = re.search(r'.*site.*\n.*status (.*)"[\S\s]+tracker.*\n.*status (.*)"[\S\s]+irc.*\n.*status (.*)"', content.content.decode())
|
||||
status = []
|
||||
for i in range(0,4):
|
||||
if status_txt.group(i) == "normal":
|
||||
@ -517,7 +517,7 @@ class Trackers(callbacks.Plugin):
|
||||
return
|
||||
|
||||
# Extract statuses
|
||||
status_txt = re.search(r'.*pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>', content.text)
|
||||
status_txt = re.search(r'.*pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>', content.content.decode())
|
||||
status = []
|
||||
for i in range(0,5):
|
||||
if status_txt.group(i) == "Online":
|
||||
|
@ -115,7 +115,7 @@ class UrbanDictionary(callbacks.Plugin):
|
||||
#irc.reply("{0}".format(self._repairjson(html.decode('utf-8'))))
|
||||
try:
|
||||
#jsondata = self._repairjson(html.decode('utf-8')) # decode utf-8. fix \r\n that ud puts in below.
|
||||
jsondata = html.decode('utf-8')
|
||||
jsondata = html.decode()
|
||||
jsondata = json.loads(jsondata) # odds chars in UD.
|
||||
except Exception as e:
|
||||
self.log.error("Error parsing JSON from UD: {0}".format(e))
|
||||
|
@ -129,7 +129,7 @@ class WorldTime(callbacks.Plugin):
|
||||
|
||||
# wrap in a big try/except
|
||||
try:
|
||||
result = json.loads(response.decode('utf-8'))
|
||||
result = json.loads(response.decode())
|
||||
if result['status'] == 'OK':
|
||||
lat = str(result['results'][0]['geometry']['location']['lat'])
|
||||
lng = str(result['results'][0]['geometry']['location']['lng'])
|
||||
|
@ -72,7 +72,7 @@ class YouTube(callbacks.Plugin):
|
||||
request = request.json()
|
||||
video_id = request["items"][0]["id"]["videoId"]
|
||||
except Exception:
|
||||
log.error("YouTube: YouTube API HTTP %s: %s" % (request.status_code, request.text))
|
||||
log.error("YouTube: YouTube API HTTP %s: %s" % (request.status_code, request.content.decode()))
|
||||
pass
|
||||
return video_id
|
||||
|
||||
@ -187,7 +187,7 @@ class YouTube(callbacks.Plugin):
|
||||
else:
|
||||
log.error("YouTube: Error parsing Youtube API JSON response")
|
||||
else:
|
||||
log.error("YouTube: YouTube API HTTP %s: %s" % (request.status_code, request.text))
|
||||
log.error("YouTube: YouTube API HTTP %s: %s" % (request.status_code, request.content.decode()))
|
||||
if title:
|
||||
use_bold = self.registryValue("useBold", channel)
|
||||
if use_bold:
|
||||
|
Loading…
x
Reference in New Issue
Block a user