示例#1
0
 def move_item(self, target):
     # if target in execute_sql(filepath, "SELECT COUNT(1) FROM objects WHERE location={} AND object_id={};".format(
     # self.location, self.object_id)):
     # print(execute_sql(filepath, "select location from objects where object_id = {}".format(self.object_id)))
     exec_sql(
         save_db_filepath,
         f"UPDATE objects SET location = '{target}' WHERE object_id = {self.object_id}"
     )
     # print(execute_sql(filepath, "select location from objects where object_id = {}".format(self.object_id)))
     self.location = target
示例#2
0
 def __init__(self, object_id):
     self.object_class, self.object_id, self.class_id, self.location, self.column_name = \
         exec_sql(save_db_filepath, f"SELECT object_class, object_id, class_id, location, column_name FROM objects "
                                    f"WHERE object_id = {object_id}")
示例#3
0
 def __init__(self, object_id):
     Object.__init__(self, object_id)
     Container.__init__(self, 36)
     self.name, self.hunger, self.thirst, self.health, self.stamina, self.strength = exec_sql(
         save_db_filepath,
         f"SELECT name, hunger, thirst, health, stamina, strength FROM players "
         f"WHERE player_id = {self.class_id}")
示例#4
0
 def __init__(self, object_id):
     super().__init__(object_id)
     self.name, self.description, self.weight, self.size, self.emoji, self.image = \
         exec_sql(save_db_filepath, f"SELECT name, description, weight, size, emoji, image_link "
                                    f"FROM {self.object_class} WHERE {self.column_name} = {self.class_id}")
示例#5
0
 async def sql(self, ctx, *, code):
     await ctx.send(embed=discord.Embed(
         title="Output:",
         description=str(
             exec_sql("datapacks/default_datapack/default_items.db", code)),
         colour=0xFFFFFE))