Skip to content

Commit

Permalink
We can now filter weapons by their location
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Feb 27, 2021
1 parent 79d297d commit 00d5db5
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/db/characters.json
Expand Up @@ -14615,7 +14615,7 @@
},
{
"key": "Rosaria",
"rarity": 5,
"rarity": 4,
"weaponType": "polearm",
"elementType": "cryo",
"image": "Rosaria.png",
Expand Down
221 changes: 221 additions & 0 deletions assets/db/weapons.json
Expand Up @@ -3938,6 +3938,23 @@
"isAnAscension": false,
"specificValue": 69
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_bow_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -4637,6 +4654,23 @@
"isAnAscension": false,
"specificValue": 41.3
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_bow_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -10691,6 +10725,23 @@
"isAnAscension": false,
"specificValue": 165
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_sword_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -11385,6 +11436,23 @@
"isAnAscension": false,
"specificValue": 34.5
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_sword_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -18809,6 +18877,23 @@
"isAnAscension": false,
"specificValue": 110
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_catalyst_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -19161,6 +19246,23 @@
"isAnAscension": false,
"specificValue": 41.3
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_catalyst_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -21630,6 +21732,23 @@
"isAnAscension": false,
"specificValue": 41.3
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_catalyst_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -26628,6 +26747,23 @@
"isAnAscension": false,
"specificValue": 27.6
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_claymore_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -28373,6 +28509,23 @@
"isAnAscension": false,
"specificValue": 51.7
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_claymore_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -29082,6 +29235,23 @@
"isAnAscension": false,
"specificValue": 34.5
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_claymore_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -32335,6 +32505,23 @@
"isAnAscension": false,
"specificValue": 34.5
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_polearm_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -33738,6 +33925,23 @@
"isAnAscension": false,
"specificValue": 45.9
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_polearm_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down Expand Up @@ -34794,6 +34998,23 @@
"isAnAscension": false,
"specificValue": 69
}
],
"craftingMaterials": [
{
"quantity": 1,
"materialType": "ingredient",
"image": "northlander_polearm_prototype.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "crystal_chunk.png"
},
{
"quantity": 50,
"materialType": "ingredient",
"image": "white_iron_chunk.png"
}
]
},
{
Expand Down
12 changes: 12 additions & 0 deletions lib/application/weapons/weapons_bloc.dart
Expand Up @@ -46,20 +46,23 @@ class WeaponsBloc extends Bloc<WeaponsEvent, WeaponsState> {
weaponSubStatType: currentState.weaponSubStatType,
),
weaponSubStatTypeChanged: (e) => currentState.copyWith.call(tempWeaponSubStatType: e.subStatType),
weaponLocationTypeChanged: (e) => currentState.copyWith.call(tempWeaponLocationType: e.locationType),
applyFilterChanges: (_) => _buildInitialState(
search: currentState.search,
weaponFilterType: currentState.tempWeaponFilterType,
rarity: currentState.tempRarity,
sortDirectionType: currentState.tempSortDirectionType,
weaponTypes: currentState.tempWeaponTypes,
weaponSubStatType: currentState.tempWeaponSubStatType,
locationType: currentState.tempWeaponLocationType,
),
cancelChanges: (_) => currentState.copyWith.call(
tempWeaponFilterType: currentState.weaponFilterType,
tempRarity: currentState.rarity,
tempSortDirectionType: currentState.sortDirectionType,
tempWeaponTypes: currentState.weaponTypes,
tempWeaponSubStatType: currentState.weaponSubStatType,
tempWeaponLocationType: currentState.weaponLocationType,
),
);

Expand All @@ -73,6 +76,7 @@ class WeaponsBloc extends Bloc<WeaponsEvent, WeaponsState> {
WeaponFilterType weaponFilterType = WeaponFilterType.rarity,
SortDirectionType sortDirectionType = SortDirectionType.asc,
StatType weaponSubStatType = StatType.all,
ItemLocationType locationType = ItemLocationType.all,
}) {
final isLoaded = state is _LoadedState;
var data = _genshinService.getWeaponsForCard();
Expand All @@ -94,6 +98,8 @@ class WeaponsBloc extends Bloc<WeaponsEvent, WeaponsState> {
showWeaponDetails: _settingsService.showWeaponDetails,
weaponSubStatType: weaponSubStatType,
tempWeaponSubStatType: weaponSubStatType,
weaponLocationType: locationType,
tempWeaponLocationType: locationType,
);
}

Expand All @@ -113,6 +119,10 @@ class WeaponsBloc extends Bloc<WeaponsEvent, WeaponsState> {
data = data.where((el) => el.subStatType == weaponSubStatType).toList();
}

if (locationType != ItemLocationType.all) {
data = data.where((el) => el.locationType == locationType).toList();
}

_sortData(data, weaponFilterType, sortDirectionType);

final s = currentState.copyWith.call(
Expand All @@ -128,6 +138,8 @@ class WeaponsBloc extends Bloc<WeaponsEvent, WeaponsState> {
tempSortDirectionType: sortDirectionType,
weaponSubStatType: weaponSubStatType,
tempWeaponSubStatType: weaponSubStatType,
weaponLocationType: locationType,
tempWeaponLocationType: locationType,
);
return s;
}
Expand Down
1 change: 1 addition & 0 deletions lib/application/weapons/weapons_event.dart
Expand Up @@ -13,6 +13,7 @@ abstract class WeaponsEvent with _$WeaponsEvent {
const factory WeaponsEvent.applyFilterChanges() = _ApplyFilterChanges;
const factory WeaponsEvent.sortDirectionTypeChanged(SortDirectionType sortDirectionType) = _SortDirectionTypeChanged;
const factory WeaponsEvent.weaponSubStatTypeChanged(StatType subStatType) = _WeaponSubStatTypeChanged;
const factory WeaponsEvent.weaponLocationTypeChanged(ItemLocationType locationType) = _WeaponLocationTypeChanged;

const factory WeaponsEvent.cancelChanges() = _CancelChanges;
}
2 changes: 2 additions & 0 deletions lib/application/weapons/weapons_state.dart
Expand Up @@ -17,5 +17,7 @@ abstract class WeaponsState with _$WeaponsState {
@required SortDirectionType tempSortDirectionType,
@required StatType weaponSubStatType,
@required StatType tempWeaponSubStatType,
@required ItemLocationType weaponLocationType,
@required ItemLocationType tempWeaponLocationType,
}) = _LoadedState;
}

0 comments on commit 00d5db5

Please sign in to comment.