const logindb = { loginplayer:[{username:'testuser',password:'testpwd'}] } var loginusername='' var loginpassword='' function addItemToMarketTable(item,price){ let table = document.getElementById('balanceitems') let tr=document.createElement('tr') let tditem=document.createElement('td') tditem.innerHTML=item let tdprice=document.createElement('td') tdprice.innerHTML=price tr.appendChild(tditem) tr.appendChild(tdprice) table.appendChild(tr) } function addPlayerToLBTable(player,index){ let table = document.getElementById('playerlb') let tr=document.createElement('tr') let tditem=document.createElement('td') tditem.innerHTML=player let tdindex=document.createElement('td') tdindex.innerHTML=index tr.appendChild(tditem) tr.appendChild(tdindex) table.appendChild(tr) } function addGuildToLBTable(guild,index){ let table = document.getElementById('guildlb') let tr=document.createElement('tr') let tditem=document.createElement('td') tditem.innerHTML=guild let tdindex=document.createElement('td') tdindex.innerHTML=index tr.appendChild(tditem) tr.appendChild(tdindex) table.appendChild(tr) } function createDashBox(color,title=null){ let dashBox = document.createElement('div') dashBox.className='dash-full-box' dashBox.id=color if(title!=null){ let dashtitle = document.createElement('p') dashtitle.className='dash-title' dashtitle.innerText=title dashBox.appendChild(dashtitle) } document.getElementById('dashboardcontent').appendChild(dashBox) let br= document.createElement('br') document.getElementById('dashboardcontent').appendChild(br) return dashBox } function spawnBaseDashBox(){ let wdmbox = createDashBox('red') wdmbox.innerHTML=`
` let mobox = createDashBox('green','MONEY INFOS:') mobox.innerHTML = `

Your Current balance: NODATA$

Current balance of your Guild: NODATA$

` let markbox = createDashBox('yellow','TRADE INFOS:') markbox.innerHTML=`Market price of items:
Items: Price:
` let lbbox = createDashBox('orange','LEADERBOARD:') lbbox.innerHTML=`
Player: Place:
Guild: Place:
` } function loadscript(){ createauth() } window.onload=loadscript function startscript(){ if(auth(loginusername,loginpassword)){ mainscript(loginusername,loginpassword) } } function mainscript(username,password){ spawnBaseDashBox() showGameDatas(username,password) } function createauth(){ document.getElementById('dashboardcontent').innerHTML=`


` } function loginsubmit(){ loginusername = document.getElementById('loginusername').value loginpassword = document.getElementById('loginpassword').value startscript() } function auth(username,password){ if(checkauth(username,password)){ document.getElementById('logindiv').remove() return true } else{ document.getElementById('loginindic').innerHTML='Bad Password or Username' return false } } function checkauth(username, password){ const [check, index] = checkusername(username) if(check){ if(logindb.loginplayer[index].password===password){ return true } } return false } function checkusername(username){ for(let i=0; i