Skip to content

Commit e9f242d

Browse files
committed
refactor: Generics for several CHAR commands
CHAR_renameCommand CHAR_customizeCommand CHAR_changeRaceCommand CHAR_changeFactionCommand CHAR_combatStopCommand CHAR_maxSkillCommand CHAR_freezeCommand CHAR_unfreezeCommand CHAR_possessCommand CHAR_unpossessCommand
1 parent bb389de commit e9f242d

5 files changed

Lines changed: 159 additions & 219 deletions

File tree

Commands/Commands_Char.lua

Lines changed: 56 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,66 @@ CHAR_genericCommands = {
104104
},
105105
[CHAR_unbindSightCommand] = {
106106
[GENERICS_command] = ".unbindsight",
107+
[GENERICS_isTargetCheckNeeded] = true,
107108
[GENERICS_canTargetBeACreature] = true,
108109
[GENERICS_message] = "logCHAR_unbindSight"
110+
},
111+
[CHAR_renameCommand] = {
112+
[GENERICS_isTargetCheckNeeded] = true,
113+
[GENERICS_command] = ".character rename",
114+
[GENERICS_message] = "logCHAR_rename"
115+
},
116+
[CHAR_customizeCommand] = {
117+
[GENERICS_isTargetCheckNeeded] = true,
118+
[GENERICS_command] = ".character customize",
119+
[GENERICS_message] = "logCHAR_customize"
120+
},
121+
[CHAR_changeRaceCommand] = {
122+
[GENERICS_isTargetCheckNeeded] = true,
123+
[GENERICS_command] = ".character changerace",
124+
[GENERICS_message] = "logCHAR_changeRace"
125+
},
126+
[CHAR_changeFactionCommand] = {
127+
[GENERICS_isTargetCheckNeeded] = true,
128+
[GENERICS_command] = ".character changefaction",
129+
[GENERICS_message] = "logCHAR_changeFaction"
130+
},
131+
[CHAR_combatStopCommand] = {
132+
[GENERICS_isTargetCheckNeeded] = true,
133+
[GENERICS_command] = ".combatstop",
134+
[GENERICS_message] = "logCHAR_combatStop"
135+
},
136+
[CHAR_maxSkillCommand] = {
137+
[GENERICS_isTargetCheckNeeded] = true,
138+
[GENERICS_command] = ".maxskill",
139+
[GENERICS_message] = "logCHAR_maxSkill"
140+
},
141+
[CHAR_freezeCommand] = {
142+
[GENERICS_isTargetCheckNeeded] = true,
143+
[GENERICS_command] = ".freeze",
144+
[GENERICS_message] = "logCHAR_freeze"
145+
},
146+
[CHAR_unfreezeCommand] = {
147+
[GENERICS_isTargetCheckNeeded] = true,
148+
[GENERICS_command] = ".unfreeze",
149+
[GENERICS_message] = "logCHAR_unfreeze"
150+
},
151+
[CHAR_possessCommand] = {
152+
[GENERICS_isTargetCheckNeeded] = true,
153+
[GENERICS_command] = ".possess",
154+
[GENERICS_canTargetBeACreature] = true,
155+
[GENERICS_message] = "logCHAR_possess"
156+
},
157+
[CHAR_unpossessCommand] = {
158+
[GENERICS_isTargetCheckNeeded] = true,
159+
[GENERICS_canTargetBeACreature] = true,
160+
[GENERICS_command] = ".unpossess",
161+
[GENERICS_message] = "logCHAR_unpossess"
109162
}
110163
}
164+
-- Delete
165+
166+
--
111167

112168
function InitModelFrame()
113169
ma_modelframe:SetScript("OnUpdate", function() MangAdminModelOnUpdate(arg1) end)
@@ -170,44 +226,6 @@ function ModelChanged()
170226
ma_modelframe:RefreshUnit()
171227
end
172228

173-
174-
-- Delete
175-
176-
177-
function Demorph()
178-
local player = UnitName("target") or UnitName("player")
179-
MangAdmin:ChatMsg(".morph reset")
180-
MangAdmin:LogAction("Demorphed player "..player..".")
181-
end
182-
183-
function CharMorphButton()
184-
local player = UnitName("target") or UnitName("player")
185-
local diplayID = ma_charactertarget:GetText()
186-
MangAdmin:ChatMsg(".morph target "..diplayID)
187-
MangAdmin:LogAction("Morph applied to "..player..".")
188-
189-
end
190-
191-
function GetGPSInfo()
192-
local player = UnitName("target") or UnitName("player")
193-
MangAdmin:ChatMsg(".gps")
194-
MangAdmin:LogAction("Got GPS coordinates for player "..player..".")
195-
end
196-
197-
function CharBindSight()
198-
local cname = ma_charactertarget:GetText()
199-
MangAdmin:ChatMsg(".bindsight")
200-
MangAdmin:LogAction("Sight bound to "..cname)
201-
end
202-
203-
function CharUnBindSight()
204-
local cname = ma_charactertarget:GetText()
205-
MangAdmin:ChatMsg(".unbindsight")
206-
MangAdmin:LogAction("Sight unbound to "..cname)
207-
end
208-
209-
--
210-
211229
function ToggleMapsChar(value)
212230
MangAdmin:ChatMsg(".cheat explore "..value)
213231
if value == 1 then
@@ -217,8 +235,6 @@ function ToggleMapsChar(value)
217235
end
218236
end
219237

