Thread Tools Display Modes
12/18/14, 10:25 AM   #1
SiSaSyco
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 8
Manipulating Data in Guild History

Hi!

I want to manipulate the Guild History View, in this case the Bank View.
I already found the LibGuildHistory Lib and that helped to show all the transactions that was not visible before.
Now I would like to change the "X Hours ago" Label per transaction to the real Date like 2014-12-16 10:00:00
I dont know if its possible, but i would guess that there has to be a real datetime saved per transaction.
I dont even know, how to add/remove/change things in the view. I even dont get how the author of LibGuildHistory adds the old transactions to the view and how I can get a hand on the underlying table data.

Maybe someone here can point me to some documentation, example code or something that helps me to get a start on how to do it? Espacially how to manipulate existing Data in the view and/or adding additional data to the view (e.g. another column with additional data) and how to access the relevant table data?

Later it would be awesome if I could only show x transactions per page and have previous/next buttons to switch between pages. Or have Filter to only show transactions from the last 7 days ...

thx in advance!
  Reply With Quote
12/19/14, 07:29 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
It should be simple. Guild history data contains timestamp when event was received and time since event, so it is easy to get real time. You will need just to hook setup function for guild history row and change what is displayed.

Lua Code:
  1. --backup of the original function
  2. local SetupGuildEvent_Orig = GUILD_HISTORY.SetupGuildEvent
  3.  
  4. function GUILD_HISTORY:SetupGuildEvent(control, data, ...)
  5.     --call original function first
  6.     SetupGuildEvent_Orig(self, control, data, ...)
  7.  
  8.     --get timestamp (epoch time) of the event
  9.     local timestamp = GetTimeStamp() - data.secsSinceEvent - (GetFrameTimeSeconds() - data.timeStamp)
  10.     --get date of the event from timestamp
  11.     local datestring = GetDateStringFromTimestamp(timestamp)
  12.     --get time of the event, however this time is valid for GMT time zone
  13.     local timestring = ZO_FormatTime(timestamp % 86400, TIME_FORMAT_STYLE_CLOCK_TIME, TIME_FORMAT_PRECISION_TWENTY_FOUR_HOUR) --timestamp % 86400 = seconds since midnight in GMT time zone (% = modulo, 86400 = number of seconds in a day)
  14.  
  15.     --set new text
  16.     control:GetNamedChild("Time"):SetText(datestring .. " " .. timestring)
  17. end

Now you just have to figure out how to convert GMT time to your timezone. I was thinking about something like:
Lua Code:
  1. local correction = GetSecondsSinceMidnight() - (GetTimeStamp() % 86400)
However it probably won't work if date in timezones is different.
  Reply With Quote
12/19/14, 09:47 AM   #3
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Garkin View Post
Now you just have to figure out how to convert GMT time to your timezone. I was thinking about something like:
Lua Code:
  1. local correction = GetSecondsSinceMidnight() - (GetTimeStamp() % 86400)
However it probably won't work if date in timezones is different.
Garkin is right. Just be careful around midnight. e.g. UTC+1: 0-(23*60*60) = -82800
Lua Code:
  1. local correction = GetSecondsSinceMidnight() - (GetTimeStamp() % 86400)
  2. if correction < -12*60*60 then correction = correction + 86400 end

As far as I have seening GetSecondsSinceMidnight() reflects your current client settings, including daylight saving. If the date you want to correct is in another daylight saving range, the correction will differ +/- one hour.

Last edited by votan : 12/19/14 at 12:11 PM.
  Reply With Quote
12/21/14, 04:03 AM   #4
SiSaSyco
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 8
Thank you very much for this examples. I will try this.
But where do you find this Informations? e.g. GUILD_HISTORY.SetupGuildEvent or data.secsSinceEvent? There is not much Info in the Wiki, I only find secsSinceEvent in combination with GetGuildEventInfo. Is there a better Resource for this? I dont want to bother you every time I need to find such Functions/Attributes
  Reply With Quote
12/21/14, 04:50 AM   #5
SiSaSyco
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 8
This worked the way you wrote it. Great! Thank you
  Reply With Quote
12/21/14, 06:27 AM   #6
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by SiSaSyco View Post
Thank you very much for this examples. I will try this.
But where do you find this Informations? e.g. GUILD_HISTORY.SetupGuildEvent or data.secsSinceEvent? There is not much Info in the Wiki, I only find secsSinceEvent in combination with GetGuildEventInfo. Is there a better Resource for this? I dont want to bother you every time I need to find such Functions/Attributes
First tool I recommend is addon Zgoo, and second what I recommend is obtaining EsoUI source code extracted from game0000.dat. Try to Google it (or just send me a PM).
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Manipulating Data in Guild History


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