Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzerothCore support #4

Draft
wants to merge 49 commits into
base: TrinityCore
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9d26d66
Updated download links that were not working
FeedehC Feb 14, 2023
7564b4b
chore: update download links
55Honey Feb 14, 2023
db5446e
AzerothCore Support
Kebful Jan 27, 2024
4e37e50
Merge pull request #2 from Kebful/master
Kitzunu Jan 27, 2024
5cdf305
1.0.0
Kitzunu Jan 27, 2024
f7ab41b
Update README.md
Kitzunu Jan 27, 2024
595b2e4
Merge remote-tracking branch 'AzerothGenie/master' into TrinityCore
chocochaos Feb 24, 2024
1396c61
Update interface version to prevent addon being listed as out of date…
chocochaos Feb 24, 2024
0ad17c3
refactor: introduce CommandBus to simplify interaction with GM comman…
chocochaos Feb 24, 2024
c0826be
Refactoring progress, mostly focussed on Spy
chocochaos Mar 6, 2024
12c821c
Test commit
chocochaos Mar 6, 2024
d533382
Nil values cannot be concatenated. Revert back to empty strings for now
chocochaos Mar 6, 2024
31e5e5f
Load LUA files in the correct order
chocochaos Mar 6, 2024
a9b32a9
Fix incorrect variable reference
chocochaos Mar 6, 2024
53f2a98
Prevent error about message being nil
chocochaos Mar 6, 2024
36fe18c
Attempt to fix nil errors
chocochaos Mar 6, 2024
bd07df6
Fix some references and add more debugging information
chocochaos Mar 6, 2024
85d1234
Use correct concatenation syntax
chocochaos Mar 6, 2024
686b2a1
Resolve incorrect function references
chocochaos Mar 6, 2024
7583b65
Add more debug information
chocochaos Mar 6, 2024
73f01c0
Add more debug information
chocochaos Mar 6, 2024
9f491e2
Add more debug information
chocochaos Mar 6, 2024
df96077
Use explicit identifiers for command handlers
chocochaos Mar 6, 2024
8808695
Fix playerinfo message detection
chocochaos Mar 6, 2024
2e9168e
Add more debug information
chocochaos Mar 6, 2024
fc1c13a
Correctly detect the broken bar character
chocochaos Mar 6, 2024
2731cbd
Correctly parse location information
chocochaos Mar 6, 2024
fc32694
Remove some debug code, and add better way to handle debug messages
chocochaos Mar 6, 2024
986d4f7
Remove forgotten debug message
chocochaos Mar 6, 2024
8aa3c77
Make sure spy window is shown
chocochaos Mar 6, 2024
97f23e0
Correctly filter out unknown locations
chocochaos Mar 6, 2024
032f989
FFS: why does azerothcore add spaces around locations?
chocochaos Mar 6, 2024
e5b1ce7
Add code completion hints and use consistent command identifiers for …
chocochaos Mar 6, 2024
c9519dc
More major refactoring, mostly focussed on the command / chat respons…
chocochaos Mar 7, 2024
0b97376
Apparently these includes in XMLs do not work in 3.3.5 - or I messed …
chocochaos Mar 7, 2024
1127413
Fix a typo
chocochaos Mar 7, 2024
27ce18b
Correctly set values in Spy UI
chocochaos Mar 7, 2024
0bc0523
Quick hacky fix to get the spy window to display before loading data
chocochaos Mar 7, 2024
64a37e0
Even uglier fix to prevent null index errors
chocochaos Mar 7, 2024
c21526f
Fix uninitialised table
chocochaos Mar 7, 2024
25bdccc
Fix infowindow reference
chocochaos Mar 7, 2024
666f01a
Add some strategic debug information
chocochaos Mar 7, 2024
53721ad
Slightly optimise onSuccess flow for readers
chocochaos Mar 7, 2024
024b8d0
Slightly optimise onError flow for readers
chocochaos Mar 7, 2024
8c2052a
Possibly fix the HUD again (or will it fail to show now as well? ;) )
chocochaos Mar 7, 2024
5e3a943
Fix incorrect reference
chocochaos Mar 7, 2024
312f567
Fix incorrect reference
chocochaos Mar 7, 2024
95160d7
More robust handling of GM mode in playerinfo reader
chocochaos Mar 7, 2024
050ad4e
Fix state being used after it has been reset
chocochaos Mar 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
.vscode/
197 changes: 39 additions & 158 deletions Chatreader.lua

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Core/ChatMessageObserver/Bootstrap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local defaultInGameChatEventHandler = ChatFrame_MessageEventHandler;
local function ourChatEventHandler(self, event, message, ...)
local response = nil;
if event == "CHAT_MSG_SYSTEM" then
response = GMGenie.ChatMessagePublisher.publishSystemMessage(message);
end

