Thread Tools Display Modes
07-21-14, 06:17 AM   #21
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Code:
                -- Clickable player links in self messages
                local playerLink = "|Hplayer:"..playerName.."|h["..playerName.."]|h"
                if isPet then
                        playerLink = format(L.SOMEONES_PET, playerLink)
                end
                print("|cffffff9a[NoTroll]|r", format(L.ANNOUNCE_MESSAGE, playerLink, spellLink))
        else
                -- Can't send player links to channels
                if isPet then
                        playerName = format(L.SOMEONES_PET, playerName)
                end
                local now, message = GetTime(), format(L.ANNOUNCE_MESSAGE, playerName, spellLink)
                if message ~= lastText or now - lastTime > 5 then
                        lastText, lastTime = message, now
                        SendChatMessage(message, channel)
                end
        end
end
 
-------------------------------------------------------------------------
-- Make player names in channel messages from the addon clickable LOCALLY ONLY
 
local ANNOUNCE_PATTERN = L.ANNOUNCE_MESSAGE:gsub("%%1$s", "(.+)"):gsub("%%2$s", ".+")
 
function f:AddLocalMessageLinks(_, message, ...)
        if type(message) ~= "string" then return end
        local name = strmatch(message, ANNOUNCE_PATTERN)
        if name then
                local char = strmatch(playerName, "^[^%s%-]+")
                local class = UnitClass(char)
                local link = "|Hplayer:"..char.."|h["..name.."]|h"
                message = gsub(message, name, link)
                return false, message, ...
        end
end
Message: Interface\AddOns\NoTroll\NoTroll.lua:94: bad argument #1 to 'strmatch' (string expected, got nil)
Time: 07/21/14 06:18:52
Count: 1
Stack: ...vUI\libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:147: in function <...vUI\libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:147>
[string "safecall Dispatcher[1]"]:4: in function <[string "safecall Dispatcher[1]"]:4>
[C]: ?
[string "safecall Dispatcher[1]"]:13: in function `?'
...vUI\libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:92: in function `Fire'
...face\AddOns\ElvUI\libs\AceEvent-3.0\AceEvent-3.0.lua:120: in function <...face\AddOns\ElvUI\libs\AceEvent-3.0\AceEvent-3.0.lua:119>

Locals: <none>
With your changes I still get this error. - With ELVUI only enabled

Also since it was working without mods I figured I would test it. Bloodlust didn't go to SAY, showed as a console line in chat

Message: Interface\AddOns\NoTroll\NoTroll.lua:94: bad argument #1 to 'strmatch' (string expected, got nil)
Time: 07/21/14 06:25:05
Count: 2
Stack: [C]: in function `strmatch'
Interface\AddOns\NoTroll\NoTroll.lua:94: in function `filterFunc'
Interface\FrameXML\ChatFrame.lua:2842: in function `ChatFrame_MessageEventHandler'
Interface\FrameXML\ChatFrame.lua:2637: in function `ChatFrame_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Locals: (*temporary) = nil
(*temporary) = "^[^%s%-]+"
(*temporary) = "string expected, got nil"
This one with the SAY setting

Message: Interface\AddOns\NoTroll\NoTroll.lua:314: attempt to call field 'refresh' (a nil value)
Time: 07/21/14 06:42:49
Count: 1
Stack: Interface\AddOns\NoTroll\NoTroll.lua:314: in function <Interface\AddOns\NoTroll\NoTroll.lua:308>

Locals: self = NoTrollScrollFrameDelete4 {
0 = <userdata>
}
id = 1064
(*temporary) = nil
(*temporary) = "attempt to call field 'refresh' (a nil value)"
db = <table> {
80353 = "SELF"
13159 = "SELF"
73325 = "SAY"
49576 = "RAID"
62124 = "SELF"
56222 = "SELF"
2825 = "PARTY"
34477 = "SAY"
20736 = "SELF"
2649 = "SELF"
41450 = "SELF"
39270 = "SAY"
32182 = "SELF"
103128 = "SELF"
}
Removed an entry in the list but first caused an error, Required me to Reload the UI before it showed the entry removed.

Party and Raid work, Raid does the double spams still. Party works great.

I just got home if you couldn't tell :P 14 hour shift at the hospital.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...

Last edited by morpheusxeno : 07-21-14 at 08:04 AM.
  Reply With Quote
07-21-14, 08:52 PM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
http://pastebin.com/D4u8a8WB

