View Single Post
12/16/20, 02:29 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
A hint:
If you need to read guild history you should change the addon to use the library "LibHistoire" as it was newly designed to get this data performantly.
Manually reading the histry is slower and might be buggy, as well as using older addon code.

In that file at first please change ALL occurrences of LibStub to no LibStub calls as this library is obsolete.
e.g.
local LAM2 = LibStub("LibAddonMenu-2.0")
->
local LAM2 = LibAddonMenu2

Each library has written in it's description what the global variable to use is named, e.g. for LibAddonMenu it's LibAddonMenu2 since version 28 I think.
In the txt file (named "manifest") of the addon please remove all hardcoded lines to something like
/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
/libs/LibAddonMenu-2.0/controls/...

And add this:
## DependsOn: LibAddonMenu2.0>=31

This assures you do not load any included very old libraries and break addons, but it will search for a properly instaleld library "LibAddonMenu-2.0" in version 31 or higher, providing it's own LibAddonMenu-2.0.txt where the ## AddOnVersion: 31 is specified. So no dulicate versions are loaded anymore, what LibStub managed to suppress in the past, but ZOs code does better meanwhile (since Summerset).


The SavedVariables are created here:
Lua Code:
  1. self.savedVariables = ZO_SavedVars:NewAccountWide(
  2.                               "GuildBankLedgerVars"
  3.                             , self.savedVarVersion
  4.                             , nil
  5.                             , self.default
  6.                             )
If you want to add another parameter after the , self.default to make it save the file contents differently for each server you play on:
Lua Code:
  1. self.savedVariables = ZO_SavedVars:NewAccountWide(
  2.                               "GuildBankLedgerVars"
  3.                             , self.savedVarVersion
  4.                             , nil
  5.                             , self.default
  6.                             , GetWorldName()
  7.                             )

GetWorldName() rturns "EU Megaserver" or "NA Megaserver" or "PTS".
The SV file will save a table named "GuildBankLedgerVars" and below you will find all data stored behind the subtable ["xx Megaserver"] -> ["@AccountName"] -> ["$AccountWide"] (because ZO_SavedVars:NewAccountWide was used).


Ziggr then used some OLD API functions to check if there are some guild history events firing and to catch them, e.g.
in

Lua Code:
  1. -- Async poll to fetch ALL guild bank history data from the ESO server
  2. -- Calls ServerDataComplete() once all data is loaded.
  3. function GuildBankLedger:ServerDataPoll(guild_index)

It was checking via DoesGuildHistoryCategoryHaveMoreEvents for more events to come in (as the server decces WHEN and IF the events come in! That's why youd efinately should switch to LibHistoire and NOT use this anymore).

As his comment says alread: In the end it calls function
GuildBankLedger:ServerDataComplete

And in there it uses the function RecordEvent to add some data to internal addon's table
self.fetched_str_list

But where is the SavedVars connection?
In function GuildBankLedger:ServerDataComplete it was assigned:

Lua Code:
  1. self.savedVariables.history[guild_name] = self.fetched_str_list[guild_index]

In the SV file you will find a subtable history with the subtables per guild_name -> having all the recorded event data from self.fetched_str_list of the [guild_index]

Hope this helps as overview. But please consider changing this to use "LibHistoire" if you want to work on it!
Or you might run into either server performance trouble and or other old prolems which were solved if you sue this lib.
It was build to make several addons work togeher AND NOT query the same guild history data again and again... This was a big performance prolem, and still is, on the server. So pelase support the better approach.

Last edited by Baertram : 12/16/20 at 02:46 PM.
  Reply With Quote