View Single Post
03/11/15, 07:56 PM   #4
Deome
 
Deome's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Question

Originally Posted by merlight View Post
Lua Code:
  1. function ZO_KeyboardGuildRosterManager:BuildMasterList()
  2.      -- The master list lives in the GUILD_ROSTER_MANAGER and is built there
  3. end
  4.  
  5. function ZO_KeyboardGuildRosterManager:FilterScrollList()
  6.     ...
  7.     local masterList = GUILD_ROSTER_MANAGER:GetMasterList()
  8.     ...
  9. end

So you need to hook BuildMasterList on GUILD_ROSTER_MANAGER, and FilterScrollList on GUILD_ROSTER_KEYBOARD.
Also for FilterScrollList, I wouldn't replace the function, but call the original and then rewrite all entries' typeId.

Or, and this may seem dirty but is nonetheless awesome, don't hook it at all, and make the original create entries with your typeId:
Lua Code:
  1. -- this will only work because GUILD_MEMBER_DATA is not local in ingame/guild/keyboard/guildroster_keyboard.lua
  2. local DDSK_G = setmetatable({GUILD_MEMBER_DATA = DDSK_DATA_TYPE}, {__index = _G})
  3. setfenv(GUILD_ROSTER_KEYBOARD.FilterScrollList, DDSK_G)
Actually, I have my own hooks for BuildMasterList and FilterScrollList (though I've made no real changes to the latter) hooks. The sales data is in the ZO_GuildRoster control and all its children--I've already tested and noted that the "LabelText" that I use for the ddSKRosterRow controls can easily be posted to chat. The issue isn't in SetupGuildMember or even SetupRow as best I can tell; here's how those controls, and the normal ones, appear in my SetupGuildMember replacement function:

Code:
function ddShopkeeper.SetupGuildMember(self, control, data)
	origSetupGuildMember(self, control, data)
	
	local UserId = GetControl(control, "DisplayName")
	local Zone = GetControl(control, "Zone")
	local Class = GetControl(control, "Class")
	local Level = GetControl(control, "Level")
	local Vet = GetControl(control, "Veteran")
	local Note = GetControl(control, "Note")
	UserId:SetText(data.sortIndex.."  "..data.displayName)
		
	local tRosterSales = ddShopkeeper.Ledger.Options.cRosterSales.getFunc()
	local tRosterPurchases = ddShopkeeper.Ledger.Options.cRosterPurchases.getFunc()
	local tRosterTax = ddShopkeeper.Ledger.Options.cRosterTax.getFunc()
	local Sales = GetControl(control, "SalesLabel")
	local Purchases = GetControl(control, "PurchaseLabel")
	local Tax = GetControl(control, "TaxLabel")
	local SalesText = ddShopkeeper.LocalizedNumber(data.sales).." "..zo_iconFormat("esoui/art/currency/currency_gold.dds", 14, 14)
	local PurchText = ddShopkeeper.LocalizedNumber(data.purchases).." "..zo_iconFormat("esoui/art/currency/currency_gold.dds", 14, 14)
	local TaxesText = ddShopkeeper.LocalizedNumber(data.tax).." "..zo_iconFormat("esoui/art/currency/currency_gold.dds", 14, 14)

So, "SalesText" etc. can easily go to chat with a simple display function ( d(SalesText) ) and it'll post 500 lines of it to chat. Likewise, I can manipulate all the original controls like Vet and Note. But the "Sales", etc., variables, based on a GetControl("MyddSKRosterRowLabelName") function, come up nil.

As best I can tell, the issue is that my control(s) never get added like they used to, from this function:
Code:
ZO_ScrollList_AddDataType(GUILD_ROSTER_KEYBOARD.list, 2, "ddSKRosterRow", 30, function(control, data) GUILD_ROSTER_MANAGER:SetupRow(control, data) end)
  Reply With Quote