vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Extra common usage commands not significant enough for a new module.
3 --Thott
4  
5 Refactored it so that it uses the localization.lua. Added save settings by class.
6 --sarf
7 ]]
8  
9 function UltimateUI_RegisterUltimateUIChatCommands()
10 --------------------------------------------------------------------------------
11 -- Register the help command.
12 local comlist = ULTIMATEUI_HELP_COMM;
13 local desc = ULTIMATEUI_HELP_COMM_INFO;
14 local id = "ULTIMATEUIHELP";
15 local func = function (msg) UltimateUIMaster_ChatCommandsHelpDisplay(); end
16 UltimateUI_RegisterChatCommand ( id, comlist, func, desc, CSM_CHAINNONE );
17 -- Overwrite old help command.
18 UltimateUI_RegisterChatCommand ( "HELP", comlist, func, "", CSM_CHAINPRE );
19 --------------------------------------------------------------------------------
20  
21 --------------------------------------------------------------------------------
22 -- Register the version command.
23 comlist = ULTIMATEUI_VERSION_COMM;
24 desc = ULTIMATEUI_VERSION_COMM_INFO;
25 id = "ULTIMATEUIVERSION";
26 func = function (msg) UltimateUIMaster_ChatVersionDisplay(); end
27 UltimateUI_RegisterChatCommand ( id, comlist, func, desc, CSM_CHAINNONE );
28 --------------------------------------------------------------------------------
29  
30 --------------------------------------------------------------------------------
31 -- Register the reload ui command.
32 comlist = ULTIMATEUI_RELOADUI_COMM;
33 desc = ULTIMATEUI_RELOADUI_COMM_INFO;
34 id = "RELOADUI";
35 func = function()
36 ReloadUI();
37 end
38 UltimateUI_RegisterChatCommand ( id, comlist, func, desc );
39 --------------------------------------------------------------------------------
40  
41 --------------------------------------------------------------------------------
42 -- Register (and setup) /stop
43 UltimateUIStop_OnLoad();
44 comlist = ULTIMATEUI_STOP_COMM;
45 desc = ULTIMATEUI_STOP_COMM_INFO;
46 id = "STOP";
47 func = function()
48 UltimateUI_Stop();
49 end
50 UltimateUI_RegisterChatCommand ( id, comlist, func, desc );
51 --------------------------------------------------------------------------------
52  
53 --------------------------------------------------------------------------------
54 -- Register the class CVar settings commands.
55 comlist = ULTIMATEUI_CLASS_SETTINGS_COMM;
56 desc = format(ULTIMATEUI_CLASS_SETTINGS_COMM_INFO, ULTIMATEUI_CLASS_SETTINGS_PARAM_SAVE, ULTIMATEUI_CLASS_SETTINGS_PARAM_LOAD);
57 id = "SETTINGSBYCLASS";
58 func = function(msg)
59 if ( ( not msg ) or ( strlen(msg) <= 0 ) ) then
60 -- Sea.io.print(format(ULTIMATEUI_CLASS_SETTINGS_HELP1, ULTIMATEUI_CLASS_SETTINGS_PARAM_LOAD, ULTIMATEUI_CLASS_SETTINGS_PARAM_SAVE));
61 return;
62 end
63 local command = strlower(msg);
64 local class = UnitClass("player");
65 if( strfind("save", command) ) then
66 UltimateUIMaster_StoreVariables()
67 if ( UltimateUI_SaveDefaultSettingsForClass(class) ) then
68 -- Sea.io.print(format(ULTIMATEUI_CLASS_SETTINGS_SAVED, class));
69 else
70 -- Sea.io.print(format(ULTIMATEUI_CLASS_SETTINGS_SAVED_ERROR, class));
71 end
72 elseif( strfind("load", command) ) then
73 if ( UltimateUI_LoadDefaultSettingsForClass(class) ) then
74 UltimateUIMaster_LoadVariables();
75 -- Sea.io.print(format(ULTIMATEUI_CLASS_SETTINGS_LOADED, class));
76 else
77 -- Sea.io.print(format(ULTIMATEUI_CLASS_SETTINGS_LOADED_ERROR, class));
78 end
79 else
80 -- Sea.io.print(ULTIMATEUI_CLASS_SETTINGS_HELP2);
81 end
82 end
83 UltimateUI_RegisterChatCommand ( id, comlist, func, desc );
84 --------------------------------------------------------------------------------
85  
86 --------------------------------------------------------------------------------
87 -- Register the /f x command
88 if (SLASH_FOLLOW4 == "/f") then
89 SLASH_FOLLOW1 = "/fol";
90 SLASH_FOLLOW4 = "/fol";
91 end
92  
93 comlist = FCOMMAND_COMM;
94 desc = FCOMMAND_COMM_INFO;
95 id = "FRIENDSCOMMAND";
96 func = function(msg)
97 local tbl = split(msg, " ");
98 if (not tbl[1]) then return; end
99  
100 if (tbl[1] == "l" or tbl[1] == "list") then
101 local m = ""
102 local bool = 0;
103 local numFriends = GetNumFriends();
104 for i = 1, numFriends, 1 do
105 local name, level, class, area, connected = GetFriendInfo(i);
106 if (not connected) then
107 if (bool == 0) then
108 bool = 1;
109 print1(FCOMMAND_ONLINE);
110 print1(m);
111 m = "";
112 end
113 m = m..MakeHyperLink("Player:"..name, name, "FF0000").." ";
114 else
115 m = m..MakeHyperLink("Player:"..name, name, "00FF00").." ";
116 end
117 end
118 print1(FCOMMAND_OFFLINE);
119 print1(m);
120 elseif (tbl[1] == "a" or tbl[1] == "add") then
121 if (tbl[2]) then
122 AddFriend(tbl[2]);
123 end
124 elseif (tbl[1] == "r" or tbl[1] == "remove") then
125 if (tbl[2]) then
126 RemoveFriend(tbl[2]);
127 end
128 elseif (tbl[1] == "m" or tbl[1] == "message") then
129 local m = strsub(msg, strlen(tbl[1]) + 1);
130 if (not m or strlen(m) < 1) then return; end
131 local numFriends = GetNumFriends();
132 for i = 1, numFriends, 1 do
133 local name, level, class, area, connected = GetFriendInfo(i);
134 if (not connected) then
135 break;
136 end
137 SendChatMessage(m, "WHISPER", this.language, name);
138 end
139 end
140 end
141 UltimateUI_RegisterChatCommand ( id, comlist, func, desc );
142 --------------------------------------------------------------------------------
143 end
144  
145 -- UltimateUI /stop command functions. This command is obviously for macros.
146 function UltimateUIStop_OnLoad()
147 -- Sea.util.hook("MoveForwardStop","UltimateUIStop_AutoStop");
148 -- Sea.util.hook("MoveBackwardStop","UltimateUIStop_AutoStop");
149 -- Sea.util.hook("ToggleAutoRun","UltimateUIStop_AutoToggle");
150 end
151 function UltimateUIStop_AutoStop()
152 UltimateUIStopAuto = false;
153 end
154 function UltimateUIStop_AutoToggle()
155 UltimateUIStopAuto = not UltimateUIStopAuto;
156 end
157 function UltimateUI_Stop()
158 if(UltimateUIStopAuto) then
159 UltimateUIStopAuto = false;
160 ToggleAutoRun();
161 end
162 MoveForwardStop();
163 MoveBackwardStop();
164 TurnLeftStop();
165 TurnRightStop();
166 end