Mercurial > wow > ouroloot
comparison core.lua @ 17:d929c40cdb09
Small boosts, better version display. Do not wedge when receiving initial boss broadcast of a wipe while outside a raid instance.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Thu, 25 Aug 2011 08:50:33 +0000 |
parents | 5ee4edd24c13 |
children | ca797c0f32d4 |
comparison
equal
deleted
inserted
replaced
16:5ee4edd24c13 | 17:d929c40cdb09 |
---|---|
1 local addon = select(2,...) | 1 local nametag, addon = ... |
2 | 2 |
3 --[==[ | 3 --[==[ |
4 g_loot's numeric indices are loot entries (including titles, separators, | 4 g_loot's numeric indices are loot entries (including titles, separators, |
5 etc); its named indices are: | 5 etc); its named indices are: |
6 - forum: saved text from forum markup window, default nil | 6 - forum: saved text from forum markup window, default nil |
88 addon.author_debug = flib.author_debug | 88 addon.author_debug = flib.author_debug |
89 | 89 |
90 -- Play cute games with namespaces here just to save typing. WTB Lua 5.2 PST. | 90 -- Play cute games with namespaces here just to save typing. WTB Lua 5.2 PST. |
91 do local _G = _G setfenv (1, addon) | 91 do local _G = _G setfenv (1, addon) |
92 | 92 |
93 revision = 15 | 93 commrev = 15 -- number |
94 revision = _G.GetAddOnMetadata(nametag,"Version") or "?" | |
94 ident = "OuroLoot2" | 95 ident = "OuroLoot2" |
95 identTg = "OuroLoot2Tg" | 96 identTg = "OuroLoot2Tg" |
96 status_text = nil | 97 status_text = nil |
97 | 98 |
98 DEBUG_PRINT = false | 99 DEBUG_PRINT = false |
973 end | 974 end |
974 if possible_st then | 975 if possible_st then |
975 possible_st:SetData(g_loot) | 976 possible_st:SetData(g_loot) |
976 end | 977 end |
977 | 978 |
978 self.status_text = ("v2r%d communicating as ident %s"):format(self.revision,self.ident) | 979 self.status_text = ("%s communicating as ident %s commrev %d"):format(self.revision,self.ident,self.commrev) |
979 self:RegisterComm(self.ident) | 980 self:RegisterComm(self.ident) |
980 self:RegisterComm(self.identTg, "OnCommReceivedNocache") | 981 self:RegisterComm(self.identTg, "OnCommReceivedNocache") |
981 | 982 |
982 if self.author_debug then | 983 if self.author_debug then |
983 _G.OL = self | 984 _G.OL = self |
1062 duration = duration, -- these two deliberately may be nil | 1063 duration = duration, -- these two deliberately may be nil |
1063 raiderlist = raiders and table.concat(raiders, ", ") | 1064 raiderlist = raiders and table.concat(raiders, ", ") |
1064 } | 1065 } |
1065 candidates = candidates or {} | 1066 candidates = candidates or {} |
1066 tinsert(candidates,c) | 1067 tinsert(candidates,c) |
1067 break | 1068 end |
1068 end | 1069 break |
1069 end | 1070 end |
1070 self.dprint('loot',"<<_do_boss out") | 1071 self.dprint('loot',"<<_do_boss out") |
1071 end | 1072 end |
1072 -- No wrapping layer for now | 1073 -- No wrapping layer for now |
1073 addon.on_boss_broadcast = _do_boss | 1074 addon.on_boss_broadcast = _do_boss |
1074 | 1075 |
1075 function addon:_mark_boss_kill (index) | 1076 function addon:_mark_boss_kill (index) |
1076 local e = g_loot[index] | 1077 local e = g_loot[index] |
1078 if not e then | |
1079 self:Print("Something horribly wrong;", index, "is not a valid entry!") | |
1080 return | |
1081 end | |
1077 if not e.bosskill then | 1082 if not e.bosskill then |
1078 self:Print("Something horribly wrong;", index, "is not a boss entry!") | 1083 self:Print("Something horribly wrong;", index, "is not a boss entry!") |
1079 return | 1084 return |
1080 end | 1085 end |
1081 if e.reason ~= 'wipe' then | 1086 if e.reason ~= 'wipe' then |
1169 -- Given a loot index, searches backwards for a timestamp. Returns that | 1174 -- Given a loot index, searches backwards for a timestamp. Returns that |
1170 -- index and the time entry, or nil if it falls off the beginning. Pass an | 1175 -- index and the time entry, or nil if it falls off the beginning. Pass an |
1171 -- optional second index to search no earlier than it. | 1176 -- optional second index to search no earlier than it. |
1172 -- May also be able to make good use of this in forum-generation routine. | 1177 -- May also be able to make good use of this in forum-generation routine. |
1173 function addon:find_previous_time_entry(i,stop) | 1178 function addon:find_previous_time_entry(i,stop) |
1174 local stop = stop or 0 | 1179 stop = stop or 0 |
1175 while i > stop do | 1180 while i > stop do |
1176 if g_loot[i].kind == 'time' then | 1181 if g_loot[i].kind == 'time' then |
1177 return i, g_loot[i] | 1182 return i, g_loot[i] |
1178 end | 1183 end |
1179 i = i - 1 | 1184 i = i - 1 |
1255 function addon._adjustBossOrder (is, should_be) | 1260 function addon._adjustBossOrder (is, should_be) |
1256 --pprint('loot', is, should_be) | 1261 --pprint('loot', is, should_be) |
1257 if is == should_be then --pprint('loot', "equal, yay") | 1262 if is == should_be then --pprint('loot', "equal, yay") |
1258 return | 1263 return |
1259 end | 1264 end |
1260 if is < should_be then --pprint('loot', "...the hell? bailing") | 1265 if (type(is)~='number') or (type(should_be)~='number') or (is < should_be) then |
1266 --pprint('loot', "...the hell? bailing") | |
1261 return | 1267 return |
1262 end | 1268 end |
1263 if g_loot[should_be].kind == 'time' then | 1269 if g_loot[should_be].kind == 'time' then |
1264 should_be = should_be + 1 | 1270 should_be = should_be + 1 |
1265 if is == should_be then | 1271 if is == should_be then |
1469 pprint('comm', "incoming ping from", sender) | 1475 pprint('comm', "incoming ping from", sender) |
1470 addon:whispercast (sender, 'pong', addon.revision, | 1476 addon:whispercast (sender, 'pong', addon.revision, |
1471 addon.enabled and "tracking" or (addon.rebroadcast and "broadcasting" or "disabled")) | 1477 addon.enabled and "tracking" or (addon.rebroadcast and "broadcasting" or "disabled")) |
1472 end | 1478 end |
1473 OCR_funcs.pong = function (sender, _, rev, status) | 1479 OCR_funcs.pong = function (sender, _, rev, status) |
1474 local s = ("|cff00ff00%s|r v2r%s is |cff00ffff%s|r"):format(sender,rev,status) | 1480 local s = ("|cff00ff00%s|r %s is |cff00ffff%s|r"):format(sender,rev,status) |
1475 addon:Print("Echo: ", s) | 1481 addon:Print("Echo: ", s) |
1476 adduser (sender, s, status=="tracking" or status=="broadcasting" or nil) | 1482 adduser (sender, s, status=="tracking" or status=="broadcasting" or nil) |
1477 end | 1483 end |
1478 | 1484 |
1479 OCR_funcs.loot = function (sender, _, recip, item, count, extratext) | 1485 OCR_funcs.loot = function (sender, _, recip, item, count, extratext) |