Skip to content

Commit 50e35d9

Browse files
committed
feat/fix: Add Learn/Unlearn Spell, fix LearnDropmenu
1 parent 02d229c commit 50e35d9

File tree

5 files changed

+112
-42
lines changed

5 files changed

+112
-42
lines changed

Commands/Commands_Char.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,11 @@ function LearnAndUnlearnSpell(isLearn, value)
423423
elseif value == "all_lang" then
424424
MangAdmin:ChatMsg(command .. " all lang")
425425
MangAdmin:LogAction(log .. " all languages to " .. player .. ".")
426+
elseif value == "all_default" then
427+
MangAdmin:ChatMsg(command .. " all default")
428+
MangAdmin:LogAction(log .. " all defaults to " .. player .. ".")
426429
elseif value == "all_myclass" then
427-
MangAdmin:ChatMsg(command .. " all myclass")
430+
MangAdmin:ChatMsg(command .. " all my class")
428431
MangAdmin:LogAction(log .. " all spells available to the " .. "-class to " .. player .. ".")
429432
else
430433
MangAdmin:ChatMsg(command .. " " .. value)
@@ -464,7 +467,7 @@ function Modify(case, value)
464467
MangAdmin:ChatMsg(".modify mana " .. value)
465468
MangAdmin:LogAction("Modified mana for " .. player .. " to " .. value .. " mana")
466469
elseif case == "aspeed" then
467-
MangAdmin:ChatMsg(".modify aspeed " .. value)
470+
MangAdmin:ChatMsg(".modify speed all " .. value)
468471
MangAdmin:LogAction("Modified AllSpeeds for " .. player .. " to " .. value .. " mana")
469472
elseif case == "arena" then
470473
MangAdmin:ChatMsg(".modify arenapoints " .. value)
@@ -514,6 +517,10 @@ function LearnPresetDropDownInitialize()
514517
local info = UIDropDownMenu_CreateInfo()
515518
local buttons = {
516519
{ Locale["labelCHAR_languageClass"], "all_lang" },
520+
{ Locale["labelCHAR_defaultClass"], "all_default" },
521+
{ Locale["labelCHAR_myClass"], "all_myclass" },
522+
{ Locale["labelCHAR_craftClass"], "all_crafts" },
523+
{ Locale["labelCHAR_GMClass"], "all_gm" },
517524
{ Locale["labelCHAR_languageCommon"], "668" },
518525
{ Locale["labelCHAR_languageOrcish"], "669" },
519526
{ Locale["labelCHAR_languageTaurahe"], "670" },
@@ -588,7 +595,6 @@ function ResetDropDownInitialize()
588595
local level = 1
589596
local info = UIDropDownMenu_CreateInfo()
590597
local buttons = {
591-
{ Locale["labelCHAR_resetAchievementsOption"], "achievements" },
592598
{ Locale["labelCHAR_resetHonorOption"], "honor" },
593599
{ Locale["labelCHAR_resetLevelOption"], "level" },
594600
{ Locale["labelCHAR_resetSpellsOption"], "spells" },
@@ -606,5 +612,5 @@ function ResetDropDownInitialize()
606612
info.keepShownOnClick = nil
607613
UIDropDownMenu_AddButton(info, level)
608614
end
609-
UIDropDownMenu_SetSelectedValue(CHAR_resetDropdown, "achievements")
615+
UIDropDownMenu_SetSelectedValue(CHAR_resetDropdown, "honor")
610616
end

Frames/MangFrames_SectionChar.lua

Lines changed: 75 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,46 @@ function MangAdmin:CreateCharSection()
12681268
},
12691269
text = Locale["label_bagButton"]
12701270
})
1271+
-- Learn Button
1272+
FrameLib:BuildButton({
1273+
name = "CHAR_learnSpellButton",
1274+
group = "char",
1275+
parent = ma_midframe,
1276+
texture = {
1277+
name = "CHAR_learnSpellButton_texture",
1278+
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
1279+
},
1280+
size = {
1281+
width = 80,
1282+
height = 20
1283+
},
1284+
setpoint = {
1285+
pos = "TOPLEFT",
1286+
offX = 632, --charColSix
1287+
offY = -96 --charRowNine
1288+
},
1289+
text = Locale["labelCHAR_learnSpellButton"]
1290+
})
1291+
-- Unlearn Button
1292+
FrameLib:BuildButton({
1293+
name = "CHAR_unlearnSpellButton",
1294+
group = "char",
1295+
parent = ma_midframe,
1296+
texture = {
1297+
name = "CHAR_unlearnSpellButton_texture",
1298+
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
1299+
},
1300+
size = {
1301+
width = 80,
1302+
height = 20
1303+
},
1304+
setpoint = {
1305+
pos = "TOPLEFT",
1306+
offX = 632, --charColSix
1307+
offY = -118 --charRowNine
1308+
},
1309+
text = Locale["labelCHAR_unlearnSpellButton"]
1310+
})
12711311
-- Learn Preset Dropdown
12721312
FrameLib:BuildFrame({
12731313
name = "CHAR_learnPresetDropdown",
@@ -1304,95 +1344,96 @@ function MangAdmin:CreateCharSection()
13041344
},
13051345
text = Locale["labelCHAR_learnPresetButton"]
13061346
})
1307-
-- Modify Dropdown
1347+
-- Reset Dropdown
13081348
FrameLib:BuildFrame({
1309-
name = "CHAR_modifyDropdown",
1349+
name = "CHAR_resetDropdown",
13101350
group = "char",
13111351
parent = ma_midframe,
13121352
size = {
1313-
width = 80,
1353+
width = 40,
13141354
height = 20
13151355
},
13161356
setpoint = {
13171357
pos = "TOPLEFT",
1318-
offX = 315,
1358+
offX = 190,
13191359
offY = 0
13201360
},
13211361
inherits = "UIDropDownMenuTemplate"
13221362
})
1323-
-- Modify Input Box
1324-
FrameLib:BuildFrame({
1325-
type = "EditBox",
1326-
name = "CHAR_modifyInputBox",
1363+
-- Reset Button
1364+
FrameLib:BuildButton({
1365+
name = "CHAR_resetButton",
13271366
group = "char",
13281367
parent = ma_midframe,
1368+
texture = {
1369+
name = "CHAR_resetButton_texture",
1370+
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
1371+
},
13291372
size = {
1330-
width = 30,
1373+
width = 40,
13311374
height = 20
13321375
},
13331376
setpoint = {
13341377
pos = "TOPLEFT",
1335-
offX = 455,
1378+
offX = 330,
13361379
offY = -4
13371380
},
1338-
inherits = "InputBoxTemplate"
1381+
text = Locale["labelCHAR_resetButton"]
13391382
})
1340-
-- Modify Button
1341-
FrameLib:BuildButton({
1342-
name = "CHAR_modifyButton",
1383+
-- Modify Dropdown
1384+
FrameLib:BuildFrame({
1385+
name = "CHAR_modifyDropdown",
13431386
group = "char",
13441387
parent = ma_midframe,
1345-
texture = {
1346-
name = "CHAR_modifyButton_texture",
1347-
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
1348-
},
13491388
size = {
1350-
width = 40,
1389+
width = 80,
13511390
height = 20
13521391
},
13531392
setpoint = {
13541393
pos = "TOPLEFT",
1355-
offX = 485,
1356-
offY = -4
1394+
offX = 365,
1395+
offY = 0
13571396
},
1358-
text = Locale["labelCHAR_modifyButton"]
1397+
inherits = "UIDropDownMenuTemplate"
13591398
})
1360-
-- Reset Dropdown
1399+
-- Modify Input Box
13611400
FrameLib:BuildFrame({
1362-
name = "CHAR_resetDropdown",
1401+
type = "EditBox",
1402+
name = "CHAR_modifyInputBox",
13631403
group = "char",
13641404
parent = ma_midframe,
13651405
size = {
1366-
width = 40,
1406+
width = 60,
13671407
height = 20
13681408
},
13691409
setpoint = {
13701410
pos = "TOPLEFT",
1371-
offX = 150,
1372-
offY = 0
1411+
offX = 505,
1412+
offY = -4
13731413
},
1374-
inherits = "UIDropDownMenuTemplate"
1414+
inherits = "InputBoxTemplate"
13751415
})
1376-
-- Reset Button
1416+
-- Modify Button
13771417
FrameLib:BuildButton({
1378-
name = "CHAR_resetButton",
1418+
name = "CHAR_modifyButton",
13791419
group = "char",
13801420
parent = ma_midframe,
13811421
texture = {
1382-
name = "CHAR_resetButton_texture",
1422+
name = "CHAR_modifyButton_texture",
13831423
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
13841424
},
13851425
size = {
1386-
width = 40,
1426+
width = 50,
13871427
height = 20
13881428
},
13891429
setpoint = {
13901430
pos = "TOPLEFT",
1391-
offX = 285,
1431+
offX = 570,
13921432
offY = -4
13931433
},
1394-
text = Locale["labelCHAR_resetButton"]
1434+
text = Locale["labelCHAR_modifyButton"]
13951435
})
1436+
13961437
-- Input Box Label
13971438
FrameLib:BuildFontString({
13981439
name = "ma_parameterboxtext",

FunctionInit.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,21 @@ function InitControls()
753753
end
754754
)
755755

756+
MangAdmin:PrepareScript(
757+
CHAR_learnSpellButton,
758+
Locale["ttCHAR_learnSpell"],
759+
function()
760+
LearnAndUnlearnSpell(true, CHAR_genericCommands[GENERICS_parametersGet]())
761+
end
762+
)
763+
764+
MangAdmin:PrepareScript(
765+
CHAR_unlearnSpellButton,
766+
Locale["ttCHAR_unlearnSpell"],
767+
function()
768+
LearnAndUnlearnSpell(false, CHAR_genericCommands[GENERICS_parametersGet]())
769+
end
770+
)
756771

757772
MangAdmin:PrepareScript(
758773
CHAR_learnPresetButton,
@@ -776,7 +791,7 @@ function InitControls()
776791
end
777792
)
778793
LearnPresetDropDownInitialize()
779-
UIDropDownMenu_Initialize(CHAR_learnPresetDropdown, LearnLangDropDownInitialize)
794+
UIDropDownMenu_Initialize(CHAR_learnPresetDropdown, LearnPresetDropDownInitialize)
780795
UIDropDownMenu_SetWidth(CHAR_learnPresetDropdown, 100)
781796
UIDropDownMenu_SetButtonWidth(CHAR_learnPresetDropdown, 20)
782797
ModifyDropDownInitialize()

Locales/enUS.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ function Return_enUS()
335335
["ttCHAR_modify"] = "Modify the selected attribute by the entered amount of the selected player",
336336
["ttCHAR_reset"] = "Reset the selected attribute of the selected player",
337337
["ttCHAR_learnPreset"] = "Learn the selected spell(s)",
338+
["ttCHAR_learnSpell"] = "Learn for selected player the specified spellID [[Parameters: $spellID]]",
339+
["ttCHAR_unlearnSpell"] = "Unlearn for selected player the specified spellID [[Parameters: $spellID]]",
338340
--[[CHAR-Control-Labels]]
339341
["labelCHAR_killButton"] = "Kill",
340342
["labelCHAR_reviveButton"] = "Revive",
@@ -390,6 +392,8 @@ function Return_enUS()
390392
["labelCHAR_hideAreaButton"] = "HideArea",
391393
["labelCHAR_honorAddButton"] = "HonorAdd",
392394
["labelCHAR_honorUpdateButton"] = "HonorUpdt",
395+
["labelCHAR_learnSpellButton"] = "Learn Spell",
396+
["labelCHAR_unlearnSpellButton"] = "Unlearn Spell",
393397
["labelCHAR_showMapsButton"] = "Show Maps",
394398
["labelCHAR_hideMapsButton"] = "Hide Maps",
395399
["labelCHAR_modifyButton"] = "Modify",
@@ -409,7 +413,7 @@ function Return_enUS()
409413
["labelCHAR_modifyFlySpeedOption"] = "FlySpeed",
410414
["labelCHAR_modifyGenderOption"] = "Gender",
411415
["labelCHAR_modifyHonorOption"] = "Honor",
412-
["labelCHAR_modifyMountSpeedOption"] = "MountSpeed",
416+
["labelCHAR_modifyMountSpeedOption"] = "MountDisplay",
413417
["labelCHAR_modifyPhaseOption"] = "Phase",
414418
["labelCHAR_modifyRunicPowerOption"] = "RunicPower",
415419
["labelCHAR_modifyStandSateOption"] = "StandState",
@@ -420,8 +424,11 @@ function Return_enUS()
420424
["labelCHAR_resetSpellsOption"] = "Spells",
421425
["labelCHAR_resetHonorOption"] = "Honor",
422426
["labelCHAR_resetLevelOption"] = "Level",
423-
["labelCHAR_resetAchievementsOption"] = "Achievements",
424427
["labelCHAR_languageClass"] = "All Class Langs",
428+
["labelCHAR_defaultClass"] = "All My Class Spells and Talents",
429+
["labelCHAR_myClass"] = "All Class Default",
430+
["labelCHAR_craftClass"] = "All Craft",
431+
["labelCHAR_GMClass"] = "All GM skills",
425432
["labelCHAR_languageCommon"] = "Common",
426433
["labelCHAR_languageOrcish"] = "Orcish",
427434
["labelCHAR_languageTaurahe"] = "Taurahe",

TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- Add to GM: reset all lvl 4
1+
- Add to GM: reset all lvl 4
2+
- Add reset achiemements

0 commit comments

Comments
 (0)