From 01e1ebc45340053674504bab3c1dd6bb19e2c3c1 Mon Sep 17 00:00:00 2001 From: "barraux.a" Date: Wed, 30 Nov 2022 14:08:38 +0100 Subject: [PATCH] Ajout de la base --- bdd.db | Bin 0 -> 53248 bytes main.py | 35 +++++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 bdd.db diff --git a/bdd.db b/bdd.db new file mode 100644 index 0000000000000000000000000000000000000000..092caf47a8e5b2773afebbd6cda1b0c61a223231 GIT binary patch literal 53248 zcmeI5U2I&(b;ox}iXvB{H>jepY@nFlzQk=&L(OARw2r|TMiR$WRG0mVhhl&t=u3eHO#q4aW z)%q0wQ~ZzdKf?d-*)U)Fuk8XuzCYFa|MOp(o9)%od$XVIO!gKR4)uGJyXXFT_aAZgSbyR0(qeJG zXQ{t$eqm*0Vb9lllMg+-d+x!xU6N17@9ppFFCL+EDdF()(!K)+O8^HKjvSc}DtTnr zLtnms*VkshIQO;Bn(FTb@(W+tHTTei51Uwva_{V}xi8G^ntS+xxv$Rl9x>3aOy}Oa zF15b+SNFAB2Nw7CAE$X-$ILGrU0KrS^R@OiP&5U^gqYRmrpBiqyk`*9BmLzgON)yO z`}^}di}2{$NN4l(%uIXDsKCf)KF34ut>_JeAJ&bU-@CkYV5MNq#_nG@y65i-?KBYA zxp!@0>*ncu?r9&J(sodYSA-@i!uZxSS-|1F-v|`?_~GF6(8A;M)hv4!R{HywmJbw? z2FfgwLw!Eri#e5I290fOwRU#Lr|0e-q#utoztab&)*icS^Yq{_d}HZg|LF4G zh5bkSqm$<3Gb7_WX4>r?hZgo9*mI!2_~@-{Wofaq*`0r;ZPF>S%q^PbTdyC!^?JWE z;m$iWr``Q^tNZKjf8O4fMfAwPN0)&MN9jlxzIoy6u4D96vO4U@R#l#;^pZ+0sqAf) zzo3##WtUWbNu>h{=08@+ODcWpZx+`9PA{rt&F0D8ltLU*3AK?_gU@cL^f`&o-WiUa zK5I+oTKfDIMIb$+l4lxFZ9O+s{~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B*q?8T*RUEfWts9Magi=%8}&QV+l;5)nm7>)tgmZNX|dP4~K+tJff9McRx|6u4nM)5J-#1lC!3RfrMA5XMA8tu?0FFF!)x7htD;) zhm034qe{)(JHv?R=GRo-)DO=WUKI~ZX~UwxU@5OvxfD;0-{VSF`ZZ=hu;I8y9!cwF zih5Z7(rKJiy1W-ux__dF0BcGEAyKZr1k0&dANXSNzZ}TqV#G%qDQSZ}20;RYZ#6?K zxA^T%u{H6+B#B4XozM@!4i8`;c{9N1)O%0yr_YE-v<>ujq-{!8LA_dx<|QyAsFm`G z2I~+CHD?4wLyV1NqZi|ghjk<0a3fHb=&=)JFuFjxrcENfdXAN(hk=H}LyABYbz`^q z8bmQM+)=-1OXG#>rWpbkkT|YVXA>#4hZR4Iw{=doAhI%5;at@1CKsF?52v>Nv6XXaAIxwHtWOcWnbrXs_z99`!zMu`* zN*ik{%j3fZW-ZD>YN>44=kaMlf^Ux#!=qQSxp)s#i74VdWJ6S?kgrrE9#El;H>nOX z{0`D=QaR3tT^+76lh8YU_vpmTbh|xsV!L@YXYT?(6&#&(@97xr79tK6sc4F?)&z>m zU8s_Q(^+SO1&YgDRBz!VODVA&u2yKzOLSLrIG{SViQzM-Ehz7^=v*C#Rr~fL+R`7Q z1rDM>C|B-c>v6%7CW1ZJF3x-Ratfx zP~qIN?8q(@6Xw_E5k`3+uNs%`zP*h*^ybQ3_8N{WCY4u<7EzTXUujb*hiJabpS}hQ z7o^!@$^;2;5i zu6V(=K^JaagNuMqvw`rdu}D#y$;{`VI*SahW*;M^hA>i1@)Cytg)B}4lP-eWP!Zvy ze88uLd3|(&;)^)|~k0Zv3s+vH$=8 literal 0 HcmV?d00001 diff --git a/main.py b/main.py index f9b083b..389030e 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import random import cli import time import getkey +import sqlite3 class Animation: """ class de gestion des animations du personnage""" @@ -71,13 +72,29 @@ class Animation: class Personnage(Animation): """Class de base du personnage""" - def __init__(self, nom, x, y, xp): + def __init__(self, nom, x, y, categorie, xp=1): + + conn = sqlite3.connect('bdd.db') + c = conn.cursor() + c.execute("SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where name = ?", (nom,)) + data = c.fetchone() + print(data) + if data is None: + c.execute("insert into Personnage(name, pdv, xp, max_pdv, categorie) Values(?, ?, ?, ?, ?) ", (nom, "20", str(xp), "20", categorie)) + conn.commit() + c.execute("SELECT * from Personnage join Categorie on Personnage.categorie=Categorie.name join Profil on Categorie.profil=Profil.name where name = ?", (nom,)) + data = c.fetchone() + + conn.close() + data = data[0] + print(data) + self.nom = nom self.coef_attack = 1 self.coef_defense = 1 - self.pdv = 20 - self.max_pdv = 20 - self.xp = xp + self.pdv = data[1] + self.max_pdv = data[3] + self.xp = data[2] self.inv = ['potion'for i in range(2)] self.shape = ['', ''] @@ -418,9 +435,11 @@ class App: name = input('=>') self.setting(name, 0) -app = App() -gui = cli.Cli(width=app.width, height=app.height) +# app = App() +# gui = cli.Cli(width=app.width, height=app.height) + +# app.menu() -app.menu() +# # guerrier.move(-10, 0) -# guerrier.move(-10, 0) +Personnage('Georges', 0, 0, "guerrier", 1)