diff --git a/Core.lua b/Core.lua index b23a41c1..e7b07aba 100644 --- a/Core.lua +++ b/Core.lua @@ -169,7 +169,7 @@ core.EncounterList = { -- Event IDs must be in the exact same order as core core.CommDKPUI = {} -- global storing entire Configuration UI to hide/show UI core.MonVersion = "v3.2.7"; core.BuildNumber = 30207; -core.ReleaseNumber = 66 +core.ReleaseNumber = 67 core.defaultTable = "__default"; core.SemVer = core.MonVersion.."-r"..tostring(core.ReleaseNumber); core.UpgradeSchema = false; diff --git a/Localization/Localization.cn.lua b/Localization/Localization.cn.lua index ca2711cd..c58a0c2b 100644 --- a/Localization/Localization.cn.lua +++ b/Localization/Localization.cn.lua @@ -180,6 +180,8 @@ if GetLocale() == "zhCN" then AUTOCOMBATLOGTTWARN = "如果尚未激活,请在系统>网络中手动激活高级战斗日志。", AUTOOPEN = "自动打开出价窗口", AUTOOPENTTDESC = "选中该选项后,将在拍卖新项目时自动打开投标窗口。 如果未选中,则需要使用“/dkp bid”手动将其打开。", + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", DECREASEDISENCHANT = "降低分解價值", DECREASEDISENCHANTTTDESC = "3次分解後將分解值降低一半,之後每次分解至少減少5個DKP", AWARDBONUS = "奖励奖金", @@ -898,13 +900,13 @@ if GetLocale() == "zhCN" then MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", --TODO TRANSLATE: --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.de.lua b/Localization/Localization.de.lua index d7ec4db4..4b011aee 100644 --- a/Localization/Localization.de.lua +++ b/Localization/Localization.de.lua @@ -180,6 +180,8 @@ if GetLocale() == "deDE" then AUTOCOMBATLOGTTWARN = "Sie müssen Advanced Combat Logging immer noch manuell unter System> Netzwerk aktivieren, falls Sie dies noch nicht getan haben.", AUTOOPEN = "Gebotsfenster automatisch öffnen", AUTOOPENTTDESC = "Wenn diese Option aktiviert ist, wird das Gebotsfenster automatisch geöffnet, wenn ein neuer Artikel versteigert wird. Wenn das Kontrollkästchen deaktiviert ist, müssen Sie es bei Bedarf mit \"/dkp bid\" manuell öffnen.", + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", DECREASEDISENCHANT = "Entzaubern-Wert verringern", DECREASEDISENCHANTTTDESC = "Verringere den Entzaubern-Wert nach drei Entzauberungen um die Hälfte bei jeder weiteren Entzauberung bis zu einem Mindestwert von 5 DKP", AWARDBONUS = "Bonusprämie", @@ -892,13 +894,13 @@ if GetLocale() == "deDE" then MIGRATIONCOMPLETED = "Migration abgeschlossen.|n|nBitte deaktivieren Sie MonolithDKP und laden Sie das UI neu. (/reload)", --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.en.lua b/Localization/Localization.en.lua index dfe7a6e2..fa5a06db 100644 --- a/Localization/Localization.en.lua +++ b/Localization/Localization.en.lua @@ -875,13 +875,13 @@ core.L = { MIGRATIONCANCELED = "Migration canceled.|n|nPlease disable MonolithDKP and /reload the UI if you want to continue with CommunityDKP without using your current tables and settings.", MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.es.lua b/Localization/Localization.es.lua index fd489f18..ec134feb 100644 --- a/Localization/Localization.es.lua +++ b/Localization/Localization.es.lua @@ -180,6 +180,8 @@ if GetLocale() == "esES" or GetLocale() == "esMX" then AUTOCOMBATLOGTTWARN = "Aún debe activar manualmente el Registro avanzado de combate en Sistema> Red si aún no lo ha hecho.", AUTOOPEN = "Ventana de oferta de apertura automática", AUTOOPENTTDESC = "Cuando está marcada, la ventana de ofertas se abrirá automáticamente cuando se subaste un nuevo artículo. Si no está marcado, deberá abrirlo manualmente cuando sea necesario con \"/dkp bid\".", + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", DECREASEDISENCHANT = "Disminuir el valor de desencantar", DECREASEDISENCHANTTTDESC = "Disminuya el valor de desencantar después de 3 desencantadores a la mitad cada desencanto después hasta un mínimo de 5 DKP", AWARDBONUS = "Bono de premio", @@ -896,13 +898,13 @@ if GetLocale() == "esES" or GetLocale() == "esMX" then MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", --TODO TRANSLATE: --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.fr.lua b/Localization/Localization.fr.lua index 33f19fa9..f3144594 100644 --- a/Localization/Localization.fr.lua +++ b/Localization/Localization.fr.lua @@ -222,6 +222,8 @@ if GetLocale() == "frFR" then ARTINFLATTTDESC = "Points à donner à chaque joueur SUR LE DKP divisé et réparti entre eux. Cette valeur est ajoutée à leur DKP gagné APRÈS que la valeur mise en banque soit divisée.", AUTOAWARD = "Prix ​​Auto DKP", AUTOAWARDTTDESC = "Attribue automatiquement des DKP de Boss tué (réglés dans l'onglet Options) lorsqu'un boss est tué. Seul le Chef de Raid distribuera ces points. Le raid doit être en cours (via l'onglet Ajuster les DKP).", + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", AUTOCOMBATLOG = "Journal de combat automatique", AUTOCOMBATLOGTTDESC = "Active automatiquement /combatlog lorsque vous êtes dans un raid et que vous entrez dans une zone de raid ou entrez dans un combat avec un boss de raid.", AUTOCOMBATLOGTTWARN = "Vous devez toujours activer manuellement la journalisation de combat avancée dans Système > Réseau (si vous ne l'avez pas déjà fait).", @@ -943,13 +945,13 @@ if GetLocale() == "frFR" then MIGRATIONCOMPLETED = "Migration réussie.|n|nVeuillez désactiver MonolithDKP et recharger votre interface (/reload).", --TODO TRANSLATE: --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.kr.lua b/Localization/Localization.kr.lua index d4db7e2e..93a3ed81 100644 --- a/Localization/Localization.kr.lua +++ b/Localization/Localization.kr.lua @@ -174,6 +174,8 @@ if GetLocale() == "koKR" then ARTINFLATTTDESC = "DKP에서 각 플레이어에게 나누어주는 포인트. 이 값은 뱅킹 된 값이 분할 된 후 획득 한 DKP에 추가됩니다.", AUTOAWARD = "자동 수상 DKP", AUTOAWARDTTDESC = "Automatically awards Boss Kill Bonus DKP (set in Options tab) when a boss is killed. Only the raid leader will distribute points with this. Raid must be initialized on the Adjust DKP tab.", -- NEED TRANSLATION + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", AUTOCOMBATLOG = "자동 전투 기록", AUTOCOMBATLOGTTDESC = "공격대와 공격대에 들어가거나 전투 대전에서 전투에 참가할 때 / combatlog를 자동으로 활성화합니다.", AUTOCOMBATLOGTTWARN = "시스템> 네트워크에서 고급 전투 로깅을 아직 활성화하지 않은 경우 여전히 수동으로 활성화해야합니다.", @@ -895,13 +897,13 @@ if GetLocale() == "koKR" then MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", --TODO TRANSLATE: --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.ru.lua b/Localization/Localization.ru.lua index 9208e167..83cb06ce 100644 --- a/Localization/Localization.ru.lua +++ b/Localization/Localization.ru.lua @@ -236,6 +236,8 @@ if GetLocale() == "ruRU" then ARTINFLATTTDESC = "Очки, которые распределяются между каждым игроком таблицы DKP, которые разделены и распределены между ними. Это значение добавляется к их заработанному DKP ПОСЛЕ того, как банковская стоимость делится.", AUTOAWARD = "Авто-начисление DKP", AUTOAWARDTTDESC = "Automatically awards Boss Kill Bonus DKP (set in Options tab) when a boss is killed. Only the raid leader will distribute points with this. Raid must be initialized on the Adjust DKP tab.", -- NEEDS TRANSLATION + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", AUTOCOMBATLOG = "Автоматический журнал боя", AUTOCOMBATLOGTTDESC = "Автоматически активирует /combatlog когда в рейде и рейдовой зоне.", AUTOCOMBATLOGTTWARN = "Вам все еще необходимо активировать \"Расширенный журнал боя\" в \"Настройки > Соединение\" если Вы еще не сделали этого.", @@ -954,13 +956,13 @@ if GetLocale() == "ruRU" then MIGRATIONCOMPLETED = "Миграция завершена.|n|nПожалуйста отключите MonolithDKP и перезагрузите интерфейс.", --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.se.lua b/Localization/Localization.se.lua index 1b4881e2..d1c0b293 100644 --- a/Localization/Localization.se.lua +++ b/Localization/Localization.se.lua @@ -808,13 +808,13 @@ core.L = { MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Localization/Localization.tw.lua b/Localization/Localization.tw.lua index b4aec797..0b6987e1 100644 --- a/Localization/Localization.tw.lua +++ b/Localization/Localization.tw.lua @@ -174,6 +174,8 @@ if GetLocale() == "zhTW" then ARTINFLATTTDESC = "分配給每個玩家的DKP的TOP積分,在各個玩家之間分配。銀行價值除後,此值將添加到他們的收入DKP中。", AUTOAWARD = "汽車獎DKP", AUTOAWARDTTDESC = "Automatically awards Boss Kill Bonus DKP (set in Options tab) when a boss is killed. Only the raid leader will distribute points with this. Raid must be initialized on the Adjust DKP tab.", -- NEED TRANSLATION + AUTOAWARDLOOT = "Auto Award Loot", + AUTOAWARDLOOTDESC = "When checked loot will be automatically awarded to the winner. If looting they will be master looted to the winner. If awarding from your bags they will be inserted into the next trade window with the winner.", AUTOCOMBATLOG = "自動戰鬥記錄", AUTOCOMBATLOGTTDESC = "在突襲中進入突襲區域或在遭遇突襲時進入戰鬥時自動激活/ combatlog。", AUTOCOMBATLOGTTWARN = "如果尚未激活“高級戰鬥日誌”,則仍必須在系統>網絡中手動激活它。", @@ -897,13 +899,13 @@ if GetLocale() == "zhTW" then MIGRATIONCOMPLETED = "Migration complete.|n|nPlease disable MonolithDKP and /reload the UI.", --TODO TRANSLATE: --TODO TRANSLATE: - CHANGELOG1 = "CommunityDKP - v3.2.7-r66", + CHANGELOG1 = "CommunityDKP - v3.2.7-r67-bcc", CHANGELOG2 = " - fixed class filters (shamans / paladins)", CHANGELOG3 = " - fixed class graph (9th class)", CHANGELOG4 = " - updated version in the header", CHANGELOG5 = " - added TBC zones and encounters", CHANGELOG6 = " - added localizations to TBC zones and encounters", - CHANGELOG7 = "", + CHANGELOG7 = " - added auto award loot PR#174", CHANGELOG8 = "", CHANGELOG9 = "Taidtuskecyh @ Gehennas", CHANGELOG10 = "CommunityDKP Discord: https://discord.gg/dXXK4vH" diff --git a/Modules/Award.lua b/Modules/Award.lua index 5a9de569..8d611414 100644 --- a/Modules/Award.lua +++ b/Modules/Award.lua @@ -1,660 +1,660 @@ -local _, core = ...; -local _G = _G; -local CommDKP = core.CommDKP; -local L = core.L; - -local function SetItemPrice(cost, loot) - local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) - local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(loot,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") - local cost = cost; - - if itemName == nil and Name ~= nil then - itemName = Name; - end - - local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; - local newItem = {item=itemName, minbid=cost, link=itemLink, icon=itemIcon, disenchants=0, lastbid=cost, itemID = itemID} - - if not search then - CommDKP:GetTable(CommDKP_MinBids, true)[itemID] = newItem; - elseif search then - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid = CommDKP_round(cost, core.DB.modes.rounding); - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].lastbid = CommDKP_round(cost, core.DB.modes.rounding); - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].link = itemLink; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].icon = itemIcon; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].item = itemName; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].itemID = itemID; - if cost == 0 then - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].disenchants = 0; - end - newItem = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; - end - core.PriceTable = CommDKP:FormatPriceTable(); - CommDKP:PriceTable_Update(0); - CommDKP.Sync:SendData("CommDKPSetPrice", newItem); - -end - -local function AwardItem(player, cost, boss, zone, loot, reassign) - local cost = cost; - local winner = player; - local curTime = time(); - local curZone = zone; - local curBoss = boss; - local loot = loot; - local BidsEntry = {}; - local mode = core.DB.modes.mode; - local curOfficer = UnitName("player") - local bids; - local search_reassign; - local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) - - CommDKP:StatusVerify_Update() - if core.IsOfficer then - if core.DB.modes.costvalue == "Percent" then - local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), winner); - - if core.DB.modes.mode == "Roll Based Bidding" then - if search then - cost = CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) - cost = CommDKP_round(cost, core.DB.modes.rounding); - else - print(L["ERROR"]) - end - else - cost = CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) - cost = CommDKP_round(cost, core.DB.modes.rounding); - end - else - cost = CommDKP_round(cost, core.DB.modes.rounding) - end - - if cost > 0 then - cost = cost * -1 - end - - if reassign then - search_reassign = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_Loot, true), reassign, "index") - - if search_reassign then - local deleted = CopyTable(CommDKP:GetTable(CommDKP_Loot, true)[search_reassign[1][1]]) - local reimburse = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), deleted.player, "player") - local newIndex = curOfficer.."-"..curTime-2 - deleted.cost = deleted.cost * -1 - deleted.deletes = reassign - deleted.index = newIndex - deleted.date = curTime-2 - if deleted.bids then - bids = CopyTable(deleted.bids); - deleted.bids = nil; - end - CommDKP:GetTable(CommDKP_Loot, true)[search_reassign[1][1]].deletedby = newIndex - CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].dkp = CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].dkp + deleted.cost - CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent = CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent + deleted.cost - table.insert(CommDKP:GetTable(CommDKP_Loot, true), 1, deleted) - CommDKP.Sync:SendData("CommDKPDelLoot", CommDKP:GetTable(CommDKP_Loot, true)[1]) - end - end - - if core.DB.modes.StoreBids and not reassign then - local Bids_Submitted = CommDKP:BidsSubmitted_Get(); - local newIndex = curOfficer.."-"..curTime - - for i=1, #Bids_Submitted do - if Bids_Submitted[i].bid then - BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].bid; - elseif Bids_Submitted[i].dkp then - BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].dkp; - elseif Bids_Submitted[i].roll then - BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].roll..Bids_Submitted[i].range; - end - end - if Bids_Submitted[1] then - if Bids_Submitted[1].bid then - tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, bids={ }}) - for k,v in pairs(BidsEntry) do - table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].bids, {bidder=k, bid=v}); - end - elseif Bids_Submitted[1].dkp then - tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, dkp={ }}) - for k,v in pairs(BidsEntry) do - table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].dkp, {bidder=k, dkp=v}); - end - elseif Bids_Submitted[1].roll then - tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, rolls={ }}) - for k,v in pairs(BidsEntry) do - table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].rolls, {bidder=k, roll=v}); - end - end - else - tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) - end - else - local newIndex = curOfficer.."-"..curTime - tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) - if reassign then - local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_Loot, true), reassign, "index") - - if search and CommDKP:GetTable(CommDKP_Loot, true)[search[1][1]].player ~= winner then - CommDKP:GetTable(CommDKP_Loot, true)[1].reassigned = true - end - end - if type(bids) == "table" then - CommDKP:GetTable(CommDKP_Loot, true)[1].bids = bids - end - end - CommDKP:BidsSubmitted_Clear() - CommDKP.Sync:SendData("CommDKPLootDist", CommDKP:GetTable(CommDKP_Loot, true)[1]) - CommDKP:DKPTable_Set(winner, "dkp", CommDKP_round(cost, core.DB.modes.rounding), true) - CommDKP:LootHistory_Reset(); - CommDKP:LootHistory_Update(L["NOFILTER"]) - - if core.BiddingWindow and core.BiddingWindow:IsShown() then -- runs below if award is through bidding window (update minbids and zerosum bank) - if _G["CommDKPBiddingStartBiddingButton"] then - _G["CommDKPBiddingStartBiddingButton"]:SetText(L["STARTBIDDING"]) - _G["CommDKPBiddingStartBiddingButton"]:SetScript("OnClick", function (self) - ToggleTimerBtn(self) - end) - timerToggle = 0; - end - - core.BidInProgress = false; - CommDKP:BroadcastStopBidTimer() - - local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(loot,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") - - if itemName == nil and Name ~= nil then - itemName = Name; - end - - local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID] - local minBidAmount = CommDKP_round(CommDKP:GetMinBid(loot), core.DB.modes.rounding); - local lastBidAmount = CommDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); - - if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - if core.BiddingWindow.CustomMinBid:GetChecked() == false then - minBidAmount = CommDKP_round(minBidAmount, core.DB.modes.rounding); - else - if core.BiddingWindow.cost:GetNumber() ~= tonumber(minBidAmount) then - minBidAmount = CommDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); - end - end - else - if core.BiddingWindow.CustomMinBid:GetChecked() == true then - minBidAmount = CommDKP_round(core.BiddingWindow.minBid:GetNumber(), core.DB.modes.rounding); - end - end - - --set table here - local minBidEntry = {item=itemName, minbid=minBidAmount, link=itemLink, icon=itemIcon, lastbid=lastBidAmount, itemID=itemID}; - - if not search then - --not found - CommDKP:GetTable(CommDKP_MinBids, true)[itemID] = minBidEntry; - if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - core.BiddingWindow.CustomMinBid:SetShown(true); - core.BiddingWindow.CustomMinBid:SetChecked(core.DB.defaults.CustomMinBid); - end - CommDKP.Sync:SendData("CommDKPSetPrice", minBidEntry); - else - --found - if CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid ~= minBidAmount then - if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - core.BiddingWindow.CustomMinBid:SetShown(true); - core.BiddingWindow.CustomMinBid:SetChecked(core.DB.defaults.CustomMinBid); - end - end - - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid = minBidEntry.minbid; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].lastbid = minBidEntry.lastbid; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].link = minBidEntry.link; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].icon = minBidEntry.icon; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].item = minBidEntry.itemName; - CommDKP:GetTable(CommDKP_MinBids, true)[itemID].itemID = minBidEntry.itemID; - - CommDKP.Sync:SendData("CommDKPSetPrice", CommDKP:GetTable(CommDKP_MinBids, true)[itemID]); - end - - core.PriceTable = CommDKP:FormatPriceTable(); - CommDKP:PriceTable_Update(0); - - if mode == "Zero Sum" and not reassign then - core.DB.modes.ZeroSumBank.balance = core.DB.modes.ZeroSumBank.balance + -tonumber(cost) - table.insert(core.DB.modes.ZeroSumBank, { loot = loot, cost = -tonumber(cost) }) - CommDKP:ZeroSumBank_Update() - CommDKP.Sync:SendData("CommDKPZSumBank", core.DB.modes.ZeroSumBank) - end - core.BiddingWindow:Hide() - CommDKP:ClearBidWindow() - end - - -- moved this outside of above if to always display even if manual award - SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "RAID_WARNING") - if core.DB.modes.AnnounceAward then - SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "GUILD") - end - - if core.DB.defaults.AutoAwardLoot then - local numLootItems = GetNumLootItems() - if numLootItems > 0 then - local lootIndex = nil - for i = 1, numLootItems do - local lootLink = GetLootSlotLink(i) - if lootIndex == nil and lootLink ~= nil and lootLink == loot then - lootIndex = i - end - end - - local candidateIndex = nil - local maxGroupMembers = MAX_RAID_MEMBERS - if not IsInRaid() then maxGroupMembers = MAX_PARTY_MEMBERS end - for i = 1, maxGroupMembers do - local candidate = GetMasterLootCandidate(lootIndex, i) - if candidateIndex == nil and candidate ~= nil and candidate == winner then - candidateIndex = i - end - end - - if lootIndex ~= nil and candidateIndex ~= nil then - GiveMasterLoot(lootIndex, candidateIndex) - end - else - if core.DB.pendingLoot == nil then - core.DB.pendingLoot = {} - end - if core.DB.pendingLoot[winner] == nil then - core.DB.pendingLoot[winner] = {} - end - tinsert(core.DB.pendingLoot[winner], loot) - InitiateTrade(winner) - end - end - - end -end - -local function AwardConfirm_Create() - local f = CreateFrame("Frame", "CommDKP_AwardWindowConfirm", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil); - - f:SetPoint("TOP", UIParent, "TOP", 0, -200); - f:SetSize(400, 270); -- + 40 - f:SetClampedToScreen(true) - f:SetBackdrop( { - bgFile = "Textures\\white.blp", tile = true, -- White backdrop allows for black background with 1.0 alpha on low alpha containers - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3, - insets = { left = 0, right = 0, top = 0, bottom = 0 } - }); - f:SetBackdropColor(0,0,0,0.9); - f:SetBackdropBorderColor(1,1,1,1) - f:SetFrameStrata("DIALOG") - f:SetFrameLevel(15) - f:Hide() - - f.confirmHeader = f:CreateFontString(nil, "OVERLAY") - f.confirmHeader:SetFontObject("CommDKPLargeRight"); - f.confirmHeader:SetScale(0.9) - f.confirmHeader:SetPoint("TOPLEFT", f, "TOPLEFT", 15, -15); - f.confirmHeader:SetText(L["CONFAWARD"]) - - ---------------------------------- - -- Team row - ---------------------------------- - - f.teamHeader = f:CreateFontString(nil, "OVERLAY") - f.teamHeader:SetFontObject("CommDKPLargeRight"); - f.teamHeader:SetScale(0.7) - f.teamHeader:SetPoint("TOPLEFT", f, "TOPLEFT", 120, -60); - f.teamHeader:SetText(L["TEAM"]..":") - - f.team = CreateFrame("FRAME", "CommDKPAwardConfirmPlayerDropDown", f, "CommunityDKPUIDropDownMenuTemplate") - f.team:SetPoint("LEFT", f.teamHeader, "RIGHT", -15, 0) - UIDropDownMenu_SetWidth(f.team, 150) - UIDropDownMenu_JustifyText(f.team, "LEFT") - - ---------------------------------- - -- Player row - ---------------------------------- - - f.playerHeader = f:CreateFontString(nil, "OVERLAY") - f.playerHeader:SetFontObject("CommDKPLargeRight"); - f.playerHeader:SetScale(0.7) - f.playerHeader:SetPoint("TOPRIGHT", f.teamHeader, "BOTTOMRIGHT", 0, -10); - f.playerHeader:SetText(L["PLAYER"]..":") - - f.player = CreateFrame("FRAME", "CommDKPAwardConfirmPlayerDropDown", f, "CommunityDKPUIDropDownMenuTemplate") - f.player:SetPoint("LEFT", f.playerHeader, "RIGHT", -15, 0) - UIDropDownMenu_SetWidth(f.player, 150) - UIDropDownMenu_JustifyText(f.player, "LEFT") - - ---------------------------------- - -- Item row - ---------------------------------- - - f.lootHeader = f:CreateFontString(nil, "OVERLAY") - f.lootHeader:SetFontObject("CommDKPLargeRight"); - f.lootHeader:SetScale(0.7) - f.lootHeader:SetPoint("TOPRIGHT", f.playerHeader, "BOTTOMRIGHT", 0, -10); - f.lootHeader:SetText(L["ITEM"]..":") - - f.lootIcon = f:CreateTexture(nil, "OVERLAY", nil); - f.lootIcon:SetPoint("LEFT", f.lootHeader, "RIGHT", 5, 0); - f.lootIcon:SetColorTexture(0, 0, 0, 1) - f.lootIcon:SetSize(20, 20); - - f.loot = f:CreateFontString(nil, "OVERLAY") - f.loot:SetFontObject("CommDKPNormalLeft"); - f.loot:SetPoint("LEFT", f.lootIcon, "RIGHT", 5, 1); - f.loot:SetSize(200, 28); - - ---------------------------------- - -- Cost row - ---------------------------------- - - f.costHeader = f:CreateFontString(nil, "OVERLAY") - f.costHeader:SetFontObject("CommDKPLargeRight"); - f.costHeader:SetScale(0.7) - f.costHeader:SetPoint("TOPRIGHT", f.lootHeader, "BOTTOMRIGHT", 0, -10); - f.costHeader:SetText(L["ITEMCOST"]..":") - - f.cost = CreateFrame("EditBox", nil, f, BackdropTemplateMixin and "BackdropTemplate" or nil) - f.cost:SetAutoFocus(false) - f.cost:SetMultiLine(false) - f.cost:SetPoint("LEFT", f.costHeader, "RIGHT", 5, 0) - f.cost:SetSize(50, 22) - f.cost:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 1, edgeSize = 2, - }); - f.cost:SetBackdropColor(0,0,0,0.9) - f.cost:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - f.cost:SetMaxLetters(10) - f.cost:SetTextColor(1, 1, 1, 1) - f.cost:SetFontObject("CommDKPSmallRight") - f.cost:SetTextInsets(10,10,0,0) - f.cost:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - f.cost:SetScript("OnTabPressed", function(self) -- clears focus on tab - self:ClearFocus() - end) - f.cost:SetScript("OnEnterPressed", function(self) -- clears focus on enter - self:ClearFocus() - end) - - f.costFooter = f:CreateFontString(nil, "OVERLAY") - f.costFooter:SetFontObject("CommDKPNormalLeft"); - f.costFooter:SetPoint("LEFT", f.cost, "RIGHT", 5, 0); - f.costFooter:SetSize(200, 28); - - ---------------------------------- - -- Boss row - ---------------------------------- - - f.bossHeader = f:CreateFontString(nil, "OVERLAY") - f.bossHeader:SetFontObject("CommDKPLargeRight"); - f.bossHeader:SetScale(0.7) - f.bossHeader:SetPoint("TOPRIGHT", f.costHeader, "BOTTOMRIGHT", 0, -10); - f.bossHeader:SetText(L["BOSS"]..":") - - f.bossDropDown = CreateFrame("FRAME", "CommDKPAwardConfirmBossDropDown", f, "CommunityDKPUIDropDownMenuTemplate") - f.bossDropDown:SetPoint("LEFT", f.bossHeader, "RIGHT", -15, -2) - UIDropDownMenu_SetWidth(f.bossDropDown, 150) - UIDropDownMenu_JustifyText(f.bossDropDown, "LEFT") - - ---------------------------------- - -- Zone row - ---------------------------------- - - f.zoneHeader = f:CreateFontString(nil, "OVERLAY") - f.zoneHeader:SetFontObject("CommDKPLargeRight"); - f.zoneHeader:SetScale(0.7) - f.zoneHeader:SetPoint("TOPRIGHT", f.bossHeader, "BOTTOMRIGHT", 0, -10); - f.zoneHeader:SetText(L["ZONE"]..":") - - f.zoneDropDown = CreateFrame("FRAME", "CommDKPAwardConfirmBossDropDown", f, "CommunityDKPUIDropDownMenuTemplate") - f.zoneDropDown:SetPoint("LEFT", f.zoneHeader, "RIGHT", -15, -2) - UIDropDownMenu_SetWidth(f.zoneDropDown, 150) - UIDropDownMenu_JustifyText(f.zoneDropDown, "LEFT") - - ---------------------------------- - -- Buttons - ---------------------------------- - - f.yesButton = CommDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 20, 15, L["CONFIRM"]); - f.setPriceButton = CommDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 150, 15, "Set Price"); - f.setPriceButton:SetShown(false); - f.noButton = CommDKP:CreateButton("BOTTOMRIGHT", f, "BOTTOMRIGHT", -20, 15, L["CANCEL"]); - - return f; -end - - --- this also populates all the drop downs -function CommDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) - local _,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) - local curBoss, curZone, player, cost = boss, zone, player, cost - local class, search; - local PlayerList = {}; - local curSelected = 0; - local mode = core.DB.modes.mode; - - - if player then - search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), player) - class = CommDKP:GetCColors(CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].class) - end - - for i=1, #CommDKP:GetTable(CommDKP_DKPTable, true) do - table.insert(PlayerList, CommDKP:GetTable(CommDKP_DKPTable, true)[i].player) - end - table.sort(PlayerList, function(a, b) - return a < b - end) - - PlaySound(850) - core.AwardConfirm = core.AwardConfirm or AwardConfirm_Create() - core.AwardConfirm:SetShown(not core.AwardConfirm:IsShown()) - - if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - core.AwardConfirm.setPriceButton:SetShown(true); - end - - --core.AwardConfirm.player:SetText("|c"..class.hex..player.."|r") - core.AwardConfirm.lootIcon:SetTexture(itemIcon) - core.AwardConfirm.loot:SetText(loot) - core.AwardConfirm.cost:SetNumber(cost) - core.AwardConfirm.cost:SetScript("OnKeyUp", function(self) - cost = self:GetNumber(); - end) - core.AwardConfirm.costFooter:SetText("DKP") - --core.AwardConfirm.boss:SetText(boss.." in "..zone) - - ----- - -- team drop down initialization - ----- - - core.AwardConfirm.team:SetScript("OnEnter", - function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(L["TEAMCURRENTLIST"], 0.25, 0.75, 0.90, 1, true); - GameTooltip:AddLine(L["WARNING"], 1.0, 0, 0, true); - GameTooltip:AddLine(L["TEAMCURRENTLISTDESC3"], 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end - ) - core.AwardConfirm.team:SetScript("OnLeave", - function(self) - GameTooltip:Hide() - end - ) - - -- Create and bind the initialization function to the dropdown menu - UIDropDownMenu_Initialize(core.AwardConfirm.team, - function(self, level, menuList) - - local dropDownMenuItem = UIDropDownMenu_CreateInfo() - dropDownMenuItem.func = self.SetValue - dropDownMenuItem.fontObject = "CommDKPSmallCenter" - - teamList = CommDKP:GetGuildTeamList() - - for i=1, #teamList do - dropDownMenuItem.disabled = true - dropDownMenuItem.text = teamList[i][2] - dropDownMenuItem.arg1 = teamList[i][2] -- name - dropDownMenuItem.arg2 = teamList[i][1] -- index - dropDownMenuItem.checked = teamList[i][1] == tonumber(CommDKP:GetCurrentTeamIndex()) - dropDownMenuItem.isNotRadio = true - UIDropDownMenu_AddButton(dropDownMenuItem) - end - end - ) - -- Show which team is currently the current one - UIDropDownMenu_SetText(core.AwardConfirm.team, CommDKP:GetCurrentTeamName()) - - if player then - UIDropDownMenu_SetText(core.AwardConfirm.player, "|c"..class.hex..player.."|r") - else - UIDropDownMenu_SetText(core.AwardConfirm.player, "") - end - - UIDropDownMenu_Initialize(core.AwardConfirm.player, function(self, level, menuList) - local filterName = UIDropDownMenu_CreateInfo() - local ranges = {1} - - while ranges[#ranges] < #PlayerList do - table.insert(ranges, ranges[#ranges]+20) - end - - if (level or 1) == 1 then - local numSubs = ceil(#PlayerList/20) - filterName.func = self.SetValue - - for i=1, numSubs do - local max = i*20; - if max > #PlayerList then max = #PlayerList end - filterName.text, filterName.checked, filterName.menuList, filterName.hasArrow = strsub(PlayerList[((i*20)-19)], 1, 1).."-"..strsub(PlayerList[max], 1, 1), curSelected >= (i*20)-19 and curSelected <= i*20, i, true - UIDropDownMenu_AddButton(filterName) - end - - else - filterName.func = self.SetValue - for i=ranges[menuList], ranges[menuList]+19 do - if PlayerList[i] then - local classSearch = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), PlayerList[i]) - local c; - - if classSearch then - c = CommDKP:GetCColors(CommDKP:GetTable(CommDKP_DKPTable, true)[classSearch[1][1]].class) - else - c = { hex="ff444444" } - end - filterName.text, filterName.arg1, filterName.arg2, filterName.checked, filterName.isNotRadio = "|c"..c.hex..PlayerList[i].."|r", PlayerList[i], "|c"..c.hex..PlayerList[i].."|r", PlayerList[i] == player, true - UIDropDownMenu_AddButton(filterName, level) - end - end - end - end) - - UIDropDownMenu_SetText(core.AwardConfirm.bossDropDown, curBoss) - UIDropDownMenu_Initialize(core.AwardConfirm.bossDropDown, function(self, level, menuList) -- BOSS dropdown - UIDropDownMenu_SetAnchor(core.AwardConfirm.bossDropDown, 10, 10, "TOPLEFT", core.AwardConfirm.bossDropDown, "BOTTOMLEFT") - --UIDropDownMenu_JustifyText(core.AwardConfirm.bossDropDown, "LEFT") - local reason = UIDropDownMenu_CreateInfo() - local tempNPCs = {}; - - table.insert(tempNPCs, core.LastKilledBoss) - - for k,v in pairs(core.LastKilledNPC) do -- eliminates duplicate zones - if not CommDKP:Table_Search(tempNPCs, v) then - table.insert(tempNPCs, v) - end - end - - reason.func = self.SetValue - - if not CommDKP:Table_Search(tempNPCs, curBoss) then - reason.text, reason.arg1, reason.checked, reason.isNotRadio = curBoss, curBoss, curBoss == curBoss, true - UIDropDownMenu_AddButton(reason) - end - - for i=1, #tempNPCs do - reason.text, reason.arg1, reason.checked, reason.isNotRadio = tempNPCs[i], tempNPCs[i], tempNPCs[i] == curBoss, true - UIDropDownMenu_AddButton(reason) - end - end) - - UIDropDownMenu_SetText(core.AwardConfirm.zoneDropDown, curZone) - UIDropDownMenu_Initialize(core.AwardConfirm.zoneDropDown, function(self, level, menuList) -- ZONE dropdown - UIDropDownMenu_SetAnchor(core.AwardConfirm.zoneDropDown, 10, 10, "TOPLEFT", core.AwardConfirm.zoneDropDown, "BOTTOMLEFT") - --UIDropDownMenu_JustifyText(core.AwardConfirm.bossDropDown, "LEFT") - local reason = UIDropDownMenu_CreateInfo() - local tempZones = {}; - - table.insert(tempZones, core.CurrentRaidZone) - - for k,v in pairs(core.RecentZones) do -- eliminates duplicate zones - if not CommDKP:Table_Search(tempZones, v) then - table.insert(tempZones, v) - end - end - - reason.func = self.SetValue - - for i=1, #tempZones do - reason.text, reason.arg1, reason.checked, reason.isNotRadio = tempZones[i], tempZones[i], tempZones[i] == curZone, true - UIDropDownMenu_AddButton(reason) - end - end) - - - function core.AwardConfirm.player:SetValue(newValue, arg2) ---- PLAYER dropdown function - if player ~= newValue then player = newValue end - UIDropDownMenu_SetText(core.AwardConfirm.player, arg2) - CloseDropDownMenus() - end - - function core.AwardConfirm.bossDropDown:SetValue(newValue) ---- BOSS dropdown function - UIDropDownMenu_SetText(core.AwardConfirm.bossDropDown, newValue) - curBoss = newValue; - CloseDropDownMenus() - end - - function core.AwardConfirm.zoneDropDown:SetValue(newValue) ---- ZONE dropdown function - UIDropDownMenu_SetText(core.AwardConfirm.zoneDropDown, newValue) - curZone = newValue; - CloseDropDownMenus() - end - - core.AwardConfirm.yesButton:SetScript("OnClick", function() -- Run when "Yes" is clicked - if not player then - StaticPopupDialogs["AWARD_VALIDATE"] = { - text = L["PLAYERVALIDATE"], - button1 = L["OK"], - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("AWARD_VALIDATE") - else - if reassign then - AwardItem(player, cost, curBoss, curZone, loot, reassign) - else - AwardItem(player, cost, curBoss, curZone, loot) - end - core.AwardConfirm:SetShown(false) - end - - PlaySound(851) - end) - core.AwardConfirm.noButton:SetScript("OnClick", function() -- Run when "No" is clicked - PlaySound(851) - core.AwardConfirm:SetShown(false) - end) - core.AwardConfirm.setPriceButton:SetScript("OnClick", function() -- Run when "Set Price" is clicked - SetItemPrice(cost, loot) - PlaySound(851) - core.AwardConfirm:SetShown(false) - end) -end +local _, core = ...; +local _G = _G; +local CommDKP = core.CommDKP; +local L = core.L; + +local function SetItemPrice(cost, loot) + local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) + local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(loot,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") + local cost = cost; + + if itemName == nil and Name ~= nil then + itemName = Name; + end + + local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; + local newItem = {item=itemName, minbid=cost, link=itemLink, icon=itemIcon, disenchants=0, lastbid=cost, itemID = itemID} + + if not search then + CommDKP:GetTable(CommDKP_MinBids, true)[itemID] = newItem; + elseif search then + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid = CommDKP_round(cost, core.DB.modes.rounding); + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].lastbid = CommDKP_round(cost, core.DB.modes.rounding); + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].link = itemLink; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].icon = itemIcon; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].item = itemName; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].itemID = itemID; + if cost == 0 then + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].disenchants = 0; + end + newItem = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; + end + core.PriceTable = CommDKP:FormatPriceTable(); + CommDKP:PriceTable_Update(0); + CommDKP.Sync:SendData("CommDKPSetPrice", newItem); + +end + +local function AwardItem(player, cost, boss, zone, loot, reassign) + local cost = cost; + local winner = player; + local curTime = time(); + local curZone = zone; + local curBoss = boss; + local loot = loot; + local BidsEntry = {}; + local mode = core.DB.modes.mode; + local curOfficer = UnitName("player") + local bids; + local search_reassign; + local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) + + CommDKP:StatusVerify_Update() + if core.IsOfficer then + if core.DB.modes.costvalue == "Percent" then + local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), winner); + + if core.DB.modes.mode == "Roll Based Bidding" then + if search then + cost = CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) + cost = CommDKP_round(cost, core.DB.modes.rounding); + else + print(L["ERROR"]) + end + else + cost = CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) + cost = CommDKP_round(cost, core.DB.modes.rounding); + end + else + cost = CommDKP_round(cost, core.DB.modes.rounding) + end + + if cost > 0 then + cost = cost * -1 + end + + if reassign then + search_reassign = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_Loot, true), reassign, "index") + + if search_reassign then + local deleted = CopyTable(CommDKP:GetTable(CommDKP_Loot, true)[search_reassign[1][1]]) + local reimburse = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), deleted.player, "player") + local newIndex = curOfficer.."-"..curTime-2 + deleted.cost = deleted.cost * -1 + deleted.deletes = reassign + deleted.index = newIndex + deleted.date = curTime-2 + if deleted.bids then + bids = CopyTable(deleted.bids); + deleted.bids = nil; + end + CommDKP:GetTable(CommDKP_Loot, true)[search_reassign[1][1]].deletedby = newIndex + CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].dkp = CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].dkp + deleted.cost + CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent = CommDKP:GetTable(CommDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent + deleted.cost + table.insert(CommDKP:GetTable(CommDKP_Loot, true), 1, deleted) + CommDKP.Sync:SendData("CommDKPDelLoot", CommDKP:GetTable(CommDKP_Loot, true)[1]) + end + end + + if core.DB.modes.StoreBids and not reassign then + local Bids_Submitted = CommDKP:BidsSubmitted_Get(); + local newIndex = curOfficer.."-"..curTime + + for i=1, #Bids_Submitted do + if Bids_Submitted[i].bid then + BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].bid; + elseif Bids_Submitted[i].dkp then + BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].dkp; + elseif Bids_Submitted[i].roll then + BidsEntry[Bids_Submitted[i].player] = Bids_Submitted[i].roll..Bids_Submitted[i].range; + end + end + if Bids_Submitted[1] then + if Bids_Submitted[1].bid then + tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, bids={ }}) + for k,v in pairs(BidsEntry) do + table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].bids, {bidder=k, bid=v}); + end + elseif Bids_Submitted[1].dkp then + tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, dkp={ }}) + for k,v in pairs(BidsEntry) do + table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].dkp, {bidder=k, dkp=v}); + end + elseif Bids_Submitted[1].roll then + tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, rolls={ }}) + for k,v in pairs(BidsEntry) do + table.insert(CommDKP:GetTable(CommDKP_Loot, true)[1].rolls, {bidder=k, roll=v}); + end + end + else + tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) + end + else + local newIndex = curOfficer.."-"..curTime + tinsert(CommDKP:GetTable(CommDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) + if reassign then + local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_Loot, true), reassign, "index") + + if search and CommDKP:GetTable(CommDKP_Loot, true)[search[1][1]].player ~= winner then + CommDKP:GetTable(CommDKP_Loot, true)[1].reassigned = true + end + end + if type(bids) == "table" then + CommDKP:GetTable(CommDKP_Loot, true)[1].bids = bids + end + end + CommDKP:BidsSubmitted_Clear() + CommDKP.Sync:SendData("CommDKPLootDist", CommDKP:GetTable(CommDKP_Loot, true)[1]) + CommDKP:DKPTable_Set(winner, "dkp", CommDKP_round(cost, core.DB.modes.rounding), true) + CommDKP:LootHistory_Reset(); + CommDKP:LootHistory_Update(L["NOFILTER"]) + + if core.BiddingWindow and core.BiddingWindow:IsShown() then -- runs below if award is through bidding window (update minbids and zerosum bank) + if _G["CommDKPBiddingStartBiddingButton"] then + _G["CommDKPBiddingStartBiddingButton"]:SetText(L["STARTBIDDING"]) + _G["CommDKPBiddingStartBiddingButton"]:SetScript("OnClick", function (self) + ToggleTimerBtn(self) + end) + timerToggle = 0; + end + + core.BidInProgress = false; + CommDKP:BroadcastStopBidTimer() + + local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(loot,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") + + if itemName == nil and Name ~= nil then + itemName = Name; + end + + local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID] + local minBidAmount = CommDKP_round(CommDKP:GetMinBid(loot), core.DB.modes.rounding); + local lastBidAmount = CommDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); + + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then + if core.BiddingWindow.CustomMinBid:GetChecked() == false then + minBidAmount = CommDKP_round(minBidAmount, core.DB.modes.rounding); + else + if core.BiddingWindow.cost:GetNumber() ~= tonumber(minBidAmount) then + minBidAmount = CommDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); + end + end + else + if core.BiddingWindow.CustomMinBid:GetChecked() == true then + minBidAmount = CommDKP_round(core.BiddingWindow.minBid:GetNumber(), core.DB.modes.rounding); + end + end + + --set table here + local minBidEntry = {item=itemName, minbid=minBidAmount, link=itemLink, icon=itemIcon, lastbid=lastBidAmount, itemID=itemID}; + + if not search then + --not found + CommDKP:GetTable(CommDKP_MinBids, true)[itemID] = minBidEntry; + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then + core.BiddingWindow.CustomMinBid:SetShown(true); + core.BiddingWindow.CustomMinBid:SetChecked(core.DB.defaults.CustomMinBid); + end + CommDKP.Sync:SendData("CommDKPSetPrice", minBidEntry); + else + --found + if CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid ~= minBidAmount then + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then + core.BiddingWindow.CustomMinBid:SetShown(true); + core.BiddingWindow.CustomMinBid:SetChecked(core.DB.defaults.CustomMinBid); + end + end + + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].minbid = minBidEntry.minbid; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].lastbid = minBidEntry.lastbid; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].link = minBidEntry.link; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].icon = minBidEntry.icon; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].item = minBidEntry.itemName; + CommDKP:GetTable(CommDKP_MinBids, true)[itemID].itemID = minBidEntry.itemID; + + CommDKP.Sync:SendData("CommDKPSetPrice", CommDKP:GetTable(CommDKP_MinBids, true)[itemID]); + end + + core.PriceTable = CommDKP:FormatPriceTable(); + CommDKP:PriceTable_Update(0); + + if mode == "Zero Sum" and not reassign then + core.DB.modes.ZeroSumBank.balance = core.DB.modes.ZeroSumBank.balance + -tonumber(cost) + table.insert(core.DB.modes.ZeroSumBank, { loot = loot, cost = -tonumber(cost) }) + CommDKP:ZeroSumBank_Update() + CommDKP.Sync:SendData("CommDKPZSumBank", core.DB.modes.ZeroSumBank) + end + core.BiddingWindow:Hide() + CommDKP:ClearBidWindow() + end + + -- moved this outside of above if to always display even if manual award + SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "RAID_WARNING") + if core.DB.modes.AnnounceAward then + SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "GUILD") + end + + if core.DB.defaults.AutoAwardLoot then + local numLootItems = GetNumLootItems() + if numLootItems > 0 then + local lootIndex = nil + for i = 1, numLootItems do + local lootLink = GetLootSlotLink(i) + if lootIndex == nil and lootLink ~= nil and lootLink == loot then + lootIndex = i + end + end + + local candidateIndex = nil + local maxGroupMembers = MAX_RAID_MEMBERS + if not IsInRaid() then maxGroupMembers = MAX_PARTY_MEMBERS end + for i = 1, maxGroupMembers do + local candidate = GetMasterLootCandidate(lootIndex, i) + if candidateIndex == nil and candidate ~= nil and candidate == winner then + candidateIndex = i + end + end + + if lootIndex ~= nil and candidateIndex ~= nil then + GiveMasterLoot(lootIndex, candidateIndex) + end + else + if core.DB.pendingLoot == nil then + core.DB.pendingLoot = {} + end + if core.DB.pendingLoot[winner] == nil then + core.DB.pendingLoot[winner] = {} + end + tinsert(core.DB.pendingLoot[winner], loot) + InitiateTrade(winner) + end + end + + end +end + +local function AwardConfirm_Create() + local f = CreateFrame("Frame", "CommDKP_AwardWindowConfirm", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil); + + f:SetPoint("TOP", UIParent, "TOP", 0, -200); + f:SetSize(400, 270); -- + 40 + f:SetClampedToScreen(true) + f:SetBackdrop( { + bgFile = "Textures\\white.blp", tile = true, -- White backdrop allows for black background with 1.0 alpha on low alpha containers + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3, + insets = { left = 0, right = 0, top = 0, bottom = 0 } + }); + f:SetBackdropColor(0,0,0,0.9); + f:SetBackdropBorderColor(1,1,1,1) + f:SetFrameStrata("DIALOG") + f:SetFrameLevel(15) + f:Hide() + + f.confirmHeader = f:CreateFontString(nil, "OVERLAY") + f.confirmHeader:SetFontObject("CommDKPLargeRight"); + f.confirmHeader:SetScale(0.9) + f.confirmHeader:SetPoint("TOPLEFT", f, "TOPLEFT", 15, -15); + f.confirmHeader:SetText(L["CONFAWARD"]) + + ---------------------------------- + -- Team row + ---------------------------------- + + f.teamHeader = f:CreateFontString(nil, "OVERLAY") + f.teamHeader:SetFontObject("CommDKPLargeRight"); + f.teamHeader:SetScale(0.7) + f.teamHeader:SetPoint("TOPLEFT", f, "TOPLEFT", 120, -60); + f.teamHeader:SetText(L["TEAM"]..":") + + f.team = CreateFrame("FRAME", "CommDKPAwardConfirmPlayerDropDown", f, "CommunityDKPUIDropDownMenuTemplate") + f.team:SetPoint("LEFT", f.teamHeader, "RIGHT", -15, 0) + UIDropDownMenu_SetWidth(f.team, 150) + UIDropDownMenu_JustifyText(f.team, "LEFT") + + ---------------------------------- + -- Player row + ---------------------------------- + + f.playerHeader = f:CreateFontString(nil, "OVERLAY") + f.playerHeader:SetFontObject("CommDKPLargeRight"); + f.playerHeader:SetScale(0.7) + f.playerHeader:SetPoint("TOPRIGHT", f.teamHeader, "BOTTOMRIGHT", 0, -10); + f.playerHeader:SetText(L["PLAYER"]..":") + + f.player = CreateFrame("FRAME", "CommDKPAwardConfirmPlayerDropDown", f, "CommunityDKPUIDropDownMenuTemplate") + f.player:SetPoint("LEFT", f.playerHeader, "RIGHT", -15, 0) + UIDropDownMenu_SetWidth(f.player, 150) + UIDropDownMenu_JustifyText(f.player, "LEFT") + + ---------------------------------- + -- Item row + ---------------------------------- + + f.lootHeader = f:CreateFontString(nil, "OVERLAY") + f.lootHeader:SetFontObject("CommDKPLargeRight"); + f.lootHeader:SetScale(0.7) + f.lootHeader:SetPoint("TOPRIGHT", f.playerHeader, "BOTTOMRIGHT", 0, -10); + f.lootHeader:SetText(L["ITEM"]..":") + + f.lootIcon = f:CreateTexture(nil, "OVERLAY", nil); + f.lootIcon:SetPoint("LEFT", f.lootHeader, "RIGHT", 5, 0); + f.lootIcon:SetColorTexture(0, 0, 0, 1) + f.lootIcon:SetSize(20, 20); + + f.loot = f:CreateFontString(nil, "OVERLAY") + f.loot:SetFontObject("CommDKPNormalLeft"); + f.loot:SetPoint("LEFT", f.lootIcon, "RIGHT", 5, 1); + f.loot:SetSize(200, 28); + + ---------------------------------- + -- Cost row + ---------------------------------- + + f.costHeader = f:CreateFontString(nil, "OVERLAY") + f.costHeader:SetFontObject("CommDKPLargeRight"); + f.costHeader:SetScale(0.7) + f.costHeader:SetPoint("TOPRIGHT", f.lootHeader, "BOTTOMRIGHT", 0, -10); + f.costHeader:SetText(L["ITEMCOST"]..":") + + f.cost = CreateFrame("EditBox", nil, f, BackdropTemplateMixin and "BackdropTemplate" or nil) + f.cost:SetAutoFocus(false) + f.cost:SetMultiLine(false) + f.cost:SetPoint("LEFT", f.costHeader, "RIGHT", 5, 0) + f.cost:SetSize(50, 22) + f.cost:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 1, edgeSize = 2, + }); + f.cost:SetBackdropColor(0,0,0,0.9) + f.cost:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + f.cost:SetMaxLetters(10) + f.cost:SetTextColor(1, 1, 1, 1) + f.cost:SetFontObject("CommDKPSmallRight") + f.cost:SetTextInsets(10,10,0,0) + f.cost:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + f.cost:SetScript("OnTabPressed", function(self) -- clears focus on tab + self:ClearFocus() + end) + f.cost:SetScript("OnEnterPressed", function(self) -- clears focus on enter + self:ClearFocus() + end) + + f.costFooter = f:CreateFontString(nil, "OVERLAY") + f.costFooter:SetFontObject("CommDKPNormalLeft"); + f.costFooter:SetPoint("LEFT", f.cost, "RIGHT", 5, 0); + f.costFooter:SetSize(200, 28); + + ---------------------------------- + -- Boss row + ---------------------------------- + + f.bossHeader = f:CreateFontString(nil, "OVERLAY") + f.bossHeader:SetFontObject("CommDKPLargeRight"); + f.bossHeader:SetScale(0.7) + f.bossHeader:SetPoint("TOPRIGHT", f.costHeader, "BOTTOMRIGHT", 0, -10); + f.bossHeader:SetText(L["BOSS"]..":") + + f.bossDropDown = CreateFrame("FRAME", "CommDKPAwardConfirmBossDropDown", f, "CommunityDKPUIDropDownMenuTemplate") + f.bossDropDown:SetPoint("LEFT", f.bossHeader, "RIGHT", -15, -2) + UIDropDownMenu_SetWidth(f.bossDropDown, 150) + UIDropDownMenu_JustifyText(f.bossDropDown, "LEFT") + + ---------------------------------- + -- Zone row + ---------------------------------- + + f.zoneHeader = f:CreateFontString(nil, "OVERLAY") + f.zoneHeader:SetFontObject("CommDKPLargeRight"); + f.zoneHeader:SetScale(0.7) + f.zoneHeader:SetPoint("TOPRIGHT", f.bossHeader, "BOTTOMRIGHT", 0, -10); + f.zoneHeader:SetText(L["ZONE"]..":") + + f.zoneDropDown = CreateFrame("FRAME", "CommDKPAwardConfirmBossDropDown", f, "CommunityDKPUIDropDownMenuTemplate") + f.zoneDropDown:SetPoint("LEFT", f.zoneHeader, "RIGHT", -15, -2) + UIDropDownMenu_SetWidth(f.zoneDropDown, 150) + UIDropDownMenu_JustifyText(f.zoneDropDown, "LEFT") + + ---------------------------------- + -- Buttons + ---------------------------------- + + f.yesButton = CommDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 20, 15, L["CONFIRM"]); + f.setPriceButton = CommDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 150, 15, "Set Price"); + f.setPriceButton:SetShown(false); + f.noButton = CommDKP:CreateButton("BOTTOMRIGHT", f, "BOTTOMRIGHT", -20, 15, L["CANCEL"]); + + return f; +end + + +-- this also populates all the drop downs +function CommDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) + local _,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) + local curBoss, curZone, player, cost = boss, zone, player, cost + local class, search; + local PlayerList = {}; + local curSelected = 0; + local mode = core.DB.modes.mode; + + + if player then + search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), player) + class = CommDKP:GetCColors(CommDKP:GetTable(CommDKP_DKPTable, true)[search[1][1]].class) + end + + for i=1, #CommDKP:GetTable(CommDKP_DKPTable, true) do + table.insert(PlayerList, CommDKP:GetTable(CommDKP_DKPTable, true)[i].player) + end + table.sort(PlayerList, function(a, b) + return a < b + end) + + PlaySound(850) + core.AwardConfirm = core.AwardConfirm or AwardConfirm_Create() + core.AwardConfirm:SetShown(not core.AwardConfirm:IsShown()) + + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then + core.AwardConfirm.setPriceButton:SetShown(true); + end + + --core.AwardConfirm.player:SetText("|c"..class.hex..player.."|r") + core.AwardConfirm.lootIcon:SetTexture(itemIcon) + core.AwardConfirm.loot:SetText(loot) + core.AwardConfirm.cost:SetNumber(cost) + core.AwardConfirm.cost:SetScript("OnKeyUp", function(self) + cost = self:GetNumber(); + end) + core.AwardConfirm.costFooter:SetText("DKP") + --core.AwardConfirm.boss:SetText(boss.." in "..zone) + + ----- + -- team drop down initialization + ----- + + core.AwardConfirm.team:SetScript("OnEnter", + function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip:SetText(L["TEAMCURRENTLIST"], 0.25, 0.75, 0.90, 1, true); + GameTooltip:AddLine(L["WARNING"], 1.0, 0, 0, true); + GameTooltip:AddLine(L["TEAMCURRENTLISTDESC3"], 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end + ) + core.AwardConfirm.team:SetScript("OnLeave", + function(self) + GameTooltip:Hide() + end + ) + + -- Create and bind the initialization function to the dropdown menu + UIDropDownMenu_Initialize(core.AwardConfirm.team, + function(self, level, menuList) + + local dropDownMenuItem = UIDropDownMenu_CreateInfo() + dropDownMenuItem.func = self.SetValue + dropDownMenuItem.fontObject = "CommDKPSmallCenter" + + teamList = CommDKP:GetGuildTeamList() + + for i=1, #teamList do + dropDownMenuItem.disabled = true + dropDownMenuItem.text = teamList[i][2] + dropDownMenuItem.arg1 = teamList[i][2] -- name + dropDownMenuItem.arg2 = teamList[i][1] -- index + dropDownMenuItem.checked = teamList[i][1] == tonumber(CommDKP:GetCurrentTeamIndex()) + dropDownMenuItem.isNotRadio = true + UIDropDownMenu_AddButton(dropDownMenuItem) + end + end + ) + -- Show which team is currently the current one + UIDropDownMenu_SetText(core.AwardConfirm.team, CommDKP:GetCurrentTeamName()) + + if player then + UIDropDownMenu_SetText(core.AwardConfirm.player, "|c"..class.hex..player.."|r") + else + UIDropDownMenu_SetText(core.AwardConfirm.player, "") + end + + UIDropDownMenu_Initialize(core.AwardConfirm.player, function(self, level, menuList) + local filterName = UIDropDownMenu_CreateInfo() + local ranges = {1} + + while ranges[#ranges] < #PlayerList do + table.insert(ranges, ranges[#ranges]+20) + end + + if (level or 1) == 1 then + local numSubs = ceil(#PlayerList/20) + filterName.func = self.SetValue + + for i=1, numSubs do + local max = i*20; + if max > #PlayerList then max = #PlayerList end + filterName.text, filterName.checked, filterName.menuList, filterName.hasArrow = strsub(PlayerList[((i*20)-19)], 1, 1).."-"..strsub(PlayerList[max], 1, 1), curSelected >= (i*20)-19 and curSelected <= i*20, i, true + UIDropDownMenu_AddButton(filterName) + end + + else + filterName.func = self.SetValue + for i=ranges[menuList], ranges[menuList]+19 do + if PlayerList[i] then + local classSearch = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), PlayerList[i]) + local c; + + if classSearch then + c = CommDKP:GetCColors(CommDKP:GetTable(CommDKP_DKPTable, true)[classSearch[1][1]].class) + else + c = { hex="ff444444" } + end + filterName.text, filterName.arg1, filterName.arg2, filterName.checked, filterName.isNotRadio = "|c"..c.hex..PlayerList[i].."|r", PlayerList[i], "|c"..c.hex..PlayerList[i].."|r", PlayerList[i] == player, true + UIDropDownMenu_AddButton(filterName, level) + end + end + end + end) + + UIDropDownMenu_SetText(core.AwardConfirm.bossDropDown, curBoss) + UIDropDownMenu_Initialize(core.AwardConfirm.bossDropDown, function(self, level, menuList) -- BOSS dropdown + UIDropDownMenu_SetAnchor(core.AwardConfirm.bossDropDown, 10, 10, "TOPLEFT", core.AwardConfirm.bossDropDown, "BOTTOMLEFT") + --UIDropDownMenu_JustifyText(core.AwardConfirm.bossDropDown, "LEFT") + local reason = UIDropDownMenu_CreateInfo() + local tempNPCs = {}; + + table.insert(tempNPCs, core.LastKilledBoss) + + for k,v in pairs(core.LastKilledNPC) do -- eliminates duplicate zones + if not CommDKP:Table_Search(tempNPCs, v) then + table.insert(tempNPCs, v) + end + end + + reason.func = self.SetValue + + if not CommDKP:Table_Search(tempNPCs, curBoss) then + reason.text, reason.arg1, reason.checked, reason.isNotRadio = curBoss, curBoss, curBoss == curBoss, true + UIDropDownMenu_AddButton(reason) + end + + for i=1, #tempNPCs do + reason.text, reason.arg1, reason.checked, reason.isNotRadio = tempNPCs[i], tempNPCs[i], tempNPCs[i] == curBoss, true + UIDropDownMenu_AddButton(reason) + end + end) + + UIDropDownMenu_SetText(core.AwardConfirm.zoneDropDown, curZone) + UIDropDownMenu_Initialize(core.AwardConfirm.zoneDropDown, function(self, level, menuList) -- ZONE dropdown + UIDropDownMenu_SetAnchor(core.AwardConfirm.zoneDropDown, 10, 10, "TOPLEFT", core.AwardConfirm.zoneDropDown, "BOTTOMLEFT") + --UIDropDownMenu_JustifyText(core.AwardConfirm.bossDropDown, "LEFT") + local reason = UIDropDownMenu_CreateInfo() + local tempZones = {}; + + table.insert(tempZones, core.CurrentRaidZone) + + for k,v in pairs(core.RecentZones) do -- eliminates duplicate zones + if not CommDKP:Table_Search(tempZones, v) then + table.insert(tempZones, v) + end + end + + reason.func = self.SetValue + + for i=1, #tempZones do + reason.text, reason.arg1, reason.checked, reason.isNotRadio = tempZones[i], tempZones[i], tempZones[i] == curZone, true + UIDropDownMenu_AddButton(reason) + end + end) + + + function core.AwardConfirm.player:SetValue(newValue, arg2) ---- PLAYER dropdown function + if player ~= newValue then player = newValue end + UIDropDownMenu_SetText(core.AwardConfirm.player, arg2) + CloseDropDownMenus() + end + + function core.AwardConfirm.bossDropDown:SetValue(newValue) ---- BOSS dropdown function + UIDropDownMenu_SetText(core.AwardConfirm.bossDropDown, newValue) + curBoss = newValue; + CloseDropDownMenus() + end + + function core.AwardConfirm.zoneDropDown:SetValue(newValue) ---- ZONE dropdown function + UIDropDownMenu_SetText(core.AwardConfirm.zoneDropDown, newValue) + curZone = newValue; + CloseDropDownMenus() + end + + core.AwardConfirm.yesButton:SetScript("OnClick", function() -- Run when "Yes" is clicked + if not player then + StaticPopupDialogs["AWARD_VALIDATE"] = { + text = L["PLAYERVALIDATE"], + button1 = L["OK"], + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("AWARD_VALIDATE") + else + if reassign then + AwardItem(player, cost, curBoss, curZone, loot, reassign) + else + AwardItem(player, cost, curBoss, curZone, loot) + end + core.AwardConfirm:SetShown(false) + end + + PlaySound(851) + end) + core.AwardConfirm.noButton:SetScript("OnClick", function() -- Run when "No" is clicked + PlaySound(851) + core.AwardConfirm:SetShown(false) + end) + core.AwardConfirm.setPriceButton:SetScript("OnClick", function() -- Run when "Set Price" is clicked + SetItemPrice(cost, loot) + PlaySound(851) + core.AwardConfirm:SetShown(false) + end) +end diff --git a/Modules/Options.lua b/Modules/Options.lua index acbbf179..a4e01ed0 100644 --- a/Modules/Options.lua +++ b/Modules/Options.lua @@ -1,1408 +1,1410 @@ -local _, core = ...; -local _G = _G; -local CommDKP = core.CommDKP; -local L = core.L; - -local moveTimerToggle = 0; -local validating = false - -local function DrawPercFrame(box) - --Draw % signs if set to percent - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box]:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetFontObject("CommDKPNormalLeft"); - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box], "RIGHT", -15, 0); - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetText("%") - - if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box]:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetFontObject("CommDKPNormalLeft"); - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box], "RIGHT", -15, 0); - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetText("%") - end -end - -local function SaveSettings() - if CommDKP.ConfigTab4.default[1] then - core.DB.DKPBonus.OnTimeBonus = CommDKP.ConfigTab4.default[1]:GetNumber(); - core.DB.DKPBonus.BossKillBonus = CommDKP.ConfigTab4.default[2]:GetNumber(); - core.DB.DKPBonus.CompletionBonus = CommDKP.ConfigTab4.default[3]:GetNumber(); - core.DB.DKPBonus.NewBossKillBonus = CommDKP.ConfigTab4.default[4]:GetNumber(); - core.DB.DKPBonus.UnexcusedAbsence = CommDKP.ConfigTab4.default[5]:GetNumber(); - if CommDKP.ConfigTab4.default[6]:GetNumber() < 0 then - core.DB.DKPBonus.DecayPercentage = 0 - CommDKP.ConfigTab4.default[6]:GetNumber(); - else - core.DB.DKPBonus.DecayPercentage = CommDKP.ConfigTab4.default[6]:GetNumber(); - end - CommDKP.ConfigTab2.decayDKP:SetNumber(core.DB.DKPBonus.DecayPercentage); - CommDKP.ConfigTab4.default[6]:SetNumber(core.DB.DKPBonus.DecayPercentage) - core.DB.DKPBonus.BidTimer = CommDKP.ConfigTab4.bidTimer:GetNumber(); - - core.DB.MinBidBySlot.Head = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:GetNumber() - core.DB.MinBidBySlot.Neck = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2]:GetNumber() - core.DB.MinBidBySlot.Shoulders = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3]:GetNumber() - core.DB.MinBidBySlot.Cloak = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4]:GetNumber() - core.DB.MinBidBySlot.Chest = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5]:GetNumber() - core.DB.MinBidBySlot.Bracers = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6]:GetNumber() - core.DB.MinBidBySlot.Hands = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7]:GetNumber() - core.DB.MinBidBySlot.Belt = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8]:GetNumber() - core.DB.MinBidBySlot.Legs = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:GetNumber() - core.DB.MinBidBySlot.Boots = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10]:GetNumber() - core.DB.MinBidBySlot.Ring = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11]:GetNumber() - core.DB.MinBidBySlot.Trinket = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12]:GetNumber() - core.DB.MinBidBySlot.OneHanded = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13]:GetNumber() - core.DB.MinBidBySlot.TwoHanded = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:GetNumber() - core.DB.MinBidBySlot.OffHand = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15]:GetNumber() - core.DB.MinBidBySlot.Range = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16]:GetNumber() - core.DB.MinBidBySlot.Other = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:GetNumber() - - if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then - core.DB.MaxBidBySlot.Head = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1]:GetNumber() - core.DB.MaxBidBySlot.Neck = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2]:GetNumber() - core.DB.MaxBidBySlot.Shoulders = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3]:GetNumber() - core.DB.MaxBidBySlot.Cloak = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4]:GetNumber() - core.DB.MaxBidBySlot.Chest = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5]:GetNumber() - core.DB.MaxBidBySlot.Bracers = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6]:GetNumber() - core.DB.MaxBidBySlot.Hands = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7]:GetNumber() - core.DB.MaxBidBySlot.Belt = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8]:GetNumber() - core.DB.MaxBidBySlot.Legs = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:GetNumber() - core.DB.MaxBidBySlot.Boots = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10]:GetNumber() - core.DB.MaxBidBySlot.Ring = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11]:GetNumber() - core.DB.MaxBidBySlot.Trinket = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12]:GetNumber() - core.DB.MaxBidBySlot.OneHanded = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13]:GetNumber() - core.DB.MaxBidBySlot.TwoHanded = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:GetNumber() - core.DB.MaxBidBySlot.OffHand = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15]:GetNumber() - core.DB.MaxBidBySlot.Range = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16]:GetNumber() - core.DB.MaxBidBySlot.Other = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:GetNumber() - end - end - - core.CommDKPUI:SetScale(core.DB.defaults.CommDKPScaleSize); - core.DB.defaults.HistoryLimit = CommDKP.ConfigTab4.history:GetNumber(); - core.DB.defaults.DKPHistoryLimit = CommDKP.ConfigTab4.DKPHistory:GetNumber(); - core.DB.defaults.TooltipHistoryCount = CommDKP.ConfigTab4.TooltipHistory:GetNumber(); - CommDKP:DKPTable_Update() -end - -function CommDKP:Options() - local default = {} - CommDKP.ConfigTab4.default = default; - CommDKP:CheckOfficer() - CommDKP.ConfigTab4.header = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.header:SetFontObject("CommDKPLargeCenter"); - CommDKP.ConfigTab4.header:SetPoint("TOPLEFT", CommDKP.ConfigTab4, "TOPLEFT", 15, -10); - CommDKP.ConfigTab4.header:SetText(L["DEFAULTSETTINGS"]); - CommDKP.ConfigTab4.header:SetScale(1.2) - - if core.IsOfficer == true then - CommDKP.ConfigTab4.description = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.description:SetFontObject("CommDKPNormalLeft"); - CommDKP.ConfigTab4.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.header, "BOTTOMLEFT", 7, -15); - CommDKP.ConfigTab4.description:SetText("|CFFcca600"..L["DEFAULTDKPAWARDVALUES"].."|r"); - - for i=1, 6 do - CommDKP.ConfigTab4.default[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.default[i]:SetAutoFocus(false) - CommDKP.ConfigTab4.default[i]:SetMultiLine(false) - CommDKP.ConfigTab4.default[i]:SetSize(80, 24) - CommDKP.ConfigTab4.default[i]:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.default[i]:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.default[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.default[i]:SetMaxLetters(6) - CommDKP.ConfigTab4.default[i]:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.default[i]:SetFontObject("CommDKPSmallRight") - CommDKP.ConfigTab4.default[i]:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.default[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.default[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.default[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc - SaveSettings() - if i == 6 then - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:HighlightText() - else - self:HighlightText(0,0) - CommDKP.ConfigTab4.default[i+1]:SetFocus() - CommDKP.ConfigTab4.default[i+1]:HighlightText() - end - end) - CommDKP.ConfigTab4.default[i]:SetScript("OnEnter", function(self) - if (self.tooltipText) then - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); - end - if (self.tooltipDescription) then - GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end - if (self.tooltipWarning) then - GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); - GameTooltip:Show(); - end - end) - CommDKP.ConfigTab4.default[i]:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - if i==1 then - CommDKP.ConfigTab4.default[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4, "TOPLEFT", 144, -84) - elseif i==4 then - CommDKP.ConfigTab4.default[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.default[1], "TOPLEFT", 212, 0) - else - CommDKP.ConfigTab4.default[i]:SetPoint("TOP", CommDKP.ConfigTab4.default[i-1], "BOTTOM", 0, -22) - end - end - - -- Modes Button - CommDKP.ConfigTab4.ModesButton = self:CreateButton("TOPRIGHT", CommDKP.ConfigTab4, "TOPRIGHT", -40, -20, L["DKPMODES"]); - CommDKP.ConfigTab4.ModesButton:SetSize(110,25) - CommDKP.ConfigTab4.ModesButton:SetScript("OnClick", function() - CommDKP:ToggleDKPModesWindow() - end); - CommDKP.ConfigTab4.ModesButton:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["DKPMODES"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["DKPMODESTTDESC2"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["DKPMODESTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.ModesButton:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - if not core.IsOfficer then - CommDKP.ConfigTab4.ModesButton:Hide() - end - CommDKP.ConfigTab4.default[1]:SetText(core.DB.DKPBonus.OnTimeBonus) - CommDKP.ConfigTab4.default[1].tooltipText = L["ONTIMEBONUS"] - CommDKP.ConfigTab4.default[1].tooltipDescription = L["ONTIMEBONUSTTDESC"] - - CommDKP.ConfigTab4.default[2]:SetText(core.DB.DKPBonus.BossKillBonus) - CommDKP.ConfigTab4.default[2].tooltipText = L["BOSSKILLBONUS"] - CommDKP.ConfigTab4.default[2].tooltipDescription = L["BOSSKILLBONUSTTDESC"] - - CommDKP.ConfigTab4.default[3]:SetText(core.DB.DKPBonus.CompletionBonus) - CommDKP.ConfigTab4.default[3].tooltipText = L["RAIDCOMPLETIONBONUS"] - CommDKP.ConfigTab4.default[3].tooltipDescription = L["RAIDCOMPLETEBONUSTT"] - - CommDKP.ConfigTab4.default[4]:SetText(core.DB.DKPBonus.NewBossKillBonus) - CommDKP.ConfigTab4.default[4].tooltipText = L["NEWBOSSKILLBONUS"] - CommDKP.ConfigTab4.default[4].tooltipDescription = L["NEWBOSSKILLTTDESC"] - - CommDKP.ConfigTab4.default[5]:SetText(core.DB.DKPBonus.UnexcusedAbsence) - CommDKP.ConfigTab4.default[5]:SetNumeric(false) - CommDKP.ConfigTab4.default[5].tooltipText = L["UNEXCUSEDABSENCE"] - CommDKP.ConfigTab4.default[5].tooltipDescription = L["UNEXCUSEDTTDESC"] - CommDKP.ConfigTab4.default[5].tooltipWarning = L["UNEXCUSEDTTWARN"] - - CommDKP.ConfigTab4.default[6]:SetText(core.DB.DKPBonus.DecayPercentage) - CommDKP.ConfigTab4.default[6]:SetTextInsets(0, 15, 0, 0) - CommDKP.ConfigTab4.default[6].tooltipText = L["DECAYPERCENTAGE"] - CommDKP.ConfigTab4.default[6].tooltipDescription = L["DECAYPERCENTAGETTDESC"] - CommDKP.ConfigTab4.default[6].tooltipWarning = L["DECAYPERCENTAGETTWARN"] - - --OnTimeBonus Header - CommDKP.ConfigTab4.OnTimeHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.OnTimeHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.OnTimeHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[1], "LEFT", 0, 0); - CommDKP.ConfigTab4.OnTimeHeader:SetText(L["ONTIMEBONUS"]..": ") - - --BossKillBonus Header - CommDKP.ConfigTab4.BossKillHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.BossKillHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.BossKillHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[2], "LEFT", 0, 0); - CommDKP.ConfigTab4.BossKillHeader:SetText(L["BOSSKILLBONUS"]..": ") - - --CompletionBonus Header - CommDKP.ConfigTab4.CompleteHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.CompleteHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.CompleteHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[3], "LEFT", 0, 0); - CommDKP.ConfigTab4.CompleteHeader:SetText(L["RAIDCOMPLETIONBONUS"]..": ") - - --NewBossKillBonus Header - CommDKP.ConfigTab4.NewBossHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.NewBossHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.NewBossHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[4], "LEFT", 0, 0); - CommDKP.ConfigTab4.NewBossHeader:SetText(L["NEWBOSSKILLBONUS"]..": ") - - --UnexcusedAbsence Header - CommDKP.ConfigTab4.UnexcusedHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.UnexcusedHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.UnexcusedHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[5], "LEFT", 0, 0); - CommDKP.ConfigTab4.UnexcusedHeader:SetText(L["UNEXCUSEDABSENCE"]..": ") - - --DKP Decay Header - CommDKP.ConfigTab4.DecayHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DecayHeader:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.DecayHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[6], "LEFT", 0, 0); - CommDKP.ConfigTab4.DecayHeader:SetText(L["DECAYAMOUNT"]..": ") - - CommDKP.ConfigTab4.DecayFooter = CommDKP.ConfigTab4.default[6]:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DecayFooter:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.DecayFooter:SetPoint("LEFT", CommDKP.ConfigTab4.default[6], "RIGHT", -15, -1); - CommDKP.ConfigTab4.DecayFooter:SetText("%") - - -- Default Minimum Bids Container Frame - CommDKP.ConfigTab4.DefaultMinBids = CreateFrame("Frame", nil, CommDKP.ConfigTab4); - CommDKP.ConfigTab4.DefaultMinBids:SetPoint("TOPLEFT", CommDKP.ConfigTab4.default[3], "BOTTOMLEFT", -130, -52) - CommDKP.ConfigTab4.DefaultMinBids:SetSize(420, 410); - - CommDKP.ConfigTab4.DefaultMinBids.description = CommDKP.ConfigTab4.DefaultMinBids:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMinBids.description:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.DefaultMinBids.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "TOPLEFT", 15, 15); - -- DEFAULT min bids Create EditBoxes - local SlotBox = {} - CommDKP.ConfigTab4.DefaultMinBids.SlotBox = SlotBox; - - for i=1, 17 do - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetAutoFocus(false) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetMultiLine(false) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetSize(60, 24) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetMaxLetters(6) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetFontObject("CommDKPSmallRight") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc - if i == 8 then - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:HighlightText() - SaveSettings() - elseif i == 5 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:HighlightText() - SaveSettings() - elseif i == 13 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:HighlightText() - SaveSettings() - elseif i == 17 then - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:HighlightText() - SaveSettings() - elseif i == 16 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(1) - CommDKP.ConfigTab4.default[1]:SetFocus() - CommDKP.ConfigTab4.default[1]:HighlightText() - SaveSettings() - else - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:SetFocus() - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:HighlightText() - SaveSettings() - end - end) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEnter", function(self) - if (self.tooltipText) then - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); - end - if (self.tooltipDescription) then - GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end - if (self.tooltipWarning) then - GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); - GameTooltip:Show(); - end - end) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - -- Slot Headers - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header = CommDKP.ConfigTab4.DefaultMinBids:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header:SetFontObject("CommDKPNormalLeft"); - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header:SetPoint("RIGHT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i], "LEFT", 0, 0); - - if i==1 then - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "TOPLEFT", 100, -10) - elseif i==9 then - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1], "TOPLEFT", 150, 0) - elseif i==17 then - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8], "BOTTOM", 0, -22) - else - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i-1], "BOTTOM", 0, -22) - end - end - - local prefix; - if core.DB.modes.mode == "Minimum Bid Values" then - prefix = L["MINIMUMBID"]; - CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTMINBIDVALUES"].."|r"); - elseif core.DB.modes.mode == "Static Item Values" then - CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); - if core.DB.modes.costvalue == "Integer" then - prefix = L["DKPPRICE"] - elseif core.DB.modes.costvalue == "Percent" then - prefix = L["PERCENTCOST"] - end - elseif core.DB.modes.mode == "Roll Based Bidding" then - CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); - if core.DB.modes.costvalue == "Integer" then - prefix = L["DKPPRICE"] - elseif core.DB.modes.costvalue == "Percent" then - prefix = L["PERCENTCOST"] - end - elseif core.DB.modes.mode == "Zero Sum" then - CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); - if core.DB.modes.costvalue == "Integer" then - prefix = L["DKPPRICE"] - elseif core.DB.modes.costvalue == "Percent" then - prefix = L["PERCENTCOST"] - end - end - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].Header:SetText(L["HEAD"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:SetText(core.DB.MinBidBySlot.Head) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].tooltipText = L["HEAD"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].tooltipDescription = prefix.." "..L["FORHEADSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].Header:SetText(L["NECK"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2]:SetText(core.DB.MinBidBySlot.Neck) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].tooltipText = L["NECK"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].tooltipDescription = prefix.." "..L["FORNECKSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].Header:SetText(L["SHOULDERS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3]:SetText(core.DB.MinBidBySlot.Shoulders) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].tooltipText = L["SHOULDERS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].tooltipDescription = prefix.." "..L["FORSHOULDERSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].Header:SetText(L["CLOAK"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4]:SetText(core.DB.MinBidBySlot.Cloak) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].tooltipText = L["CLOAK"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].tooltipDescription = prefix.." "..L["FORBACKSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].Header:SetText(L["CHEST"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5]:SetText(core.DB.MinBidBySlot.Chest) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].tooltipText = L["CHEST"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].tooltipDescription = prefix.." "..L["FORCHESTSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].Header:SetText(L["BRACERS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6]:SetText(core.DB.MinBidBySlot.Bracers) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].tooltipText = L["BRACERS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].tooltipDescription = prefix.." "..L["FORWRISTSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].Header:SetText(L["HANDS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7]:SetText(core.DB.MinBidBySlot.Hands) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].tooltipText = L["HANDS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].tooltipDescription = prefix.." "..L["FORHANDSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].Header:SetText(L["BELT"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8]:SetText(core.DB.MinBidBySlot.Belt) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].tooltipText = L["BELT"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].tooltipDescription = prefix.." "..L["FORWAISTSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].Header:SetText(L["LEGS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:SetText(core.DB.MinBidBySlot.Legs) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].tooltipText = L["LEGS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].tooltipDescription = prefix.." "..L["FORLEGSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].Header:SetText(L["BOOTS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10]:SetText(core.DB.MinBidBySlot.Boots) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].tooltipText = L["BOOTS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].tooltipDescription = prefix.." "..L["FORFEETSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].Header:SetText(L["RINGS"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11]:SetText(core.DB.MinBidBySlot.Ring) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].tooltipText = L["RINGS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].tooltipDescription = prefix.." "..L["FORFINGERSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].Header:SetText(L["TRINKET"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12]:SetText(core.DB.MinBidBySlot.Trinket) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].tooltipText = L["TRINKET"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].tooltipDescription = prefix.." "..L["FORTRINKETSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].Header:SetText(L["ONEHANDED"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13]:SetText(core.DB.MinBidBySlot.OneHanded) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].tooltipText = L["ONEHANDEDWEAPONS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].tooltipDescription = prefix.." "..L["FORONEHANDSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].Header:SetText(L["TWOHANDED"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:SetText(core.DB.MinBidBySlot.TwoHanded) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].tooltipText = L["TWOHANDEDWEAPONS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].tooltipDescription = prefix.." "..L["FORTWOHANDSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].Header:SetText(L["OFFHAND"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15]:SetText(core.DB.MinBidBySlot.OffHand) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].tooltipText = L["OFFHANDITEMS"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].tooltipDescription = prefix.." "..L["FOROFFHANDSLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].Header:SetText(L["RANGE"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16]:SetText(core.DB.MinBidBySlot.Range) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].tooltipText = L["RANGE"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].tooltipDescription = prefix.." "..L["FORRANGESLOT"] - - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].Header:SetText(L["OTHER"]..": ") - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:SetText(core.DB.MinBidBySlot.Other) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].tooltipText = L["OTHER"] - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].tooltipDescription = prefix.." "..L["FOROTHERSLOT"] - - if core.DB.modes.costvalue == "Percent" then - for i=1, #CommDKP.ConfigTab4.DefaultMinBids.SlotBox do - DrawPercFrame(i) - CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextInsets(0, 15, 0, 0) - end - end - -- Broadcast Minimum Bids Button - CommDKP.ConfigTab4.BroadcastMinBids = self:CreateButton("TOP", CommDKP.ConfigTab4, "BOTTOM", 30, 30, L["BCASTVALUES"]); - CommDKP.ConfigTab4.BroadcastMinBids:ClearAllPoints(); - CommDKP.ConfigTab4.BroadcastMinBids:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17], "RIGHT", 41, 0) - CommDKP.ConfigTab4.BroadcastMinBids:SetSize(110,25) - CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnClick", function() - StaticPopupDialogs["SEND_MINBIDS"] = { - text = L["BCASTMINBIDCONFIRM"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = function() - local temptable = {} - table.insert(temptable, core.DB.MinBidBySlot) - local teams = CommDKP:GetGuildTeamList(true); - local teamTable = {} - - for k, v in pairs(teams) do - local teamIndex = tostring(v.index); - table.insert(teamTable, {teamIndex, CommDKP:GetTable(CommDKP_MinBids, true, teamIndex)}); - end - table.insert(temptable, teamTable); - CommDKP.Sync:SendData("CommDKPMinBid", temptable) - CommDKP:Print(L["MINBIDVALUESSENT"]) - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("SEND_MINBIDS") - end); - CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["BCASTVALUES"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["BCASTVALUESTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["BCASTVALUESTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - -- Default Maximum Bids Container Frame - if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then - CommDKP.ConfigTab4.DefaultMaxBids = CreateFrame("Frame", nil, CommDKP.ConfigTab4); - CommDKP.ConfigTab4.DefaultMaxBids:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "BOTTOMLEFT", 0, -52) - CommDKP.ConfigTab4.DefaultMaxBids:SetSize(420, 410); - - CommDKP.ConfigTab4.DefaultMaxBids.description = CommDKP.ConfigTab4.DefaultMaxBids:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMaxBids.description:SetFontObject("CommDKPSmallRight"); - CommDKP.ConfigTab4.DefaultMaxBids.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "TOPLEFT", 15, 15); - - -- DEFAULT Max bids Create EditBoxes - local SlotBox = {} - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox = SlotBox; - - for i=1, 17 do - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetAutoFocus(false) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetMultiLine(false) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetSize(60, 24) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetMaxLetters(6) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetFontObject("CommDKPSmallRight") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:HighlightText(0,0) - SaveSettings() - self:ClearFocus() - end) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc - if i == 8 then - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:SetFocus() - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:HighlightText() - SaveSettings() - elseif i == 5 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:SetFocus() - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:HighlightText() - SaveSettings() - elseif i == 13 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:SetFocus() - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:HighlightText() - SaveSettings() - elseif i == 17 then - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:SetFocus() - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:HighlightText() - SaveSettings() - elseif i == 16 then - self:HighlightText(0,0) - CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(1) - CommDKP.ConfigTab4.default[1]:SetFocus() - CommDKP.ConfigTab4.default[1]:HighlightText() - SaveSettings() - else - self:HighlightText(0,0) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:SetFocus() - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:HighlightText() - SaveSettings() - end - end) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEnter", function(self) - if (self.tooltipText) then - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); - end - if (self.tooltipDescription) then - GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end - if (self.tooltipWarning) then - GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); - GameTooltip:Show(); - end - end) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - -- Slot Headers - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header = CommDKP.ConfigTab4.DefaultMaxBids:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header:SetFontObject("CommDKPNormalLeft"); - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header:SetPoint("RIGHT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i], "LEFT", 0, 0); - - if i==1 then - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "TOPLEFT", 100, -10) - elseif i==9 then - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1], "TOPLEFT", 150, 0) - elseif i==17 then - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8], "BOTTOM", 0, -22) - else - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i-1], "BOTTOM", 0, -22) - end - end - - local prefix; - - prefix = L["MAXIMUMBID"]; - CommDKP.ConfigTab4.DefaultMaxBids.description:SetText("|CFFcca600"..L["DEFAULTMAXBIDVALUES"].."|r"); - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].Header:SetText(L["HEAD"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1]:SetText(core.DB.MaxBidBySlot.Head) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].tooltipText = L["HEAD"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].tooltipDescription = prefix.." "..L["FORHEADSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].Header:SetText(L["NECK"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2]:SetText(core.DB.MaxBidBySlot.Neck) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].tooltipText = L["NECK"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].tooltipDescription = prefix.." "..L["FORNECKSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].Header:SetText(L["SHOULDERS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3]:SetText(core.DB.MaxBidBySlot.Shoulders) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].tooltipText = L["SHOULDERS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].tooltipDescription = prefix.." "..L["FORSHOULDERSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].Header:SetText(L["CLOAK"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4]:SetText(core.DB.MaxBidBySlot.Cloak) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].tooltipText = L["CLOAK"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].tooltipDescription = prefix.." "..L["FORBACKSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].Header:SetText(L["CHEST"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5]:SetText(core.DB.MaxBidBySlot.Chest) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].tooltipText = L["CHEST"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].tooltipDescription = prefix.." "..L["FORCHESTSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].Header:SetText(L["BRACERS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6]:SetText(core.DB.MaxBidBySlot.Bracers) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].tooltipText = L["BRACERS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].tooltipDescription = prefix.." "..L["FORWRISTSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].Header:SetText(L["HANDS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7]:SetText(core.DB.MaxBidBySlot.Hands) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].tooltipText = L["HANDS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].tooltipDescription = prefix.." "..L["FORHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].Header:SetText(L["BELT"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8]:SetText(core.DB.MaxBidBySlot.Belt) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].tooltipText = L["BELT"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].tooltipDescription = prefix.." "..L["FORWAISTSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].Header:SetText(L["LEGS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:SetText(core.DB.MaxBidBySlot.Legs) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].tooltipText = L["LEGS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].tooltipDescription = prefix.." "..L["FORLEGSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].Header:SetText(L["BOOTS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10]:SetText(core.DB.MaxBidBySlot.Boots) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].tooltipText = L["BOOTS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].tooltipDescription = prefix.." "..L["FORFEETSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].Header:SetText(L["RINGS"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11]:SetText(core.DB.MaxBidBySlot.Ring) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].tooltipText = L["RINGS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].tooltipDescription = prefix.." "..L["FORFINGERSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].Header:SetText(L["TRINKET"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12]:SetText(core.DB.MaxBidBySlot.Trinket) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].tooltipText = L["TRINKET"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].tooltipDescription = prefix.." "..L["FORTRINKETSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].Header:SetText(L["ONEHANDED"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13]:SetText(core.DB.MaxBidBySlot.OneHanded) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].tooltipText = L["ONEHANDEDWEAPONS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].tooltipDescription = prefix.." "..L["FORONEHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].Header:SetText(L["TWOHANDED"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:SetText(core.DB.MaxBidBySlot.TwoHanded) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].tooltipText = L["TWOHANDEDWEAPONS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].tooltipDescription = prefix.." "..L["FORTWOHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].Header:SetText(L["OFFHAND"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15]:SetText(core.DB.MaxBidBySlot.OffHand) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].tooltipText = L["OFFHANDITEMS"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].tooltipDescription = prefix.." "..L["FOROFFHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].Header:SetText(L["RANGE"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16]:SetText(core.DB.MaxBidBySlot.Range) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].tooltipText = L["RANGE"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].tooltipDescription = prefix.." "..L["FORRANGESLOT"].." "..L["MAXIMUMBIDTTDESC"] - - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].Header:SetText(L["OTHER"]..": ") - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:SetText(core.DB.MaxBidBySlot.Other) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].tooltipText = L["OTHER"] - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].tooltipDescription = prefix.." "..L["FOROTHERSLOT"].." "..L["MAXIMUMBIDTTDESC"] - - if core.DB.modes.costvalue == "Percent" then - for i=1, #CommDKP.ConfigTab4.DefaultMaxBids.SlotBox do - DrawPercFrame(i) - CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextInsets(0, 15, 0, 0) - end - end - -- Broadcast Maximum Bids Button - CommDKP.ConfigTab4.BroadcastMaxBids = self:CreateButton("TOP", CommDKP.ConfigTab4, "BOTTOM", 30, 30, L["BCASTVALUES"]); - CommDKP.ConfigTab4.BroadcastMaxBids:ClearAllPoints(); - CommDKP.ConfigTab4.BroadcastMaxBids:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17], "RIGHT", 41, 0) - CommDKP.ConfigTab4.BroadcastMaxBids:SetSize(110,25) - CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnClick", function() - StaticPopupDialogs["SEND_MAXBIDS"] = { - text = L["BCASTMAXBIDCONFIRM"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = function() - local temptable = {} - table.insert(temptable, core.DB.MaxBidBySlot) - local teams = CommDKP:GetGuildTeamList(true); - local teamTable = {} - - for k, v in pairs(teams) do - local teamIndex = tostring(v.index); - table.insert(teamTable, {teamIndex, CommDKP:GetTable(CommDKP_MaxBids, true, teamIndex)}); - end - table.insert(temptable, teamTable); - CommDKP.Sync:SendData("CommDKPMaxBid", temptable) - CommDKP:Print(L["MAXBIDVALUESSENT"]) - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("SEND_MAXBIDS") - end); - CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["BCASTVALUES"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["BCASTVALUESTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["BCASTVALUESTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - end - -- Bid Timer Slider - CommDKP.ConfigTab4.bidTimerSlider = CreateFrame("SLIDER", "$parentBidTimerSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - Mixin(CommDKP.ConfigTab4.bidTimerSlider, BackdropTemplateMixin) - CommDKP.ConfigTab4.bidTimerSlider:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then - CommDKP.ConfigTab4.bidTimerSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "BOTTOMLEFT", 54, -40); - else - CommDKP.ConfigTab4.bidTimerSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "BOTTOMLEFT", 54, -40); - end - CommDKP.ConfigTab4.bidTimerSlider:SetMinMaxValues(10, 90); - CommDKP.ConfigTab4.bidTimerSlider:SetValue(core.DB.DKPBonus.BidTimer); - CommDKP.ConfigTab4.bidTimerSlider:SetValueStep(1); - CommDKP.ConfigTab4.bidTimerSlider.tooltipText = L["BIDTIMER"] - CommDKP.ConfigTab4.bidTimerSlider.tooltipRequirement = L["BIDTIMERDEFAULTTTDESC"] - CommDKP.ConfigTab4.bidTimerSlider:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.bidTimerSlider:GetName().."Low"):SetText("10") - getglobal(CommDKP.ConfigTab4.bidTimerSlider:GetName().."High"):SetText("90") - CommDKP.ConfigTab4.bidTimerSlider:SetScript("OnValueChanged", function(self) -- clears focus on esc - CommDKP.ConfigTab4.bidTimer:SetText(CommDKP.ConfigTab4.bidTimerSlider:GetValue()) - end) - - CommDKP.ConfigTab4.bidTimerHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.bidTimerHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.bidTimerHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.bidTimerSlider, "TOP", 0, 3); - CommDKP.ConfigTab4.bidTimerHeader:SetText(L["BIDTIMER"]) - - CommDKP.ConfigTab4.bidTimer = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.bidTimer:SetAutoFocus(false) - CommDKP.ConfigTab4.bidTimer:SetMultiLine(false) - CommDKP.ConfigTab4.bidTimer:SetSize(50, 18) - CommDKP.ConfigTab4.bidTimer:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.bidTimer:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.bidTimer:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.bidTimer:SetMaxLetters(4) - CommDKP.ConfigTab4.bidTimer:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.bidTimer:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.bidTimer:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.bidTimer:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.bidTimer:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.bidTimer:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.bidTimerSlider:SetValue(CommDKP.ConfigTab4.bidTimer:GetNumber()); - end) - CommDKP.ConfigTab4.bidTimer:SetPoint("TOP", CommDKP.ConfigTab4.bidTimerSlider, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.bidTimer:SetText(CommDKP.ConfigTab4.bidTimerSlider:GetValue()) - end -- the end - - -- Tooltip History Slider - CommDKP.ConfigTab4.TooltipHistorySlider = CreateFrame("SLIDER", "$parentTooltipHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - if CommDKP.ConfigTab4.bidTimer then - CommDKP.ConfigTab4.TooltipHistorySlider:SetPoint("LEFT", CommDKP.ConfigTab4.bidTimerSlider, "RIGHT", 30, 0); - else - CommDKP.ConfigTab4.TooltipHistorySlider:SetPoint("TOP", CommDKP.ConfigTab4, "TOP", 1, -107); - end - - Mixin(CommDKP.ConfigTab4.TooltipHistorySlider, BackdropTemplateMixin) - CommDKP.ConfigTab4.TooltipHistorySlider:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - - CommDKP.ConfigTab4.TooltipHistorySlider:SetMinMaxValues(5, 35); - CommDKP.ConfigTab4.TooltipHistorySlider:SetValue(core.DB.defaults.TooltipHistoryCount); - CommDKP.ConfigTab4.TooltipHistorySlider:SetValueStep(1); - CommDKP.ConfigTab4.TooltipHistorySlider.tooltipText = L["TTHISTORYCOUNT"] - CommDKP.ConfigTab4.TooltipHistorySlider.tooltipRequirement = L["TTHISTORYCOUNTTTDESC"] - CommDKP.ConfigTab4.TooltipHistorySlider:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.TooltipHistorySlider:GetName().."Low"):SetText("5") - getglobal(CommDKP.ConfigTab4.TooltipHistorySlider:GetName().."High"):SetText("35") - CommDKP.ConfigTab4.TooltipHistorySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc - CommDKP.ConfigTab4.TooltipHistory:SetText(CommDKP.ConfigTab4.TooltipHistorySlider:GetValue()) - end) - - CommDKP.ConfigTab4.TooltipHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.TooltipHistoryHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.TooltipHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.TooltipHistorySlider, "TOP", 0, 3); - CommDKP.ConfigTab4.TooltipHistoryHeader:SetText(L["TTHISTORYCOUNT"]) - - CommDKP.ConfigTab4.TooltipHistory = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.TooltipHistory:SetAutoFocus(false) - CommDKP.ConfigTab4.TooltipHistory:SetMultiLine(false) - CommDKP.ConfigTab4.TooltipHistory:SetSize(50, 18) - CommDKP.ConfigTab4.TooltipHistory:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.TooltipHistory:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.TooltipHistory:SetBackdropBorderColor(0.12,0.12, 0.34, 1) - CommDKP.ConfigTab4.TooltipHistory:SetMaxLetters(4) - CommDKP.ConfigTab4.TooltipHistory:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.TooltipHistory:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.TooltipHistory:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.TooltipHistorySlider:SetValue(CommDKP.ConfigTab4.TooltipHistory:GetNumber()); - end) - CommDKP.ConfigTab4.TooltipHistory:SetPoint("TOP", CommDKP.ConfigTab4.TooltipHistorySlider, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.TooltipHistory:SetText(CommDKP.ConfigTab4.TooltipHistorySlider:GetValue()) - - - -- Loot History Limit Slider - CommDKP.ConfigTab4.historySlider = CreateFrame("SLIDER", "$parentHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - - if CommDKP.ConfigTab4.bidTimer then - CommDKP.ConfigTab4.historySlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.bidTimerSlider, "BOTTOMLEFT", 0, -50); - else - CommDKP.ConfigTab4.historySlider:SetPoint("TOPRIGHT", CommDKP.ConfigTab4.TooltipHistorySlider, "BOTTOMLEFT", 56, -49); - end - - Mixin(CommDKP.ConfigTab4.historySlider, BackdropTemplateMixin) - CommDKP.ConfigTab4.historySlider:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - - CommDKP.ConfigTab4.historySlider:SetMinMaxValues(100, 2500); - CommDKP.ConfigTab4.historySlider:SetValue(core.DB.defaults.HistoryLimit); - CommDKP.ConfigTab4.historySlider:SetValueStep(25); - CommDKP.ConfigTab4.historySlider.tooltipText = L["LOOTHISTORYLIMIT"] - CommDKP.ConfigTab4.historySlider.tooltipRequirement = L["LOOTHISTLIMITTTDESC"] - CommDKP.ConfigTab4.historySlider.tooltipWarning = L["LOOTHISTLIMITTTWARN"] - CommDKP.ConfigTab4.historySlider:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.historySlider:GetName().."Low"):SetText("100") - getglobal(CommDKP.ConfigTab4.historySlider:GetName().."High"):SetText("2500") - CommDKP.ConfigTab4.historySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc - CommDKP.ConfigTab4.history:SetText(CommDKP.ConfigTab4.historySlider:GetValue()) - end) - - CommDKP.ConfigTab4.HistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.HistoryHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.HistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.historySlider, "TOP", 0, 3); - CommDKP.ConfigTab4.HistoryHeader:SetText(L["LOOTHISTORYLIMIT"]) - - CommDKP.ConfigTab4.history = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.history:SetAutoFocus(false) - CommDKP.ConfigTab4.history:SetMultiLine(false) - CommDKP.ConfigTab4.history:SetSize(50, 18) - CommDKP.ConfigTab4.history:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.history:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.history:SetBackdropBorderColor(0.12,0.12, 0.34, 1) - CommDKP.ConfigTab4.history:SetMaxLetters(4) - CommDKP.ConfigTab4.history:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.history:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.history:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.history:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.history:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.history:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.historySlider:SetValue(CommDKP.ConfigTab4.history:GetNumber()); - end) - CommDKP.ConfigTab4.history:SetPoint("TOP", CommDKP.ConfigTab4.historySlider, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.history:SetText(CommDKP.ConfigTab4.historySlider:GetValue()) - - -- DKP History Limit Slider - CommDKP.ConfigTab4.DKPHistorySlider = CreateFrame("SLIDER", "$parentDKPHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - Mixin(CommDKP.ConfigTab4.DKPHistorySlider, BackdropTemplateMixin) - CommDKP.ConfigTab4.DKPHistorySlider:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - CommDKP.ConfigTab4.DKPHistorySlider:SetPoint("LEFT", CommDKP.ConfigTab4.historySlider, "RIGHT", 30, 0); - CommDKP.ConfigTab4.DKPHistorySlider:SetMinMaxValues(100, 2500); - CommDKP.ConfigTab4.DKPHistorySlider:SetValue(core.DB.defaults.DKPHistoryLimit); - CommDKP.ConfigTab4.DKPHistorySlider:SetValueStep(25); - CommDKP.ConfigTab4.DKPHistorySlider.tooltipText = L["DKPHISTORYLIMIT"] - CommDKP.ConfigTab4.DKPHistorySlider.tooltipRequirement = L["DKPHISTLIMITTTDESC"] - CommDKP.ConfigTab4.DKPHistorySlider.tooltipWarning = L["DKPHISTLIMITTTWARN"] - CommDKP.ConfigTab4.DKPHistorySlider:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.DKPHistorySlider:GetName().."Low"):SetText("100") - getglobal(CommDKP.ConfigTab4.DKPHistorySlider:GetName().."High"):SetText("2500") - CommDKP.ConfigTab4.DKPHistorySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc - CommDKP.ConfigTab4.DKPHistory:SetText(CommDKP.ConfigTab4.DKPHistorySlider:GetValue()) - end) - - CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.DKPHistorySlider, "TOP", 0, 3); - CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["DKPHISTORYLIMIT"]) - - CommDKP.ConfigTab4.DKPHistory = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.DKPHistory:SetAutoFocus(false) - CommDKP.ConfigTab4.DKPHistory:SetMultiLine(false) - CommDKP.ConfigTab4.DKPHistory:SetSize(50, 18) - CommDKP.ConfigTab4.DKPHistory:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.DKPHistory:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.DKPHistory:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.DKPHistory:SetMaxLetters(4) - CommDKP.ConfigTab4.DKPHistory:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.DKPHistory:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.DKPHistory:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.DKPHistory:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.DKPHistory:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.DKPHistory:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.DKPHistorySlider:SetValue(CommDKP.ConfigTab4.history:GetNumber()); - end) - CommDKP.ConfigTab4.DKPHistory:SetPoint("TOP", CommDKP.ConfigTab4.DKPHistorySlider, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.DKPHistory:SetText(CommDKP.ConfigTab4.DKPHistorySlider:GetValue()) - - -- Bid Timer Size Slider - CommDKP.ConfigTab4.TimerSizeSlider = CreateFrame("SLIDER", "$parentBidTimerSizeSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - Mixin(CommDKP.ConfigTab4.TimerSizeSlider, BackdropTemplateMixin) - CommDKP.ConfigTab4.TimerSizeSlider:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - CommDKP.ConfigTab4.TimerSizeSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.historySlider, "BOTTOMLEFT", 0, -50); - CommDKP.ConfigTab4.TimerSizeSlider:SetMinMaxValues(0.5, 2.0); - CommDKP.ConfigTab4.TimerSizeSlider:SetValue(core.DB.defaults.BidTimerSize); - CommDKP.ConfigTab4.TimerSizeSlider:SetValueStep(0.05); - CommDKP.ConfigTab4.TimerSizeSlider.tooltipText = L["TIMERSIZE"] - CommDKP.ConfigTab4.TimerSizeSlider.tooltipRequirement = L["TIMERSIZETTDESC"] - CommDKP.ConfigTab4.TimerSizeSlider.tooltipWarning = L["TIMERSIZETTWARN"] - CommDKP.ConfigTab4.TimerSizeSlider:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.TimerSizeSlider:GetName().."Low"):SetText("50%") - getglobal(CommDKP.ConfigTab4.TimerSizeSlider:GetName().."High"):SetText("200%") - CommDKP.ConfigTab4.TimerSizeSlider:SetScript("OnValueChanged", function(self) - CommDKP.ConfigTab4.TimerSize:SetText(CommDKP.ConfigTab4.TimerSizeSlider:GetValue()) - core.DB.defaults.BidTimerSize = CommDKP.ConfigTab4.TimerSizeSlider:GetValue(); - CommDKP.BidTimer:SetScale(core.DB.defaults.BidTimerSize); - end) - - CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.TimerSizeSlider, "TOP", 0, 3); - CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["TIMERSIZE"]) - - CommDKP.ConfigTab4.TimerSize = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.TimerSize:SetAutoFocus(false) - CommDKP.ConfigTab4.TimerSize:SetMultiLine(false) - CommDKP.ConfigTab4.TimerSize:SetSize(50, 18) - CommDKP.ConfigTab4.TimerSize:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.TimerSize:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.TimerSize:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.TimerSize:SetMaxLetters(4) - CommDKP.ConfigTab4.TimerSize:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.TimerSize:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.TimerSize:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.TimerSize:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.TimerSize:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.TimerSize:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.TimerSizeSlider:SetValue(CommDKP.ConfigTab4.TimerSize:GetNumber()); - end) - CommDKP.ConfigTab4.TimerSize:SetPoint("TOP", CommDKP.ConfigTab4.TimerSizeSlider, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.TimerSize:SetText(CommDKP.ConfigTab4.TimerSizeSlider:GetValue()) - - -- UI Scale Size Slider - CommDKP.ConfigTab4.CommDKPScaleSize = CreateFrame("SLIDER", "$parentCommDKPScaleSizeSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); - Mixin(CommDKP.ConfigTab4.CommDKPScaleSize, BackdropTemplateMixin) - CommDKP.ConfigTab4.CommDKPScaleSize:SetBackdrop({ - bgFile = "Interface\\Buttons\\UI-SliderBar-Background", - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", - tile = true, tileSize = 8, edgeSize = 8, - insets = { left = 3, right = 3, top = 6, bottom = 6 } - }) - CommDKP.ConfigTab4.CommDKPScaleSize:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DKPHistorySlider, "BOTTOMLEFT", 0, -50); - CommDKP.ConfigTab4.CommDKPScaleSize:SetMinMaxValues(0.5, 2.0); - CommDKP.ConfigTab4.CommDKPScaleSize:SetValue(core.DB.defaults.CommDKPScaleSize); - CommDKP.ConfigTab4.CommDKPScaleSize:SetValueStep(0.05); - CommDKP.ConfigTab4.CommDKPScaleSize.tooltipText = L["CommDKPSCALESIZE"] - CommDKP.ConfigTab4.CommDKPScaleSize.tooltipRequirement = L["CommDKPSCALESIZETTDESC"] - CommDKP.ConfigTab4.CommDKPScaleSize.tooltipWarning = L["CommDKPSCALESIZETTWARN"] - CommDKP.ConfigTab4.CommDKPScaleSize:SetObeyStepOnDrag(true); - getglobal(CommDKP.ConfigTab4.CommDKPScaleSize:GetName().."Low"):SetText("50%") - getglobal(CommDKP.ConfigTab4.CommDKPScaleSize:GetName().."High"):SetText("200%") - CommDKP.ConfigTab4.CommDKPScaleSize:SetScript("OnValueChanged", function(self) - CommDKP.ConfigTab4.UIScaleSize:SetText(CommDKP.ConfigTab4.CommDKPScaleSize:GetValue()) - core.DB.defaults.CommDKPScaleSize = CommDKP.ConfigTab4.CommDKPScaleSize:GetValue(); - end) - - CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") - CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); - CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.CommDKPScaleSize, "TOP", 0, 3); - CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["MAINGUISIZE"]) - - CommDKP.ConfigTab4.UIScaleSize = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) - CommDKP.ConfigTab4.UIScaleSize:SetAutoFocus(false) - CommDKP.ConfigTab4.UIScaleSize:SetMultiLine(false) - CommDKP.ConfigTab4.UIScaleSize:SetSize(50, 18) - CommDKP.ConfigTab4.UIScaleSize:SetBackdrop({ - bgFile = "Textures\\white.blp", tile = true, - edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, - }); - CommDKP.ConfigTab4.UIScaleSize:SetBackdropColor(0,0,0,0.9) - CommDKP.ConfigTab4.UIScaleSize:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) - CommDKP.ConfigTab4.UIScaleSize:SetMaxLetters(4) - CommDKP.ConfigTab4.UIScaleSize:SetTextColor(1, 1, 1, 1) - CommDKP.ConfigTab4.UIScaleSize:SetFontObject("CommDKPTinyCenter") - CommDKP.ConfigTab4.UIScaleSize:SetTextInsets(10, 10, 5, 5) - CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEscapePressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEnterPressed", function(self) -- clears focus on esc - self:ClearFocus() - end) - CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEditFocusLost", function(self) -- clears focus on esc - CommDKP.ConfigTab4.CommDKPScaleSize:SetValue(CommDKP.ConfigTab4.UIScaleSize:GetNumber()); - end) - CommDKP.ConfigTab4.UIScaleSize:SetPoint("TOP", CommDKP.ConfigTab4.CommDKPScaleSize, "BOTTOM", 0, -3) - CommDKP.ConfigTab4.UIScaleSize:SetText(CommDKP.ConfigTab4.CommDKPScaleSize:GetValue()) - - -- Suppress Broadcast Notifications checkbox - CommDKP.ConfigTab4.SuppressNotifications = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.SuppressNotifications:SetPoint("TOP", CommDKP.ConfigTab4.TimerSizeSlider, "BOTTOMLEFT", 0, -35) - CommDKP.ConfigTab4.SuppressNotifications:SetChecked(core.DB.defaults.SuppressNotifications) - CommDKP.ConfigTab4.SuppressNotifications:SetScale(0.8) - CommDKP.ConfigTab4.SuppressNotifications.text:SetText("|cff5151de"..L["SUPPRESSNOTIFICATIONS"].."|r"); - CommDKP.ConfigTab4.SuppressNotifications.text:SetFontObject("CommDKPSmall") - CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["SUPPRESSNOTIFICATIONS"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["SUPPRESSNOTIFYTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["SUPPRESSNOTIFYTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnClick", function() - if CommDKP.ConfigTab4.SuppressNotifications:GetChecked() then - CommDKP:Print(L["NOTIFICATIONSLIKETHIS"].." |cffff0000"..L["HIDDEN"].."|r.") - core.DB["defaults"]["SuppressNotifications"] = true; - else - core.DB["defaults"]["SuppressNotifications"] = false; - CommDKP:Print(L["NOTIFICATIONSLIKETHIS"].." |cff00ff00"..L["VISIBLE"].."|r.") - end - PlaySound(808) - end) - - -- Combat Logging checkbox - CommDKP.ConfigTab4.CombatLogging = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.CombatLogging:SetPoint("TOP", CommDKP.ConfigTab4.SuppressNotifications, "BOTTOM", 0, 0) - CommDKP.ConfigTab4.CombatLogging:SetChecked(core.DB.defaults.AutoLog) - CommDKP.ConfigTab4.CombatLogging:SetScale(0.8) - CommDKP.ConfigTab4.CombatLogging.text:SetText("|cff5151de"..L["AUTOCOMBATLOG"].."|r"); - CommDKP.ConfigTab4.CombatLogging.text:SetFontObject("CommDKPSmall") - CommDKP.ConfigTab4.CombatLogging:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["AUTOCOMBATLOG"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["AUTOCOMBATLOGTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["AUTOCOMBATLOGTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.CombatLogging:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - CommDKP.ConfigTab4.CombatLogging:SetScript("OnClick", function(self) - core.DB.defaults.AutoLog = self:GetChecked() - PlaySound(808) - end) - - if core.DB.defaults.AutoOpenBid == nil then - core.DB.defaults.AutoOpenBid = true - end - - CommDKP.ConfigTab4.AutoOpenCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.AutoOpenCheckbox:SetChecked(core.DB.defaults.AutoOpenBid) - CommDKP.ConfigTab4.AutoOpenCheckbox:SetScale(0.8); - CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetText("|cff5151de"..L["AUTOOPEN"].."|r"); - CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetScale(1); - CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetFontObject("CommDKPSmallLeft") - CommDKP.ConfigTab4.AutoOpenCheckbox:SetPoint("TOP", CommDKP.ConfigTab4.CombatLogging, "BOTTOM", 0, 0); - CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnClick", function(self) - core.DB.defaults.AutoOpenBid = self:GetChecked() - end) - CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_LEFT"); - GameTooltip:SetText(L["AUTOOPEN"], 0.25, 0.75, 0.90, 1, true); - GameTooltip:AddLine(L["AUTOOPENTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end) - CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - if core.IsOfficer == true then - CommDKP.ConfigTab4.AutoAwardLootCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetChecked(core.DB.defaults.AutoAwardLoot) - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScale(0.8); - CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetText("|cff5151de"..L["AUTOAWARDLOOT"].."|r"); - CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetScale(1); - CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetFontObject("CommDKPSmallLeft") - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetPoint("TOP", CommDKP.ConfigTab4.AutoOpenCheckbox, "BOTTOM", 0, 0); - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnClick", function(self) - core.DB.defaults.AutoAwardLoot = self:GetChecked() - if core.DB.defaults.AutoAwardLoot == false then - core.DB.pendingLoot = {} - end - end) - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_LEFT"); - GameTooltip:SetText(L["AUTOAWARDLOOT"], 0.25, 0.75, 0.90, 1, true); - GameTooltip:AddLine(L["AUTOAWARDLOOTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end) - CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - -- Suppress Broadcast Notifications checkbox - CommDKP.ConfigTab4.SuppressTells = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.SuppressTells:SetPoint("LEFT", CommDKP.ConfigTab4.SuppressNotifications, "RIGHT", 200, 0) - CommDKP.ConfigTab4.SuppressTells:SetChecked(core.DB.defaults.SuppressTells) - CommDKP.ConfigTab4.SuppressTells:SetScale(0.8) - CommDKP.ConfigTab4.SuppressTells.text:SetText("|cff5151de"..L["SUPPRESSBIDWHISP"].."|r"); - CommDKP.ConfigTab4.SuppressTells.text:SetFontObject("CommDKPSmall") - CommDKP.ConfigTab4.SuppressTells:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(L["SUPPRESSBIDWHISP"], 0.25, 0.75, 0.90, 1, true) - GameTooltip:AddLine(L["SuppressBIDWHISPTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:AddLine(L["SuppressBIDWHISPTTWARN"], 1.0, 0, 0, true); - GameTooltip:Show() - end) - CommDKP.ConfigTab4.SuppressTells:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - CommDKP.ConfigTab4.SuppressTells:SetScript("OnClick", function() - if CommDKP.ConfigTab4.SuppressTells:GetChecked() then - CommDKP:Print(L["BIDWHISPARENOW"].." |cffff0000"..L["HIDDEN"].."|r.") - core.DB["defaults"]["SuppressTells"] = true; - else - core.DB["defaults"]["SuppressTells"] = false; - CommDKP:Print(L["BIDWHISPARENOW"].." |cff00ff00"..L["VISIBLE"].."|r.") - end - PlaySound(808) - end) - - if core.DB.defaults.DecreaseDisenchantValue == nil then - core.DB.defaults.DecreaseDisenchantValue = false - end - - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetPoint("LEFT", CommDKP.ConfigTab4.CombatLogging, "RIGHT", 200, 0) - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetChecked(core.DB.defaults.DecreaseDisenchantValue) - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScale(0.8); - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox.text:SetText("|cff5151de"..L["DECREASEDISENCHANT"].."|r"); - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox.text:SetFontObject("CommDKPSmall") - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnClick", function(self) - core.DB.defaults.DecreaseDisenchantValue = self:GetChecked() - end) - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_LEFT"); - GameTooltip:SetText(L["DECREASEDISENCHANT"], 0.25, 0.75, 0.90, 1, true); - GameTooltip:AddLine(L["DECREASEDISENCHANTTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end) - CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - - end - - -- Save Settings Button - CommDKP.ConfigTab4.submitSettings = self:CreateButton("BOTTOMLEFT", CommDKP.ConfigTab4, "BOTTOMLEFT", 30, 30, L["SAVESETTINGS"]); - CommDKP.ConfigTab4.submitSettings:ClearAllPoints(); - CommDKP.ConfigTab4.submitSettings:SetPoint("TOP", CommDKP.ConfigTab4.AutoOpenCheckbox, "BOTTOMLEFT", 20, -40) - CommDKP.ConfigTab4.submitSettings:SetSize(90,25) - CommDKP.ConfigTab4.submitSettings:SetScript("OnClick", function() - if core.IsOfficer == true then - for i=1, 6 do - if not tonumber(CommDKP.ConfigTab4.default[i]:GetText()) then - StaticPopupDialogs["OPTIONS_VALIDATION"] = { - text = L["INVALIDOPTIONENTRY"].." "..CommDKP.ConfigTab4.default[i].tooltipText..". "..L["PLEASEUSENUMS"], - button1 = L["OK"], - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("OPTIONS_VALIDATION") - - return; - end - end - for i=1, 17 do - if not tonumber(CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:GetText()) then - StaticPopupDialogs["OPTIONS_VALIDATION"] = { - text = L["INVALIDMINBIDENTRY"].." "..CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].tooltipText..". "..L["PLEASEUSENUMS"], - button1 = L["OK"], - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("OPTIONS_VALIDATION") - - return; - end - end - end - - SaveSettings() - CommDKP:Print(L["DEFAULTSETSAVED"]) - end) - - -- Chatframe Selection - CommDKP.ConfigTab4.ChatFrame = CreateFrame("FRAME", "CommDKPChatFrameSelectDropDown", CommDKP.ConfigTab4, "CommunityDKPUIDropDownMenuTemplate") - if not core.DB.defaults.ChatFrames then core.DB.defaults.ChatFrames = {} end - - UIDropDownMenu_Initialize(CommDKP.ConfigTab4.ChatFrame, function(self, level, menuList) - local SelectedFrame = UIDropDownMenu_CreateInfo() - SelectedFrame.func = self.SetValue - SelectedFrame.fontObject = "CommDKPSmallCenter" - SelectedFrame.keepShownOnClick = true; - SelectedFrame.isNotRadio = true; - - for i = 1, NUM_CHAT_WINDOWS do - local name = GetChatWindowInfo(i) - if name ~= "" then - SelectedFrame.text, SelectedFrame.arg1, SelectedFrame.checked = name, name, core.DB.defaults.ChatFrames[name] - UIDropDownMenu_AddButton(SelectedFrame) - end - end - end) - - CommDKP.ConfigTab4.ChatFrame:SetPoint("LEFT", CommDKP.ConfigTab4.AutoOpenCheckbox, "RIGHT", 130, 0) - UIDropDownMenu_SetWidth(CommDKP.ConfigTab4.ChatFrame, 150) - UIDropDownMenu_SetText(CommDKP.ConfigTab4.ChatFrame, "Addon Notifications") - - function CommDKP.ConfigTab4.ChatFrame:SetValue(arg1) - core.DB.defaults.ChatFrames[arg1] = not core.DB.defaults.ChatFrames[arg1] - CloseDropDownMenus() - end - - - - -- Position Bid Timer Button - CommDKP.ConfigTab4.moveTimer = self:CreateButton("BOTTOMRIGHT", CommDKP.ConfigTab4, "BOTTOMRIGHT", -50, 30, L["MOVEBIDTIMER"]); - CommDKP.ConfigTab4.moveTimer:ClearAllPoints(); - CommDKP.ConfigTab4.moveTimer:SetPoint("LEFT", CommDKP.ConfigTab4.submitSettings, "RIGHT", 200, 0) - CommDKP.ConfigTab4.moveTimer:SetSize(110,25) - CommDKP.ConfigTab4.moveTimer:SetScript("OnClick", function() - if moveTimerToggle == 0 then - CommDKP:StartTimer(120, L["MOVEME"]) - CommDKP.ConfigTab4.moveTimer:SetText(L["HIDEBIDTIMER"]) - moveTimerToggle = 1; - else - CommDKP.BidTimer:SetScript("OnUpdate", nil) - CommDKP.BidTimer:Hide() - CommDKP.ConfigTab4.moveTimer:SetText(L["MOVEBIDTIMER"]) - moveTimerToggle = 0; - end - end) - - -- wipe tables button - CommDKP.ConfigTab4.WipeTables = self:CreateButton("BOTTOMRIGHT", CommDKP.ConfigTab4, "BOTTOMRIGHT", -50, 30, L["WIPETABLES"]); - CommDKP.ConfigTab4.WipeTables:ClearAllPoints(); - CommDKP.ConfigTab4.WipeTables:SetPoint("RIGHT", CommDKP.ConfigTab4.moveTimer, "LEFT", -40, 0) - CommDKP.ConfigTab4.WipeTables:SetSize(110,25) - CommDKP.ConfigTab4.WipeTables:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(L["WIPETABLES"], 0.25, 0.75, 0.90, 1, true); - GameTooltip:AddLine(L["WIPETABLESTTDESC"], 1.0, 1.0, 1.0, true); - GameTooltip:Show(); - end) - CommDKP.ConfigTab4.WipeTables:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - CommDKP.ConfigTab4.WipeTables:SetScript("OnClick", function() - - StaticPopupDialogs["WIPE_TABLES"] = { - text = L["WIPETABLESCONF"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = function() - CommDKP:SetTable(CommDKP_Whitelist, false, nil); - CommDKP:SetTable(CommDKP_DKPTable, true, nil); - CommDKP:SetTable(CommDKP_Loot, true, nil); - CommDKP:SetTable(CommDKP_DKPHistory, true, nil); - CommDKP:SetTable(CommDKP_Archive, true, nil); - CommDKP:SetTable(CommDKP_Standby, true, nil); - CommDKP:SetTable(CommDKP_MinBids, true, nil); - CommDKP:SetTable(CommDKP_MaxBids, true, nil); - - CommDKP:SetTable(CommDKP_DKPTable, true, {}); - CommDKP:SetTable(CommDKP_Loot, true, {}); - CommDKP:SetTable(CommDKP_DKPHistory, true, {}); - CommDKP:SetTable(CommDKP_Archive, true, {}); - CommDKP:SetTable(CommDKP_Whitelist, false, {}); - CommDKP:SetTable(CommDKP_Standby, true, {}); - CommDKP:SetTable(CommDKP_MinBids, true, {}); - CommDKP:SetTable(CommDKP_MaxBids, true, {}); - CommDKP:LootHistory_Reset() - CommDKP:FilterDKPTable(core.currentSort, "reset") - CommDKP:StatusVerify_Update() - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("WIPE_TABLES") - end) - - -- Options Footer (empty frame to push bottom of scrollframe down) - CommDKP.ConfigTab4.OptionsFooterFrame = CreateFrame("Frame", nil, CommDKP.ConfigTab4); - CommDKP.ConfigTab4.OptionsFooterFrame:SetPoint("TOPLEFT", CommDKP.ConfigTab4.moveTimer, "BOTTOMLEFT") - CommDKP.ConfigTab4.OptionsFooterFrame:SetSize(420, 50); - -end +local _, core = ...; +local _G = _G; +local CommDKP = core.CommDKP; +local L = core.L; + +local moveTimerToggle = 0; +local validating = false + +local function DrawPercFrame(box) + --Draw % signs if set to percent + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box]:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetFontObject("CommDKPNormalLeft"); + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box], "RIGHT", -15, 0); + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[box].perc:SetText("%") + + if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box]:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetFontObject("CommDKPNormalLeft"); + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box], "RIGHT", -15, 0); + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[box].perc:SetText("%") + end +end + +local function SaveSettings() + if CommDKP.ConfigTab4.default[1] then + core.DB.DKPBonus.OnTimeBonus = CommDKP.ConfigTab4.default[1]:GetNumber(); + core.DB.DKPBonus.BossKillBonus = CommDKP.ConfigTab4.default[2]:GetNumber(); + core.DB.DKPBonus.CompletionBonus = CommDKP.ConfigTab4.default[3]:GetNumber(); + core.DB.DKPBonus.NewBossKillBonus = CommDKP.ConfigTab4.default[4]:GetNumber(); + core.DB.DKPBonus.UnexcusedAbsence = CommDKP.ConfigTab4.default[5]:GetNumber(); + if CommDKP.ConfigTab4.default[6]:GetNumber() < 0 then + core.DB.DKPBonus.DecayPercentage = 0 - CommDKP.ConfigTab4.default[6]:GetNumber(); + else + core.DB.DKPBonus.DecayPercentage = CommDKP.ConfigTab4.default[6]:GetNumber(); + end + CommDKP.ConfigTab2.decayDKP:SetNumber(core.DB.DKPBonus.DecayPercentage); + CommDKP.ConfigTab4.default[6]:SetNumber(core.DB.DKPBonus.DecayPercentage) + core.DB.DKPBonus.BidTimer = CommDKP.ConfigTab4.bidTimer:GetNumber(); + + core.DB.MinBidBySlot.Head = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:GetNumber() + core.DB.MinBidBySlot.Neck = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2]:GetNumber() + core.DB.MinBidBySlot.Shoulders = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3]:GetNumber() + core.DB.MinBidBySlot.Cloak = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4]:GetNumber() + core.DB.MinBidBySlot.Chest = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5]:GetNumber() + core.DB.MinBidBySlot.Bracers = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6]:GetNumber() + core.DB.MinBidBySlot.Hands = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7]:GetNumber() + core.DB.MinBidBySlot.Belt = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8]:GetNumber() + core.DB.MinBidBySlot.Legs = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:GetNumber() + core.DB.MinBidBySlot.Boots = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10]:GetNumber() + core.DB.MinBidBySlot.Ring = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11]:GetNumber() + core.DB.MinBidBySlot.Trinket = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12]:GetNumber() + core.DB.MinBidBySlot.OneHanded = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13]:GetNumber() + core.DB.MinBidBySlot.TwoHanded = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:GetNumber() + core.DB.MinBidBySlot.OffHand = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15]:GetNumber() + core.DB.MinBidBySlot.Range = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16]:GetNumber() + core.DB.MinBidBySlot.Other = CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:GetNumber() + + if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then + core.DB.MaxBidBySlot.Head = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1]:GetNumber() + core.DB.MaxBidBySlot.Neck = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2]:GetNumber() + core.DB.MaxBidBySlot.Shoulders = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3]:GetNumber() + core.DB.MaxBidBySlot.Cloak = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4]:GetNumber() + core.DB.MaxBidBySlot.Chest = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5]:GetNumber() + core.DB.MaxBidBySlot.Bracers = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6]:GetNumber() + core.DB.MaxBidBySlot.Hands = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7]:GetNumber() + core.DB.MaxBidBySlot.Belt = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8]:GetNumber() + core.DB.MaxBidBySlot.Legs = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:GetNumber() + core.DB.MaxBidBySlot.Boots = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10]:GetNumber() + core.DB.MaxBidBySlot.Ring = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11]:GetNumber() + core.DB.MaxBidBySlot.Trinket = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12]:GetNumber() + core.DB.MaxBidBySlot.OneHanded = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13]:GetNumber() + core.DB.MaxBidBySlot.TwoHanded = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:GetNumber() + core.DB.MaxBidBySlot.OffHand = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15]:GetNumber() + core.DB.MaxBidBySlot.Range = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16]:GetNumber() + core.DB.MaxBidBySlot.Other = CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:GetNumber() + end + end + + core.CommDKPUI:SetScale(core.DB.defaults.CommDKPScaleSize); + core.DB.defaults.HistoryLimit = CommDKP.ConfigTab4.history:GetNumber(); + core.DB.defaults.DKPHistoryLimit = CommDKP.ConfigTab4.DKPHistory:GetNumber(); + core.DB.defaults.TooltipHistoryCount = CommDKP.ConfigTab4.TooltipHistory:GetNumber(); + CommDKP:DKPTable_Update() +end + +function CommDKP:Options() + local default = {} + CommDKP.ConfigTab4.default = default; + CommDKP:CheckOfficer() + CommDKP.ConfigTab4.header = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.header:SetFontObject("CommDKPLargeCenter"); + CommDKP.ConfigTab4.header:SetPoint("TOPLEFT", CommDKP.ConfigTab4, "TOPLEFT", 15, -10); + CommDKP.ConfigTab4.header:SetText(L["DEFAULTSETTINGS"]); + CommDKP.ConfigTab4.header:SetScale(1.2) + + if core.IsOfficer == true then + CommDKP.ConfigTab4.description = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.description:SetFontObject("CommDKPNormalLeft"); + CommDKP.ConfigTab4.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.header, "BOTTOMLEFT", 7, -15); + CommDKP.ConfigTab4.description:SetText("|CFFcca600"..L["DEFAULTDKPAWARDVALUES"].."|r"); + + for i=1, 6 do + CommDKP.ConfigTab4.default[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.default[i]:SetAutoFocus(false) + CommDKP.ConfigTab4.default[i]:SetMultiLine(false) + CommDKP.ConfigTab4.default[i]:SetSize(80, 24) + CommDKP.ConfigTab4.default[i]:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.default[i]:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.default[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.default[i]:SetMaxLetters(6) + CommDKP.ConfigTab4.default[i]:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.default[i]:SetFontObject("CommDKPSmallRight") + CommDKP.ConfigTab4.default[i]:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.default[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.default[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.default[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc + SaveSettings() + if i == 6 then + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:HighlightText() + else + self:HighlightText(0,0) + CommDKP.ConfigTab4.default[i+1]:SetFocus() + CommDKP.ConfigTab4.default[i+1]:HighlightText() + end + end) + CommDKP.ConfigTab4.default[i]:SetScript("OnEnter", function(self) + if (self.tooltipText) then + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); + end + if (self.tooltipDescription) then + GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end + if (self.tooltipWarning) then + GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); + GameTooltip:Show(); + end + end) + CommDKP.ConfigTab4.default[i]:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + if i==1 then + CommDKP.ConfigTab4.default[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4, "TOPLEFT", 144, -84) + elseif i==4 then + CommDKP.ConfigTab4.default[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.default[1], "TOPLEFT", 212, 0) + else + CommDKP.ConfigTab4.default[i]:SetPoint("TOP", CommDKP.ConfigTab4.default[i-1], "BOTTOM", 0, -22) + end + end + + -- Modes Button + CommDKP.ConfigTab4.ModesButton = self:CreateButton("TOPRIGHT", CommDKP.ConfigTab4, "TOPRIGHT", -40, -20, L["DKPMODES"]); + CommDKP.ConfigTab4.ModesButton:SetSize(110,25) + CommDKP.ConfigTab4.ModesButton:SetScript("OnClick", function() + CommDKP:ToggleDKPModesWindow() + end); + CommDKP.ConfigTab4.ModesButton:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["DKPMODES"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["DKPMODESTTDESC2"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["DKPMODESTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.ModesButton:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + if not core.IsOfficer then + CommDKP.ConfigTab4.ModesButton:Hide() + end + CommDKP.ConfigTab4.default[1]:SetText(core.DB.DKPBonus.OnTimeBonus) + CommDKP.ConfigTab4.default[1].tooltipText = L["ONTIMEBONUS"] + CommDKP.ConfigTab4.default[1].tooltipDescription = L["ONTIMEBONUSTTDESC"] + + CommDKP.ConfigTab4.default[2]:SetText(core.DB.DKPBonus.BossKillBonus) + CommDKP.ConfigTab4.default[2].tooltipText = L["BOSSKILLBONUS"] + CommDKP.ConfigTab4.default[2].tooltipDescription = L["BOSSKILLBONUSTTDESC"] + + CommDKP.ConfigTab4.default[3]:SetText(core.DB.DKPBonus.CompletionBonus) + CommDKP.ConfigTab4.default[3].tooltipText = L["RAIDCOMPLETIONBONUS"] + CommDKP.ConfigTab4.default[3].tooltipDescription = L["RAIDCOMPLETEBONUSTT"] + + CommDKP.ConfigTab4.default[4]:SetText(core.DB.DKPBonus.NewBossKillBonus) + CommDKP.ConfigTab4.default[4].tooltipText = L["NEWBOSSKILLBONUS"] + CommDKP.ConfigTab4.default[4].tooltipDescription = L["NEWBOSSKILLTTDESC"] + + CommDKP.ConfigTab4.default[5]:SetText(core.DB.DKPBonus.UnexcusedAbsence) + CommDKP.ConfigTab4.default[5]:SetNumeric(false) + CommDKP.ConfigTab4.default[5].tooltipText = L["UNEXCUSEDABSENCE"] + CommDKP.ConfigTab4.default[5].tooltipDescription = L["UNEXCUSEDTTDESC"] + CommDKP.ConfigTab4.default[5].tooltipWarning = L["UNEXCUSEDTTWARN"] + + CommDKP.ConfigTab4.default[6]:SetText(core.DB.DKPBonus.DecayPercentage) + CommDKP.ConfigTab4.default[6]:SetTextInsets(0, 15, 0, 0) + CommDKP.ConfigTab4.default[6].tooltipText = L["DECAYPERCENTAGE"] + CommDKP.ConfigTab4.default[6].tooltipDescription = L["DECAYPERCENTAGETTDESC"] + CommDKP.ConfigTab4.default[6].tooltipWarning = L["DECAYPERCENTAGETTWARN"] + + --OnTimeBonus Header + CommDKP.ConfigTab4.OnTimeHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.OnTimeHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.OnTimeHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[1], "LEFT", 0, 0); + CommDKP.ConfigTab4.OnTimeHeader:SetText(L["ONTIMEBONUS"]..": ") + + --BossKillBonus Header + CommDKP.ConfigTab4.BossKillHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.BossKillHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.BossKillHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[2], "LEFT", 0, 0); + CommDKP.ConfigTab4.BossKillHeader:SetText(L["BOSSKILLBONUS"]..": ") + + --CompletionBonus Header + CommDKP.ConfigTab4.CompleteHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.CompleteHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.CompleteHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[3], "LEFT", 0, 0); + CommDKP.ConfigTab4.CompleteHeader:SetText(L["RAIDCOMPLETIONBONUS"]..": ") + + --NewBossKillBonus Header + CommDKP.ConfigTab4.NewBossHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.NewBossHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.NewBossHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[4], "LEFT", 0, 0); + CommDKP.ConfigTab4.NewBossHeader:SetText(L["NEWBOSSKILLBONUS"]..": ") + + --UnexcusedAbsence Header + CommDKP.ConfigTab4.UnexcusedHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.UnexcusedHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.UnexcusedHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[5], "LEFT", 0, 0); + CommDKP.ConfigTab4.UnexcusedHeader:SetText(L["UNEXCUSEDABSENCE"]..": ") + + --DKP Decay Header + CommDKP.ConfigTab4.DecayHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DecayHeader:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.DecayHeader:SetPoint("RIGHT", CommDKP.ConfigTab4.default[6], "LEFT", 0, 0); + CommDKP.ConfigTab4.DecayHeader:SetText(L["DECAYAMOUNT"]..": ") + + CommDKP.ConfigTab4.DecayFooter = CommDKP.ConfigTab4.default[6]:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DecayFooter:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.DecayFooter:SetPoint("LEFT", CommDKP.ConfigTab4.default[6], "RIGHT", -15, -1); + CommDKP.ConfigTab4.DecayFooter:SetText("%") + + -- Default Minimum Bids Container Frame + CommDKP.ConfigTab4.DefaultMinBids = CreateFrame("Frame", nil, CommDKP.ConfigTab4); + CommDKP.ConfigTab4.DefaultMinBids:SetPoint("TOPLEFT", CommDKP.ConfigTab4.default[3], "BOTTOMLEFT", -130, -52) + CommDKP.ConfigTab4.DefaultMinBids:SetSize(420, 410); + + CommDKP.ConfigTab4.DefaultMinBids.description = CommDKP.ConfigTab4.DefaultMinBids:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMinBids.description:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.DefaultMinBids.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "TOPLEFT", 15, 15); + -- DEFAULT min bids Create EditBoxes + local SlotBox = {} + CommDKP.ConfigTab4.DefaultMinBids.SlotBox = SlotBox; + + for i=1, 17 do + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetAutoFocus(false) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetMultiLine(false) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetSize(60, 24) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetMaxLetters(6) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetFontObject("CommDKPSmallRight") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc + if i == 8 then + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:HighlightText() + SaveSettings() + elseif i == 5 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:HighlightText() + SaveSettings() + elseif i == 13 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:HighlightText() + SaveSettings() + elseif i == 17 then + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:HighlightText() + SaveSettings() + elseif i == 16 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(1) + CommDKP.ConfigTab4.default[1]:SetFocus() + CommDKP.ConfigTab4.default[1]:HighlightText() + SaveSettings() + else + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:SetFocus() + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i+1]:HighlightText() + SaveSettings() + end + end) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnEnter", function(self) + if (self.tooltipText) then + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); + end + if (self.tooltipDescription) then + GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end + if (self.tooltipWarning) then + GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); + GameTooltip:Show(); + end + end) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + -- Slot Headers + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header = CommDKP.ConfigTab4.DefaultMinBids:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header:SetFontObject("CommDKPNormalLeft"); + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].Header:SetPoint("RIGHT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i], "LEFT", 0, 0); + + if i==1 then + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "TOPLEFT", 100, -10) + elseif i==9 then + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1], "TOPLEFT", 150, 0) + elseif i==17 then + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8], "BOTTOM", 0, -22) + else + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i-1], "BOTTOM", 0, -22) + end + end + + local prefix; + if core.DB.modes.mode == "Minimum Bid Values" then + prefix = L["MINIMUMBID"]; + CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTMINBIDVALUES"].."|r"); + elseif core.DB.modes.mode == "Static Item Values" then + CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); + if core.DB.modes.costvalue == "Integer" then + prefix = L["DKPPRICE"] + elseif core.DB.modes.costvalue == "Percent" then + prefix = L["PERCENTCOST"] + end + elseif core.DB.modes.mode == "Roll Based Bidding" then + CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); + if core.DB.modes.costvalue == "Integer" then + prefix = L["DKPPRICE"] + elseif core.DB.modes.costvalue == "Percent" then + prefix = L["PERCENTCOST"] + end + elseif core.DB.modes.mode == "Zero Sum" then + CommDKP.ConfigTab4.DefaultMinBids.description:SetText("|CFFcca600"..L["DEFAULTITEMCOSTS"].."|r"); + if core.DB.modes.costvalue == "Integer" then + prefix = L["DKPPRICE"] + elseif core.DB.modes.costvalue == "Percent" then + prefix = L["PERCENTCOST"] + end + end + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].Header:SetText(L["HEAD"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1]:SetText(core.DB.MinBidBySlot.Head) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].tooltipText = L["HEAD"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[1].tooltipDescription = prefix.." "..L["FORHEADSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].Header:SetText(L["NECK"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2]:SetText(core.DB.MinBidBySlot.Neck) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].tooltipText = L["NECK"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[2].tooltipDescription = prefix.." "..L["FORNECKSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].Header:SetText(L["SHOULDERS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3]:SetText(core.DB.MinBidBySlot.Shoulders) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].tooltipText = L["SHOULDERS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[3].tooltipDescription = prefix.." "..L["FORSHOULDERSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].Header:SetText(L["CLOAK"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4]:SetText(core.DB.MinBidBySlot.Cloak) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].tooltipText = L["CLOAK"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[4].tooltipDescription = prefix.." "..L["FORBACKSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].Header:SetText(L["CHEST"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5]:SetText(core.DB.MinBidBySlot.Chest) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].tooltipText = L["CHEST"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[5].tooltipDescription = prefix.." "..L["FORCHESTSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].Header:SetText(L["BRACERS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6]:SetText(core.DB.MinBidBySlot.Bracers) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].tooltipText = L["BRACERS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[6].tooltipDescription = prefix.." "..L["FORWRISTSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].Header:SetText(L["HANDS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7]:SetText(core.DB.MinBidBySlot.Hands) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].tooltipText = L["HANDS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[7].tooltipDescription = prefix.." "..L["FORHANDSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].Header:SetText(L["BELT"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8]:SetText(core.DB.MinBidBySlot.Belt) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].tooltipText = L["BELT"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[8].tooltipDescription = prefix.." "..L["FORWAISTSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].Header:SetText(L["LEGS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9]:SetText(core.DB.MinBidBySlot.Legs) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].tooltipText = L["LEGS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[9].tooltipDescription = prefix.." "..L["FORLEGSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].Header:SetText(L["BOOTS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10]:SetText(core.DB.MinBidBySlot.Boots) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].tooltipText = L["BOOTS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[10].tooltipDescription = prefix.." "..L["FORFEETSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].Header:SetText(L["RINGS"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11]:SetText(core.DB.MinBidBySlot.Ring) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].tooltipText = L["RINGS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[11].tooltipDescription = prefix.." "..L["FORFINGERSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].Header:SetText(L["TRINKET"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12]:SetText(core.DB.MinBidBySlot.Trinket) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].tooltipText = L["TRINKET"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[12].tooltipDescription = prefix.." "..L["FORTRINKETSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].Header:SetText(L["ONEHANDED"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13]:SetText(core.DB.MinBidBySlot.OneHanded) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].tooltipText = L["ONEHANDEDWEAPONS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[13].tooltipDescription = prefix.." "..L["FORONEHANDSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].Header:SetText(L["TWOHANDED"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14]:SetText(core.DB.MinBidBySlot.TwoHanded) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].tooltipText = L["TWOHANDEDWEAPONS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[14].tooltipDescription = prefix.." "..L["FORTWOHANDSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].Header:SetText(L["OFFHAND"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15]:SetText(core.DB.MinBidBySlot.OffHand) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].tooltipText = L["OFFHANDITEMS"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[15].tooltipDescription = prefix.." "..L["FOROFFHANDSLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].Header:SetText(L["RANGE"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16]:SetText(core.DB.MinBidBySlot.Range) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].tooltipText = L["RANGE"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[16].tooltipDescription = prefix.." "..L["FORRANGESLOT"] + + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].Header:SetText(L["OTHER"]..": ") + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17]:SetText(core.DB.MinBidBySlot.Other) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].tooltipText = L["OTHER"] + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17].tooltipDescription = prefix.." "..L["FOROTHERSLOT"] + + if core.DB.modes.costvalue == "Percent" then + for i=1, #CommDKP.ConfigTab4.DefaultMinBids.SlotBox do + DrawPercFrame(i) + CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:SetTextInsets(0, 15, 0, 0) + end + end + -- Broadcast Minimum Bids Button + CommDKP.ConfigTab4.BroadcastMinBids = self:CreateButton("TOP", CommDKP.ConfigTab4, "BOTTOM", 30, 30, L["BCASTVALUES"]); + CommDKP.ConfigTab4.BroadcastMinBids:ClearAllPoints(); + CommDKP.ConfigTab4.BroadcastMinBids:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMinBids.SlotBox[17], "RIGHT", 41, 0) + CommDKP.ConfigTab4.BroadcastMinBids:SetSize(110,25) + CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnClick", function() + StaticPopupDialogs["SEND_MINBIDS"] = { + text = L["BCASTMINBIDCONFIRM"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = function() + local temptable = {} + table.insert(temptable, core.DB.MinBidBySlot) + local teams = CommDKP:GetGuildTeamList(true); + local teamTable = {} + + for k, v in pairs(teams) do + local teamIndex = tostring(v.index); + table.insert(teamTable, {teamIndex, CommDKP:GetTable(CommDKP_MinBids, true, teamIndex)}); + end + table.insert(temptable, teamTable); + CommDKP.Sync:SendData("CommDKPMinBid", temptable) + CommDKP:Print(L["MINBIDVALUESSENT"]) + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("SEND_MINBIDS") + end); + CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["BCASTVALUES"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["BCASTVALUESTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["BCASTVALUESTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.BroadcastMinBids:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + -- Default Maximum Bids Container Frame + if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then + CommDKP.ConfigTab4.DefaultMaxBids = CreateFrame("Frame", nil, CommDKP.ConfigTab4); + CommDKP.ConfigTab4.DefaultMaxBids:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "BOTTOMLEFT", 0, -52) + CommDKP.ConfigTab4.DefaultMaxBids:SetSize(420, 410); + + CommDKP.ConfigTab4.DefaultMaxBids.description = CommDKP.ConfigTab4.DefaultMaxBids:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMaxBids.description:SetFontObject("CommDKPSmallRight"); + CommDKP.ConfigTab4.DefaultMaxBids.description:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "TOPLEFT", 15, 15); + + -- DEFAULT Max bids Create EditBoxes + local SlotBox = {} + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox = SlotBox; + + for i=1, 17 do + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i] = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetAutoFocus(false) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetMultiLine(false) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetSize(60, 24) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetMaxLetters(6) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetFontObject("CommDKPSmallRight") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:HighlightText(0,0) + SaveSettings() + self:ClearFocus() + end) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnTabPressed", function(self) -- clears focus on esc + if i == 8 then + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:SetFocus() + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:HighlightText() + SaveSettings() + elseif i == 5 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:SetFocus() + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:HighlightText() + SaveSettings() + elseif i == 13 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(200) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:SetFocus() + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:HighlightText() + SaveSettings() + elseif i == 17 then + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:SetFocus() + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:HighlightText() + SaveSettings() + elseif i == 16 then + self:HighlightText(0,0) + CommDKP.UIConfig.TabMenu.ScrollFrame:SetVerticalScroll(1) + CommDKP.ConfigTab4.default[1]:SetFocus() + CommDKP.ConfigTab4.default[1]:HighlightText() + SaveSettings() + else + self:HighlightText(0,0) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:SetFocus() + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i+1]:HighlightText() + SaveSettings() + end + end) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnEnter", function(self) + if (self.tooltipText) then + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip:SetText(self.tooltipText, 0.25, 0.75, 0.90, 1, true); + end + if (self.tooltipDescription) then + GameTooltip:AddLine(self.tooltipDescription, 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end + if (self.tooltipWarning) then + GameTooltip:AddLine(self.tooltipWarning, 1.0, 0, 0, true); + GameTooltip:Show(); + end + end) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + -- Slot Headers + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header = CommDKP.ConfigTab4.DefaultMaxBids:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header:SetFontObject("CommDKPNormalLeft"); + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i].Header:SetPoint("RIGHT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i], "LEFT", 0, 0); + + if i==1 then + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "TOPLEFT", 100, -10) + elseif i==9 then + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1], "TOPLEFT", 150, 0) + elseif i==17 then + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8], "BOTTOM", 0, -22) + else + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetPoint("TOP", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i-1], "BOTTOM", 0, -22) + end + end + + local prefix; + + prefix = L["MAXIMUMBID"]; + CommDKP.ConfigTab4.DefaultMaxBids.description:SetText("|CFFcca600"..L["DEFAULTMAXBIDVALUES"].."|r"); + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].Header:SetText(L["HEAD"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1]:SetText(core.DB.MaxBidBySlot.Head) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].tooltipText = L["HEAD"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[1].tooltipDescription = prefix.." "..L["FORHEADSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].Header:SetText(L["NECK"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2]:SetText(core.DB.MaxBidBySlot.Neck) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].tooltipText = L["NECK"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[2].tooltipDescription = prefix.." "..L["FORNECKSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].Header:SetText(L["SHOULDERS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3]:SetText(core.DB.MaxBidBySlot.Shoulders) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].tooltipText = L["SHOULDERS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[3].tooltipDescription = prefix.." "..L["FORSHOULDERSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].Header:SetText(L["CLOAK"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4]:SetText(core.DB.MaxBidBySlot.Cloak) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].tooltipText = L["CLOAK"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[4].tooltipDescription = prefix.." "..L["FORBACKSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].Header:SetText(L["CHEST"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5]:SetText(core.DB.MaxBidBySlot.Chest) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].tooltipText = L["CHEST"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[5].tooltipDescription = prefix.." "..L["FORCHESTSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].Header:SetText(L["BRACERS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6]:SetText(core.DB.MaxBidBySlot.Bracers) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].tooltipText = L["BRACERS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[6].tooltipDescription = prefix.." "..L["FORWRISTSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].Header:SetText(L["HANDS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7]:SetText(core.DB.MaxBidBySlot.Hands) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].tooltipText = L["HANDS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[7].tooltipDescription = prefix.." "..L["FORHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].Header:SetText(L["BELT"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8]:SetText(core.DB.MaxBidBySlot.Belt) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].tooltipText = L["BELT"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[8].tooltipDescription = prefix.." "..L["FORWAISTSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].Header:SetText(L["LEGS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9]:SetText(core.DB.MaxBidBySlot.Legs) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].tooltipText = L["LEGS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[9].tooltipDescription = prefix.." "..L["FORLEGSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].Header:SetText(L["BOOTS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10]:SetText(core.DB.MaxBidBySlot.Boots) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].tooltipText = L["BOOTS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[10].tooltipDescription = prefix.." "..L["FORFEETSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].Header:SetText(L["RINGS"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11]:SetText(core.DB.MaxBidBySlot.Ring) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].tooltipText = L["RINGS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[11].tooltipDescription = prefix.." "..L["FORFINGERSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].Header:SetText(L["TRINKET"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12]:SetText(core.DB.MaxBidBySlot.Trinket) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].tooltipText = L["TRINKET"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[12].tooltipDescription = prefix.." "..L["FORTRINKETSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].Header:SetText(L["ONEHANDED"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13]:SetText(core.DB.MaxBidBySlot.OneHanded) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].tooltipText = L["ONEHANDEDWEAPONS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[13].tooltipDescription = prefix.." "..L["FORONEHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].Header:SetText(L["TWOHANDED"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14]:SetText(core.DB.MaxBidBySlot.TwoHanded) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].tooltipText = L["TWOHANDEDWEAPONS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[14].tooltipDescription = prefix.." "..L["FORTWOHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].Header:SetText(L["OFFHAND"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15]:SetText(core.DB.MaxBidBySlot.OffHand) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].tooltipText = L["OFFHANDITEMS"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[15].tooltipDescription = prefix.." "..L["FOROFFHANDSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].Header:SetText(L["RANGE"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16]:SetText(core.DB.MaxBidBySlot.Range) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].tooltipText = L["RANGE"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[16].tooltipDescription = prefix.." "..L["FORRANGESLOT"].." "..L["MAXIMUMBIDTTDESC"] + + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].Header:SetText(L["OTHER"]..": ") + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17]:SetText(core.DB.MaxBidBySlot.Other) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].tooltipText = L["OTHER"] + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17].tooltipDescription = prefix.." "..L["FOROTHERSLOT"].." "..L["MAXIMUMBIDTTDESC"] + + if core.DB.modes.costvalue == "Percent" then + for i=1, #CommDKP.ConfigTab4.DefaultMaxBids.SlotBox do + DrawPercFrame(i) + CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[i]:SetTextInsets(0, 15, 0, 0) + end + end + -- Broadcast Maximum Bids Button + CommDKP.ConfigTab4.BroadcastMaxBids = self:CreateButton("TOP", CommDKP.ConfigTab4, "BOTTOM", 30, 30, L["BCASTVALUES"]); + CommDKP.ConfigTab4.BroadcastMaxBids:ClearAllPoints(); + CommDKP.ConfigTab4.BroadcastMaxBids:SetPoint("LEFT", CommDKP.ConfigTab4.DefaultMaxBids.SlotBox[17], "RIGHT", 41, 0) + CommDKP.ConfigTab4.BroadcastMaxBids:SetSize(110,25) + CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnClick", function() + StaticPopupDialogs["SEND_MAXBIDS"] = { + text = L["BCASTMAXBIDCONFIRM"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = function() + local temptable = {} + table.insert(temptable, core.DB.MaxBidBySlot) + local teams = CommDKP:GetGuildTeamList(true); + local teamTable = {} + + for k, v in pairs(teams) do + local teamIndex = tostring(v.index); + table.insert(teamTable, {teamIndex, CommDKP:GetTable(CommDKP_MaxBids, true, teamIndex)}); + end + table.insert(temptable, teamTable); + CommDKP.Sync:SendData("CommDKPMaxBid", temptable) + CommDKP:Print(L["MAXBIDVALUESSENT"]) + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("SEND_MAXBIDS") + end); + CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["BCASTVALUES"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["BCASTVALUESTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["BCASTVALUESTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.BroadcastMaxBids:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + end + -- Bid Timer Slider + CommDKP.ConfigTab4.bidTimerSlider = CreateFrame("SLIDER", "$parentBidTimerSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + Mixin(CommDKP.ConfigTab4.bidTimerSlider, BackdropTemplateMixin) + CommDKP.ConfigTab4.bidTimerSlider:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + if core.DB.modes.mode == "Minimum Bid Values" or (core.DB.modes.mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then + CommDKP.ConfigTab4.bidTimerSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMaxBids, "BOTTOMLEFT", 54, -40); + else + CommDKP.ConfigTab4.bidTimerSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DefaultMinBids, "BOTTOMLEFT", 54, -40); + end + CommDKP.ConfigTab4.bidTimerSlider:SetMinMaxValues(10, 90); + CommDKP.ConfigTab4.bidTimerSlider:SetValue(core.DB.DKPBonus.BidTimer); + CommDKP.ConfigTab4.bidTimerSlider:SetValueStep(1); + CommDKP.ConfigTab4.bidTimerSlider.tooltipText = L["BIDTIMER"] + CommDKP.ConfigTab4.bidTimerSlider.tooltipRequirement = L["BIDTIMERDEFAULTTTDESC"] + CommDKP.ConfigTab4.bidTimerSlider:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.bidTimerSlider:GetName().."Low"):SetText("10") + getglobal(CommDKP.ConfigTab4.bidTimerSlider:GetName().."High"):SetText("90") + CommDKP.ConfigTab4.bidTimerSlider:SetScript("OnValueChanged", function(self) -- clears focus on esc + CommDKP.ConfigTab4.bidTimer:SetText(CommDKP.ConfigTab4.bidTimerSlider:GetValue()) + end) + + CommDKP.ConfigTab4.bidTimerHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.bidTimerHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.bidTimerHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.bidTimerSlider, "TOP", 0, 3); + CommDKP.ConfigTab4.bidTimerHeader:SetText(L["BIDTIMER"]) + + CommDKP.ConfigTab4.bidTimer = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.bidTimer:SetAutoFocus(false) + CommDKP.ConfigTab4.bidTimer:SetMultiLine(false) + CommDKP.ConfigTab4.bidTimer:SetSize(50, 18) + CommDKP.ConfigTab4.bidTimer:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.bidTimer:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.bidTimer:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.bidTimer:SetMaxLetters(4) + CommDKP.ConfigTab4.bidTimer:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.bidTimer:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.bidTimer:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.bidTimer:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.bidTimer:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.bidTimer:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.bidTimerSlider:SetValue(CommDKP.ConfigTab4.bidTimer:GetNumber()); + end) + CommDKP.ConfigTab4.bidTimer:SetPoint("TOP", CommDKP.ConfigTab4.bidTimerSlider, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.bidTimer:SetText(CommDKP.ConfigTab4.bidTimerSlider:GetValue()) + end -- the end + + -- Tooltip History Slider + CommDKP.ConfigTab4.TooltipHistorySlider = CreateFrame("SLIDER", "$parentTooltipHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + if CommDKP.ConfigTab4.bidTimer then + CommDKP.ConfigTab4.TooltipHistorySlider:SetPoint("LEFT", CommDKP.ConfigTab4.bidTimerSlider, "RIGHT", 30, 0); + else + CommDKP.ConfigTab4.TooltipHistorySlider:SetPoint("TOP", CommDKP.ConfigTab4, "TOP", 1, -107); + end + + Mixin(CommDKP.ConfigTab4.TooltipHistorySlider, BackdropTemplateMixin) + CommDKP.ConfigTab4.TooltipHistorySlider:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + + CommDKP.ConfigTab4.TooltipHistorySlider:SetMinMaxValues(5, 35); + CommDKP.ConfigTab4.TooltipHistorySlider:SetValue(core.DB.defaults.TooltipHistoryCount); + CommDKP.ConfigTab4.TooltipHistorySlider:SetValueStep(1); + CommDKP.ConfigTab4.TooltipHistorySlider.tooltipText = L["TTHISTORYCOUNT"] + CommDKP.ConfigTab4.TooltipHistorySlider.tooltipRequirement = L["TTHISTORYCOUNTTTDESC"] + CommDKP.ConfigTab4.TooltipHistorySlider:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.TooltipHistorySlider:GetName().."Low"):SetText("5") + getglobal(CommDKP.ConfigTab4.TooltipHistorySlider:GetName().."High"):SetText("35") + CommDKP.ConfigTab4.TooltipHistorySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc + CommDKP.ConfigTab4.TooltipHistory:SetText(CommDKP.ConfigTab4.TooltipHistorySlider:GetValue()) + end) + + CommDKP.ConfigTab4.TooltipHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.TooltipHistoryHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.TooltipHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.TooltipHistorySlider, "TOP", 0, 3); + CommDKP.ConfigTab4.TooltipHistoryHeader:SetText(L["TTHISTORYCOUNT"]) + + CommDKP.ConfigTab4.TooltipHistory = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.TooltipHistory:SetAutoFocus(false) + CommDKP.ConfigTab4.TooltipHistory:SetMultiLine(false) + CommDKP.ConfigTab4.TooltipHistory:SetSize(50, 18) + CommDKP.ConfigTab4.TooltipHistory:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.TooltipHistory:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.TooltipHistory:SetBackdropBorderColor(0.12,0.12, 0.34, 1) + CommDKP.ConfigTab4.TooltipHistory:SetMaxLetters(4) + CommDKP.ConfigTab4.TooltipHistory:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.TooltipHistory:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.TooltipHistory:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.TooltipHistory:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.TooltipHistorySlider:SetValue(CommDKP.ConfigTab4.TooltipHistory:GetNumber()); + end) + CommDKP.ConfigTab4.TooltipHistory:SetPoint("TOP", CommDKP.ConfigTab4.TooltipHistorySlider, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.TooltipHistory:SetText(CommDKP.ConfigTab4.TooltipHistorySlider:GetValue()) + + + -- Loot History Limit Slider + CommDKP.ConfigTab4.historySlider = CreateFrame("SLIDER", "$parentHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + + if CommDKP.ConfigTab4.bidTimer then + CommDKP.ConfigTab4.historySlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.bidTimerSlider, "BOTTOMLEFT", 0, -50); + else + CommDKP.ConfigTab4.historySlider:SetPoint("TOPRIGHT", CommDKP.ConfigTab4.TooltipHistorySlider, "BOTTOMLEFT", 56, -49); + end + + Mixin(CommDKP.ConfigTab4.historySlider, BackdropTemplateMixin) + CommDKP.ConfigTab4.historySlider:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + + CommDKP.ConfigTab4.historySlider:SetMinMaxValues(100, 2500); + CommDKP.ConfigTab4.historySlider:SetValue(core.DB.defaults.HistoryLimit); + CommDKP.ConfigTab4.historySlider:SetValueStep(25); + CommDKP.ConfigTab4.historySlider.tooltipText = L["LOOTHISTORYLIMIT"] + CommDKP.ConfigTab4.historySlider.tooltipRequirement = L["LOOTHISTLIMITTTDESC"] + CommDKP.ConfigTab4.historySlider.tooltipWarning = L["LOOTHISTLIMITTTWARN"] + CommDKP.ConfigTab4.historySlider:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.historySlider:GetName().."Low"):SetText("100") + getglobal(CommDKP.ConfigTab4.historySlider:GetName().."High"):SetText("2500") + CommDKP.ConfigTab4.historySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc + CommDKP.ConfigTab4.history:SetText(CommDKP.ConfigTab4.historySlider:GetValue()) + end) + + CommDKP.ConfigTab4.HistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.HistoryHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.HistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.historySlider, "TOP", 0, 3); + CommDKP.ConfigTab4.HistoryHeader:SetText(L["LOOTHISTORYLIMIT"]) + + CommDKP.ConfigTab4.history = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.history:SetAutoFocus(false) + CommDKP.ConfigTab4.history:SetMultiLine(false) + CommDKP.ConfigTab4.history:SetSize(50, 18) + CommDKP.ConfigTab4.history:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.history:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.history:SetBackdropBorderColor(0.12,0.12, 0.34, 1) + CommDKP.ConfigTab4.history:SetMaxLetters(4) + CommDKP.ConfigTab4.history:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.history:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.history:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.history:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.history:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.history:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.historySlider:SetValue(CommDKP.ConfigTab4.history:GetNumber()); + end) + CommDKP.ConfigTab4.history:SetPoint("TOP", CommDKP.ConfigTab4.historySlider, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.history:SetText(CommDKP.ConfigTab4.historySlider:GetValue()) + + -- DKP History Limit Slider + CommDKP.ConfigTab4.DKPHistorySlider = CreateFrame("SLIDER", "$parentDKPHistorySlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + Mixin(CommDKP.ConfigTab4.DKPHistorySlider, BackdropTemplateMixin) + CommDKP.ConfigTab4.DKPHistorySlider:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + CommDKP.ConfigTab4.DKPHistorySlider:SetPoint("LEFT", CommDKP.ConfigTab4.historySlider, "RIGHT", 30, 0); + CommDKP.ConfigTab4.DKPHistorySlider:SetMinMaxValues(100, 2500); + CommDKP.ConfigTab4.DKPHistorySlider:SetValue(core.DB.defaults.DKPHistoryLimit); + CommDKP.ConfigTab4.DKPHistorySlider:SetValueStep(25); + CommDKP.ConfigTab4.DKPHistorySlider.tooltipText = L["DKPHISTORYLIMIT"] + CommDKP.ConfigTab4.DKPHistorySlider.tooltipRequirement = L["DKPHISTLIMITTTDESC"] + CommDKP.ConfigTab4.DKPHistorySlider.tooltipWarning = L["DKPHISTLIMITTTWARN"] + CommDKP.ConfigTab4.DKPHistorySlider:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.DKPHistorySlider:GetName().."Low"):SetText("100") + getglobal(CommDKP.ConfigTab4.DKPHistorySlider:GetName().."High"):SetText("2500") + CommDKP.ConfigTab4.DKPHistorySlider:SetScript("OnValueChanged", function(self) -- clears focus on esc + CommDKP.ConfigTab4.DKPHistory:SetText(CommDKP.ConfigTab4.DKPHistorySlider:GetValue()) + end) + + CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.DKPHistorySlider, "TOP", 0, 3); + CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["DKPHISTORYLIMIT"]) + + CommDKP.ConfigTab4.DKPHistory = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.DKPHistory:SetAutoFocus(false) + CommDKP.ConfigTab4.DKPHistory:SetMultiLine(false) + CommDKP.ConfigTab4.DKPHistory:SetSize(50, 18) + CommDKP.ConfigTab4.DKPHistory:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.DKPHistory:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.DKPHistory:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.DKPHistory:SetMaxLetters(4) + CommDKP.ConfigTab4.DKPHistory:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.DKPHistory:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.DKPHistory:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.DKPHistory:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.DKPHistory:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.DKPHistory:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.DKPHistorySlider:SetValue(CommDKP.ConfigTab4.history:GetNumber()); + end) + CommDKP.ConfigTab4.DKPHistory:SetPoint("TOP", CommDKP.ConfigTab4.DKPHistorySlider, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.DKPHistory:SetText(CommDKP.ConfigTab4.DKPHistorySlider:GetValue()) + + -- Bid Timer Size Slider + CommDKP.ConfigTab4.TimerSizeSlider = CreateFrame("SLIDER", "$parentBidTimerSizeSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + Mixin(CommDKP.ConfigTab4.TimerSizeSlider, BackdropTemplateMixin) + CommDKP.ConfigTab4.TimerSizeSlider:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + CommDKP.ConfigTab4.TimerSizeSlider:SetPoint("TOPLEFT", CommDKP.ConfigTab4.historySlider, "BOTTOMLEFT", 0, -50); + CommDKP.ConfigTab4.TimerSizeSlider:SetMinMaxValues(0.5, 2.0); + CommDKP.ConfigTab4.TimerSizeSlider:SetValue(core.DB.defaults.BidTimerSize); + CommDKP.ConfigTab4.TimerSizeSlider:SetValueStep(0.05); + CommDKP.ConfigTab4.TimerSizeSlider.tooltipText = L["TIMERSIZE"] + CommDKP.ConfigTab4.TimerSizeSlider.tooltipRequirement = L["TIMERSIZETTDESC"] + CommDKP.ConfigTab4.TimerSizeSlider.tooltipWarning = L["TIMERSIZETTWARN"] + CommDKP.ConfigTab4.TimerSizeSlider:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.TimerSizeSlider:GetName().."Low"):SetText("50%") + getglobal(CommDKP.ConfigTab4.TimerSizeSlider:GetName().."High"):SetText("200%") + CommDKP.ConfigTab4.TimerSizeSlider:SetScript("OnValueChanged", function(self) + CommDKP.ConfigTab4.TimerSize:SetText(CommDKP.ConfigTab4.TimerSizeSlider:GetValue()) + core.DB.defaults.BidTimerSize = CommDKP.ConfigTab4.TimerSizeSlider:GetValue(); + CommDKP.BidTimer:SetScale(core.DB.defaults.BidTimerSize); + end) + + CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.TimerSizeSlider, "TOP", 0, 3); + CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["TIMERSIZE"]) + + CommDKP.ConfigTab4.TimerSize = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.TimerSize:SetAutoFocus(false) + CommDKP.ConfigTab4.TimerSize:SetMultiLine(false) + CommDKP.ConfigTab4.TimerSize:SetSize(50, 18) + CommDKP.ConfigTab4.TimerSize:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.TimerSize:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.TimerSize:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.TimerSize:SetMaxLetters(4) + CommDKP.ConfigTab4.TimerSize:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.TimerSize:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.TimerSize:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.TimerSize:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.TimerSize:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.TimerSize:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.TimerSizeSlider:SetValue(CommDKP.ConfigTab4.TimerSize:GetNumber()); + end) + CommDKP.ConfigTab4.TimerSize:SetPoint("TOP", CommDKP.ConfigTab4.TimerSizeSlider, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.TimerSize:SetText(CommDKP.ConfigTab4.TimerSizeSlider:GetValue()) + + -- UI Scale Size Slider + CommDKP.ConfigTab4.CommDKPScaleSize = CreateFrame("SLIDER", "$parentCommDKPScaleSizeSlider", CommDKP.ConfigTab4, "CommDKPOptionsSliderTemplate"); + Mixin(CommDKP.ConfigTab4.CommDKPScaleSize, BackdropTemplateMixin) + CommDKP.ConfigTab4.CommDKPScaleSize:SetBackdrop({ + bgFile = "Interface\\Buttons\\UI-SliderBar-Background", + edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", + tile = true, tileSize = 8, edgeSize = 8, + insets = { left = 3, right = 3, top = 6, bottom = 6 } + }) + CommDKP.ConfigTab4.CommDKPScaleSize:SetPoint("TOPLEFT", CommDKP.ConfigTab4.DKPHistorySlider, "BOTTOMLEFT", 0, -50); + CommDKP.ConfigTab4.CommDKPScaleSize:SetMinMaxValues(0.5, 2.0); + CommDKP.ConfigTab4.CommDKPScaleSize:SetValue(core.DB.defaults.CommDKPScaleSize); + CommDKP.ConfigTab4.CommDKPScaleSize:SetValueStep(0.05); + CommDKP.ConfigTab4.CommDKPScaleSize.tooltipText = L["CommDKPSCALESIZE"] + CommDKP.ConfigTab4.CommDKPScaleSize.tooltipRequirement = L["CommDKPSCALESIZETTDESC"] + CommDKP.ConfigTab4.CommDKPScaleSize.tooltipWarning = L["CommDKPSCALESIZETTWARN"] + CommDKP.ConfigTab4.CommDKPScaleSize:SetObeyStepOnDrag(true); + getglobal(CommDKP.ConfigTab4.CommDKPScaleSize:GetName().."Low"):SetText("50%") + getglobal(CommDKP.ConfigTab4.CommDKPScaleSize:GetName().."High"):SetText("200%") + CommDKP.ConfigTab4.CommDKPScaleSize:SetScript("OnValueChanged", function(self) + CommDKP.ConfigTab4.UIScaleSize:SetText(CommDKP.ConfigTab4.CommDKPScaleSize:GetValue()) + core.DB.defaults.CommDKPScaleSize = CommDKP.ConfigTab4.CommDKPScaleSize:GetValue(); + end) + + CommDKP.ConfigTab4.DKPHistoryHeader = CommDKP.ConfigTab4:CreateFontString(nil, "OVERLAY") + CommDKP.ConfigTab4.DKPHistoryHeader:SetFontObject("CommDKPTinyCenter"); + CommDKP.ConfigTab4.DKPHistoryHeader:SetPoint("BOTTOM", CommDKP.ConfigTab4.CommDKPScaleSize, "TOP", 0, 3); + CommDKP.ConfigTab4.DKPHistoryHeader:SetText(L["MAINGUISIZE"]) + + CommDKP.ConfigTab4.UIScaleSize = CreateFrame("EditBox", nil, CommDKP.ConfigTab4, BackdropTemplateMixin and "BackdropTemplate" or nil) + CommDKP.ConfigTab4.UIScaleSize:SetAutoFocus(false) + CommDKP.ConfigTab4.UIScaleSize:SetMultiLine(false) + CommDKP.ConfigTab4.UIScaleSize:SetSize(50, 18) + CommDKP.ConfigTab4.UIScaleSize:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\CommunityDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2, + }); + CommDKP.ConfigTab4.UIScaleSize:SetBackdropColor(0,0,0,0.9) + CommDKP.ConfigTab4.UIScaleSize:SetBackdropBorderColor(0.12, 0.12, 0.34, 1) + CommDKP.ConfigTab4.UIScaleSize:SetMaxLetters(4) + CommDKP.ConfigTab4.UIScaleSize:SetTextColor(1, 1, 1, 1) + CommDKP.ConfigTab4.UIScaleSize:SetFontObject("CommDKPTinyCenter") + CommDKP.ConfigTab4.UIScaleSize:SetTextInsets(10, 10, 5, 5) + CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEscapePressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEnterPressed", function(self) -- clears focus on esc + self:ClearFocus() + end) + CommDKP.ConfigTab4.UIScaleSize:SetScript("OnEditFocusLost", function(self) -- clears focus on esc + CommDKP.ConfigTab4.CommDKPScaleSize:SetValue(CommDKP.ConfigTab4.UIScaleSize:GetNumber()); + end) + CommDKP.ConfigTab4.UIScaleSize:SetPoint("TOP", CommDKP.ConfigTab4.CommDKPScaleSize, "BOTTOM", 0, -3) + CommDKP.ConfigTab4.UIScaleSize:SetText(CommDKP.ConfigTab4.CommDKPScaleSize:GetValue()) + + -- Suppress Broadcast Notifications checkbox + CommDKP.ConfigTab4.SuppressNotifications = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.SuppressNotifications:SetPoint("TOP", CommDKP.ConfigTab4.TimerSizeSlider, "BOTTOMLEFT", 0, -35) + CommDKP.ConfigTab4.SuppressNotifications:SetChecked(core.DB.defaults.SuppressNotifications) + CommDKP.ConfigTab4.SuppressNotifications:SetScale(0.8) + CommDKP.ConfigTab4.SuppressNotifications.text:SetText("|cff5151de"..L["SUPPRESSNOTIFICATIONS"].."|r"); + CommDKP.ConfigTab4.SuppressNotifications.text:SetFontObject("CommDKPSmall") + CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["SUPPRESSNOTIFICATIONS"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["SUPPRESSNOTIFYTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["SUPPRESSNOTIFYTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + CommDKP.ConfigTab4.SuppressNotifications:SetScript("OnClick", function() + if CommDKP.ConfigTab4.SuppressNotifications:GetChecked() then + CommDKP:Print(L["NOTIFICATIONSLIKETHIS"].." |cffff0000"..L["HIDDEN"].."|r.") + core.DB["defaults"]["SuppressNotifications"] = true; + else + core.DB["defaults"]["SuppressNotifications"] = false; + CommDKP:Print(L["NOTIFICATIONSLIKETHIS"].." |cff00ff00"..L["VISIBLE"].."|r.") + end + PlaySound(808) + end) + + -- Combat Logging checkbox + CommDKP.ConfigTab4.CombatLogging = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.CombatLogging:SetPoint("TOP", CommDKP.ConfigTab4.SuppressNotifications, "BOTTOM", 0, 0) + CommDKP.ConfigTab4.CombatLogging:SetChecked(core.DB.defaults.AutoLog) + CommDKP.ConfigTab4.CombatLogging:SetScale(0.8) + CommDKP.ConfigTab4.CombatLogging.text:SetText("|cff5151de"..L["AUTOCOMBATLOG"].."|r"); + CommDKP.ConfigTab4.CombatLogging.text:SetFontObject("CommDKPSmall") + CommDKP.ConfigTab4.CombatLogging:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["AUTOCOMBATLOG"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["AUTOCOMBATLOGTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["AUTOCOMBATLOGTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.CombatLogging:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + CommDKP.ConfigTab4.CombatLogging:SetScript("OnClick", function(self) + core.DB.defaults.AutoLog = self:GetChecked() + PlaySound(808) + end) + + if core.DB.defaults.AutoOpenBid == nil then + core.DB.defaults.AutoOpenBid = true + end + + CommDKP.ConfigTab4.AutoOpenCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.AutoOpenCheckbox:SetChecked(core.DB.defaults.AutoOpenBid) + CommDKP.ConfigTab4.AutoOpenCheckbox:SetScale(0.8); + CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetText("|cff5151de"..L["AUTOOPEN"].."|r"); + CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetScale(1); + CommDKP.ConfigTab4.AutoOpenCheckbox.text:SetFontObject("CommDKPSmallLeft") + CommDKP.ConfigTab4.AutoOpenCheckbox:SetPoint("TOP", CommDKP.ConfigTab4.CombatLogging, "BOTTOM", 0, 0); + CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnClick", function(self) + core.DB.defaults.AutoOpenBid = self:GetChecked() + end) + CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_LEFT"); + GameTooltip:SetText(L["AUTOOPEN"], 0.25, 0.75, 0.90, 1, true); + GameTooltip:AddLine(L["AUTOOPENTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end) + CommDKP.ConfigTab4.AutoOpenCheckbox:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + if core.IsOfficer == true then + CommDKP.ConfigTab4.AutoAwardLootCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetChecked(core.DB.defaults.AutoAwardLoot) + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScale(0.8); + CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetText("|cff5151de"..L["AUTOAWARDLOOT"].."|r"); + CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetScale(1); + CommDKP.ConfigTab4.AutoAwardLootCheckbox.text:SetFontObject("CommDKPSmallLeft") + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetPoint("TOP", CommDKP.ConfigTab4.AutoOpenCheckbox, "BOTTOM", 0, 0); + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnClick", function(self) + core.DB.defaults.AutoAwardLoot = self:GetChecked() + + if core.DB.defaults.AutoAwardLoot == false then + core.DB.pendingLoot = {} + end + + end) + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_LEFT"); + GameTooltip:SetText(L["AUTOAWARDLOOT"], 0.25, 0.75, 0.90, 1, true); + GameTooltip:AddLine(L["AUTOAWARDLOOTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end) + CommDKP.ConfigTab4.AutoAwardLootCheckbox:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + -- Suppress Broadcast Notifications checkbox + CommDKP.ConfigTab4.SuppressTells = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.SuppressTells:SetPoint("LEFT", CommDKP.ConfigTab4.SuppressNotifications, "RIGHT", 200, 0) + CommDKP.ConfigTab4.SuppressTells:SetChecked(core.DB.defaults.SuppressTells) + CommDKP.ConfigTab4.SuppressTells:SetScale(0.8) + CommDKP.ConfigTab4.SuppressTells.text:SetText("|cff5151de"..L["SUPPRESSBIDWHISP"].."|r"); + CommDKP.ConfigTab4.SuppressTells.text:SetFontObject("CommDKPSmall") + CommDKP.ConfigTab4.SuppressTells:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(L["SUPPRESSBIDWHISP"], 0.25, 0.75, 0.90, 1, true) + GameTooltip:AddLine(L["SuppressBIDWHISPTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:AddLine(L["SuppressBIDWHISPTTWARN"], 1.0, 0, 0, true); + GameTooltip:Show() + end) + CommDKP.ConfigTab4.SuppressTells:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + CommDKP.ConfigTab4.SuppressTells:SetScript("OnClick", function() + if CommDKP.ConfigTab4.SuppressTells:GetChecked() then + CommDKP:Print(L["BIDWHISPARENOW"].." |cffff0000"..L["HIDDEN"].."|r.") + core.DB["defaults"]["SuppressTells"] = true; + else + core.DB["defaults"]["SuppressTells"] = false; + CommDKP:Print(L["BIDWHISPARENOW"].." |cff00ff00"..L["VISIBLE"].."|r.") + end + PlaySound(808) + end) + + if core.DB.defaults.DecreaseDisenchantValue == nil then + core.DB.defaults.DecreaseDisenchantValue = false + end + + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox = CreateFrame("CheckButton", nil, CommDKP.ConfigTab4, "UICheckButtonTemplate"); + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetPoint("LEFT", CommDKP.ConfigTab4.CombatLogging, "RIGHT", 200, 0) + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetChecked(core.DB.defaults.DecreaseDisenchantValue) + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScale(0.8); + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox.text:SetText("|cff5151de"..L["DECREASEDISENCHANT"].."|r"); + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox.text:SetFontObject("CommDKPSmall") + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnClick", function(self) + core.DB.defaults.DecreaseDisenchantValue = self:GetChecked() + end) + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_LEFT"); + GameTooltip:SetText(L["DECREASEDISENCHANT"], 0.25, 0.75, 0.90, 1, true); + GameTooltip:AddLine(L["DECREASEDISENCHANTTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end) + CommDKP.ConfigTab4.DecreaseDisenchantCheckbox:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + + end + + -- Save Settings Button + CommDKP.ConfigTab4.submitSettings = self:CreateButton("BOTTOMLEFT", CommDKP.ConfigTab4, "BOTTOMLEFT", 30, 30, L["SAVESETTINGS"]); + CommDKP.ConfigTab4.submitSettings:ClearAllPoints(); + CommDKP.ConfigTab4.submitSettings:SetPoint("TOP", CommDKP.ConfigTab4.AutoOpenCheckbox, "BOTTOMLEFT", 20, -40) + CommDKP.ConfigTab4.submitSettings:SetSize(90,25) + CommDKP.ConfigTab4.submitSettings:SetScript("OnClick", function() + if core.IsOfficer == true then + for i=1, 6 do + if not tonumber(CommDKP.ConfigTab4.default[i]:GetText()) then + StaticPopupDialogs["OPTIONS_VALIDATION"] = { + text = L["INVALIDOPTIONENTRY"].." "..CommDKP.ConfigTab4.default[i].tooltipText..". "..L["PLEASEUSENUMS"], + button1 = L["OK"], + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("OPTIONS_VALIDATION") + + return; + end + end + for i=1, 17 do + if not tonumber(CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i]:GetText()) then + StaticPopupDialogs["OPTIONS_VALIDATION"] = { + text = L["INVALIDMINBIDENTRY"].." "..CommDKP.ConfigTab4.DefaultMinBids.SlotBox[i].tooltipText..". "..L["PLEASEUSENUMS"], + button1 = L["OK"], + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("OPTIONS_VALIDATION") + + return; + end + end + end + + SaveSettings() + CommDKP:Print(L["DEFAULTSETSAVED"]) + end) + + -- Chatframe Selection + CommDKP.ConfigTab4.ChatFrame = CreateFrame("FRAME", "CommDKPChatFrameSelectDropDown", CommDKP.ConfigTab4, "CommunityDKPUIDropDownMenuTemplate") + if not core.DB.defaults.ChatFrames then core.DB.defaults.ChatFrames = {} end + + UIDropDownMenu_Initialize(CommDKP.ConfigTab4.ChatFrame, function(self, level, menuList) + local SelectedFrame = UIDropDownMenu_CreateInfo() + SelectedFrame.func = self.SetValue + SelectedFrame.fontObject = "CommDKPSmallCenter" + SelectedFrame.keepShownOnClick = true; + SelectedFrame.isNotRadio = true; + + for i = 1, NUM_CHAT_WINDOWS do + local name = GetChatWindowInfo(i) + if name ~= "" then + SelectedFrame.text, SelectedFrame.arg1, SelectedFrame.checked = name, name, core.DB.defaults.ChatFrames[name] + UIDropDownMenu_AddButton(SelectedFrame) + end + end + end) + + CommDKP.ConfigTab4.ChatFrame:SetPoint("LEFT", CommDKP.ConfigTab4.AutoOpenCheckbox, "RIGHT", 130, 0) + UIDropDownMenu_SetWidth(CommDKP.ConfigTab4.ChatFrame, 150) + UIDropDownMenu_SetText(CommDKP.ConfigTab4.ChatFrame, "Addon Notifications") + + function CommDKP.ConfigTab4.ChatFrame:SetValue(arg1) + core.DB.defaults.ChatFrames[arg1] = not core.DB.defaults.ChatFrames[arg1] + CloseDropDownMenus() + end + + + + -- Position Bid Timer Button + CommDKP.ConfigTab4.moveTimer = self:CreateButton("BOTTOMRIGHT", CommDKP.ConfigTab4, "BOTTOMRIGHT", -50, 30, L["MOVEBIDTIMER"]); + CommDKP.ConfigTab4.moveTimer:ClearAllPoints(); + CommDKP.ConfigTab4.moveTimer:SetPoint("LEFT", CommDKP.ConfigTab4.submitSettings, "RIGHT", 200, 0) + CommDKP.ConfigTab4.moveTimer:SetSize(110,25) + CommDKP.ConfigTab4.moveTimer:SetScript("OnClick", function() + if moveTimerToggle == 0 then + CommDKP:StartTimer(120, L["MOVEME"]) + CommDKP.ConfigTab4.moveTimer:SetText(L["HIDEBIDTIMER"]) + moveTimerToggle = 1; + else + CommDKP.BidTimer:SetScript("OnUpdate", nil) + CommDKP.BidTimer:Hide() + CommDKP.ConfigTab4.moveTimer:SetText(L["MOVEBIDTIMER"]) + moveTimerToggle = 0; + end + end) + + -- wipe tables button + CommDKP.ConfigTab4.WipeTables = self:CreateButton("BOTTOMRIGHT", CommDKP.ConfigTab4, "BOTTOMRIGHT", -50, 30, L["WIPETABLES"]); + CommDKP.ConfigTab4.WipeTables:ClearAllPoints(); + CommDKP.ConfigTab4.WipeTables:SetPoint("RIGHT", CommDKP.ConfigTab4.moveTimer, "LEFT", -40, 0) + CommDKP.ConfigTab4.WipeTables:SetSize(110,25) + CommDKP.ConfigTab4.WipeTables:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); + GameTooltip:SetText(L["WIPETABLES"], 0.25, 0.75, 0.90, 1, true); + GameTooltip:AddLine(L["WIPETABLESTTDESC"], 1.0, 1.0, 1.0, true); + GameTooltip:Show(); + end) + CommDKP.ConfigTab4.WipeTables:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + CommDKP.ConfigTab4.WipeTables:SetScript("OnClick", function() + + StaticPopupDialogs["WIPE_TABLES"] = { + text = L["WIPETABLESCONF"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = function() + CommDKP:SetTable(CommDKP_Whitelist, false, nil); + CommDKP:SetTable(CommDKP_DKPTable, true, nil); + CommDKP:SetTable(CommDKP_Loot, true, nil); + CommDKP:SetTable(CommDKP_DKPHistory, true, nil); + CommDKP:SetTable(CommDKP_Archive, true, nil); + CommDKP:SetTable(CommDKP_Standby, true, nil); + CommDKP:SetTable(CommDKP_MinBids, true, nil); + CommDKP:SetTable(CommDKP_MaxBids, true, nil); + + CommDKP:SetTable(CommDKP_DKPTable, true, {}); + CommDKP:SetTable(CommDKP_Loot, true, {}); + CommDKP:SetTable(CommDKP_DKPHistory, true, {}); + CommDKP:SetTable(CommDKP_Archive, true, {}); + CommDKP:SetTable(CommDKP_Whitelist, false, {}); + CommDKP:SetTable(CommDKP_Standby, true, {}); + CommDKP:SetTable(CommDKP_MinBids, true, {}); + CommDKP:SetTable(CommDKP_MaxBids, true, {}); + CommDKP:LootHistory_Reset() + CommDKP:FilterDKPTable(core.currentSort, "reset") + CommDKP:StatusVerify_Update() + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("WIPE_TABLES") + end) + + -- Options Footer (empty frame to push bottom of scrollframe down) + CommDKP.ConfigTab4.OptionsFooterFrame = CreateFrame("Frame", nil, CommDKP.ConfigTab4); + CommDKP.ConfigTab4.OptionsFooterFrame:SetPoint("TOPLEFT", CommDKP.ConfigTab4.moveTimer, "BOTTOMLEFT") + CommDKP.ConfigTab4.OptionsFooterFrame:SetSize(420, 50); + +end diff --git a/init.lua b/init.lua index 4819990c..b452bdfd 100644 --- a/init.lua +++ b/init.lua @@ -1,1328 +1,1330 @@ -local _, core = ...; -local _G = _G; -local CommDKP = core.CommDKP; -local L = core.L; -local waitTable = {}; -local waitFrame = nil; -local lockouts = CreateFrame("Frame", "LockoutsFrame"); -local eventDelay = {}; - --------------------------------------- --- Slash Command --------------------------------------- -CommDKP.Commands = { - ["config"] = function() - if core.Initialized then - local pass, err = pcall(CommDKP.Toggle) - if not pass then - CommDKP:Print(err) - core.CommDKPUI:SetShown(false) - StaticPopupDialogs["SUGGEST_RELOAD"] = { - text = "|CFFFF0000"..L["WARNING"].."|r: "..L["MUSTRELOADUI"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = function() - ReloadUI(); - end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show ("SUGGEST_RELOAD") - end - else - CommDKP:Print("CommunityDKP has not completed initialization.") - end - end, - ["reset"] = CommDKP.ResetPosition, - ["bid"] = function(...) - if core.Initialized then - local item = strjoin(" ", ...) - CommDKP:CheckOfficer() - CommDKP:StatusVerify_Update() - - if core.IsOfficer then - if ... == nil then - if core.BidAuctioneer then - CommDKP:ToggleBidWindow() - else - CommDKP:BidInterface_Toggle() - end - else - local itemName,_,_,_,_,_,_,_,_,itemIcon = GetItemInfo(item) - CommDKP:Print("Opening Bid Window for: ".. item) - CommDKP:ToggleBidWindow(item, itemIcon, itemName) - end - end - CommDKP:BidInterface_Toggle() - else - CommDKP:Print("CommunityDKP has not completed initialization.") - end - end, - ["repairtables"] = function(...) -- test new features - local cmd = ... - if core.IsOfficer then - if cmd == "true" then - CommDKP:RepairTables(cmd) - else - CommDKP:RepairTables() - end - end - end, - ["award"] = function (name, ...) - if core.IsOfficer and core.Initialized then - CommDKP:StatusVerify_Update() - - if not name or not strfind(name, ":::::") then - CommDKP:Print(L["AWARDWARNING"]) - return - end - local item = strjoin(" ", ...) - if not item then return end - item = name.." "..item; - local itemName,itemLink,_,_,_,_,_,_,_,_ = GetItemInfo(item) - local cost = 0; - local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(itemLink,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") - - if itemName == nil and Name ~= nil then - itemName = Name; - end - - local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; - - if not search then - cost = CommDKP:GetMinBid(item) - else - cost = search.minbid; - end - - CommDKP:AwardConfirm(nil, cost, core.DB.bossargs.LastKilledBoss, core.DB.bossargs.CurrentRaidZone, item) - else - CommDKP:Print(L["NOPERMISSION"]) - end - end, - ["lockouts"] = function() - lockouts:RegisterEvent("UPDATE_INSTANCE_INFO"); - lockouts:SetScript("OnEvent", CommDKP_OnEvent); - RequestRaidInfo() - end, - ["timer"] = function(time, ...) - if time == nil then - CommDKP:BroadcastTimer(1, "...") - else - local title = strjoin(" ", ...) - CommDKP:BroadcastTimer(tonumber(time), title) - end - end, - ["export"] = function(time, ...) - CommDKP:ToggleExportWindow() - end, - ["modes"] = function() - if core.Initialized then - CommDKP:CheckOfficer() - if core.IsOfficer then - CommDKP:ToggleDKPModesWindow() - else - CommDKP:Print(L["NOPERMISSION"]) - end - else - CommDKP:Print("CommunityDKP has not completed initialization.") - end - end, - ["help"] = function() - CommDKP:Print(" "); - CommDKP:Print(L["SLASHCOMMANDLIST"]..":") - CommDKP:Print("|cff00cc66/dkp|r - "..L["DKPLAUNCH"]); - CommDKP:Print("|cff00cc66/dkp ?|r - "..L["HELPINFO"]); - CommDKP:Print("|cff00cc66/dkp reset|r - "..L["DKPRESETPOS"]); - CommDKP:Print("|cff00cc66/dkp lockouts|r - "..L["DKPLOCKOUT"]); - CommDKP:Print("|cff00cc66/dkp timer|r - "..L["CREATERAIDTIMER"]); - CommDKP:Print("|cff00cc66/dkp bid|r - "..L["OPENBIDWINDOWHELP"]); - CommDKP:Print("|cff00cc66/dkp bid [itemlink]|r - "..L["OPENAUCWINHELP"]); - CommDKP:Print("|cff00cc66/dkp award [item link]|r - "..L["DKPAWARDHELP"]); - CommDKP:Print("|cff00cc66/dkp modes|r - "..L["DKPMODESHELP"]); - CommDKP:Print("|cff00cc66/dkp export|r - "..L["DKPEXPORTHELP"]); - CommDKP:Print(" "); - CommDKP:Print(L["WHISPERCMDSHELP"]); - CommDKP:Print("|cff00cc66!bid (or !bid <"..L["VALUE"]..">)|r - "..L["BIDHELP"]); - CommDKP:Print("|cff00cc66!dkp (or !dkp <"..L["PLAYERNAME"]..">)|r - "..L["DKPCMDHELP"]); - end, -}; - -local function HandleSlashCommands(str) - if (#str == 0) then - CommDKP.Commands.config(); - return; - end - - local args = {}; - for _, arg in ipairs({ string.split(' ', str) }) do - if (#arg > 0) then - table.insert(args, arg); - end - end - - local path = CommDKP.Commands; - - for id, arg in ipairs(args) do - if (#arg > 0) then - arg = arg:lower(); - if (path[arg]) then - if (type(path[arg]) == "function") then - path[arg](select(id + 1, unpack(args))); - return; - elseif (type(path[arg]) == "table") then - path = path[arg]; - end - else - CommDKP.Commands.help(); - return; - end - end - end -end - -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", function(self, event, msg, ...) -- suppresses outgoing whisper responses to limit spam - - if core.DB == nil then - return false; - end - - if core.DB.defaults.SuppressTells then - if core.BidInProgress then - if strfind(msg, L["YOURBIDOF"]) == 1 then - return true - elseif strfind(msg, L["BIDDENIEDFILTER"]) == 1 then - return true - elseif strfind(msg, L["BIDACCEPTEDFILTER"]) == 1 then - return true; - elseif strfind(msg, L["NOTSUBMITTEDBID"]) == 1 then - return true; - elseif strfind(msg, L["ONLYONEROLLWARN"]) == 1 then - return true; - elseif strfind(msg, L["ROLLNOTACCEPTED"]) == 1 then - return true; - elseif strfind(msg, L["YOURBID"].." "..L["MANUALLYDENIED"]) == 1 then - return true; - elseif strfind(msg, L["CANTCANCELROLL"]) == 1 then - return true; - end - end - - if strfind(msg, "CommunityDKP: ") == 1 then - return true - elseif strfind(msg, L["DKPAVAILABLE"]) ~= nil and strfind(msg, '%[') ~= nil and strfind(msg, '%]') ~= nil then - return true - elseif strfind(msg, L["NOBIDINPROGRESS"]) == 1 then - return true - elseif strfind(msg, L["BIDCANCELLED"]) == 1 then - return true - end - end -end) - -ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", function(self, event, msg, ...) -- suppresses incoming whisper responses to limit spam - - if core.DB == nil then - return false; - end - - if core.DB.defaults.SuppressTells then - if core.BidInProgress then - if strfind(msg, "!bid") == 1 then - return true - end - end - - if strfind(msg, "!dkp") == 1 then - return true - end - end -end) - - -function CommDKP_wait(delay, func, ...) - if(type(delay)~="number" or type(func)~="function") then - return false; - end - if(waitFrame == nil) then - waitFrame = CreateFrame("Frame","WaitFrame", UIParent); - waitFrame:SetScript("onUpdate",function (self,elapse) - local count = #waitTable; - local i = 1; - while(i<=count) do - local waitRecord = tremove(waitTable,i); - local d = tremove(waitRecord,1); - local f = tremove(waitRecord,1); - local p = tremove(waitRecord,1); - if(d>elapse) then - tinsert(waitTable,i,{d-elapse,f,p}); - i = i + 1; - else - count = count - 1; - f(unpack(p)); - end - end - end); - end - tinsert(waitTable,{delay,func,{...}}); - return true; -end - -local function DoInit(event, arg1) - if CommDKP:MonolithMigration() then - return -- Legacy MonolithDKP addon detected: don't initialise any further! - end - CommDKP:OnInitialize(event, arg1); -end - -local function DoGuildUpdate() - if IsInGuild() and not core.InitStart then - GuildRoster() - core.InitStart = true - - -- Prints info after all addons have loaded. Circumvents addons that load saved chat messages pushing info out of view. - C_Timer.After(3, function () - CommDKP:CheckOfficer() - CommDKP:SortLootTable() - CommDKP:SortDKPHistoryTable() - CommDKP:Print(L["VERSION"].." "..core.MonVersion..", "..L["CREATEDMAINTAIN"].." Vapok@BloodsailBuccaneers-Classic"); - CommDKP:Print(L["LOADED"].." "..#CommDKP:GetTable(CommDKP_DKPTable, true).." "..L["PLAYERRECORDS"]..", "..#CommDKP:GetTable(CommDKP_Loot, true).." "..L["LOOTHISTRECORDS"].." "..#CommDKP:GetTable(CommDKP_DKPHistory, true).." "..L["DKPHISTRECORDS"].."."); - CommDKP:Print(L["USE"].." /dkp ? "..L["SUBMITBUGS"].." @ https://github.com/Vapok/CommunityDKP/issues"); - CommDKP.Sync:SendData("CommDKPBuild", tostring(core.BuildNumber)) -- broadcasts build number to guild to check if a newer version is available - CommDKP:SendTalentsAndRole() - - -- send seed for every team in guild - -- this basically sends index of latest entry in loot and DKP tables to everyone online in guild, - -- if they have this entry it does nothing since they are up to date, if they dont it changes seed in those tables to the index being sent - CommDKP:SendSeedData(); - end) - end -end - -function CommDKP:SendSeedData() - - local latestIndexForTeam = {} - local _teams = CommDKP:GetGuildTeamList(); - local _numberOfTeams = CommDKP:tablelength(_teams); - - for i=1, _numberOfTeams do - - latestIndexForTeam[tostring(_teams[i][1])] = {} - - if #CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1])) > 0 and strfind(CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index, "-") then - local off1,date1 = strsplit("-", CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index) - if CommDKP:ValidateSender(off1) then - latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index - else - latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = "start" - end - else - latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = "start" - end - - if #CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1])) > 0 and strfind(CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index, "-") then - local off2,date2 = strsplit("-", CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index) - if CommDKP:ValidateSender(off2) then - latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index - else - latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = "start" - end - else - latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = "start" - end - end - - --[[ - latestIndexForTeam = { - ["0"] = { - ["Loot"] = "name-date", - ["DKPHistory"] = "name-date" - }, - ["1"] = { - ["Loot"] = "start", - ["DKPHistory"] = "start" - } - } - --]] - - CommDKP.Sync:SendData("CommDKPSeed", latestIndexForTeam) -- requests role and spec data and sends current seeds (index of newest DKP and Loot entries) - -end - -function CommDKP_OnEvent(self, event, arg1, ...) - if event == "ADDON_LOADED" then - if (arg1 ~= "CommunityDKP") then return end - core.IsOfficer = nil - core.Initialized = false - CommDKP_wait(2, DoInit, event, arg1); - ---DoInit(event,arg1); - self:UnregisterEvent("ADDON_LOADED") - return; - end - - -- If core.DB is nil, that means that the addon hasn't fully initialized.. so let's wait 1 second and try again. - if core.DB == nil then - if eventDelay[event] == nil then - eventDelay[event] = 1; - else - eventDelay[event] = eventDelay[event] + 2; - end - C_Timer.After(eventDelay[event], function () CommDKP_OnEvent(self, event, arg1); end); - return; - end - - if eventDelay[event] ~= nil then - eventDelay[event] = nil; - end - - -- unregister unneccessary events - if event == "CHAT_MSG_WHISPER" and not core.DB.modes.channels.whisper then - self:UnregisterEvent("CHAT_MSG_WHISPER") - return - end - if (event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER") and not core.DB.modes.channels.raid then - self:UnregisterEvent("CHAT_MSG_RAID") - self:UnregisterEvent("CHAT_MSG_RAID_LEADER") - return - end - if event == "CHAT_MSG_GUILD" and not core.DB.modes.channels.guild and not core.DB.modes.StandbyOptIn then - self:UnregisterEvent("CHAT_MSG_GUILD") - return - end - - if event == "BOSS_KILL" then - CommDKP:CheckOfficer() - if core.IsOfficer and IsInRaid() then - local boss_name = ...; - if CommDKP:Table_Search(core.EncounterList, arg1) then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue(arg1) - - if core.DB.modes.StandbyOptIn and core.RaidInProgress then - CommDKP_Standby_Announce(boss_name) - end - - if core.DB.modes.AutoAward and core.RaidInProgress then - if not core.DB.modes.StandbyOptIn and core.DB.DKPBonus.IncStandby then - CommDKP:AutoAward(3, core.DB.DKPBonus.BossKillBonus, core.DB.bossargs.CurrentRaidZone..": "..core.DB.bossargs.LastKilledBoss) - else - CommDKP:AutoAward(1, core.DB.DKPBonus.BossKillBonus, core.DB.bossargs.CurrentRaidZone..": "..core.DB.bossargs.LastKilledBoss) - end - end - else - CommDKP:Print("Event ID: "..arg1.." - > "..boss_name.." Killed. Please report this Event ID at https://www.curseforge.com/wow/addons/communitydkp/issues to update raid event handlers.") - end - elseif IsInRaid() then - core.DB.bossargs.LastKilledBoss = ...; - end - elseif event == "ENCOUNTER_START" then - if core.DB.defaults.AutoLog and IsInRaid() then - if not LoggingCombat() then - LoggingCombat(1) - CommDKP:Print(L["NOWLOGGINGCOMBAT"]) - end - end - elseif event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA" then -- logs 15 recent zones entered while in a raid party - if IsInRaid() and core.Initialized then -- only processes combat log events if in raid - CommDKP:CheckOfficer() - if core.IsOfficer then - if not CommDKP:Table_Search(core.DB.bossargs.RecentZones, GetRealZoneText()) then -- only adds it if it doesn't already exist in the table - if #core.DB.bossargs.RecentZones > 14 then - for i=15, #core.DB.bossargs.RecentZones do -- trims the tail end of the stack - table.remove(core.DB.bossargs.RecentZones, i) - end - end - table.insert(core.DB.bossargs.RecentZones, 1, GetRealZoneText()) - end - end - if core.DB.defaults.AutoLog and CommDKP:Table_Search(core.ZoneList, GetRealZoneText()) then - if not LoggingCombat() then - LoggingCombat(1) - CommDKP:Print(L["NOWLOGGINGCOMBAT"]) - end - end - end - if core.Initialized then - CommDKP:SendTalentsAndRole() - end - elseif event == "CHAT_MSG_WHISPER" then - CommDKP:CheckOfficer() - if core.IsOfficer then - - arg1 = strlower(arg1) - if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) then - CommDKP_CHAT_MSG_WHISPER(arg1, ...) - elseif string.find(arg1, "!standby") == 1 and core.StandbyActive then - CommDKP_Standby_Handler(arg1, ...) - end - end - elseif event == "GUILD_ROSTER_UPDATE" then - - if not core.InitStart then - DoGuildUpdate(); - end - - if IsInGuild() and core.InitStart then - self:UnregisterEvent("GUILD_ROSTER_UPDATE") - end - elseif event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER" then - CommDKP:CheckOfficer() - arg1 = strlower(arg1) - if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!standby") == 1 or string.find(arg1, "!dkp") == 1) and core.IsOfficer == true then - CommDKP_CHAT_MSG_WHISPER(arg1, ...) - end - elseif event == "UPDATE_INSTANCE_INFO" then - local num = GetNumSavedInstances() - local raidString, reset, newreset, days, hours, mins, maxPlayers, numEncounter, curLength; - - if not core.DB.Lockouts then core.DB.Lockouts = {Three = 0, Five = 1570032000, Seven = 1569945600} end - - for i=1, num do -- corrects reset timestamp for any raids where an active lockout exists - _,_,reset,_,_,_,_,_,maxPlayers,_,numEncounter = GetSavedInstanceInfo(i) - newreset = time() + reset + 2 -- returned time is 2 seconds off - - if maxPlayers == 40 and numEncounter > 1 then - curLength = "Seven" - elseif maxPlayers == 40 and numEncounter == 1 then - curLength = "Five" - elseif maxPlayers == 20 then - curLength = "Three" - end - - if core.DB.Lockouts[curLength] < newreset then - core.DB.Lockouts[curLength] = newreset - end - end - - -- Updates lockout timer if no lockouts were found to do so. - while core.DB.Lockouts.Three < time() do core.DB.Lockouts.Three = core.DB.Lockouts.Three + 259200 end - while core.DB.Lockouts.Five < time() do core.DB.Lockouts.Five = core.DB.Lockouts.Five + 432000 end - while core.DB.Lockouts.Seven < time() do core.DB.Lockouts.Seven = core.DB.Lockouts.Seven + 604800 end - - for k,v in pairs(core.DB.Lockouts) do - reset = v - time(); - days = math.floor(reset / 86400) - hours = math.floor(math.floor(reset % 86400) / 3600) - mins = math.ceil((reset % 3600) / 60) - - if days > 1 then days = " "..days.." "..L["DAYS"] elseif days == 0 then days = "" else days = " "..days.." "..L["DAY"] end - if hours > 1 then hours = " "..hours.." "..L["HOURS"] elseif hours == 0 then hours = "" else hours = " "..hours.." "..L["HOUR"].."." end - if mins > 1 then mins = " "..mins.." "..L["MINUTES"].."." elseif mins == 0 then mins = "" else mins = " "..mins.." "..L["MINUTE"].."." end - - if k == "Three" then raidString = "ZG, AQ20" - elseif k == "Five" then raidString = "Onyxia" - elseif k == "Seven" then raidString = "MC, BWL, AQ40" - end - - if k ~= "Three" then -- remove when three day raid lockouts are added - CommDKP:Print(raidString.." "..L["RESETSIN"]..days..hours..mins.." ("..date("%A @ %H:%M:%S%p", v)..")") - end - end - - self:UnregisterEvent("UPDATE_INSTANCE_INFO"); - elseif event == "CHAT_MSG_GUILD" then - CommDKP:CheckOfficer() - if core.IsOfficer then - arg1 = strlower(arg1) - if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) and core.DB.modes.channels.guild then - CommDKP_CHAT_MSG_WHISPER(arg1, ...) - elseif string.find(arg1, "!standby") == 1 and core.StandbyActive then - CommDKP_Standby_Handler(arg1, ...) - end - end - --elseif event == "CHAT_MSG_SYSTEM" then - --MonoDKP_CHAT_MSG_SYSTEM(arg1) - elseif event == "GROUP_ROSTER_UPDATE" then --updates raid listing if window is open - if CommDKP.UIConfig and core.CommDKPUI:IsShown() then - if core.CurSubView == "raid" then - CommDKP:ViewLimited(true) - elseif core.CurSubView == "raid and standby" then - CommDKP:ViewLimited(true, true) - end - end - elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then -- logs last 15 NPCs killed while in raid - if IsInRaid() then -- only processes combat log events if in raid - local _,arg1,_,_,_,_,_,arg2,arg3 = CombatLogGetCurrentEventInfo(); - if arg1 == "UNIT_DIED" and not strfind(arg2, "Player") and not strfind(arg2, "Pet-") then - CommDKP:CheckOfficer() - if core.IsOfficer then - if not CommDKP:Table_Search(core.DB.bossargs.LastKilledNPC, arg3) then -- only adds it if it doesn't already exist in the table - if #core.DB.bossargs.LastKilledNPC > 14 then - for i=15, #core.DB.bossargs.LastKilledNPC do -- trims the tail end of the stack - table.remove(core.DB.bossargs.LastKilledNPC, i) - end - end - table.insert(core.DB.bossargs.LastKilledNPC, 1, arg3) - end - end - end - end - --[[elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then -- replaced with above BOSS_KILL event handler - if IsInRaid() then -- only processes combat log events if in raid - local _,arg1,_,_,_,_,_,_,arg2 = CombatLogGetCurrentEventInfo(); -- run operation when boss is killed - if arg1 == "UNIT_DIED" then - CommDKP:CheckOfficer() - if core.IsOfficer == true then - if CommDKP:TableStrFind(core.BossList, arg2) then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue(arg2) - elseif arg2 == "Flamewalker Elite" or arg2 == "Flamewalker Healer" then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Majordomo Executus") - elseif arg2 == "Emperor Vek'lor" or arg2 == "Emperor Vek'nilash" then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Twin Emperors") - elseif arg2 == "Princess Yauj" or arg2 == "Vem" or arg2 == "Lord Kri" then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Bug Family") - elseif arg2 == "Highlord Mograine" or arg2 == "Thane Korth'azz" or arg2 == "Sir Zeliek" or arg2 == "Lady Blaumeux" then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue("The Four Horsemen") - elseif arg2 == "Gri'lek" or arg2 == "Hazza'rah" or arg2 == "Renataki" or arg2 == "Wushoolay" then - CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Edge of Madness") - end - end - end - end--]] - elseif event == "LOOT_OPENED" then - CommDKP:CheckOfficer(); - if core.IsOfficer then - local lootTable = {} - local lootList = {}; - - if IsInRaid() then - for i=1, GetNumLootItems() do - if LootSlotHasItem(i) and GetLootSlotLink(i) then - local _,link,quality = GetItemInfo(GetLootSlotLink(i)) - if quality >= 4 then - table.insert(lootTable, link) - end - end - end - local name - if not UnitIsFriend("player", "target") and UnitIsDead("target") then - name = UnitName("target") -- sets bidding window name to current target - else - name = core.LastKilledBoss -- sets name to last killed boss if no target is available (chests) - end - lootTable.boss=name - CommDKP.Sync:SendData("CommDKPBossLoot", lootTable) - - for i=1, #lootTable do - local item = Item:CreateFromItemLink(lootTable[i]); - item:ContinueOnItemLoad(function() - local icon = item:GetItemIcon() - table.insert(lootList, {icon=icon, link=item:GetItemLink()}) - end); - end - - CommDKP:LootTable_Set(lootList) - end - end - elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_SHOW" then - local traderName = UnitName("npc") - if traderName == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then - return - end - core.DB.pendingTradePlayer = traderName - core.DB.pendingTrade = {} - local pendingLoot = core.DB.pendingLoot[traderName] - for i, lootLink in pairs(pendingLoot) do - local awarded = false - for containerSlot = 0, NUM_BAG_FRAMES do - for bagSlot = 1, GetContainerNumSlots(containerSlot) do - local containerLink = GetContainerItemLink(containerSlot, bagSlot) - if not awarded and containerLink ~= nil and containerLink == lootLink then - ClearCursor() - PickupContainerItem(containerSlot, bagSlot) - local tradeSlot = TradeFrame_GetAvailableSlot() - if tradeSlot ~= nil and tradeSlot <= 6 then - ClickTradeButton(tradeSlot) - pendingLoot[i] = nil - tinsert(core.DB.pendingTrade, lootLink) - awarded = true - end - end - end - end - end - elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_ACCEPT_UPDATE" then - local arg2 = ... - local traderName = UnitName("npc") - if traderName == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then - return - end - if arg1 ~= nil and arg1 == 1 then - local pendingLoot = core.DB.pendingLoot[traderName] - if core.DB.pendingTrade == nil then - core.DB.pendingTrade = {} - end - for tradeSlot = 1, 6 do - local tradeLink = GetTradePlayerItemLink(tradeSlot) - for i, lootLink in pairs(pendingLoot) do - if tradeLink ~= nil and tradeLink == lootLink then - tinsert(core.DB.pendingTrade, tradeLink) - end - end - end - end - elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_CLOSED" then - local traderName = UnitName("npc") - if traderName == nil or core.DB.pendingTrade == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then - return - end - local pendingLoot = core.DB.pendingLoot[traderName] - for _, tradeLink in pairs(core.DB.pendingTrade) do - for i, lootLink in pairs(pendingLoot) do - if tradeLink == lootLink then - pendingLoot[i] = nil - end - end - end - if #pendingLoot <= 0 then - core.DB.pendingLoot[traderName] = nil - end - core.DB.pendingTrade = {} - core.DB.pendingTradePlayer = nil - end -end - -function CommDKP:OnInitialize(event, name) -- This is the FIRST function to run on load triggered registered events at bottom of file - if (name ~= "CommunityDKP") then return end - - -- allows using left and right buttons to move through chat 'edit' box - --[[for i = 1, NUM_CHAT_WINDOWS do - _G["ChatFrame"..i.."EditBox"]:SetAltArrowKeyMode(false); - end--]] - - ---------------------------------- - -- Register Slash Commands - ---------------------------------- - SLASH_CommunityDKP1 = "/dkp"; - SLASH_CommunityDKP2 = "/CommDKP"; - SlashCmdList.CommunityDKP = HandleSlashCommands; - - --[[SLASH_RELOADUI1 = "/rl"; -- new slash command for reloading UI -- for debugging - SlashCmdList.RELOADUI = ReloadUI;--]] - - SLASH_FRAMESTK1 = "/fs"; -- new slash command for showing framestack tool - SlashCmdList.FRAMESTK = function() - LoadAddOn("Blizzard_DebugTools"); - FrameStackTooltip_Toggle(); - end - - if(event == "ADDON_LOADED") then - C_Timer.After(5, function () - core.CommDKPUI = CommDKP.UIConfig or CommDKP:CreateMenu(); -- creates main menu after 5 seconds (trying to initialize after raid frames are loaded) - core.KeyEventUI = CreateFrame("Frame","KeyEventFrame", UIParent); - - -- on every key down ? really? - core.KeyEventUI:SetScript("OnKeyDown", function(self, key) - if core.Initialized and core.IsOfficer then - if MouseIsOver(MultiBarLeft) or MouseIsOver(MultiBarRight) or MouseIsOver(MultiBarBottomLeft) or MouseIsOver(MultiBarBottomRight) or MouseIsOver(MainMenuBar) then - return; - end - -- TODO: Make this a configurable keybind. - if GameTooltip:GetItem() then - local item, link = GameTooltip:GetItem(); - - if (key == "LALT" or key == "LSHIFT") and IsShiftKeyDown() and IsAltKeyDown() then - - local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") - local itemIcon = GetItemIcon(itemID); - local itemName, itemLink = GetItemInfo(link); - - CommDKP:ToggleBidWindow(itemLink, itemIcon, itemName); - end - - if (key == "LCTRL" or key == "LSHIFT") and IsShiftKeyDown() and IsControlKeyDown() then - -- TODO: Automate the Price a Bit More - CommDKP:AwardConfirm(nil, 0, core.DB.bossargs.LastKilledBoss, core.DB.bossargs.CurrentRaidZone, link); - end - - - end - end - end); - - core.KeyEventUI:SetPropagateKeyboardInput(true); - end) - ------------------------------------------------ - -- Verify DB Schemas - ------------------------------------------------\ - if not CommDKP:VerifyDBSchema(CommDKP_DB) then CommDKP_DB = CommDKP:UpgradeDBSchema(CommDKP_DB, CommDKP_DB, false, "CommDKP_DB") end; - - -- Verify that the DB table has been initialized. - CommDKP:SetTable(CommDKP_DB, false, CommDKP:InitializeCommDKPDB(CommDKP:GetTable(CommDKP_DB))) - core.DB = CommDKP:GetTable(CommDKP_DB); --Player specific DB - - - if not CommDKP:VerifyDBSchema(CommDKP_DKPTable) then CommDKP_DKPTable = CommDKP:UpgradeDBSchema(CommDKP_DKPTable, CommDKP_DKPTable, true, "CommDKP_DKPTable") end; - if not CommDKP:VerifyDBSchema(CommDKP_Loot) then CommDKP_Loot = CommDKP:UpgradeDBSchema(CommDKP_Loot, CommDKP_Loot, true, "CommDKP_Loot") end; - if not CommDKP:VerifyDBSchema(CommDKP_DKPHistory) then CommDKP_DKPHistory = CommDKP:UpgradeDBSchema(CommDKP_DKPHistory, CommDKP_DKPHistory, true, "CommDKP_DKPHistory") end; - if not CommDKP:VerifyDBSchema(CommDKP_MinBids) then CommDKP_MinBids = CommDKP:UpgradeDBSchema(CommDKP_MinBids, CommDKP_MinBids, true, "CommDKP_MinBids") end; - if not CommDKP:VerifyDBSchema(CommDKP_MaxBids) then CommDKP_MaxBids = CommDKP:UpgradeDBSchema(CommDKP_MaxBids, CommDKP_MaxBids, true, "CommDKP_MaxBids") end; - if not CommDKP:VerifyDBSchema(CommDKP_Whitelist) then CommDKP_Whitelist = CommDKP:UpgradeDBSchema(CommDKP_Whitelist, CommDKP_Whitelist, false, "CommDKP_Whitelist") end; - if not CommDKP:VerifyDBSchema(CommDKP_Standby) then CommDKP_Standby = CommDKP:UpgradeDBSchema(CommDKP_Standby, CommDKP_Standby, true, "CommDKP_Standby") end; - if not CommDKP:VerifyDBSchema(CommDKP_Archive) then CommDKP_Archive = CommDKP:UpgradeDBSchema(CommDKP_Archive, CommDKP_Archive, true, "CommDKP_Archive") end; - if not CommDKP:VerifyDBSchema(CommDKP_Profiles) then CommDKP_Profiles = CommDKP:UpgradeDBSchema(CommDKP_Profiles, CommDKP_Profiles, true, "CommDKP_Profiles") end; - - - ------------------------------------ - -- Import SavedVariables - ------------------------------------ - core.WorkingTable = CommDKP:GetTable(CommDKP_DKPTable, true); -- imports full DKP table to WorkingTable for list manipulation - core.PriceTable = CommDKP:FormatPriceTable(); - - for i=1, #core.WorkingTable do - local CurPlayer = core.WorkingTable[i].player; - local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), CurPlayer); - - if search then - --Set Version Info on Legacy Record First - local profile = CommDKP:GetTable(CommDKP_Profiles, true)[CurPlayer] or CommDKP:GetDefaultEntity(); - core.WorkingTable[i].version = profile.version; - end - end - - - if not CommDKP:GetTable(CommDKP_DKPHistory, true).seed then CommDKP:GetTable(CommDKP_DKPHistory, true).seed = 0 end - if not CommDKP:GetTable(CommDKP_Loot, true).seed then CommDKP:GetTable(CommDKP_Loot, true).seed = 0 end - if CommDKP:GetTable(CommDKP_DKPTable, true).seed then CommDKP:GetTable(CommDKP_DKPTable, true).seed = nil end - - - core.CurrentRaidZone = core.DB.bossargs.CurrentRaidZone; -- stores raid zone as a redundency - core.LastKilledBoss = core.DB.bossargs.LastKilledBoss; -- stores last boss killed as a redundency - core.LastKilledNPC = core.DB.bossargs.LastKilledNPC -- Stores last 30 mobs killed in raid. - core.RecentZones = core.DB.bossargs.RecentZones -- Stores last 30 zones entered within a raid party. - - table.sort(core.WorkingTable, function(a, b) - return a["player"] < b["player"] - end) - - table.sort(core.PriceTable, function(a, b) - if a["item"] ~= nil and b["item"] == nil then - return true; - elseif a["item"] == nil and b["item"] ~= nil then - return false; - elseif a["item"] == nil and b["item"] == nil then - return false; - end - - return a["item"] < b["item"] - end) - CommDKP:StartBidTimer("seconds", nil) -- initiates timer frame for use - - if CommDKP.BidTimer then CommDKP.BidTimer:SetScript("OnUpdate", nil) end - - if #CommDKP:GetTable(CommDKP_Loot, true) > core.DB.defaults.HistoryLimit then - CommDKP:PurgeLootHistory() -- purges Loot History entries that exceed the "HistoryLimit" option variable (oldest entries) and populates CommDKP_Archive with deleted values - end - if #CommDKP:GetTable(CommDKP_DKPHistory, true) > core.DB.defaults.DKPHistoryLimit then - CommDKP:PurgeDKPHistory() -- purges DKP History entries that exceed the "DKPHistoryLimit" option variable (oldest entries) and populates CommDKP_Archive with deleted values - end - core.DB.pendingLoot = {} - end -end - -function CommDKP:GetTable(dbTable, hasTeams, teamIndex) - hasTeams = hasTeams or false; - local _teamIndex; - - if IsInGuild() then - local realmName = CommDKP:GetRealmName(); - local guildName = CommDKP:GetGuildName(); - - dbTable = CommDKP:InitializeGuild(dbTable,realmName,guildName); - - if hasTeams then - - if teamIndex == nil then - _teamIndex = core.DB.defaults.CurrentTeam; - else - _teamIndex = teamIndex - end - - if not dbTable[realmName][guildName][_teamIndex] then - dbTable[realmName][guildName][_teamIndex] = {} - end - - return dbTable[realmName][guildName][_teamIndex]; - else - return dbTable[realmName][guildName]; - end - else - return dbTable[core.defaultTable]; - end -end - -function CommDKP:SetTable(dbTable, hasTeams, value, teamIndex) - hasTeams = hasTeams or false; - local _teamIndex; - - if IsInGuild() then - local realmName = CommDKP:GetRealmName(); - local guildName = CommDKP:GetGuildName(); - - dbTable = CommDKP:InitializeGuild(dbTable,realmName,guildName); - - if hasTeams then - if teamIndex == nil then - _teamIndex = core.DB.defaults.CurrentTeam; - else - _teamIndex = teamIndex - end - - dbTable[realmName][guildName][_teamIndex] = value; - else - dbTable[realmName][guildName] = value; - end - else - dbTable[core.defaultTable] = value; - end -end - -function CommDKP:VerifyDBSchema(dbTable) - local verified = false; - --Check to see if the schema node exists. If not, this is 2.1.2 database. - local retOK, hasInfo = pcall(CommDKP_tableHasKey,dbTable,"dbinfo"); - - if (not retOK) or (retOK and not hasInfo) then - verified = false; - elseif dbTable.dbinfo.build == core.BuildNumber then - verified = true; - end - - return verified; -end - -function CommDKP:UpgradeDBSchema(newDbTable, oldDbTable, hasTeams, tableName) - -- Initialize the Database for a Pre-2.2 Database - local retOK, hasInfo = pcall(CommDKP_tableHasKey,oldDbTable,"dbinfo"); - if (not retOK) or (retOK and not hasInfo) then - newDbTable = CommDKP:InitPlayerTable(oldDbTable, hasTeams, tableName) - end - - -- Verify that build and priorbuild elements exist. - if newDbTable.dbinfo.build == nil then - newDbTable.dbinfo.build = 0; - end - - if newDbTable.dbinfo.priorbuild == nil then - newDbTable.dbinfo.priorbuild = 0; - end - - --Set Prior Build - newDbTable.dbinfo.priorbuild = newDbTable.dbinfo.build; - - -- Build 20205 (2.2.5) Changes - if newDbTable.dbinfo.build < 20205 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber then - if newDbTable.dbinfo.name == "CommDKP_DB" then - - local defaultTable = {} - defaultTable = CommDKP:InitializeCommDKPDB(CommDKP:GetTable(defaultTable)) - if not defaultTable.defaults.CurrentTeam then defaultTable.defaults.CurrentTeam = "0" end; - if not defaultTable.teams then defaultTable.teams = {} end; - newDbTable[core.defaultTable] = defaultTable; - end - end - - if newDbTable.dbinfo.build < 30200 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber and newDbTable.dbinfo.priorbuild ~= 0 then - if newDbTable.dbinfo.name == "CommDKP_MinBids" then - newDbTable = CommDKP:RefactorMinBidItemTable(newDbTable); - end - end - - if newDbTable.dbinfo.build < 30202 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber and newDbTable.dbinfo.priorbuild ~= 0 then - if newDbTable.dbinfo.name == "CommDKP_MinBids" then - newDbTable = CommDKP:VerifyMinBidItemTable(newDbTable); - end - end - - -- Set Current Build Number - newDbTable.dbinfo.build = core.BuildNumber; - return newDbTable; -end - -function CommDKP_tableHasKey(table,key) - return table[key] ~= nil; -end - -function CommDKP:InitializeCommDKPDB(dbTable) - if dbTable == nil then - dbTable = {} - end - - if not dbTable.DKPBonus or not dbTable.DKPBonus.OnTimeBonus then - dbTable.DKPBonus = { - OnTimeBonus = 15, BossKillBonus = 5, CompletionBonus = 10, NewBossKillBonus = 10, UnexcusedAbsence = -25, BidTimer = 30, DecayPercentage = 20, GiveRaidStart = false, IncStandby = false, - } - end - - if not dbTable.defaults or not dbTable.defaults.HistoryLimit then - dbTable.defaults = { - HistoryLimit = 2500, DKPHistoryLimit = 2500, BidTimerSize = 1.0, CommDKPScaleSize = 1.0, SuppressNotifications = false, TooltipHistoryCount = 15, SuppressTells = true, - } - end - if not dbTable.defaults.ChatFrames then - dbTable.defaults.ChatFrames = {} - for i = 1, NUM_CHAT_WINDOWS do - local name = GetChatWindowInfo(i) - - if name ~= "" then - dbTable.defaults.ChatFrames[name] = true - end - end - end - if not dbTable.raiders then dbTable.raiders = {} end - if not dbTable.MinBidBySlot or not dbTable.MinBidBySlot.Head then - dbTable.MinBidBySlot = { - Head = 70, Neck = 70, Shoulders = 70, Cloak = 70, Chest = 70, Bracers = 70, Hands = 70, Belt = 70, Legs = 70, Boots = 70, Ring = 70, Trinket = 70, OneHanded = 70, TwoHanded = 70, OffHand = 70, Range = 70, Other = 70, - } - end - if not dbTable.MaxBidBySlot or not dbTable.MaxBidBySlot.Head then - dbTable.MaxBidBySlot = { - Head = 0, Neck = 0, Shoulders = 0, Cloak = 0, Chest = 0, Bracers = 0, Hands = 0, Belt = 0, Legs = 0, Boots = 0, Ring = 0, Trinket = 0, OneHanded = 0, TwoHanded = 0, OffHand = 0, Range = 0, Other = 0, - } - end - if not dbTable.bossargs then dbTable.bossargs = { CurrentRaidZone = "Molten Core", LastKilledBoss = "Lucifron" } end - if not dbTable.modes or not dbTable.modes.mode then dbTable.modes = { mode = "Minimum Bid Values", SubZeroBidding = false, rounding = 0, AddToNegative = false, increment = 60, ZeroSumBidType = "Static", AllowNegativeBidders = false } end; - if not dbTable.modes.ZeroSumBank then dbTable.modes.ZeroSumBank = { balance = 0 } end - if not dbTable.modes.channels then dbTable.modes.channels = { raid = true, whisper = true, guild = true } end - if not dbTable.modes.costvalue then dbTable.modes.costvalue = "Integer" end - if not dbTable.modes.rolls or not dbTable.modes.rolls.min then dbTable.modes.rolls = { min = 1, max = 100, UsePerc = false, AddToMax = 0 } end - if not dbTable.bossargs.LastKilledNPC then dbTable.bossargs.LastKilledNPC = {} end - if not dbTable.bossargs.RecentZones then dbTable.bossargs.RecentZones = {} end - if not dbTable.defaults.HideChangeLogs then dbTable.defaults.HideChangeLogs = 0 end - if not dbTable.modes.AntiSnipe then dbTable.modes.AntiSnipe = 0 end - if not dbTable.defaults.CurrentGuild then dbTable.defaults.CurrentGuild = {} end - if not dbTable.defaults.CurrentTeam then dbTable.defaults.CurrentTeam = "0" end; - if not dbTable.teams then dbTable.teams = {} end; - if not dbTable.modes.AnnounceRaidWarning then dbTable.modes.AnnounceRaidWarning = false end; - if dbTable.defaults.CustomMaxBid == nil then dbTable.defaults.CustomMaxBid = true end; - if dbTable.defaults.CustomMinBid == nil then dbTable.defaults.CustomMinBid = true end; - - -- 3.1.3 Version Change - Removing installed Variables - if dbTable.defaults.installed210 then - dbTable.defaults.installed210 = nil; - end - - if dbTable.defaults.installed then - dbTable.defaults.installed = nil; - end - - if IsInGuild() then - if not dbTable.teams["0"] then - dbTable.teams["0"] = {name=CommDKP:GetGuildName()} - dbTable.defaults.CurrentTeam = "0"; - end; - end - - return dbTable; -end - -function CommDKP:InitPlayerTable(globalTable, hasTeams, tableName) - local playerTable = {}; - playerTable = CommDKP:InitDbSchema(playerTable, tableName); - if IsInGuild() then - - local realmName = CommDKP:GetRealmName(); - local guildName = CommDKP:GetGuildName(); - - - playerTable = CommDKP:InitializeGuild(playerTable,realmName,guildName); - - if not globalTable then - globalTable = {}; - end - - if hasTeams then - playerTable[realmName][guildName]["0"] = CopyTable(globalTable); - else - playerTable[realmName][guildName] = CopyTable(globalTable); - end - end - -- Init Default Table - playerTable[core.defaultTable] = {}; - return playerTable; -end - -function CommDKP:InitializeGuild(dataTable, realmName, guildName) - local retOK1, hasInfo1 = pcall(CommDKP_tableHasKey,dataTable,realmName); - - if (not retOK1) or (retOK1 and not hasInfo1) then - dataTable[realmName] = {} - end - - if guildName ~= nil then - local retOK2, hasInfo2 = pcall(CommDKP_tableHasKey,dataTable[realmName],guildName); - - if (not retOK2) or (retOK2 and not hasInfo2) then - dataTable[realmName][guildName] = {} - end - end - - return dataTable -end - -function CommDKP:InitDbSchema(dbTable, tableName) - dbTable["dbinfo"] = {}; - dbTable.dbinfo["build"] = 0; - dbTable.dbinfo["name"] = tableName; - dbTable.dbinfo["priorbuild"] = 0; - dbTable.dbinfo["needsUpgrade"] = false; - return dbTable; -end - ----------------------------------- --- Monolith Migration ----------------------------------- - -function CommDKP:MonolithMigration() - local _, _, _, _, reason = GetAddOnInfo("MonolithDKP") - if reason == "MISSING" or reason == "DISABLED" then - return false -- MonolithDKP is missing or globally disabled - end - - local loaded, finished = IsAddOnLoaded("MonolithDKP") - if not loaded then - return false -- MonolithDKP is disabled for the current character - end - - if not finished then - CommDKP:Print("MonolithDKP has not finished loading - please report to Discord!") - return false -- Should not happen?! Maybe race condition ... - end - - -- MonolithDKP is up & running - CommunityDKP will not initialise - CommDKP:Print("Legacy MonolithDKP addon detected - please disable it to continue with CommunityDKP!") - local activeCommunity = self:MonolithMigrationDbEntries("CommDKP") -- check if CommunityDKP already has table entries - local activeCommunitySchema = CommDKP_DB ~= nil and CommDKP:GetTable(CommDKP_DB, false)["teams"] ~= nil -- check if CommunityDKP finished schema migration - local activeMonolith21x = self:MonolithMigrationLegacySeed() > 0 -- check if there are usable MonolithDKP 2.1.x tables available - local activeMonolith22x = self:MonolithMigrationDbBuild() > 0 and self:MonolithMigrationDbEntries("MonDKP") -- same for MonolithDKP 2.2.x - - -- check if we should offer migration - if not activeCommunity and (activeMonolith21x or activeMonolith21x) then - -- CommunityDKP is fresh and there are MonolithDKP 2.1.x or 2.2.x tables available - self:MonolithMigrationLegacyDetected(function() self:MonolithMigrationProcess(false) end) - elseif activeCommunity and activeCommunitySchema and activeMonolith21x and IsInGuild() and CommDKP:ValidateSender(UnitName("player")) then - -- CommunityDKP already has data we can import MonolithDKP 2.1.x data as a new team - self:MonolithMigrationAsNewTeam(function() self:MonolithMigrationProcess(true) end) - else - -- CommunityDKP already has table entries and there is no legacy data to add as an additional team - self:MonolithMigrationGenericPopup(L["MIGRATIONUNAVAILABLE"]) - end - - return true -- don't initialise CommunityDKP -end - -function CommDKP:MonolithMigrationProcess(asNewTeam) - asNewTeam = asNewTeam or false; - - -- add a new team? - local teamIndex - if asNewTeam then - teamIndex = CommDKP:AddNewTeamToGuild() - end - - -- deep copy so we don't modify the source data - local copyTableRecursive - copyTableRecursive = function(obj) - if type(obj) ~= "table" then return obj end - local res = {} - for k, v in pairs(obj) do res[copyTableRecursive(k)] = copyTableRecursive(v) end - return res - end - - -- rename MonDKPScaleSize property to CommDKPScaleSize for each guild / team - local migrateDefaultsRecursive - migrateDefaultsRecursive = function(table) - for k, v in pairs(table) do - if k == "defaults" then - if v.MonDKPScaleSize ~= nil then - v.CommDKPScaleSize = v.MonDKPScaleSize - v.MonDKPScaleSize = nil - end - elseif type(v) == "table" then - migrateDefaultsRecursive(v) - end - end - end - - -- copy everything from legacy addon - if asNewTeam then - -- local tempDB = copyTableRecursive(MonDKP_DB) - -- migrateDefaultsRecursive(tempDB) - -- CommDKP:SetTable(CommDKP_DB, true, tempDB, teamIndex) - - -- CommDKP:GetTable(CommDKP_DKPTable, false)[teamIndex] = MonDKP_DKPTable - CommDKP:SetTable(CommDKP_DKPTable, true, MonDKP_DKPTable, teamIndex) - CommDKP:SetTable(CommDKP_Loot, true, MonDKP_Loot, teamIndex) - CommDKP:SetTable(CommDKP_DKPHistory, true, MonDKP_DKPHistory, teamIndex) - CommDKP:SetTable(CommDKP_MinBids, true, MonDKP_MinBids, teamIndex) - CommDKP:SetTable(CommDKP_MaxBids, true, MonDKP_MaxBids, teamIndex) - CommDKP:SetTable(CommDKP_Whitelist, true, MonDKP_Whitelist, teamIndex) - CommDKP:SetTable(CommDKP_Standby, true, MonDKP_Standby, teamIndex) - CommDKP:SetTable(CommDKP_Archive, true, MonDKP_Archive, teamIndex) - else - local tempDB = copyTableRecursive(MonDKP_DB) - migrateDefaultsRecursive(tempDB) - CommDKP_DB = tempDB - - CommDKP_DKPTable = MonDKP_DKPTable - CommDKP_Loot = MonDKP_Loot - CommDKP_DKPHistory = MonDKP_DKPHistory - CommDKP_MinBids = MonDKP_MinBids - CommDKP_MaxBids = MonDKP_MaxBids - CommDKP_Whitelist = MonDKP_Whitelist - CommDKP_Standby = MonDKP_Standby - CommDKP_Archive = MonDKP_Archive - end - - -- show completion popup - self:MonolithMigrationGenericPopup(L["MIGRATIONCOMPLETED"]) -end - -function CommDKP:MonolithMigrationLegacyDetected(migration) - StaticPopupDialogs["MONOLITH_MIGRATION_DETECTED"] = { - text = L["MIGRATIONDETECTED"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = function() self:MonolithMigrationConfirmationPopup(migration) end, - OnCancel = function() self:MonolithMigrationCancelationPopup() end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show("MONOLITH_MIGRATION_DETECTED") -end - -function CommDKP:MonolithMigrationAsNewTeam(migration) - StaticPopupDialogs["MONOLITH_MIGRATION_TEAM"] = { - text = L["MIGRATIONTEAM"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = migration, - OnCancel = function() self:MonolithMigrationCancelationPopup() end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show("MONOLITH_MIGRATION_TEAM") -end - -function CommDKP:MonolithMigrationConfirmationPopup(migration) - StaticPopupDialogs["MONOLITH_MIGRATION_CONFIRMATION"] = { - text = "|CFFFF0000"..L["WARNING"].."|r: "..L["MIGRATIONCONFIRM"], - button1 = L["YES"], - button2 = L["NO"], - OnAccept = migration, - OnCancel = function() self:MonolithMigrationCancelationPopup() end, - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show("MONOLITH_MIGRATION_CONFIRMATION") -end - -function CommDKP:MonolithMigrationCancelationPopup() - StaticPopupDialogs["MONOLITH_MIGRATION_CANCELED"] = { - text = L["MIGRATIONCANCELED"], - button1 = L["OK"], - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show("MONOLITH_MIGRATION_CANCELED") -end - -function CommDKP:MonolithMigrationGenericPopup(text) - StaticPopupDialogs["MONOLITH_MIGRATION_GENERIC"] = { - text = text, - button1 = L["OK"], - timeout = 0, - whileDead = true, - hideOnEscape = true, - preferredIndex = 3, - } - StaticPopup_Show("MONOLITH_MIGRATION_GENERIC") -end - -function CommDKP:MonolithMigrationLegacySeed() - -- returns the latest seed timestamp (version 2.1.x) or 0 if it won't find anything - local lootSeed = 0 - local historySeed = 0 - - if MonDKP_Loot ~= nil and #MonDKP_Loot > 0 and MonDKP_Loot[1].index ~= nil and strfind(MonDKP_Loot[1].index, "-") ~= nil then - lootSeed = tonumber(strsub(MonDKP_Loot[1].index, strfind(MonDKP_Loot[1].index, "-") + 1)) - end - if MonDKP_DKPHistory ~= nil and #MonDKP_DKPHistory > 0 and MonDKP_DKPHistory[1].index ~= nil and strfind(MonDKP_DKPHistory[1].index, "-") ~= nil then - historySeed = tonumber(strsub(MonDKP_DKPHistory[1].index, strfind(MonDKP_DKPHistory[1].index, "-") + 1)) - end - - return math.max(lootSeed or 0, historySeed or 0) -end - -function CommDKP:MonolithMigrationDbBuild() - -- returns the db build version (version 2.2.x) or 0 if it won't find anything - local build = 0 - - if MonDKP_DB ~= nil and MonDKP_DB.dbinfo ~= nil and MonDKP_DB.dbinfo.build ~= nil then - build = tonumber(MonDKP_DB.dbinfo.build) - end - - return build or 0 -end - -function CommDKP:MonolithMigrationDbEntries(prefix) - -- returns true if there are already CommunityDKP entries - local findEntryRecursive - findEntryRecursive = function(table, entry) - if table == nil then - return false - end - - for k, v in pairs(table) do - if k == entry then - return true -- entry found - ABORT! - elseif type(v) == "table" and findEntryRecursive(v, entry) then - return true -- entry in child table found - ABORT! - end - end - - return false - end - - if prefix ~= nil and prefix == "MonDKP" then - return findEntryRecursive(MonDKP_DKPHistory, "players") - or findEntryRecursive(MonDKP_DKPTable, "player") - or findEntryRecursive(MonDKP_Loot, "player") - else - return findEntryRecursive(CommDKP_DKPHistory, "players") - or findEntryRecursive(CommDKP_DKPTable, "player") - or findEntryRecursive(CommDKP_Loot, "player") - end -end - ----------------------------------- --- Register Events and Initiallize AddOn ----------------------------------- - -local events = CreateFrame("Frame", "EventsFrame"); -events:RegisterEvent("ADDON_LOADED"); -events:RegisterEvent("GROUP_ROSTER_UPDATE"); -events:RegisterEvent("ENCOUNTER_START"); -- FOR TESTING PURPOSES. -events:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") -- NPC kill event -events:RegisterEvent("LOOT_OPENED") -events:RegisterEvent("CHAT_MSG_RAID") -events:RegisterEvent("CHAT_MSG_RAID_LEADER") -events:RegisterEvent("CHAT_MSG_WHISPER"); -events:RegisterEvent("CHAT_MSG_GUILD") -events:RegisterEvent("GUILD_ROSTER_UPDATE") -events:RegisterEvent("PLAYER_ENTERING_WORLD") -events:RegisterEvent("ZONE_CHANGED_NEW_AREA") -events:RegisterEvent("BOSS_KILL") -events:RegisterEvent("TRADE_SHOW") -events:RegisterEvent("TRADE_ACCEPT_UPDATE") -events:RegisterEvent("TRADE_CLOSED") -events:SetScript("OnEvent", CommDKP_OnEvent); -- calls the above CommDKP_OnEvent function to determine what to do with the event +local _, core = ...; +local _G = _G; +local CommDKP = core.CommDKP; +local L = core.L; +local waitTable = {}; +local waitFrame = nil; +local lockouts = CreateFrame("Frame", "LockoutsFrame"); +local eventDelay = {}; + +-------------------------------------- +-- Slash Command +-------------------------------------- +CommDKP.Commands = { + ["config"] = function() + if core.Initialized then + local pass, err = pcall(CommDKP.Toggle) + if not pass then + CommDKP:Print(err) + core.CommDKPUI:SetShown(false) + StaticPopupDialogs["SUGGEST_RELOAD"] = { + text = "|CFFFF0000"..L["WARNING"].."|r: "..L["MUSTRELOADUI"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = function() + ReloadUI(); + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show ("SUGGEST_RELOAD") + end + else + CommDKP:Print("CommunityDKP has not completed initialization.") + end + end, + ["reset"] = CommDKP.ResetPosition, + ["bid"] = function(...) + if core.Initialized then + local item = strjoin(" ", ...) + CommDKP:CheckOfficer() + CommDKP:StatusVerify_Update() + + if core.IsOfficer then + if ... == nil then + if core.BidAuctioneer then + CommDKP:ToggleBidWindow() + else + CommDKP:BidInterface_Toggle() + end + else + local itemName,_,_,_,_,_,_,_,_,itemIcon = GetItemInfo(item) + CommDKP:Print("Opening Bid Window for: ".. item) + CommDKP:ToggleBidWindow(item, itemIcon, itemName) + end + end + CommDKP:BidInterface_Toggle() + else + CommDKP:Print("CommunityDKP has not completed initialization.") + end + end, + ["repairtables"] = function(...) -- test new features + local cmd = ... + if core.IsOfficer then + if cmd == "true" then + CommDKP:RepairTables(cmd) + else + CommDKP:RepairTables() + end + end + end, + ["award"] = function (name, ...) + if core.IsOfficer and core.Initialized then + CommDKP:StatusVerify_Update() + + if not name or not strfind(name, ":::::") then + CommDKP:Print(L["AWARDWARNING"]) + return + end + local item = strjoin(" ", ...) + if not item then return end + item = name.." "..item; + local itemName,itemLink,_,_,_,_,_,_,_,_ = GetItemInfo(item) + local cost = 0; + local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(itemLink,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") + + if itemName == nil and Name ~= nil then + itemName = Name; + end + + local search = CommDKP:GetTable(CommDKP_MinBids, true)[itemID]; + + if not search then + cost = CommDKP:GetMinBid(item) + else + cost = search.minbid; + end + + CommDKP:AwardConfirm(nil, cost, core.DB.bossargs.LastKilledBoss, core.DB.bossargs.CurrentRaidZone, item) + else + CommDKP:Print(L["NOPERMISSION"]) + end + end, + ["lockouts"] = function() + lockouts:RegisterEvent("UPDATE_INSTANCE_INFO"); + lockouts:SetScript("OnEvent", CommDKP_OnEvent); + RequestRaidInfo() + end, + ["timer"] = function(time, ...) + if time == nil then + CommDKP:BroadcastTimer(1, "...") + else + local title = strjoin(" ", ...) + CommDKP:BroadcastTimer(tonumber(time), title) + end + end, + ["export"] = function(time, ...) + CommDKP:ToggleExportWindow() + end, + ["modes"] = function() + if core.Initialized then + CommDKP:CheckOfficer() + if core.IsOfficer then + CommDKP:ToggleDKPModesWindow() + else + CommDKP:Print(L["NOPERMISSION"]) + end + else + CommDKP:Print("CommunityDKP has not completed initialization.") + end + end, + ["help"] = function() + CommDKP:Print(" "); + CommDKP:Print(L["SLASHCOMMANDLIST"]..":") + CommDKP:Print("|cff00cc66/dkp|r - "..L["DKPLAUNCH"]); + CommDKP:Print("|cff00cc66/dkp ?|r - "..L["HELPINFO"]); + CommDKP:Print("|cff00cc66/dkp reset|r - "..L["DKPRESETPOS"]); + CommDKP:Print("|cff00cc66/dkp lockouts|r - "..L["DKPLOCKOUT"]); + CommDKP:Print("|cff00cc66/dkp timer|r - "..L["CREATERAIDTIMER"]); + CommDKP:Print("|cff00cc66/dkp bid|r - "..L["OPENBIDWINDOWHELP"]); + CommDKP:Print("|cff00cc66/dkp bid [itemlink]|r - "..L["OPENAUCWINHELP"]); + CommDKP:Print("|cff00cc66/dkp award [item link]|r - "..L["DKPAWARDHELP"]); + CommDKP:Print("|cff00cc66/dkp modes|r - "..L["DKPMODESHELP"]); + CommDKP:Print("|cff00cc66/dkp export|r - "..L["DKPEXPORTHELP"]); + CommDKP:Print(" "); + CommDKP:Print(L["WHISPERCMDSHELP"]); + CommDKP:Print("|cff00cc66!bid (or !bid <"..L["VALUE"]..">)|r - "..L["BIDHELP"]); + CommDKP:Print("|cff00cc66!dkp (or !dkp <"..L["PLAYERNAME"]..">)|r - "..L["DKPCMDHELP"]); + end, +}; + +local function HandleSlashCommands(str) + if (#str == 0) then + CommDKP.Commands.config(); + return; + end + + local args = {}; + for _, arg in ipairs({ string.split(' ', str) }) do + if (#arg > 0) then + table.insert(args, arg); + end + end + + local path = CommDKP.Commands; + + for id, arg in ipairs(args) do + if (#arg > 0) then + arg = arg:lower(); + if (path[arg]) then + if (type(path[arg]) == "function") then + path[arg](select(id + 1, unpack(args))); + return; + elseif (type(path[arg]) == "table") then + path = path[arg]; + end + else + CommDKP.Commands.help(); + return; + end + end + end +end + +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", function(self, event, msg, ...) -- suppresses outgoing whisper responses to limit spam + + if core.DB == nil then + return false; + end + + if core.DB.defaults.SuppressTells then + if core.BidInProgress then + if strfind(msg, L["YOURBIDOF"]) == 1 then + return true + elseif strfind(msg, L["BIDDENIEDFILTER"]) == 1 then + return true + elseif strfind(msg, L["BIDACCEPTEDFILTER"]) == 1 then + return true; + elseif strfind(msg, L["NOTSUBMITTEDBID"]) == 1 then + return true; + elseif strfind(msg, L["ONLYONEROLLWARN"]) == 1 then + return true; + elseif strfind(msg, L["ROLLNOTACCEPTED"]) == 1 then + return true; + elseif strfind(msg, L["YOURBID"].." "..L["MANUALLYDENIED"]) == 1 then + return true; + elseif strfind(msg, L["CANTCANCELROLL"]) == 1 then + return true; + end + end + + if strfind(msg, "CommunityDKP: ") == 1 then + return true + elseif strfind(msg, L["DKPAVAILABLE"]) ~= nil and strfind(msg, '%[') ~= nil and strfind(msg, '%]') ~= nil then + return true + elseif strfind(msg, L["NOBIDINPROGRESS"]) == 1 then + return true + elseif strfind(msg, L["BIDCANCELLED"]) == 1 then + return true + end + end +end) + +ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", function(self, event, msg, ...) -- suppresses incoming whisper responses to limit spam + + if core.DB == nil then + return false; + end + + if core.DB.defaults.SuppressTells then + if core.BidInProgress then + if strfind(msg, "!bid") == 1 then + return true + end + end + + if strfind(msg, "!dkp") == 1 then + return true + end + end +end) + + +function CommDKP_wait(delay, func, ...) + if(type(delay)~="number" or type(func)~="function") then + return false; + end + if(waitFrame == nil) then + waitFrame = CreateFrame("Frame","WaitFrame", UIParent); + waitFrame:SetScript("onUpdate",function (self,elapse) + local count = #waitTable; + local i = 1; + while(i<=count) do + local waitRecord = tremove(waitTable,i); + local d = tremove(waitRecord,1); + local f = tremove(waitRecord,1); + local p = tremove(waitRecord,1); + if(d>elapse) then + tinsert(waitTable,i,{d-elapse,f,p}); + i = i + 1; + else + count = count - 1; + f(unpack(p)); + end + end + end); + end + tinsert(waitTable,{delay,func,{...}}); + return true; +end + +local function DoInit(event, arg1) + if CommDKP:MonolithMigration() then + return -- Legacy MonolithDKP addon detected: don't initialise any further! + end + CommDKP:OnInitialize(event, arg1); +end + +local function DoGuildUpdate() + if IsInGuild() and not core.InitStart then + GuildRoster() + core.InitStart = true + + -- Prints info after all addons have loaded. Circumvents addons that load saved chat messages pushing info out of view. + C_Timer.After(3, function () + CommDKP:CheckOfficer() + CommDKP:SortLootTable() + CommDKP:SortDKPHistoryTable() + CommDKP:Print(L["VERSION"].." "..core.MonVersion..", "..L["CREATEDMAINTAIN"].." Vapok@BloodsailBuccaneers-Classic & Taidtuskecyh@Gehennas"); + CommDKP:Print(L["LOADED"].." "..#CommDKP:GetTable(CommDKP_DKPTable, true).." "..L["PLAYERRECORDS"]..", "..#CommDKP:GetTable(CommDKP_Loot, true).." "..L["LOOTHISTRECORDS"].." "..#CommDKP:GetTable(CommDKP_DKPHistory, true).." "..L["DKPHISTRECORDS"].."."); + CommDKP:Print(L["USE"].." /dkp ? "..L["SUBMITBUGS"].." @ https://github.com/Vapok/CommunityDKP/issues"); + CommDKP.Sync:SendData("CommDKPBuild", tostring(core.BuildNumber)) -- broadcasts build number to guild to check if a newer version is available + CommDKP:SendTalentsAndRole() + + -- send seed for every team in guild + -- this basically sends index of latest entry in loot and DKP tables to everyone online in guild, + -- if they have this entry it does nothing since they are up to date, if they dont it changes seed in those tables to the index being sent + CommDKP:SendSeedData(); + end) + end +end + +function CommDKP:SendSeedData() + + local latestIndexForTeam = {} + local _teams = CommDKP:GetGuildTeamList(); + local _numberOfTeams = CommDKP:tablelength(_teams); + + for i=1, _numberOfTeams do + + latestIndexForTeam[tostring(_teams[i][1])] = {} + + if #CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1])) > 0 and strfind(CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index, "-") then + local off1,date1 = strsplit("-", CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index) + if CommDKP:ValidateSender(off1) then + latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = CommDKP:GetTable(CommDKP_DKPHistory, true, tostring(_teams[i][1]))[1].index + else + latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = "start" + end + else + latestIndexForTeam[tostring(_teams[i][1])]["DKPHistory"] = "start" + end + + if #CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1])) > 0 and strfind(CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index, "-") then + local off2,date2 = strsplit("-", CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index) + if CommDKP:ValidateSender(off2) then + latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = CommDKP:GetTable(CommDKP_Loot, true, tostring(_teams[i][1]))[1].index + else + latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = "start" + end + else + latestIndexForTeam[tostring(_teams[i][1])]["Loot"] = "start" + end + end + + --[[ + latestIndexForTeam = { + ["0"] = { + ["Loot"] = "name-date", + ["DKPHistory"] = "name-date" + }, + ["1"] = { + ["Loot"] = "start", + ["DKPHistory"] = "start" + } + } + --]] + + CommDKP.Sync:SendData("CommDKPSeed", latestIndexForTeam) -- requests role and spec data and sends current seeds (index of newest DKP and Loot entries) + +end + +function CommDKP_OnEvent(self, event, arg1, ...) + if event == "ADDON_LOADED" then + if (arg1 ~= "CommunityDKP") then return end + core.IsOfficer = nil + core.Initialized = false + CommDKP_wait(2, DoInit, event, arg1); + ---DoInit(event,arg1); + self:UnregisterEvent("ADDON_LOADED") + return; + end + + -- If core.DB is nil, that means that the addon hasn't fully initialized.. so let's wait 1 second and try again. + if core.DB == nil then + if eventDelay[event] == nil then + eventDelay[event] = 1; + else + eventDelay[event] = eventDelay[event] + 2; + end + C_Timer.After(eventDelay[event], function () CommDKP_OnEvent(self, event, arg1); end); + return; + end + + if eventDelay[event] ~= nil then + eventDelay[event] = nil; + end + + -- unregister unneccessary events + if event == "CHAT_MSG_WHISPER" and not core.DB.modes.channels.whisper then + self:UnregisterEvent("CHAT_MSG_WHISPER") + return + end + if (event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER") and not core.DB.modes.channels.raid then + self:UnregisterEvent("CHAT_MSG_RAID") + self:UnregisterEvent("CHAT_MSG_RAID_LEADER") + return + end + if event == "CHAT_MSG_GUILD" and not core.DB.modes.channels.guild and not core.DB.modes.StandbyOptIn then + self:UnregisterEvent("CHAT_MSG_GUILD") + return + end + + if event == "BOSS_KILL" then + CommDKP:CheckOfficer() + if core.IsOfficer and IsInRaid() then + local boss_name = ...; + if CommDKP:Table_Search(core.EncounterList, arg1) then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue(arg1) + + if core.DB.modes.StandbyOptIn and core.RaidInProgress then + CommDKP_Standby_Announce(boss_name) + end + + if core.DB.modes.AutoAward and core.RaidInProgress then + if not core.DB.modes.StandbyOptIn and core.DB.DKPBonus.IncStandby then + CommDKP:AutoAward(3, core.DB.DKPBonus.BossKillBonus, core.DB.bossargs.CurrentRaidZone..": "..core.DB.bossargs.LastKilledBoss) + else + CommDKP:AutoAward(1, core.DB.DKPBonus.BossKillBonus, core.DB.bossargs.CurrentRaidZone..": "..core.DB.bossargs.LastKilledBoss) + end + end + else + CommDKP:Print("Event ID: "..arg1.." - > "..boss_name.." Killed. Please report this Event ID at https://www.curseforge.com/wow/addons/communitydkp/issues to update raid event handlers.") + end + elseif IsInRaid() then + core.DB.bossargs.LastKilledBoss = ...; + end + elseif event == "ENCOUNTER_START" then + if core.DB.defaults.AutoLog and IsInRaid() then + if not LoggingCombat() then + LoggingCombat(1) + CommDKP:Print(L["NOWLOGGINGCOMBAT"]) + end + end + elseif event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA" then -- logs 15 recent zones entered while in a raid party + if IsInRaid() and core.Initialized then -- only processes combat log events if in raid + CommDKP:CheckOfficer() + if core.IsOfficer then + if not CommDKP:Table_Search(core.DB.bossargs.RecentZones, GetRealZoneText()) then -- only adds it if it doesn't already exist in the table + if #core.DB.bossargs.RecentZones > 14 then + for i=15, #core.DB.bossargs.RecentZones do -- trims the tail end of the stack + table.remove(core.DB.bossargs.RecentZones, i) + end + end + table.insert(core.DB.bossargs.RecentZones, 1, GetRealZoneText()) + end + end + if core.DB.defaults.AutoLog and CommDKP:Table_Search(core.ZoneList, GetRealZoneText()) then + if not LoggingCombat() then + LoggingCombat(1) + CommDKP:Print(L["NOWLOGGINGCOMBAT"]) + end + end + end + if core.Initialized then + CommDKP:SendTalentsAndRole() + end + elseif event == "CHAT_MSG_WHISPER" then + CommDKP:CheckOfficer() + if core.IsOfficer then + + arg1 = strlower(arg1) + if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) then + CommDKP_CHAT_MSG_WHISPER(arg1, ...) + elseif string.find(arg1, "!standby") == 1 and core.StandbyActive then + CommDKP_Standby_Handler(arg1, ...) + end + end + elseif event == "GUILD_ROSTER_UPDATE" then + + if not core.InitStart then + DoGuildUpdate(); + end + + if IsInGuild() and core.InitStart then + self:UnregisterEvent("GUILD_ROSTER_UPDATE") + end + elseif event == "CHAT_MSG_RAID" or event == "CHAT_MSG_RAID_LEADER" then + CommDKP:CheckOfficer() + arg1 = strlower(arg1) + if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!standby") == 1 or string.find(arg1, "!dkp") == 1) and core.IsOfficer == true then + CommDKP_CHAT_MSG_WHISPER(arg1, ...) + end + elseif event == "UPDATE_INSTANCE_INFO" then + local num = GetNumSavedInstances() + local raidString, reset, newreset, days, hours, mins, maxPlayers, numEncounter, curLength; + + if not core.DB.Lockouts then core.DB.Lockouts = {Three = 0, Five = 1570032000, Seven = 1569945600} end + + for i=1, num do -- corrects reset timestamp for any raids where an active lockout exists + _,_,reset,_,_,_,_,_,maxPlayers,_,numEncounter = GetSavedInstanceInfo(i) + newreset = time() + reset + 2 -- returned time is 2 seconds off + + if maxPlayers == 40 and numEncounter > 1 then + curLength = "Seven" + elseif maxPlayers == 40 and numEncounter == 1 then + curLength = "Five" + elseif maxPlayers == 20 then + curLength = "Three" + end + + if core.DB.Lockouts[curLength] < newreset then + core.DB.Lockouts[curLength] = newreset + end + end + + -- Updates lockout timer if no lockouts were found to do so. + while core.DB.Lockouts.Three < time() do core.DB.Lockouts.Three = core.DB.Lockouts.Three + 259200 end + while core.DB.Lockouts.Five < time() do core.DB.Lockouts.Five = core.DB.Lockouts.Five + 432000 end + while core.DB.Lockouts.Seven < time() do core.DB.Lockouts.Seven = core.DB.Lockouts.Seven + 604800 end + + for k,v in pairs(core.DB.Lockouts) do + reset = v - time(); + days = math.floor(reset / 86400) + hours = math.floor(math.floor(reset % 86400) / 3600) + mins = math.ceil((reset % 3600) / 60) + + if days > 1 then days = " "..days.." "..L["DAYS"] elseif days == 0 then days = "" else days = " "..days.." "..L["DAY"] end + if hours > 1 then hours = " "..hours.." "..L["HOURS"] elseif hours == 0 then hours = "" else hours = " "..hours.." "..L["HOUR"].."." end + if mins > 1 then mins = " "..mins.." "..L["MINUTES"].."." elseif mins == 0 then mins = "" else mins = " "..mins.." "..L["MINUTE"].."." end + + if k == "Three" then raidString = "ZG, AQ20" + elseif k == "Five" then raidString = "Onyxia" + elseif k == "Seven" then raidString = "MC, BWL, AQ40" + end + + if k ~= "Three" then -- remove when three day raid lockouts are added + CommDKP:Print(raidString.." "..L["RESETSIN"]..days..hours..mins.." ("..date("%A @ %H:%M:%S%p", v)..")") + end + end + + self:UnregisterEvent("UPDATE_INSTANCE_INFO"); + elseif event == "CHAT_MSG_GUILD" then + CommDKP:CheckOfficer() + if core.IsOfficer then + arg1 = strlower(arg1) + if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) and core.DB.modes.channels.guild then + CommDKP_CHAT_MSG_WHISPER(arg1, ...) + elseif string.find(arg1, "!standby") == 1 and core.StandbyActive then + CommDKP_Standby_Handler(arg1, ...) + end + end + --elseif event == "CHAT_MSG_SYSTEM" then + --MonoDKP_CHAT_MSG_SYSTEM(arg1) + elseif event == "GROUP_ROSTER_UPDATE" then --updates raid listing if window is open + if CommDKP.UIConfig and core.CommDKPUI:IsShown() then + if core.CurSubView == "raid" then + CommDKP:ViewLimited(true) + elseif core.CurSubView == "raid and standby" then + CommDKP:ViewLimited(true, true) + end + end + elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then -- logs last 15 NPCs killed while in raid + if IsInRaid() then -- only processes combat log events if in raid + local _,arg1,_,_,_,_,_,arg2,arg3 = CombatLogGetCurrentEventInfo(); + if arg1 == "UNIT_DIED" and not strfind(arg2, "Player") and not strfind(arg2, "Pet-") then + CommDKP:CheckOfficer() + if core.IsOfficer then + if not CommDKP:Table_Search(core.DB.bossargs.LastKilledNPC, arg3) then -- only adds it if it doesn't already exist in the table + if #core.DB.bossargs.LastKilledNPC > 14 then + for i=15, #core.DB.bossargs.LastKilledNPC do -- trims the tail end of the stack + table.remove(core.DB.bossargs.LastKilledNPC, i) + end + end + table.insert(core.DB.bossargs.LastKilledNPC, 1, arg3) + end + end + end + end + --[[elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then -- replaced with above BOSS_KILL event handler + if IsInRaid() then -- only processes combat log events if in raid + local _,arg1,_,_,_,_,_,_,arg2 = CombatLogGetCurrentEventInfo(); -- run operation when boss is killed + if arg1 == "UNIT_DIED" then + CommDKP:CheckOfficer() + if core.IsOfficer == true then + if CommDKP:TableStrFind(core.BossList, arg2) then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue(arg2) + elseif arg2 == "Flamewalker Elite" or arg2 == "Flamewalker Healer" then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Majordomo Executus") + elseif arg2 == "Emperor Vek'lor" or arg2 == "Emperor Vek'nilash" then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Twin Emperors") + elseif arg2 == "Princess Yauj" or arg2 == "Vem" or arg2 == "Lord Kri" then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Bug Family") + elseif arg2 == "Highlord Mograine" or arg2 == "Thane Korth'azz" or arg2 == "Sir Zeliek" or arg2 == "Lady Blaumeux" then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue("The Four Horsemen") + elseif arg2 == "Gri'lek" or arg2 == "Hazza'rah" or arg2 == "Renataki" or arg2 == "Wushoolay" then + CommDKP.ConfigTab2.BossKilledDropdown:SetValue("Edge of Madness") + end + end + end + end--]] + elseif event == "LOOT_OPENED" then + CommDKP:CheckOfficer(); + if core.IsOfficer then + local lootTable = {} + local lootList = {}; + + if IsInRaid() then + for i=1, GetNumLootItems() do + if LootSlotHasItem(i) and GetLootSlotLink(i) then + local _,link,quality = GetItemInfo(GetLootSlotLink(i)) + if quality >= 4 then + table.insert(lootTable, link) + end + end + end + local name + if not UnitIsFriend("player", "target") and UnitIsDead("target") then + name = UnitName("target") -- sets bidding window name to current target + else + name = core.LastKilledBoss -- sets name to last killed boss if no target is available (chests) + end + lootTable.boss=name + CommDKP.Sync:SendData("CommDKPBossLoot", lootTable) + + for i=1, #lootTable do + local item = Item:CreateFromItemLink(lootTable[i]); + item:ContinueOnItemLoad(function() + local icon = item:GetItemIcon() + table.insert(lootList, {icon=icon, link=item:GetItemLink()}) + end); + end + + CommDKP:LootTable_Set(lootList) + end + end + elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_SHOW" then + local traderName = UnitName("npc") + if traderName == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then + return + end + core.DB.pendingTradePlayer = traderName + core.DB.pendingTrade = {} + local pendingLoot = core.DB.pendingLoot[traderName] + + for i, lootLink in pairs(pendingLoot) do + local awarded = false + for containerSlot = 0, NUM_BAG_FRAMES do + for bagSlot = 1, GetContainerNumSlots(containerSlot) do + local containerLink = GetContainerItemLink(containerSlot, bagSlot) + + if not awarded and containerLink ~= nil and containerLink == lootLink then + ClearCursor() + PickupContainerItem(containerSlot, bagSlot) + local tradeSlot = TradeFrame_GetAvailableSlot() + if tradeSlot ~= nil and tradeSlot <= 6 then + ClickTradeButton(tradeSlot) + pendingLoot[i] = nil + tinsert(core.DB.pendingTrade, lootLink) + awarded = true + end + end + end + end + end + elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_ACCEPT_UPDATE" then + local arg2 = ... + local traderName = UnitName("npc") + if traderName == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then + return + end + if arg1 ~= nil and arg1 == 1 then + local pendingLoot = core.DB.pendingLoot[traderName] + if core.DB.pendingTrade == nil then + core.DB.pendingTrade = {} + end + for tradeSlot = 1, 6 do + local tradeLink = GetTradePlayerItemLink(tradeSlot) + for i, lootLink in pairs(pendingLoot) do + if tradeLink ~= nil and tradeLink == lootLink then + tinsert(core.DB.pendingTrade, tradeLink) + end + end + end + end + elseif core.DB.defaults.AutoAwardLoot and event == "TRADE_CLOSED" then + local traderName = UnitName("npc") + if traderName == nil or core.DB.pendingTrade == nil or core.DB.pendingLoot == nil or core.DB.pendingLoot[traderName] == nil then + return + end + local pendingLoot = core.DB.pendingLoot[traderName] + for _, tradeLink in pairs(core.DB.pendingTrade) do + for i, lootLink in pairs(pendingLoot) do + if tradeLink == lootLink then + pendingLoot[i] = nil + end + end + end + if #pendingLoot <= 0 then + core.DB.pendingLoot[traderName] = nil + end + core.DB.pendingTrade = {} + core.DB.pendingTradePlayer = nil + end +end + +function CommDKP:OnInitialize(event, name) -- This is the FIRST function to run on load triggered registered events at bottom of file + if (name ~= "CommunityDKP") then return end + + -- allows using left and right buttons to move through chat 'edit' box + --[[for i = 1, NUM_CHAT_WINDOWS do + _G["ChatFrame"..i.."EditBox"]:SetAltArrowKeyMode(false); + end--]] + + ---------------------------------- + -- Register Slash Commands + ---------------------------------- + SLASH_CommunityDKP1 = "/dkp"; + SLASH_CommunityDKP2 = "/CommDKP"; + SlashCmdList.CommunityDKP = HandleSlashCommands; + + --[[SLASH_RELOADUI1 = "/rl"; -- new slash command for reloading UI -- for debugging + SlashCmdList.RELOADUI = ReloadUI;--]] + + SLASH_FRAMESTK1 = "/fs"; -- new slash command for showing framestack tool + SlashCmdList.FRAMESTK = function() + LoadAddOn("Blizzard_DebugTools"); + FrameStackTooltip_Toggle(); + end + + if(event == "ADDON_LOADED") then + C_Timer.After(5, function () + core.CommDKPUI = CommDKP.UIConfig or CommDKP:CreateMenu(); -- creates main menu after 5 seconds (trying to initialize after raid frames are loaded) + core.KeyEventUI = CreateFrame("Frame","KeyEventFrame", UIParent); + + -- on every key down ? really? + core.KeyEventUI:SetScript("OnKeyDown", function(self, key) + if core.Initialized and core.IsOfficer then + if MouseIsOver(MultiBarLeft) or MouseIsOver(MultiBarRight) or MouseIsOver(MultiBarBottomLeft) or MouseIsOver(MultiBarBottomRight) or MouseIsOver(MainMenuBar) then + return; + end + -- TODO: Make this a configurable keybind. + if GameTooltip:GetItem() then + local item, link = GameTooltip:GetItem(); + + if (key == "LALT" or key == "LSHIFT") and IsShiftKeyDown() and IsAltKeyDown() then + + local _, _, Color, Ltype, itemID, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link,"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") + local itemIcon = GetItemIcon(itemID); + local itemName, itemLink = GetItemInfo(link); + + CommDKP:ToggleBidWindow(itemLink, itemIcon, itemName); + end + + if (key == "LCTRL" or key == "LSHIFT") and IsShiftKeyDown() and IsControlKeyDown() then + -- TODO: Automate the Price a Bit More + CommDKP:AwardConfirm(nil, 0, core.DB.bossargs.LastKilledBoss, core.DB.bossargs.CurrentRaidZone, link); + end + + + end + end + end); + + core.KeyEventUI:SetPropagateKeyboardInput(true); + end) + ------------------------------------------------ + -- Verify DB Schemas + ------------------------------------------------\ + if not CommDKP:VerifyDBSchema(CommDKP_DB) then CommDKP_DB = CommDKP:UpgradeDBSchema(CommDKP_DB, CommDKP_DB, false, "CommDKP_DB") end; + + -- Verify that the DB table has been initialized. + CommDKP:SetTable(CommDKP_DB, false, CommDKP:InitializeCommDKPDB(CommDKP:GetTable(CommDKP_DB))) + core.DB = CommDKP:GetTable(CommDKP_DB); --Player specific DB + + + if not CommDKP:VerifyDBSchema(CommDKP_DKPTable) then CommDKP_DKPTable = CommDKP:UpgradeDBSchema(CommDKP_DKPTable, CommDKP_DKPTable, true, "CommDKP_DKPTable") end; + if not CommDKP:VerifyDBSchema(CommDKP_Loot) then CommDKP_Loot = CommDKP:UpgradeDBSchema(CommDKP_Loot, CommDKP_Loot, true, "CommDKP_Loot") end; + if not CommDKP:VerifyDBSchema(CommDKP_DKPHistory) then CommDKP_DKPHistory = CommDKP:UpgradeDBSchema(CommDKP_DKPHistory, CommDKP_DKPHistory, true, "CommDKP_DKPHistory") end; + if not CommDKP:VerifyDBSchema(CommDKP_MinBids) then CommDKP_MinBids = CommDKP:UpgradeDBSchema(CommDKP_MinBids, CommDKP_MinBids, true, "CommDKP_MinBids") end; + if not CommDKP:VerifyDBSchema(CommDKP_MaxBids) then CommDKP_MaxBids = CommDKP:UpgradeDBSchema(CommDKP_MaxBids, CommDKP_MaxBids, true, "CommDKP_MaxBids") end; + if not CommDKP:VerifyDBSchema(CommDKP_Whitelist) then CommDKP_Whitelist = CommDKP:UpgradeDBSchema(CommDKP_Whitelist, CommDKP_Whitelist, false, "CommDKP_Whitelist") end; + if not CommDKP:VerifyDBSchema(CommDKP_Standby) then CommDKP_Standby = CommDKP:UpgradeDBSchema(CommDKP_Standby, CommDKP_Standby, true, "CommDKP_Standby") end; + if not CommDKP:VerifyDBSchema(CommDKP_Archive) then CommDKP_Archive = CommDKP:UpgradeDBSchema(CommDKP_Archive, CommDKP_Archive, true, "CommDKP_Archive") end; + if not CommDKP:VerifyDBSchema(CommDKP_Profiles) then CommDKP_Profiles = CommDKP:UpgradeDBSchema(CommDKP_Profiles, CommDKP_Profiles, true, "CommDKP_Profiles") end; + + + ------------------------------------ + -- Import SavedVariables + ------------------------------------ + core.WorkingTable = CommDKP:GetTable(CommDKP_DKPTable, true); -- imports full DKP table to WorkingTable for list manipulation + core.PriceTable = CommDKP:FormatPriceTable(); + + for i=1, #core.WorkingTable do + local CurPlayer = core.WorkingTable[i].player; + local search = CommDKP:Table_Search(CommDKP:GetTable(CommDKP_DKPTable, true), CurPlayer); + + if search then + --Set Version Info on Legacy Record First + local profile = CommDKP:GetTable(CommDKP_Profiles, true)[CurPlayer] or CommDKP:GetDefaultEntity(); + core.WorkingTable[i].version = profile.version; + end + end + + + if not CommDKP:GetTable(CommDKP_DKPHistory, true).seed then CommDKP:GetTable(CommDKP_DKPHistory, true).seed = 0 end + if not CommDKP:GetTable(CommDKP_Loot, true).seed then CommDKP:GetTable(CommDKP_Loot, true).seed = 0 end + if CommDKP:GetTable(CommDKP_DKPTable, true).seed then CommDKP:GetTable(CommDKP_DKPTable, true).seed = nil end + + + core.CurrentRaidZone = core.DB.bossargs.CurrentRaidZone; -- stores raid zone as a redundency + core.LastKilledBoss = core.DB.bossargs.LastKilledBoss; -- stores last boss killed as a redundency + core.LastKilledNPC = core.DB.bossargs.LastKilledNPC -- Stores last 30 mobs killed in raid. + core.RecentZones = core.DB.bossargs.RecentZones -- Stores last 30 zones entered within a raid party. + + table.sort(core.WorkingTable, function(a, b) + return a["player"] < b["player"] + end) + + table.sort(core.PriceTable, function(a, b) + if a["item"] ~= nil and b["item"] == nil then + return true; + elseif a["item"] == nil and b["item"] ~= nil then + return false; + elseif a["item"] == nil and b["item"] == nil then + return false; + end + + return a["item"] < b["item"] + end) + CommDKP:StartBidTimer("seconds", nil) -- initiates timer frame for use + + if CommDKP.BidTimer then CommDKP.BidTimer:SetScript("OnUpdate", nil) end + + if #CommDKP:GetTable(CommDKP_Loot, true) > core.DB.defaults.HistoryLimit then + CommDKP:PurgeLootHistory() -- purges Loot History entries that exceed the "HistoryLimit" option variable (oldest entries) and populates CommDKP_Archive with deleted values + end + if #CommDKP:GetTable(CommDKP_DKPHistory, true) > core.DB.defaults.DKPHistoryLimit then + CommDKP:PurgeDKPHistory() -- purges DKP History entries that exceed the "DKPHistoryLimit" option variable (oldest entries) and populates CommDKP_Archive with deleted values + end + core.DB.pendingLoot = {} + end +end + +function CommDKP:GetTable(dbTable, hasTeams, teamIndex) + hasTeams = hasTeams or false; + local _teamIndex; + + if IsInGuild() then + local realmName = CommDKP:GetRealmName(); + local guildName = CommDKP:GetGuildName(); + + dbTable = CommDKP:InitializeGuild(dbTable,realmName,guildName); + + if hasTeams then + + if teamIndex == nil then + _teamIndex = core.DB.defaults.CurrentTeam; + else + _teamIndex = teamIndex + end + + if not dbTable[realmName][guildName][_teamIndex] then + dbTable[realmName][guildName][_teamIndex] = {} + end + + return dbTable[realmName][guildName][_teamIndex]; + else + return dbTable[realmName][guildName]; + end + else + return dbTable[core.defaultTable]; + end +end + +function CommDKP:SetTable(dbTable, hasTeams, value, teamIndex) + hasTeams = hasTeams or false; + local _teamIndex; + + if IsInGuild() then + local realmName = CommDKP:GetRealmName(); + local guildName = CommDKP:GetGuildName(); + + dbTable = CommDKP:InitializeGuild(dbTable,realmName,guildName); + + if hasTeams then + if teamIndex == nil then + _teamIndex = core.DB.defaults.CurrentTeam; + else + _teamIndex = teamIndex + end + + dbTable[realmName][guildName][_teamIndex] = value; + else + dbTable[realmName][guildName] = value; + end + else + dbTable[core.defaultTable] = value; + end +end + +function CommDKP:VerifyDBSchema(dbTable) + local verified = false; + --Check to see if the schema node exists. If not, this is 2.1.2 database. + local retOK, hasInfo = pcall(CommDKP_tableHasKey,dbTable,"dbinfo"); + + if (not retOK) or (retOK and not hasInfo) then + verified = false; + elseif dbTable.dbinfo.build == core.BuildNumber then + verified = true; + end + + return verified; +end + +function CommDKP:UpgradeDBSchema(newDbTable, oldDbTable, hasTeams, tableName) + -- Initialize the Database for a Pre-2.2 Database + local retOK, hasInfo = pcall(CommDKP_tableHasKey,oldDbTable,"dbinfo"); + if (not retOK) or (retOK and not hasInfo) then + newDbTable = CommDKP:InitPlayerTable(oldDbTable, hasTeams, tableName) + end + + -- Verify that build and priorbuild elements exist. + if newDbTable.dbinfo.build == nil then + newDbTable.dbinfo.build = 0; + end + + if newDbTable.dbinfo.priorbuild == nil then + newDbTable.dbinfo.priorbuild = 0; + end + + --Set Prior Build + newDbTable.dbinfo.priorbuild = newDbTable.dbinfo.build; + + -- Build 20205 (2.2.5) Changes + if newDbTable.dbinfo.build < 20205 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber then + if newDbTable.dbinfo.name == "CommDKP_DB" then + + local defaultTable = {} + defaultTable = CommDKP:InitializeCommDKPDB(CommDKP:GetTable(defaultTable)) + if not defaultTable.defaults.CurrentTeam then defaultTable.defaults.CurrentTeam = "0" end; + if not defaultTable.teams then defaultTable.teams = {} end; + newDbTable[core.defaultTable] = defaultTable; + end + end + + if newDbTable.dbinfo.build < 30200 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber and newDbTable.dbinfo.priorbuild ~= 0 then + if newDbTable.dbinfo.name == "CommDKP_MinBids" then + newDbTable = CommDKP:RefactorMinBidItemTable(newDbTable); + end + end + + if newDbTable.dbinfo.build < 30202 and newDbTable.dbinfo.priorbuild ~= core.BuildNumber and newDbTable.dbinfo.priorbuild ~= 0 then + if newDbTable.dbinfo.name == "CommDKP_MinBids" then + newDbTable = CommDKP:VerifyMinBidItemTable(newDbTable); + end + end + + -- Set Current Build Number + newDbTable.dbinfo.build = core.BuildNumber; + return newDbTable; +end + +function CommDKP_tableHasKey(table,key) + return table[key] ~= nil; +end + +function CommDKP:InitializeCommDKPDB(dbTable) + if dbTable == nil then + dbTable = {} + end + + if not dbTable.DKPBonus or not dbTable.DKPBonus.OnTimeBonus then + dbTable.DKPBonus = { + OnTimeBonus = 15, BossKillBonus = 5, CompletionBonus = 10, NewBossKillBonus = 10, UnexcusedAbsence = -25, BidTimer = 30, DecayPercentage = 20, GiveRaidStart = false, IncStandby = false, + } + end + + if not dbTable.defaults or not dbTable.defaults.HistoryLimit then + dbTable.defaults = { + HistoryLimit = 2500, DKPHistoryLimit = 2500, BidTimerSize = 1.0, CommDKPScaleSize = 1.0, SuppressNotifications = false, TooltipHistoryCount = 15, SuppressTells = true, + } + end + if not dbTable.defaults.ChatFrames then + dbTable.defaults.ChatFrames = {} + for i = 1, NUM_CHAT_WINDOWS do + local name = GetChatWindowInfo(i) + + if name ~= "" then + dbTable.defaults.ChatFrames[name] = true + end + end + end + if not dbTable.raiders then dbTable.raiders = {} end + if not dbTable.MinBidBySlot or not dbTable.MinBidBySlot.Head then + dbTable.MinBidBySlot = { + Head = 70, Neck = 70, Shoulders = 70, Cloak = 70, Chest = 70, Bracers = 70, Hands = 70, Belt = 70, Legs = 70, Boots = 70, Ring = 70, Trinket = 70, OneHanded = 70, TwoHanded = 70, OffHand = 70, Range = 70, Other = 70, + } + end + if not dbTable.MaxBidBySlot or not dbTable.MaxBidBySlot.Head then + dbTable.MaxBidBySlot = { + Head = 0, Neck = 0, Shoulders = 0, Cloak = 0, Chest = 0, Bracers = 0, Hands = 0, Belt = 0, Legs = 0, Boots = 0, Ring = 0, Trinket = 0, OneHanded = 0, TwoHanded = 0, OffHand = 0, Range = 0, Other = 0, + } + end + if not dbTable.bossargs then dbTable.bossargs = { CurrentRaidZone = "Molten Core", LastKilledBoss = "Lucifron" } end + if not dbTable.modes or not dbTable.modes.mode then dbTable.modes = { mode = "Minimum Bid Values", SubZeroBidding = false, rounding = 0, AddToNegative = false, increment = 60, ZeroSumBidType = "Static", AllowNegativeBidders = false } end; + if not dbTable.modes.ZeroSumBank then dbTable.modes.ZeroSumBank = { balance = 0 } end + if not dbTable.modes.channels then dbTable.modes.channels = { raid = true, whisper = true, guild = true } end + if not dbTable.modes.costvalue then dbTable.modes.costvalue = "Integer" end + if not dbTable.modes.rolls or not dbTable.modes.rolls.min then dbTable.modes.rolls = { min = 1, max = 100, UsePerc = false, AddToMax = 0 } end + if not dbTable.bossargs.LastKilledNPC then dbTable.bossargs.LastKilledNPC = {} end + if not dbTable.bossargs.RecentZones then dbTable.bossargs.RecentZones = {} end + if not dbTable.defaults.HideChangeLogs then dbTable.defaults.HideChangeLogs = 0 end + if not dbTable.modes.AntiSnipe then dbTable.modes.AntiSnipe = 0 end + if not dbTable.defaults.CurrentGuild then dbTable.defaults.CurrentGuild = {} end + if not dbTable.defaults.CurrentTeam then dbTable.defaults.CurrentTeam = "0" end; + if not dbTable.teams then dbTable.teams = {} end; + if not dbTable.modes.AnnounceRaidWarning then dbTable.modes.AnnounceRaidWarning = false end; + if dbTable.defaults.CustomMaxBid == nil then dbTable.defaults.CustomMaxBid = true end; + if dbTable.defaults.CustomMinBid == nil then dbTable.defaults.CustomMinBid = true end; + + -- 3.1.3 Version Change - Removing installed Variables + if dbTable.defaults.installed210 then + dbTable.defaults.installed210 = nil; + end + + if dbTable.defaults.installed then + dbTable.defaults.installed = nil; + end + + if IsInGuild() then + if not dbTable.teams["0"] then + dbTable.teams["0"] = {name=CommDKP:GetGuildName()} + dbTable.defaults.CurrentTeam = "0"; + end; + end + + return dbTable; +end + +function CommDKP:InitPlayerTable(globalTable, hasTeams, tableName) + local playerTable = {}; + playerTable = CommDKP:InitDbSchema(playerTable, tableName); + if IsInGuild() then + + local realmName = CommDKP:GetRealmName(); + local guildName = CommDKP:GetGuildName(); + + + playerTable = CommDKP:InitializeGuild(playerTable,realmName,guildName); + + if not globalTable then + globalTable = {}; + end + + if hasTeams then + playerTable[realmName][guildName]["0"] = CopyTable(globalTable); + else + playerTable[realmName][guildName] = CopyTable(globalTable); + end + end + -- Init Default Table + playerTable[core.defaultTable] = {}; + return playerTable; +end + +function CommDKP:InitializeGuild(dataTable, realmName, guildName) + local retOK1, hasInfo1 = pcall(CommDKP_tableHasKey,dataTable,realmName); + + if (not retOK1) or (retOK1 and not hasInfo1) then + dataTable[realmName] = {} + end + + if guildName ~= nil then + local retOK2, hasInfo2 = pcall(CommDKP_tableHasKey,dataTable[realmName],guildName); + + if (not retOK2) or (retOK2 and not hasInfo2) then + dataTable[realmName][guildName] = {} + end + end + + return dataTable +end + +function CommDKP:InitDbSchema(dbTable, tableName) + dbTable["dbinfo"] = {}; + dbTable.dbinfo["build"] = 0; + dbTable.dbinfo["name"] = tableName; + dbTable.dbinfo["priorbuild"] = 0; + dbTable.dbinfo["needsUpgrade"] = false; + return dbTable; +end + +---------------------------------- +-- Monolith Migration +---------------------------------- + +function CommDKP:MonolithMigration() + local _, _, _, _, reason = GetAddOnInfo("MonolithDKP") + if reason == "MISSING" or reason == "DISABLED" then + return false -- MonolithDKP is missing or globally disabled + end + + local loaded, finished = IsAddOnLoaded("MonolithDKP") + if not loaded then + return false -- MonolithDKP is disabled for the current character + end + + if not finished then + CommDKP:Print("MonolithDKP has not finished loading - please report to Discord!") + return false -- Should not happen?! Maybe race condition ... + end + + -- MonolithDKP is up & running - CommunityDKP will not initialise + CommDKP:Print("Legacy MonolithDKP addon detected - please disable it to continue with CommunityDKP!") + local activeCommunity = self:MonolithMigrationDbEntries("CommDKP") -- check if CommunityDKP already has table entries + local activeCommunitySchema = CommDKP_DB ~= nil and CommDKP:GetTable(CommDKP_DB, false)["teams"] ~= nil -- check if CommunityDKP finished schema migration + local activeMonolith21x = self:MonolithMigrationLegacySeed() > 0 -- check if there are usable MonolithDKP 2.1.x tables available + local activeMonolith22x = self:MonolithMigrationDbBuild() > 0 and self:MonolithMigrationDbEntries("MonDKP") -- same for MonolithDKP 2.2.x + + -- check if we should offer migration + if not activeCommunity and (activeMonolith21x or activeMonolith21x) then + -- CommunityDKP is fresh and there are MonolithDKP 2.1.x or 2.2.x tables available + self:MonolithMigrationLegacyDetected(function() self:MonolithMigrationProcess(false) end) + elseif activeCommunity and activeCommunitySchema and activeMonolith21x and IsInGuild() and CommDKP:ValidateSender(UnitName("player")) then + -- CommunityDKP already has data we can import MonolithDKP 2.1.x data as a new team + self:MonolithMigrationAsNewTeam(function() self:MonolithMigrationProcess(true) end) + else + -- CommunityDKP already has table entries and there is no legacy data to add as an additional team + self:MonolithMigrationGenericPopup(L["MIGRATIONUNAVAILABLE"]) + end + + return true -- don't initialise CommunityDKP +end + +function CommDKP:MonolithMigrationProcess(asNewTeam) + asNewTeam = asNewTeam or false; + + -- add a new team? + local teamIndex + if asNewTeam then + teamIndex = CommDKP:AddNewTeamToGuild() + end + + -- deep copy so we don't modify the source data + local copyTableRecursive + copyTableRecursive = function(obj) + if type(obj) ~= "table" then return obj end + local res = {} + for k, v in pairs(obj) do res[copyTableRecursive(k)] = copyTableRecursive(v) end + return res + end + + -- rename MonDKPScaleSize property to CommDKPScaleSize for each guild / team + local migrateDefaultsRecursive + migrateDefaultsRecursive = function(table) + for k, v in pairs(table) do + if k == "defaults" then + if v.MonDKPScaleSize ~= nil then + v.CommDKPScaleSize = v.MonDKPScaleSize + v.MonDKPScaleSize = nil + end + elseif type(v) == "table" then + migrateDefaultsRecursive(v) + end + end + end + + -- copy everything from legacy addon + if asNewTeam then + -- local tempDB = copyTableRecursive(MonDKP_DB) + -- migrateDefaultsRecursive(tempDB) + -- CommDKP:SetTable(CommDKP_DB, true, tempDB, teamIndex) + + -- CommDKP:GetTable(CommDKP_DKPTable, false)[teamIndex] = MonDKP_DKPTable + CommDKP:SetTable(CommDKP_DKPTable, true, MonDKP_DKPTable, teamIndex) + CommDKP:SetTable(CommDKP_Loot, true, MonDKP_Loot, teamIndex) + CommDKP:SetTable(CommDKP_DKPHistory, true, MonDKP_DKPHistory, teamIndex) + CommDKP:SetTable(CommDKP_MinBids, true, MonDKP_MinBids, teamIndex) + CommDKP:SetTable(CommDKP_MaxBids, true, MonDKP_MaxBids, teamIndex) + CommDKP:SetTable(CommDKP_Whitelist, true, MonDKP_Whitelist, teamIndex) + CommDKP:SetTable(CommDKP_Standby, true, MonDKP_Standby, teamIndex) + CommDKP:SetTable(CommDKP_Archive, true, MonDKP_Archive, teamIndex) + else + local tempDB = copyTableRecursive(MonDKP_DB) + migrateDefaultsRecursive(tempDB) + CommDKP_DB = tempDB + + CommDKP_DKPTable = MonDKP_DKPTable + CommDKP_Loot = MonDKP_Loot + CommDKP_DKPHistory = MonDKP_DKPHistory + CommDKP_MinBids = MonDKP_MinBids + CommDKP_MaxBids = MonDKP_MaxBids + CommDKP_Whitelist = MonDKP_Whitelist + CommDKP_Standby = MonDKP_Standby + CommDKP_Archive = MonDKP_Archive + end + + -- show completion popup + self:MonolithMigrationGenericPopup(L["MIGRATIONCOMPLETED"]) +end + +function CommDKP:MonolithMigrationLegacyDetected(migration) + StaticPopupDialogs["MONOLITH_MIGRATION_DETECTED"] = { + text = L["MIGRATIONDETECTED"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = function() self:MonolithMigrationConfirmationPopup(migration) end, + OnCancel = function() self:MonolithMigrationCancelationPopup() end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MONOLITH_MIGRATION_DETECTED") +end + +function CommDKP:MonolithMigrationAsNewTeam(migration) + StaticPopupDialogs["MONOLITH_MIGRATION_TEAM"] = { + text = L["MIGRATIONTEAM"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = migration, + OnCancel = function() self:MonolithMigrationCancelationPopup() end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MONOLITH_MIGRATION_TEAM") +end + +function CommDKP:MonolithMigrationConfirmationPopup(migration) + StaticPopupDialogs["MONOLITH_MIGRATION_CONFIRMATION"] = { + text = "|CFFFF0000"..L["WARNING"].."|r: "..L["MIGRATIONCONFIRM"], + button1 = L["YES"], + button2 = L["NO"], + OnAccept = migration, + OnCancel = function() self:MonolithMigrationCancelationPopup() end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MONOLITH_MIGRATION_CONFIRMATION") +end + +function CommDKP:MonolithMigrationCancelationPopup() + StaticPopupDialogs["MONOLITH_MIGRATION_CANCELED"] = { + text = L["MIGRATIONCANCELED"], + button1 = L["OK"], + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MONOLITH_MIGRATION_CANCELED") +end + +function CommDKP:MonolithMigrationGenericPopup(text) + StaticPopupDialogs["MONOLITH_MIGRATION_GENERIC"] = { + text = text, + button1 = L["OK"], + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MONOLITH_MIGRATION_GENERIC") +end + +function CommDKP:MonolithMigrationLegacySeed() + -- returns the latest seed timestamp (version 2.1.x) or 0 if it won't find anything + local lootSeed = 0 + local historySeed = 0 + + if MonDKP_Loot ~= nil and #MonDKP_Loot > 0 and MonDKP_Loot[1].index ~= nil and strfind(MonDKP_Loot[1].index, "-") ~= nil then + lootSeed = tonumber(strsub(MonDKP_Loot[1].index, strfind(MonDKP_Loot[1].index, "-") + 1)) + end + if MonDKP_DKPHistory ~= nil and #MonDKP_DKPHistory > 0 and MonDKP_DKPHistory[1].index ~= nil and strfind(MonDKP_DKPHistory[1].index, "-") ~= nil then + historySeed = tonumber(strsub(MonDKP_DKPHistory[1].index, strfind(MonDKP_DKPHistory[1].index, "-") + 1)) + end + + return math.max(lootSeed or 0, historySeed or 0) +end + +function CommDKP:MonolithMigrationDbBuild() + -- returns the db build version (version 2.2.x) or 0 if it won't find anything + local build = 0 + + if MonDKP_DB ~= nil and MonDKP_DB.dbinfo ~= nil and MonDKP_DB.dbinfo.build ~= nil then + build = tonumber(MonDKP_DB.dbinfo.build) + end + + return build or 0 +end + +function CommDKP:MonolithMigrationDbEntries(prefix) + -- returns true if there are already CommunityDKP entries + local findEntryRecursive + findEntryRecursive = function(table, entry) + if table == nil then + return false + end + + for k, v in pairs(table) do + if k == entry then + return true -- entry found - ABORT! + elseif type(v) == "table" and findEntryRecursive(v, entry) then + return true -- entry in child table found - ABORT! + end + end + + return false + end + + if prefix ~= nil and prefix == "MonDKP" then + return findEntryRecursive(MonDKP_DKPHistory, "players") + or findEntryRecursive(MonDKP_DKPTable, "player") + or findEntryRecursive(MonDKP_Loot, "player") + else + return findEntryRecursive(CommDKP_DKPHistory, "players") + or findEntryRecursive(CommDKP_DKPTable, "player") + or findEntryRecursive(CommDKP_Loot, "player") + end +end + +---------------------------------- +-- Register Events and Initiallize AddOn +---------------------------------- + +local events = CreateFrame("Frame", "EventsFrame"); +events:RegisterEvent("ADDON_LOADED"); +events:RegisterEvent("GROUP_ROSTER_UPDATE"); +events:RegisterEvent("ENCOUNTER_START"); -- FOR TESTING PURPOSES. +events:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") -- NPC kill event +events:RegisterEvent("LOOT_OPENED") +events:RegisterEvent("CHAT_MSG_RAID") +events:RegisterEvent("CHAT_MSG_RAID_LEADER") +events:RegisterEvent("CHAT_MSG_WHISPER"); +events:RegisterEvent("CHAT_MSG_GUILD") +events:RegisterEvent("GUILD_ROSTER_UPDATE") +events:RegisterEvent("PLAYER_ENTERING_WORLD") +events:RegisterEvent("ZONE_CHANGED_NEW_AREA") +events:RegisterEvent("BOSS_KILL") +events:RegisterEvent("TRADE_SHOW") +events:RegisterEvent("TRADE_ACCEPT_UPDATE") +events:RegisterEvent("TRADE_CLOSED") +events:SetScript("OnEvent", CommDKP_OnEvent); -- calls the above CommDKP_OnEvent function to determine what to do with the event