@@ -187,25 +187,55 @@ idrinth.tier = {
187187 var ln = {
188188 type : 'td'
189189 } ;
190- if (
191- idrinth . tier . list [ listKey ] . hasOwnProperty ( 'loot' ) &&
192- idrinth . tier . list [ listKey ] . loot . hasOwnProperty ( difficulty ) &&
193- idrinth . tier . list [ listKey ] . loot [ difficulty ] . hasOwnProperty ( ic ) &&
194- idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ]
195- ) {
196- ln . attributes = ln . attributes ?ln . attributes :[ ] ;
190+ /**
191+ *
192+ * @param {object } ln
193+ * @param {string } listKey
194+ * @param {string } difficulty
195+ * @param {string } ic
196+ * @returns {object } for the buildElement wrapper
197+ */
198+ var addTitle = function ( ln , listKey , difficulty , ic ) {
199+ if ( ! idrinth . tier . list [ listKey ] . hasOwnProperty ( 'loot' ) ) {
200+ return ln ;
201+ }
202+ if ( ! idrinth . tier . list [ listKey ] . loot . hasOwnProperty ( difficulty ) ) {
203+ return ln ;
204+ }
205+ if ( ! idrinth . tier . list [ listKey ] . loot [ difficulty ] . hasOwnProperty ( ic ) ) {
206+ return ln ;
207+ }
208+ if ( ! idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] ) {
209+ return ln ;
210+ }
211+ ln . attributes = ln . attributes ? ln . attributes : [ ] ;
197212 var title = "" ;
198- for ( var key in idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] ) {
199- if ( idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] . hasOwnProperty ( key ) ) {
200- title += idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] [ key ] + " " + idrinth . text . get ( 'tier.loot.' + key ) + "\n" ;
213+ for ( var key in idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] ) {
214+ if ( idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] . hasOwnProperty ( key ) ) {
215+ title += idrinth . tier . list [ listKey ] . loot [ difficulty ] [ ic ] [ key ] + " " + idrinth . text . get ( 'tier.loot.' + key ) + "\n" ;
201216 }
202217 }
203- ln . attributes . push ( { name :'title' , value :title } ) ;
204- }
205- if (
206- idrinth . tier . list [ listKey ] . hasOwnProperty ( difficulty ) &&
207- idrinth . tier . list [ listKey ] [ difficulty ] . hasOwnProperty ( ic )
208- ) {
218+ ln . attributes . push ( {
219+ name : 'title' ,
220+ value : title
221+ } ) ;
222+ return ln ;
223+ } ;
224+ /**
225+ *
226+ * @param {object } ln
227+ * @param {string } listKey
228+ * @param {string } difficulty
229+ * @param {string } ic
230+ * @returns {object } for the buildElement wrapper
231+ */
232+ var addContent = function ( ln , listKey , difficulty , ic ) {
233+ if (
234+ ! idrinth . tier . list [ listKey ] . hasOwnProperty ( difficulty ) ||
235+ ! idrinth . tier . list [ listKey ] [ difficulty ] . hasOwnProperty ( ic )
236+ ) {
237+ return ln ;
238+ }
209239 ln . styles = idrinth . tier . list [ listKey ] . os [ difficulty ] === idrinth . tier . list [ listKey ] [ difficulty ] [ ic ] ? 'is-os' : '' ;
210240 ln . content = idrinth . ui . formatNumber ( idrinth . tier . list [ listKey ] [ difficulty ] [ ic ] ) ;
211241 if (
@@ -215,8 +245,9 @@ idrinth.tier = {
215245 ) {
216246 ln . content += ' ' + idrinth . tier . list [ listKey ] . epics [ difficulty ] [ ic ] + 'E' ;
217247 }
218- }
219- return ln ;
248+ return ln ;
249+ } ;
250+ return addContent ( addTitle ( ln , listKey , difficulty , ic ) , listKey , difficulty , ic ) ;
220251 } ;
221252 /**
222253 *
0 commit comments