"""DT_CharacterAbility 데이터 구조 확인 (수정3)"""
import json

with open('../../원본데이터/DataTable.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

assets = data.get('Assets', [])
print(f"총 Assets: {len(assets)}\n")

# DT_CharacterAbility 찾기
dt_char = None
for asset in assets:
    if asset.get('AssetName') == 'DT_CharacterAbility':
        dt_char = asset
        print(f"발견: {asset.get('AssetName')}")
        print(f"  AssetPath: {asset.get('AssetPath')}")
        print(f"  RowStructure: {asset.get('RowStructure')}")
        break

if not dt_char:
    print("DT_CharacterAbility를 찾을 수 없습니다.")
    exit(1)

# Rows 확인
rows = dt_char.get('Rows', [])
print(f"  Rows 개수: {len(rows)}\n")

# 우르드 찾기
print("=== 우르드 데이터 ===")
for row in rows:
    row_name = row.get('RowName', '')
    if 'urud' in row_name.lower():
        print(f"RowName: {row_name}")
        row_data = row.get('Data', {})
        print(f"Data 키: {list(row_data.keys())}\n")

        # attackMontageMap 확인
        if 'attackMontageMap' in row_data:
            attack_map = row_data['attackMontageMap']
            print(f"attackMontageMap 타입: {type(attack_map)}")

            if isinstance(attack_map, dict):
                print("attackMontageMap 내용 (dict):")
                for k, v in attack_map.items():
                    print(f"  [{k}]: {v}")
            elif isinstance(attack_map, list):
                print(f"attackMontageMap 내용 (list, {len(attack_map)}개):")
                for idx, item in enumerate(attack_map):
                    print(f"  [{idx}]: {item}")
            else:
                print(f"attackMontageMap 값: {attack_map}")

# 리옌 찾기
print("\n=== 리옌 데이터 ===")
for row in rows:
    row_name = row.get('RowName', '')
    if 'lian' in row_name.lower():
        print(f"RowName: {row_name}")
        row_data = row.get('Data', {})

        if 'attackMontageMap' in row_data:
            attack_map = row_data['attackMontageMap']
            print(f"attackMontageMap 타입: {type(attack_map)}")

            if isinstance(attack_map, dict):
                print("attackMontageMap 내용 (dict):")
                for k, v in attack_map.items():
                    print(f"  [{k}]: {v}")
            elif isinstance(attack_map, list):
                print(f"attackMontageMap 내용 (list, {len(attack_map)}개):")
                for idx, item in enumerate(attack_map):
                    print(f"  [{idx}]: {item}")
