Thread Tools Display Modes
01/05/24, 08:57 AM   #1
robert.labrie
AddOn Author - Click to view addons
Join Date: Dec 2021
Posts: 16
LazyCraftingCertification / my first addon

Posting here for a bit of feedback/advice. I finally made an add-on. It has two major issues I think:
* I'm not supposed to use LLC_Global but I'm not sure what to use in it's stead
* LCCGetCurrentPlayerRacialPatternId() probably won't work for Imperials since I doubt the raceId aligns with the patternId for it but I don't have Imperial race on my acct

Any other feedback/commentary. As a sysadmin with over 20 years experience I'm a degenerate programmer who writes mediocre code and would love a once-over from someone experienced before I publish the addon.

https://github.com/robertlabrie/Lazy...gCertification

Cheers,
Robert
  Reply With Quote
01/05/24, 11:15 AM   #2
wookiefriseur
 
wookiefriseur's Avatar
Join Date: Mar 2014
Posts: 53
You could store the racialPatternId in a variable, because you never switch characters once the AddOn is loaded.

Something like this:

Lua Code:
  1. local racialId
  2.  local function getRacialId()
  3.   if racialId then return racialId end
  4.  
  5.  local characterId = GetCurrentCharacterId()
  6.   for i = 1, GetNumCharacters() do
  7.     local _, _, _, _, raceId, _, id, _ = GetCharacterInfo(i)
  8.     if (characterId == id) then
  9.       return raceId
  10.     end
  11.  end
  12. end

Regarding LLC, don't know but looks like you have to register your AddOn with LibLazyCrafting and then you get a function table that you can use. Something like:

Lua Code:
  1. local autocraft = true
  2.  
  3. -- you could use some function, that handles the crafting results and stuff, but nil should be fine for now
  4. local callbackfunction = nil
  5.  
  6. local LLC = LibLazyCrafting:AddRequestingAddon(LazyCraftingCertification.name, autocraft, callbackfunction )
  7.  
  8. -- and then use it like
  9. LLC.CraftSmithingItemByLevel(7, false, 1, getRacialId(), 1, false, CRAFTING_TYPE_BLACKSMITHING, 0, 1, true)

Careful, didn't test it.
  Reply With Quote
01/05/24, 01:54 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Hi and welcome to ESO addon development.
Never worked with LLC in depth so I cannot help you with that.
I onlw know it provides callbacks that fire as something was done, e.g. after it did craft anything etc. where you can register to and run a callback function in your addon then.


But a good advice:
In your txt file please add the library's most current version as check via >= behind the library name if you create new addons so players do not enable any very outdated old version and your addon loads, but errors then -> Self protection against wrong bug reports

Current:
Code:
## DependsOn: LibLazyCrafting
New:
Code:
## DependsOn: LibLazyCrafting>=3086
The version behind the >= is in the LibLazyCrafting.txt at ## AddOnVersion: <version here> tag

Described here at the Wiki:
https://wiki.esoui.com/Libraries
  Reply With Quote
01/05/24, 09:08 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
Originally Posted by robert.labrie View Post
Posting here for a bit of feedback/advice. I finally made an add-on. It has two major issues I think:
Originally Posted by robert.labrie View Post
* I'm not supposed to use LLC_Global but I'm not sure what to use in it's stead
* LCCGetCurrentPlayerRacialPatternId() probably won't work for Imperials since I doubt the raceId aligns with the patternId for it but I don't have Imperial race on my acct

Any other feedback/commentary. As a sysadmin with over 20 years experience I'm a degenerate programmer who writes mediocre code and would love a once-over from someone experienced before I publish the addon.

https://github.com/robertlabrie/Lazy...gCertification

Cheers,
Robert
Well, could have just asked me :P
But anyway, what you'll want to do is to call
local interactionTable = LibLazyCrafting:AddRequestingAddon(String addonName, boolean autoCraft, function callbackFunction, string optionalDebugAuthor, table optionalStyleTable)

Then replace any instances of LLC_Global with interactionTable.
You can even add a callback function, and LLC will spit back a table containing the location of the newly crafted item. So you don't need to worry about that weird tristat epic iron dagger that someone made.

