Download
(4 Kb)
Download
Updated: 02/13/21 02:44 PM
Pictures
File Info
Compatibility:
Markarth (6.2.5)
Updated:02/13/21 02:44 PM
Created:01/07/21 11:14 AM
Monthly downloads:48
Total downloads:4,506
Favorites:7
MD5:
Categories:Beta-version AddOns, Auction House & Vendors, Bags, Bank, Inventory
PurchaseTracker
Version: 1.0.0
by: be.ste [More]
What it does?

It tracks all purchases done for a specific item and shows some statistics in the item popup.

--------------------

Dependencies:
- AwesomeGuildStore>=2635 (I reuse an event from there to catch purchases, well, could have done it probably from an Eso event directly, but hell, you should install this addon anyway! )

--------------------

How can it be used?

Well, keep track of for how much you bought items.
There are no configurations, no settings, it just works after activation

Why did you (the uploader) create this addon?

Because I did not find anything similar doing just that, showing the price I purchased items in the item popup.
Good to know if I want to resell something I found in some shop so I can define how much at least I must take to make some profit
(TTC often shows too low prices, MasterMerchant too high to resell it fast enough )

Anything else the developer wants to say?

Yes, some special thanks to the developers of the addons I copied some code snippets from and learned how some things work:
- Master Merchant
- Tamriel Trade Center
- Awesome Guildstore
- @Baertram who gave me some tips in the comment section!
- and thanks to all others too! Existing code base is the best to learn from

Known Issues:

Update 1.0.0
just changed the version number

Update 0.0.2 fixed all known issues:
Implemented:
- The addon now saves data per server and is thereby bettere useable for server hoppers
- Item quality is now also tracked seperately (mainly for equipable items)
- Purchase buffer limited to 100 items per "quality/item" combination to avoid future performance issues
- implemented compatiblity functions for previous beta version users (already tracked data shouldn't get lost)
Removed not used addon dependencies and unused ui xml
General code cleanup
Archived Files (2)
File Name
Version
Size
Uploader
Date
0.0.2
4kB
be.ste
01/10/21 12:07 PM
0.0.1
4kB
be.ste
01/07/21 11:14 AM


Post A Reply Comment Options
Unread 01/10/21, 12:17 PM  
be.ste
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 4
Uploads: 2
I just uploaded V 0.0.2 and it should be soon available:

Update 0.0.2 fixed all known issues:
Implemented:
- The addon now saves data per server and is thereby bettere useable for server hoppers
- Item quality is now also tracked seperately (mainly for equipable items)
- Purchase buffer limited to 100 items per "quality/item" combination to avoid future performance issues
- implemented compatiblity functions for previous beta version users (already tracked data shouldn't get lost)
Removed not used addon dependencies and unused ui xml
General code cleanup

Thanks again @Baertram for all the hints.

Originally Posted by Baertram
self -> normally only used for "classes".
I removed any "class" structure and only using "static functions" now.
"Objects" are not needed in this addon.

Originally Posted by Baertram
SavedVariables / GetWorldName() / servers
I implemented datamigration to the server the addon user first logs in.
However, should not affect any future addon users much as young as it is.
I created some of the structure myself rather than per server - might not be ideally because all servers data is read in the memory, not sure how it works in the background.

I give it some thoughts how to eventually migrate that over later. Currently it still is in "default"

Originally Posted by Baertram
txt manifest file:
removed not used dependencies + empty line

Originally Posted by Baertram
Global variables
I just use "AwesomeGuildStore" directly now
Report comment to moderator  
Reply With Quote
Unread 01/07/21, 12:40 PM  
be.ste
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 4
Uploads: 2
@Baertram
Thanks a lot for your input! This will help and also helps understanding some of the LUA.

I will very probably consider them all in the next update(s).

Ya, I was a bit lazy about NA/EU differenciation. And wanted it to work fast (for me), me only playing on one of the servers. Now you already exactly described what to do, so thanks a lot! That makes it easy for me to fix that.
Report comment to moderator  
Reply With Quote
Unread 01/07/21, 12:08 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5988
Uploads: 78
Hi and welcome to addon development
A few hints about your files and code.

txt manifest file:
You shouldn't include empty lines like ## OptionalDependsOn:
They only stress the parse tools

lua code:
self -> normally only used for "classes".
It works for your addon, but you have not defined PurchaseTracker as a "class" via ZO_Object:Subclass()
So basically you shouldn' use self in the code, but jst reference the variable directly, in your case PurchaseTracker.
It's "only" a table
Code:
PurchaseTracker  = {}
Not a created object
Code:
 ZO_Object.New(self) )
of the class e.g. PurchaseTrackerClass.

That said your functions should neither the : notation, but only . then.

Class notation:
Lua Code:
  1. function PurchaseTracker:Initialize()
  2. ...
  3.  self:OverWriteToolTipFunction()
  4. ...

Normal table notation:
Lua Code:
  1. function PurchaseTracker.OverWriteToolTipFunction()
  2. ...
  3. end
  4.  
  5. function PurchaseTracker.Initialize()
  6. ...
  7.  PurchaseTracker.OverWriteToolTipFunction()
  8. ...
  9. end


SavedVariables:
Lua Code:
  1. self.savedVariables = ZO_SavedVars:NewAccountWide("PurchaseTrackerVars", 1, nil, acctDefaults, nil, 'PurchaseTracker')
Think about adding SavedVariables that are server dependent directly from the start! There are a lot users playing on the NA Megaserver as well as on the EU Megaserver (or even using the PTS). If your addon should differe the settings of those: Either use the 3rd parameter (which you have left nil and therefor will be the subtable named "Default" in your SV table now) of ZO_SavedVars:NewAccountWide or the 6th parameter where you have currently added 'PurchaseTracker' (and which will create a subtable further down below the accountname).
And instead of 'PurchaseTracker' use GetWorldName() then, which will return "NA Megaserver" or "EU Megaserver" depening on where you are logged in to.

Maybe your addon here does not need this difference, but perhaps others will. So always think about it at first if you need to use SVs, as changing them later will often reset the data (as changing the SV version does!) and make users angry :-)

Global variables:
Better NOT name local variables like exisitng global ones!
Your code:
Lua Code:
  1. local AwesomeGuildStore = _G["AwesomeGuildStore"]

Works but well, could cause issues.
Just name it slightly different like using a non-capital first character
Lua Code:
  1. local awesomeGuildStore = _G["AwesomeGuildStore"]

Easier to read AND see it's NOT the global variable you are refereincing there.
IF you really need to directly use the global variable, then just USE the global name AwesomeGuildStore.
-> _G["AwesomeGuildStore"] is nothing different than AwesomeGuildStore.


Libraries:
You have named the lib LibGetText and LibChatmessage as dependencies. Why?
They are not used in your addon?
Your code about them is commented!

Btw: If you add AGS alread as dependency, and AGS got those as needed dependencies, they will be automatically enabeld before AGS and AGS before your addon, so your addon does not need to depend on them as well anymore.
This would only be neccesary IF you have added the libraries as OptionalDependencies. But as AGS is a non-optional, so to say a "rea dependency", you won't have a problem removing them from your dependency list.

I'd definately remove them as long as you do not really use them in your code!
Last edited by Baertram : 01/07/21 at 12:12 PM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: