Mercurial > wow > cyborg-mmo7
comparison OptionView.lua @ 22:0b0f51236a88
Simplified CyborgMMO_GetButtonIndex.
| author | madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09 |
|---|---|
| date | Thu, 25 Apr 2013 01:30:31 +0000 |
| parents | cccc7661a2e6 |
| children | 92b62e33887b |
comparison
equal
deleted
inserted
replaced
| 21:c8b19bc87787 | 22:0b0f51236a88 |
|---|---|
| 51 local binding = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(name)] | 51 local binding = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(name)] |
| 52 getglobal(name):SetText(binding) | 52 getglobal(name):SetText(binding) |
| 53 end | 53 end |
| 54 | 54 |
| 55 function CyborgMMO_GetButtonIndex(name) | 55 function CyborgMMO_GetButtonIndex(name) |
| 56 local row,mode = string.find(name,"Mode") | 56 local row,mode = name:match('Row(.)Mode(.)') |
| 57 row = tonumber(row, 16) | |
| 58 mode = tonumber(mode) | |
| 57 local modeStr = string.sub(name, mode +1,mode+2) | 59 local modeStr = string.sub(name, mode +1,mode+2) |
| 58 local rowStr = string.sub(name, row-1,row-1) | 60 local rowStr = string.sub(name, row-1,row-1) |
| 59 return (CyborgMMO_GetNumberFromHexLetter(rowStr) + ((CyborgMMO_GetNumberFromHexLetter(modeStr) - 1) * 13)) | 61 return (mode-1) * 13 + row |
| 60 end | 62 end |
| 61 | 63 |
| 62 function CyborgMMO_ShowProfileTooltip(self) | 64 function CyborgMMO_ShowProfileTooltip(self) |
| 63 local red,green,blue = self:GetVertexColor() | 65 local red,green,blue = self:GetVertexColor() |
| 64 if red == 0 and green == 0 and blue == 0 then | 66 if red == 0 and green == 0 and blue == 0 then |
| 76 end | 78 end |
| 77 end | 79 end |
| 78 | 80 |
| 79 function CyborgMMO_HideProfileTooltip(self) | 81 function CyborgMMO_HideProfileTooltip(self) |
| 80 GameTooltip:Hide() | 82 GameTooltip:Hide() |
| 81 end | |
| 82 | |
| 83 function CyborgMMO_GetNumberFromHexLetter(str) | |
| 84 local number = 0 | |
| 85 if str == "A" then | |
| 86 number = 10 | |
| 87 elseif str == "B" then | |
| 88 number = 11 | |
| 89 elseif str == "C" then | |
| 90 number = 12 | |
| 91 elseif str == "D" then | |
| 92 number = 13 | |
| 93 elseif str == "E" then | |
| 94 number = 14 | |
| 95 elseif str == "F" then | |
| 96 number = 15 | |
| 97 else | |
| 98 number = tonumber(str) | |
| 99 end | |
| 100 return number | |
| 101 end | 83 end |
| 102 | 84 |
| 103 function CyborgMMO_SetNewKeybind(keyOrButton) | 85 function CyborgMMO_SetNewKeybind(keyOrButton) |
| 104 local previous = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] | 86 local previous = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] |
| 105 CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton | 87 CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton |
