Skip to content

Commit

Permalink
Revert point buff icon, add more default value
Browse files Browse the repository at this point in the history
  • Loading branch information
narumi147 committed Aug 12, 2023
1 parent 7dd8033 commit 6d6e9ad
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/app/modules/battle/simulation_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ class _SimulationPreviewState extends State<SimulationPreview> {
options.pointBuffs.remove(groupId);
}
String? icon = groupDetail?.icon;
icon ??= buffs.firstOrNull?.iconFix;
icon ??= buffs.firstOrNull?.icon;

rows.add(ListTile(
dense: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/event/event_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
pointName = Transl.itemNames(pointGroup.name).l;
}
pointName ??= S.current.event_point_reward + (rewardGroups.length > 1 ? ' $groupId' : '');
final icon = pointGroup?.icon ?? event.pointBuffs.firstWhereOrNull((buff) => buff.groupId == groupId)?.iconFix;
final icon = pointGroup?.icon ?? event.pointBuffs.firstWhereOrNull((buff) => buff.groupId == groupId)?.icon;
tabs.add(Tab(
child: Text.rich(TextSpan(children: [
if (icon != null) CenterWidgetSpan(child: db.getIconImage(icon, width: 24)),
Expand Down
6 changes: 5 additions & 1 deletion lib/app/modules/item/item_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ class _ItemListTabState extends State<ItemListTab> {
}
break;
case _ItemSortType.id:
sortedEntries.sort2((e) => e.key);
if (widget.category == ItemCategory.event) {
sortedEntries.sort2((e) => -e.key);
} else {
sortedEntries.sort2((e) => e.key);
}
break;
case _ItemSortType.owned:
sortedEntries.sort2((e) => e.key == Items.qpId ? double.negativeInfinity : db.curUser.items[e.key] ?? 0);
Expand Down
16 changes: 9 additions & 7 deletions lib/generated/models/gamedata/event.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 7 additions & 19 deletions lib/models/gamedata/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ class EventPointReward {
// String bgImageGet;

EventPointReward({
required this.groupId,
this.groupId = 0,
required this.point,
required this.gifts,
this.gifts = const [],
// required this.bgImagePoint,
// required this.bgImageGet,
});
Expand All @@ -576,7 +576,7 @@ class EventPointGroup {
String? icon;

EventPointGroup({
required this.groupId,
this.groupId = 0,
this.name = "",
String? icon,
}) : icon = icon != null && icon.endsWith('/Items/0.png') ? null : icon;
Expand Down Expand Up @@ -615,18 +615,6 @@ class EventPointBuff {
this.lv = 0,
});

String get iconFix {
if (groupId ~/ 100 == 80442) {
final match = RegExp(r'/Items/(\d+).png').firstMatch(icon);
String? iconId = match?.group(1);
if (iconId != null) {
iconId = iconId.padLeft(2, '0');
return "https://static.atlasacademy.io/JP/EventUI/Prefabs/80442/img_LeaderIcon$iconId.png";
}
}
return icon;
}

factory EventPointBuff.fromJson(Map<String, dynamic> json) => _$EventPointBuffFromJson(json);

Map<String, dynamic> toJson() => _$EventPointBuffToJson(this);
Expand All @@ -641,7 +629,7 @@ class EventPointActivity {
int objectValue;

EventPointActivity({
required this.groupId,
this.groupId = 0,
this.point = 0,
this.objectType = EventPointActivityObjectType.none,
this.objectId = 0,
Expand Down Expand Up @@ -1097,9 +1085,9 @@ class EventRewardScene {
List<EventRewardSceneFlag> flags;

EventRewardScene({
required this.slot,
required this.groupId,
required this.type,
this.slot = 0,
this.groupId = 0,
this.type = 0,
this.guides = const [],
required this.tabOnImage,
required this.tabOffImage,
Expand Down

0 comments on commit 6d6e9ad

Please sign in to comment.