From e8f2f63a4449ab1f5979cdb7c4d80e4665f2f170 Mon Sep 17 00:00:00 2001 From: Jason Kane Date: Sat, 17 Aug 2024 19:17:20 -0700 Subject: [PATCH] buff/debuff messages, incomplete and could be a misfeature --- cnv/chatlog/npc_chatter.py | 41 ++++++++++++++++++++++++++++++++------ cnv/tabs/character.py | 6 ++++-- cnv/tabs/configuration.py | 4 +++- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/cnv/chatlog/npc_chatter.py b/cnv/chatlog/npc_chatter.py index 4ac88cd..2283d8b 100644 --- a/cnv/chatlog/npc_chatter.py +++ b/cnv/chatlog/npc_chatter.py @@ -564,23 +564,52 @@ def tail(self): dialog = plainstring(" ".join(lstring)) if talking: self.speaking_queue.put((None, dialog, "system")) - + elif lstring[1] == "have": + enabled = False # have is tricky. lots of things use have. dialog = plainstring(" ".join(lstring)) if lstring[2] == "defeated": enabled = settings.get_toggle(settings.taggify("Acknowledge each win")) + + if talking and enabled: + self.speaking_queue.put((None, dialog, "system")) + + elif lstring[2] in ["Insight", "Uncanny"]: + # You have Insight into your enemy's weaknesses and slightly increase your chance To Hit and your Perception. + pass + + elif lstring[2] == "been": + enabled =False + # buffs and debuffs + if lstring[3] in [ + "put", "immobilized!", "exemplared", + "interrupted.", "held", "temporarily", + "blinded" + ]: + enabled = settings.get_toggle(settings.taggify('Speak Debuffs')) + elif lstring[3] in ["granted", ]: + enabled = settings.get_toggle(settings.taggify('Speak Buffs')) + if talking and enabled: self.speaking_queue.put((None, dialog, "system")) - else: - if not talking: - log.info(f'{talking=}') - else: - log.info(f'{enabled=}') elif talking: self.speaking_queue.put((None, dialog, "system")) + elif lstring[1] == "are": + enabled = False + if lstring[2] in ['held!', 'unable']: + # 2024-04-01 20:04:17 You are held! + enabled = settings.get_toggle(settings.taggify('Speak Debuffs')) + elif lstring[2] in ['healed', 'filled', 'now', 'Robust', 'Enraged', 'hidden', 'Sturdy']: + enabled = settings.get_toggle(settings.taggify('Speak Buffs')) + + if talking and enabled: + dialog = plainstring(" ".join(lstring)) + self.speaking_queue.put((None, dialog, "system")) + + elif self.hero and lstring[1] == "gain": # You gain 104 experience and 36 influence. # You gain 15 experience, work off 15 debt, and gain 14 influence. diff --git a/cnv/tabs/character.py b/cnv/tabs/character.py index de9a6fd..dd749d6 100644 --- a/cnv/tabs/character.py +++ b/cnv/tabs/character.py @@ -17,7 +17,7 @@ log = logging.getLogger(__name__) -# when youare level X, how many xp do you need to reach the next level? +# when you are level X, how many xp do you need to reach the next level? xp_table = { 1: 106, 2: 337, @@ -620,7 +620,7 @@ def __init__(self, parent, event_queue, speaking_queue, *args, **kwargs): # experience = self.character_subtabs.add('Experience') # influence = self.character_subtabs.add('Influence') - self.character_subtabs.grid(column=0, row=0, sticky="new") + self.character_subtabs.grid(column=0, row=0, sticky="nsew") buffer.grid(column=0, row=1, sticky="nsew") self.start_time = datetime.now() @@ -630,6 +630,8 @@ def subtab_selected(self, *args, **kwargs): if selected_tab == "Damage": self.damageframe.refresh_damage_panel() self.damageframe.pack(fill="both", expand=True) + elif selected_tab == "Graph": + pass else: log.warning(f'Unknown tab: {selected_tab}') diff --git a/cnv/tabs/configuration.py b/cnv/tabs/configuration.py index 6c2c9c3..4dba58b 100644 --- a/cnv/tabs/configuration.py +++ b/cnv/tabs/configuration.py @@ -233,7 +233,9 @@ def __init__(self, *args, **kwargs): index = 0 for toggle in [ "Acknowledge each win", - "Persist player chat" + "Persist player chat", + "Speak Buffs", + "Speak Debuffs", ]: tag = settings.taggify(toggle) self.toggles[tag] = tk.StringVar(