@@ -187,50 +187,47 @@ MultiBot.raidus.wowButton("Load", -762, 360, 80, 20, 12)
187187 end
188188end
189189
190- MultiBot .raidus .wowButton (" 1" , - 734 , 360 , 22 , 20 , 12 ).setDisable ()
191- .doLeft = function (pButton )
192- if (pButton .state ) then
193- pButton .parent .save = " "
194- pButton .setDisable ()
195- MultiBot .raidus .setRaidus ()
196- else
197- pButton .parent .save = " 1"
198- pButton .parent .buttons [" 2" ].setDisable ()
199- pButton .parent .buttons [" 3" ].setDisable ()
200- pButton .setEnable ()
201- MultiBot .raidus .setRaidus ()
190+ local function UpdateRaidusSlotButtonText (button )
191+ local label = " Slot"
192+ if MultiBot .raidus .save ~= " " then
193+ label = " Slot " .. MultiBot .raidus .save
202194 end
195+ button .text :SetText (" |cffffcc00" .. label .. " |r" )
203196end
204197
205- MultiBot .raidus .wowButton (" 2" , - 707 , 360 , 22 , 20 , 12 ).setDisable ()
206- .doLeft = function (pButton )
207- if (pButton .state ) then
208- pButton .parent .save = " "
209- pButton .setDisable ()
210- MultiBot .raidus .setRaidus ()
211- else
212- pButton .parent .save = " 2"
213- pButton .parent .buttons [" 1" ].setDisable ()
214- pButton .parent .buttons [" 3" ].setDisable ()
215- pButton .setEnable ()
216- MultiBot .raidus .setRaidus ()
198+ local slotDropDown = CreateFrame (" Frame" , " MultiBotRaidusSlotDropDown" , MultiBot .raidus , " UIDropDownMenuTemplate" )
199+ UIDropDownMenu_SetWidth (slotDropDown , 80 )
200+ UIDropDownMenu_Initialize (slotDropDown , function (self , level )
201+ for i = 1 , 10 do
202+ local info = UIDropDownMenu_CreateInfo ()
203+ info .text = tostring (i )
204+ info .value = tostring (i )
205+ info .func = function ()
206+ MultiBot .raidus .save = tostring (i )
207+ UIDropDownMenu_SetSelectedValue (slotDropDown , tostring (i ))
208+ UpdateRaidusSlotButtonText (MultiBot .raidus .buttons [" Slot" ])
209+ MultiBot .raidus .setRaidus ()
210+ end
211+ UIDropDownMenu_AddButton (info , level )
217212 end
218- end
213+ end )
219214
220- MultiBot .raidus .wowButton (" 3 " , - 680 , 360 , 22 , 20 , 12 ). setDisable ( )
221- . doLeft = function ( pButton )
222- if ( pButton . state ) then
223- pButton . parent . save = " "
224- pButton . setDisable ( )
225- MultiBot . raidus . setRaidus ( )
226- else
227- pButton . parent . save = " 3 "
228- pButton . parent . buttons [ " 1 " ]. setDisable ( )
229- pButton . parent . buttons [ " 2 " ]. setDisable ()
230- pButton . setEnable ()
231- MultiBot .raidus .setRaidus ( )
215+ local slotButton = MultiBot .raidus .wowButton (" Slot " , - 682 , 360 , 80 , 20 , 12 )
216+ slotButton . tip = MultiBot . tips . raidus . slot
217+ slotButton : SetScript ( " OnEnter " , function ( self )
218+ GameTooltip : SetOwner ( self , " ANCHOR_TOP " )
219+ GameTooltip : SetText ( self . tip or " " , 1 , 1 , 1 , true )
220+ end )
221+ slotButton : SetScript ( " OnLeave " , function ()
222+ GameTooltip : Hide ()
223+ end )
224+ slotButton . doLeft = function ()
225+ if MultiBot . raidus . save ~= " " then
226+ UIDropDownMenu_SetSelectedValue ( slotDropDown , MultiBot .raidus .save )
232227 end
228+ ToggleDropDownMenu (1 , nil , slotDropDown , slotButton , 0 , 0 )
233229end
230+ UpdateRaidusSlotButtonText (slotButton )
234231
235232-- Contrôle du mode Tri, "Score / Level / Class"
236233local sortBaseX = - 300 -- position du bouton "Score", pour déplacer tout le groupe il faut modifier cette valeur
@@ -356,13 +353,13 @@ MultiBot.raidus.wowButton("Apply", -514, 360, 80, 20, 12)
356353
357354 local tSelf = UnitName (" player" )
358355 MultiBot .index .raidus = {}
356+ local tSelected = 0
357+ local selectedNames = {}
359358
360359 for tName , tValue in pairs (MultiBot .frames [" MultiBar" ].frames [" Units" ].buttons ) do
361360 if (tValue .state ) then
362- if (tName ~= tSelf and tRaidByName [tName ] == nil ) then
363- if (UnitInGroup (tName ) or UnitInRaid (tName )) then UninviteUnit (tName ) end
364- SendChatMessage (" .playerbot bot remove " .. tName , " SAY" )
365- end
361+ tSelected = tSelected + 1
362+ selectedNames [tName ] = true
366363 else
367364 if (tName ~= tSelf and tRaidByName [tName ] ~= nil ) then
368365 table.insert (MultiBot .index .raidus , tName )
@@ -372,7 +369,53 @@ MultiBot.raidus.wowButton("Apply", -514, 360, 80, 20, 12)
372369
373370 local tNeeds = # MultiBot .index .raidus
374371
375- if (tNeeds > 0 ) then
372+ local usedLayoutFallback = false
373+
374+ local tFallback = {}
375+ local hasLayoutOnly = false
376+ for tName , _ in pairs (tRaidByName ) do
377+ if tName ~= tSelf then
378+ if not selectedNames [tName ] then
379+ hasLayoutOnly = true
380+ end
381+ if not MultiBot .isMember (tName ) then
382+ table.insert (tFallback , tName )
383+ end
384+ end
385+ end
386+
387+ if tSelected == 0 or hasLayoutOnly then
388+ if # tFallback > 0 then
389+ MultiBot .index .raidus = tFallback
390+ tNeeds = # tFallback
391+ usedLayoutFallback = true
392+ end
393+ end
394+
395+ local tRaidByMembers = MultiBot .raidus .getRaidState ()
396+ for tName , _ in pairs (tRaidByMembers ) do
397+ if tName ~= tSelf and tRaidByName [tName ] == nil then
398+ if MultiBot .isMember (tName ) then
399+ UninviteUnit (tName )
400+ end
401+ SendChatMessage (" .playerbot bot remove " .. tName , " SAY" )
402+ end
403+ end
404+
405+ local tList = " "
406+ if tNeeds > 0 then
407+ tList = table.concat (MultiBot .index .raidus , " , " )
408+ end
409+ if usedLayoutFallback then
410+ SendChatMessage (" Raidus Apply: using layout list, selected=" .. tSelected .. " toInvite=" .. tNeeds , " SAY" )
411+ else
412+ SendChatMessage (" Raidus Apply: selected=" .. tSelected .. " toInvite=" .. tNeeds , " SAY" )
413+ end
414+ if tList ~= " " then
415+ SendChatMessage (" Raidus Apply list: " .. tList , " SAY" )
416+ end
417+
418+ if (tNeeds > 0 ) then
376419 SendChatMessage (MultiBot .info .starting , " SAY" )
377420 MultiBot .timer .invite .roster = " raidus"
378421 MultiBot .timer .invite .needs = tNeeds
0 commit comments