- Fixed error with options refresh
- Fixed error with linking player names in your own chat frame
- Probably fixed duplication issue, now keeps track of the last time it announced on a per-GUID basis so it shouldn't matter how many unit tokens currently refer to the same unit (since you'll get one spell even per unit token, and I'm guessing your duplicates were for eg. raid4 and party4 with raid members in your same party/subgroup)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-22-14, 06:38 AM   #23
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Alright , I will check it again when I get home, 24 hour shift tonight.

I was curious if there is any way that we can pack libstub with Notroll, so they are in the same folder. - Just in case some one does want to remove the mod the ease of handling it.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...

Last edited by morpheusxeno : 07-22-14 at 06:41 AM.
  Reply With Quote
07-23-14, 04:31 AM   #24
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Yes, just put the LibStub file in the same folder and add the path to it in the TOC.

Typically you'd keep libraries a "Libs" subfolder for organizational purposes, eg.

Code:
MyAddon
     Libs
          LibStub
               LibStub.lua
          SomeLibrary-1.0
               SomeLibrary.lua
     MyAddon.lua
     MyAddon.toc
Code:
## Interface: 50400
## Title: My Addon

## OptionalDependencies: SomeLibrary-1.0

Libs\LibStub\LibStub.lua
Libs\SomeLibrary-1.0\SomeLibrary.lua

MyAddon.lua
Note that LibStub doesn't need to be listed as an optional dependency, since a standalone installation of SomeLibrary-1.0 would include LibStub itself or have its own dependency.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-23-14, 07:18 AM   #25
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
None of the chat channels work after the new changes.

