🧹 More refactoring
This commit is contained in:
@ -4,7 +4,7 @@ import string
|
||||
import json
|
||||
|
||||
with open("gwendolyn/resources/star_wars/starwarsskills.json", "r") as f:
|
||||
skillData = json.load(f)
|
||||
skill_data = json.load(f)
|
||||
|
||||
class StarWarsRoll():
|
||||
def __init__(self, bot):
|
||||
@ -288,12 +288,12 @@ class StarWarsRoll():
|
||||
characteristic = random.choice(["brawn"] * 3 + ["agility"] * 3 + ["intellect", "cunning", "presence"])
|
||||
results = "**Gruesome Injury**: The target's "+characteristic+" is permanently one lower, "+dd+dd+dd+dd
|
||||
|
||||
sendMessage = "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||
send_message = "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||
|
||||
messageList = sendMessage.split("\n")
|
||||
await ctx.send(messageList[0])
|
||||
if len(messageList) > 1:
|
||||
for messageItem in messageList[1:]:
|
||||
message_list = send_message.split("\n")
|
||||
await ctx.send(message_list[0])
|
||||
if len(message_list) > 1:
|
||||
for messageItem in message_list[1:]:
|
||||
await ctx.channel.send(messageItem)
|
||||
|
||||
# Parses the command into something the other functions understand
|
||||
@ -312,19 +312,19 @@ class StarWarsRoll():
|
||||
rollParameters = [0,0,0,0,0,0,0]
|
||||
|
||||
if string.capwords(commands[0]) == "Obligations":
|
||||
sendMessage = self.obligationRoll()
|
||||
send_message = self.obligationRoll()
|
||||
|
||||
elif string.capwords(commands[0]) in skillData:
|
||||
elif string.capwords(commands[0]) in skill_data:
|
||||
self.bot.log("Oh look! This guy has skills!")
|
||||
if self.bot.star_wars.character.userHasChar(user):
|
||||
self.bot.log("They have a character. That much we know")
|
||||
skillLevel = self.bot.star_wars.character.charData(user,"Skills " + string.capwords(commands[0]))
|
||||
skillLevel = self.bot.star_wars.character.char_data(user,"Skills " + string.capwords(commands[0]))
|
||||
|
||||
if string.capwords(commands[0]) == "Lightsaber":
|
||||
self.bot.log("The skill is lightsaber")
|
||||
charLevel = self.bot.star_wars.character.charData(user,"Characteristics " + self.bot.star_wars.character.lightsaberChar(user))
|
||||
charLevel = self.bot.star_wars.character.char_data(user,"Characteristics " + self.bot.star_wars.character.lightsaberChar(user))
|
||||
else:
|
||||
charLevel = self.bot.star_wars.character.charData(user,"Characteristics " + skillData[string.capwords(commands[0])])
|
||||
charLevel = self.bot.star_wars.character.char_data(user,"Characteristics " + skill_data[string.capwords(commands[0])])
|
||||
|
||||
abilityDice = abs(charLevel-skillLevel)
|
||||
proficiencyDice = min(skillLevel,charLevel)
|
||||
@ -334,14 +334,14 @@ class StarWarsRoll():
|
||||
validCommand = True
|
||||
else:
|
||||
self.bot.log("Okay, no they don't i guess")
|
||||
sendMessage = "You don't have a user. You can make one with /starwarscharacter"
|
||||
send_message = "You don't have a user. You can make one with /starwarscharacter"
|
||||
|
||||
elif string.capwords(commands[0]) in ["Ranged","Piloting"]:
|
||||
self.bot.log("They fucked up writing the name of a ranged or piloting skill")
|
||||
if string.capwords(commands[0]) == "Ranged":
|
||||
sendMessage = "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||
send_message = "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||
else:
|
||||
sendMessage = "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||
send_message = "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||
else:
|
||||
validCommand = True
|
||||
|
||||
@ -372,19 +372,19 @@ class StarWarsRoll():
|
||||
|
||||
simplified = self.simplify(rollResults)
|
||||
|
||||
name = self.bot.star_wars.character.getCharName(user)
|
||||
name = self.bot.star_wars.character.getChar_name(user)
|
||||
|
||||
self.bot.log("Returns results and simplified results")
|
||||
|
||||
if simplified == "":
|
||||
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
||||
send_message = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
||||
else:
|
||||
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
||||
send_message = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
||||
|
||||
messageList = sendMessage.split("\n")
|
||||
await ctx.send(messageList[0])
|
||||
if len(messageList) > 1:
|
||||
for messageItem in messageList[1:]:
|
||||
message_list = send_message.split("\n")
|
||||
await ctx.send(message_list[0])
|
||||
if len(message_list) > 1:
|
||||
for messageItem in message_list[1:]:
|
||||
if messageItem == "":
|
||||
self.bot.log("Tried to send empty message")
|
||||
else:
|
||||
|
Reference in New Issue
Block a user