Last active
February 3, 2026 07:48
-
-
Save nuxodin/830f23e85214f4966f4698b07a12c72b 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
| (function() { | |
| // Prüfe ob UI bereits existiert | |
| if (document.getElementById('avatar-tool-ui')) { | |
| document.getElementById('avatar-tool-ui').remove(); | |
| return; | |
| } | |
| // Erstelle UI Container | |
| const ui = document.createElement('div'); | |
| ui.id = 'avatar-tool-ui'; | |
| ui.innerHTML = ` | |
| <style> | |
| #avatar-tool-ui { | |
| position: fixed; | |
| top: 20px; | |
| right: 20px; | |
| width: 320px; | |
| background: white; | |
| border: 2px solid #333; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.3); | |
| z-index: 999999; | |
| font-family: Arial, sans-serif; | |
| font-size: 14px; | |
| } | |
| #avatar-tool-header { | |
| background: #333; | |
| color: white; | |
| padding: 12px; | |
| border-radius: 6px 6px 0 0; | |
| cursor: move; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| #avatar-tool-close { | |
| cursor: pointer; | |
| font-size: 20px; | |
| font-weight: bold; | |
| } | |
| #avatar-tool-content { | |
| padding: 15px; | |
| } | |
| .tool-section { | |
| margin-bottom: 20px; | |
| padding-bottom: 15px; | |
| border-bottom: 1px solid #ddd; | |
| } | |
| .tool-section:last-child { | |
| border-bottom: none; | |
| } | |
| .tool-section h3 { | |
| margin: 0 0 10px 0; | |
| font-size: 16px; | |
| } | |
| .tool-input { | |
| width: 100%; | |
| padding: 8px; | |
| margin: 5px 0; | |
| border: 1px solid #ccc; | |
| border-radius: 4px; | |
| box-sizing: border-box; | |
| } | |
| .tool-button { | |
| width: 100%; | |
| padding: 10px; | |
| background: #4CAF50; | |
| color: white; | |
| border: none; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| font-size: 14px; | |
| margin-top: 5px; | |
| } | |
| .tool-button:hover { | |
| background: #45a049; | |
| } | |
| .tool-button.secondary { | |
| background: #2196F3; | |
| } | |
| .tool-button.secondary:hover { | |
| background: #0b7dda; | |
| } | |
| .tool-button.warning { | |
| background: #FF9800; | |
| } | |
| .tool-button.warning:hover { | |
| background: #e68900; | |
| } | |
| .tool-textarea { | |
| width: 100%; | |
| padding: 8px; | |
| margin: 5px 0; | |
| border: 1px solid #ccc; | |
| border-radius: 4px; | |
| box-sizing: border-box; | |
| font-family: monospace; | |
| font-size: 12px; | |
| min-height: 100px; | |
| } | |
| .tool-status { | |
| margin-top: 8px; | |
| padding: 8px; | |
| border-radius: 4px; | |
| font-size: 12px; | |
| display: none; | |
| } | |
| .tool-status.success { | |
| background: #d4edda; | |
| color: #155724; | |
| display: block; | |
| } | |
| .tool-status.error { | |
| background: #f8d7da; | |
| color: #721c24; | |
| display: block; | |
| } | |
| .button-row { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 8px; | |
| margin-top: 5px; | |
| } | |
| </style> | |
| <div id="avatar-tool-header"> | |
| <span>Avatar Tool</span> | |
| <span id="avatar-tool-close">×</span> | |
| </div> | |
| <div id="avatar-tool-content"> | |
| <div class="tool-section"> | |
| <h3>💰 Adjust Coins</h3> | |
| <input type="number" id="coin-value" class="tool-input" placeholder="Amount (e.g., 999)" value="999"> | |
| <button id="adjust-coins-btn" class="tool-button">Set Coins</button> | |
| <div id="coins-status" class="tool-status"></div> | |
| </div> | |
| <div class="tool-section"> | |
| <h3>👤 Avatar Manager</h3> | |
| <button id="load-random-btn" class="tool-button secondary">Load Random Avatar</button> | |
| <textarea id="avatar-json" class="tool-textarea" placeholder="Paste avatar JSON here...">{}</textarea> | |
| <input type="text" id="avatar-uid" class="tool-input" placeholder="UID (optional, e.g., fav1)" value=""> | |
| <div class="button-row"> | |
| <button id="set-avatar-btn" class="tool-button warning">Set Avatar</button> | |
| <button id="set-favorite-btn" class="tool-button">Set Favorite</button> | |
| </div> | |
| <div id="avatar-status" class="tool-status"></div> | |
| </div> | |
| </div> | |
| `; | |
| document.body.appendChild(ui); | |
| // Draggable functionality | |
| let isDragging = false; | |
| let currentX; | |
| let currentY; | |
| let initialX; | |
| let initialY; | |
| const header = document.getElementById('avatar-tool-header'); | |
| header.addEventListener('mousedown', dragStart); | |
| document.addEventListener('mousemove', drag); | |
| document.addEventListener('mouseup', dragEnd); | |
| function dragStart(e) { | |
| initialX = e.clientX - ui.offsetLeft; | |
| initialY = e.clientY - ui.offsetTop; | |
| isDragging = true; | |
| } | |
| function drag(e) { | |
| if (isDragging) { | |
| e.preventDefault(); | |
| currentX = e.clientX - initialX; | |
| currentY = e.clientY - initialY; | |
| ui.style.left = currentX + 'px'; | |
| ui.style.top = currentY + 'px'; | |
| ui.style.right = 'auto'; | |
| } | |
| } | |
| function dragEnd() { | |
| isDragging = false; | |
| } | |
| // Close button | |
| document.getElementById('avatar-tool-close').addEventListener('click', () => { | |
| ui.remove(); | |
| }); | |
| // Adjust Coins | |
| document.getElementById('adjust-coins-btn').addEventListener('click', () => { | |
| const value = parseInt(document.getElementById('coin-value').value); | |
| const status = document.getElementById('coins-status'); | |
| if (isNaN(value)) { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Please enter a valid number'; | |
| return; | |
| } | |
| try { | |
| if (typeof log !== 'undefined' && log.log) { | |
| log.log({ | |
| event: "adjustCoins", | |
| value: value | |
| }); | |
| status.className = 'tool-status success'; | |
| status.textContent = `✓ Coins adjusted to ${value}`; | |
| } else { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: log.log() not found'; | |
| } | |
| } catch (e) { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: ' + e.message; | |
| } | |
| }); | |
| // Random Avatar Generator | |
| function generateRandomAvatar() { | |
| const colors = ['red', 'blue', 'green', 'yellow', 'purple', 'orange', 'pink', 'cyan', 'brown', 'grey', 'lime', 'lightGreen', 'blueGrey']; | |
| const shades = ['400', '500', '600', '700', '800', '900']; | |
| const skinOptions = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']; | |
| const eyebrowOptions = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']; | |
| const eyeOptions = ['female_asia', 'male', 'male_asia', 'female', 'animal', 'closed']; | |
| const mouthOptions = ['laugh_2', 'smiley', 'neutral', 'neutral_2', 'neutral_3', 'neutral_4', 'friendly', 'friendly_2', 'friendly_3', 'friendly_4', 'laugh', 'laugh_3', 'laugh_4', 'sad', 'sad_2', 'sad_3', 'sad_4', 'cry', 'cry_2', 'cry_3', 'cry_4', 'braces', 'braces_2', 'braces_3', 'braces_4', 'vampire_2', 'vampire_3', 'vampire_4', 'clown']; | |
| const makeupOptions = ['cheeks', 'c', 'e', 'g', 'f']; | |
| const skinConditionOptions = ['vitiligio_a', 'vitiligio_b', 'freckles', 'acne']; | |
| const hairOptions = ['aw', 'a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'ax', 'ay', 'az', 'ba', 'long', 'normal']; | |
| const moustacheOptions = ['a', 'b', 'c', 'd', 'e', 'f']; | |
| const beardOptions = ['a', 'b', 'c', 'd', 'e', 'f']; | |
| const earringOptions = ['simple_l', 'simple_r', 'simple', 'diamond_l', 'diamond_r', 'diamonds', 'stars', 'balls', 'flowers1', 'flowers2', 'feathers', 'diamond1', 'diamond2', 'earbuds', 'creole', 'diamond3']; | |
| const glassesOptions = ['a', 'c', 'v', 'e', 'f', 'g', 'h', 'r', 'i', 'k', 'm', 'n', 'o', 'p', 'q', 's', 't', 'u']; | |
| const maskOptions = ['za', 'w', 'x', 'y', 'z', 'aa', 'ab', 'ac', 'ad', 'ae']; | |
| const headgearOptions = ['witch', 'flower', 'headband', 'sweat_band', 'basque', 'hat', 'bavarian', 'pirate_band', 'pirate_d', 'cap', 'cap_reverse', 'basecap', 'felt_hat', 'homburg', 'melon', 'woolhat', 'woolhat_2', 'woolhat_3', 'woolhat_4', 'lady_hat_1', 'lady_hat_2', 'lady_hat_3', 'lady_hat_4', 'lady_hat_5', 'lady_hat_6', 'snowman', 'agent', 'turban', 'kippa', 'hijab', 'hijab2', 'hijab3', 'hijab4', 'hijab5', 'chador', 'agal', 'reggae', 'tophat', 'tophat_big', 'cowboy', 'desert', 'sheikh', 'turkish', 'russian', 'inka', 'chinese', 'eskimo', 'cape', 'feather1', 'feather2', 'feather3', 'blumenkranz', 'olive_vine', 'bike_helmet', 'pirate_a', 'pirate_b', 'pirate_c', 'carnival', 'princess', 'headphones', 'harlekin', 'party', 'skeleton', 'hairring_alien_1', 'hairring_alien_2', 'hairring_robot', 'hairring_star', 'hairring_ball', 'hairring_cat', 'hairring_animal_1', 'hairring_animal_2', 'mickey', 'hairring_frog', 'rabbit', 'crown', 'wrap', 'cap_sloppy']; | |
| const necklineOptions = ['l', 'j', 'k', 'm', 'n']; | |
| const armsOptions = ['long', 'normal', 'short']; | |
| const pantsOptions = ['normal', 'a_normal', 'long', 'd']; | |
| const randomColor = () => colors[Math.floor(Math.random() * colors.length)] + '.' + shades[Math.floor(Math.random() * shades.length)]; | |
| const randomHex = () => Math.floor(Math.random()*16777215).toString(16).padStart(6, '0').toUpperCase(); | |
| const randomOption = (arr) => arr[Math.floor(Math.random() * arr.length)]; | |
| const maybeOption = (arr, probability = 0.5) => Math.random() < probability ? randomOption(arr) : undefined; | |
| return { | |
| body: { | |
| type: "human", | |
| children: { | |
| human: { | |
| children: { | |
| arms: { | |
| c1: randomColor(), | |
| option: randomOption(armsOptions) | |
| }, | |
| belt: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| coat: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| skin: { | |
| c1: randomHex(), | |
| option: randomOption(skinOptions) | |
| }, | |
| vest: { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| c3: randomColor() | |
| }, | |
| design: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| gloves: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| necklace: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| neckline: { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| option: randomOption(necklineOptions) | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| head: { | |
| type: "human", | |
| children: { | |
| human: { | |
| children: { | |
| eyes: { | |
| c1: randomHex(), | |
| c2: randomHex(), | |
| option: randomOption(eyeOptions) | |
| }, | |
| hair: { | |
| c1: randomHex(), | |
| option: randomOption(hairOptions) | |
| }, | |
| mask: maybeOption(maskOptions, 0.3) ? { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| option: randomOption(maskOptions) | |
| } : {}, | |
| skin: { | |
| c1: randomHex(), | |
| option: randomOption(skinOptions) | |
| }, | |
| beard: maybeOption(beardOptions, 0.3) ? { | |
| c1: randomColor(), | |
| option: randomOption(beardOptions) | |
| } : {}, | |
| mouth: { | |
| c1: randomHex(), | |
| c2: randomColor(), | |
| option: randomOption(mouthOptions) | |
| }, | |
| makeup: maybeOption(makeupOptions, 0.4) ? { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| c3: randomColor(), | |
| option: randomOption(makeupOptions) | |
| } : {}, | |
| earRing: maybeOption(earringOptions, 0.4) ? { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| option: randomOption(earringOptions) | |
| } : {}, | |
| glasses: maybeOption(glassesOptions, 0.3) ? { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| option: randomOption(glassesOptions) | |
| } : {}, | |
| eyebrows: { | |
| c1: randomHex(), | |
| option: randomOption(eyebrowOptions) | |
| }, | |
| hairBack: { | |
| c1: randomHex() | |
| }, | |
| headgear: maybeOption(headgearOptions, 0.5) ? { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| c3: randomColor(), | |
| option: randomOption(headgearOptions) | |
| } : {}, | |
| moustache: maybeOption(moustacheOptions, 0.2) ? { | |
| c1: randomHex(), | |
| option: randomOption(moustacheOptions) | |
| } : {}, | |
| skinCondition: maybeOption(skinConditionOptions, 0.2) ? { | |
| c1: randomHex(), | |
| option: randomOption(skinConditionOptions) | |
| } : {} | |
| } | |
| } | |
| } | |
| }, | |
| legs: { | |
| type: "human", | |
| children: { | |
| human: { | |
| children: { | |
| skin: { | |
| c1: randomHex(), | |
| option: randomOption(skinOptions) | |
| }, | |
| pants: { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| option: randomOption(pantsOptions) | |
| }, | |
| shoes: { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| c3: randomColor() | |
| }, | |
| skirt: { | |
| c1: randomColor(), | |
| c2: randomColor() | |
| }, | |
| wheelChair: { | |
| c1: randomColor(), | |
| c2: randomColor(), | |
| c3: randomColor() | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| shadow: {}, | |
| version: 2 | |
| }; | |
| } | |
| document.getElementById('load-random-btn').addEventListener('click', () => { | |
| const avatar = generateRandomAvatar(); | |
| document.getElementById('avatar-json').value = JSON.stringify(avatar, null, 2); | |
| }); | |
| // Set Avatar (direktes Setzen) | |
| document.getElementById('set-avatar-btn').addEventListener('click', () => { | |
| const jsonText = document.getElementById('avatar-json').value; | |
| const status = document.getElementById('avatar-status'); | |
| try { | |
| const avatarData = JSON.parse(jsonText); | |
| if (typeof log !== 'undefined' && log.log) { | |
| log.log({ | |
| event: "setAvatar", | |
| value: avatarData | |
| }); | |
| status.className = 'tool-status success'; | |
| status.textContent = '✓ Avatar set successfully'; | |
| } else { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: log.log() not found'; | |
| } | |
| } catch (e) { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: Invalid JSON - ' + e.message; | |
| } | |
| }); | |
| // Set Favorite | |
| document.getElementById('set-favorite-btn').addEventListener('click', () => { | |
| const jsonText = document.getElementById('avatar-json').value; | |
| const uid = document.getElementById('avatar-uid').value || 'fav_' + Date.now(); | |
| const status = document.getElementById('avatar-status'); | |
| try { | |
| const avatarData = JSON.parse(jsonText); | |
| if (typeof log !== 'undefined' && log.log) { | |
| log.log({ | |
| event: "setAvatarFavourite", | |
| value: avatarData, | |
| uid: uid | |
| }); | |
| status.className = 'tool-status success'; | |
| status.textContent = `✓ Favorite set with UID: ${uid}`; | |
| } else { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: log.log() not found'; | |
| } | |
| } catch (e) { | |
| status.className = 'tool-status error'; | |
| status.textContent = 'Error: Invalid JSON - ' + e.message; | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment