the-marenga / sf-api

Manage Shakes & Fidget characters via simple commands. Handles encryption, response parsing and everything else for you
MIT License
15 stars 3 forks source link

Detailed data of guild members #15

Closed Sempoinus1 closed 8 months ago

Sempoinus1 commented 8 months ago

Heyy,

I wonder if I can fetch more data of guild member, I mean I get the player name but that's not the same with character id. I need to fetch Cons, Main stat, Album and number of defeated bosses in personal portal.

I'm aware I can easily fetch those data for myself, but is there a way now to fetch guild members?

the-marenga commented 8 months ago

The only way to fetch detailed data of other players is with the ViewPlayer command. Thats how the game itself does it for guild members, hall of fame entries, arena battles and so on. All just use the ViewPlayer command in the game. The data fetched should contain all data the game has about the player (equipment, attributes, album count, fortress, etc.).

If I remember correctly, the value for the portal count the server sends is bad/wrong in some cases and I prefered to have no value, instead of a wrong value, so I commented that part of the parsing out until I know what makes the game send a wrong value:

https://github.com/the-marenga/sf-api/blob/abbb8990fafc8ed57fce18263f2b63a78269099d/src/gamestate/social.rs#L307

If you need that value, I can check up on that problem again and make sure that value gets parsed correctly

Sempoinus1 commented 8 months ago

Thanks! That helped a lot!

Btw, is there any reason for https://github.com/the-marenga/sf-api/blob/abbb8990fafc8ed57fce18263f2b63a78269099d/src/gamestate/social.rs#L54 this to be private?

the-marenga commented 8 months ago

Yes, because you can use the ViewPlayer command with the player_id, or the username. As a result, there also has to be a way to get the fetched result from the gamestate with the player_id and the username. Both of these ways are provides with the lookup_name() and lookup_pid() methods on OtherPlayers. If the underlying fields were public, you could easily create situations, where the lookup is no longer in sync with the vec, that contains the players and thus return you the wrong result when calling the lookup methods

Sempoinus1 commented 8 months ago

Thanks! Everything is resolved now. I'll take a look at the portal too maybe I'll figure something out.