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-2020 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.quatrevieux.araknemu.game; |
21
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.Araknemu; |
23
|
|
|
import fr.quatrevieux.araknemu.common.account.banishment.BanIpService; |
24
|
|
|
import fr.quatrevieux.araknemu.common.account.banishment.BanishmentService; |
25
|
|
|
import fr.quatrevieux.araknemu.common.account.banishment.network.BanIpCheck; |
26
|
|
|
import fr.quatrevieux.araknemu.common.session.SessionLogService; |
27
|
|
|
import fr.quatrevieux.araknemu.core.di.ContainerConfigurator; |
28
|
|
|
import fr.quatrevieux.araknemu.core.di.ContainerModule; |
29
|
|
|
import fr.quatrevieux.araknemu.core.event.DefaultListenerAggregate; |
30
|
|
|
import fr.quatrevieux.araknemu.core.event.ListenerAggregate; |
31
|
|
|
import fr.quatrevieux.araknemu.core.network.Server; |
32
|
|
|
import fr.quatrevieux.araknemu.core.network.netty.NettyServer; |
33
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.AggregatePacketParser; |
34
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.AggregateParserLoader; |
35
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.DefaultDispatcher; |
36
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.Dispatcher; |
37
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.PacketParser; |
38
|
|
|
import fr.quatrevieux.araknemu.core.network.parser.ParserLoader; |
39
|
|
|
import fr.quatrevieux.araknemu.core.network.session.SessionConfigurator; |
40
|
|
|
import fr.quatrevieux.araknemu.core.network.session.SessionFactory; |
41
|
|
|
import fr.quatrevieux.araknemu.core.network.session.extension.RateLimiter; |
42
|
|
|
import fr.quatrevieux.araknemu.core.network.session.extension.SessionLogger; |
43
|
|
|
import fr.quatrevieux.araknemu.data.constant.Characteristic; |
44
|
|
|
import fr.quatrevieux.araknemu.data.living.constraint.player.PlayerConstraints; |
45
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.BanIpRepository; |
46
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.account.AccountBankRepository; |
47
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.account.AccountRepository; |
48
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.account.BanishmentRepository; |
49
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.account.BankItemRepository; |
50
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.account.ConnectionLogRepository; |
51
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.player.PlayerItemRepository; |
52
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.player.PlayerRepository; |
53
|
|
|
import fr.quatrevieux.araknemu.data.living.repository.player.PlayerSpellRepository; |
54
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.SpellTemplateRepository; |
55
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.character.PlayerExperienceRepository; |
56
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.character.PlayerRaceRepository; |
57
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.MapTemplateRepository; |
58
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.MapTriggerRepository; |
59
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.area.AreaRepository; |
60
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.area.SubAreaRepository; |
61
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.npc.NpcExchangeRepository; |
62
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.npc.NpcRepository; |
63
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.npc.NpcTemplateRepository; |
64
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.npc.QuestionRepository; |
65
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.environment.npc.ResponseActionRepository; |
66
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.item.ItemSetRepository; |
67
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.item.ItemTemplateRepository; |
68
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.item.ItemTypeRepository; |
69
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.monster.MonsterGroupDataRepository; |
70
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.monster.MonsterGroupPositionRepository; |
71
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.monster.MonsterRewardItemRepository; |
72
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.monster.MonsterRewardRepository; |
73
|
|
|
import fr.quatrevieux.araknemu.data.world.repository.monster.MonsterTemplateRepository; |
74
|
|
|
import fr.quatrevieux.araknemu.game.account.AccountService; |
75
|
|
|
import fr.quatrevieux.araknemu.game.account.CharactersService; |
76
|
|
|
import fr.quatrevieux.araknemu.game.account.TokenService; |
77
|
|
|
import fr.quatrevieux.araknemu.game.account.bank.BankService; |
78
|
|
|
import fr.quatrevieux.araknemu.game.account.generator.CamelizeName; |
79
|
|
|
import fr.quatrevieux.araknemu.game.account.generator.NameCheckerGenerator; |
80
|
|
|
import fr.quatrevieux.araknemu.game.account.generator.NameGenerator; |
81
|
|
|
import fr.quatrevieux.araknemu.game.account.generator.SimpleNameGenerator; |
82
|
|
|
import fr.quatrevieux.araknemu.game.activity.ActivityService; |
83
|
|
|
import fr.quatrevieux.araknemu.game.chat.ChannelType; |
84
|
|
|
import fr.quatrevieux.araknemu.game.chat.ChatService; |
85
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.Channel; |
86
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.FightChannel; |
87
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.FightSpectatorChannel; |
88
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.FightTeamChannel; |
89
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.FloodGuardChannel; |
90
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.GlobalChannel; |
91
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.MapChannel; |
92
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.NullChannel; |
93
|
|
|
import fr.quatrevieux.araknemu.game.chat.channel.PrivateChannel; |
94
|
|
|
import fr.quatrevieux.araknemu.game.connector.ConnectorService; |
95
|
|
|
import fr.quatrevieux.araknemu.game.connector.RealmConnector; |
96
|
|
|
import fr.quatrevieux.araknemu.game.exploration.ExplorationService; |
97
|
|
|
import fr.quatrevieux.araknemu.game.exploration.area.AreaService; |
98
|
|
|
import fr.quatrevieux.araknemu.game.exploration.exchange.DefaultExchangeFactory; |
99
|
|
|
import fr.quatrevieux.araknemu.game.exploration.exchange.ExchangeFactory; |
100
|
|
|
import fr.quatrevieux.araknemu.game.exploration.exchange.npc.NpcExchangeFactories; |
101
|
|
|
import fr.quatrevieux.araknemu.game.exploration.exchange.player.PlayerExchangeFactories; |
102
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.ActionFactory; |
103
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.ExplorationActionRegistry; |
104
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.challenge.ChallengeActionsFactories; |
105
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.fight.FightActionsFactories; |
106
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.move.MoveFactory; |
107
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.move.validator.StopOnTrigger; |
108
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.move.validator.ValidateOverweight; |
109
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.move.validator.ValidateRestrictedDirections; |
110
|
|
|
import fr.quatrevieux.araknemu.game.exploration.interaction.action.move.validator.ValidateWalkable; |
111
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.ExplorationMapService; |
112
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.GeolocationService; |
113
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.CellLoader; |
114
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.CellLoaderAggregate; |
115
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.MapTriggerService; |
116
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.TriggerLoader; |
117
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.action.ActionFactoryRegistry; |
118
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.action.CellActionFactory; |
119
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.action.teleport.Teleport; |
120
|
|
|
import fr.quatrevieux.araknemu.game.exploration.map.cell.trigger.action.teleport.TeleportFactory; |
121
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.NpcService; |
122
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.DialogService; |
123
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.action.exchange.OpenBank; |
124
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.action.object.RemoveObject; |
125
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.action.teleport.GoToAstrub; |
126
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.parameter.BankCostResolver; |
127
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.parameter.GetterResolver; |
128
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.parameter.ParametersResolver; |
129
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.dialog.parameter.VariableResolver; |
130
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.exchange.NpcExchangeService; |
131
|
|
|
import fr.quatrevieux.araknemu.game.exploration.npc.store.NpcStoreService; |
132
|
|
|
import fr.quatrevieux.araknemu.game.fight.Fight; |
133
|
|
|
import fr.quatrevieux.araknemu.game.fight.FightService; |
134
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.AiFactory; |
135
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.ChainAiFactory; |
136
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.MonsterAiFactory; |
137
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.type.Aggressive; |
138
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.type.Fixed; |
139
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.type.Runaway; |
140
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.type.Support; |
141
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.factory.type.Tactical; |
142
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.Simulator; |
143
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.AlterActionPointsSimulator; |
144
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.AlterCharacteristicSimulator; |
145
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.ArmorSimulator; |
146
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.DamageSimulator; |
147
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.HealSimulator; |
148
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.PunishmentSimulator; |
149
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.RemovePointsSimulator; |
150
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.SetStateSimulator; |
151
|
|
|
import fr.quatrevieux.araknemu.game.fight.ai.simulation.effect.StealLifeSimulator; |
152
|
|
|
import fr.quatrevieux.araknemu.game.fight.builder.ChallengeBuilderFactory; |
153
|
|
|
import fr.quatrevieux.araknemu.game.fight.builder.PvmBuilderFactory; |
154
|
|
|
import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; |
155
|
|
|
import fr.quatrevieux.araknemu.game.fight.castable.spell.SpellConstraintsValidator; |
156
|
|
|
import fr.quatrevieux.araknemu.game.fight.castable.weapon.WeaponConstraintsValidator; |
157
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.AddExperience; |
158
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.AddItems; |
159
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.AddKamas; |
160
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.ReturnToSavePosition; |
161
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.SetDead; |
162
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.action.SynchronizeLife; |
163
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.pvm.PvmRewardsGenerator; |
164
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.pvm.provider.PvmEndFightActionProvider; |
165
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.pvm.provider.PvmItemDropProvider; |
166
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.pvm.provider.PvmKamasProvider; |
167
|
|
|
import fr.quatrevieux.araknemu.game.fight.ending.reward.drop.pvm.provider.PvmXpProvider; |
168
|
|
|
import fr.quatrevieux.araknemu.game.fight.fighter.DefaultFighterFactory; |
169
|
|
|
import fr.quatrevieux.araknemu.game.fight.fighter.FighterFactory; |
170
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.AiModule; |
171
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.CommonEffectsModule; |
172
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.IndirectSpellApplyEffectsModule; |
173
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.LaunchedSpellsModule; |
174
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.RaulebaqueModule; |
175
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.StatesModule; |
176
|
|
|
import fr.quatrevieux.araknemu.game.fight.spectator.DefaultSpectatorFactory; |
177
|
|
|
import fr.quatrevieux.araknemu.game.fight.spectator.SpectatorFactory; |
178
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.cast.CastFactory; |
179
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.closeCombat.CloseCombatFactory; |
180
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.factory.FightActionsFactoryRegistry; |
181
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.move.validators.FightPathValidator; |
182
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.move.validators.StopOnEnemyValidator; |
183
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.move.validators.TackleValidator; |
184
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.util.BaseCriticalityStrategy; |
185
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.action.util.CriticalityStrategy; |
186
|
|
|
import fr.quatrevieux.araknemu.game.fight.type.ChallengeType; |
187
|
|
|
import fr.quatrevieux.araknemu.game.fight.type.PvmType; |
188
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.AdminLoader; |
189
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.AggregateLoader; |
190
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.CommonLoader; |
191
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.ExploringLoader; |
192
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.ExploringOrFightingLoader; |
193
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.FightingLoader; |
194
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.LoggedLoader; |
195
|
|
|
import fr.quatrevieux.araknemu.game.handler.loader.PlayingLoader; |
196
|
|
|
import fr.quatrevieux.araknemu.game.item.ItemService; |
197
|
|
|
import fr.quatrevieux.araknemu.game.item.SuperType; |
198
|
|
|
import fr.quatrevieux.araknemu.game.item.effect.mapping.EffectToCharacteristicMapping; |
199
|
|
|
import fr.quatrevieux.araknemu.game.item.effect.mapping.EffectToSpecialMapping; |
200
|
|
|
import fr.quatrevieux.araknemu.game.item.effect.mapping.EffectToUseMapping; |
201
|
|
|
import fr.quatrevieux.araknemu.game.item.effect.mapping.EffectToWeaponMapping; |
202
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.DefaultItemFactory; |
203
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.ItemFactory; |
204
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.ResourceFactory; |
205
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.UsableFactory; |
206
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.WeaponFactory; |
207
|
|
|
import fr.quatrevieux.araknemu.game.item.factory.WearableFactory; |
208
|
|
|
import fr.quatrevieux.araknemu.game.monster.MonsterService; |
209
|
|
|
import fr.quatrevieux.araknemu.game.monster.environment.MonsterEnvironmentService; |
210
|
|
|
import fr.quatrevieux.araknemu.game.monster.group.MonsterGroupFactory; |
211
|
|
|
import fr.quatrevieux.araknemu.game.monster.group.generator.FixedMonsterListGenerator; |
212
|
|
|
import fr.quatrevieux.araknemu.game.monster.group.generator.MonsterListGeneratorSwitch; |
213
|
|
|
import fr.quatrevieux.araknemu.game.monster.group.generator.RandomMonsterListGenerator; |
214
|
|
|
import fr.quatrevieux.araknemu.game.monster.reward.MonsterRewardService; |
215
|
|
|
import fr.quatrevieux.araknemu.game.player.PlayerService; |
216
|
|
|
import fr.quatrevieux.araknemu.game.player.experience.PlayerExperienceService; |
217
|
|
|
import fr.quatrevieux.araknemu.game.player.inventory.InventoryService; |
218
|
|
|
import fr.quatrevieux.araknemu.game.player.race.PlayerRaceService; |
219
|
|
|
import fr.quatrevieux.araknemu.game.player.spell.SpellBookService; |
220
|
|
|
import fr.quatrevieux.araknemu.game.spell.SpellService; |
221
|
|
|
import fr.quatrevieux.araknemu.game.spell.effect.SpellEffectService; |
222
|
|
|
import fr.quatrevieux.araknemu.network.game.GameExceptionConfigurator; |
223
|
|
|
import fr.quatrevieux.araknemu.network.game.GamePacketConfigurator; |
224
|
|
|
import fr.quatrevieux.araknemu.network.game.GameSession; |
225
|
|
|
import fr.quatrevieux.araknemu.network.game.in.GameParserLoader; |
226
|
|
|
import fr.quatrevieux.araknemu.network.in.CommonParserLoader; |
227
|
|
|
import fr.quatrevieux.araknemu.game.fight.module.MonsterInvocationModule; |
228
|
|
|
import org.apache.logging.log4j.LogManager; |
229
|
|
|
import org.apache.logging.log4j.Logger; |
230
|
|
|
|
231
|
|
|
import java.util.Arrays; |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Module for game service |
235
|
|
|
*/ |
236
|
|
|
public final class GameModule implements ContainerModule { |
237
|
|
|
private final Araknemu app; |
238
|
|
|
|
239
|
1 |
|
public GameModule(Araknemu app) { |
240
|
1 |
|
this.app = app; |
241
|
1 |
|
} |
242
|
|
|
|
243
|
|
|
@Override |
244
|
|
|
public void configure(ContainerConfigurator configurator) { |
245
|
1 |
|
configurator.factory( |
246
|
|
|
Logger.class, |
247
|
1 |
|
container -> LogManager.getLogger(GameService.class) |
248
|
|
|
); |
249
|
|
|
|
250
|
1 |
|
configurator.persist( |
251
|
|
|
GameService.class, |
252
|
1 |
|
container -> new GameService( |
253
|
1 |
|
container.get(GameConfiguration.class), |
254
|
1 |
|
container.get(RealmConnector.class), |
255
|
1 |
|
container.get(Server.class), |
256
|
1 |
|
container.get(Logger.class), |
257
|
1 |
|
container.get(ListenerAggregate.class), |
258
|
|
|
|
259
|
|
|
// Preload |
260
|
1 |
|
Arrays.asList( |
261
|
1 |
|
container.get(ItemService.class), |
262
|
1 |
|
container.get(SpellService.class), |
263
|
|
|
|
264
|
1 |
|
container.get(DialogService.class), |
265
|
1 |
|
container.get(NpcExchangeService.class), |
266
|
1 |
|
container.get(NpcService.class), |
267
|
|
|
|
268
|
1 |
|
container.get(MonsterRewardService.class), |
269
|
1 |
|
container.get(MonsterService.class), |
270
|
1 |
|
container.get(MonsterEnvironmentService.class), |
271
|
|
|
|
272
|
1 |
|
container.get(AreaService.class), |
273
|
1 |
|
container.get(MapTriggerService.class), |
274
|
1 |
|
container.get(ExplorationMapService.class), |
275
|
|
|
|
276
|
1 |
|
container.get(PlayerRaceService.class), |
277
|
1 |
|
container.get(PlayerExperienceService.class), |
278
|
|
|
|
279
|
1 |
|
container.get(GameBanIpSynchronizer.class), |
280
|
1 |
|
container.get(SavingService.class) |
281
|
|
|
), |
282
|
|
|
|
283
|
|
|
// Subscribers |
284
|
1 |
|
Arrays.asList( |
285
|
1 |
|
container.get(AreaService.class), |
286
|
1 |
|
container.get(ExplorationMapService.class), |
287
|
1 |
|
container.get(MapTriggerService.class), |
288
|
1 |
|
container.get(ChatService.class), |
289
|
1 |
|
container.get(InventoryService.class), |
290
|
1 |
|
container.get(SpellBookService.class), |
291
|
1 |
|
container.get(PlayerExperienceService.class), |
292
|
1 |
|
container.get(FightService.class), |
293
|
1 |
|
container.get(ExplorationService.class), |
294
|
1 |
|
container.get(NpcService.class), |
295
|
1 |
|
container.get(MonsterEnvironmentService.class), |
296
|
1 |
|
container.get(NpcExchangeService.class), |
297
|
1 |
|
container.get(ActivityService.class), |
298
|
1 |
|
container.get(PlayerService.class), |
299
|
1 |
|
container.get(AccountService.class), |
300
|
1 |
|
container.get(ShutdownService.class), |
301
|
1 |
|
container.get(GameBanIpSynchronizer.class), |
302
|
1 |
|
container.get(SavingService.class) |
303
|
|
|
) |
304
|
|
|
) |
305
|
|
|
); |
306
|
|
|
|
307
|
1 |
|
configurator.factory( |
308
|
|
|
GameConfiguration.class, |
309
|
1 |
|
container -> app.configuration().module(GameConfiguration.MODULE) |
310
|
|
|
); |
311
|
|
|
|
312
|
1 |
|
configurator.factory( |
313
|
|
|
Server.class, |
314
|
1 |
|
container -> new NettyServer( |
315
|
1 |
|
container.get(SessionFactory.class), |
316
|
1 |
|
container.get(GameConfiguration.class).port(), |
317
|
1 |
|
container.get(GameConfiguration.class).inactivityTime() |
318
|
|
|
) |
319
|
|
|
); |
320
|
|
|
|
321
|
1 |
|
configurator.factory( |
322
|
|
|
SessionFactory.class, |
323
|
1 |
|
container -> new SessionConfigurator<>(GameSession::new) |
324
|
1 |
|
.add(new BanIpCheck<>(container.get(BanIpService.class))) |
325
|
1 |
|
.add(new RateLimiter.Configurator<>(container.get(GameConfiguration.class).packetRateLimit())) |
326
|
1 |
|
.add(new SessionLogger.Configurator<>(container.get(Logger.class))) |
327
|
1 |
|
.add(new GameExceptionConfigurator(container.get(Logger.class))) |
328
|
1 |
|
.add(new GamePacketConfigurator( |
329
|
1 |
|
container.get(Dispatcher.class), |
330
|
1 |
|
container.get(PacketParser.class) |
331
|
|
|
)) |
332
|
|
|
); |
333
|
|
|
|
334
|
1 |
|
configurator.factory( |
335
|
|
|
Dispatcher.class, |
336
|
1 |
|
container -> new DefaultDispatcher( |
337
|
|
|
new AggregateLoader( |
338
|
|
|
new CommonLoader(), |
339
|
|
|
new LoggedLoader(), |
340
|
|
|
new PlayingLoader(), |
341
|
|
|
new ExploringLoader(), |
342
|
|
|
new AdminLoader(), // @todo should be defined into the AdminModule |
|
|
|
|
343
|
|
|
new FightingLoader(), |
344
|
|
|
new ExploringOrFightingLoader() |
345
|
1 |
|
).load(container) |
346
|
|
|
) |
347
|
|
|
); |
348
|
|
|
|
349
|
1 |
|
configurator.factory( |
350
|
|
|
PacketParser.class, |
351
|
1 |
|
container -> new AggregatePacketParser( |
352
|
|
|
new AggregateParserLoader( |
353
|
|
|
new ParserLoader[]{ |
354
|
|
|
new CommonParserLoader(), |
355
|
|
|
new GameParserLoader(), |
356
|
|
|
} |
357
|
1 |
|
).load() |
358
|
|
|
) |
359
|
|
|
); |
360
|
|
|
|
361
|
1 |
|
configurator.factory( |
362
|
|
|
PlayerConstraints.class, |
363
|
1 |
|
container -> new PlayerConstraints( |
364
|
1 |
|
container.get(PlayerRepository.class), |
365
|
1 |
|
container.get(GameConfiguration.class).player() |
366
|
|
|
) |
367
|
|
|
); |
368
|
|
|
|
369
|
1 |
|
configureServices(configurator); |
370
|
1 |
|
} |
371
|
|
|
|
372
|
|
|
private void configureServices(ContainerConfigurator configurator) { |
|
|
|
|
373
|
1 |
|
configurator.persist( |
374
|
|
|
ConnectorService.class, |
375
|
1 |
|
container -> new ConnectorService( |
376
|
1 |
|
container.get(TokenService.class), |
377
|
1 |
|
container.get(AccountService.class) |
378
|
|
|
) |
379
|
|
|
); |
380
|
|
|
|
381
|
1 |
|
configurator.persist( |
382
|
|
|
TokenService.class, |
383
|
1 |
|
container -> new TokenService() |
384
|
|
|
); |
385
|
|
|
|
386
|
1 |
|
configurator.persist( |
387
|
|
|
AccountService.class, |
388
|
1 |
|
container -> new AccountService( |
389
|
1 |
|
container.get(AccountRepository.class), |
390
|
1 |
|
container.get(GameConfiguration.class) |
391
|
|
|
) |
392
|
|
|
); |
393
|
|
|
|
394
|
1 |
|
configurator.persist( |
395
|
|
|
CharactersService.class, |
396
|
1 |
|
container -> new CharactersService( |
397
|
1 |
|
container.get(PlayerRepository.class), |
398
|
1 |
|
container.get(PlayerConstraints.class), |
399
|
1 |
|
container.get(PlayerRaceRepository.class), |
400
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
401
|
1 |
|
container.get(PlayerItemRepository.class) |
402
|
|
|
) |
403
|
|
|
); |
404
|
|
|
|
405
|
1 |
|
configurator.persist( |
406
|
|
|
PlayerService.class, |
407
|
1 |
|
container -> new PlayerService( |
408
|
1 |
|
container.get(PlayerRepository.class), |
409
|
1 |
|
container.get(GameConfiguration.class), |
410
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
411
|
1 |
|
container.get(InventoryService.class), |
412
|
1 |
|
container.get(PlayerRaceService.class), |
413
|
1 |
|
container.get(SpellBookService.class), |
414
|
1 |
|
container.get(PlayerExperienceService.class) |
415
|
|
|
) |
416
|
|
|
); |
417
|
|
|
|
418
|
1 |
|
configurator.persist( |
419
|
|
|
ExplorationService.class, |
420
|
1 |
|
container -> new ExplorationService( |
421
|
1 |
|
container.get(ExplorationMapService.class), |
422
|
1 |
|
container.get(GameConfiguration.class).player(), |
423
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class) |
424
|
|
|
) |
425
|
|
|
); |
426
|
|
|
|
427
|
1 |
|
configurator.persist( |
428
|
|
|
ExplorationMapService.class, |
429
|
1 |
|
container -> new ExplorationMapService( |
430
|
1 |
|
container.get(MapTemplateRepository.class), |
431
|
1 |
|
container.get(FightService.class), |
432
|
1 |
|
container.get(AreaService.class), |
433
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
434
|
|
|
// Use proxy to fix circular reference between ExplorationMapService and MapTriggerService |
435
|
1 |
|
(map, cells) -> container.get(CellLoader.class).load(map, cells) |
436
|
|
|
) |
437
|
|
|
); |
438
|
|
|
|
439
|
1 |
|
configurator.persist( |
440
|
|
|
GeolocationService.class, |
441
|
1 |
|
container -> new GeolocationService( |
442
|
1 |
|
container.get(ExplorationMapService.class), |
443
|
1 |
|
container.get(AreaService.class), |
444
|
1 |
|
container.get(MapTemplateRepository.class) |
445
|
|
|
) |
446
|
|
|
); |
447
|
|
|
|
448
|
1 |
|
configurator.persist( |
449
|
|
|
CellLoader.class, |
450
|
1 |
|
container -> new CellLoaderAggregate(new CellLoader[] { |
451
|
1 |
|
new TriggerLoader(container.get(MapTriggerService.class)), |
452
|
|
|
}) |
453
|
|
|
); |
454
|
|
|
|
455
|
1 |
|
configurator.persist( |
456
|
|
|
MapTriggerService.class, |
457
|
1 |
|
container -> new MapTriggerService( |
458
|
1 |
|
container.get(MapTriggerRepository.class), |
459
|
1 |
|
container.get(CellActionFactory.class) |
460
|
|
|
) |
461
|
|
|
); |
462
|
|
|
|
463
|
1 |
|
configurator.persist( |
464
|
|
|
CellActionFactory.class, |
465
|
1 |
|
container -> new ActionFactoryRegistry() |
466
|
1 |
|
.register(Teleport.ACTION_ID, new TeleportFactory(container.get(ExplorationMapService.class))) |
467
|
|
|
); |
468
|
|
|
|
469
|
1 |
|
configurator.persist( |
470
|
|
|
ActionFactory.class, |
471
|
1 |
|
container -> new ExplorationActionRegistry( |
472
|
|
|
new MoveFactory( |
473
|
|
|
new ValidateWalkable(), |
474
|
|
|
new ValidateOverweight(), |
475
|
|
|
new ValidateRestrictedDirections(), |
476
|
|
|
new StopOnTrigger() |
477
|
|
|
), |
478
|
1 |
|
new ChallengeActionsFactories(container.get(FightService.class)), |
479
|
|
|
new FightActionsFactories( |
480
|
1 |
|
container.get(FightService.class), |
481
|
1 |
|
container.get(FighterFactory.class), |
482
|
1 |
|
container.get(SpectatorFactory.class) |
483
|
|
|
) |
484
|
|
|
) |
485
|
|
|
); |
486
|
|
|
|
487
|
1 |
|
configurator.persist( |
488
|
|
|
ChatService.class, |
489
|
1 |
|
container -> new ChatService( |
490
|
1 |
|
container.get(GameConfiguration.class).chat(), |
491
|
|
|
new Channel[] { |
492
|
|
|
new MapChannel(), |
493
|
1 |
|
new GlobalChannel(ChannelType.INCARNAM, container.get(PlayerService.class)), |
494
|
|
|
new FloodGuardChannel( |
495
|
1 |
|
new GlobalChannel(ChannelType.TRADE, container.get(PlayerService.class)), |
496
|
1 |
|
container.get(GameConfiguration.class).chat() |
497
|
|
|
), |
498
|
|
|
new FloodGuardChannel( |
499
|
1 |
|
new GlobalChannel(ChannelType.RECRUITMENT, container.get(PlayerService.class)), |
500
|
1 |
|
container.get(GameConfiguration.class).chat() |
501
|
|
|
), |
502
|
|
|
new GlobalChannel( |
503
|
|
|
ChannelType.ADMIN, |
504
|
1 |
|
player -> player.account().isMaster(), |
505
|
1 |
|
container.get(PlayerService.class) |
506
|
|
|
), |
507
|
|
|
new NullChannel(ChannelType.MEETIC), |
508
|
1 |
|
new PrivateChannel(container.get(PlayerService.class)), |
509
|
|
|
new FightChannel(), |
510
|
|
|
new FightTeamChannel(), |
511
|
|
|
new FightSpectatorChannel(ChannelType.FIGHT_TEAM), |
512
|
|
|
new FightSpectatorChannel(ChannelType.MESSAGES), |
513
|
|
|
} |
514
|
|
|
) |
515
|
|
|
); |
516
|
|
|
|
517
|
1 |
|
configurator.persist( |
518
|
|
|
AreaService.class, |
519
|
1 |
|
container -> new AreaService( |
520
|
1 |
|
container.get(AreaRepository.class), |
521
|
1 |
|
container.get(SubAreaRepository.class) |
522
|
|
|
) |
523
|
|
|
); |
524
|
|
|
|
525
|
1 |
|
configurator.persist( |
526
|
|
|
InventoryService.class, |
527
|
1 |
|
container -> new InventoryService( |
528
|
1 |
|
container.get(PlayerItemRepository.class), |
529
|
1 |
|
container.get(ItemService.class) |
530
|
|
|
) |
531
|
|
|
); |
532
|
|
|
|
533
|
1 |
|
configurator.persist( |
534
|
|
|
ListenerAggregate.class, |
535
|
1 |
|
container -> new DefaultListenerAggregate(container.get(Logger.class)) |
536
|
|
|
); |
537
|
|
|
|
538
|
1 |
|
configurator.factory( |
539
|
|
|
fr.quatrevieux.araknemu.core.event.Dispatcher.class, |
540
|
1 |
|
container -> container.get(ListenerAggregate.class) |
541
|
|
|
); |
542
|
|
|
|
543
|
1 |
|
configurator.persist( |
544
|
|
|
NameGenerator.class, |
545
|
1 |
|
container -> new NameCheckerGenerator( |
546
|
|
|
new CamelizeName( |
547
|
|
|
new SimpleNameGenerator( |
548
|
1 |
|
container.get(GameConfiguration.class).player() |
549
|
|
|
) |
550
|
|
|
), |
551
|
1 |
|
container.get(PlayerRepository.class), |
552
|
1 |
|
container.get(GameConfiguration.class) |
553
|
|
|
) |
554
|
|
|
); |
555
|
|
|
|
556
|
1 |
|
configurator.persist( |
557
|
|
|
ItemService.class, |
558
|
1 |
|
container -> new ItemService( |
559
|
1 |
|
container.get(ItemTemplateRepository.class), |
560
|
1 |
|
container.get(ItemFactory.class), |
561
|
1 |
|
container.get(ItemSetRepository.class), |
562
|
1 |
|
container.get(ItemTypeRepository.class), |
563
|
1 |
|
container.get(EffectToCharacteristicMapping.class), |
564
|
1 |
|
container.get(EffectToSpecialMapping.class) |
565
|
|
|
) |
566
|
|
|
); |
567
|
|
|
|
568
|
1 |
|
configurator.persist( |
569
|
|
|
SpellService.class, |
570
|
1 |
|
container -> new SpellService( |
571
|
1 |
|
container.get(SpellTemplateRepository.class), |
572
|
1 |
|
container.get(SpellEffectService.class) |
573
|
|
|
) |
574
|
|
|
); |
575
|
|
|
|
576
|
1 |
|
configurator.persist( |
577
|
|
|
SpellEffectService.class, |
578
|
1 |
|
container -> new SpellEffectService() |
579
|
|
|
); |
580
|
|
|
|
581
|
1 |
|
configurator.persist( |
582
|
|
|
PlayerRaceService.class, |
583
|
1 |
|
container -> new PlayerRaceService( |
584
|
1 |
|
container.get(PlayerRaceRepository.class), |
585
|
1 |
|
container.get(SpellService.class) |
586
|
|
|
) |
587
|
|
|
); |
588
|
|
|
|
589
|
1 |
|
configurator.persist( |
590
|
|
|
SpellBookService.class, |
591
|
1 |
|
container -> new SpellBookService( |
592
|
1 |
|
container.get(PlayerSpellRepository.class), |
593
|
1 |
|
container.get(SpellService.class), |
594
|
1 |
|
container.get(PlayerRaceService.class) |
595
|
|
|
) |
596
|
|
|
); |
597
|
|
|
|
598
|
1 |
|
configurator.persist( |
599
|
|
|
PlayerExperienceService.class, |
600
|
1 |
|
container -> new PlayerExperienceService( |
601
|
1 |
|
container.get(PlayerExperienceRepository.class), |
602
|
1 |
|
container.get(GameConfiguration.class).player() |
603
|
|
|
) |
604
|
|
|
); |
605
|
|
|
|
606
|
1 |
|
configurator.persist( |
607
|
|
|
fr.quatrevieux.araknemu.game.fight.turn.action.move.MoveFactory.class, |
608
|
1 |
|
container -> new fr.quatrevieux.araknemu.game.fight.turn.action.move.MoveFactory(new FightPathValidator[] { |
609
|
|
|
new TackleValidator(), |
610
|
|
|
new StopOnEnemyValidator(), |
611
|
|
|
}) |
612
|
|
|
); |
613
|
|
|
|
614
|
1 |
|
configurator.persist( |
615
|
|
|
CastFactory.class, |
616
|
1 |
|
container -> new CastFactory( |
617
|
|
|
new SpellConstraintsValidator(), |
618
|
1 |
|
container.get(CriticalityStrategy.class) |
619
|
|
|
) |
620
|
|
|
); |
621
|
|
|
|
622
|
1 |
|
configurator.persist( |
623
|
|
|
CloseCombatFactory.class, |
624
|
1 |
|
container -> new CloseCombatFactory( |
625
|
|
|
new WeaponConstraintsValidator(), |
626
|
1 |
|
container.get(CriticalityStrategy.class) |
627
|
|
|
) |
628
|
|
|
); |
629
|
|
|
|
630
|
1 |
|
configurator.persist( |
631
|
|
|
FightActionsFactoryRegistry.class, |
632
|
1 |
|
container -> new FightActionsFactoryRegistry( |
633
|
1 |
|
container.get(fr.quatrevieux.araknemu.game.fight.turn.action.move.MoveFactory.class), |
634
|
1 |
|
container.get(CastFactory.class), |
635
|
1 |
|
container.get(CloseCombatFactory.class) |
636
|
|
|
) |
637
|
|
|
); |
638
|
|
|
|
639
|
1 |
|
configurator.persist( |
640
|
|
|
FightService.FightFactory.class, |
641
|
1 |
|
container -> (id, type, map, teams, statesFlow, executor) -> new Fight( |
642
|
|
|
id, |
643
|
|
|
type, |
644
|
|
|
map, |
645
|
|
|
teams, |
646
|
|
|
statesFlow, |
647
|
1 |
|
container.get(Logger.class), // @todo fight logger |
|
|
|
|
648
|
|
|
executor, |
649
|
1 |
|
container.get(FightActionsFactoryRegistry.class) |
650
|
|
|
) |
651
|
|
|
); |
652
|
|
|
|
653
|
1 |
|
configurator.persist( |
654
|
|
|
FightService.class, |
655
|
1 |
|
container -> new FightService( |
656
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
657
|
1 |
|
Arrays.asList( |
658
|
|
|
new ChallengeBuilderFactory( |
659
|
1 |
|
container.get(FighterFactory.class), |
660
|
1 |
|
container.get(ChallengeType.class) |
661
|
|
|
), |
662
|
|
|
new PvmBuilderFactory( |
663
|
1 |
|
container.get(FighterFactory.class), |
664
|
1 |
|
container.get(PvmType.class) |
665
|
|
|
) |
666
|
|
|
), |
667
|
1 |
|
Arrays.asList( |
668
|
|
|
CommonEffectsModule::new, |
669
|
1 |
|
fight -> new IndirectSpellApplyEffectsModule(fight, container.get(SpellService.class)), |
670
|
|
|
StatesModule::new, |
671
|
|
|
RaulebaqueModule::new, |
672
|
|
|
LaunchedSpellsModule::new, |
673
|
1 |
|
fight -> new AiModule(container.get(AiFactory.class)), |
674
|
1 |
|
fight -> new MonsterInvocationModule(container.get(MonsterService.class), container.get(FighterFactory.class), fight) |
675
|
|
|
), |
676
|
1 |
|
container.get(FightService.FightFactory.class), |
677
|
1 |
|
container.get(GameConfiguration.class).fight() |
678
|
|
|
) |
679
|
|
|
); |
680
|
|
|
|
681
|
1 |
|
configurator.persist( |
682
|
|
|
NpcService.class, |
683
|
1 |
|
container -> new NpcService( |
684
|
1 |
|
container.get(DialogService.class), |
685
|
1 |
|
container.get(NpcTemplateRepository.class), |
686
|
1 |
|
container.get(NpcRepository.class), |
687
|
1 |
|
Arrays.asList( |
688
|
1 |
|
container.get(NpcStoreService.class), |
689
|
1 |
|
container.get(NpcExchangeService.class) |
690
|
|
|
) |
691
|
|
|
) |
692
|
|
|
); |
693
|
|
|
|
694
|
1 |
|
configurator.persist( |
695
|
|
|
DialogService.class, |
696
|
1 |
|
container -> new DialogService( |
697
|
1 |
|
container.get(QuestionRepository.class), |
698
|
1 |
|
container.get(ResponseActionRepository.class), |
699
|
|
|
new fr.quatrevieux.araknemu.game.exploration.npc.dialog.action.ActionFactory[] { |
700
|
|
|
new fr.quatrevieux.araknemu.game.exploration.npc.dialog.action.teleport.Teleport.Factory( |
701
|
1 |
|
container.get(ExplorationMapService.class) |
702
|
|
|
), |
703
|
1 |
|
new GoToAstrub.Factory(container.get(ExplorationMapService.class)), |
704
|
|
|
new RemoveObject.Factory(), |
705
|
1 |
|
new OpenBank.Factory(container.get(BankService.class)), |
706
|
|
|
}, |
707
|
1 |
|
container.get(ParametersResolver.class), |
708
|
1 |
|
container.get(Logger.class) |
709
|
|
|
) |
710
|
|
|
); |
711
|
|
|
|
712
|
1 |
|
configurator.persist( |
713
|
|
|
NpcStoreService.class, |
714
|
1 |
|
container -> new NpcStoreService( |
715
|
1 |
|
container.get(ItemService.class), |
716
|
1 |
|
container.get(ItemTemplateRepository.class), |
717
|
1 |
|
container.get(GameConfiguration.class).economy() |
718
|
|
|
) |
719
|
|
|
); |
720
|
|
|
|
721
|
1 |
|
configurator.persist( |
722
|
|
|
NpcExchangeService.class, |
723
|
1 |
|
container -> new NpcExchangeService( |
724
|
1 |
|
container.get(ItemService.class), |
725
|
1 |
|
container.get(NpcExchangeRepository.class), |
726
|
1 |
|
container.get(ItemTemplateRepository.class) |
727
|
|
|
) |
728
|
|
|
); |
729
|
|
|
|
730
|
1 |
|
configurator.persist( |
731
|
|
|
MonsterService.class, |
732
|
1 |
|
container -> new MonsterService( |
733
|
1 |
|
container.get(SpellService.class), |
734
|
1 |
|
container.get(MonsterRewardService.class), |
735
|
1 |
|
container.get(MonsterTemplateRepository.class) |
736
|
|
|
) |
737
|
|
|
); |
738
|
|
|
|
739
|
1 |
|
configurator.persist( |
740
|
|
|
MonsterEnvironmentService.class, |
741
|
1 |
|
container -> new MonsterEnvironmentService( |
742
|
1 |
|
container.get(ActivityService.class), |
743
|
1 |
|
container.get(FightService.class), |
744
|
1 |
|
container.get(MonsterGroupFactory.class), |
745
|
1 |
|
container.get(MonsterGroupPositionRepository.class), |
746
|
1 |
|
container.get(MonsterGroupDataRepository.class), |
747
|
1 |
|
container.get(GameConfiguration.class).activity() |
748
|
|
|
) |
749
|
|
|
); |
750
|
|
|
|
751
|
1 |
|
configurator.persist( |
752
|
|
|
MonsterRewardService.class, |
753
|
1 |
|
container -> new MonsterRewardService( |
754
|
1 |
|
container.get(MonsterRewardRepository.class), |
755
|
1 |
|
container.get(MonsterRewardItemRepository.class) |
756
|
|
|
) |
757
|
|
|
); |
758
|
|
|
|
759
|
1 |
|
configurator.persist( |
760
|
|
|
ActivityService.class, |
761
|
1 |
|
container -> new ActivityService( |
762
|
1 |
|
container.get(GameConfiguration.class).activity(), |
763
|
1 |
|
container.get(Logger.class) // @todo custom logger ? |
|
|
|
|
764
|
|
|
) |
765
|
|
|
); |
766
|
|
|
|
767
|
1 |
|
configurator.persist( |
768
|
|
|
BankService.class, |
769
|
1 |
|
container -> new BankService( |
770
|
1 |
|
container.get(ItemService.class), |
771
|
1 |
|
container.get(AccountBankRepository.class), |
772
|
1 |
|
container.get(BankItemRepository.class), |
773
|
1 |
|
container.get(GameConfiguration.class).economy() |
774
|
|
|
) |
775
|
|
|
); |
776
|
|
|
|
777
|
1 |
|
configurator.persist( |
778
|
|
|
BanishmentService.class, |
779
|
1 |
|
container -> new BanishmentService<>( |
780
|
1 |
|
container.get(BanishmentRepository.class), |
781
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
782
|
1 |
|
ids -> container.get(AccountService.class).getByIds(ids) |
783
|
|
|
) |
784
|
|
|
); |
785
|
|
|
|
786
|
1 |
|
configurator.persist( |
787
|
|
|
BanIpService.class, |
788
|
1 |
|
container -> new BanIpService<>( |
789
|
1 |
|
container.get(BanIpRepository.class), |
790
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
791
|
1 |
|
ids -> container.get(AccountService.class).getByIds(ids) |
792
|
|
|
) |
793
|
|
|
); |
794
|
|
|
|
795
|
1 |
|
configurator.persist( |
796
|
|
|
GameBanIpSynchronizer.class, |
797
|
1 |
|
container -> new GameBanIpSynchronizer( |
798
|
1 |
|
container.get(BanIpService.class), |
799
|
1 |
|
() -> container.get(GameService.class).sessions(), |
800
|
1 |
|
container.get(Logger.class), |
801
|
1 |
|
container.get(GameConfiguration.class).banIpRefresh() |
802
|
|
|
) |
803
|
|
|
); |
804
|
|
|
|
805
|
1 |
|
configurator.persist( |
806
|
|
|
ParametersResolver.class, |
807
|
1 |
|
container -> new ParametersResolver( |
808
|
|
|
new VariableResolver[] { |
809
|
1 |
|
new GetterResolver("name", session -> session.player().name()), |
810
|
1 |
|
new BankCostResolver(container.get(BankService.class)), |
811
|
|
|
}, |
812
|
1 |
|
container.get(Logger.class) |
813
|
|
|
) |
814
|
|
|
); |
815
|
|
|
|
816
|
1 |
|
configurator.persist( |
817
|
|
|
FighterFactory.class, |
818
|
1 |
|
container -> new DefaultFighterFactory( |
819
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class) |
820
|
|
|
) |
821
|
|
|
); |
822
|
|
|
|
823
|
1 |
|
configurator.persist(SpectatorFactory.class, container -> new DefaultSpectatorFactory()); |
824
|
|
|
|
825
|
1 |
|
configurator.persist(EffectToSpecialMapping.class, container -> new EffectToSpecialMapping()); |
826
|
1 |
|
configurator.persist(EffectToWeaponMapping.class, container -> new EffectToWeaponMapping()); |
827
|
1 |
|
configurator.persist(EffectToCharacteristicMapping.class, container -> new EffectToCharacteristicMapping()); |
828
|
1 |
|
configurator.persist(EffectToUseMapping.class, container -> new EffectToUseMapping( |
829
|
1 |
|
container.get(SpellService.class) |
830
|
|
|
)); |
831
|
|
|
|
832
|
1 |
|
configurator.persist( |
833
|
|
|
ItemFactory.class, |
834
|
1 |
|
container -> new DefaultItemFactory( |
835
|
1 |
|
new ResourceFactory(container.get(EffectToSpecialMapping.class)), |
836
|
|
|
new UsableFactory( |
837
|
1 |
|
container.get(EffectToUseMapping.class), |
838
|
1 |
|
container.get(EffectToSpecialMapping.class) |
839
|
|
|
), |
840
|
|
|
new WeaponFactory( |
841
|
1 |
|
container.get(SpellEffectService.class), |
842
|
1 |
|
container.get(EffectToWeaponMapping.class), |
843
|
1 |
|
container.get(EffectToCharacteristicMapping.class), |
844
|
1 |
|
container.get(EffectToSpecialMapping.class) |
845
|
|
|
), |
846
|
1 |
|
new WearableFactory(SuperType.AMULET, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
847
|
1 |
|
new WearableFactory(SuperType.RING, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
848
|
1 |
|
new WearableFactory(SuperType.BELT, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
849
|
1 |
|
new WearableFactory(SuperType.BOOT, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
850
|
1 |
|
new WearableFactory(SuperType.SHIELD, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
851
|
1 |
|
new WearableFactory(SuperType.HELMET, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
852
|
1 |
|
new WearableFactory(SuperType.MANTLE, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)), |
853
|
1 |
|
new WearableFactory(SuperType.DOFUS, container.get(EffectToCharacteristicMapping.class), container.get(EffectToSpecialMapping.class)) |
854
|
|
|
) |
855
|
|
|
); |
856
|
|
|
|
857
|
1 |
|
configurator.persist(CriticalityStrategy.class, container -> new BaseCriticalityStrategy()); |
858
|
|
|
|
859
|
1 |
|
configurator.persist( |
860
|
|
|
MonsterGroupFactory.class, |
861
|
1 |
|
container -> new MonsterGroupFactory( |
862
|
|
|
new MonsterListGeneratorSwitch( |
863
|
1 |
|
new RandomMonsterListGenerator(container.get(MonsterService.class)), |
864
|
1 |
|
new FixedMonsterListGenerator(container.get(MonsterService.class)) |
865
|
|
|
) |
866
|
|
|
) |
867
|
|
|
); |
868
|
|
|
|
869
|
1 |
|
configurator.persist( |
870
|
|
|
PvmType.class, |
871
|
1 |
|
container -> new PvmType( |
872
|
|
|
new PvmRewardsGenerator( |
873
|
|
|
// Issue #192 (https://github.com/Arakne/Araknemu/issues/192) : Perform SynchronizeLife before AddExperience |
874
|
|
|
// to ensure that level up (which trigger restore life) is performed after life synchronisation |
875
|
1 |
|
Arrays.asList(new SynchronizeLife(), new AddExperience(), new AddKamas(), new AddItems(container.get(ItemService.class))), |
876
|
1 |
|
Arrays.asList(new SetDead(), new ReturnToSavePosition()), |
877
|
1 |
|
Arrays.asList( |
878
|
1 |
|
new PvmXpProvider(container.get(GameConfiguration.class).fight().xpRate()), |
879
|
|
|
new PvmKamasProvider(), |
880
|
1 |
|
new PvmItemDropProvider(container.get(GameConfiguration.class).fight().dropRate()), |
881
|
|
|
new PvmEndFightActionProvider() |
882
|
|
|
) |
883
|
|
|
), |
884
|
1 |
|
container.get(GameConfiguration.class).fight() |
885
|
|
|
) |
886
|
|
|
); |
887
|
|
|
|
888
|
1 |
|
configurator.persist( |
889
|
|
|
ChallengeType.class, |
890
|
1 |
|
container -> new ChallengeType(container.get(GameConfiguration.class).fight()) |
891
|
|
|
); |
892
|
|
|
|
893
|
1 |
|
configurator.persist( |
894
|
|
|
AiFactory.class, |
895
|
1 |
|
container -> new ChainAiFactory( |
896
|
1 |
|
container.get(MonsterAiFactory.class) |
897
|
|
|
) |
898
|
|
|
); |
899
|
|
|
|
900
|
|
|
// @todo Move to "FightModule" |
|
|
|
|
901
|
1 |
|
configurator.persist(Simulator.class, container -> { |
902
|
1 |
|
final Simulator simulator = new Simulator(container.get(CriticalityStrategy.class)); |
903
|
|
|
|
904
|
1 |
|
simulator.register(91, new StealLifeSimulator(Element.WATER)); |
905
|
1 |
|
simulator.register(92, new StealLifeSimulator(Element.EARTH)); |
906
|
1 |
|
simulator.register(93, new StealLifeSimulator(Element.AIR)); |
907
|
1 |
|
simulator.register(94, new StealLifeSimulator(Element.FIRE)); |
908
|
1 |
|
simulator.register(95, new StealLifeSimulator(Element.NEUTRAL)); |
909
|
|
|
|
910
|
1 |
|
simulator.register(96, new DamageSimulator(Element.WATER)); |
911
|
1 |
|
simulator.register(97, new DamageSimulator(Element.EARTH)); |
912
|
1 |
|
simulator.register(98, new DamageSimulator(Element.AIR)); |
913
|
1 |
|
simulator.register(99, new DamageSimulator(Element.FIRE)); |
914
|
1 |
|
simulator.register(100, new DamageSimulator(Element.NEUTRAL)); |
915
|
|
|
|
916
|
|
|
// AP |
917
|
1 |
|
simulator.register(111, new AlterActionPointsSimulator(200)); |
918
|
1 |
|
simulator.register(120, new AlterActionPointsSimulator(200)); |
919
|
1 |
|
simulator.register(168, new AlterActionPointsSimulator(-200)); |
920
|
1 |
|
simulator.register(101, new RemovePointsSimulator(Characteristic.ACTION_POINT, Characteristic.RESISTANCE_ACTION_POINT, 200)); |
921
|
|
|
|
922
|
|
|
// MP |
923
|
1 |
|
simulator.register(78, new AlterCharacteristicSimulator(200)); |
924
|
1 |
|
simulator.register(128, new AlterCharacteristicSimulator(200)); |
925
|
1 |
|
simulator.register(169, new AlterCharacteristicSimulator(-200)); |
926
|
1 |
|
simulator.register(127, new RemovePointsSimulator(Characteristic.MOVEMENT_POINT, Characteristic.RESISTANCE_MOVEMENT_POINT, 200)); |
927
|
|
|
|
928
|
|
|
// Characteristics boost |
929
|
1 |
|
simulator.register(112, new AlterCharacteristicSimulator(10)); // damage |
930
|
1 |
|
simulator.register(115, new AlterCharacteristicSimulator(5)); // critical |
931
|
1 |
|
simulator.register(117, new AlterCharacteristicSimulator(5)); // sight |
932
|
1 |
|
simulator.register(118, new AlterCharacteristicSimulator()); // strength |
933
|
1 |
|
simulator.register(119, new AlterCharacteristicSimulator()); // agility |
934
|
1 |
|
simulator.register(122, new AlterCharacteristicSimulator(-5)); // Fail malus |
935
|
1 |
|
simulator.register(123, new AlterCharacteristicSimulator()); // luck |
936
|
1 |
|
simulator.register(124, new AlterCharacteristicSimulator()); // wisdom |
937
|
1 |
|
simulator.register(126, new AlterCharacteristicSimulator()); // intelligence |
938
|
1 |
|
simulator.register(138, new AlterCharacteristicSimulator(2)); // percent damage |
939
|
1 |
|
simulator.register(178, new AlterCharacteristicSimulator(8)); // heal |
940
|
1 |
|
simulator.register(182, new AlterCharacteristicSimulator(10)); // summoned creature |
941
|
1 |
|
simulator.register(606, new AlterCharacteristicSimulator()); // Wisdom not dispellable |
942
|
1 |
|
simulator.register(607, new AlterCharacteristicSimulator()); // Strength not dispellable |
943
|
1 |
|
simulator.register(608, new AlterCharacteristicSimulator()); // Luck not dispellable |
944
|
1 |
|
simulator.register(609, new AlterCharacteristicSimulator()); // Agility not dispellable |
945
|
1 |
|
simulator.register(611, new AlterCharacteristicSimulator()); // Intelligence not dispellable |
946
|
|
|
|
947
|
|
|
// Characteristics malus |
948
|
1 |
|
simulator.register(116, new AlterCharacteristicSimulator(-5)); // sight malus |
949
|
1 |
|
simulator.register(145, new AlterCharacteristicSimulator(-10)); // -damage |
950
|
1 |
|
simulator.register(152, new AlterCharacteristicSimulator(-1)); // -luck |
951
|
1 |
|
simulator.register(154, new AlterCharacteristicSimulator(-1)); // -agility |
952
|
1 |
|
simulator.register(155, new AlterCharacteristicSimulator(-1)); // -intelligence |
953
|
1 |
|
simulator.register(156, new AlterCharacteristicSimulator(-1)); // -wisdom |
954
|
1 |
|
simulator.register(157, new AlterCharacteristicSimulator(-1)); // -strength |
955
|
1 |
|
simulator.register(171, new AlterCharacteristicSimulator(-5)); // -critical |
956
|
1 |
|
simulator.register(179, new AlterCharacteristicSimulator(-8)); // -heal |
957
|
1 |
|
simulator.register(186, new AlterCharacteristicSimulator(-2)); // -percent damage |
958
|
|
|
|
959
|
1 |
|
simulator.register(105, new ArmorSimulator()); |
960
|
1 |
|
simulator.register(265, new ArmorSimulator()); |
961
|
|
|
|
962
|
|
|
// Heal |
963
|
1 |
|
simulator.register(108, new HealSimulator()); |
964
|
|
|
|
965
|
|
|
// Misc |
966
|
1 |
|
simulator.register(950, new SetStateSimulator() |
967
|
1 |
|
.state(50, -500) // Altruiste |
968
|
|
|
); |
969
|
1 |
|
simulator.register(150, new PunishmentSimulator()); |
970
|
|
|
|
971
|
1 |
|
return simulator; |
972
|
|
|
}); |
973
|
|
|
|
974
|
1 |
|
configurator.persist( |
975
|
|
|
MonsterAiFactory.class, |
976
|
|
|
container -> { |
977
|
1 |
|
final MonsterAiFactory factory = new MonsterAiFactory(); |
978
|
1 |
|
final Simulator simulator = container.get(Simulator.class); |
979
|
|
|
|
980
|
1 |
|
factory.register("AGGRESSIVE", new Aggressive(simulator)); |
981
|
1 |
|
factory.register("RUNAWAY", new Runaway(simulator)); |
982
|
1 |
|
factory.register("SUPPORT", new Support(simulator)); |
983
|
1 |
|
factory.register("TACTICAL", new Tactical(simulator)); |
984
|
1 |
|
factory.register("FIXED", new Fixed(simulator)); |
985
|
|
|
|
986
|
1 |
|
return factory; |
987
|
|
|
} |
988
|
|
|
); |
989
|
|
|
|
990
|
1 |
|
configurator.persist(ExchangeFactory.class, container -> new DefaultExchangeFactory( |
991
|
|
|
new PlayerExchangeFactories(), |
992
|
|
|
new NpcExchangeFactories() |
993
|
|
|
)); |
994
|
|
|
|
995
|
1 |
|
configurator.persist(ShutdownService.class, container -> new ShutdownService( |
996
|
|
|
app, |
997
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class), |
998
|
1 |
|
container.get(GameConfiguration.class) |
999
|
|
|
)); |
1000
|
|
|
|
1001
|
1 |
|
configurator.persist(SessionLogService.class, container -> new SessionLogService( |
1002
|
1 |
|
container.get(ConnectionLogRepository.class) |
1003
|
|
|
)); |
1004
|
|
|
|
1005
|
1 |
|
configurator.persist(SavingService.class, container -> new SavingService( |
1006
|
1 |
|
container.get(PlayerService.class), |
1007
|
1 |
|
container.get(GameConfiguration.class), |
1008
|
1 |
|
container.get(fr.quatrevieux.araknemu.core.event.Dispatcher.class) |
1009
|
|
|
)); |
1010
|
1 |
|
} |
1011
|
|
|
} |
1012
|
|
|
|