vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ RightClick SelfCast Addon by kritzi ]]-- |
2 | -- Version 2.10 |
||
3 | |||
4 | -- Maintenance by Ozymandius |
||
5 | -- I find this mod invaluable, and can't live without it, which is |
||
6 | -- why I was most upset when it started failing after patch 1.10 |
||
7 | -- Never touched the internals of a mod before, but it neded fixing ;) |
||
8 | -- Don't expect any further updates unless it totally breaks again |
||
9 | |||
10 | -- Version History |
||
11 | -- 31/03/06 - 2.10 - Updated to work in patch 1.10 |
||
12 | -- TBH, this just involved changing te tooltip defn. in the XML |
||
13 | -- & incrementing the version in the TOC |
||
14 | |||
15 | -- Just right klick a spell and instead of the TargetingCursor |
||
16 | -- you will target yourselfe. |
||
17 | |||
18 | function rSelfCast_OnLoad() |
||
19 | rSelfCast_Original_UseAction = UseAction; |
||
20 | UseAction = rSelfCast_UseAction; |
||
21 | |||
22 | this:RegisterEvent("ADDON_LOADED"); |
||
23 | |||
24 | SLASH_rSelfCast1="/rsc"; |
||
25 | SlashCmdList["rSelfCast"] = rSelfCast_Command; |
||
26 | |||
27 | SLASH_rel1="/rel"; |
||
28 | SlashCmdList["rel"] = rel; |
||
29 | end |
||
30 | |||
31 | function rel() |
||
32 | ReloadUI(); |
||
33 | end |
||
34 | |||
35 | function rSelfCast_Set(type,var,value) |
||
36 | if(rSelfCast_Array == nil) then rSelfCast_Array={}; end |
||
37 | if(rSelfCast_Array[GetLocale()] == nil) then rSelfCast_Array[GetLocale()]={}; end |
||
38 | if(rSelfCast_Array[GetLocale()][UnitClass("player")] == nil) then rSelfCast_Array[GetLocale()][UnitClass("player")]={}; end |
||
39 | if(rSelfCast_Array[GetLocale()][UnitClass("player")][type] == nil) then rSelfCast_Array[GetLocale()][UnitClass("player")][type]={}; end |
||
40 | if(rSelfCast_Array[GetLocale()][UnitClass("player")][type][var] == nil) then rSelfCast_Array[GetLocale()][UnitClass("player")][type][var]=value; end |
||
41 | end |
||
42 | |||
43 | function rSelfCast_Get(type,var) |
||
44 | if (rSelfCast_Array == nil) then return nil; |
||
45 | elseif(rSelfCast_Array[GetLocale()] == nil) then return nil; |
||
46 | elseif(rSelfCast_Array[GetLocale()][UnitClass("player")] == nil) then return nil; |
||
47 | elseif(rSelfCast_Array[GetLocale()][UnitClass("player")][type] == nil) then return nil; |
||
48 | else return rSelfCast_Array[GetLocale()][UnitClass("player")][type][var]; end |
||
49 | end |
||
50 | |||
51 | function rSelfCast_OnEvent() |
||
52 | if(event ~= nil and event == "ADDON_LOADED" and rSelfCast_Disabled == nil) then |
||
53 | this:RegisterEvent("CHAT_MSG_SPELL_FAILED_LOCALPLAYER"); |
||
54 | if(rSelfCast_Version == nil) then rSelfCast_Version = 200; end |
||
55 | |||
56 | elseif(event ~= nil and event == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" and arg1 ~= nil and rSelfCast_MouseButton == "RightButton") then |
||
57 | rSelfCast_Debug(arg1); |
||
58 | |||
59 | local check_array={ |
||
60 | "Ihr scheitert beim Wirken von (.+): Ung\195\188ltiges Ziel.", |
||
61 | "Ihr scheitert beim Wirken von (.+): Eure Waffenhand ist leer..", |
||
62 | "You fail to cast (.+): No target.", |
||
63 | "You fail to cast (.+): Your weapon hand is empty.", |
||
64 | "Vous n'avez pas r\195\169ussi \195\160 lancer (.+) : Cible incorrecte.", |
||
65 | "Vous n'avez pas r\195\169ussi \195\160 lancer (.+) : Vous n'avez pas d'arme en main.." |
||
66 | } |
||
67 | |||
68 | for i,check in check_array do |
||
69 | for action in string.gfind(arg1, check) do |
||
70 | rSelfCast_Debug("Adding '"..action.."' as a not SelfCast able."); |
||
71 | rSelfCast_Set("no_selfcast",action,true); |
||
72 | end |
||
73 | end |
||
74 | end |
||
75 | end |
||
76 | |||
77 | function rSelfCast_UseAction(id, type, self) |
||
78 | rSelfCast_MouseButton = arg1; |
||
79 | |||
80 | if(rSelfCast_MouseButton == "RightButton" and rSelfCast_Disabled == nil) then |
||
81 | rSelfCast_Debug("Performing right-click"); |
||
82 | rSelfCast_Tooltip:SetAction(id); |
||
83 | if(rSelfCast_TooltipTextLeft1 ~= nil) then |
||
84 | local action=rSelfCast_TooltipTextLeft1:GetText(); |
||
85 | rSelfCast_Debug("ToolTipTextLeft1 = '"..action.."'."); |
||
86 | |||
87 | if(rSelfCast_Get("no_selfcast",action) == nil) then |
||
88 | self = 1; |
||
89 | if(rSelfCast_Get("selfcast_bug",action) == true) then |
||
90 | rSelfCast_Debug("Change Target to Player because '"..action.."' is buggy."); |
||
91 | TargetUnit("player"); |
||
92 | end |
||
93 | end |
||
94 | |||
95 | rSelfCast_Original_UseAction(id, type, self); |
||
96 | |||
97 | if(SpellIsTargeting() and self == 1) then |
||
98 | rSelfCast_Debug("Adding '"..action.."' as buggy."); |
||
99 | rSelfCast_Set("selfcast_bug",action,true); |
||
100 | SpellTargetUnit("player"); |
||
101 | elseif(rSelfCast_Get("selfcast_bug",action) == true) then |
||
102 | rSelfCast_Debug("Switch back to the last Target."); |
||
103 | TargetLastTarget(); |
||
104 | end |
||
105 | end |
||
106 | else |
||
107 | rSelfCast_Original_UseAction(id, type, self); |
||
108 | end |
||
109 | end |
||
110 | |||
111 | function rSelfCast_Command(cmd) |
||
112 | if(cmd ~= nil and cmd == "enable") then |
||
113 | rSelfCast_Disabled=nil; |
||
114 | if(rSelfCast_Original_UseAction == nil) then |
||
115 | rSelfCast_Original_UseAction = UseAction; |
||
116 | UseAction = rSelfCast_UseAction; |
||
117 | end |
||
118 | this:RegisterEvent("CHAT_MSG_SPELL_FAILED_LOCALPLAYER"); |
||
119 | |||
120 | DEFAULT_CHAT_FRAME:AddMessage("rSelfCast is now enabled."); |
||
121 | |||
122 | elseif(cmd ~= nil and cmd == "disable") then |
||
123 | rSelfCast_Disabled=true; |
||
124 | this:UnregisterEvent("CHAT_MSG_SPELL_FAILED_LOCALPLAYER"); |
||
125 | |||
126 | DEFAULT_CHAT_FRAME:AddMessage("rSelfCast is now disabled."); |
||
127 | |||
128 | elseif(cmd ~= nil and cmd == "debug enable" and rSelfCast_Disabled == nil) then |
||
129 | rSelfCast_DebugMode=true; |
||
130 | DEFAULT_CHAT_FRAME:AddMessage("rSelfCast debug mode is now enabled."); |
||
131 | |||
132 | elseif(cmd ~= nil and cmd == "debug disable" and rSelfCast_Disabled == nil) then |
||
133 | rSelfCast_DebugMode=nil; |
||
134 | DEFAULT_CHAT_FRAME:AddMessage("rSelfCast debug mode is now disabled."); |
||
135 | |||
136 | elseif(cmd ~= nil and cmd == "reset" and rSelfCast_Disabled == nil and rSelfCast_DebugMode == true) then |
||
137 | rSelfCast_Array=nil; |
||
138 | DEFAULT_CHAT_FRAME:AddMessage("All collected rSelfCast data were reseted."); |
||
139 | rSelfCast_Debug("TEST 1"); |
||
140 | |||
141 | else |
||
142 | DEFAULT_CHAT_FRAME:AddMessage("|cffffff78rSelfCast Help:|r"); |
||
143 | if(rSelfCast_Disabled == true) then |
||
144 | DEFAULT_CHAT_FRAME:AddMessage("The AddOn is disabled for this profile."); |
||
145 | DEFAULT_CHAT_FRAME:AddMessage(" |cffffff78/rsc enable|r - activates the AddOn"); |
||
146 | else |
||
147 | if(rSelfCast_DebugMode == true) then |
||
148 | DEFAULT_CHAT_FRAME:AddMessage("The debug mode is enabled."); |
||
149 | DEFAULT_CHAT_FRAME:AddMessage(" |cffffff78/rsc debug disable|r - deactivates the debug mode."); |
||
150 | DEFAULT_CHAT_FRAME:AddMessage(" |cffffff78/rsc reset|r - deletes all collected data."); |
||
151 | else |
||
152 | DEFAULT_CHAT_FRAME:AddMessage(" |cffffff78/rsc debug enable|r - activates the debug mode."); |
||
153 | end |
||
154 | DEFAULT_CHAT_FRAME:AddMessage(" |cffffff78/rsc disable|r - deactivates the AddOn for this profile."); |
||
155 | end |
||
156 | end |
||
157 | end |
||
158 | |||
159 | function rSelfCast_Debug(string) |
||
160 | if(rSelfCast_DebugMode == true and string ~= nil) then |
||
161 | DEFAULT_CHAT_FRAME:AddMessage("|cffff6666rSC debug|r - "..string); |
||
162 | end |
||
163 | end |