Remove R students from 200 pull summary
This commit is contained in:
parent
f079dcadd5
commit
dcb0ca3094
50
main.py
50
main.py
@ -1,49 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import roll
|
|
||||||
import discord
|
import discord
|
||||||
|
import roll
|
||||||
|
import utils
|
||||||
from students import *
|
from students import *
|
||||||
|
|
||||||
|
|
||||||
bot = discord.Bot()
|
bot = discord.Bot()
|
||||||
emojis = {
|
|
||||||
'R': '🟦',
|
|
||||||
'SR': '🟨',
|
|
||||||
'SSR': '🟪'
|
|
||||||
}
|
|
||||||
|
|
||||||
def generate_student_roll_string(student_get):
|
|
||||||
message = ""
|
|
||||||
for i in range(len(student_get)):
|
|
||||||
rate_up_message = ""
|
|
||||||
if student_get[i]['pickup']:
|
|
||||||
rate_up_message = " (Pick Up!)"
|
|
||||||
|
|
||||||
message += f"{emojis[student_get[i]['rarity']]} {student_get[i]['name']}{rate_up_message}\n"
|
|
||||||
|
|
||||||
return message
|
|
||||||
|
|
||||||
|
|
||||||
def generate_spark_summary_string(student_get):
|
|
||||||
message = ""
|
|
||||||
for ten_pulls in student_get:
|
|
||||||
line = ""
|
|
||||||
ssr_students = []
|
|
||||||
for student in ten_pulls:
|
|
||||||
line += emojis[student['rarity']]
|
|
||||||
if student['rarity'] == 'SSR':
|
|
||||||
rate_up_message = ""
|
|
||||||
if student['pickup']:
|
|
||||||
rate_up_message = " (Pick up!)"
|
|
||||||
ssr_students.append(student['name'] + rate_up_message)
|
|
||||||
message += line + " " + ", ".join(ssr_students) + "\n"
|
|
||||||
return message
|
|
||||||
|
|
||||||
|
|
||||||
def validate_banner_number(banner_number):
|
|
||||||
banner_amount = len(CURRENT_BANNER) + 1
|
|
||||||
return banner_number <= banner_amount
|
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
@ -65,7 +29,7 @@ async def banner_list(ctx: discord.ApplicationContext):
|
|||||||
|
|
||||||
@bot.slash_command(name="single-pull", description="Single pull in a banner")
|
@bot.slash_command(name="single-pull", description="Single pull in a banner")
|
||||||
async def single_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
async def single_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
||||||
if not validate_banner_number(banner_number):
|
if not utils.validate_banner_number(banner_number):
|
||||||
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -79,7 +43,7 @@ async def single_pull(ctx: discord.ApplicationContext, banner_number: discord.Op
|
|||||||
|
|
||||||
@bot.slash_command(name="multi-pull", description="Multi pull in a banner")
|
@bot.slash_command(name="multi-pull", description="Multi pull in a banner")
|
||||||
async def multi_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
async def multi_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
||||||
if not validate_banner_number(banner_number):
|
if not utils.validate_banner_number(banner_number):
|
||||||
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -88,12 +52,12 @@ async def multi_pull(ctx: discord.ApplicationContext, banner_number: discord.Opt
|
|||||||
student_get = roll.regular_multi()
|
student_get = roll.regular_multi()
|
||||||
else:
|
else:
|
||||||
student_get = roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR'])
|
student_get = roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR'])
|
||||||
await ctx.respond(generate_student_roll_string(student_get))
|
await ctx.respond(utils.generate_student_roll_string(student_get))
|
||||||
|
|
||||||
|
|
||||||
@bot.slash_command(name="200-pull", description="200 pull in a banner")
|
@bot.slash_command(name="200-pull", description="200 pull in a banner")
|
||||||
async def two_hundred_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
async def two_hundred_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
||||||
if not validate_banner_number(banner_number):
|
if not utils.validate_banner_number(banner_number):
|
||||||
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -104,7 +68,7 @@ async def two_hundred_pull(ctx: discord.ApplicationContext, banner_number: disco
|
|||||||
else:
|
else:
|
||||||
for i in range(20):
|
for i in range(20):
|
||||||
student_get.append(roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR']))
|
student_get.append(roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR']))
|
||||||
await ctx.respond(generate_spark_summary_string(student_get))
|
await ctx.respond(utils.generate_spark_summary_string(student_get))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
8
roll.py
8
roll.py
@ -65,14 +65,14 @@ def rate_up(ssr_student, sr_guarantee=False, sr_student=None):
|
|||||||
'pickup': True
|
'pickup': True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
if ssr:
|
if ssr:
|
||||||
if ssr_student not in student_pool:
|
if ssr_student in student_pool:
|
||||||
student_pool.remove(ssr_student)
|
student_pool.remove(ssr_student)
|
||||||
else:
|
if sr_student in student_pool:
|
||||||
if sr_student not in student_pool:
|
|
||||||
student_pool.remove(sr_student)
|
student_pool.remove(sr_student)
|
||||||
|
|
||||||
|
|
||||||
student_pool_roll_number = random.randint(0, len(student_pool) - 1)
|
student_pool_roll_number = random.randint(0, len(student_pool) - 1)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
7
test.py
7
test.py
@ -1,3 +1,8 @@
|
|||||||
import roll
|
import roll
|
||||||
|
from utils import generate_spark_summary_string
|
||||||
|
|
||||||
print(roll.rate_up_multi('Izuna', 'Shizuko'))
|
student_get = []
|
||||||
|
for i in range(20):
|
||||||
|
student_get.append(roll.rate_up_multi('Izuna', 'Shizuko'))
|
||||||
|
|
||||||
|
print(generate_spark_summary_string(student_get))
|
38
utils.py
Normal file
38
utils.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
emojis = {
|
||||||
|
'R': '🟦',
|
||||||
|
'SR': '🟨',
|
||||||
|
'SSR': '🟪'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def validate_banner_number(banner_number):
|
||||||
|
banner_amount = len(CURRENT_BANNER) + 1
|
||||||
|
return banner_number <= banner_amount
|
||||||
|
|
||||||
|
|
||||||
|
def generate_student_roll_string(student_get):
|
||||||
|
message = ""
|
||||||
|
for i in range(len(student_get)):
|
||||||
|
rate_up_message = ""
|
||||||
|
if student_get[i]['pickup']:
|
||||||
|
rate_up_message = " (Pick Up!)"
|
||||||
|
|
||||||
|
message += f"{emojis[student_get[i]['rarity']]} {student_get[i]['name']}{rate_up_message}\n"
|
||||||
|
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
|
def generate_spark_summary_string(student_get):
|
||||||
|
message = ""
|
||||||
|
for ten_pulls in student_get:
|
||||||
|
line = ""
|
||||||
|
ssr_students = []
|
||||||
|
for student in ten_pulls:
|
||||||
|
if student['rarity'] in ['SR', 'SSR']:
|
||||||
|
line += emojis[student['rarity']]
|
||||||
|
rate_up_message = ""
|
||||||
|
if student['pickup']:
|
||||||
|
rate_up_message = " (Pick up!)"
|
||||||
|
ssr_students.append(student['name'] + rate_up_message)
|
||||||
|
message += line + " " + ", ".join(ssr_students) + "\n"
|
||||||
|
return message
|
Loading…
Reference in New Issue
Block a user