Notably, you might be interested in the optionalStyleTable. This lets you specify 'allowed' styles (for example, all base racial styles, and maybe some cheap stuff like barbaric), and then you can just pass LLC_FREE_STYLE_CHOICE as the style ID. Then LLC will choose whatever you have the most of, (and can use) in that allowed style list. This is admittedly, not documented iirc bc it was a later addition.
  Reply With Quote
01/05/24, 09:30 PM   #5
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
LazyCraftingCertification.name = "Lazy Crafting Certification"
IIRC this should generally match the folder name of your addon, as if it's used in
function LazyCraftingCertification.OnAddOnLoaded(event, addonName)
if addonName == LazyCraftingCertification.name then


then the addonName passed to that callback function is the folder name. Not 100% sure. You're not doing anything in the onAddonLoaded function so you wouldn't see any issues from that, but it might cause headaches if you do try to do stuff there (like say, register with LLC)


https://github.com/robertlabrie/Lazy...cation.lua#L22


Personally, I would suggest using the item ID (GetItemId . Also, assuming recipes don't share item ids) rather than the item link, but it doesn't make a big difference.
I also highly suggest making a helper function to find the certification quests. It'll make it a little easier, especially if you ever plan to localize, and you won't need as many for loops either.


https://github.com/robertlabrie/Lazy...ua#L63C8-L63C8


You can do local _,_,_, thingICareAbout,_,_,_,otherThingICareAbout = functionWithTonsOfReturns()
Makes the code a little more readable.

If someone accepts provisioning quest, realizes they don't have the addon on, then turns it on, the addon won't auto learn the recipe and will get stymied when it tries to craft. Probably won't happen too much but something to consider.
(also you have empty function local function LCCScratch()
end)


There's a nifty function DoesItemLinkFulfillJournalQuestCondition that you can use for the craft steps. Just save an example iron dagger item link and ask if that item link fills the quest condition. Also makes it easier for localization. But I doubt it'll work for the deconstruction step.
  Reply With Quote
01/09/24, 07:59 PM   #6
robert.labrie
AddOn Author - Click to view addons
Join Date: Dec 2021
Posts: 16
Big thanks to everyone who responded and Dolgubon thanks for the tip on the addon name that saved me hours of head scratching. Im pretty happy with it now (still some improvements to make if it gets > 1 download or any requests I'll handle). Last question on this thread is when doing the initial addon upload if I plan to link to github later, should I keep the .git directory in LazyCraftingCertificiation1.0.0.zip or remove it?

Thanks again
Robert
  Reply With Quote
01/10/24, 02:36 AM   #7
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
Originally Posted by robert.labrie View Post
Big thanks to everyone who responded and Dolgubon thanks for the tip on the addon name that saved me hours of head scratching. Im pretty happy with it now (still some improvements to make if it gets > 1 download or any requests I'll handle). Last question on this thread is when doing the initial addon upload if I plan to link to github later, should I keep the .git directory in LazyCraftingCertificiation1.0.0.zip or remove it?

Thanks again
Robert
Do not include the .git file.
Personally, I use the Package utility to package the files.
It makes it very easy to make the .zip files.
Then just put the link to the github in the addon description, and those who care will be able to get the git repo

Also side note, but I updated the documentation for LLC and moved it to a Readme, partly in response to this

Last edited by Dolgubon : 01/10/24 at 03:10 AM.
  Reply With Quote
01/10/24, 04:04 AM   #8
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Originally Posted by Dolgubon View Post
Also side note, but I updated the documentation for LLC and moved it to a Readme, partly in response to this
Thanks a lot!

Originally Posted by Dolgubon View Post
Do not include the .git file.
Yes please, do not add any hidden files like .git or .idea or .vs(_code) or thumbs.db or whatever in your zip files as they will show in teh addon verfification tools and would have to be checked each time too.
Beside that antivirus and other protective tools sometimes spitout false positives about hidden files.

As those ONLY belong to the addon development process, or windows explorer cached image files (thumbs.db), please do not add those into the zip files.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » LazyCraftingCertification / my first addon


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