Skip to content

Commit 1f55dc1

Browse files
committed
Fixed moving away from delve, fixed map movement/exploration timer
1 parent f23475c commit 1f55dc1

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

app/Game/Maps/Controllers/Api/MapController.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Flare\Models\Character;
66
use App\Flare\Models\Quest;
7+
use App\Flare\Values\AutomationType;
78
use App\Game\Maps\Requests\MoveRequest;
89
use App\Game\Maps\Requests\QuestDataRequest;
910
use App\Game\Maps\Requests\SetSailValidation;
@@ -62,6 +63,19 @@ public function move(MoveRequest $request, Character $character): JsonResponse
6263
return response()->json(['invalid input'], 429);
6364
}
6465

66+
if ($character->currentAutomations()
67+
->where('character_id', $character->id)
68+
->where('completed_at', '>', now())
69+
->where(function ($query) {
70+
$query->where('type', AutomationType::DELVE);
71+
})
72+
->exists()
73+
) {
74+
return response()->json([
75+
'message' => 'You cannot escape the shadows child. Cancel the Delve if you want to wonder around in the wild.',
76+
], 422);
77+
}
78+
6579
$this->walkingService->setCoordinatesToTravelTo(
6680
$request->character_position_x,
6781
$request->character_position_y

resources/js/game/sections/map/lib/state/map-state-manager.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class MapStateManager {
2121
component: MapSection | Game,
2222
): MapState {
2323
let state: MapState = {
24-
...this.setState(data),
24+
...this.setState(data, (component as any).state),
2525
...{ map_id: data.character_map.game_map.id },
2626
};
2727

@@ -84,7 +84,7 @@ export default class MapStateManager {
8484
*/
8585
static buildCoreState(data: MapData, component: Game): MapState {
8686
let state: MapState = {
87-
...this.setState(data),
87+
...this.setState(data, (component as any).state),
8888
...{ map_id: data.character_map.game_map.id },
8989
};
9090

@@ -122,7 +122,10 @@ export default class MapStateManager {
122122
*
123123
* @param data
124124
*/
125-
static setState(data: MapData): MapState {
125+
static setState(
126+
data: MapData,
127+
previousState?: Partial<MapState>,
128+
): MapState {
126129
return {
127130
map_id: data.character_map.id,
128131
map_url: data.map_url,
@@ -149,8 +152,14 @@ export default class MapStateManager {
149152
bottom_bounds: 0,
150153
right_bounds: 0,
151154
loading: false,
152-
automation_time_out: 0,
153-
celestial_time_out: 0,
155+
automation_time_out:
156+
(data as any).automation_time_out ??
157+
previousState?.automation_time_out ??
158+
0,
159+
celestial_time_out:
160+
(data as any).celestial_time_out ??
161+
previousState?.celestial_time_out ??
162+
0,
154163
is_event_based: data.is_event_based,
155164
can_access_hell_forged_shop: data.can_access_hell_forged_shop,
156165
can_access_purgatory_chains_shop:

0 commit comments

Comments
 (0)