Created
July 3, 2026 02:57
-
-
Save Yoone/d1347aeba682777a4bbef55d9f1eecd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Decode a Guild Wars 2 Armor Display Case (pt="2") homestead <payload>. | |
| Usage: | |
| ./gw2_armor_display_case.py '<payload text>' | |
| Example payload text: | |
| 'AAADfAYA/8PsdP//AgAAAwAAAINVwYCA64P/AA8AGQAZ/wD/gaj/gAC17gAg;iC8AAJovAAB6LwAAhy8AAKQvAACqLwAAoRkAAA==;RgVGBdgE2ARGBUYF2ATYBEYFRgXYBNgERgUSANgE2ARGBUYF2ATYBIABRgXYBNgEAQABAAEAAQA=;statueattack' | |
| Format: https://wiki.guildwars2.com/wiki/User:Yoone/Armor_Display_Case_Format_Research | |
| """ | |
| import base64 | |
| import struct | |
| import sys | |
| SLOTS = ["Coat", "Boots", "Gloves", "Helm", "Leggings", "Shoulders", "Back"] | |
| def decode_payload(text): | |
| parts = text.strip().split(";") | |
| while parts and parts[-1] == "": # old exports end with a bare ';' | |
| parts.pop() | |
| if len(parts) < 3: | |
| raise ValueError("expected at least 3 ';'-separated blobs") | |
| p1, p2, p3 = (base64.b64decode(parts[i]) for i in range(3)) | |
| pose = parts[3] if len(parts) > 3 else None | |
| skins = struct.unpack("<7I", p2) # 7 x uint32 LE | |
| dyes = struct.unpack("<28H", p3) # 7 x 4 x uint16 LE | |
| slots = [ | |
| {"slot": SLOTS[i], "skin": skins[i], "dyes": list(dyes[i * 4:i * 4 + 4])} | |
| for i in range(7) | |
| ] | |
| return {"appearance_hex": p1.hex(), "slots": slots, "pose": pose} | |
| def print_case(d): | |
| print("Armor Display Case") | |
| print(" pose:", d["pose"] or "(none)") | |
| print(" appearance (p1):", d["appearance_hex"]) | |
| print(" slots:") | |
| for s in d["slots"]: | |
| if s["skin"] == 0: | |
| print(f" {s['slot']:<9} empty") | |
| continue | |
| dyes = ", ".join(str(c) if c else "-" for c in s["dyes"]) | |
| print(f" {s['slot']:<9} skin {s['skin']:<8} dyes: {dyes}") | |
| def main(): | |
| if len(sys.argv) < 2: | |
| print(__doc__) | |
| sys.exit(1) | |
| print_case(decode_payload(sys.argv[1])) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment