Mercurial > wow > cyborg-mmo7
diff WowObjects.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 | bf9220814fb5 |
children | 6cb9a2936580 |
line wrap: on
line diff
--- a/WowObjects.lua Thu May 24 16:13:28 2012 +0000 +++ b/WowObjects.lua Mon May 28 15:54:52 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. -WowObject = { +CyborgMMO_WowObject = { new = function(type, detail, subdetail) local self = {}; self.Texture = nil; @@ -48,7 +48,7 @@ end, ClearBinding = function(key) - local buttonFrame, parentFrame, name = CallbackFactory.Instance().AddCallback(WowObject.DoNothing); + local buttonFrame, parentFrame, name = CyborgMMO_CallbackFactory.Instance().AddCallback(CyborgMMO_WowObject.DoNothing); if(1 ~= SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton")) then msg("Failed to bind companion to button click"); end @@ -59,21 +59,21 @@ Load = function(object) if("item" == type) then - object = WowItem.Load(Object) + object = CyborgMMO_WowItem.Load(Object) elseif("macro" == type) then - object = WowMacro.Load(object) + object = CyborgMMO_WowMacro.Load(object) elseif("spell" == type) then - object = WowSpell.Load(object) + object = CyborgMMO_WowSpell.Load(object) elseif("petaction" == type) then - object = WowSpell.Load(object) + object = CyborgMMO_WowSpell.Load(object) --elseif("merchant"== type) then --object = SlotMerchant.new(detail,subdetail) elseif("companion" == type) then - object = WowCompanion.Load(object) + object = CyborgMMO_WowCompanion.Load(object) elseif("equipmentset" == type) then - object = WowEquipmentSet.Load(object) + object = CyborgMMO_WowEquipmentSet.Load(object) else - object = WowObject.new(type,detail, subdetail) + object = CyborgMMO_WowObject.new(type,detail, subdetail) end return object; end, @@ -82,23 +82,23 @@ Create = function(objectType, detail, subdetail) local object; if("item" == objectType) then - object = WowItem.new(detail,subdetail) + object = CyborgMMO_WowItem.new(detail,subdetail) elseif("macro" == objectType) then - object = WowMacro.new(detail) + object = CyborgMMO_WowMacro.new(detail) elseif("spell" == objectType) then - object = WowSpell.new(objectType, detail,subdetail) + object = CyborgMMO_WowSpell.new(objectType, detail,subdetail) elseif("petaction" == objectType) then - object = WowSpell.new(objectType, detail,subdetail) + object = CyborgMMO_WowSpell.new(objectType, detail,subdetail) elseif("merchant"== objectType) then - object = SlotMerchant.new(detail,subdetail) + object = CyborgMMO_SlotMerchant.new(detail,subdetail) elseif("companion" == objectType) then - object = WowCompanion.new(detail,subdetail) + object = CyborgMMO_WowCompanion.new(detail,subdetail) elseif("equipmentset" == objectType) then - object = WowEquipmentSet.new(objectType,detail,subdetail) + object = CyborgMMO_WowEquipmentSet.new(objectType,detail,subdetail) elseif("callback" == objectType) then - object = WowCallback.new(detail); + object = CyborgMMO_WowCallback.new(detail); else - object = WowObject.new(objectType,detail, subdetail) + object = CyborgMMO_WowObject.new(objectType,detail, subdetail) end return object; @@ -107,12 +107,12 @@ local CallbackCursor = nil; -CallbackIcons = { +CyborgMMO_CallbackIcons = { new = function(self) self.point, self.relativeTo, self.relativePoint, self.xOfs, self.yOfs = self:GetPoint(); --self:SetPoint(self.point, self.relativeTo, self.relativePoint, self.xOfs, self.yOfs); self.strata = self:GetFrameStrata(); - self.wowObject = WowCallback.new(self:GetName()); + self.wowObject = CyborgMMO_WowCallback.new(string.gsub(self:GetName(), self:GetParent():GetName(), "",1)) self.wowObject.SetTextures(self); self:RegisterForDrag("LeftButton","RightButton") self:SetResizable(false); @@ -139,27 +139,28 @@ self:ClearAllPoints(); self:SetPoint(self.point, self.relativeTo, self.relativePoint, self.xOfs, self.yOfs); local x, y = GetCursorPosition(); - RatPageController.Instance().CallbackDropped(self) + CyborgMMO_RatPageController.Instance().CallbackDropped(self) end return self; end } -WowCallback = { +CyborgMMO_WowCallback = { new = function(callbackName) - local self = WowObject.new("callback", callbackName, ""); + local self = CyborgMMO_WowObject.new("callback", callbackName, ""); self.CallbackName = callbackName; self.Texture = "Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga" self.SetTextures = function(buttonFrame) + msg("TextureName = "..self.CallbackName) buttonFrame:SetNormalTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga") buttonFrame:SetPushedTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Down.tga") buttonFrame:SetHighlightTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Over.tga") end self.DoAction = function() - local action = GetCallback(self.CallbackName) + local action = CyborgMMO_CallbackFactory.Instance().GetCallback(self.CallbackName) msg("calling callback:- "..self.CallbackName); action(); @@ -168,7 +169,7 @@ self.PickupCallback = function() local slot = nil; - local observers = RatPageModel.Instance().GetAllObservers(); + local observers = CyborgMMO_RatPageModel.Instance().GetAllObservers(); for i = 1, (# observers) do if(MouseIsOver(observers[i])) then slot = observers[i]; @@ -183,11 +184,6 @@ msg("click handler"); CallbackCursor:StopMoving(); CallbackCursor:Hide(); - - if("LeftButton" == button) then - else - - end end self.Pickup = function() @@ -199,8 +195,8 @@ self.SetBinding = function(key) - local buttonFrame, parentFrame, name = CallbackFactory.Instance().AddCallback(self.DoAction); - if(1 ~= SetOverrideBindingClick(CallbackFactory.Instance().Frame, true, key, name, "LeftButton")) then + local buttonFrame, parentFrame, name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction); + if(1 ~= SetOverrideBindingClick(CyborgMMO_CallbackFactory.Instance().Frame, true, key, name, "LeftButton")) then msg("Failed to Bind modeChange"); end end @@ -211,9 +207,9 @@ -- WowItem Class -- -WowItem = { +CyborgMMO_WowItem = { new = function(number, itemID) - local self = WowObject.new("item", number, itemID); -- base class + local self = CyborgMMO_WowObject.new("item", number, itemID); -- base class -- Set all the item info. -- self.Name, self.Link, @@ -241,7 +237,7 @@ end self.SetBinding = function(key) - SetOverrideBinding(CallbackFactory.Instance().Frame, true, key, "ITEM "..self.Name); + SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, key, "ITEM "..self.Name); end return self; @@ -250,9 +246,9 @@ -- WowSpell Class -- -WowSpell = { +CyborgMMO_WowSpell = { new = function(type, spellbookID, spellbook) - local self = WowObject.new(type, spellbookID, spellbook) -- base class + local self = CyborgMMO_WowObject.new(type, spellbookID, spellbook) -- base class self.SpellbookID = spellbookID; self.Spellbook = spellbook; self.Name, self.Rank = GetSpellBookItemName(spellbookID, spellbook); @@ -276,7 +272,7 @@ self.SetBinding = function(key) msg("Binding to key "..key) self.Key = key - SetOverrideBinding(CallbackFactory.Instance().Frame, true, self.Key, self.Type.." "..self.Name); + SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, self.Key, self.Type.." "..self.Name); end return self; @@ -293,9 +289,9 @@ -- WowMacro Class -- -WowMacro = { +CyborgMMO_WowMacro = { new = function(index) - local self = WowObject.new("macro", index, nil); -- base class + local self = CyborgMMO_WowObject.new("macro", index, nil); -- base class -- Set all the item info. -- self.Name, self.Texture, @@ -318,7 +314,7 @@ self.SetBinding = function(key) self.Key = key; - SetOverrideBinding(CallbackFactory.Instance().Frame, true, key, "MACRO "..self.Index); + SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, key, "MACRO "..self.Index); end return self; @@ -328,9 +324,9 @@ -- WowCompanion Class -- -WowCompanion = { +CyborgMMO_WowCompanion = { new = function(index, SubType) - local self = WowObject.new("companion", index, SubType); -- base class + local self = CyborgMMO_WowObject.new("companion", index, SubType); -- base class -- Set all the item info. -- self.Id, self.Name, self.SpellId, self.Texture, self.isSummoned = GetCompanionInfo(SubType, index); self.SubType = SubType; @@ -352,7 +348,7 @@ self.SetBinding = function(key) self.Key = key - local buttonFrame, parentFrame, name = CallbackFactory.Instance().AddCallback(self.DoAction); + local buttonFrame, parentFrame, name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction); if(1 ~= SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton")) then msg("Failed to bind companion to button click"); end @@ -369,9 +365,9 @@ } -- WowMerchant Class -- -WowMerchant = { +CyborgMMO_WowMerchant = { new = function(index) - local self = WowObject.new("macro", index, nil); -- base class + local self = CyborgMMO_WowObject.new("macro", index, nil); -- base class -- Set all the item info. -- self.Name, self.Texture, @@ -397,7 +393,7 @@ self.SetBinding = function(key) self.Key = key - SetOverrideBinding(CallbackFactory.Instance().Frame, true, key, "MERCHANT "..self.Index); + SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, key, "MERCHANT "..self.Index); end return self; @@ -405,9 +401,9 @@ } -- WowEquipmentSet Class -- -WowEquipmentSet = { +CyborgMMO_WowEquipmentSet = { new = function(objectType, name, index) - local self = WowObject.new(objectType, name, index); -- base class + local self = CyborgMMO_WowObject.new(objectType, name, index); -- base class -- Set all the item info. -- texture, lessIndex = GetEquipmentSetInfoByName(name); self.Texture = "Interface\\Icons\\"..texture; @@ -429,7 +425,7 @@ self.SetBinding = function(key) self.Key = key - local buttonFrame, parentFrame, name = CallbackFactory.Instance().AddCallback(self.DoAction); + local buttonFrame, parentFrame, name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction); if(1 ~= SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton")) then msg("Failed to bind companion to button click"); end