Skip to content

Commit

Permalink
Merge ac80350 into b9adff7
Browse files Browse the repository at this point in the history
  • Loading branch information
mrogaski committed Mar 28, 2020
2 parents b9adff7 + ac80350 commit 335b0db
Show file tree
Hide file tree
Showing 29 changed files with 644 additions and 221 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ install:
script:
- lua -lluacov tests/TestUtility.lua -v
- lua -lluacov tests/TestSettings.lua -v
- lua -lluacov tests/TestSystemEventHandler.lua -v

after_success:
- luacov-coveralls
Expand Down
2 changes: 1 addition & 1 deletion API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This project uses [Semantic Versioning](http://semver.org/).

## [1.11.0] -- Unreleased
### Removed
- Removed replication of achievements and loot announcements between co-guilds.

### Changed
- Updated the TOC for WoW 8.3.0.
- Refactored CHAT_MSG_SYSTEM handling to use an abstract factory and added
full unit testing for the polymorphic classes.

### Fixed
- Updated debug message call stack parsing for 8.3.

## [1.10.1] -- 2019-09-24
### Updated
- Updated the TOC for WoW 8.2.5.
Expand Down Expand Up @@ -623,6 +635,7 @@ flapping roster announcements for characters in peer co-guilds.
## 0.9.00 -- 2010-11-01
Initial commit.

[1.11.0]: https://github.com/AIE-Guild/GreenWall/compare/v1.10.1...v1.11.0
[1.10.1]: https://github.com/AIE-Guild/GreenWall/compare/v1.10.0...v1.10.1
[1.10.0]: https://github.com/AIE-Guild/GreenWall/compare/v1.9.15...v1.10.0
[1.9.15]: https://github.com/AIE-Guild/GreenWall/compare/v1.9.14...v1.9.15
Expand Down
13 changes: 2 additions & 11 deletions Channel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -262,7 +262,6 @@ Transmit Methods
-- @param type The message type.
-- Accepted values are:
-- GW_MTYPE_CHAT
-- GW_MTYPE_ACHIEVEMENT
-- GW_MTYPE_BROADCAST
-- GW_MTYPE_NOTICE
-- GW_MTYPE_REQUEST
Expand Down Expand Up @@ -298,10 +297,6 @@ function GwChannel:tl_send(type, message)
local opcode
if type == GW_MTYPE_CHAT then
opcode = 'C'
elseif type == GW_MTYPE_ACHIEVEMENT then
opcode = 'A'
elseif type == GW_MTYPE_LOOT then
opcode = 'L'
elseif type == GW_MTYPE_BROADCAST then
opcode = 'B'
elseif type == GW_MTYPE_NOTICE then
Expand Down Expand Up @@ -471,10 +466,6 @@ function GwChannel:tl_receive(...)
local type = GW_MTYPE_NONE
if opcode == 'C' then
type = GW_MTYPE_CHAT
elseif opcode == 'A' then
type = GW_MTYPE_ACHIEVEMENT
elseif opcode == 'L' then
type = GW_MTYPE_LOOT
elseif opcode == 'B' then
type = GW_MTYPE_BROADCAST
elseif opcode == 'N' then
Expand All @@ -486,7 +477,7 @@ function GwChannel:tl_receive(...)
elseif opcode == 'E' then
type = GW_MTYPE_EXTERNAL
else
gw.Debug(GW_LOG_ERROR, 'unknown segment opcode: %s', opcode)
gw.Debug(GW_LOG_WARNING, 'unknown segment opcode: %s', opcode)
end
return sender, guild_id, type, message
end
Expand Down
12 changes: 1 addition & 11 deletions Chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -37,14 +37,6 @@ function gw.handlerGuildChat(type, guild_id, content, arglist)
local sender = arglist[2]
if type == GW_MTYPE_CHAT then
gw.ReplicateMessage('GUILD', content[1], guild_id, arglist)
elseif type == GW_MTYPE_ACHIEVEMENT then
if gw.settings:get('achievements') then
gw.ReplicateMessage('GUILD_ACHIEVEMENT', content[1], guild_id, arglist)
end
elseif type == GW_MTYPE_LOOT then
if gw.settings:get('achievements') then
gw.ReplicateMessage('LOOT', content[1], guild_id, arglist)
end
elseif type == GW_MTYPE_BROADCAST then
local action, target, rank = unpack(content)
if action == 'join' then
Expand Down Expand Up @@ -95,8 +87,6 @@ end
-- Accepted values:
-- 'GUILD'
-- 'OFFICER'
-- 'GUILD_ACHIEVEMENT'
-- 'LOOT'
-- 'SYSTEM'
-- @param message The message to replicate.
-- @param guild_id (optional) Guild ID of the sender.
Expand Down
2 changes: 1 addition & 1 deletion Compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 8 additions & 10 deletions Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -64,15 +64,13 @@ GW_CTYPE_ADDON = 2
--
GW_MTYPE_NONE = 0
GW_MTYPE_CHAT = 1
GW_MTYPE_ACHIEVEMENT = 2
GW_MTYPE_LOOT = 3
GW_MTYPE_BROADCAST = 4
GW_MTYPE_CONTROL = 5
GW_MTYPE_REQUEST = 6
GW_MTYPE_RESPONSE = 7
GW_MTYPE_NOTICE = 8
GW_MTYPE_ADDON = 9
GW_MTYPE_EXTERNAL = 10
GW_MTYPE_BROADCAST = 2
GW_MTYPE_CONTROL = 3
GW_MTYPE_REQUEST = 4
GW_MTYPE_RESPONSE = 5
GW_MTYPE_NOTICE = 6
GW_MTYPE_ADDON = 7
GW_MTYPE_EXTERNAL = 8


--
Expand Down
2 changes: 1 addition & 1 deletion GUILD_QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Definitions
-----------

Bridging
> Replication of chat events within one guild into the guild, achievement, and officer chat of another guild.
> Replication of chat events within one guild into the guild and officer chat channels of another guild.
Confederation
> A large WoW guild that is partitioned into smaller guilds to comply with Blizzard's guild size limit.
Expand Down
4 changes: 1 addition & 3 deletions Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -70,8 +70,6 @@ gw.usage = [[
-- Reload the configuration.
reset
-- Reset communications and reload the configuration.
achievements <on|off>
-- Toggle display of confederation achievements.
roster <on|off>
-- Toggle display of confederation online, offline, join, and leave messages.
rank <on|off>
Expand Down
115 changes: 3 additions & 112 deletions GreenWall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Copyright (c) 2010-2020 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -176,9 +176,7 @@ function GreenWall_OnLoad(self)
self:RegisterEvent('CHAT_MSG_CHANNEL_LEAVE')
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE')
self:RegisterEvent('CHAT_MSG_GUILD')
self:RegisterEvent('CHAT_MSG_LOOT')
self:RegisterEvent('CHAT_MSG_OFFICER')
self:RegisterEvent('CHAT_MSG_GUILD_ACHIEVEMENT')
self:RegisterEvent('CHAT_MSG_SYSTEM')
self:RegisterEvent('GUILD_ROSTER_UPDATE')
self:RegisterEvent('PLAYER_ENTERING_WORLD')
Expand Down Expand Up @@ -297,18 +295,6 @@ function GreenWall_OnEvent(self, event, ...)
local message, sender, language, _, _, flags, _, chanNum = select(1, ...)
gw.Debug(GW_LOG_DEBUG, 'event=%s, sender=%s, message=%q', event, sender, message)

elseif event == 'CHAT_MSG_LOOT' then

local message, sender, _, _, _, flags, _, chanNum = select(1, ...)
gw.Debug(GW_LOG_DEBUG, 'event=%s, sender=%s, message=%q', event, sender, message)
item = gw.GetItemString(message)
if item and gw.IsLegendary(item) then
if gw.iCmp(gw.GlobalName(sender), gw.player) then
newmsg = message:gsub('You receive', gw.player .. ' receives') -- Convert to third-person
gw.config.channel.guild:send(GW_MTYPE_LOOT, newmsg)
end
end

elseif event == 'CHAT_MSG_OFFICER' then

-- Messages will be forwarded by the ChatEdit_ParseText hook
Expand All @@ -322,14 +308,6 @@ function GreenWall_OnEvent(self, event, ...)
gw.ReceiveLocal(gw.GlobalName(sender), payload)
end

elseif event == 'CHAT_MSG_GUILD_ACHIEVEMENT' then

local message, sender, _, _, _, flags, _, chanNum = select(1, ...)
gw.Debug(GW_LOG_DEBUG, 'event=%s, sender=%s, message=%q', event, sender, message)
if gw.iCmp(gw.GlobalName(sender), gw.player) then
gw.config.channel.guild:send(GW_MTYPE_ACHIEVEMENT, message)
end

elseif event == 'CHAT_MSG_CHANNEL_JOIN' then

local _, player, _, _, _, _, _, number = select(1, ...)
Expand Down Expand Up @@ -407,96 +385,9 @@ function GreenWall_OnEvent(self, event, ...)
elseif event == 'CHAT_MSG_SYSTEM' then

local message = select(1, ...)

gw.Debug(GW_LOG_DEBUG, 'event=%s, message=%q', event, message)

local pat_online = ERR_FRIEND_ONLINE_SS:format('(.+)', '(.+)'):gsub('([%[%]])', '%%%1')
local pat_offline = ERR_FRIEND_OFFLINE_S:format('(.+)')
local pat_join = ERR_GUILD_JOIN_S:format('(.+)')
local pat_leave = ERR_GUILD_LEAVE_S:format('(.+)')
local pat_quit = ERR_GUILD_QUIT_S:format(gw.player)
local pat_removed = ERR_GUILD_REMOVE_SS:format('(.+)', '(.+)')
local pat_kick = ERR_GUILD_REMOVE_SS:format('(.+)', '(.+)')
local pat_promote = ERR_GUILD_PROMOTE_SSS:format('(.+)', '(.+)', '(.+)')
local pat_demote = ERR_GUILD_DEMOTE_SSS:format('(.+)', '(.+)', '(.+)')

if message:match(pat_online) then

local _, player = message:match(pat_online)
player = gw.GlobalName(player)
gw.config.comember_cache:hold(player)
gw.Debug(GW_LOG_DEBUG, 'comember_cache: updated %s', player)

elseif message:match(pat_offline) then

local player = message:match(pat_offline)
player = gw.GlobalName(player)
gw.config.comember_cache:hold(player)
gw.Debug(GW_LOG_DEBUG, 'comember_cache: updated %s', player)

elseif message:match(pat_join) then

local player = message:match(pat_join)
if gw.GlobalName(player) == gw.player then
-- We have joined the guild.
gw.Debug(GW_LOG_NOTICE, 'guild join detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'join')
end

elseif message:match(pat_leave) then

local player = message:match(pat_leave)
if gw.GlobalName(player) == gw.player then
-- We have left the guild.
gw.Debug(GW_LOG_NOTICE, 'guild quit detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_quit) then

local player = message:match(pat_quit)
if gw.GlobalName(player) == gw.player then
-- We have left the guild.
gw.Debug(GW_LOG_NOTICE, 'guild quit detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_removed) then

local player = message:match(pat_removed)
if gw.GlobalName(player) == gw.player then
-- We have been kicked from the guild.
gw.Debug(GW_LOG_NOTICE, 'guild kick detected.')
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'leave')
gw.config:reset()
end

elseif message:match(pat_kick) then

local target, player = message:match(pat_kick)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you kicked %s', target)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'remove', target)
end

elseif message:match(pat_promote) then

local player, target, rank = message:match(pat_promote)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you promoted %s to %s', target, rank)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'promote', target, rank)
end

elseif message:match(pat_demote) then

local player, target, rank = message:match(pat_demote)
if gw.GlobalName(player) == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you demoted %s to %s', target, rank)
gw.config.channel.guild:send(GW_MTYPE_BROADCAST, 'demote', target, rank)
end
end
handler = GwSystemEventHandler:factory(gw.config, message)
handler:run()

elseif event == 'GUILD_ROSTER_UPDATE' then

Expand Down
7 changes: 4 additions & 3 deletions GreenWall.toc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Interface: 80205
## Interface: 80300
## Title: GreenWall
## Notes: Common communication channel as a replacement for guild chat in guild confederations.
## Author: Mark Rogaski <stigg@aie-guild.org>
## Version: 1.10.1
## Version: 1.11.0-dev
## URL: https://github.com/AIE-Guild/GreenWall
## URL: https://www.curseforge.com/wow/addons/greenwall
## DefaultState: enabled
## SavedVariables: GreenWallAccount
## SavedVariablesPerCharacter: GreenWall,GreenWallMeta,GreenWallLog
## X-Category: Guild
## X-Date: 2019-09-24
## X-Date: 2020-03-27

Lib\Load.xml
Constants.lua
Expand All @@ -21,6 +21,7 @@ Config.lua
Compat.lua
Chat.lua
Channel.lua
SystemEventHandler.lua
API.lua
Interface.lua
GreenWall.lua
Expand Down
Loading

0 comments on commit 335b0db

Please sign in to comment.