changeset 73:304d7ebb8e30 v29

small bug fixes for item upgrades, gear swapping
author yellowfive
date Tue, 17 Nov 2015 20:52:06 -0800
parents 55598ba0d435
children 01854bbdc1c7
files AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc Gear.lua ui/Ui.lua
diffstat 4 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Sat Jul 18 01:05:00 2015 -0700
+++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Tue Nov 17 20:52:06 2015 -0800
@@ -609,9 +609,9 @@
 		table.sort(item.bonusIds)
     end
 	
-	-- if numBonuses is 0 and there is a number after it, that is the upgrade id for old items now I guess?
-	if numBonuses == 0 then
-		local upgradeId = tonumber(parts[14])
+	-- if there is another part after bonus ids, that is the upgrade id	
+	if #parts >= 14 + numBonuses then
+		local upgradeId = tonumber(parts[14 + numBonuses])
 		item.upgradeId = upgradeId and upgradeId or 0
 	else
 		item.upgradeId = 0
--- a/AskMrRobot.toc	Sat Jul 18 01:05:00 2015 -0700
+++ b/AskMrRobot.toc	Tue Nov 17 20:52:06 2015 -0800
@@ -1,7 +1,7 @@
 ## Interface: 60200
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 28
+## Version: 29
 ## Notes: Gear import/export, combat logging, and more.
 ## URL: www.askmrrobot.com
 ## SavedVariables: AskMrRobotDb2
--- a/Gear.lua	Sat Jul 18 01:05:00 2015 -0700
+++ b/Gear.lua	Tue Nov 17 20:52:06 2015 -0800
@@ -40,6 +40,7 @@
 local function findMatchingItemFromTable(item, list, bestLink, bestItem, bestDiff, bestLoc, usedItems, tableType)
 	if not list then return nil end
 	
+	local found = false
 	for k,v in pairs(list) do
 		local listItem = Amr.ParseItemLink(v)
 		if listItem then
@@ -52,9 +53,10 @@
 					bestItem = listItem
 					bestDiff = diff
 					bestLoc = string.format("%s_%s", tableType, k)
+					found = true
 				end
 			end
-			if diff == 0 then break end
+			if found then break end
 		end
 	end
 	
@@ -506,6 +508,12 @@
 	
 	-- find the best matching item
 	
+	-- inventory
+	bestItem, bestDiff, bestLink = scanBagForItem(item, BACKPACK_CONTAINER, bestItem, bestDiff, bestLink)
+	for bagId = 1, NUM_BAG_SLOTS do
+		bestItem, bestDiff, bestLink = scanBagForItem(item, bagId, bestItem, bestDiff, bestLink)
+	end
+
 	-- equipped items, but skip slots we have just equipped (to avoid e.g. just moving 2 of the same item back and forth between mh oh weapon slots)
 	for slotNum = 1, #Amr.SlotIds do
 		local slotId = Amr.SlotIds[slotNum]
@@ -525,12 +533,6 @@
 		end
 	end
 	
-	-- inventory
-	bestItem, bestDiff, bestLink = scanBagForItem(item, BACKPACK_CONTAINER, bestItem, bestDiff, bestLink)
-	for bagId = 1, NUM_BAG_SLOTS do
-		bestItem, bestDiff, bestLink = scanBagForItem(item, bagId, bestItem, bestDiff, bestLink)
-	end
-	
 	-- bank
 	bestItem, bestDiff, bestLink = scanBagForItem(item, BANK_CONTAINER, bestItem, bestDiff, bestLink)
 	for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
@@ -688,7 +690,7 @@
 			spec = spec,
 			itemsToEquip = itemsToEquip,
 			remaining = remaining,
-			doneSlots = {},
+			doneSlots = _pendingEquip and _pendingEquip.spec == spec and _pendingEquip.doneSlots or {},
 			nextSlot = firstSlot
 		}
 
--- a/ui/Ui.lua	Sat Jul 18 01:05:00 2015 -0700
+++ b/ui/Ui.lua	Tue Nov 17 20:52:06 2015 -0800
@@ -60,9 +60,15 @@
 end
 
 local function getFontPath(style)
-	local region = Amr.RegionNames[GetCurrentRegion()]
-	if region == "KR" or region == "CN" or region == "TW" then
-		return "Fonts\\FRIZQT__.TTF"
+	local locale = GetLocale()
+	if locale == "koKR" then
+		return "Fonts\\2002.TTF"
+	elseif locale == "zhCN" then
+		return "Fonts\\ARKai_T.ttf"
+	elseif locale == "zhTW" then
+		return "Fonts\\bLEI00D.ttf"
+	elseif locale == "ruRU" then
+		return "Fonts\\FRIZQT___CYR.TTF"
 	else
 		return "Interface\\AddOns\\" .. Amr.ADDON_NAME .. "\\Media\\Ubuntu-" .. style .. ".ttf"
 	end