|
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.game.handler.loader; |
|
21
|
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.core.di.Container; |
|
23
|
|
|
import fr.quatrevieux.araknemu.core.di.ContainerException; |
|
24
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.PacketHandler; |
|
25
|
|
|
import fr.quatrevieux.araknemu.game.chat.ChatService; |
|
26
|
|
|
import fr.quatrevieux.araknemu.game.exploration.ExplorationService; |
|
27
|
|
|
import fr.quatrevieux.araknemu.game.handler.EnsureFightingOrSpectator; |
|
28
|
|
|
import fr.quatrevieux.araknemu.game.handler.EnsureInactiveFight; |
|
29
|
|
|
import fr.quatrevieux.araknemu.game.handler.EnsurePlaying; |
|
30
|
|
|
import fr.quatrevieux.araknemu.game.handler.account.BoostCharacteristic; |
|
31
|
|
|
import fr.quatrevieux.araknemu.game.handler.chat.SaveSubscription; |
|
32
|
|
|
import fr.quatrevieux.araknemu.game.handler.chat.SendMessage; |
|
33
|
|
|
import fr.quatrevieux.araknemu.game.handler.fight.LeaveFight; |
|
34
|
|
|
import fr.quatrevieux.araknemu.game.handler.fight.LeaveSpectatorFight; |
|
35
|
|
|
import fr.quatrevieux.araknemu.game.handler.game.CreateGame; |
|
36
|
|
|
import fr.quatrevieux.araknemu.game.handler.object.MoveObject; |
|
37
|
|
|
import fr.quatrevieux.araknemu.game.handler.object.RemoveObject; |
|
38
|
|
|
import fr.quatrevieux.araknemu.game.handler.spell.MoveSpell; |
|
39
|
|
|
import fr.quatrevieux.araknemu.game.handler.spell.UpgradeSpell; |
|
40
|
|
|
import fr.quatrevieux.araknemu.network.game.GameSession; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Loader for playing packets |
|
44
|
|
|
*/ |
|
45
|
|
|
public final class PlayingLoader extends AbstractLoader { |
|
46
|
|
|
public PlayingLoader() { |
|
47
|
1 |
|
super(EnsurePlaying::new); |
|
48
|
1 |
|
} |
|
49
|
|
|
|
|
50
|
|
|
@Override |
|
51
|
|
|
@SuppressWarnings("unchecked") |
|
52
|
|
|
protected PacketHandler<GameSession, ?>[] handlers(Container container) throws ContainerException { |
|
53
|
1 |
|
return new PacketHandler[] { |
|
54
|
|
|
new CreateGame( |
|
55
|
1 |
|
container.get(ExplorationService.class) |
|
56
|
|
|
), |
|
57
|
|
|
new SendMessage( |
|
58
|
1 |
|
container.get(ChatService.class) |
|
59
|
|
|
), |
|
60
|
|
|
new SaveSubscription(), |
|
61
|
|
|
new EnsureInactiveFight(new MoveObject()), |
|
62
|
|
|
new EnsureInactiveFight(new RemoveObject()), |
|
63
|
|
|
new EnsureInactiveFight(new BoostCharacteristic()), |
|
64
|
|
|
new EnsureInactiveFight(new UpgradeSpell()), |
|
65
|
|
|
new MoveSpell(), |
|
66
|
|
|
new EnsureFightingOrSpectator(new LeaveFight(), new LeaveSpectatorFight()), |
|
67
|
|
|
}; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|