The only channel which displays a LUA Error after a spell has been casted that is listed is RAID chat
Code:
Message: Interface\FrameXML\UnitFrame.lua:729: Usage: UnitName("unit")
Time: 07/23/14 07:15:22
Count: 1
Stack: [C]: ?
[C]: in function `UnitName'
Interface\FrameXML\UnitFrame.lua:729: in function `GetUnitName'
Interface\AddOns\NoTroll\NoTroll.lua:85: in function `Announce'
Interface\AddOns\NoTroll\NoTroll.lua:63: in function <Interface\AddOns\NoTroll\NoTroll.lua:60>

Locals:


None,Player,Party,Say - All of these channels do not display lua errors. They also do not send the spell information.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
07-23-14, 11:25 AM   #26
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Change:
Code:
	local playerName = GetUnitName(unit, true)
to:
Code:
	local playerName = GetUnitName(caster, true)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-24-14, 06:57 AM   #27
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Tried all chat channels now, It only seems to work while I am in in raid and in combat.

I wanted to add instance chat.

Whats my problem?

local ChannelNames = {
NONE = NONE,
SELF = PLAYER,
SAY = CHAT_MSG_SAY,
PARTY = CHAT_MSG_PARTY,
RAID = CHAT_MSG_RAID,
INSTANCE = INSTANCE_CHAT,
}

local orderedChannels = { "NONE", "SELF", "SAY", "PARTY", "RAID", "INSTANCE"}
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("INSTANCE_CHAT", f.AddLocalMessageLinks)
Message: SendChatMessage(): Unknown chat type
Time: 07/24/14 08:05:44
Count: 1
Stack: [C]: ?
[C]: ?
[C]: in function `SendChatMessage'
Interface\AddOns\NoTroll\NoTroll.lua:100: in function `Announce'
Interface\AddOns\NoTroll\NoTroll.lua:64: in function <Interface\AddOns\NoTroll\NoTroll.lua:61>

Locals:
Also when a hunters pet is growling. It only says [BOB] USES [GROWL]
Doesn't say JIM's BOB uses [GROWL]
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...

Last edited by morpheusxeno : 07-24-14 at 08:42 AM.
  Reply With Quote
07-24-14, 11:29 PM   #28
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You don't need to add instance chat separately. When you're in an instance group, both RAID and PARTY chat types are redirected to the INSTANCE_CHAT channel. If you added a separate entry for instance chat, then anyone who had that selected would find that their messages weren't being sent when they were in a normal group.

If you really want to add it separately, you need to use the correct values. The channel name as needs to be passed to SendChatMessage is "INSTANCE_CHAT" not "INSTANCE"; the event name as used for registering a filter is "CHAT_MSG_INSTANCE_CHAT" not "INSTANCE_CHAT"; and the human-readable name is contained in the global named CHAT_MSG_INSTANCE_CHAT not INSTANCE_CHAT (in fact I don't even think a global by that name exists).

Code:
local ChannelNames = {
	NONE = NONE,
	SELF = PLAYER,
	SAY = CHAT_MSG_SAY,
	PARTY = CHAT_MSG_PARTY,
	RAID = CHAT_MSG_RAID,
	INSTANCE_CHAT = CHAT_MSG_INSTANCE_CHAT,
}

local orderedChannels = { "NONE", "SELF", "SAY", "PARTY", "RAID", "INSTANCE_CHAT"}
Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", f.AddLocalMessageLinks)
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", f.AddLocalMessageLinks)
But, for the reasons mentioned above, I would recommend against adding a separate option for instance chat. It's unnecessary at best, and confusing at worst.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-25-14, 08:06 AM   #29
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
OH! I didn't know that. I'll just not add it lol.

What about the hunter pet notification ? It only shows the pets name is growling, instead of whos pets name is growling.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
07-25-14, 09:36 AM   #30
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
To identify the owner of a pet you basically have to loop over every pet in the raid and match their GUID with the one casting the spell.

Here's the lazy solution:
Lua Code:
  1. local function Pet2Player(guid)
  2.     if UnitInRaid('player') then
  3.         for i = 1, 40 do
  4.             if guid == UnitGUID('raidpet' .. i) then
  5.                 return UnitName('raid' .. i), UnitCreatureFamily('raidpet' .. i)
  6.             end
  7.         end
  8.     else
  9.         if guid == UnitGUID('pet') then return UnitName('player'), UnitCreatureFamily('pet') end
  10.         for i = 1, 4 do
  11.             if guid == UnitGUID('partypet' .. i) then
  12.                 return UnitName('party' .. i), UnitCreatureFamily('partypet' .. i)
  13.             end
  14.         end
  15.     end
  16. end
It might be more efficient to cache the raid pets in a table on UNIT_PET and GROUP_ROSTER_UPDATE events but it would also be more effort.
  Reply With Quote
07-25-14, 11:41 AM   #31
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
As this addon is being released publicly I would like it to be efficient as possible. I do however thank you for your time. I have learned a decent bit from working with this addon and the extra help others have contributed.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
07-26-14, 01:34 AM   #32
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Scanning GUIDs shouldn't be required, as the addon works with unitIDs, so you can just strip "pet" out of the unit token to get the owner's unitID, at least for group members, eg. "raidpet14" -> "raid14".

I thought I already handled that, but looking at the code I must have been distracted by Actual Work while writing it at work, because what's in there won't actually work...

http://pastebin.com/dK6VWMYW

- Fixed converting pet names to owner names
- As a side benefit, filtering out irrelevant units and preventing duplicates is now more effective and more efficient.
- Still not actually tested in-game
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-26-14, 06:21 AM   #33
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
I tried using PARTY ANNOUNCE in a LFR. It went to blue chat which only 5 people can see. Unless I am retarded... I didnt see it going to instance chat like it was supposed to.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
07-26-14, 09:33 AM   #34
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
It works the other way around that's why.
INSTANCE_CHAT will automatically go to party if you're not in a cross-realm group, not the opposite.
  Reply With Quote
07-26-14, 08:01 PM   #35
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Originally Posted by Dridzt View Post
It works the other way around that's why.
INSTANCE_CHAT will automatically go to party if you're not in a cross-realm group, not the opposite.
So I should be using CHAT_MSG_INSTANCE_CHAT in place of CHAT_MSG_PARTY ?

@ Phanx -

Could we address the Misdirect from a Hunter to show who he is using it on?
Who pulled boss?

After that I think this project would be complete
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...

Last edited by morpheusxeno : 07-26-14 at 08:30 PM.
  Reply With Quote
07-27-14, 08:40 PM   #36
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Dridzt View Post
It works the other way around that's why.
INSTANCE_CHAT will automatically go to party if you're not in a cross-realm group, not the opposite.
In that case you should probably use INSTANCE_CHAT in place of RAID -- that way PARTY works the same way no matter what kind of group you're in (sends only to your 5-player sub-group in a raid) but RAID sends to the whole group.

Originally Posted by morpheusxeno View Post
Could we address the Misdirect from a Hunter to show who he is using it on?
Who pulled boss?
Well, you never answered my earlier question about this (and similar spells) -- does casting this put a buff/debuff on the target or not? eg. if Hunter casts Misdirection on Mage, does Mage get a buff or debuff, or not?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-27-14, 09:17 PM   #37
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Phanx View Post
if Hunter casts Misdirection on Mage, does Mage get a buff or debuff, or not?
Misdirection puts a buff on the target with the same spell ID as the spell (34477).
  Reply With Quote
07-28-14, 08:53 PM   #38
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
He's right it does put a buff.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
07-31-14, 08:13 PM   #39
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Phanx! Were did you go!
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
08-01-14, 04:02 AM   #40
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Tired of trolls...

Thread Tools
Display Modes

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