Mercurial > wow > cyborg-mmo7
comparison OptionView.lua @ 4:d186f8cd5000
Renamed functions to avoid conflicts
author | madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09 |
---|---|
date | Mon, 28 May 2012 15:54:52 +0000 |
parents | 08c83fa555a5 |
children | 8428fa7cf0e4 |
comparison
equal
deleted
inserted
replaced
3:461854a2849c | 4:d186f8cd5000 |
---|---|
16 | 16 |
17 --~ You should have received a copy of the GNU General Public License | 17 --~ You should have received a copy of the GNU General Public License |
18 --~ along with this program; if not, write to the Free Software | 18 --~ along with this program; if not, write to the Free Software |
19 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 19 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | 20 |
21 OptionView = { | 21 CyborgMMO_OptionView = { |
22 new = function(self) | 22 new = function(self) |
23 self.name = "Cyborg MMO7 Plugin" | 23 self.name = "Cyborg MMO7 Plugin" |
24 InterfaceOptions_AddCategory(self); | 24 InterfaceOptions_AddCategory(self); |
25 return self | 25 return self |
26 | 26 |
27 end | 27 end |
28 } | 28 } |
29 | 29 |
30 local lastButton = nil | 30 local lastButton = nil |
31 | 31 |
32 function BindButton(name) | 32 function CyborgMMO_BindButton(name) |
33 lastButton = name | 33 lastButton = name |
34 local index = GetButtonIndex(name) | 34 local index = CyborgMMO_GetButtonIndex(name) |
35 local mode = 1 | 35 local mode = 1 |
36 while(index > 13) do | 36 while(index > 13) do |
37 mode = mode + 1 | 37 mode = mode + 1 |
38 index = index - 13 | 38 index = index - 13 |
39 end | 39 end |
40 local buttonStr = StringTable[("MouseRow"..index.."Name")] | 40 local buttonStr = StringTable[("CyborgMMO_OptionPageRebindMouseRow"..index.."Name")] |
41 | 41 |
42 getglobal("BindingFrameButtonName"):SetText(buttonStr.." Mode "..mode) | 42 getglobal("CyborgMMO_BindingFrameButtonName"):SetText(buttonStr.." Mode "..mode) |
43 getglobal("BindingFrameKey"):SetText(StringTable["CurrentBinding"].." "..WowCommands[GetButtonIndex(lastButton)]) | 43 getglobal("CyborgMMO_BindingFrameKey"):SetText(StringTable["CyborgMMO_CurrentBinding"].." "..WowCommands[CyborgMMO_GetButtonIndex(lastButton)]) |
44 BindingFrame:Show() | 44 CyborgMMO_BindingFrame:Show() |
45 | 45 |
46 end | 46 end |
47 | 47 |
48 function GetBindingButtonText(name) | 48 function CyborgMMO_GetBindingButtonText(name) |
49 if(nil == WowCommands) then | 49 if(nil == WowCommands) then |
50 LoadWowCommands(); | 50 CyborgMMO_LoadWowCommands(); |
51 end | 51 end |
52 | 52 |
53 local binding = WowCommands[GetButtonIndex(name)] | 53 local binding = WowCommands[CyborgMMO_GetButtonIndex(name)] |
54 getglobal(name):SetText(binding) | 54 getglobal(name):SetText(binding) |
55 end | 55 end |
56 | 56 |
57 function GetButtonIndex(name) | 57 function CyborgMMO_GetButtonIndex(name) |
58 local row,mode = string.find(name,"Mode") | 58 local row,mode = string.find(name,"Mode") |
59 local modeStr = string.sub(name, mode +1,mode+2) | 59 local modeStr = string.sub(name, mode +1,mode+2) |
60 local rowStr = string.sub(name, row-1,row-1) | 60 local rowStr = string.sub(name, row-1,row-1) |
61 return (GetNumberFromHexLetter(rowStr) + ((GetNumberFromHexLetter(modeStr) - 1) * 13)) | 61 return (CyborgMMO_GetNumberFromHexLetter(rowStr) + ((CyborgMMO_GetNumberFromHexLetter(modeStr) - 1) * 13)) |
62 end | 62 end |
63 | 63 |
64 function GetNumberFromHexLetter(str) | 64 function CyborgMMO_GetNumberFromHexLetter(str) |
65 local number = 0 | 65 local number = 0 |
66 if("A" == str) then | 66 if("A" == str) then |
67 number = 10 | 67 number = 10 |
68 elseif("B" == str) then | 68 elseif("B" == str) then |
69 number = 11 | 69 number = 11 |
79 number = tonumber(str) | 79 number = tonumber(str) |
80 end | 80 end |
81 return number | 81 return number |
82 end | 82 end |
83 | 83 |
84 function SetNewKeybind(keyOrButton) | 84 function CyborgMMO_SetNewKeybind(keyOrButton) |
85 local previous = WowCommands[GetButtonIndex(lastButton)] | 85 local previous = WowCommands[CyborgMMO_GetButtonIndex(lastButton)] |
86 WowCommands[GetButtonIndex(lastButton)] = keyOrButton; | 86 WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton; |
87 GetBindingButtonText(lastButton); | 87 CyborgMMO_GetBindingButtonText(lastButton); |
88 BindingFrame:Hide() | 88 CyborgMMO_BindingFrame:Hide() |
89 RatPageModel.Instance().LoadData() | 89 CyborgMMO_RatPageModel.Instance().LoadData() |
90 end | 90 end |
91 | 91 |
92 function BindingFrame_OnKeyDown(self, keyOrButton) | 92 function CyborgMMO_BindingFrameOnKeyDown(self, keyOrButton) |
93 if keyOrButton=="ESCAPE" then | 93 if keyOrButton=="ESCAPE" then |
94 BindingFrame:Hide() | 94 CyborgMMO_BindingFrame:Hide() |
95 return | 95 return |
96 end | 96 end |
97 | 97 |
98 if ( GetBindingFromClick(keyOrButton) == "SCREENSHOT" ) then | 98 if ( GetBindingFromClick(keyOrButton) == "SCREENSHOT" ) then |
99 RunBinding("SCREENSHOT"); | 99 RunBinding("SCREENSHOT"); |
190 end | 190 end |
191 if ( keyPressed == "BUTTON1" or keyPressed == "BUTTON2" ) then | 191 if ( keyPressed == "BUTTON1" or keyPressed == "BUTTON2" ) then |
192 return; | 192 return; |
193 end | 193 end |
194 | 194 |
195 SetNewKeybind(keyPressed) | 195 CyborgMMO_SetNewKeybind(keyPressed) |
196 | 196 |
197 end | 197 end |