Skip to content

Commit 55ec303

Browse files
committed
refactor: another generics port
1 parent 76a3cb4 commit 55ec303

6 files changed

Lines changed: 69 additions & 67 deletions

File tree

Commands/Commands_Char.lua

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,31 @@ CHAR_genericCommands = {
298298
[GENERICS_command] = ".damage ",
299299
[GENERICS_message] = "logCHAR_damage"
300300
},
301+
[CHAR_showAreaCommand] = {
302+
[GENERICS_isParametersNeeded] = true,
303+
[GENERICS_isTargetCheckNeeded] = true,
304+
[GENERICS_command] = ".showarea ",
305+
[GENERICS_message] = "logCHAR_showArea"
306+
},
307+
[CHAR_hideAreaCommand] = {
308+
[GENERICS_isParametersNeeded] = true,
309+
[GENERICS_isTargetCheckNeeded] = true,
310+
[GENERICS_command] = ".hidearea ",
311+
[GENERICS_message] = "logCHAR_hideArea"
312+
},
313+
[CHAR_honorAddCommand] = {
314+
[GENERICS_isParametersNeeded] = true,
315+
[GENERICS_isTargetCheckNeeded] = true,
316+
[GENERICS_command] = ".honor add ",
317+
[GENERICS_message] = "logCHAR_honorAdd"
318+
},
319+
[CHAR_honorUpdateCommand] = {
320+
[GENERICS_isTargetCheckNeeded] = true,
321+
[GENERICS_command] = ".honor update ",
322+
[GENERICS_message] = "logCHAR_honorUpdate"
323+
},
301324
}
302325
-- Delete
303-
304326
--
305327

306328
function InitModelFrame()
@@ -615,31 +637,3 @@ function ResetDropDownInitialize()
615637
end
616638
UIDropDownMenu_SetSelectedValue(ma_resetdropdown, "talents")
617639
end
618-
619-
function HideAreaButton()
620-
local cname = ma_charactertarget:GetText()
621-
local npccname = ma_npccharactertarget:GetText()
622-
MangAdmin:ChatMsg(".hidearea " .. cname)
623-
MangAdmin:LogAction(".hidearea " .. cname .. ".")
624-
end
625-
626-
function ShowAreaButton()
627-
local cname = ma_charactertarget:GetText()
628-
local npccname = ma_npccharactertarget:GetText()
629-
MangAdmin:ChatMsg(".showarea " .. cname)
630-
MangAdmin:LogAction(".showarea " .. cname .. ".")
631-
end
632-
633-
function HonorAddButton()
634-
local cname = ma_charactertarget:GetText()
635-
local npccname = ma_npccharactertarget:GetText()
636-
MangAdmin:ChatMsg(".honor add " .. cname)
637-
MangAdmin:LogAction(".honor add " .. cname .. ".")
638-
end
639-
640-
function HonorUpdateButton()
641-
local cname = ma_charactertarget:GetText()
642-
local npccname = ma_npccharactertarget:GetText()
643-
MangAdmin:ChatMsg(".honor update ")
644-
MangAdmin:LogAction(".honor update.")
645-
end

Commands/Commands_Generics.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ function getCallsDictionary(ID)
3434
end
3535

3636
function genericClearParametersBox(caller)
37-
if (caller == "GM") then
37+
if (caller == GM_KEY) then
3838
GM_parameterInput:SetText("")
39+
elseif (caller == CHAR_KEY) then
40+
CHAR_parameterInput:setText("")
3941
end
4042
end
4143

Commands/declarations/command_keys.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ CHAR_deleteGuildCommand = "deleteGuild"
9898
CHAR_inviteGuildCommand = "inviteGuild"
9999
CHAR_uninviteGuildCommand = "uninviteGuild"
100100
CHAR_rankGuildCommand = "rankGuild"
101-
102101
CHAR_muteCommand = "mute"
103102
CHAR_unmuteCommand = "unmute"
104103
CHAR_auraCommand = "aura"
@@ -110,3 +109,7 @@ CHAR_questAddCommand = "questAdd"
110109
CHAR_questRemoveCommand = "questRemove"
111110
CHAR_questCompleteCommand = "questComplete"
112111
CHAR_damageCommand = "damage"
112+
CHAR_showAreaCommand = "showArea"
113+
CHAR_hideAreaCommand = "hideArea"
114+
CHAR_honorAddCommand = "honorAdd"
115+
CHAR_honorUpdateCommand = "honorUpdate"

Frames/MangFrames_SectionChar.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,11 +1294,11 @@ function MangAdmin:CreateCharSection()
12941294
})
12951295

