Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix: update steel path entities
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerOrnstein committed Mar 21, 2021
1 parent 51a7d9e commit b878f46
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 9 deletions.
16 changes: 14 additions & 2 deletions lib/src/entities/worldstate/steel_path.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:equatable/equatable.dart';

import '../../../objects.dart';

class SteelPath extends WorldstateObject {
Expand All @@ -8,9 +10,19 @@ class SteelPath extends WorldstateObject {
required this.rotation,
}) : super(activation: activation, expiry: expiry);

final String currentReward;
final List<String> rotation;
final SteelPathReward currentReward;
final List<SteelPathReward> rotation;

@override
List<Object?> get props => super.props..addAll([currentReward, rotation]);
}

class SteelPathReward extends Equatable {
const SteelPathReward({required this.name, required this.cost});

final String name;
final int cost;

@override
List<Object?> get props => [name, cost];
}
22 changes: 20 additions & 2 deletions lib/src/models/worldstate/steel_path_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class SteelPathMdoel extends SteelPath {
const SteelPathMdoel({
required DateTime activation,
required DateTime expiry,
required String currentReward,
required List<String> rotation,
required this.currentReward,
required this.rotation,
}) : super(
activation: activation,
expiry: expiry,
Expand All @@ -22,5 +22,23 @@ class SteelPathMdoel extends SteelPath {
return _$SteelPathMdoelFromJson(json);
}

@override
final SteelPathRewardModel currentReward;

@override
final List<SteelPathRewardModel> rotation;

Map<String, dynamic> toJson() => _$SteelPathMdoelToJson(this);
}

@JsonSerializable()
class SteelPathRewardModel extends SteelPathReward {
SteelPathRewardModel({required String name, required int cost})
: super(name: name, cost: cost);

factory SteelPathRewardModel.fromJson(Map<String, dynamic> json) {
return _$SteelPathRewardModelFromJson(json);
}

Map<String, dynamic> toJson() => _$SteelPathRewardModelToJson(this);
}
36 changes: 31 additions & 5 deletions lib/src/models/worldstate/steel_path_model.g.dart

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

0 comments on commit b878f46

Please sign in to comment.