Skip to content

Commit

Permalink
Grouped all the map code together
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKyle committed Nov 16, 2023
1 parent a8e1465 commit 393733c
Show file tree
Hide file tree
Showing 106 changed files with 187 additions and 186 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"private": true,
"main": "resources/js/app.ts",
"scripts": {
"dev": "yarn run development",
"development": "TAILWIND_MODE=build mix",
Expand Down
6 changes: 3 additions & 3 deletions resources/js/game/game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import ScreenRefresh from "./sections/screen-refresh/screen-refresh";
import KingdomsList from "./sections/kingdoms/kingdoms-list";
import KingdomDetails from "./lib/game/kingdoms/kingdom-details";
import Actions from "./sections/game-actions-section/actions";
import PositionType from "./lib/game/types/map/position-type";
import PositionType from "./sections/map/types/map/position-type";
import { removeCommas } from "./lib/game/format-number";
import CharacterCurrenciesType from "./lib/game/character/character-currencies-type";
import KingdomLogDetails from "./lib/game/kingdoms/kingdom-log-details";
import GlobalTimeoutModal from "./sections/game-modals/global-timeout-modal";
import MapState from "./sections/map/types/map-state";
import MapData from "./lib/game/map/request-types/MapData";
import MapStateManager from "./lib/game/map/state/map-state-manager";
import MapData from "./sections/map/lib/request-types/MapData";
import MapStateManager from "./sections/map/lib/state/map-state-manager";
import MapTabs from "./sections/map/map-tabs";

export default class Game extends React.Component<GameProps, GameState> {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/lib/game/ajax/FetchGameData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { setDefaultResultOrder } from "dns";
import Game from "../../../game";
import Ajax from "../../ajax/ajax";
import { AxiosResponse } from "axios";
import MapStateManager from "../map/state/map-state-manager";
import MapStateManager from "../../../sections/map/lib/state/map-state-manager";
import { CharacterType } from "../character/character-type";

type AjaxUrls = { url: string, name: string }[];
Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/lib/game/character/character-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PositionType from "../types/map/position-type";
import PositionType from "../../../sections/map/types/map/position-type";
import AttackTypes from "./attack-types";
import ExtraActionType from "./extra-action-type";

Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/lib/game/types/game-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CharacterCurrenciesType from "../character/character-currencies-type";
import CharacterStatusType from "../character/character-status-type";
import QuestType from "./quests/quest-type";
import KingdomDetails from "../kingdoms/kingdom-details";
import PositionType from "./map/position-type";
import PositionType from "../../../sections/map/types/map/position-type";
import KingdomLogDetails from "../kingdoms/kingdom-log-details";
import MonsterType from "./actions/monster/monster-type";
import MapState from "../../../sections/map/types/map-state";
Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/lib/game/types/quests/quest-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {QuestDetails} from "../../map/types/quest-details";
import {QuestDetails} from "../../../../sections/map/types/quest-details";

export default interface QuestType {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import EnemyKingdomPinProps from "../../../lib/game/types/map/kingdom-pins/enemy-kingdom-pin-props";
import EnemyKingdomPinProps from "../../map/types/map/kingdom-pins/enemy-kingdom-pin-props";

export default class EnemyKingdomPin extends React.Component<EnemyKingdomPinProps, {}> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Fragment} from "react";
import EnemyKingdomPin from "./enemy-kingdom-pin";
import KingdomProps from "../../../lib/game/types/map/kingdom-pins/kingdom-props";
import KingdomState from "../../../lib/game/types/map/kingdom-pins/kingdom-state";
import KingdomProps from "../../map/types/map/kingdom-pins/kingdom-props";
import KingdomState from "../../map/types/map/kingdom-pins/kingdom-state";
import {viewPortWatcher} from "../../../lib/view-port-watcher";
import KingdomModal from "./modals/kingdom-modal";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import KingdomPinProps from "../../../lib/game/types/map/kingdom-pins/kingdom-pin-props";
import KingdomPinProps from "../../map/types/map/kingdom-pins/kingdom-pin-props";

export default class KingdomPin extends React.Component<KingdomPinProps, any> {

Expand Down
4 changes: 2 additions & 2 deletions resources/js/game/sections/components/kingdoms/kingdoms.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, {Fragment} from "react";
import KingdomProps from "../../../lib/game/types/map/kingdom-pins/kingdom-props";
import KingdomProps from "../../map/types/map/kingdom-pins/kingdom-props";
import KingdomPin from "./kingdom-pin";
import KingdomModal from "./modals/kingdom-modal";
import KingdomState from "../../../lib/game/types/map/kingdom-pins/kingdom-state";
import KingdomState from "../../map/types/map/kingdom-pins/kingdom-state";
import {viewPortWatcher} from "../../../lib/view-port-watcher";

export default class Kingdoms extends React.Component<KingdomProps, KingdomState> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {formatNumber, percent} from "../../../../../lib/game/format-number";
import KingdomHelpModal from "../kingdom-help-modal";
import KingdomTopSection from "./kingdom-top-section";
import KingdomDetailsProps
from "../../../../../lib/game/types/map/kingdom-pins/modals/components/kingdom-details-props";
from "../../../../map/types/map/kingdom-pins/modals/components/kingdom-details-props";
import ComponentLoading from "../../../../../components/ui/loading/component-loading";
import PrimaryOutlineButton from "../../../../../components/ui/buttons/primary-outline-button";
import LoadingProgressBar from "../../../../../components/ui/progress-bars/loading-progress-bar";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Fragment} from "react";
import {formatNumber} from "../../../../../lib/game/format-number";
import KingdomTopSectionProps
from "../../../../../lib/game/types/map/kingdom-pins/modals/components/kingdom-top-section-props";
from "../../../../map/types/map/kingdom-pins/modals/components/kingdom-top-section-props";

export default class KingdomTopSection extends React.Component<KingdomTopSectionProps, {}> {
constructor(props: KingdomTopSectionProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, {Fragment} from "react";
import {fetchCost} from "../../../../lib/game/map/teleportion-costs";
import {fetchCost} from "../../../map/lib/teleportion-costs";
import Dialogue from "../../../../components/ui/dialogue/dialogue";
import KingdomModalProps from "../../../../lib/game/types/map/kingdom-pins/modals/kingdom-modal-props";
import KingdomModalState from "../../../../lib/game/types/map/kingdom-pins/modals/kingdom-modal-state";
import KingdomModalProps from "../../../map/types/map/kingdom-pins/modals/kingdom-modal-props";
import KingdomModalState from "../../../map/types/map/kingdom-pins/modals/kingdom-modal-state";
import {formatNumber} from "../../../../lib/game/format-number";
import clsx from "clsx";
import WarningAlert from "../../../../components/ui/alerts/simple-alerts/warning-alert";
import KingdomDetailsType from "../../../../lib/game/map/types/kingdom-details";
import KingdomDetailsType from "../../../map/types/kingdom-details";
import KingdomDetails from "./components/kingdom-details";

export default class KingdomModal extends React.Component<KingdomModalProps, KingdomModalState> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import NpcKingdomPinProps from "../../../lib/game/types/map/kingdom-pins/npc-kingdom-pin-props";
import NpcKingdomPinProps from "../../map/types/map/kingdom-pins/npc-kingdom-pin-props";

export default class NpcKingdomPin extends React.Component<NpcKingdomPinProps, {}> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Fragment} from "react";
import NpcKingdomPin from "./npc-kingdom-pin";
import NpcKingdomProps from "../../../lib/game/types/map/kingdom-pins/npc-kingdom-props";
import NpcKingdomProps from "../../map/types/map/kingdom-pins/npc-kingdom-props";
import {viewPortWatcher} from "../../../lib/view-port-watcher";
import KingdomModal from "./modals/kingdom-modal";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import LocationPinProps from "../../../lib/game/types/map/location-pins/location-pin-props";
import LocationPinProps from "../../map/types/map/location-pins/location-pin-props";

export default class LocationPin extends React.Component<LocationPinProps, {}> {

Expand Down
4 changes: 2 additions & 2 deletions resources/js/game/sections/components/locations/location.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment, SyntheticEvent } from "react";
import LocationProps from "../../../lib/game/types/map/location-pins/location-props";
import LocationProps from "../../map/types/map/location-pins/location-props";
import LocationPin from "./location-pin";
import LocationState from "../../../lib/game/types/map/location-pins/location-state";
import LocationState from "../../map/types/map/location-pins/location-state";
import LocationModal from "./modals/location-modal";
import { viewPortWatcher } from "../../../lib/view-port-watcher";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {Fragment} from "react";
import {formatNumber} from "../../../../lib/game/format-number";
import SpecialLocationHelpModal from "./special-location-help-modal";
import LocationDetailsProps from "../../../../lib/game/types/map/location-pins/modals/location-details-props";
import LocationDetailsProps from "../../../map/types/map/location-pins/modals/location-details-props";
import Gems from '../../npc-actions/seer-actions/deffinitions/gems';

export default class LocationDetails extends React.Component<LocationDetailsProps, any> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {Fragment} from "react";
import Dialogue from "../../../../components/ui/dialogue/dialogue";
import {LocationModalPros} from "../../../../lib/game/types/map/location-pins/modals/location-modal-pros";
import {fetchCost} from "../../../../lib/game/map/teleportion-costs";
import {LocationModalPros} from "../../../map/types/map/location-pins/modals/location-modal-pros";
import {fetchCost} from "../../../map/lib/teleportion-costs";
import {formatNumber} from "../../../../lib/game/format-number";
import clsx from "clsx";
import WarningAlert from "../../../../components/ui/alerts/simple-alerts/warning-alert";
import LocationModalState from "../../../../lib/game/types/map/location-pins/modals/location-modal-state";
import LocationModalState from "../../../map/types/map/location-pins/modals/location-modal-state";
import SpecialLocationHelpModal from "./special-location-help-modal";
import LocationDetails from "./location-details";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import QuestNodeProps from "../../../../lib/game/types/map/quests/quest-node-props";
import QuestNodeProps from "../../../map/types/map/quests/quest-node-props";
import QuestDetailsModal from "../modals/quest-details-modal";
import clsx from "clsx";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import {Tree, TreeNode} from "react-organizational-chart";
import QuestTreeProps from "../../../../lib/game/types/map/quests/quest-tree-props";
import QuestTreeProps from "../../../map/types/map/quests/quest-tree-props";
import QuestNode from "./quest-node";
import {QuestDetails} from "../../../../lib/game/map/types/quest-details";
import {ChildQuestDetails} from "../../../../lib/game/map/types/child-quest-details";
import {QuestDetails} from "../../../map/types/quest-details";
import {ChildQuestDetails} from "../../../map/types/child-quest-details";
import Tabs from "../../../../components/ui/tabs/tabs";
import TabPanel from "../../../../components/ui/tabs/tab-panel";

Expand Down
4 changes: 2 additions & 2 deletions resources/js/game/sections/components/quests/quests.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from "react";
import QuestsProps from "../../../lib/game/types/map/quests/quests-props";
import QuestState from "../../../lib/game/types/map/quests/quest-state";
import QuestsProps from "../../map/types/map/quests/quests-props";
import QuestState from "../../map/types/map/quests/quest-state";
import ComponentLoading from "../../../components/ui/loading/component-loading";
import QuestTree from "./components/quest-tree";
import DropDown from "../../../components/ui/drop-down/drop-down";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CharacterType } from "../../../../../lib/game/character/character-type";
import MapState from "../../../../map/types/map-state";
import CharacterCurrenciesDetails from "../../../../../lib/game/types/character-currencies-details";
import PositionType from "../../../../../lib/game/types/map/position-type";
import PositionType from "../../../../map/types/map/position-type";
import { MapTimerData } from "../../../../../lib/game/types/game-state";

export default interface SmallMapSectionProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {CharacterType} from "../../../lib/game/character/character-type";
import CharacterStatusType from "../../../lib/game/character/character-status-type";
import PositionType from "../../../lib/game/types/map/position-type";
import PositionType from "../../map/types/map/position-type";
import { GameActionState } from "../../../lib/game/types/game-state";

export default interface ActionsProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CharacterCurrenciesDetails from "../../../lib/game/types/character-currencies-details";
import ActionsProps from "./actions-props";
import PositionType from "../../../lib/game/types/map/position-type";
import PositionType from "../../map/types/map/position-type";
import MapState from "../../map/types/map-state";
import { MapTimerData } from "../../../lib/game/types/game-state";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {Fragment} from "react";
import Table from "../../../components/ui/data-tables/table";
import BuildingDetails from "../../../lib/game/kingdoms/building-details";
import {buildBuildingsColumns} from "../../../lib/game/kingdoms/build-buildings-columns";
import BuildingsTableProps from "resources/js/game/lib/game/kingdoms/types/buildings-table-props";
import BuildingsTableProps from "../../../lib/game/kingdoms/types/buildings-table-props";
import {AxiosError, AxiosResponse} from "axios";
import Ajax from "../../../lib/ajax/ajax";
import LoadingProgressBar from "../../../components/ui/progress-bars/loading-progress-bar";
Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/sections/kingdoms/units/units-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DangerAlert from "../../../components/ui/alerts/simple-alerts/danger-aler
import SuccessAlert from "../../../components/ui/alerts/simple-alerts/success-alert";
import LoadingProgressBar from "../../../components/ui/progress-bars/loading-progress-bar";
import UpgradeTablesState from "../../../lib/game/kingdoms/types/upgrade-tables-state";
import BuildingDetails from "resources/js/game/lib/game/kingdoms/building-details";
import BuildingDetails from "../../../lib/game/kingdoms/building-details";

export default class UnitsTable extends React.Component<UnitsTableProps, UpgradeTablesState> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {Fragment} from "react";
import MovePlayer from "../../../lib/game/map/ajax/move-player";
import MovePlayer from "../lib/ajax/move-player";
import PrimaryOutlineButton from "../../../components/ui/buttons/primary-outline-button";
import TraverseModal from "../../components/map-actions/modals/traverse-modal";
import DirectionalMovementProps from "../../../lib/game/map/types/directional-movement-props";
import DirectionalMovementState from "../../../lib/game/map/types/directional-movement-state";
import TraverseModal from "../modals/traverse-modal";
import DirectionalMovementProps from "../types/directional-movement-props";
import DirectionalMovementState from "../types/directional-movement-state";
import clsx from "clsx";

export default class DirectionalMovement extends React.Component<DirectionalMovementProps, DirectionalMovementState> {
Expand Down
22 changes: 11 additions & 11 deletions resources/js/game/sections/map/actions/map-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { Fragment } from "react";
import PrimaryOutlineButton from "../../../components/ui/buttons/primary-outline-button";
import MapActionsProps from "../../../lib/game/map/types/map-actions-props";
import { canSettleHere } from "../../../lib/game/map/location-helpers";
import MapActionsState from "../../../lib/game/map/types/map-actions-state";
import ViewLocationState from "../../../lib/game/map/state/view-location-state";
import TeleportModal from "../../components/map-actions/modals/teleport-modal";
import MovePlayer from "../../../lib/game/map/ajax/move-player";
import SetSailModal from "../../components/map-actions/modals/set-sail-modal";
import LocationDetails from "../../../lib/game/map/types/location-details";
import Conjuration from "../../components/map-actions/modals/conjuration";
import SettleKingdomModal from "../../components/map-actions/modals/settle-kingdom-modal";
import ViewLocationModal from "../../components/map-actions/modals/view-location-modal";
import MapActionsProps from "../types/map-actions-props";
import { canSettleHere } from "../lib/location-helpers";
import MapActionsState from "../types/map-actions-state";
import ViewLocationState from "../lib/state/view-location-state";
import TeleportModal from "../modals/teleport-modal";
import MovePlayer from "../lib/ajax/move-player";
import SetSailModal from "../modals/set-sail-modal";
import LocationDetails from "../types/location-details";
import Conjuration from "../modals/conjuration";
import SettleKingdomModal from "../modals/settle-kingdom-modal";
import ViewLocationModal from "../modals/view-location-modal";

export default class MapActions extends React.Component<
MapActionsProps,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/game/sections/map/helpers/merge-locations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LocationDetails from "../../../lib/game/map/types/location-details";
import LocationDetails from "../types/location-details";

const mergeLocations = (locations: LocationDetails[], locationsToMerge: LocationDetails[]): LocationDetails[] => {
const mergedMap = new Map<number, LocationDetails>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Component} from "react";
import {movePlayer} from "../move-player";
import {generateServerMessage} from "../../../ajax/generate-server-message";
import Ajax from "../../../ajax/ajax";
import {generateServerMessage} from "../../../../lib/ajax/generate-server-message";
import Ajax from "../../../../lib/ajax/ajax";
import {AxiosError, AxiosResponse} from "axios";
import MapStateManager from "../state/map-state-manager";
import {getPortLocation} from "../location-helpers";
import {getNewXPosition, getNewYPosition} from "../map-position";
import DirectionalMovement from "../../../../sections/map/actions/directional-movement";
import MapActions from "../../../../sections/map/actions/map-actions";
import DirectionalMovement from "../../actions/directional-movement";
import MapActions from "../../actions/map-actions";
import MapData from "../request-types/MapData";

export default class MovePlayer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import MapState from "../../../sections/map/types/map-state";
import LocationDetails from "./types/location-details";
import MapState from "../types/map-state";
import LocationDetails from "../types/location-details";
import PlayerKingdomsDetails from "../types/map/player-kingdoms-details";
import NpcKingdomsDetails from "../types/map/npc-kingdoms-details";
import MapActions from "../../../sections/map/actions/map-actions";
import MapActions from "../actions/map-actions";

/**
* Gets the current port that the player is on.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MapSection from "../../../sections/map/map-section";
import MapSection from "../map-section";

/**
* Fetches the player icon position for the map component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @param mapPositionY
* @type [{characterY: number, mapPositionY: number}]
*/
import MapSection from "../../../sections/map/map-section";
import MapSection from "../map-section";

export const getNewYPosition = (characterY: number, mapPositionY: number, viewPort: number): number => {
if (characterY < 288) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {generateServerMessage} from "../../ajax/generate-server-message";
import {generateServerMessage} from "../../../lib/ajax/generate-server-message";

/**
* Move the player in a direction.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CharacterMapDetails from "../types/character-map-details";
import LocationDetails from "../types/location-details";
import CharacterMapDetails from "../../types/character-map-details";
import LocationDetails from "../../types/location-details";

export default interface MapData {
can_move: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TeleportModal from "../../../../sections/components/map-actions/modals/teleport-modal";
import LocationDetails from "../types/location-details";
import TeleportModal from "../../modals/teleport-modal";
import LocationDetails from "../../types/location-details";
import PlayerKingdomsDetails from "../../types/map/player-kingdoms-details";
import NpcKingdomsDetails from "../../types/map/npc-kingdoms-details";

Expand Down
Loading

0 comments on commit 393733c

Please sign in to comment.