diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 221cad2..53f78d0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,9 +2,52 @@ ChangeLogs: --------------------------- -EMA Version: v8.0.1-Beta(0103) +EMA Version: v8.1.0-Release(0108) +Game Version: 8.1.0 +Release Date: 12/12/2018 + +# Toon + -- Fixed some API changes in WarMode that was changed in patch 8.1 + + +--------------------------- + +EMA Version: v8.0.1-Release(0107) +Game Version: 8.0.1 +Release Date: 02/12/2018 + +## Mail + # Added Support to Mail Gold! + # Fix The Mail Page getting stuck on the Outgoing Mail when Nothing to send! + # Postal addon should nolonger clear the last character you Mailed + + + + +--------------------------- + +EMA Version: v8.0.1-Release(0106) +Game Version: 8.0.1 +Release Date: 17/11/2018 + +## Interaction + # Loot + - Should Close Loot Window If There is no Items to Loot! issue #13 + #Taxi + - Taxi service changed to try and deal better with the Newer FightMap with the Same Point NAME! issue #38 + +## Quest + - Fixed a bug Lua Error on quest when the clone does not have more then one item to pick issue #17 + +## Item-Bar + - Fixed A Bug Where It Was Clearing Items In The Players Bag! issue #46 + + +--------------------------- + +EMA Version: v8.0.1-Release(0103) Game Version: 8.0.1 -Release Date: 05/10/2018 +Release Date: 23/10/2018 ## Interaction diff --git a/EMA.toc b/EMA.toc index 0f6e614..cc3ec05 100644 --- a/EMA.toc +++ b/EMA.toc @@ -2,7 +2,7 @@ ## Title: EMA ## Notes: Ebony's MultiBoxing Assistant ## Author: Jennifer Cally 'Ebony' -## Version: v8.0.1-Beta(0103) +## Version: v8.1.0-Release(0108) ## SavedVariables: CoreProfileDB, CommunicationsProfileDB, TeamProfileDB, TagProfileDB, MessageProfileDB, CurrProfileDB, DisplayTeamProfileDB, FollowProfileDB, GuildProfileDB, InteractionProfileDB, ItemUseProfileDB, PurchaseProfileDB, QuestProfileDB, QuestWatcherProfileDB, SellProfileDB, TalkProfileDB, ToonProfileDB, TradeProfileDB, MailProfileDB, ISBoxerProfileDB #Libs diff --git a/EbonyUtilities.lua b/EbonyUtilities.lua index 2c28fdd..52bfa94 100644 --- a/EbonyUtilities.lua +++ b/EbonyUtilities.lua @@ -110,6 +110,21 @@ function EbonyUtilities:FormatMoneyString( value ) return strtrim(goldFormat.." "..silverFormat.." "..copperFormat) end +-- A little toy to retun Gold, silver and copper for mail use +function EbonyUtilities:MoneyString( value ) + local gold = floor( value / ( EbonyUtilities.COPPER_PER_SILVER * EbonyUtilities.SILVER_PER_GOLD ) ); + local silver = floor( ( value - ( gold * EbonyUtilities.COPPER_PER_SILVER * EbonyUtilities.SILVER_PER_GOLD ) ) / EbonyUtilities.COPPER_PER_SILVER ); + local copper = mod( value, EbonyUtilities.COPPER_PER_SILVER ); + if gold <=0 then + goldFormat = "" + if silver <= 0 then + silverFormat = "" + end + end + return gold, silver, copper +end + + -- itemLink - the item link to extract an item id from. -- Gets an item id from an item link. Returns nil, if an item id could not be found. function EbonyUtilities:GetItemIdFromItemLink( itemLink ) diff --git a/Locales/Core-Locale-enUS.lua b/Locales/Core-Locale-enUS.lua index 57481ff..d895671 100644 --- a/Locales/Core-Locale-enUS.lua +++ b/Locales/Core-Locale-enUS.lua @@ -591,7 +591,7 @@ L["TRADE_REAGENTS_HELP"] = "Trades All Crafting Reagent Items" L["TRADE_OPTIONS"] = "Trade To Options" L["TRADE_GOLD"] = "Trade Excess Gold To Master From Minion" L["TRADE_GOLD_HELP"] = "Trade Excess Gold To Master From Minions \nAlways Be Careful When Auto Trading." -L["GOLD_TO_KEEP"] = "Amount of Gold To Keep On Current Minion" +L["GOLD_TO_KEEP"] = "Amount of Gold To Keep:" L["TRADE_TAG_ERR"] = "Item Tags Must Only Be Made Up Of Letters And Numbers." L["ERR_WILL_NOT_TRADE"] = "Is Not A Member Of The Team, Will Not Trade Items." L["ADD_ITEMS"] = "Add Items" @@ -906,8 +906,20 @@ L["MAIL_GOLD"] = "Adjust Characters Money While Visiting A Mail Box" L["MAIL_GOLD_HELP"] = "Adjust Characters Money While Visiting A Mail Box" L["SENT_AUTO_MAILER"] = "Sent By EMA Auto Mailer" L["Mail_OPTIONS"] = "Mail Options" ---PH -L["MAIL_GOLD_COMING_SOON"] = "Mail Gold Options Coming Soon™" +L["MAIL_GOLD_OPTIONS"] = "Mail Gold Options" + +L["SENT_AUTO_MAILER_GOLD"] = function( gold ) + return string.format("EMA Auto Gold Mailer: %s", gold ) +end + + +----------------------- +-- Bank Locale +L["BANK"] = "Bank" +L["REMOVE_BANK_LIST"] = "Remove Item From Bank List" + + + ----------------------- -- LDBBar Locale diff --git a/Modules/Bank.lua b/Modules/Bank.lua new file mode 100644 index 0000000..eb0283b --- /dev/null +++ b/Modules/Bank.lua @@ -0,0 +1,824 @@ +-- ================================================================================ -- +-- EMA - ( Ebony's MultiBoxing Assistant ) -- +-- Current Author: Jennifer Cally (Ebony) -- +-- -- +-- License: All Rights Reserved 2018 Jennifer Cally -- +-- -- +-- Some Code Used from "Jamba" that is -- +-- Released under the MIT License -- +-- "Jamba" Copyright 2008-2015 Michael "Jafula" Miller -- +-- -- +-- ================================================================================ -- + + +-- Create the addon using AceAddon-3.0 and embed some libraries. +local EMA = LibStub( "AceAddon-3.0" ):NewAddon( + "Bank", + "Module-1.0", + "AceConsole-3.0", + "AceEvent-3.0", + "AceHook-3.0", + "AceTimer-3.0" +) + +-- Get the EMA Utilities Library. +local EMAUtilities = LibStub:GetLibrary( "EbonyUtilities-1.0" ) +local EMAHelperSettings = LibStub:GetLibrary( "EMAHelperSettings-1.0" ) +--local LibBagUtils = LibStub:GetLibrary( "LibBagUtils-1.0" ) +local AceGUI = LibStub( "AceGUI-3.0" ) + +-- Constants and Locale for this module. +EMA.moduleName = "Bank" +EMA.settingsDatabaseName = "BankProfileDB" +EMA.chatCommand = "ema-Bank" +local L = LibStub( "AceLocale-3.0" ):GetLocale( "Core" ) +EMA.parentDisplayName = L["INTERACTION"] +EMA.moduleDisplayName = L["BANK"] +-- Icon +EMA.moduleIcon = "Interface\\Addons\\EMA\\Media\\BankIcon.tga" +-- order +EMA.moduleOrder = 20 + +-- Settings - the values to store and their defaults for the settings database. +EMA.settings = { + profile = { + messageArea = EMAApi.DefaultMessageArea(), + showEMABankWindow = false, + blackListItem = false, + BankBoEItems = false, + autoBankToonNameBoE = "", + BankTagName = EMAApi.AllGroup(), + autoBoEItemTag = EMAApi.AllGroup(), + BankCRItems = false, + autoBankToonNameCR = "", + autoCRItemTag = EMAApi.AllGroup(), + autoBankItemsList = {}, + adjustMoneyWithBankBank = false, + goldAmountToKeepOnToon = 250, + }, +} + +-- Configuration. +function EMA:GetConfiguration() + local configuration = { + name = EMA.moduleDisplayName, + handler = EMA, + type = 'group', + childGroups = "tab", + get = "EMAConfigurationGetSetting", + set = "EMAConfigurationSetSetting", + args = { + push = { + type = "input", + name = L["PUSH_SETTINGS"], + desc = L["PUSH_ALL_SETTINGS"], + usage = "/EMA-Bank push", + get = false, + set = "EMASendSettings", + guiHidden = true, + }, + }, + } + return configuration +end + +------------------------------------------------------------------------------------------------------------- +-- Command this module sends. +------------------------------------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------------------------------------- +-- Messages module sends. +------------------------------------------------------------------------------------------------------------- + + +------------------------------------------------------------------------------------------------------------- +-- Popup Dialogs. +------------------------------------------------------------------------------------------------------------- + +local function InitializePopupDialogs() + StaticPopupDialogs["EMABANK_CONFIRM_REMOVE_BANK_ITEMS"] = { + text = L["REMOVE_BANK_LIST"], + button1 = YES, + button2 = NO, + timeout = 0, + whileDead = 1, + hideOnEscape = 1, + OnAccept = function() + EMA:RemoveItem() + end, + } +end + +------------------------------------------------------------------------------------------------------------ +-- Addon initialization, enabling and disabling. +------------------------------------------------------------------------------------------------------------- + +-- Initialise the module. +function EMA:OnInitialize() + -- Initialise the popup dialogs. + InitializePopupDialogs() + EMA.autoBankItemLink = nil + EMA.autoBankToonName = nil + EMA.BankItemTable = {} + EMA.ShiftkeyDown = false + --EMA.putItemsInGB = {} + -- Create the settings control. + EMA:SettingsCreate() + -- Initialse the EMAModule part of this module. + EMA:EMAModuleInitialize( EMA.settingsControl.widgetSettings.frame ) + -- Populate the settings. + EMA:SettingsRefresh() +end + +-- Called when the addon is enabled. +function EMA:OnEnable() + EMA:RegisterEvent( "BANKFRAME_OPENED" ) + EMA:RegisterEvent( "BANKFRAME_CLOSED" ) + EMA:RegisterMessage( EMAApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) + EMA:RegisterMessage( EMAApi.GROUP_LIST_CHANGED , "OnGroupAreasChanged" ) +end + +-- Called when the addon is disabled. +function EMA:OnDisable() + -- AceHook-3.0 will tidy up the hooks for us. +end + +function EMA:SettingsCreate() + EMA.settingsControl = {} + -- Create the settings panel. + EMAHelperSettings:CreateSettings( + EMA.settingsControl, + EMA.moduleDisplayName, + EMA.parentDisplayName, + EMA.SettingsPushSettingsClick, + EMA.moduleIcon, + EMA.moduleOrder + ) + local bottomOfInfo = EMA:SettingsCreateBank( EMAHelperSettings:TopOfSettings() ) + EMA.settingsControl.widgetSettings.content:SetHeight( -bottomOfInfo ) + -- Help + local helpTable = {} + EMAHelperSettings:CreateHelp( EMA.settingsControl, helpTable, EMA:GetConfiguration() ) +end + +function EMA:SettingsPushSettingsClick( event ) + EMA:EMASendSettings() +end + +function EMA:SettingsCreateBank( top ) + local buttonControlWidth = 85 + local checkBoxHeight = EMAHelperSettings:GetCheckBoxHeight() + local editBoxHeight = EMAHelperSettings:GetEditBoxHeight() + local buttonHeight = EMAHelperSettings:GetButtonHeight() + local dropdownHeight = EMAHelperSettings:GetDropdownHeight() + local left = EMAHelperSettings:LeftOfSettings() + local headingHeight = EMAHelperSettings:HeadingHeight() + local headingWidth = EMAHelperSettings:HeadingWidth( false ) + local horizontalSpacing = EMAHelperSettings:GetHorizontalSpacing() + local indentContinueLabel = horizontalSpacing * 18 + local verticalSpacing = EMAHelperSettings:GetVerticalSpacing() + local BankWidth = headingWidth + local dropBoxWidth = (headingWidth - horizontalSpacing) / 4 + local halfWidth = (headingWidth - horizontalSpacing) / 2 + local thirdWidth = (headingWidth - indentContinueLabel) / 3 + local left2 = left + thirdWidth + horizontalSpacing + local left3 = left2 + thirdWidth + horizontalSpacing + local movingTop = top + local movingTopEdit = - 10 + -- A blank to get layout to show right? + EMAHelperSettings:CreateHeading( EMA.settingsControl, L[""], movingTop, false ) + movingTop = movingTop - headingHeight + EMAHelperSettings:CreateHeading( EMA.settingsControl, L["Bank_LIST_HEADER"], movingTop, false ) + movingTop = movingTop - headingHeight + EMA.settingsControl.checkBoxShowEMABankWindow = EMAHelperSettings:CreateCheckBox( + EMA.settingsControl, + headingWidth, + left2, + movingTop, + L["Bank_LIST"], + EMA.SettingsToggleShowEMABankWindow, + L["Bank_LIST_HELP"] + ) + movingTop = movingTop - checkBoxHeight + EMA.settingsControl.BankItemsHighlightRow = 1 + EMA.settingsControl.BankItemsOffset = 1 + local list = {} + list.listFrameName = "EMABankIteamsSettingsFrame" + list.parentFrame = EMA.settingsControl.widgetSettings.content + list.listTop = movingTop + list.listLeft = left + list.listWidth = BankWidth + list.rowHeight = 15 + list.rowsToDisplay = 10 + list.columnsToDisplay = 4 + list.columnInformation = {} + list.columnInformation[1] = {} + list.columnInformation[1].width = 40 + list.columnInformation[1].alignment = "LEFT" + list.columnInformation[2] = {} + list.columnInformation[2].width = 20 + list.columnInformation[2].alignment = "LEFT" + list.columnInformation[3] = {} + list.columnInformation[3].width = 20 + list.columnInformation[3].alignment = "LEFT" + list.columnInformation[4] = {} + list.columnInformation[4].width = 20 + list.columnInformation[4].alignment = "LEFT" + list.scrollRefreshCallback = EMA.SettingsScrollRefresh + list.rowClickCallback = EMA.SettingsBankItemsRowClick + EMA.settingsControl.BankItems = list + EMAHelperSettings:CreateScrollList( EMA.settingsControl.BankItems ) + movingTop = movingTop - list.listHeight - verticalSpacing + EMA.settingsControl.BankItemsButtonRemove = EMAHelperSettings:CreateButton( + EMA.settingsControl, + buttonControlWidth, + left2 + 50, + movingTop, + L["REMOVE"], + EMA.SettingsBankItemsRemoveClick + ) + movingTop = movingTop - buttonHeight - verticalSpacing + EMAHelperSettings:CreateHeading( EMA.settingsControl, L["ADD_ITEMS"], movingTop, false ) + + movingTop = movingTop - headingHeight + EMA.settingsControl.BankItemsEditBoxBankItem = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + thirdWidth, + left2, + movingTop, + L["ITEM_DROP"] + ) + EMA.settingsControl.BankItemsEditBoxBankItem:SetCallback( "OnEnterPressed", EMA.SettingsEditBoxChangedBankItem ) + movingTop = movingTop - editBoxHeight + + EMA.settingsControl.listCheckBoxBoxOtherBlackListItem = EMAHelperSettings:CreateCheckBox( + EMA.settingsControl, + thirdWidth, + left, + movingTop + movingTopEdit, + L["BLACKLIST_ITEM"], + EMA.SettingsToggleBlackListItem, + L["BLACKLIST_ITEM_HELP"] + ) + + EMA.settingsControl.tabNumListDropDownList = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + thirdWidth, + left2, + movingTop, + L["BankTOON"] + ) + EMA.settingsControl.tabNumListDropDownList:SetCallback( "OnEnterPressed", EMA.EditBankToonName ) + --Group + EMA.settingsControl.BankItemsEditBoxBankTag = EMAHelperSettings:CreateDropdown( + EMA.settingsControl, + thirdWidth, + left3, + movingTop, + L["GROUP_LIST"] + ) + EMA.settingsControl.BankItemsEditBoxBankTag:SetList( EMAApi.GroupList() ) + EMA.settingsControl.BankItemsEditBoxBankTag:SetCallback( "OnValueChanged", EMA.GroupListDropDownList ) + movingTop = movingTop - editBoxHeight + EMA.settingsControl.BankItemsButtonAdd = EMAHelperSettings:CreateButton( + EMA.settingsControl, + buttonControlWidth, + left2 + 50, + movingTop, + L["ADD"], + EMA.SettingsBankItemsAddClick + ) + movingTop = movingTop - buttonHeight + EMAHelperSettings:CreateHeading( EMA.settingsControl, L["Bank_OPTIONS"], movingTop, false ) + movingTop = movingTop - editBoxHeight - 3 + + EMA.settingsControl.checkBoxBankBoEItems = EMAHelperSettings:CreateCheckBox( + EMA.settingsControl, + thirdWidth, + left, + movingTop + movingTopEdit, + L["Bank_BOE_ITEMS"], + EMA.SettingsToggleBankBoEItems, + L["Bank_BOE_ITEMS_HELP"] + ) + EMA.settingsControl.tabNumListDropDownListBoE = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + thirdWidth, + left2, + movingTop, + L["BankTOON"] + ) + EMA.settingsControl.tabNumListDropDownListBoE:SetCallback( "OnEnterPressed", EMA.EditBankToonNameBoE ) + EMA.settingsControl.BankTradeBoEItemsTagBoE = EMAHelperSettings:CreateDropdown( + EMA.settingsControl, + thirdWidth, + left3, + movingTop, + L["GROUP_LIST"] + ) + EMA.settingsControl.BankTradeBoEItemsTagBoE:SetList( EMAApi.GroupList() ) + EMA.settingsControl.BankTradeBoEItemsTagBoE:SetCallback( "OnValueChanged", EMA.GroupListDropDownListBoE) + + movingTop = movingTop - editBoxHeight - 3 + EMA.settingsControl.checkBoxBankCRItems = EMAHelperSettings:CreateCheckBox( + EMA.settingsControl, + thirdWidth, + left, + movingTop + movingTopEdit, + L["Bank_REAGENTS"], + EMA.SettingsToggleBankCRItems, + L["Bank_REAGENTS_HELP"] + ) + EMA.settingsControl.tabNumListDropDownListCR = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + thirdWidth, + left2, + movingTop, + L["BankTOON"] + ) + EMA.settingsControl.tabNumListDropDownListCR:SetCallback( "OnEnterPressed", EMA.EditBankToonNameCR ) + EMA.settingsControl.BankTradeCRItemsTagCR = EMAHelperSettings:CreateDropdown( + EMA.settingsControl, + thirdWidth, + left3, + movingTop, + L["GROUP_LIST"] + ) + EMA.settingsControl.BankTradeCRItemsTagCR:SetList( EMAApi.GroupList() ) + EMA.settingsControl.BankTradeCRItemsTagCR:SetCallback( "OnValueChanged", EMA.GroupListDropDownListCR ) + + movingTop = movingTop - editBoxHeight + movingTop = movingTop - editBoxHeight + + EMA.settingsControl.labelComingSoon = EMAHelperSettings:CreateContinueLabel( + EMA.settingsControl, + headingWidth, + left2, + movingTop, + L["Bank_GOLD_COMING_SOON"] + ) +--[[ + EMA.settingsControl.checkBoxAdjustMoneyOnToonViaBankBank = EMAHelperSettings:CreateCheckBox( + EMA.settingsControl, + headingWidth, + left + 110, + movingTop, + L["Bank_GOLD"], + EMA.SettingsToggleAdjustMoneyOnToonViaBankBank, + L["Bank_GOLD_HELP"] + ) + movingTop = movingTop - checkBoxHeight + EMA.settingsControl.editBoxGoldAmountToLeaveOnToon = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + dropBoxWidth, + left2, + movingTop, + L["GOLD_TO_KEEP"] + ) + EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetCallback( "OnEnterPressed", EMA.EditBoxChangedGoldAmountToLeaveOnToon ) +]] + movingTop = movingTop - editBoxHeight + + EMA.settingsControl.dropdownMessageArea = EMAHelperSettings:CreateDropdown( + EMA.settingsControl, + dropBoxWidth, + left2, + movingTop, + L["MESSAGE_AREA"] + ) + EMA.settingsControl.dropdownMessageArea:SetList( EMAApi.MessageAreaList() ) + EMA.settingsControl.dropdownMessageArea:SetCallback( "OnValueChanged", EMA.SettingsSetMessageArea ) + movingTop = movingTop - dropdownHeight - verticalSpacing + return movingTop +end + + +------------------------------------------------------------------------------------------------------------- +-- Settings Callbacks. +------------------------------------------------------------------------------------------------------------- + +function EMA:SettingsScrollRefresh() + FauxScrollFrame_Update( + EMA.settingsControl.BankItems.listScrollFrame, + EMA:GetBankItemsMaxPosition(), + EMA.settingsControl.BankItems.rowsToDisplay, + EMA.settingsControl.BankItems.rowHeight + ) + EMA.settingsControl.BankItemsOffset = FauxScrollFrame_GetOffset( EMA.settingsControl.BankItems.listScrollFrame ) + for iterateDisplayRows = 1, EMA.settingsControl.BankItems.rowsToDisplay do + -- Reset. + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[1].textString:SetText( "" ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[1].textString:SetTextColor( 1.0, 1.0, 1.0, 1.0 ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[2].textString:SetText( "" ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[2].textString:SetTextColor( 1.0, 1.0, 1.0, 1.0 ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[3].textString:SetText( "" ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[3].textString:SetTextColor( 1.0, 1.0, 1.0, 1.0 ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[4].textString:SetText( "" ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[4].textString:SetTextColor( 1.0, 0, 0, 1.0 ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].highlight:SetColorTexture( 0.0, 0.0, 0.0, 0.0 ) + -- Get data. + local dataRowNumber = iterateDisplayRows + EMA.settingsControl.BankItemsOffset + if dataRowNumber <= EMA:GetBankItemsMaxPosition() then + -- Put data information into columns. + local BankItemsInformation = EMA:GetBankItemsAtPosition( dataRowNumber ) + local blackListText = "" + if BankItemsInformation.blackList == true then + blackListText = L["ITEM_ON_BLACKLIST"] + end + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[1].textString:SetText( BankItemsInformation.name ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[2].textString:SetText( BankItemsInformation.GBTab ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[3].textString:SetText( BankItemsInformation.tag ) + EMA.settingsControl.BankItems.rows[iterateDisplayRows].columns[4].textString:SetText( blackListText ) + -- Highlight the selected row. + if dataRowNumber == EMA.settingsControl.BankItemsHighlightRow then + EMA.settingsControl.BankItems.rows[iterateDisplayRows].highlight:SetColorTexture( 1.0, 1.0, 0.0, 0.5 ) + end + end + end +end + +function EMA:SettingsBankItemsRowClick( rowNumber, columnNumber ) + if EMA.settingsControl.BankItemsOffset + rowNumber <= EMA:GetBankItemsMaxPosition() then + EMA.settingsControl.BankItemsHighlightRow = EMA.settingsControl.BankItemsOffset + rowNumber + EMA:SettingsScrollRefresh() + end +end + +function EMA:SettingsBankItemsRemoveClick( event ) + StaticPopup_Show( "EMABank_CONFIRM_REMOVE_Bank_ITEMS" ) +end + +function EMA:SettingsEditBoxChangedBankItem( event, text ) + EMA.autoBankItemLink = text + EMA:SettingsRefresh() +end + +function EMA:SettingsBankItemsAddClick( event ) + if EMA.autoBankItemLink ~= nil and EMA.autoBankToonName ~= nil and EMA.db.BankTagName ~= nil then + EMA:AddItem( EMA.autoBankItemLink, EMA.autoBankToonName, EMA.db.BankTagName, EMA.db.blackListItem ) + EMA.autoBankItemLink = nil + EMA:SettingsRefresh() + end +end + +function EMA:GroupListDropDownList (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + for index, groupName in ipairs( EMAApi.GroupList() ) do + if index == value then + EMA.db.BankTagName = groupName + break + end + end + EMA:SettingsRefresh() +end + +function EMA:SettingsToggleBlackListItem( event, checked ) + EMA.db.blackListItem = checked + EMA:SettingsRefresh() +end + + +function EMA:EditBankToonName (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + EMA.autoBankToonName = value + EMA:SettingsRefresh() +end + +function EMA:SettingsToggleBankBoEItems(event, checked ) + EMA.db.BankBoEItems = checked + EMA:SettingsRefresh() +end + + +function EMA:EditBankToonNameBoE (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + EMA.db.autoBankToonNameBoE = value + EMA:SettingsRefresh() +end + +function EMA:GroupListDropDownListBoE (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + for index, groupName in ipairs( EMAApi.GroupList() ) do + if index == value then + EMA.db.autoBoEItemTag = groupName + break + end + end + EMA:SettingsRefresh() +end + + +function EMA:SettingsToggleBankCRItems(event, checked ) + EMA.db.BankCRItems = checked + EMA:SettingsRefresh() +end + +function EMA:EditBankToonNameCR (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + EMA.db.autoBankToonNameCR = value + EMA:SettingsRefresh() +end + +function EMA:GroupListDropDownListCR (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + for index, groupName in ipairs( EMAApi.GroupList() ) do + if index == value then + EMA.db.autoCRItemTag = groupName + break + end + end + EMA:SettingsRefresh() +end + +function EMA:OnMessageAreasChanged( message ) + EMA.settingsControl.dropdownMessageArea:SetList( EMAApi.MessageAreaList() ) +end + +function EMA:OnGroupAreasChanged( message ) + EMA.settingsControl.BankItemsEditBoxBankTag:SetList( EMAApi.GroupList() ) + EMA.settingsControl.BankTradeBoEItemsTagBoE:SetList( EMAApi.GroupList() ) + EMA.settingsControl.BankTradeCRItemsTagCR:SetList( EMAApi.GroupList() ) +end + +function EMA:SettingsSetMessageArea( event, value ) + EMA.db.messageArea = value + EMA:SettingsRefresh() +end + +function EMA:SettingsToggleShowEMABankWindow( event, checked ) + EMA.db.showEMABankWindow = checked + EMA:SettingsRefresh() +end + +function EMA:SettingsToggleAdjustMoneyOnToonViaBankBank( event, checked ) + EMA.db.adjustMoneyWithBankBank = checked + EMA:SettingsRefresh() +end + +function EMA:SettingsToggleAdjustMoneyWithMasterOnBank( event, checked ) + EMA.db.adjustMoneyWithMasterOnBank = checked + EMA:SettingsRefresh() +end + +function EMA:EditBoxChangedGoldAmountToLeaveOnToon( event, text ) + EMA.db.goldAmountToKeepOnToon = tonumber( text ) + if EMA.db.goldAmountToKeepOnToon == nil then + EMA.db.goldAmountToKeepOnToon = 0 + end + EMA:SettingsRefresh() +end + +-- Settings received. +function EMA:EMAOnSettingsReceived( characterName, settings ) + if characterName ~= EMA.characterName then + -- Update the settings. + EMA.db.messageArea = settings.messageArea + EMA.db.showEMABankWindow = settings.showEMABankWindow + EMA.db.BankTagName = settings.BankTagName + EMA.db.BankBoEItems = settings.BankBoEItems + EMA.db.autoBankToonNameBoE = settings.autoBankToonNameBoE + EMA.db.autoBoEItemTag = settings.autoBoEItemTag + EMA.db.BankCRItems = settings.BankCRItems + EMA.db.autoBankToonNameCR = settings.autoBankToonNameCR + EMA.db.autoCRItemTag = settings.autoCRItemTag + EMA.db.autoBankItemsList = EMAUtilities:CopyTable( settings.autoBankItemsList ) + EMA.db.adjustMoneyWithBankBank = settings.adjustMoneyWithBankBank + EMA.db.goldAmountToKeepOnToon = settings.goldAmountToKeepOnToon + -- Refresh the settings. + EMA:SettingsRefresh() + -- Tell the player. + EMA:Print( L["SETTINGS_RECEIVED_FROM_A"]( characterName ) ) + end +end + +function EMA:BeforeEMAProfileChanged() +end + +function EMA:OnEMAProfileChanged() + EMA:SettingsRefresh() +end + +function EMA:SettingsRefresh() + EMA.settingsControl.checkBoxShowEMABankWindow:SetValue( EMA.db.showEMABankWindow ) + EMA.settingsControl.BankItemsEditBoxBankTag:SetText( EMA.db.BankTagName ) + EMA.settingsControl.listCheckBoxBoxOtherBlackListItem:SetValue( EMA.db.blackListItem ) + EMA.settingsControl.checkBoxBankBoEItems:SetValue( EMA.db.BankBoEItems ) + EMA.settingsControl.tabNumListDropDownListBoE:SetText( EMA.db.autoBankToonNameBoE ) + EMA.settingsControl.BankTradeBoEItemsTagBoE:SetText( EMA.db.autoBoEItemTag ) + EMA.settingsControl.checkBoxBankCRItems:SetValue( EMA.db.BankCRItems ) + EMA.settingsControl.tabNumListDropDownListCR:SetText( EMA.db.autoBankToonNameCR ) + EMA.settingsControl.BankTradeCRItemsTagCR:SetText( EMA.db.autoCRItemTag ) + EMA.settingsControl.dropdownMessageArea:SetValue( EMA.db.messageArea ) +-- EMA.settingsControl.checkBoxAdjustMoneyOnToonViaBankBank:SetValue( EMA.db.adjustMoneyWithBankBank ) +-- EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetText( tostring( EMA.db.goldAmountToKeepOnToon ) ) +-- EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetDisabled( not EMA.db.adjustMoneyWithBankBank ) + EMA.settingsControl.BankItemsEditBoxBankItem:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.listCheckBoxBoxOtherBlackListItem:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.BankItemsEditBoxBankTag:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.tabNumListDropDownList:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.BankItemsButtonRemove:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.BankItemsButtonAdd:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.checkBoxBankBoEItems:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.tabNumListDropDownListBoE:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.BankTradeBoEItemsTagBoE:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.checkBoxBankCRItems:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.tabNumListDropDownListCR:SetDisabled( not EMA.db.showEMABankWindow ) + EMA.settingsControl.BankTradeCRItemsTagCR:SetDisabled( not EMA.db.showEMABankWindow ) + EMA:SettingsScrollRefresh() + +end + +--Comms not sure if we going to use comms here. +-- A EMA command has been received. +function EMA:EMAOnCommandReceived( characterName, commandName, ... ) + if characterName == self.characterName then + return + end +end + +------------------------------------------------------------------------------------------------------------- +-- Bank functionality. +------------------------------------------------------------------------------------------------------------- + +function EMA:GetBankItemsMaxPosition() + return #EMA.db.autoBankItemsList +end + +function EMA:GetBankItemsAtPosition( position ) + return EMA.db.autoBankItemsList[position] +end + +function EMA:AddItem( itemLink, GBTab, itemTag, blackList ) + --EMA:Print("testDBAdd", itemLink, GBTab, 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.GBTab = GBTab + itemInformation.tag = itemTag + itemInformation.blackList = blackList + table.insert( EMA.db.autoBankItemsList, itemInformation ) + EMA:SettingsRefresh() + EMA:SettingsBankItemsRowClick( 1, 1 ) + end +end + +function EMA:RemoveItem() + table.remove( EMA.db.autoBankItemsList, EMA.settingsControl.BankItemsHighlightRow ) + EMA:SettingsRefresh() + EMA:SettingsBankItemsRowClick( EMA.settingsControl.BankItemsHighlightRow - 1, 1 ) +end + + +function EMA:Bank_SHOW(event, ...) + --EMA:Print("test") + if EMA.db.showEMABankWindow == true then + if not IsShiftKeyDown() then + EMA:AddAllToBankBox() + else + EMA.ShiftkeyDown = true + end + end + --[[ + if EMA.db.adjustMoneyWithBankBank == true then + AddGoldToBankBox() + end + ]] +end + +function EMA:Bank_CLOSED(event, ...) + EMA.ShiftkeyDown = false +end + +function EMA:AddAllToBankBox() + --EMA:Print("run") + BankFrameTab_OnClick(nil, "2") + SendBankNameEditBox:SetText( "" ) + SendBankNameEditBox:ClearFocus() + local count = 1 + for bagID = 0, NUM_BAG_SLOTS do + for slotID = 1,GetContainerNumSlots( bagID ),1 do + --EMA:Print( "Bags OK. checking", itemLink ) + local item = Item:CreateFromBagAndSlot(bagID, slotID) + if ( item ) then + local bagItemLink = item:GetItemLink() + if ( bagItemLink ) then + local itemLink = item:GetItemLink() + local location = item:GetItemLocation() + local itemType = C_Item.GetItemInventoryType( location ) + local isBop = C_Item.IsBound( location ) + local itemRarity = C_Item.GetItemQuality( location ) + local _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,isCraftingReagent = GetItemInfo( bagItemLink ) + local canSend = false + local toonName = nil + if EMA.db.BankBoEItems == true then + if itemType ~= 0 then + if EMAApi.IsCharacterInGroup( EMA.characterName, EMA.db.autoBoEItemTag ) == true then + if isBop == false then + if itemRarity == 2 or itemRarity == 3 or itemRarity == 4 then + canSend = true + toonName = EMA.db.autoBankToonNameBoE + end + end + end + end + end + if EMA.db.BankCRItems == true then + if isCraftingReagent == true then + if EMAApi.IsCharacterInGroup( EMA.characterName, EMA.db.autoCRItemTag ) == true then + if isBop == false then + canSend = true + toonName = EMA.db.autoBankToonNameCR + end + end + end + end + for position, itemInformation in pairs( EMA.db.autoBankItemsList ) do + if EMAUtilities:DoItemLinksContainTheSameItem( itemLink, itemInformation.link ) then + if EMAApi.IsCharacterInGroup( EMA.characterName, itemInformation.tag ) == true then + --EMA:Print("DataTest", itemInformation.link, itemInformation.blackList ) + --EMA:Print("test", itemLink) + canSend = true + toonName = itemInformation.GBTab + end + if itemInformation.blackList == true then + canSend = false + end + end + end + if canSend == true and toonName ~= "" and toonName ~= nil then + local currentBankToon = SendBankNameEditBox:GetText() + local characterName = EMAUtilities:AddRealmToNameIfMissing( toonName ) + if toonName == currentBankToon or currentBankToon == "" and characterName ~= EMA.characterName then + if count <= ATTACHMENTS_MAX_SEND then + --EMA:Print("sending Bank:", count) + count = count + 1 + SendBankNameEditBox:SetText( toonName ) + SendBankSubjectEditBox:SetText( L["SENT_AUTO_BankER"] ) + PickupContainerItem( bagID, slotID ) + UseContainerItem( bagID , slotID ) + end + end + end + end + end + end + end + EMA:ScheduleTimer( "DoSendBank", 0.5, nil ) +end + +function EMA:Bank_SEND_SUCCESS( event, ... ) + --EMA:Print("try sendBank Again") + if EMA.ShiftkeyDown == false then + EMA:ScheduleTimer( "AddAllToBankBox", 1, nil ) + end +end + +function EMA:DoSendBank() + --EMA:Print("newSendRun") + for iterateBankSlots = 1, ATTACHMENTS_MAX_SEND do + if HasSendBankItem( iterateBankSlots ) == true then + SendBankFrame_SendBank() + break + end + end +end + +-- gold +function AddGoldToBankBox() + local moneyToKeepOnToon = tonumber( EMA.db.goldAmountToKeepOnToon ) + local moneyOnToon = GetMoney() + local moneyToDepositOrWithdraw = moneyOnToon - moneyToKeepOnToon + if moneyToDepositOrWithdraw == 0 then + return + end + if moneyToDepositOrWithdraw > 0 then + --local tradePlayersName = GetUnitName("NPC", true) + --local characterName = EMAUtilities:AddRealmToNameIfMissing( tradePlayersName ) + --if EMAApi.IsCharacterTheMaster(characterName) == true and EMAUtilities:CheckIsFromMyRealm(characterName) == true then + SendBankMoneyGold:SetText(moneyToDepositOrWithdraw) + --end + end +end \ No newline at end of file diff --git a/Modules/Follow.lua b/Modules/Follow.lua index 9df920a..8af39b7 100644 --- a/Modules/Follow.lua +++ b/Modules/Follow.lua @@ -1212,7 +1212,7 @@ function EMA:FollowStrobeOnReceiveCommand( target, tag ) -- If this character responds to this tag... if EMAApi.DoesCharacterHaveTag( EMA.characterName, tag ) then -- Then follow the target specified - strobing. - EMA:FollowStrobeOn( target ) + EMA:FollowStrobeOn( target ) end end @@ -1242,7 +1242,6 @@ function EMA:FollowStrobeOffReceiveCommand( tag ) if EMAApi.DoesCharacterHaveTag( EMA.characterName, tag ) then -- Then follow the target specified - turn off strobing. EMA:FollowStrobeOff() - --FollowUnit( "Player", true ) end end @@ -1310,7 +1309,7 @@ function EMA:FollowStrobeOff() -- Stop the timer from doing another follow command. if EMA.followingStrobing == true then EMA.followingStrobing = false - FollowUnit("player") + --FollowUnit("player") EMA:CancelTimer( EMA.followStrobeTimer ) end end diff --git a/Modules/Interaction.lua b/Modules/Interaction.lua index f57df68..d7a184b 100644 --- a/Modules/Interaction.lua +++ b/Modules/Interaction.lua @@ -446,7 +446,7 @@ function EMA:TAXIMAP_OPENED(event, ...) end -- Take a taxi. -local function TakeTaxi( sender, nodeName ) +local function TakeTaxi( sender, nodeName, taxiNodeIndex ) -- If the take masters taxi option is on. if EMA.db.takeMastersTaxi == true then -- If the sender was not this character and is the master then... @@ -456,10 +456,19 @@ local function TakeTaxi( sender, nodeName ) --EMA:Print("test23", nodeName ) for iterateNodes = 1, NumTaxiNodes() do local mapNodeName = TaxiNodeName( iterateNodes ) - if mapNodeName == nodeName then + if EMA.TaxiFrameName == FlightMapFrame then + --EMA:Print("test240", nodeName, "vs", mapNodeName, "ID", iterateNodes) + if mapNodeName == nodeName and iterateNodes == taxiNodeIndex then + --EMA:Print("test24", nodeName, "vs", mapNodeName, "ID", iterateNodes) + nodeIndex = iterateNodes + break + end + else + if mapNodeName == nodeName then --EMA:Print("test24", nodeName, "vs", mapNodeName, "ID", iterateNodes) - nodeIndex = iterateNodes - --break + nodeIndex = iterateNodes + break + end end end -- If a node index was found... @@ -469,8 +478,6 @@ local function TakeTaxi( sender, nodeName ) -- Take a taxi. EMA.TakesTaxi = true EMA:ScheduleTimer( "TakeTimedTaxi", EMA.db.changeTexiTime , nodeIndex ) - --GetNumRoutes( nodeIndex ) - --TakeTaxiNode( nodeIndex ) else -- Tell the master that this character could not take the same flight. EMA:EMASendMessageToTeam( EMA.db.messageArea, L["I_AM_UNABLE_TO_FLY_TO_A"]( nodeName ), false ) @@ -495,7 +502,7 @@ function EMA:TakeTaxiNode( taxiNodeIndex ) --EMA:Print("testTake", taxiNodeIndex, nodeName ) if EMA.TakesTaxi == false then -- Tell the other characters about the taxi. - EMA:EMASendCommandToTeam( EMA.COMMAND_TAKE_TAXI, nodeName ) + EMA:EMASendCommandToTeam( EMA.COMMAND_TAKE_TAXI, nodeName, taxiNodeIndex ) end EMA.TakesTaxi = false end @@ -735,6 +742,8 @@ function EMA:doLoot( tries ) else CloseLoot() end + else + CloseLoot() end end diff --git a/Modules/ItemUse.lua b/Modules/ItemUse.lua index 3da2835..d14facf 100644 --- a/Modules/ItemUse.lua +++ b/Modules/ItemUse.lua @@ -506,7 +506,7 @@ function EMA:ClearButton() if itemLink and itemLink:match("item:%d") then local _ , tooltipTextTwo = EMAUtilities:TooltipScaner( itemLink ) if tooltipTextTwo == nil or tooltipTextTwo ~= "Unique" then - if EMA:IsInInventory( name ) == false then + if EMA:IsInInventory( action ) == false then EMA.db.itemsAdvanced[iterateItems] = nil EMA:EMASendUpdate( iterateItems, "empty", nil ) EMA:SettingsRefresh() diff --git a/Modules/Mail.lua b/Modules/Mail.lua index f790fb8..2a139f9 100644 --- a/Modules/Mail.lua +++ b/Modules/Mail.lua @@ -53,8 +53,11 @@ EMA.settings = { autoMailToonNameCR = "", autoCRItemTag = EMAApi.AllGroup(), autoMailItemsList = {}, - adjustMoneyWithMailBank = false, + + adjustMoneyWithMail = false, goldAmountToKeepOnToon = 250, + autoMailToonNameGold = "", + autoMailMoneyTag = EMAApi.AllGroup(), }, } @@ -122,7 +125,8 @@ function EMA:OnInitialize() EMA.autoMailToonName = nil EMA.MailItemTable = {} EMA.ShiftkeyDown = false - --EMA.putItemsInGB = {} + EMA.OldMailName = "" + EMA.Count = 0 -- Create the settings control. EMA:SettingsCreate() -- Initialse the EMAModule part of this module. @@ -292,7 +296,7 @@ function EMA:SettingsCreateMail( top ) ) movingTop = movingTop - buttonHeight EMAHelperSettings:CreateHeading( EMA.settingsControl, L["Mail_OPTIONS"], movingTop, false ) - movingTop = movingTop - editBoxHeight - 3 + movingTop = movingTop - headingHeight EMA.settingsControl.checkBoxMailBoEItems = EMAHelperSettings:CreateCheckBox( EMA.settingsControl, @@ -349,36 +353,54 @@ function EMA:SettingsCreateMail( top ) EMA.settingsControl.MailTradeCRItemsTagCR:SetList( EMAApi.GroupList() ) EMA.settingsControl.MailTradeCRItemsTagCR:SetCallback( "OnValueChanged", EMA.GroupListDropDownListCR ) - movingTop = movingTop - editBoxHeight - movingTop = movingTop - editBoxHeight + movingTop = movingTop - editBoxHeight - headingHeight +-- movingTop = movingTop - editBoxHeight + + EMAHelperSettings:CreateHeading( EMA.settingsControl, L["MAIL_GOLD_OPTIONS"] , movingTop, false ) + movingTop = movingTop - headingHeight - EMA.settingsControl.labelComingSoon = EMAHelperSettings:CreateContinueLabel( + EMA.settingsControl.checkBoxAdjustMoneyOnToonViaMail = EMAHelperSettings:CreateCheckBox( EMA.settingsControl, headingWidth, - left2, - movingTop, - L["MAIL_GOLD_COMING_SOON"] - ) ---[[ - EMA.settingsControl.checkBoxAdjustMoneyOnToonViaMailBank = EMAHelperSettings:CreateCheckBox( - EMA.settingsControl, - headingWidth, - left + 110, + left, movingTop, L["MAIL_GOLD"], - EMA.SettingsToggleAdjustMoneyOnToonViaMailBank, + EMA.SettingsToggleAdjustMoneyOnToonViaMail, L["MAIL_GOLD_HELP"] ) + movingTop = movingTop - checkBoxHeight EMA.settingsControl.editBoxGoldAmountToLeaveOnToon = EMAHelperSettings:CreateEditBox( EMA.settingsControl, dropBoxWidth, - left2, + left, movingTop, L["GOLD_TO_KEEP"] ) EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetCallback( "OnEnterPressed", EMA.EditBoxChangedGoldAmountToLeaveOnToon ) -]] + + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonName = EMAHelperSettings:CreateEditBox( + EMA.settingsControl, + thirdWidth, + left2, + movingTop, + L["MAILTOON"] + ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonName:SetCallback( "OnEnterPressed", EMA.EditMailToonNameGold ) + + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonTag = EMAHelperSettings:CreateDropdown( + EMA.settingsControl, + thirdWidth, + left3, + movingTop, + L["GROUP_LIST"] + ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonTag:SetList( EMAApi.GroupList() ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonTag:SetCallback( "OnValueChanged", EMA.GroupListDropDownListGold ) + + + + movingTop = movingTop - editBoxHeight EMA.settingsControl.dropdownMessageArea = EMAHelperSettings:CreateDropdown( @@ -570,13 +592,10 @@ function EMA:SettingsToggleShowEMAMailWindow( event, checked ) EMA:SettingsRefresh() end -function EMA:SettingsToggleAdjustMoneyOnToonViaMailBank( event, checked ) - EMA.db.adjustMoneyWithMailBank = checked - EMA:SettingsRefresh() -end +-- Gold Stuff! -function EMA:SettingsToggleAdjustMoneyWithMasterOnMail( event, checked ) - EMA.db.adjustMoneyWithMasterOnMail = checked +function EMA:SettingsToggleAdjustMoneyOnToonViaMail( event, checked ) + EMA.db.adjustMoneyWithMail = checked EMA:SettingsRefresh() end @@ -588,6 +607,30 @@ function EMA:EditBoxChangedGoldAmountToLeaveOnToon( event, text ) EMA:SettingsRefresh() end +function EMA:GroupListDropDownListGold (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + for index, groupName in ipairs( EMAApi.GroupList() ) do + if index == value then + EMA.db.autoMailMoneyTag = groupName + break + end + end + EMA:SettingsRefresh() +end + +function EMA:EditMailToonNameGold (event, value ) + -- if nil or the blank group then don't get Name. + if value == " " or value == nil then + return + end + EMA.db.autoMailToonNameGold = value + EMA:SettingsRefresh() +end + + -- Settings received. function EMA:EMAOnSettingsReceived( characterName, settings ) if characterName ~= EMA.characterName then @@ -602,8 +645,10 @@ function EMA:EMAOnSettingsReceived( characterName, settings ) EMA.db.autoMailToonNameCR = settings.autoMailToonNameCR EMA.db.autoCRItemTag = settings.autoCRItemTag EMA.db.autoMailItemsList = EMAUtilities:CopyTable( settings.autoMailItemsList ) - EMA.db.adjustMoneyWithMailBank = settings.adjustMoneyWithMailBank + EMA.db.adjustMoneyWithMail = settings.adjustMoneyWithMail EMA.db.goldAmountToKeepOnToon = settings.goldAmountToKeepOnToon + EMA.db.autoMailToonNameGold = settings.autoMailToonNameGold + EMA.db.autoMailMoneyTag = settings.autoMailMoneyTag -- Refresh the settings. EMA:SettingsRefresh() -- Tell the player. @@ -629,9 +674,15 @@ function EMA:SettingsRefresh() EMA.settingsControl.tabNumListDropDownListCR:SetText( EMA.db.autoMailToonNameCR ) EMA.settingsControl.MailTradeCRItemsTagCR:SetText( EMA.db.autoCRItemTag ) EMA.settingsControl.dropdownMessageArea:SetValue( EMA.db.messageArea ) --- EMA.settingsControl.checkBoxAdjustMoneyOnToonViaMailBank:SetValue( EMA.db.adjustMoneyWithMailBank ) --- EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetText( tostring( EMA.db.goldAmountToKeepOnToon ) ) --- EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetDisabled( not EMA.db.adjustMoneyWithMailBank ) + + EMA.settingsControl.checkBoxAdjustMoneyOnToonViaMail:SetValue( EMA.db.adjustMoneyWithMail ) + EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetText( tostring( EMA.db.goldAmountToKeepOnToon ) ) + EMA.settingsControl.editBoxGoldAmountToLeaveOnToon:SetDisabled( not EMA.db.adjustMoneyWithMail ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonName:SetText( EMA.db.autoMailToonNameGold ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonName:SetDisabled( not EMA.db.adjustMoneyWithMail ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonTag:SetText( EMA.db.autoMailMoneyTag ) + EMA.settingsControl.SettingsToggleAdjustMoneyOnToonTag:SetDisabled( not EMA.db.adjustMoneyWithMail ) + EMA.settingsControl.MailItemsEditBoxMailItem:SetDisabled( not EMA.db.showEMAMailWindow ) EMA.settingsControl.listCheckBoxBoxOtherBlackListItem:SetDisabled( not EMA.db.showEMAMailWindow ) EMA.settingsControl.MailItemsEditBoxMailTag:SetDisabled( not EMA.db.showEMAMailWindow ) @@ -702,11 +753,10 @@ function EMA:MAIL_SHOW(event, ...) EMA.ShiftkeyDown = true end end - --[[ - if EMA.db.adjustMoneyWithMailBank == true then - AddGoldToMailBox() + if EMA.db.adjustMoneyWithMail == true and EMA.db.showEMAMailWindow == true then + EMA:ScheduleTimer( "AddGoldToMailBox", 0.1 ) + -- AddGoldToMailBox() end - ]] end function EMA:MAIL_CLOSED(event, ...) @@ -716,9 +766,13 @@ end function EMA:AddAllToMailBox() --EMA:Print("run") MailFrameTab_OnClick(nil, "2") - SendMailNameEditBox:SetText( "" ) + --EMA.OldMailName = SendMailNameEditBox:GetText() + SendMailNameEditBox:SetText( "" ) + SendMailMoneyGold:SetText( "" ) + SendMailMoneySilver:SetText( "" ) + SendMailMoneyCopper:SetText( "" ) SendMailNameEditBox:ClearFocus() - local count = 1 + EMA.Count = 1 for bagID = 0, NUM_BAG_SLOTS do for slotID = 1,GetContainerNumSlots( bagID ),1 do --EMA:Print( "Bags OK. checking", itemLink ) @@ -773,53 +827,73 @@ function EMA:AddAllToMailBox() local currentMailToon = SendMailNameEditBox:GetText() local characterName = EMAUtilities:AddRealmToNameIfMissing( toonName ) if toonName == currentMailToon or currentMailToon == "" and characterName ~= EMA.characterName then - if count <= ATTACHMENTS_MAX_SEND then + if EMA.Count <= ATTACHMENTS_MAX_SEND then --EMA:Print("sending Mail:", count) - count = count + 1 + EMA.Count = EMA.Count + 1 SendMailNameEditBox:SetText( toonName ) SendMailSubjectEditBox:SetText( L["SENT_AUTO_MAILER"] ) PickupContainerItem( bagID, slotID ) UseContainerItem( bagID , slotID ) end - end + end end end end end end - EMA:ScheduleTimer( "DoSendMail", 0.5, nil ) + EMA:ScheduleTimer( "DoSendMail", 0.8, nil ) end function EMA:MAIL_SEND_SUCCESS( event, ... ) --EMA:Print("try sendMail Again") - if EMA.ShiftkeyDown == false then + if EMA.ShiftkeyDown == false and EMA.Count < 1 then EMA:ScheduleTimer( "AddAllToMailBox", 1, nil ) end end -function EMA:DoSendMail() +function EMA:DoSendMail( gold ) --EMA:Print("newSendRun") for iterateMailSlots = 1, ATTACHMENTS_MAX_SEND do - if HasSendMailItem( iterateMailSlots ) == true then - SendMailFrame_SendMail() + if HasSendMailItem( iterateMailSlots ) == true or gold == true then + --EMA:Print("canSend") + --SendMailFrame_SendMail() + SendMailMailButton:Click() + EMA.Count = 0 break end - end + end + local gold = SendMailMoneyCopper:GetText() + --EMA:Print("test", gold) + if HasSendMailItem( "1" ) == false and gold == "" then + MailFrameTab_OnClick(nil, 1) + end end -- gold -function AddGoldToMailBox() - local moneyToKeepOnToon = tonumber( EMA.db.goldAmountToKeepOnToon ) - local moneyOnToon = GetMoney() +function EMA:AddGoldToMailBox() + local moneyToKeepOnToon = tonumber( EMA.db.goldAmountToKeepOnToon ) * 10000 + local moneyOnToon = GetMoney() - 30 local moneyToDepositOrWithdraw = moneyOnToon - moneyToKeepOnToon + local toonName = EMA.db.autoMailToonNameGold + --EMA:Print("i have", moneyOnToon, "keep", moneyToKeepOnToon, "send", moneyToDepositOrWithdraw ) if moneyToDepositOrWithdraw == 0 then return end - if moneyToDepositOrWithdraw > 0 then - --local tradePlayersName = GetUnitName("NPC", true) - --local characterName = EMAUtilities:AddRealmToNameIfMissing( tradePlayersName ) - --if EMAApi.IsCharacterTheMaster(characterName) == true and EMAUtilities:CheckIsFromMyRealm(characterName) == true then - SendMailMoneyGold:SetText(moneyToDepositOrWithdraw) - --end + if moneyToDepositOrWithdraw > 0 and HasSendMailItem("1") == false then + local currentMailToon = SendMailNameEditBox:GetText() + local characterName = EMAUtilities:AddRealmToNameIfMissing( toonName ) + if toonName == currentMailToon or currentMailToon == "" and characterName ~= EMA.characterName then + if EMAApi.IsCharacterInGroup( EMA.characterName, EMA.db.autoMailMoneyTag ) == true then + local gold, silver, copper = EMAUtilities:MoneyString( moneyToDepositOrWithdraw ) + local coinText = GetCoinText( moneyToDepositOrWithdraw ) + --EMA:Print("Send", "gold", gold, "silver", silver, "copper", copper ) + SendMailSubjectEditBox:SetText( (L["SENT_AUTO_MAILER_GOLD"](coinText) ) ) + SendMailNameEditBox:SetText( toonName ) + SendMailMoneyGold:SetText(gold) + SendMailMoneySilver:SetText(silver) + SendMailMoneyCopper:SetText(copper) + EMA:ScheduleTimer( "DoSendMail", 0.8, true ) + end + end end end \ No newline at end of file diff --git a/Modules/Quest.lua b/Modules/Quest.lua index a732d7b..f920d5c 100644 --- a/Modules/Quest.lua +++ b/Modules/Quest.lua @@ -1445,7 +1445,9 @@ function EMA:DoChooseQuestReward( sender, questIndex, modifierKeysPressed, rewar if numberOfQuestRewards <= 1 then -- One or less. if EMA.db.noChoiceSlaveCompleteQuestWithMaster == true then - GetQuestReward( questIndex ) + QuestInfoFrame.itemChoice = 1 + --GetQuestReward( 1 ) + GetQuestReward( QuestInfoFrame.itemChoice ) end else -- More than one. diff --git a/Modules/Toon.lua b/Modules/Toon.lua index 1d6c647..b790921 100644 --- a/Modules/Toon.lua +++ b/Modules/Toon.lua @@ -898,7 +898,6 @@ function EMA:OnEnable() EMA:RegisterEvent("LOSS_OF_CONTROL_ADDED") EMA:RegisterEvent( "UI_ERROR_MESSAGE", "BAGS_FULL" ) EMA:RegisterEvent( "BAG_UPDATE_DELAYED" ) - EMA:RegisterEvent( "WAR_MODE_STATUS_UPDATE", "WARMODE" ) EMA:RegisterEvent( "PLAYER_FLAGS_CHANGED", "WARMODE" ) EMA:RegisterMessage( EMAApi.MESSAGE_MESSAGE_AREAS_CHANGED, "OnMessageAreasChanged" ) EMA:RegisterMessage( EMAApi.MESSAGE_CHARACTER_ONLINE, "OnCharactersChanged" ) @@ -1343,21 +1342,24 @@ function EMA:WARMODE(event, ...) return end if C_PvP.IsWarModeFeatureEnabled() == true then - if C_PvP.CanToggleWarMode() == true then - local isWarMode = C_PvP.IsWarModeDesired() - --EMA:Print("Send", isWarMode ) - EMA:EMASendCommandToTeam( EMA.COMMAND_WAR_MODE, isWarMode ) + local isWarMode = C_PvP.IsWarModeDesired() + if C_PvP.CanToggleWarMode(isWarMode) == true then + --EMA:Print("Send", isWarMode, EMA.isInternalCommand ) + if EMA.isInternalCommand == false then + EMA:EMASendCommandToTeam( EMA.COMMAND_WAR_MODE, isWarMode ) + EMA.isInternalCommand = true + end end end end function EMA:DoWarMode( isWarMode ) - --local text = UnitFactionGroup("player") == PLAYER_FACTION_GROUP[0] and PVP_WAR_MODE_NOT_NOW_HORDE or PVP_WAR_MODE_NOT_NOW_ALLIANCE - if C_PvP.CanToggleWarMode() == true and isWarMode ~= nil then + --EMA:Print("testwarmode", isWarMode ) + EMA.isInternalCommand = true + if C_PvP.CanToggleWarMode( isWarMode ) == true and isWarMode ~= nil then C_PvP.SetWarModeDesired( isWarMode ) - else - -- EMA:EMASendMessageToTeam( EMA.db.requestArea, L["ERR_WARMODE"]( text ), false ) end + EMA.isInternalCommand = false end function EMA:MERCHANT_SHOW( event, ... ) @@ -1590,7 +1592,9 @@ function EMA:EMAOnCommandReceived( characterName, commandName, ... ) end end if commandName == EMA.COMMAND_WAR_MODE then - if characterName ~= self.characterName then + if characterName == self.characterName then + EMA.isInternalCommand = false + else EMA.DoWarMode( characterName, ... ) end end diff --git a/Modules/Trade.lua b/Modules/Trade.lua index 53718d1..ec9baf0 100644 --- a/Modules/Trade.lua +++ b/Modules/Trade.lua @@ -615,9 +615,6 @@ function EMA:RemoveItem() end function EMA:TRADE_SHOW( event, ... ) - - - --Keep for tradeing gold! if EMA.db.adjustMoneyWithMasterOnTrade == true then EMA:ScheduleTimer( "TradeShowAdjustMoneyWithMaster", 0.3 )