diff --git a/Jamba-AdvancedLoot/Jamba-AdvancedLoot.toc b/Jamba-AdvancedLoot/Jamba-AdvancedLoot.toc index e82eb22..5e3882a 100644 --- a/Jamba-AdvancedLoot/Jamba-AdvancedLoot.toc +++ b/Jamba-AdvancedLoot/Jamba-AdvancedLoot.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: Jamba-AdvancedLoot ## Notes: Jamba-AdvancedLoot ## Author: Ebony, Former Author: Jafula & Max Schilling -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-AdvancedLoot/JambaAdvancedLoot.lua b/Jamba-AdvancedLoot/JambaAdvancedLoot.lua index 10e160c..4883952 100644 --- a/Jamba-AdvancedLoot/JambaAdvancedLoot.lua +++ b/Jamba-AdvancedLoot/JambaAdvancedLoot.lua @@ -558,8 +558,9 @@ end -- Called when the addon is enabled. function AJM:OnEnable() AJM:SetAutoLoot() - AJM:RegisterEvent( "LOOT_OPENED" ) + --AJM:RegisterEvent( "LOOT_OPENED" ) AJM:RegisterEvent( "GROUP_ROSTER_UPDATE" ) + AJM:RegisterEvent( "LOOT_READY" ) AJM:RegisterMessage( JambaApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) end @@ -647,6 +648,15 @@ function AJM:GROUP_ROSTER_UPDATE( event, ... ) AJM:SetAutoLoot() end +function AJM:LOOT_READY() + if AJM.db.advancedLoot == true then + if IsInGroup() then + AJM:DoAdvancedLoot() + end + end +end + + function AJM:LOOT_OPENED() if AJM.db.advancedLoot == true then if IsInGroup() then diff --git a/Jamba-AdvancedLoot/Locales/Locales.xml b/Jamba-AdvancedLoot/Locales/Locales.xml index 3a7360b..8e22097 100644 --- a/Jamba-AdvancedLoot/Locales/Locales.xml +++ b/Jamba-AdvancedLoot/Locales/Locales.xml @@ -10,4 +10,4 @@ Credits: Built on top of the awesome JAMBA addon, most code is copied nearly dir <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaAdvancedLoot-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Curr/Jamba-Curr.toc b/Jamba-Curr/Jamba-Curr.toc index 7da10b0..2a8c06a 100644 --- a/Jamba-Curr/Jamba-Curr.toc +++ b/Jamba-Curr/Jamba-Curr.toc @@ -1,12 +1,12 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaCurr ## Notes: JambaCurr ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba ## SavedVariables: JambaCurrProfileDB ## LoadOnDemand: 1 Locales\Locales.xml -JambaCurr.lua +JambaCurr.lua \ No newline at end of file diff --git a/Jamba-Curr/JambaCurr.lua b/Jamba-Curr/JambaCurr.lua index 0d9a976..a030892 100644 --- a/Jamba-Curr/JambaCurr.lua +++ b/Jamba-Curr/JambaCurr.lua @@ -61,6 +61,14 @@ AJM.currTypes.ShadowyCoins = 1154 AJM.currTypes.SightlessEye = 1149 AJM.currTypes.TimeWornArtifact = 1268 AJM.currTypes.CuriousCoin = 1275 +--7.2 +AJM.currTypes.LegionfallWarSupplies = 1342 +--7.2.5 +AJM.currTypes.CoinsOfAir = 1416 +--7.3 +AJM.currTypes.WrithingEssence = 1501 +AJM.currTypes.ArgusWaystone = 1506 +AJM.currTypes.VeiledArgunite = 1508 -------------------------------------- End of edit -------------------------------------------------------------- @@ -85,9 +93,9 @@ AJM.settings = { CcurrTypeThreeName = AJM:CurrencyIconAndName(AJM.currTypes.TimeWalker), CcurrTypeFour = AJM.currTypes.SightlessEye, CcurrTypeFourName = AJM:CurrencyIconAndName(AJM.currTypes.SightlessEye), - CcurrTypeFive = 0, + CcurrTypeFive = 1, CcurrTypeFiveName = "", - CcurrTypeSix = 0, + CcurrTypeSix = 1, CcurrTypeSixName = "", currencyFrameAlpha = 1.0, currencyFramePoint = "CENTER", @@ -726,8 +734,8 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM.db.currencyFrameBorderColourG = settings.currencyFrameBorderColourG AJM.db.currencyFrameBorderColourB = settings.currencyFrameBorderColourB AJM.db.currencyFrameBorderColourA = settings.currencyFrameBorderColourA - AJM.db.currencyMediaBorder = settings.currencyBorderStyle - AJM.db.currencyMediaBackground = settings.currencyBackgroundStyle + AJM.db.currencyBorderStyle = settings.currencyBorderStyle + AJM.db.currencyBackgroundStyle = settings.currencyBackgroundStyle AJM.db.currencyFontSize = settings.currencyFontSize AJM.db.currencyFontStyle = settings.currencyFontStyle AJM.db.currencyNameWidth = settings.currencyNameWidth @@ -771,7 +779,7 @@ function AJM:CreateJambaToonCurrencyListFrame() -- The frame. local frame = CreateFrame( "Frame", "JambaToonCurrencyListWindowFrame", UIParent ) frame.obj = AJM - frame:SetFrameStrata( "BACKGROUND" ) + frame:SetFrameStrata( "LOW" ) frame:SetToplevel( false ) frame:SetClampedToScreen( true ) frame:EnableMouse( true ) @@ -983,28 +991,40 @@ function AJM:UpdateHendingText() local parentFrame = JambaToonCurrencyListFrame -- Type One local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeOne ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeOneText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeOneText:SetText( iconTextureString ) + end -- Type Two local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeTwo ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeTwoText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeTwoText:SetText( iconTextureString ) + end -- Type Three local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeThree ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeThreeText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeThreeText:SetText( iconTextureString ) + end -- Type Four local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeFour ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeFourText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeFourText:SetText( iconTextureString ) + end -- Type Five local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeFive ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeFiveText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeFiveText:SetText( iconTextureString ) + end -- Type six local name, amount, icon, earnedThisWeek, weeklyMax, totalMax, isDiscovered = GetCurrencyInfo( AJM.db.CcurrTypeSix ) - local iconTextureString = strconcat(" |T"..icon..":20|t") - parentFrame.TypeSixText:SetText( iconTextureString ) + if icon ~= nil then + local iconTextureString = strconcat(" |T"..icon..":20|t") + parentFrame.TypeSixText:SetText( iconTextureString ) + end end function AJM:CurrencyUpdateWindowLock() @@ -1027,7 +1047,9 @@ function AJM:SettingsUpdateBorderStyle() } ) frame:SetBackdropColor( AJM.db.currencyFrameBackgroundColourR, AJM.db.currencyFrameBackgroundColourG, AJM.db.currencyFrameBackgroundColourB, AJM.db.currencyFrameBackgroundColourA ) frame:SetBackdropBorderColor( AJM.db.currencyFrameBorderColourR, AJM.db.currencyFrameBorderColourG, AJM.db.currencyFrameBorderColourB, AJM.db.currencyFrameBorderColourA ) + frame:ClearAllPoints() frame:SetAlpha( AJM.db.currencyFrameAlpha ) + frame:SetPoint( AJM.db.currencyFramePoint, UIParent, AJM.db.currencyFrameRelativePoint, AJM.db.currencyFrameXOffset, AJM.db.currencyFrameYOffset ) end function AJM:SettingsUpdateFontStyle() @@ -1398,10 +1420,10 @@ function AJM:JambaToonHideCurrency() end function AJM:JambaToonRequestCurrency() - -- Colour red. + -- Colour Light Red. local r = 1.0 - local g = 0.0 - local b = 0.0 + local g = 0.42 + local b = 0.42 local a = 0.6 for characterName, currencyFrameCharacterInfo in pairs( AJM.currencyFrameCharacterInfo ) do --AJM.Print("DoRequestCurrency", characterName) @@ -1444,6 +1466,7 @@ function AJM:JambaToonRequestCurrency() end AJM:JambaSendCommandToTeam( AJM.COMMAND_REQUEST_CURRENCY, "" ) AJM.SettingsRefresh() + end function AJM:DoSendCurrency( characterName, dummyValue ) @@ -1458,6 +1481,13 @@ function AJM:DoSendCurrency( characterName, dummyValue ) AJM.currentCurrencyValues.currTypeFour = select( 2, GetCurrencyInfo( AJM.db.CcurrTypeFour ) ) AJM.currentCurrencyValues.currTypeFive = select( 2, GetCurrencyInfo( AJM.db.CcurrTypeFive ) ) AJM.currentCurrencyValues.currTypeSix = select( 2, GetCurrencyInfo( AJM.db.CcurrTypeSix ) ) + -- Max CurrencyValues + AJM.currentCurrencyValues.currMaxTypeOne = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeOne ) ) + AJM.currentCurrencyValues.currMaxTypeTwo = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeTwo ) ) + AJM.currentCurrencyValues.currMaxTypeThree = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeThree ) ) + AJM.currentCurrencyValues.currMaxTypeFour = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeFour ) ) + AJM.currentCurrencyValues.currMaxTypeFive = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeFive ) ) + AJM.currentCurrencyValues.currMaxTypeSix = select( 6, GetCurrencyInfo( AJM.db.CcurrTypeSix ) ) AJM:JambaSendCommandToToon( characterName, AJM.COMMAND_HERE_IS_CURRENCY, AJM.currentCurrencyValues ) else return @@ -1465,7 +1495,7 @@ function AJM:DoSendCurrency( characterName, dummyValue ) end function AJM:DoShowToonsCurrency( characterName, currencyValues ) - --AJM.Print("DoShowCurrency", characterName, currencyValues.currTypeOne ) + --AJM.Print("DoShowCurrency", characterName, currencyValues.currTypeOne, currencyValues.currMaxTypeOne ) local parentFrame = JambaToonCurrencyListFrame -- Get (or create and get) the character information. local currencyFrameCharacterInfo = AJM.currencyFrameCharacterInfo[characterName] @@ -1479,15 +1509,47 @@ function AJM:DoShowToonsCurrency( characterName, currencyValues ) local g = 1.0 local b = 1.0 local a = 1.0 + local v = 0 + currencyFrameCharacterInfo.GoldText:SetTextColor( r, g, b, a ) currencyFrameCharacterInfo.characterNameText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeOneText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeTwoText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeThreeText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeFourText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeFiveText:SetTextColor( r, g, b, a ) - currencyFrameCharacterInfo.TypeSixText:SetTextColor( r, g, b, a ) - + currencyFrameCharacterInfo.GoldText:SetTextColor( r, g, b, a ) + if currencyValues.currTypeOne == currencyValues.currMaxTypeOne and currencyValues.currTypeOne > 0 then + --AJM:Print("SetRed") + currencyFrameCharacterInfo.TypeOneText:SetTextColor( r, v, v, a ) + else + --AJM:Print("SetWhite") + currencyFrameCharacterInfo.TypeOneText:SetTextColor( r, g, b, a ) + end + + if currencyValues.currTypeTwo == currencyValues.currMaxTypeTwo and currencyValues.currTypeTwo > 0 then + currencyFrameCharacterInfo.TypeTwoText:SetTextColor( r, v, v, a ) + else + currencyFrameCharacterInfo.TypeTwoText:SetTextColor( r, g, b, a ) + end + if currencyValues.currTypeThree == currencyValues.currMaxTypeThree and currencyValues.currTypeThree > 0 then + currencyFrameCharacterInfo.TypeThreeText:SetTextColor( r, v, v, a ) + else + currencyFrameCharacterInfo.TypeThreeText:SetTextColor( r, g, b, a ) + end + + if currencyValues.currTypeFour == currencyValues.currMaxTypeFour and currencyValues.currTypeFour > 0 then + currencyFrameCharacterInfo.TypeFourText:SetTextColor( r, v, v, a ) + else + currencyFrameCharacterInfo.TypeFourText:SetTextColor( r, g, b, a ) + end + + if currencyValues.currTypeFive == currencyValues.currMaxTypeFive and currencyValues.currTypeFive > 0 then + currencyFrameCharacterInfo.TypeFiveText:SetTextColor( r, v, v, a ) + else + currencyFrameCharacterInfo.TypeFiveText:SetTextColor( r, g, b, a ) + end + + if currencyValues.currTypeSix == currencyValues.currMaxTypeSix and currencyValues.currTypeSix > 0 then + currencyFrameCharacterInfo.TypeSixText:SetTextColor( r, v, v, a ) + else + currencyFrameCharacterInfo.TypeSixText:SetTextColor( r, g, b, a ) + end currencyFrameCharacterInfo.GoldText:SetText( JambaUtilities:FormatMoneyString( currencyValues.currGold ) ) --currencyFrameCharacterInfo.GoldText:SetText( GetCoinTextureString( currencyValues.currGold ) ) currencyFrameCharacterInfo.TypeOneText:SetText( currencyValues.currTypeOne ) diff --git a/Jamba-Curr/Locales/JambaCurr-Locale-enUS.lua b/Jamba-Curr/Locales/JambaCurr-Locale-enUS.lua index fbb9e0d..ef49c98 100644 --- a/Jamba-Curr/Locales/JambaCurr-Locale-enUS.lua +++ b/Jamba-Curr/Locales/JambaCurr-Locale-enUS.lua @@ -75,4 +75,4 @@ L["Shows Currency on The Currency display window."] = true L["You can change the Currency ID here.\n\nFor a list of ID's\nhttp://www.wowhead.com/currencies"] = true L["Show Currency Window"] = true L["Open Currency List On Start Up.\n\nThe Master Minion Only)"] = true -L["Lock Currency List\n\n(Enables Mouse Click-Through)"] = true +L["Lock Currency List\n\n(Enables Mouse Click-Through)"] = true \ No newline at end of file diff --git a/Jamba-Curr/Locales/Locales.xml b/Jamba-Curr/Locales/Locales.xml index 424585b..c60cd2b 100644 --- a/Jamba-Curr/Locales/Locales.xml +++ b/Jamba-Curr/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaCurr-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-DisplayTeam/Jamba-DisplayTeam.toc b/Jamba-DisplayTeam/Jamba-DisplayTeam.toc index 13cd196..beae5c3 100644 --- a/Jamba-DisplayTeam/Jamba-DisplayTeam.toc +++ b/Jamba-DisplayTeam/Jamba-DisplayTeam.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: Jamba-DisplayTeam ## Notes: Jamba-DisplayTeam ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-DisplayTeam/JambaDisplayTeam.lua b/Jamba-DisplayTeam/JambaDisplayTeam.lua index 0cad4d8..8a4d81b 100644 --- a/Jamba-DisplayTeam/JambaDisplayTeam.lua +++ b/Jamba-DisplayTeam/JambaDisplayTeam.lua @@ -18,6 +18,7 @@ local AJM = LibStub( "AceAddon-3.0" ):NewAddon( local JambaUtilities = LibStub:GetLibrary( "JambaUtilities-1.0" ) local JambaHelperSettings = LibStub:GetLibrary( "JambaHelperSettings-1.0" ) local LibBagUtils = LibStub:GetLibrary( "LibBagUtils-1.0" ) +local LibButtonGlow = LibStub:GetLibrary( "LibButtonGlow-1.0") AJM.SharedMedia = LibStub( "LibSharedMedia-3.0" ) -- Constants required by JambaModule and Locale for this module. @@ -52,6 +53,7 @@ AJM.settings = { teamListHorizontal = true, showListTitle = false, olnyShowInParty = false, + healthManaOutOfParty = false, showCharacterPortrait = true, characterPortraitWidth = 80, showFollowStatus = true, @@ -68,6 +70,7 @@ AJM.settings = { experienceStatusShowValues = false, experienceStatusShowPercentage = true, showHealthStatus = true, + showClassColors = false, healthStatusWidth = 100, healthStatusHeight = 30, healthStatusShowValues = true, @@ -155,6 +158,9 @@ AJM.COMMAND_TOONINFORMATION_UPDATE = "IlvlInfoUpd" AJM.COMMAND_REPUTATION_STATUS_UPDATE = "RepStsUpd" AJM.COMMAND_COMBO_STATUS_UPDATE = "CboStsUpd" AJM.COMMAND_REQUEST_INFO = "SendInfo" +AJM.COMMAND_COMBAT_STATUS_UPDATE = "InComStsUpd" +AJM.COMMAND_POWER_STATUS_UPDATE = "PowStsUpd" +AJM.COMMAND_HEALTH_STATUS_UPDATE = "heaStsUpd" ------------------------------------------------------------------------------------------------------------- -- Messages module sends. @@ -438,7 +444,7 @@ function AJM:SettingsUpdateStatusBarTexture() characterStatusBar["reputationBar"]:GetStatusBarTexture():SetVertTile( false ) characterStatusBar["healthBar"]:SetStatusBarTexture( statusBarTexture ) characterStatusBar["healthBar"]:GetStatusBarTexture():SetHorizTile( false ) - characterStatusBar["healthBar"]:GetStatusBarTexture():SetVertTile( false ) + characterStatusBar["healthBar"]:GetStatusBarTexture():SetVertTile( false ) characterStatusBar["powerBar"]:SetStatusBarTexture( statusBarTexture ) characterStatusBar["powerBar"]:GetStatusBarTexture():SetHorizTile( false ) characterStatusBar["powerBar"]:GetStatusBarTexture():SetVertTile( false ) @@ -534,11 +540,11 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) followBar.CurrText = "currNothing" followBar.CharacterLevel = 1 followBar.MaxCharacterLevel = 100 - followBarClick:SetScript("OnEnter", function(self) AJM:ShowFollowTooltip(followBarClick, followBar, characterName, true) end) - followBarClick:SetScript("OnLeave", function(self) GameTooltip:Hide() end) +-- followBarClick:SetScript("OnEnter", function(self) AJM:ShowFollowTooltip(followBarClick, followBar, characterName, true) end) +-- followBarClick:SetScript("OnLeave", function(self) GameTooltip:Hide() end) -- Set the experience bar. local experienceName = AJM.globalFramePrefix.."ExperienceBar" - local experienceBar = CreateFrame( "StatusBar", experienceName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) + local experienceBar = CreateFrame( "StatusBar", experienceName, parentFrame, "AnimatedStatusBarTemplate" ) --"TextStatusBar,SecureActionButtonTemplate" ) experienceBar.backgroundTexture = experienceBar:CreateTexture( experienceName.."BackgroundTexture", "ARTWORK" ) experienceBar.backgroundTexture:SetColorTexture( 0.0, 0.39, 0.88, 0.15 ) experienceBar:SetStatusBarTexture( statusBarTexture ) @@ -559,11 +565,12 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) experienceBarText.playerExperience = 100 experienceBarText.playerMaxExperience = 100 experienceBarText.exhaustionStateID = 1 + experienceBarText.playerLevel = 1 characterStatusBar["experienceBarText"] = experienceBarText AJM:UpdateExperienceStatus( characterName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ) -- Set the artifactXP bar. local experienceArtName = AJM.globalFramePrefix.."ExperienceArtBar" - local experienceArtBar = CreateFrame( "StatusBar", experienceArtName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) + local experienceArtBar = CreateFrame( "StatusBar", experienceArtName, parentFrame, "AnimatedStatusBarTemplate" ) --"TextStatusBar,SecureActionButtonTemplate" ) experienceArtBar.backgroundTexture = experienceArtBar:CreateTexture( experienceArtName.."BackgroundTexture", "ARTWORK" ) experienceArtBar.backgroundTexture:SetColorTexture( 1.0, 0.0, 0.0, 0.15 ) experienceArtBar:SetStatusBarTexture( statusBarTexture ) @@ -584,12 +591,13 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) experienceArtBarText.artifactName = "N/A" experienceArtBarText.artifactXP = 0 experienceArtBarText.artifactForNextPoint = 100 + experienceArtBarText.artifactPointsSpent = 1 experienceArtBarText.artifactPointsAvailable = 0 characterStatusBar["experienceArtBarText"] = experienceArtBarText AJM:UpdateExperienceStatus( characterName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ) -- Set the HonorXP bar. local experienceHonorName = AJM.globalFramePrefix.."ExperienceHonorBar" - local experienceHonorBar = CreateFrame( "StatusBar", experienceHonorName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) + local experienceHonorBar = CreateFrame( "StatusBar", experienceHonorName, parentFrame, "AnimatedStatusBarTemplate" ) --"TextStatusBar,SecureActionButtonTemplate" ) experienceHonorBar.backgroundTexture = experienceArtBar:CreateTexture( experienceArtName.."BackgroundTexture", "ARTWORK" ) experienceHonorBar.backgroundTexture:SetColorTexture( 1.0, 0.0, 0.0, 0.15 ) experienceHonorBar:SetStatusBarTexture( statusBarTexture ) @@ -616,7 +624,7 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) AJM:UpdateExperienceStatus( characterName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ) -- Set the reputation bar. local reputationName = AJM.globalFramePrefix.."ReputationBar" - local reputationBar = CreateFrame( "StatusBar", reputationName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) + local reputationBar = CreateFrame( "StatusBar", reputationName, parentFrame, "AnimatedStatusBarTemplate" ) --"TextStatusBar,SecureActionButtonTemplate" ) reputationBar.backgroundTexture = reputationBar:CreateTexture( reputationName.."BackgroundTexture", "ARTWORK" ) reputationBar.backgroundTexture:SetColorTexture( 0.0, 0.39, 0.88, 0.15 ) reputationBar:SetStatusBarTexture( statusBarTexture ) @@ -642,6 +650,7 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) characterStatusBar["reputationBarText"] = reputationBarText AJM:UpdateReputationStatus( characterName, nil, nil, nil ) -- Set the health bar. + local healthName = AJM.globalFramePrefix.."HealthBar" local healthBar = CreateFrame( "StatusBar", healthName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) healthBar.backgroundTexture = healthBar:CreateTexture( healthName.."BackgroundTexture", "ARTWORK" ) @@ -653,10 +662,27 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) healthBar:SetValue( 100 ) healthBar:SetFrameStrata( "LOW" ) healthBar:SetAlpha( 1 ) + + + local healthIncomingName = AJM.globalFramePrefix.."HealthIncomingBar" + local healthIncomingBar = CreateFrame( "StatusBar", healthIncomingName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) + healthIncomingBar.backgroundTexture = healthIncomingBar:CreateTexture( healthIncomingName.."BackgroundTexture", "ARTWORK" ) + healthIncomingBar.backgroundTexture:SetColorTexture( 0.58, 0.0, 0.55, 0.15 ) + healthIncomingBar:SetStatusBarTexture( statusBarTexture ) + healthIncomingBar:GetStatusBarTexture():SetHorizTile( false ) + healthIncomingBar:GetStatusBarTexture():SetVertTile( false ) + healthIncomingBar:SetMinMaxValues( 0, 100 ) + healthIncomingBar:SetValue( 0 ) + healthIncomingBar:SetFrameStrata( "BACKGROUND" ) + healthIncomingBar:SetAlpha( 1 ) + + -- Set the heal Incoming bar + local healthBarClick = CreateFrame( "CheckButton", healthName.."Click"..characterName, parentFrame, "SecureActionButtonTemplate" ) healthBarClick:SetAttribute( "unit", Ambiguate( characterName, "all" ) ) healthBarClick:SetFrameStrata( "MEDIUM" ) characterStatusBar["healthBar"] = healthBar + characterStatusBar["healthIncomingBar"] = healthIncomingBar characterStatusBar["healthBarClick"] = healthBarClick local healthBarText = healthBar:CreateFontString( healthName.."Text", "OVERLAY", "GameFontNormal" ) healthBarText:SetTextColor( 1.00, 1.00, 1.00, 1.00 ) @@ -664,8 +690,11 @@ function AJM:CreateJambaTeamStatusBar( characterName, parentFrame ) healthBarText:SetAllPoints() healthBarText.playerHealth = 100 healthBarText.playerMaxHealth = 100 + healthBarText.inComingHeal = 0 characterStatusBar["healthBarText"] = healthBarText AJM:UpdateHealthStatus( characterName, nil, nil ) + + -- Set the power bar. local powerName = AJM.globalFramePrefix.."PowerBar" local powerBar = CreateFrame( "StatusBar", powerName, parentFrame, "TextStatusBar,SecureActionButtonTemplate" ) @@ -822,6 +851,7 @@ function AJM:HideJambaTeamStatusBar( characterName ) characterStatusBar["reputationBar"]:Hide() characterStatusBar["reputationBarClick"]:Hide() characterStatusBar["healthBar"]:Hide() + characterStatusBar["healthIncomingBar"]:Hide() characterStatusBar["healthBarClick"]:Hide() characterStatusBar["powerBar"]:Hide() characterStatusBar["powerBarClick"]:Hide() @@ -1112,6 +1142,7 @@ function AJM:UpdateJambaTeamStatusBar( characterName, characterPosition ) end -- Display the health bar. local healthBar = characterStatusBar["healthBar"] + local healthIncomingBar = characterStatusBar["healthIncomingBar"] local healthBarClick = characterStatusBar["healthBarClick"] if AJM.db.showHealthStatus == true then healthBar.backgroundTexture:SetAllPoints() @@ -1131,7 +1162,18 @@ function AJM:UpdateJambaTeamStatusBar( characterName, characterPosition ) else healthBar:Hide() healthBarClick:Hide() - end + end + -- Display the health Incoming bar. + if AJM.db.showHealthStatus == true then + healthIncomingBar.backgroundTexture:SetAllPoints() + healthIncomingBar:SetWidth( AJM.db.healthStatusWidth ) + healthIncomingBar:SetHeight( AJM.db.healthStatusHeight ) + healthIncomingBar:SetPoint( "TOPLEFT", healthBar, "TOPLEFT", 0, 0 ) + healthIncomingBar:Show() + else + healthIncomingBar:Hide() + --healthBarClick:Hide() + end -- Display the power bar. local powerBar = characterStatusBar["powerBar"] local powerBarClick = characterStatusBar["powerBarClick"] @@ -1211,7 +1253,7 @@ local function SettingsCreateDisplayOptions( top ) L["Show Team List"], AJM.SettingsToggleShowTeamList, L["Show Jamba Team or Unit Frame List"] - ) + ) movingTop = movingTop - checkBoxHeight - verticalSpacing AJM.settingsControl.displayOptionsCheckBoxShowTeamListOnlyOnMaster = JambaHelperSettings:CreateCheckBox( AJM.settingsControl, @@ -1243,6 +1285,26 @@ local function SettingsCreateDisplayOptions( top ) L["Enable Clique Support\n\n**reload UI to take effect**"] ) movingTop = movingTop - checkBoxHeight - verticalSpacing + AJM.settingsControl.displayOptionsCheckBoxOlnyShowInParty = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Only Show in Party"], + AJM.SettingsToggleOlnyShowinParty, + L["Only Show Display-Team\nIn Party or Raid"] + ) + movingTop = movingTop - checkBoxHeight - verticalSpacing + AJM.settingsControl.displayOptionsCheckBoxHpManaOutOfParty = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Health & Power Out of Group"], + AJM.SettingsToggleHpManaOutOfParty, + L["Update Health and Power out of Groups\nUse Guild Communications!"] + ) + movingTop = movingTop - checkBoxHeight - verticalSpacing -- Create appearance & layout. JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Appearance & Layout"], movingTop, true ) movingTop = movingTop - headingHeight @@ -1254,18 +1316,8 @@ local function SettingsCreateDisplayOptions( top ) L["Show Title"], AJM.SettingsToggleShowTeamListTitle, L["Show Team List Title"] - ) - AJM.settingsControl.displayOptionsCheckBoxOlnyShowInParty = JambaHelperSettings:CreateCheckBox( - AJM.settingsControl, - thirdWidth, - left2, - movingTop, - L["Olny Show in Party"], - AJM.SettingsToggleOlnyShowinParty, - L["Olny Show Display-Team\nIn Party or Raid"] ) movingTop = movingTop - checkBoxHeight - verticalSpacing - AJM.settingsControl.displayOptionsCharactersPerBar = JambaHelperSettings:CreateSlider( AJM.settingsControl, halfWidthSlider, @@ -1586,7 +1638,17 @@ local function SettingsCreateDisplayOptions( top ) L["Percentage"], AJM.SettingsToggleShowHealthStatusPercentage, L["Show Percentage"] - ) + ) + movingTop = movingTop - checkBoxHeight - verticalSpacing + AJM.settingsControl.displayOptionsCheckBoxShowClassColors = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + thirdWidth, + left, + movingTop, + L["Show Class Colors"], + AJM.SettingsToggleShowClassColors, + L["Show class Coulor on Health Bar"] + ) movingTop = movingTop - checkBoxHeight - verticalSpacing AJM.settingsControl.displayOptionsHealthStatusWidthSlider = JambaHelperSettings:CreateSlider( AJM.settingsControl, @@ -1748,6 +1810,7 @@ function AJM:SettingsRefresh() -- AJM.settingsControl.displayOptionsCheckBoxTeamHorizontal:SetValue( AJM.db.teamListHorizontal ) AJM.settingsControl.displayOptionsCheckBoxShowListTitle:SetValue( AJM.db.showListTitle ) AJM.settingsControl.displayOptionsCheckBoxOlnyShowInParty:SetValue( AJM.db.olnyShowInParty ) + AJM.settingsControl.displayOptionsCheckBoxHpManaOutOfParty:SetValue ( AJM.db.healthManaOutOfParty ) AJM.settingsControl.displayOptionsTeamListTransparencySlider:SetValue( AJM.db.frameAlpha ) AJM.settingsControl.displayOptionsTeamListScaleSlider:SetValue( AJM.db.teamListScale ) AJM.settingsControl.displayOptionsTeamListMediaStatus:SetValue( AJM.db.statusBarTexture ) @@ -1774,6 +1837,7 @@ function AJM:SettingsRefresh() AJM.settingsControl.displayOptionsExperienceStatusWidthSlider:SetValue( AJM.db.experienceStatusWidth ) AJM.settingsControl.displayOptionsExperienceStatusHeightSlider:SetValue( AJM.db.experienceStatusHeight ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatus:SetValue( AJM.db.showHealthStatus ) + AJM.settingsControl.displayOptionsCheckBoxShowClassColors:SetValue( AJM.db.showClassColors ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatusValues:SetValue( AJM.db.healthStatusShowValues ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatusPercentage:SetValue( AJM.db.healthStatusShowPercentage ) AJM.settingsControl.displayOptionsHealthStatusWidthSlider:SetValue( AJM.db.healthStatusWidth ) @@ -1803,6 +1867,7 @@ function AJM:SettingsRefresh() --AJM.settingsControl.displayOptionsCheckBoxTeamHorizontal:SetDisabled( not AJM.db.showTeamList ) AJM.settingsControl.displayOptionsCheckBoxShowListTitle:SetDisabled( not AJM.db.showTeamList ) AJM.settingsControl.displayOptionsCheckBoxOlnyShowInParty:SetDisabled( not AJM.db.showTeamList ) + AJM.settingsControl.displayOptionsCheckBoxHpManaOutOfParty:SetDisabled( not AJM.db.showTeamList) AJM.settingsControl.displayOptionsTeamListScaleSlider:SetDisabled( not AJM.db.showTeamList ) AJM.settingsControl.displayOptionsTeamListTransparencySlider:SetDisabled( not AJM.db.showTeamList ) AJM.settingsControl.displayOptionsTeamListMediaStatus:SetDisabled( not AJM.db.showTeamList ) @@ -1829,6 +1894,7 @@ function AJM:SettingsRefresh() AJM.settingsControl.displayOptionsExperienceStatusWidthSlider:SetDisabled( not AJM.db.showTeamList or not AJM.db.showExperienceStatus) AJM.settingsControl.displayOptionsExperienceStatusHeightSlider:SetDisabled( not AJM.db.showTeamList or not AJM.db.showExperienceStatus ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatus:SetDisabled( not AJM.db.showTeamList ) + AJM.settingsControl.displayOptionsCheckBoxShowClassColors:SetDisabled( not AJM.db.showTeamList or not AJM.db.showHealthStatus ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatusValues:SetDisabled( not AJM.db.showTeamList or not AJM.db.showHealthStatus ) AJM.settingsControl.displayOptionsCheckBoxShowHealthStatusPercentage:SetDisabled( not AJM.db.showTeamList or not AJM.db.showHealthStatus ) AJM.settingsControl.displayOptionsHealthStatusWidthSlider:SetDisabled( not AJM.db.showTeamList or not AJM.db.showHealthStatus ) @@ -1878,6 +1944,7 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) --AJM.db.teamListHorizontal = settings.teamListHorizontal AJM.db.showListTitle = settings.showListTitle AJM.db.olnyShowInParty = settings.olnyShowInParty + AJM.db.healthManaOutOfParty = settings.healthManaOutOfParty AJM.db.teamListScale = settings.teamListScale AJM.db.statusBarTexture = settings.statusBarTexture AJM.db.borderStyle = settings.borderStyle @@ -1901,6 +1968,7 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM.db.experienceStatusShowValues = settings.experienceStatusShowValues AJM.db.experienceStatusShowPercentage = settings.experienceStatusShowPercentage AJM.db.showHealthStatus = settings.showHealthStatus + AJM.db.showClassColors = settings.showClassColors AJM.db.healthStatusWidth = settings.healthStatusWidth AJM.db.healthStatusHeight = settings.healthStatusHeight AJM.db.healthStatusShowValues = settings.healthStatusShowValues @@ -1993,6 +2061,12 @@ function AJM:SettingsToggleOlnyShowinParty( event, checked ) AJM:SettingsRefresh() end +function AJM:SettingsToggleHpManaOutOfParty( event, checked ) + AJM.db.healthManaOutOfParty = checked + AJM:SettingsRefresh() +end + + function AJM:SettingsChangeScale( event, value ) AJM.db.teamListScale = tonumber( value ) AJM:SettingsRefresh() @@ -2122,6 +2196,11 @@ function AJM:SettingsToggleShowHealthStatus( event, checked ) AJM:SettingsRefresh() end +function AJM:SettingsToggleShowClassColors( event, checked ) + AJM.db.showClassColors = checked + AJM:SettingsRefresh() +end + function AJM:SettingsToggleShowHealthStatusValues( event, checked ) AJM.db.healthStatusShowValues = checked AJM:SettingsRefresh() @@ -2222,6 +2301,7 @@ end ]] -- A Jamba command has been recieved. function AJM:JambaOnCommandReceived( characterName, commandName, ... ) AJM:DebugMessage( "JambaOnCommandReceived", characterName ) + --AJM:Print("DebugCommandReceived", characterName, commandName ) if commandName == AJM.COMMAND_FOLLOW_STATUS_UPDATE then AJM:ProcessUpdateFollowStatusMessage( characterName, ... ) end @@ -2237,9 +2317,18 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if commandName == AJM.COMMAND_COMBO_STATUS_UPDATE then AJM:ProcessUpdateComboStatusMessage( characterName, ... ) end + if commandName == AJM.COMMAND_COMBAT_STATUS_UPDATE then + AJM:ProcessUpdateCombatStatusMessage( characterName, ... ) + end + if commandName == AJM.COMMAND_HEALTH_STATUS_UPDATE then + AJM:ProcessUpdateHealthStatusMessage( characterName, ... ) + end + if commandName == AJM.COMMAND_POWER_STATUS_UPDATE then + AJM:ProcessUpdatePowerStatusMessage(characterName, ... ) + end if commandName == AJM.COMMAND_REQUEST_INFO then AJM.SendInfomationUpdateCommand() - end + end end ------------------------------------------------------------------------------------------------------------- @@ -2430,6 +2519,7 @@ function AJM:SendFollowStatusUpdateCommand( isFollowing ) if AJM.db.showTeamList == true and AJM.db.showFollowStatus == true then local canSend = false local alpha = AutoFollowStatus:GetAlpha() + --AJM:Print("testA", alpha) if alpha < 1 then canSend = true AJM.isFollowing = false @@ -2444,7 +2534,7 @@ function AJM:SendFollowStatusUpdateCommand( isFollowing ) canSend = false end end - --AJM:Print("canSend", canSend) + --AJM:Print("canSend", canSend ) if canSend == true then if AJM.db.showTeamListOnMasterOnly == true then AJM:JambaSendCommandToMaster( AJM.COMMAND_FOLLOW_STATUS_UPDATE, isFollowing ) @@ -2455,12 +2545,13 @@ function AJM:SendFollowStatusUpdateCommand( isFollowing ) end end + function AJM:ProcessUpdateFollowStatusMessage( characterName, isFollowing ) - AJM:UpdateFollowStatus( characterName, isFollowing, isFollowLeader ) + AJM:UpdateFollowStatus( characterName, isFollowing ) end -function AJM:UpdateFollowStatus( characterName, isFollowing, isFollowLeader ) - --AJM:Print("follow", characterName, isFollowing, isFollowLeader) +function AJM:UpdateFollowStatus( characterName, isFollowing ) + --AJM:Print("follow", characterName, "follow", isFollowing) if CanDisplayTeamList() == false then return end @@ -2472,30 +2563,56 @@ function AJM:UpdateFollowStatus( characterName, isFollowing, isFollowLeader ) if characterStatusBar == nil then return end - local followBar = characterStatusBar["followBar"] + local followBar = characterStatusBar["followBar"] if isFollowing == true then -- Following. followBar:SetStatusBarColor( 0.05, 0.85, 0.05, 1.00 ) + LibButtonGlow.HideOverlayGlow(followBar) else if isFollowLeader == true then -- Follow leader. followBar:SetStatusBarColor( 0.55, 0.15, 0.15, 0.25 ) + LibButtonGlow.HideOverlayGlow(followBar) else -- Not following. + LibButtonGlow.ShowOverlayGlow(followBar) followBar:SetStatusBarColor( 0.85, 0.05, 0.05, 1.00 ) + AJM:ScheduleTimer("EndGlowFollowBar", 2 , followBar) end - end + end +end + +function AJM:EndGlowFollowBar(frame) + LibButtonGlow.HideOverlayGlow(frame) +end + +-- TEXT and Combat updates + +function AJM:SendCombatStatusUpdateCommand() + local inCombat = UnitAffectingCombat("player") + --AJM:Print("canSend", inCombat) + if AJM.db.showTeamListOnMasterOnly == true then + AJM:JambaSendCommandToMaster( AJM.COMMAND_COMBAT_STATUS_UPDATE, inCombat ) + else + AJM:JambaSendCommandToTeam( AJM.COMMAND_COMBAT_STATUS_UPDATE, inCombat ) + end end function AJM:SettingsUpdateFollowTextAll() for characterName, characterStatusBar in pairs( AJM.characterStatusBar ) do - AJM:SettingsUpdateFollowText( characterName ) + AJM:SettingsUpdateFollowText( characterName, nil ) end end -function AJM:SettingsUpdateFollowText( characterName, characterLevel, characterMaxLevel, overall, equipped, gold, durability, slotsFree, totalSlots, toolText ) - --AJM:Print("Info", characterName, characterLevel,characterMaxLevel, overall, equipped) -- debug +function AJM:ProcessUpdateCombatStatusMessage( characterName, inCombat ) +-- AJM:Print("test", characterName, inCombat ) + AJM:SettingsUpdateFollowText( characterName, inCombat ) +end + + +function AJM:SettingsUpdateFollowText( characterName, inCombat ) + --AJM:Print("FollowTextInfo", characterName, inCombat) -- debug if CanDisplayTeamList() == false then return end @@ -2507,8 +2624,26 @@ function AJM:SettingsUpdateFollowText( characterName, characterLevel, characterM if characterStatusBar == nil then return end - local followBarText = characterStatusBar["followBarText"] + +--[[ if inCombat == true then + --AJM:Print("change stuff here") + local _, _, icon = GetCurrencyInfo( "1356" ) + local text = followBarText:GetText() + local iconTextureString = strconcat(" |T"..icon..":14|t") + followBarText:SetText( iconTextureString.." "..text ) + else + local text = "" + text = text..Ambiguate( characterName, "none" ) + followBarText:SetText( text ) + end +]] + if inCombat == true then + followBarText:SetTextColor(1.0, 0.5, 0.25) + else + followBarText:SetTextColor( 1.00, 1.00, 1.00, 1.00 ) + end + local text = "" if AJM.db.followStatusShowName == true then text = text..Ambiguate( characterName, "none" ) @@ -2537,6 +2672,10 @@ function AJM:HONOR_XP_UPDATE(event, arg1, agr2, ...) AJM:SendExperienceStatusUpdateCommand() end +function AJM:ARTIFACT_XP_UPDATE(event, ...) + AJM:SendExperienceStatusUpdateCommand() +end + function AJM:HONOR_LEVEL_UPDATE(event, arg1, agr2, ...) AJM:SendExperienceStatusUpdateCommand() end @@ -2558,13 +2697,17 @@ function AJM:SendExperienceStatusUpdateCommand() local artifactXP = 0 local artifactForNextPoint = 100 local artifactPointsAvailable = 0 + local artifactPointsSpent = 0 if ArtifactWatchBar:IsShown() == true then - local itemID, altItemID, name, icon, totalXP, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop = C_ArtifactUI.GetEquippedArtifactInfo() - local numPointsAvailableToSpend, xp, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP) + --local itemID, altItemID, name, icon, totalXP, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop = C_ArtifactUI.GetEquippedArtifactInfo() + --local numPointsAvailableToSpend, xp, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(pointsSpent, totalXP) + local artifactItemID, _, name, _, artifactTotalXP, artifactPointsSpent, _, _, _, _, _, _, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo() + local numPointsAvailableToSpend, xp, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP(artifactPointsSpent, artifactTotalXP, artifactTier) artifactName = name artifactXP = xp artifactForNextPoint = xpForNextPoint - artifactPointsAvailable = numPointsAvailableToSpend + artifactPointsAvailable = numPointsAvailableToSpend + artifactPointsSpent = pointsSpent end local honorXP = UnitHonor("player") local honorMax = UnitHonorMax("player") @@ -2576,35 +2719,31 @@ function AJM:SendExperienceStatusUpdateCommand() local honorExhaustionStateID = GetHonorRestState() if not (honorexhaustionStateID == 1) then honorExhaustionStateID = 0 - end - - + end -- AJM:Print("testSend", honorXP, honorMax, HonorLevel, honorExhaustionStateID) - - if AJM.db.showTeamListOnMasterOnly == true then --AJM:Print("Test", characterName, name, xp, xpForNextPoint, numPointsAvailableToSpend) - AJM:JambaSendCommandToMaster( AJM.COMMAND_EXPERIENCE_STATUS_UPDATE, playerExperience, playerMaxExperience, exhaustionStateID, artifactName, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) + AJM:JambaSendCommandToMaster( AJM.COMMAND_EXPERIENCE_STATUS_UPDATE, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel, artifactName, artifactPointsSpent, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) else AJM:DebugMessage( "SendExperienceStatusUpdateCommand TO TEAM!" ) --AJM:Print("Test", characterName, name, xp, xpForNextPoint, numPointsAvailableToSpend) - AJM:JambaSendCommandToTeam( AJM.COMMAND_EXPERIENCE_STATUS_UPDATE, playerExperience, playerMaxExperience, exhaustionStateID, artifactName, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID) + AJM:JambaSendCommandToTeam( AJM.COMMAND_EXPERIENCE_STATUS_UPDATE, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel, artifactName, artifactXP, artifactPointsSpent, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID) end end end -function AJM:ProcessUpdateExperienceStatusMessage( characterName, playerExperience, playerMaxExperience, exhaustionStateID, artifactName, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID) - AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxExperience, exhaustionStateID, artifactName, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) +function AJM:ProcessUpdateExperienceStatusMessage( characterName, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel, artifactName, artifactXP, artifactForNextPoint, artifactPointsSpent, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID) + AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel, artifactName, artifactXP, artifactForNextPoint, artifactPointsSpent, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) end function AJM:SettingsUpdateExperienceAll() for characterName, characterStatusBar in pairs( AJM.characterStatusBar ) do - AJM:UpdateExperienceStatus( characterName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ) + AJM:UpdateExperienceStatus( characterName, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ) end end -function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxExperience, exhaustionStateID, artifactName, artifactXP, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) ---AJM:Print( "UpdateExperienceStatus", characterName, playerExperience, playerMaxExperience, exhaustionStateID) +function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel, artifactName, artifactXP, artifactPointsSpent, artifactForNextPoint, artifactPointsAvailable, honorXP, honorMax, HonorLevel, honorExhaustionStateID ) +--AJM:Print( "UpdateExperienceStatus", characterName, playerExperience, playerMaxExperience, exhaustionStateID, playerLevel) -- AJM:Print("ArtTest", characterName, "name", artifactName, "xp", artifactXP, "Points", artifactForNextPoint, artifactPointsAvailable) -- AJM:Print("honorTest", characterName, honorXP, honorMax, HonorLevel, honorExhaustionStateID) if CanDisplayTeamList() == false then @@ -2639,8 +2778,6 @@ function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxE return end - - if playerExperience == nil then playerExperience = experienceBarText.playerExperience end @@ -2650,7 +2787,9 @@ function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxE if exhaustionStateID == nil then exhaustionStateID = experienceBarText.exhaustionStateID end - + if playerLevel == nil then + playerLevel = experienceBarText.playerLevel + end if artifactName == nil then artifactName = experienceArtBarText.artifactName end @@ -2658,7 +2797,9 @@ function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxE if artifactXP == nil then artifactXP = experienceArtBarText.artifactXP end - + if artifactPointsSpent == nil then + artifactPointsSpent = experienceArtBarText.artifactPointsSpent + end if artifactForNextPoint == nil then artifactForNextPoint = experienceArtBarText.artifactForNextPoint end @@ -2686,24 +2827,31 @@ function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxE experienceBarText.playerExperience = playerExperience experienceBarText.playerMaxExperience = playerMaxExperience experienceBarText.exhaustionStateID = exhaustionStateID + experienceBarText.playerLevel = playerLevel experienceArtBarText.artifactName = artifactName experienceArtBarText.artifactXP = artifactXP + experienceArtBarText.artifactPointsSpent = artifactPointsSpent experienceArtBarText.artifactForNextPoint = artifactForNextPoint experienceArtBarText.artifactPointsAvailable = artifactPointsAvailable experienceHonorBarText.honorXP = honorXP experienceHonorBarText.honorMax = honorMax experienceHonorBarText.honorLevel = honorLevel experienceHonorBarText.honorExhaustionStateID = honorExhaustionStateID + local min, max = math.min(0, playerExperience), playerMaxExperience + + --experienceBar:SetMinMaxValues( 0, tonumber( playerMaxExperience ) ) + --experienceBar:SetValue( tonumber( playerExperience ) ) + experienceBar:SetAnimatedValues(playerExperience, min, max , playerLevel) - - experienceBar:SetMinMaxValues( 0, tonumber( playerMaxExperience ) ) - experienceBar:SetValue( tonumber( playerExperience ) ) - - experienceArtBar:SetMinMaxValues( 0, tonumber( artifactForNextPoint ) ) - experienceArtBar:SetValue( tonumber( artifactXP ) ) - experienceHonorBar:SetMinMaxValues( 0, tonumber( honorMax ) ) - experienceHonorBar:SetValue( tonumber( honorXP ) ) + --experienceArtBar:SetMinMaxValues( 0, tonumber( artifactForNextPoint ) ) + --experienceArtBar:SetValue( tonumber( artifactXP ) ) + experienceArtBar:SetAnimatedValues(artifactXP, 0, artifactForNextPoint, artifactPointsAvailable + artifactPointsSpent) + + --experienceHonorBar:SetMinMaxValues( 0, tonumber( honorMax ) ) + --experienceHonorBar:SetValue( tonumber( honorXP ) ) + experienceHonorBar:SetAnimatedValues(honorXP, 0, honorMax, honorLevel) + --[[ if UnitInParty(Ambiguate( characterName, "none" ) ) == true then @@ -2716,6 +2864,7 @@ function AJM:UpdateExperienceStatus( characterName, playerExperience, playerMaxE experienceBar:SetAlpha( 1 ) end --]] + local text = "" if AJM.db.experienceStatusShowValues == true then text = text..tostring( AbbreviateLargeNumbers(playerExperience) )..L[" / "]..tostring( AbbreviateLargeNumbers(playerMaxExperience) )..L[" "] @@ -2847,9 +2996,12 @@ function AJM:UpdateReputationStatus( characterName, reputationName, reputationSt reputationBarText.reputationBarMin = reputationBarMin reputationBarText.reputationBarMax = reputationBarMax reputationBarText.reputationBarValue = reputationBarValue - reputationBar:SetMinMaxValues( tonumber( reputationBarMin ), tonumber( reputationBarMax ) ) - reputationBar:SetValue( tonumber( reputationBarValue ) ) - if reputationName == 0 then + + --reputationBar:SetMinMaxValues( tonumber( reputationBarMin ), tonumber( reputationBarMax ) ) + --reputationBar:SetValue( tonumber( reputationBarValue ) ) + reputationBar:SetAnimatedValues(reputationBarValue, reputationBarMin, reputationBarMax, 0 ) + + if reputationName == 0 then reputationBarMin = 0 reputationBarMax = 100 reputationBarValue = 100 @@ -2891,8 +3043,8 @@ end ------------------------------------------------------------------------------------------------------------- function AJM:UNIT_HEALTH( event, unit, ... ) - AJM:SendHealthStatusUpdateCommand( unit ) --AJM:Print("test2", unit) + AJM:SendHealthStatusUpdateCommand( unit ) end function AJM:UNIT_MAXHEALTH( event, unit, ... ) @@ -2900,29 +3052,59 @@ function AJM:UNIT_MAXHEALTH( event, unit, ... ) AJM:SendHealthStatusUpdateCommand( unit ) end +function AJM:UNIT_HEAL_PREDICTION( event, unit, ... ) + --AJM:Print("test2", unit) + AJM:SendHealthStatusUpdateCommand( unit ) +end + function AJM:SendHealthStatusUpdateCommand(unit) + --AJM:Print("debugHealthUpd", unit ) if unit == nil then return end if AJM.db.showTeamList == true and AJM.db.showHealthStatus == true then - local playerHealth = UnitHealth( unit ) - local playerMaxHealth = UnitHealthMax( unit ) - local characterName, characterRealm = UnitName( unit ) - local character = JambaUtilities:AddRealmToNameIfNotNil( characterName, characterRealm ) - --AJM:Print("HeathStats", character, playerHealth, playerMaxHealth) - AJM:UpdateHealthStatus( character, playerHealth, playerMaxHealth) + if AJM.db.healthManaOutOfParty == true then + if unit == "player" then + --AJM:Print("itsme", unit) + local playerHealth = UnitHealth( unit ) + local playerMaxHealth = UnitHealthMax( unit ) + local inComingHeal = UnitGetIncomingHeals( unit ) + local _, class = UnitClass ("player") + + if AJM.db.showTeamListOnMasterOnly == true then + --AJM:Print( "SendHealthStatusUpdateCommand TO Master!" ) + AJM:JambaSendCommandToMaster( AJM.COMMAND_HEALTH_STATUS_UPDATE, playerHealth, playerMaxHealth, inComingHeal, class ) + else + --AJM:Print( "SendHealthStatusUpdateCommand TO Team!" ) + AJM:JambaSendCommandToTeam( AJM.COMMAND_HEALTH_STATUS_UPDATE, playerHealth, playerMaxHealth, inComingHeal, class ) + end + end + else + local playerHealth = UnitHealth( unit ) + local playerMaxHealth = UnitHealthMax( unit ) + local inComingHeal = UnitGetIncomingHeals( unit ) + local characterName, characterRealm = UnitName( unit ) + local _, class = UnitClass ( unit ) + local character = JambaUtilities:AddRealmToNameIfNotNil( characterName, characterRealm ) + --AJM:Print("HeathStats", character, playerHealth, playerMaxHealth) + AJM:UpdateHealthStatus( character, playerHealth, playerMaxHealth, inComingHeal, class) + end end end +function AJM:ProcessUpdateHealthStatusMessage( characterName, playerHealth, playerMaxHealth, inComingHeal, class ) + AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth, inComingHeal, class) +end + function AJM:SettingsUpdateHealthAll() for characterName, characterStatusBar in pairs( AJM.characterStatusBar ) do - AJM:UpdateHealthStatus( characterName, nil, nil ) + AJM:UpdateHealthStatus( characterName, nil, nil, nil, nil ) end end -function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth ) - --AJM:Print("testUpdate", characterName, playerHealth, playerMaxHealth) +function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth, inComingHeal, class ) + --AJM:Print("testUpdate", characterName, playerHealth, playerMaxHealth, inComingHeal, class ) if characterName == nil then return end @@ -2938,7 +3120,8 @@ function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth ) return end local healthBarText = characterStatusBar["healthBarText"] - local healthBar = characterStatusBar["healthBar"] + local healthBar = characterStatusBar["healthBar"] + local healthIncomingBar = characterStatusBar["healthIncomingBar"] if playerMaxHealth == 0 then playerMaxHealth = healthBarText.playerMaxHealth @@ -2949,6 +3132,9 @@ function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth ) if playerMaxHealth == nil then playerMaxHealth = healthBarText.playerMaxHealth end + if inComingHeal == nil then + inComingHeal = healthBarText.inComingHeal + end --[[ if UnitInParty(Ambiguate( characterName, "none" ) ) == true then if range == false then @@ -2962,8 +3148,18 @@ function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth ) ]] healthBarText.playerHealth = playerHealth healthBarText.playerMaxHealth = playerMaxHealth + healthBarText.inComingHeal = inComingHeal + -- Set statusBar healthBar:SetMinMaxValues( 0, tonumber( playerMaxHealth ) ) healthBar:SetValue( tonumber( playerHealth ) ) + healthIncomingBar:SetMinMaxValues( 0, tonumber( playerMaxHealth ) ) + healthIncomingBar:SetValue( tonumber( playerHealth ) ) + + if inComingHeal > 0 then +-- AJM:Print("incomingHeal", inComingHeal) + healthIncomingBar:SetValue( tonumber( playerHealth + inComingHeal ) ) + healthIncomingBar:SetStatusBarColor( 0, 1, 0, 1 ) + end local text = "" if UnitIsDeadOrGhost(Ambiguate( characterName, "none" ) ) == true then --AJM:Print("dead", characterName) @@ -2981,11 +3177,21 @@ function AJM:UpdateHealthStatus( characterName, playerHealth, playerMaxHealth ) end end healthBarText:SetText( text ) - AJM:SetStatusBarColourForHealth( healthBar, floor((playerHealth/playerMaxHealth)*100), characterName) -end - -function AJM:SetStatusBarColourForHealth( statusBar, statusValue, characterName ) - local r, g, b = 0, 0, 0 + AJM:SetStatusBarColourForHealth( healthBar, floor((playerHealth/playerMaxHealth)*100), characterName, class) +end + +-- TODO Support for classColors +function AJM:SetStatusBarColourForHealth( statusBar, statusValue, characterName, class ) + --AJM:Print("colour class", statusValue, characterName) + local classColor = RAID_CLASS_COLORS[class] + if classColor ~= nil and AJM.db.showClassColors == true then + -- AJM:Print("test", characterName, class, classColor.r, classColor.g, classColor.b ) + local r = classColor.r + local g = classColor.g + local b = classColor.b + statusBar:SetStatusBarColor( r, g, b, 1 ) + else + local r, g, b = 0, 0, 0 statusValue = statusValue / 100 if( statusValue > 0.5 ) then r = (1.0 - statusValue) * 2 @@ -2994,8 +3200,9 @@ function AJM:SetStatusBarColourForHealth( statusBar, statusValue, characterName r = 1.0 g = statusValue * 2 end - b = 0.0 + b = b statusBar:SetStatusBarColor( r, g, b ) + end end ------------------------------------------------------------------------------------------------------------- @@ -3012,23 +3219,44 @@ end function AJM:SendPowerStatusUpdateCommand( unit ) if AJM.db.showTeamList == true and AJM.db.showPowerStatus == true then - local playerPower = UnitPower( unit ) - local playerMaxPower = UnitPowerMax( unit ) - local characterName, characterRealm = UnitName( unit ) - local character = JambaUtilities:AddRealmToNameIfNotNil( characterName, characterRealm ) - --AJM:Print("power", character, playerPower, playerMaxPower ) - AJM:UpdatePowerStatus( character, playerPower, playerMaxPower) + if AJM.db.healthManaOutOfParty == true then + if unit == "player" then + --AJM:Print("itsme", unit) + local playerPower = UnitPower( unit ) + local playerMaxPower = UnitPowerMax( unit ) + local _, powerToken = UnitPowerType( unit ) + if AJM.db.showTeamListOnMasterOnly == true then + --AJM:Print( "SendHealthStatusUpdateCommand TO Master!" ) + AJM:JambaSendCommandToMaster( AJM.COMMAND_POWER_STATUS_UPDATE, playerPower, powerToken ) + else + --AJM:Print( "SendHealthStatusUpdateCommand TO Team!", playerPower, playerMaxPower, powerToken ) + AJM:JambaSendCommandToTeam( AJM.COMMAND_POWER_STATUS_UPDATE, playerPower, playerMaxPower, powerToken ) + end + end + else + local playerPower = UnitPower( unit ) + local playerMaxPower = UnitPowerMax( unit ) + local characterName, characterRealm = UnitName( unit ) + local _, powerToken = UnitPowerType( unit ) + local character = JambaUtilities:AddRealmToNameIfNotNil( characterName, characterRealm ) + --AJM:Print("power", character, playerPower, playerMaxPower ) + AJM:UpdatePowerStatus( character, playerPower, playerMaxPower, powerToken) + end end end +function AJM:ProcessUpdatePowerStatusMessage( characterName, playerPower, playerMaxPower, powerToken ) + AJM:UpdatePowerStatus( characterName, playerPower, playerMaxPower, powerToken ) +end + function AJM:SettingsUpdatePowerAll() for characterName, characterStatusBar in pairs( AJM.characterStatusBar ) do - AJM:UpdatePowerStatus( characterName, nil, nil ) + AJM:UpdatePowerStatus( characterName, nil, nil, nil ) end end -function AJM:UpdatePowerStatus( characterName, playerPower, playerMaxPower) - --AJM:Print("testPOwer", characterName, playerPower, playerMaxPower ) +function AJM:UpdatePowerStatus( characterName, playerPower, playerMaxPower, powerToken) + --AJM:Print("testPOwer", characterName, playerPower, playerMaxPower, powerToken ) if characterName == nil then return end @@ -3084,19 +3312,26 @@ function AJM:UpdatePowerStatus( characterName, playerPower, playerMaxPower) end end powerBarText:SetText( text ) - AJM:SetStatusBarColourForPower( powerBar, originalChatacterName ) + AJM:SetStatusBarColourForPower( powerBar, powerToken )--originalChatacterName ) end -function AJM:SetStatusBarColourForPower( statusBar, unit ) - unit = Ambiguate( unit, "none" ) - local powerIndex, powerString, altR, altG, altB = UnitPowerType( unit ) +function AJM:SetStatusBarColourForPower( statusBar, powerToken ) + local info = PowerBarColor[powerToken] + if info ~= nil then + -- AJM:Print("powertest", powerToken, info.r, info.g, info.b ) + statusBar:SetStatusBarColor( info.r, info.g, info.b, 1 ) + statusBar.backgroundTexture:SetColorTexture( info.r, info.g, info.b, 0.25 ) + + end + --unit = Ambiguate( unit, "none" ) +--[[ local powerIndex, powerString, altR, altG, altB = UnitPowerType( powerToken ) if powerString ~= nil and powerString ~= "" then local r = PowerBarColor[powerString].r local g = PowerBarColor[powerString].g local b = PowerBarColor[powerString].b statusBar:SetStatusBarColor( r, g, b, 1 ) statusBar.backgroundTexture:SetColorTexture( r, g, b, 0.25 ) - end + end ]] end ------------------------------------------------------------------------------------------------------------- @@ -3312,6 +3547,7 @@ function AJM:OnEnable() AJM:RegisterEvent( "PLAYER_LEVEL_UP" ) AJM:RegisterEvent( "UNIT_HEALTH" ) AJM:RegisterEvent( "UNIT_MAXHEALTH" ) + AJM:RegisterEvent( "UNIT_HEAL_PREDICTION" ) AJM:RegisterEvent( "UNIT_POWER", "UNIT_POWER" ) AJM:RegisterEvent( "UNIT_MAXPOWER", "UNIT_POWER" ) AJM:RegisterEvent( "PLAYER_ENTERING_WORLD" ) @@ -3324,6 +3560,7 @@ function AJM:OnEnable() AJM:RegisterEvent( "HONOR_LEVEL_UPDATE" ) AJM:RegisterEvent( "HONOR_PRESTIGE_UPDATE" ) AJM:RegisterEvent( "GROUP_ROSTER_UPDATE" ) + AJM:RegisterEvent( "ARTIFACT_XP_UPDATE" ) AJM.SharedMedia.RegisterCallback( AJM, "LibSharedMedia_Registered" ) AJM.SharedMedia.RegisterCallback( AJM, "LibSharedMedia_SetGlobal" ) AJM:RegisterMessage( JambaApi.MESSAGE_TEAM_CHARACTER_ADDED, "OnCharactersChanged" ) @@ -3393,13 +3630,21 @@ function AJM:PLAYER_REGEN_ENABLED( event, ... ) if AJM.updateSettingsAfterCombat == true then AJM:SettingsRefresh() AJM.updateSettingsAfterCombat = false - end + end + -- Ebony added follow bar combat Icon + if AJM.db.showTeamList == true and AJM.db.showFollowStatus == true then + AJM:ScheduleTimer( "SendCombatStatusUpdateCommand", 1 ) + end end function AJM:PLAYER_REGEN_DISABLED( event, ... ) if AJM.db.hideTeamListInCombat == true then JambaDisplayTeamListFrame:Hide() end + -- Ebony added follow bar combat Icon + if AJM.db.showTeamList == true and AJM.db.showFollowStatus == true then + AJM:ScheduleTimer( "SendCombatStatusUpdateCommand", 1 ) + end end function AJM:PLAYER_TALENT_UPDATE(event, ...) diff --git a/Jamba-DisplayTeam/Locales/JambaDisplayTeam-Locale-enUS.lua b/Jamba-DisplayTeam/Locales/JambaDisplayTeam-Locale-enUS.lua index 167ba85..7ac5d76 100644 --- a/Jamba-DisplayTeam/Locales/JambaDisplayTeam-Locale-enUS.lua +++ b/Jamba-DisplayTeam/Locales/JambaDisplayTeam-Locale-enUS.lua @@ -81,8 +81,11 @@ L["Currency Info:"] = true L["Unknown Sender"] = true L["Show ToolTip"] = true L["Characters Per Bar"] = true -L["Olny Show in Party"] = true -L["Olny Show Display-Team\nIn Party or Raid"] = true +L["Only Show in Party"] = true +L["Only Show Display-Team\nIn Party or Raid"] = true +L["Health & Power Out of Group"] = true +L["Show Class Colors"] = true + --Help System @@ -95,7 +98,7 @@ L["Enable Clique Support"] = true L["Enable Clique Support\n\n**reload UI to take effect**"] = true L["Show Title"] = true L["Show the Character Portrait"] = true -L["Olny shows Equipped item Level"] = true +L["Only shows Equipped item Level"] = true L["Show the Team Experience(xp) bar"] = true L["Show the Team Reputation Bar"] = true L["Show the Teams Health Bars"] = true @@ -106,7 +109,6 @@ L["Show Percentage"] = true L["Faction Name"] = true L["Show Jamba Team or Unit Frame List"] = true L["Show Character Name"] = true - L["ShowHonorXP"] = true L["Show ToolTip Information"] = true L["Show the Follow Bar and Character Name\n\nHover Over for Character Infomation"] = true @@ -119,4 +121,6 @@ L["Show the Team Artifact XP bar"] = true L["Show the Team Honor XP Bar"] = true L["ShowReputation"] = true L["Show the Team Reputation Bar"] = true +L["Update Health and Power out of Groups\nUse Guild Communications!"] = true +L["Show class Coulor on Health Bar"] = true diff --git a/Jamba-FTL/Jamba-FTL.toc b/Jamba-FTL/Jamba-FTL.toc index af34be5..17231cb 100644 --- a/Jamba-FTL/Jamba-FTL.toc +++ b/Jamba-FTL/Jamba-FTL.toc @@ -1,12 +1,12 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaFTL ## Notes: JambaFTL ## Author: olipcs (although most of the code is originaly from Jafula) (any changes added to support 4.0.5 from ebony!) -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba ## SavedVariables: JambaFTLProfileDB ## LoadOnDemand: 1 Locales\Locales.xml -JambaFTL.lua +JambaFTL.lua \ No newline at end of file diff --git a/Jamba-FTL/JambaFTL.lua b/Jamba-FTL/JambaFTL.lua index beee8ff..dd101d9 100644 --- a/Jamba-FTL/JambaFTL.lua +++ b/Jamba-FTL/JambaFTL.lua @@ -701,4 +701,4 @@ end -- Called when the addon is disabled. function AJM:OnDisable() end - + \ No newline at end of file diff --git a/Jamba-FTL/Locales/Locales.xml b/Jamba-FTL/Locales/Locales.xml index e6c26a5..a0d3c9f 100644 --- a/Jamba-FTL/Locales/Locales.xml +++ b/Jamba-FTL/Locales/Locales.xml @@ -9,4 +9,4 @@ Credits: Many thanks goes to Jafula for the awsome JAMBA addon --> <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaFTL-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Follow/Jamba-Follow.toc b/Jamba-Follow/Jamba-Follow.toc index 8b3d01a..1ee30eb 100644 --- a/Jamba-Follow/Jamba-Follow.toc +++ b/Jamba-Follow/Jamba-Follow.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaFollow ## Notes: JambaFollow ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Follow/JambaFollow.lua b/Jamba-Follow/JambaFollow.lua index aeeecf5..9df113b 100644 --- a/Jamba-Follow/JambaFollow.lua +++ b/Jamba-Follow/JambaFollow.lua @@ -683,8 +683,6 @@ function AJM:AreTeamMembersInCombat() -- Is the team member online? if JambaApi.GetCharacterOnlineStatus( characterName ) == true then -- Yes, is the character in combat? - --if UnitAffectingCombat( characterName ) then - -- Ebony This API does not like A realmName so better remove it its from the server we playing on. if UnitAffectingCombat( Ambiguate( characterName, "none" ) ) then inCombat = true break @@ -702,6 +700,7 @@ function AJM:IsFollowingStrobingPaused() return AJM.followingStrobingPaused end + function AJM:CharacterOnTaxi() AJM:SetNoFollowBrokenWarningNextBreak() if AJM:IsFollowingStrobing() == true then @@ -712,6 +711,7 @@ function AJM:CharacterOnTaxi() end end + function AJM:PLAYER_CONTROL_GAINED() if AJM.characterIsOnTaxi == true then AJM.characterIsOnTaxi = false @@ -723,21 +723,13 @@ function AJM:PLAYER_CONTROL_GAINED() end end + function AJM:SuppressNextFollowWarningCommand( info, parameters ) AJM:SuppressNextFollowWarning() end function AJM:SuppressNextFollowWarning() -- Events are fired as follows for a /follow command. - -- When the character is not already following. - -- AUTOFOLLOW_BEGIN - -- AUTOFOLLOW_END (Need to suppress this) - -- AUTOFOLLOW_BEGIN - -- When a character is following. - -- AUTOFOLLOW_END (Need to suppress this) - -- AUTOFOLLOW_BEGIN - -- AUTOFOLLOW_END (And also we need to suppress this one as well) - -- AUTOFOLLOW_BEGIN if AJM.isFollowing == true then AJM:SetNoFollowBrokenWarningNextBreak() AJM:SetNoFollowBrokenWarningNextSecondBreak() @@ -754,17 +746,18 @@ function AJM:SetNoFollowBrokenWarningNextSecondBreak() AJM.jambaExternalNoWarnNextSecondBreak = true end + function AJM:AUTOFOLLOW_BEGIN( event, target, ... ) - AJM.currentFollowTarget = target - AJM.isFollowing = true + AJM.currentFollowTarget = target + AJM.isFollowing = true end function AJM:AUTOFOLLOW_END( event, ... ) AJM.isFollowing = false - AJM:ScheduleTimer( "AutoFollowEndUpdate", 1 ) - --AJM:AutoFollowEndSend() + AJM:ScheduleTimer( "AutoFollowEndUpdate", 0.5 ) end +-- checks the follow system Msg, is there under 1 always 1 unless it fadeing. function AJM:AutoFollowEndUpdate() local alpha = AutoFollowStatus:GetAlpha() --AJM:Print("updatetest", test) @@ -774,58 +767,45 @@ function AJM:AutoFollowEndUpdate() end end - function AJM:AutoFollowEndSend() - -- Argument 1 has the reason follow ended, this does not come back from the event parameters. - -- arg1 is gone in 4.01 which makes this functionality kinda useless. Shame. -- If warn if auto follow breaks is on... local canWarn = false - local canWarnMsg = nil if AJM.db.warnWhenFollowBreaks == true then if AJM.jambaSetFollowTarget == false then canWarn = true end end - -- Do not warn if not Taxi - if UnitOnTaxi(AJM.currentFollowTarget) == true or UnitOnTaxi("player") == true then + -- Do not warn if on Taxi + if UnitOnTaxi("player") == true then + --AJM:Print("taxi") canWarn = false end --Do not warn if in combat? if AJM.db.doNotWarnFollowBreakInCombat == true and AJM.outOfCombat == false then + --AJM:Print("Do Not warn in comabt") canWarn = false end --Do not warn if a passenger in a vehicle. if UnitInVehicle("Player") == true and UnitControllingVehicle("player") == false then + --AJM:Print("UnitInVehicle") canWarn = false end -- Do not warn if any other members in combat? - if AJM.db.doNotWarnFollowBreakMembersInCombat == true and AJM:AreTeamMembersInCombat() == true then + if AJM.db.doNotWarnFollowBreakMembersInCombat == true and AJM:AreTeamMembersInCombat() == true or UnitAffectingCombat("player") == true then + --AJM:Print("doNotWarnFollowBreakMembersInCombat") canWarn = false end -- Don't warn about follow breaking if follow strobing is on or paused. if AJM.db.doNotWarnFollowStrobing == true then if AJM.followingStrobing == true or AJM.followStrobingPaused == true then + --AJM:Print("FollowStrobing") canWarn = false end end - -- Ebony says this system does not work right. so is not checking to see if blizzard code says follow is borken, (or kinda anyway) - -- If the first do not warn flag is set, check the second do not warn flag. ---[[ if AJM.jambaExternalNoWarnNextBreak == false then - if AJM.jambaExternalNoWarnNextSecondBreak == true then - canWarn = false - AJM.jambaExternalNoWarnNextSecondBreak = false - end - end - -- ebony says i DON'T even know what the hell this is doing??? so it can go - -- Is another Jamba module supressing this warning? - if AJM.jambaExternalNoWarnNextBreak == true then - canWarn = false - canWarnMsg = "jambaExternalNoWarnNextBreak" - AJM.jambaExternalNoWarnNextBreak = false - end ]] -- Check to see if range warning is in effect. This olny works in a party it seems!! if AJM.db.onlyWarnIfOutOfFollowRange == true then if CheckInteractDistance( AJM.currentFollowTarget, 4 ) then + --AJM:Print("CheckInteractDistance") canWarn = false end end @@ -1093,7 +1073,7 @@ end function AJM:FollowTarget( target ) -- Attempting to follow self? Note: if target ever is party1, etc, then this will not catch the same character. - if JambaUtilities:Lowercase( target ) == JambaUtilities:Lowercase( AJM.characterName ) then + if target == AJM.characterName then return end local canFollowTarget = true @@ -1120,7 +1100,8 @@ function AJM:FollowTarget( target ) -- If allowed to follow the target, then... if canFollowTarget == true then -- Set the jamba set this flag toggle, so not to complain about follow broken after combat. - if (AJM.db.autoFollowAfterCombat == true) or (AJM.followingStrobing == true) then + --if (AJM.db.autoFollowAfterCombat == true) or (AJM.followingStrobing == true) then + if AJM.followingStrobing == true then AJM.jambaSetFollowTarget = true end --AJM:Print( target ) diff --git a/Jamba-Follow/Locales/Locales.xml b/Jamba-Follow/Locales/Locales.xml index 5624384..2fa029f 100644 --- a/Jamba-Follow/Locales/Locales.xml +++ b/Jamba-Follow/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaFollow-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-ItemUse/Jamba-ItemUse.toc b/Jamba-ItemUse/Jamba-ItemUse.toc index 69ad7c1..d64ddae 100644 --- a/Jamba-ItemUse/Jamba-ItemUse.toc +++ b/Jamba-ItemUse/Jamba-ItemUse.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaItemUse ## Notes: JambaItemUse ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-ItemUse/JambaItemUse.lua b/Jamba-ItemUse/JambaItemUse.lua index 2064f70..d38ddd6 100644 --- a/Jamba-ItemUse/JambaItemUse.lua +++ b/Jamba-ItemUse/JambaItemUse.lua @@ -143,6 +143,9 @@ end -- Command this module sends. ------------------------------------------------------------------------------------------------------------- +AJM.COMMAND_ITEMBAR_BUTTON = "JambaCommandItemBarButton" +AJM.COMMAND_ITEMUSE_SYNC = "JambaCommandItemBarSync" + ------------------------------------------------------------------------------------------------------------- -- Messages module sends. ------------------------------------------------------------------------------------------------------------- @@ -215,12 +218,22 @@ local function CreateJambaItemUseFrame() updateButton:SetScript( "OnClick", function() AJM:ClearButton() end ) updateButton:SetPoint( "TOPRIGHT", frame, "TOPRIGHT", -4, -3 ) updateButton:SetHeight( 20 ) - updateButton:SetWidth( 70 ) + updateButton:SetWidth( 65 ) updateButton:SetText( L["Clear"] ) - updateButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(updateButton, true) end) + updateButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(updateButton, "clear", true) end) updateButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - ArtifactUpdateButton = updateButton - frame:ClearAllPoints() + ClearUpdateButton = updateButton + -- Sync Button + local syncButton = CreateFrame( "Button", "ButtonSync", frame, "UIPanelButtonTemplate" ) + syncButton:SetScript( "OnClick", function() AJM:SyncButton() end ) + syncButton:SetPoint( "TOPRIGHT", frame, "TOPRIGHT", -71, -3 ) + syncButton:SetHeight( 20 ) + syncButton:SetWidth( 65 ) + syncButton:SetText( L["Sync"] ) + syncButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(updateButton, "sync", true) end) + syncButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) + SyncUpdateButton = syncButton + frame:ClearAllPoints() frame:SetPoint( AJM.db.framePoint, UIParent, AJM.db.frameRelativePoint, AJM.db.frameXOffset, AJM.db.frameYOffset ) frame:SetBackdrop( { bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", @@ -238,12 +251,16 @@ local function CreateJambaItemUseFrame() AJM.UpdateHeight() end -function AJM:ShowTooltip(frame, show) +function AJM:ShowTooltip(frame, info, show) if show then GameTooltip:SetOwner(frame, "ANCHOR_TOP") GameTooltip:SetPoint("TOPLEFT", frame, "TOPRIGHT", 16, 0) GameTooltip:ClearLines() - GameTooltip:AddLine(L["Clears items no longer in your bags "], 1, 0.82, 0, 1) + if info == "clear" then + GameTooltip:AddLine(L["Clears items no longer in your bags"], 1, 0.82, 0, 1) + elseif info == "sync" then + GameTooltip:AddLine(L["Synchronise Item-Use Buttons"], 1, 0.82, 0, 1) + end GameTooltip:Show() else GameTooltip:Hide() @@ -255,12 +272,14 @@ function AJM:UpdateHeight() if AJM.db.hideClearButton == false then AJM.db.itemUseTitleHeight = 2 local newHeight = AJM.db.itemUseTitleHeight + 20 - ArtifactUpdateButton:Show() + ClearUpdateButton:Show() + SyncUpdateButton:Show() return newHeight else AJM.db.itemUseTitleHeight = 2 oldHeight = AJM.db.itemUseTitleHeight - ArtifactUpdateButton:Hide() + ClearUpdateButton:Hide() + SyncUpdateButton:Hide() return oldHeight end end @@ -330,7 +349,8 @@ function AJM:UpdateQuestItemsInBar() if AJM:IsInInventory( itemLink ) == false then --AJM:Print("NOT IN BAGS", itemLink) AJM.db.itemsAdvanced[iterateItems] = nil - AJM:JambaSendSettings() + AJM:JambaSendUpdate( iterateItems, "empty", nil ) + --AJM:JambaSendSettings() end end end @@ -388,8 +408,9 @@ function AJM:OnButtonContentsChanged( event, button, state, type, value, ... ) return end AJM:AddItemToItemDatabase( button.itemNumber, type, value ) - AJM:JambaSendSettings() - AJM:SettingsRefresh() + AJM:JambaSendUpdate(button.itemNumber, type, value ) + --AJM:JambaSendSettings() + AJM:SettingsRefresh() end function AJM:OnButtonUpdate( event, button, ... ) @@ -468,11 +489,18 @@ end function AJM:CheckForSatchelsItemAndAddToBar() for bag = 0, NUM_BAG_SLOTS do for slot = 1, GetContainerNumSlots(bag) do - local texture, count, locked, quality, readable, lootable, link, isFiltered, hasNoValue, itemID = GetContainerItemInfo(bag, slot) - --AJM:Print("test", link, lootable) if link and lootable then - --AJM:Print("satchelsFound", link) - AJM:AddAnItemToTheBarIfNotExists( link, false ) + --AJM:Print("test", link) + tooltipScanner:SetOwner(UIParent, "ANCHOR_NONE") + tooltipScanner:SetHyperlink(link) + --AJM:Print("scanTooltip", link) -- Debug + local tooltipText = _G[tooltipName.."TextLeft2"]:GetText() + --AJM:Print("tooltiptest", link, tooltipText) -- Debug + if tooltipText ~= "Locked" then + --AJM:Print("Not Locked", link) + --AJM:Print("satchelsFound", link) + AJM:AddAnItemToTheBarIfNotExists( link, false ) + end end end end @@ -482,7 +510,7 @@ end function AJM:ClearButton() local state = "0" - for iterateItems = 1, AJM.maximumNumberOfItems, 1 do + for iterateItems = 1, AJM.db.numberOfItems, 1 do local itemContainer = AJM.itemContainer[iterateItems] if itemContainer == nil then AJM:CreateJambaItemUseItemContainer( iterateItems, parentFrame ) @@ -505,8 +533,8 @@ function AJM:ClearButton() if AJM:IsInInventory( name ) == false then --AJM:Print("NOT IN BAGS", itemLink) AJM.db.itemsAdvanced[iterateItems] = nil + AJM:JambaSendUpdate( iterateItems, "empty", nil ) AJM:SettingsRefresh() - AJM:JambaSendSettings() end end end @@ -514,6 +542,29 @@ function AJM:ClearButton() end end +-- Sync Buttion +function AJM:SyncButton() + local dataTable = {} + for iterateItems = 1, AJM.db.numberOfItems, 1 do + local itemContainer = AJM.itemContainer[iterateItems] + if itemContainer == nil then + AJM:CreateJambaItemUseItemContainer( iterateItems, parentFrame ) + itemContainer = AJM.itemContainer[iterateItems] + end + local containerButton = itemContainer["container"] + local itemInfo = AJM:GetItemFromItemDatabase( iterateItems ) + local kind = itemInfo.kind + local action = itemInfo.action + data = {} + data.button = iterateItems + data.type = kind + data.action = action + table.insert( dataTable, data ) + end + AJM:JambaSendCommandToTeam( AJM.COMMAND_ITEMUSE_SYNC, dataTable) +end + + -- Adds artifact power items to item bar. function AJM:CheckForArtifactItemAndAddToBar() for bag = 0, NUM_BAG_SLOTS do @@ -533,43 +584,8 @@ function AJM:CheckForArtifactItemAndAddToBar() end end end - ---Removes artifact power after used. ---[[ -function AJM:UpdateArtifactItemsInBar() - local state = "0" - for iterateItems = 1, AJM.maximumNumberOfItems, 1 do - local itemContainer = AJM.itemContainer[iterateItems] - if itemContainer == nil then - AJM:CreateJambaItemUseItemContainer( iterateItems, parentFrame ) - itemContainer = AJM.itemContainer[iterateItems] - end - local containerButton = itemContainer["container"] - local itemInfo = AJM:GetItemFromItemDatabase( iterateItems ) - local kind = itemInfo.kind - local action = itemInfo.action - if kind == "item" then - local name, itemLink,_,_,_,_,questItem = GetItemInfo( action ) - if itemLink and itemLink:match("item:%d") then - tooltipScanner:SetOwner(UIParent, "ANCHOR_NONE") - tooltipScanner:SetHyperlink(itemLink) - --AJM:Print("scanTooltip", name, itemLink) - local tooltipText = _G[tooltipName.."TextLeft2"]:GetText() - if tooltipText and tooltipText:match(ARTIFACT_POWER) then - if AJM:IsInInventory( name ) == false then - --AJM:Print("NOT IN BAGS", itemLink) - AJM.db.itemsAdvanced[iterateItems] = nil - AJM:SettingsRefresh() - AJM:JambaSendSettings() - end - end - end - end - end -end ---]] ---Checks the item is in the player players bag +--Checks the item is in the Toon players bag function AJM:IsInInventory(itemLink) for bag = 0,4,1 do for slot = 1,GetContainerNumSlots(bag),1 do @@ -612,7 +628,7 @@ function AJM:AddAnItemToTheBarIfNotExists( itemLink, startsQuest) --Checks the items we talking about is in the bags of the player. if itemInfo.kind == "empty" then AJM:AddItemToItemDatabase( iterateItems, "item", itemId ) - AJM:JambaSendSettings() + AJM:JambaSendUpdate( iterateItems, "item", itemId ) AJM:SettingsRefresh() if startsQuest then AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["New item that starts a quest found!"], false ) @@ -671,6 +687,31 @@ function AJM:UpdateJambaItemUseDimensions() end ------------------------------------------------------------------------------------------------------------- +-- Communications +------------------------------------------------------------------------------------------------------------- + +function AJM:JambaSendUpdate( button, type, action ) + --AJM:Print("testDataDebug", button, type, action ) + AJM:JambaSendCommandToTeam( AJM.COMMAND_ITEMBAR_BUTTON, button, type, action ) +end + +function AJM:ReceiveButtonData(characterName, button, type, action) + --AJM:Print("ReceiveButtonDataDebug", button, type, action ) + AJM:AddItemToItemDatabase( button, type, action ) + AJM:SettingsRefresh() +end + +function AJM:ReceiveSync(characterName, data) + --AJM:Print("ReceiveSync", data) + for id, data in pairs( data ) do + --AJM:Print("ID", id, data.button, data.type, data.action ) + AJM:AddItemToItemDatabase( data.button, data.type, data.action ) + AJM:SettingsRefresh() + end +end + + +------------------------------------------------------------------------------------------------------------- -- Settings Dialogs. ------------------------------------------------------------------------------------------------------------- @@ -755,7 +796,7 @@ local function SettingsCreateOptions( top ) headingWidth, left, movingTop, - L["Hides the clear Button"], + L["Hide Buttons"], AJM.SettingsToggleHideClearButton ) movingTop = movingTop - checkBoxHeight - verticalSpacing @@ -1228,4 +1269,12 @@ end -- A Jamba command has been recieved. function AJM:JambaOnCommandReceived( characterName, commandName, ... ) -end + if characterName ~= self.characterName then + if commandName == AJM.COMMAND_ITEMBAR_BUTTON then + AJM:ReceiveButtonData( characterName, ... ) + end + if commandName == AJM.COMMAND_ITEMUSE_SYNC then + AJM:ReceiveSync( characterName, ... ) + end + end +end diff --git a/Jamba-ItemUse/Locales/JambaItemUse-Locale-enUS.lua b/Jamba-ItemUse/Locales/JambaItemUse-Locale-enUS.lua index 51677ad..0db9021 100644 --- a/Jamba-ItemUse/Locales/JambaItemUse-Locale-enUS.lua +++ b/Jamba-ItemUse/Locales/JambaItemUse-Locale-enUS.lua @@ -65,10 +65,13 @@ L["Number Of Rows"] = true L["New item that starts a quest found!"] = true L["Clear Item Bar"] = true L["Clear the item bar (remove all items)."] = true -L["Hides the clear Button"] = true +L["Hide Buttons"] = true L["Item Bar Cleared"] = true L["Automatically Add Artifact Power Items To Bar"] = true L["Automatically Add Satchel Items To Bar"] = true L["New Artifact Power Item found!"] = true + L["Clear"] = true -L["Clears items no longer in your bags "] = true +L["Clears items no longer in your bags"] = true +L["Sync"] = true +L["Synchronise Item-Use Buttons"] = true \ No newline at end of file diff --git a/Jamba-ItemUse/Locales/Locales.xml b/Jamba-ItemUse/Locales/Locales.xml index e9fe15b..6fca106 100644 --- a/Jamba-ItemUse/Locales/Locales.xml +++ b/Jamba-ItemUse/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaItemUse-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Mount/Jamba-Mount.toc b/Jamba-Mount/Jamba-Mount.toc index 67a08fa..70e6ae2 100644 --- a/Jamba-Mount/Jamba-Mount.toc +++ b/Jamba-Mount/Jamba-Mount.toc @@ -1,12 +1,12 @@ -## Interface: 70100 +## Interface: 70300 ## Title: Jamba-Mount ## Notes: Jamba-Mount ## Author: Ebony -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba ## SavedVariables: JambaMountProfileDB ## LoadOnDemand: 1 Locales\Locales.xml -JambaMount.lua +JambaMount.lua \ No newline at end of file diff --git a/Jamba-Mount/JambaMount.old.lua b/Jamba-Mount/JambaMount.old.lua new file mode 100644 index 0000000..b42c397 --- /dev/null +++ b/Jamba-Mount/JambaMount.old.lua @@ -0,0 +1,450 @@ +--[[ +Jamba - Jafula's Awesome Multi-Boxer Assistant +Copyright 2008 - 2017 Michael "Jafula" Miller +License: The MIT License + +This is was made by Ebony with the idea from Hydra +]]-- + +-- Create the addon using AceAddon-3.0 and embed some libraries. +local AJM = LibStub( "AceAddon-3.0" ):NewAddon( + "JambaMount", + "JambaModule-1.0", + "AceConsole-3.0", + "AceEvent-3.0", + "AceHook-3.0", + "AceTimer-3.0" +) + +-- Get the Jamba Utilities Library. +local JambaUtilities = LibStub:GetLibrary( "JambaUtilities-1.0" ) +local JambaHelperSettings = LibStub:GetLibrary( "JambaHelperSettings-1.0" ) + +-- Constants and Locale for this module. +AJM.moduleName = "Jamba-Mount" +AJM.settingsDatabaseName = "JambaMountProfileDB" +AJM.chatCommand = "jamba-mount" +local L = LibStub( "AceLocale-3.0" ):GetLocale( AJM.moduleName ) +AJM.parentDisplayName = L["Toon"] +AJM.moduleDisplayName = L["Mount"] + +-- Settings - the values to store and their defaults for the settings database. +AJM.settings = { + profile = { + mountWithTeam = true, + dismountWithTeam = true, + dismountWithMaster = true, + mountInRange = false, + --mountName = nil, + --messageArea = JambaApi.DefaultMessageArea(), + warningArea = JambaApi.DefaultWarningArea() + }, +} + +-- Configuration. +function AJM:GetConfiguration() + local configuration = { + name = AJM.moduleDisplayName, + handler = AJM, + type = 'group', + childGroups = "tab", + get = "JambaConfigurationGetSetting", + set = "JambaConfigurationSetSetting", + args = { + push = { + type = "input", + name = L["Push Settings"], + desc = L["Push the Mount settings to all characters in the team."], + usage = "/jamba-mount push", + get = false, + set = "JambaSendSettings", + order = 4, + guiHidden = true, + }, + }, + } + return configuration +end + +------------------------------------------------------------------------------------------------------------- +-- Command this module sends. +------------------------------------------------------------------------------------------------------------- + +AJM.COMMAND_MOUNT_ME = "JambaMountMe" +AJM.COMMAND_MOUNT_DISMOUNT = "JambaMountDisMount" + +------------------------------------------------------------------------------------------------------------- +-- Messages module sends. +------------------------------------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------------------------------------- +-- Addon initialization, enabling and disabling. +------------------------------------------------------------------------------------------------------------- + +-- Initialise the module. +function AJM:OnInitialize() + -- Create the settings control. + AJM:SettingsCreate() + -- Initialse the JambaModule part of this module. + AJM:JambaModuleInitialize( AJM.settingsControl.widgetSettings.frame ) + -- Populate the settings. + AJM:SettingsRefresh() + AJM.MountFromTeamMember = false + AJM.castingMount = nil +end + +-- Called when the addon is enabled. +function AJM:OnEnable() +-- AJM:RegisterEvent("PLAYER_REGEN_ENABLED") +-- AJM:RegisterEvent("PLAYER_REGEN_DISABLED") + AJM:RegisterEvent("UNIT_SPELLCAST_START") + AJM:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") + AJM:RegisterEvent("UNIT_AURA") + AJM:RegisterMessage( JambaApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) + +end + +-- Called when the addon is disabled. +function AJM:OnDisable() + -- AceHook-3.0 will tidy up the hooks for us. +end + +function AJM:SettingsCreate() + AJM.settingsControl = {} + -- Create the settings panel. + JambaHelperSettings:CreateSettings( + AJM.settingsControl, + AJM.moduleDisplayName, + AJM.parentDisplayName, + AJM.SettingsPushSettingsClick + ) + local bottomOfInfo = AJM:SettingsCreateMount( JambaHelperSettings:TopOfSettings() ) + AJM.settingsControl.widgetSettings.content:SetHeight( -bottomOfInfo ) + -- Help + local helpTable = {} + JambaHelperSettings:CreateHelp( AJM.settingsControl, helpTable, AJM:GetConfiguration() ) +end + +function AJM:SettingsPushSettingsClick( event ) + AJM:JambaSendSettings() +end + +function AJM:SettingsCreateMount( top ) + local checkBoxHeight = JambaHelperSettings:GetCheckBoxHeight() + local left = JambaHelperSettings:LeftOfSettings() + local headingHeight = JambaHelperSettings:HeadingHeight() + local headingWidth = JambaHelperSettings:HeadingWidth( false ) + local dropdownHeight = JambaHelperSettings:GetDropdownHeight() + local verticalSpacing = JambaHelperSettings:GetVerticalSpacing() + local movingTop = top + JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Mount Options"], movingTop, false ) + movingTop = movingTop - headingHeight + AJM.settingsControl.checkBoxMountWithTeam = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Mount with Team"], + AJM.SettingsToggleMountWithTeam + ) + movingTop = movingTop - headingHeight + AJM.settingsControl.checkBoxDismountWithTeam = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Dismount with Team"], + AJM.SettingsToggleDisMountWithTeam, + L["Dismount with Character That Dismount"] + ) + movingTop = movingTop - headingHeight + AJM.settingsControl.checkBoxDismountWithMaster = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Only Dismount's from Master"], + AJM.SettingsToggleDisMountWithMaster, + L["Only Dismount's from Master character."] + ) + movingTop = movingTop - headingHeight + AJM.settingsControl.checkBoxMountInRange = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Only Mount when in Range"], + AJM.SettingsToggleMountInRange, + L["Only Works In a party!"] + ) +-- movingTop = movingTop - checkBoxHeight +-- AJM.settingsControl.dropdownMessageArea = JambaHelperSettings:CreateDropdown( +-- AJM.settingsControl, +-- headingWidth, +-- left, +-- movingTop, +-- L["Message Area"] +-- ) +-- AJM.settingsControl.dropdownMessageArea:SetList( JambaApi.MessageAreaList() ) +-- AJM.settingsControl.dropdownMessageArea:SetCallback( "OnValueChanged", AJM.SettingsSetMessageArea ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControl.dropdownWarningArea = JambaHelperSettings:CreateDropdown( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Send Warning Area"] + ) + AJM.settingsControl.dropdownWarningArea:SetList( JambaApi.MessageAreaList() ) + AJM.settingsControl.dropdownWarningArea:SetCallback( "OnValueChanged", AJM.SettingsSetWarningArea ) + + + + movingTop = movingTop - dropdownHeight - verticalSpacing + return movingTop +end + +function AJM:OnMessageAreasChanged( message ) + --AJM.settingsControl.dropdownMessageArea:SetList( JambaApi.MessageAreaList() ) + AJM.settingsControl.dropdownWarningArea:SetList( JambaApi.MessageAreaList() ) +end + +function AJM:SettingsSetWarningArea( event, value ) + AJM.db.warningArea = value + AJM:SettingsRefresh() +end + +--function AJM:SettingsSetMessageArea( event, value ) +-- AJM.db.messageArea = value +-- AJM:SettingsRefresh() +--end + +function AJM:SettingsToggleMountWithTeam( event, checked ) + AJM.db.mountWithTeam = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleDisMountWithTeam( event, checked ) + AJM.db.dismountWithTeam = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleDisMountWithMaster( event, checked ) + AJM.db.dismountWithMaster = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleMountInRange( event, checked ) + AJM.db.mountInRange = checked + AJM:SettingsRefresh() +end + +-- Settings received. +function AJM:JambaOnSettingsReceived( characterName, settings ) + if characterName ~= AJM.characterName then + -- Update the settings. + AJM.db.mountWithTeam = settings.mountWithTeam + AJM.db.dismountWithTeam = settings.dismountWithTeam + AJM.db.dismountWithMaster = settings.dismountWithMaster + AJM.db.mountInRange = settings.mountInRange + AJM.db.messageArea = settings.messageArea + AJM.db.warningArea = settings.warningArea + -- Refresh the settings. + AJM:SettingsRefresh() + -- Tell the player. + AJM:Print( L["Settings received from A."]( characterName ) ) + -- Tell the team? + --AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Settings received from A."]( characterName ), false ) + end +end + +function AJM:BeforeJambaProfileChanged() +end + +function AJM:OnJambaProfileChanged() + AJM:SettingsRefresh() +end + +function AJM:SettingsRefresh() + AJM.settingsControl.checkBoxMountWithTeam:SetValue( AJM.db.mountWithTeam ) + AJM.settingsControl.checkBoxDismountWithTeam:SetValue( AJM.db.dismountWithTeam ) + AJM.settingsControl.checkBoxDismountWithMaster:SetValue( AJM.db.dismountWithMaster ) + AJM.settingsControl.checkBoxMountInRange:SetValue( AJM.db.mountInRange ) + --AJM.settingsControl.dropdownMessageArea:SetValue( AJM.db.messageArea ) + AJM.settingsControl.dropdownWarningArea:SetValue( AJM.db.warningArea ) + -- Set state. + --AJM.settingsControl.checkBoxMountWithTeam:SetDisabled( not AJM.db.mountWithTeam ) + AJM.settingsControl.checkBoxDismountWithTeam:SetDisabled( not AJM.db.mountWithTeam ) + AJM.settingsControl.checkBoxDismountWithMaster:SetDisabled( not AJM.db.dismountWithTeam or not AJM.db.mountWithTeam ) + AJM.settingsControl.checkBoxMountInRange:SetDisabled( not AJM.db.mountWithTeam ) +end + +------------------------------------------------------------------------------------------------------------- +-- JambaMount functionality. +------------------------------------------------------------------------------------------------------------- + +function AJM:UNIT_SPELLCAST_START(event, unitID, name, rank, lineID, spellID, ... ) + --AJM:Print("Looking for Spells.", unitID, spellID, name) + --AJM.castingMount = nil + -- No Need to send the casting of mount again to team. + if AJM.MountFromTeamMember == true then + return + end + if unitID == "player" and UnitAffectingCombat("player") == false then + local mountIDs = C_MountJournal.GetMountIDs() + for i = 1, #mountIDs do + --local name , id, icon, active = C_MountJournal.GetMountInfoByID(i) + local creatureName,mountSpellID,_,_,_,_,_,_,_,hideOnChar,isCollected,mountID = C_MountJournal.GetMountInfoByID(mountIDs[i]) + if (isCollected and hideOnChar ~= true) then + --AJM:Print("MountName", name, spellID, "Checks", creatureName, mountSpellID) + if spellID == mountSpellID then + --AJM:Print("SendtoTeam", "name", creatureName , "id", mountID) + if IsShiftKeyDown() == false then + AJM.castingMount = creatureName + AJM:JambaSendCommandToTeam( AJM.COMMAND_MOUNT_ME, spellID, mountID ) + break + end + end + end + end + end +end + +function AJM:UNIT_SPELLCAST_SUCCEEDED(event, unitID, spell, rank, lineID, spellID, ... ) + if unitID ~= "player" then + return + end + --AJM:Print("Looking for Spells Done", spell, AJM.castingMount) + if spell == AJM.castingMount then + --AJM:Print("test", spell) + AJM.isMounted = spell + --AJM:Print("Mounted!", AJM.isMounted) + end + +end + +function AJM:UNIT_AURA(event, unitID, ... ) + --AJM:Print("tester", unitID, AJM.isMounted) + if unitID ~= "player" or AJM.isMounted == nil or AJM.db.dismountWithTeam == false then + return + end + --AJM:Print("tester", unitID, AJM.isMounted) + if not UnitBuff( unitID, AJM.isMounted) then + --AJM:Print("I have Dismounted - Send to team!", AJM.isMounted) + if AJM.db.dismountWithMaster == true then + if JambaApi.IsCharacterTheMaster( AJM.characterName ) == true then + if IsShiftKeyDown() == false then + --AJM:Print("test") + AJM:JambaSendCommandToTeam( AJM.COMMAND_MOUNT_DISMOUNT ) + AJM.MountFromTeamMember = false + end + else + --AJM:Print("test1") + return + end + else + AJM:JambaSendCommandToTeam( AJM.COMMAND_MOUNT_DISMOUNT ) + end + end +end + +function AJM:TeamMountStart(characterName, spellID, mountID) + --This checks the toon is not moving and if so adds a timmer before it mounts! (ebony magic :D) + local moving = GetUnitSpeed("Player") + --AJM:Print("moving", moving, spellID, mountID ) + if moving == 0 then + --AJM:Print("mount?", spellID, mountID ) + AJM:TeamMount(characterName, spellID, mountID) + else + --AJM:Print("player Moving try agian in 1..." ) + AJM:ScheduleTimer( "TeamMountStart", 1, nil, spellID, mountID ) + end +end + + +function AJM:TeamMount(characterName, spellID, mountID) + --AJM:Print("testTeamMount", characterName, name, mountID ) + --mount with team truned off. + if UnitAffectingCombat("player") == true then + AJM:JambaSendMessageToTeam( AJM.db.warningArea, L["I am Unable To Mount In Combat."], false ) + return + end + if AJM.db.mountWithTeam == false then + return + end + -- already mounted. + if IsMounted() then + return + end + -- Checks if character is in range. + if AJM.db.mountInRange == true then + if UnitIsVisible(Ambiguate(characterName, "none") ) == false then + --AJM:Print("UnitIsNotVisible", characterName) + return + end + end + -- Checks done now the fun stuff! + --Do i have the same mount as master? + hasMount = false + local creatureName, spellID, icon, active, isUsable, sourceType, isFavorite, isFactionSpecific, faction, hideOnChar, isCollected, mountID = C_MountJournal.GetMountInfoByID(mountID) + if isUsable == true then + --AJM:Print("i have this Mount", creatureName) + hasMount = true + mount = mountID + else + --AJM:Print("i Do not have Mount", creatureName) + for i = 1, C_MountJournal.GetNumMounts() do + local creatureName, spellID, icon, active, isUsable, sourceType, isFavorite, isFactionSpecific, faction, hideOnChar, isCollected, mountID = C_MountJournal.GetMountInfoByID(i) + --AJM:Print("looking for a mount i can use", i) + if isUsable == true then + mount = mountID + hasMount = true + break + end + end + end + +--AJM:Print("test1420", mount, name) + -- for unsupported mounts. + if hasMount == true then + --AJM:Print("test14550", mount, name ) + if name == "Random" then + C_MountJournal.SummonByID(0) + else + --AJM:Print("test1054" ) + C_MountJournal.SummonByID( mount ) + end + if IsMounted() == false then + AJM:ScheduleTimer( "AmNotMounted", 2 ) + end + end +end + +function AJM:AmNotMounted() + if IsMounted() == false then + --AJM:Print("test") + AJM:JambaSendMessageToTeam( AJM.db.warningArea, L["I am unable to Mount."], false ) + end +end + + + +-- A Jamba command has been received. +function AJM:JambaOnCommandReceived( characterName, commandName, ... ) + if characterName ~= self.characterName then + if commandName == AJM.COMMAND_MOUNT_ME then + --AJM:Print("command") + AJM:TeamMountStart( characterName, ... ) + AJM.MountFromTeamMember = true + end + -- Dismount if mounted! + if commandName == AJM.COMMAND_MOUNT_DISMOUNT then + --AJM:Print("time to Dismount") + if IsMounted() then + AJM.MountFromTeamMember = false + Dismount() + end + end + end +end diff --git a/Jamba-Mount/Locales/JambaMount-Locale-enUS.lua b/Jamba-Mount/Locales/JambaMount-Locale-enUS.lua index 47f0f36..f225e7e 100644 --- a/Jamba-Mount/Locales/JambaMount-Locale-enUS.lua +++ b/Jamba-Mount/Locales/JambaMount-Locale-enUS.lua @@ -25,3 +25,4 @@ L["I am unable to Mount."] = true L["Only Works In a party!"] = true L["Dismount with Character That Dismount"] = true L["Only Dismount's from Master character."] = true +L["I am Unable To Mount In Combat."] = true \ No newline at end of file diff --git a/Jamba-Mount/Locales/Locales.xml b/Jamba-Mount/Locales/Locales.xml index ae1937a..828b3fa 100644 --- a/Jamba-Mount/Locales/Locales.xml +++ b/Jamba-Mount/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaMount-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Purchase/Jamba-Purchase.toc b/Jamba-Purchase/Jamba-Purchase.toc index 384b5ab..266def3 100644 --- a/Jamba-Purchase/Jamba-Purchase.toc +++ b/Jamba-Purchase/Jamba-Purchase.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: Jamba-Purchase ## Notes: Jamba-Purchase ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Purchase/Locales/Locales.xml b/Jamba-Purchase/Locales/Locales.xml index 32ff556..072ec06 100644 --- a/Jamba-Purchase/Locales/Locales.xml +++ b/Jamba-Purchase/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaPurchase-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Quest/Jamba-Quest.toc b/Jamba-Quest/Jamba-Quest.toc index 4f84694..903e1c5 100644 --- a/Jamba-Quest/Jamba-Quest.toc +++ b/Jamba-Quest/Jamba-Quest.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaQuest ## Notes: JambaQuest ## Author: Ebony, DropDownchanges by Schilm, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Quest/JambaQuest.lua b/Jamba-Quest/JambaQuest.lua index b2ddcf7..aa9e687 100644 --- a/Jamba-Quest/JambaQuest.lua +++ b/Jamba-Quest/JambaQuest.lua @@ -31,12 +31,6 @@ local L = LibStub( "AceLocale-3.0" ):GetLocale( AJM.moduleName ) AJM.parentDisplayName = L["Quest"] AJM.moduleDisplayName = L["Quest"] -ALL_QUEST_BUTTON_TEXTURES = { - _AbandonAllButton = [[Interface\Icons\INV_BOX_01]], - _ShareAllButton = [[Interface\Icons\INV_BOX_02]], - _TrackAllButton = [[Interface\Icons\INV_BOX_03]], - _UnTrackAllButton = [[Interface\Icons\INV_BOX_04]], -} -- Settings - the values to store and their defaults for the settings database. AJM.settings = { @@ -48,6 +42,7 @@ AJM.settings = { doNotAutoAccept = true, allAcceptAnyQuest = false, onlyAcceptQuestsFrom = false, + hideStaticPopup = false, acceptFromTeam = false, acceptFromNpc = false, acceptFromFriends = false, @@ -66,7 +61,6 @@ AJM.settings = { hasChoiceSlaveChooseSameRewardAsMaster = false, hasChoiceSlaveMustChooseOwnReward = true, hasChoiceSlaveRewardChoiceModifierConditional = false, --- hasChoiceAquireBestQuestRewardForCharacter = false, hasChoiceCtrlKeyModifier = false, hasChoiceShiftKeyModifier = false, hasChoiceAltKeyModifier = false, @@ -78,7 +72,6 @@ AJM.settings = { frameXOffset = 0, frameYOffset = 0, overrideQuestAutoSelectAndComplete = false, --- hasChoiceAquireBestQuestRewardForCharacterAndGet = false, }, } @@ -116,30 +109,101 @@ end -- Command this module sends. ------------------------------------------------------------------------------------------------------------- -AJM.COMMAND_SELECT_GOSSIP_OPTION = "SelectGossipOption" -AJM.COMMAND_SELECT_GOSSIP_ACTIVE_QUEST = "SelectGossipActiveQuest" -AJM.COMMAND_SELECT_GOSSIP_AVAILABLE_QUEST = "SelectGossipAvailableQuest" -AJM.COMMAND_SELECT_ACTIVE_QUEST = "SelectActiveQuest" -AJM.COMMAND_SELECT_AVAILABLE_QUEST = "SelectAvailableQuest" -AJM.COMMAND_ACCEPT_QUEST = "AcceptQuest" -AJM.COMMAND_COMPLETE_QUEST = "CompleteQuest" -AJM.COMMAND_CHOOSE_QUEST_REWARD = "ChooseQuestReward" -AJM.COMMAND_DECLINE_QUEST = "DeclineQuest" -AJM.COMMAND_SELECT_QUEST_LOG_ENTRY = "SelectQuestLogEntry" -AJM.COMMAND_QUEST_TRACK = "QuestTrack" -AJM.COMMAND_ABANDON_QUEST = "AbandonQuest" -AJM.COMMAND_ABANDON_ALL_QUESTS = "AbandonAllQuests" -AJM.COMMAND_TRACK_ALL_QUESTS = "TrackAllQuests" -AJM.COMMAND_UNTRACK_ALL_QUESTS = "UnTrackAllQuests" -AJM.COMMAND_SHARE_ALL_QUESTS = "ShareAllQuests" -AJM.COMMAND_TOGGLE_AUTO_SELECT = "ToggleAutoSelect" -AJM.COMMAND_LOG_COMPLETE_QUEST = "LogCompleteQuest" -AJM.COMMAND_ACCEPT_QUEST_FAKE = "AcceptQuestFake" +AJM.COMMAND_SELECT_GOSSIP_OPTION = "JambaSelectGossipOption" +AJM.COMMAND_SELECT_GOSSIP_ACTIVE_QUEST = "JambaSelectGossipActiveQuest" +AJM.COMMAND_SELECT_GOSSIP_AVAILABLE_QUEST = "JambaSelectGossipAvailableQuest" +AJM.COMMAND_SELECT_ACTIVE_QUEST = "JambaSelectActiveQuest" +AJM.COMMAND_SELECT_AVAILABLE_QUEST = "JambaSelectAvailableQuest" +AJM.COMMAND_ACCEPT_QUEST = "JambaAcceptQuest" +AJM.COMMAND_COMPLETE_QUEST = "JambaCompleteQuest" +AJM.COMMAND_CHOOSE_QUEST_REWARD = "JambaChooseQuestReward" +AJM.COMMAND_DECLINE_QUEST = "JambaDeclineQuest" +AJM.COMMAND_SELECT_QUEST_LOG_ENTRY = "JambaSelectQuestLogEntry" +AJM.COMMAND_QUEST_TRACK = "JambaQuestTrack" +AJM.COMMAND_ABANDON_QUEST = "JambaAbandonQuest" +AJM.COMMAND_ABANDON_ALL_QUESTS = "JambaAbandonAllQuests" +AJM.COMMAND_TRACK_ALL_QUESTS = "JambaTrackAllQuests" +AJM.COMMAND_UNTRACK_ALL_QUESTS = "JambaUnTrackAllQuests" +AJM.COMMAND_SHARE_ALL_QUESTS = "JambaShareAllQuests" +AJM.COMMAND_TOGGLE_AUTO_SELECT = "JambaToggleAutoSelect" +AJM.COMMAND_LOG_COMPLETE_QUEST = "JambaLogCompleteQuest" +AJM.COMMAND_ACCEPT_QUEST_FAKE = "JambaAcceptQuestFake" ------------------------------------------------------------------------------------------------------------- -- Messages module sends. ------------------------------------------------------------------------------------------------------------- + +------------------------------------------------------------------------------------------------------------- +-- Popup Dialogs. +------------------------------------------------------------------------------------------------------------- + +-- Initialize Popup Dialogs. +local function InitializePopupDialogs() + -- Asks If you like to Abandon on all toons + StaticPopupDialogs["JAMBAQUEST_ABANDON_ALL_TOONS"] = { + text = L["Would you like to Abandon \"%s\" On All Toons?"], + button1 = L["Just Me"], + button2 = L["All Team"], + button3 = NO, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + OnAccept = function( self ) + --AJM:Print("Button1") + AbandonQuest() + end, + OnAlt = function ( self ) + --AJM:Print("Button3") + + end, + OnCancel = function( self, data ) + --AJM:Print("Button2") + AJM:JambaSendCommandToTeam( AJM.COMMAND_ABANDON_QUEST, data.questID, data.title) + end, + } + -- Asks If you like to Track on all toons + StaticPopupDialogs["JAMBAQUEST_TRACK_ALL_TOONS"] = { + text = L["Would you like to Track \"%s\" On All Toons?"], + button1 = YES, + button2 = NO, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + OnAccept = function( self, data ) + AJM:JambaSendCommandToTeam( AJM.COMMAND_QUEST_TRACK, data.questID, data.title, true ) + end, + OnCancel = function( self ) + end, + } + StaticPopupDialogs["JAMBAQUEST_UNTRACK_ALL_TOONS"] = { + text = L["Would you like to UnTrack \"%s\" On All Toons?"], + button1 = YES, + button2 = NO, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + OnAccept = function( self, data ) + AJM:JambaSendCommandToTeam( AJM.COMMAND_QUEST_TRACK, data.questID, data.title, false ) + end, + OnCancel = function( self ) + end, + } + StaticPopupDialogs["AbandonALLToonsQuest"] = { + text = L["This will abandon ALL quests ON every toon! Yes, this means you will end up with ZERO quests in your quest log! Are you sure?"], + button1 = YES, + button2 = NO, + timeout = 0, + whileDead = true, + hideOnEscape = true, + OnAccept = function() + AJM:DoAbandonAllQuestsFromAllToons() + end, + } + + +end + ------------------------------------------------------------------------------------------------------------- -- Addon initialization, enabling and disabling. ------------------------------------------------------------------------------------------------------------- @@ -156,6 +220,8 @@ function AJM:OnInitialize() AJM:JambaModuleInitialize( AJM.settingsControl.widgetSettings.frame ) -- Populate the settings. AJM:SettingsRefresh() + -- Initialise the popup dialogs. + InitializePopupDialogs() -- Create the Jamba Quest Log frame. AJM:CreateJambaMiniQuestLogFrame() -- An empty table to hold the available and active quests at an npc. @@ -175,8 +241,6 @@ function AJM:OnEnable() AJM:RegisterEvent( "GOSSIP_SHOW" ) AJM:RegisterEvent( "QUEST_GREETING" ) AJM:RegisterEvent( "QUEST_PROGRESS" ) - AJM:RegisterEvent( "WORLD_MAP_UPDATE" ) - AJM:RegisterEvent( "ZONE_CHANGED_NEW_AREA" ) -- Quest post hooks. AJM:SecureHook( "SelectGossipOption" ) AJM:SecureHook( "SelectGossipActiveQuest" ) @@ -186,18 +250,14 @@ function AJM:OnEnable() AJM:SecureHook( "AcceptQuest" ) AJM:SecureHook( "AcknowledgeAutoAcceptQuest" ) AJM:SecureHook( "CompleteQuest" ) - --AJM:SecureHook( "DeclineQuest" ) - AJM:SecureHook( "IgnoreQuest" ) - AJM:SecureHook( "UnignoreQuest" ) AJM:SecureHook( "GetQuestReward" ) AJM:SecureHook( "ToggleFrame" ) AJM:SecureHook( "ToggleQuestLog" ) AJM:SecureHook( WorldMapFrame, "Hide", "QuestLogFrameHide" ) AJM:SecureHook( "ShowQuestComplete" ) - - JambaQuestMapQuestOptionsDropDown.questID = 0; -- for QuestMapQuestOptionsDropDown_Initialize - UIDropDownMenu_Initialize(JambaQuestMapQuestOptionsDropDown, JambaQuestMapQuestOptionsDropDown_Initialize, "MENU"); - + AJM:SecureHook( "QuestMapQuestOptions_AbandonQuest" ) + AJM:SecureHook( "QuestMapQuestOptions_TrackQuest" ) +-- AJM:SecureHook( QuestFrame, "Hide", "DeclineQuest" ) end -- Called when the addon is disabled. @@ -589,29 +649,6 @@ function AJM:SettingsCreateQuestCompletionControl( top ) ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionDoNothing:SetType( "radio" ) movingTop = movingTop - radioBoxHeight - -- TODO: Fix or remove. - -- Radio box: Has choice, choose best reward. --- AJM.settingsControlCompletion.checkBoxHasChoiceAquireBestQuestRewardForCharacter = JambaHelperSettings:CreateCheckBox( --- AJM.settingsControlCompletion, --- headingWidth, --- column1Left, --- movingTop, --- L["Toon Auto Selects Best Reward"], --- AJM.SettingsToggleHasChoiceAquireBestQuestRewardForCharacter --- ) --- AJM.settingsControlCompletion.checkBoxHasChoiceAquireBestQuestRewardForCharacter:SetType( "radio" ) --- movingTop = movingTop - radioBoxHeight - -- Radio box: Has choice, choose best reward - actually get it. --- AJM.settingsControlCompletion.checkBoxActuallyGetTheBestReward = JambaHelperSettings:CreateCheckBox( --- AJM.settingsControlCompletion, --- headingWidth, --- column1Left + indent, --- movingTop, --- L["And Claims It As Well"], --- AJM.SettingsToggleActuallyGetTheBestReward --- --- ) - movingTop = movingTop - checkBoxHeight -- Radio box: Has choice, minion complete quest with master. AJM.settingsControlCompletion.checkBoxHasChoiceMinionCompleteQuestWithMaster = JambaHelperSettings:CreateCheckBox( AJM.settingsControlCompletion, @@ -752,8 +789,6 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM.db.hasChoiceShiftKeyModifier = settings.hasChoiceShiftKeyModifier AJM.db.hasChoiceAltKeyModifier = settings.hasChoiceAltKeyModifier AJM.db.hasChoiceOverrideUseSlaveRewardSelected = settings.hasChoiceOverrideUseSlaveRewardSelected --- AJM.db.hasChoiceAquireBestQuestRewardForCharacter = settings.hasChoiceAquireBestQuestRewardForCharacter --- AJM.db.hasChoiceAquireBestQuestRewardForCharacterAndGet = settings.hasChoiceAquireBestQuestRewardForCharacterAndGet AJM.db.messageArea = settings.messageArea AJM.db.warningArea = settings.warningArea AJM.db.overrideQuestAutoSelectAndComplete = settings.overrideQuestAutoSelectAndComplete @@ -807,9 +842,6 @@ function AJM:SettingsRefresh() AJM.settingsControlCompletion.checkBoxHasChoiceMinionCompleteQuestWithMaster:SetValue( AJM.db.hasChoiceSlaveCompleteQuestWithMaster ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionChooseSameRewardAsMaster:SetValue( AJM.db.hasChoiceSlaveChooseSameRewardAsMaster ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionMustChooseOwnReward:SetValue( AJM.db.hasChoiceSlaveMustChooseOwnReward ) --- Ebony Fix or remove, --- AJM.settingsControlCompletion.checkBoxHasChoiceAquireBestQuestRewardForCharacter:SetValue( AJM.db.hasChoiceAquireBestQuestRewardForCharacter ) --- AJM.settingsControlCompletion.checkBoxActuallyGetTheBestReward:SetValue( AJM.db.hasChoiceAquireBestQuestRewardForCharacterAndGet ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionRewardChoiceModifierConditional:SetValue( AJM.db.hasChoiceSlaveRewardChoiceModifierConditional ) AJM.settingsControlCompletion.checkBoxHasChoiceCtrlKeyModifier:SetValue( AJM.db.hasChoiceCtrlKeyModifier ) AJM.settingsControlCompletion.checkBoxHasChoiceShiftKeyModifier:SetValue( AJM.db.hasChoiceShiftKeyModifier ) @@ -833,8 +865,6 @@ function AJM:SettingsRefresh() AJM.settingsControlCompletion.checkBoxNoChoiceMinionCompleteQuestWithMaster:SetDisabled( not AJM.db.enableAutoQuestCompletion ) AJM.settingsControlCompletion.checkBoxNoChoiceAllAutoCompleteQuest:SetDisabled( not AJM.db.enableAutoQuestCompletion ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionDoNothing:SetDisabled( not AJM.db.enableAutoQuestCompletion ) --- AJM.settingsControlCompletion.checkBoxHasChoiceAquireBestQuestRewardForCharacter:SetDisabled( not AJM.db.enableAutoQuestCompletion ) --- AJM.settingsControlCompletion.checkBoxActuallyGetTheBestReward:SetDisabled( not AJM.db.enableAutoQuestCompletion or not AJM.db.hasChoiceAquireBestQuestRewardForCharacter ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionCompleteQuestWithMaster:SetDisabled( not AJM.db.enableAutoQuestCompletion ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionChooseSameRewardAsMaster:SetDisabled( not AJM.db.enableAutoQuestCompletion or not AJM.db.hasChoiceSlaveCompleteQuestWithMaster ) AJM.settingsControlCompletion.checkBoxHasChoiceMinionMustChooseOwnReward:SetDisabled( not AJM.db.enableAutoQuestCompletion or not AJM.db.hasChoiceSlaveCompleteQuestWithMaster ) @@ -991,11 +1021,6 @@ function AJM:SettingsToggleHasChoiceAquireBestQuestRewardForCharacter( event, ch AJM:SettingsRefresh() end ---function AJM:SettingsToggleActuallyGetTheBestReward( event, checked ) --- AJM.db.hasChoiceAquireBestQuestRewardForCharacterAndGet = checked --- AJM:SettingsRefresh() ---end - function AJM:SettingsToggleHasChoiceMinionChooseSameRewardAsMaster( event, checked ) AJM.db.hasChoiceSlaveChooseSameRewardAsMaster = checked AJM.db.hasChoiceSlaveMustChooseOwnReward = not checked @@ -1236,20 +1261,11 @@ function AJM:DoSelectAvailableQuest( sender, questIndex ) end end -function AJM:UnignoreQuest() +function AJM:DeclineQuest() if AJM.db.mirrorMasterQuestSelectionAndDeclining == true then if AJM.isInternalCommand == false then AJM:DebugMessage( "DeclineQuest" ) - AJM:JambaSendCommandToTeam( AJM.COMMAND_DECLINE_QUEST ) - end - end -end - -function AJM:IgnoreQuest() - if AJM.db.mirrorMasterQuestSelectionAndDeclining == true then - if AJM.isInternalCommand == false then - AJM:DebugMessage( "DeclineQuest" ) - AJM:JambaSendCommandToTeam( AJM.COMMAND_DECLINE_QUEST ) + AJM:ScheduleTimer("JambaSendCommandToTeam", 0.5, AJM.COMMAND_DECLINE_QUEST ) end end end @@ -1258,13 +1274,8 @@ function AJM:DoDeclineQuest( sender ) if AJM.db.mirrorMasterQuestSelectionAndDeclining == true then AJM.isInternalCommand = true AJM:DebugMessage( "DoDeclineQuest" ) + HideUIPanel(QuestFrame) --DeclineQuest() - local isIgnored = IsQuestIgnored() - if isIgnored then - UnignoreQuest() - else - IgnoreQuest() - end AJM.isInternalCommand = false end end @@ -1336,8 +1347,6 @@ function AJM:DoShowQuestComplete( sender, questName ) local questIndex = AJM:GetQuestLogIndexByName( questName ) if questIndex ~= 0 then ShowQuestComplete( questIndex ) - --TODO fix this or remove - --WatchFrameAutoQuest_ClearPopUpByLogIndex( questIndex ) end AJM.isInternalCommand = false end @@ -1432,216 +1441,6 @@ function AJM:DoChooseQuestReward( sender, questIndex, modifierKeysPressed, rewar end end ---TODO FIX or Remove! ---[[ -function AJM:GetBestRewardIndexForCharacter() - -- Originally provided by loop: http://www.dual-boxing.com/showpost.php?p=257610&postcount=1505 - -- New version provided by Mischanix via jamba.uservoice.com. - -- Modified by Jafula. - local numberOfQuestRewards = GetNumQuestChoices() - local bestQuestItemIndex = 1 - local bestSellPrice = 0 - -- Yanked this from LibItemUtils; sucks that we need this lookup table, but GetItemInfo only - -- returns an equipment location, which must first be converted to a slot value that GetInventoryItemLink understands: - local equipmentSlotLookup = { - INVTYPE_HEAD = {"HeadSlot", nil}, - INVTYPE_NECK = {"NeckSlot", nil}, - INVTYPE_SHOULDER = {"ShoulderSlot", nil}, - INVTYPE_CLOAK = {"BackSlot", nil}, - INVTYPE_CHEST = {"ChestSlot", nil}, - INVTYPE_WRIST = {"WristSlot", nil}, - INVTYPE_HAND = {"HandsSlot", nil}, - INVTYPE_WAIST = {"WaistSlot", nil}, - INVTYPE_LEGS = {"LegsSlot", nil}, - INVTYPE_FEET = {"FeetSlot", nil}, - INVTYPE_SHIELD = {"SecondaryHandSlot", nil}, - INVTYPE_ROBE = {"ChestSlot", nil}, - INVTYPE_2HWEAPON = {"MainHandSlot", "SecondaryHandSlot"}, - INVTYPE_WEAPONMAINHAND = {"MainHandSlot", nil}, - INVTYPE_WEAPONOFFHAND = {"SecondaryHandSlot", "MainHandSlot"}, - INVTYPE_WEAPON = {"MainHandSlot","SecondaryHandSlot"}, - INVTYPE_THROWN = {"RangedSlot", nil}, - INVTYPE_RANGED = {"RangedSlot", nil}, - INVTYPE_RANGEDRIGHT = {"RangedSlot", nil}, - INVTYPE_FINGER = {"Finger0Slot", "Finger1Slot"}, - INVTYPE_HOLDABLE = {"SecondaryHandSlot", "MainHandSlot"}, - INVTYPE_TRINKET = {"Trinket0Slot", "Trinket1Slot"} - } - local statWeights = { - ITEM_MOD_STRENGTH_SHORT = 0x0C, - ITEM_MOD_AGILITY_SHORT = 0x02, - ITEM_MOD_INTELLECT_SHORT = 0x11, - ITEM_MOD_SPELL_POWER_SHORT = 0x11, - ITEM_MOD_SPIRIT_SHORT = 0x10, - ITEM_MOD_HIT_RATING_SHORT = 0x07, - } - local classSpec = { - DEATHKNIGHT1 = 0x08, - DEATHKNIGHT2 = 0x04, - DEATHKNIGHT3 = 0x04, - DRUID1 = 0x01, - DRUID2 = 0x02, -- Feral bears get agi itemization as well - DRUID3 = 0x10, - HUNTER1 = 0x02, - HUNTER2 = 0x02, - HUNTER3 = 0x02, - MAGE1 = 0x01, - MAGE2 = 0x01, - MAGE3 = 0x01, - PALADIN1 = 0x10, - PALADIN2 = 0x08, - PALADIN3 = 0x04, - PRIEST1 = 0x10, - PRIEST2 = 0x10, - PRIEST3 = 0x01, - ROGUE1 = 0x02, - ROGUE2 = 0x02, - ROGUE3 = 0x02, - SHAMAN1 = 0x01, - SHAMAN2 = 0x02, - SHAMAN3 = 0x10, - WARLOCK1 = 0x01, - WARLOCK2 = 0x01, - WARLOCK3 = 0x01, - WARRIOR1 = 0x04, - WARRIOR2 = 0x04, - WARRIOR3 = 0x08, - } - local _, class = UnitClass("player") - -- Original canWear - here for documentation purposes - Jafula. - END - local canWear = { - DEATHKNIGHT = {"Cloth", "Leather", "Mail", "Plate", "Axe", "Mace", "Polearm", "Sword"}, - DRUID = {"Cloth", "Leather", "Dagger", "Fist Weapon", "Mace", "Polearm", "Staff"}, - HUNTER = {"Cloth", "Leather", "Mail", "Axe", "Dagger", "Fist Weapon", "Polearm", "Staff", "Sword", "Bow", "Crossbow", "Gun"}, - MAGE = {"Cloth", "Dagger", "Staff", "Sword", "Wand"}, - PALADIN = {"Cloth", "Leather", "Mail", "Plate", "Axe", "Mace", "Polearm", "Sword"}, - PRIEST = {"Cloth", "Dagger", "Mace", "Staff", "Wand"}, - ROGUE = {"Cloth", "Leather", "Dagger", "Fist Weapon", "Axe", "Mace", "Sword"}, - SHAMAN = {"Cloth", "Leather", "Mail", "Axe", "Dagger", "Fist Weapon", "Mace", "Staff"}, - WARLOCK = {"Cloth", "Dagger", "Staff", "Sword", "Wand"}, - WARRIOR = {"Cloth", "Leather", "Mail", "Plate", "Axe", "Dagger", "Fist Weapon", "Mace", "Polearm", "Staff", "Sword", "Bow", "Crossbow", "Gun", "Thrown"} - } - END - -- Removed lower tier armour from canWear table (i.e. DKs, Paladins, Warriers can only wear Plate). - -- I personally would not pick up a lower tiered piece for my toons. Jafula. - local canWear = { - DEATHKNIGHT = {"Plate", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Two-Handed Axes", "Two-Handed Maces", "Two-Handed Swords", "Sigils", "Miscellaneous"}, - DRUID = {"Leather", "Daggers", "Fist Weapons", "One-Handed Maces", "Polearms", "Staves", "Two-Handed Maces", "Idols", "Miscellaneous"}, - HUNTER = {"Mail", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Swords", "Polearms", "Staves", "Two-Handed Axes", "Two-Handed Swords", "Thrown", "Miscellaneous"}, - MAGE = {"Cloth", "Daggers", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - PALADIN = {"Plate", "Shields", "Daggers", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Polearms", "Two-Handed Axes", "Two-Handed Maces", "Two-Handed Swords", "Librams", "Miscellaneous"}, - PRIEST = {"Cloth", "Daggers", "One-Handed Maces", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - ROGUE = {"Leather", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Thrown", "Miscellaneous"}, - SHAMAN = {"Mail", "Shields", "Daggers", "Fist Weapons", "One-Handed Axes", "One-Handed Maces", "Staves", "Two-Handed Axes", "Two-Handed Maces", "Totems", "Miscellaneous"}, - WARLOCK = {"Cloth", "Daggers", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - WARRIOR = {"Plate", "Shields", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Polearms","Staves", "Two-Handed Axes","Two-Handed Maces", "Two-Handed Swords", "Thrown", "Miscellaneous"} - } - local canWearLowbies = { - DEATHKNIGHT = {"Plate", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Two-Handed Axes", "Two-Handed Maces", "Two-Handed Swords", "Sigils", "Miscellaneous"}, - DRUID = {"Leather", "Daggers", "Fist Weapons", "One-Handed Maces", "Polearms", "Staves", "Two-Handed Maces", "Idols", "Miscellaneous"}, - HUNTER = {"Leather", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Swords", "Polearms", "Staves", "Two-Handed Axes", "Two-Handed Swords", "Thrown", "Miscellaneous"}, - MAGE = {"Cloth", "Daggers", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - PALADIN = {"Mail", "Shields", "Daggers", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Polearms", "Two-Handed Axes", "Two-Handed Maces", "Two-Handed Swords", "Librams", "Miscellaneous"}, - PRIEST = {"Cloth", "Daggers", "One-Handed Maces", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - ROGUE = {"Leather", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Thrown", "Miscellaneous"}, - SHAMAN = {"Leather", "Shields", "Daggers", "Fist Weapons", "One-Handed Axes", "One-Handed Maces", "Staves", "Two-Handed Axes", "Two-Handed Maces", "Totems", "Miscellaneous"}, - WARLOCK = {"Cloth", "Daggers", "One-Handed Swords", "Staves", "Wands", "Miscellaneous"}, - WARRIOR = {"Mail", "Shields", "Bows", "Crossbows", "Daggers", "Fist Weapons", "Guns", "One-Handed Axes", "One-Handed Maces", "One-Handed Swords", "Polearms","Staves", "Two-Handed Axes","Two-Handed Maces", "Two-Handed Swords", "Thrown", "Miscellaneous"} - } - local compare = function(val, t) - for _,v in ipairs(t) do if val == v then return true end end return false - end - local scaleRare = { - 1, - 1, - 1, - 1.11, - 1.67, - 2, - 2.2, - 1 - } - if UnitLevel("player")<=58 then - scaleRare[7] = UnitLevel("player")+15 - elseif UnitLevel("player")<=68 then - scaleRare[7] = (UnitLevel("player")-60)*3 + 85 - elseif UnitLevel("player")<=79 then - scaleRare[7] = (UnitLevel("player")-70)*4 + 134 - elseif UnitLevel("player")<=85 then - scaleRare[7] = (UnitLevel("player")-80)*8 + 292 - end - local ourItemization = classSpec[class..(GetSpecialization() or 1)] - local statTable = {} - local rewardTable = {} - local countRewardNotLoaded = 0 - for questItemIndex = 1, numberOfQuestRewards do - local rewardItemLink = GetQuestItemLink("choice", questItemIndex) --- TODO: Remove ---AJM:Print( questItemIndex, " of ", numberOfQuestRewards, " is ", rewardItemLink ) - if rewardItemLink ~= nil then - local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo( rewardItemLink ) - if itemSellPrice > bestSellPrice then - bestSellPrice = itemSellPrice - bestQuestItemIndex = questItemIndex - end - local relevance = 0 - local itemLevelD = 0 - GetItemStats(itemLink, statTable) - for modifier, value in pairs(statTable) do - if statWeights[modifier] and bit.band(ourItemization, statWeights[modifier]) ~= 0 then - relevance = relevance + 1 - end - end - local lowLevel = 400 - local lowRare = 7 - if equipmentSlotLookup[itemEquipLoc] ~= nil then - for _, a in ipairs( equipmentSlotLookup[itemEquipLoc] ) do - local itemLink = GetInventoryItemLink( "player", GetInventorySlotInfo( a ) ) - if itemLink then - local _, _, ourRare, ourLevel = GetItemInfo( itemLink ) - if ourLevel < lowLevel then - lowLevel = ourLevel - lowRare = ourRare - end - end - end - itemLevel = itemLevel * scaleRare[itemRarity] - lowLevel = lowLevel * scaleRare[lowRare] - itemLevelD = lowLevel - itemLevel - --AJM:Print( itemLevelD, relevance, compare( itemSubType, canWear[class] ), compare( itemSubType, canWearLowbies[class] ), itemSubType) - local toonCanWearPiece = false - if UnitLevel("player") <= 39 then - toonCanWearPiece = compare( itemSubType, canWearLowbies[class] ) - else - toonCanWearPiece = compare( itemSubType, canWear[class] ) - end - if itemLevelD <= 0 and relevance > 0 and toonCanWearPiece == true then - --AJM:Print( "added: ", questItemIndex) - rewardTable[questItemIndex] = relevance - end - --AJM:Print(itemLink..": r="..relevance..", delta="..itemLevelD, "itemIndex="..questItemIndex) - wipe(statTable) - end - else - countRewardNotLoaded = countRewardNotLoaded + 1 - end - end - if countRewardNotLoaded > 0 then - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["The reward information was not loaded from the server. Close the quest window and open it again."], false ) - end - bestR = -1 ---AJM:Print( "dotable!" ) - for i, r in pairs( rewardTable ) do - --AJM:Print( i, r ) - if r > bestR then - bestQuestItemIndex = i - bestR = r - end - end - return bestQuestItemIndex -end -]]-- ------------------------------------------------------------------------------------------------------------- -- NPC QUEST PROCESSING - ACCEPTING @@ -1653,8 +1452,6 @@ function AJM:QUEST_ACCEPTED( ... ) if AJM.db.masterAutoShareQuestOnAccept == true then if JambaApi.IsCharacterTheMaster( AJM.characterName ) == true then if AJM.isInternalCommand == false then - -- Remove some spam, - --AJM:JambaSendMessageToTeam( AJM.db.messageArea, "Attempting to auto share newly accepted quest.", false ) SelectQuestLogEntry( questIndex ) if GetQuestLogPushable() and GetNumSubgroupMembers() > 0 then AJM:JambaSendMessageToTeam( AJM.db.messageArea, "Pushing newly accepted quest.", false ) @@ -1680,7 +1477,7 @@ end function AJM:DoAcceptQuest( sender ) if AJM.db.acceptQuests == true and AJM.db.slaveMirrorMasterAccept == true then local questIndex = AJM:GetQuestLogIndexByName( questName ) - --Olny works if the quest frame is open. Stops sending a blank quest. + --Only works if the quest frame is open. Stops sending a blank quest. Tell the team a char not got the quest window open???? <<<<<< TODO if QuestFrame:IsShown() == true then AJM.isInternalCommand = true AJM:DebugMessage( "DoAcceptQuest" ) @@ -1802,6 +1599,44 @@ end -- JAMBA QUEST CONTEXT MENU ------------------------------------------------------------------------------------------------------------- + + +function AJM:QuestMapQuestOptions_AbandonQuest(questID) + if JambaApi.GetTeamListMaximumOrderOnline() > 1 then + local lastQuestIndex = GetQuestLogSelection() + --AJM:Print("SetAbandonQuest", lastQuestIndex, questID) + title = GetAbandonQuestName() + local data = {} + data.questID = questID + data.title = title + StaticPopup_Hide( "ABANDON_QUEST" ) + StaticPopup_Hide( "ABANDON_QUEST_WITH_ITEMS" ) + StaticPopup_Show( "JAMBAQUEST_ABANDON_ALL_TOONS", title, nil, data ) + end +end + +function AJM:QuestMapQuestOptions_TrackQuest(questID) + if JambaApi.GetTeamListMaximumOrderOnline() > 1 then + --AJM:Print("test", questID) + local questLogIndex = GetQuestLogIndexByID(questID) + local title = GetQuestLogTitle( questLogIndex ) + local data = {} + data.questID = questID + data.title = title + if ( IsQuestWatched(questLogIndex) ) then + --AJM:Print("TrackingQuest") + StaticPopup_Show( "JAMBAQUEST_TRACK_ALL_TOONS", title, nil, data ) + else + --AJM:Print("UnTrackQuest") + StaticPopup_Show( "JAMBAQUEST_UNTRACK_ALL_TOONS", title, nil, data ) + end + end +end + + +--Max's Menu System that was tainting like hell do like it trying quest3.0 Ebony's way. + +--[[ function JambaQuestMapQuestOptionsDropDown_Initialize(self) local questLogIndex = GetQuestLogIndexByID(self.questID); local info = UIDropDownMenu_CreateInfo(); @@ -1848,10 +1683,10 @@ function JambaQuestMapQuestOptionsDropDown_Initialize(self) text = L["JAMBA_QUESTLOG_CONTEXT_ALERT_AbandonAllToons"], button1 = YES, button2 = NO, - timeout = 0, - whileDead = true, + timeout = 0, + whileDead = true, hideOnEscape = true, - OnAccept = function(self, data) + OnAccept = function(self, data) AJM:JambaSendCommandToTeam( AJM.COMMAND_ABANDON_QUEST, data.questID, data.title) end, } @@ -1875,7 +1710,7 @@ function AJM:QuestMapQuestOptions_ShareQuest(questID) PlaySound("igQuestLogOpen"); end -function AJM:QuestMapQuestOptions_AbandonQuest(questID) + function AJM:QuestMapQuestOptions_AbandonQuest(questID) local lastQuestIndex = GetQuestLogSelection(); SelectQuestLogEntry(GetQuestLogIndexByID(questID)); SetAbandonQuest(); @@ -1890,21 +1725,6 @@ function AJM:QuestMapQuestOptions_AbandonQuest(questID) SelectQuestLogEntry(lastQuestIndex); end -function AJM:QuestMapQuestOptions_TrackQuest(questID, questLogIndex) - --AJM:Print("test", questID, questLogIndex ) - if ( not IsQuestWatched(questID) ) then - AddQuestWatch(questLogIndex, true); - QuestSuperTracking_OnQuestTracked(questID); - end -end - -function AJM:QuestMapQuestOptions_UnTrackQuest(questID, questLogIndex) - --AJM:Print("test", questID, questLogIndex ) - if ( IsQuestWatched(questLogIndex) ) then - QuestObjectiveTracker_UntrackQuest(nil, questID); - end -end - function AJM:QuestMapQuestOptions_ToggleTrackQuestAllToons(questID) local questLogIndex = GetQuestLogIndexByID(questID); @@ -1930,45 +1750,62 @@ function AJM:QuestMapQuestOptions_AbandonQuestAllToons(questID) end -function AJM:QuestMapQuestOptions_Jamba_DoQuestTrack( sender, questID, title, track ) +]] + +function AJM:QuestMapQuestOptions_Jamba_DoQuestTrack( sender, questID, title, track ) local questLogIndex = GetQuestLogIndexByID( questID ) - if questLogIndex ~= 0 then if track then - AJM:QuestMapQuestOptions_TrackQuest( questID, questLogIndex ) + AJM:JambaDoQuest_TrackQuest( questID, questLogIndex ) else - AJM:QuestMapQuestOptions_UnTrackQuest( questID, questLogIndex ) + AJM:JambaDoQuest_UnTrackQuest( questID, questLogIndex ) end else - AJM:JambaSendMessageToTeam( AJM.db.warningArea, L["JAMBA_QUESTLOG_DoNotHaveQuest"]( title ), false ) + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_DoNotHaveQuest"]( title ), false ) end end -function AJM:QuestMapQuestOptions_Jamba_DoAbandonQuest( sender, questID, title ) +function AJM:JambaDoQuest_TrackQuest(questID, questLogIndex) + --AJM:Print("test", questID, questLogIndex ) + if ( not IsQuestWatched(questID) ) then + AddQuestWatch(questLogIndex, true) + QuestSuperTracking_OnQuestTracked(questID) + end +end + + +function AJM:JambaDoQuest_UnTrackQuest(questID, questLogIndex) + --AJM:Print("test", questID, questLogIndex ) + if ( IsQuestWatched(questLogIndex) ) then + QuestObjectiveTracker_UntrackQuest(nil, questID) + end +end + + +function AJM:QuestMapQuestOptions_Jamba_DoAbandonQuest( sender, questID, title ) local questLogIndex = GetQuestLogIndexByID( questID ) - if questLogIndex ~= 0 then - local lastQuestIndex = GetQuestLogSelection(); SelectQuestLogEntry(GetQuestLogIndexByID(questID)); SetAbandonQuest(); AbandonQuest(); - SelectQuestLogEntry(lastQuestIndex); - + SelectQuestLogEntry(lastQuestIndex); AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_HaveAbandonedQuest"]( title ), false ) - else - AJM:JambaSendMessageToTeam( AJM.db.warningArea, L["JAMBA_QUESTLOG_DoNotHaveQuest"]( title ), false ) end - end + + +-- Jamba ALL menu at the bottom of quest WorldMap Quest Log + + function AJM:CreateJambaMiniQuestLogFrame() JambaMiniQuestLogFrame = CreateFrame( "Frame", "JambaMiniQuestLogFrame", QuestMapFrame ) local frame = JambaMiniQuestLogFrame - frame:SetWidth( 155 ) + frame:SetWidth( 295 ) frame:SetHeight( 50 ) frame:SetFrameStrata( "HIGH" ) frame:SetToplevel( true ) @@ -1976,181 +1813,172 @@ function AJM:CreateJambaMiniQuestLogFrame() frame:EnableMouse( true ) frame:SetMovable( true ) frame:ClearAllPoints() - frame:SetPoint("BOTTOMRIGHT", QuestMapFrame, "BOTTOMRIGHT", 5,-55) + frame:SetPoint("BOTTOMRIGHT", QuestMapFrame, "BOTTOMRIGHT", 5,-50) frame:SetBackdrop( { bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 15, edgeSize = 15, insets = { left = 5, right = 5, top = 5, bottom = 5 } } ) - table.insert( UISpecialFrames, "JambaQuestLogWindowFrame" ) - AJM:CreateQuestLogButton('_AbandonAllButton', 0, AJM.QuestMapAll_Jamba_DoAbandonAllQuestsFromAllToons) - --AJM:CreateQuestLogButton('_ShareAllButton', 1, AJM.QuestMapAll_Jamba_DoShareAllQuestsFromThisToon) -- MCS 2016/04/02 This would make the share functionality share all quests from just the current toon - AJM:CreateQuestLogButton('_ShareAllButton', 1, AJM.QuestMapAll_Jamba_DoShareAllQuestsFromAllToons) -- MCS 2016/04/02 This would make the share functionality share all quests on all toons, rather than just current toon - AJM:CreateQuestLogButton('_TrackAllButton', 2, AJM.QuestMapAll_Jamba_DoTrackAllQuestsFromAllToons) - AJM:CreateQuestLogButton('_UnTrackAllButton', 3, AJM.QuestMapAll_Jamba_DoUnTrackAllQuestsFromAllToons) - -end -function AJM:CreateQuestLogButton(name, index, doAction) - - StaticPopupDialogs[name .. "_confirm"] = { - text = L["JAMBA_QUESTLOG_ALL_ALERT" .. name], - button1 = YES, - button2 = NO, - timeout = 0, - whileDead = true, - hideOnEscape = true, - OnAccept = function() - doAction() - end, - } - - local x_coord = -10 - index * 35 - - local button = CreateFrame( "CheckButton", name, JambaMiniQuestLogFrame ) - - local buttonTexture = button:CreateTexture() - buttonTexture:SetAllPoints() - buttonTexture:SetTexture(ALL_QUEST_BUTTON_TEXTURES[name]) - - button.Normal = buttonTexture - button.ButtonName = name - - button:SetScript( "OnClick", AJM.JambaAllQuestButtonOnClick ) - button:SetScript( "OnEnter", AJM.JambaAllQuestButtonOnEnter ) - button:SetScript( "OnLeave", AJM.JambaAllQuestButtonOnLeave ) - button:RegisterForClicks("AnyUp") - button:SetSize( 30, 30 ) - button:ClearAllPoints() - button:SetPoint("BOTTOMRIGHT", JambaMiniQuestLogFrame, "BOTTOMRIGHT", x_coord, 10) -end - -function AJM.JambaAllQuestButtonOnEnter (button) - WorldMapTooltip:SetOwner( button, "ANCHOR_TOPLEFT" ) - WorldMapTooltip:SetText( L["JAMBA_QUESTLOG_ALL_MOUSEOVER" .. button.ButtonName], nil, nil, nil, nil, 1 ) -end - -function AJM.JambaAllQuestButtonOnLeave () - WorldMapTooltip:Hide() -end - -function AJM.JambaAllQuestButtonOnClick (button) - StaticPopup_Show( button.ButtonName .. "_confirm" ) + -- abandon ALL button + local abandonButton = CreateFrame( "Button", "abandonButton", frame, "UIPanelButtonTemplate" ) + abandonButton:SetScript( "OnClick", function() StaticPopup_Show("AbandonALLToonsQuest") end ) + abandonButton:SetPoint( "TOPLEFT", frame, "TOPLEFT", 0 , -5) + abandonButton:SetHeight( 35 ) + abandonButton:SetWidth( 100 ) + abandonButton:SetText( L["Abandon All\nQuests"] ) + abandonButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(trackButton, true, L["Aabandon All Quests on all Minions"]) end) + abandonButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) + abandonQuestLogWindowAbandonFrameButton = abandonButton + + -- Share All Button + local shareButton = CreateFrame( "Button", "shareButton", frame, "UIPanelButtonTemplate" ) + shareButton:SetScript( "OnClick", function() AJM:DoShareAllQuestsFromAllToons() end ) + shareButton:SetPoint( "TOPLEFT", frame, "TOPLEFT", 100, -5) + shareButton:SetHeight( 21 ) + shareButton:SetWidth( 100 ) + shareButton:SetText( L["Share All"] ) + shareButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(shareButton, true, L["share All Quests to all Minions"]) end) + shareButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) + shareQuestLogWindowFrameShareButton = shareButton + + --Track All Button + local trackButton = CreateFrame( "Button", "trackButton", frame, "UIPanelButtonTemplate" ) + trackButton:SetScript( "OnClick", function() AJM:DoTrackAllQuestsFromAllToons() end ) + trackButton:SetPoint( "TOPRIGHT", frame, "TOPRIGHT", 0, -5) + trackButton:SetHeight( 21 ) + trackButton:SetWidth( 100 ) + trackButton:SetText( L["Track All"] ) + trackButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(trackButton, true, L["Track All Quests on all Minions"]) end) + trackButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) + JambaQuestLogWindowFrameTrackButton = trackButton + + -- Untrack All + local unTrackButton = CreateFrame( "Button", "unTrackButton", frame, "UIPanelButtonTemplate" ) + unTrackButton:SetScript( "OnClick", function() AJM:DoUnTrackAllQuestsFromAllToons() end ) + unTrackButton:SetPoint( "TOPRIGHT", frame, "TOPRIGHT", 0, -25) + unTrackButton:SetHeight( 21 ) + unTrackButton:SetWidth( 100 ) + unTrackButton:SetText( L["Untrack All"] ) + unTrackButton:SetScript("OnEnter", function(self) AJM:ShowTooltip(trackButton, true, L["Untrack All Quests on all Minions"]) end) + unTrackButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end) + JambaQuestLogWindowFrameUnTrackButton = unTrackButton +end + + +function AJM:ShowTooltip(frame, show, text) + if show then + GameTooltip:SetOwner(frame, "ANCHOR_TOP") + GameTooltip:SetPoint("TOPLEFT", frame, "TOPRIGHT", 16, 0) + GameTooltip:ClearLines() + GameTooltip:AddLine( text , 1, 0.82, 0, 1) + GameTooltip:Show() + else + GameTooltip:Hide() + end end -function AJM.QuestMapAll_Jamba_DoAbandonAllQuestsFromAllToons() - AJM:JambaSendCommandToTeam( AJM.COMMAND_ABANDON_ALL_QUESTS) +function AJM:DoAbandonAllQuestsFromAllToons() + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Abandoning quest's to all toons"], false ) + AJM:DoAbandonAllQuestsFromThisToon() + AJM:ScheduleTimer("JambaSendCommandToTeam" , 2, AJM.COMMAND_ABANDON_ALL_QUESTS) end -function AJM.QuestMapAll_Jamba_DoAbandonAllQuestsFromThisToon() +function AJM:DoAbandonAllQuestsFromThisToon() AJM.iterateQuests = 0 - AJM:IterateQuests("QuestMapAll_Jamba_AbandonNextQuest", 0.5) + AJM:IterateQuests("AbandonNextQuest", 0.5) end -function AJM.QuestMapAll_Jamba_AbandonNextQuest() - +function AJM.AbandonNextQuest() local title, isHeader, questID = AJM:GetRelevantQuestInfo(AJM.iterateQuests) - if isHeader == false and questID ~= 0 then - local canAbandon = CanAbandonQuest(questID) if canAbandon then - - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_ALL_MESSAGE_AbandonAllButton"]( title ), false ) AJM:JambaSendCommandToTeam( AJM.COMMAND_ABANDON_QUEST, questID, title) - if (AJM.iterateQuests ~= GetNumQuestLogEntries()) then -- decrement quest count as we have removed one if not last quest AJM.iterateQuests = AJM.iterateQuests - 1 end - else - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_ALL_MESSAGE_CannotAbandonQuest"]( title ), false ) end end - - AJM:IterateQuests("QuestMapAll_Jamba_AbandonNextQuest", 0.5) + AJM:IterateQuests("AbandonNextQuest", 0.5) end -function AJM.QuestMapAll_Jamba_DoShareAllQuestsFromAllToons() - AJM:JambaSendCommandToTeam( AJM.COMMAND_SHARE_ALL_QUESTS) +function AJM.DoShareAllQuestsFromAllToons() + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Sharing Quest's to All Minions"], false ) + AJM:DoShareAllQuestsFromThisToon() + AJM:ScheduleTimer("JambaSendCommandToTeam" , 2, AJM.COMMAND_SHARE_ALL_QUESTS) end -function AJM.QuestMapAll_Jamba_DoShareAllQuestsFromThisToon() +function AJM.DoShareAllQuestsFromThisToon() AJM.iterateQuests = 0 - AJM:IterateQuests("QuestMapAll_Jamba_ShareNextQuest", 1) + AJM:IterateQuests("ShareNextQuest", 1) end -function AJM.QuestMapAll_Jamba_ShareNextQuest() - +function AJM.ShareNextQuest() local title, isHeader, questID = AJM:GetRelevantQuestInfo(AJM.iterateQuests) - - if isHeader == false and questID ~= 0 then - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_ALL_MESSAGE_ShareAllButton"]( title ), false ) - QuestMapQuestOptions_ShareQuest(questID) - end - - AJM:IterateQuests("QuestMapAll_Jamba_ShareNextQuest", 1) + if GetQuestLogPushable() then + if isHeader == false and questID ~= 0 then + QuestMapQuestOptions_ShareQuest(questID) + end + end + AJM:IterateQuests("ShareNextQuest", 1) end -function AJM.QuestMapAll_Jamba_DoTrackAllQuestsFromAllToons() - AJM:JambaSendCommandToTeam( AJM.COMMAND_TRACK_ALL_QUESTS) + +function AJM:DoTrackAllQuestsFromAllToons() + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Tracking Quest's to All Minions"], false ) + AJM:DoTrackAllQuestsFromThisToon() + AJM:ScheduleTimer("JambaSendCommandToTeam", 1, AJM.COMMAND_TRACK_ALL_QUESTS) end -function AJM.QuestMapAll_Jamba_DoTrackAllQuestsFromThisToon() +function AJM:DoTrackAllQuestsFromThisToon() AJM.iterateQuests = 0 - AJM:IterateQuests("QuestMapAll_Jamba_TrackNextQuest", 0.5) + AJM:IterateQuests("TrackNextQuest", 0.5) end -function AJM.QuestMapAll_Jamba_TrackNextQuest() +function AJM.TrackNextQuest() local title, isHeader, questID = AJM:GetRelevantQuestInfo(AJM.iterateQuests) if isHeader == false and questID ~= 0 then - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_ALL_MESSAGE_TrackAllButton"]( title ), false ) AJM:JambaSendCommandToTeam( AJM.COMMAND_QUEST_TRACK, questID, title, true ) end - AJM:IterateQuests("QuestMapAll_Jamba_TrackNextQuest", 0.5) + AJM:IterateQuests("TrackNextQuest", 0.5) end -function AJM.QuestMapAll_Jamba_DoUnTrackAllQuestsFromThisToon() - AJM.iterateQuests = 0 - AJM:IterateQuests("QuestMapAll_Jamba_UnTrackNextQuest", 0.5) +function AJM:DoUnTrackAllQuestsFromAllToons() + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Untracking Quest's to All Minions"], false ) + AJM:DoUnTrackAllQuestsFromThisToon() + AJM:ScheduleTimer("JambaSendCommandToTeam", 1, AJM.COMMAND_UNTRACK_ALL_QUESTS) end -function AJM.QuestMapAll_Jamba_DoUnTrackAllQuestsFromAllToons() - AJM:JambaSendCommandToTeam( AJM.COMMAND_UNTRACK_ALL_QUESTS) +function AJM:DoUnTrackAllQuestsFromThisToon() + AJM.iterateQuests = 0 + AJM:IterateQuests("UnTrackNextQuest", 0.5) end -function AJM.QuestMapAll_Jamba_UnTrackNextQuest() +function AJM.UnTrackNextQuest() local title, isHeader, questID = AJM:GetRelevantQuestInfo(AJM.iterateQuests) - - if isHeader == false and questID ~= 0 then - - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["JAMBA_QUESTLOG_ALL_MESSAGE_UnTrackAllButton"]( title ), false ) - - AJM:JambaSendCommandToTeam( AJM.COMMAND_QUEST_TRACK, questID, title, false ) - end - - AJM:IterateQuests("QuestMapAll_Jamba_UnTrackNextQuest", 0.5) + if isHeader == false and questID ~= 0 then + AJM:JambaSendCommandToTeam( AJM.COMMAND_QUEST_TRACK, questID, title, false ) + end + AJM:IterateQuests("UnTrackNextQuest", 0.5) end function AJM:IterateQuests(methodToCall, timer) - AJM.iterateQuests = AJM.iterateQuests + 1 - - if AJM.iterateQuests <= GetNumQuestLogEntries() then - AJM:ScheduleTimer( methodToCall, timer ) - end + if AJM.iterateQuests <= GetNumQuestLogEntries() then + AJM:ScheduleTimer( methodToCall, timer ) + end end function AJM:GetRelevantQuestInfo(questLogIndex) - local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle( questLogIndex ) - return title, isHeader, questID end @@ -2161,7 +1989,6 @@ function AJM:ToggleFrame( frame ) end function AJM:ToggleQuestLog() - -- This sorts out hooking on L or marcioMenu button if AJM.db.showJambaQuestLogWithWoWQuestLog == true then if WorldMapFrame:IsVisible() and QuestMapFrame:IsVisible() then @@ -2186,40 +2013,6 @@ function AJM:ToggleShowQuestCommandWindow( show ) end end -function AJM:WORLD_MAP_UPDATE() - JambaHookQuestButtons() -end - -function AJM:ZONE_CHANGED_NEW_AREA() - JambaHookQuestButtons() -end - -function JambaHookQuestButtons() - - for k, v in pairs( QuestMapFrame.QuestsFrame.Contents.Titles ) do - - if AJM:IsHooked(v, "OnClick") then - AJM:Unhook(v, "OnClick") - end - - AJM:RawHookScript(v, "OnClick", "QuestMapLogTitleButton_OnClick") - end -end - -function AJM:QuestMapLogTitleButton_OnClick(frame, button) - - if ( button == "RightButton" ) then - - if ( frame.questID ~= JambaQuestMapQuestOptionsDropDown.questID ) then - CloseDropDownMenus(); - end - - JambaQuestMapQuestOptionsDropDown.questID = frame.questID; - ToggleDropDownMenu(1, nil, JambaQuestMapQuestOptionsDropDown, "cursor", 6, -6); - else - self.hooks[frame].OnClick(frame, button) - end -end ------------------------------------------------------------------------------------------------------------- -- ESCORT QUEST @@ -2293,29 +2086,30 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if commandName == AJM.COMMAND_TOGGLE_AUTO_SELECT then AJM:DoAutoSelectToggle( characterName, ... ) end - -- Want to action track and abandon command on the same character that sent the command. - +-- Want to action track and abandon command on the same character tat sent the command. if commandName == AJM.COMMAND_QUEST_TRACK then AJM:QuestMapQuestOptions_Jamba_DoQuestTrack( characterName, ... ) end if commandName == AJM.COMMAND_ABANDON_QUEST then AJM:QuestMapQuestOptions_Jamba_DoAbandonQuest( characterName, ... ) end + + -- If this character sent this command, don't action it. + if characterName == AJM.characterName then + return + end + if commandName == AJM.COMMAND_ABANDON_ALL_QUESTS then - AJM:QuestMapAll_Jamba_DoAbandonAllQuestsFromThisToon( ) + AJM:DoAbandonAllQuestsFromThisToon() end if commandName == AJM.COMMAND_TRACK_ALL_QUESTS then - AJM:QuestMapAll_Jamba_DoTrackAllQuestsFromThisToon( ) + AJM:DoTrackAllQuestsFromThisToon() end if commandName == AJM.COMMAND_UNTRACK_ALL_QUESTS then - AJM:QuestMapAll_Jamba_DoUnTrackAllQuestsFromThisToon( ) + AJM:DoUnTrackAllQuestsFromThisToon() end - if commandName == AJM.COMMAND_SHARE_ALL_QUESTS then - AJM:QuestMapAll_Jamba_DoShareAllQuestsFromThisToon( ) - end - -- If this character sent this command, don't action it. - if characterName == AJM.characterName then - return + if commandName == AJM.COMMAND_SHARE_ALL_QUESTS then + AJM:DoShareAllQuestsFromThisToon() end if commandName == AJM.COMMAND_ACCEPT_QUEST then AJM:DoAcceptQuest( characterName, ... ) diff --git a/Jamba-Quest/Locales/JambaQuest-Locale-enUS.lua b/Jamba-Quest/Locales/JambaQuest-Locale-enUS.lua index af192dc..b310a4c 100644 --- a/Jamba-Quest/Locales/JambaQuest-Locale-enUS.lua +++ b/Jamba-Quest/Locales/JambaQuest-Locale-enUS.lua @@ -89,6 +89,7 @@ L["Toon Auto Selects Best Reward"] = true L["And Claims It As Well"] = true L["The reward information was not loaded from the server. Close the quest window and open it again."] = true +--[[ L["JAMBA_QUESTLOG_CONTEXT_DROPDOWNTEXT_AbandonAllToons"] = "Jamba Abandon On All Toons" L["JAMBA_QUESTLOG_CONTEXT_DROPDOWNTEXT_TrackAllToons"] = "Jamba Track On All Toons" L["JAMBA_QUESTLOG_CONTEXT_DROPDOWNTEXT_UnTrackAllToons"] = "Jamba UnTrack On All Toons" @@ -131,5 +132,41 @@ end L["JAMBA_QUESTLOG_ALL_MESSAGE_ShareAllButton"] = function( questName ) return string.format( "Sharing quest to all toons: %s", questName ) + +L["JAMBA_QUESTLOG_ALL_MESSAGE_AbandonAllButton"] = function( questName ) + return string.format( "Abandoning quest on all toons: %s", questName ) +end + + +]] +L["JAMBA_QUESTLOG_HaveAbandonedQuest"] = function( questName ) + return string.format( "I have abandoned the quest: %s", questName ) end +L["JAMBA_QUESTLOG_DoNotHaveQuest"] = function( questName ) + return string.format( "I do not have the quest: %s", questName ) +end + + +--JAMBA QUEST 3.0 +L["Would you like to Abandon \"%s\" On All Toons?"] = true +L["Would you like to Track \"%s\" On All Toons?"] = true +L["Would you like to UnTrack \"%s\" On All Toons?"] = true +L["Just Me"] = true +L["All Team"] = true +L["This will abandon ALL quests ON every toon! Yes, this means you will end up with ZERO quests in your quest log! Are you sure?"] = true +L["Untracking Quest's to All Minions"] = true +L["Tracking Quest's to All Minions"] = true +L["Sharing Quest's to All Minions"] = true +L["Abandoning quest's to all toons"] = true +L["Abandon All\nQuests"] = true +L["Aabandon All Quests on all Minions"] = true +L["Untrack All"] = true +L["Untrack All Quests on all Minions"] = true +L["Track All"] = true +L["Track All Quests on all Minions"] = true +L["Share All"] = true +L["share All Quests to all Minions"] = true + + + diff --git a/Jamba-QuestWatcher/Jamba-QuestWatcher.toc b/Jamba-QuestWatcher/Jamba-QuestWatcher.toc index 8e5a312..c3f79e4 100644 --- a/Jamba-QuestWatcher/Jamba-QuestWatcher.toc +++ b/Jamba-QuestWatcher/Jamba-QuestWatcher.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaQuestWatcher ## Notes: JambaQuestWatcher ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-QuestWatcher/JambaQuestWatcher.lua b/Jamba-QuestWatcher/JambaQuestWatcher.lua index 0a5f997..88d5737 100644 --- a/Jamba-QuestWatcher/JambaQuestWatcher.lua +++ b/Jamba-QuestWatcher/JambaQuestWatcher.lua @@ -281,7 +281,7 @@ function AJM:SettingsCreateQuestWatcherControl( top ) movingTop, L["Unlock JoT"], AJM.SettingsToggleUnlockWatcherFrame, - L["Unlocks Jamba Objective Tracker/nTo Move It/nLock to Click Through"] + L["Unlocks Jamba Objective Tracker\n Hold Alt key To Move It\n Lock to Click Through"] ) movingTop = movingTop - checkBoxHeight AJM.settingsControlWatcher.checkBoxHideBlizzardWatchFrame = JambaHelperSettings:CreateCheckBox( @@ -2257,4 +2257,4 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) end -JambaApi.ClearAllQuests = ClearAllQuests +JambaApi.ClearAllQuests = ClearAllQuests \ No newline at end of file diff --git a/Jamba-QuestWatcher/Locales/JambaQuestWatcher-Locale-enUS.lua b/Jamba-QuestWatcher/Locales/JambaQuestWatcher-Locale-enUS.lua index 23a9d06..520d0d2 100644 --- a/Jamba-QuestWatcher/Locales/JambaQuestWatcher-Locale-enUS.lua +++ b/Jamba-QuestWatcher/Locales/JambaQuestWatcher-Locale-enUS.lua @@ -58,7 +58,7 @@ L["Show JoT On Master Only"] = true L["Hide Blizzard's Objectives Tracker"] = true L["Hides Defualt Objective Tracker"] = true L["Unlock JoT"] = true -L["Unlocks Jamba Objective Tracker/nTo Move It/nLock to Click Through"] = true +L["Unlocks Jamba Objective Tracker\n Hold Alt key To Move It\n Lock to Click Through"] = true L["Enable JoT"] = true L["Enables Jamba Objective Tracker"] = true L["Olny show Jamba Objective Tracker On Master Character Olny"] = true diff --git a/Jamba-QuestWatcher/Locales/Locales.xml b/Jamba-QuestWatcher/Locales/Locales.xml index 5a048be..13afb9d 100644 --- a/Jamba-QuestWatcher/Locales/Locales.xml +++ b/Jamba-QuestWatcher/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaQuestWatcher-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Sell/Jamba-Sell.toc b/Jamba-Sell/Jamba-Sell.toc index 2cddcbe..b68ca66 100644 --- a/Jamba-Sell/Jamba-Sell.toc +++ b/Jamba-Sell/Jamba-Sell.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaSell ## Notes: JambaSell ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Sell/JambaSell.lua b/Jamba-Sell/JambaSell.lua index 5408a54..39ff131 100644 --- a/Jamba-Sell/JambaSell.lua +++ b/Jamba-Sell/JambaSell.lua @@ -10,15 +10,17 @@ local AJM = LibStub( "AceAddon-3.0" ):NewAddon( "JambaModule-1.0", "AceConsole-3.0", "AceEvent-3.0", - "AceHook-3.0" + "AceHook-3.0", + "AceTimer-3.0" ) -- Load libraries. local JambaUtilities = LibStub:GetLibrary( "JambaUtilities-1.0" ) local JambaHelperSettings = LibStub:GetLibrary( "JambaHelperSettings-1.0" ) local AceGUI = LibStub:GetLibrary( "AceGUI-3.0" ) +local LibBagUtils = LibStub:GetLibrary( "LibBagUtils-1.0" ) local LibItemUtilsJamba = LibStub:GetLibrary( "LibItemUtilsJamba-1.0" ) -local LibGratuity = LibStub( "LibGratuity-3.0" ) +local ItemUpgradeInfo = LibStub("LibItemUpgradeInfo-1.0") -- Constants and Locale for this module. AJM.moduleName = "Jamba-Sell" @@ -28,19 +30,37 @@ local L = LibStub( "AceLocale-3.0" ):GetLocale( AJM.moduleName ) AJM.parentDisplayName = L["Merchant"] AJM.moduleDisplayName = L["Sell"] + -- Settings - the values to store and their defaults for the settings database. AJM.settings = { profile = { sellItemOnAllWithAltKey = false, - autoSellPoorItems = false, - autoSellPoorItemsHaveExceptions = false, - autoSellPoorItemsExceptionList = {}, + + --TODO REMOVE + -- autoSellPoorItems = false, + -- autoSellPoorItemsHaveExceptions = false, + -- autoSellPoorItemsExceptionList = {}, + + -- Other Items autoSellOtherItems = false, autoSellOtherItemsList = {}, messageArea = JambaApi.DefaultMessageArea(), - autoSellUnusableSoulbound = false, - autoSellUnusableSoulboundLowerTier = false, - autoSellUnusableSoulboundTag = "" + autoSellItem = false, + -- Gray + autoSellPoor = false, + autoSellBoEPoor = false, + -- Green + autoSellUncommon = false, + autoSellIlvlUncommon = 0, + autoSellBoEUncommon = false, + -- Rare + autoSellRare = false, + autoSellIlvlRare = 0, + autoSellBoERare = false, + -- Epic + autoSellEpic = false, + autoSellIlvlEpic = 0, + autoSellBoEEpic = false, }, } @@ -54,16 +74,6 @@ function AJM:GetConfiguration() get = "JambaConfigurationGetSetting", set = "JambaConfigurationSetSetting", args = { - --[[ - popout = { - type = "input", - name = L["PopOut"], - desc = L["Show the sell other settings in their own window."], - usage = "/jamba-sell popout", - get = false, - set = "ShowPopOutWindow", - }, - ]]-- push = { type = "input", name = L["Push Settings"], @@ -94,7 +104,16 @@ AJM.COMMAND_SELL_ITEM = "SellItem" AJM.BAG_PLAYER_BACKPACK = 0 -- NUM_BAG_SLOTS is defined as 4 in Blizzard's FrameXML\BankFrame.lua. AJM.BAG_PLAYER_MAXIMUM = NUM_BAG_SLOTS +-- Store ItemQuality https://wow.gamepedia.com/API_TYPE_Quality AJM.ITEM_QUALITY_POOR = 0 +AJM.ITEM_QUALITY_COMMON = 1 +AJM.ITEM_QUALITY_UNCOMMON = 2 +AJM.ITEM_QUALITY_RARE = 3 +AJM.ITEM_QUALITY_EPIC = 4 +AJM.ITEM_QUALITY_LEGENDARY = 5 +AJM.ITEM_QUALITY_ARTIFACT = 6 +AJM.ITEM_QUALITY_HEIRLOOM = 7 +AJM.MIN_ITEM_LEVEL = 10 function AJM:BeforeJambaProfileChanged() end @@ -106,15 +125,39 @@ end function AJM:SettingsRefresh() -- Sell on all with alt key. AJM.settingsControl.checkBoxSellItemOnAllWithAltKey:SetValue( AJM.db.sellItemOnAllWithAltKey ) - -- Auto sell unusable soulbound items. - AJM.settingsControl.checkBoxAutoSellUnusableSoulboundItems:SetValue( AJM.db.autoSellUnusableSoulbound ) - AJM.settingsControl.checkBoxAutoSellUnusableSoulboundLowerTierItems:SetValue( AJM.db.autoSellUnusableSoulboundLowerTier ) - AJM.settingsControl.editBoxUnusableSoulboundTag:SetText( AJM.db.autoSellUnusableSoulboundTag ) - AJM.settingsControl.checkBoxAutoSellUnusableSoulboundLowerTierItems:SetDisabled( not AJM.db.autoSellUnusableSoulbound ) - AJM.settingsControl.editBoxUnusableSoulboundTag:SetDisabled( not AJM.db.autoSellUnusableSoulbound ) + -- Auto sell Quality and Ilvl items. + AJM.settingsControl.checkBoxAutoSellItems:SetValue( AJM.db.autoSellItem ) + -- Poor + AJM.settingsControl.checkBoxAutoSellPoor:SetValue ( AJM.db.autoSellPoor ) + AJM.settingsControl.checkBoxAutoSellBoEPoor:SetValue ( AJM.db.autoSellBoEPoor ) + AJM.settingsControl.checkBoxAutoSellPoor:SetDisabled ( not AJM.db.autoSellItem ) + AJM.settingsControl.checkBoxAutoSellBoEPoor:SetDisabled ( not AJM.db.autoSellPoor ) + -- Uncommon + AJM.settingsControl.checkBoxAutoSellUncommon:SetValue (AJM.db.autoSellUncommon ) + AJM.settingsControl.editBoxAutoSellIlvlUncommon:SetText (AJM.db.autoSellIlvlUncommon ) + AJM.settingsControl.checkBoxAutoSellBoEUncommon:SetValue (AJM.db.autoSellBoEUncommon ) + AJM.settingsControl.checkBoxAutoSellUncommon:SetDisabled ( not AJM.db.autoSellItem ) + AJM.settingsControl.editBoxAutoSellIlvlUncommon:SetDisabled ( not AJM.db.autoSellUncommon ) + AJM.settingsControl.checkBoxAutoSellBoEUncommon:SetDisabled ( not AJM.db.autoSellUncommon ) + -- Rare + AJM.settingsControl.checkBoxAutoSellRare:SetValue (AJM.db.autoSellRare ) + AJM.settingsControl.editBoxAutoSellIlvlRare:SetText (AJM.db.autoSellIlvlRare ) + AJM.settingsControl.checkBoxAutoSellBoERare:SetValue (AJM.db.autoSellBoERare ) + AJM.settingsControl.checkBoxAutoSellRare:SetDisabled ( not AJM.db.autoSellItem ) + AJM.settingsControl.editBoxAutoSellIlvlRare:SetDisabled ( not AJM.db.autoSellRare ) + AJM.settingsControl.checkBoxAutoSellBoERare:SetDisabled ( not AJM.db.autoSellRare ) + -- Epic + AJM.settingsControl.checkBoxAutoSellEpic:SetValue ( AJM.db.autoSellEpic ) + AJM.settingsControl.editBoxAutoSellIlvlEpic:SetText ( AJM.db.autoSellIlvlEpic) + AJM.settingsControl.checkBoxAutoSellBoEEpic:SetValue ( AJM.db.autoSellBoEEpic ) + AJM.settingsControl.checkBoxAutoSellEpic:SetDisabled ( not AJM.db.autoSellItem ) + AJM.settingsControl.editBoxAutoSellIlvlEpic:SetDisabled ( not AJM.db.autoSellEpic ) + AJM.settingsControl.checkBoxAutoSellBoEEpic:SetDisabled ( not AJM.db.autoSellEpic ) -- Messages. AJM.settingsControl.dropdownMessageArea:SetValue( AJM.db.messageArea ) -- Greys. + +--[[ AJM.settingsControlGreys.checkBoxAutoSellPoorItems:SetValue( AJM.db.autoSellPoorItems ) AJM.settingsControlGreys.checkBoxAutoSellPoorItemsHaveExceptions:SetValue( AJM.db.autoSellPoorItemsHaveExceptions ) AJM.settingsControlGreys.greysEditBoxExceptionTag:SetText( AJM.autoSellPoorItemExceptionTag ) @@ -123,6 +166,7 @@ function AJM:SettingsRefresh() AJM.settingsControlGreys.greysEditBoxExceptionTag:SetDisabled( not AJM.db.autoSellPoorItems or not AJM.db.autoSellPoorItemsHaveExceptions ) AJM.settingsControlGreys.greysButtonRemove:SetDisabled( not AJM.db.autoSellPoorItems or not AJM.db.autoSellPoorItemsHaveExceptions ) AJM.settingsControlGreys.greysButtonAdd:SetDisabled( not AJM.db.autoSellPoorItems or not AJM.db.autoSellPoorItemsHaveExceptions ) +]] -- Others. AJM.settingsControlOthers.checkBoxAutoSellOtherItems:SetValue( AJM.db.autoSellOtherItems ) AJM.settingsControlOthers.othersEditBoxOtherTag:SetText( AJM.autoSellOtherItemTag ) @@ -130,7 +174,7 @@ function AJM:SettingsRefresh() AJM.settingsControlOthers.othersEditBoxOtherTag:SetDisabled( not AJM.db.autoSellOtherItems ) AJM.settingsControlOthers.othersButtonRemove:SetDisabled( not AJM.db.autoSellOtherItems ) AJM.settingsControlOthers.othersButtonAdd:SetDisabled( not AJM.db.autoSellOtherItems ) - AJM:SettingsGreysScrollRefresh() +-- AJM:SettingsGreysScrollRefresh() AJM:SettingsOthersScrollRefresh() end @@ -139,14 +183,23 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) if characterName ~= AJM.characterName then -- Update the settings. AJM.db.sellItemOnAllWithAltKey = settings.sellItemOnAllWithAltKey - AJM.db.autoSellUnusableSoulbound = settings.autoSellUnusableSoulbound - AJM.db.autoSellUnusableSoulboundTag = settings.autoSellUnusableSoulboundTag - AJM.db.autoSellUnusableSoulboundLowerTier = settings.autoSellUnusableSoulboundLowerTier - AJM.db.autoSellPoorItems = settings.autoSellPoorItems - AJM.db.autoSellPoorItemsHaveExceptions = settings.autoSellPoorItemsHaveExceptions + AJM.db.autoSellItem = settings.autoSellItem + AJM.db.autoSellPoor = settings.autoSellPoor + AJM.db.autoSellBoEPoor = settings.autoSellBoEPoor + AJM.db.autoSellUncommon = settings.autoSellUncommon + AJM.db.autoSellIlvlUncommon = settings.autoSellIlvlUncommon + AJM.db.autoSellBoEUncommon = settings.autoSellBoEUncommon + AJM.db.autoSellRare = settings.autoSellRare + AJM.db.autoSellIlvlRare = settings.autoSellIlvlRare + AJM.db.autoSellBoERare = settings.autoSellBoERare + AJM.db.autoSellEpic = settings.autoSellEpic + AJM.db.autoSellIlvlEpic = settings.autoSellIlvlEpic + AJM.db.autoSellBoEEpic = settings.autoSellBoEEpic + -- AJM.db.autoSellPoorItems = settings.autoSellPoorItems + -- AJM.db.autoSellPoorItemsHaveExceptions = settings.autoSellPoorItemsHaveExceptions AJM.db.autoSellOtherItems = settings.autoSellOtherItems AJM.db.messageArea = settings.messageArea - AJM.db.autoSellPoorItemsExceptionList = JambaUtilities:CopyTable( settings.autoSellPoorItemsExceptionList ) +-- AJM.db.autoSellPoorItemsExceptionList = JambaUtilities:CopyTable( settings.autoSellPoorItemsExceptionList ) AJM.db.autoSellOtherItemsList = JambaUtilities:CopyTable( settings.autoSellOtherItemsList ) -- Refresh the settings. AJM:SettingsRefresh() @@ -157,6 +210,7 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) end end + ------------------------------------------------------------------------------------------------------------- -- Settings Dialogs. ------------------------------------------------------------------------------------------------------------- @@ -172,8 +226,12 @@ local function SettingsCreateMain( top ) local headingHeight = JambaHelperSettings:HeadingHeight() local headingWidth = JambaHelperSettings:HeadingWidth( false ) local horizontalSpacing = JambaHelperSettings:GetHorizontalSpacing() + local indent = horizontalSpacing * 12 local verticalSpacing = JambaHelperSettings:GetVerticalSpacing() local halfWidth = (headingWidth - horizontalSpacing) / 2 + local thirdWidth = (headingWidth - (horizontalSpacing * 5)) / 5 + local left2 = left + thirdWidth + local left3 = left + halfWidth local movingTop = top JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Sell Item On All Toons"], movingTop, false ) movingTop = movingTop - headingHeight @@ -186,34 +244,116 @@ local function SettingsCreateMain( top ) AJM.SettingsToggleSellItemOnAllWithAltKey ) movingTop = movingTop - checkBoxHeight - JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Sell Unusable Soulbound Items"], movingTop, false ) + JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Sell Items"], movingTop, false ) + movingTop = movingTop - headingHeight - AJM.settingsControl.checkBoxAutoSellUnusableSoulboundItems = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl.checkBoxAutoSellItems = JambaHelperSettings:CreateCheckBox( AJM.settingsControl, headingWidth, left, movingTop, - L["Automatically Sell Unusable Soulbound Items"], - AJM.SettingsToggleAutoSellUnusableSoulboundItems + L["Automatically Sell Items"], + AJM.SettingsToggleAutoSellItems ) +-- Gray + movingTop = movingTop - checkBoxHeight - 3 + AJM.settingsControl.checkBoxAutoSellPoor = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left, + movingTop, + L["Sell Gray Items"], + AJM.SettingsToggleAutoSellPoor + ) + AJM.settingsControl.checkBoxAutoSellBoEPoor = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left3, + movingTop, + L["Only SoulBound"], + AJM.SettingsToggleAutoSellBoEPoor + ) +-- Green + movingTop = movingTop - checkBoxHeight - 3 + AJM.settingsControl.checkBoxAutoSellUncommon = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left, + movingTop, + L["Sell Green Items"], + AJM.SettingsToggleAutoSellUncommon + ) + AJM.settingsControl.checkBoxAutoSellBoEUncommon = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left3, + movingTop, + L["Only SoulBound"], + AJM.SettingsToggleAutoSellBoEUncommon + ) movingTop = movingTop - checkBoxHeight - AJM.settingsControl.checkBoxAutoSellUnusableSoulboundLowerTierItems = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl.editBoxAutoSellIlvlUncommon = JambaHelperSettings:CreateEditBox( AJM.settingsControl, - headingWidth, - left, - movingTop, - L["And Unusable Lower Tier Armour Soulbound Items"], - AJM.SettingsToggleAutoSellUnusableSoulboundLowerTierItems + thirdWidth, + left, + movingTop, + L["Item Level"] ) + AJM.settingsControl.editBoxAutoSellIlvlUncommon:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedIlvlUncommon ) +-- Rare + movingTop = movingTop - editBoxHeight - 3 + AJM.settingsControl.checkBoxAutoSellRare = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left, + movingTop, + L["Sell Rare Items"], + AJM.SettingsToggleAutoSellRare + ) + AJM.settingsControl.checkBoxAutoSellBoERare = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left3, + movingTop, + L["Only SoulBound"], + AJM.SettingsToggleAutoSellBoERare + ) movingTop = movingTop - checkBoxHeight - AJM.settingsControl.editBoxUnusableSoulboundTag = JambaHelperSettings:CreateEditBox( - AJM.settingsControl, - headingWidth, + AJM.settingsControl.editBoxAutoSellIlvlRare = JambaHelperSettings:CreateEditBox( + AJM.settingsControl, + thirdWidth, + left, + movingTop, + L["Item Level"] + ) + AJM.settingsControl.editBoxAutoSellIlvlRare:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedIlvlRare ) +-- Epic + movingTop = movingTop - editBoxHeight - 3 + AJM.settingsControl.checkBoxAutoSellEpic = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, left, movingTop, - L["On Characters With This Tag"] + L["Sell Epic Items"], + AJM.SettingsToggleAutoSellEpic + ) + AJM.settingsControl.checkBoxAutoSellBoEEpic = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + halfWidth, + left3, + movingTop, + L["Only SoulBound"], + AJM.SettingsToggleAutoSellBoEEpic ) - AJM.settingsControl.editBoxUnusableSoulboundTag:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedUnusableSoulboundTag ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControl.editBoxAutoSellIlvlEpic = JambaHelperSettings:CreateEditBox( + AJM.settingsControl, + thirdWidth, + left, + movingTop, + L["Item Level"] + ) + AJM.settingsControl.editBoxAutoSellIlvlEpic:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedIlvlEpic ) movingTop = movingTop - editBoxHeight JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Sell Messages"], movingTop, false ) movingTop = movingTop - headingHeight @@ -234,6 +374,7 @@ function AJM:OnMessageAreasChanged( message ) AJM.settingsControl.dropdownMessageArea:SetList( JambaApi.MessageAreaList() ) end +--[[ local function SettingsCreateGreys( top ) -- Position and size constants. local buttonControlWidth = 105 @@ -332,6 +473,7 @@ local function SettingsCreateGreys( top ) movingTop = movingTop - buttonHeight return movingTop end +]] local function SettingsCreateOthers( top ) -- Position and size constants. @@ -424,7 +566,7 @@ end local function SettingsCreate() AJM.settingsControl = {} - AJM.settingsControlGreys = {} + --AJM.settingsControlGreys = {} AJM.settingsControlOthers = {} JambaHelperSettings:CreateSettings( AJM.settingsControl, @@ -432,12 +574,12 @@ local function SettingsCreate() AJM.parentDisplayName, AJM.SettingsPushSettingsClick ) - JambaHelperSettings:CreateSettings( - AJM.settingsControlGreys, - L["Sell: Greys"], - AJM.parentDisplayName, - AJM.SettingsPushSettingsClick - ) +-- JambaHelperSettings:CreateSettings( +-- AJM.settingsControlGreys, +-- L["Sell: Greys"], +-- AJM.parentDisplayName, +-- AJM.SettingsPushSettingsClick +-- ) JambaHelperSettings:CreateSettings( AJM.settingsControlOthers, L["Sell: Others"], @@ -446,8 +588,8 @@ local function SettingsCreate() ) local bottomOfSell = SettingsCreateMain( JambaHelperSettings:TopOfSettings() ) AJM.settingsControl.widgetSettings.content:SetHeight( -bottomOfSell ) - local bottomOfGreys = SettingsCreateGreys( JambaHelperSettings:TopOfSettings() ) - AJM.settingsControlGreys.widgetSettings.content:SetHeight( -bottomOfGreys ) +-- local bottomOfGreys = SettingsCreateGreys( JambaHelperSettings:TopOfSettings() ) +-- AJM.settingsControlGreys.widgetSettings.content:SetHeight( -bottomOfGreys ) local bottomOfOthers = SettingsCreateOthers( JambaHelperSettings:TopOfSettings() ) AJM.settingsControlOthers.widgetSettings.content:SetHeight( -bottomOfOthers ) -- Help @@ -459,6 +601,7 @@ end -- Settings Callbacks. ------------------------------------------------------------------------------------------------------------- +--[[ function AJM:SettingsGreysScrollRefresh() FauxScrollFrame_Update( AJM.settingsControlGreys.greys.listScrollFrame, @@ -495,6 +638,8 @@ function AJM:SettingsGreysRowClick( rowNumber, columnNumber ) AJM:SettingsGreysScrollRefresh() end end +]] + function AJM:SettingsOthersScrollRefresh() FauxScrollFrame_Update( @@ -542,21 +687,85 @@ function AJM:SettingsToggleSellItemOnAllWithAltKey( event, checked ) AJM:SettingsRefresh() end -function AJM:SettingsToggleAutoSellUnusableSoulboundItems( event, checked ) - AJM.db.autoSellUnusableSoulbound = checked +--Here + +function AJM:SettingsToggleAutoSellItems( event, checked ) + AJM.db.autoSellItem = checked + AJM:SettingsRefresh() +end + +-- Poor +function AJM:SettingsToggleAutoSellPoor( event, checked ) + AJM.db.autoSellPoor = checked + AJM:SettingsRefresh() +end + + +function AJM:SettingsToggleAutoSellBoEPoor( event, checked ) + AJM.db.autoSellBoEPoor = checked + AJM:SettingsRefresh() +end + +-- Uncommon + +function AJM:SettingsToggleAutoSellUncommon( event, checked ) + AJM.db.autoSellUncommon = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsEditBoxChangedIlvlUncommon( event, text ) + AJM.db.autoSellIlvlUncommon = text + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleAutoSellBoEUncommon( event, checked ) + AJM.db.autoSellBoEUncommon = checked + AJM:SettingsRefresh() +end + +-- Rare + +function AJM:SettingsToggleAutoSellRare( event, checked ) + AJM.db.autoSellRare = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsEditBoxChangedIlvlRare( event, text ) + AJM.db.autoSellIlvlRare = text + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleAutoSellBoERare( event, checked ) + AJM.db.autoSellBoERare = checked + AJM:SettingsRefresh() +end + +-- Epic + +function AJM:SettingsToggleAutoSellEpic( event, checked ) + AJM.db.autoSellEpic = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsEditBoxChangedIlvlEpic( event, text ) + AJM.db.autoSellIlvlEpic = text AJM:SettingsRefresh() end -function AJM:SettingsToggleAutoSellUnusableSoulboundLowerTierItems( event, checked ) - AJM.db.autoSellUnusableSoulboundLowerTier = checked +function AJM:SettingsToggleAutoSellBoEEpic( event, checked ) + AJM.db.autoSellBoEEpic = checked AJM:SettingsRefresh() end + function AJM:SettingsSetMessageArea( event, value ) AJM.db.messageArea = value AJM:SettingsRefresh() end + +--TPDO Remove! +--[[ function AJM:SettingsToggleAutoSellPoorItems( event, checked ) AJM.db.autoSellPoorItems = checked AJM:SettingsRefresh() @@ -593,6 +802,7 @@ function AJM:SettingsGreysAddClick( event ) AJM:SettingsRefresh() end end +]] function AJM:SettingsToggleAutoSellOtherItems( event, checked ) AJM.db.autoSellOtherItems = checked @@ -641,17 +851,17 @@ end -- Initialize Popup Dialogs. local function InitializePopupDialogs() - StaticPopupDialogs["JAMBASELL_CONFIRM_REMOVE_AUTO_SELL_POOR_ITEMS_EXCEPTION"] = { - text = L["Are you sure you wish to remove the selected item from the auto sell poor items exception list?"], - button1 = YES, - button2 = NO, - timeout = 0, - whileDead = 1, - hideOnEscape = 1, - OnAccept = function() - AJM:RemoveGrey() - end, - } +-- StaticPopupDialogs["JAMBASELL_CONFIRM_REMOVE_AUTO_SELL_POOR_ITEMS_EXCEPTION"] = { +-- text = L["Are you sure you wish to remove the selected item from the auto sell poor items exception list?"], +-- button1 = YES, +-- button2 = NO, +-- timeout = 0, +-- whileDead = 1, +-- hideOnEscape = 1, +-- OnAccept = function() +-- AJM:RemoveGrey() +-- end, +-- } StaticPopupDialogs["JAMBASELL_CONFIRM_REMOVE_AUTO_SELL_OTHER_ITEMS"] = { text = L["Are you sure you wish to remove the selected item from the auto sell other items list?"], button1 = YES, @@ -672,32 +882,23 @@ end -- Initialise the module. function AJM:OnInitialize() -- Item link of item to add to auto sell item other / poor exception list. - AJM.autoSellPoorItemExceptionLink = nil +-- AJM.autoSellPoorItemExceptionLink = nil AJM.autoSellOtherItemLink = nil -- The tag to add to the other / poor exception item. - AJM.autoSellPoorItemExceptionTag = JambaApi.AllTag() +-- AJM.autoSellPoorItemExceptionTag = JambaApi.AllTag() AJM.autoSellOtherItemTag = JambaApi.AllTag() + -- Create the settings control. SettingsCreate() -- Initialise the JambaModule part of this module. - AJM:JambaModuleInitialize( AJM.settingsControlGreys.widgetSettings.frame ) +-- AJM:JambaModuleInitialize( AJM.settingsControlGreys.widgetSettings.frame ) + AJM:JambaModuleInitialize( AJM.settingsControl.widgetSettings.frame ) -- Populate the settings. AJM:SettingsRefresh() -- Initialise the popup dialogs. InitializePopupDialogs() -- Hook the item click event. AJM:RawHook( "ContainerFrameItemButton_OnModifiedClick", true ) - --[[ - -- Create a standalone window for the sell others. - AJM.standaloneWindow = AceGUI:Create( "Window" ) - AJM.standaloneWindow:Hide() - AJM.standaloneWindow:SetTitle( "Jamba-Sell" ) - AJM.standaloneWindow:SetLayout( "Fill" ) - AJM.standaloneWindow:AddChild( AJM.settingsControlOthers.widgetSettings ) - AJM.standaloneWindow:SetHeight( 410 ) - AJM.standaloneWindow:SetWidth( 410 ) - AJM.standaloneWindow.frame:SetFrameStrata( "HIGH" ) - ]]-- end -- Called when the addon is enabled. @@ -714,9 +915,9 @@ end -- JambaSell functionality. ------------------------------------------------------------------------------------------------------------- -function AJM:ShowPopOutWindow() +--function AJM:ShowPopOutWindow() --AJM.standaloneWindow:Show() -end +--end -- The ContainerFrameItemButton_OnModifiedClick hook. function AJM:ContainerFrameItemButton_OnModifiedClick( self, event, ... ) @@ -732,7 +933,8 @@ function AJM:DoSellItem( itemlink ) -- Iterate each bag the player has. for bag = AJM.BAG_PLAYER_BACKPACK, AJM.BAG_PLAYER_MAXIMUM do -- Iterate each slot in the bag. - for slot = 1, GetContainerNumSlots( bag ) do + numSlots = GetContainerNumSlots( bag ) + for slot = 1, numSlots do -- Get the item link for the item in this slot. local bagItemLink = GetContainerItemLink( bag, slot ) -- If there is an item... @@ -740,7 +942,9 @@ function AJM:DoSellItem( itemlink ) -- Does it match the item to sell? if JambaUtilities:DoItemLinksContainTheSameItem( bagItemLink, itemlink ) then -- Yes, sell this item. - UseContainerItem( bag, slot ) + if MerchantFrame:IsVisible() == true then + UseContainerItem( bag, slot ) + end -- Tell the boss. AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( bagItemLink ), false ) end @@ -749,6 +953,7 @@ function AJM:DoSellItem( itemlink ) end end +--[[ function AJM:GetGreysMaxPosition() return #AJM.db.autoSellPoorItemsExceptionList end @@ -786,6 +991,7 @@ function AJM:RemoveGrey() AJM:SettingsRefresh() AJM:SettingsGreysRowClick( 1, 1 ) end +]] function AJM:GetOthersMaxPosition() return #AJM.db.autoSellOtherItemsList @@ -817,22 +1023,140 @@ function AJM:RemoveOther() end function AJM:MERCHANT_SHOW() - -- Does the user want to auto sell poor items? - if AJM.db.autoSellPoorItems == true then - AJM:DoMerchantSellPoorItems() + -- Sell Items + if AJM.db.autoSellItem == true then + AJM:DoMerchantSellItems() + end - -- Does the user want to auto sell other items? + -- Sell Other Items if AJM.db.autoSellOtherItems == true then - AJM:DoMerchantSellOtherItems() + AJM:ScheduleTimer( "DoMerchantSellOtherItems", 2 ) end + + -- Does the user want to auto sell poor items? + --if AJM.db.autoSellPoorItems == true then + -- AJM:DoMerchantSellPoorItems() + --end + + -- Does the user want to auto sell other items? -- Does the user want to auto sell unusable soulbound items? - if AJM.db.autoSellUnusableSoulbound == true then - if JambaApi.DoesCharacterHaveTag( AJM.characterName, AJM.db.autoSellUnusableSoulboundTag ) == true then - AJM:DoMerchantSellUnusableSoulbound() +-- if AJM.db.autoSellUnusableSoulbound == true then +-- if JambaApi.DoesCharacterHaveTag( AJM.characterName, AJM.db.autoSellUnusableSoulboundTag ) == true then +-- AJM:DoMerchantSellUnusableSoulbound() +-- end +-- end +end + + +function AJM:DoMerchantSellItems() + local count = 0 + local gold = 0 + for bag,slot,link in LibBagUtils:Iterate("BAGS") do + if bag ~= nil then + if link ~= nil then + local canSell = false + local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, iconFileDataID, itemSellPrice = GetItemInfo( link ) + --AJM:Print("Test", itemLink, itemRarity ) + if AJM.db.autoSellPoor == true then + if itemRarity == AJM.ITEM_QUALITY_POOR then + canSell = true + if AJM.db.autoSellBoEPoor == true then + local isBop = JambaUtilities:ToolTipBagScaner(link, bag, slot) + if isBop ~= ITEM_SOULBOUND then + --AJM:Print("BoE", link ) + canSell = false + end + end + end + end + -- Green + if AJM.db.autoSellUncommon == true then + if itemRarity == AJM.ITEM_QUALITY_UNCOMMON then + if itemType == WEAPON or itemType == ARMOR then + --AJM:Print("testGreen", link, itemRarity, "a", AJM.ITEM_QUALITY_UNCOMMON ) + local num = tonumber( AJM.db.autoSellIlvlUncommon ) + local iLvl = ItemUpgradeInfo:GetUpgradedItemLevel(link) + --AJM:Print("test", iLvl, "vs", num, "item", link ) + if num ~= nil and iLvl ~= nil and (itemLevel > AJM.MIN_ITEM_LEVEL ) then + if iLvl >= num then + canSell = true + end + end + if AJM.db.autoSellBoEUncommon == true then + local isBop = JambaUtilities:ToolTipBagScaner( link,bag,slot ) + --AJM:Print("IsBoP", isBop) + if isBop ~= ITEM_SOULBOUND then + canSell = false + end + end + end + end + end + --Blue + if AJM.db.autoSellRare == true then + if itemRarity == AJM.ITEM_QUALITY_RARE then + if itemType == WEAPON or itemType == ARMOR then + local num = tonumber( AJM.db.autoSellIlvlRare ) + local iLvl = ItemUpgradeInfo:GetUpgradedItemLevel(link) + --AJM:Print("test", iLvl, "vs", num ) + if num ~= nil and iLvl ~= nil and (itemLevel > AJM.MIN_ITEM_LEVEL ) then + if iLvl >= num then + canSell = true + end + end + if AJM.db.autoSellBoERare == true then + local isBop = JambaUtilities:ToolTipBagScaner( link,bag,slot ) + --AJM:Print("IsBoP", isBop) + if isBop ~= ITEM_SOULBOUND then + canSell = false + end + end + end + end + end + -- Epic + if AJM.db.autoSellEpic == true then + if itemRarity == AJM.ITEM_QUALITY_EPIC then + if itemType == WEAPON or itemType == ARMOR then + local num = tonumber( AJM.db.autoSellIlvlEpic ) + local iLvl = ItemUpgradeInfo:GetUpgradedItemLevel(link) + --AJM:Print("test", iLvl, "vs", num ) + if num ~= nil and iLvl ~= nil and (itemLevel > AJM.MIN_ITEM_LEVEL ) then + if iLvl >= num then + canSell = true + end + end + if AJM.db.autoSellBoEEpic == true then + local isBop = JambaUtilities:ToolTipBagScaner( link,bag,slot ) + --AJM:Print("IsBoP", isBop) + if isBop ~= ITEM_SOULBOUND then + canSell = false + end + end + end + end + end + if canSell == true then + if itemSellPrice ~= nil and itemSellPrice > 0 then + if MerchantFrame:IsVisible() == true then + count = count + 1 + gold = gold + itemSellPrice + UseContainerItem( bag, slot ) + end + end + end + end + end end + if count > 0 then + local formattedGoldAmount = GetCoinTextureString(gold) + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X Items And Made:"]( count )..formattedGoldAmount, false ) end end + + +--[[ function AJM:DoMerchantSellUnusableSoulbound() -- Iterate each bag the player has. local localizedClass, fileClass = UnitClass( "player" ) @@ -880,8 +1204,10 @@ function AJM:DoMerchantSellUnusableSoulbound() if compare( itemSubType, canWear["ALL"] ) then if not compare( itemSubType, canWear[fileClass] ) then -- Sell. - UseContainerItem( bag, slot ) - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( itemLink ), false ) + if MerchantFrame:IsVisible() == true then + UseContainerItem( bag, slot ) + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( itemLink ), false ) + end end end end @@ -891,11 +1217,13 @@ function AJM:DoMerchantSellUnusableSoulbound() end end + function AJM:DoMerchantSellPoorItems() -- Iterate each bag the player has. for bag = AJM.BAG_PLAYER_BACKPACK, AJM.BAG_PLAYER_MAXIMUM do -- Iterate each slot in the bag. - for slot = 1, GetContainerNumSlots( bag ) do + local numSlots = GetContainerNumSlots( bag ) + for slot = 1, numSlots do -- Get the item link for the item in this slot. local itemLink = GetContainerItemLink( bag, slot ) -- If there is an item... @@ -929,12 +1257,16 @@ function AJM:SellPoorItemIfNotAnException( itemName, itemLink, bag, slot ) -- Can sell the item? if canSell == true then -- Then use it (effectively selling it as the character is talking to a merchant). - UseContainerItem( bag, slot ) - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( itemLink ), false ) + if MerchantFrame:IsVisible() == true then + UseContainerItem( bag, slot ) + AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( itemLink ), false ) + end else AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["DID NOT SELL: X"]( itemLink ), false ) end end +]] +-- Sell Other Items! function AJM:DoMerchantSellOtherItems() -- Iterate all the wanted items... @@ -953,9 +1285,11 @@ function AJM:DoMerchantSellOtherItems() -- Does it match the item to sell? if JambaUtilities:DoItemLinksContainTheSameItem( bagItemLink, itemInformation.link ) then -- Yes, sell this item. - UseContainerItem( bag, slot ) - -- Tell the boss. - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( bagItemLink ), false ) + if MerchantFrame:IsVisible() == true then + UseContainerItem( bag, slot ) + -- Tell the boss. + --AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["I have sold: X"]( bagItemLink ), false ) + end end end end diff --git a/Jamba-Sell/Locales/JambaSell-Locale-enUS.lua b/Jamba-Sell/Locales/JambaSell-Locale-enUS.lua index 9335066..9b0f83f 100644 --- a/Jamba-Sell/Locales/JambaSell-Locale-enUS.lua +++ b/Jamba-Sell/Locales/JambaSell-Locale-enUS.lua @@ -21,14 +21,18 @@ end L["DID NOT SELL: X"] = function( itemLink ) return string.format( "DID NOT SELL: %s", itemLink ) end +L["I have sold: X Items And Made:"] = function( count ) + return string.format( "I have sold: %s Items And Made: ", count ) +end +L["Items"] = true L["Sell: Others"] = true -L["Sell Greys"] = true +--L["Sell Greys"] = true L["Sell Others"] = true -L["Auto Sell Poor Quality Items"] = true -L["Except For These Poor Quality Items"] = true -L["Add Exception"] = true -L["Exception Item (drag item to box)"] = true -L["Exception Tag"] = true +--L["Auto Sell Poor Quality Items"] = true +--L["Except For These Poor Quality Items"] = true +--L["Add Exception"] = true +--L["Exception Item (drag item to box)"] = true +--L["Exception Tag"] = true L["Remove"] = true L["Add"] = true L["Sell Others"] = true @@ -41,10 +45,21 @@ L["Add Other"] = true L["Sell Messages"] = true L["Sell Item On All Toons"] = true L["Hold Alt While Selling An Item To Sell On All Toons"] = true -L["PopOut"] = true -L["Show the sell other settings in their own window."] = true -L["Sell Unusable Soulbound Items"] = true -L["Automatically Sell Unusable Soulbound Items"] = true -L["On Characters With This Tag"] = true +--L["PopOut"] = true +--L["Show the sell other settings in their own window."] = true +--L["Sell Unusable Soulbound Items"] = true +--L["Automatically Sell Unusable Soulbound Items"] = true +--L["On Characters With This Tag"] = true L["Sell"] = true -L["And Unusable Lower Tier Armour Soulbound Items"] = true +--L["And Unusable Lower Tier Armour Soulbound Items"] = true + +--New Stuff + +L["Automatically Sell Items"] = true +L["Sell Items"] = true +L["Only SoulBound"] = true +L["Item Level"] = true +L["Sell Gray Items"] = true +L["Sell Green Items"] = true +L["Sell Rare Items"] = true +L["Sell Epic Items"] = true diff --git a/Jamba-Talk/Jamba-Talk.toc b/Jamba-Talk/Jamba-Talk.toc index 7d8fd75..d5907de 100644 --- a/Jamba-Talk/Jamba-Talk.toc +++ b/Jamba-Talk/Jamba-Talk.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaTalk ## Notes: JambaTalk ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Talk/JambaTalk.lua b/Jamba-Talk/JambaTalk.lua index eabff5d..da15327 100644 --- a/Jamba-Talk/JambaTalk.lua +++ b/Jamba-Talk/JambaTalk.lua @@ -785,4 +785,4 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if commandName == AJM.COMMAND_MESSAGE then AJM:ProcessReceivedMessage( characterName, ... ) end -end +end \ No newline at end of file diff --git a/Jamba-Talk/Locales/Locales.xml b/Jamba-Talk/Locales/Locales.xml index df18854..0b257ac 100644 --- a/Jamba-Talk/Locales/Locales.xml +++ b/Jamba-Talk/Locales/Locales.xml @@ -6,4 +6,4 @@ License: The MIT License <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd" xmlns="http://www.blizzard.com/wow/ui/"> <Script file="JambaTalk-Locale-enUS.lua" /> -</Ui> +</Ui> \ No newline at end of file diff --git a/Jamba-Taxi/Jamba-Taxi.toc b/Jamba-Taxi/Jamba-Taxi.toc index 9a49185..a153f44 100644 --- a/Jamba-Taxi/Jamba-Taxi.toc +++ b/Jamba-Taxi/Jamba-Taxi.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: Jamba-Taxi ## Notes: Jamba-Taxi ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Taxi/JambaTaxi.lua b/Jamba-Taxi/JambaTaxi.lua index b52d5c1..086a451 100644 --- a/Jamba-Taxi/JambaTaxi.lua +++ b/Jamba-Taxi/JambaTaxi.lua @@ -31,7 +31,7 @@ AJM.settings = { profile = { takeMastersTaxi = true, requestTaxiStop = true, - changeTexiTime = 5, + changeTexiTime = 2, messageArea = JambaApi.DefaultMessageArea(), }, } @@ -67,6 +67,7 @@ end AJM.COMMAND_TAKE_TAXI = "JambaTaxiTakeTaxi" AJM.COMMAND_EXIT_TAXI = "JambaTaxiExitTaxi" +AJM.COMMAND_CLOSE_TAXI = "JambaCloseTaxi" ------------------------------------------------------------------------------------------------------------- -- Messages module sends. @@ -96,6 +97,8 @@ function AJM:OnEnable() -- Hook the TaketaxiNode function. AJM:SecureHook( "TakeTaxiNode" ) AJM:SecureHook( "TaxiRequestEarlyLanding" ) + -- WoW API Events. + AJM:RegisterEvent("TAXIMAP_CLOSED") AJM:RegisterMessage( JambaApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) end @@ -166,7 +169,7 @@ function AJM:SettingsCreateTaxi( top ) movingTop, L["Clones To Take Taxi After Master"] ) - AJM.settingsControl.changeTexiTime:SetSliderValues( 0, 10, 1 ) + AJM.settingsControl.changeTexiTime:SetSliderValues( 0, 5, 0.5 ) AJM.settingsControl.changeTexiTime:SetCallback( "OnValueChanged", AJM.SettingsChangeTaxiTimer ) --movingTop = movingTop - halfWidthSlider @@ -284,7 +287,6 @@ function AJM.TakeTimedTaxi( event, nodeIndex, ...) end end - -- Called after the character has just taken a flight (hooked function). function AJM:TakeTaxiNode( taxiNodeIndex ) -- If the take masters taxi option is on. @@ -298,7 +300,7 @@ function AJM:TakeTaxiNode( taxiNodeIndex ) AJM.jambaTakesTaxi = false end end --- exit taxi with team ebony + local function LeaveTaxi ( sender ) if AJM.db.requestTaxiStop == true then if sender ~= AJM.characterName then @@ -309,10 +311,9 @@ local function LeaveTaxi ( sender ) end end - - function AJM.TaxiRequestEarlyLanding( sender ) -- If the take masters taxi option is on. + --AJM:Print("test") if AJM.db.requestTaxiStop == true then if UnitOnTaxi( "player" ) and CanExitVehicle() == true then if AJM.jambaLeavsTaxi == false then @@ -323,6 +324,21 @@ function AJM.TaxiRequestEarlyLanding( sender ) AJM.jambaLeavsTaxi = false end end + +function AJM:TAXIMAP_CLOSED( event, ... ) + --AJM:Print("closeTaxiTwo", AJM.jambaTakesTaxi ) + if TaxiFrame_ShouldShowOldStyle() or FlightMapFrame:IsVisible() then + AJM:JambaSendCommandToTeam ( AJM.COMMAND_CLOSE_TAXI ) + end +end + + +local function CloseTaxiMapFrame() + if AJM.jambaTakesTaxi == false then + CloseTaxiMap() + end +end + -- A Jamba command has been received. function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if characterName ~= self.characterName then @@ -348,6 +364,9 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) LeaveTaxi ( characterName, ... ) end end + if commandName == AJM.COMMAND_CLOSE_TAXI then + CloseTaxiMapFrame() + end end end diff --git a/Jamba-Toon/Jamba-Toon.toc b/Jamba-Toon/Jamba-Toon.toc index eddd88b..8028fb0 100644 --- a/Jamba-Toon/Jamba-Toon.toc +++ b/Jamba-Toon/Jamba-Toon.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaToon ## Notes: JambaToon ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Toon/JambaToon.lua b/Jamba-Toon/JambaToon.lua index aa87d0d..715f350 100644 --- a/Jamba-Toon/JambaToon.lua +++ b/Jamba-Toon/JambaToon.lua @@ -10,6 +10,7 @@ local AJM = LibStub( "AceAddon-3.0" ):NewAddon( "JambaModule-1.0", "AceConsole-3.0", "AceEvent-3.0", + "AceHook-3.0", "AceTimer-3.0" ) @@ -17,6 +18,7 @@ local AJM = LibStub( "AceAddon-3.0" ):NewAddon( local JambaUtilities = LibStub:GetLibrary( "JambaUtilities-1.0" ) local JambaHelperSettings = LibStub:GetLibrary( "JambaHelperSettings-1.0" ) local LibBagUtils = LibStub:GetLibrary( "LibBagUtils-1.0" ) +--local LibCache = LibStub('LibItemCache-1.1') AJM.SharedMedia = LibStub( "LibSharedMedia-3.0" ) -- Constants and Locale for this module. @@ -59,8 +61,13 @@ AJM.settings = { autoRepair = true, autoRepairUseGuildFunds = true, merchantArea = JambaApi.DefaultMessageArea(), - warnAfk = true, - afkMessage = L["I am inactive!"], + autoAcceptRoleCheck = false, + enterLFGWithTeam = false, + acceptReadyCheck = false, + teleportLFGWithTeam = false, + rollWithTeam = false, + --Debug Suff + testAlwaysOff = true }, } @@ -95,7 +102,10 @@ end AJM.COMMAND_TEAM_DEATH = "JambaToonTeamDeath" AJM.COMMAND_RECOVER_TEAM = "JambaToonRecoverTeam" AJM.COMMAND_SOUL_STONE = "JambaToonSoulStone" - +AJM.COMMAND_READY_CHECK = "JambaReadyCheck" +AJM.COMMAND_TELE_PORT = "Jambateleport" +AJM.COMMAND_LOOT_ROLL = "JamabaLootRoll" +AJM.COMMAND_CHECK_BAGS = "jambaCheckBags" ------------------------------------------------------------------------------------------------------------- -- Messages module sends. @@ -105,6 +115,9 @@ AJM.COMMAND_SOUL_STONE = "JambaToonSoulStone" -- Variables used by module. ------------------------------------------------------------------------------------------------------------- +AJM.sharedInvData = {} + + ------------------------------------------------------------------------------------------------------------- -- Settings Dialogs. ------------------------------------------------------------------------------------------------------------- @@ -229,8 +242,7 @@ local function SettingsCreateRequests( top ) L["Display Team Release Prompts"], AJM.SettingsToggleAcceptDeathRequests, L["Display Team Release Popup Displays when the Team Dies"] - ) - + ) movingTop = movingTop - checkBoxHeight AJM.settingsControlRequests.checkBoxAutoAcceptSummonRequest = JambaHelperSettings:CreateCheckBox( AJM.settingsControlRequests, @@ -242,17 +254,59 @@ local function SettingsCreateRequests( top ) L["Automatically Accept Summon Requests"] ) movingTop = movingTop - checkBoxHeight - AJM.settingsControlRequests.dropdownRequestArea = JambaHelperSettings:CreateDropdown( + -- Ebony Group Stuff + JambaHelperSettings:CreateHeading( AJM.settingsControlRequests, L["Raid/Party Tools."], movingTop, false ) + movingTop = movingTop - headingHeight + AJM.settingsControlRequests.checkBoxAutoRoleCheck = JambaHelperSettings:CreateCheckBox( AJM.settingsControlRequests, headingWidth, left, movingTop, + L["Auto Accept Role Checks"], + AJM.SettingsToggleAutoRoleCheck, + L["Automatically Accept Role Checks \n\nIf a role is already set.."] + ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControlRequests.checkBoxAcceptReadyCheck = JambaHelperSettings:CreateCheckBox( + AJM.settingsControlRequests, + headingWidth, + left, + movingTop, + L["Accept Ready Checks With Team"], + AJM.SettingsToggleAcceptReadyCheck, + L["Accept Ready Checks With Team \n\nIf Team Member is the one that does the ready check it is Auto."] + ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControlRequests.checkBoxLFGTeleport = JambaHelperSettings:CreateCheckBox( + AJM.settingsControlRequests, + headingWidth, + left, + movingTop, + L["LFG Teleport With Team"], + AJM.SettingsToggleLFGTeleport, + L["Teleport With Team Members LFG"] + ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControlRequests.checkBoxLootWithTeam = JambaHelperSettings:CreateCheckBox( + AJM.settingsControlRequests, + headingWidth, + left, + movingTop, + L["Roll Loot With Team"], + AJM.SettingsToggleLootWithTeam, + L["Roll Loot With the Team"] + ) + movingTop = movingTop - dropdownHeight - verticalSpacing + AJM.settingsControlRequests.dropdownRequestArea = JambaHelperSettings:CreateDropdown( + AJM.settingsControlRequests, + headingWidth, + left, + movingTop, L["Send Request Message Area"] , L["Pick a Message Area"] ) AJM.settingsControlRequests.dropdownRequestArea:SetList( JambaApi.MessageAreaList() ) AJM.settingsControlRequests.dropdownRequestArea:SetCallback( "OnValueChanged", AJM.SettingsSetRequestArea ) - movingTop = movingTop - dropdownHeight - verticalSpacing return movingTop end @@ -403,27 +457,8 @@ local function SettingsCreateWarnings( top ) ) AJM.settingsControlWarnings.editBoxBagsFullMessage:SetCallback( "OnEnterPressed", AJM.EditBoxChangedBagsFullMessage ) movingTop = movingTop - editBoxHeight - JambaHelperSettings:CreateHeading( AJM.settingsControlWarnings, L["Inactive"], movingTop, true ) + JambaHelperSettings:CreateHeading( AJM.settingsControlWarnings, L["Other"], movingTop, true ) movingTop = movingTop - headingHeight - AJM.settingsControlWarnings.checkBoxWarnAfk = JambaHelperSettings:CreateCheckBox( - AJM.settingsControlWarnings, - headingWidth, - left, - movingTop, - L["Warn If Toon Goes Inactive"], - AJM.SettingsToggleWarnAfk, - L["Warn If Toon Goes Inactive mosty for PVP"] - ) - movingTop = movingTop - checkBoxHeight - AJM.settingsControlWarnings.editBoxAfkMessage = JambaHelperSettings:CreateEditBox( AJM.settingsControlWarnings, - headingWidth, - left, - movingTop, - L["Inactive Message"] - ) - AJM.settingsControlWarnings.editBoxAfkMessage:SetCallback( "OnEnterPressed", AJM.EditBoxChangedAfkMessage ) - movingTop = movingTop - editBoxHeight - -- Ebony CC AJM.settingsControlWarnings.checkBoxWarnCC = JambaHelperSettings:CreateCheckBox( AJM.settingsControlWarnings, headingWidth, @@ -514,8 +549,6 @@ function AJM:SettingsRefresh() AJM.settingsControlWarnings.editBoxWarnManaDropsMessage:SetText( AJM.db.warnManaDropsMessage ) AJM.settingsControlWarnings.checkBoxWarnBagsFull:SetValue( AJM.db.warnBagsFull ) AJM.settingsControlWarnings.editBoxBagsFullMessage:SetText( AJM.db.bagsFullMessage ) - AJM.settingsControlWarnings.checkBoxWarnAfk:SetValue( AJM.db.warnAfk ) - AJM.settingsControlWarnings.editBoxAfkMessage:SetText( AJM.db.afkMessage ) AJM.settingsControlWarnings.checkBoxWarnCC:SetValue( AJM.db.warnCC ) AJM.settingsControlWarnings.editBoxCCMessage:SetText( AJM.db.CcMessage ) AJM.settingsControlWarnings.dropdownWarningArea:SetValue( AJM.db.warningArea ) @@ -524,10 +557,15 @@ function AJM:SettingsRefresh() AJM.settingsControlRequests.checkBoxAutoDenyDuels:SetValue( AJM.db.autoDenyDuels ) AJM.settingsControlRequests.checkBoxAutoAcceptSummonRequest:SetValue( AJM.db.autoAcceptSummonRequest ) AJM.settingsControlRequests.checkBoxAutoDenyGuildInvites:SetValue( AJM.db.autoDenyGuildInvites ) + AJM.settingsControlRequests.checkBoxAutoRoleCheck:SetValue( AJM.db.autoAcceptRoleCheck ) + AJM.settingsControlRequests.checkBoxAcceptReadyCheck:SetValue( AJM.db.acceptReadyCheck ) + AJM.settingsControlRequests.checkBoxLFGTeleport:SetValue( AJM.db.teleportLFGWithTeam ) + AJM.settingsControlRequests.checkBoxLootWithTeam:SetValue( AJM.db.rollWithTeam ) AJM.settingsControlRequests.dropdownRequestArea:SetValue( AJM.db.requestArea ) AJM.settingsControlMerchant.checkBoxAutoRepair:SetValue( AJM.db.autoRepair ) AJM.settingsControlMerchant.checkBoxAutoRepairUseGuildFunds:SetValue( AJM.db.autoRepairUseGuildFunds ) AJM.settingsControlMerchant.dropdownMerchantArea:SetValue( AJM.db.merchantArea ) + AJM.settingsControlWarnings.editBoxHitFirstTimeMessage:SetDisabled( not AJM.db.warnHitFirstTimeCombat ) AJM.settingsControlWarnings.editBoxWarnTargetNotMasterMessage:SetDisabled( not AJM.db.warnTargetNotMasterEnterCombat ) AJM.settingsControlWarnings.editBoxWarnFocusNotMasterMessage:SetDisabled( not AJM.db.warnFocusNotMasterEnterCombat ) @@ -537,7 +575,6 @@ function AJM:SettingsRefresh() AJM.settingsControlWarnings.editBoxWarnManaDropsMessage:SetDisabled( not AJM.db.warnWhenManaDropsBelowX ) AJM.settingsControlMerchant.checkBoxAutoRepairUseGuildFunds:SetDisabled( not AJM.db.autoRepair ) AJM.settingsControlWarnings.editBoxBagsFullMessage:SetDisabled( not AJM.db.warnBagsFull ) - AJM.settingsControlWarnings.editBoxAfkMessage:SetDisabled( not AJM.db.warnAfk ) AJM.settingsControlWarnings.editBoxCCMessage:SetDisabled( not AJM.db.warnCC ) end @@ -559,10 +596,12 @@ function AJM:SettingsToggleAutoDenyDuels( event, checked ) AJM.db.autoDenyDuels = checked AJM:SettingsRefresh() end + function AJM:SettingsToggleAutoAcceptSummonRequest( event, checked ) AJM.db.autoAcceptSummonRequest = checked AJM:SettingsRefresh() end + function AJM:SettingsToggleAutoDenyGuildInvites( event, checked ) AJM.db.autoDenyGuildInvites = checked AJM:SettingsRefresh() @@ -573,12 +612,32 @@ function AJM:SettingsToggleAutoAcceptResurrectRequests( event, checked ) AJM:SettingsRefresh() end - function AJM:SettingsToggleAcceptDeathRequests( event, checked ) AJM.db.acceptDeathRequests = checked AJM:SettingsRefresh() end +function AJM:SettingsToggleAutoRoleCheck( event, checked ) + AJM.db.autoAcceptRoleCheck = checked + AJM:SettingsRefresh() +end + + +function AJM:SettingsToggleAcceptReadyCheck( event, checked ) + AJM.db.acceptReadyCheck = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleLFGTeleport( event, checked ) + AJM.db.teleportLFGWithTeam = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleLootWithTeam( event, checked ) + AJM.db.rollWithTeam = checked + AJM:SettingsRefresh() +end + function AJM:SettingsToggleWarnHitFirstTimeCombat( event, checked ) AJM.db.warnHitFirstTimeCombat = checked AJM:SettingsRefresh() @@ -599,16 +658,6 @@ function AJM:EditBoxChangedBagsFullMessage( event, text ) AJM:SettingsRefresh() end -function AJM:SettingsToggleWarnAfk( event, checked ) - AJM.db.warnAfk = checked - AJM:SettingsRefresh() -end - -function AJM:EditBoxChangedAfkMessage( event, text ) - AJM.db.afkMessage = text - AJM:SettingsRefresh() -end - function AJM:SettingsToggleWarnCC( event, checked ) AJM.db.warnCC = checked AJM:SettingsRefresh() @@ -708,17 +757,21 @@ function AJM:OnInitialize() AJM.haveBeenHit = false -- Bags full changed count. AJM.previousFreeBagSlotsCount = -1 + --Start-DB for items. + --AJM:scanBagsForItems() + AJM:AddDummyItem() end -- Called when the addon is enabled. function AJM:OnEnable() + AJM.isInternalCommand = false -- WoW events. AJM:RegisterEvent( "UNIT_COMBAT" ) AJM:RegisterEvent( "PLAYER_REGEN_DISABLED" ) AJM:RegisterEvent( "PLAYER_REGEN_ENABLED" ) AJM:RegisterEvent( "UNIT_HEALTH" ) AJM:RegisterEvent( "MERCHANT_SHOW" ) - AJM:RegisterEvent( "UNIT_MANA" ) + AJM:RegisterEvent( "UNIT_POWER_FREQUENT" ) AJM:RegisterEvent( "RESURRECT_REQUEST" ) AJM:RegisterEvent( "PLAYER_DEAD" ) AJM:RegisterEvent( "CORPSE_IN_RANGE" ) @@ -730,14 +783,22 @@ function AJM:OnEnable() AJM:RegisterEvent( "DUEL_REQUESTED" ) AJM:RegisterEvent( "GUILD_INVITE_REQUEST" ) AJM:RegisterEvent( "ITEM_PUSH" ) - --test - --AJM:RegisterEvent("LOSS_OF_CONTROL_UPDATE") + AJM:RegisterEvent( "LFG_ROLE_CHECK_SHOW" ) + AJM:RegisterEvent( "READY_CHECK" ) AJM:RegisterEvent("LOSS_OF_CONTROL_ADDED") AJM:RegisterEvent( "UI_ERROR_MESSAGE", "ITEM_PUSH" ) - AJM:RegisterEvent( "UNIT_AURA" ) +-- Fail stuff?? +-- AJM:RegisterEvent( "BAG_UPDATE_DELAYED" ) AJM:RegisterMessage( JambaApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) - AJM:RegisterMessage( JambaApi.MESSAGE_CHARACTER_ONLINE, "OnCharactersChanged" ) + AJM:RegisterMessage( JambaApi.MESSAGE_CHARACTER_ONLINE, "OnCharactersChanged" ) AJM:RegisterMessage( JambaApi.MESSAGE_CHARACTER_OFFLINE, "OnCharactersChanged" ) + -- Ace Hooks + AJM:SecureHook( "ConfirmReadyCheck" ) + AJM:SecureHook( "LFGTeleport" ) + AJM:SecureHook( "RollOnLoot" ) + +-- fail tooltip scan keep for now +-- AJM:SecureHook( GameTooltip , "SetBagItem", "AddTooltipInfo" ) end -- Called when the addon is disabled. @@ -762,16 +823,18 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM.db.warnManaDropsMessage = settings.warnManaDropsMessage AJM.db.warnBagsFull = settings.warnBagsFull AJM.db.bagsFullMessage = settings.bagsFullMessage - AJM.db.warnAfk = settings.warnAfk - AJM.db.afkMessage = settings.afkMessage AJM.db.warnCC = settings.warnCC AJM.db.CcMessage = settings.CcMessage AJM.db.autoAcceptResurrectRequest = settings.autoAcceptResurrectRequest AJM.db.acceptDeathRequests = settings.acceptDeathRequests AJM.db.autoDenyDuels = settings.autoDenyDuels - --ebonnysum AJM.db.autoAcceptSummonRequest = settings.autoAcceptSummonRequest AJM.db.autoDenyGuildInvites = settings.autoDenyGuildInvites + AJM.db.autoAcceptRoleCheck = settings.autoAcceptRoleCheck + AJM.db.enterLFGWithTeam = settings.enterLFGWithTeam + AJM.db.acceptReadyCheck = settings.acceptReadyCheck + AJM.db.teleportLFGWithTeam = settings.teleportLFGWithTeam + AJM.db.rollWithTeam = settings.rollWithTeam AJM.db.autoRepair = settings.autoRepair AJM.db.autoRepairUseGuildFunds = settings.autoRepairUseGuildFunds AJM.db.warningArea = settings.warningArea @@ -781,8 +844,6 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM:SettingsRefresh() -- Tell the player. AJM:Print( L["Settings received from A."]( characterName ) ) - -- Tell the team? - --AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Settings received from A."]( characterName ), false ) end end @@ -860,8 +921,8 @@ function AJM:PLAYER_DEAD( event, ...) StaticPopup_Show( "TEAMDEATH" ) end end --- Mosty taken from blizzard StaticPopup Code +-- Mosty taken from blizzard StaticPopup Code StaticPopupDialogs["TEAMDEATH"] = { --local resTime = GetReleaseTimeRemaining(), text = L["Release Team?"], --..resTime, @@ -1017,7 +1078,108 @@ function AJM:RESURRECT_REQUEST( event, ... ) end end --- EbonySum Accepts summons +--LFG stuff + +function AJM:READY_CHECK( event, name, ... ) + -- Auto do Ready Check if team member is the one that does the readycheck + if AJM.db.acceptReadyCheck == true then + --AJM:Print("readyCheck", name ) + for index, characterName in JambaApi.TeamListOrderedOnline() do + if name == Ambiguate( characterName, "none") then + AJM.isInternalCommand = ture + --AJM:Print("found in team", characterName) + if ReadyCheckFrame:IsShown() == true then + --AJM:Print("Ok?") + ConfirmReadyCheck(1) + ReadyCheckFrame:Hide() + end + AJM.isInternalCommand = false + end + end + end +end + + +function AJM:ConfirmReadyCheck( ready ) + --AJM:Print("Test", ready ) + if AJM.db.acceptReadyCheck == true then + if AJM.isInternalCommand == false then + AJM:JambaSendCommandToTeam( AJM.COMMAND_READY_CHECK, ready) + end + end +end + +function AJM:AmReadyCheck( ready ) + --AJM:Print("AmReady!", ready ) + AJM.isInternalCommand = true + if ready == 1 then + ConfirmReadyCheck(1) + ReadyCheckFrame:Hide() + else + ConfirmReadyCheck() + ReadyCheckFrame:Hide() + end + AJM.isInternalCommand = false +end + +function AJM:LFGTeleport( event, arg1, ... ) + --AJM:Print("LFGtest") + if AJM.db.teleportLFGWithTeam == true then + if IsShiftKeyDown() == false then + if AJM.isInternalCommand == false then + if IsInLFGDungeon() == true then + AJM:JambaSendCommandToTeam( AJM.COMMAND_TELE_PORT, true ) + else + AJM:JambaSendCommandToTeam( AJM.COMMAND_TELE_PORT, false ) + end + end + end + end +end + +function AJM:DoLFGTeleport(port) + --AJM:Print("TeleCommand", port) + AJM.isInternalCommand = true + if IsShiftKeyDown() == false then + if port == true then + --AJM:Print("yestel") + LFGTeleport(1) + else + --AJM:Print("notel") + LFGTeleport() + end + end + AJM.isInternalCommand = false +end + +function AJM:LFG_ROLE_CHECK_SHOW( event, ... ) + if AJM.db.autoAcceptRoleCheck == true then + --AJM:Print("testPopup?") + CompleteLFGRoleCheck("ture") + end +end + +function AJM:RollOnLoot(id, rollType, ...) + --AJM:Print("lootTest", id, rollType) + local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo( id ) + --AJM:Print("lootItemTest", name) + if AJM.db.rollWithTeam == true then + if IsShiftKeyDown() == false then + if AJM.isInternalCommand == false then + AJM:JambaSendCommandToTeam( AJM.COMMAND_LOOT_ROLL, id, rollType, name) + end + end + end +end + +function AJM:DoLootRoll( id, rollType, name ) + --AJM:Print("i have a command to roll on item", name) + AJM.isInternalCommand = true + if name ~= nil then + RollOnLoot(id, rollType) + end + AJM.isInternalCommand = false +end function AJM:CONFIRM_SUMMON( event, sender, location, ... ) local sender, location = GetSummonConfirmSummoner(), GetSummonConfirmAreaName() @@ -1075,18 +1237,17 @@ function AJM:MERCHANT_SHOW( event, ... ) end end -function AJM:UNIT_MANA( event, unitAffected, ... ) +function AJM:UNIT_POWER_FREQUENT( event, unitAffected, power, ... ) if AJM.db.warnWhenManaDropsBelowX == false then return end if unitAffected ~= "player" then return end - local powerType, powerTypeString = UnitPowerType( "player" ) - if powerTypeString ~= "MANA" then + if power ~= "MANA" then return - end - local currentMana = (UnitMana( "player" ) / UnitManaMax( "player" ) * 100) + end + local currentMana = (UnitPower( "player", 0 ) / UnitPowerMax( "player", 0 ) * 100) if AJM.toldMasterAboutMana == true then if currentMana >= tonumber( AJM.db.warnWhenManaDropsAmount ) then AJM.toldMasterAboutMana = false @@ -1163,15 +1324,6 @@ function AJM:ITEM_PUSH( event, ... ) end end - -function AJM:UNIT_AURA( event, ... ) - if AJM.db.warnAfk == true then - if JambaUtilities:DoesThisCharacterHaveBuff( L["Inactive"] ) == true then - AJM:JambaSendMessageToTeam( AJM.db.warningArea, AJM.db.afkMessage, false ) - end - end -end - --Ebony CCed function AJM:LOSS_OF_CONTROL_ADDED( event, ... ) if AJM.db.warnCC == true then @@ -1184,6 +1336,124 @@ function AJM:LOSS_OF_CONTROL_ADDED( event, ... ) end end + +---------------------------------------------------------------------------------------------------------------- +--Most of this is Jamba-Bag sutff that needs to be here for my notes. Ebony! + +function AJM:AddDummyItem() + JambaUtilities:ClearTable( AJM.sharedInvData ) + itemInformation = {} + itemInformation.characterName = "ebonyOwns" + itemInformation.name = "DummyTestItem" + itemInformation.count = "0" + itemInformation.itemId = "71142" + table.insert( AJM.sharedInvData, itemInformation ) +end + + +function AJM:AddTooltipInfo( toolTip ) + --AJM:Print("test") + local name, link = toolTip:GetItem() + local itemName, characterName, itemCount = AJM:AddToTooltip(link ) + AJM:AddToTooltip(toolTip, link) + +-- local totalCount = 0 +-- if itemName ~= nil then +-- toolTip:AddLine(" ") +-- toolTip:AddLine(L["Jamba Inventory"], 1, 0.82, 0, 1) +-- toolTip:AddDoubleLine(Ambiguate(characterName, "none"), L["Bags"]..L[" "]..itemCount, 1,1,1,1,1,1) +-- totalCount = totalCount + itemCount +-- end +-- if totalCount > 1 then +-- toolTip:AddDoubleLine("Total", totalCount, 1,0,0,1,1,1) +-- end + toolTip:Show() +end + +function AJM:AddToTooltip(toolTip, link) + local totalCount = 0 + if link ~= nil then + toolTip:AddLine(" ") + toolTip:AddLine(L["Jamba Bags"], 1, 0.82, 0, 1) + for id, item in pairs( AJM.sharedInvData ) do + --AJM:Print("Checking", item.name, link, item.count) + local itemId = JambaUtilities:GetItemIdFromItemLink( link ) + --AJM:Print("Checking", item.itemId, itemId, item.characterName ) + if itemId == item.itemId then + --AJM:Print("found8", item.name, item.characterName, item.count) + toolTip:AddDoubleLine(Ambiguate(item.characterName, "none"), L["Bags"]..L[" "]..item.count, 1,1,1,1,1,1) + totalCount = totalCount + item.count + end + end + end + if totalCount > 1 then + toolTip:AddLine(" ") + toolTip:AddDoubleLine("Total", totalCount, 1,0.82,0,1,1,1,1) + end +end + + +function AJM:BAG_UPDATE_DELAYED(event, ... ) + for bagID = 0, NUM_BAG_SLOTS do + for slot = 1, GetContainerNumSlots(bagID) do + --if slot ~= nil then + local itemLink = GetContainerItemLink(bagID, slot) + if itemLink ~= nil then + --AJM:Print("test1212", itemLink) + local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemLink) + local itemId = JambaUtilities:GetItemIdFromItemLink( itemLink ) + --AJM:Print("ItemNotInList", link) + --We olny want to check items with a count. EG- (mats etc.) + if maxStack ~= nil then + if maxStack > 1 then + local countBags = GetItemCount(link) + AJM:JambaSendCommandToTeam( AJM.COMMAND_CHECK_BAGS, link, countBags, itemId ) + else + local countBags = GetItemCount(link) + --AJM:Print("NonStackeditems", link, countBags, itemId) + AJM:JambaSendCommandToTeam( AJM.COMMAND_CHECK_BAGS, link, countBags, itemId ) + end + end + end + end + end +end + +function AJM:addItemIfNotExists( itemLink, countBags, characterName ) + local IfNotExists = false + for id, item in pairs( AJM.sharedInvData ) do + --AJM:Print("test132", item.name, itemLink ) + if item.itemId == itemLink and characterName == item.characterName then + --AJM:Print("found!", item.name, characterName) + IfNotExists = true + --If Count Has changed we need to update the text! + if item.count ~= countBags and item.characterName == characterName then + --AJM:Print("IDRemovTest", id) + AJM.sharedInvData[id] = nil + IfNotExists = false + end + break + else + IfNotExists = false + end + end + return IfNotExists +end + + + +function AJM:ReceivedCheckBags( characterName, item, count, itemId ) + --AJM:Print("itemTest.", characterName, item, count, itemId ) + itemInformation = {} + itemInformation.characterName = characterName + itemInformation.name = item + itemInformation.count = count + itemInformation.itemId = itemId + if AJM:addItemIfNotExists( itemId, count, characterName ) == false then + table.insert( AJM.sharedInvData, itemInformation ) + end +end + -- A Jamba command has been received. function AJM:JambaOnCommandReceived( characterName, commandName, ... ) --AJM:Print("Test", characterName, commandName) @@ -1196,4 +1466,22 @@ function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if commandName == AJM.COMMAND_SOUL_STONE then AJM:doSoulStone() end + if commandName == AJM.COMMAND_READY_CHECK then + if characterName ~= self.characterName then + AJM.AmReadyCheck( characterName, ... ) + end + end + if commandName == AJM.COMMAND_TELE_PORT then + if characterName ~= self.characterName then + AJM.DoLFGTeleport( characterName, ... ) + end + end + if commandName == AJM.COMMAND_LOOT_ROLL then + if characterName ~= self.characterName then + AJM.DoLootRoll( characterName, ... ) + end + end + if commandName == AJM.COMMAND_CHECK_BAGS then + AJM:ReceivedCheckBags( characterName, ... ) + end end diff --git a/Jamba-Toon/Locales/JambaToon-Locale-enUS.lua b/Jamba-Toon/Locales/JambaToon-Locale-enUS.lua index 8106656..b37ddf5 100644 --- a/Jamba-Toon/Locales/JambaToon-Locale-enUS.lua +++ b/Jamba-Toon/Locales/JambaToon-Locale-enUS.lua @@ -5,6 +5,7 @@ License: The MIT License ]]-- local L = LibStub( "AceLocale-3.0" ):NewLocale( "Jamba-Toon", "enUS", true ) +L["I'll be something one day"] = true L["Slash Commands"] = true L["Toon: Warnings"] = true L["Push Settings"] = true @@ -62,14 +63,7 @@ L["I do not have enough money to repair all my items."] = true L["Repairing cost me: X"] = function( costString ) return string.format( "Repairing cost me: %s", costString ) end -L["I am inactive!"] = true -L["Warn If Toon Goes Inactive"] = true -L["Inactive Message"] = true --- Brgin special. --- This is the inactive buff - you need to make sure it is localized correctly. --- http://www.wowhead.com/spell=43681 -L["Inactive"] = true --- End special. +L["Other"] = true L["Crowd Control Message"] = true L["Warn If Toon Gets Crowd Control"] = true L["I Am"] = true @@ -81,6 +75,11 @@ L["Recover All Team Corpses?"] = true L["I can not release to my Corpse for:"] = true L[" Seconds"] = true L["I Do not have a SoulStone"] = true +L["Raid/Party Tools."] = true +L["Auto Accept Role Checks"] = true +L["Accept Ready Checks With Team"] = true +L["LFG Teleport With Team"] = true +L["Roll Loot With Team"] = true --Jamba Help Tooltips L["Display Team Release Popups when the Team Dies"] = true @@ -101,3 +100,11 @@ L["Warn If All Regular Bags Are Full"] = true L["Warn If Toon Goes Inactive mosty for PVP"] = true L["Warn If any Minion Gets Crowd Control"] = true L["Automatically Deny All Guild Invites"] = true +L["Automatically Accept Role Checks \n\nIf a role is already set.."] = true +L["Accept Ready Checks With Team \n\nIf Team Member is the one that does the ready check it is Auto."] = true +L["Teleport With Team Members LFG"] = true +L["Roll Loot With the Team"] = true +--PLace Holder. +L["Bags"] = true +L[" "] = true +L["Jamba Bags"] = true diff --git a/Jamba-Trade/Jamba-Trade.toc b/Jamba-Trade/Jamba-Trade.toc index cd1783c..9984212 100644 --- a/Jamba-Trade/Jamba-Trade.toc +++ b/Jamba-Trade/Jamba-Trade.toc @@ -1,8 +1,8 @@ -## Interface: 70100 +## Interface: 70300 ## Title: JambaTrade ## Notes: JambaTrade ## Author: Ebony, Former Author: Jafula -## Version: 7.1.5-5.1.7 +## Version: 5.3.0 ## X-Category: Interface Enhancements ## X-Child-Of: Jamba ## Dependencies: Jamba diff --git a/Jamba-Trade/JambaTrade.lua b/Jamba-Trade/JambaTrade.lua index 6fa16b4..0cad26c 100644 --- a/Jamba-Trade/JambaTrade.lua +++ b/Jamba-Trade/JambaTrade.lua @@ -18,7 +18,7 @@ local AJM = LibStub( "AceAddon-3.0" ):NewAddon( local JambaUtilities = LibStub:GetLibrary( "JambaUtilities-1.0" ) local JambaHelperSettings = LibStub:GetLibrary( "JambaHelperSettings-1.0" ) local LibBagUtils = LibStub:GetLibrary( "LibBagUtils-1.0" ) -local LibGratuity = LibStub( "LibGratuity-3.0" ) +--local LibGratuity = LibStub( "LibGratuity-3.0" ) --Unlikey to be used bugged! local AceGUI = LibStub( "AceGUI-3.0" ) -- Constants and Locale for this module. @@ -26,7 +26,7 @@ AJM.moduleName = "Jamba-Trade" AJM.settingsDatabaseName = "JambaTradeProfileDB" AJM.chatCommand = "jamba-trade" local L = LibStub( "AceLocale-3.0" ):GetLocale( AJM.moduleName ) -AJM.parentDisplayName = L["Interaction"] +AJM.parentDisplayName = L["Toon"] AJM.moduleDisplayName = L["Trade"] AJM.inventorySeperator = "\008" @@ -36,16 +36,14 @@ AJM.inventoryPartSeperator = "\009" AJM.settings = { profile = { messageArea = JambaApi.DefaultMessageArea(), - framePoint = "CENTER", - frameRelativePoint = "CENTER", - frameXOffset = 0, - frameYOffset = 0, showJambaTradeWindow = false, + tradeBoEItems = false, + tradeCRItems = false, + autoTradeItemsList = {}, adjustMoneyWithGuildBank = false, goldAmountToKeepOnToon = 200, adjustMoneyWithMasterOnTrade = false, goldAmountToKeepOnToonTrade = 200, - ignoreSoulBound = false }, } @@ -59,24 +57,6 @@ function AJM:GetConfiguration() get = "JambaConfigurationGetSetting", set = "JambaConfigurationSetSetting", args = { - loadname = { - type = "input", - name = L["Load Item By Name"], - desc = L["Load a certain amount of an item by name into the trade window."], - usage = "/jamba-trade loadname <item-name>,<amount>", - get = false, - set = "JambaTradeLoadNameCommand", - guiHidden = true, - }, - loadtype = { - type = "input", - name = L["Load Items By Type"], - desc = L["Load items by type into the trade window."], - usage = "/jamba-trade loadtype <class>,<subclass>", - get = false, - set = "JambaTradeLoadTypeCommand", - guiHidden = true, - }, push = { type = "input", name = L["Push Settings"], @@ -95,36 +75,45 @@ end -- Command this module sends. ------------------------------------------------------------------------------------------------------------- -AJM.COMMAND_SHOW_INVENTORY = "ShowInventory" -AJM.COMMAND_HERE_IS_MY_INVENTORY = "HereIsMyInventory" -AJM.COMMAND_LOAD_ITEM_INTO_TRADE = "LoadItemIntoTrade" -AJM.COMMAND_LOAD_ITEM_CLASS_INTO_TRADE = "LoadItemClassIntoTrade" -AJM.COMMAND_GET_SLOT_COUNT = "GetSlotCount" -AJM.COMMAND_HERE_IS_MY_SLOT_COUNT = "HereIsMySlotCount" ------------------------------------------------------------------------------------------------------------- -- Messages module sends. ------------------------------------------------------------------------------------------------------------- + +------------------------------------------------------------------------------------------------------------- +-- Popup Dialogs. +------------------------------------------------------------------------------------------------------------- + +local function InitializePopupDialogs() + StaticPopupDialogs["JAMBATRADE_CONFIRM_REMOVE_TRADE_ITEMS"] = { + text = L["Are you sure you wish to remove the selected item from the trade items list?"], + button1 = YES, + button2 = NO, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + OnAccept = function() + AJM:RemoveItem() + end, + } +end + + ------------------------------------------------------------------------------------------------------------- -- Addon initialization, enabling and disabling. ------------------------------------------------------------------------------------------------------------- -- Initialise the module. function AJM:OnInitialize() - AJM.inventory = "" - AJM.inventoryInDisplayTable = {} - AJM.inventorySortedTable = {} - AJM.itemClassList = {} - AJM.itemClassSubList = {} - AJM.itemClassSubListLastSelection = {} - AJM.itemClassCurrentSelection = "" - AJM.itemSubClassCurrentSelection = "" + -- Initialise the popup dialogs. + InitializePopupDialogs() + AJM.autoTradeItemLink = nil + AJM.autoTradeItemTag = JambaApi.AllTag() -- Create the settings control. AJM:SettingsCreate() -- Initialse the JambaModule part of this module. AJM:JambaModuleInitialize( AJM.settingsControl.widgetSettings.frame ) - AJM:CreateInventoryFrame() -- Populate the settings. AJM:SettingsRefresh() end @@ -132,8 +121,8 @@ end -- Called when the addon is enabled. function AJM:OnEnable() AJM:RegisterEvent( "TRADE_SHOW" ) - AJM:RegisterEvent( "TRADE_CLOSED" ) - AJM:RegisterEvent( "GUILDBANKFRAME_OPENED" ) + AJM:RegisterEvent( "TRADE_CLOSED" ) -- Unsued but we keep it for now! + AJM:RegisterEvent( "GUILDBANKFRAME_OPENED" ) -- Temp! AJM:RegisterMessage( JambaApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) end @@ -163,25 +152,111 @@ function AJM:SettingsPushSettingsClick( event ) end function AJM:SettingsCreateTrade( top ) + local buttonControlWidth = 85 local checkBoxHeight = JambaHelperSettings:GetCheckBoxHeight() local editBoxHeight = JambaHelperSettings:GetEditBoxHeight() + local buttonHeight = JambaHelperSettings:GetButtonHeight() + local dropdownHeight = JambaHelperSettings:GetDropdownHeight() local left = JambaHelperSettings:LeftOfSettings() local headingHeight = JambaHelperSettings:HeadingHeight() local headingWidth = JambaHelperSettings:HeadingWidth( false ) - local dropdownHeight = JambaHelperSettings:GetDropdownHeight() + local horizontalSpacing = JambaHelperSettings:GetHorizontalSpacing() local verticalSpacing = JambaHelperSettings:GetVerticalSpacing() + local tradeWidth = headingWidth local movingTop = top - JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Trade Options"], movingTop, false ) + JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Trade Item List"], movingTop, false ) movingTop = movingTop - headingHeight AJM.settingsControl.checkBoxShowJambaTradeWindow = JambaHelperSettings:CreateCheckBox( AJM.settingsControl, headingWidth, left, movingTop, - L["Show Jamba Trade Window On Trade"], + L["Trade The List Of Items With Master"], AJM.SettingsToggleShowJambaTradeWindow ) movingTop = movingTop - checkBoxHeight + AJM.settingsControl.checkBoxTradeBoEItems = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Trades Binds When Equipped Items With Master"], + AJM.SettingsToggleTradeBoEItems + ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControl.checkBoxTradeCRItems = JambaHelperSettings:CreateCheckBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Trades Crafting Reagents Items With Master"], + AJM.SettingsToggleTradeCRItems + ) + movingTop = movingTop - checkBoxHeight + AJM.settingsControl.tradeItemsHighlightRow = 1 + AJM.settingsControl.tradeItemsOffset = 1 + local list = {} + list.listFrameName = "JambaTradeIteamsSettingsFrame" + list.parentFrame = AJM.settingsControl.widgetSettings.content + list.listTop = movingTop + list.listLeft = left + list.listWidth = tradeWidth + list.rowHeight = 15 + list.rowsToDisplay = 10 + list.columnsToDisplay = 2 + list.columnInformation = {} + list.columnInformation[1] = {} + list.columnInformation[1].width = 70 + list.columnInformation[1].alignment = "LEFT" + list.columnInformation[2] = {} + list.columnInformation[2].width = 30 + list.columnInformation[2].alignment = "LEFT" + list.scrollRefreshCallback = AJM.SettingsScrollRefresh + list.rowClickCallback = AJM.SettingsTradeItemsRowClick + AJM.settingsControl.tradeItems = list + JambaHelperSettings:CreateScrollList( AJM.settingsControl.tradeItems ) + movingTop = movingTop - list.listHeight - verticalSpacing + AJM.settingsControl.tradeItemsButtonRemove = JambaHelperSettings:CreateButton( + AJM.settingsControl, + buttonControlWidth, + left, + movingTop, + L["Remove"], + AJM.SettingsTradeItemsRemoveClick + ) + movingTop = movingTop - buttonHeight - verticalSpacing + JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Add Items"], movingTop, false ) + movingTop = movingTop - headingHeight + AJM.settingsControl.tradeItemsEditBoxTradeItem = JambaHelperSettings:CreateEditBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Other Item (drag item to box)"] + ) + AJM.settingsControl.tradeItemsEditBoxTradeItem:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedTradeItem ) + movingTop = movingTop - editBoxHeight + AJM.settingsControl.tradeItemsEditBoxTradeTag = JambaHelperSettings:CreateEditBox( + AJM.settingsControl, + headingWidth, + left, + movingTop, + L["Other Tag"] + ) + + AJM.settingsControl.tradeItemsEditBoxTradeTag:SetCallback( "OnEnterPressed", AJM.SettingsEditBoxChangedTradeItemTag ) + movingTop = movingTop - editBoxHeight + AJM.settingsControl.tradeItemsButtonAdd = JambaHelperSettings:CreateButton( + AJM.settingsControl, + buttonControlWidth, + left, + movingTop, + L["Add"], + AJM.SettingsTradeItemsAddClick + ) + movingTop = movingTop - buttonHeight + JambaHelperSettings:CreateHeading( AJM.settingsControl, L["Trade Options"], movingTop, false ) + movingTop = movingTop - headingHeight AJM.settingsControl.checkBoxAdjustMoneyOnToonViaGuildBank = JambaHelperSettings:CreateCheckBox( AJM.settingsControl, headingWidth, @@ -230,6 +305,76 @@ function AJM:SettingsCreateTrade( top ) return movingTop end + +------------------------------------------------------------------------------------------------------------- +-- Settings Callbacks. +------------------------------------------------------------------------------------------------------------- + + +function AJM:SettingsScrollRefresh() + FauxScrollFrame_Update( + AJM.settingsControl.tradeItems.listScrollFrame, + AJM:GetTradeItemsMaxPosition(), + AJM.settingsControl.tradeItems.rowsToDisplay, + AJM.settingsControl.tradeItems.rowHeight + ) + AJM.settingsControl.tradeItemsOffset = FauxScrollFrame_GetOffset( AJM.settingsControl.tradeItems.listScrollFrame ) + for iterateDisplayRows = 1, AJM.settingsControl.tradeItems.rowsToDisplay do + -- Reset. + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[1].textString:SetText( "" ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[1].textString:SetTextColor( 1.0, 1.0, 1.0, 1.0 ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[2].textString:SetText( "" ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[2].textString:SetTextColor( 1.0, 1.0, 1.0, 1.0 ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].highlight:SetColorTexture( 0.0, 0.0, 0.0, 0.0 ) + -- Get data. + local dataRowNumber = iterateDisplayRows + AJM.settingsControl.tradeItemsOffset + if dataRowNumber <= AJM:GetTradeItemsMaxPosition() then + -- Put data information into columns. + local tradeItemsInformation = AJM:GetTradeItemsAtPosition( dataRowNumber ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[1].textString:SetText( tradeItemsInformation.name ) + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].columns[2].textString:SetText( tradeItemsInformation.tag ) + -- Highlight the selected row. + if dataRowNumber == AJM.settingsControl.tradeItemsHighlightRow then + AJM.settingsControl.tradeItems.rows[iterateDisplayRows].highlight:SetColorTexture( 1.0, 1.0, 0.0, 0.5 ) + end + end + end +end + +function AJM:SettingsTradeItemsRowClick( rowNumber, columnNumber ) + if AJM.settingsControl.tradeItemsOffset + rowNumber <= AJM:GetTradeItemsMaxPosition() then + AJM.settingsControl.tradeItemsHighlightRow = AJM.settingsControl.tradeItemsOffset + rowNumber + AJM:SettingsScrollRefresh() + end +end + +function AJM:SettingsTradeItemsRemoveClick( event ) + StaticPopup_Show( "JAMBATRADE_CONFIRM_REMOVE_TRADE_ITEMS" ) +end + +function AJM:SettingsEditBoxChangedTradeItem( event, text ) + AJM.autoTradeItemLink = text + AJM:SettingsRefresh() +end + +function AJM:SettingsEditBoxChangedTradeItemTag( event, text ) + if not text or text:trim() == "" or text:find( "%W" ) ~= nil then + AJM:Print( L["Item tags must only be made up of letters and numbers."] ) + return + end + AJM.autoTradeItemTag = text + AJM:SettingsRefresh() +end + +function AJM:SettingsTradeItemsAddClick( event ) + if AJM.autoTradeItemLink ~= nil and AJM.autoTradeItemTag ~= nil then + AJM:AddItem( AJM.autoTradeItemLink, AJM.autoTradeItemTag ) + AJM.autoTradeItemLink = nil + AJM.settingsControl.tradeItemsEditBoxTradeItem:SetText( "" ) + AJM:SettingsRefresh() + end +end + function AJM:OnMessageAreasChanged( message ) AJM.settingsControl.dropdownMessageArea:SetList( JambaApi.MessageAreaList() ) end @@ -244,6 +389,16 @@ function AJM:SettingsToggleShowJambaTradeWindow( event, checked ) AJM:SettingsRefresh() end +function AJM:SettingsToggleTradeBoEItems(event, checked ) + AJM.db.tradeBoEItems = checked + AJM:SettingsRefresh() +end + +function AJM:SettingsToggleTradeCRItems(event, checked ) + AJM.db.tradeCRItems = checked + AJM:SettingsRefresh() +end + function AJM:SettingsToggleAdjustMoneyOnToonViaGuildBank( event, checked ) AJM.db.adjustMoneyWithGuildBank = checked AJM:SettingsRefresh() @@ -275,11 +430,10 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) if characterName ~= AJM.characterName then -- Update the settings. AJM.db.messageArea = settings.messageArea - AJM.db.framePoint = settings.framePoint - AJM.db.frameRelativePoint = settings.frameRelativePoint - AJM.db.frameXOffset = settings.frameXOffset - AJM.db.frameYOffset = settings.frameYOffset AJM.db.showJambaTradeWindow = settings.showJambaTradeWindow + AJM.db.tradeBoEItems = settings.tradeBoEItems + AJM.db.tradeCRItems = settings.tradeCRItems + AJM.db.autoTradeItemsList = JambaUtilities:CopyTable( settings.autoTradeItemsList ) AJM.db.adjustMoneyWithGuildBank = settings.adjustMoneyWithGuildBank AJM.db.goldAmountToKeepOnToon = settings.goldAmountToKeepOnToon AJM.db.adjustMoneyWithMasterOnTrade = settings.adjustMoneyWithMasterOnTrade @@ -288,8 +442,6 @@ function AJM:JambaOnSettingsReceived( characterName, settings ) AJM:SettingsRefresh() -- Tell the player. AJM:Print( L["Settings received from A."]( characterName ) ) - -- Tell the team? - --AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Settings received from A."]( characterName ), false ) end end @@ -302,6 +454,10 @@ end function AJM:SettingsRefresh() AJM.settingsControl.checkBoxShowJambaTradeWindow:SetValue( AJM.db.showJambaTradeWindow ) + AJM.settingsControl.checkBoxTradeBoEItems:SetValue( AJM.db.tradeBoEItems) + AJM.settingsControl.checkBoxTradeCRItems:SetValue( AJM.db.tradeCRItems) + AJM.settingsControl.checkBoxTradeBoEItems:SetDisabled( not AJM.db.showJambaTradeWindow ) + AJM.settingsControl.checkBoxTradeCRItems:SetDisabled( not AJM.db.showJambaTradeWindow ) AJM.settingsControl.dropdownMessageArea:SetValue( AJM.db.messageArea ) AJM.settingsControl.checkBoxAdjustMoneyOnToonViaGuildBank:SetValue( AJM.db.adjustMoneyWithGuildBank ) AJM.settingsControl.editBoxGoldAmountToLeaveOnToon:SetText( tostring( AJM.db.goldAmountToKeepOnToon ) ) @@ -309,328 +465,74 @@ function AJM:SettingsRefresh() AJM.settingsControl.checkBoxAdjustMoneyWithMasterOnTrade:SetValue( AJM.db.adjustMoneyWithMasterOnTrade ) AJM.settingsControl.editBoxGoldAmountToLeaveOnToonTrade:SetText( tostring( AJM.db.goldAmountToKeepOnToonTrade ) ) AJM.settingsControl.editBoxGoldAmountToLeaveOnToonTrade:SetDisabled( not AJM.db.adjustMoneyWithMasterOnTrade ) + AJM.settingsControl.tradeItemsEditBoxTradeTag:SetText( AJM.autoTradeItemTag ) + AJM.settingsControl.tradeItemsEditBoxTradeItem:SetDisabled( not AJM.db.showJambaTradeWindow ) + AJM.settingsControl.tradeItemsEditBoxTradeTag:SetDisabled( not AJM.db.showJambaTradeWindow ) + AJM.settingsControl.tradeItemsButtonRemove:SetDisabled( not AJM.db.showJambaTradeWindow ) + AJM.settingsControl.tradeItemsButtonAdd:SetDisabled( not AJM.db.showJambaTradeWindow ) + AJM:SettingsScrollRefresh() + end +--Comms not sure if we going to use comms here. -- A Jamba command has been received. function AJM:JambaOnCommandReceived( characterName, commandName, ... ) if characterName == self.characterName then return end - if commandName == AJM.COMMAND_SHOW_INVENTORY then - AJM:SendInventory( characterName ) - end - if commandName == AJM.COMMAND_HERE_IS_MY_INVENTORY then - AJM:ShowOtherToonsInventory( characterName, ... ) - end - if commandName == AJM.COMMAND_LOAD_ITEM_INTO_TRADE then - AJM:LoadItemIntoTrade( ... ) - end - if commandName == AJM.COMMAND_LOAD_ITEM_CLASS_INTO_TRADE then - AJM:LoadItemClassIntoTradeWindow( ... ) - end - if commandName == AJM.COMMAND_GET_SLOT_COUNT then - AJM:GetSlotCountAndSendToToon( characterName ) - end - if commandName == AJM.COMMAND_HERE_IS_MY_SLOT_COUNT then - AJM:SetOtherToonsSlotCount( characterName, ... ) - end end ------------------------------------------------------------------------------------------------------------- -- Trade functionality. ------------------------------------------------------------------------------------------------------------- -function AJM:CreateInventoryFrame() - local frame = CreateFrame( "Frame", "JambaTradeInventoryWindowFrame", UIParent ) - frame.parentObject = AJM - frame:SetFrameStrata( "LOW" ) - frame:SetToplevel( true ) - frame:SetClampedToScreen( true ) - frame:EnableMouse( true ) - frame:SetMovable( true ) - frame:RegisterForDrag( "LeftButton" ) - frame:SetScript( "OnDragStart", - function( this ) - this:StartMoving() - end ) - frame:SetScript( "OnDragStop", - function( this ) - this:StopMovingOrSizing() - local point, relativeTo, relativePoint, xOffset, yOffset = this:GetPoint() - AJM.db.framePoint = point - AJM.db.frameRelativePoint = relativePoint - AJM.db.frameXOffset = xOffset - AJM.db.frameYOffset = yOffset - end ) - frame:ClearAllPoints() - frame:SetPoint( AJM.db.framePoint, UIParent, AJM.db.frameRelativePoint, AJM.db.frameXOffset, AJM.db.frameYOffset ) - frame:SetBackdrop( { - bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 10, edgeSize = 20, - insets = { left = 3, right = 3, top = 3, bottom = 3 } - } ) - - frame:SetWidth( 323 ) - frame:SetHeight( 452 ) - - frame.title = frame:CreateFontString( nil, "OVERLAY", "GameFontNormal" ) - frame.title:SetText( "Jamba-Trade" ) - frame.title:SetPoint( "TOPLEFT", frame, "TOPLEFT", 10, -7 ) - frame.title:SetJustifyH( "LEFT" ) - frame.title:SetJustifyV( "TOP" ) - - local left, right, top, bottom, width, height - left = 86 - right = 400 - top = 10 - bottom = 35 - width = right - left - height = bottom - top - - local header = frame:CreateTexture( nil, "ARTWORK" ) - header:SetTexture( "Interface\\BankFrame\\UI-BankFrame" ) - header:ClearAllPoints() - header:SetPoint( "TOPLEFT", frame, "TOPLEFT", 7, 0 ) - header:SetWidth( width ) - header:SetHeight( height ) - header:SetTexCoord( left/512, right/512, top/512, bottom/512 ) - frame.header = header - - local closeButton = CreateFrame( "Button", "JambaTradeInventoryWindowFrameButtonClose", frame, "UIPanelCloseButton" ) - closeButton:SetScript( "OnClick", AJM.JambaTradeWindowCloseButtonClicked ) - closeButton:SetPoint( "TOPRIGHT", frame, "TOPRIGHT", 1, 2 ) - - local dropDownClass = AceGUI:Create( "Dropdown" ) - dropDownClass.frame:SetParent( frame ) - dropDownClass:SetLabel( "" ) - dropDownClass:SetPoint( "TOPLEFT", frame, "TOPLEFT", 8, -28 ) - dropDownClass:SetWidth( 130 ) - dropDownClass:SetList( AJM.itemClassList ) - dropDownClass:SetCallback( "OnValueChanged", AJM.JambaTradeClassDropDownChanged ) - frame.dropDownClass = dropDownClass - - local dropDownSubClass = AceGUI:Create( "Dropdown" ) - dropDownSubClass.frame:SetParent( frame ) - dropDownSubClass:SetLabel( "" ) - dropDownSubClass:SetPoint( "TOPLEFT", frame, "TOPLEFT", 142, -28 ) - dropDownSubClass:SetWidth( 170 ) - dropDownSubClass:SetCallback( "OnValueChanged", AJM.JambaTradeSubClassDropDownChanged ) - frame.dropDownSubClass = dropDownSubClass - - local checkBoxIgnoreSoulBound = CreateFrame( "CheckButton", "JambaTradeInventoryWindowFrameCheckButtonIgnoreSoulbound", frame, "ChatConfigCheckButtonTemplate" ) - checkBoxIgnoreSoulBound:SetPoint( "TOPLEFT", frame, "TOPLEFT", 142, -95 ) - checkBoxIgnoreSoulBound:SetHeight( 24 ) - checkBoxIgnoreSoulBound:SetWidth( 24 ) - checkBoxIgnoreSoulBound:SetScript( "OnClick", AJM.JambaTradeIgnoreSoulBoundCheckboxChanged ) - frame.checkBoxIgnoreSoulBound = checkBoxIgnoreSoulBound - - local labelIgnoreSoulBound = frame:CreateFontString( nil, "BACKGROUND", "GameFontHighlight" ) - labelIgnoreSoulBound:SetText( L["Ignore Soulbound"] ) - labelIgnoreSoulBound:SetPoint( "TOPLEFT", frame, "TOPLEFT", 167, -100 ) - labelIgnoreSoulBound:SetJustifyH( "LEFT" ) - labelIgnoreSoulBound:SetJustifyV( "TOP" ) - labelIgnoreSoulBound:SetWidth( 150 ) - frame.labelIgnoreSoulBound = labelIgnoreSoulBound - - local labelMineBags = frame:CreateFontString( nil, "BACKGROUND", "GameFontHighlight" ) - labelMineBags:SetText( "" ) - labelMineBags:SetPoint( "TOPLEFT", frame, "TOPLEFT", 145, -63 ) - labelMineBags:SetJustifyH( "LEFT" ) - labelMineBags:SetJustifyV( "TOP" ) - labelMineBags:SetWidth( 370 ) - frame.labelMineBags = labelMineBags - - local labelTheirsBags = frame:CreateFontString( nil, "BACKGROUND", "GameFontHighlight" ) - labelTheirsBags:SetText( "") - labelTheirsBags:SetPoint( "TOPLEFT", frame, "TOPLEFT", 145, -80 ) - labelTheirsBags:SetJustifyH( "LEFT" ) - labelTheirsBags:SetJustifyV( "TOP" ) - labelTheirsBags:SetWidth( 370 ) - frame.labelTheirsBags = labelTheirsBags - - local loadMineButton = CreateFrame( "Button", "JambaTradeInventoryWindowFrameButtonLoadMine", frame, "UIPanelButtonTemplate" ) - loadMineButton:SetScript( "OnClick", AJM.JambaTradeLoadMineButtonClicked ) - loadMineButton:SetPoint( "TOPLEFT", frame, "TOPLEFT", 10, -60 ) - loadMineButton:SetHeight( 24 ) - loadMineButton:SetWidth( 100 ) - loadMineButton:SetText( L["Load Mine"] ) - frame.loadMineButton = loadMineButton - - local loadTheirsButton = CreateFrame( "Button", "JambaTradeInventoryWindowFrameButtonLoadTheirs", frame, "UIPanelButtonTemplate" ) - loadTheirsButton:SetScript( "OnClick", AJM.JambaTradeLoadTheirsButtonClicked ) - loadTheirsButton:SetPoint( "TOPLEFT", frame, "TOPLEFT", 10, -87 ) - loadTheirsButton:SetHeight( 24 ) - loadTheirsButton:SetWidth( 100 ) - loadTheirsButton:SetText( L["Load Theirs"] ) - frame.loadTheirsButton = loadTheirsButton - - local blockNumber = 0 - local cellCounter = 0 - local blockRowSize = 7 - local blockColumnSize = 8 - local cellXOffset = 4 - local cellYOffset = -4 - local cellXSpacing = 4 - local cellYSpacing = 4 - local xOffset = 6 - local yOffset = header:GetHeight() + 93 - local blockXLocation, blockYLocation - local cellHeight, cellWidth - - local tempButton = CreateFrame( "Button", "JambaTradeInventoryWindowFrameButtonTemp", frame, "ItemButtonTemplate" ) - cellWidth = tempButton:GetWidth() - cellHeight = tempButton:GetHeight() - tempButton:Hide() - - AJM.tradeScrollRowHeight = cellHeight + cellYSpacing - AJM.tradeScrollRowsToDisplay = 1 * blockColumnSize - AJM.tradeScrollMaximumRows = AJM.tradeScrollRowsToDisplay - AJM.tradeScrollOffset = 0 - AJM.tradeScrollItemsPerRow = 1 * blockRowSize - - frame.tradeScrollFrame = CreateFrame( "ScrollFrame", frame:GetName().."ScrollFrame", frame, "FauxScrollFrameTemplate" ) - frame.tradeScrollFrame:SetPoint( "TOPLEFT", frame, "TOPLEFT", -27, -yOffset ) - frame.tradeScrollFrame:SetPoint( "BOTTOMRIGHT", frame, "BOTTOMRIGHT", -27, 5 ) - frame.tradeScrollFrame:SetScript( "OnVerticalScroll", - function( self, offset ) - FauxScrollFrame_OnVerticalScroll( - self, - offset, - AJM.tradeScrollRowHeight, - AJM.TradeScrollRefreshCallback ) - end - ) - - frame.slotBackgrounds = {} - frame.slots = {} - left = 79 - right = 121 - top = 255 - bottom = 296 - width = right - left - height = bottom - top - for blockY = 0, (blockColumnSize - 1) do - for blockX = 0, (blockRowSize - 1) do - blockNumber = blockX + (blockY * blockColumnSize) - local slotTexture = frame:CreateTexture( nil, "ARTWORK" ) - slotTexture:SetTexture( "Interface\\ContainerFrame\\UI-Bag-Components-Bank" ) - slotTexture:ClearAllPoints() - blockXLocation = xOffset + (1 * (blockX * width)) - blockYLocation = -yOffset + (-1 * (blockY * height)) - slotTexture:SetPoint( "TOPLEFT", frame, "TOPLEFT", blockXLocation, blockYLocation ) - slotTexture:SetWidth( width ) - slotTexture:SetHeight( height ) - slotTexture:SetTexCoord( left/256, right/256, top/512, bottom/512 ) - frame.slotBackgrounds[blockNumber] = slotTexture - frame.slots[cellCounter] = CreateFrame( "Button", "JambaTradeInventoryWindowFrameButton"..cellCounter, frame, "ItemButtonTemplate" ) - frame.slots[cellCounter]:SetPoint( "TOPLEFT", frame, "TOPLEFT", cellXOffset + blockXLocation, cellYOffset + blockYLocation ) - frame.slots[cellCounter]:SetScript( "OnClick", function( self ) AJM:OtherToonInventoryButtonClick( self ) end) - frame.slots[cellCounter]:SetScript( "OnEnter", function( self ) AJM:OtherToonInventoryButtonEnter( self ) end ) - frame.slots[cellCounter]:SetScript( "OnLeave", function( self ) AJM:OtherToonInventoryButtonLeave( self ) end) - frame.slots[cellCounter]:Hide() - cellCounter = cellCounter + 1 - end - end - JambaTradeInventoryFrame = frame - table.insert( UISpecialFrames, "JambaTradeInventoryWindowFrame" ) - JambaTradeInventoryFrame:Hide() -end - -function AJM:JambaTradeWindowCloseButtonClicked() - JambaTradeInventoryFrame:Hide() -end - -function AJM:JambaTradeClassDropDownChanged( event, value ) - AJM.itemClassCurrentSelection = value - JambaTradeInventoryFrame.dropDownSubClass:SetList( AJM.itemClassSubList[value] ) - JambaTradeInventoryFrame.dropDownSubClass:SetValue( AJM.itemClassSubListLastSelection[value] ) - AJM:TradeScrollRefreshCallback() -end - -function AJM:JambaTradeSubClassDropDownChanged( event, value ) - AJM.itemSubClassCurrentSelection = value - AJM.itemClassSubListLastSelection[AJM.itemClassCurrentSelection] = AJM.itemSubClassCurrentSelection - AJM:TradeScrollRefreshCallback() -end - -function AJM:JambaTradeIgnoreSoulBoundCheckboxChanged() - if JambaTradeInventoryFrame.checkBoxIgnoreSoulBound:GetChecked() then - AJM.db.ignoreSoulBound = true - else - AJM.db.ignoreSoulBound = false - end -end - -function AJM.JambaTradeLoadMineButtonClicked() - AJM:LoadItemClassIntoTradeWindow( AJM.itemClassCurrentSelection, AJM.itemSubClassCurrentSelection, AJM.db.ignoreSoulBound ) -end +-- New Trade stuff -function AJM.JambaTradeLoadTheirsButtonClicked() - local name = AJM:GetNPCUnitName() - AJM:JambaSendCommandToToon( name, AJM.COMMAND_LOAD_ITEM_CLASS_INTO_TRADE, AJM.itemClassCurrentSelection, AJM.itemSubClassCurrentSelection, AJM.db.ignoreSoulBound ) -end -function AJM:OtherToonInventoryButtonEnter( self ) - if self.link ~= nil then - GameTooltip_SetDefaultAnchor( GameTooltip, self ) - GameTooltip:SetOwner( self, "ANCHOR_LEFT" ) - GameTooltip:ClearLines() - GameTooltip:SetHyperlink( self.link ) - CursorUpdate() - end +function AJM:GetTradeItemsMaxPosition() + return #AJM.db.autoTradeItemsList end -function AJM:OtherToonInventoryButtonLeave( self ) - if self.link ~= nil then - GameTooltip:Hide() - ResetCursor() - end +function AJM:GetTradeItemsAtPosition( position ) + return AJM.db.autoTradeItemsList[position] end -function AJM:OtherToonInventoryButtonClick( self ) - local name = AJM:GetNPCUnitName() - AJM:JambaSendCommandToToon( name, AJM.COMMAND_LOAD_ITEM_INTO_TRADE, self.bag, self.slot, false ) - SetItemButtonDesaturated( self, 1, 0.5, 0.5, 0.5 ) +function AJM:AddItem( itemLink, itemTag ) + -- Get some more information about the item. + local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo( itemLink ) + -- If the item could be found. + if name ~= nil then + local itemInformation = {} + itemInformation.link = link + itemInformation.name = name + itemInformation.tag = itemTag + table.insert( AJM.db.autoTradeItemsList, itemInformation ) + AJM:SettingsRefresh() + AJM:SettingsTradeItemsRowClick( 1, 1 ) + end end -function AJM:GetInventory() - local itemId - AJM.inventory = "" - for bag, slot, link in LibBagUtils:Iterate( "BAGS" ) do - -- Don't send slots that have no items and don't send anything in the keyring bag (-2) - if link ~= nil and bag ~= -2 then - local texture, itemCount, locked, quality, readable = GetContainerItemInfo( bag, slot ) - itemId = JambaUtilities:GetItemIdFromItemLink( link ) - AJM.inventory = AJM.inventory..bag..AJM.inventoryPartSeperator..slot..AJM.inventoryPartSeperator..itemId..AJM.inventoryPartSeperator..itemCount..AJM.inventorySeperator - end - end +function AJM:RemoveItem() + table.remove( AJM.db.autoTradeItemsList, AJM.settingsControl.tradeItemsHighlightRow ) + AJM:SettingsRefresh() + AJM:SettingsTradeItemsRowClick( 1, 1 ) end -function AJM:JambaTradeLoadTypeCommand( info, parameters ) - local class, subclass = strsplit( ",", parameters ) - if class ~= nil and class:trim() ~= "" and subclass ~= nil and subclass:trim() ~= "" then - AJM:LoadItemClassIntoTradeWindow( class:trim(), subclass:trim(), false ) - else - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Jamba-Trade: Please provide a class and a subclass seperated by a comma for the loadtype command."], false ) - end -end -function AJM:JambaTradeLoadNameCommand( info, parameters ) - local itemName, amount = strsplit( ",", parameters ) - if itemName ~= nil and itemName:trim() ~= "" and amount ~= nil and amount:trim() ~= "" then - AJM:SplitStackItemByNameLimitAmount( itemName:trim(), amount:trim() ) - else - AJM:JambaSendMessageToTeam( AJM.db.messageArea, L["Jamba-Trade: Please provide a name and an amount seperated by a comma for the loadname command."], false ) +function AJM:TRADE_SHOW( event, ... ) + --Keep for tradeing gold! + if AJM.db.adjustMoneyWithMasterOnTrade == true then + AJM:ScheduleTimer( "TradeShowAdjustMoneyWithMaster", 1 ) end -end - -function AJM:TRADE_SHOW( event, ... ) + -- do trade list with Gold! if AJM.db.showJambaTradeWindow == true then - AJM:TradeShowDisplayJambaTrade() + AJM:ScheduleTimer("TradeItemsFromList", 1 ) end - if AJM.db.adjustMoneyWithMasterOnTrade == true then - AJM:ScheduleTimer( "TradeShowAdjustMoneyWithMaster", 1 ) + if AJM.db.tradeBoEItems == true and AJM.db.showJambaTradeWindow == true then + AJM:ScheduleTimer("TradeBoEItems", 1.5 ) + end + if AJM.db.tradeCRItems == true and AJM.db.showJambaTradeWindow == true then + AJM:ScheduleTimer("TradeCRItems", 1.8 ) end end @@ -648,53 +550,121 @@ function AJM:TradeShowAdjustMoneyWithMaster() if moneyToDepositOrWithdraw > 0 then for index, character in JambaApi.TeamListOrderedOnline() do --AJM:Print("Team", character ) - local teamCharacterName = ( Ambiguate( character, "none" ) ) + local teamCharacterName = ( Ambiguate( character, "short" ) ) local tradePlayersName = GetUnitName("NPC") if tradePlayersName == teamCharacterName then - --AJM:Print("found", tradePlayersName, teamCharacterName ) - --PickupPlayerMoney( moneyToDepositOrWithdraw ) - --GetCursorMoney() - --AddTradeMoney() - MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, moneyToDepositOrWithdraw) - break + --AJM:Print("found", tradePlayersName, teamCharacterName, character ) + if JambaApi.IsCharacterTheMaster(character) == true and JambaUtilities:CheckIsFromMyRealm(character) == true then + MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, moneyToDepositOrWithdraw) + break + end else - AJM:Print(tradePlayersName, "is not Member of the team, Will not trade Gold.") + --AJM:Print(tradePlayersName, L["Is Not a Member of the team, Will not trade Gold."]) end end end end -function AJM:GetNPCUnitName() - local name, realm = UnitName( "npc" ) - if realm then - name = name.."-"..realm - else - name = name.."-"..AJM.characterRealm + +function AJM:TradeItemsFromList() + if JambaApi.IsCharacterTheMaster( AJM.characterName ) == true then + return end - return name + for index, character in JambaApi.TeamListOrderedOnline() do + --AJM:Print("Team", character ) + local teamCharacterName = ( Ambiguate( character, "short" ) ) + local tradePlayersName = GetUnitName("NPC") + if tradePlayersName == teamCharacterName then + --AJM:Print("found", tradePlayersName, teamCharacterName, character ) + if JambaApi.IsCharacterTheMaster(character) == true and JambaUtilities:CheckIsFromMyRealm(character) == true then + --Checks the D_B for any items in the list. + for position, itemInformation in pairs( AJM.db.autoTradeItemsList ) do + --AJM:Print("Items in list", itemInformation.link ) + if JambaApi.DoesCharacterHaveTag( AJM.characterName, itemInformation.tag ) == true then + --Checks if there is a item in the bag with the name + --local bag, slot, link = LibBagUtils:Find("BAGS", itemInformation.link ) --did olny the find the 1st stack of a item. + for bag,slot,link in LibBagUtils:Iterate("BAGS", itemInformation.link ) do + if bag ~= nil then + --AJM:Print("found", bag, slot) + for iterateTradeSlots = 1, (MAX_TRADE_ITEMS - 1) do + if GetTradePlayerItemLink( iterateTradeSlots ) == nil then + PickupContainerItem( bag, slot ) + ClickTradeButton( iterateTradeSlots ) + end + end + end + end + end + end + end + else + --AJM:Print(tradePlayersName, L["Is Not a Member of the team, Will not trade Items."]) + end + end end -function AJM:TradeShowDisplayJambaTrade() - local slotsFree, totalSlots = LibBagUtils:CountSlots( "BAGS", 0 ) - JambaTradeInventoryFrame.labelMineBags:SetText( self.characterName..": "..(totalSlots - slotsFree).."/"..totalSlots ) - if slotsFree < 6 then - JambaTradeInventoryFrame.labelMineBags:SetTextColor( 0.9, 0.0, 0.0 ) +function AJM:TradeBoEItems() + if JambaApi.IsCharacterTheMaster( AJM.characterName ) == true then + return end - JambaTradeInventoryFrame.checkBoxIgnoreSoulBound:SetChecked( AJM.db.ignoreSoulBound ) - AJM:JambaTradeIgnoreSoulBoundCheckboxChanged() - local name = AJM:GetNPCUnitName() - AJM:JambaSendCommandToToon( name, AJM.COMMAND_GET_SLOT_COUNT ) - AJM:LoadThisToonsClasses() - AJM:JambaSendCommandToToon (name, AJM.COMMAND_SHOW_INVENTORY ) + for bag,slot,link in LibBagUtils:Iterate("BAGS") do + if bag ~= nil then + local _, _, locked, quality = GetContainerItemInfo(bag, slot) + -- quality is Uncommon (green) to Epic (purple) 2 - 3 - 4 + if quality ~= nil and locked == false then + if quality >= 2 and quality <= 4 then + -- tooltips scan is the olny way to find if the item is BoE in bags! + local isBoe = JambaUtilities:ToolTipBagScaner(link, bag, slot) + -- if the item is boe then add it to the trade list! + if isBoe ~= ITEM_SOULBOUND then + --AJM:Print("test21", link, locked) + for iterateTradeSlots = 1, (MAX_TRADE_ITEMS - 1) do + if GetTradePlayerItemLink( iterateTradeSlots ) == nil then + PickupContainerItem( bag, slot ) + ClickTradeButton( iterateTradeSlots ) + end + end + end + end + end + end + end end -function AJM:TRADE_CLOSED() - if AJM.db.showJambaTradeWindow == false then + +function AJM:TradeCRItems() + if JambaApi.IsCharacterTheMaster( AJM.characterName ) == true then return end - JambaTradeInventoryFrame:Hide() + for bag,slot,itemLink in LibBagUtils:Iterate("BAGS") do + if itemLink then + -- using legion CraftingReagent API, as tooltip massess up some "items" + local _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,isCraftingReagent = GetItemInfo(itemLink) + if isCraftingReagent == true then + --AJM:Print("TradeCraftingGoods", isCraftingReagent, itemLink) + -- tooltips scan is the olny way to find if the item is BOP in bags! + local isBop = JambaUtilities:TooltipScaner(itemLink) + --AJM:Print("testBOP", itemLink, isBop) + if isBop ~= ITEM_BIND_ON_PICKUP then + --AJM:Print("AddToTrade", itemLink) + for iterateTradeSlots = 1, (MAX_TRADE_ITEMS - 1) do + if GetTradePlayerItemLink( iterateTradeSlots ) == nil then + PickupContainerItem( bag, slot ) + ClickTradeButton( iterateTradeSlots ) + end + end + end + end + end + end +end + + +function AJM:TRADE_CLOSED() + end +-- Guild bank stuff keep TEMP! function AJM:GUILDBANKFRAME_OPENED() if AJM.db.adjustMoneyWithGuildBank == false then @@ -715,309 +685,3 @@ function AJM:GUILDBANKFRAME_OPENED() WithdrawGuildBankMoney( -1 * moneyToDepositOrWithdraw ) end end - -function AJM:SendInventory( characterName ) - AJM:GetInventory() - AJM:JambaSendCommandToToon( characterName, AJM.COMMAND_HERE_IS_MY_INVENTORY, AJM.inventory ) -end - -function AJM:GetSlotCountAndSendToToon( characterName ) - local slotsFree, totalSlots = LibBagUtils:CountSlots( "BAGS", 0 ) - AJM:JambaSendCommandToToon( characterName, AJM.COMMAND_HERE_IS_MY_SLOT_COUNT, slotsFree, totalSlots ) -end - -function AJM:SetOtherToonsSlotCount( characterName, slotsFree, totalSlots ) - JambaTradeInventoryFrame.labelTheirsBags:SetText( characterName..": "..(totalSlots - slotsFree).."/"..totalSlots ) - if slotsFree < 6 then - JambaTradeInventoryFrame.labelTheirsBags:SetTextColor( 0.9, 0.0, 0.0 ) - end -end - -function AJM:LoadItemIntoTrade( bag, slot, ignoreSoulBound ) - ClearCursor() - LibGratuity:SetBagItem( bag, slot ) - if LibGratuity:Find( ITEM_SOULBOUND, 1, 3 ) then - -- SOULBOUND - if ignoreSoulBound == true then - return true - end - if GetTradePlayerItemLink( MAX_TRADE_ITEMS ) == nil then - PickupContainerItem( bag, slot ) - ClickTradeButton( MAX_TRADE_ITEMS ) - return true - end - else - for iterateTradeSlots = 1, (MAX_TRADE_ITEMS - 1) do - if GetTradePlayerItemLink( iterateTradeSlots ) == nil then - PickupContainerItem( bag, slot ) - ClickTradeButton( iterateTradeSlots ) - return true - end - end - end - ClearCursor() - return false -end - -function AJM:LoadItemClassIntoTradeWindow( requiredClass, requiredSubClass, ignoreSoulBound ) - for bag, slot, link in LibBagUtils:Iterate( "BAGS" ) do - -- Ignore slots that have no items and ignore anything in the keyring bag (-2) - if link ~= nil and bag ~= -2 then - local itemId = JambaUtilities:GetItemIdFromItemLink( link ) - local name, link, quality, iLevel, reqLevel, class, subClass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo( itemId ) - if requiredClass == L["!Single Item"] then - if requiredSubClass == name then - if AJM:LoadItemIntoTrade( bag, slot, ignoreSoulBound ) == false then - return - end - end - end - if requiredClass == L["!Quality"] then - if requiredSubClass == AJM:GetQualityName( quality ) then - if AJM:LoadItemIntoTrade( bag, slot, ignoreSoulBound ) == false then - return - end - end - end - if requiredClass == class and requiredSubClass == subClass then - if AJM:LoadItemIntoTrade( bag, slot, ignoreSoulBound ) == false then - return - end - end - end - end -end - -function AJM:SplitStackItemByNameLimitAmount( name, amount ) - amount = tonumber( amount ) - local foundAndSplit = false - for bag, slot, link in LibBagUtils:Iterate( "BAGS", name ) do - -- If the item has been found and split, then finish up this section. - if foundAndSplit == true then - break - end - -- Attempt to split the item to the request amount. - SplitContainerItem( bag, slot, amount ) - -- If successful, cursor will have item, stick it into an empty spot in the bags. - if CursorHasItem() then - LibBagUtils:PutItem( "BAGS" ) - foundAndSplit = true - end - end - -- If item was found and split successfully then look for item stack of the request size and attempt to put it in the trade window. - if foundAndSplit == true then - AJM:ScheduleTimer( "LoadItemByNameLimitAmountIntoTradeWindow", 5, name..","..tostring( amount ) ) - end -end - -function AJM:LoadItemByNameLimitAmountIntoTradeWindow( nameAndAmount ) - local name, amount = strsplit( ",", nameAndAmount ) - amount = tonumber( amount ) - for bag, slot, link in LibBagUtils:Iterate( "BAGS", name ) do - local texture, count, locked, quality, readable, lootable, link = GetContainerItemInfo( bag, slot ) - if count == amount then - -- This stack is the required size. - AJM:LoadItemIntoTrade( bag, slot, false ) - break - end - end -end - -local function JambaInventoryClassSort( a, b ) - local aClass = "" - local bClass = "" - local aSubClass = "" - local bSubClass = "" - local aName = "" - local bName = "" - if a ~= nil then - aClass = a.class - aSubClass = a.subClass - aName = a.name - end - if b ~= nil then - bClass = b.class - bSubClass = b.subClass - bName = b.name - end - if aClass == bClass then - if aSubClass == bSubClass then - return aName > bName - end - return aSubClass > bSubClass - end - return aClass > bClass -end - -function AJM:AddToClassAndSubClassLists( class, subClass ) - if class ~= nil then - if AJM.itemClassList[class] == nil then - AJM.itemClassList[class] = class - AJM.itemClassSubList[class] = {} - AJM.itemClassSubListLastSelection[class] = "" - end - if class ~= nil and subClass ~= nil then - AJM.itemClassSubList[class][subClass] = subClass - end - end -end - -function AJM:GetQualityName( quality ) - if quality == LE_ITEM_QUALITY_POOR then - return L["0. Poor (gray)"] - end - if quality == LE_ITEM_QUALITY_COMMON then - return L["1. Common (white)"] - end - if quality == LE_ITEM_QUALITY_UNCOMMON then - return L["2. Uncommon (green)"] - end - if quality == LE_ITEM_QUALITY_RARE then - return L["3. Rare / Superior (blue)"] - end - if quality == LE_ITEM_QUALITY_EPIC then - return L["4. Epic (purple)"] - end - if quality == LE_ITEM_QUALITY_LEGENDARY then - return L["5. Legendary (orange)"] - end - if quality == 6 then - return L["6. Artifact (golden yellow)"] - end - if quality == LE_ITEM_QUALITY_HEIRLOOM then - return L["7. Heirloom (light yellow)"] - end - return L["Unknown"] -end - -function AJM:LoadThisToonsClasses() - local itemId - for bag, slot, link in LibBagUtils:Iterate( "BAGS" ) do - -- Don't send slots that have no items and don't send anything in the keyring bag (-2) - if link ~= nil and bag ~= -2 then - itemId = JambaUtilities:GetItemIdFromItemLink( link ) - local name, link, quality, iLevel, reqLevel, class, subClass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo( itemId ) - if name ~= nil then - AJM:AddToClassAndSubClassLists( L["!Single Item"], name ) - end - if quality ~= nil then - AJM:AddToClassAndSubClassLists( L["!Quality"], AJM:GetQualityName( quality ) ) - end - AJM:AddToClassAndSubClassLists( class, subClass ) - end - end -end - -function AJM:ShowOtherToonsInventory( characterName, inventory ) - table.wipe( AJM.inventorySortedTable ) - local inventoryLines = { strsplit( AJM.inventorySeperator, inventory ) } - local inventoryInfo - for index, line in ipairs( inventoryLines ) do - local bag, slot, inventoryItemID, itemCount = strsplit( AJM.inventoryPartSeperator, line ) - if inventoryItemID ~= nil and inventoryItemID ~= "" then - local name, link, quality, iLevel, reqLevel, class, subClass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo( inventoryItemID ) - AJM:AddToClassAndSubClassLists( class, subClass ) - if name ~= nil then - AJM:AddToClassAndSubClassLists( L["!Single Item"], name ) - end - if quality ~= nil then - AJM:AddToClassAndSubClassLists( L["!Quality"], AJM:GetQualityName( quality ) ) - end - if texture == nil then - class = "?" - name = "?" - end - inventoryInfo = {} - inventoryInfo.bag = bag - inventoryInfo.slot = slot - inventoryInfo.inventoryItemID = inventoryItemID - inventoryInfo.itemCount = itemCount - inventoryInfo.class = class - inventoryInfo.subClass = subClass - inventoryInfo.name = name - table.insert( AJM.inventorySortedTable, inventoryInfo ) - end - end - table.sort( AJM.inventorySortedTable, JambaInventoryClassSort ) - -- Start the row at 1, and the column at 0. - local rowCounter = 0 - local columnCounter = AJM.tradeScrollItemsPerRow - 1 - table.wipe( AJM.inventoryInDisplayTable ) - for index, line in ipairs( AJM.inventorySortedTable ) do - columnCounter = columnCounter + 1 - if columnCounter == AJM.tradeScrollItemsPerRow then - rowCounter = rowCounter + 1 - columnCounter = 0 - end - if AJM.inventoryInDisplayTable[rowCounter] == nil then - AJM.inventoryInDisplayTable[rowCounter] = {} - end - AJM.inventoryInDisplayTable[rowCounter][columnCounter] = {} - AJM.inventoryInDisplayTable[rowCounter][columnCounter]["bag"] = line.bag - AJM.inventoryInDisplayTable[rowCounter][columnCounter]["slot"] = line.slot - AJM.inventoryInDisplayTable[rowCounter][columnCounter]["inventoryItemID"] = line.inventoryItemID - AJM.inventoryInDisplayTable[rowCounter][columnCounter]["itemCount"] = line.itemCount - end - AJM.tradeScrollMaximumRows = rowCounter - AJM:TradeScrollRefreshCallback() - JambaTradeInventoryFrame.dropDownClass:SetList( AJM.itemClassList ) - JambaTradeInventoryFrame:Show() -end - -function AJM:TradeScrollRefreshCallback() - FauxScrollFrame_Update( - JambaTradeInventoryFrame.tradeScrollFrame, - AJM.tradeScrollMaximumRows, - AJM.tradeScrollRowsToDisplay, - AJM.tradeScrollRowHeight - ) - AJM.tradeScrollOffset = FauxScrollFrame_GetOffset( JambaTradeInventoryFrame.tradeScrollFrame ) - local slotNumber, columnNumber, slot - local r, g, b - for iterateDisplayRows = 1, AJM.tradeScrollRowsToDisplay do - -- Reset cells. - for columnNumber = 0, (AJM.tradeScrollItemsPerRow - 1) do - slotNumber = columnNumber + ((iterateDisplayRows - 1) * AJM.tradeScrollItemsPerRow) - slot = JambaTradeInventoryFrame.slots[slotNumber] - SetItemButtonTexture( slot, "" ) - slot:Hide() - end - -- Get data. - local dataRowNumber = iterateDisplayRows + AJM.tradeScrollOffset - if dataRowNumber <= AJM.tradeScrollMaximumRows then - -- Put items in cells. - for columnNumber, inventoryInfoTable in pairs( AJM.inventoryInDisplayTable[dataRowNumber] ) do - slotNumber = columnNumber + ((iterateDisplayRows - 1) * AJM.tradeScrollItemsPerRow) - slot = JambaTradeInventoryFrame.slots[slotNumber] - local name, link, quality, iLevel, reqLevel, class, subClass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo( inventoryInfoTable["inventoryItemID"] ) - if texture == nil then - texture = "Interface\\Icons\\Temp" - r = 0.9 - g = 0.0 - b = 0.0 - else - r, g, b = GetItemQualityColor( quality ) - end - SetItemButtonTexture( slot, texture ) - SetItemButtonCount( slot, tonumber( inventoryInfoTable["itemCount"] ) ) - if AJM.itemClassCurrentSelection == class and AJM.itemSubClassCurrentSelection == subClass then - SetItemButtonTextureVertexColor( slot, 0.4, 0.9, 0.0 ) - SetItemButtonNormalTextureVertexColor( slot, 0.9, 0.9, 0.0 ) - elseif AJM.itemClassCurrentSelection == L["!Single Item"] and AJM.itemSubClassCurrentSelection == name then - SetItemButtonTextureVertexColor( slot, 0.4, 0.9, 0.0 ) - SetItemButtonNormalTextureVertexColor( slot, 0.9, 0.9, 0.0 ) - elseif AJM.itemClassCurrentSelection == L["!Quality"] and AJM.itemSubClassCurrentSelection == AJM:GetQualityName( quality ) then - SetItemButtonTextureVertexColor( slot, 0.4, 0.9, 0.0 ) - SetItemButtonNormalTextureVertexColor( slot, 0.9, 0.9, 0.0 ) - else - SetItemButtonTextureVertexColor( slot, 1.0, 1.0, 1.0 ) - SetItemButtonNormalTextureVertexColor( slot, r, g, b ) - end - slot.link = link - slot.bag = inventoryInfoTable["bag"] - slot.slot = inventoryInfoTable["slot"] - slot:Show() - end - end - end -end diff --git a/Jamba-Trade/Locales/JambaTrade-Locale-enUS.lua b/Jamba-Trade/Locales/JambaTrade-Locale-enUS.lua index bb5ef7c..275dab9 100644 --- a/Jamba-Trade/Locales/JambaTrade-Locale-enUS.lua +++ b/Jamba-Trade/Locales/JambaTrade-Locale-enUS.lua @@ -15,28 +15,21 @@ L["Settings received from A."] = function( characterName ) return "Settings received from "..characterName.."." end L["Message Area"] = true -L["Load Item By Name"] = true -L["Load a certain amount of an item by name into the trade window."] = true -L["Load Items By Type"] = true -L["Load items by type into the trade window."] = true -L["Load Mine"] = true -L["Load Theirs"] = true -L["Jamba-Trade: Please provide a class and a subclass seperated by a comma for the loadtype command."] = true -L["Jamba-Trade: Please provide a name and an amount seperated by a comma for the loadname command."] = true -L["!Single Item"] = true -L["Show Jamba Trade Window On Trade"] = true L["Adjust Toon Money While Visiting The Guild Bank"] = true L["Amount of Gold"] = true -L["!Quality"] = true -L["0. Poor (gray)"] = true -L["1. Common (white)"] = true -L["2. Uncommon (green)"] = true -L["3. Rare / Superior (blue)"] = true -L["4. Epic (purple)"] = true -L["5. Legendary (orange)"] = true -L["6. Artifact (golden yellow)"] = true -L["7. Heirloom (light yellow)"] = true -L["Unknown"] = true -L["Ignore Soulbound"] = true +L["Add"] = true +L["Other Tag"] = true +L["Other Item (drag item to box)"] = true +L["Remove"] = true +L["Trade The List Of Items With Master"]= true +L["Trade Item List"] = true +L["Add Items"] = true +L["Toon"] = true +L["Item tags must only be made up of letters and numbers."] = true +L["Are you sure you wish to remove the selected item from the trade items list?"] = true L["Trade Excess Gold To Master From Minion"] = true L["Amount Of Gold To Keep"] = true +L["Trades Binds When Equipped Items With Master"] = true +L["Is Not a Member of the team, Will not trade Gold."] = true +L["Is Not a Member of the team, Will not trade Items."] = true +L["Trades Crafting Reagents Items With Master"] = true diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/CHANGES.txt b/Jamba/Libs/LibItemUpgradeInfo-1.0/CHANGES.txt new file mode 100644 index 0000000..340f8e4 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/CHANGES.txt @@ -0,0 +1,18 @@ +tag 5876ed6c59ef3d2568d88b9bba9ec77682e6074e Release-70200-28 +Author: Alar of Runetotem <alar@aspide.it> +Date: Tue Mar 28 12:21:53 2017 +0200 + +Toc updated to 70200 + +commit 7c5485ab35700b2e38a008feb84e4af34b7396f0 +Author: Alar of Runetotem <alar@aspide.it> +Date: Tue Mar 28 12:07:53 2017 +0200 + + Updated TOC to 70200 + +commit c4ed50190aad123c1297705da7f38c86f7ab1d10 +Author: Alar of Runetotem <alar@aspide.it> +Date: Tue Mar 28 11:30:56 2017 +0200 + + toc update + diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/Core.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/Core.lua new file mode 100644 index 0000000..422fc3e --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/Core.lua @@ -0,0 +1,654 @@ +local MAJOR, MINOR = "LibItemUpgradeInfo-1.0", 28 +local type,tonumber,select,strsplit,GetItemInfoFromHyperlink=type,tonumber,select,strsplit,GetItemInfoFromHyperlink +local library,previous = _G.LibStub:NewLibrary(MAJOR, MINOR) +local lib=library --#lib Needed to keep Eclipse LDT happy +if not lib then return end +local pp=print +--[===[@debug@ +LoadAddOn("Blizzard_DebugTools") +LoadAddOn("LibDebug") +if LibDebug then LibDebug() end +--@end-debug@]===] +--@non-debug@ +local print=function() end +--@end-non-debug@ +--[[ +Caching system +1 itemName String The name of the item. +2 itemLink String The item link of the item. +3 itemRarity Number The quality of the item. The value is 0 to 7, which represents Poor to Heirloom. This appears to include gains from upgrades/bonuses. +4 itemLevel Number The item level of this item, not including item levels gained from upgrades. There is currently no API to get the item level including upgrades/bonuses. +5 itemMinLevel Number The minimum level required to use the item, 0 meaning no level requirement. +6 itemType String The type of the item: Armor, Weapon, Quest, Key, etc. (localized) +7 itemSubType String The sub-type of the item: Enchanting, Cloth, Sword, etc. See itemType. (localized) +8 itemStackCount Number How many of the item per stack: 20 for Runecloth, 1 for weapon, 100 for Alterac Ram Hide, etc. +9 itemEquipLoc String The type of inventory equipment location in which the item may be equipped, or "" if it can't be equippable. The string returned is also the name of a global string variable e.g. if "INVTYPE_WEAPONMAINHAND" is returned, _G["INVTYPE_WEAPONMAINHAND"] will be the localized, displayable name of the location. +10 iconFileDataID Number The FileDataID for the icon texture for the item. +11 itemSellPrice Number The price, in copper, a vendor is willing to pay for this item, 0 for items that cannot be sold. +12 itemClassID Number This is the numerical value that determines the string to display for 'itemType'. +13 itemSubClassID Number This is the numerical value that determines the string to display for 'itemSubType' +14 ? number +15 expansionId +16 ? ? +17 ? boolean +--]] +-- ItemLink Constants +local i_Name=1 +local i_Link=2 +local i_Rarity=3 +local i_Quality=3 +local i_Level=4 +local i_MinLevel =5 +local i_ClassName=6 +local i_SubClassName=7 +local i_StackCount=8 +local i_EquipLoc=9 +local i_TextureId=10 +local i_SellPrice=11 +local i_ClassID=12 +local i_SubClass_ID=13 +local i_unk1=14 +local i_unk2=15 +local i_unk3=16 +local i_unk4=17 + + +do +local oGetItemInfo=GetItemInfo +lib.itemcache=lib.itemcache or + setmetatable({miss=0,tot=0},{ + __index=function(table,key) + if (not key) then return "" end + if (key=="miss") then return 0 end + if (key=="tot") then return 0 end + local cached={oGetItemInfo(key)} + if #cached==0 then return nil end + local itemLink=cached[2] + if not itemLink then return nil end + local itemID=lib:GetItemID(itemLink) + local quality=cached[3] + local cacheIt=true + if quality==LE_ITEM_QUALITY_ARTIFACT then + local relic1, relic2, relic3 = select(4,strsplit(':', itemLink)) + if relic1 and relic1 ~= '' and not oGetItemInfo(relic1) then cacheIt = false end + if relic2 and relic2 ~= '' and not oGetItemInfo(relic2) then cacheIt = false end + if relic3 and relic3 ~= '' and not oGetItemInfo(relic3) then cacheIt = false end + end + cached.englishClass=GetItemClassInfo(cached[12]) + cached.englishSubClass=GetItemSubClassInfo(cached[12],cached[13]) + if cacheIt then + rawset(table,key,cached) + end + table.miss=table.miss+1 + return cached + end + + }) +end +local cache,select,unpack=lib.itemcache,select,unpack +local function CachedGetItemInfo(key,index) + if not key then return nil end + index=index or 1 + cache.tot=cache.tot+1 + local cached=cache[key] + if cached and type(cached)=='table' then + return select(index,unpack(cached)) + else + rawset(cache,key,nil) -- voiding broken cache entry + end +end + +local upgradeTable = { + [ 1] = { upgrade = 1, max = 1, ilevel = 8 }, + [373] = { upgrade = 1, max = 3, ilevel = 4 }, + [374] = { upgrade = 2, max = 3, ilevel = 8 }, + [375] = { upgrade = 1, max = 3, ilevel = 4 }, + [376] = { upgrade = 2, max = 3, ilevel = 4 }, + [377] = { upgrade = 3, max = 3, ilevel = 4 }, + [378] = { ilevel = 7 }, + [379] = { upgrade = 1, max = 2, ilevel = 4 }, + [380] = { upgrade = 2, max = 2, ilevel = 4 }, + [445] = { upgrade = 0, max = 2, ilevel = 0 }, + [446] = { upgrade = 1, max = 2, ilevel = 4 }, + [447] = { upgrade = 2, max = 2, ilevel = 8 }, + [451] = { upgrade = 0, max = 1, ilevel = 0 }, + [452] = { upgrade = 1, max = 1, ilevel = 8 }, + [453] = { upgrade = 0, max = 2, ilevel = 0 }, + [454] = { upgrade = 1, max = 2, ilevel = 4 }, + [455] = { upgrade = 2, max = 2, ilevel = 8 }, + [456] = { upgrade = 0, max = 1, ilevel = 0 }, + [457] = { upgrade = 1, max = 1, ilevel = 8 }, + [458] = { upgrade = 0, max = 4, ilevel = 0 }, + [459] = { upgrade = 1, max = 4, ilevel = 4 }, + [460] = { upgrade = 2, max = 4, ilevel = 8 }, + [461] = { upgrade = 3, max = 4, ilevel = 12 }, + [462] = { upgrade = 4, max = 4, ilevel = 16 }, + [465] = { upgrade = 0, max = 2, ilevel = 0 }, + [466] = { upgrade = 1, max = 2, ilevel = 4 }, + [467] = { upgrade = 2, max = 2, ilevel = 8 }, + [468] = { upgrade = 0, max = 4, ilevel = 0 }, + [469] = { upgrade = 1, max = 4, ilevel = 4 }, + [470] = { upgrade = 2, max = 4, ilevel = 8 }, + [471] = { upgrade = 3, max = 4, ilevel = 12 }, + [472] = { upgrade = 4, max = 4, ilevel = 16 }, + [491] = { upgrade = 0, max = 4, ilevel = 0 }, + [492] = { upgrade = 1, max = 4, ilevel = 4 }, + [493] = { upgrade = 2, max = 4, ilevel = 8 }, + [494] = { upgrade = 0, max = 6, ilevel = 0 }, + [495] = { upgrade = 1, max = 6, ilevel = 4 }, + [496] = { upgrade = 2, max = 6, ilevel = 8 }, + [497] = { upgrade = 3, max = 6, ilevel = 12 }, + [498] = { upgrade = 4, max = 6, ilevel = 16 }, + [503] = { upgrade = 3, max = 3, ilevel = 1 }, + [504] = { upgrade = 3, max = 4, ilevel = 12 }, + [505] = { upgrade = 4, max = 4, ilevel = 16 }, + [506] = { upgrade = 5, max = 6, ilevel = 20 }, + [507] = { upgrade = 6, max = 6, ilevel = 24 }, + [529] = { upgrade = 0, max = 2, ilevel = 0 }, + [530] = { upgrade = 1, max = 2, ilevel = 5 }, + [531] = { upgrade = 2, max = 2, ilevel = 10 }, + [535] = { upgrade = 1, max = 3, ilevel = 15 }, + [536] = { upgrade = 2, max = 3, ilevel = 30 }, + [537] = { upgrade = 3, max = 3, ilevel = 45 }, + [538] = { upgrade = 0, max = 3, ilevel = 0 }, + +} +do + local stub = { ilevel = 0 } + setmetatable(upgradeTable, { __index = function(t, key) + return stub + end}) +end +-- Tooltip Scanning stuff +local itemLevelPattern = _G.ITEM_LEVEL:gsub("%%d", "(%%d+)") +local soulboundPattern = _G.ITEM_SOULBOUND +local boePattern=_G.ITEM_BIND_ON_EQUIP +local bopPattern=_G.ITEM_BIND_ON_PICKUP +local boaPattern1=_G.ITEM_BIND_TO_BNETACCOUNT +local boaPattern2=_G.ITEM_BNETACCOUNTBOUND + +local scanningTooltip +local anchor +local tipCache = lib.tipCache or setmetatable({},{__index=function(table,key) return {} end}) +local emptytable={} + +local function ScanTip(itemLink,itemLevel,show) + if type(itemLink)=="number" then + itemLink=CachedGetItemInfo(itemLink,2) + if not itemLink then return emptytable end + end + if type(tipCache[itemLink].ilevel)=="nil"then -- or not tipCache[itemLink].cached then + local cacheIt=true + if not scanningTooltip then + anchor=CreateFrame("Frame") + anchor:Hide() + scanningTooltip = _G.CreateFrame("GameTooltip", "LibItemUpgradeInfoTooltip", nil, "GameTooltipTemplate") + end + --scanningTooltip:ClearLines() + GameTooltip_SetDefaultAnchor(scanningTooltip,anchor) + local itemString=itemLink:match("|H(.-)|h") + local rc,message=pcall(scanningTooltip.SetHyperlink,scanningTooltip,itemString) + if (not rc) then + return emptytable + end + scanningTooltip:Show() + local quality,_,_,class,subclass,_,_,_,_,classIndex,subclassIndex=CachedGetItemInfo(itemLink,3) + + -- line 1 is the item name + -- line 2 may be the item level, or it may be a modifier like "Heroic" + -- check up to line 6 just in case + local ilevel,soulbound,bop,boe,boa,heirloom + if quality==LE_ITEM_QUALITY_ARTIFACT and itemLevel then + local relic1, relic2, relic3 = select(4,strsplit(':', itemLink)) + if relic1 and relic1 ~= '' and not CachedGetItemInfo(relic1) then cacheIt = false end + if relic2 and relic2 ~= '' and not CachedGetItemInfo(relic2) then cacheIt = false end + if relic3 and relic3 ~= '' and not CachedGetItemInfo(relic3) then cacheIt = false end + ilevel=itemLevel + end + if show then + for i=1,12 do + local l, ltext = _G["LibItemUpgradeInfoTooltipTextLeft"..i], nil + local r, rtext = _G["LibItemUpgradeInfoTooltipTextRight"..i], nil + ltext=l:GetText() + rtext=r:GetText() + pp(i,ltext,' - ',rtext) + end + end + for i = 2, 6 do + local label, text = _G["LibItemUpgradeInfoTooltipTextLeft"..i], nil + if label then text=label:GetText() end + if text then + if ilevel==nil then ilevel = tonumber(text:match(itemLevelPattern)) end + if soulbound==nil then soulbound = text:find(soulboundPattern) end + if bop==nil then bop = text:find(bopPattern) end + if boe==nil then boe = text:find(boePattern) end + if boa==nil then boa = text:find(boaPattern1) end + if boa==nil then boa = text:find(boaPattern2) end + end + end + tipCache[itemLink]={ + ilevel=ilevel or itemLevel, + soulbound=soulbound, + bop=bop, + boe=boe, + cached=cacheIt + } + scanningTooltip:Hide() + end + return tipCache[itemLink] +end + + +-- GetUpgradeID(itemString) +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Number - The upgrade ID (possibly 0), or nil if the input is invalid or +-- does not contain upgrade info +function lib:GetUpgradeID(itemString) + if type(itemString)~="string" then return end + local itemString = itemString:match("item[%-?%d:]+") or ""-- Standardize itemlink to itemstring + local instaid, _, numBonuses, affixes = select(12, strsplit(":", itemString, 15)) + instaid=tonumber(instaid) or 7 + numBonuses=tonumber(numBonuses) or 0 + if instaid >0 and (instaid-4)%8==0 then + return tonumber((select(numBonuses + 1, strsplit(":", affixes)))) + end +end + +-- GetCurrentUpgrade(id) +-- +-- Returns the current upgrade level of the item, e.g. 1 for a 1/2 item. +-- +-- Arguments: +-- id - Number - The upgrade ID of the item (obtained via GetUpgradeID()) +-- +-- Returns: +-- Number - The current upgrade level of the item. Returns nil if the item +-- cannot be upgraded +function lib:GetCurrentUpgrade(id) + return upgradeTable[id].upgrade +end + +-- GetMaximumUpgrade(id) +-- +-- Returns the maximum upgrade level of the item, e.g. 2 for a 1/2 item. +-- +-- Arguments: +-- id - Number - The upgrade ID of the item (obtained via GetUpgradeID()) +-- +-- Returns: +-- Number - The maximum upgrade level of the item. Returns nil if the item +-- cannot be upgraded +function lib:GetMaximumUpgrade(id) + return upgradeTable[id].max +end + +-- GetItemLevelUpgrade(id) +-- +-- Returns the item level increase that this upgrade is worth, e.g. 4 for a +-- 1/2 item or 8 for a 2/2 item. +-- +-- Arguments: +-- id - Number - The upgrade ID of the item (obtained via GetUpgradeID()) +-- +-- Returns: +-- Number - The item level increase of the item. Returns 0 if the item +-- cannot be or has not been upgraded +function lib:GetItemLevelUpgrade(id) + return upgradeTable[id].ilevel +end + +-- GetItemUpgradeInfo(itemString) +-- +-- Returns the current upgrade level, maximum upgrade level, and item level +-- increase for an item. +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns if the item can be upgraded: +-- Number - The current upgrade level of the item +-- Number - The maximum upgrade level of the item +-- Number - The item level increase of the item +-- or if the item cannot be upgraded: +-- nil +-- nil +-- 0 +-- or if the item is invalid or does not contain upgrade info: +-- nil +function lib:GetItemUpgradeInfo(itemString) + local id = self:GetUpgradeID(itemString) + if id then + local cur = self:GetCurrentUpgrade(id) + local max = self:GetMaximumUpgrade(id) + local delta = self:GetItemLevelUpgrade(id) + return cur, max, delta + end + return nil +end + +-- GetHeirloomTrueLevel(itemString) +-- +-- Returns the true item level for an heirloom (actually, returns the true level for any adapting item) +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Number, Boolean - The true item level of the item. If the item is not +-- an heirloom, or an error occurs when trying to scan the +-- item tooltip, the second return value is false. Otherwise +-- the second return value is true. If the input is invalid, +-- (nil, false) is returned. +-- Convert the ITEM_LEVEL constant into a pattern for our use +function lib:GetHeirloomTrueLevel(itemString) + if type(itemString) ~= "string" then return nil,false end + local _, itemLink, rarity, itemLevel = CachedGetItemInfo(itemString) + if (not itemLink) then + return nil,false + end + local rc=ScanTip(itemLink,itemLevel) + if rc.ilevel then + return rc.ilevel,true + end + return itemLevel, false +end + +-- GetUpgradedItemLevel(itemString) +-- +-- Returns the true item level of the item, including upgrades and heirlooms. +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Number - The true item level of the item, or nil if the input is invalid +function lib:GetUpgradedItemLevel(itemString) + -- check for heirlooms first + local ilvl, isTrue = self:GetHeirloomTrueLevel(itemString) + if isTrue then + return ilvl + end + -- not an heirloom? fall back to the regular item logic + local id = self:GetUpgradeID(itemString) + if ilvl and id then + ilvl = ilvl + self:GetItemLevelUpgrade(id) + end + return ilvl +end + +-- IsBop(itemString) +-- +-- Check an item for Bind On Pickup. +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Boolean - True if Bind On Pickup + +function lib:IsBop(itemString) + local rc=ScanTip(itemString) + return rc.bop +end +-- IsBoe(itemString) +-- +-- Check an item for Bind On Equip. +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Boolean - True if Bind On Equip + +function lib:IsBoe(itemString) + local rc=ScanTip(itemString) + return rc.boe +end +-- IsBoa(itemString) +-- +-- Check an item for Bind On Aaccount +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Boolean - True if Bind On Equip + +function lib:IsBoa(itemString) + local rc=ScanTip(itemString) + return rc.boa +end + +-- IsArtifact(itemString) +-- +-- Check an item for Heirloom +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Boolean - True if Artifact + +function lib:IsArtifact(itemString) + return CachedGetItemInfo(itemString,i_Quality)==LE_ITEM_QUALITY_ARTIFACT +end + +-- GetClassInfoIsHeirloom(itemString) +-- +-- Retrieve class and subclass +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- class,subclass + + +function lib:GetClassInfo(itemString) + local rc=ScantTip(itemString) + return rc.class,rc.subclass +end + + +-- IsHeirloom(itemString) +-- +-- Check an item for Heirloom +-- +-- Arguments: +-- itemString - String - An itemLink or itemString denoting the item +-- +-- Returns: +-- Boolean - True if Heirloom + +function lib:IsHeirloom(itemString) + return CachedGetItemInfo(itemString,i_Quality) ==LE_ITEM_QUALITY_HEIRLOOM +end +--- +-- Parses an itemlink and returns itemId without calling API again +-- @param #lib self +-- @param #string itemlink +-- @return #number itemId or 0 +function lib:GetItemID(itemlink) + if (type(itemlink)=="string") then + local itemid,context=GetItemInfoFromHyperlink(itemlink) + return tonumber(itemid) or 0 + --return tonumber(itemlink:match("Hitem:(%d+):")) or 0 + else + return 0 + end +end + +--- +-- +-- Returns a caching version of GetItemInfo. Can be used to override the original one. +-- Adds a second parameter to directly retrieving a specific value +-- (Note: internally uses select so it's actually like calling select(n,GetItemInfo(itemID)) +-- +-- Arguments: +-- self #lib self +-- +-- Returns: +-- #function The new function + +--@do-not-package-- +function lib:ScanTip(itemLink) + local GameTooltip=LibItemUpgradeInfoTooltip + if GameTooltip then + GameTooltip_SetDefaultAnchor(GameTooltip, UIParent) + GameTooltip:SetHyperlink(itemLink) + GameTooltip:Show() + end + return ScanTip(itemLink,100,true) +end +function lib:GetCachingGetItemInfo() + return CachedGetItemInfo +end +function lib:GetCacheStats() + local c=lib.itemcache + local h=c.tot-c.miss + local perc=( h>0) and h/c.tot*100 or 0 + return c.miss,h,perc +end +function lib:GetCache() + return lib.itemcache +end +function lib:CleanCache() + return wipe(lib.itemcache) +end + +--[===========[ ]===========] +--[===[ Debug utilities ]===] +--[===========[ ]===========] + +local function compareTables(t1, t2) + local seen = {} + for k, v1 in pairs(t1) do + seen[k] = true + local v2 = rawget(t2, k) + if not v2 then return false end + if type(v1) ~= type(v2) then return false end + if type(v1) == "table" then + if not compareTables(v1, v2) then return false end + elseif v1 ~= v2 then return false end + end + for k in pairs(t2) do + if not seen[k] then return false end + end + return true +end + +-- prints the table rows in red and green +-- omits the lead { and the trailing } +local function printDiffTable(t1, t2) + local keys, seen = {}, {} + for k in pairs(t1) do + keys[#keys+1] = k + seen[k] = true + end + for k in pairs(t2) do + if not seen[k] then + keys[#keys+1] = k + end + end + table.sort(keys) + local function formatTable(t) + local comps = {} + for k, v in pairs(t) do + comps[#comps+1] = ("%s = %d"):format(k, v) + end + return "{ " .. table.concat(comps, ", ") .. " }" + end + for _, k in ipairs(keys) do + local v1, v2 = rawget(t1, k), rawget(t2, k) + local equal + if type(v1) == "table" and type(v2) == "table" then equal = compareTables(v1, v2) + else equal = v1 == v2 end + if not equal then + if v1 then + pp(("|cffff0000 [%d] = %s,|r"):format(k, formatTable(v1))) + end + if v2 then + pp(("|cff00ff00 [%d] = %s,|r"):format(k, formatTable(v2))) + end + end + end +end + +-- Scans the first 10000 upgrade IDs +-- Run this with /run LibStub:GetLibrary("LibItemUpgradeInfo-1.0"):_CheckUpgradeTable() +-- If you don't have Aspirant's Staff of Harmony cached it may error out, just try again. +do + local debugFrame + local worker + local newTable + local debugTooltip + function lib:_CheckUpgradeTable(itemLink) + if worker then + pp("|cffff0000LibItemUpgradeInfo-1.0: upgrade check already in progress") + return + end + if not debugFrame then + debugFrame = _G.CreateFrame("frame") + debugFrame:Hide() + debugFrame:SetScript("OnUpdate", function() + local ok, result, count, max = pcall(worker) + if not ok or result then + debugFrame:Hide() + worker = nil + end + if not ok then + pp("|cffff0000LibItemUpgradeInfo-1.0 error: " .. result .. "|r") + elseif result then + pp("LibItemUpgradeInfo-1.0: scan complete") + if compareTables(upgradeTable, newTable) then + pp("LibItemUpgradeInfo-1.0: |cff00ff00No changes|r") + else + pp("LibItemUpgradeInfo-1.0: |cffff0000New table:|r {") + printDiffTable(upgradeTable, newTable) + pp("}") + end + else + pp("LibItemUpgradeInfo-1.0: scanning " .. count .. "/" .. max) + end + end) + end + if not debugTooltip then + debugTooltip = _G.CreateFrame("GameTooltip", "LibItemUpgradeInfoDebugTooltip", nil, "GameTooltipTemplate") + debugTooltip:SetOwner(_G.WorldFrame, "ANCHOR_NONE") + end + newTable = {} + --local itemLink = "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:90:253:0:0:1:0|h[Aspirant's Staff of Harmony]|h|r" + local itemLink = itemLink or "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:100:253:4:0:0:0|h[Aspirant's Staff of Harmony]|h|r" +-- Livello è il 9,upgradeid il 14. Al decimo posto, un valore che deve essere 4 o 4+n *8) per far scattare l'uso dell'upgradeid + local itemLevel = select(4, _G.GetItemInfo(itemLink)) + assert(itemLevel, "Can't find item level for itemLink") + local count, max, batchsize = 0, 10000, 200 + worker = function() + for i = count, math.min(max, count+batchsize) do + local link = itemLink:gsub("%d+|h", i.."|h") + debugTooltip:ClearLines() + debugTooltip:SetHyperlink(link) + local upgrade, max + local curLevel, maxLevel = _G.LibItemUpgradeInfoDebugTooltipTextLeft3:GetText():match("^Upgrade Level: (%d+)/(%d+)") + local ilvl = tonumber(_G.LibItemUpgradeInfoDebugTooltipTextLeft2:GetText():match("Item Level (%d+)")) + if not ilvl then + ilvl = tonumber(_G.LibItemUpgradeInfoDebugTooltipTextLeft3:GetText():match("Item Level (%d+)")) + end + assert(ilvl ~= nil, "Can't find ItemLevel in tooltip: " .. _G.LibItemUpgradeInfoDebugTooltipTextLeft2:GetText()) + if curLevel or maxLevel or ilvl ~= itemLevel then + newTable[i] = { upgrade = tonumber(curLevel), max = tonumber(maxLevel), ilevel = ilvl - itemLevel } + end + end + count = count + batchsize + return (count > max), count, max + end + debugFrame:Show() + end +end +--@end-do-not-package-- + +-- vim: set noet sw=4 ts=4: diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc new file mode 100644 index 0000000..c8552d8 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.toc @@ -0,0 +1,9 @@ +## Interface: 70200 +## Title: Lib: ItemUpgradeInfo-1.0 +## Notes: Database of item upgrade IDs +## Author: eridius +## Version: Release-70200-28 70200 +## X-Revision: 7c5485a +## X-Category: Library + +LibItemUpgradeInfo-1.0.xml diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.xml b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.xml new file mode 100644 index 0000000..49934ad --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibItemUpgradeInfo-1.0.xml @@ -0,0 +1,4 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> + <Script file="LibStub\LibStub.lua"/> + <Script file="Core.lua"/> +</Ui> diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.lua new file mode 100644 index 0000000..ae1900e --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.lua @@ -0,0 +1,51 @@ +-- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $ +-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info +-- LibStub is hereby placed in the Public Domain +-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke +local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! +local LibStub = _G[LIBSTUB_MAJOR] + +-- Check to see is this version of the stub is obsolete +if not LibStub or LibStub.minor < LIBSTUB_MINOR then + LibStub = LibStub or {libs = {}, minors = {} } + _G[LIBSTUB_MAJOR] = LibStub + LibStub.minor = LIBSTUB_MINOR + + -- LibStub:NewLibrary(major, minor) + -- major (string) - the major version of the library + -- minor (string or number ) - the minor version of the library + -- + -- returns nil if a newer or same version of the lib is already present + -- returns empty library object or old library object if upgrade is needed + function LibStub:NewLibrary(major, minor) + assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") + minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") + + local oldminor = self.minors[major] + if oldminor and oldminor >= minor then return nil end + self.minors[major], self.libs[major] = minor, self.libs[major] or {} + return self.libs[major], oldminor + end + + -- LibStub:GetLibrary(major, [silent]) + -- major (string) - the major version of the library + -- silent (boolean) - if true, library is optional, silently return nil if its not found + -- + -- throws an error if the library can not be found (except silent is set) + -- returns the library object if found + function LibStub:GetLibrary(major, silent) + if not self.libs[major] and not silent then + error(("Cannot find a library instance of %q."):format(tostring(major)), 2) + end + return self.libs[major], self.minors[major] + end + + -- LibStub:IterateLibraries() + -- + -- Returns an iterator for the currently registered libraries + function LibStub:IterateLibraries() + return pairs(self.libs) + end + + setmetatable(LibStub, { __call = LibStub.GetLibrary }) +end diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc new file mode 100644 index 0000000..ef0b412 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/LibStub.toc @@ -0,0 +1,9 @@ +## Interface: 70200 +## Title: Lib: LibStub +## Notes: Universal Library Stub +## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel +## X-Website: http://www.wowace.com/addons/libstub/ +## X-Category: Library +## X-License: Public Domain + +LibStub.lua diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test.lua new file mode 100644 index 0000000..338bcf4 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test.lua @@ -0,0 +1,41 @@ +debugstack = debug.traceback +strmatch = string.match + +loadfile("../LibStub.lua")() + +local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy +assert(lib) -- should return the library table +assert(not oldMinor) -- should not return the old minor, since it didn't exist + +-- the following is to create data and then be able to check if the same data exists after the fact +function lib:MyMethod() +end +local MyMethod = lib.MyMethod +lib.MyTable = {} +local MyTable = lib.MyTable + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail +assert(not newLib) -- should not return since out of date + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail +assert(not newLib) -- should not return since out of date + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version +assert(newLib) -- library table +assert(rawequal(newLib, lib)) -- should be the same reference as the previous +assert(newOldMinor == 1) -- should return the minor version of the previous version + +assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved +assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number) +assert(newLib) -- library table +assert(newOldMinor == 2) -- previous version was 2 + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number) +assert(newLib) +assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string) + +local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string +assert(newLib) +assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string) diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test2.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test2.lua new file mode 100644 index 0000000..eae7172 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test2.lua @@ -0,0 +1,27 @@ +debugstack = debug.traceback +strmatch = string.match + +loadfile("../LibStub.lua")() + +for major, library in LibStub:IterateLibraries() do + -- check that MyLib doesn't exist yet, by iterating through all the libraries + assert(major ~= "MyLib") +end + +assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking +assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error. +local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib +assert(lib) -- check it exists +assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference + +assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version + +local count=0 +for major, library in LibStub:IterateLibraries() do + -- check that MyLib exists somewhere in the libraries, by iterating through all the libraries + if major == "MyLib" then -- we found it! + count = count +1 + assert(rawequal(library, lib)) -- verify that the references are equal + end +end +assert(count == 1) -- verify that we actually found it, and only once diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test3.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test3.lua new file mode 100644 index 0000000..21bda2b --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test3.lua @@ -0,0 +1,14 @@ +debugstack = debug.traceback +strmatch = string.match + +loadfile("../LibStub.lua")() + +local proxy = newproxy() -- non-string + +assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata +local success, ret = pcall(LibStub.GetLibrary, proxy, true) +assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered. + +assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it. + +assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement diff --git a/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test4.lua b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test4.lua new file mode 100644 index 0000000..4735246 --- /dev/null +++ b/Jamba/Libs/LibItemUpgradeInfo-1.0/LibStub/tests/test4.lua @@ -0,0 +1,41 @@ +debugstack = debug.traceback +strmatch = string.match + +loadfile("../LibStub.lua")() + + +-- Pretend like loaded libstub is old and doesn't have :IterateLibraries +assert(LibStub.minor) +LibStub.minor = LibStub.minor - 0.0001 +LibStub.IterateLibraries = nil + +loadfile("../LibStub.lua")() + +assert(type(LibStub.IterateLibraries)=="function") + + +-- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created +LibStub.IterateLibraries = 123 + +loadfile("../LibStub.lua")() + +assert(LibStub.IterateLibraries == 123) + + +-- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created +LibStub.minor = LibStub.minor + 0.0001 + +loadfile("../LibStub.lua")() + +assert(LibStub.IterateLibraries == 123) + + +-- Again with a huge number +LibStub.minor = LibStub.minor + 1234567890 + +loadfile("../LibStub.lua")() + +assert(LibStub.IterateLibraries == 123) + + +print("OK")