1
|
|
|
/* |
2
|
|
|
* This file is part of Araknemu. |
3
|
|
|
* |
4
|
|
|
* Araknemu is free software: you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* Araknemu is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU Lesser General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
15
|
|
|
* along with Araknemu. If not, see <https://www.gnu.org/licenses/>. |
16
|
|
|
* |
17
|
|
|
* Copyright (c) 2017-2019 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.quatrevieux.araknemu.network.game.out.fight; |
21
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.FightRewardsSheet; |
23
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.DropReward; |
24
|
|
|
import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; |
25
|
|
|
|
26
|
|
|
import java.util.stream.Collectors; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The fight is terminated |
30
|
|
|
* |
31
|
|
|
* https://github.com/Emudofus/Dofus/blob/1.29/dofus/aks/Game.as#L1240 |
32
|
|
|
*/ |
33
|
|
|
public final class FightEnd { |
34
|
|
|
private final FightRewardsSheet rewardsSheet; |
35
|
|
|
|
36
|
1 |
|
public FightEnd(FightRewardsSheet rewardsSheet) { |
37
|
1 |
|
this.rewardsSheet = rewardsSheet; |
38
|
1 |
|
} |
39
|
|
|
|
40
|
|
|
@Override |
41
|
|
|
public String toString() { |
42
|
|
|
// See: https://github.com/Emudofus/Dofus/blob/1.29/dofus/aks/Game.as#L1419 |
43
|
|
|
// this id is used to wait for animation termination |
44
|
1 |
|
final Fighter lastFighter = rewardsSheet.results().fight().turnList().currentFighter(); |
45
|
|
|
|
46
|
1 |
|
return "GE" + |
47
|
1 |
|
rewardsSheet.results().fight().duration() + "|" + |
48
|
1 |
|
(lastFighter == null ? 0 : lastFighter.id()) + "|" + |
49
|
1 |
|
rewardsSheet.type().ordinal() + "|" + |
50
|
1 |
|
rewardsSheet.rewards().stream().map(DropReward::render).collect(Collectors.joining("|")) |
51
|
|
|
; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|