Mercurial > wow > askmrrobot
comparison AskMrRobot.lua @ 13:bb0c8ce689d1 v1.2.15.0
fixed minor bug on startup with new settings
| author | yellowfive |
|---|---|
| date | Thu, 10 Jul 2014 15:25:18 -0700 |
| parents | ece9167c0d1c |
| children | e77e01abce98 |
comparison
equal
deleted
inserted
replaced
| 12:a7bc121c536d | 13:bb0c8ce689d1 |
|---|---|
| 268 elseif event == "PLAYER_LOGOUT" then | 268 elseif event == "PLAYER_LOGOUT" then |
| 269 -- doing nothing right now, but leaving this in case we need something here | 269 -- doing nothing right now, but leaving this in case we need something here |
| 270 elseif event == "PLAYER_ENTERING_WORLD" then | 270 elseif event == "PLAYER_ENTERING_WORLD" then |
| 271 | 271 |
| 272 -- delete entries that are more than 10 days old to prevent the table from growing indefinitely | 272 -- delete entries that are more than 10 days old to prevent the table from growing indefinitely |
| 273 local now = time() | 273 if AmrSettings.Logins and #AmrSettings.Logins > 0 then |
| 274 local oldDuration = 60 * 60 * 24 * 10 | 274 local now = time() |
| 275 local entryTime | 275 local oldDuration = 60 * 60 * 24 * 10 |
| 276 repeat | 276 local entryTime |
| 277 -- parse entry and get time | 277 repeat |
| 278 local parts = {} | 278 -- parse entry and get time |
| 279 for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do | 279 local parts = {} |
| 280 tinsert(parts, part) | 280 for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do |
| 281 end | 281 tinsert(parts, part) |
| 282 entryTime = tonumber(parts[3]) | 282 end |
| 283 | 283 entryTime = tonumber(parts[3]) |
| 284 -- entries are in order, remove first entry if it is old | 284 |
| 285 if difftime(now, entryTime) > oldDuration then | 285 -- entries are in order, remove first entry if it is old |
| 286 tremove(AmrSettings.Logins, 1) | 286 if difftime(now, entryTime) > oldDuration then |
| 287 end | 287 tremove(AmrSettings.Logins, 1) |
| 288 until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration | 288 end |
| 289 until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration | |
| 290 end | |
| 289 | 291 |
| 290 -- record the time a player logs in, used to figure out which player logged which parts of their log file | 292 -- record the time a player logs in, used to figure out which player logged which parts of their log file |
| 291 local key = AmrRealmName .. ";" .. AmrCharacterName .. ";" | 293 local key = AmrRealmName .. ";" .. AmrCharacterName .. ";" |
| 292 local loginData = key .. time() | 294 local loginData = key .. time() |
| 293 if AmrSettings.Logins and #AmrSettings.Logins > 0 then | 295 if AmrSettings.Logins and #AmrSettings.Logins > 0 then |
