Skip to content

Commit

Permalink
Initial commit (fix repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
valsan-azerty-boi committed Nov 20, 2022
0 parents commit a390c64
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .gitignore
@@ -0,0 +1,57 @@
# Compiled Lua sources
luac.out
/WhereGuildmates

# luarocks build files
*.src.rock
*.zip
*.tar.gz

# Object files
*.o
*.os
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Images
*.bmp
*.gif
*.png
*.svg
*.webm
*.webp

# Sounds
*.aac
*.flac
*.m4a
*.mp3
*.wav
*.wma
6 changes: 6 additions & 0 deletions README.md
@@ -0,0 +1,6 @@
# where-guildmates-wow

This addon plays a fun sound when a guildmate login or logout

- It was a fun idea from a guildmate so I did it (we have custom sounds for our characters hehe)
- Created for World of Warcraft Retail 10.0.2 on Nov 18 (2022)
84 changes: 84 additions & 0 deletions WhereGuildmates.lua
@@ -0,0 +1,84 @@
addonName = "WhereGuildmates";

local frame = CreateFrame("Frame");
frame:RegisterEvent("CHAT_MSG_SYSTEM");

local online_msg = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.-)"):gsub("[%[%]]", "%%%1");
local offline_msg = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.-)");

local function GetPlayerNameFromMsg(msg)
local name = nil;

if(msg:find(online_msg)) then
_, name = strmatch(msg, online_msg);
elseif(msg:find(offline_msg)) then
name = strmatch(msg, offline_msg);
end

return name;
end

local function GetPlayerNameFromGuild(index)
local name = GetGuildRosterInfo(index):match("(.*-)"):gsub('-', '');
return name;
end

local function LoginCustomRule(playerName)
local sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\login.ogg";

if(playerName == "Gorkah") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\login_gorkah.ogg";
elseif(playerName == "Krÿg") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\login_kryg.ogg";
elseif(playerName == "Borsâ") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\login_borsa.ogg";
elseif(playerName == "Ewïlan") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\login_ewilan.ogg";
elseif(playerName == "Klamidiaa") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\login_klam.ogg";
else
num = math.random() and math.random() and math.random() and math.random(0, 20)
if(num == 10) then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\wololo.ogg";
end
end

return sound;
end

local function LogoutCustomRule(playerName)
local sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\logout.ogg";

if(playerName == "Gorkah") then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\logout.ogg";
else
num = math.random() and math.random() and math.random() and math.random(0, 20)
if(num == 10) then
sound = "Interface\\AddOns\\WhereGuildmates\\sounds\\ee\\wololo.ogg";
end
end

return sound;
end

local function EventHandler(self, event, msg)
local msgPlayerName = GetPlayerNameFromMsg(msg);

if(msgPlayerName == nil or msgPlayerName == '') then
-- do nothing
else
for i=1,GetNumGuildMembers(true) do
local guildPlayerName = GetPlayerNameFromGuild(i);
if((guildPlayerName == msgPlayerName)) then
if(msg:find(online_msg)) then
PlaySoundFile(LoginCustomRule(msgPlayerName), "Master");
elseif(msg:find(offline_msg)) then
PlaySoundFile(LogoutCustomRule(msgPlayerName), "Master");
end
break
end
end
end
end

frame:SetScript("OnEvent", EventHandler);
16 changes: 16 additions & 0 deletions WhereGuildmates.toc
@@ -0,0 +1,16 @@
## Interface: 100002
## Interface-Classic: 11403
## Interface-BCC: 20504
## Interface-Wrath: 30400
## X-Min-Interface: 100002
## X-Min-Interface-Classic: 11403
## X-Min-Interface-BCC: 20504
## X-Min-Interface-Wrath: 30400
## Title: WhereGuildmates
## Version: 1.1.5
## DefaultState: Enabled
## LoadOnDemand: 0
## Notes: Play a fun sound when a guildmate login or logout.
## Description: Play a fun sound when a guildmate login or logout.

WhereGuildmates.lua
Binary file added cover.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sounds/ee/login_borsa.ogg
Binary file not shown.
Binary file added sounds/ee/login_ewilan.ogg
Binary file not shown.
Binary file added sounds/ee/login_gorkah.ogg
Binary file not shown.
Binary file added sounds/ee/login_klam.ogg
Binary file not shown.
Binary file added sounds/ee/login_kryg.ogg
Binary file not shown.
Binary file added sounds/ee/wololo.ogg
Binary file not shown.
Binary file added sounds/login.ogg
Binary file not shown.
Binary file added sounds/logout.ogg
Binary file not shown.

0 comments on commit a390c64

Please sign in to comment.