Add get_quest, get_side_quest to player.

This commit is contained in:
Ceda EI 2019-03-13 19:49:15 +05:30
parent b3093fa1a4
commit 2a5ae51d71
1 changed files with 22 additions and 0 deletions

View File

@ -157,6 +157,28 @@ class player():
quests.append(q)
return quests
def get_quest(self, qid):
cursor = self.DB.cursor()
query = ('SELECT chat_id, qid, name, importance, difficulty, '
'state FROM quests WHERE chat_id = ? AND qid = ?')
cursor.execute(query, (self.CHAT_ID, qid))
row = cursor.fetchone()
if row is None:
return False
else:
return quest(self.DB, *row)
def get_side_quest(self, qid):
cursor = self.DB.cursor()
query = ('SELECT chat_id, qid, name, importance, difficulty, '
'state FROM quests WHERE chat_id = ? AND qid = ?')
cursor.execute(query, (self.CHAT_ID, qid))
row = cursor.fetchone()
if row is None:
return False
else:
return side_quest(self.DB, *row)
def get_tokens(self):
cursor = self.DB.cursor()
query = ('SELECT token FROM tokens WHERE chat_id=?')