220-
221-
222238
function LearnSpell(value, state)
223239
if MangAdmin:Selection("player") or MangAdmin:Selection("self") or MangAdmin:Selection("none") then
224240
local player = UnitName("target") or UnitName("player")
@@ -440,72 +456,6 @@ function ResetDropDownInitialize()
440456
UIDropDownMenu_SetSelectedValue(ma_resetdropdown, "talents")
441457
end
442458

443-
444-
function CharRename()
445-
local cname = ma_charactertarget:GetText()
446-
MangAdmin:ChatMsg(".character rename")
447-
MangAdmin:LogAction("Forced rename of "..cname)
448-
end
449-
450-
function CharCustomize()
451-
local cname = ma_charactertarget:GetText()
452-
MangAdmin:ChatMsg(".character customize")
453-
MangAdmin:LogAction("Forced customization of "..cname)
454-
end
455-
456-
function CharChangeRace()
457-
local cname = ma_charactertarget:GetText()
458-
MangAdmin:ChatMsg(".character changerace")
459-
MangAdmin:LogAction("Forced race change of "..cname)
460-
end
461-
462-
function CharChangeFaction()
463-
local cname = ma_charactertarget:GetText()
464-
MangAdmin:ChatMsg(".character changefaction")
465-
MangAdmin:LogAction("Forced faction change of "..cname)
466-
end
467-
468-
function CharCombatStop()
469-
local player = UnitName("target") or UnitName("player")
470-
MangAdmin:ChatMsg(".combatstop")
471-
MangAdmin:LogAction("Forced combat stop on "..player)
472-
end
473-
474-
function CharMaxSkill()
475-
local player = UnitName("target") or UnitName("player")
476-
MangAdmin:ChatMsg(".maxskill")
477-
MangAdmin:LogAction("Set player MaxSkill for "..player)
478-
end
479-
480-
function CharFreeze()
481-
local player = UnitName("target") or UnitName("player")
482-
MangAdmin:ChatMsg(".freeze")
483-
MangAdmin:LogAction("Set Freeze for "..player)
484-
end
485-
486-
function CharUnFreeze()
487-
local player = UnitName("target") or UnitName("player")
488-
MangAdmin:ChatMsg(".unfreeze")
489-
MangAdmin:LogAction("UnFroze "..player)
490-
end
491-
492-
function CharListFreeze()
493-
MangAdmin:ChatMsg(".listfreeze")
494-
MangAdmin:LogAction("Listed Frozen players")
495-
end
496-
497-
function CharPossess()
498-
local player = UnitName("target") or UnitName("player")
499-
MangAdmin:ChatMsg(".possess")
500-
MangAdmin:LogAction("Possessed "..player)
501-
end
502-
503-
function CharUnPossess()
504-
local player = UnitName("target") or UnitName("player")
505-
MangAdmin:ChatMsg(".unpossess")
506-
MangAdmin:LogAction("UnPossessed "..player)
507-
end
508-
509459
function CharRecall()
510460
local player = UnitName("target") or UnitName("player")
511461
MangAdmin:ChatMsg(".recall")

Commands/declarations/command_keys.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ GENERICS_command = "command"
1616
GENERICS_message = "message"
1717

1818
-- Spells Keys
19+
-- GM
1920
GM_displayAccountGMLevelCommand = "displayAccountLevel"
2021
GM_flyModeCommand = "flyMode"
2122
GM_godModeCommand = "godMode"
@@ -56,7 +57,7 @@ GM_playerSpeedCommand = "playerSpeed"
5657
GM_playerScaleCommand = "playerScale"
5758
GM_AllianceJailCommand = "allianceJail"
5859
GM_HordeJailCommand = "hordeJail"
59-
60+
--CHAR
6061
CHAR_reviveCommand = "revive"
6162
CHAR_saveCommand = "save"
6263
CHAR_kickCommand = "kick"
@@ -71,4 +72,14 @@ CHAR_morphResetCommand = "morphReset"
7172
CHAR_gpsCommand = "gps"
7273
CHAR_bindSightCommand = "bindSight"
7374
CHAR_unbindSightCommand = "unbindSight"
75+
CHAR_renameCommand = "rename"
76+
CHAR_customizeCommand = "customize"
77+
CHAR_changeRaceCommand = "changeRace"
78+
CHAR_changeFactionCommand = "changeFaction"
79+
CHAR_combatStopCommand = "combatStop"
80+
CHAR_maxSkillCommand = "maxSkill"
81+
CHAR_freezeCommand = "freeze"
82+
CHAR_unfreezeCommand = "unfreeze"
83+
CHAR_possessCommand = "possess"
84+
CHAR_unpossessCommand = "unpossess"
7485

0 commit comments

Comments
 (0)