Skip to content

Commit

Permalink
Merge ca4c3ea into 2f6f971
Browse files Browse the repository at this point in the history
  • Loading branch information
mrogaski committed Apr 27, 2020
2 parents 2f6f971 + ca4c3ea commit 39b5d41
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 151 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ This project uses [Semantic Versioning](http://semver.org/).

## [1.11.0] -- Unreleased
### Removed
- Removed replication of achievements and loot announcements between co-guilds.
The `SendChatMessage` function was made partially protected in 8.2.5, and
events that are not triggered by hardware events cannot use the function.
- Removed replication of achievements, promotions, demotions, and loot
announcements between co-guilds. The `SendChatMessage` function was made
partially protected in 8.2.5, and events that are not triggered by hardware
events cannot use the function.
- Removed unnecessary local co-guild use of the addon communication channel.

### Added
Expand Down
10 changes: 1 addition & 9 deletions Chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,9 @@ function gw.handlerGuildChat(type, guild_id, content, arglist)
gw.ReplicateMessage('SYSTEM', format(ERR_GUILD_LEAVE_S, sender), guild_id, arglist)
end
elseif action == 'remove' then
if gw.settings:get('rank') then
if gw.settings:get('roster') then
gw.ReplicateMessage('SYSTEM', format(ERR_GUILD_REMOVE_SS, target, sender), guild_id, arglist)
end
elseif action == 'promote' then
if gw.settings:get('rank') then
gw.ReplicateMessage('SYSTEM', format(ERR_GUILD_PROMOTE_SSS, sender, target, rank), guild_id, arglist)
end
elseif action == 'demote' then
if gw.settings:get('rank') then
gw.ReplicateMessage('SYSTEM', format(ERR_GUILD_DEMOTE_SSS, sender, target, rank), guild_id, arglist)
end
end
else
gw.Debug(GW_LOG_WARNING, 'unhandled message type: %d', type)
Expand Down
2 changes: 0 additions & 2 deletions Globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ gw.usage = [[
-- Reset communications and reload the configuration.
roster <on|off>
-- Toggle display of confederation online, offline, join, and leave messages.
rank <on|off>
-- Toggle display of confederation promotion and demotion messages.
tag <on|off>
-- Show co-guild identifier in messages.
ochat <on|off>
Expand Down
4 changes: 2 additions & 2 deletions GreenWall.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
## Title: GreenWall
## Notes: Common communication channel as a replacement for guild chat in guild confederations.
## Author: Mark Rogaski <stigg@aie-guild.org>
## Version: 1.11.0-beta
## Version: 1.11.0
## 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: 2020-03-27
## X-Date: 2020-04-27

Lib\Load.xml
Constants.lua
Expand Down
15 changes: 1 addition & 14 deletions GreenWall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,9 @@ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<OnLoad>getglobal(self:GetName() .. "Text"):SetText("Show co-guild roster announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionRank" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRoster"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName() .. "Text"):SetText("Show co-guild rank announcements");</OnLoad>
</Scripts>
</CheckButton>
<Slider name="$parentOptionJoinDelay" inherits="OptionsSliderTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRank" relativeFrom="BOTTOMLEFT">
<Anchor point="TOPLEFT" relativeTo="$parentOptionRoster" relativeFrom="BOTTOMLEFT">
<Offset>
<AbsDimension x="8" y="-64"/>
</Offset>
Expand Down
2 changes: 0 additions & 2 deletions Interface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function GreenWallInterfaceFrame_LoadOptions(self, mode)
getglobal(self:GetName() .. "OptionMode"):SetChecked(mode == GW_MODE_ACCOUNT)
getglobal(self:GetName() .. "OptionTag"):SetChecked(gw.settings:get('tag', mode))
getglobal(self:GetName() .. "OptionRoster"):SetChecked(gw.settings:get('roster', mode))
getglobal(self:GetName() .. "OptionRank"):SetChecked(gw.settings:get('rank', mode))
getglobal(self:GetName() .. "OptionJoinDelay"):SetValue(gw.settings:get('joindelay', mode))
if (gw.IsOfficer()) then
getglobal(self:GetName() .. "OptionOfficerChat"):SetChecked(gw.settings:get('ochat', mode))
Expand Down Expand Up @@ -77,7 +76,6 @@ function GreenWallInterfaceFrame_SaveUpdates(self)
gw.settings:set('mode', mode)
gw.settings:set('tag', getglobal(self:GetName() .. "OptionTag"):GetChecked() and true or false, mode)
gw.settings:set('roster', getglobal(self:GetName() .. "OptionRoster"):GetChecked() and true or false, mode)
gw.settings:set('rank', getglobal(self:GetName() .. "OptionRank"):GetChecked() and true or false, mode)
gw.settings:set('joindelay', getglobal(self:GetName() .. "OptionJoinDelay"):GetValue(), mode)
if (gw.IsOfficer()) then
gw.settings:set('ochat', getglobal(self:GetName() .. "OptionOfficerChat"):GetChecked() and true or false, mode)
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ You will be able to set the following options.

Default: on

- __rank__ - _Show Co-Guild Rank Announcements_

Show promotion and demotion messages from other co-guilds.

Default: off

- __joindelay__ - _Channel Join Delay_

Adjust the time in seconds GreenWall will wait for a the system default channels (e.g. General, Local Defense).
Expand Down Expand Up @@ -187,12 +181,6 @@ To view the current configuration, you would enter one of the following.

Default: on

- rank [ on | off ]

Show promotion and demotion messages from other co-guilds.

Default: off

- ochat [ on | off ]

Show bridge officer chat between the co-guilds. This only works for members who have privileges to view officer notes.
Expand Down
4 changes: 0 additions & 4 deletions Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ function GwSettings:new()
value = true,
desc = "co-guild roster announcements"
},
rank = {
value = false,
desc = "co-guild rank announcements"
},
debug = {
value = GW_LOG_NONE,
min = 0,
Expand Down
36 changes: 1 addition & 35 deletions SystemEventHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ local pat_leave = ERR_GUILD_LEAVE_S:format('(.+)')
local pat_quit = ERR_GUILD_QUIT_S:format('(.+)')
local pat_removed = ERR_GUILD_REMOVE_SS:format('(.+)', '(.+)')
local pat_kick = ERR_GUILD_REMOVE_SELF
local pat_promote = ERR_GUILD_PROMOTE_SSS:format('(.+)', '(.+)', '(.+)')
local pat_demote = ERR_GUILD_DEMOTE_SSS:format('(.+)', '(.+)', '(.+)')

GwSystemEventHandler = { config = nil, player = nil, rank = nil }
GwSystemEventHandler = { config = nil, player = nil }

function GwSystemEventHandler:new(obj)
obj = obj or {}
Expand Down Expand Up @@ -108,22 +106,6 @@ end

GwPromoteSystemEventHandler = GwSystemEventHandler:new()

function GwPromoteSystemEventHandler:run()
if self.player == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you promoted %s to %s', self.target, self.rank)
self.config.channel.guild:send(GW_MTYPE_BROADCAST, 'promote', self.target, self.rank)
end
end

GwDemoteSystemEventHandler = GwSystemEventHandler:new()

function GwDemoteSystemEventHandler:run()
if self.player == gw.player then
gw.Debug(GW_LOG_NOTICE, 'you demoted %s to %s', self.target, self.rank)
self.config.channel.guild:send(GW_MTYPE_BROADCAST, 'demote', self.target, self.rank)
end
end

function GwSystemEventHandler:factory(config, message)
-- Remove coloring
message = string.gsub(message, "|c%w%w%w%w%w%w%w%w([^|]*)|r", "%1")
Expand Down Expand Up @@ -184,22 +166,6 @@ function GwSystemEventHandler:factory(config, message)
gw.Debug(GW_LOG_NOTICE, 'player removed: %s', player)
return GwKickSystemEventHandler:new({ config = config, player = player })

elseif message:match(pat_promote) then

local player, target, rank = message:match(pat_promote)
player = gw.GlobalName(player)
target = gw.GlobalName(target)
gw.Debug(GW_LOG_NOTICE, 'player promoted: %s, %s', target, rank)
return GwPromoteSystemEventHandler:new({ config = config, player = player, target = target, rank = rank })

elseif message:match(pat_demote) then

local player, target, rank = message:match(pat_demote)
player = gw.GlobalName(player)
target = gw.GlobalName(target)
gw.Debug(GW_LOG_NOTICE, 'player demoted: %s, %s', target, rank)
return GwDemoteSystemEventHandler:new({ config = config, player = player, target = target, rank = rank })

else

-- Unhandled system message
Expand Down
5 changes: 0 additions & 5 deletions run_tests.bat

This file was deleted.

2 changes: 0 additions & 2 deletions tests/TestSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function TestSettingsCreate:test_initialize()
lu.assertStrMatches(tab.updated, '%d%d%d%d%-%d%d%-%d%d %d%d:%d%d:%d%d')
lu.assertEquals(tab.tag, true)
lu.assertEquals(tab.roster, true)
lu.assertEquals(tab.rank, false)
lu.assertEquals(tab.debug, GW_LOG_NONE)
lu.assertEquals(tab.verbose, false)
lu.assertEquals(tab.log, false)
Expand Down Expand Up @@ -122,7 +121,6 @@ function TestSettingsLoad:test_character()
local settings = GwSettings:new()
lu.assertEquals(GreenWall.tag, true)
lu.assertEquals(GreenWall.roster, false)
lu.assertEquals(GreenWall.rank, false)
end

function TestSettingsLoad:test_account()
Expand Down
61 changes: 0 additions & 61 deletions tests/TestSystemEventHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function TestSystemEventHandler:test_online_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwOnlineSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
lu.assertEquals(handler.config, config)
end

Expand All @@ -103,7 +102,6 @@ function TestSystemEventHandler:test_online_raw_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwOnlineSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_online_run()
Expand All @@ -128,7 +126,6 @@ function TestSystemEventHandler:test_offline_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwOfflineSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_offline_run()
Expand All @@ -153,7 +150,6 @@ function TestSystemEventHandler:test_join_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwJoinSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_join_run()
Expand All @@ -178,7 +174,6 @@ function TestSystemEventHandler:test_leave_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwLeaveSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_leave_run()
Expand All @@ -205,7 +200,6 @@ function TestSystemEventHandler:test_quit_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwQuitSystemEventHandler)
lu.assertEquals(handler.player, "Ralff-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_quit_run()
Expand All @@ -223,7 +217,6 @@ function TestSystemEventHandler:test_remove_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwRemoveSystemEventHandler)
lu.assertEquals(handler.player, "Eggolas-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_remove_run()
Expand All @@ -250,7 +243,6 @@ function TestSystemEventHandler:test_kick_init()
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwKickSystemEventHandler)
lu.assertEquals(handler.player, "Ralff-EarthenRing")
lu.assertNil(handler.rank)
end

function TestSystemEventHandler:test_kick_run()
Expand All @@ -262,65 +254,12 @@ function TestSystemEventHandler:test_kick_run()
lu.assertTrue(config.is_reset)
end

function TestSystemEventHandler:test_promote_init()
config = MockConfig:new()
message = "Ralff has promoted Eggolas to Cohort."
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwPromoteSystemEventHandler)
lu.assertEquals(handler.player, "Ralff-EarthenRing")
lu.assertEquals(handler.target, "Eggolas-EarthenRing")
lu.assertEquals(handler.rank, "Cohort")
end

function TestSystemEventHandler:test_promote_run()
config = MockConfig:new()
message = "Ralff has promoted Eggolas to Cohort."
handler = GwSystemEventHandler:factory(config, message)
handler:run()
lu.assertEquals(config.channel.guild.input[1], { GW_MTYPE_BROADCAST, "promote", "Eggolas-EarthenRing", "Cohort" })
end

function TestSystemEventHandler:test_promote_run_skip()
config = MockConfig:new()
message = "Stigg has promoted Eggolas to Cohort."
handler = GwSystemEventHandler:factory(config, message)
handler:run()
lu.assertNil(config.channel.guild.input[1])
end

function TestSystemEventHandler:test_demote_init()
config = MockConfig:new()
message = "Ralff has demoted Eggolas to Pleb."
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwDemoteSystemEventHandler)
lu.assertEquals(handler.player, "Ralff-EarthenRing")
lu.assertEquals(handler.target, "Eggolas-EarthenRing")
lu.assertEquals(handler.rank, "Pleb")
end

function TestSystemEventHandler:test_demote_run()
config = MockConfig:new()
message = "Ralff has demoted Eggolas to Pleb."
handler = GwSystemEventHandler:factory(config, message)
handler:run()
lu.assertEquals(config.channel.guild.input[1], { GW_MTYPE_BROADCAST, "demote", "Eggolas-EarthenRing", "Pleb" })
end

function TestSystemEventHandler:test_demote_run_skip()
config = MockConfig:new()
message = "Stigg has demoted Eggolas to Pleb."
handler = GwSystemEventHandler:factory(config, message)
handler:run()
lu.assertNil(config.channel.guild.input[1])
end

function TestSystemEventHandler:test_no_match()
config = MockConfig:new()
message = "Don't panic."
handler = GwSystemEventHandler:factory(config, message)
lu.assertEquals(getmetatable(handler), GwSystemEventHandler)
lu.assertNil(handler.player)
lu.assertNil(handler.rank)
end


Expand Down

0 comments on commit 39b5d41

Please sign in to comment.