Mercurial > wow > cyborg-mmo7
comparison WowObjects.lua @ 15:80192bc4a108
Replaced the global msg function with CyborgMMO_DPrint:
- avoids conflicts with other addons ('msg' is too generic)
- has 'print' semantics (several values accepted, calls tostring)
- use AddMessage with a colored prefix, instead of plain SendChatMessage
| author | madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09 |
|---|---|
| date | Thu, 25 Apr 2013 01:29:55 +0000 |
| parents | 9f2d838d4f8e |
| children | a6f4c8f86130 |
comparison
equal
deleted
inserted
replaced
| 14:9f2d838d4f8e | 15:80192bc4a108 |
|---|---|
| 27 self.Detail = detail | 27 self.Detail = detail |
| 28 self.Subdetail = subdetail | 28 self.Subdetail = subdetail |
| 29 | 29 |
| 30 -- Methods -- | 30 -- Methods -- |
| 31 self.DoAction = function() | 31 self.DoAction = function() |
| 32 msg("Nothing To Do") | 32 CyborgMMO_DPrint("Nothing To Do") |
| 33 end | 33 end |
| 34 | 34 |
| 35 self.Pickup = function() | 35 self.Pickup = function() |
| 36 msg("Pick up Item") | 36 CyborgMMO_DPrint("Pick up Item") |
| 37 end | 37 end |
| 38 | 38 |
| 39 self.SetBinding = function(key) | 39 self.SetBinding = function(key) |
| 40 end | 40 end |
| 41 | 41 |
| 48 | 48 |
| 49 ClearBinding = function(key) | 49 ClearBinding = function(key) |
| 50 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(CyborgMMO_WowObject.DoNothing) | 50 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(CyborgMMO_WowObject.DoNothing) |
| 51 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") | 51 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") |
| 52 if result ~= 1 then | 52 if result ~= 1 then |
| 53 msg("Failed to bind companion to button click") | 53 CyborgMMO_DPrint("Failed to bind companion to button click") |
| 54 end | 54 end |
| 55 end, | 55 end, |
| 56 | 56 |
| 57 DoNothing = function() | 57 DoNothing = function() |
| 58 end, | 58 end, |
| 153 local self = CyborgMMO_WowObject.new("callback", callbackName, "") | 153 local self = CyborgMMO_WowObject.new("callback", callbackName, "") |
| 154 self.CallbackName = callbackName | 154 self.CallbackName = callbackName |
| 155 self.Texture = "Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga" | 155 self.Texture = "Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga" |
| 156 | 156 |
| 157 self.SetTextures = function(buttonFrame) | 157 self.SetTextures = function(buttonFrame) |
| 158 msg("TextureName = "..self.CallbackName) | 158 CyborgMMO_DPrint("TextureName = "..self.CallbackName) |
| 159 buttonFrame:SetNormalTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga") | 159 buttonFrame:SetNormalTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Unselected.tga") |
| 160 buttonFrame:SetPushedTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Down.tga") | 160 buttonFrame:SetPushedTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Down.tga") |
| 161 buttonFrame:SetHighlightTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Over.tga") | 161 buttonFrame:SetHighlightTexture("Interface\\AddOns\\CyborgMMO7\\Graphics\\"..self.CallbackName.."Over.tga") |
| 162 end | 162 end |
| 163 | 163 |
| 164 self.DoAction = function() | 164 self.DoAction = function() |
| 165 local action = CyborgMMO_CallbackFactory.Instance().GetCallback(self.CallbackName) | 165 local action = CyborgMMO_CallbackFactory.Instance().GetCallback(self.CallbackName) |
| 166 msg("calling callback:- "..self.CallbackName) | 166 CyborgMMO_DPrint("calling callback:- "..self.CallbackName) |
| 167 action() | 167 action() |
| 168 end | 168 end |
| 169 | 169 |
| 170 self.PickupCallback = function() | 170 self.PickupCallback = function() |
| 171 local slot = nil | 171 local slot = nil |
| 178 end | 178 end |
| 179 slot:SetNormalTexture(slot.UnCheckedTexture) | 179 slot:SetNormalTexture(slot.UnCheckedTexture) |
| 180 end | 180 end |
| 181 | 181 |
| 182 self.ClickHandler = function(self, button, down) | 182 self.ClickHandler = function(self, button, down) |
| 183 msg("click handler") | 183 CyborgMMO_DPrint("click handler") |
| 184 CallbackCursor:StopMoving() | 184 CallbackCursor:StopMoving() |
| 185 CallbackCursor:Hide() | 185 CallbackCursor:Hide() |
| 186 end | 186 end |
| 187 | 187 |
| 188 self.Pickup = function() | 188 self.Pickup = function() |
| 193 | 193 |
| 194 self.SetBinding = function(key) | 194 self.SetBinding = function(key) |
| 195 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction) | 195 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction) |
| 196 local result = SetOverrideBindingClick(CyborgMMO_CallbackFactory.Instance().Frame, true, key, name, "LeftButton") | 196 local result = SetOverrideBindingClick(CyborgMMO_CallbackFactory.Instance().Frame, true, key, name, "LeftButton") |
| 197 if result ~= 1 then | 197 if result ~= 1 then |
| 198 msg("Failed to Bind modeChange") | 198 CyborgMMO_DPrint("Failed to Bind modeChange") |
| 199 end | 199 end |
| 200 end | 200 end |
| 201 | 201 |
| 202 return self | 202 return self |
| 203 end, | 203 end, |
| 220 self.Texture, | 220 self.Texture, |
| 221 self.SellPrice = GetItemInfo(itemID) | 221 self.SellPrice = GetItemInfo(itemID) |
| 222 | 222 |
| 223 -- override method -- | 223 -- override method -- |
| 224 self.DoAction = function() | 224 self.DoAction = function() |
| 225 msg("Use Item") | 225 CyborgMMO_DPrint("Use Item") |
| 226 end | 226 end |
| 227 | 227 |
| 228 -- override method -- | 228 -- override method -- |
| 229 self.Pickup = function() | 229 self.Pickup = function() |
| 230 self.PlaySound() | 230 self.PlaySound() |
| 252 self.Type = type | 252 self.Type = type |
| 253 | 253 |
| 254 | 254 |
| 255 -- override method -- | 255 -- override method -- |
| 256 self.DoAction = function() | 256 self.DoAction = function() |
| 257 msg("Cast Spell") | 257 CyborgMMO_DPrint("Cast Spell") |
| 258 end | 258 end |
| 259 | 259 |
| 260 -- override method -- | 260 -- override method -- |
| 261 self.Pickup = function() | 261 self.Pickup = function() |
| 262 self.PlaySound() | 262 self.PlaySound() |
| 264 -- SetCursor(self.Texture) | 264 -- SetCursor(self.Texture) |
| 265 return PickupSpellBookItem(self.SpellbookID, self.Spellbook) | 265 return PickupSpellBookItem(self.SpellbookID, self.Spellbook) |
| 266 end | 266 end |
| 267 | 267 |
| 268 self.SetBinding = function(key) | 268 self.SetBinding = function(key) |
| 269 msg("Binding to key "..key) | 269 CyborgMMO_DPrint("Binding to key "..key) |
| 270 self.Key = key | 270 self.Key = key |
| 271 SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, self.Key, self.Type.." "..self.Name) | 271 SetOverrideBinding(CyborgMMO_CallbackFactory.Instance().Frame, true, self.Key, self.Type.." "..self.Name) |
| 272 end | 272 end |
| 273 | 273 |
| 274 return self | 274 return self |
| 293 self.isLocal = GetMacroInfo(index) | 293 self.isLocal = GetMacroInfo(index) |
| 294 self.Index = index | 294 self.Index = index |
| 295 | 295 |
| 296 -- override method -- | 296 -- override method -- |
| 297 self.DoAction = function() | 297 self.DoAction = function() |
| 298 msg("Use Item") | 298 CyborgMMO_DPrint("Use Item") |
| 299 end | 299 end |
| 300 | 300 |
| 301 -- override method -- | 301 -- override method -- |
| 302 self.Pickup = function() | 302 self.Pickup = function() |
| 303 self.PlaySound() | 303 self.PlaySound() |
| 345 self.SetBinding = function(key) | 345 self.SetBinding = function(key) |
| 346 self.Key = key | 346 self.Key = key |
| 347 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction) | 347 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction) |
| 348 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") | 348 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") |
| 349 if result ~= 1 then | 349 if result ~= 1 then |
| 350 msg("Failed to bind companion to button click") | 350 CyborgMMO_DPrint("Failed to bind companion to button click") |
| 351 end | 351 end |
| 352 -- SetOverrideBinding(hiddenModeChanger, true, key, "MACRO "..self.Index) | 352 -- SetOverrideBinding(hiddenModeChanger, true, key, "MACRO "..self.Index) |
| 353 end | 353 end |
| 354 | 354 |
| 355 return self | 355 return self |
| 375 self.ExtendedCost = GetMerchantItemInfo(index) | 375 self.ExtendedCost = GetMerchantItemInfo(index) |
| 376 self.Index = index | 376 self.Index = index |
| 377 | 377 |
| 378 -- override method -- | 378 -- override method -- |
| 379 self.DoAction = function() | 379 self.DoAction = function() |
| 380 msg("Use Item") | 380 CyborgMMO_DPrint("Use Item") |
| 381 end | 381 end |
| 382 | 382 |
| 383 -- override method -- | 383 -- override method -- |
| 384 self.Pickup = function() | 384 self.Pickup = function() |
| 385 self.PlaySound() | 385 self.PlaySound() |
| 423 self.SetBinding = function(key) | 423 self.SetBinding = function(key) |
| 424 self.Key = key | 424 self.Key = key |
| 425 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction); | 425 local buttonFrame,parentFrame,name = CyborgMMO_CallbackFactory.Instance().AddCallback(self.DoAction); |
| 426 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") | 426 local result = SetOverrideBindingClick(parentFrame, true, key, name, "LeftButton") |
| 427 if result ~= 1 then | 427 if result ~= 1 then |
| 428 msg("Failed to bind companion to button click") | 428 CyborgMMO_DPrint("Failed to bind companion to button click") |
| 429 end | 429 end |
| 430 end | 430 end |
| 431 | 431 |
| 432 return self | 432 return self |
| 433 end, | 433 end, |
