@@ -6,7 +6,7 @@ import Popup from '@components/popup.js';
66import Worker from '@utils/worker' ;
77import { CreateElement , BindTooltip , Sleep , Random } from '@utils/helpers.js' ;
88
9- export default class Table {
9+ export default class ItemTable {
1010 #mode;
1111 #casket;
1212 #multiCasket;
@@ -31,7 +31,7 @@ export default class Table {
3131 static ROW_HEIGHT = 69 ;
3232 static BUFFER_ROWS = 3 ;
3333 #VISIBLE_ROWS;
34- get #NUM_ROW_ELEMENTS( ) { return this . #VISIBLE_ROWS + Table . BUFFER_ROWS * 2 ; } ;
34+ get #NUM_ROW_ELEMENTS( ) { return this . #VISIBLE_ROWS + ItemTable . BUFFER_ROWS * 2 ; } ;
3535
3636 #popup;
3737
@@ -63,7 +63,7 @@ export default class Table {
6363 this . #casket = options . casket ?? null ;
6464 this . #multiCasket = options . multiCasket ?? false ;
6565
66- this . #VISIBLE_ROWS = Math . max ( 1 , Math . floor ( ( unsafeWindow . innerHeight * .66 ) / Table . ROW_HEIGHT ) ) ;
66+ this . #VISIBLE_ROWS = Math . max ( 1 , Math . floor ( ( unsafeWindow . innerHeight * .66 ) / ItemTable . ROW_HEIGHT ) ) ;
6767
6868 this . #data. map ( item => delete item . element ) ;
6969
@@ -211,22 +211,22 @@ export default class Table {
211211 this . #tableContainer = CreateElement ( "div" , {
212212 class : "cs2s_table_container" ,
213213 style : {
214- height : `${ ( this . #VISIBLE_ROWS + 1 ) * Table . ROW_HEIGHT } px`
214+ height : `${ ( this . #VISIBLE_ROWS + 1 ) * ItemTable . ROW_HEIGHT } px`
215215 } ,
216216 onscroll : ( ) => { this . #UpdateRows( ) ; } ,
217217 children : [ this . #table]
218218 } ) ;
219219
220220 // Build Footer Elements
221221
222- if ( this . #mode === Table . MODE . RETRIEVE ) {
222+ if ( this . #mode === ItemTable . MODE . RETRIEVE ) {
223223 this . #selectionLimit = Constant . INVENTORY_ITEM_LIMIT - inventory . items . filter ( x => typeof x . attributes [ "trade protected escrow date" ] === "undefined" ) . length ;
224224 } else {
225225 this . #selectionLimit = Constant . STORAGE_UNIT_ITEM_LIMIT - inventory . storedItems . filter ( x => x . casket_id == this . #casket. iteminfo . id ) . length ;
226226 }
227227
228228 const onStatusUpdate = ( status ) => {
229- if ( this . #mode !== Table . MODE . RETRIEVE || typeof status . Plugin ?. UnprotectedInventorySize === "undefined" ) {
229+ if ( this . #mode !== ItemTable . MODE . RETRIEVE || typeof status . Plugin ?. UnprotectedInventorySize === "undefined" ) {
230230 return ;
231231 }
232232
@@ -280,7 +280,7 @@ export default class Table {
280280
281281 if ( ! Script . Bot ?. Plugin ?. Connected ) {
282282 Script . ShowStartInterfacePrompt ( {
283- message : this . #mode === Table . MODE . RETRIEVE
283+ message : this . #mode === ItemTable . MODE . RETRIEVE
284284 ? "Interface must running to retrieve items"
285285 : "Interface must running to store items" ,
286286 autoClose : true ,
@@ -423,7 +423,7 @@ export default class Table {
423423
424424 // Build Popup Elements
425425
426- const popupTitle = this . #mode === Table . MODE . RETRIEVE
426+ const popupTitle = this . #mode === ItemTable . MODE . RETRIEVE
427427 ? "Select items to retrieve from "
428428 : "Select items to move into " ;
429429
@@ -651,7 +651,7 @@ export default class Table {
651651 }
652652
653653 this . #spacer. style . height = "0px"
654- this . #spacer. style . height = `${ ( this . #filteredData. length * Table . ROW_HEIGHT ) - this . #table. clientHeight + 31 } px` ;
654+ this . #spacer. style . height = `${ ( this . #filteredData. length * ItemTable . ROW_HEIGHT ) - this . #table. clientHeight + 31 } px` ;
655655
656656 this . #UpdateRows( ) ;
657657 this . #UpdateFooter( ) ;
@@ -662,7 +662,7 @@ export default class Table {
662662 CreateElement ( "td" , {
663663 class : "cs2s_table_empty" ,
664664 colspan : 6 ,
665- text : this . #mode == Table . MODE . RETRIEVE ? "Storage Unit is empty" : "Inventory has no storable items"
665+ text : this . #mode == ItemTable . MODE . RETRIEVE ? "Storage Unit is empty" : "Inventory has no storable items"
666666 } )
667667 ]
668668 } ) ) ;
@@ -674,7 +674,7 @@ export default class Table {
674674 0 ,
675675 Math . min (
676676 this . #filteredData. length - this . #NUM_ROW_ELEMENTS,
677- Math . floor ( this . #tableContainer. scrollTop / Table . ROW_HEIGHT ) - Table . BUFFER_ROWS
677+ Math . floor ( this . #tableContainer. scrollTop / ItemTable . ROW_HEIGHT ) - ItemTable . BUFFER_ROWS
678678 )
679679 ) ;
680680
@@ -730,7 +730,7 @@ export default class Table {
730730 }
731731 }
732732
733- this . #tableBody. style . transform = `translate3d(0, ${ startRow * Table . ROW_HEIGHT } px, 0)` ;
733+ this . #tableBody. style . transform = `translate3d(0, ${ startRow * ItemTable . ROW_HEIGHT } px, 0)` ;
734734 }
735735
736736 #UpdateFooter( ) {
@@ -871,12 +871,12 @@ export default class Table {
871871 let resetSort = false ;
872872
873873 if ( options . event ) {
874- if ( this . #sortDirection === Table . SORT_DIRECTION . DESC ) {
874+ if ( this . #sortDirection === ItemTable . SORT_DIRECTION . DESC ) {
875875 this . #sortColumns = [ "casket_id" , "id" ] ;
876- this . #sortDirection = Table . SORT_DIRECTION . DESC ;
876+ this . #sortDirection = ItemTable . SORT_DIRECTION . DESC ;
877877 resetSort = true ;
878- } else if ( this . #sortDirection === Table . SORT_DIRECTION . ASC ) {
879- this . #sortDirection = Table . SORT_DIRECTION . DESC ;
878+ } else if ( this . #sortDirection === ItemTable . SORT_DIRECTION . ASC ) {
879+ this . #sortDirection = ItemTable . SORT_DIRECTION . DESC ;
880880 }
881881 }
882882
@@ -885,10 +885,10 @@ export default class Table {
885885 }
886886
887887 if ( ! this . #sortDirection) {
888- this . #sortDirection = Table . SORT_DIRECTION . ASC ;
888+ this . #sortDirection = ItemTable . SORT_DIRECTION . ASC ;
889889 }
890890
891- const asc = this . #sortDirection === Table . SORT_DIRECTION . ASC ;
891+ const asc = this . #sortDirection === ItemTable . SORT_DIRECTION . ASC ;
892892
893893 this . #filteredData. sort ( ( a , b ) => {
894894 for ( const column of this . #sortColumns) {
@@ -1769,7 +1769,7 @@ export default class Table {
17691769
17701770 const progressMessage = CreateElement ( "div" , {
17711771 class : "cs2s_action_message" ,
1772- text : this . #mode == Table . MODE . RETRIEVE ? "Retrieving Items" : "Storing Items"
1772+ text : this . #mode == ItemTable . MODE . RETRIEVE ? "Retrieving Items" : "Storing Items"
17731773 } ) ;
17741774
17751775 const progressBar = CreateElement ( "div" , {
@@ -1800,7 +1800,7 @@ export default class Table {
18001800 } ) ;
18011801
18021802 const popup = new Popup ( {
1803- title : this . #mode == Table . MODE . RETRIEVE
1803+ title : this . #mode == ItemTable . MODE . RETRIEVE
18041804 ? "Retrieving From Storage Unit"
18051805 : "Moving To Storage Unit" ,
18061806 body : [ popupBody ] ,
@@ -1836,7 +1836,7 @@ export default class Table {
18361836 }
18371837
18381838 try {
1839- if ( this . #mode == Table . MODE . RETRIEVE ) {
1839+ if ( this . #mode == ItemTable . MODE . RETRIEVE ) {
18401840 await this . #inventory. RetrieveItem ( item ) ;
18411841 } else {
18421842 await this . #inventory. StoreItem ( item , this . #casket) ;
@@ -1854,7 +1854,7 @@ export default class Table {
18541854
18551855 worker . Cancel ( ) ;
18561856 popup . Hide ( ) ;
1857- Script . ShowError ( { level : ERROR_LEVEL . HIGH } , e , new Error ( `Failed to ${ this . #mode == Table . MODE . RETRIEVE ? "retrieve" : "store" } "${ item . full_name } ". If errors persist, reload the page and try again.` ) ) ;
1857+ Script . ShowError ( { level : ERROR_LEVEL . HIGH } , e , new Error ( `Failed to ${ this . #mode == ItemTable . MODE . RETRIEVE ? "retrieve" : "store" } "${ item . full_name } ". If errors persist, reload the page and try again.` ) ) ;
18581858
18591859 return ;
18601860 }
@@ -1871,7 +1871,7 @@ export default class Table {
18711871 this . #UpdateTable( ) ;
18721872
18731873 numItemsProcessed ++ ;
1874- progressMessage . innerText = ( this . #mode == Table . MODE . RETRIEVE ? "Retrieving Items" : "Storing Items" ) + ` (${ numItemsProcessed } /${ numItemsToProcess } )` ;
1874+ progressMessage . innerText = ( this . #mode == ItemTable . MODE . RETRIEVE ? "Retrieving Items" : "Storing Items" ) + ` (${ numItemsProcessed } /${ numItemsToProcess } )` ;
18751875 progressBar . style . setProperty ( "--percentage" , `${ ( ( numItemsProcessed / numItemsToProcess ) * 100 ) . toFixed ( 2 ) } %` ) ;
18761876
18771877 itemWindow . append ( itemImage ) ;
0 commit comments