diff --git a/src/mods/chat.js b/src/mods/chat.js index ae23ec6..ffeb7c3 100644 --- a/src/mods/chat.js +++ b/src/mods/chat.js @@ -10,11 +10,228 @@ idrinth.chat = { chatRank: { }, refreshCount: 0, refreshChats: function () { + var applyMessages = function ( data ) { + var processMessages = function ( messages ) { + var addMessages = function ( chatMessages, chatId, chatElement ) { + var buildMessage = function ( message, chat, chatId, messageId ) { + var getfullDateInt = function () { + function addZero ( x, n ) { + while ( x.toString ().length < n ) { + x = "0" + x; + } + return x; + } + var d = new Date (); + return addZero ( d.getFullYear (), 2 ) + + addZero ( d.getMonth (), 2 ) + + addZero ( d.getDate (), 2 ) + + addZero ( d.getHours (), 2 ) + + addZero ( d.getMinutes (), 2 ) + + addZero ( d.getSeconds (), 2 ) + + addZero ( d.getMilliseconds (), 3 ); + }; + var notify = function ( message, own, chatId ) { + var notActive = function ( chatId ) { + try { + return !idrinth.windowactive || + !( document.getElementById ( 'idrinth-chat-tab-click-' + chatId ).getAttribute ( 'class' ) ).match ( /(\s|^)active( |$)/ ) || + !( document.getElementById ( 'idrinth-chat' ).getAttribute ( 'class' ) ).match ( /(\s|^)active( |$)/ ); + } catch ( e ) { + idrinth.core.log ( e.getMessage ); + return true; + } + }; + var messageAllowed = function ( text ) { + try { + return ( idrinth.settings.get ( "notification#message" ) && text.match ( /\{[A-Z]{2}-Raid / ) === null ) || + ( idrinth.settings.get ( "notification#mention" ) && text.match ( new RegExp ( '(\s|^)' + idrinth.core.escapeRegExp ( idrinth.chat.users[idrinth.chat.self].name ) + '(\s|$)', 'i' ) ) !== null ) || + ( idrinth.settings.get ( "notification#raid" ) && text.match ( /\{[A-Z]{2}-Raid / ) !== null ); + } catch ( e ) { + idrinth.core.log ( e.getMessage () ); + return false; + } + }; + if ( !own && notActive ( chatId ) && messageAllowed ( message.text ) ) { + try { + idrinth.core.sendNotification ( + message.time.split ( ' ' )[1] + ' ' + document.getElementById ( 'idrinth-chat-tab-click-' + chatId ).innerHTML + ':', + idrinth.chat.users[message.user].name + ': ' + message.text + ); + } catch ( exception ) { + idrinth.core.log ( exception.getMessage () ); + } + } + }; + var own = parseInt ( message.user, 10 ) === parseInt ( idrinth.chat.self, 10 ); + notify ( message, own, chatId ); + chat.appendChild ( idrinth.ui.buildElement ( + { + type: 'li', + id: 'idrinth-single-chat-message-' + messageId + ( parseInt ( messageId, 10 ) < 1 ? '-' + getfullDateInt () : '' ), + css: own ? 'self-written ' : '', + children: [ + { + type: 'span', + css: 'time', + content: message.time.split ( ' ' )[1], + attributes: [ { + name: 'title', + value: message.time + } ] + }, + { + type: 'span', + css: 'user ' + idrinth.chat.ranks[parseInt ( idrinth.chat.chatRank[chatId][message.user], 10 )] + ( message.user === 0 ? ' system-message' : '' ), + content: idrinth.chat.users[message.user].name, + attributes: [ + { + name: 'data-id', + value: message.user + }, + { + name: 'onclick', + value: 'idrinth.chat.userclick(this,' + message.user + ',' + chatId + ')' + } + ] + }, + { + type: '#text', + content: ':' + }, + { + type: 'span', + children: idrinth.chat.buildMessageText ( message.text ) + } + ] + } + ) ); + }; + var isNew = false; + for (var messageId in chatMessages) { + if ( parseInt ( messageId, 10 ) < 1 || !document.getElementById ( 'idrinth-single-chat-message-' + messageId ) ) { + isNew = true; + buildMessage ( messages[chatId][messageId], chatElement, chatId, messageId ); + if ( parseInt ( messageId, 10 ) > parseInt ( idrinth.chat.maxId, 10 ) ) { + idrinth.chat.maxId = messageId; + } + } + } + return isNew; + }; + var setChatClass = function ( isNew, chat, chatId ) { + var isActive = function ( element ) { + var cssClass = element.getAttribute ( 'class' ); + return !( !cssClass ) && !( !cssClass.match ( /(^|\s)active(\s|$)/ ) ); + }; + var chatActive = isActive ( document.getElementById ( 'idrinth-chat' ) ); + if ( isNew && !chatActive ) { + document.getElementById ( 'idrinth-chat' ).setAttribute ( 'class', 'new-message' ); + } + var tab = document.getElementById ( 'idrinth-chat-tab-click-' + chatId ); + var tabActive = isActive ( tab ); + if ( isNew && !tabActive ) { + tab.setAttribute ( 'class', tab.getAttribute ( 'class' ) + ' new-message' ); + } else if ( tabActive && chatActive && chat.lastChild.scrollTop < chat.lastChild.scrollHeight ) { + try { + chat.lastChild.scrollIntoView ( false ); + } catch ( e ) { + idrinth.core.log ( e ); + } + chat.lastChild.scrollTop = chat.lastChild.scrollHeight; + } + }; + if ( idrinth.chat.maxId === 0 ) { + idrinth.chat.maxId = 1; + } + for (var key in messages) { + if ( + !isNaN ( parseInt ( key, 10 ) ) + && document.getElementById ( 'idrinth-chat-tab-' + key ) + && document.getElementById ( 'idrinth-chat-tab-' + key ).getElementsByTagName ( 'ul' )[1] ) { + var chat = document.getElementById ( 'idrinth-chat-tab-' + key ).getElementsByTagName ( 'ul' )[1]; + setChatClass ( addMessages ( messages[key], key, chat ), chat, key ); + } + } + }; + if ( !data ) { + return idrinth.chat.returnMessages ( data ); + } + data = JSON.parse ( data ); + if ( !data ) { + return idrinth.chat.returnMessages ( data ); + } + if ( data.login ) { + return idrinth.chat.relogin (); + } + if ( data.messages ) { + processMessages ( data.messages ); + } + idrinth.chat.oldMessages = [ ]; + idrinth.chat.updateTimeout = window.setTimeout ( idrinth.chat.refreshChats, 999 ); + }; + var refreshMembers = function () { + var applyMembers = function ( data ) { + var applyMemberData = function () { + var addMemberElement = function ( chat, chatId, userId ) { + var usedPlatforms = ''; + for (var pkey in idrinth.chat.users[userId].platforms) { + if ( idrinth.chat.users[userId].platforms[pkey] ) { + usedPlatforms += pkey; + } + } + chat.appendChild ( idrinth.ui.buildElement ( { + type: 'li', + css: 'user ' + idrinth.chat.ranks[parseInt ( idrinth.chat.chatRank[chatId][userId], 10 )], + content: ( usedPlatforms === '' ? '' : '[' + usedPlatforms.toUpperCase () + '] ' ) + idrinth.chat.users[userId].name, + attributes: [ + { + name: 'data-id', + value: userId + }, + { + name: 'onclick', + value: 'idrinth.chat.userclick(this,' + userId + ', ' + chatId + ')' + } + ] + } + ) ); + }; + for (var chatId in idrinth.chat.chatRank) { + if ( document.getElementById ( 'idrinth-chat-tab-' + chatId ) ) { + var chat = document.getElementById ( 'idrinth-chat-tab-' + chatId ).getElementsByTagName ( 'ul' )[0]; + while ( chat.firstChild ) { + chat.removeChild ( chat.firstChild ); + } + for (var userId in idrinth.chat.chatRank[chatId]) { + if ( idrinth.chat.chatRank[chatId].hasOwnProperty ( userId ) ) { + addMemberElement ( chat, chatId, userId ); + } + } + } + } + }; + if ( !data ) { + return; + } + data = JSON.parse ( data ); + if ( !data ) { + return; + } + idrinth.chat.self = data.self; + idrinth.chat.users = data.users; + idrinth.chat.chatRank = data.members; + applyMemberData (); + }; + idrinth.core.ajax.runHome ( + 'chat-service/accounts/', + applyMembers + ); + }; idrinth.chat.oldMessages = JSON.parse ( JSON.stringify ( idrinth.chat.messages ) ); idrinth.chat.messages = [ ]; idrinth.core.ajax.runHome ( 'chat-service/update/', - idrinth.chat.applyMessages, + applyMessages, idrinth.chat.returnMessages, idrinth.chat.returnMessages, JSON.stringify ( { @@ -23,23 +240,10 @@ idrinth.chat = { } ) ); if ( idrinth.chat.refreshCount % 25 === 0 ) { - idrinth.chat.refreshMembers (); + refreshMembers (); } idrinth.chat.refreshCount++; }, - refreshMembers: function () { - idrinth.core.ajax.runHome ( - 'chat-service/accounts/', - idrinth.chat.applyMembers, - function () { - window.setTimeout ( idrinth.chat.refreshMembers, 1000 ); - }, - function () { - window.setTimeout ( idrinth.chat.refreshMembers, 1000 ); - }, - '' - ); - }, returnMessages: function ( data ) { for (var count = idrinth.chat.oldMessages.length - 1; count >= 0; count--) { idrinth.chat.messages.unshift ( idrinth.chat.oldMessages[count] ); @@ -102,9 +306,9 @@ idrinth.chat = { if ( !hasRights ( node.requiredRank, ownRank ) ) { return; } - var translation = idrinth.text.get ( config.label ); + var translation = idrinth.text.get ( node.label ); return { - content: translation === idrinth.text.data.default ? config.label : translation, + content: translation === idrinth.text.data.default ? node.label : translation, type: 'li', attributes: [ { name: 'onclick', @@ -280,218 +484,7 @@ idrinth.chat = { }; }, idrinth.chat.buildEmoticons ], 5 ); }, - applyMessages: function ( data ) { - var processMessages = function ( messages ) { - var addMessages = function ( chatMessages, chatId, chatElement ) { - var buildMessage = function ( message, chat, chatId, messageId ) { - var getfullDateInt = function () { - function addZero ( x, n ) { - while ( x.toString ().length < n ) { - x = "0" + x; - } - return x; - } - var d = new Date (); - return addZero ( d.getFullYear (), 2 ) + - addZero ( d.getMonth (), 2 ) + - addZero ( d.getDate (), 2 ) + - addZero ( d.getHours (), 2 ) + - addZero ( d.getMinutes (), 2 ) + - addZero ( d.getSeconds (), 2 ) + - addZero ( d.getMilliseconds (), 3 ); - }; - var notify = function ( message, own, chatId ) { - var notActive = function ( chatId ) { - try { - return !idrinth.windowactive || - !( document.getElementById ( 'idrinth-chat-tab-click-' + chatId ).getAttribute ( 'class' ) ).match ( /(\s|^)active( |$)/ ) || - !( document.getElementById ( 'idrinth-chat' ).getAttribute ( 'class' ) ).match ( /(\s|^)active( |$)/ ); - } catch ( e ) { - idrinth.core.log ( e.getMessage ); - return true; - } - }; - var messageAllowed = function ( text ) { - try { - return ( idrinth.settings.get ( "notification#message" ) && text.match ( /\{[A-Z]{2}-Raid / ) === null ) || - ( idrinth.settings.get ( "notification#mention" ) && text.match ( new RegExp ( '(\s|^)' + idrinth.core.escapeRegExp ( idrinth.chat.users[idrinth.chat.self].name ) + '(\s|$)', 'i' ) ) !== null ) || - ( idrinth.settings.get ( "notification#raid" ) && text.match ( /\{[A-Z]{2}-Raid / ) !== null ); - } catch ( e ) { - idrinth.core.log ( e.getMessage () ); - return false; - } - }; - if ( !own && notActive ( chatId ) && messageAllowed ( message.text ) ) { - try { - idrinth.core.sendNotification ( - message.time.split ( ' ' )[1] + ' ' + document.getElementById ( 'idrinth-chat-tab-click-' + chatId ).innerHTML + ':', - idrinth.chat.users[message.user].name + ': ' + message.text - ); - } catch ( exception ) { - idrinth.core.log ( exception.getMessage () ); - } - } - }; - var own = parseInt ( message.user, 10 ) === parseInt ( idrinth.chat.self, 10 ); - notify ( message, own, chatId ); - chat.appendChild ( idrinth.ui.buildElement ( - { - type: 'li', - id: 'idrinth-single-chat-message-' + messageId + ( parseInt ( messageId, 10 ) < 1 ? '-' + getfullDateInt () : '' ), - css: own ? 'self-written ' : '', - children: [ - { - type: 'span', - css: 'time', - content: message.time.split ( ' ' )[1], - attributes: [ { - name: 'title', - value: message.time - } ] - }, - { - type: 'span', - css: 'user ' + idrinth.chat.ranks[parseInt ( idrinth.chat.chatRank[chatId][message.user], 10 )] + ( message.user === 0 ? ' system-message' : '' ), - content: idrinth.chat.users[message.user].name, - attributes: [ - { - name: 'data-id', - value: message.user - }, - { - name: 'onclick', - value: 'idrinth.chat.userclick(this,' + message.user + ',' + chatId + ')' - } - ] - }, - { - type: '#text', - content: ':' - }, - { - type: 'span', - children: idrinth.chat.buildMessageText ( message.text ) - } - ] - } - ) ); - }; - var isNew = false; - for (var messageId in chatMessages) { - if ( parseInt ( messageId, 10 ) < 1 || !document.getElementById ( 'idrinth-single-chat-message-' + messageId ) ) { - isNew = true; - buildMessage ( messages[chatId][messageId], chatElement, chatId, messageId ); - if ( parseInt ( messageId, 10 ) > parseInt ( idrinth.chat.maxId, 10 ) ) { - idrinth.chat.maxId = messageId; - } - } - } - return isNew; - }; - var setChatClass = function ( isNew, chat, chatId ) { - var isActive = function ( element ) { - var cssClass = element.getAttribute ( 'class' ); - return !( !cssClass ) && !( !cssClass.match ( /(^|\s)active(\s|$)/ ) ); - }; - var chatActive = isActive ( document.getElementById ( 'idrinth-chat' ) ); - if ( isNew && !chatActive ) { - document.getElementById ( 'idrinth-chat' ).setAttribute ( 'class', 'new-message' ); - } - var tab = document.getElementById ( 'idrinth-chat-tab-click-' + chatId ); - var tabActive = isActive ( tab ); - if ( isNew && !tabActive ) { - tab.setAttribute ( 'class', tab.getAttribute ( 'class' ) + ' new-message' ); - } else if ( tabActive && chatActive && chat.lastChild.scrollTop < chat.lastChild.scrollHeight ) { - try { - chat.lastChild.scrollIntoView ( false ); - } catch ( e ) { - idrinth.core.log ( e ); - } - chat.lastChild.scrollTop = chat.lastChild.scrollHeight; - } - }; - if ( idrinth.chat.maxId === 0 ) { - idrinth.chat.maxId = 1; - } - for (var key in messages) { - if ( - !isNaN ( parseInt ( key, 10 ) ) - && document.getElementById ( 'idrinth-chat-tab-' + key ) - && document.getElementById ( 'idrinth-chat-tab-' + key ).getElementsByTagName ( 'ul' )[1] ) { - var chat = document.getElementById ( 'idrinth-chat-tab-' + key ).getElementsByTagName ( 'ul' )[1]; - setChatClass ( addMessages ( messages[key], key, chat ), chat, key ); - } - } - }; - if ( !data ) { - return idrinth.chat.returnMessages ( data ); - } - data = JSON.parse ( data ); - if ( !data ) { - return idrinth.chat.returnMessages ( data ); - } - if ( data.login ) { - return idrinth.chat.relogin (); - } - if ( data.messages ) { - processMessages ( data.messages ); - } - idrinth.chat.oldMessages = [ ]; - idrinth.chat.updateTimeout = window.setTimeout ( idrinth.chat.refreshChats, 999 ); - }, ranks: [ '', 'banned', 'user', 'mod', 'owner' ], - applyMembers: function ( data ) { - var applyMemberData = function () { - var addMemberElement = function ( chat, chatId, userId ) { - var usedPlatforms = ''; - for (var pkey in idrinth.chat.users[userId].platforms) { - if ( idrinth.chat.users[userId].platforms[pkey] ) { - usedPlatforms += pkey; - } - } - chat.appendChild ( idrinth.ui.buildElement ( { - type: 'li', - css: 'user ' + idrinth.chat.ranks[parseInt ( idrinth.chat.chatRank[chatId][userId], 10 )], - content: ( usedPlatforms === '' ? '' : '[' + usedPlatforms.toUpperCase () + '] ' ) + idrinth.chat.users[userId].name, - attributes: [ - { - name: 'data-id', - value: userId - }, - { - name: 'onclick', - value: 'idrinth.chat.userclick(this,' + userId + ', ' + chatId + ')' - } - ] - } - ) ); - }; - for (var chatId in idrinth.chat.chatRank) { - if ( document.getElementById ( 'idrinth-chat-tab-' + chatId ) ) { - var chat = document.getElementById ( 'idrinth-chat-tab-' + chatId ).getElementsByTagName ( 'ul' )[0]; - while ( chat.firstChild ) { - chat.removeChild ( chat.firstChild ); - } - for (var userId in idrinth.chat.chatRank[chatId]) { - if ( idrinth.chat.chatRank[chatId].hasOwnProperty ( userId ) ) { - addMemberElement ( chat, chatId, userId ); - } - } - } - } - }; - if ( !data ) { - return idrinth.chat.returnMessages ( data ); - } - data = JSON.parse ( data ); - if ( !data ) { - return idrinth.chat.returnMessages ( data ); - } - idrinth.chat.self = data.self; - idrinth.chat.users = data.users; - idrinth.chat.chatRank = data.members; - applyMemberData (); - }, emotes: { }, start: function () { var build = function () { diff --git a/src/mods/settings.js b/src/mods/settings.js index f01d641..f61df8e 100644 --- a/src/mods/settings.js +++ b/src/mods/settings.js @@ -1,54 +1,43 @@ idrinth.settings = { - raids: false, - favs: '', - factor: true, - moveLeft: false, - minimalist: false, - chatHiddenOnStart: true, - names: true, - timeout: 5000, - loadtime: 5000, - windows: 3, - warBottom: false, - landMax: true, - chatting: true, - chatuser: '', - newgroundLoad: 30, - chatpass: '', - isWorldServer: false, - alarmTime: '8:0', - alarmActive: false, - bannedRaids: { }, - language: 'en', - notification: { - mention: true, - message: true, - raid: true - }, - land: { - cornfield: 0, - stable: 0, - barn: 0, - store: 0, - pub: 0, - inn: 0, - tower: 0, - fort: 0, - castle: 0, - gold: 0 - }, - save: function ( ) { - 'use strict'; - var store = function ( prefix, list, store ) { - for (var key in list) { - if ( list.hasOwnProperty ( key ) && typeof list[key] !== 'object' && typeof list[key] !== 'function' ) { - window.localStorage.setItem ( prefix + key, list[key] ); - } else if ( list.hasOwnProperty ( key ) && typeof list[key] === 'object' ) { - store ( prefix + key + '-', list[key], store ); - } - } - }; - store ( 'idrinth-dotd-', idrinth.settings, store ); + data: { + raids: false, + favs: '', + factor: true, + moveLeft: false, + minimalist: false, + chatHiddenOnStart: true, + names: true, + timeout: 5000, + loadtime: 5000, + windows: 3, + warBottom: false, + landMax: true, + chatting: true, + chatuser: '', + newgroundLoad: 30, + chatpass: '', + isWorldServer: false, + alarmTime: '8:0', + alarmActive: false, + bannedRaids: { }, + language: 'en', + notification: { + mention: true, + message: true, + raid: true + }, + land: { + cornfield: 0, + stable: 0, + barn: 0, + store: 0, + pub: 0, + inn: 0, + tower: 0, + fort: 0, + castle: 0, + gold: 0 + } }, get: function ( field ) { 'use strict'; @@ -58,43 +47,72 @@ idrinth.settings = { } return null; }; + var remove = function ( key ) { + try { + window.localStorage.removeItem ( key ); + } catch ( e ) { + //not really relevant + } + }; if ( !field ) { return; } - var value = getValue ( idrinth.settings, field ); + var value = getValue ( idrinth.settings.data, field ); if ( value !== null && typeof value !== 'object' ) { + remove ( 'idrinth-dotd-' + field ); return value; } field = field.split ( '#' ); - return getValue ( idrinth.settings[field[0]], field[1] ); + remove ( 'idrinth-dotd-' + field[0] + '-' + field[1] ); + return getValue ( idrinth.settings.data[field[0]], field[1] ); }, change: function ( field, value ) { 'use strict'; var setValue = function ( parent, field, value ) { if ( idrinth.core.fieldIsSetting ( parent, field ) ) { parent[field] = value; - idrinth.settings.save ( ); return true; } return false; }; + var store = function ( ) { + window.localStorage.setItem ( 'idotd', JSON.stringify ( idrinth.settings.data ) ); + }; if ( !field ) { return; } - if ( setValue ( idrinth.settings, field, value ) ) { + if ( setValue ( idrinth.settings.data, field, value ) ) { + store (); return; } field = field.split ( '#' ); - if ( !idrinth.settings[field[0]] || !field[1] ) { + if ( !idrinth.settings.data[field[0]] || !field[1] ) { return; } - if ( setValue ( idrinth.settings[field[0]], field[1], value ) ) { + if ( setValue ( idrinth.settings.data[field[0]], field[1], value ) ) { + store (); return; } }, start: function ( ) { 'use strict'; - if ( window.localStorage ) { + var getCurrent = function () { + var data = JSON.parse ( window.localStorage.getItem ( 'idotd' ) ); + var apply = function ( to, from, apply ) { + for (var key in from) { + if ( from.hasOwnProperty ( key ) ) { + if ( typeof from[key] === 'object' ) { + to[key] = typeof to[key] === 'object' ? to[key] : { }; + apply ( to[key], from[key] ); + } else { + to[key] = from[key]; + } + } + } + }; + apply ( idrinth.settings.data, data, apply ); + }; + var getOld = function () { var objectIterator = function ( object, prefix, objectIterator ) { var itemHandler = function ( prefix, key, item ) { if ( typeof item !== 'function' ) { @@ -121,7 +139,14 @@ idrinth.settings = { } return object; }; - objectIterator ( idrinth.settings, '', objectIterator ); + objectIterator ( idrinth.settings.data, '', objectIterator ); + }; + if ( window.localStorage ) { + if ( window.localStorage.getItem ( 'idotd' ) ) { + getCurrent (); + } else { + getOld (); + } } } }; \ No newline at end of file diff --git a/src/mods/tier.js b/src/mods/tier.js index 00e7a12..9ef4cc6 100644 --- a/src/mods/tier.js +++ b/src/mods/tier.js @@ -68,11 +68,11 @@ idrinth.tier = { idrinth.core.alert ( idrinth.text.get ( "tier.maxBoxes" ) ); }, taggedSlots: { }, - start: function () { + start: function ( ) { 'use strict'; var pos = 1; while ( 0 < window.innerWidth - 140 * ( pos + 1 ) ) { - this.taggedSlots[( pos * 140 ).toString ()] = null; + this.taggedSlots[( pos * 140 ).toString ( )] = null; pos++; } idrinth.core.ajax.runHome ( @@ -93,20 +93,25 @@ idrinth.tier = { data = JSON.parse ( data ); if ( data ) { idrinth.tier.list = data; + var create = function ( name, url ) { + 'use strict'; + if ( !idrinth.settings.data.bannedRaids[name] ) { + idrinth.settings.data.bannedRaids[name] = false; + window.localStorage.setItem ( 'idotd', JSON.stringify ( idrinth.settings.data ) ); + } + document.getElementById ( 'idrinth-raid-may-join-list' ).appendChild ( idrinth.ui.buildElement ( { + name: 'bannedRaids#' + name, + rType: '#input', + type: 'checkbox', + id: 'idrinth-raid-may-join-list-' + name, + label: idrinth.text.get ( "raids.disableJoining" ) + name + } ) ); + document.getElementById ( 'idrinth-raid-may-join-list' ).lastChild.setAttribute ( 'style', + 'background-image:url(https://dotd.idrinth.de/static/raid-image-service/' + url + '/);' ); + }; for (var key in data) { if ( data[key].name ) { - if ( idrinth.settings.get ( "bannedRaids#" + data[key].name ) === undefined ) { - idrinth.settings.change ( "bannedRaids#" + data[key].name, false ); - } - document.getElementById ( 'idrinth-raid-may-join-list' ).appendChild ( idrinth.ui.buildElement ( { - name: 'bannedRaids#' + data[key].name, - rType: '#input', - type: 'checkbox', - id: 'idrinth-raid-may-join-list-' + data[key].name, - label: idrinth.text.get ( "raids.disableJoining" ) + data[key].name - } ) ); - document.getElementById ( 'idrinth-raid-may-join-list' ).lastChild.setAttribute ( 'style', - 'background-image:url(https://dotd.idrinth.de/static/raid-image-service/' + data[key].url + '/);' ); + create ( data[key].name, data[key].url ); } } } else { @@ -117,7 +122,6 @@ idrinth.tier = { var clearInnerHtml = function ( elem ) { elem.innerHTML = ''; }; - var makeList = function ( list ) { var makeField = function ( listKey, difficulty, ic ) { var ln = { diff --git a/tiers/Batiatus' Elite Gladiators [Elite Gladiators].json b/tiers/Batiatus' Elite Gladiators [Elite Gladiators].json new file mode 100644 index 0000000..125d510 --- /dev/null +++ b/tiers/Batiatus' Elite Gladiators [Elite Gladiators].json @@ -0,0 +1,67 @@ +{ +"nightmare":{ + "15000000":{ + "epic": 2, + "legendary": 4, + "uncommon": 6, + "common": 8, + "stats": null +}, + "18000000":{ + "epic": 3, + "legendary": 5, + "uncommon": 7, + "common": 9, + "stats": null +}, + "21000000":{ + "epic": 4, + "legendary": 6, + "uncommon": 8, + "common": 10, + "stats": null +}, + "24000000":{ + "epic": 5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "27000000":{ + "epic": 6, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "30000000":{ + "epic": 7, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "33000000":{ + "epic": 8, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "36000000":{ + "epic": 9, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "39000000":{ + "epic": 10, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +} + } +} diff --git a/tiers/Dirthax [Dirthax].json b/tiers/Dirthax [Dirthax].json new file mode 100644 index 0000000..19d8526 --- /dev/null +++ b/tiers/Dirthax [Dirthax].json @@ -0,0 +1,206 @@ +{ + "normal":{ + "1100000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "4950000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "8250000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "12100000":{ + "epic": 2, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "17600000":{ + "epic": 2.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "35750000":{ + "epic": 3, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "49500000":{ + "epic": 3.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +} + }, + "hard":{ + "1375000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "6188000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "10313000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "15125000":{ + "epic": 2, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "22000000":{ + "epic": 2.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "44688000":{ + "epic": 3, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "61875000":{ + "epic": 3.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +} + }, + "legendary":{ + "1760000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "7920000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "13200000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "19360000":{ + "epic": 2, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "28160000":{ + "epic": 2.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "57200000":{ + "epic": 3, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "79200000":{ + "epic": 3.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +} + }, + "nightmare":{ + "2200000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "9900000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "16500000":{ + "epic": 1, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "24200000":{ + "epic": 2, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "35200000":{ + "epic": 2.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "71500000":{ + "epic": 3, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +}, + "99000000":{ + "epic": 3.5, + "legendary": null, + "uncommon": null, + "common": null, + "stats": null +} + } +}