Thread Tools Display Modes
03-18-12, 07:40 AM   #1
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Request for addon [blacklist]

Hello friends ...
I wonder if there is anyone who can make a small addon that would work as follows ...

The addon would check the guild members who left or were kicked, would write the nick of them in a text file "blacklist" and every time the "roster" of my guild was updated, it would check if my guild has a player who would be in this "black list" and let me know or just with a warring kickaria this player.

This way I avoid players who left and returned to my guild or players who were kicked and returned.

Can anyone help me?
  Reply With Quote
03-18-12, 08:10 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Untested, but something like this should work:

World of Warcraft\Interface\AddOns\GuildBlacklist\GuildBlacklist.toc
Code:
## Interface: 40300
## Title: Guild Blacklist
## Notes: Keeps a list of players you don't want in your guild because they already left or were kicked.
## SavedVariables: GuildBlacklistDB

GuildBlacklist.lua
World of Warcraft\Interface\AddOns\GuildBlacklist\GuildBlacklist.lua
Code:
------------------------------------------------------------------------
--	Local variables
------------------------------------------------------------------------

local blacklist, new, old
local notes, officerNotes = {}, {}

------------------------------------------------------------------------
--	Addon functions/logic
------------------------------------------------------------------------

local addon = CreateFrame("Frame")
addon:RegisterEvent("PLAYER_GUILD_UPDATE")
addon:RegisterEvent("PLAYER_LOGIN")
addon:SetScript("OnEvent", function(self, event, ...)
	if event == "GUILD_ROSTER_UPDATE" then
		if not new then
			-- First run for this guild.
			new = {}
		else
			new, old = old, new
			wipe(new)
		end

		for i = 1, GetNumGuildMembers() do
			local name, _, _, level, class, _, note, officerNote, online = GetGuildRosterInfo(i)
			new[name] = string.format(FRIENDS_LEVEL_TEMPLATE, level, class)
			notes[name] = note
			officerNotes[name] = officerNote
		end

		for name, info in pairs(old) do
			if not new[name] then
				print(string.format("%s (%s) is now on the blacklist because they are no longer in the guild.", name, info))
				blacklist[name] = info
			end
		end

		for name, info in pairs(new) do
			if blacklist[name] then
				print(string.format("%s (%s) is on the blacklist!", name, info))
				if notes[name] then
					print("   Guild note:", notes[name])
				end
				if officerNotes[name] then
					print("   Officer note:", officerNotes[name])
				end
			end
		end

	elseif event == "PLAYER_GUILD_UPDATE" or event == "PLAYER_LOGIN" then
		local guild = IsInGuild() and GetGuildInfo("player")

		if not guild then
			self:UnregisterEvent("GUILD_ROSTER_UPDATE")
			blacklist = nil
			return
		end

		if not GuildBlacklistDB then
			GuildBlacklistDB = {}
		end

		local realm = GetRealmName()
		if not GuildBlacklistDB[realm] then
			GuildBlacklistDB[realm] = {}
		end

		if not GuildBlacklistDB[realm][guild] then
			GuildBlacklistDB[realm][guild] = {}
		end

		blacklist = GuildBlacklistDB[realm][guild]

		new, old = nil, {}
		for name, info in pairs(blacklist) do
			old[name] = info
		end

		self:RegisterEvent("GUILD_ROSTER_UPDATE")
		GuildRoster()
	end
end)

------------------------------------------------------------------------
--	Slash command interface
------------------------------------------------------------------------

SLASH_GUILDBLACKLIST1 = "/guildblacklist"
SLASH_GUILDBLACKLIST2 = "/gbl"

