update stats after using bulk allocation. Fixes #845

This commit is contained in:
Phillip Thelen 2017-11-02 17:49:44 +01:00
parent cfa0e22290
commit d61fea5e76

View file

@ -230,6 +230,18 @@ class UserRepositoryImpl(localRepository: UserLocalRepository, apiClient: ApiCli
override fun bulkAllocatePoints(user: User?, strength: Int, intelligence: Int, constitution: Int, perception: Int): Observable<Stats> =
apiClient.bulkAllocatePoints(strength, intelligence, constitution, perception)
.doOnNext { stats ->
if (user != null && user.isManaged) {
localRepository.executeTransaction {
user.stats.str = stats.str
user.stats.con = stats.con
user.stats.per = stats.per
user.stats._int = stats._int
user.stats.points = stats.points
user.stats.mp = stats.mp
}
}
}
override fun runCron(tasks: List<Task>) {
val observable: Observable<List<TaskScoringResult>> = if (tasks.isNotEmpty()) {