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

(Blocked) Add rank_icon to ADDUSER command #275

Closed
wants to merge 6 commits into from

Conversation

jauggy
Copy link
Member

@jauggy jauggy commented Apr 16, 2024

Context

Contributors use a high rank to determine their rank icon. The problem is that this makes contributors look like pro gamers and they might not be. In order to create more flexibility to rank icons, we should separate them from rank. If we can separate it from rank we could use rank icons made by Ice

1

Teiserver currently sends this for ADDUSER :

    "ADDUSER #{client.name} #{client.country} #{client.userid} #{client.lobby_client}\n"

Proposed Changes

I propose to send this instead from TeiServer

    "ADDUSER #{client.name} #{client.country} #{client.userid} #{client.lobby_client} #{client.rank_icon}\n"

where rank_icon is a string that can take these values:

  • 1Chev, 2Chev, ...8Chev
  • 1Moderator, 2Moderator, ...8Moderator
  • 1Contributor, 2Contributor, ...8Contributor
  • 1Streamer, 2Streamer, ...8Streamer
  • 1Mentor, 2Mentor, ...8Mentor
  • Bot

But it's very flexible and can really be anything. The numeric prefix represents their chev level purely based on playtime. After that the postfix depends on if they have a special role or not. If a user has multiple roles it will pick one in this order: Moderator > Contributor > Streamer > Mentor.

Required SPADS modification

SPADS doesn't error with this modification. However I have no idea why it doesn't error.

Required Chobby Modifications

No change is required to Chobby to prevent errors. Chobby is using regex that will simply ignore the extra argument.

Test Steps

1. Launch SPADS

perl spads.pl etc/spads.conf

This is the normal command to launch spads.

2. Add TeiServer Test Users

Launch teiserver with this command (that allows running Elixir commands)

iex -S mix phx.server

In the same terminal run this to generate test users

TestScript.run()

This will generate the following users:

1Chev, 2Chev, 3Chev, 4Chev, 5Chev, 6Chev, 7Chev, 8Chev

Each of them will have a password of password. Their chev level is defined by their name.

3. Login with test users

Launch Chobby and login with any of the test users. Check via logs what rank_icon is being send (Not sure how to log this)

Now go to Teiserver website and login with root@localhost with password password
Go to Users > Find the user > Edit > Change their role to include any of Moderator/Contributor/Streamer/Mentor

Relogin with that user in Chobby. Check the logs and it should be different.

@jauggy jauggy changed the title WIP: Add rank_icon to ADDUSER command (Blocked) Add rank_icon to ADDUSER command May 11, 2024
@jauggy
Copy link
Member Author

jauggy commented May 11, 2024

While the code in this PR works, it is currently blocked due to not knowing how to get this information into the in-game player list. Getting the data into chobby should be working fine.

@Beherith
Copy link
Contributor

I would honestly expect SPADS to panic at this, ill have to test it on integration.

@Beherith
Copy link
Contributor

I think I would much prefer to make this an extensible field, likely via base64'd json. There have been multiple requests to transfer additional metadata in ADDUSER.

@jauggy
Copy link
Member Author

jauggy commented May 14, 2024

@Beherith just to clarify you want the last argument to be base 64 json string instead of just rank icon? Example:

    "ADDUSER #{client.name} #{client.country} #{client.userid} #{client.lobby_client} #{base64json_extradata}\n"

@jauggy
Copy link
Member Author

jauggy commented May 14, 2024

I would honestly expect SPADS to panic at this, ill have to test it on integration.

I later figured out why it doesn't error. It's because there's an existing bug. Teifion does not send cpu in the ADDUSER command. BarManager.py is expecting it

def hADDUSER(command, userName, country = "nil", cpu = "nil", userID = "nil", lobbyID = "nil"):

So everything is off by one.

Also see this comment by Teifion:
https://discord.com/channels/549281623154229250/564591092360675328/1172100679242887168

@jauggy
Copy link
Member Author

jauggy commented Aug 6, 2024

Not working on this so closing

@jauggy jauggy closed this Aug 6, 2024
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

Successfully merging this pull request may close these issues.

2 participants