Download
(3 Kb)
Download
Updated: 03/17/21 02:03 PM
Pictures
File Info
Updated:03/17/21 02:03 PM
Created:03/16/21 01:05 PM
Monthly downloads:54
Total downloads:2,660
Favorites:6
MD5:
Categories:Chat Mods, Group, Guild & Friends
Guild AdBlock - Block Guild Advertisement Spam
Version: 1.1
by: scorpius2k1 [More]


:: I am no longer playing/developing anything for ESO. This addon may continue to work fine, but please use at your own risk as it will not receive further updates. If any addon developers would like to take over this project, please let me know. ::

Apologies for any inconveniences to anyone, it's been a lot of fun over the years. ❤


All the best,
Scorp (scorpius2k1)











VERSION 1.1 (Flames Of Ambition)
*Requires LibAddonMenu 2.0 as a dependency to work, please ensure you have it installed!

[!] Discontinued
For this and more advanced blocking features and options, check out AdBlock Plus!



.: Guild AdBlock :.

Block Guild Advertisement Spam!

Filters all guild advertisements from zone chat
  • No more zone chat guild spam!
  • Displays "Blocked Advertisement!" in chat whenever an advertisement is blocked
  • Guild information is still shareable if you are in any other type of chat (group, whisper, guild, etc)
  • Optionally disable notifications in settings when an advertisement is blocked (silent operation)

*To see blocked advertisement count for the current session, type /gab

Help Support This Addon: DONATE HERE
1.2
Addon Settings are now account wide instead of per-character
Total advertisement blocked count added to settings page and will now retain totals across restarts/reloadui
Added localization for English, French, German, and Russian languages (if more are needed, please let me know)
Code optimization/cleanup

1.1
Added Settings Menu with options to enable/disable addon and notification in chat area
Update code to use ZOS defined constants and compatibility with other chat hook addons (pchat, rchat) (thanks Baertram)

1.0
Initial Release
Archived Files (1)
File Name
Version
Size
Uploader
Date
1.0
2kB
scorpius2k1
03/16/21 01:05 PM


Post A Reply Comment Options
Unread 03/17/21, 08:56 AM  
scorpius2k1
 
scorpius2k1's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 27
Uploads: 5
Appreciate the feedback and help! I am already working on version 1.1 which will also include a settings menu for better flexibility (an option to turn off notifications that something was blocked)Thanks for all the detailed clarification, I will be sure to include those options in the next release!

Originally Posted by Baertram
Thanks for the addon.

One thing: You should not use the hard values like 31 for your message type but use the ZOs defined constants, as the values might change in the future (some did already).

The constants can be found in the esouidocumentation_pxx.txt file, provided here:
https://wiki.esoui.com/APIVersion#live_API_version

Check the actual live API version and the txt link is at the line "API TXT Documentation".
You have hooked the function FormatAndAddChatMessage, which is using the parameter

So the constants are listed below the headline "MsgChannelType" (h5. MsgChannelType)
CHAT_CHANNEL_ZONE
You can find the values to the constants by either trying /tb CHAT_CHANNEL_ZONE or /zgoo CHAT_CHANNEL_ZONE ingame (if you install merTorchbug or zgoo. merTorchbug also got a total list of globals + their values! You just need to type /tb and thens elect the globals tab to see and search them).


Another important hint:
As you prehook the chat function FormatAndAddChatMessage, which will be used for all kind of events for the chat (not only EVENT_CHAT_MESSAGE_CHANNEL !) as you can see here https://github.com/esoui/esoui/blob/...dlers.lua#L211
At this line the different chat events will be registered to call the OnChatEvent function: https://github.com/esoui/esoui/blob/...dlers.lua#L224
It can be EVENT_CHAT_MESSAGE_CHANNEL , or any other which is passed in by eventKey via function ZO_ChatRouter:RegisterMessageFormatter(eventKey, messageFormatter).

So you should make sure that you check if the eventKey in your callback function is EVENT_CHAT_MESSAGE_CHANNEL, and not any other event that fires and tries to find the messageType and text, but maybe does not provide these parameters.


Third hint/compatibility issues:
If you prehook a function and return true the standard code etc. won't be run anymore. Works fine to prevent such messages in the chat, right. But will most likely break other addons that want to use these texts.
In your case it's valid as the addon's purpose is to suppress those messages.

But there are other addons like pChat and rChar or even LibChatMessage which try to save the chat history. Maybe these entries should be kept in the history, but your addon is stripping the messages before.
So you could use your txt file and entries like

Code:
## OptionalDependsOn: pChat rChat
to assure the other addons get loaded before your addon and maybe also add their chat handlers and the history stuff before, so that they will keep the messages, and your addon is just hiding the message afterwards in chat as the standard eso function is not run at the end, due to your return true in the PreHook.

I did not test pChar/rChat if anything is broken if your addon is enabled, so this is just an info to tell you what was happening in the past, and what could be done (but needs testing!).
Report comment to moderator  
Reply With Quote
Unread 03/17/21, 03:41 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4964
File comments: 6032
Uploads: 78
Thanks for the addon.

One thing: You should not use the hard values like 31 for your message type but use the ZOs defined constants, as the values might change in the future (some did already).

The constants can be found in the esouidocumentation_pxx.txt file, provided here:
https://wiki.esoui.com/APIVersion#live_API_version

Check the actual live API version and the txt link is at the line "API TXT Documentation".
You have hooked the function FormatAndAddChatMessage, which is using the parameter

So the constants are listed below the headline "MsgChannelType" (h5. MsgChannelType)
CHAT_CHANNEL_ZONE
You can find the values to the constants by either trying /tb CHAT_CHANNEL_ZONE or /zgoo CHAT_CHANNEL_ZONE ingame (if you install merTorchbug or zgoo. merTorchbug also got a total list of globals + their values! You just need to type /tb and thens elect the globals tab to see and search them).


Another important hint:
As you prehook the chat function FormatAndAddChatMessage, which will be used for all kind of events for the chat (not only EVENT_CHAT_MESSAGE_CHANNEL !) as you can see here https://github.com/esoui/esoui/blob/...dlers.lua#L211
At this line the different chat events will be registered to call the OnChatEvent function: https://github.com/esoui/esoui/blob/...dlers.lua#L224
It can be EVENT_CHAT_MESSAGE_CHANNEL , or any other which is passed in by eventKey via function ZO_ChatRouter:RegisterMessageFormatter(eventKey, messageFormatter).

So you should make sure that you check if the eventKey in your callback function is EVENT_CHAT_MESSAGE_CHANNEL, and not any other event that fires and tries to find the messageType and text, but maybe does not provide these parameters.


Third hint/compatibility issues:
If you prehook a function and return true the standard code etc. won't be run anymore. Works fine to prevent such messages in the chat, right. But will most likely break other addons that want to use these texts.
In your case it's valid as the addon's purpose is to suppress those messages.

But there are other addons like pChat and rChar or even LibChatMessage which try to save the chat history. Maybe these entries should be kept in the history, but your addon is stripping the messages before.
So you could use your txt file and entries like

Code:
## OptionalDependsOn: pChat rChat
to assure the other addons get loaded before your addon and maybe also add their chat handlers and the history stuff before, so that they will keep the messages, and your addon is just hiding the message afterwards in chat as the standard eso function is not run at the end, due to your return true in the PreHook.

I did not test pChar/rChat if anything is broken if your addon is enabled, so this is just an info to tell you what was happening in the past, and what could be done (but needs testing!).
Last edited by Baertram : 03/17/21 at 03:41 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.