From bac4ac5fba3e2a415e74d95e6438571319e21348 Mon Sep 17 00:00:00 2001 From: Road-block Date: Wed, 31 Oct 2018 00:09:10 +0200 Subject: [PATCH] add a sanity check for raid level characters to avoid inadvertently assigning EP to low levels (eg. summoning locks etc) fix a logic error for fractional PR on standings / bid tablets where it was doing an alphabetic instead of numeric sort fix minimap icon position not saving for people without Fubar or with icon attached to minimap use the minimum raid level to avoid set main popups appearing in low level guilded characters --- README.md | 11 +++++----- shootyepgp.lua | 56 ++++++++++++++++++++++++++++++++++++++------------ shootyepgp.toc | 6 +++--- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a72c1af..fd06915 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,15 @@ shootyepgp requires some modifications to guild permissions for officer notes by ### Version 3.x (current) - officer notes must be set to visible by all and editable **only** by the EPGP admins (eg. officer rank+) -- public notes are free to be used for anything +- public notes are not in use by the addon -### _Version 2.x (deprecated)_ +#### _Version 2.x (deprecated)_ - _public and officer notes must be set to visible by all._ - _both public and officer notes **must** be editable **only** by the EPGP admins (eg. officer rank+)_ ## tips -Creating a new chatframe (right-click > create new window on chat tab) and naming it `debug` (capitalization doesn't matter) will move the bulk of information messages there and out of your default chatframe. +Create a new chatframe (right-click > create new window on chat tab) and name it `debug` (capitalization doesn't matter) +Most of the information messages will now print on that frame and not clutter your default chatframe. ## usage Right-click on minimap or FuBar shootyepgp icon will show all available settings. @@ -27,8 +28,8 @@ The standings window can also be toggled with **/shooty show** chat command. - Item GP prices on item tooltips (all) - Export standings to csv (all) - Configurable EPGP Decay (admin) -- Configurable Offspec discount (all) -- Guild Progression multiplier (all) +- Configurable Offspec discount (admin) +- Guild Progression multiplier (admin) - Reserves - *standby list EP* - with alts support (admin and all) Addon has been designed so that basic member functionality is usable even without the addon. diff --git a/shootyepgp.lua b/shootyepgp.lua index 0e295f8..0bcb746 100644 --- a/shootyepgp.lua +++ b/shootyepgp.lua @@ -15,6 +15,7 @@ sepgp.VARS = { decay = 0.9, max = 1000, timeout = 60, + minlevel = 55, maxloglines = 500, prefix = "SEPGP_PREFIX", reservechan = "Reserves", @@ -451,11 +452,14 @@ function sepgp:OnInitialize() -- ADDON_LOADED (1) unless LoD if sepgp_log == nil then sepgp_log = {} end if sepgp_looted == nil then sepgp_looted = {} end if sepgp_debug == nil then sepgp_debug = {} end + self:RegisterDB("sepgp_fubar") + self:RegisterDefaults("char",{}) --table.insert(sepgp_debug,{[date("%b/%d %H:%M:%S")]="OnInitialize"}) end function sepgp:OnEnable() -- PLAYER_LOGIN (2) --table.insert(sepgp_debug,{[date("%b/%d %H:%M:%S")]="OnEnable"}) + sepgp._playerLevel = UnitLevel("player") sepgp.extratip = (sepgp.extratip) or CreateFrame("GameTooltip","shootyepgp_tooltip",UIParent,"GameTooltipTemplate") sepgp._versionString = GetAddOnMetadata("shootyepgp","Version") sepgp._websiteString = GetAddOnMetadata("shootyepgp","X-Website") @@ -483,6 +487,19 @@ function sepgp:OnEnable() -- PLAYER_LOGIN (2) sepgp:SetRefresh(true) sepgp:testLootPrompt() end) + if sepgp._playerLevel and sepgp._playerLevel < MAX_PLAYER_LEVEL then + self:RegisterEvent("PLAYER_LEVEL_UP", function() + if (arg1) then + sepgp._playerLevel = tonumber(arg1) + if sepgp._playerLevel == MAX_PLAYER_LEVEL then + sepgp:UnregisterEvent("PLAYER_LEVEL_UP") + end + if sepgp._playerLevel and sepgp._playerLevel >= sepgp.VARS.minlevel then + sepgp:testMain() + end + end + end) + end self:RegisterEvent("CHAT_MSG_RAID","captureLootCall") self:RegisterEvent("CHAT_MSG_RAID_LEADER","captureLootCall") self:RegisterEvent("CHAT_MSG_RAID_WARNING","captureLootCall") @@ -518,12 +535,8 @@ function sepgp:AceEvent_FullyInitialized() -- SYNTHETIC EVENT, later than PLAYER break end end - - if (sepgp_main == nil) or (sepgp_main == "") then - if (IsInGuild()) then - StaticPopup_Show("SHOOTY_EPGP_SET_MAIN") - end - end + + self:testMain() local delay = 2 if self:IsEventRegistered("AceEvent_FullyInitialized") then @@ -1250,7 +1263,9 @@ function sepgp:award_raid_ep(ep) -- awards ep to raid members in zone if GetNumRaidMembers()>0 then for i = 1, GetNumRaidMembers(true) do local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i) - self:givename_ep(name,ep) + if level >= sepgp.VARS.minlevel then + self:givename_ep(name,ep) + end end self:simpleSay(string.format(L["Giving %d ep to all raidmembers"],ep)) self:addToLog(string.format(L["Giving %d ep to all raidmembers"],ep)) @@ -1440,10 +1455,13 @@ end --------- -- Menu --------- +sepgp.hasIcon = "Interface\\PetitionFrame\\GuildCharter-Icon" +sepgp.title = "shootyepgp" sepgp.defaultMinimapPosition = 180 +sepgp.defaultPosition = "RIGHT" sepgp.cannotDetachTooltip = true sepgp.tooltipHiddenWhenEmpty = false -sepgp.hasIcon = "Interface\\PetitionFrame\\GuildCharter-Icon" +sepgp.independentProfile = true function sepgp:OnTooltipUpdate() local hint = L["|cffffff00Click|r to toggle Standings.%s \n|cffffff00Right-Click|r for Options."] @@ -1492,8 +1510,9 @@ function sepgp:buildRosterTable() end sepgp.alts = {} for i = 1, numGuildMembers do - local member_name,_,_,_,class,_,note,officernote,_,_ = GetGuildRosterInfo(i) + local member_name,_,_,level,class,_,note,officernote,_,_ = GetGuildRosterInfo(i) local main, main_class, main_rank = self:parseAlt(member_name,officernote) + local is_raid_level = tonumber(level) and level >= sepgp.VARS.minlevel if (main) then if ((self._playerName) and (name == self._playerName)) then if (not sepgp_main) or (sepgp_main and sepgp_main ~= main) then @@ -1506,11 +1525,13 @@ function sepgp:buildRosterTable() sepgp.alts[main][member_name] = class end if (sepgp_raidonly) and next(r) then - if r[member_name] then + if r[member_name] and is_raid_level then table.insert(g,{["name"]=member_name,["class"]=class}) end else - table.insert(g,{["name"]=member_name,["class"]=class}) + if is_raid_level then + table.insert(g,{["name"]=member_name,["class"]=class}) + end end end return g @@ -2074,7 +2095,8 @@ end function sepgp:verifyGuildMember(name,silent) for i=1,GetNumGuildMembers(1) do local g_name, g_rank, g_rankIndex, g_level, g_class, g_zone, g_note, g_officernote, g_online = GetGuildRosterInfo(i) - if (string.lower(name) == string.lower(g_name)) and (tonumber(g_level) == MAX_PLAYER_LEVEL) then + if (string.lower(name) == string.lower(g_name)) and (tonumber(g_level) >= sepgp.VARS.minlevel) then + -- == MAX_PLAYER_LEVEL]] return g_name, g_class, g_rank, g_officernote end end @@ -2102,6 +2124,14 @@ function sepgp:lootMaster() end end +function sepgp:testMain() + if (sepgp_main == nil) or (sepgp_main == "") then + if (IsInGuild()) then + StaticPopup_Show("SHOOTY_EPGP_SET_MAIN") + end + end +end + function sepgp:make_escable(framename,operation) local found for i,f in ipairs(UISpecialFrames) do @@ -2396,5 +2426,5 @@ function sepgp:EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, level) ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y) end --- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_groupbyarmor,sepgp_groupbyrole,sepgp_raidonly,sepgp_decay,sepgp_minep,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_altspool,sepgp_altpercent,sepgp_log,sepgp_dbver,sepgp_looted,sepgp_debug +-- GLOBALS: sepgp_saychannel,sepgp_groupbyclass,sepgp_groupbyarmor,sepgp_groupbyrole,sepgp_raidonly,sepgp_decay,sepgp_minep,sepgp_reservechannel,sepgp_main,sepgp_progress,sepgp_discount,sepgp_altspool,sepgp_altpercent,sepgp_log,sepgp_dbver,sepgp_looted,sepgp_debug,sepgp_fubar -- GLOBALS: sepgp,sepgp_prices,sepgp_standings,sepgp_bids,sepgp_loot,sepgp_reserves,sepgp_alts,sepgp_logs diff --git a/shootyepgp.toc b/shootyepgp.toc index 5a85510..220f609 100644 --- a/shootyepgp.toc +++ b/shootyepgp.toc @@ -7,10 +7,10 @@ ## X-Website: https://github.com/Road-block/shootyepgp/releases/latest ## X-Category: Guild ## X-Credits: shooty, Qcat(zhCN) -## Version: 3.50.5 -## X-Alpha: 3.60 +## Version: 3.60 +## X-Alpha: ## OptionalDeps: Ace2 -## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_groupbyarmor, sepgp_groupbyrole, sepgp_raidonly, sepgp_dbver, sepgp_debug +## SavedVariables: sepgp_saychannel, sepgp_groupbyclass, sepgp_groupbyarmor, sepgp_groupbyrole, sepgp_raidonly, sepgp_dbver, sepgp_debug, sepgp_fubar ## SavedVariablesPerCharacter: sepgp_main, sepgp_log, sepgp_looted, sepgp_decay, sepgp_minep, sepgp_reservechannel, sepgp_progress, sepgp_discount, sepgp_altspool, sepgp_altpercent Libs\AceLibrary\AceLibrary.lua