12961296
FrameLib:BuildButton({
1297-
name = "ma_hideareabutton",
1297+
name = "CHAR_hideAreaButton",
12981298
group = "char",
12991299
parent = ma_midframe,
13001300
texture = {
1301-
name = "ma_hideareabutton_texture",
1301+
name = "CHAR_hideAreaButton_texture",
13021302
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
13031303
},
13041304
size = {
@@ -1310,15 +1310,15 @@ function MangAdmin:CreateCharSection()
13101310
offX = 548, --charColSix
13111311
offY = -30 --charRowOne
13121312
},
1313-
text = Locale["ma_HideAreaButton"]
1313+
text = Locale["labelCHAR_hideAreaButton"]
13141314
})
13151315

13161316
FrameLib:BuildButton({
1317-
name = "ma_showareabutton",
1317+
name = "CHAR_showAreaButton",
13181318
group = "char",
13191319
parent = ma_midframe,
13201320
texture = {
1321-
name = "ma_showareabutton_texture",
1321+
name = "CHAR_showAreaButton_texture",
13221322
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
13231323
},
13241324
size = {
@@ -1330,15 +1330,15 @@ function MangAdmin:CreateCharSection()
13301330
offX = 467, --charColFive
13311331
offY = -30 --charRowOne
13321332
},
1333-
text = Locale["ma_ShowAreaButton"]
1333+
text = Locale["labelCHAR_showAreaButton"]
13341334
})
13351335

13361336
FrameLib:BuildButton({
1337-
name = "ma_honoraddbutton",
1337+
name = "CHAR_honorAddButton",
13381338
group = "char",
13391339
parent = ma_midframe,
13401340
texture = {
1341-
name = "ma_honoraddbutton_texture",
1341+
name = "CHAR_honorAddButton_texture",
13421342
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
13431343
},
13441344
size = {
@@ -1350,15 +1350,15 @@ function MangAdmin:CreateCharSection()
13501350
offX = 467, --charColFive
13511351
offY = -204 --charRowNine
13521352
},
1353-
text = Locale["ma_HonorAddButton"]
1353+
text = Locale["labelCHAR_honorAddButton"]
13541354
})
13551355

13561356
FrameLib:BuildButton({
1357-
name = "ma_honorupdatebutton",
1357+
name = "CHAR_honorUpdateButton",
13581358
group = "char",
13591359
parent = ma_midframe,
13601360
texture = {
1361-
name = "ma_honorupdatebutton_texture",
1361+
name = "CHAR_honorUpdateButton_texture",
13621362
color = { color.btn.r, color.btn.g, color.btn.b, transparency.btn }
13631363
},
13641364
size = {
@@ -1370,7 +1370,7 @@ function MangAdmin:CreateCharSection()
13701370
offX = 548, --charColSix
13711371
offY = -204 --charRowNine
13721372
},
1373-
text = Locale["ma_HonorUpdateButton"]
1373+
text = Locale["labelCHAR_honorUpdateButton"]
13741374
})
13751375

13761376
FrameLib:BuildFontString({
@@ -1396,7 +1396,7 @@ function MangAdmin:CreateCharSection()
13961396
},
13971397
setpoint = {
13981398
pos = "BOTTOMLEFT",
1399-
offX = 292,
1399+
offX = 305,
14001400
offY = 4
14011401
},
14021402
inherits = "InputBoxTemplate"

FunctionInit.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -970,31 +970,31 @@ function InitControls()
970970
end
971971
)
972972
MangAdmin:PrepareScript(
973-
ma_hideareabutton,
974-
Locale["tt_HideAreaButton"],
973+
CHAR_hideAreaButton,
974+
Locale["ttCHAR_hideArea"],
975975
function()
976-
HideAreaButton()
976+
genericCaller(CHAR_KEY, CHAR_hideAreaCommand)
977977
end
978978
)
979979
MangAdmin:PrepareScript(
980-
ma_showareabutton,
981-
Locale["tt_ShowAreaButton"],
980+
CHAR_showAreaButton,
981+
Locale["ttCHAR_showArea"],
982982
function()
983-
ShowAreaButton()
983+
genericCaller(CHAR_KEY, CHAR_showAreaCommand)
984984
end
985985
)
986986
MangAdmin:PrepareScript(
987-
ma_honoraddbutton,
988-
Locale["tt_HonorAddButton"],
987+
CHAR_honorAddButton,
988+
Locale["ttCHAR_honorAdd"],
989989
function()
990-
HonorAddButton()
990+
genericCaller(CHAR_KEY, CHAR_honorAddCommand)
991991
end
992992
)
993993
MangAdmin:PrepareScript(
994-
ma_honorupdatebutton,
995-
Locale["tt_HonorUpdateButton"],
994+
CHAR_honorUpdateButton,
995+
Locale["ttCHAR_honorUpdate"],
996996
function()
997-
HonorUpdateButton()
997+
genericCaller(CHAR_KEY, CHAR_honorUpdateCommand)
998998
end
999999
)
10001000

