Widget:C.WeaponToggle

De Wiki Gla
Revisão de 21h36min de 31 de dezembro de 2025 por Gurren1 (discussão | contribs) (Criou página com '<!-- WEAPON TOGGLE SYSTEM --> <script> (() => { 'use strict'; const { filePathURL } = window.__CBase || {}; function resolveCharacterWeaponIcon()...')
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar

<script>

   (() => {
       'use strict';
       const { filePathURL } = window.__CBase || {};
       function resolveCharacterWeaponIcon() {
           const root = document.querySelector('.character-box');
           if (!root) return null;
           const raw = root.dataset.weaponicon;
           if (!raw || raw.trim() ===  || raw === 'Nada.png') return null;
           return filePathURL ? filePathURL(raw.trim()) : null;
       }
       const i18nTexts = {
           pt: {
               title: 'Visualização com Arma Especial',
               body1: 'Este modo ativa a visualização do personagem equipado com sua arma especial.',
               body2: 'Algumas habilidades são diferentes enquanto estão com a arma equipada, essas habilidades ficam destacadas com borda vermelha.',
               dontShow: 'Não mostrar novamente',
               ok: 'Entendi'
           },
           en: {
               title: 'Special Weapon View',
               body1: 'This mode activates the view of the character equipped with their special weapon.',
               body2: 'Some abilities are different while equipped with the weapon, these abilities are highlighted with a red border.',
               dontShow: "Don't show again",
               ok: 'Got it'
           },
           es: {
               title: 'Visualización con Arma Especial',
               body1: 'Este modo activa la visualización del personaje equipado con su arma especial.',
               body2: 'Algunas habilidades son diferentes mientras están con el arma equipada, estas habilidades quedan destacadas con borde rojo.',
               dontShow: 'No mostrar de nuevo',
               ok: 'Entendido'
           },
           pl: {
               title: 'Widok z Bronią Specjalną',
               body1: 'Ten tryb aktywuje widok postaci wyposażonej w broń specjalną.',
               body2: 'Niektóre umiejętności różnią się podczas posiadania broni, te umiejętności są podświetlone czerwoną obwódką.',
               dontShow: 'Nie pokazuj ponownie',
               ok: 'Rozumiem'
           }
       };
       const getCurrentLang = () => {
           const html = document.documentElement.lang || 'pt-br';
           const norm = html.toLowerCase().split('-')[0];
           return i18nTexts[norm] ? norm : 'pt';
       };
       function showPopup() {
           try {
               if (localStorage.getItem('glaWeaponPopupDismissed') === '1') return;
           } catch (err) { }
           const lang = getCurrentLang();
           const texts = i18nTexts[lang] || i18nTexts.pt;
           const modal = document.createElement('div');
           modal.className = 'weapon-modal-overlay';
           modal.innerHTML = `

${texts.title}

${texts.body1}

${texts.body2}

                   <label><input type="checkbox" id="weapon-dont-show"> ${texts.dontShow}</label>
                   <button class="weapon-modal-btn">${texts.ok}</button>
           `;
           document.body.appendChild(modal);
           modal.querySelector('.weapon-modal-btn').addEventListener('click', () => {
               const checkbox = document.getElementById('weapon-dont-show');
               if (checkbox && checkbox.checked) {
                   try { localStorage.setItem('glaWeaponPopupDismissed', '1'); } catch (x) { }
               }
               modal.remove();
           });
           modal.addEventListener('click', (e) => {
               if (e.target === modal) modal.remove();
           });
       }
       window.__glaWeaponShowPopup = showPopup;
       // Apply weapon icon to toggle button
       const toggleBtn = document.querySelector('.weapon-bar-toggle');
       if (toggleBtn) {
           const iconURL = resolveCharacterWeaponIcon();
           if (iconURL) {
               const img = document.createElement('img');
               img.src = iconURL;
               img.className = 'weapon-toggle-icon';
               img.alt = 'Weapon Toggle';
               toggleBtn.appendChild(img);
           }
       }
   })();

</script>