From 2353c4fe3edd7b0f2df9f245f232daa7f3c8e852 Mon Sep 17 00:00:00 2001 From: HonorGoG Date: Wed, 2 Jul 2025 23:59:28 -0700 Subject: [PATCH] - Fixing some more TOC changes in the repository. --- Titan/TitanGame.lua | 4 +- Titan/TitanHistory.lua | 2 +- Titan/_ATitanDoc.lua | 2 +- TitanBag/TitanBag.toc | 9 + TitanBag/TitanBag_Mainline.toc | 9 - TitanBag/TitanBag_Vanilla.toc | 9 - TitanClock/TitanClock.toc | 10 + TitanClock/TitanClock_Mainline.toc | 10 - TitanClock/TitanClock_Vanilla.toc | 9 - TitanGold/TitanGold.toc | 10 + TitanGold/TitanGold_Mainline.toc | 10 - TitanGold/TitanGold_Vanilla.toc | 9 - TitanLDB/Artwork/Bag_Blue.blp | Bin 0 -> 3916 bytes TitanLDB/Artwork/Bag_Red.blp | Bin 0 -> 3916 bytes TitanLDB/Artwork/Starter.tga | Bin 0 -> 16428 bytes TitanLDB/DevReadMe.lua | 156 ++++++ TitanLDB/StarterLDB.lua | 253 +++++++++ TitanLDB/TitanLDB.toc | 13 + .../CallbackHandler-1.0/CallbackHandler-1.0.lua | 202 +++++++ .../CallbackHandler-1.0/CallbackHandler-1.0.xml | 4 + TitanLDB/libs/LibDataBroker-1.1.lua | 90 ++++ TitanLocation/TitanLocation.toc | 10 + TitanLocation/TitanLocation_Mainline.toc | 10 - TitanLocation/TitanLocation_Vanilla.toc | 9 - TitanLootType/TitanLootType.toc | 10 + TitanLootType/TitanLootType_Classic.toc | 18 +- TitanLootType/TitanLootType_Mainline.toc | 10 - TitanPerformance/TitanPerformance.toc | 10 + TitanPerformance/TitanPerformance_Mainline.toc | 10 - TitanPerformance/TitanPerformance_Vanilla.toc | 9 - TitanPlugin/Artwork/TitanStarter.tga | Bin 0 -> 16428 bytes TitanPlugin/DevReadMe.lua | 539 ++++++++++++++++++ TitanPlugin/TitanPlugin.toc | 9 + TitanPlugin/TitanStarter.lua | 569 ++++++++++++++++++++ TitanRepair/TitanRepair.toc | 10 + TitanRepair/TitanRepair_Mainline.toc | 10 - TitanRepair/TitanRepair_Vanilla.toc | 9 - TitanVolume/TitanVolume.toc | 11 + TitanVolume/TitanVolume_Mainline.toc | 11 - TitanVolume/TitanVolume_Vanilla.toc | 9 - TitanXP/TitanXP.toc | 10 + TitanXP/TitanXP_Mainline.toc | 10 - TitanXP/TitanXP_Vanilla.toc | 9 - 43 files changed, 1938 insertions(+), 175 deletions(-) create mode 100644 TitanBag/TitanBag.toc delete mode 100644 TitanBag/TitanBag_Mainline.toc delete mode 100644 TitanBag/TitanBag_Vanilla.toc create mode 100644 TitanClock/TitanClock.toc delete mode 100644 TitanClock/TitanClock_Mainline.toc delete mode 100644 TitanClock/TitanClock_Vanilla.toc create mode 100644 TitanGold/TitanGold.toc delete mode 100644 TitanGold/TitanGold_Mainline.toc delete mode 100644 TitanGold/TitanGold_Vanilla.toc create mode 100644 TitanLDB/Artwork/Bag_Blue.blp create mode 100644 TitanLDB/Artwork/Bag_Red.blp create mode 100644 TitanLDB/Artwork/Starter.tga create mode 100644 TitanLDB/DevReadMe.lua create mode 100644 TitanLDB/StarterLDB.lua create mode 100644 TitanLDB/TitanLDB.toc create mode 100644 TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua create mode 100644 TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml create mode 100644 TitanLDB/libs/LibDataBroker-1.1.lua create mode 100644 TitanLocation/TitanLocation.toc delete mode 100644 TitanLocation/TitanLocation_Mainline.toc delete mode 100644 TitanLocation/TitanLocation_Vanilla.toc create mode 100644 TitanLootType/TitanLootType.toc delete mode 100644 TitanLootType/TitanLootType_Mainline.toc create mode 100644 TitanPerformance/TitanPerformance.toc delete mode 100644 TitanPerformance/TitanPerformance_Mainline.toc delete mode 100644 TitanPerformance/TitanPerformance_Vanilla.toc create mode 100644 TitanPlugin/Artwork/TitanStarter.tga create mode 100644 TitanPlugin/DevReadMe.lua create mode 100644 TitanPlugin/TitanPlugin.toc create mode 100644 TitanPlugin/TitanStarter.lua create mode 100644 TitanRepair/TitanRepair.toc delete mode 100644 TitanRepair/TitanRepair_Mainline.toc delete mode 100644 TitanRepair/TitanRepair_Vanilla.toc create mode 100644 TitanVolume/TitanVolume.toc delete mode 100644 TitanVolume/TitanVolume_Mainline.toc delete mode 100644 TitanVolume/TitanVolume_Vanilla.toc create mode 100644 TitanXP/TitanXP.toc delete mode 100644 TitanXP/TitanXP_Mainline.toc delete mode 100644 TitanXP/TitanXP_Vanilla.toc diff --git a/Titan/TitanGame.lua b/Titan/TitanGame.lua index 923007c..2d4d3be 100644 --- a/Titan/TitanGame.lua +++ b/Titan/TitanGame.lua @@ -1,8 +1,8 @@ --[===[ File NAME: TitanGame.lua -DESC: This file contains the 'game version' Titan or Titan. Used to set up libs, locale, ... +DESC: This file contains the 'game version' Titan or TitanClassic. Used to set up libs, locale, ... Different folders are required because Titan used Titan as a name (& folder) for the Classic WoW versions. -The saved variables for Classic WoW are in Titan.lua - not Titan.lua. +The saved variables for Classic WoW are in TitanClassic.lua - not Titan.lua. :DESC --]===] diff --git a/Titan/TitanHistory.lua b/Titan/TitanHistory.lua index 6106877..b3245fc 100644 --- a/Titan/TitanHistory.lua +++ b/Titan/TitanHistory.lua @@ -15,7 +15,7 @@ Green - 'header' - Titan or plugin Highlight - notes. tips. and details --]] Titan_Global.recent_changes = "" -.. TitanUtils_GetGoldText("8.3.0 : 2025/07/15\n") +.. TitanUtils_GetGoldText("8.3.0 : 2025/07/2\n") .. TitanUtils_GetGreenText("Titan : \n") .. TitanUtils_GetHighlightText("" .. "- Major change : \n" diff --git a/Titan/_ATitanDoc.lua b/Titan/_ATitanDoc.lua index d19e186..68d4c7f 100644 --- a/Titan/_ATitanDoc.lua +++ b/Titan/_ATitanDoc.lua @@ -38,7 +38,7 @@ These are routines Titan will keep stable. Changes to these varaibles and routines will be broadcast to developers via Discord at a minimum. Dev : -These are global routines Tian uses. These may change at any time per Titan needs and design. +These are global routines Titan uses. These may change at any time per Titan needs and design. File : Each file has a terse description of its contents. diff --git a/TitanBag/TitanBag.toc b/TitanBag/TitanBag.toc new file mode 100644 index 0000000..2c413f6 --- /dev/null +++ b/TitanBag/TitanBag.toc @@ -0,0 +1,9 @@ +## Interface: 110105, 40402, 11507 +## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.3.0|r +## Version: 8.3.0 +## IconTexture: Interface\AddOns\TitanBag\TitanBag +## Notes: Adds bag and free slot information to Titan Panel +## Author: Titan Panel Development Team (http://www.titanpanel.org) +## SavedVariables: +## Dependencies: Titan +TitanBag.lua diff --git a/TitanBag/TitanBag_Mainline.toc b/TitanBag/TitanBag_Mainline.toc deleted file mode 100644 index dbf89cf..0000000 --- a/TitanBag/TitanBag_Mainline.toc +++ /dev/null @@ -1,9 +0,0 @@ -## Interface: 110107 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## IconTexture: Interface\AddOns\TitanBag\TitanBag -## Notes: Adds bag and free slot information to Titan Panel -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: -## Dependencies: Titan -TitanBag.lua diff --git a/TitanBag/TitanBag_Vanilla.toc b/TitanBag/TitanBag_Vanilla.toc deleted file mode 100644 index 8ebc4ee..0000000 --- a/TitanBag/TitanBag_Vanilla.toc +++ /dev/null @@ -1,9 +0,0 @@ -## Interface: 11507, 50500 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## Notes: Adds bag and free slot information to Titan Panel -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: -## OptionalDeps: -## Dependencies: Titan -TitanBag.lua diff --git a/TitanClock/TitanClock.toc b/TitanClock/TitanClock.toc new file mode 100644 index 0000000..e4b816a --- /dev/null +++ b/TitanClock/TitanClock.toc @@ -0,0 +1,10 @@ +## Interface: 110105, 40402, 11507 +## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.3.0|r +## Version: 8.3.0 +## IconTexture: Interface\Icons\Spell_Nature_TimeStop +## Notes: Adds a clock to Titan Panel +## Author: Titan Panel Development Team (http://www.titanpanel.org) +## SavedVariables: +## OptionalDeps: +## Dependencies: Titan +TitanClock.lua diff --git a/TitanClock/TitanClock_Mainline.toc b/TitanClock/TitanClock_Mainline.toc deleted file mode 100644 index 710ed98..0000000 --- a/TitanClock/TitanClock_Mainline.toc +++ /dev/null @@ -1,10 +0,0 @@ -## Interface: 110107 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## IconTexture: Interface\Icons\Spell_Nature_TimeStop -## Notes: Adds a clock to Titan Panel -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: -## OptionalDeps: -## Dependencies: Titan -TitanClock.lua diff --git a/TitanClock/TitanClock_Vanilla.toc b/TitanClock/TitanClock_Vanilla.toc deleted file mode 100644 index fcdb12b..0000000 --- a/TitanClock/TitanClock_Vanilla.toc +++ /dev/null @@ -1,9 +0,0 @@ -## Interface: 11507, 50500 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## Notes: Adds a clock to Titan Panel -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: -## OptionalDeps: -## Dependencies: Titan -TitanClock.lua diff --git a/TitanGold/TitanGold.toc b/TitanGold/TitanGold.toc new file mode 100644 index 0000000..5bf41d9 --- /dev/null +++ b/TitanGold/TitanGold.toc @@ -0,0 +1,10 @@ +## Interface: 110105, 40402, 11507 +## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.3.0|r +## Version: 8.3.0 +## IconTexture: Interface\AddOns\TitanGold\Artwork\TitanGold +## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. +## Author: Titan Panel Development Team (http://www.titanpanel.org) +## SavedVariables: GoldSave +## OptionalDeps: +## Dependencies: Titan +TitanGold.lua diff --git a/TitanGold/TitanGold_Mainline.toc b/TitanGold/TitanGold_Mainline.toc deleted file mode 100644 index d8d594f..0000000 --- a/TitanGold/TitanGold_Mainline.toc +++ /dev/null @@ -1,10 +0,0 @@ -## Interface: 110107 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## IconTexture: Interface\AddOns\TitanGold\Artwork\TitanGold -## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: GoldSave -## OptionalDeps: -## Dependencies: Titan -TitanGold.lua diff --git a/TitanGold/TitanGold_Vanilla.toc b/TitanGold/TitanGold_Vanilla.toc deleted file mode 100644 index c3788b1..0000000 --- a/TitanGold/TitanGold_Vanilla.toc +++ /dev/null @@ -1,9 +0,0 @@ -## Interface: 11507, 50500 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.3.0|r -## Version: 8.3.0 -## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. -## Author: Titan Panel Development Team (http://www.titanpanel.org) -## SavedVariables: GoldSave -## OptionalDeps: -## Dependencies: Titan -TitanGold.lua diff --git a/TitanLDB/Artwork/Bag_Blue.blp b/TitanLDB/Artwork/Bag_Blue.blp new file mode 100644 index 0000000000000000000000000000000000000000..5e7bde1a175240f200c117b170133ac61ecdf86d GIT binary patch literal 3916 zcmeHJZ)_CD6@Rzo%4&`wd%ay%C2UX$XR6$vir8F$3+K74@ABa|3&}P# zDcC9rw$#OTlG-)&u)W51h;$)d_iig_S}-6HS~V?BTPJB$IV353tK+IImfSz2RJf&Y zeOM?cNl`!Zq|t9@-^{#uzxU?NL?2IRE&yO$;0hx;ZD0wu2e2&zShXBr1GdfBzJcwY zgy1L!z(A0&Io-vEpZDcH1NRxY&%kFg;3Gd7xb^7rm;~Mls7tv49+?12aeVzdWxTt; z`2V@v`bAv)e>Z+oFFEU1nhAh?y|?D)elEc(D^V8=O7Q+gr#1pah;2I?_)x_HlEzo(a~|u*S7b0cSRsVj;b!!T_Hiv!*QJK*jx=WM2rNK)0;_%hg03z(-AQP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mz<3*#jyV|g7%e`nnURk3gHd}D6@*0e-Ve!qVSp3AQ^IJd5kto|vwhp11K@sS0L zknN6Mj}Wh;XQrh(>u(bt^y&wjDo{TAe%eK(AoA#WEmW6C6moDbsVJq9DEZa;e13Su zN8Y?^{_mVPq@!e291-jM84U_%smAxcsX+r^DgRDjrPCJ-%u?l;NH#J%A?r!FvjA32Dy0%QLl>=iD&sZdXv~T1M z>F=RNl#%4c-n4B%Cb_vC&p#Z~GD+6OsqYG>wP-F)oA}eJOiOkxe^l(LjTRi| z!{3tr<-0tSJ{@dn+IvQHvSO0&@B%)h9^+5o+s3Zn#!Y*fG^IYWL|}oAIrH+KiMa^I z{Yi#lFs>6$*5$}oGt>whon&3+J>!u5s;3_Bop2&Yo{dA%q;Y;Om*6$! zRQ}VO(6fc}+Lu~otdo2AGnycdShK<*X=o_l_Y3comfi_pc#Pjv?WDDvUniPP1&}-s zh|hN$f9~+qCGmINDB(hMXi%vUzSBA|T7+ru6IfRj*y5{-8$p>Eo}(dq*dG3kGO6G> GwEqh>R`D|c literal 0 HcmV?d00001 diff --git a/TitanLDB/Artwork/Bag_Red.blp b/TitanLDB/Artwork/Bag_Red.blp new file mode 100644 index 0000000000000000000000000000000000000000..31579e7f35db61f470b858c70c7bae36f5c63df3 GIT binary patch literal 3916 zcmeHKeQZ;w_=bdwZ_ndq0If-Ju>U&uL06`Y`S~-#&pU6hM0P#WqzOe{^?<0O0aRuV9 zL>TfC0Kgz2Ma-!@qo2>|c?F(V;CTg}Spfoj`vm*SBITW{0KhDP3INGX03q`K@$cv4 z(>ibe|0G%sz;Z?iz-vd@)U@Z63xGn=&Yb|;Eb1#K@05=$P~W z@_Y0H0)y~m;rd}5Nl=7~-;bdNDbh=%VE+>~1+Y`Da)bk&0Fcz)y+3LKpcWCgPH}Nw z9w8<$7SaDEud#I~POWRvt-L~D@=~9#_JgVeFaPk=yX&I{%5r={5(WY<8tdlp9?;1f0jO6LSTRP`4*o)7F0*6 zk>dwzpvD;4ex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@LVSC4K%v7OTr#oj7NHU2}KDnIAuFcPv z+oob$y{Ipls`?G&`d3H&N@gCe(U2R5rPbpk1?FuVH%qy^+PckBD|*0ZB^8V?3k;5p z_K4AQK5*`*daTDg6h8XIP;NG-VXx(^grXXBjibSGxZn83GNLoW{hvEbj?_62{R3_< Blu!Tw literal 0 HcmV?d00001 diff --git a/TitanLDB/Artwork/Starter.tga b/TitanLDB/Artwork/Starter.tga new file mode 100644 index 0000000000000000000000000000000000000000..6a7ddda4e51144dea0fb5437a7361075c9228d40 GIT binary patch literal 16428 zcmeI34{(&_oyQj>_!^~f36ti) z*`si`$B^Difyr?|R|;)pNGDLSs|U`Sf~FKSMbI>2CsH_b7RPvc3au27kmtVNC;NMO zHVq*JJn_bN<}=R=36RhC`9073JkPs090MJ4`5k_T+mc^>)_#`2bxdFY{;n*L4Q}m) zTky4;!2hRAJ#(@#wX28GeQ+8SCQ_Bw?AC(_?*)_HD z)l4Fl>1P_DzL9WAcx_|`+fEzsv)Ux#zc>kcF zBL4eeqUmB_Rju+o7*ohV19wH>t~}wm^3GeS{IOcn3C;(Wu6@sQf9Y}XBK)_*`4JER z6Tol;z;Sh>Uc=xXhWin?e*_f$eT!>!2FyYHB?H4>=MdT6sM2&Gi_^uG)otS^6~73! zz<&Y6CxI`4A>h*E48Qn-*c@E~uzJ z0=A8sIAtN~!Ut{xHzSDwIt?cBf0xRTtP$g9I44y;59hP+R|5TG&Fyv$!J4G@X9gsH zevOUJ!0^{ulp+@cxGQ8pI>4#mn)=tlQw8CrQDiX%&bI>#bmj2z7sgF+&xQLY@D98? z#hv{x{qA!6^*#Mr1A^(#`<#bX>Kb6H?+tfrVihPVr}?<(EpoErTDTIKYGm2*<0i>Xmnyf~@6 z{)CNZVoZe|Yq0T!63UYs(C~grY@5axsZpBwtCbIUrY+UDgHdH7&(-mvm?HUAn>&56 z`m^8-Pbijjj?bSD|F3}Sz1PumUe@iCm&5%(;eOHfmkfIGuRPqUi0Pj{ZH4VGIq>-@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=Y%z^&1p3S6WN3+V{;X0h>##9MfvaD{8?azBU z8~*3u{*rU7?>lgJfvcVGy8C1PcNW9HS$|GtOOtBG`bPR*x9E5FcRbZ(_dhe}>ibLn z%)#`R8lZp4lg%oy9q%j9vL5I^WnH6&&h!`Dc$P~4v*ns6?cag>WA38J3V7cMICi`H zT%5}cI*`pX#L{pI{o2mb@` zKHI{1o<5_8>oxgv+>Ccl3U7=zw!RDS{ucXZtSNdUfwMQ0ng-Mc)(Aoj=Mw%H&IZ#2 z;wfbkL@p*J^YHFw1Ktw>&qSODV|{C!Vc^|%t;z{5>Hy6nJ%y$CnLl^6o!ra!e+~Xm zhBqY7fPVWk1A$|MFo*D_h75P+P?2a<%bvh~4LK6NKcTziV7e#v9ufc3@c$|Ln`e2~ zI_AwdyzqYp?&rV-@J_+Zilg8VXaX;lKU&)Yj)Awp>FAEej_&<0?ulRG{bt%);#KIR7j# zzhG|VN>GRAXQPqrLx-J{!hX^58%i9q%S^mZ1DLYXBPN8_!98qT=;K1#gQf8 zC*VN-+@-$*?;(ftsDsXozDF%^9I*fCF8-Szq3 zztO&t`*SC1#SQKT-$D*+3TKo*yY%1cUI!n*zeBvGg?~Hz*TCKVDfjQ{kFK$D6Z}61 z?!f2C?*S3y@Dp%2wyCZi?&l5vx8c7U?)X1I*R^A%~;jcj*5E@LvRXJfklEbM#y8#`%MM?($iDC-4KDXF3*uZvhYJ z>zOvb^;3OuU&iw+u0{C%ivI}`YmU#Z&l0$P3Cx}~r)ci92c~^_Vanilla. Delete (or rename) the other .toc files. + +*** The ## Interface value should match the current interface value of the corresponding WoW version. +If the interface value is higher or lower, WoW will complain that you are running 'out of date' addons. +In the BattleNet app this typically shown below the 'Play' button. +- DragonFlight 10.2.7 is represented without dots - 100207 - in the .toc file. +- Cataclysm 4.4.0 is represented without dots - 40401 - in the .toc file. + +=== Artwork folder: icons and artwork +Anyone can extract the Blizzard UI code and art from WoW. This can be handy to get code examples. +My understanding is any WoW icon can be used within an addon without violating the ToS (Terms of Service). +Wowhead has a searchable list of WoW icons : https://www.wowhead.com/icons + +WoW icons tend to be .blp files. These files are NOT easy to look at or manipulate!! +BLPView (Windows only) from wowinterface is light and easy to view blp files as thumbnails in File Explorer. +You will need to research third party tools to manipulate .blp files. My advice is convert .blp to another format. + +=== libs folder +*** The libraries required for a LDB addon are in the LDB/libs folder. +- WoW does not guarentee the load order of addons. +- If the LDB addon were loaded before the display addon, the loader would throw errors if the libs were not found. +- If the LDB addon requires additional libraries, please include them in libs folder and update the .toc appropriately. + +--]] + +--[[ LDB attributes +The list of required attributes depend on the type of LDB being created. + +Attributes used in this addon: +.type : Required : data source | launcher +.icon : Path to the icon to be used. Place the icon in the addon folder, even if copied from WoW folder. +.label : The label for the addon text +.text : The addon text to display +.OnTooltipShow : The function to use for the tool tip, if any +.OnClick : The function to to handle mouse clicks, if any + + +Available Titan extensions: +.category : The general grouping this addon is in. +- Titan attempts to grab X-Category from the addon TOC first. +- The complete category list is in +- TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY (TitanGlobal.lua) "Built-ins" is reserved for addons that Titan releases! +.version : Addon version shown in Titan menus and config. +- Titan attempts to grab Version from the addon TOC first. +.OnDoubleClick : Implemented by orig dev, not sure this is used by any addon. + +The three data elements are: +- icon +- label +- text + +When any of these are changed, the LDB lib initiates a callback to the display addon. +The display addon registers for these callbacks and creates any frame(s) it needs to display the LDB addon data. +--]] + +--[[ Editing +Before you start changing this example it is HIGHLY recommended to install the following addons: +- BugGrabber : Grabs errors and stores them +- BugSack : The visual part of BugGrabber +- WowLua : Allows you to try Lua code directly in WoW. + +It is recommended you make small changes then check your coding. +When testing just start or /reload WoW. All versions now check and load new files on reload. + +Routines: +GetBagSlotInfo will be replaced by your code. + +Button_OnEvent will be changed to react to any events your addon needs. +- All events registered for should be handled here. +- The display addon is not directly involved in any event handling of this addon. +--]] + +--[[ Code flow within WoW +First step: ==== Starting WoW +Wow will load addons in the Addons folder. +Order is not guaranteed, however dependencies (## Dependencies) are honored. + +When this addon is loaded any code outside the Lua functions will be run. +Examples: +- local VERSION = GetAddOnMetadata(add_on, "Version") will set VERSION +- ... +- Create_Frames is called + +Create_Frames will create the addon frame StarterLDBExample. +- All created frames will be in the global namespace. +- All created frames are forever – they are not touched by the Lua garbage collection. + +Then Create_frames sets the frame OnEvent script handler. This is the only handler required in this addon. + +Then local LDB_Init will initialize the required LDB object. +This routine should be small : +- Set the LDB object +- Set required local variables +- Register for PLAYER_ENTERING_WORLD +- *** DO NOT rely on any saved variables (## SavedVariables) being ready here + +Next: ==== Waiting for WoW +WoW fires a bunch of events as addons are loaded. + +Eventually the game and all addons are loaded and addons receive the PLAYER_ENTERING_WORLD event via the frame script OnEvent. +When processing PLAYER_ENTERING_WORLD, register for additional events your addon requires. +Any saved variables should be ready. + +Next: ==== Still waiting for WoW +The display addon (such as Titan) shows the user requested bars with the user requested addons. + +The addon is now ready for the user. + +Next: ==== Ready to play WoW! Yeah! +The addon is 'idle' until one of the following occur: +- Any registered event is received - OnEvent +- User clicks on this addon - OnClick via display addon +- User mouses over addon - OnTooltipShow via display addon +- User mouse leaves addon - OnLeave via display addon + +Next: ==== +The above steps continues until: +- The user logs out the character or exits WoW or reloads UI - Onhide + +On logout or exit any saved variables are saved to the local system. +No additional actions are required. + +--]] diff --git a/TitanLDB/StarterLDB.lua b/TitanLDB/StarterLDB.lua new file mode 100644 index 0000000..c0ceadb --- /dev/null +++ b/TitanLDB/StarterLDB.lua @@ -0,0 +1,253 @@ +--[[ StarterLDB.lua +By: The Titan Panel Development Team +--]] + + +-- Intended for Intellisense if an IDE supports and is used +-- Lines starting with triple dash are usually Intellisense +---@class Frame WoW frame to get events +---@field obj table For LDB object + +-- ******************************** Constants ******************************* +local ADDON_NAME = ... +-- Set the name we want in the global name space. Ensure the name is unique across all addons. +StarterLDB = {} + +-- NOTE: The 'id' and the 'addon' name are different! +-- Typically they are the same to reduce user confusion but they do not need to be the same. +local id = "LDBStarter"; -- Name the user dhould see in the display addon +local addon = ADDON_NAME -- addon name / folder name / toc name + +-- Localized strings are outside the scope of this example. + +--[[ +The artwork path must start with Interface\\AddOns +Then the name of the plugin +Then any additional folder(s) to your artwork / icons. +Double backslash will for for Windows; forward slash works fine. +--]] +local artwork_path = "Interface/AddOns/TitanLDB/Artwork/" +---@diagnostic disable-next-line: deprecated, undefined-global +local GetAddOnMetadata = C_AddOns.GetAddOnMetadata or GetAddOnMetadata + +-- Get data from the TOC file. +local version = tostring(GetAddOnMetadata(addon, "Version")) or "Unknown" +local author = GetAddOnMetadata(addon, "Author") or "Unknown" +-- NOTE: GetAddOnMetadata expects the addon name : +-- The addon folder name or .toc name needs to be the same. + +-- ******************************** Variables ******************************* +local trace = false -- toggle to show / hide debug statements in this addon + +-- ******************************** Functions ******************************* + +---Output a debug statement to Chat with timestamp. +---@param debug_message string +---@param debug_type string +local function Debug(debug_message, debug_type) + if trace then + local dtype = "" + local time_stamp = "" + local msg = "" + if debug_type == "error" then + dtype = "Error: " + elseif debug_type == "warning" then + dtype = "Warning: " + end + time_stamp = date("%H:%M:%S") .. ": " + + msg = + tostring(addon) .. ": " + .. time_stamp + .. dtype + .. debug_message + + _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) + else + -- not requested + end + --date("%m/%d/%y %H:%M:%S") +end + +--- Calculate bag space then return text and icon to display +---@return string bagText display text +---@return string icon path to +local function GetBagSlotInfo() + local totalSlots, usedSlots, availableSlots, icon + totalSlots = 0; + usedSlots = 0; + for bag = 0, 4 do + local size = C_Container.GetContainerNumSlots(bag); + if (size and size > 0) then + totalSlots = totalSlots + size; + local free = C_Container.GetContainerNumFreeSlots(bag) + local used = size - free + usedSlots = usedSlots + used; + end + end + availableSlots = totalSlots - usedSlots; + + local i, r = math.modf(availableSlots / 2) + -- Simple example of changing the icon : even blue - odd red + -- wowhead.com/icons was searched and these selected + -- The art was extracted : ../_retail_/BliizardInterfaceArt + -- These were found in /Interface/ICONS of the extracted folder by the name used on wowhead + -- Copied into /Artwork in case Blizz ever renames or removes these icons. + if (r == 0) then + icon = artwork_path .. "Bag_Blue.blp" + else + icon = artwork_path .. "Bag_Red.blp" + end + + local bagText + bagText = format("%d/%d", availableSlots, totalSlots); + + bagText = HIGHLIGHT_FONT_COLOR_CODE .. bagText .. FONT_COLOR_CODE_CLOSE + + return bagText, icon +end + +--- Create the tooltip +---@param tooltip GameTooltip From display addon +local function LDB_OnTooltipShow(tooltip) + tooltip = tooltip or GameTooltip -- for safety + local tt_str = "" + + tt_str = + GREEN_FONT_COLOR_CODE + .. id .. " Info" + .. FONT_COLOR_CODE_CLOSE + tooltip:AddLine(tt_str) + + local text, icon = GetBagSlotInfo() + tt_str = "Available bag slots" + .. " " .. text .. "\n" + .. "\n" .. "Hint: Left-click to open all bags." + + tooltip:AddLine(tt_str) +end + +--- Initialize the LDB obj and initial set up +---@param LDB_frame Frame Addon frame +local function LDB_Init(LDB_frame) + Debug(id .. " Init ...", "normal"); + --[[ + Initialize the Data Broker 'button'. + This is the heart of a LDB plugin. It determines how the display addon is to treat this addon. + + Setting the type is required so the LDB lib and display addon know what to do. See the LDB spec. + + id will be the name Titan uses for the plugin. You can find it in the Titan Config or Titan right click menu. + --]] + + LDB_frame.obj = + LibStub("LibDataBroker-1.1"):NewDataObject(id, -- Name used within Titan + { + type = "data source", -- required + -- LDB spec: The two options are: + -- "data source" - Expected to show some type of info + -- "launcher" - Expected to open another window or perform some action + icon = artwork_path .. "Starter.tga", -- The icon to display on the display addon + label = id, -- label for the text + text = "nyl", -- will be updated as needed by this plugin + OnTooltipShow = function(tooltip) + LDB_OnTooltipShow(tooltip) + end, + OnClick = function(self, button) + if (button == "LeftButton") then + -- Just a simple action to illustrate an LDB addon. + ToggleAllBags(); + elseif (button == "RightButton") then + -- There is no action to take in this example. + --[[ Add code here if your addon needs to do something on right click. + Typically an options menu which is outside the scope of this example. + --]] + end + end, + -- Titan specific!! + category = "Information", -- Otherwise defaults to General : TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY + }) + + -- After player entering world it is safe + -- - to look at any saved variables + -- - register for more events; registering here may cause errors if data is not ready + LDB_frame:RegisterEvent("PLAYER_ENTERING_WORLD"); + + Debug(id .. " Init fini.", "normal"); +end + +--- Update the Bags Data Broker 'button' +---@param LDB_frame Frame +local function LDB_Update(LDB_frame) + local text, icon = GetBagSlotInfo() + LDB_frame.obj.text = text + LDB_frame.obj.icon = icon +end + +--- Parse events registered events and act on them +---@param self Button +---@param event string +---@param ... any +local function Button_OnEvent(self, event, ...) + -- https://warcraft.wiki.gg/wiki/UIHANDLER_OnEvent + + Debug("OnEvent" + .. " " .. tostring(event) .. "" + , "normal") + if (event == "PLAYER_ENTERING_WORLD") then + -- Do any additional set up needed + -- + -- Now that events have settled, register the one(s) we really want. + -- Registering here may reduce churn and possible timing issues wrt data being ready + self:RegisterEvent("BAG_UPDATE"); + + -- Unregister events no longer needed. + -- Good practice to avoid init again - this is fired on /reload + self:UnregisterEvent("PLAYER_ENTERING_WORLD"); + + -- Update the text (bag numbers) + LDB_Update(self) + + end + if event == "BAG_UPDATE" then + LDB_Update(self) + end +end + +--- Create needed frames +local function Create_Frames() + -- general container frame to get events from WoW. + -- The display addon will create frame(s) needed to display data set by this addon. + local window = CreateFrame("Frame", "StarterLDBExample", UIParent) + -- window:Hide() + + -- Set strata as desired + window:SetFrameStrata("FULLSCREEN") + -- https://warcraft.wiki.gg/wiki/Frame_Strata + + window:SetScript("OnEvent", function(self, event, ...) + Button_OnEvent(self, event, ...) + end) + -- https://warcraft.wiki.gg/wiki/API_ScriptObject_SetScript + + -- Using SetScript("OnLoad", does not work + LDB_Init(window) + + -- shamelessly print a load message to chat window + DEFAULT_CHAT_FRAME:AddMessage( + GREEN_FONT_COLOR_CODE + .. addon .. id .. " " .. version + .. " by " + .. FONT_COLOR_CODE_CLOSE + .. "|cFFFFFF00" .. author .. FONT_COLOR_CODE_CLOSE); +end + +Create_Frames() -- Create WoW frames to get events + +--[[ +print("" + .." "..tostring(id).."" + .." "..tostring(version).."" + .." by "..tostring(author).."" + ) +--]] diff --git a/TitanLDB/TitanLDB.toc b/TitanLDB/TitanLDB.toc new file mode 100644 index 0000000..94e79e1 --- /dev/null +++ b/TitanLDB/TitanLDB.toc @@ -0,0 +1,13 @@ +## Interface: 110000 +## Title: StarterLDB +## Notes: LDB example +## Author: Titan Dev Team +## DefaultState: Enabled +## SavedVariables: +## OptionalDeps: +## Dependencies: +## Version: 1.1 +## X-Child-Of: +libs/CallbackHandler-1.0/CallbackHandler-1.0.xml +libs/LibDataBroker-1.1.lua +StarterLDB.lua diff --git a/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua new file mode 100644 index 0000000..01287bd --- /dev/null +++ b/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -0,0 +1,202 @@ +--[[ $Id: CallbackHandler-1.0.lua 1298 2022-12-12 15:10:10Z nevcairiel $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 8 +local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) + +if not CallbackHandler then return end -- No upgrade needed + +local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} + +-- Lua APIs +local securecallfunction, error = securecallfunction, error +local setmetatable, rawget = setmetatable, rawget +local next, select, pairs, type, tostring = next, select, pairs, type, tostring + + +local function Dispatch(handlers, ...) + local index, method = next(handlers) + if not method then return end + repeat + securecallfunction(method, ...) + index, method = next(handlers, index) + until not method +end + +-------------------------------------------------------------------------- +-- CallbackHandler:New +-- +-- target - target object to embed public APIs in +-- RegisterName - name of the callback registration API, default "RegisterCallback" +-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" +-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. + +function CallbackHandler.New(_self, target, RegisterName, UnregisterName, UnregisterAllName) + + RegisterName = RegisterName or "RegisterCallback" + UnregisterName = UnregisterName or "UnregisterCallback" + if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + UnregisterAllName = "UnregisterAllCallbacks" + end + + -- we declare all objects and exported APIs inside this closure to quickly gain access + -- to e.g. function names, the "target" parameter, etc + + + -- Create the registry object + local events = setmetatable({}, meta) + local registry = { recurse=0, events=events } + + -- registry:Fire() - fires the given event/message into the registry + function registry:Fire(eventname, ...) + if not rawget(events, eventname) or not next(events[eventname]) then return end + local oldrecurse = registry.recurse + registry.recurse = oldrecurse + 1 + + Dispatch(events[eventname], eventname, ...) + + registry.recurse = oldrecurse + + if registry.insertQueue and oldrecurse==0 then + -- Something in one of our callbacks wanted to register more callbacks; they got queued + for event,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, event) or not next(events[event]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for object,func in pairs(callbacks) do + events[event][object] = func + -- fire OnUsed callback? + if first and registry.OnUsed then + registry.OnUsed(registry, target, event) + first = nil + end + end + end + registry.insertQueue = nil + end + end + + -- Registration of a callback, handles: + -- self["method"], leads to self["method"](self, ...) + -- self with function ref, leads to functionref(...) + -- "addonId" (instead of self) with function ref, leads to functionref(...) + -- all with an optional arg, which, if present, gets passed as first argument (after self if present) + target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) + if type(eventname) ~= "string" then + error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) + end + + method = method or eventname + + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + + if type(method) ~= "string" and type(method) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) + end + + local regfunc + + if type(method) == "string" then + -- self["method"] calling style + if type(self) ~= "table" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) + elseif self==target then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) + elseif type(self[method]) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) self[method](self,arg,...) end + else + regfunc = function(...) self[method](self,...) end + end + else + -- function ref with self=object or self="addonId" or self=thread + if type(self)~="table" and type(self)~="string" and type(self)~="thread" then + error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) method(arg,...) end + else + regfunc = method + end + end + + + if events[eventname][self] or registry.recurse<1 then + -- if registry.recurse<1 then + -- we're overwriting an existing entry, or not currently recursing. just set it. + events[eventname][self] = regfunc + -- fire OnUsed callback? + if registry.OnUsed and first then + registry.OnUsed(registry, target, eventname) + end + else + -- we're currently processing a callback in this registry, so delay the registration of this new entry! + -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency + registry.insertQueue = registry.insertQueue or setmetatable({},meta) + registry.insertQueue[eventname][self] = regfunc + end + end + + -- Unregister a callback + target[UnregisterName] = function(self, eventname) + if not self or self==target then + error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) + end + if type(eventname) ~= "string" then + error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) + end + if rawget(events, eventname) and events[eventname][self] then + events[eventname][self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(events[eventname]) then + registry.OnUnused(registry, target, eventname) + end + end + if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then + registry.insertQueue[eventname][self] = nil + end + end + + -- OPTIONAL: Unregister all callbacks for given selfs/addonIds + if UnregisterAllName then + target[UnregisterAllName] = function(...) + if select("#",...)<1 then + error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) + end + if select("#",...)==1 and ...==target then + error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) + end + + + for i=1,select("#",...) do + local self = select(i,...) + if registry.insertQueue then + for eventname, callbacks in pairs(registry.insertQueue) do + if callbacks[self] then + callbacks[self] = nil + end + end + end + for eventname, callbacks in pairs(events) do + if callbacks[self] then + callbacks[self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(callbacks) then + registry.OnUnused(registry, target, eventname) + end + end + end + end + end + end + + return registry +end + + +-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it +-- try to upgrade old implicit embeds since the system is selfcontained and +-- relies on closures to work. + diff --git a/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml b/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml new file mode 100644 index 0000000..a5b22a7 --- /dev/null +++ b/TitanLDB/libs/CallbackHandler-1.0/CallbackHandler-1.0.xml @@ -0,0 +1,4 @@ + +