Skip to content

Commit

Permalink
More work on user info (#39)
Browse files Browse the repository at this point in the history
* User Caddie Data

Following the User Character, Equipment, and Statistic Data structures,
User Caddie Data is similarly reused between multiple packets.

* Improve Change Equipment packets

More details for GSC-0006 and response GSS-006B.

* More User Statistics

Perhaps useless, but this is low hanging fruit.

User Statistics Data had to be split, as there is a 78-byte data block
of currently-unknown use at the end in GSS-0044 and GSS-0045 that does
not appear in GSS-0158.

* User Course Records Data

Another duplicated structure presents itself, this time with course
records. The extra course-specific slots of GSS-0045 appear in GSS-015C,
too.

* User Information III, The Reckoning

Continuing on the path of cleaning up GSC-002F responses, another
repeated data structure has been extracted (user_name_data), along with
pointing most of the GSC-002F responses to their appropriate shared
structure definitions instead of bespoke individual definitions that are
liable to be left incomplete when work happens elsewhere.

Because of the extensive use of these shared structures, a surprising
amount of extra information can be gathered about other accounts that
wouldn't be displayed in-game, such as current pang balance or exact
equipment loadout. Third party implementations of the server might see
fit to blank out this information where it's not absolutely necessary.

* Authentication Keep-Alive Observation

A minor observation that the current server's ID appears in the token
portion of the challenge and response. Also documented are the range of
lengths of responses.

* Statistical Anomaly

While GSS-0158 is mostly a response to GSC-002F, it's also sent as a
response to GSC-0002, but almost entirely blanked out.

Very odd.

* The Endgame

Various packets regarding ending of holes, matches and tournaments here;
GSC-0031 is similar to GSC-0006, but sent after every hole. GSC-00AA is
identical to GSC-0006, but sent when using a Tiki Report instead of
allowing a tournament to end naturally. The format for all three of
these packets have been split off into user_course_record_data.

While tournaments ending as a result of GSC-00AA is obvious, a new
method was needed for grouping packets that didn't directly result from
some other packet. Tentatively calling these 'events', the first such
event is that of a match or tournament ending, with GSC-0006 and 10 GSS
packets joining that list.

Lastly, GSS-012A is noted as a dedicated response to using a Tiki Report
with GSC-00AA, separate from it acting as a combination GSC-0006,
GSC-000F, and tournament end.

* Missed Connections

Additional packets related to connecting to a sub-server; GSC-0083 is
similar to GSC-0004, but used when the user is in multiplayer/grand prix
mode. With both GSC-0004 and GSC-0083, a reply of GSS-004E is used to
acknowledge a successful connection to the new sub-server.

* Minor fix to indices

Forgot to add GSC-0083 and GSS-004E to the packet indices.

* High Fashion

Details on user designed clothing in game, at least from an observer's
perspective. GSC-00B9 requests information on a particular item, and
GSS-012E allows for the client to make an HTTP request for custom
uploaded textures.

Also included is a small clean up of GSS-00E6, since user shops are the
most obvious places to find custom clothing on a whim.

* Port-a-Ball Code

GSC-0019 and GSS-0060 are the pair of packets responsible for allowing
players to relocate their comet during play, called relief. Note that
this is never free relief; it is always a penalty relief, regardless of
the impracticality/impossibility of playing the shot as the comet lies.

* Gotta Go Fast

GSC-0065 and GSS-00C7 are the pair of packets governing time booster /
fast forward use. GSC-0065 only occurs when the local user activates a
time booster, while GSS-00C7 is announced to everyone, thus actually
activating the time booster effect in the client.

* Masters of the Pangyaverse

GSC-0187, 0188, 0189, 018A, GSS-026E, 026F, 0270, and 0271 are all
related to Character Mastery.

GSC-018B, 018C, GSS-0272, and 0273 are said by other projects to also be
related to Character Mastery, but no examples of them have been
witnessed in order to be certain.

* Black Papel, hero of LaGacha

GSC-0186 and GSS-026C govern the 'big' mode for Black Papel, which are
otherwise identical to standard mode (GSC-014B and GSS-021B). A little
bit of cleanup on existing packets and an example of each type of result
is provided.
  • Loading branch information
EricChiz committed Jun 10, 2023
1 parent fa95d1e commit b448dcf
Show file tree
Hide file tree
Showing 75 changed files with 1,719 additions and 729 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions src/events/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PangYa Event Index
Many packets occur not because of a response or consequence of another packet,
but by a change in game state.

These pages exist primarily to organize the responses to these events together
and adding context and a timeline to often disparate packets.

## Events
[Tournament / Match Ending](/events/match_end.md)
24 changes: 24 additions & 0 deletions src/events/match_end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Tournament / Match End

This event is triggered when all players in tournament/match have holed out or forfeit, and the tournament/match ends.

All matches and tournaments trigger the following packets:
* [GameService Client 0x0006 Match Statistics Submit](/packets/gameservice/client/0006.ksy),
* (unless this event has been triggered by [GameService Client 0x00aa Match Statistics Submit (Tiki Report)](/packets/gameservice/client/00aa.ksy))
* [GameService Server 0x0133 Treasure Point Result](/packets/gameservice/server/0133.ksy),
* (unless there are no items to give)
* [GameService Server 0x0134 Treasure Point Winnings](/packets/gameservice/server/0134.ksy),
* [GameService Server 0x0216 User Status Update](/packets/gameservice/server/0216.ksy),
* [GameService Server 0x022E Achievement Unlocked](/packets/gameservice/server/022e.ksy),
* [GameService Server 0x0220 Achievement Update](/packets/gameservice/server/0220.ksy),
* GameService Server 0x0244 Undocumented, and
* [GameService Server 0x00C8 Pang Balance](/packets/gameservice/server/00c8.ksy).

A match, but not a tournament, also triggers:
* [GameService Server 0x00FA Room Bonus Collectables Result](/packets/gameservice/server/00fa.ksy).

A tournament, but not a match, also triggers:
* [GameService Server 0x00CE Tournament Item Winnings](/packets/gameservice/server/00ce.ksy).

A match or tournament ending also triggers rejoining the waiting area for the room, thus:
* [GameService Server 0x004A Room Settings Announce](/packets/gameservice/server/004a.ksy).
43 changes: 43 additions & 0 deletions src/packets/common/user_caddie_data.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
meta:
id: user_caddie_data
title: User Caddie Data
encoding: ASCII
endian: le
imports:
- id_bank

doc: |
Oft-recurring format for communicating a user's in-game statistics to clients, including:
* [GameService Server 0x004B User Equipment Change Announce](/packets/gameservice/server/004b.ksy)
* [GameService Server 0x0071 User Caddie Roster](/packets/gameservice/server/0071.ksy)
If no caddie is specified (`roster_slot_caddie` and `item_id_caddie` are both 0), the remaining fields may contain garbage data.
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
- id: roster_slot_caddie
type: u4
doc: User-specific roster slot of the relevant caddie.
- id: item_id_caddie
type: u4
doc: From pangya_xx.iff/Caddie.iff. Item ID of the relevant caddie.
enum: id_bank::item_id_caddie
- id: unknown_user_caddie_data_a
size: 4
- id: caddie_level
type: u1
doc: Caddie's achieved level. Can be checked by right clicking on them in My Room.
- id: caddie_xp_amount
type: u4
doc: Caddie's earnt XP. Can be checked by right clicking on them in My Room.
- id: unknown_user_caddie_data_d
size: 8
7 changes: 6 additions & 1 deletion src/packets/common/user_character_data.ksy
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ doc: |
Oft-recurring format for communicating a user's character data to clients, including:
* [Gameservice Server 0x0048 Room Census](/packets/gameservice/server/0048.ksy)
* [Gameservice Server 0x004B User Equipment Announce](/packets/gameservice/server/004b.ksy)
* [Gameservice Server 0x006B Equipment Response](/packets/gameservice/server/006b.ksy)
* [Gameservice Server 0x006B Equipment Update Response](/packets/gameservice/server/006b.ksy)
* [Gameservice Server 0x0070 User Character Roster](/packets/gameservice/server/0070.ksy)
* [Gameservice Server 0x015E User Information Equipment](/packets/gameservice/server/015e.ksy)
* [Gameservice Server 0x0168 User Information](/packets/gameservice/server/0168.ksy)
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
Expand Down
63 changes: 63 additions & 0 deletions src/packets/common/user_course_record_data.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
meta:
id: user_course_record_data
title: User Course Record Data
encoding: ASCII
endian: le
imports:
- id_bank

doc: |
Oft-recurring format for communicating a user's course records to clients, including:
* [GameService Server 0x0045 User Statistics](/packets/gameservice/server/0045.ksy)
* [GameService Server 0x015C User Course Records Response](/packets/gameservice/server/015c.ksy)
Its client-side counterpart is [User Course Result Data](/packets/common/user_course_result_data.ksy).
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
- id: course_id
type: s1
doc: ID of relevant course
enum: id_bank::course_id
- id: course_record_total_strokes
type: u4
doc: User's total strokes on this course, across all matches.
- id: course_record_total_putts
type: u4
doc: User's total putts on this course, across all matches.
- id: match_stat_holes
type: u4
doc: The number of holes played this match.
- id: unknown_user_course_record_d
type: u4
- id: unknown_user_course_record_e
type: u4
- id: unknown_user_course_record_f
type: u4
- id: match_stat_total_score
type: s4
doc: User's total score in this match.
- id: course_record_best_score
type: s1
doc: User's best score on this course for a 18-hole match. 0x7F (127) if not set.
- id: course_record_best_pang
type: u4
doc: User's best pang earnt on this course for a 18-hole match.
- id: unknown_user_course_record_j
size: 4
doc: Always 0x00?
- id: course_record_item_id_character
enum: id_bank::item_id_character
type: u4
doc: From pangya_xx.iff/Character.iff. User's best character on this course for an 18-hole match. 0 if not set.
- id: unknown_user_course_record_k
type: s1
79 changes: 79 additions & 0 deletions src/packets/common/user_course_result_data.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
meta:
id: user_course_result_data
title: User Course Result Data
encoding: ASCII
endian: le
imports:
- id_bank

doc: |
Oft-recurring format for reporting a user's hole or match statistics to the server, including:
* [GameService Client 0x0006 Match Statistics Submit](/packets/gameservice/client/0006.ksy)
* [GameService Client 0x0031 Hole Statistics Submit](/packets/gameservice/client/0031.ksy)
* [GameService Client 0x00AA Match Statistics Submit (Tiki Report)](/packets/gameservice/client/00aa.ksy)
Its server-side counterpart is [User Course Record Data](/packets/common/user_course_record_data.ksy).
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
- id: user_stat_strokes
type: u4
doc: Number of strokes (excluding putts) made during the match.
- id: user_stat_putts
type: u4
doc: Number of putts made during the match.
- id: unknown_user_course_result_data_c
size: 4
doc: Always 0?
- id: unknown_user_course_result_data_d_delta
type: u4
doc: Changes unknown_userdata_d in GSS-0045.
- id: user_stat_longest_drive
type: f4
doc: User's longest drive of the match.
- id: unknown_user_course_result_data_f
type: u4
- id: unknown_user_course_result_data_g
size: 8
- id: user_stat_distance
type: u4
doc: User's total distance travelled in the match. Calculated as the sum of floors of the straight-line distance between initial and final resting positions of the comet.
- id: user_stat_holes_played
type: u4
doc: Unconfirmed. Increments by 1 per hole played.
- id: unknown_user_course_result_data_j
size: 8
doc: Always 0?
- id: unknown_user_course_result_data_s
type: u2
- id: unknown_user_course_result_data_k
type: u4
- id: unknown_user_course_result_data_l
type: u4
- id: user_stat_holes_completed
type: u4
doc: Unconfirmed. Increments by 1 per hole completed. Battle matches can result in failing to hole out, for example, resulting in this number not incrementing.
- id: user_stat_holes_completed_by_putting
type: u4
doc: Unconfirmed. Increments by 1 per hole completed by putting. Chip-ins result in this number not incrementing.
- id: user_stat_longest_putt
type: f4
doc: User's longest successful putt of the match. 0 if no successful putts.
- id: user_stat_longest_chip
type: f4
doc: User's longest successful chip-in of the match. 0 if no successful chip-ins.
- id: unknown_user_course_result_data_q
type: s4
doc: 0xFFFFFFFF (-1) in VS matches and per-hole in tournaments, small positive values at end of tournaments.
- id: unknown_user_course_result_data_r
size: 161
doc: Always 0?
37 changes: 29 additions & 8 deletions src/packets/common/user_equipment_data.ksy
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ doc: |
Oft-recurring format for communicating a user's equipment data to clients, including:
* [GameService Server 0x0044 Unknown](/packets/gameservice/server/0044.ksy)
* [GameService Server 0x0072 User Equipment](/packets/gameservice/server/0072.ksy)
* [GameService Server 0x0156 User Equipment Response](/packets/gameservice/server/0156.ksy)
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
Expand All @@ -34,19 +40,22 @@ seq:
doc: From pangya_xx.iff/Item.iff. Corresponds with the 10 slots available to the user. 0 if unused.
- id: inventory_slot_portrait_background
type: u4
doc: From GameService Server 0x0073 User Inventory. Equipped Portrait Background. 0 if unused.
doc: Inventory slot of equipped Portrait Background. 0 if unused.
- id: inventory_slot_portrait_frame
type: u4
doc: Unconfirmed. From GameService Server 0x0073 User Inventory. Equipped Portrait Frame. 0 if unused.
doc: Unconfirmed. Inventory slot of equipped Portrait Frame. 0 if unused.
- id: inventory_slot_portrait_sticker
type: u4
doc: From GameService Server 0x0073 User Inventory. Equipped Portrait Sticker. 0 if unused.
doc: Inventory slot of equipped Portrait Sticker. 0 if unused.
- id: inventory_slot_portrait_slot
type: u4
doc: From GameService Server 0x0073 User Inventory. Equipped Portrait Slot. 0 if unused.
- id: unknown_user_equipment_data_a
size: 8
doc: All 0?
doc: Inventory slot of equipped Portrait Slot. 0 if unused.
- id: inventory_slot_cut_in
type: u4
doc: Unconfirmed. Inventory slot of equipped Power Shot Cut-In. 0 if unused.
- id: inventory_slot_rank_banner
type: u4
doc: Unconfirmed. Inventory slot of equipped Rank Banner. 0 if unused.
- id: item_id_portrait_background
type: u4
doc: From pangya_xx.iff/Skin.iff. 0 if unused.
Expand All @@ -59,6 +68,18 @@ seq:
- id: item_id_portrait_slot
type: u4
doc: From pangya_xx.iff/Skin.iff. 0 if unused.
- id: item_id_cut_in
type: u4
doc: Unconfirmed. From pangya_xx.iff/Skin.iff. 0 if unused.
- id: item_id_rank_banner
type: u4
doc: Unconfirmed. From pangya_xx.iff/Skin.iff. 0 if unused. Banner displayed instead of rank.
- id: unknown_user_equipment_data_b
size: 20
size: 4
doc: All 0?
- id: item_id_furniture
type: u4
repeat: expr
repeat-expr: 2
doc: From pangya_xx.iff/Furniture.iff. 2 IDs in series. Appears to be posters. No idea why this is here.

71 changes: 71 additions & 0 deletions src/packets/common/user_name_data.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
meta:
id: user_name_data
title: User Name Data
encoding: ASCII
endian: le
imports:
- id_bank

doc: |
Oft-recurring format for communicating a user's display name and guild to clients, including:
* [Gameservice Server 0x0044 Unknown](/packets/gameservice/server/0044.ksy)
* [Gameservice Server 0x0157 User Name Response](/packets/gameservice/server/0157.ksy)
**See Also**:
* [User Caddie Data](/packets/common/user_caddie_data.ksy)
* [User Character Data](/packets/common/user_character_data.ksy)
* [User Course Record Data](/packets/common/user_course_record_data.ksy)
* [User Course Result Data](/packets/common/user_course_result_data.ksy)
* [User Equipment Data](/packets/common/user_equipment_data.ksy)
* [User Name Data](/packets/common/user_name_data.ksy)
* [User Statistic Data](/packets/common/user_statistic_data.ksy)
seq:
- id: room_id
type: u2
doc: Unconfirmed. 0xFFFF (-1) when not in room.
- id: username
type: strz
size: 22
doc: User's account name.
- id: user_nickname
type: strz
size: 22
doc: User's display name.
- id: guild_name
type: strz
size: 21
- id: guild_emblem_id
type: strz
size: 24
doc: Local user's guild's emblem ID. If present, for instance "13579ace", PNG image is downloaded over HTTP from (PangyaTH) 203.107.140.35:50008/_Files/GuildEmblem/13579ace.png
- id: connection_id
type: u4
doc: Unused in GSS-0157.
- id: unknown_user_name_data_a
size: 12
doc: All 0x00?
- id: unknown_user_name_data_b
type: u4
- id: unknown_user_name_data_c
size: 4
doc: All 0x00?
- id: unknown_user_name_data_d
type: u2
- id: unknown_user_name_data_e
size: 6
doc: All 0xFF?
- id: unknown_user_name_data_f
size: 16
- id: username_atnt
type: strz
size: 128
doc: |
Typically the local player's username, appended with "@NT".
Possibly some sort of email or messaging integration?
Occasionally this field is empty.
"faceb###############@NT" also witnessed, suggesting a link to Login-via-Facebook functionality.
- id: user_id
type: u4
doc: Unique ID representing the user.
Loading

0 comments on commit b448dcf

Please sign in to comment.