Mercurial > wow > inventory
comparison Core.lua @ 98:252292b703ce
All print(...) function calls are now handled by addon:Print(text, color).
The cursor will be cleared of any items/spells before moving as well as when aborting.
| author | Zerotorescue |
|---|---|
| date | Sun, 09 Jan 2011 17:49:33 +0100 |
| parents | 31493364b163 |
| children | 6ae44d372360 |
comparison
equal
deleted
inserted
replaced
| 97:ae268e5c7825 | 98:252292b703ce |
|---|---|
| 91 local name = GetChatWindowInfo(i); | 91 local name = GetChatWindowInfo(i); |
| 92 | 92 |
| 93 if name:upper() == "DEBUG" then | 93 if name:upper() == "DEBUG" then |
| 94 this.debugChannel = _G["ChatFrame" .. i]; | 94 this.debugChannel = _G["ChatFrame" .. i]; |
| 95 | 95 |
| 96 print("A debug channel already exists, used the old one. (" .. i .. ")"); | 96 addon:Print("A debug channel already exists, used the old one. (" .. i .. ")"); |
| 97 return; | 97 return; |
| 98 end | 98 end |
| 99 end | 99 end |
| 100 | 100 |
| 101 if not this.debugChannel then | 101 if not this.debugChannel then |
| 102 -- Create a new debug channel | 102 -- Create a new debug channel |
| 103 local chatFrame = FCF_OpenNewWindow('Debug'); | 103 local chatFrame = FCF_OpenNewWindow('Debug'); |
| 104 ChatFrame_RemoveAllMessageGroups(chatFrame); | 104 ChatFrame_RemoveAllMessageGroups(chatFrame); |
| 105 this.debugChannel = chatFrame; | 105 this.debugChannel = chatFrame; |
| 106 | 106 |
| 107 print("New debug channel created."); | 107 addon:Print("New debug channel created."); |
| 108 end | 108 end |
| 109 end, { "d", "debug" }); | 109 end, { "d", "debug" }); |
| 110 | 110 |
| 111 -- Remember this character is on this account | 111 -- Remember this character is on this account |
| 112 local playerName = UnitName("player"); | 112 local playerName = UnitName("player"); |
| 131 -- Is our database outdated? Then patch it. | 131 -- Is our database outdated? Then patch it. |
| 132 | 132 |
| 133 if not self.db.global.version then | 133 if not self.db.global.version then |
| 134 -- Old version was before version was saved, many changes were done in that revision | 134 -- Old version was before version was saved, many changes were done in that revision |
| 135 | 135 |
| 136 print("Updating Inventorium database from version " .. (self.db.global.version or "Unknown") .. " to version " .. addonRevision .. "..."); | 136 addon:Print("Updating Inventorium database from version " .. (self.db.global.version or "Unknown") .. " to version " .. addonRevision .. "..."); |
| 137 | 137 |
| 138 if self.db.global and self.db.global.defaults then | 138 if self.db.global and self.db.global.defaults then |
| 139 print("Moving all global data into your current profile..."); | 139 addon:Print("Moving all global data into your current profile..."); |
| 140 | 140 |
| 141 -- All data mustn't be global but profile-based | 141 -- All data mustn't be global but profile-based |
| 142 self.db.profile.defaults = CopyTable(self.db.global.defaults); | 142 self.db.profile.defaults = CopyTable(self.db.global.defaults); |
| 143 self.db.profile.groups = CopyTable(self.db.global.groups); | 143 self.db.profile.groups = CopyTable(self.db.global.groups); |
| 144 | 144 |
| 150 end; | 150 end; |
| 151 self:CommandHandler(); | 151 self:CommandHandler(); |
| 152 end | 152 end |
| 153 | 153 |
| 154 if self.db.profile.defaults.minimumStock then | 154 if self.db.profile.defaults.minimumStock then |
| 155 print("Copying the minimum stock value into the minimum global stock..."); | 155 addon:Print("Copying the minimum stock value into the minimum global stock..."); |
| 156 | 156 |
| 157 -- We added another stock option and renamed the old to be more obvious about what it means | 157 -- We added another stock option and renamed the old to be more obvious about what it means |
| 158 self.db.profile.defaults.minGlobalStock = self.db.profile.defaults.minimumStock; | 158 self.db.profile.defaults.minGlobalStock = self.db.profile.defaults.minimumStock; |
| 159 self.db.profile.defaults.minimumStock = nil; | 159 self.db.profile.defaults.minimumStock = nil; |
| 160 end | 160 end |
| 161 | 161 |
| 162 if self.db.profile.defaults.minimumLocalStock then | 162 if self.db.profile.defaults.minimumLocalStock then |
| 163 print("Renaming the minimum local stock property..."); | 163 addon:Print("Renaming the minimum local stock property..."); |
| 164 | 164 |
| 165 -- We added another stock option and then renamed it | 165 -- We added another stock option and then renamed it |
| 166 self.db.profile.defaults.minLocalStock = self.db.profile.defaults.minimumLocalStock; | 166 self.db.profile.defaults.minLocalStock = self.db.profile.defaults.minimumLocalStock; |
| 167 self.db.profile.defaults.minimumLocalStock = nil; | 167 self.db.profile.defaults.minimumLocalStock = nil; |
| 168 end | 168 end |
| 169 | 169 |
| 170 if self.db.profile.defaults.alertBelowMinimum then | 170 if self.db.profile.defaults.alertBelowMinimum then |
| 171 print("Copying the alert below minimum value into the alert below global minimum value..."); | 171 addon:Print("Copying the alert below minimum value into the alert below global minimum value..."); |
| 172 | 172 |
| 173 -- We added another stock option and then renamed it | 173 -- We added another stock option and then renamed it |
| 174 self.db.profile.defaults.alertBelowGlobalMinimum = self.db.profile.defaults.alertBelowMinimum; | 174 self.db.profile.defaults.alertBelowGlobalMinimum = self.db.profile.defaults.alertBelowMinimum; |
| 175 self.db.profile.defaults.alertBelowMinimum = nil; | 175 self.db.profile.defaults.alertBelowMinimum = nil; |
| 176 end | 176 end |
| 304 | 304 |
| 305 if slashArgs[cmd] then | 305 if slashArgs[cmd] then |
| 306 -- Pass a reference to the addon (to be used as "self") and the provided arg | 306 -- Pass a reference to the addon (to be used as "self") and the provided arg |
| 307 slashArgs[cmd](addon, arg); | 307 slashArgs[cmd](addon, arg); |
| 308 else | 308 else |
| 309 print(slashError); | 309 addon:Print(slashError); |
| 310 end | 310 end |
| 311 end | 311 end |
| 312 | 312 |
| 313 function addon:RegisterSlash(func, args, description) | 313 function addon:RegisterSlash(func, args, description) |
| 314 for _, arg in pairs(args) do | 314 for _, arg in pairs(args) do |
| 424 | 424 |
| 425 -- General | 425 -- General |
| 426 | 426 |
| 427 addon.Colors = { | 427 addon.Colors = { |
| 428 Red = { 1, 0, 0 }, | 428 Red = { 1, 0, 0 }, |
| 429 Orange = { 1, .46, .1 }, | |
| 429 Green = { 0, 1, 0 }, | 430 Green = { 0, 1, 0 }, |
| 431 Blue = { 0, 0, 1 }, | |
| 432 Yellow = { 1, 1, 0 }, | |
| 433 Cyan = { 0, 1, 1 }, | |
| 430 }; -- easy to extend if more colors are needed | 434 }; -- easy to extend if more colors are needed |
| 431 function addon:Print(text, color) | 435 function addon:Print(text, color) |
| 432 local red, green, blue; | 436 local red, green, blue; |
| 433 | 437 |
| 434 if color then | 438 if color then |
