Thread Tools Display Modes
03/11/15, 06:29 PM   #1
Deome
 
Deome's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Question Stumped By GUILD_ROSTER Changes

So, for some time now I've had a neat feature in ddSK that re-does the whole Guild Roster screen so that members sales data can be shown/ranked in the winder.

But now, for the life of me I can't get the UI to recognize the <Label> controls in individual rows--the data is there, and the text is there, but the controls ain't loading.

Prior to 1.6, this is the code I used to add those controls to ZO_GuildRosterList:
Code:
ZO_ScrollList_AddDataType(GUILD_ROSTER.list, 2, "ddSKRosterRow", 30, function(control, data) GUILD_ROSTER:SetupGuildMember(control, data) end)

Obviously, GUILD_ROSTER is now a mess of keyboard and gamepad changes. Here's the best effort I have to simply adapt to the new Roster classes:
Code:
ZO_ScrollList_AddDataType(GUILD_ROSTER_KEYBOARD.list, 2, "ddSKRosterRow", 30, function(control, data) GUILD_ROSTER_MANAGER:SetupRow(control, data) end)



I've also updated the XML file so that:
Code:
<Control name="ddSKRosterRow" mouseEnabled="true" virtual="true" inherits="ZO_GuildRosterRow">

is now:
Code:
<Control name="ddSKRosterRow" mouseEnabled="true" virtual="true" inherits="ZO_KeyboardGuildRosterRow">
due to the change in the RosterRow control names.

What am I missing here? I just need the labels themselves, the fancy things that make the window display text, from my ddSKRosterRow control to show up.
  Reply With Quote
03/11/15, 07:07 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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)
  Reply With Quote
03/11/15, 07:56 PM   #3
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
03/11/15, 09:40 PM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Deome View Post
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)
I guess you know this, but just to be clear: that only registers the data type, it must the be used to create data entries in FilterScrollList. Could it be that the list is built and filtered even before you hook that? Try RefreshData after you setup hooks. Oh and now I noticed: SetupRow is a method of ZO_KeyboardGuildRosterManager, not the shared manager. How come it doesn't spit errors?

Btw, you should give that "2" type a name, it'll be easier to find where it's used in the code

And final note for tonight. ZO_ScrollList_AddDataType with setup function that calls the base version, and then overriding the base version, is complicated and wrong -- if you're adding data type 2, you should not be changing the setup procedure for data type 1. Instead, provide a function that will call the base setup, and then your additional setup:
Lua Code:
  1. ZO_ScrollList_AddDataType(GUILD_ROSTER_KEYBOARD.list, 2, "ddSKRosterRow", 30,
  2. function(control, data)
  3.     GUILD_ROSTER_KEYBOARD:SetupRow(control, data)
  4.     ddShopkeeper.SetupGuildMember(GUILD_ROSTER_MANAGER, control, data) -- don't call origSetupGuildMember from there, only init your own stuff
  5. end)
  Reply With Quote
03/11/15, 09:47 PM   #5
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by merlight View Post
I guess you know this, but just to be clear: that only registers the data type, it must the be used to create data entries in FilterScrollList. Could it be that the list is built and filtered even before you hook that? Try RefreshData after you setup hooks. Oh and now I noticed: SetupRow is a method of ZO_KeyboardGuildRosterManager, not the shared manager. How come it doesn't spit errors?
After I posted that and re-read again to check, it started coming together. Here's what I think is happening.
1. game starting
2. original BuildMasterList
3. original FilterScrollList => all entries have typeId == 1
4. ddSK installs hooks
5. list is shown, row controls are created for type 1
6. ddSK SetupGuildMember wonders where are children for type 2
  Reply With Quote
03/12/15, 02:35 AM   #6
Minceraft
 
Minceraft's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 51
MailBuddy

I've also had similar problems with MailBuddy. ZO_FriendsList was renamed and we've tried to account for it by changing the name in the code, but it still doesn't anchor AT ALL... stumped...
  Reply With Quote
03/12/15, 08:15 PM   #7
Deome
 
Deome's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Unhappy

Originally Posted by merlight View Post
After I posted that and re-read again to check, it started coming together. Here's what I think is happening.
1. game starting
2. original BuildMasterList
3. original FilterScrollList => all entries have typeId == 1
4. ddSK installs hooks
5. list is shown, row controls are created for type 1
6. ddSK SetupGuildMember wonders where are children for type 2
Okay, I'm starting to see it too. I really had no idea FilterScrollList is involved. Guess I'll be digging through the API tonight.
  Reply With Quote
03/11/15, 07:13 PM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,009
I didn't try it and don#t know your addon, so i couldn't test it, but couldn't you just use GUILD_ROSTER_MANAGER:SetupGuildMember() again to add the controls?
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Stumped By GUILD_ROSTER Changes


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off