/trunk
## Interface: 20400 |
## Title: TeamSqueak |
## Notes: Shows you who is using their Push To Talk button in communication programs such as TeamSpeak |
## Author: Ethan Centaurai |
## Version: 2.0.wowi:revision |
## LoadManagers: AddonLoader |
## X-LoadOn-Slash: /ts, /TeamSqueak |
## X-Category: Chat/Communication |
## X-eMail: ethan.centaurai@live.co.uk |
## X-Donate: PayPal:ethan.centaurai@live.co.uk |
## X-License: GPL v2 or later |
## X-Embeds: LibRock-1.0, TabletLib |
## OptionalDeps: LibRock-1.0, TabletLib |
## SavedVariables: TeamSqueakDB |
embeds.xml |
enUS.lua |
Core.lua |
Options.lua |
--[[ $Id$ ]] |
TeamSqueak = Rock:NewAddon("TeamSqueak", 'LibRockComm-1.0', 'LibRockConsole-1.0', 'LibRockConfig-1.0', 'LibRockDB-1.0', 'LibRockEvent-1.0') |
TeamSqueak.date = ("$Date$"):match("%d%d%d%d%-%d%d%-%d%d") |
TeamSqueak:SetDatabase("TeamSqueakDB") |
TeamSqueak:SetDatabaseDefaults('profile', { |
list = { detached = true }, |
groupLeader = { r = 1, g = 1, b = 1 }, |
groupOfficer = { r = 0.85, g = 0.85, b = 0.85 }, |
groupMember = { r = 0.7, g = 0.7, b = 0.7 }, |
}) |
local L = Rock("LibRockLocale-1.0"):GetTranslationNamespace("TeamSqueak") |
local Tablet = Rock("Tablet-2.0") |
BINDING_HEADER_TEAMSQUEAK = "TeamSqueak" |
BINDING_NAME_TEAMSQUEAK = L["Push To Talk"] |
function TeamSqueak:OnEnable() |
self.registry = {} |
self:AddEventListener("CHAT_MSG_SYSTEM") |
self:SetCommPrefix("TSK") |
self:AddCommListener("TSK", "GROUP") |
self:AddSlashCommand("OnSlashCommand", { "/ts", "/TeamSqueak" }) |
Tablet:Register("TeamSqueak_List", |
'detachedData', self.db.profile.list, 'dontHook', true, 'hideWhenEmpty', true, |
'minWidth', 350, 'strata', "HIGH", 'cantAttach', true, 'children', function() |
local cat = Tablet:AddCategory('columns', 1, 'text', "TeamSqueak", 'textR', 1, 'textG', 0.7, 'textB', 0) |
cat:AddLine() |
for _, v in pairs(self.registry) do |
---- if type(v) == 'table' then |
local r, g, b |
if v.rank == 2 then -- Raid/Party Leader |
r, g, b = self.db.profile.groupLeader.r, self.db.profile.groupLeader.g, self.db.profile.groupLeader.b |
elseif v.rank == 1 then -- Raid Officer |
r, g, b = self.db.profile.groupOfficer.r, self.db.profile.groupOfficer.g, self.db.profile.groupOfficer.b |
else -- Raid/Party Member |
r, g, b = self.db.profile.groupMember.r, self.db.profile.groupMember.g, self.db.profile.groupMember.b |
end |
cat:AddLine('text', v.name, 'size', 10, 'textR', r, 'textG', b, 'textB', b) |
---- end |
end |
end |
) |
if not GetBindingKey("TEAMSQUEAK") then |
self:Print(L["Welcome to TeamSqueak! Please use '/ts config' to open the options window, and set your Push To Talk button."]) |
end |
end |
function TeamSqueak:OnDisable() |
self.registry = nil |
Tablet:Unregister("TeamSqueak_List") |
end |
function TeamSqueak:OnCommReceive(prefix, sender, distribution, chatting, rank) |
self:SetTalking(sender, chatting, rank) |
end |
function TeamSqueak:OnSlashCommand(cmd, txt) |
if txt == "config" or txt == "options" then |
self:OpenConfigMenu() |
elseif txt == "close" or txt == "hide" then |
Tablet:Close("TeamSqueak_List") |
else |
Tablet:Open("TeamSqueak_List") |
end |
end |
function TeamSqueak:OnButtonDown() |
local rank = 0 |
if IsRaidLeader() or IsPartyLeader() then rank = 2 |
elseif IsRaidOfficer() then rank = 1 end |
self:SendCommMessage("GROUP", true, rank) |
end |
function TeamSqueak:OnButtonUp() |
self:SendCommMessage("GROUP", false) |
end |
function TeamSqueak:SetTalking(name, chatting, rank) |
local id |
for k, v in pairs(self.registry) do |
if v and v.name == name then |
id = k |
end |
end |
if chatting and not id then |
table.insert(self.registry, { name = name, rank = rank }) |
elseif not chatting and id then |
table.remove(self.registry, id) |
end |
Tablet:Refresh("TeamSqueak_List") |
end |
-- we cannot receive comm messages when someone/you leaves the group, remove names as necessary |
function TeamSqueak:CHAT_MSG_SYSTEM(msg) |
if msg:find(L["(%s) leaves the party."]) then |
self:SetTalking(msg:match(L["(%s) leaves the party."]), false) |
end |
if msg:find(L["(%s) has left the raid group"]) then |
self:SetTalking(msg:match(L["(%s) has left the raid group"]), false) |
end |
if msg == ERR_LEFT_GROUP_YOU or msg == ERR_RAID_YOU_LEFT or msg == ERR_GROUP_DISBANDED then |
self:Purge() |
end |
end |
function TeamSqueak:Purge() |
self.registry = {} |
Tablet:Refresh("TeamSqueak_List") |
end |
--[[ $Id:enUS.lua 46303 2007-08-11 21:56:03Z darkimakuni $ ]] |
Rock("LibRockLocale-1.0"):GetTranslationNamespace("TeamSqueak"):AddTranslations("enUS", function() return { |
["Welcome to TeamSqueak! Please use '/ts config' to open the options window, and set your Push To Talk button."] = true, |
["(%s) leaves the party."] = true, |
["(%s) has left the raid group"] = true, |
["Open"] = true, |
["Show the list of names."] = true, |
["Close"] = true, |
["Hide the list of names."] = true, |
["Push To Talk"] = true, |
["Select the button to act as your Push To Talk button."] = true, |
["Colors"] = true, |
["Set the text color of users names depending on their rank."] = true, |
["Raid/Party Leaders"] = true, |
["Set the text color for raid/party leaders."] = true, |
["Raid Officers"] = true, |
["Set the text color for raid officers."] = true, |
["Raid/Party Members"] = true, |
["Set the text color for raid/party members."] = true, |
["Purge"] = true, |
["Remove all names from the list. Useful if names appear to be stuck."] = true, |
} end) |
--[[ $Id$ ]] |
local L = Rock("LibRockLocale-1.0"):GetTranslationNamespace("TeamSqueak") |
TeamSqueak:SetConfigTable({ |
name = "TeamSqueak", desc = "Shows you who is using their Push To Talk button in communication programs such as TeamSpeak", |
icon = "Interface\\Common\\VoiceChat-On", type = 'group', handler = TeamSqueak, args = { |
{ |
name = L["Open"], type = 'execute', buttonText = L["Open"], order = 1, |
desc = L["Show the list of names."], |
func = function() Rock("Tablet-2.0"):Open("TeamSqueak_List") end, |
}, |
{ |
name = L["Close"], type = 'execute', buttonText = L["Close"], order = 2, |
desc = L["Hide the list of names."], |
func = function() Rock("Tablet-2.0"):Close("TeamSqueak_List") end, |
}, |
{ |
name = L["Push To Talk"], type = 'keybinding', order = 3, |
desc = L["Select the button to act as your Push To Talk button."], |
get = function() return GetBindingKey("TEAMSQUEAK") end, |
set = function(key) SetBinding(key, "TEAMSQUEAK") end, |
keybindingExcept = function() return { GetBindingKey("SCREENSHOT") } end, |
}, |
{ |
name = L["Colors"], type = 'group', order = 4, |
desc = L["Set the text color of users names depending on their rank."], args = { |
{ |
name = L["Raid/Party Leaders"], type = 'color', order = 4.1, |
desc = L["Set the text color for raid/party leaders."], |
get = function() return TeamSqueak.db.profile.groupLeader.r, TeamSqueak.db.profile.groupLeader.g, TeamSqueak.db.profile.groupLeader.b end, |
set = function(r, g, b) TeamSqueak.db.profile.groupLeader = { r = r, g = g, b = b } end, |
}, |
{ |
name = L["Raid Officers"], type = 'color', order = 4.2, |
desc = L["Set the text color for raid officers."], |
get = function() return TeamSqueak.db.profile.groupOfficer.r, TeamSqueak.db.profile.groupOfficer.g, TeamSqueak.db.profile.groupOfficer.b end, |
set = function(r, g, b) TeamSqueak.db.profile.groupOfficer = { r = r, g = g, b = b } end, |
}, |
{ |
name = L["Raid/Party Members"], type = 'color', order = 4.3, |
desc = L["Set the text color for raid/party members."], |
get = function() return TeamSqueak.db.profile.groupMember.r, TeamSqueak.db.profile.groupMember.g, TeamSqueak.db.profile.groupMember.b end, |
set = function(r, g, b) TeamSqueak.db.profile.groupMember = { r = r, g = g, b = b } end, |
}, |
}, |
}, |
{ |
name = L["Purge"], type = 'execute', buttonText = L["Purge"], order = 5, |
desc = L["Remove all names from the list. Useful if names appear to be stuck."], |
func = "Purge", |
}, |
}, |
}) |
Welcome to TeamSqueak! |
This simple addon will show you who is using their Push To Talk button in programs such as TeamSpeak. |
To set up: |
1) Log into WoW |
2) Use the slash command '/ts config' to open the config window |
To open the TeamSqueak window, use the slash commands '/ts show' or '/ts open' |
To close the TeamSqueak window, use the slash commands '/ts hide' or '/ts close' |
Note: You can also use '/teamsqueak' if another addon is using '/ts' |
Any bugs/issues/problems/requests/comments? |
Visit: http://www.wowinterface.com/portal.php?uid=16655 |
Email: ethan.centaurai@live.co.uk |
Whisper in-game (EU Azjol-Nerub): |
Mju (Horde) |
Imakuni, Lucaria, Myrah (Alliance) |
Enjoy using TeamSqueak! |
<Bindings> |
<Binding name="TEAMSQUEAK" header="TEAMSQUEAK" runOnUp="true"> |
if keystate == "down" then TeamSqueak:OnButtonDown() |
else TeamSqueak:OnButtonUp() end |
</Binding> |
</Bindings> |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> |
<Include file="Lib\LibRock-1.0\lib.xml"/> |
<Include file="Lib\LibRockComm-1.0\lib.xml"/> |
<Include file="Lib\LibRockConfig-1.0\lib.xml"/> |
<Include file="Lib\LibRockConsole-1.0\lib.xml"/> |
<Include file="Lib\LibRockDB-1.0\lib.xml"/> |
<Include file="Lib\LibRockEvent-1.0\lib.xml"/> |
<Include file="Lib\LibRockLocale-1.0\lib.xml"/> |
<Script file="Lib\Tablet-2.0\Tablet-2.0.lua"/> |
</Ui> |
Copyright (C) 2007-2008 Ethan Centaurai |
This program is free software; you can redistribute it and/or |
modify it under the terms of the GNU General Public License |
as published by the Free Software Foundation; either version 2 |
of the License, or (at your option) any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this program; if not, write to the Free Software |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |