ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Manipulating Data in Guild History (https://www.esoui.com/forums/showthread.php?t=4150)

SiSaSyco 12/18/14 10:25 AM

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!

Garkin 12/19/14 07:29 AM

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.

votan 12/19/14 09:47 AM

Quote:

Originally Posted by Garkin (Post 17931)
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.

SiSaSyco 12/21/14 04:03 AM

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 :D

SiSaSyco 12/21/14 04:50 AM

This worked the way you wrote it. Great! Thank you ;)

Garkin 12/21/14 06:27 AM

Quote:

Originally Posted by SiSaSyco (Post 17968)
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 :D

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).


All times are GMT -6. The time now is 06:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI