Skip to content

Commit

Permalink
Add "Chatty is default" preference to Mastermind Page
Browse files Browse the repository at this point in the history
This release adds a "chatty is default" checkbox to the Mastermind page,
which will select whether pets reset to chatty or non-chatty mode when
the Binds Reset key is pressed.

It also fixes a misbehavior bug when "Load Last Profile" is selected as
a preference and the last profile can't be found, ie, has been deleted
or moved.
  • Loading branch information
emersonrp committed Jul 23, 2024
1 parent 848883c commit f9dc350
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions Page/Mastermind.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def __init__(self, parent):
'PetCmdEnable': False,

'PetChatToggle' : 'LALT+M',
'PetChattyDefault' : True,
'PetSelect1' : '',
'PetSelect2' : '',
'PetSelect3' : '',
Expand Down Expand Up @@ -278,6 +279,11 @@ def BuildPage(self):
ctlType = 'keybutton',
tooltip = 'Choose the key combo that will toggle your pets\' chattiness level',
)
petCommandsKeys.AddControl(
ctlName = 'PetChattyDefault',
ctlType = "checkbox",
tooltip = "Choose whether pets are chatty or silent after a binds reset",
)
#
# Pet Next/Prev select binds
petnpenable = wx.Panel(self)
Expand Down Expand Up @@ -342,7 +348,7 @@ def OnPetCmdEnable(self, evt = None):
self.EnableControls(enabled, [
command['ctrlName'], command['ctrlName']+"ResponseMethod", command['ctrlName']+"Response"
])
self.EnableControls(enabled , ['PetChatToggle', ])
self.EnableControls(enabled , ['PetChatToggle', 'PetChattyDefault', ])

for petid in [1,2,3,4,5,6]:
self.Ctrls[f"Pet{petid}Bodyguard"].Enable(enabled)
Expand Down Expand Up @@ -575,7 +581,10 @@ def PopulateBindFiles(self):
if self.GetState('PetCmdEnable'):
powers = self.MMPowerSets[ profile.General.GetState('Primary') ]['powers']

self.mmSubBind(ResetFile, "all", None, powers)
if self.GetState('PetChattyDefault'):
self.mmSubBind(ResetFile, "all", None, powers)
else:
self.mmQuietSubBind(ResetFile, "all", None, powers)

#### "Quiet" versions
allfile = profile.GetBindFile('mmb','all.txt')
Expand Down Expand Up @@ -606,10 +615,14 @@ def PopulateBindFiles(self):
### By-name select binds.
# TODO - would this make more sense fully integrated into mm(Quiet)SubBind?
for pet in [1,2,3,4,5,6]:
feedback = self.GetChatString('SelectAll', pet)
feedback = ''
selfile = "sel.txt"
if self.GetState('PetChattyDefault'):
feedback = self.GetChatString('SelectAll', pet)
selfile = "csel.txt"
ResetFile.SetBind(
self.Ctrls[f"PetSelect{pet}"].MakeFileKeyBind(
[feedback, f"petselectname {self.uniqueNames[pet-1]}", profile.BLF('mmb', f"csel.txt")]
[feedback, f"petselectname {self.uniqueNames[pet-1]}", profile.BLF('mmb', selfile)]
)
)

Expand All @@ -618,7 +631,7 @@ def PopulateBindFiles(self):
self.GetState('IncPetSize') and self.GetState('DecPetSize') and
self.GetState('SelNextPet') and self.GetState('SelPrevPet')
):
self.psCreateSet(6,0,self.Profile.ResetFile())
self.psCreateSet(6,0,ResetFile)
for tsize in 1,2,3,4,5,6:
for tsel in range(0,tsize+1):
file = self.Profile.GetBindFile('petsel', f"{tsize}{tsel}.txt")
Expand Down Expand Up @@ -747,6 +760,7 @@ def AllBindFiles(self):
'PetGotoResponseMethod' : "Pet Response",
'PetStayResponseMethod' : "Pet Response",
'PetChatToggle' : "Pet Chatty Mode Toggle",
'PetChattyDefault' : "Chatty is Default",
'PetBodyguard' : "Bodyguard Mode",
'PetBodyguardResponseMethod' : "Pet Response",
'PetNPEnable' : 'Enable Prev/Next Pet Binds',
Expand Down

0 comments on commit f9dc350

Please sign in to comment.