Skip to content

Commit

Permalink
buff/debuff messages, incomplete and could be a misfeature
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-kane committed Aug 18, 2024
1 parent 4e48edc commit e8f2f63
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
41 changes: 35 additions & 6 deletions cnv/chatlog/npc_chatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions cnv/tabs/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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}')

Expand Down
4 changes: 3 additions & 1 deletion cnv/tabs/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e8f2f63

Please sign in to comment.