Alpha v1.1
This commit is contained in:
parent
8b56494400
commit
65093ca0b5
53
admin.php
53
admin.php
@ -41,6 +41,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slug = $_POST['slug'];
|
||||
$icon = $_POST['icon'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
$modifier_ids = isset($_POST['modifiers']) ? $_POST['modifiers'] : [];
|
||||
|
||||
$image_url = null;
|
||||
@ -98,13 +99,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slug = $_POST['slug'];
|
||||
$color = $_POST['color'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE celestial_object_statuses SET name = ?, slug = ?, color = ?, description = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $slug, $color, $description, $id]);
|
||||
$stmt = $db->prepare("UPDATE celestial_object_statuses SET name = ?, slug = ?, color = ?, description = ?, is_blinking = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $slug, $color, $description, $is_blinking, $id]);
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO celestial_object_statuses (name, slug, color, description) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $slug, $color, $description]);
|
||||
$stmt = $db->prepare("INSERT INTO celestial_object_statuses (name, slug, color, description, is_blinking) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $slug, $color, $description, $is_blinking]);
|
||||
}
|
||||
header("Location: admin.php?tab=statuses&success=1");
|
||||
exit;
|
||||
@ -123,6 +125,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$name = $_POST['name'];
|
||||
$slug = $_POST['slug'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE settlement_types SET name = ?, slug = ?, description = ? WHERE id = ?");
|
||||
@ -149,6 +152,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slug = $_POST['slug'];
|
||||
$type = $_POST['type'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE modifiers SET name = ?, slug = ?, type = ?, description = ? WHERE id = ?");
|
||||
@ -175,6 +179,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slug = $_POST['slug'];
|
||||
$fa_icon = $_POST['fa_icon'];
|
||||
$color = $_POST['color'];
|
||||
$is_playable = isset($_POST['is_playable']) ? 1 : 0;
|
||||
$image_url = null;
|
||||
$alliance_ids = isset($_POST['alliances']) ? $_POST['alliances'] : [];
|
||||
|
||||
@ -192,11 +197,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
}
|
||||
}
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE factions SET name = ?, slug = ?, image_url = ?, fa_icon = ?, color = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color, $id]);
|
||||
$stmt = $db->prepare("UPDATE factions SET name = ?, slug = ?, image_url = ?, fa_icon = ?, color = ?, is_playable = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color, $is_playable, $id]);
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO factions (name, slug, image_url, fa_icon, color) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color]);
|
||||
$stmt = $db->prepare("INSERT INTO factions (name, slug, image_url, fa_icon, color, is_playable) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $slug, $image_url, $fa_icon, $color, $is_playable]);
|
||||
$id = $db->lastInsertId();
|
||||
}
|
||||
|
||||
@ -227,6 +232,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$slug = $_POST['slug'];
|
||||
$icon = $_POST['icon'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
$show_in_header = isset($_POST["show_in_header"]) ? 1 : 0;
|
||||
|
||||
$image_url = null;
|
||||
@ -273,6 +279,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
||||
$name = $_POST['name'];
|
||||
$slug = $_POST['slug'];
|
||||
$description = $_POST['description'];
|
||||
$is_blinking = isset($_POST['is_blinking']) ? 1 : 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE lootboxes SET name = ?, slug = ?, description = ? WHERE id = ?");
|
||||
@ -414,6 +421,7 @@ if ($tab === 'users') {
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css?v=<?php echo time(); ?>" rel="stylesheet">
|
||||
<style>
|
||||
.blink { animation: blinker 1s linear infinite; } @keyframes blinker { 50% { opacity: 0; } }
|
||||
body { background: #000; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; }
|
||||
header { background: #1a202c; padding: 10px 20px; border-bottom: 2px solid #2d3545; display: flex; justify-content: space-between; align-items: center; }
|
||||
.nav-links a { color: #88c0d0; text-decoration: none; margin-right: 20px; font-weight: bold; font-size: 14px; }
|
||||
@ -710,6 +718,11 @@ if ($tab === 'users') {
|
||||
<label>Couleur</label>
|
||||
<div class="color-group">
|
||||
<input type="color" id="st_color_picker" class="color-picker-input" oninput="document.getElementById('st_color').value = this.value">
|
||||
<div style="margin-top: 5px;">
|
||||
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9em;">
|
||||
<input type="checkbox" name="is_blinking" id="st_is_blinking" value="1"> Clignotement
|
||||
</label>
|
||||
</div>
|
||||
<input type="text" name="color" id="st_color" required placeholder="#ef4444" oninput="document.getElementById('st_color_picker').value = this.value">
|
||||
</div>
|
||||
</div>
|
||||
@ -728,7 +741,7 @@ if ($tab === 'users') {
|
||||
<tbody>
|
||||
<?php foreach ($statuses_list as $s): ?>
|
||||
<tr>
|
||||
<td><div style="width: 20px; height: 20px; background: <?php echo $s['color']; ?>; border: 1px solid #fff;"></div></td>
|
||||
<td><div style="width: 20px; height: 20px; background: <?php echo $s['color']; ?>; border: 1px solid #fff;" class="<?php echo ($s['is_blinking'] ?? 0) ? 'blink' : ''; ?>"></div></td>
|
||||
<td><strong><?php echo htmlspecialchars($s['name']); ?></strong></td>
|
||||
<td><code><?php echo htmlspecialchars($s['slug']); ?></code></td>
|
||||
<td>
|
||||
@ -815,6 +828,13 @@ if ($tab === 'users') {
|
||||
<input type="file" name="image" accept="image/png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; gap: 20px; margin-bottom: 15px; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 4px; border: 1px solid #334155;">
|
||||
<div style="flex: 1; display: flex; align-items: center; gap: 10px;">
|
||||
<input type="checkbox" name="is_playable" id="fac_is_playable" style="width: auto;">
|
||||
<label for="fac_is_playable" style="margin-bottom: 0; cursor: pointer;">Accessible aux joueurs (Jouable)</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="font-size: 12px; color: #8c92a3;">Alliances (Réciprocité automatique)</label>
|
||||
@ -836,7 +856,7 @@ if ($tab === 'users') {
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead><tr><th>Couleur</th><th>Visuel</th><th>Nom</th><th>Slug</th><th>Alliances</th><th>Actions</th></tr></thead>
|
||||
<thead><tr><th>Couleur</th><th>Visuel</th><th>Nom</th><th>Slug</th><th>Jouable</th><th>Alliances</th><th>Actions</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($factions_list as $f): ?>
|
||||
<tr>
|
||||
@ -852,6 +872,13 @@ if ($tab === 'users') {
|
||||
</td>
|
||||
<td><strong><?php echo htmlspecialchars($f['name']); ?></strong></td>
|
||||
<td><code><?php echo htmlspecialchars($f['slug']); ?></code></td>
|
||||
<td style="text-align: center;">
|
||||
<?php if ($f['is_playable']): ?>
|
||||
<span style="color: #a3be8c; font-weight: bold;">Oui</span>
|
||||
<?php else: ?>
|
||||
<span style="color: #bf616a; font-weight: bold;">Non</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<small>
|
||||
<?php
|
||||
@ -1173,12 +1200,14 @@ if ($tab === 'users') {
|
||||
document.getElementById('st_color_picker').value = data.color.startsWith('#') ? data.color : '#000000';
|
||||
}
|
||||
document.getElementById('st_desc').value = data.description;
|
||||
document.getElementById('st_is_blinking').checked = data.is_blinking == 1;
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
function resetStatusForm() {
|
||||
document.getElementById('statusForm').reset();
|
||||
document.getElementById('st_id').value = 0;
|
||||
document.getElementById('st_color_picker').value = '#000000';
|
||||
document.getElementById('st_is_blinking').checked = false;
|
||||
}
|
||||
|
||||
function editSettlementType(data) {
|
||||
@ -1210,6 +1239,7 @@ if ($tab === 'users') {
|
||||
document.getElementById('fac_color_picker').value = color.startsWith('#') ? color : '#808080';
|
||||
}
|
||||
document.getElementById('fac_fa_icon').value = data.fa_icon || '';
|
||||
document.getElementById('fac_is_playable').checked = data.is_playable == 1;
|
||||
|
||||
// Handle Alliances
|
||||
document.querySelectorAll('.alliance-checkbox').forEach(cb => cb.checked = false);
|
||||
@ -1232,6 +1262,7 @@ if ($tab === 'users') {
|
||||
document.getElementById('fac_id').value = 0;
|
||||
document.getElementById('fac_color').value = '#808080';
|
||||
document.getElementById('fac_color_picker').value = '#808080';
|
||||
document.getElementById('fac_is_playable').checked = false;
|
||||
document.querySelectorAll('.alliance-checkbox').forEach(cb => cb.checked = false);
|
||||
document.querySelectorAll('.alliance-label').forEach(lbl => lbl.style.display = 'flex');
|
||||
}
|
||||
@ -1343,4 +1374,4 @@ if ($tab === 'users') {
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
11
db/add_is_blinking_to_statuses.php
Normal file
11
db/add_is_blinking_to_statuses.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
try {
|
||||
$db = db();
|
||||
$db->exec("ALTER TABLE celestial_object_statuses ADD COLUMN is_blinking TINYINT(1) DEFAULT 0");
|
||||
echo "Column 'is_blinking' added successfully to 'celestial_object_statuses'.\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "Error adding column: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
11
db/add_is_playable_to_factions.php
Normal file
11
db/add_is_playable_to_factions.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
$db = db();
|
||||
|
||||
try {
|
||||
$db->exec("ALTER TABLE factions ADD COLUMN is_playable TINYINT(1) DEFAULT 0");
|
||||
echo "Column 'is_playable' added successfully to 'factions' table.\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
@ -269,8 +269,24 @@ if ($view === 'sector') {
|
||||
}
|
||||
|
||||
function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
if ($type === 'empty') return 'rgba(255,255,255,0.05)';
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
return $statuses_map[$status]['color'] ?? 'rgba(255,255,255,0.05)';
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@ -281,6 +297,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css?v=<?php echo time(); ?>" rel="stylesheet">
|
||||
<style>
|
||||
.blink { animation: blinker 1s linear infinite; } @keyframes blinker { 50% { opacity: 0; } }
|
||||
body { background: #0b0f19; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; }
|
||||
header { background: #1a202c; padding: 10px 20px; border-bottom: 2px solid #2d3545; display: flex; justify-content: space-between; align-items: center; }
|
||||
.container { padding: 40px; display: flex; flex-direction: column; align-items: center; }
|
||||
@ -442,7 +459,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
$dotColor = 'rgba(255,255,255,0.05)';
|
||||
if (isset($sector_data[$s][$p])) { $dotColor = getStatusColor($sector_data[$s][$p]['status'], $sector_data[$s][$p]['type'], $statuses_map, $object_types_map); }
|
||||
?>
|
||||
<div class="mini-dot" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<div class="mini-dot <?php echo isStatusBlinking($sector_data[$s][$p]['status'], $statuses_map) ? 'blink' : ''; ?>" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<div style="font-size: 14px; font-weight: bold; margin-top: 5px;">SECTEUR <?php echo $s; ?></div>
|
||||
@ -494,7 +511,7 @@ function getStatusColor($status, $type, $statuses_map, $object_types_map) {
|
||||
<?php if ($imageUrl): ?>
|
||||
<img src="<?php echo htmlspecialchars($imageUrl); ?>?v=<?php echo time(); ?>" class="object-image">
|
||||
<?php else: ?>
|
||||
<i class="fa-solid <?php echo $icon; ?>" style="color: <?php echo $color; ?>;"></i>
|
||||
<i class="fa-solid <?php echo $icon; ?> <?php echo isStatusBlinking($obj['status'], $statuses_map) ? 'blink' : ''; ?>" style="color: <?php echo $color; ?>;"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<span class="object-name"><?php echo htmlspecialchars($obj['name']); ?></span>
|
||||
|
||||
20
index.php
20
index.php
@ -139,7 +139,19 @@ if ($view === 'sector') {
|
||||
}
|
||||
|
||||
function getStatusColor($status, $statuses_map) {
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
return $statuses_map[$status]['color'] ?? 'rgba(255,255,255,0.05)';
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
function isStatusBlinking($status, $statuses_map) {
|
||||
return ($statuses_map[$status]["is_blinking"] ?? 0) == 1;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@ -150,6 +162,7 @@ function getStatusColor($status, $statuses_map) {
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css?v=<?php echo time(); ?>" rel="stylesheet">
|
||||
<style>
|
||||
.blink { animation: blinker 1s linear infinite; } @keyframes blinker { 50% { opacity: 0; } }
|
||||
body { background: #000; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; }
|
||||
#main-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
|
||||
.user-auth-bar { display: flex; justify-content: flex-end; gap: 20px; font-size: 11px; color: #8c92a3; margin-bottom: 10px; }
|
||||
@ -593,7 +606,7 @@ function getStatusColor($status, $statuses_map) {
|
||||
<?php if ($imageUrl): ?>
|
||||
<img src="<?php echo htmlspecialchars($imageUrl); ?>?v=<?php echo time(); ?>" class="object-image">
|
||||
<?php else: ?>
|
||||
<i class="fa-solid <?php echo $icon; ?>" style="color: <?php echo $color; ?>;"></i>
|
||||
<i class="fa-solid <?php echo $icon; ?> <?php echo isStatusBlinking($obj['status'], $statuses_map) ? 'blink' : ''; ?>" style="color: <?php echo $color; ?>;"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<span class="object-name"><?php echo htmlspecialchars($obj['name']); ?></span>
|
||||
@ -612,7 +625,7 @@ function getStatusColor($status, $statuses_map) {
|
||||
$dotColor = 'rgba(255,255,255,0.05)';
|
||||
if (isset($sector_data[$s][$p])) { $dotColor = getStatusColor($sector_data[$s][$p]['status'], $statuses_map); }
|
||||
?>
|
||||
<div class="mini-dot" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<div class="mini-dot <?php echo isStatusBlinking($sector_data[$s][$p]['status'], $statuses_map) ? 'blink' : ''; ?>" style="background-color: <?php echo $dotColor; ?>;"></div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<div style="font-size: 10px; color: #88c0d0;">SECTEUR</div>
|
||||
@ -627,7 +640,7 @@ function getStatusColor($status, $statuses_map) {
|
||||
|
||||
<div class="legend">
|
||||
<?php foreach($statuses_db as $s): ?>
|
||||
<div class="legend-item"><span class="dot" style="background: <?php echo $s['color']; ?>;"></span> <?php echo $s['name']; ?></div>
|
||||
<div class="legend-item"><span class="dot <?php echo ($s['is_blinking'] ?? 0) ? 'blink' : ''; ?>" style="background: <?php echo $s['color']; ?>;"></span> <?php echo $s['name']; ?></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</main>
|
||||
@ -696,6 +709,7 @@ function getStatusColor($status, $statuses_map) {
|
||||
document.getElementById('m-planet-img').src = typeInfo.image_url || '';
|
||||
document.getElementById('m-planet-status').innerText = statusInfo.name || data.status;
|
||||
document.getElementById('m-planet-status').style.background = statusInfo.color || 'rgba(255,255,255,0.1)';
|
||||
document.getElementById('m-planet-status').classList.toggle('blink', statusInfo.is_blinking == 1);
|
||||
document.getElementById('m-planet-faction').innerText = 'Faction dominante: ' + factionInfo.name;
|
||||
document.getElementById('m-planet-faction').style.color = factionInfo.color || '#fff';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user