Skip to content

Commit

Permalink
Merge pull request #96 from Vysci/custom_lfg_msg
Browse files Browse the repository at this point in the history
Ability to post LFG messages
  • Loading branch information
Vysci authored Jun 26, 2021
2 parents cc80eb7 + 1655ef4 commit 314a9dc
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 26 deletions.
65 changes: 65 additions & 0 deletions LFGBulletinBoard/Chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,68 @@ function GBB.InsertChat()
GBB.DB["NotifyChat"]=true
GBB.OptionsUpdate()
end

function GBB.SendMessage(ChannelName, Msg)
local index = GetChannelName(ChannelName) -- It finds General is a channel at index 1
if (index~=nil) then
SendChatMessage(Msg , "CHANNEL", nil, index);
end
end

function GBB.AnnounceInit()
GroupBulletinBoardFrameAnnounceMsg:SetTextColor(0.6,0.6,0.6)
GroupBulletinBoardFrameAnnounceMsg:SetText(L["msgRequestHere"])
GroupBulletinBoardFrameAnnounce:SetText(L["BtnPostMsg"])
GroupBulletinBoardFrameAnnounceMsg:HighlightText(0,0)
GroupBulletinBoardFrameAnnounceMsg:SetCursorPosition(0)
GroupBulletinBoardFrameAnnounce:Disable()

end

function GBB.GetFocus()
local t= GroupBulletinBoardFrameAnnounceMsg:GetText()
if t==L["msgRequestHere"] then
GroupBulletinBoardFrameAnnounceMsg:SetTextColor(1,1,1)
GroupBulletinBoardFrameAnnounceMsg:SetText("")

end
end

function GBB.EditAnnounceMessage_Changed()
local t= GroupBulletinBoardFrameAnnounceMsg:GetText()
if t==nil or t=="" or t==L["msgRequestHere"] then
GroupBulletinBoardFrameAnnounce:Disable()
else
GroupBulletinBoardFrameAnnounce:Enable()
end
end

function GBB.Announce()
local msg = GroupBulletinBoardFrameAnnounceMsg:GetText()

if msg~= nil and msg~="" and msg~=L["msgRequestHere"]then
GBB.SendMessage(GBB.DB.AnnounceChannel, msg)
GroupBulletinBoardFrameAnnounceMsg:ClearFocus()
end
end

function GBB.CreateChannelPulldown (frame, level, menuList)
if level~=1 then return end
local t= GBB.PhraseChannelList(GetChannelList())

local info = UIDropDownMenu_CreateInfo()


for i,channel in pairs(t) do
info.text = i..". "..channel.name
info.checked = (channel.name == GBB.DB.AnnounceChannel)
info.disabled = channel.hidden
info.arg1 = i
info.arg2 = channel.name
info.func = function(self, arg1, arg2, checked)
GBB.DB.AnnounceChannel=arg2
GroupBulletinBoardFrameSelectChannel:SetText(arg2)
end
UIDropDownMenu_AddButton(info)
end
end
26 changes: 20 additions & 6 deletions LFGBulletinBoard/GroupBulletinBoard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ function GBB.JoinLFG()
end
end

function GBB.BtnSelectChannel()
if UIDROPDOWNMENU_OPEN_MENU ~= GBB.FramePullDownChannel then
UIDropDownMenu_Initialize( GBB.FramePullDownChannel, GBB.CreateChannelPulldown, "MENU")
end
ToggleDropDownMenu(nil, nil, GBB.FramePullDownChannel, GroupBulletinBoardFrameSelectChannel, 0,0)
end

--gui
-------------------------------------------------------------------------------------

Expand All @@ -185,7 +192,7 @@ end

