Mercurial > wow > cyborg-mmo7
changeset 5:8428fa7cf0e4
Updated the profile to use macros and rename all the variables and functions with the prefix CyborgMMO. Added a tooltip to inform the user to assign the profile.
author | madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09 |
---|---|
date | Tue, 29 May 2012 10:26:40 +0000 |
parents | d186f8cd5000 |
children | 43f45e032db8 |
files | CurrentProfile/Mmo7Wow.pr0 CyborgMMO7.lua CyborgMMO7.toc Localisation.lua OpenButtonPage.xml OptionView.lua RatPageModel.lua RatPageView.lua |
diffstat | 8 files changed, 102 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/CyborgMMO7.lua Mon May 28 15:54:52 2012 +0000 +++ b/CyborgMMO7.lua Tue May 29 10:26:40 2012 +0000 @@ -23,15 +23,15 @@ function CyborgMMO_LoadStrings(self) ---~ msg("LoadStrings("..self:GetName()..") = "..StringTable[self:GetName()]) - self:SetText(StringTable[self:GetName()]); +--~ msg("LoadStrings("..self:GetName()..") = "..CyborgMMO_StringTable[self:GetName()]) + self:SetText(CyborgMMO_StringTable[self:GetName()]); end -local VarsLoaded = false; -local EnteredWorld = false; -local LoadBinding = false; -local SaveName = GetRealmName().."_"..UnitName("player"); -local Settings = nil; +local CyborgMMO_VarsLoaded = false; +local CyborgMMO_EnteredWorld = false; +local CyborgMMO_LoadBinding = false; +local CyborgMMO_SaveName = GetRealmName().."_"..UnitName("player"); +local CyborgMMO_Settings = nil; function CyborgMMO_MiniMapButtonReposition(pos) @@ -85,37 +85,37 @@ end function CyborgMMO_LoadWowCommands() - if (ProfileKeyBindings == nil) then - ProfileKeyBindings = {} - ProfileKeyBindings = InternationalWowCommands[GetLocale()] + if (CyborgMMO_ProfileKeyBindings == nil) then + CyborgMMO_ProfileKeyBindings = {} + CyborgMMO_ProfileKeyBindings = CyborgMMO_InternationalWowCommands[GetLocale()] end - WowCommands = ProfileKeyBindings + CyborgMMO_WowCommands = CyborgMMO_ProfileKeyBindings end function CyborgMMO_GetSaveData() - if(VarsLoaded) then + if(CyborgMMO_VarsLoaded) then if (CyborgMMO7SaveData == nil) then CyborgMMO7SaveData = {}; - CyborgMMO7SaveData[SaveName] = {} + CyborgMMO7SaveData[CyborgMMO_SaveName] = {} end CyborgMMO_LoadWowCommands() - return CyborgMMO7SaveData[SaveName]; + return CyborgMMO7SaveData[CyborgMMO_SaveName]; end return nil; end function CyborgMMO_SetSaveData(data, index) - if(VarsLoaded) then + if(CyborgMMO_VarsLoaded) then CyborgMMO_GetSaveData()[index] = data - ProfileKeyBindings = WowCommands + CyborgMMO_ProfileKeyBindings = CyborgMMO_WowCommands end end function CyborgMMO_Event(self, event, ...) if(event == "VARIABLES_LOADED") then - VarsLoaded = true; + CyborgMMO_VarsLoaded = true; elseif(event == "PLAYER_ENTERING_WORLD") then - EnteredWorld = true; + CyborgMMO_EnteredWorld = true; elseif(event == "PLAYER_ENTER_COMBAT") then msg("PLAYER_ENTER_COMBAT"); Close(); @@ -127,13 +127,13 @@ -- Fire Loading if and only if the player is in the world and vars are loaded - if(false == LoadBinding) then - if(VarsLoaded) then - if(EnteredWorld) then + if(false == CyborgMMO_LoadBinding) then + if(CyborgMMO_VarsLoaded) then + if(CyborgMMO_EnteredWorld) then local data = CyborgMMO_GetSaveData() CyborgMMO_RatPageModel.Instance().LoadData(); - LoadBinding = true; + CyborgMMO_LoadBinding = true; ShowMacroFrame(); HideUIPanel(MacroFrame); @@ -153,15 +153,15 @@ data["Settings"]["CyborgButton"] = true; end - Settings = data["Settings"]; + CyborgMMO_Settings = data["Settings"]; - CyborgMMO_OptionPageCyborgSizeSlider:SetValue(Settings["Cyborg"]); - CyborgMMO_SetOpenButtonSize(Settings["Cyborg"]) - CyborgMMO_OptionPagePluginSizeSlider:SetValue(Settings["Plugin"]); - CyborgMMO_SetMainPageSize(Settings["Plugin"]); + CyborgMMO_OptionPageCyborgSizeSlider:SetValue(CyborgMMO_Settings["Cyborg"]); + CyborgMMO_SetOpenButtonSize(CyborgMMO_Settings["Cyborg"]) + CyborgMMO_OptionPagePluginSizeSlider:SetValue(CyborgMMO_Settings["Plugin"]); + CyborgMMO_SetMainPageSize(CyborgMMO_Settings["Plugin"]); - CyborgMMO_SetMiniMapButton(Settings["MiniMapButton"]) - CyborgMMO_SetCyborgHeadButton(Settings["CyborgButton"]) + CyborgMMO_SetMiniMapButton(CyborgMMO_Settings["MiniMapButton"]) + CyborgMMO_SetCyborgHeadButton(CyborgMMO_Settings["CyborgButton"]) local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() CyborgMMO_MiniMapButtonReposition(math.deg(math.atan2(ymin,xmin))) @@ -192,7 +192,7 @@ end local buttonFrame, parentFrame, name = CyborgMMO_CallbackFactory.Instance().AddCallback(fn); - if(1 ~= SetOverrideBindingClick(parentFrame, true, Mode[modeNum], name, "LeftButton")) then + if(1 ~= SetOverrideBindingClick(parentFrame, true, CyborgMMO_Mode[modeNum], name, "LeftButton")) then msg("Failed to Bind modeChange"); end end @@ -205,7 +205,7 @@ function CyborgMMO_Close() CyborgMMO_MainPage:Hide(); - if(Settings["CyborgButton"] == true) then + if(CyborgMMO_Settings["CyborgButton"] == true) then CyborgMMO_OpenButtonPage:Show(); end end @@ -213,7 +213,7 @@ function CyborgMMO_Open() CyborgMMO_MainPage:Show(); CyborgMMO_RatQuickPage:Hide(); - if(Settings["CyborgButton"] == true) then + if(CyborgMMO_Settings["CyborgButton"] == true) then CyborgMMO_OpenButtonPage:Show(); end end @@ -240,51 +240,51 @@ end function CyborgMMO_SetMainPageSize(percent) - if(VarsLoaded) then - if(EnteredWorld) then + if(CyborgMMO_VarsLoaded) then + if(CyborgMMO_EnteredWorld) then CyborgMMO_MainPage:SetScale(percent); - Settings["Plugin"] = percent; + CyborgMMO_Settings["Plugin"] = percent; local data = CyborgMMO_GetSaveData() - data["Settings"] = Settings + data["Settings"] = CyborgMMO_Settings CyborgMMO_OptionPagePluginSizeSlider:SetValue(percent); end end end function CyborgMMO_SetOpenButtonSize(percent) - if(VarsLoaded) then - if(EnteredWorld) then + if(CyborgMMO_VarsLoaded) then + if(CyborgMMO_EnteredWorld) then CyborgMMO_OpenButtonPage:SetScale(percent) - Settings["Cyborg"] = percent; + CyborgMMO_Settings["Cyborg"] = percent; local data = CyborgMMO_GetSaveData() - data["Settings"] = Settings + data["Settings"] = CyborgMMO_Settings CyborgMMO_OptionPageCyborgSizeSlider:SetValue(percent); end end end function CyborgMMO_SetCyborgHeadButton(boolVal) - Settings["CyborgButton"] = boolVal; + CyborgMMO_Settings["CyborgButton"] = boolVal; CyborgMMO_OptionPageCyborgButton:SetChecked(boolVal); - if(Settings["CyborgButton"] == true) then + if(CyborgMMO_Settings["CyborgButton"] == true) then CyborgMMO_Close(); else CyborgMMO_OpenButtonPage:Hide(); end local data = CyborgMMO_GetSaveData() - data["Settings"] = Settings + data["Settings"] = CyborgMMO_Settings end function CyborgMMO_SetMiniMapButton(boolVal) - Settings["MiniMapButton"] = boolVal - Settings["MiniMapButton"] = boolVal + CyborgMMO_Settings["MiniMapButton"] = boolVal + CyborgMMO_Settings["MiniMapButton"] = boolVal CyborgMMO_OptionPageMiniMapButton:SetChecked(boolVal) - if(Settings["MiniMapButton"] == true) then + if(CyborgMMO_Settings["MiniMapButton"] == true) then CyborgMMO_MiniMapFrameButton:Show() else CyborgMMO_MiniMapFrameButton:Hide() end local data = CyborgMMO_GetSaveData() - data["Settings"] = Settings + data["Settings"] = CyborgMMO_Settings end
--- a/CyborgMMO7.toc Mon May 28 15:54:52 2012 +0000 +++ b/CyborgMMO7.toc Tue May 29 10:26:40 2012 +0000 @@ -4,7 +4,7 @@ ## Version: 1.1.0 ## LoadOnDemand: 0 ## SavedVariablesPerCharacter: CyborgMMO7SaveData -## SavedVariables: ProfileKeyBindings +## SavedVariables: CyborgMMO_ProfileKeyBindings ## X-Curse-Packaged-Version: r2 ## X-Curse-Project-Name: Cyborg MMO7 ## X-Curse-Project-ID: cyborg-mmo7
--- a/Localisation.lua Mon May 28 15:54:52 2012 +0000 +++ b/Localisation.lua Tue May 29 10:26:40 2012 +0000 @@ -18,7 +18,7 @@ --~ along with this program; if not, write to the Free Software --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -InternationalMode = { +CyborgMMO_InternationalMode = { ["enUS"] = { "ALT-CTRL-E", "ALT-CTRL-F", @@ -58,7 +58,7 @@ -InternationalWowCommands = { +CyborgMMO_InternationalWowCommands = { ["enUS"] = { "ALT-CTRL-NUMPAD1", "ALT-CTRL-NUMPAD2", @@ -348,7 +348,7 @@ } } -InternationalStringTable = { +CyborgMMO_InternationalStringTable = { ["enUS"] = { CyborgMMO_BindingFrameExitButton="Close", CyborgMMO_BindingFrameHeaderText="Please press the appropriate button", @@ -379,7 +379,13 @@ CyborgMMO_OptionPageRebindMode1="Mode 1", CyborgMMO_OptionPageRebindMode2="Mode 2", CyborgMMO_OptionPageRebindMode3="Mode 3", - CyborgMMO_OptionPageRebindTitle="MMO Keybinds:-" + CyborgMMO_OptionPageRebindTitle="MMO Keybinds:-", + CyborgMMO_ToolTipLine1="Warning! If your spell assignments are not working you may not have the correct profile assigned.", + CyborgMMO_ToolTipLine2="To assign the correct profile:", + CyborgMMO_ToolTipLine3="\t1) Click on the M.M.O.7 tray icon in the Windows system tray. ", + CyborgMMO_ToolTipLine4="\t2) Locate the profile called MMO7_WoWAddon and left click it. ", + CyborgMMO_ToolTipLine5="\t3) When the M.M.O.7 tray icon turns green, the profile is active. ", + CyborgMMO_ToolTipLine6="Once the profile is active, reload WoW and press the Mode button on the M.M.O.7 to synchronise the device." }, ["frFR"] = { CyborgButtonTitle="Bouton Cyborg", @@ -431,6 +437,6 @@ } } -Mode = InternationalMode[GetLocale()] -WowCommands = nil -StringTable = InternationalStringTable[GetLocale()] \ No newline at end of file +CyborgMMO_Mode = CyborgMMO_InternationalMode[GetLocale()] +CyborgMMO_WowCommands = nil +CyborgMMO_StringTable = CyborgMMO_InternationalStringTable[GetLocale()] \ No newline at end of file
--- a/OpenButtonPage.xml Mon May 28 15:54:52 2012 +0000 +++ b/OpenButtonPage.xml Tue May 29 10:26:40 2012 +0000 @@ -59,7 +59,6 @@ </OnLoad> <OnClick> CyborgMMO_Toggle(); - </OnClick> <OnDragStart> self:StartMoving(); @@ -69,6 +68,12 @@ self:StopMovingOrSizing(); self.isMoving = false; </OnDragStop> + <OnEnter> + CyborgMMO_ShowProfileTooltip(self:GetNormalTexture()) + </OnEnter> + <OnLeave> + CyborgMMO_HideProfileTooltip() + </OnLeave> </Scripts> <NormalTexture file="Interface\AddOns\CyborgMMO7\Graphics\Cyborg.tga"> @@ -169,9 +174,11 @@ if(false == CyborgMMO_IsOpen()) then CyborgMMO_RatQuickPage:Show(); end + CyborgMMO_ShowProfileTooltip(getglobal(self:GetName().."_Icon")) </OnEnter> <OnLeave> - CyborgMMO_RatQuickPage:Hide(); + CyborgMMO_RatQuickPage:Hide() + CyborgMMO_HideProfileTooltip() </OnLeave> <OnUpdate> if(self:IsDragging()) then
--- a/OptionView.lua Mon May 28 15:54:52 2012 +0000 +++ b/OptionView.lua Tue May 29 10:26:40 2012 +0000 @@ -37,20 +37,20 @@ mode = mode + 1 index = index - 13 end - local buttonStr = StringTable[("CyborgMMO_OptionPageRebindMouseRow"..index.."Name")] + local buttonStr = CyborgMMO_StringTable[("CyborgMMO_OptionPageRebindMouseRow"..index.."Name")] getglobal("CyborgMMO_BindingFrameButtonName"):SetText(buttonStr.." Mode "..mode) - getglobal("CyborgMMO_BindingFrameKey"):SetText(StringTable["CyborgMMO_CurrentBinding"].." "..WowCommands[CyborgMMO_GetButtonIndex(lastButton)]) + getglobal("CyborgMMO_BindingFrameKey"):SetText(CyborgMMO_StringTable["CyborgMMO_CurrentBinding"].." "..CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)]) CyborgMMO_BindingFrame:Show() end function CyborgMMO_GetBindingButtonText(name) - if(nil == WowCommands) then + if(nil == CyborgMMO_WowCommands) then CyborgMMO_LoadWowCommands(); end - local binding = WowCommands[CyborgMMO_GetButtonIndex(name)] + local binding = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(name)] getglobal(name):SetText(binding) end @@ -61,6 +61,27 @@ return (CyborgMMO_GetNumberFromHexLetter(rowStr) + ((CyborgMMO_GetNumberFromHexLetter(modeStr) - 1) * 13)) end +function CyborgMMO_ShowProfileTooltip(self) + local red, green, blue, _ = self:GetVertexColor() + if((red == 0) and (green == 0) and (blue == 0)) then + GameTooltip:SetOwner(self:GetParent(), "ANCHOR_RIGHT"); + GameTooltip:SetText(CyborgMMO_StringTable["CyborgMMO_ToolTipLine1"], nil, nil, nil, nil, 1); + GameTooltip:AddLine(nil, 0.8, 1.0, 0.8); + GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine2"], 0.8, 1.0, 0.8); + GameTooltip:AddLine(nil, 0.8, 1.0, 0.8); + GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine3"], 0.8, 1.0, 0.8); + GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine4"], 0.8, 1.0, 0.8); + GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine5"], 0.8, 1.0, 0.8); + GameTooltip:AddLine(nil, 0.8, 1.0, 0.8); + GameTooltip:AddLine(CyborgMMO_StringTable["CyborgMMO_ToolTipLine6"], 0.8, 1.0, 0.8); + GameTooltip:Show(); + end +end + +function CyborgMMO_HideProfileTooltip(self) + GameTooltip:Hide(); +end + function CyborgMMO_GetNumberFromHexLetter(str) local number = 0 if("A" == str) then @@ -82,8 +103,8 @@ end function CyborgMMO_SetNewKeybind(keyOrButton) - local previous = WowCommands[CyborgMMO_GetButtonIndex(lastButton)] - WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton; + local previous = CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] + CyborgMMO_WowCommands[CyborgMMO_GetButtonIndex(lastButton)] = keyOrButton; CyborgMMO_GetBindingButtonText(lastButton); CyborgMMO_BindingFrame:Hide() CyborgMMO_RatPageModel.Instance().LoadData()
--- a/RatPageModel.lua Mon May 28 15:54:52 2012 +0000 +++ b/RatPageModel.lua Tue May 29 10:26:40 2012 +0000 @@ -111,7 +111,7 @@ self.Data[mode][button] = object; if(nil ~= object) then - object.SetBinding(WowCommands[((mode-1)*RAT7.BUTTONS)+button]); + object.SetBinding(CyborgMMO_WowCommands[((mode-1)*RAT7.BUTTONS)+button]); if("callback" == object.Type) then msg("trying to set texture") local slot = getglobal("CyborgMMO_MainPageSlotListSlot"..button); @@ -119,7 +119,7 @@ end else msg("clearing "..button) - CyborgMMO_WowObject.ClearBinding(WowCommands[((mode-1)*RAT7.BUTTONS)+button]) + CyborgMMO_WowObject.ClearBinding(CyborgMMO_WowCommands[((mode-1)*RAT7.BUTTONS)+button]) end end
--- a/RatPageView.lua Mon May 28 15:54:52 2012 +0000 +++ b/RatPageView.lua Tue May 29 10:26:40 2012 +0000 @@ -64,10 +64,11 @@ CyborgMMO_SlotView = { new = function(self, parent) self._assignedWowObject = nil; - self.UnCheckedTexture = self:GetNormalTexture(); self:RegisterForClicks("LeftButtonUp", "RightButtonUp"); self.Id = self:GetID(); CyborgMMO_RatPageModel.Instance().AddObserver(self); + self.UnCheckedTexture = self:GetNormalTexture(); + -- Object Method -- self.Clicked = function() self:GetParent().SlotClicked(self) @@ -113,7 +114,7 @@ end end - return self; + return self; end }