Mercurial > wow > inventory
comparison Modules/Scanner.lua @ 122:6724bc8eface
Reduced usage of global functions by defining them locally.
author | Zerotorescue |
---|---|
date | Sat, 15 Jan 2011 18:52:01 +0100 |
parents | dc6f405c1a5d |
children | ee4672f21586 |
comparison
equal
deleted
inserted
replaced
121:ca6280dc2f5b | 122:6724bc8eface |
---|---|
1 local addon = select(2, ...); | 1 local addon = select(2, ...); |
2 local mod = addon:NewModule("Scanner", "AceEvent-3.0", "AceTimer-3.0"); | 2 local mod = addon:NewModule("Scanner", "AceEvent-3.0", "AceTimer-3.0"); |
3 | |
4 local _G = _G; | |
5 local select, pairs = _G.select, _G.pairs; | |
6 local twipe, tinsert, mceil = _G.table.wipe, _G.table.insert, _G.math.ceil; | |
3 | 7 |
4 local Mover, paused, currentLocation; | 8 local Mover, paused, currentLocation; |
5 local itemCache = {}; | 9 local itemCache = {}; |
6 | 10 |
7 local function OnMoveAccept() | 11 local function OnMoveAccept() |
19 end | 23 end |
20 | 24 |
21 local function GetSmallCoinTextureString(coins) | 25 local function GetSmallCoinTextureString(coins) |
22 if coins >= 10000000 then | 26 if coins >= 10000000 then |
23 -- When we have1000g, hide silver and copper | 27 -- When we have1000g, hide silver and copper |
24 coins = (math.ceil(coins / 10000) * 10000); | 28 coins = (mceil(coins / 10000) * 10000); |
25 elseif coins >= 10000 then | 29 elseif coins >= 10000 then |
26 -- When we have 1g, hide copper | 30 -- When we have 1g, hide copper |
27 coins = (math.ceil(coins / 100) * 100); | 31 coins = (mceil(coins / 100) * 100); |
28 end | 32 end |
29 | 33 |
30 return GetCoinTextureString(coins); | 34 return GetCoinTextureString(coins); |
31 end | 35 end |
32 | 36 |
167 | 171 |
168 addon:SetFrameSettings("Inventorium Merchant Restock", ("The following items can be restocked from this merchant for a total of %s. Do you wish to proceed?"):format(GetSmallCoinTextureString(totalCost)), proceedButton, cancelButton, headers); | 172 addon:SetFrameSettings("Inventorium Merchant Restock", ("The following items can be restocked from this merchant for a total of %s. Do you wish to proceed?"):format(GetSmallCoinTextureString(totalCost)), proceedButton, cancelButton, headers); |
169 end | 173 end |
170 | 174 |
171 function mod:ClearCache() | 175 function mod:ClearCache() |
172 table.wipe(itemCache); | 176 twipe(itemCache); |
173 end | 177 end |
174 | 178 |
175 function mod:CacheLocation(location, remember) | 179 function mod:CacheLocation(location, remember) |
176 -- Reset cache just in case it was filled | 180 -- Reset cache just in case it was filled |
177 self:ClearCache(); | 181 self:ClearCache(); |
440 | 444 |
441 -- Store the list with rows in this | 445 -- Store the list with rows in this |
442 local data = {}; | 446 local data = {}; |
443 | 447 |
444 for i, move in pairs(moves) do | 448 for i, move in pairs(moves) do |
445 table.insert(data, { | 449 tinsert(data, { |
446 ["rowData"] = move, -- this is not a key usually found in a row item and ignored by the library | 450 ["rowData"] = move, -- this is not a key usually found in a row item and ignored by the library |
447 ["cols"] = columns, | 451 ["cols"] = columns, |
448 }); | 452 }); |
449 end | 453 end |
450 | 454 |