function GBB.ResizeFrameList()
local w
GroupBulletinBoardFrame_ScrollFrame:SetHeight(GroupBulletinBoardFrame:GetHeight() -30-25 )
GroupBulletinBoardFrame_ScrollFrame:SetHeight(GroupBulletinBoardFrame:GetHeight() -55-25 )
w=GroupBulletinBoardFrame:GetWidth() -20-10-10
GroupBulletinBoardFrame_ScrollFrame:SetWidth( w )
GroupBulletinBoardFrame_ScrollChildFrame:SetWidth( w )
Expand Down Expand Up @@ -407,12 +414,11 @@ function GBB.Init()
GBB.RaidList = GBB.GetRaids()
--GBB.dungeonLevel
GBB.dungeonSort = GBB.GetDungeonSort()
--GBB.searchTagsLoc,GBB.badTagsLoc,GBB.dungeonTagsLoc,GBB.dungeonSecondTags,GBB.suffixTagsLoc = GroupBulletinBoard_GetTags()


-- Reset Request-List
GBB.RequestList={}
GBB.FramesEntries={}
-- ownRequestDungeons={}

GBB.FoldedDungeons={}

-- Timer-Stuff
Expand All @@ -426,7 +432,7 @@ function GBB.Init()

GBB.AutoUpdateTimer=time()+GBB.UPDATETIMER


GBB.AnnounceInit()

local x, y, w, h = GBB.DB.X, GBB.DB.Y, GBB.DB.Width, GBB.DB.Height
if not x or not y or not w or not h then
Expand Down Expand Up @@ -502,7 +508,15 @@ function GBB.Init()
)

GBB.FramePullDownChannel=CreateFrame("Frame", "GBB.PullDownMenu", UIParent, "UIDropDownMenuTemplate")

if GBB.DB.AnnounceChannel == nil then
if L["lfg_channel"] ~= "" then
GBB.DB.AnnounceChannel = L["lfg_channel"]
else
_, GBB.DB.AnnounceChannel = GetChannelList()
end
end
GroupBulletinBoardFrameSelectChannel:SetText(GBB.DB.AnnounceChannel)

GBB.ResizeFrameList()

if GBB.DB.EscapeQuit then
Expand Down
59 changes: 58 additions & 1 deletion LFGBulletinBoard/GroupBulletinBoard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,64 @@
</OnMouseDown>
</Scripts>
</Button>


<!-- announcebox -->
<Button name="$parentSelectChannel" inherits="UIPanelButtonTemplate" text="channel">
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent" >
<Offset>
<AbsDimension x="10" y="22"/>
</Offset>
</Anchor>
</Anchors>
<Size><AbsDimension x="150" y="20" /></Size>
<Scripts>
<OnClick>
GroupBulletinBoard_Addon.BtnSelectChannel()
</OnClick>
</Scripts>
</Button>

<Button name="$parentAnnounce" inherits="UIPanelButtonTemplate" text="Post">
<Anchors>
<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" relativeTo="$parent" >
<Offset>
<AbsDimension x="-40" y="22"/>
</Offset>
</Anchor>
</Anchors>
<Size><AbsDimension x="100" y="20" /></Size>
<Scripts>
<OnClick>
GroupBulletinBoard_Addon.Announce()
</OnClick>
</Scripts>
</Button>

<EditBox name="$parentAnnounceMsg" letters="255" autoFocus="false" inherits="InputBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentSelectChannel" >
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMLEFT" relativeTo="$parentAnnounce" >
<Offset>
<AbsDimension x="-4" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Size><AbsDimension x="100" y="20"/></Size>
<Scripts>
<OnEditFocusGained>
GroupBulletinBoard_Addon.GetFocus()
</OnEditFocusGained>
<OnTextChanged>
GroupBulletinBoard_Addon.EditAnnounceMessage_Changed()
</OnTextChanged>
</Scripts>
</EditBox>