SlashCmdList.GUILDBLACKLIST = function(input)
	if not blacklist then
		return print("|cffffcc00GuildBlacklist:|r", ERR_GUILD_PLAYER_NOT_IN_GUILD)
	end
	local cmd, arg = input:trim():lower():match("(%S+)%s*(.+*)")
	if cmd == "add" then
		local name = arg:gsub("%a", string.upper, 1)
		if not blacklist[name] then
			blacklist[name] = true
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s has been added to the blacklist.", name))
		else
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s is already on the blacklist.", name))
		end
	elseif cmd == "remove" then
		local name = arg:gsub("%a", string.upper, 1)
		if blacklist[name] then
			blacklist[name] = nil
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s is no longer blacklisted.", name))
		else
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s was not found on the blacklist. Check your spelling and try again."))
		end
	elseif cmd == "list" then
		local sorted = {}
		for name in pairs(blacklist) do
			sorted[#sorted+1] = name
		end
		table.sort(sorted)
		if #sorted < 1 then
			print("|cffffcc00GuildBlacklist:|r", "The blacklist is currently empty.")
		else
			print("|cffffcc00GuildBlacklist:|r", string.format("There are currently %d names on the blacklist:", #sorted))
			for i = 1, #sorted do
				print(string.format("   %s - %s", name, blacklist[name] or UNKNOWN))
			end
		end
	else
		print("|cffffcc00GuildBlacklist:|r", "The following commands are available:")
		print("   - add <name> - Adds <name> to the blacklist.")
		print("   - remove <name> - Removes <name> from the blacklist.")
		print("   - list - Lists all names currently on the blacklist.")
	end
end
Any time there's a guild change, it will add anyone who left to the blacklist, and report any guild members who are on the blacklist.

Type "/gbl" for a few options.

Last edited by Phanx : 03-20-12 at 02:02 PM.
  Reply With Quote
03-18-12, 10:03 PM   #3
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Thank you my friend!

That's exactly what I'm looking for, but I tried typing the command "/ guildblacklist" or "/ GBL" and is not working ....
  Reply With Quote
03-18-12, 10:05 PM   #4
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
They must be typed exactly. Ie:

Code:
/gbl
No spaces, no extra capital letters, etc.
  Reply With Quote
03-19-12, 12:18 AM   #5
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Hello friend, really wrong wrote ...

but I typed ...

/gbl
or
/guildblacklist

and nothing happens
  Reply With Quote
03-19-12, 12:43 AM   #6
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Another feature I noticed was that the addon adds the blacklist only players who leave or are expelled from the moment I'm online.

There is the possibility to check the addon players who left or were expelled from the alert log?

Thus, even if I am off line and a player to leave or be expelled, so I log in the addon will check the registry and add these players to the blacklist.

would be possible to do this?
  Reply With Quote
03-19-12, 03:32 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Caetan0 View Post
I typed ...

/gbl
or
/guildblacklist

and nothing happens
I'm not in a guild at the moment, but when I typed "/gbl" in-game, the "GuildBlacklist: You are not in a guild." message appeared correctly, so you should at least be seeing something.

Try installing BugSack and see if it reports any errors from the addon.

Originally Posted by Caetan0 View Post
... even if I am off line and a player to leave or be expelled, so I log in the addon will check the registry and add these players to the blacklist.

would be possible to do this?
Yeah, I thought about that and then promptly forgot to implement it. I'll post a revised version tomorrow.
  Reply With Quote
03-19-12, 07:09 AM   #8
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Good afternoon my friend ...

the type "/gbl" I get this error return.


Code:
2x GuildBlacklist\GuildBlacklist.lua:92: attempt to call global "match" (a nil value)
GuildBlacklist\GuildBlacklist.lua:92: in function "?"
FrameXML\ChatFrame.lua:4293: in function "ChatEdit_ParseText"
FrameXML\ChatFrame.lua:3992: in function "ChatEdit_SendText"
FrameXML\ChatFrame.lua:4031: in function "ChatEdit_OnEnterPressed"
<string>:"*:OnEnterPressed":1: in function <string>:"*:OnEnterPressed":1

Locals:
editBox = ChatFrame1EditBox {
 0 = <userdata>
 headerSuffix = ChatFrame1EditBoxHeaderSuffix {}
 focusLeft = ChatFrame1EditBoxFocusLeft {}
 focusRight = ChatFrame1EditBoxFocusRight {}
 text = ""
 setText = 0
 focusMid = ChatFrame1EditBoxFocusMid {}
 chatFrame = ChatFrame1 {}
 addSpaceToAutoComplete = true
 tabCompleteTableIndex = 1
 language = "Língua Comum"
 header = ChatFrame1EditBoxHeader {}
}
send = 1
parseIfNoSpaces = nil
text = "/gbl"
command = "/GBL"
msg = ""
hash_SecureCmdList = <table> {
 /MA = <func> @FrameXML\ChatFrame.lua:1380
 /INICIARATQ = <func> @FrameXML\ChatFrame.lua:1061
 /CONCEN = <func> @FrameXML\ChatFrame.lua:1322
 /MAINASSISTOFF = <func> @FrameXML\ChatFrame.lua:1393
 /EQ = <func> @FrameXML\ChatFrame.lua:1163
 /ALVOGRUPO = <func> @FrameXML\ChatFrame.lua:1268
 /PETMOVETO = <func> @FrameXML\ChatFrame.lua:1430
 /TARGET = <func> @FrameXML\ChatFrame.lua:1220
 /PARARLANÇAMENTO = <func> @FrameXML\ChatFrame.lua:1111
 /CLEARTARGET = <func> @FrameXML\ChatFrame.lua:1282
 /TANQUEPRIN = <func> @FrameXML\ChatFrame.lua:1348
 /CANCELARAURA = <func> @FrameXML\ChatFrame.lua:1117
 /COMPARTEQUIP = <func> @FrameXML\ChatFrame.lua:1170
 /SIGA = <func> @FrameXML\ChatFrame.lua:1424
 /MT = <func> @FrameXML\ChatFrame.lua:1348
 /EQUIP = <func> @FrameXML\ChatFrame.lua:1163
 /TARGETRAID = <func> @FrameXML\ChatFrame.lua:1275
 /A = <func> @FrameXML\ChatFrame.lua:1308
 /REMOVERINDICADORGLOBAL = <func> @FrameXML\ChatFrame.lua:1527
 /COMPDEFENSIVO = <func> @FrameXML\ChatFrame.lua:1448
 /CANCELARFETIÇONAFILA = <func> @FrameXML\ChatFrame.lua:1493
 /DUEL = <func> @FrameXML\ChatFrame.lua:1406
 /EQUIPSLOT = <func> @FrameXML\ChatFrame.lua:1170
 /USE = <func> @FrameXML\ChatFrame.lua:1077
 /USUARALEAT = <func> @FrameXML\ChatFrame.lua:1090
 /CLEARMA = <func> @FrameXML\ChatFrame.lua:1374
 /TARGETENEMY = <func> @FrameXML\ChatFrame.lua:1240
 /TARGETLASTENEMY = <func> @FrameXML\ChatFrame.lua:1294
 /STARTATTACK = <func> @FrameXML\ChatFrame.lua:1061
 /ALVOINIMIGO = <func> @FrameXML\ChatFrame.lua:1240
 /TARGETFRIENDPLAYER = <func> @FrameXML\ChatFrame.lua:1261
 /AJAGRESSIVO = <func> @FrameXML\ChatFrame.lua:1454
 /ASSIST = <func> @FrameXML\ChatFrame.lua:1308
 /IG = <func> @FrameXML\ChatFrame.lua:1520
 /AJUDANTEAJUDA = <func> @FrameXML\ChatFrame.lua:1460
 /STOPMACRO = <func> @FrameXML\ChatFrame.lua:1487
 /TROCAÇAO = <func> @FrameXML\ChatFrame.lua:1200
 /PETFOLLOW = <func> @FrameXML\ChatFrame.lua:1424
 /PETAGGRESSIVE = <func> @FrameXML\ChatFrame.lua:1454
 /TARGETLASTTARGET = <func> @FrameXML\ChatFrame.lua:1288
 /ALVORAIDE = <func> @FrameXML\ChatFrame.lua:1275
 /DESISTIR = <func> @FrameXML\ChatFrame.lua:1410
 /AJUDANTEPASSIVO = <func> @FrameXML\ChatFrame.lua:1442
 /TARGETFRIEND = <func> @FrameXML\ChatFrame.lua:1254
 /COMPAUTOLAN = <func> @FrameXML\ChatFrame.lua:1480
 /TP = <func> @FrameXML\ChatFrame.lua:1348
 /MAOFF = <func> @FrameXML\ChatFrame.lua:1393
 /PETAUTOCASTOFF = <func> @FrameXML\ChatFrame.lua:1473
 /CHANGEACTIONBAR = <func> @FrameXML\ChatFrame.lua:1188
 /CONCEDE = <functio
  Reply With Quote
03-19-12, 10:55 AM   #9
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
Change line 92 from

lua Code:
  1. local cmd, arg = input:trim():lower()match("(%S+)%s*(.+*)")

to

lua Code:
  1. local cmd, arg = input:trim():lower():match("(%S+)%s*(.+*)")

She had a typo, and forgot to put a colon after lower() :P
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote
03-19-12, 01:00 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Fixed typo, and theoretically checks for players who left since the last login:
Code:
------------------------------------------------------------------------
--	Local variables
------------------------------------------------------------------------

local blacklist, new, old
local notes, officerNotes = {}, {}

------------------------------------------------------------------------
--	Addon functions/logic
------------------------------------------------------------------------

local addon = CreateFrame("Frame")
addon:RegisterEvent("PLAYER_GUILD_UPDATE")
addon:RegisterEvent("PLAYER_LOGIN")
addon:SetScript("OnEvent", function(self, event, ...)
	if event == "GUILD_ROSTER_UPDATE" then
		if not new then
			-- First run for this guild.
			new = {}
		else
			new, old = old, new
			wipe(new)
		end

		for i = 1, GetNumGuildMembers() do
			local name, _, _, level, class, _, note, officerNote, online = GetGuildRosterInfo(i)
			new[name] = string.format(FRIENDS_LEVEL_TEMPLATE, level, class)
			notes[name] = note
			officerNotes[name] = officerNote
		end

		for name, info in pairs(old) do
			if not new[name] then
				print(string.format("%s (%s) is now on the blacklist because they are no longer in the guild.", name, info))
				blacklist[name] = info
			end
		end

		for name, info in pairs(new) do
			if blacklist[name] then
				print(string.format("%s (%s) is on the blacklist!", name, info))
				if notes[name] then
					print("   Guild note:", notes[name])
				end
				if officerNotes[name] then
					print("   Officer note:", officerNotes[name])
				end
			end
		end

	elseif event == "PLAYER_GUILD_UPDATE" or event == "PLAYER_LOGIN" then
		local guild = IsInGuild() and GetGuildInfo("player")

		if not guild then
			self:UnregisterEvent("GUILD_ROSTER_UPDATE")
			blacklist = nil
			return
		end

		if not GuildBlacklistDB then
			GuildBlacklistDB = {}
		end

		local realm = GetRealmName()
		if not GuildBlacklistDB[realm] then
			GuildBlacklistDB[realm] = {}
		end

		if not GuildBlacklistDB[realm][guild] then
			GuildBlacklistDB[realm][guild] = {}
		end

		blacklist = GuildBlacklistDB[realm][guild]

		new, old = nil, {}
		for name, info in pairs(blacklist) do
			old[name] = info
		end

		self:RegisterEvent("GUILD_ROSTER_UPDATE")
		GuildRoster()
	end
end)

------------------------------------------------------------------------
--	Slash command interface
------------------------------------------------------------------------

SLASH_GUILDBLACKLIST1 = "/guildblacklist"
SLASH_GUILDBLACKLIST2 = "/gbl"

SlashCmdList.GUILDBLACKLIST = function(input)
	if not blacklist then
		return print("|cffffcc00GuildBlacklist:|r", ERR_GUILD_PLAYER_NOT_IN_GUILD)
	end
	local cmd, arg = input:trim():lower():match("(%S+)%s*(.+*)")
	if cmd == "add" then
		local name = arg:gsub("%a", string.upper, 1)
		if not blacklist[name] then
			blacklist[name] = true
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s has been added to the blacklist.", name))
		else
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s is already on the blacklist.", name))
		end
	elseif cmd == "remove" then
		local name = arg:gsub("%a", string.upper, 1)
		if blacklist[name] then
			blacklist[name] = nil
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s is no longer blacklisted.", name))
		else
			return print("|cffffcc00GuildBlacklist:|r", string.format("%s was not found on the blacklist. Check your spelling and try again."))
		end
	elseif cmd == "list" then
		local sorted = {}
		for name in pairs(blacklist) do
			sorted[#sorted+1] = name
		end
		table.sort(sorted)
		if #sorted < 1 then
			print("|cffffcc00GuildBlacklist:|r", "The blacklist is currently empty.")
		else
			print("|cffffcc00GuildBlacklist:|r", string.format("There are currently %d names on the blacklist:", #sorted))
			for i = 1, #sorted do
				print(string.format("   %s - %s", name, blacklist[name] or UNKNOWN))
			end
		end
	else
		print("|cffffcc00GuildBlacklist:|r", "The following commands are available:")
		print("   - add <name> - Adds <name> to the blacklist.")
		print("   - remove <name> - Removes <name> from the blacklist.")
		print("   - list - Lists all names currently on the blacklist.")
	end
end
On a side note, base slash commands aren't case-sensitive, so "/gbl" and "/GBL" and "/Gbl" all work the same. Additional commands that you include after the slash command may or may not be case-sensitive, depending on the addon that handles them; the commands in my code above are not case sensitive, so "/gbl add caetan" and "/GBL ADD CAETAN" and "/Gbl Add Caetan" all work the same.

Last edited by Phanx : 03-20-12 at 02:03 PM.
  Reply With Quote
03-19-12, 01:06 PM   #11
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Phanx View Post
On a side note, base slash commands aren't case-sensitive, so "/gbl" and "/GBL" and "/Gbl" all work the same.
Oh yeah Man, me so confused lately.
  Reply With Quote
03-19-12, 09:22 PM   #12
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Hello my friends ...

I changed the code of the addon here and he is no longer presenting the BugStack errors, but I'm noticing three simple flaws that I do not know how to fix.

1 - The only code that is working is "/gbl" when I type "/gbl list" get the same return on the first slash.

2 - He continues checking/adding blacklisted, only players leaving/kicked in when I'm online, or if any player leaving/kicked from the guild when I'm offline, the addon does not register the nick him.

3 - The file database does not change the estásalvando upon logoff, or if he adds a player blacklisted and I leave the game, return the file to the database is reset and lose players were listed there.

----

None of these problems was detected by BugSack, I performed some tests with my friends and detected these flaws.

But I thank everyone's attention and I believe that with these adjustments make this addon going to be an excellent tool for the maintenance of my guild. o/
  Reply With Quote
03-20-12, 02:06 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
#1 - And what exactly happens when you type those commands? As I already said, I am not in a guild, so I cannot test the addon, so I need to know exactly what it is/isn't doing. "It doesn't work" or "the same thing happens when I do X or Y" does not tell me anything.

#2 & #3 - Updated the code in both of my last posts. Should correctly save data between login sessions now.
  Reply With Quote
03-20-12, 11:47 PM   #14
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Good night my friend ...

I performed some more tests with my friends and I can conclude that ...

* The addon is working as follows, if I'm online and some of guild member leaves / kick it is usually registered in the blacklist, but if a member leaves and / guild kick, while I'm offline when I connect again the game does not add the addon blacklisted players who left / kick in my absence.

* The question of "slash command" is running as follows, when I type "/gbl" I get this return ...

"---
GuildBlacklist: The following commands are available:
- add <name> - Adds <name> to the blacklist.
- remove <name> - Removes <name> from the blacklist.
- list - Lists all names currently on the blacklist.
---"

and if I enter "/gbl add Caetan0" or "/gbl remove Caetan0" or "/gbl list" I get this return ...

"---
GuildBlacklist: The following commands are available:
- add <name> - Adds <name> to the blacklist.
- remove <name> - Removes <name> from the blacklist.
- list - Lists all names currently on the blacklist.
---"
  Reply With Quote
03-22-12, 02:34 AM   #15
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
someone able to detect what is happening with the addon?
  Reply With Quote
03-22-12, 02:41 AM   #16
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Are the people leaving coming back before you log back in ?

Looking at the code posted it looks like it generates a list of people in guild when you log in and processes who is no longer in the list that was before. The above query would explain that situation.

Going through the log list that the game generates is not 100% useful as it is limited to 100 records if I remember rightly so if there are more than 100 records generated while you aren't playing the above mentioned routine will work best for you.

I can't see at first glance what else could be happening to explain the problem you are getting.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
03-22-12, 05:22 AM   #17
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I understand,

But what is happening is that the command "/gbl add", "/gbl remove" and "/gbl list" is not working and the addon is not registering the members who left / guild kick in my absence
  Reply With Quote
03-22-12, 03:40 PM   #18
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I usually do not have access to WoW during the week, because I am usually only at home on weekends. I also do not usually have a great deal of time during the week to go over code in detail. So, unless someone else wants to take over, you'll just have to wait until the weekend.

Also, as I've mentioned several times, I am not in a guild, so trying to test the guild roster logic would require writing more code to mimic the functionality of guild events and functions, something I really do not have time for.
  Reply With Quote
03-23-12, 01:30 AM   #19
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
I understand my friend,

Do not want to disturb you or take your time, is that this type of addon is really very important to me, would greatly appreciate it if you could adjust it.

I'll be waiting for the weekend or someone who has the knowledge to take the code, sorry mess and very thank you friend.
  Reply With Quote
03-27-12, 11:09 AM   #20
Caetan0
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 99
Can someone help me with this addon?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Request for addon [blacklist]


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