Flagrick's Avatar
Files 1
Downloads 9,220
Favorites 45
View Feature Request
Make addon PTS compatible
Feature #: 459
File: Lootdrop, Continued (All in One)
Date: 06/19/14 07:14 AM
By: Garkin
Status: Feature Implemented
When I try to use LootDrop on PTS I will get this errors:

Code:
2014-06-19T14:32:35.084+01:00 |cff0000Lua Error: user:/AddOns/LootDrop/LootDroppable.lua:156: function expected instead of nil
stack traceback:
	user:/AddOns/LootDrop/LootDroppable.lua:156: in function 'LootDroppable:SetIcon'
	user:/AddOns/LootDrop/LootDrop.lua:688: in function 'LootDrop:LootPrint'
	user:/AddOns/LootDrop/LootDrop.lua:670: in function 'LootDrop:OnItemLooted'
	user:/AddOns/LootDrop/LootDrop.lua:300: in function '(anonymous)'|r
2014-06-19T14:35:12.972+01:00 |cff0000Lua Error: user:/AddOns/LootDrop/LootDroppable.lua:156: function expected instead of nil
stack traceback:
	user:/AddOns/LootDrop/LootDroppable.lua:156: in function 'LootDroppable:SetIcon'
	user:/AddOns/LootDrop/LootDrop.lua:789: in function 'LootDrop:OnXPUpdated'
	user:/AddOns/LootDrop/LootDrop.lua:278: in function '(anonymous)'|r
2014-06-19T14:35:19.143+01:00 |cff0000Lua Error: user:/AddOns/LootDrop/LootDroppable.lua:156: function expected instead of nil
stack traceback:
	user:/AddOns/LootDrop/LootDroppable.lua:156: in function 'LootDroppable:SetIcon'
	user:/AddOns/LootDrop/LootDrop.lua:728: in function 'LootDrop:OnMoneyUpdated'
	user:/AddOns/LootDrop/LootDrop.lua:264: in function '(anonymous)'|r
2014-06-19T14:35:19.160+01:00 |cff0000Lua Error: EsoUI/Libraries/Utility/ZO_ColorDef.lua:86: operator * is not supported for nil * number
stack traceback:
	EsoUI/Libraries/Utility/ZO_ColorDef.lua:86: in function 'ZO_ColorDef:ToHex'
	EsoUI/Libraries/Utility/ZO_ColorDef.lua:90: in function 'ZO_ColorDef:Colorize'
	user:/AddOns/LootDrop/LootDrop.lua:684: in function 'LootDrop:LootPrint'
	user:/AddOns/LootDrop/LootDrop.lua:670: in function 'LootDrop:OnItemLooted'
	user:/AddOns/LootDrop/LootDrop.lua:300: in function '(anonymous)'|r
I believe it is because of changes in the links on PTS. On PTS links does not contain color information, it has linkStyle instead of colors. Changes in ZO_LinkHandler.lua:

Code on live servers:
Lua Code:
  1. function ZO_LinkHandler_CreateLink(text, color, type, ...) --where ... is the data to encode
  2.     if type then
  3.         return ("|H%s:%s|h[%s]|h"):format(color and color:ToHex() or "ignore", zo_strjoin(':', type, ...), text)
  4.     end
  5. end
  6.  
  7. function ZO_LinkHandler_ParseLink(link)
  8.     if type(link) == "string" then
  9.         local color, data, text = link:match("|H(.-):(.-)|h(.-)|h")
  10.         return text, color, zo_strsplit(':', data)
  11.     end
  12. end
Code on PTS:
Lua Code:
  1. function ZO_LinkHandler_CreateLink(text, color, linkType, ...) --where ... is the data to encode
  2.     if linkType then
  3.         return ("|H%d:%s|h[%s]|h"):format(LINK_STYLE_BRACKETS, zo_strjoin(':', linkType, ...), text)
  4.     end
  5. end
  6.  
  7. function ZO_LinkHandler_ParseLink(link)
  8.     if type(link) == "string" then
  9.         local linkStyle, data, text = link:match("|H(.-):(.-)|h(.-)|h")
  10.         return text, linkStyle, zo_strsplit(':', data)
  11.     end
  12. end

RSS 2.0 Feed for Favorite CommentsNotes Sort Options
By: Garkin - 06/19/14 08:35 AM
Code:
2014-06-19T16:12:11.116+01:00 |cff0000Lua Error: user:/AddOns/LootDrop/LootDroppable.lua:156: function expected instead of nil
stack traceback:
	user:/AddOns/LootDrop/LootDroppable.lua:156: in function 'LootDroppable:SetIcon'
	user:/AddOns/LootDrop/LootDrop.lua:689: in function 'LootDrop:LootPrint'
	user:/AddOns/LootDrop/LootDrop.lua:671: in function 'LootDrop:OnItemLooted'
	user:/AddOns/LootDrop/LootDrop.lua:300: in function '(anonymous)'|r
This is because texture now uses :GetTextureFileName() method instead of :GetTextureInfo().
By: Garkin - 06/19/14 09:08 AM
Also it seems that itemlinks from loot event and also from GetItemLink(bagIndex, slotIndex) does not contain any text, so you will get empty string from ZO_LinkHandler_ParseLink().
You will probably have to use itemlinks instead of just item name.

A few link examples generated from my inventory on PTS server:
Code:
|H0:item:54513:3:9:45870:3:9:0:0:0:0:0:0:0:0:0:5:0:0:0:0|h|h
|H0:item:43550:3:9:26582:3:9:0:0:0:0:0:0:0:0:0:4:0:0:0:0|h|h
|H0:item:45024:19:12:26848:19:12:0:0:0:0:0:0:0:0:0:9:0:0:124:0|h|h
|H0:item:43535:3:9:26844:3:9:0:0:0:0:0:0:0:0:0:4:0:0:74:0|h|h
|H0:item:45117:3:9:26582:3:9:0:0:0:0:0:0:0:0:0:5:0:0:0:0|h|h
|H0:item:45290:3:9:26580:3:9:0:0:0:0:0:0:0:0:0:5:0:0:0:0|h|h
|H0:item:43551:3:9:26588:3:9:0:0:0:0:0:0:0:0:0:9:0:0:0:0|h|h
By: Flagrick - 06/28/14 12:15 PM
Done in 1.8.5 beta 2