added image map generator, map cell's color and emoji legend, death players emoji and color

This commit is contained in:
andrea
2025-07-28 22:29:27 +02:00
parent 56da6031f2
commit 52cc55e611
4 changed files with 120 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
from utils import logs as _log
from bot_libs import syms as _bot_syms
from bot_libs import player_handling as _bot_player
from bot_libs import simulation as _bot_simulation
from bot_libs import repeating as _bot_repeat
@@ -61,11 +62,20 @@ async def cmd_get_ranking_players(context, update, chat_id):
async def cmd_simulate_day(context, update, chat_id):
return await _bot_simulation.simulate_day(context, chat_id)
async def cmd_show_game_map(context, update, chat_id):
async def cmd_show_game_map_unicode(context, update, chat_id):
Arena= context.application.bot_data['arena']
Gamemap= Arena.get_map()
rendered_map= Gamemap.get_renderized_map()
return await update.message.reply_text(rendered_map)
await update.message.reply_text(rendered_map)
return await update.message.reply_text(_bot_syms.MAP_UTF8_LEGEND, parse_mode='MarkdownV2')
async def cmd_show_game_map_image(context, update, chat_id):
Arena= context.application.bot_data['arena']
Gamemap= Arena.get_map()
image_map= Gamemap.get_image_map()
bot= update.get_bot()
await bot.send_photo(chat_id= chat_id, photo= image_map)
return await update.message.reply_text(_bot_syms.MAP_IMAGE_LEGEND, parse_mode='MarkdownV2')
async def cmd_simulate_day_cron(context, update, chat_id):
context.application.bot_data['ask_seconds'] = 1

View File

@@ -75,3 +75,40 @@ COLORS_NAMES= [
"Pearl", "Pumpkin", "Navy", "Ultramarine", "Sapphire", "Desert", "Cherry",
"Tulip",
]
MAP_UTF8_FIELD= '🟩'
MAP_UTF8_MOUNTAIN= '⛰️'
MAP_UTF8_PLAYER_MALE= '👨'
MAP_UTF8_PLAYER_FEMALE= '👧🏻'
MAP_UTF8_PLAYER_NONBINARY= '⚧️'
MAP_UTF8_DEATH_PLAYER= '💀'
MAP_UTF8_ITEM= '📦'
MAP_UTF8_LEGEND= f"""*Legenda*:
\- *{MAP_UTF8_FIELD}*: Cella *libera* per muoversi
\- *{MAP_UTF8_MOUNTAIN}*: Bordo della mappa, *non raggiungibile*
\- *{MAP_UTF8_PLAYER_MALE}*: Posizione di un *giocatore Maschio*
\- *{MAP_UTF8_PLAYER_FEMALE}*: Posizione di una *giocatorice Femmina*
\- *{MAP_UTF8_PLAYER_NONBINARY}*: Posizione di un *giocatore non binario*
\- *{MAP_UTF8_DEATH_PLAYER}*: Posizione di un *giocatore morto*
\- *{MAP_UTF8_ITEM}*: Posizione di un *oggetto* \(non ancora implementato\)
"""
MAP_IMAGE_FIELD= (0, 255, 0) # green
MAP_IMAGE_MOUNTAIN= (0, 0, 0) # black
MAP_IMAGE_PLAYER_MALE= (0, 0, 255) # blue
MAP_IMAGE_PLAYER_FEMALE= (255, 0, 0) # red
MAP_IMAGE_PLAYER_NONBINARY= (255, 255, 0) # yellow
MAP_IMAGE_DEATH_PLAYER= (160, 160, 160) # grey
MAP_IMAGE_ITEM= (255, 255, 255) # white
MAP_IMAGE_LEGEND= """*Legenda*:
\- *Verde*: Cella *libera* per muoversi
\- *Nero*: Bordo della mappa, *non raggiungibile*
\- *Blue*: Posizione di un *giocatore Maschio*
\- *Rosso*: Posizione di una *giocatorice Femmina*
\- *Giallo*: Posizione di un *giocatore non binario*
\- *Grigio*: Posizione di un *giocatore morto*
\- *Bianco*: Posizione di un *oggetto* \(non ancora implementato\)
"""