911 lines
44 KiB
HTML
911 lines
44 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ player.player_name if player else 'Player' }} - Dune Awakening Dashboard{% endblock %}
|
|
{% block content %}
|
|
|
|
{% if tunnel_down %}
|
|
<div class="error-banner danger">
|
|
<strong>SSH Tunnel Not Detected</strong><br>
|
|
Start the SSH tunnel first, then refresh.
|
|
</div>
|
|
{% elif db_error %}
|
|
<div class="error-banner danger"><strong>Database Error:</strong> {{ db_error }}</div>
|
|
{% elif not_found %}
|
|
<div class="error-banner danger"><strong>Player Not Found</strong><br>The requested player character does not exist.</div>
|
|
{% else %}
|
|
|
|
<div class="page-header">
|
|
<h1>{{ player.player_name }}</h1>
|
|
<p>Actor ID: {{ player.id }} · Controller ID: {{ player.player_controller_id or 'N/A' }}
|
|
{% if player.online_status %}
|
|
· <span class="badge badge-{{ player.online_status.lower() }}">{{ player.online_status }}</span>
|
|
{% endif %}
|
|
{% if player.life_state %}
|
|
· <span class="badge badge-{{ player.life_state.lower() }}">{{ player.life_state }}</span>
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
|
|
{% if vitals and vitals.max_health %}
|
|
<div class="vitals-bar">
|
|
{% if not is_online %}
|
|
<button onclick="openModal('vitals-modal')" class="btn-edit" style="margin-right:8px;">Edit Vitals</button>
|
|
{% endif %}
|
|
<div class="vitals-item">
|
|
<span class="vitals-label">Health</span>
|
|
<span class="vitals-value" style="color:#e74c3c;">{{ "%.0f"|format(vitals.current_health or 0) }}/{{ "%.0f"|format(vitals.max_health or 0) }}</span>
|
|
{% if is_online %}<span style="font-size:10px;color:#e67e22;margin-left:4px;">(WIP)</span>{% else %}<span style="font-size:10px;color:var(--text-muted);margin-left:4px;">(WIP)</span>{% endif %}
|
|
</div>
|
|
<div class="vitals-divider"></div>
|
|
<div class="vitals-item">
|
|
<span class="vitals-label">Hydration</span>
|
|
<span class="vitals-value" style="color:#3498db;">{{ "%.1f"|format(vitals.current_hydration | float if vitals.current_hydration else 0) }}</span>
|
|
{% if is_online %}<span style="font-size:10px;color:#2ecc71;margin-left:4px;">(live)</span>{% endif %}
|
|
</div>
|
|
<div class="vitals-divider"></div>
|
|
<div class="vitals-item">
|
|
<span class="vitals-label">Spice</span>
|
|
<span class="vitals-value" style="color:#f39c12;">{{ "%.0f"|format(vitals.current_spice | float if vitals.current_spice else 0) }}</span>
|
|
{% if is_online %}<span style="font-size:10px;color:#2ecc71;margin-left:4px;">(live)</span>{% endif %}
|
|
</div>
|
|
{% if vitals.spice_addiction_level is not none or vitals.spice_tolerance is not none %}
|
|
<div class="vitals-divider"></div>
|
|
<div class="vitals-item">
|
|
<span class="vitals-label">Spice Addiction</span>
|
|
<span class="vitals-value" style="color:#9b59b6;">{{ "%.1f"|format(vitals.spice_addiction_level | float if vitals.spice_addiction_level else 0) }}</span>
|
|
</div>
|
|
<div class="vitals-divider"></div>
|
|
<div class="vitals-item">
|
|
<span class="vitals-label">Spice Tolerance</span>
|
|
<span class="vitals-value" style="color:#9b59b6;">{{ "%.1f"|format(vitals.spice_tolerance | float if vitals.spice_tolerance else 0) }}</span>
|
|
</div>
|
|
{% endif %}
|
|
{% if is_online %}
|
|
<div style="width:100%;font-size:11px;color:#e67e22;margin-top:4px;">Player is online — edit vitals only when offline. Health data is currently WIP.</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="detail-section">
|
|
<h2>Account Info</h2>
|
|
<div class="detail-grid">
|
|
<div class="detail-item">
|
|
<div class="dlabel">Character Name</div>
|
|
<div class="dvalue">{{ player.player_name or 'Unknown' }}</div>
|
|
</div>
|
|
<div class="detail-item">
|
|
<div class="dlabel">Funcom ID</div>
|
|
<div class="dvalue">{{ player.funcom_id or 'N/A' }}</div>
|
|
</div>
|
|
<div class="detail-item">
|
|
<div class="dlabel">Email / User</div>
|
|
<div class="dvalue">{{ player.account_email }}</div>
|
|
</div>
|
|
<div class="detail-item">
|
|
<div class="dlabel">Platform ID</div>
|
|
<div class="dvalue" style="font-size:12px;">{{ player.platform_id or 'N/A' }}</div>
|
|
</div>
|
|
<div class="detail-item">
|
|
<div class="dlabel">Map</div>
|
|
<div class="dvalue">{{ player.map or 'N/A' }}</div>
|
|
</div>
|
|
<div class="detail-item">
|
|
<div class="dlabel">Position</div>
|
|
<div class="dvalue" style="font-size:11px;font-family:monospace;">{{ player.transform_text or 'N/A' }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if player.last_login_time or player.last_avatar_activity %}
|
|
<div class="detail-section">
|
|
<h2>Activity</h2>
|
|
<div class="detail-grid">
|
|
{% if player.last_login_time %}
|
|
<div class="detail-item">
|
|
<div class="dlabel">Last Login</div>
|
|
<div class="dvalue">{{ player.last_login_time.strftime('%Y-%m-%d %H:%M UTC') }}</div>
|
|
</div>
|
|
{% endif %}
|
|
{% if player.last_avatar_activity %}
|
|
<div class="detail-item">
|
|
<div class="dlabel">Last Activity</div>
|
|
<div class="dvalue">{{ player.last_avatar_activity.strftime('%Y-%m-%d %H:%M UTC') }}</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px;">
|
|
<div class="card">
|
|
<div class="card-header">Faction
|
|
{% if not is_online %}
|
|
<button onclick="openModal('faction-modal')" class="btn-edit">Edit</button>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
{% if player.faction_name %}
|
|
<span class="badge badge-{{ player.faction_name.lower() }}">{{ player.faction_name }}</span>
|
|
{% if player.utc_time_faction_change %}<br><small style="color:var(--text-light);">Since {{ player.utc_time_faction_change.strftime('%Y-%m-%d') }}</small>{% endif %}
|
|
{% else %}<div class="empty">No faction</div>{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<div class="card-header">Guild</div>
|
|
<div class="card-body">
|
|
{% if guild %}
|
|
<div><a href="/guilds/{{ guild.guild_id }}" style="font-weight:600;">{{ guild.guild_name }}</a></div>
|
|
<div><span class="badge badge-{{ guild.faction_name.lower() if guild.faction_name else 'none' }}">{{ guild.faction_name or 'No faction' }}</span></div>
|
|
<div><span class="badge badge-{{ fmt_role(guild.role_id).lower() }}">{{ fmt_role(guild.role_id) }}</span></div>
|
|
{% if guild.guild_description %}<p style="margin-top:8px;font-size:13px;color:var(--text-light);">{{ guild.guild_description }}</p>{% endif %}
|
|
{% else %}<div class="empty">Not in a guild</div>{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="detail-section">
|
|
<h2>Currencies</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>Currency</th><th>Balance</th></tr></thead>
|
|
<tbody>
|
|
{% for c in currency %}
|
|
<tr>
|
|
<td>{{ c.currency_id | currency_label }}</td>
|
|
<td style="font-weight:600;">{{ c.balance | format_number }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="2" class="empty">No currency data</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<div style="font-size:10px;color:var(--text-muted);padding:4px 8px;">Note: Currency values may be stale due to game server behavior</div>
|
|
</div>
|
|
{% if is_online %}
|
|
<div style="font-size:12px;color:#e67e22;padding:8px 16px;">Player is online — editing disabled. Log out first.</div>
|
|
{% else %}
|
|
<button onclick="openCurrenciesModal()" class="btn-edit" style="margin:8px 16px;">Edit</button>
|
|
{% endif %}
|
|
<div style="font-size:11px;color:var(--text-muted);padding:4px 16px 8px;">Read-only. Balances reflect last game save — game server writes deltas on top of DB value.</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if specialization or tech_knowledge is not none %}
|
|
<div class="detail-section">
|
|
<h2>Specialization & XP
|
|
{% if not is_online %}
|
|
<button onclick="openModal('spec-modal')" class="btn-edit">Edit</button>
|
|
{% endif %}
|
|
</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>Track</th><th>XP</th><th>Level</th></tr></thead>
|
|
<tbody>
|
|
{% for s in specialization %}
|
|
<tr><td>{{ s.track_type }}</td><td>{{ s.xp_amount | format_number }}</td><td>{{ s.level }}</td></tr>
|
|
{% endfor %}
|
|
{% if tech_knowledge is not none %}
|
|
<tr><td>Tech Knowledge Points</td><td>{{ tech_knowledge | format_number }}</td><td>—</td></tr>
|
|
{% endif %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if faction_reputation %}
|
|
<div class="detail-section">
|
|
<h2>Faction Reputation</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>Faction</th><th>Reputation</th></tr></thead>
|
|
<tbody>
|
|
{% for fr in faction_reputation %}
|
|
<tr>
|
|
<td>{{ fr.faction_name }}</td>
|
|
<td style="font-weight:600;">{{ fr.reputation_amount | format_number }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if landsraad_info and landsraad_info.daily_reward_charges is not none %}
|
|
<div class="detail-section">
|
|
<h2>Landsraad</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>Info</th><th>Value</th></tr></thead>
|
|
<tbody>
|
|
{% if landsraad_info.daily_reward_charges is not none %}
|
|
<tr><td>Daily Reward Charges</td><td>{{ landsraad_info.daily_reward_charges }}</td></tr>
|
|
{% endif %}
|
|
{% if landsraad_info.last_viewed_term_id is not none %}
|
|
<tr><td>Last Viewed Term</td><td>{{ landsraad_info.last_viewed_term_id }}</td></tr>
|
|
{% endif %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if vehicles %}
|
|
<div class="detail-section">
|
|
<h2>Vehicles ({{ vehicles|length }})</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>Type</th><th>Name</th><th>Map</th><th>Access</th><th>Position</th></tr></thead>
|
|
<tbody>
|
|
{% for v in vehicles %}
|
|
<tr>
|
|
<td style="font-size:12px;">{{ v.class | class_name }}</td>
|
|
<td>{{ v.actor_name or 'N/A' }}</td>
|
|
<td>{{ v.map or 'N/A' }}</td>
|
|
<td>{% if v.ownership_rank == 1 %}<span class="badge badge-leader">Owner</span>{% elif v.ownership_rank %}<span class="badge badge-officer">Rank {{ v.ownership_rank }}</span>{% endif %}</td>
|
|
<td style="font-size:11px;font-family:monospace;">{{ v.transform_text or '' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if buildings %}
|
|
<div class="detail-section">
|
|
<h2>Buildings ({{ buildings|length }})</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>ID</th><th>Class</th><th>Map</th><th>Instances</th><th>Position</th></tr></thead>
|
|
<tbody>
|
|
{% for b in buildings %}
|
|
<tr>
|
|
<td>{{ b.id }}</td>
|
|
<td style="font-size:12px;">{{ b.class | class_name }}</td>
|
|
<td>{{ b.map or 'N/A' }}</td>
|
|
<td>{{ b.instance_count }}</td>
|
|
<td style="font-size:11px;font-family:monospace;">{{ b.transform_text or '' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if inventories %}
|
|
<div class="detail-section">
|
|
<h2>Inventory</h2>
|
|
{% if is_online %}
|
|
<div style="font-size:12px;color:#e67e22;padding:0 16px 8px;">Player is online — editing disabled. Log out first.</div>
|
|
{% endif %}
|
|
<div class="card">
|
|
<div class="card-body">
|
|
{% for inv in primary_inventories %}
|
|
{% if inv.inventory_type == 0 %}
|
|
<div class="inv-section-header">
|
|
<span>{{ inv.inventory_type | inv_label }}<span class="inv-meta">(ID: {{ inv.id }}, Slots: {{ inv.max_item_count or '?' }}, Volume: {{ inv.max_item_volume or '?' }})</span></span>
|
|
{% if not is_online %}
|
|
<button onclick="openAddItemModal({{ inv.id }})" class="btn-edit" style="font-size:11px;padding:2px 8px;">+ Add Item</button>
|
|
{% endif %}
|
|
</div>
|
|
<div class="inv-grid">
|
|
{% for item in inv.item_list %}
|
|
<div class="inv-grid-slot has-item" onclick="openItemEditModal({{ item.id }}, '{{ item.template_id | escapejs }}', {{ item.stack_size }}, {{ item.quality_level or 0 }}, {{ item.durability | default('null') }}, {{ item.max_durability | default('null') }}, {{ item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name" title="{{ item.template_id }}">{{ item.template_id | truncate(20) }}</div>
|
|
{% if item.stack_size and item.stack_size > 1 %}
|
|
<div class="inv-slot-stack">{{ item.stack_size }}</div>
|
|
{% endif %}
|
|
{% if item.ammo %}
|
|
<div class="inv-slot-ammo">🔥{{ item.ammo }}</div>
|
|
{% endif %}
|
|
{% if item.durability and item.max_durability and item.max_durability > 0 %}
|
|
{% set dur_pct = (item.durability / item.max_durability * 100) | int %}
|
|
{% set dur_class = 'low' if dur_pct < 30 else ('medium' if dur_pct < 70 else '') %}
|
|
<div class="inv-slot-durability-bar"><div class="inv-slot-durability-fill {{ dur_class }}" style="width:{{ dur_pct }}%"></div></div>
|
|
{% endif %}
|
|
{% if item.quality_level and item.quality_level > 0 %}
|
|
{% set tier_color = quality_tiers[item.quality_level].color if item.quality_level in quality_tiers else '#9a8a7a' %}
|
|
<div class="inv-slot-quality" style="background:{{ tier_color }}"></div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
{% set item_count = inv.item_list | length %}
|
|
{% set max_slots = inv.max_item_count or 35 %}
|
|
{% for i in range(item_count, max_slots) %}
|
|
<div class="inv-grid-slot" onclick="openAddItemModal({{ inv.id }})">
|
|
<div class="inv-slot-empty-icon">+</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% elif inv.inventory_type == 1 %}
|
|
<div class="inv-section-header">
|
|
<span>{{ inv.inventory_type | inv_label }}<span class="inv-meta">(ID: {{ inv.id }})</span></span>
|
|
{% if not is_online %}
|
|
<button onclick="openAddItemModal({{ inv.id }})" class="btn-edit" style="font-size:11px;padding:2px 8px;">+ Add Item</button>
|
|
{% endif %}
|
|
</div>
|
|
<div class="inv-equipped-grid">
|
|
{% for slot_idx in range(10) %}
|
|
{% set slot_label = equipped_slot_labels[slot_idx] if slot_idx in equipped_slot_labels else 'Slot ' ~ slot_idx %}
|
|
{% set slot_item = inv.item_list | selectattr('position_index', 'equalto', slot_idx) | first %}
|
|
{% if slot_item %}
|
|
<div class="inv-equipped-slot has-item" onclick="openItemEditModal({{ slot_item.id }}, '{{ slot_item.template_id | escapejs }}', {{ slot_item.stack_size }}, {{ slot_item.quality_level or 0 }}, {{ slot_item.durability | default('null') }}, {{ slot_item.max_durability | default('null') }}, {{ slot_item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-equipped-label">{{ slot_label }}</div>
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name" title="{{ slot_item.template_id }}">{{ slot_item.template_id | truncate(15) }}</div>
|
|
{% if slot_item.stack_size and slot_item.stack_size > 1 %}
|
|
<div class="inv-slot-stack">{{ slot_item.stack_size }}</div>
|
|
{% endif %}
|
|
{% if slot_item.ammo %}
|
|
<div class="inv-slot-ammo">🔥{{ slot_item.ammo }}</div>
|
|
{% endif %}
|
|
{% if slot_item.durability and slot_item.max_durability and slot_item.max_durability > 0 %}
|
|
{% set dur_pct = (slot_item.durability / slot_item.max_durability * 100) | int %}
|
|
{% set dur_class = 'low' if dur_pct < 30 else ('medium' if dur_pct < 70 else '') %}
|
|
<div class="inv-slot-durability-bar"><div class="inv-slot-durability-fill {{ dur_class }}" style="width:{{ dur_pct }}%"></div></div>
|
|
{% endif %}
|
|
{% if slot_item.quality_level and slot_item.quality_level > 0 %}
|
|
{% set tier_color = quality_tiers[slot_item.quality_level].color if slot_item.quality_level in quality_tiers else '#9a8a7a' %}
|
|
<div class="inv-slot-quality" style="background:{{ tier_color }}"></div>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="inv-equipped-slot" onclick="openAddItemModal({{ inv.id }})">
|
|
<div class="inv-equipped-label">{{ slot_label }}</div>
|
|
<div style="color:var(--text-muted);opacity:0.3;font-size:20px;">+</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% elif inv.inventory_type == 15 %}
|
|
<div class="inv-section-header">
|
|
<span>{{ inv.inventory_type | inv_label }}<span class="inv-meta">(ID: {{ inv.id }})</span></span>
|
|
{% if not is_online %}
|
|
<button onclick="openAddItemModal({{ inv.id }})" class="btn-edit" style="font-size:11px;padding:2px 8px;">+ Add Item</button>
|
|
{% endif %}
|
|
</div>
|
|
{% if inv.item_list %}
|
|
<div class="inv-key-items">
|
|
{% for item in inv.item_list %}
|
|
<div class="inv-key-item" onclick="openItemEditModal({{ item.id }}, '{{ item.template_id | escapejs }}', {{ item.stack_size }}, {{ item.quality_level or 0 }}, {{ item.durability | default('null') }}, {{ item.max_durability | default('null') }}, {{ item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name">{{ item.template_id }}</div>
|
|
{% if item.stack_size and item.stack_size > 1 %}
|
|
<span style="font-size:11px;color:var(--text-muted);">x{{ item.stack_size }}</span>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p style="color:var(--text-muted);font-size:13px;">(empty)</p>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<div class="inv-section-header">
|
|
<span>{{ inv.inventory_type | inv_label }} (ID: {{ inv.id }})</span>
|
|
{% if not is_online %}
|
|
<button onclick="openAddItemModal({{ inv.id }})" class="btn-edit" style="font-size:11px;padding:2px 8px;">+ Add Item</button>
|
|
{% endif %}
|
|
</div>
|
|
{% if inv.item_list %}
|
|
<div class="inv-grid" style="grid-template-columns:repeat(auto-fill, minmax(64px, 1fr));">
|
|
{% for item in inv.item_list %}
|
|
<div class="inv-grid-slot has-item" onclick="openItemEditModal({{ item.id }}, '{{ item.template_id | escapejs }}', {{ item.stack_size }}, {{ item.quality_level or 0 }}, {{ item.durability | default('null') }}, {{ item.max_durability | default('null') }}, {{ item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name" title="{{ item.template_id }}">{{ item.template_id | truncate(15) }}</div>
|
|
{% if item.stack_size and item.stack_size > 1 %}
|
|
<div class="inv-slot-stack">{{ item.stack_size }}</div>
|
|
{% endif %}
|
|
{% if item.ammo %}
|
|
<div class="inv-slot-ammo">🔥{{ item.ammo }}</div>
|
|
{% endif %}
|
|
{% if item.durability and item.max_durability and item.max_durability > 0 %}
|
|
{% set dur_pct = (item.durability / item.max_durability * 100) | int %}
|
|
{% set dur_class = 'low' if dur_pct < 30 else ('medium' if dur_pct < 70 else '') %}
|
|
<div class="inv-slot-durability-bar"><div class="inv-slot-durability-fill {{ dur_class }}" style="width:{{ dur_pct }}%"></div></div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p style="color:var(--text-muted);font-size:13px;">(empty)</p>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if unknown_inventories %}
|
|
<div class="inv-unknown-section">
|
|
<button class="inv-unknown-toggle" onclick="toggleUnknownSection(this)">
|
|
<span>Other / Unknown Items ({{ unknown_inventories|map(attribute='item_list')|map('length')|sum }})</span>
|
|
<span class="arrow">▶</span>
|
|
</button>
|
|
<div class="inv-unknown-content">
|
|
{% for inv in unknown_inventories %}
|
|
<div class="inv-unknown-sub">
|
|
<div class="inv-unknown-sub-header">{{ inv.inventory_type | inv_label }} (ID: {{ inv.id }})</div>
|
|
{% if inv.item_list %}
|
|
<div class="inv-unknown-grid">
|
|
{% for item in inv.item_list %}
|
|
<div class="inv-grid-slot has-item" onclick="openItemEditModal({{ item.id }}, '{{ item.template_id | escapejs }}', {{ item.stack_size }}, {{ item.quality_level or 0 }}, {{ item.durability | default('null') }}, {{ item.max_durability | default('null') }}, {{ item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name" title="{{ item.template_id }}">{{ item.template_id | truncate(20) }}</div>
|
|
{% if item.stack_size and item.stack_size > 1 %}
|
|
<div class="inv-slot-stack">{{ item.stack_size }}</div>
|
|
{% endif %}
|
|
{% if item.ammo %}
|
|
<div class="inv-slot-ammo">🔥{{ item.ammo }}</div>
|
|
{% endif %}
|
|
{% if item.durability and item.max_durability and item.max_durability > 0 %}
|
|
{% set dur_pct = (item.durability / item.max_durability * 100) | int %}
|
|
{% set dur_class = 'low' if dur_pct < 30 else ('medium' if dur_pct < 70 else '') %}
|
|
<div class="inv-slot-durability-bar"><div class="inv-slot-durability-fill {{ dur_class }}" style="width:{{ dur_pct }}%"></div></div>
|
|
{% endif %}
|
|
{% if item.quality_level and item.quality_level > 0 %}
|
|
{% set tier_color = quality_tiers[item.quality_level].color if item.quality_level in quality_tiers else '#9a8a7a' %}
|
|
<div class="inv-slot-quality" style="background:{{ tier_color }}"></div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p style="color:var(--text-muted);font-size:11px;">(empty)</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% for inv in other_inventories %}
|
|
<div class="inv-section-header">
|
|
<span>{{ inv.inventory_type | inv_label }} (ID: {{ inv.id }})</span>
|
|
{% if not is_online %}
|
|
<button onclick="openAddItemModal({{ inv.id }})" class="btn-edit" style="font-size:11px;padding:2px 8px;">+ Add Item</button>
|
|
{% endif %}
|
|
</div>
|
|
{% if inv.item_list %}
|
|
<div class="inv-grid" style="grid-template-columns:repeat(auto-fill, minmax(64px, 1fr));">
|
|
{% for item in inv.item_list %}
|
|
<div class="inv-grid-slot has-item" onclick="openItemEditModal({{ item.id }}, '{{ item.template_id | escapejs }}', {{ item.stack_size }}, {{ item.quality_level or 0 }}, {{ item.durability | default('null') }}, {{ item.max_durability | default('null') }}, {{ item.ammo | default('null') }}, {{ inv.id }})">
|
|
<div class="inv-slot-icon">📦</div>
|
|
<div class="inv-slot-name" title="{{ item.template_id }}">{{ item.template_id | truncate(15) }}</div>
|
|
{% if item.stack_size and item.stack_size > 1 %}
|
|
<div class="inv-slot-stack">{{ item.stack_size }}</div>
|
|
{% endif %}
|
|
{% if item.ammo %}
|
|
<div class="inv-slot-ammo">🔥{{ item.ammo }}</div>
|
|
{% endif %}
|
|
{% if item.durability and item.max_durability and item.max_durability > 0 %}
|
|
{% set dur_pct = (item.durability / item.max_durability * 100) | int %}
|
|
{% set dur_class = 'low' if dur_pct < 30 else ('medium' if dur_pct < 70 else '') %}
|
|
<div class="inv-slot-durability-bar"><div class="inv-slot-durability-fill {{ dur_class }}" style="width:{{ dur_pct }}%"></div></div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p style="color:var(--text-muted);font-size:13px;">(empty)</p>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if landclaims %}
|
|
<div class="detail-section">
|
|
<h2>Land Claims ({{ landclaims|length }})</h2>
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead><tr><th>ID</th><th>Class</th><th>Map</th><th>Position</th></tr></thead>
|
|
<tbody>
|
|
{% for lc in landclaims %}
|
|
<tr>
|
|
<td>{{ lc.id }}</td>
|
|
<td style="font-size:12px;">{{ lc.class | class_name }}</td>
|
|
<td>{{ lc.map or 'N/A' }}</td>
|
|
<td style="font-size:11px;font-family:monospace;">{{ lc.transform_text or '' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Faction Edit Modal -->
|
|
<div id="faction-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal('faction-modal')">
|
|
<div class="modal">
|
|
<h3>Edit Faction</h3>
|
|
<form id="faction-form" onsubmit="return submitEdit(this, '/api/edit_faction')">
|
|
<input type="hidden" name="player_controller_id" value="{{ player.player_controller_id or '' }}">
|
|
<label>Faction:
|
|
<select name="faction_id">
|
|
<option value="1" {% if player.faction_id == 1 %}selected{% endif %}>Atreides</option>
|
|
<option value="2" {% if player.faction_id == 2 %}selected{% endif %}>Harkonnen</option>
|
|
<option value="3" {% if player.faction_id == 3 %}selected{% endif %}>None</option>
|
|
<option value="4" {% if player.faction_id == 4 %}selected{% endif %}>Smuggler</option>
|
|
</select>
|
|
</label>
|
|
<div class="modal-actions">
|
|
<button type="submit" class="btn-save">Save</button>
|
|
<button type="button" onclick="closeModal('faction-modal')" class="btn-cancel">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Vitals Edit Modal -->
|
|
<div id="vitals-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal('vitals-modal')">
|
|
<div class="modal" style="max-width:500px;">
|
|
<h3>Edit Vitals</h3>
|
|
<p style="font-size:12px;color:var(--text-muted);margin-bottom:12px;">Health editing is currently <strong>WIP</strong>. Hydration/Spice are clamped at 0.</p>
|
|
<form id="vitals-form" onsubmit="return submitVitalsEdit()">
|
|
<input type="hidden" name="pawn_id" value="{{ player.state_pawn_id or player.id }}">
|
|
<label>Current Health:
|
|
<input type="number" name="current_health" step="1" min="0" max="{{ vitals.max_health | int if vitals.max_health else 150 }}" value="{{ "%.0f"|format(vitals.current_health or 0) }}" style="width:100px;">
|
|
</label>
|
|
<label>Max Health (WIP):
|
|
<input type="number" name="max_health" step="1" min="0" max="9999" value="{{ "%.0f"|format(vitals.max_health or 150) }}" style="width:100px;">
|
|
</label>
|
|
<label>Hydration:
|
|
<input type="number" name="current_hydration" step="0.1" min="0" value="{{ "%.1f"|format(vitals.current_hydration | float if vitals.current_hydration else 0) }}" style="width:100px;">
|
|
</label>
|
|
<label>Spice:
|
|
<input type="number" name="current_spice" step="1" min="0" value="{{ "%.0f"|format(vitals.current_spice | float if vitals.current_spice else 0) }}" style="width:100px;">
|
|
</label>
|
|
<div class="modal-actions">
|
|
<button type="submit" class="btn-save">Save</button>
|
|
<button type="button" onclick="closeModal('vitals-modal')" class="btn-cancel">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Currencies Edit Modal -->
|
|
<div id="currencies-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal('currencies-modal')">
|
|
<div class="modal" style="max-width:500px;">
|
|
<h3>Edit Currencies</h3>
|
|
<div id="currency-forms"></div>
|
|
<div class="modal-actions" style="margin-top:12px;">
|
|
<button type="button" onclick="closeModal('currencies-modal')" class="btn-cancel">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Specialization/XP Edit Modal -->
|
|
<div id="spec-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal('spec-modal')">
|
|
<div class="modal" style="max-width:500px;">
|
|
<h3>Edit Specialization & XP</h3>
|
|
<form id="spec-form" onsubmit="return submitSpecEdit()">
|
|
<input type="hidden" name="player_id" value="{{ player.player_controller_id or '' }}">
|
|
<label>Tech Knowledge Points (XP):
|
|
<input type="number" name="xp_points" value="{{ tech_knowledge if tech_knowledge is not none else 0 }}" style="width:150px;">
|
|
</label>
|
|
<button type="submit" class="btn-save" style="margin-top:8px;">Save XP</button>
|
|
</form>
|
|
{% for s in specialization %}
|
|
<hr style="margin:12px 0;border-color:var(--border);">
|
|
<form onsubmit="return submitEdit(this, '/api/edit_xp')">
|
|
<input type="hidden" name="player_id" value="{{ player.player_controller_id or '' }}">
|
|
<input type="hidden" name="track_type" value="{{ s.track_type }}">
|
|
<label>{{ s.track_type }} — XP: <input type="number" name="xp_amount" value="{{ s.xp_amount }}" style="width:100px;">
|
|
Level: <input type="number" step="0.1" name="level" value="{{ s.level }}" style="width:80px;">
|
|
</label>
|
|
<button type="submit" class="btn-save" style="font-size:11px;padding:2px 8px;">Save</button>
|
|
</form>
|
|
{% endfor %}
|
|
<div class="modal-actions" style="margin-top:12px;">
|
|
<button type="button" onclick="closeModal('spec-modal')" class="btn-cancel">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Item Modal -->
|
|
<div id="add-item-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal('add-item-modal')">
|
|
<div class="modal">
|
|
<h3>Add Item to Inventory</h3>
|
|
<form id="add-item-form" onsubmit="return submitAddItem()">
|
|
<input type="hidden" id="add-item-inv-id" name="inventory_id" value="">
|
|
<label>Template ID: <input type="text" name="template_id" placeholder="e.g. HealthPackRecipe" style="width:250px;"></label>
|
|
<label>Stack Size: <input type="number" name="stack_size" value="1" style="width:80px;"></label>
|
|
<label>Quality Level: <input type="number" name="quality_level" value="0" style="width:80px;"></label>
|
|
<div class="modal-actions">
|
|
<button type="submit" class="btn-save">Add</button>
|
|
<button type="button" onclick="closeModal('add-item-modal')" class="btn-cancel">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Item Edit Modal -->
|
|
<div id="item-edit-modal" class="modal-overlay item-edit-modal" style="display:none;" onclick="if(event.target===this)closeModal('item-edit-modal')">
|
|
<div class="modal" style="max-width:450px;">
|
|
<h3>Edit Item</h3>
|
|
<div class="item-preview">
|
|
<div class="item-icon">📦</div>
|
|
<div class="item-info">
|
|
<div class="item-name" id="item-edit-name"></div>
|
|
<div class="item-id" id="item-edit-id"></div>
|
|
</div>
|
|
</div>
|
|
<form id="item-edit-form" class="item-edit-form">
|
|
<input type="hidden" id="item-edit-item-id" value="">
|
|
<input type="hidden" id="item-edit-inv-id" value="">
|
|
<div class="form-row">
|
|
<label>Stack Size:</label>
|
|
<input type="number" id="item-edit-stack" min="1" value="1">
|
|
</div>
|
|
<div class="form-row">
|
|
<label>Quality:</label>
|
|
<input type="number" id="item-edit-quality" min="0" max="4" value="0">
|
|
</div>
|
|
<div class="form-row">
|
|
<label>Durability:</label>
|
|
<input type="number" id="item-edit-durability" step="0.1" min="0" placeholder="auto">
|
|
</div>
|
|
<div class="form-row">
|
|
<label>Max Durability:</label>
|
|
<input type="number" id="item-edit-max-durability" step="0.1" min="0" placeholder="auto">
|
|
</div>
|
|
<div class="form-row">
|
|
<label>Ammo:</label>
|
|
<input type="number" id="item-edit-ammo" min="0" placeholder="auto">
|
|
</div>
|
|
<div class="item-edit-actions">
|
|
<button type="button" onclick="submitItemEdit()" class="btn-save">Save</button>
|
|
<button type="button" onclick="submitItemDelete()" class="btn-danger">Delete</button>
|
|
<button type="button" onclick="closeModal('item-edit-modal')" class="btn-cancel">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
function openModal(id) {
|
|
document.getElementById(id).style.display = 'flex';
|
|
}
|
|
function closeModal(id) {
|
|
document.getElementById(id).style.display = 'none';
|
|
}
|
|
|
|
async function submitEdit(form, url) {
|
|
const data = new FormData(form);
|
|
try {
|
|
const resp = await csrfFetch(url, { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
alert('Saved successfully!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
async function submitSpecEdit() {
|
|
const form = document.getElementById('spec-form');
|
|
const data = new FormData(form);
|
|
try {
|
|
const resp = await csrfFetch('/api/edit_tech_knowledge', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
alert('XP saved!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function openCurrenciesModal() {
|
|
const container = document.getElementById('currency-forms');
|
|
container.innerHTML = '';
|
|
{% for c in currency %}
|
|
{
|
|
const div = document.createElement('div');
|
|
div.style.marginBottom = '12px';
|
|
div.innerHTML = '<label style="display:flex;align-items:center;gap:8px;">{{ c.currency_id | currency_label | safe }}: <span style="font-weight:600;min-width:80px;">{{ c.balance | format_number | safe }}</span> <input type="number" name="new_balance_{{ c.currency_id }}" placeholder="New balance" style="width:150px;"> <button type="button" class="btn-save" style="font-size:11px;padding:2px 8px;" onclick="submitCurrencyEdit({{ c.currency_id }})">Set</button></label>';
|
|
container.appendChild(div);
|
|
}
|
|
{% endfor %}
|
|
openModal('currencies-modal');
|
|
}
|
|
|
|
async function submitCurrencyEdit(currencyId) {
|
|
const input = document.querySelector(`input[name="new_balance_${currencyId}"]`);
|
|
const newBalance = parseInt(input ? input.value : '');
|
|
if (isNaN(newBalance)) {
|
|
alert('Enter a valid balance amount.');
|
|
return;
|
|
}
|
|
const data = new FormData();
|
|
data.append('player_controller_id', '{{ player.player_controller_id }}');
|
|
data.append('currency_id', currencyId);
|
|
data.append('new_balance', newBalance);
|
|
try {
|
|
const resp = await csrfFetch('/api/edit_currency', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
alert('Currency updated successfully!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
}
|
|
|
|
async function submitVitalsEdit() {
|
|
const form = document.getElementById('vitals-form');
|
|
const data = new FormData(form);
|
|
try {
|
|
const resp = await csrfFetch('/api/edit_vitals', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
alert('Vitals updated successfully!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function toggleUnknownSection(btn) {
|
|
const content = btn.nextElementSibling;
|
|
const arrow = btn.querySelector('.arrow');
|
|
content.classList.toggle('open');
|
|
arrow.classList.toggle('open');
|
|
}
|
|
|
|
async function editItem(itemId, field, currentValue) {
|
|
const newValue = prompt(`Edit ${field} for item ${itemId}:`, currentValue);
|
|
if (newValue === null || newValue === currentValue) return;
|
|
const data = new FormData();
|
|
data.append('item_id', itemId);
|
|
data.append('field', field);
|
|
data.append('value', newValue);
|
|
try {
|
|
const resp = await csrfFetch('/api/edit_item', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
}
|
|
|
|
function openItemEditModal(itemId, templateName, stackSize, quality, durability, maxDurability, ammo, invId) {
|
|
document.getElementById('item-edit-item-id').value = itemId;
|
|
document.getElementById('item-edit-inv-id').value = invId;
|
|
document.getElementById('item-edit-name').textContent = templateName;
|
|
document.getElementById('item-edit-id').textContent = 'ID: ' + itemId;
|
|
document.getElementById('item-edit-stack').value = stackSize || 1;
|
|
document.getElementById('item-edit-quality').value = quality || 0;
|
|
document.getElementById('item-edit-durability').value = durability !== null ? durability : '';
|
|
document.getElementById('item-edit-max-durability').value = maxDurability !== null ? maxDurability : '';
|
|
document.getElementById('item-edit-ammo').value = ammo !== null ? ammo : '';
|
|
openModal('item-edit-modal');
|
|
}
|
|
|
|
async function submitItemEdit() {
|
|
const itemId = document.getElementById('item-edit-item-id').value;
|
|
const invId = document.getElementById('item-edit-inv-id').value;
|
|
const stackSize = document.getElementById('item-edit-stack').value;
|
|
const quality = document.getElementById('item-edit-quality').value;
|
|
const durability = document.getElementById('item-edit-durability').value;
|
|
const maxDurability = document.getElementById('item-edit-max-durability').value;
|
|
const ammo = document.getElementById('item-edit-ammo').value;
|
|
|
|
const fields = { stack_size: stackSize, quality_level: quality };
|
|
if (durability) fields.durability = parseFloat(durability);
|
|
if (maxDurability) fields.max_durability = parseFloat(maxDurability);
|
|
if (ammo) fields.ammo = parseInt(ammo);
|
|
|
|
let allSuccess = true;
|
|
for (const [field, value] of Object.entries(fields)) {
|
|
const data = new FormData();
|
|
data.append('item_id', itemId);
|
|
data.append('field', field);
|
|
data.append('value', value);
|
|
try {
|
|
const resp = await csrfFetch('/api/edit_item', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (!result.success) {
|
|
alert('Error updating ' + field + ': ' + (result.error || 'Unknown error'));
|
|
allSuccess = false;
|
|
break;
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
allSuccess = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (allSuccess) {
|
|
closeModal('item-edit-modal');
|
|
location.reload();
|
|
}
|
|
}
|
|
|
|
async function submitItemDelete() {
|
|
const itemId = document.getElementById('item-edit-item-id').value;
|
|
const templateName = document.getElementById('item-edit-name').textContent;
|
|
if (!confirm(`Delete item "${templateName}" (ID: ${itemId})? This cannot be undone.`)) return;
|
|
const data = new FormData();
|
|
data.append('item_id', itemId);
|
|
try {
|
|
const resp = await csrfFetch('/api/delete_item', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
closeModal('item-edit-modal');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
}
|
|
|
|
function openAddItemModal(invId) {
|
|
document.getElementById('add-item-inv-id').value = invId;
|
|
openModal('add-item-modal');
|
|
}
|
|
|
|
async function submitAddItem() {
|
|
const form = document.getElementById('add-item-form');
|
|
const data = new FormData(form);
|
|
try {
|
|
const resp = await csrfFetch('/api/add_item', { method: 'POST', body: data });
|
|
const result = await resp.json();
|
|
if (result.success) {
|
|
alert('Item added successfully!');
|
|
location.reload();
|
|
} else {
|
|
alert('Error: ' + (result.error || 'Unknown error'));
|
|
}
|
|
} catch (e) {
|
|
alert('Error: ' + e.message);
|
|
}
|
|
return false;
|
|
}
|
|
</script>
|
|
{% endblock %} |