@@ -278,6 +278,21 @@ function inventoryController:onInit()
278
278
end
279
279
280
280
function inventoryController :onGameStart ()
281
+ local player = g_game .getLocalPlayer ()
282
+ if player then
283
+ local char = g_game .getCharacterName ()
284
+ local lastCombatControls = g_settings .getNode (' LastCombatControls' )
285
+ if not table .empty (lastCombatControls ) then
286
+ if lastCombatControls [char ] then
287
+ g_game .setFightMode (lastCombatControls [char ].fightMode )
288
+ g_game .setChaseMode (lastCombatControls [char ].chaseMode )
289
+ g_game .setSafeFight (lastCombatControls [char ].safeFight )
290
+ if lastCombatControls [char ].pvpMode then
291
+ g_game .setPVPMode (lastCombatControls [char ].pvpMode )
292
+ end
293
+ end
294
+ end
295
+ end
281
296
inventoryController :registerEvents (LocalPlayer , {
282
297
onInventoryChange = inventoryEvent ,
283
298
onSoulChange = onSoulChange ,
324
339
325
340
function inventoryController :onGameEnd ()
326
341
stopEvent ()
342
+
343
+ local lastCombatControls = g_settings .getNode (' LastCombatControls' )
344
+ if not lastCombatControls then
345
+ lastCombatControls = {}
346
+ end
347
+ local player = g_game .getLocalPlayer ()
348
+ if player then
349
+ local char = g_game .getCharacterName ()
350
+ lastCombatControls [char ] = {
351
+ fightMode = g_game .getFightMode (),
352
+ chaseMode = g_game .getChaseMode (),
353
+ safeFight = g_game .isSafeFight ()
354
+ }
355
+ if g_game .getFeature (GamePVPMode ) then
356
+ lastCombatControls [char ].pvpMode = g_game .getPVPMode ()
357
+ end
358
+ g_settings .setNode (' LastCombatControls' , lastCombatControls )
359
+ end
327
360
end
328
361
329
362
function onSetSafeFight (self , checked )
0 commit comments