if not response or not response.stopPropagation then
defaultInGameChatEventHandler(self, event, message, ...);
end
end

-- Hacky, but by doing it this way propagation of messages to the in-game chat can be controlled.
ChatFrame_MessageEventHandler = ourChatEventHandler;
45 changes: 45 additions & 0 deletions Core/ChatMessageObserver/Publisher.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
local ChatMessagePublisher = {
--- @type table<string, ChatMessageSubscriber[]>
subscribersByKey = {},
}

GMGenie.ChatMessagePublisher = ChatMessagePublisher;

--- Subscribe to chat messages, to read command responses and act on them.
--- @param subscriptionKey string Several subscribers can share a key. If one unsubscribes, all are unsubscribed.
--- @param subscriber ChatMessageSubscriber
function ChatMessagePublisher.subscribe(subscriptionKey, subscriber)
GMGenie.printDebugMessage("Subscribed: " .. subscriptionKey);

if not ChatMessagePublisher.subscribersByKey[subscriptionKey] then
ChatMessagePublisher.subscribersByKey[subscriptionKey] = {};
end
table.insert(ChatMessagePublisher.subscribersByKey[subscriptionKey], subscriber);
end

--- Unsubscribe from chat messages, when all required information has been gathered.
--- @param subscriptionKey string
function ChatMessagePublisher.unsubscribe(subscriptionKey)
GMGenie.printDebugMessage("Unsubscribed: " .. subscriptionKey);
ChatMessagePublisher.subscribersByKey[subscriptionKey] = {};
end

--- @param message string
--- @return ChatMessageSubscriberResponse
--- @internal
function ChatMessagePublisher.publishSystemMessage(message)
for subscriptionKey, subscribers in pairs(ChatMessagePublisher.subscribersByKey) do
for _, subscriber in ipairs(subscribers) do
local response;
if subscriber.onSystemMessage then
response = subscriber.onSystemMessage(message);
end

if response.stopPropagation then
return {stopPropagation = true};
end
end
end

return {stopPropagation = false};
end
5 changes: 5 additions & 0 deletions Core/ChatMessageObserver/Subscriber.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--- Subscribers are notified by the publisher when a chat message is sent.
--- The subscriber can then act on the message, if needed.
---
--- @class ChatMessageSubscriber
--- @field onSystemMessage nil|fun(message: string):ChatMessageSubscriberResponse Implement this method to subscribe to system messages.
2 changes: 2 additions & 0 deletions Core/ChatMessageObserver/SubscriberResponse.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- @class ChatMessageSubscriberResponse
--- @field stopPropagation boolean Should the message be propagated to other subscribers, including the in-game chat?
3 changes: 3 additions & 0 deletions Core/Functions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GMGenie.Functions = {

};
13 changes: 13 additions & 0 deletions Core/GMCommandDispatcher.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local GMCommandDispatcher = {};

GMGenie.GMCommandDispatcher = GMCommandDispatcher;

--- Dispatch a GM command.
--- @param command string
function GMCommandDispatcher.dispatch(command)
GMGenie.printDebugMessage("Dispatching GM command: " .. command);

-- Using the guild channel to prevent messages being broadcast publicly
-- in case the server does not interpret the message as a command
SendChatMessage(command, "GUILD");
end
20 changes: 20 additions & 0 deletions Core/Readers/PlayerInfo/IncompletePlayerInfo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- @class IncompletePlayerInfo
--- @field accountName string|nil
--- @field accountId number|nil
--- @field emailAdress string|nil
--- @field gmLevel number|nil
--- @field ip string|nil
--- @field latency number|nil
--- @field lastLogin string|nil
--- @field failedLogins number|nil
--- @field characterName string|nil
--- @field characterId number|nil
--- @field race string|nil
--- @field class string|nil
--- @field level number|nil
--- @field location string|nil
--- @field money string|nil
--- @field phase number|nil
--- @field totalPlayTime string|nil
--- @field isGmModeActive boolean|nil
--- @field guildName string|nil
20 changes: 20 additions & 0 deletions Core/Readers/PlayerInfo/PlayerInfo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- @class PlayerInfo
--- @field accountName string
--- @field accountId number
--- @field emailAdress string|nil
--- @field gmLevel number
--- @field ip string
--- @field latency number
--- @field lastLogin string
--- @field failedLogins number
--- @field characterName string
--- @field characterId number
--- @field race string
--- @field class string
--- @field level number
--- @field location string
--- @field money string
--- @field phase number
--- @field totalPlayTime string
--- @field isGmModeActive boolean
--- @field guildName string|nil
Loading