Quantcast

EMA Version: v1.13.2-Release-v0.6(121022)

Jennifer [10-03-19 - 17:04]
EMA Version: v1.13.2-Release-v0.6(121022)
Game Version: 1.13.2
Release Date: 3/10/2019

## Purchase
 -- Should No Longer Multiple The Count Cost Of Stacked Items.
  -- Issue #26

## Team
 -- Fixed Issue #20 Again!
  - Dev Note: Fixed The Lua Error But Did Not Fix The Friend System. ( Is a MixInTable Now)
Filename
CHANGELOG.txt
Core/Team-Classic.lua
EMA-Classic.toc
Locales/Classic-Core-Locale-enUS.lua
Modules/Purchase-Classic.lua
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 795d1c6..cc8fb56 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,20 @@
 ChangeLogs:
 ---------------------------

+EMA Version: v1.13.2-Release-v0.6(121022)
+Game Version: 1.13.2
+Release Date: 3/10/2019
+
+## Purchase
+	-- Should No Longer Multiple The Count Cost Of Stacked Items.
+		-- Issue #26
+
+## Team
+	-- Fixed Issue #20 Again!
+		- Dev Note: Fixed The Lua Error But Did Not Fix The Friend System. ( Is a MixInTable Now)
+
+---------------------------
+
 EMA Version: v1.13.2-Release-v0.6(121021)
 Game Version: 1.13.2
 Release Date: 24/9/2019
diff --git a/Core/Team-Classic.lua b/Core/Team-Classic.lua
index 132fe32..0cf6fc3 100644
--- a/Core/Team-Classic.lua
+++ b/Core/Team-Classic.lua
@@ -1350,9 +1350,10 @@ function EMA:PARTY_INVITE_REQUEST( event, inviter, ... )
 		if EMA.db.inviteAcceptFriends == true then
 			-- Iterate each friend; searching for the inviter in the friends list.
 			for friendIndex = 1, C_FriendList.GetNumOnlineFriends() do
-				local _, _, _, _, friendName = C_FriendList.GetFriendInfoByIndex( friendIndex )
+				local f = C_FriendList.GetFriendInfoByIndex( friendIndex )
 				-- Inviter found in friends list, allow the invite to be accepted.
-				if inviter == friendName then
+				--EMA:Print("test", inviter, f.name )
+				if inviter == f.name then
 					acceptInvite = true
 					break
 				end
diff --git a/EMA-Classic.toc b/EMA-Classic.toc
index fdaf95f..fbbc99d 100644
--- a/EMA-Classic.toc
+++ b/EMA-Classic.toc
@@ -2,7 +2,7 @@
 ## Title: EMA-Classic
 ## Notes: Ebony's MultiBoxing Assistant Classic
 ## Author: Jennifer Calladine 'Ebony'
-## Version: v1.13.2-Release-v0.6(121021)
+## Version: v1.13.2-Release-v0.6(121022)
 ## 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/Locales/Classic-Core-Locale-enUS.lua b/Locales/Classic-Core-Locale-enUS.lua
index dbf1523..482214e 100644
--- a/Locales/Classic-Core-Locale-enUS.lua
+++ b/Locales/Classic-Core-Locale-enUS.lua
@@ -611,9 +611,17 @@ L["PURCHASE_MSG"] = "Purchase Messages"
 L["ITEM_ERROR"] = "Item Tags Must Only Be Made Up Of Letters And Numbers."
 L["NUM_ERROR"] = "Amount To Buy Must Be A Number."
 L["BUY_POPUP_ACCEPT"] = "Are You Sure You Wish To Remove The Selected Item From The Auto Buy Items List?"
-L["ERROR_BAGS_FULL"] =  "I Do Not Have Enough Space In My Bags To Complete My Purchases."
-L["ERROR_GOLD"] = "I Do Not Have Enough Money To Complete My Purchases."
-L["ERROR_CURR"] = "I Do Not Have Enough Other Currency To Complete My Purchases."
+
+L["ERROR_BAGS_FULL"] = function( name )
+	return string.format( "I Do Not Have Enough Space In My Bags To Complete My Purchase of %s", name )
+end
+L["ERROR_GOLD"] = function( name )
+	return string.format( "I Do Not Have Enough Money To Purchase %s", name )
+end
+L["ERROR_CURR"]  = function( name )
+	return string.format( "I Do Not Have Enough Currency To Complete My Purchase Of %s", name )
+end
+

 --------------------------
 -- Trade Locale
diff --git a/Modules/Purchase-Classic.lua b/Modules/Purchase-Classic.lua
index 32a6bf5..18aa4c2 100644
--- a/Modules/Purchase-Classic.lua
+++ b/Modules/Purchase-Classic.lua
@@ -564,6 +564,7 @@ function EMA:DoMerchantAutoBuy()
 	local outOfBagSpace = false
 	local outOfMoney = false
 	local outOfOtherCurrency = false
+	local name = nil
 	-- Iterate all the wanted items...
 	if EMA.db.globalBuyList == true then
 		itemTable = EMA.db.global.autoBuyItemsListGlobal
