[Tools, py] Fix announce.py and adds native announce command from tools directory#9123
[Tools, py] Fix announce.py and adds native announce command from tools directory#9123texastoastt wants to merge 8 commits intoLandSandBoat:basefrom
Conversation
zach2good
left a comment
There was a problem hiding this comment.
This is much more complex than it needs to be. You only need to update the layout of the message produced by the existing python script and it'll start working again. You can see the new layout in ipc_stubs, I believe, or somewhere near there.
struct ChatMessageServerMessage
{
uint32 senderId{};
std::string senderName{};
std::string message{};
uint16 zoneId{};
uint8 gmLevel{};
CHAT_MESSAGE_TYPE messageType{ MESSAGE_SYSTEM_1 };
bool skipSender{};
};
struct ChatMessageCustom
{
uint32 recipientId{};
std::string senderName{};
std::string message{};
CHAT_MESSAGE_TYPE messageType{};
}; |
|
I ran into some alpaca issues trying to update the existing script but with what you just sent, I think I know why. Not sure how I missed that when I went digging. Going to make another pass at this with that info. |
|
Ok got it sorted as a python standalone and removed the previous stuff that ultimately isn't needed anymore. I absolutely over-complicated trying to understand the alpaca encoding which took me down the wrong rabbit hole previously. |
| sender = "" | ||
|
|
||
| # alpaca encoding for: | ||
| # Alpaca encoding for ChatMessageServerMessage (ID=12) |
There was a problem hiding this comment.
This is now giving conflicting information with 2 lines below
There was a problem hiding this comment.
Yep, sorry. That's an artifact from my troubleshooting.
| buffer[idx] = len(sender) | ||
| idx += 1 | ||
| # senderName (std::string) - varint length + UTF-8 data | ||
| sender_bytes = sender.encode('utf-8') |
There was a problem hiding this comment.
Why is this utf-8, we aren't using that in the C++ side?
There was a problem hiding this comment.
This is my misunderstanding, as i see utf-8 in the db and other places. What character set do i need to use for this specifically, and I'm happy to adjust.
| (ip_int,) = struct.unpack("!I", ip_bytes) | ||
| ipp = ip_int | (port << 32) | ||
| ipp_bytes = struct.pack("!Q", ipp) | ||
| # Convert to host byte order (like ntohl in C++) |
There was a problem hiding this comment.
Comment is redundant, it's already called socket.ntohl
There was a problem hiding this comment.
You're right. Will fix that.
|
This PR has been automatically marked as stale because |
I affirm:
What does this pull request do?
Restores the expected behavior of announce.py by sending a system message to all players in all zones. Due to changes in messageType, announce.cpp and accompanying CMakeupdates required to build the new native executable. announce.py was also update for backward compatibility to call the new native exe.
Steps to test these changes
From the server/tools/ directory, use either ./announce "TEST MESSAGE" or python3 announce.py "TEST MESSAGE" to confirm message sent in-game.