FXclient-mirror/fx.bundle.js

2 lines
21 KiB
JavaScript
Raw Normal View History

const dictionary = {"gIsTeamGame":"iN","game":"a1","playerId":"e2","playerData":"aV","playerNames":"a1G","gameState":"v9","fontSize":"fontSize","x":"eP","y":"eR","canvas":"h1","gHumans":"jN","playerStates":"yb","fontGeneratorFunction":"b2.ow.q5","rawPlayerNames":"w2","playerBalances":"gK","playerTerritories":"g6","gIsSingleplayer":"jn","gLobbyMaxJoin":"st","SingleplayerMenu":"aO","getSingleplayerPlayerCount":"zd","gMaxPlayers":"eF","gBots":"jk","strs":"a5M","uiSizes":"bR","gap":"gap","i":"z"};
(()=>{"use strict";function e(e){const t=document.createElement("p");t.innerText="Attack Percentage Keybinds";const n=document.createElement("div");n.className="arrayinput";const o=document.createElement("button");return o.innerText="Add",e.append(t,n,o),this.container=n,this.keys=["key","type","value"],this.objectArray=[],this.addObject=function(){this.objectArray.push({key:"",type:"absolute",value:.8}),this.displayObjects(),o.scrollIntoView(!1)},this.update=function(e){this.objectArray=e.attackPercentageKeybinds,this.displayObjects()},o.addEventListener("click",this.addObject.bind(this)),this.displayObjects=function(){if(this.container.innerHTML="",0===this.objectArray.length)return this.container.innerText="No custom attack percentage keybinds added";for(var e=0;e<this.objectArray.length;e++){var t=document.createElement("div");this.keys.forEach((function(n){let o=document.createElement("type"===n?"select":"input");if("type"===n)o.innerHTML='<option value="absolute">Absolute</option><option value="relative">Relative</option>',o.addEventListener("change",this.updateObject.bind(this,e,n));else if("key"===n)o.type="text",o.setAttribute("readonly",""),o.setAttribute("placeholder","No key set"),o.addEventListener("click",this.startKeyInput.bind(this,e,n));else{const t="absolute"===this.objectArray[e].type;o.type=t?"text":"number",t?o.addEventListener("click",this.convertIntoNumberInput.bind(this,e,n),{once:!0}):o.setAttribute("step","0.1"),o.addEventListener("input",this.updateObject.bind(this,e,n))}"value"===n&&"absolute"===this.objectArray[e].type?o.value=100*this.objectArray[e][n]+"%":o.value=this.objectArray[e][n],t.appendChild(o)}),this);var n=document.createElement("button");n.textContent="Delete",n.addEventListener("click",this.deleteObject.bind(this,e)),t.appendChild(n),this.container.appendChild(t)}},this.startKeyInput=function(e,t,n){n.target.value="Press any key";const o=this.updateObject.bind(this,e,t);n.target.addEventListener("keydown",o,{once:!0}),n.target.addEventListener("blur",(()=>{n.target.removeEventListener("keydown",o),n.target.value=this.objectArray[e][t]}),{once:!0})},this.convertIntoNumberInput=function(e,t,n){n.target.value=n.target.value.slice(0,-1),n.target.type="number",n.target.addEventListener("blur",(()=>{this.displayObjects()}),{once:!0})},this.updateObject=function(e,t,n){if(e>=this.objectArray.length)return;const o="value"===t?"absolute"===this.objectArray[e].type?parseFloat(n.target.value)/100:parseFloat(n.target.value):"key"===t?n.key:n.target.value;this.objectArray[e][t]=o,"key"===t&&this.displayObjects()},this.deleteObject=function(e){this.objectArray.splice(e,1),this.displayObjects()},this}const t={count:0,removeWins:function(){confirm("Do you really want to reset your wins?")&&(t.count=0,localStorage.removeItem("fx_winCount"),alert("Successfully reset wins"))}};null!==localStorage.getItem("fx_winCount")&&(t.count=localStorage.getItem("fx_winCount"));const n=t;var o={};const a=document.getElementById("windowContainer");function s(e){o[e.name]=e,o[e.name].isOpen=!1}function i(e){!1!==o[e].isOpen&&(o[e].isOpen=!1,o[e].element.style.display="none",void 0!==o[e].onClose&&o[e].onClose())}function l(){Object.values(o).forEach((function(e){!1!==e.closable&&i(e.name)}))}document.addEventListener("mousedown",(e=>{a.contains(e.target)||l(),m().useFullscreenMode&&p()}),{passive:!0,capture:!0}),document.getElementById("canvasA").addEventListener("touchstart",l,{passive:!0}),document.addEventListener("keydown",(e=>{"Escape"===e.key&&l()}));const r={create:function(e){const t=document.createElement("div");return e.element=t,t.className="window"+(void 0!==e.classes?" "+e.classes:" scrollable selectable"),t.style.display="none",a.appendChild(t),s(e),t},add:s,openWindow:function(e,...t){!0!==o[e].isOpen&&(void 0!==o[e].beforeOpen&&o[e].beforeOpen(...t),o[e].isOpen=!0,o[e].element.style.display=null)},closeWindow:i,closeAll:l};window.__fx=window.__fx||{};const c=window.__fx;var d={displayWinCounter:!0,useFullscreenMode:!1,hoveringTooltip:!0,realisticNames:!1,showPlayerDensity:!0,coloredDensity:!0,de