Quantcast

Some fixes and additions.

F16Gaming [02-29-12 - 17:11]
Some fixes and additions.

ADDED: The kick command now takes a second optional argument: reason.
FIXED: If the queue command fails the LFG frame now be hidden and sound re-enabled.
ADDED: Documentation for Command.GroupTools.GetNumGroupMembers.
FIXED: Kick announcement will properly output custom reason string if one exists.
FIXED: Updated documentation in Command.QueueManager.
Filename
CommandManager.lua
GroupTools.lua
PlayerManager.lua
QueueManager.lua
diff --git a/CommandManager.lua b/CommandManager.lua
index 23d2521..1a4d7b5 100644
--- a/CommandManager.lua
+++ b/CommandManager.lua
@@ -265,11 +265,11 @@ end, "Player issuing this command will receive invites sent from this AddOn.")

 CM:Register({"kick"}, PM.Access.Groups.Op.Level, function(args, sender, isChat)
 	if #args <= 0 then
-		return false, "Missing argument: name"
+		return false, "Usage: kick <player> [reason]"
 	end
 	local player = PM:GetOrCreatePlayer(args[1])
-	return PM:Kick(player, sender)
-end, "Kick a player from group (Requires confirmation).")
+	return PM:Kick(player, sender, args[2])
+end, "Kick a player from group with optional reason (Requires confirmation).")

 CM:Register({"kingme", "givelead"}, PM.Access.Groups.Op.Level, function(args, sender, isChat)
 	if not isChat then
@@ -330,6 +330,8 @@ CM:Register({"queue", "q"}, PM.Access.Groups.User.Level, function(args, sender,
 		index = QM:GetIndex(args[1])
 	end
 	if not index then
+		HideUIPanel(LFDParentFrame)
+		SetCVar("Sound_EnableSFX", 1)
 		return false, ("No such dungeon type: %q"):format(args[1])
 	end
 	return QM:Queue(index)
diff --git a/GroupTools.lua b/GroupTools.lua
index ae3f706..dc5d658 100644
--- a/GroupTools.lua
+++ b/GroupTools.lua
@@ -63,6 +63,9 @@ function GT:IsGroupLeader(name)
 	return UnitIsPartyLeader(name) -- or (name == "player" and not self:IsGroup())
 end

+--- Get the number of group members in the current party or raid (including the player).
+-- @return Number of group members.
+--
 function GT:GetNumGroupMembers()
 	if not self:IsGroup() then return 0 end
 	if UnitInRaid("player") then
diff --git a/PlayerManager.lua b/PlayerManager.lua
index 4506c1b..cca6082 100644
--- a/PlayerManager.lua
+++ b/PlayerManager.lua
@@ -99,7 +99,11 @@ local KickName, KickSender, KickReason
 local function Kick(name, sender, reason)
 	UninviteUnit(name, reason)
 	if GT:IsGroup() then
-		CM:SendMessage(("%s has been kicked on %s's request."):format(name, sender), CM.LastChannel, CM.LastTarget)
+		if type(reason) == "string" then
+			CM:SendMessage(("%s has been kicked on %s's request. (Reason: %s)"):format(name, sender, reason), CM.LastChannel, CM.LastTarget)
+		else
+			CM:SendMessage(("%s has been kicked on %s's request."):format(name, sender), CM.LastChannel, CM.LastTarget)
+		end
 	else
 		CM:SendMessage(("%s was kicked on your request."):format(name), "WHISPER", sender)
 	end
@@ -532,7 +536,7 @@ end
 -- @return String stating the result of the kick, false if error.
 -- @return Error message if unsuccessful, nil otherwise.
 --
-function PM:Kick(player, sender)
+function PM:Kick(player, sender, reason)
 	if player.Info.Name == UnitName("player") then
 		return false, "Cannot kick myself."
 	elseif self:IsFriend(player) or self:IsBNFriend(player) then
@@ -543,7 +547,7 @@ function PM:Kick(player, sender)
 	if GT:IsGroupLeader() or GT:IsRaidLeaderOrAssistant() then
 		KickName = player.Info.Name
 		KickSender = sender.Info.Name
-		KickReason = ("%s used !kick command."):format(KickSender)
+		KickReason = reason or ("%s used !kick command."):format(KickSender)
 		StaticPopup_Show("COMMAND_CONFIRMKICK", KickSender, KickName)
 		return ("Awaiting confirmation to kick %s..."):format(KickName)
 	end
diff --git a/QueueManager.lua b/QueueManager.lua
index 96d932b..f84bcad 100644
--- a/QueueManager.lua
+++ b/QueueManager.lua
@@ -53,9 +53,10 @@ local QM = C.QueueManager
 -- @field LKHeroic Random Heroic Wrath of the Lich King Dungeon
 -- @field CataclysmRandom Random Cataclysm Dungeon
 -- @field CataclysmHeroic Random Heroic Cataclysm Dungeon
--- @field Zandalari Random Rise of the Zandalari Dungeon
--- @field Horseman The Headless Horseman Hallow's Eve dungeon
--- @field BestChoice Let the server decide what dungeon is best for the player
+-- @field HourOfTwilight Random Hour of Twilight Dungeon
+-- @field CrownChemical Crown Chemical Co. Holiday Boss (Shadowfang Keep)
+-- @field Horseman The Headless Horseman Hallow's Eve Dungeon
+-- @field BestChoice Let the server decide what dungeon is best
 --
 QM.Types = {
 	ClassicRandom = {