@@ -580,6 +581,8 @@ function EMA:DoMerchantAutoBuy()
 			-- Does the merchant have the item in stock?
 			local itemIndexMerchant = EMA:DoesMerchantHaveItemInStock( itemLink )
 			if itemIndexMerchant ~= nil then
+				local itemName = GetMerchantItemInfo( itemIndexMerchant )
+				name = itemName
 				--EMA:Print("inStock", itemIndexMerchant)
 				-- Yes, item is in stock, how many does the character need?
 				local amountNeeded = EMA:GetAmountNeededForItemTopUp( itemLink, maxItemAmount )
@@ -589,6 +592,7 @@ function EMA:DoMerchantAutoBuy()
 					-- Attempt to buy the items.
 					local noFreeBagSpace, notEnoughMoney, notEnoughOtherCurrency = EMA:BuyItemFromMerchant( itemIndexMerchant, amountNeeded )
 					-- Set flags if problems occurred.
+					--EMA:Print("failed", noFreeBagSpace, notEnoughMoney, notEnoughOtherCurrency )
 					if noFreeBagSpace then
 						outOfBagSpace = true
 					end
@@ -598,19 +602,25 @@ function EMA:DoMerchantAutoBuy()
 					if notEnoughOtherCurrency then
 						outOfOtherCurrency = true
 					end
+					local name = GetMerchantItemInfo( itemIndexMerchant )
+					itemIndexMerchant = itemIndexMerchant
 				end
 			end
 		end
 	end
-	-- If there was a problem, tell the master.
-	if outOfBagSpace then
-		EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_BAGS_FULL"], false )
-	end
-	if outOfMoney then
-		EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_GOLD"], false )
-	end
-	if outOfOtherCurrency then
-		EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_CURR"], false )
+	--EMA:Print("fail", name )
+	if name ~= nil then
+		-- If there was a problem, tell the master.
+		--EMA:Print("fail", name )
+		if outOfBagSpace then
+			EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_BAGS_FULL"]( name ), false )
+		end
+		if outOfMoney then
+			EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_GOLD"]( name ), false )
+		end
+		if outOfOtherCurrency then
+			EMA:EMASendMessageToTeam( EMA.db.messageArea, L["ERROR_CURR"]( name ), false )
+		end
 	end
 end

@@ -655,6 +665,7 @@ end

 function EMA:BuyItemFromMerchant( itemIndexMerchant, amountToBuy )
 	-- Flags will be set if the character does not have enough bag space or money.
+	--EMA:Print("item", itemIndexMerchant, amountToBuy)
 	local noFreeBagSpace = false
 	local notEnoughMoney = false
 	local notEnoughOtherCurrency = false
@@ -665,8 +676,14 @@ function EMA:BuyItemFromMerchant( itemIndexMerchant, amountToBuy )
 	local costToBuy = 0
 	local moneyAvailable = 0
 	-- Get information about the item from the merchant.
-	local name, texture, price, itemsPerStack, numberAvailable, isUsable, extendedCost = GetMerchantItemInfo( itemIndexMerchant )
+	local name, texture, price, itemsPerStack, numberAvailable, isPurchasable, isUsable, extendedCost = GetMerchantItemInfo(itemIndexMerchant)
 	local maximumCanBuyAtATime = GetMerchantItemMaxStack( itemIndexMerchant )
+	-- Crazy Cat Maths On stack of items
+	if itemsPerStack > 1 then
+		price = price / itemsPerStack
+	else
+		price = price
+	end
 	-- Loop buying stacks from the merchant until the required number has been purchased.
 	repeat
 		-- Still need to buy more than the maximum?
@@ -680,7 +697,7 @@ function EMA:BuyItemFromMerchant( itemIndexMerchant, amountToBuy )
 		-- Attempt to buy this amount from the merchant; although actual amount bought may differ,
 		-- depending on merchant stock and over buy flag.
 		-- How many does the merchant have left?
-		numberAvailable = select( 5, GetMerchantItemInfo( itemIndexMerchant ) )
+		--numberAvailable = select( 5, GetMerchantItemInfo( itemIndexMerchant ) )
 		-- Calculate how many to buy depending on the stacksize and whether over buying is allowed.
 		actualAmountToBuy = buyThisAmount
 		if EMA.db.autoBuyOverflow == true then
@@ -688,6 +705,7 @@ function EMA:BuyItemFromMerchant( itemIndexMerchant, amountToBuy )
 		else
 			actualAmountToBuy = floor(actualAmountToBuy)
 		end
+		--EMA:Print("test1221", actualAmountToBuy, "a", actualAmountToBuy )
 		-- If requesting more than the number available, then just buy as much as possible.
 		-- If numberAvailable is -1 then there is unlimited stock available.
 		if numberAvailable ~= -1 then
@@ -698,8 +716,9 @@ function EMA:BuyItemFromMerchant( itemIndexMerchant, amountToBuy )
 		-- Does the character have enough money?
 		costToBuy = actualAmountToBuy * price
 		moneyAvailable = GetMoney()
+		--EMA:Print("NO MONEY", moneyAvailable , costToBuy, actualAmountToBuy )
 		if moneyAvailable < costToBuy then
-			--EMA:Print("NO MONEY", moneyAvailable , costToBuy )
+
 			notEnoughMoney = true
 		end
 		-- Is there enough free space for this item in the characters bags?