Locales/enUS.lua

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function Return_enUS()
5858
["tt_languageButton"] = "Reload AzerothCoreAdmin.", --Removed locals. Updated tooltip to just reload
5959
["tt_closeWindow"] = "Close AzerothCoreAdmin",
6060
["tt_clearParameterBox"] = "Clears the parameter box.",
61-
["tt_bag"] = "Show the bag of the selected character or yours [[Parameters: $bagSlot: 1-4]]",
61+
["tt_bag"] = "Show the bag of the selected character or yours [[Parameters: $bagSlot: 0-4]]",
6262
--[[General-Control Labels]]
6363
["label_languageButton"] = "Change language",
6464
["label_infoRevision"] = "|cFF00FF00AzerothCore rev:|r ", --Updated: Matched string output to AzerothCore
@@ -328,6 +328,10 @@ function Return_enUS()
328328
["ttCHAR_questRemove"] = "Removes the specified quest from **selected** player [[Parameters: $questID]]",
329329
["ttCHAR_questComplete"] = "Marks the specified quest as complete for **selected** player [[Parameters: $questID]]",
330330
["ttCHAR_damage"] = "Applies the specified amount of damage to the selected Unit [[Parameters: #damageAmount]]",
331+
["ttCHAR_showArea"] = "Shows the specified area to the **selected** player [[Parameters: $areaID]]",
332+
["ttCHAR_hideArea"] = "Hides the specified area to the **selected** player [[Parameters: $areaID]]",
333+
["ttCHAR_honorAdd"] = "Adds the specified amount of honor points to the **selected** player [[ParameterS: $pointsAmount]]",
334+
["ttCHAR_honorUpdate"] = "Saves Honor for **selected** player",
331335

332336
--[[CHAR-Control-Labels]]
333337
["labelCHAR_killButton"] = "Kill",
@@ -380,6 +384,10 @@ function Return_enUS()
380384
["labelCHAR_questRemoveButton"] = "QuestRem",
381385
["labelCHAR_questCompleteButton"] = "QuestCompl",
382386
["labelCHAR_damageButton"] = "Damage",
387+
["labelCHAR_showAreaButton"] = "ShowArea",
388+
["labelCHAR_hideAreaButton"] = "HideArea",
389+
["labelCHAR_honorAddButton"] = "HonorAdd",
390+
["labelCHAR_honorUpdateButton"] = "HonorUpdt",
383391

384392
--[[CHAR-Commands Output]]
385393
["logCHAR_kill"] = "_T_ has been killed",
@@ -433,6 +441,11 @@ function Return_enUS()
433441
["logCHAR_questComplete"] = "Set questID _V1_ as completed to _T_",
434442
["logCHAR_damage"] = "Applied _V1_ damage to _T_",
435443

444+
["logCHAR_showArea"] = "Showed areaID _V1_ to _T_",
445+
["logCHAR_hideArea"] = "Hide areaID _V1_ to _T_",
446+
["logCHAR_honorAdd"] = "Added _V1_ honor points to _T_",
447+
["logCHAR_honorUpdate"] = "Updated honor of _T_",
448+
436449
["tt_RotateLeft"] = "Rotate left.",
437450
["tt_RotateRight"] = "Rotate right.",
438451
["tt_ShowMapsCharButton"] = "Reveals maps for the selected character.",
@@ -442,10 +455,6 @@ function Return_enUS()
442455
["tt_resetbutton"] = "Reset the selected attribute",
443456
["tt_modelzoominbutton"] = "Zoom in the selected model",
444457
["tt_modelzoomoutbutton"] = "Zoom out the selected model",
445-
["tt_HideAreaButton"] = "Hides #areaid from **selected** player.",
446-
["tt_ShowAreaButton"] = "Shows #areaid to **selected** player.",
447-
["tt_HonorAddButton"] = "Adds #honorpoints to **selected** player.",
448-
["tt_HonorUpdateButton"] = "No parameter required. Saves Honor for **selected** player.",
449458

450459
["ma_ShowMapsButton"] = "Show Maps",
451460
["ma_HideMapsButton"] = "Hide Maps",
@@ -456,12 +465,6 @@ function Return_enUS()
456465
["ma_Modify"] = "Modify",
457466
["ma_Reset"] = "Reset",
458467

459-
460-
461-
["ma_HideAreaButton"] = "HideArea",
462-
["ma_ShowAreaButton"] = "ShowArea",
463-
["ma_HonorAddButton"] = "HonorAdd",
464-
["ma_HonorUpdateButton"] = "HonorUpdt",
465468
--[[Other]]
466469
["ma_LevelUp"] = "Level up",
467470
["ma_LevelDown"] = "Level down",

0 commit comments

Comments
 (0)