diff --git a/SteaSummon.toc b/SteaSummon.toc index c06c938..2948ac4 100755 --- a/SteaSummon.toc +++ b/SteaSummon.toc @@ -2,9 +2,9 @@ ## Title: SteaSummon ## Notes: One button summoning, shared summoning list... ## Author: Stea -## Version: 0.61 +## Version: 0.62 ## SavedVariablesPerCharacter: SteaSummonSave, SteaDEBUG, SteaSummonSaveLDB -## x-SteaSummon-Protocol-version: 0.6 +## x-SteaSummon-Protocol-version: 0.62 Libs\embeds.xml Locale\Locales.xml diff --git a/alt.lua b/alt.lua index 9aeeec9..9a5bf35 100644 --- a/alt.lua +++ b/alt.lua @@ -125,12 +125,12 @@ local alt = { end, askForAlts = function(_, player) - local idx = summon:findWaitingPlayerIdx(player) - - if gossip.netList[player] then - --return -- addon users can configure if they want alts + if summon.zone == "" then + return -- don't whisper people if not indicating we are going to summon end + local idx = summon:findWaitingPlayerIdx(player) + if SteaSummonSave.altbuffed and #summon:recBuffs(summon.waiting[idx]) == 0 then return end diff --git a/chat.lua b/chat.lua index 37d5982..720be9c 100644 --- a/chat.lua +++ b/chat.lua @@ -75,7 +75,7 @@ local chat = { if msg then if string.sub(msg, 1,1) == "-" and settings:findSummonWord(string.sub(msg, 2)) then name, server = strsplit("-", servername) - gossip:arrived(name) + gossip:arrived(name, true) elseif settings:findSummonWord(msg) then -- someone wants a summon name, server = strsplit("-", servername) diff --git a/gossip.lua b/gossip.lua index 36e3cb1..fd91fa5 100644 --- a/gossip.lua +++ b/gossip.lua @@ -370,25 +370,35 @@ local gossip = { end, --------------------------------- - arrived = function(self, player) + arrived = function(self, player, cancel) self:offlineCheck() + local cancelText = "true" + + if cancel == nil then + cancel = true + end + + if not cancel then + cancelText = "false" + end + if self:isLeader() then if addonData.summon:findWaitingPlayerIdx(player) then - addonData.summon:arrived(player) + addonData.summon:arrived(player, cancel) if self:noComms() then return end - db("gossip", ">> arrived >>", self:groupText(), player) - self:SendCommMessage(self.channel, "a " .. player, self:groupText()) + db("gossip", ">> arrived >>", self:groupText(), player, cancel) + self:SendCommMessage(self.channel, "a " .. player .. " " .. cancelText, self:groupText()) addonData.alt:listShorter() end else if self:noComms() then return end - db("gossip", ">> arrived >> WHISPER", player) - self:SendCommMessage(self.channel, "a " .. player, "WHISPER", self.netList[1]) + db("gossip", ">> arrived >> WHISPER", self.netList[1], player) + self:SendCommMessage(self.channel, "a " .. player .. " ".. cancelText, "WHISPER", self.netList[1]) end end, @@ -522,7 +532,7 @@ local gossip = { return end if name == self.me then - summonTest = nil + summonTest = "player" else summonTest = name end @@ -548,7 +558,7 @@ local gossip = { end, --------------------------------- - setClicks = function(self, locks, clickers) + setClicks = function(self, locks, clickers, noSend) local locksCount = self.locksCount local clicksCount = self.atDestCount - self.locksCount @@ -573,7 +583,13 @@ local gossip = { db('gossip', "fished adjusted count: locks", locksCount, "clicks", clicksCount, "total", locksCount + clicksCount) self.adjLocks = locksCount self.adjClicks = clicksCount - self:clicks(locksCount, clicksCount) + if not self:isLeader() then + self:clicks(locksCount, clicksCount) + end + end + + if self:isLeader() and not noSend then + self:clicks(self.adjLocks, self.adjClicks) end end, @@ -592,7 +608,7 @@ local gossip = { if self:noComms() then return end - db("gossip", ">> clickers >> WHISPER", self:groupText(), self.netList[1], locks, clickers) + db("gossip", ">> clickers >> WHISPER", self.netList[1], locks, clickers) self:SendCommMessage(self.channel, "c " .. locks .. "+" .. clickers, "WHISPER", self.netList[1]) end end, @@ -696,8 +712,8 @@ local gossip = { end, --------------------------------- - receive = function(self, msg, _, sender, ... ) - local cmd, subcmd = strsplit(" ", msg) + receive = function(self, msg, dist, sender, ... ) + local cmd, subcmd = strsplit(" ", msg, 2) local okForInit = { ["netlist"] = 1, ["e"] = 1, @@ -707,7 +723,7 @@ local gossip = { ["retire"] = 1, ["v"] = 1} - db ("gossip.event", "message", cmd, "from", sender, "payload:", subcmd) + db ("gossip.event", "message", cmd, "from", sender, "channel", dist, "payload:", subcmd) local function senderIsLeader() if self.inInit then @@ -731,11 +747,18 @@ local gossip = { --- arrive if cmd == "a" then db("gossip", "<< arrived <<", subcmd) + local player, cancel = strsplit(" ", subcmd) + + if cancel == "true" then + cancel = true + else + cancel = false + end if self:isLeader() then - self:arrived(subcmd) + self:arrived(player, cancel) else - addonData.summon:arrived(subcmd) + addonData.summon:arrived(player, cancel) end --- add player @@ -761,13 +784,10 @@ local gossip = { --- clickers elseif cmd == "c" then local locks, clickers = strsplit("+", subcmd) - db("gossip", "<< clickers <<", locks, clickers) + db("gossip", "<< clickers <<", sender, locks, clickers) + + self:setClicks(locks, clickers) - if self:isLeader() then - self:clicks(locks, clickers) - else - self:setClicks(locks, clickers) - end --- initialize elseif cmd == "i" then diff --git a/main.lua b/main.lua index 18a00e6..9808499 100644 --- a/main.lua +++ b/main.lua @@ -7,6 +7,10 @@ --- Visual -- TODO: add fancy spell casting next button +-- TODO: alts on tooltip for offline +-- TODO: buffs displayed in tooltip? over priority reason +-- TODO: indication when raid lead, click to pass lead +-- TODO: indication when net lead, also see other addon users -- notes: diff --git a/optionsgui.lua b/optionsgui.lua index 3bb21be..6501c1d 100644 --- a/optionsgui.lua +++ b/optionsgui.lua @@ -442,8 +442,8 @@ local alts = { name = L["Enable only when player buffed"], desc = L["altbuffeddesc"], type = "toggle", - width = "full", - descStyle = "inline", + width = "double", + --descStyle = "inline", set = function(_, val) SteaSummonSave.altbuffed = val end, diff --git a/summon.lua b/summon.lua index e47575a..1fdb36b 100644 --- a/summon.lua +++ b/summon.lua @@ -31,6 +31,7 @@ local summon = { needBoost = false, show = nil, nextIdx = nil, + countSummoned = 0, --------------------------------- init = function(self) @@ -49,6 +50,19 @@ local summon = { self.numwaiting = #self.waiting self.postInit = true + -- fix up for old version things (they could be lurking in alts for months) + -- and before the table gets cleared something may access the data and blow up + if self.waiting then + for _,v in pairs(self.waiting) do + -- make sure altwhispered is numeric (was a string) + if #v > 6 then -- have alts + if type(self:recAltWhispered(v) == "string") then + self:recAltWhispered(v, 0) + end + end + end + end + -- there seems to be no good event/time to check if we are in a group -- group roster changes fail to tell us when we are NOT in a group -- so we're gonna bodge this one, worst case is it takes a while to clear the list @@ -120,7 +134,17 @@ local summon = { --------------------------------- waitRecord = function(self, player, time, status, prioReason, buffs, alts, altwhispered) local rec - rec = {player, time, status, prioReason, true, buffs or {}, alts or {}, altwhispered or 0} + assert(player) + rec = { + player, + time or 0, + status or "requested", + prioReason or "Normal", + true, -- dirty flag + buffs or {}, + alts or {}, + altwhispered or 0 + } db("summon.waitlist.record","Created record {", self:recPlayer(rec), self:recTime(rec), self:recStatus(rec), self:recPrio(rec), true, self:recBuffs(rec), self:recAlts(rec), self:recAltWhispered(rec), "}") @@ -481,9 +505,9 @@ local summon = { for _, player in pairs(players) do local z, l = self:getCurrentLocation() if z == self.zone and l == self.location -- at destination, anyone can report - or (self.zone == "" and self.location == "") -- no destination, anyone can report + or (self.countSummoned > 0 and self.zone == "" and self.location == "") -- no destination, anyone can report or player == self.summoningPlayer then -- summoner can report - addonData.gossip:arrived(player) -- let everyone else know + addonData.gossip:arrived(player, false) -- let everyone else know end end @@ -571,7 +595,7 @@ local summon = { if SteaSummonToButton then SteaSummonToButton:Show() end end - if pos["width"] < 100 or pos["height"] < 28 then + if SteaSummonContextMenuButton and pos["width"] < 100 or pos["height"] < 28 then SteaSummonContextMenuButton:Hide() else SteaSummonContextMenuButton:Show() @@ -794,7 +818,7 @@ local summon = { --- Cancel Button cancelClick = function(_, button, worked) if button == "LeftButton" and worked then - addonData.gossip:arrived(player) + addonData.gossip:arrived(player, true) db("summon.display","cancelling", player) end end @@ -1264,7 +1288,14 @@ local summon = { end, --------------------------------- - arrived = function(self, player) + arrived = function(self, player, cancel) + if cancel ~= null and not cancel then + local rec = self:findWaitingPlayer(player) + if rec then + self.countSummoned = self.countSummoned + 1 + end + end + self:remove(player) end, @@ -1416,6 +1447,7 @@ local summon = { db("summon.misc", "setting destination: ", location, " in ", zone) if location and location ~= "" and zone and zone ~= "" then + self.countSummoned = 0 if SteaSummonFrame then local pat = {["%%zone"] = self.zone, ["%%subzone"] = self.location} local s = L["Destination: %subzone, %zone"] @@ -1449,7 +1481,7 @@ local summon = { --------------------------------- cancelMe = function(self) self = addonData.summon - addonData.gossip:arrived(self.me) + addonData.gossip:arrived(self.me, true) end, --------------------------------- @@ -1476,8 +1508,9 @@ local summon = { table.insert(remv, self:recPlayer(v)) end for _,v in pairs(remv) do - addonData.gossip:arrived(v) + addonData.gossip:arrived(v, true) end + self.countSummoned = 0 end end, diff --git a/util.lua b/util.lua index dbd9d3f..09c2968 100644 --- a/util.lua +++ b/util.lua @@ -144,7 +144,6 @@ local util = { playerClose = function(self, player) local me, _ = UnitName("player") player = strsplit("-", player) -- might turn up as player-server - --print("player", player) if me == player or player == "player" then return false -- don't trip for yourself, we'll let others tell us you're summoned :)