<!--Scrollframe -->
<ScrollFrame name="GroupBulletinBoardFrame_ScrollFrame" inherits="UIPanelScrollFrameTemplate">
<Backdrop name="$parentBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" tile="true">
Expand Down
2 changes: 1 addition & 1 deletion LFGBulletinBoard/LFGBulletinBoard.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 20501
## Title: LFG Bulletin Board
## Notes: Sort LFG/LFM Messages
## Version: 2.56
## Version: 2.58
## Author: Vyscî-Whitemane
## DefaultState: enabled
## SavedVariables: GroupBulletinBoardDB
Expand Down
31 changes: 15 additions & 16 deletions LFGBulletinBoard/Localization.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GBB.locales = {
["GuildChannel"]="Guild Channel",

["msgNbRequest"]="%d request(s) - click to whisper - shift+click to 'who' - ctrl+click to 'invite'",
["msgRequestHere"] = "Enter here your lfg message.",
["msgStartWho"]="request who on %s...",
["msgNewRequest"]="New request by %s for dungeon %s.",
["msgInit"]="GroupBulletinBoard %s is loaded. Type '/gbb help' to get started.",
Expand Down Expand Up @@ -104,6 +105,7 @@ GBB.locales = {
["BtnNotifyColor"]="Color of the notification message",
["BtnPlayerNoteColor"]="Color of the player note",
["BtnColorGuild"]="Colour of the guild text",
["BtnPostMsg"] = "Post",

["SlashReset"]="Reset main window position",
["SlashConfig"]="Open configuration",
Expand Down Expand Up @@ -142,9 +144,7 @@ GBB.locales = {
["BtnNotifyColor"] = "Farbe der Nachricht",
["BtnPlayerNoteColor"] = "Farbe der Spielernotizen",
["BtnSelectAll"] = "Alles auswählen",
["BtnStartShout"] = "Announce",
["BtnStopShout"] = "Stop",
["BtnStopShoutMsg"] = "Stop automatic announcement",
["BtnStopAnnounceMsg"] = "Stop automatic announcement",
["BtnTimeColor"] = "Farbe der Zeit",
["BtnUnFoldAll"] = "Alle entfalten",
["BtnUnselectAll"] = "Alles abwählen",
Expand All @@ -163,7 +163,7 @@ GBB.locales = {
["CboxDontTrunicate"] = "Nachricht nicht abkürzen",
["CboxEnableGroup"] = "Letzte Gruppenmitglieder merken",
["CboxEnableGuild"] = "Füge Gilde in Spieler-Tooltip hinzu.",
["CboxEnableShoutBox"] = "Enable automatic announcement",
["CboxEnableAnnounceBox"] = "Enable automatic announcement",
["CboxEnableShowOnly"] = "Zeige eine feste Anzahl von Anfragen pro Instanz",
["CboxEscapeQuit"] = "ESC schließt Fenster (Neustart notwendig)",
["CboxLockMinimapButton"] = "Minimap-Icon-Position sperren",
Expand Down Expand Up @@ -207,7 +207,7 @@ GBB.locales = {
["world_channel"] = "Welt",
["msgAddNote"] = "Notiz von %s",
["msgCustomList"] = "Hier die eigenen eindeutigen Suchbegriffe eingeben. Wenn nichts vorhanden ist, werden die englischen als ausgegraues Beispiel angezeigt.",
["msgDoShout"] = "Request announced.",
["msgDoAnnounce"] = "Request announced.",
["msgInit"] = "GroupBulletinBoard %s geladen. Zum Starten '/gbb help' eingeben.",
["msgLastSeen"] = "Zuletzt gesehen:",
["msgLastTime"] = "Letztes Update %s",
Expand All @@ -217,10 +217,10 @@ GBB.locales = {
["msgNbRequest"] = "%d Anfrage(n) - Anklicken zum Flüstern - shift + anklicken für /who ",
["msgNewRequest"] = "Neue Anfrage von %s für Instanz %s.",
["msgRequestHere"] = "Enter here your lfg message.",
["msgShoutError"] = "No request for a dungeon found!",
["msgShoutErrorChannel"] = "Channel '%s' not found.",
["msgAnnounceError"] = "No request for a dungeon found!",
["msgAnnounceErrorChannel"] = "Channel '%s' not found.",
["msgStartWho"] = "Sende /who für %s...",
["msgStopShout"] = "Automatic announcement stopped.",
["msgStopAnnounce"] = "Automatic announcement stopped.",
["msgTimeFormat"] = "%dm %02ds",
["msgTotalTime"] = "Gesamtzeit %s",
["PanelAbout"] = "Über",
Expand Down Expand Up @@ -259,9 +259,8 @@ GBB.locales = {
["BtnIgnore"]="Игнорировать %s",
["BtnNotifyColor"]="Цвет уведомительного сообщения",
["BtnSelectAll"]="Выбрать все",
["BtnStartShout"]="Объявить",
["BtnStopShout"]="Стоп",
["BtnStopShoutMsg"]="Остановить автоматическое объявление",
["BtnPostMsg"]="Объявить",
["BtnStopAnnounceMsg"]="Остановить автоматическое объявление",
["BtnTimeColor"]="Цвет времени",
["BtnPlayerNoteColor"]="Цвет заметки об игроке",
["BtnColorGuild"]="Цвет текста гильдии",
Expand All @@ -278,7 +277,7 @@ GBB.locales = {
["CboxColorOnLevel"]="Подсветить подземелья рекомендуемого диапазона уровней",
["CboxCompactStyle"]="Использовать двухстрочный дизайн",
["CboxDontTrunicate"]="Не обрезать сообщения",
["CboxEnableShoutBox"]="Включить автоматическое объявление",
["CboxEnableAnnounceBox"]="Включить автоматическое объявление",
["CboxEnableShowOnly"]="Показать фиксированное количество запросов в подземелье",
["CboxEscapeQuit"]="Закрывать главное окно при нажатии ESC (требуется перезагрузка)",
["CboxLockMinimapButton"]="Блокировка положения кнопки у миникарты",
Expand Down Expand Up @@ -325,7 +324,7 @@ GBB.locales = {
["lfg_channel"]="ПоискСпутников",
["world_channel"]="Мир",
["msgCustomList"]="Введите здесь свои уникальные шаблоны для поиска. Если занчение не заполнено, английские шаблоны отображаются в виде примера серым цветом.",
["msgDoShout"]="Запрос объявлен.",
["msgDoAnnounce"]="Запрос объявлен.",
["msgInit"]="GroupBulletinBoard %s загружен. Введите '/gbb help' для получения информации.",
["msgLastTime"]="Последнее обновление %s",
["msgLevelRange"]="(Уровень %d - %d)",
Expand All @@ -334,10 +333,10 @@ GBB.locales = {
["msgNbRequest"]="%d запрос(ов) - нажмите, чтобы шепнуть - ШИФТ + ЛКМ для \"/кто\"",
["msgNewRequest"]="Новый запрос от %s для подземелья %s.",
["msgRequestHere"]="Введите ваше сообщение для поиска.",
["msgShoutError"]="Запрос на подземелье не найден!",
["msgShoutErrorChannel"]="Канал '%s' не найден.",
["msgAnnounceError"]="Запрос на подземелье не найден!",
["msgAnnounceErrorChannel"]="Канал '%s' не найден.",
["msgStartWho"]="Запросить /кто на %s...",
["msgStopShout"]="Автоматическое объявление остановлено.",
["msgStopAnnounce"]="Автоматическое объявление остановлено.",
["msgTimeFormat"]="%dm %02ds",
["msgTotalTime"]="Общее время %s",
["PanelAbout"]="Информация",
Expand Down
7 changes: 5 additions & 2 deletions LFGBulletinBoard/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Group Bulletin Board

2.58
- Added a text box to post LFG msg at a click of a button

2.57
- Added support for arena

Expand Down Expand Up @@ -103,7 +106,7 @@ Group Bulletin Board
- Option: Notification on world/dungeons/raids/battleground

2.21
- Remove Shout/Announce-Box - doesn't work anymore
- Remove Announce/Announce-Box - doesn't work anymore

2.20
- TOC-UPDATETIMER
Expand All @@ -127,7 +130,7 @@ Group Bulletin Board
- Chat-Notifications - first line is now light grey
- some code optimizations
- new option: Scan Guild Channel (in Filter/Channel list)
- Shout/Announce now work with closed window
- Announce/Announce now work with closed window
- Item-Links have now a tooltip
- Adjust mousewheel-scroll-speed to one line

Expand Down

0 comments on commit 314a9dc

Please sign in to comment.