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

Support newer ApiVersion (2023-03-24 etc) #1248

Open
w1lla opened this issue Aug 16, 2023 · 3 comments
Open

Support newer ApiVersion (2023-03-24 etc) #1248

w1lla opened this issue Aug 16, 2023 · 3 comments

Comments

@w1lla
Copy link
Contributor

w1lla commented Aug 16, 2023

Hi,

When getting to update the latest server update and you want to keep to the latest api version you might get an error because Options was added into the callback of ManiaPlanet.PlayerChat:

https://forum.nadeo.com/viewtopic.php?p=11797#p11797

As well as an additional parameter for ManiaPlanet.PlayerChat() when using xml-rpc API version "2023-03-24":

ManiaPlanet.PlayerChat(ClientUid, Login, Text, IsCmd, Options);
Options can be: 0: Default, 1:ToSpectatorCurrent, 2: ToSpectatorAll, 3; ToTeam.
(ToSpectator is for the prefix "/s " on the client, ToTeam is for the prefix "/t " on the client,) `

Expected Behavior

Chat would be sent to different things like /s or /t for instance but also 0 Default is just general chat.

Actual Behavior

[2023-08-16 08:17:59,860][ERROR][debug_] root: too many values to unpack (expected 4) (log.py:86) Traceback (most recent call last): File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\events\dispatcher.py", line 184, in execute_receiver return receiver, await receiver(**kwargs) File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\events\callback.py", line 41, in glue return await self.send_robust(source) File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\events\dispatcher.py", line 266, in send_robust return await self.send(source, raw, catch_exceptions=True, gather=gather) File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\events\dispatcher.py", line 220, in send kwargs = await self.process_target(signal=self, source=source) File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\apps\core\maniaplanet\callbacks\player.py", line 28, in handle_player_chat player_uid, player_login, text, cmd = source ValueError: too many values to unpack (expected 4)

Steps to Reproduce (including precondition)

[Set the ApiVersion of the server to 2023-03-24 for instance]

(https://github.com/PyPlanet/PyPlanet/blob/master/pyplanet/core/gbx/remote.py#L26)

Screenshot on This Problem (if possible)

Even though the chat is being sent, you still get errors from pyplanet.

Your Environment

  • OS: windows 11
  • PyPlanet version: python 0.10.4
  • Python version: python 3.8.0.
@tomvlk
Copy link
Member

tomvlk commented Aug 29, 2023

@w1lla is this when you changed the default API-version? (in other words, did you change something in order to get this error)?

@w1lla
Copy link
Contributor Author

w1lla commented Aug 29, 2023

Yes, i changed the api version inside remote.py to def __init__(self, host, port, event_pool=None, user=None, password=None, api_version='2023-03-24', instance=None):

If i do this i get the the following errors:


ERROR    [debug_][pyplanet.core.instance] <Fault -506: "Method 'GetGameMode' not defined">
Traceback (most recent call last):
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\instance.py", line 108, in start
    self.loop.run_until_complete(self._start())
  File "c:\users\31648\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 608, in run_until_complete
    return future.result()
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\instance.py", line 157, in _start
    await self.gbx.connect()
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\gbx\client.py", line 134, in connect
    await super().connect()
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\gbx\remote.py", line 152, in connect
    mode = await self.execute('GetGameMode')
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\gbx\remote.py", line 206, in execute
    return await asyncio.wait_for(future, timeout)
  File "c:\users\31648\appdata\local\programs\python\python38\lib\asyncio\tasks.py", line 483, in wait_for
    return fut.result()
  File "C:\tmn\pyplanet\env\lib\site-packages\pyplanet\core\gbx\remote.py", line 220, in listen
    data, method = loads(body, use_builtin_types=True)
  File "c:\users\31648\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 1018, in loads
    return u.close(), u.getmethodname()
  File "c:\users\31648\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 655, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -506: "Method 'GetGameMode' not defined">

Seems to be related to this:

78baec5

&

https://forum.nadeo.com/viewtopic.php?p=9906#p9906

@tomvlk
Copy link
Member

tomvlk commented Aug 29, 2023

Yeah this version is not yet supported.

@tomvlk tomvlk changed the title [TM20202 Callback PlayerChat Misses some options] when ApiVersion is set to 2023-03-24 Support newer ApiVersion (2023-03-24 etc) Aug 29, 2023
@tomvlk tomvlk removed this from the Version 0.11.0 milestone Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants