Skip to content

Commit

Permalink
FEH and April Update, added limited icon
Browse files Browse the repository at this point in the history
Updated to include the new adventurers and wyrmprints
Updated the wyrmprints in accordance with the April update
Added a new reaction for the additional level added to prints
Added a limited icon to the view
  • Loading branch information
eesandoval committed Apr 30, 2019
1 parent 30ad6e3 commit 4168e55
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
6 changes: 4 additions & 2 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def query_adventurers(criteria):
def query_wyrmprints(criteria):
ability = None
rarity = None
level = 2
level = 3
if "ability" in criteria:
ability = criteria["ability"]
if "rarity" in criteria:
Expand Down Expand Up @@ -142,7 +142,7 @@ async def process_wyrmprint(name, level=None, message=None):
if name is None or name == "":
await view.show_invalid_name()

wyrmprint = Wyrmprint(name, level or 2)
wyrmprint = Wyrmprint(name, level or 3)
if wyrmprint is None:
await view.show_wyrmprint_not_found(name)
else:
Expand Down Expand Up @@ -185,6 +185,8 @@ async def process_wyrmprint_reaction(emoji, wyrmprint, message):
await process_wyrmprint(wyrmprint.name, 1, message)
elif emoji == "\U0001F509": # 2 unbinds
await process_wyrmprint(wyrmprint.name, 2, message)
elif emoji == "\U0001F50A": # 3 unbinds
await process_wyrmprint(wyrmprint.name, 3, message)

async def process_dragon_reaction(emoji, dragon, message):
if emoji == "\U0001F5BC": # Full picture
Expand Down
Binary file modified master.db
Binary file not shown.
2 changes: 2 additions & 0 deletions models/adventurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def _get_adventurer(self, db):
self.releasedate = result[9]
self.unittype = result[10].lower()
self.name = result[11]
self.limited = result[12]
return True

def _get_skills(self, db, level=None):
Expand Down Expand Up @@ -118,6 +119,7 @@ def _get_abilities(self, db, level=None):
, A.ReleaseDate
, UT.Name AS "UnitType"
, A.Name
, A.Limited
FROM Adventurers A
INNER JOIN ElementTypes ET ON ET.ElementTypeID = A.ElementTypeID
INNER JOIN WeaponTypes WT ON WT.WeaponTypeID = A.WeaponTypeID
Expand Down
2 changes: 2 additions & 0 deletions models/dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def _get_dragon(self, db):
self.maxstr = result[4]
self.releasedate = result[5]
self.name = result[6]
self.limited = result[7]
return True

def _get_skills(self, db, level):
Expand All @@ -105,6 +106,7 @@ def _get_abilities(self, db, level):
, D.STR
, D.ReleaseDate
, D.Name
, D.Limited
FROM Dragons D
INNER JOIN ElementTypes ET ON ET.ElementTypeID = D.ElementTypeID
WHERE D.Name LIKE '%' || ? || '%' COLLATE NOCASE
Expand Down
6 changes: 4 additions & 2 deletions models/wyrmprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class Wyrmprint:
@staticmethod
def find_wyrmprints(ability=None, rarity=None, level=2):
def find_wyrmprints(ability=None, rarity=None, level=3):
wyrmprints = []
params = ()
full_query = Wyrmprint.wyrmprint_search_query_text
Expand All @@ -50,7 +50,7 @@ def find_wyrmprints(ability=None, rarity=None, level=2):
wyrmprints.append(Wyrmprint(wyrmprint[0], wyrmprint[1]))
return wyrmprints

def __init__(self, name, level=2):
def __init__(self, name, level=3):
self.name = name
with Database("master.db") as db:
if not(self._get_wyrmprint(db)):
Expand All @@ -70,6 +70,7 @@ def _get_wyrmprint(self, db):
self.maxstr = result[3]
self.releasedate = result[4]
self.name = result[5]
self.limited = result[6]
return True

def _get_abilities(self, db, level):
Expand All @@ -86,6 +87,7 @@ def _get_abilities(self, db, level):
, W.MaxSTR
, W.ReleaseDate
, W.Name
, W.Limited
FROM Wyrmprints W
WHERE W.Name LIKE '%' || ? || '%' COLLATE NOCASE
ORDER BY W.ReleaseDate ASC
Expand Down
4 changes: 3 additions & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ def update(self):
self.picture_server = config["Other"]["PictureServer"]
self.adventurer_reactions = ["\U0001F5BC", "\U0001F508",
"\U0001F509", "\U0001F50A"]
self.wyrmprint_reactions = ["\U0001F5BC", "\U0001F508", "\U0001F509"]
self.wyrmprint_reactions = ["\U0001F5BC", "\U0001F508",
"\U0001F509", "\U0001F50A"]
self.dragon_reactions = ["\U0001F5BC", "\U0001F508", "\U0001F509"]
self.authorized_ids = config["Discord"]["AuthorizedIds"].split(',')
self.streaming = config.getboolean("Discord", "Streaming")
if config.has_option("Discord", "MessageLimit"):
self.message_limit = config.getint("Discord", "MessageLimit")
else:
self.message_limit = 1
self.limited_emoji = "<:limited:571981149497196575>"

def set_config_file(self, config_file):
project_root = dirname(dirname(__file__))
Expand Down
15 changes: 12 additions & 3 deletions view.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ async def show_adventurer(adventurer, message=None):
e.add_field(name="Unit Type",
value=get_emoji_element(adventurer.elementtype) +
get_emoji_weapon(adventurer.weapontype) +
get_emoji_unit(adventurer.unittype),
get_emoji_unit(adventurer.unittype) +
get_emoji_limited(adventurer.limited),
inline=True)
e.add_field(name="Rarity", value=get_emoji_rarity(adventurer.rarity),
inline=True)
Expand Down Expand Up @@ -192,7 +193,8 @@ async def show_wyrmprint(wyrmprint, message=None):
value="{0}/{1}".format(wyrmprint.maxhp, wyrmprint.maxstr),
inline=True)
e.add_field(name="Release Date",
value=convert_ISO_date_to_string(wyrmprint.releasedate),
value=convert_ISO_date_to_string(wyrmprint.releasedate) +
get_emoji_limited(wyrmprint.limited),
inline=True)
ability_format = "Ability: {0}"
for ability in wyrmprint.abilities:
Expand All @@ -213,7 +215,8 @@ async def show_dragon(dragon, message=None):
sub_portrait_URL = "dragons/portraits/{0}.png".format(url_name)
portrait_URL = config.picture_server + sub_portrait_URL
e.set_thumbnail(url=portrait_URL)
e.add_field(name="Element", value=get_emoji_element(dragon.elementtype),
e.add_field(name="Element", value=get_emoji_element(dragon.elementtype) +
get_emoji_limited(dragon.limited),
inline=True)
e.add_field(name="Rarity", value=get_emoji_rarity(dragon.rarity),
inline=True)
Expand Down Expand Up @@ -285,6 +288,12 @@ def get_emoji_rarity(rarity):
return config.rarity_emoji[rarity] * rarity


def get_emoji_limited(limited):
if limited == 1:
return config.limited_emoji
return ""


@client.event
async def on_reaction_add(reaction, user):
if (reaction.message.id in active_adventurer_messages and
Expand Down

0 comments on commit 4168e55

Please sign in to comment.