export class Resources { public readonly name : string ; public readonly typeId : number ; private resources : { elemId : number ; state : State ; } [ ] = [ ] ; constructor ( resource ) { this . name = resource . name ; this . typeId = resource . elementTypeId ; this . addOrUpdateResource ( resource ) ; } public addOrUpdateResource ( resource ) { const ref = this . resources . find ( r => r . elemId == resource . elementId ) ; if ( ref ) ref . state = resource . elementState ; else this . resources . push ( { elemId : resource . elementId , state : resource . elementState } ) ; } public getCount ( ) { return this . getCountOfRessourcesCanBeUsed ( ) + '/' + this . getTotalCount ( ) ; } public getIcon ( ) { const iconId = iconIdByTypeId [ this . typeId ] ; const result = [ ] ; if ( iconId == undefined ) { result . push ( './assets/ui/icons/fail.png' ) ; } else if ( typeof iconId === 'string' ) { result . push ( 'https://dofustouch.cdn.ankama.com/assets/2.34.8_kbu_6h45kmUJaqYJSzE(uwaos..pYYKs/gfx/items/' + iconId + '.png' ) ; } else { iconId . forEach ( ( iconId ) => { result . push ( 'https://dofustouch.cdn.ankama.com/assets/2.34.8_kbu_6h45kmUJaqYJSzE(uwaos..pYYKs/gfx/items/' + iconId + '.png' ) ; } ) ; } return result ; } public getTotalCount ( ) { return this . resources . length ; } public getCountOfRessourcesCanBeUsed ( ) { return this . resources . filter ( r => r . state == State . canUse ) . length ; } } export interface Resource { elementId : number ; elementTypeId : number ; name : string ; elementState : State ; } export enum State { canUse , cantUse , inUse } export const iconIdByTypeId = { 84 : '15026' , 146 : '89002' , 38 : '34009' , 39 : '34080' , 42 : [ '34122' , '35117' , ] , 43 : '34082' , 44 : '34082' , 45 : '34154' , 46 : [ '34121' , '35156' , ] , 47 : '34083' , 111 : '34010' , 134 : '34552' , 1 : '38017' , 8 : '38092' , 28 : '38094' , 29 : '38073' , 30 : '38140' , 31 : '38153' , 32 : '38138' , 33 : '38086' , 34 : '38095' , 35 : '38139' , 98 : '38482' , 101 : '38481' , 108 : '38673' , 109 : '38672' , 110 : '38671' , 121 : '38001' , 133 : '38677' , 61 : '35191' , 66 : '36052' , 67 : '36067' , 68 : '35192' , 112 : '58067' , 131 : '35635' , 17 : '39024' , 24 : '39028' , 25 : '39022' , 26 : '39076' , 37 : '39077' , 52 : '39078' , 53 : '39108' , 54 : '39397' , 55 : '39109' , 113 : '39110' , 114 : '39111' , 135 : '39112' , 71 : [ '41292' , '41273' , '41269' , ] , 74 : [ '41394' , '41277' , '41305' , '41400' , ] , 75 : [ '41294' , '41394' , '41277' , ] , 76 : [ '41277' , '41305' , '41400' , '41290' , ] , 77 : [ '41273' , '41269' , '41309' , '41317' , ] , 78 : [ '41269' , '41317' , '41309' , '41296' , ] , 79 : [ '41400' , '41305' , '41290' , '41313' , ] , 80 : '41395' , 81 : [ '41317' , '41309' , '41296' , '41322' , ] , 132 : [ '41403' , '41271' , ] , 225 : '170877' } ; export const ressourcesToSkip = [ - 1 , 2 , 11 , 12 , 13 , 15 , 16 , 22 , 27 , 40 , 41 , 48 , 49 , 50 , 56 , 57 , 58 , 60 , 62 , 63 , 64 , 65 , 69 , 70 , 72 , 73 , 82 , 83 , 85 , 86 , 88 , 90 , 92 , 93 , 94 , 95 , 96 , 97 , 99 , 100 , 102 , 103 , 105 , 106 , 107 , 115 , 116 , 117 , 118 , 119 , 120 , 122 , 127 , 128 , 129 , 136 , 137 , 138 , 139 , 140 , 141 , 142 , 143 , 144 , 145 , 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154 , 155 , 156 , 157 , 158 , 159 , 160 , 161 , 162 , 163 , 164 , 165 , 166 , 167 , 168 , 169 , 170 , 171 , 172 , 173 , 174 , 175 , 176 , 177 , 178 , 179 , 180 , 181 , 182 , 183 , 184 , 185 , 186 , 187 , 188 , 189 , 190 , 191 , 192 , 193 , 194 , 195 , 196 , 197 , 198 , 199 , 200 , 201 , 202 , 203 , 204 , 205 , 206 , 207 , 208 , 209 , 210 , 211 , 212 , 213 , 214 , 215 , 216 , 217 , 218 , 219 , 220 , 221 , 222 , 223 , 224 , ] ;