Spaces:
Running

screepswraper / index.html
LonginAI's picture
Upload index.html with huggingface_hub
464ead0 verified
Raw History Blame Contribute Delete
21.9 kB
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Screeps AI Wrapper</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
:root {
--background-dark: #0a0a0a;
--background-darker: #000000;
--accent-cyan: #00ffff;
--accent-green: #00ff00;
--accent-blue: #0066cc;
--text-light: #ffffff;
--text-gray: #cccccc;
--panel-bg: rgba(0, 20, 20, 0.7);
--border-color: #00aaaa;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Courier New', monospace;
background-color: var(--background-darker);
color: var(--text-light);
height: 100vh;
overflow: hidden;
}
.wrapper {
display: grid;
grid-template-columns: 300px 1fr 350px;
grid-template-rows: 60px 1fr 200px;
grid-template-areas:
"header header header"
"sidebar game chat"
"metrics metrics terminal";
height: 100vh;
gap: 10px;
padding: 10px;
}
/* Header Styles */
.header {
grid-area: header;
background: var(--panel-bg);
border: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}
.login-section {
display: flex;
gap: 15px;
align-items: center;
}
.server-selector {
background: var(--background-dark);
border: 1px solid var(--accent-cyan);
color: var(--accent-cyan);
padding: 8px 15px;
border-radius: 4px;
}
.auth-status {
color: var(--accent-green);
font-weight: bold;
}
/* Sidebar Styles */
.sidebar {
grid-area: sidebar;
background: var(--panel-bg);
border: 1px solid var(--border-color);
display: flex;
flex-direction: column;
overflow: hidden;
}
.file-manager {
flex: 1;
overflow-y: auto;
padding: 15px;
}
.file-tree {
list-style: none;
}
.file-tree li {
margin: 5px 0;
cursor: pointer;
padding: 5px;
border-radius: 3px;
}
.file-tree li:hover {
background: rgba(0, 255, 255, 0.1);
}
.file-tree li.active {
background: rgba(0, 255, 255, 0.2);
color: var(--accent-cyan);
}
.file-actions {
display: flex;
gap: 10px;
padding: 15px;
border-top: 1px solid var(--border-color);
}
.btn {
background: var(--accent-cyan);
color: var(--background-dark);
border: none;
padding: 8px 15px;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
transition: all 0.3s;
}
.btn:hover {
background: var(--background-dark);
color: var(--accent-cyan);
border: 1px solid var(--accent-cyan);
}
.btn.delete {
background: #ff4444;
color: white;
}
.btn.delete:hover {
background: var(--background-dark);
color: #ff4444;
border: 1px solid #ff4444;
}
/* Game Area Styles */
.game-area {
grid-area: game;
background: var(--panel-bg);
border: 1px solid var(--border-color);
display: flex;
flex-direction: column;
}
.game-controls {
padding: 15px;
border-bottom: 1px solid var(--border-color);
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.metrics-display {
display: flex;
gap: 20px;
padding: 10px 15px;
background: rgba(0, 0, 0, 0.3);
}
.metric-item {
text-align: center;
}
.metric-value {
font-size: 1.2em;
color: var(--accent-cyan);
font-weight: bold;
}
.metric-label {
font-size: 0.8em;
color: var(--text-gray);
}
.game-frame {
flex: 1;
border: none;
}
/* Chat Styles */
.chat-panel {
grid-area: chat;
background: var(--panel-bg);
border: 1px solid var(--border-color);
display: flex;
flex-direction: column;
}
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 15px;
display: flex;
flex-direction: column;
gap: 10px;
}
.message {
padding: 10px;
border-radius: 5px;
max-width: 90%;
}
.user-message {
background: rgba(0, 100, 200, 0.3);
align-self: flex-end;
}
.ai-message {
background: rgba(0, 255, 0, 0.1);
align-self: flex-start;
}
.chat-input {
padding: 15px;
border-top: 1px solid var(--border-color);
display: flex;
gap: 10px;
}
.chat-input input {
flex: 1;
background: var(--background-dark);
border: 1px solid var(--accent-cyan);
color: var(--text-light);
padding: 10px;
border-radius: 4px;
}
.chat-input button {
background: var(--accent-cyan);
color: var(--background-dark);
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
}
/* Terminal Styles */
.terminal {
grid-area: terminal;
background: var(--background-dark);
border: 1px solid var(--border-color);
display: flex;
flex-direction: column;
}
.terminal-output {
flex: 1;
padding: 15px;
overflow-y: auto;
font-family: 'Courier New', monospace;
white-space: pre-wrap;
color: var(--accent-green);
}
.terminal-input {
padding: 15px;
border-top: 1px solid var(--border-color);
display: flex;
gap: 10px;
}
.terminal-input input {
flex: 1;
background: var(--background-darker);
border: 1px solid var(--accent-green);
color: var(--accent-green);
padding: 10px;
border-radius: 4px;
font-family: 'Courier New', monospace;
}
/* Responsive Design */
@media (max-width: 1200px) {
.wrapper {
grid-template-columns: 250px 1fr 300px;
}
}
@media (max-width: 992px) {
.wrapper {
grid-template-columns: 200px 1fr;
grid-template-rows: 60px 1fr 1fr 150px;
grid-template-areas:
"header header"
"sidebar game"
"chat chat"
"terminal terminal";
}
}
@media (max-width: 768px) {
.wrapper {
grid-template-columns: 1fr;
grid-template-rows: 60px 1fr 1fr 1fr 150px;
grid-template-areas:
"header"
"sidebar"
"game"
"chat"
"terminal";
}
.game-controls {
flex-direction: column;
}
.metrics-display {
flex-wrap: wrap;
}
}
/* Matrix effect background */
.matrix-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
opacity: 0.05;
pointer-events: none;
}
</style>
</head>
<body>
<canvas class="matrix-bg" id="matrixCanvas"></canvas>
<div class="wrapper">
<!-- Header -->
<div class="header">
<h1>SCIIIEPS AI WRAPPER</h1>
<div class="login-section">
<select class="server-selector" id="serverSelector">
<option value="main">Main Server</option>
<option value="simulation">Simulation Server</option>
<option value="ptr">PTR Server</option>
<option value="custom">Custom Server</option>
</select>
<span class="auth-status" id="authStatus">.AUTHENTICATED</span>
</div>
</div>
<!-- Sidebar - File Manager -->
<div class="sidebar">
<div class="file-manager">
<h3>AI BRANCHES</h3>
<ul class="file-tree" id="fileTree">
<li data-path="economy" class="active">πŸ“ economy</li>
<li data-path="combat">πŸ“ combat</li>
<li data-path="expansion">πŸ“ expansion</li>
<li data-path="utils">πŸ“ utils</li>
<li data-path="main.js">πŸ“„ main.js</li>
</ul>
</div>
<div class="file-actions">
<button class="btn" id="deployBtn">
<i class="fas fa-rocket"></i> DEPLOY
</button>
<button class="btn" id="optimizeBtn">
<i class="fas fa-cogs"></i> OPTIMIZE
</button>
<button class="btn delete" id="deleteBtn">
<i class="fas fa-trash"></i> DELETE
</button>
</div>
</div>
<!-- Game Area -->
<div class="game-area">
<div class="game-controls">
<button class="btn">
<i class="fas fa-play"></i> START MISSION
</button>
<button class="btn">
<i class="fas fa-pause"></i> PAUSE
</button>
<button class="btn">
<i class="fas fa-sync"></i> RESTART
</button>
<button class="btn">
<i class="fas fa-bug"></i> DEBUG MODE
</button>
</div>
<div class="metrics-display">
<div class="metric-item">
<div class="metric-value" id="cpuUsage">78%</div>
<div class="metric-label">CPU USAGE</div>
</div>
<div class="metric-item">
<div class="metric-value" id="gclLevel">5</div>
<div class="metric-label">GCL LEVEL</div>
</div>
<div class="metric-item">
<div class="metric-value" id="roomsCount">12</div>
<div class="metric-label">ROOMS</div>
</div>
<div class="metric-item">
<div class="metric-value" id="creepsCount">86</div>
<div class="metric-label">CREEPS</div>
</div>
</div>
<iframe class="game-frame"
src="https://screeps.com/a/#!/sim"
id="gameFrame"></iframe>
</div>
<!-- Chat Panel -->
<div class="chat-panel">
<div class="chat-messages" id="chatMessages">
<div class="message ai-message">
<strong>SCIIIEPS ASSISTANT:</strong>
Welcome to Screeps AI Wrapper! How can I help you optimize your empire today?
</div>
<div class="message user-message">
<strong>USER:</strong>
Can you generate a new economy manager?
</div>
<div class="message ai-message">
<strong>CODE GENERATOR:</strong>
Generating optimized economy manager code...
</div>
</div>
<div class="chat-input">
<input type="text" id="chatInput" placeholder="Enter command or question...">
<button id="sendChatBtn">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
<!-- Terminal -->
<div class="terminal">
<div class="terminal-output" id="terminalOutput">
> AI system initialized
> Connecting to Screeps server...
> Connection established
> Monitoring room W1N1...
> CPU limit: 78%
> Error: Resource allocation conflict in room W2N3
> Recommended action: Redistribute creeps
> Deploying economy branch...
</div>
<div class="terminal-input">
<input type="text" id="terminalInput" placeholder="> Enter command...">
<button id="sendTerminalBtn">RUN</button>
</div>
</div>
</div>
<script>
// Matrix background effect
const canvas = document.getElementById('matrixCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const chars = "SCIIIEPS01MATRIX";
const charSize = 14;
const columns = canvas.width / charSize;
const drops = [];
for(let i = 0; i < columns; i++) {
drops[i] = Math.floor(Math.random() * canvas.height / charSize);
}
function drawMatrix() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#00ff00';
ctx.font = `${charSize}px monospace`;
for(let i = 0; i < drops.length; i++) {
const text = chars.charAt(Math.floor(Math.random() * chars.length));
ctx.fillText(text, i * charSize, drops[i] * charSize);
if(drops[i] * charSize > canvas.height && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(drawMatrix, 35);
// File manager functionality
let selectedFileTreeItem = null;
document.querySelectorAll('.file-tree li').forEach(item => {
item.addEventListener('click', function() {
if(selectedFileTreeItem) {
selectedFileTreeItem.classList.remove('active');
}
this.classList.add('active');
selectedFileTreeItem = this;
});
});
// Delete functionality
document.getElementById('deleteBtn').addEventListener('click', function() {
if(selectedFileTreeItem) {
const itemName = selectedFileTreeItem.textContent.trim().replace('πŸ“ ', '').replace('πŸ“„ ', '');
if(confirm(`Are you sure you want to delete "${itemName}"?`)) {
selectedFileTreeItem.remove();
selectedFileTreeItem = null;
logToTerminal(`Deleted: ${itemName}`);
}
} else {
alert("Please select a file or folder to delete");
}
});
// Server selection
document.getElementById('serverSelector').addEventListener('change', function() {
const server = this.value;
let url = "https://screeps.com/a/#!/sim";
if(server === "main") {
url = "https://screeps.com/a/#!/overview";
} else if(server === "ptr") {
url = "https://ptr.screeps.com/a/#!/overview";
} else if(server === "custom") {
const customUrl = prompt("Enter custom server URL:");
if(customUrl) {
url = customUrl;
}
}
document.getElementById('gameFrame').src = url;
logToTerminal(`Switched to ${server} server`);
});
// Chat functionality
document.getElementById('sendChatBtn').addEventListener('click', sendMessage);
document.getElementById('chatInput').addEventListener('keypress', function(e) {
if(e.key === 'Enter') {
sendMessage();
}
});
function sendMessage() {
const input = document.getElementById('chatInput');
const message = input.value.trim();
if(message) {
// Add user message
const chatMessages = document.getElementById('chatMessages');
const userMsg = document.createElement('div');
userMsg.className = 'message user-message';
userMsg.innerHTML = `<strong>USER:</strong> ${message}`;
chatMessages.appendChild(userMsg);
// Simulate AI response
setTimeout(() => {
const aiMsg = document.createElement('div');
aiMsg.className = 'message ai-message';
aiMsg.innerHTML = `<strong>SCIIIEPS ASSISTANT:</strong> Processing your request...`;
chatMessages.appendChild(aiMsg);
chatMessages.scrollTop = chatMessages.scrollHeight;
}, 500);
input.value = '';
chatMessages.scrollTop = chatMessages.scrollHeight;
}
}
// Terminal functionality
document.getElementById('sendTerminalBtn').addEventListener('click', executeCommand);
document.getElementById('terminalInput').addEventListener('keypress', function(e) {
if(e.key === 'Enter') {
executeCommand();
}
});
function executeCommand() {
const input = document.getElementById('terminalInput');
const command = input.value.trim();
if(command) {
logToTerminal(`> ${command}`);
// Simulate command execution
setTimeout(() => {
if(command.includes("deploy")) {
logToTerminal("Deploying AI branch...");
logToTerminal("Success: Code deployed to Screeps server");
} else if(command.includes("optimize")) {
logToTerminal("Optimizing code structure...");
logToTerminal("CPU efficiency improved by 12%");
} else {
logToTerminal(`Unknown command: ${command}`);
}
}, 300);
input.value = '';
}
}
function logToTerminal(message) {
const terminal = document.getElementById('terminalOutput');
terminal.textContent += `\n${message}`;
terminal.scrollTop = terminal.scrollHeight;
}
// Deploy functionality
document.getElementById('deployBtn').addEventListener('click', function() {
if(selectedFileTreeItem) {
const branchName = selectedFileTreeItem.dataset.path;
logToTerminal(`Deploying branch: ${branchName}`);
// Simulate deployment
setTimeout(() => {
logToTerminal("Deployment successful!");
}, 1000);
} else {
alert("Please select a branch to deploy");
}
});
// Optimize functionality
document.getElementById('optimizeBtn').addEventListener('click', function() {
if(selectedFileTreeItem) {
const branchName = selectedFileTreeItem.dataset.path;
logToTerminal(`Optimizing branch: ${branchName}`);
// Simulate optimization
setTimeout(() => {
logToTerminal("Optimization complete!");
logToTerminal("Reduced CPU usage by 8%");
}, 1500);
} else {
alert("Please select a branch to optimize");
}
});
// Simulate metrics updates
setInterval(() => {
document.getElementById('cpuUsage').textContent =
Math.floor(Math.random() * 30 + 60) + '%';
document.getElementById('roomsCount').textContent =
Math.floor(Math.random() * 5 + 10);
document.getElementById('creepsCount').textContent =
Math.floor(Math.random() * 20 + 70);
}, 3000);
// Handle window resize
window.addEventListener('resize', function() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
</script>
</body>
</html>