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

Pin commands not working #3

Closed
nehswu opened this issue Mar 29, 2023 · 6 comments
Closed

Pin commands not working #3

nehswu opened this issue Mar 29, 2023 · 6 comments

Comments

@nehswu
Copy link

nehswu commented Mar 29, 2023

Player chat messages don't seem to be detected, and as a result the pin commands aren't working.

OS: Windows
Version:

  • Server: 0.214.300
  • BepInEx: 5.4.2101

WebMap log excerpt:

[11:47:48.211] WebMap: MAP ALREADY BUILT!
[11:47:52.896] WebMap: starting point (-194.3, 80.4, 1.4)
[11:47:53.542] WebMap: HTTP Server Listening on port 3000
[11:47:55.155] WebMap: new visitor connected from 10.144.43.1:50583
[11:47:55.165] 3/29/2023 11:47:55 AM|Fatal|<>c__DisplayClass174_0.b__2:0|WebSocketSharp.WebSocketException: The header part of a frame could not be read.
[11:47:55.165] at WebSocketSharp.WebSocketFrame.processHeader (System.Byte[] header) [0x0001f] in :0
[11:47:55.166] at WebSocketSharp.WebSocketFrame+<>c__DisplayClass73_0.b__0 (System.Byte[] bytes) [0x00000] in :0
[11:47:55.166] at WebSocketSharp.Ext+<>c__DisplayClass57_0.b__0 (System.IAsyncResult ar) [0x0008e] in :0
[11:47:55.872] WebMap: new visitor connected from 10.144.43.1:50587
[11:49:53.847] WebMap: (chat) (-7025.5, 68.2, 3555.6) | 2 | Whopp |
[11:51:34.278] WebMap: (say) (-7028.8, 66.1, 3555.4) | 1 | Whopp |
[11:51:49.407] WebMap: (say) (-7028.8, 66.1, 3555.4) | 1 | Whopp |
[11:53:48.599] WebMap: (say) (-7028.8, 66.1, 3555.4) | 1 | Whopp |
[11:54:19.888] WebMap: (say) (-7028.8, 66.1, 3555.4) | 1 | Whopp |

Screenshot 2023-03-29 115507

@kandohar
Copy link

kandohar commented Apr 1, 2023

Same issue here

@h0tw1r3
Copy link
Owner

h0tw1r3 commented Apr 4, 2023

Noticed the same thing. Haven't been able to figure out why the data isn't being unpackaged properly. From what I can tell it's still the standard .net BinaryReader, no real changes to the valheim code. Every other field in the RPC package works fine, just not the message :(

I will try to put a hack in until I can get a proper fix.

@h0tw1r3
Copy link
Owner

h0tw1r3 commented Apr 5, 2023

I put as very unsightly hack in 5af53c0 which "fixed" the problem for me.
Also fixes the map color of Mistland's.

Need to do more testing tomorrow. If it works for others, I'll cut a new release.

@kandohar
Copy link

kandohar commented Apr 5, 2023

Nice! Thanks!
Actually, I got another issue, the position of the players is really random, they just jump around the center position and is not related to the in-game position.

@ben-bartholomew
Copy link

I ran into a similar issue with one of my mods, they made a change to the way messages are packed and I believe you will need to update WebMap.cs to reflect this. From the most recent de-compilation of Talker.Say, messages are now sent like this:

this.m_nview.InvokeRPC(ZNetView.Everybody, nameof (Say), (object) (int) type, (object) UserInfo.GetLocalUser(), (object) text, (object) PrivilegeManager.GetNetworkUserId());

In the middle there is the change, (I think to support Xbox players) they swapped out sending just the player name with the UserInfo object. De-serializing messages in the following way worked for me:

var package = new ZPackage(data.m_parameters.GetArray());
package.SetPos(0);

int _ = package.ReadInt(); //type of message

var userInfo = new UserInfo();
userInfo.Deserialize(ref package);

string message = package.ReadString() ?? "";
message = message.Trim();

FWIW I noticed no player messages (including pins) show up in the webmap on my server. I think this is the cause. I had the same trouble in another mod (unpacking would fail silently and messages would just be the empty string) until noticing this and unpacking the say messages correctly.

@h0tw1r3 h0tw1r3 closed this as completed in e6b37c7 Apr 8, 2023
@h0tw1r3
Copy link
Owner

h0tw1r3 commented Apr 8, 2023

@ben-bartholomew thank you! Exactly what I needed to see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants