3
3
import psycopg2
4
4
from colorama import Fore , Style , init
5
5
from create_character import Character
6
- from queries .query import get_subregions_character , list_all_characters , list_npcs_subregion , list_item_inventory , list_enemys_subregion , get_enemy_info
6
+ from queries .query import get_subregions_character , list_all_characters , list_npcs_subregion , list_item_inventory , list_enemys_subregion , get_enemy_info , get_civilian_info
7
7
from utils import debug
8
8
from combat import Combate , verificar_percepcao , Inimigo
9
9
import time
@@ -178,6 +178,22 @@ def display_npcs(conn, character):
178
178
179
179
return npcs
180
180
181
+ def display_npc_info (npc_nome , npc_tipo , conn ):
182
+ descricao = get_civilian_info (conn , npc_nome )
183
+ print (Fore .CYAN + "\n --- Ficha do Personagem ---" + Style .RESET_ALL )
184
+ print (Fore .GREEN + f"Nome: { descricao ['nome' ]} " + Style .RESET_ALL )
185
+ print (Fore .GREEN + f"Descrição: { descricao ['descricao' ]} " + Style .RESET_ALL )
186
+ print (Fore .MAGENTA + "\n .." + Style .RESET_ALL )
187
+ time .sleep (1 )
188
+
189
+ if npc_tipo == "Quester" :
190
+ get_quest (npc_nome )
191
+ input ("Pressione Enter para continuar..." )
192
+ else :
193
+ print (Fore .RED + f"{ npc_nome } não tem nada a dizer." + Style .RESET_ALL )
194
+ print (Fore .MAGENTA + "Pressione 0 para voltar ao menu." + Style .RESET_ALL )
195
+ input ()
196
+
181
197
def handle_player_choice (conn , character , subregions , npcs , enemys ):
182
198
try :
183
199
choice_interaction = input ("\n O que você deseja fazer agora?\n 0-Voltar\n 1-Continuar caminhando\n 2-Interagir com um personagem\n 3-Lutar: \n " )
@@ -203,11 +219,12 @@ def handle_player_choice(conn, character, subregions, npcs, enemys):
203
219
navigate (conn , character )
204
220
205
221
elif choice_interaction == "2" : # Interact with npcs
222
+ npcs = list_npcs_subregion (conn , character .sub_regiao_id )
206
223
if npcs :
207
224
npc_choice = int (input ("Escolha um personagem (número): " ))
208
225
if 1 <= npc_choice <= len (npcs ):
209
- print ( f"Você interagiu com { npcs [npc_choice - 1 ][ 0 ] } " )
210
- # NPCS TO INTERACT
226
+ npc_nome , npc_tipo = npcs [npc_choice - 1 ]
227
+ display_npc_info ( npc_nome , npc_tipo , conn )
211
228
else :
212
229
print ("\n Opção inválida!" )
213
230
else :
@@ -266,6 +283,10 @@ def get_subregion_description(conn, character):
266
283
conn .rollback ()
267
284
return "Erro ao acessar a descrição."
268
285
286
+ def get_quest (npc_nome ):
287
+ print (f"Você recebeu uma missão de { npc_nome } ." )
288
+ # Adicione mais lógica conforme necessário
289
+
269
290
# Main game loop
270
291
def game_loop (conn ):
271
292
ok = False
0 commit comments