Showing preview only (626K chars total). Download the full file or copy to clipboard to get everything.
Repository: mchekin/rpg
Branch: master
Commit: 5e4b129f4c9a
Files: 371
Total size: 532.7 KB
Directory structure:
gitextract_b2fve_hr/
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .styleci.yml
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── app/
│ ├── Console/
│ │ └── Kernel.php
│ ├── Exceptions/
│ │ └── Handler.php
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── Api/
│ │ │ │ ├── ManageInventoryController.php
│ │ │ │ ├── ManageStoreController.php
│ │ │ │ └── TradeController.php
│ │ │ ├── Auth/
│ │ │ │ ├── ConfirmPasswordController.php
│ │ │ │ ├── ForgotPasswordController.php
│ │ │ │ ├── LoginController.php
│ │ │ │ ├── RegisterController.php
│ │ │ │ ├── ResetPasswordController.php
│ │ │ │ └── VerificationController.php
│ │ │ ├── BattleController.php
│ │ │ ├── CharacterBattleController.php
│ │ │ ├── CharacterController.php
│ │ │ ├── CharacterMessageController.php
│ │ │ ├── CharacterStoreController.php
│ │ │ ├── Controller.php
│ │ │ ├── InventoryController.php
│ │ │ ├── ItemCreateController.php
│ │ │ ├── LocationController.php
│ │ │ ├── MessageController.php
│ │ │ ├── OwnStoreController.php
│ │ │ └── ProfilePictureController.php
│ │ ├── Kernel.php
│ │ ├── Middleware/
│ │ │ ├── Authenticate.php
│ │ │ ├── CanAttack.php
│ │ │ ├── CanMoveToLocation.php
│ │ │ ├── EncryptCookies.php
│ │ │ ├── HasCharacter.php
│ │ │ ├── IsAdmin.php
│ │ │ ├── IsCharacterLocation.php
│ │ │ ├── NoCharacterYet.php
│ │ │ ├── PreventRequestsDuringMaintenance.php
│ │ │ ├── RedirectIfAuthenticated.php
│ │ │ ├── TrimStrings.php
│ │ │ ├── TrustHosts.php
│ │ │ ├── TrustProxies.php
│ │ │ ├── UpdateLastUserActivity.php
│ │ │ ├── UserOwnsCharacter.php
│ │ │ └── VerifyCsrfToken.php
│ │ ├── Requests/
│ │ │ ├── CreateCharacterRequest.php
│ │ │ ├── CreateItemRequest.php
│ │ │ ├── UpdateCharacterAttributeRequest.php
│ │ │ └── UploadImageRequest.php
│ │ └── ViewComposers/
│ │ ├── BattlesComposer.php
│ │ ├── CharacterGeneralInfoComposer.php
│ │ ├── CharacterMessagesComposer.php
│ │ └── MessagesComposer.php
│ ├── Models/
│ │ ├── Battle.php
│ │ ├── BattleRound.php
│ │ ├── BattleTurn.php
│ │ ├── Character.php
│ │ ├── Image.php
│ │ ├── Inventory.php
│ │ ├── Item.php
│ │ ├── ItemPrototype.php
│ │ ├── Location.php
│ │ ├── Message.php
│ │ ├── Race.php
│ │ ├── Store.php
│ │ └── User.php
│ ├── Modules/
│ │ ├── Battle/
│ │ │ ├── Application/
│ │ │ │ └── Contracts/
│ │ │ │ └── BattleRepositoryInterface.php
│ │ │ ├── Domain/
│ │ │ │ ├── Battle.php
│ │ │ │ ├── BattleId.php
│ │ │ │ ├── BattleRound.php
│ │ │ │ ├── BattleRounds.php
│ │ │ │ ├── BattleTurn.php
│ │ │ │ ├── BattleTurnResult.php
│ │ │ │ └── BattleTurns.php
│ │ │ └── Infrastructure/
│ │ │ └── Repositories/
│ │ │ └── BattleRepository.php
│ │ ├── Character/
│ │ │ ├── Application/
│ │ │ │ ├── Commands/
│ │ │ │ │ ├── AttackCharacterCommand.php
│ │ │ │ │ ├── CreateCharacterCommand.php
│ │ │ │ │ ├── IncreaseAttributeCommand.php
│ │ │ │ │ └── MoveCharacterCommand.php
│ │ │ │ ├── Contracts/
│ │ │ │ │ ├── CharacterRepositoryInterface.php
│ │ │ │ │ ├── LocationRepositoryInterface.php
│ │ │ │ │ └── RaceRepositoryInterface.php
│ │ │ │ ├── Factories/
│ │ │ │ │ └── CharacterFactory.php
│ │ │ │ └── Services/
│ │ │ │ └── CharacterService.php
│ │ │ ├── Domain/
│ │ │ │ ├── Attributes.php
│ │ │ │ ├── Character.php
│ │ │ │ ├── CharacterId.php
│ │ │ │ ├── CharacterType.php
│ │ │ │ ├── Gender.php
│ │ │ │ ├── HitPoints.php
│ │ │ │ ├── LocationId.php
│ │ │ │ ├── Name.php
│ │ │ │ ├── Race.php
│ │ │ │ ├── Reputation.php
│ │ │ │ └── Statistics.php
│ │ │ ├── Infrastructure/
│ │ │ │ ├── ReconstitutionFactories/
│ │ │ │ │ └── CharacterReconstitutionFactory.php
│ │ │ │ └── Repositories/
│ │ │ │ ├── CharacterRepository.php
│ │ │ │ ├── LocationRepository.php
│ │ │ │ └── RaceRepository.php
│ │ │ └── UI/
│ │ │ └── Http/
│ │ │ └── CommandMappers/
│ │ │ ├── AttackCharacterCommandMapper.php
│ │ │ ├── CreateCharacterCommandMapper.php
│ │ │ ├── IncreaseAttributeCommandMapper.php
│ │ │ └── MoveCharacterCommandMapper.php
│ │ ├── Equipment/
│ │ │ ├── Application/
│ │ │ │ ├── Commands/
│ │ │ │ │ ├── AddItemToInventoryCommand.php
│ │ │ │ │ ├── CreateInventoryCommand.php
│ │ │ │ │ ├── CreateItemCommand.php
│ │ │ │ │ └── EquipItemCommand.php
│ │ │ │ ├── Contracts/
│ │ │ │ │ ├── InventoryRepositoryInterface.php
│ │ │ │ │ ├── ItemPrototypeRepositoryInterface.php
│ │ │ │ │ └── ItemRepositoryInterface.php
│ │ │ │ ├── Factories/
│ │ │ │ │ └── ItemFactory.php
│ │ │ │ └── Services/
│ │ │ │ ├── InventoryService.php
│ │ │ │ └── ItemService.php
│ │ │ ├── Domain/
│ │ │ │ ├── Inventory.php
│ │ │ │ ├── InventoryId.php
│ │ │ │ ├── InventoryItem.php
│ │ │ │ ├── InventorySlot.php
│ │ │ │ ├── Item.php
│ │ │ │ ├── ItemEffect.php
│ │ │ │ ├── ItemId.php
│ │ │ │ ├── ItemPrice.php
│ │ │ │ ├── ItemPrototype.php
│ │ │ │ ├── ItemPrototypeId.php
│ │ │ │ ├── ItemStatus.php
│ │ │ │ ├── ItemType.php
│ │ │ │ └── Money.php
│ │ │ ├── Infrastructure/
│ │ │ │ ├── ReconstitutionFactories/
│ │ │ │ │ ├── InventoryItemReconstitutionFactory.php
│ │ │ │ │ ├── InventoryReconstitutionFactory.php
│ │ │ │ │ ├── ItemPrototypeReconstitutionFactory.php
│ │ │ │ │ └── ItemReconstitutionFactory.php
│ │ │ │ └── Repositories/
│ │ │ │ ├── InventoryRepository.php
│ │ │ │ ├── ItemPrototypeRepository.php
│ │ │ │ └── ItemRepository.php
│ │ │ └── UI/
│ │ │ └── Http/
│ │ │ └── CommandMappers/
│ │ │ ├── AddItemToInventoryCommandMapper.php
│ │ │ ├── CreateItemCommandMapper.php
│ │ │ └── EquipItemCommandMapper.php
│ │ ├── Generic/
│ │ │ └── Domain/
│ │ │ ├── BaseId.php
│ │ │ ├── Container/
│ │ │ │ ├── ContainerIsFullException.php
│ │ │ │ ├── ContainerSlotIsTakenException.php
│ │ │ │ ├── ContainerSlotOutOfRangeException.php
│ │ │ │ ├── InvalidMoneyValue.php
│ │ │ │ ├── ItemNotInContainer.php
│ │ │ │ ├── NotEnoughMoneyToRemove.php
│ │ │ │ └── NotEnoughSpaceInContainerException.php
│ │ │ ├── Container.php
│ │ │ └── ContainerType.php
│ │ ├── Image/
│ │ │ ├── Application/
│ │ │ │ ├── Commands/
│ │ │ │ │ └── AddImageCommand.php
│ │ │ │ ├── Contracts/
│ │ │ │ │ └── ImageRepositoryInterface.php
│ │ │ │ ├── Factories/
│ │ │ │ │ └── ImageFactory.php
│ │ │ │ └── Services/
│ │ │ │ └── ProfilePictureService.php
│ │ │ ├── Domain/
│ │ │ │ ├── Image.php
│ │ │ │ ├── ImageFile.php
│ │ │ │ └── ImageId.php
│ │ │ ├── Infrastructure/
│ │ │ │ └── Repositories/
│ │ │ │ └── ImageRepository.php
│ │ │ └── UI/
│ │ │ └── Http/
│ │ │ └── CommandMappers/
│ │ │ └── AddImageCommandMapper.php
│ │ ├── Level/
│ │ │ ├── Application/
│ │ │ │ └── Services/
│ │ │ │ └── LevelService.php
│ │ │ └── Domain/
│ │ │ └── Level.php
│ │ ├── Message/
│ │ │ ├── Application/
│ │ │ │ ├── Commands/
│ │ │ │ │ └── SendMessageCommand.php
│ │ │ │ ├── Contracts/
│ │ │ │ │ └── MessageRepositoryInterface.php
│ │ │ │ └── Services/
│ │ │ │ └── MessageService.php
│ │ │ ├── Domain/
│ │ │ │ ├── Message.php
│ │ │ │ └── MessageId.php
│ │ │ ├── Infrastructure/
│ │ │ │ └── Repositories/
│ │ │ │ └── MessageRepository.php
│ │ │ └── UI/
│ │ │ └── Http/
│ │ │ └── CommandMappers/
│ │ │ └── SendMessageCommandMapper.php
│ │ ├── Trade/
│ │ │ ├── Application/
│ │ │ │ ├── Commands/
│ │ │ │ │ ├── AddItemToStoreCommand.php
│ │ │ │ │ ├── BuyItemCommand.php
│ │ │ │ │ ├── ChangeItemPriceCommand.php
│ │ │ │ │ ├── CreateStoreCommand.php
│ │ │ │ │ ├── MoveItemToContainerCommand.php
│ │ │ │ │ ├── MoveMoneyToContainerCommand.php
│ │ │ │ │ └── SellItemCommand.php
│ │ │ │ ├── Contracts/
│ │ │ │ │ └── StoreRepositoryInterface.php
│ │ │ │ └── Services/
│ │ │ │ ├── CreateStoreService.php
│ │ │ │ ├── ManageStoreService.php
│ │ │ │ └── TradeService.php
│ │ │ ├── Domain/
│ │ │ │ ├── Exception/
│ │ │ │ │ └── SellPriceIsTooHigh.php
│ │ │ │ ├── Store/
│ │ │ │ │ └── StoreDoesNotBuyItems.php
│ │ │ │ ├── Store.php
│ │ │ │ ├── StoreId.php
│ │ │ │ └── StoreType.php
│ │ │ ├── Infrastructure/
│ │ │ │ ├── ReconstitutionFactories/
│ │ │ │ │ └── StoreReconstitutionFactory.php
│ │ │ │ └── Repositories/
│ │ │ │ └── StoreRepository.php
│ │ │ └── UI/
│ │ │ └── Http/
│ │ │ └── CommandMappers/
│ │ │ ├── BuyItemCommandMapper.php
│ │ │ ├── ChangeItemPriceCommandMapper.php
│ │ │ ├── MoveItemToContainerCommandMapper.php
│ │ │ ├── MoveMoneyToContainerCommandMapper.php
│ │ │ └── SellItemCommandMapper.php
│ │ └── User/
│ │ ├── Application/
│ │ │ ├── Commands/
│ │ │ │ └── CreateUserCommand.php
│ │ │ └── Services/
│ │ │ └── UserService.php
│ │ └── UI/
│ │ └── Http/
│ │ └── CommandMappers/
│ │ └── CreateUserCommandMapper.php
│ ├── Providers/
│ │ ├── AppServiceProvider.php
│ │ ├── AuthServiceProvider.php
│ │ ├── BroadcastServiceProvider.php
│ │ ├── EventServiceProvider.php
│ │ ├── RouteServiceProvider.php
│ │ └── ViewComposerServiceProvider.php
│ ├── Support/
│ │ └── helpers.php
│ └── Traits/
│ ├── GeneratesUuid.php
│ ├── ThrowsDice.php
│ └── UsesStringId.php
├── artisan
├── bootstrap/
│ ├── app.php
│ └── cache/
│ └── .gitignore
├── composer.json
├── config/
│ ├── app.php
│ ├── auth.php
│ ├── broadcasting.php
│ ├── cache.php
│ ├── cors.php
│ ├── database.php
│ ├── filesystems.php
│ ├── hashing.php
│ ├── hooks.php
│ ├── image.php
│ ├── logging.php
│ ├── mail.php
│ ├── queue.php
│ ├── services.php
│ ├── session.php
│ ├── view.php
│ ├── voyager-hooks.php
│ └── voyager.php
├── database/
│ ├── .gitignore
│ ├── factories/
│ │ └── UserFactory.php
│ ├── migrations/
│ │ ├── 2014_10_12_000000_create_users_table.php
│ │ ├── 2014_10_12_100000_create_password_resets_table.php
│ │ ├── 2017_05_14_055744_create_locations_table.php
│ │ ├── 2017_05_14_055823_create_races_table.php
│ │ ├── 2017_05_14_055844_create_characters_table.php
│ │ ├── 2017_05_16_144929_create_battles_table.php
│ │ ├── 2017_05_16_181330_create_battle_rounds_table.php
│ │ ├── 2017_05_16_181844_create_battle_turns_table.php
│ │ ├── 2017_11_26_013050_add_user_role_relationship.php
│ │ ├── 2018_06_24_132346_create_messages_table.php
│ │ ├── 2018_11_19_202701_create_images.php
│ │ ├── 2019_08_19_000000_create_failed_jobs_table.php
│ │ ├── 2019_08_31_182034_create_items_table.php
│ │ ├── 2020_02_29_205331_create_inventories.php
│ │ ├── 2020_02_29_205957_create_inventory_item.php
│ │ ├── 2020_03_30_133100_create_stores.php
│ │ └── 2020_03_30_133448_create_store_item.php
│ └── seeders/
│ ├── CharacterSeeder.php
│ ├── DataRowsTableSeeder.php
│ ├── DataTypesTableSeeder.php
│ ├── DatabaseSeeder.php
│ ├── MenuItemsTableSeeder.php
│ ├── MenusTableSeeder.php
│ ├── PermissionRoleTableSeeder.php
│ ├── PermissionsTableSeeder.php
│ ├── RolesTableSeeder.php
│ ├── SettingsTableSeeder.php
│ ├── TranslationsTableSeeder.php
│ ├── UserSeeder.php
│ ├── VoyagerDatabaseSeeder.php
│ └── VoyagerDummyDatabaseSeeder.php
├── docker/
│ ├── cron/
│ │ ├── Dockerfile
│ │ └── scheduler
│ ├── mysql/
│ │ └── my.cnf
│ ├── nginx/
│ │ └── conf.d/
│ │ └── app.conf
│ └── php/
│ ├── Dockerfile
│ ├── application-init.sh
│ └── local.ini
├── docker-compose.yml
├── docs/
│ ├── docker_environment.md
│ └── local_environment.md
├── hooks/
│ └── hooks.json
├── package.json
├── phpunit.xml
├── public/
│ ├── .htaccess
│ ├── index.php
│ ├── js/
│ │ ├── character-create.js
│ │ ├── character-update.js
│ │ └── vcountdown.js
│ ├── robots.txt
│ └── web.config
├── readme.md
├── resources/
│ ├── js/
│ │ ├── app.js
│ │ ├── bootstrap.js
│ │ └── components/
│ │ ├── FlashMessages.vue
│ │ ├── InventoryManagement.vue
│ │ ├── PopupModal.vue
│ │ ├── StoreManagement.vue
│ │ └── StoreTrade.vue
│ ├── lang/
│ │ └── en/
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
│ ├── sass/
│ │ ├── _variables.scss
│ │ ├── app.scss
│ │ └── custom.scss
│ └── views/
│ ├── auth/
│ │ ├── login.blade.php
│ │ ├── passwords/
│ │ │ ├── email.blade.php
│ │ │ └── reset.blade.php
│ │ └── register.blade.php
│ ├── base.blade.php
│ ├── battle/
│ │ ├── partials/
│ │ │ └── no-battles.blade.php
│ │ └── show.blade.php
│ ├── character/
│ │ ├── battle/
│ │ │ └── index.blade.php
│ │ ├── create.blade.php
│ │ ├── inventory/
│ │ │ └── index.blade.php
│ │ ├── message/
│ │ │ └── index.blade.php
│ │ ├── partials/
│ │ │ ├── actions.blade.php
│ │ │ ├── attributes.blade.php
│ │ │ ├── character-display.blade.php
│ │ │ ├── equipment-item-mutable.blade.php
│ │ │ ├── equipment-item.blade.php
│ │ │ ├── equipment-mutable.blade.php
│ │ │ ├── equipment.blade.php
│ │ │ ├── general.blade.php
│ │ │ ├── inventory.blade.php
│ │ │ └── statistics.blade.php
│ │ └── show.blade.php
│ ├── components/
│ │ ├── increment_attribute_button.blade.php
│ │ └── short_character_description.blade.php
│ ├── emails/
│ │ └── password.blade.php
│ ├── errors/
│ │ └── 503.blade.php
│ ├── location/
│ │ ├── partials/
│ │ │ ├── list-character.blade.php
│ │ │ └── navigator.blade.php
│ │ └── show.blade.php
│ ├── message/
│ │ ├── index.blade.php
│ │ └── partials/
│ │ ├── conversation-card.blade.php
│ │ ├── conversation-message.blade.php
│ │ ├── conversation.blade.php
│ │ ├── my-message.blade.php
│ │ ├── no-messages.blade.php
│ │ └── others-message.blade.php
│ ├── pages/
│ │ └── index.blade.php
│ ├── partials/
│ │ ├── flash-messages.blade.php
│ │ └── navbar.blade.php
│ ├── trade/
│ │ ├── own_store/
│ │ │ └── index.blade.php
│ │ └── store/
│ │ └── index.blade.php
│ └── vendor/
│ ├── .gitkeep
│ └── pagination/
│ ├── bootstrap-4.blade.php
│ ├── default.blade.php
│ ├── semantic-ui.blade.php
│ ├── simple-bootstrap-4.blade.php
│ └── simple-default.blade.php
├── routes/
│ ├── api.php
│ ├── channels.php
│ ├── console.php
│ └── web.php
├── scheduler.bat
├── server.php
├── storage/
│ ├── app/
│ │ └── public/
│ │ └── .gitignore
│ ├── debugbar/
│ │ └── .gitignore
│ ├── framework/
│ │ ├── .gitignore
│ │ ├── cache/
│ │ │ └── .gitignore
│ │ ├── sessions/
│ │ │ └── .gitignore
│ │ ├── testing/
│ │ │ └── .gitignore
│ │ └── views/
│ │ └── .gitignore
│ └── logs/
│ └── .gitignore
├── tests/
│ ├── Browser/
│ │ ├── ExampleTest.php
│ │ ├── Pages/
│ │ │ ├── HomePage.php
│ │ │ └── Page.php
│ │ ├── console/
│ │ │ └── .gitignore
│ │ └── screenshots/
│ │ └── .gitignore
│ ├── CreatesApplication.php
│ ├── DuskTestCase.php
│ ├── Feature/
│ │ ├── AttackTest.php
│ │ ├── CharacterCreationTest.php
│ │ └── ExampleTest.php
│ ├── TestCase.php
│ └── Unit/
│ ├── ExampleTest.php
│ └── app/
│ └── Modules/
│ ├── Equipment/
│ │ ├── Application/
│ │ │ └── Services/
│ │ │ └── ItemServiceTest.php
│ │ └── Domain/
│ │ └── InventoryTest.php
│ └── Level/
│ ├── Application/
│ │ └── Services/
│ │ └── LevelServiceTest.php
│ └── Domain/
│ └── Entities/
│ └── LevelTest.php
└── webpack.mix.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
================================================
FILE: .gitattributes
================================================
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
# Files to keep with LF endings, even on Windows
*.sh text eol=lf
/docker/cron/scheduler eol=lf
/docker/mysql/my.cnf eol=lf
/docker/nginx/conf.d/app.conf eol=lf
/docker/php/local.ini eol=lf
================================================
FILE: .gitignore
================================================
/node_modules
/public/hot
/public/storage
/public/css/app.css
/public/fonts/
/public/js/app.js
/storage/*.key
/vendor
/.idea
.env
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.vagrant
/public/mix-manifest.json
================================================
FILE: .styleci.yml
================================================
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
================================================
FILE: .travis.yml
================================================
language: php
php:
- 7.3
addons:
chrome: stable
install:
- cp .env.example .env
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
- php artisan key:generate
- php artisan dusk:chrome-driver
before_script:
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- touch database/database.sqlite
- php artisan serve &
script:
- vendor/bin/phpunit
- php artisan dusk
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at mchekin@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
Thanks for your interest in the project.
Your contribution is highly appreciated.
Here are our guidelines to contributing to the project.
## Adding Feature / Improvement suggestions / Submitting bug report
Feel free to suggest new features, propose improvements or submitting bug reports.
- Open Issues tab
- Create new Issue with an appropriate label
Event better if you create a pull request.
## Creating a pull request
- Fork the repository.
- Create a new branch from the master branch:
- `git checkout -b brief-description`
- Commit and push your changes.
- Submit a pull request through.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2017 Michael Chekin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: app/Console/Kernel.php
================================================
<?php
namespace App\Console;
use App\Models\Character;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
Character::query()
->whereColumn('hit_points', '<', 'total_hit_points')
->increment('hit_points');
})->everyMinute();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
================================================
FILE: app/Exceptions/Handler.php
================================================
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Exceptions\PostTooLargeException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
if ($exception instanceof PostTooLargeException) {
return back()
->withErrors([
'message' => "The file may not be greater than {$this->getMaxSizeInKiloBytes()} kilobytes",
]);
}
return parent::render($request, $exception);
}
private function getMaxSizeInKiloBytes(): float
{
return bytes_to_kilobytes(config('filesystems.max_size_in_bytes'));
}
}
================================================
FILE: app/Http/Controllers/Api/ManageInventoryController.php
================================================
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Modules\Equipment\Application\Services\InventoryService;
use App\Modules\Equipment\UI\Http\CommandMappers\EquipItemCommandMapper;
use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ManageInventoryController extends Controller
{
/**
* @var InventoryService
*/
private $inventoryService;
public function __construct(InventoryService $inventoryService)
{
$this->inventoryService = $inventoryService;
}
public function equipItem(Request $request, EquipItemCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->inventoryService->equipItem($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error equipping item: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item equipped']);
}
public function unEquipItem(Request $request, EquipItemCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->inventoryService->unEquipItem($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error un-equipping item: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item un-equipped']);
}
}
================================================
FILE: app/Http/Controllers/Api/ManageStoreController.php
================================================
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Modules\Trade\Application\Services\ManageStoreService;
use App\Modules\Trade\UI\Http\CommandMappers\ChangeItemPriceCommandMapper;
use App\Modules\Trade\UI\Http\CommandMappers\MoveItemToContainerCommandMapper;
use App\Modules\Trade\UI\Http\CommandMappers\MoveMoneyToContainerCommandMapper;
use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ManageStoreController extends Controller
{
/**
* @var ManageStoreService
*/
private $service;
public function __construct(ManageStoreService $service)
{
$this->service = $service;
}
public function changeItemPrice(Request $request, ChangeItemPriceCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->changeItemPrice($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error changing item price: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item price changed']);
}
public function moveItemToStore(Request $request, MoveItemToContainerCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->moveItemToStore($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error moving item to store: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item moved to store']);
}
public function moveItemToInventory(Request $request, MoveItemToContainerCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->moveItemToInventory($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error moving item to inventory: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item moved to inventory']);
}
public function moveMoneyToStore(Request $request, MoveMoneyToContainerCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->moveMoneyToStore($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error moving money to store: ' . $exception->getMessage()
]);
}
return response()->json(['message' => 'Money moved to store']);
}
public function moveMoneyToInventory(Request $request, MoveMoneyToContainerCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->moveMoneyToInventory($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error moving money to inventory: ' . $exception->getMessage()
]);
}
return response()->json(['status' => 'Money moved to inventory']);
}
}
================================================
FILE: app/Http/Controllers/Api/TradeController.php
================================================
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Modules\Trade\Application\Services\TradeService;
use App\Modules\Trade\UI\Http\CommandMappers\BuyItemCommandMapper;
use App\Modules\Trade\UI\Http\CommandMappers\SellItemCommandMapper;
use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class TradeController extends Controller
{
/**
* @var TradeService
*/
private $service;
public function __construct(TradeService $service)
{
$this->service = $service;
}
public function buyItem(Request $request, BuyItemCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->buyItem($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error buying item: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item bought']);
}
public function sellItem(Request $request, SellItemCommandMapper $commandMapper): JsonResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->service->sellItem($command);
});
} catch (Exception $exception) {
return response()->json([
'message' => 'Error selling item: ' . $exception->getMessage()
], 500);
}
return response()->json(['message' => 'Item bought']);
}
}
================================================
FILE: app/Http/Controllers/Auth/ConfirmPasswordController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
================================================
FILE: app/Http/Controllers/Auth/ForgotPasswordController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}
================================================
FILE: app/Http/Controllers/Auth/LoginController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
================================================
FILE: app/Http/Controllers/Auth/RegisterController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Modules\User\Application\Services\UserService;
use App\Modules\User\UI\Http\CommandMappers\CreateUserCommandMapper;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* @var UserService
*/
private $userService;
/**
* @var CreateUserCommandMapper
*/
private $mapper;
/**
* Create a new controller instance.
*
* @param UserService $userService
* @param CreateUserCommandMapper $mapper
*/
public function __construct(UserService $userService, CreateUserCommandMapper $mapper)
{
$this->middleware('guest');
$this->userService = $userService;
$this->mapper = $mapper;
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:8|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
*
* @return User
*/
protected function create(array $data)
{
$request = $this->mapper->map($data);
return $this->userService->create($request);
}
}
================================================
FILE: app/Http/Controllers/Auth/ResetPasswordController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}
================================================
FILE: app/Http/Controllers/Auth/VerificationController.php
================================================
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
================================================
FILE: app/Http/Controllers/BattleController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Battle;
class BattleController extends Controller
{
public function __construct()
{
$this->middleware('auth', ['only' => ['show']]);
$this->middleware('has.character', ['only' => ['show']]);
}
public function show(string $battleId)
{
$battle = Battle::query()->findOrFail($battleId);
return view('battle.show', compact('battle'));
}
}
================================================
FILE: app/Http/Controllers/CharacterBattleController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
class CharacterBattleController extends Controller
{
public function index(string $characterId)
{
$character = Character::query()->findOrFail($characterId);
return view('character.battle.index', compact('character'));
}
}
================================================
FILE: app/Http/Controllers/CharacterController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
use App\Modules\Character\Application\Services\CharacterService;
use App\Modules\Character\UI\Http\CommandMappers\AttackCharacterCommandMapper;
use App\Modules\Character\UI\Http\CommandMappers\CreateCharacterCommandMapper;
use App\Http\Requests\CreateCharacterRequest;
use App\Http\Requests\UpdateCharacterAttributeRequest;
use App\Modules\Character\UI\Http\CommandMappers\IncreaseAttributeCommandMapper;
use App\Modules\Character\UI\Http\CommandMappers\MoveCharacterCommandMapper;
use App\Models\Race;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class CharacterController extends Controller
{
/**
* @var CharacterService
*/
private $characterService;
/**
* CharacterController constructor.
*
* @param CharacterService $characterService
*/
public function __construct(CharacterService $characterService)
{
$this->middleware('auth');
$this->middleware('has.character', ['except' => ['create', 'store', 'update']]);
$this->middleware('owns.character', ['only' => ['update']]);
$this->middleware('no.character', ['only' => ['create', 'store']]);
$this->middleware('can.move.to.location', ['only' => ['move']]);
$this->middleware('can.attack', ['only' => ['attack']]);
$this->characterService = $characterService;
}
public function create(): View
{
$races = Race::all();
$user = Auth::user();
return view('character.create', compact('races', 'user'));
}
public function store(
CreateCharacterRequest $request,
CreateCharacterCommandMapper $commandMapper
): Response {
$createCharacterCommand = $commandMapper->map($request);
$character = $this->characterService->create($createCharacterCommand);
return redirect()->route('character.show', ['character' => $character->getId()->toString()]);
}
public function show(string $characterId): View
{
$character = Character::query()->findOrFail($characterId);
return view('character.show', compact('character'));
}
public function update(
UpdateCharacterAttributeRequest $request,
IncreaseAttributeCommandMapper $commandMapper,
string $characterId
): Response {
$increaseAttributeCommand = $commandMapper->map($characterId, $request);
$this->characterService->increaseAttribute($increaseAttributeCommand);
return back()->with('status', ucfirst($increaseAttributeCommand->getAttribute()) . ' + 1');
}
public function move(
MoveCharacterCommandMapper $commandMapper,
string $characterId,
string $locationId
): Response {
$moveCharacterCommand = $commandMapper->map($characterId, $locationId);
$this->characterService->move($moveCharacterCommand);
return redirect()->route('location.show', $locationId);
}
public function attack(
string $defenderId,
Request $request,
AttackCharacterCommandMapper $commandMapper
): Response {
$attackCharacterCommand = $commandMapper->map($request, $defenderId);
$battleId = $this->characterService->attack($attackCharacterCommand);
return redirect()->route('battle.show', $battleId->toString());
}
}
================================================
FILE: app/Http/Controllers/CharacterMessageController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
use App\Modules\Message\Application\Services\MessageService;
use App\Modules\Message\UI\Http\CommandMappers\SendMessageCommandMapper;
use Illuminate\Http\Request;
class CharacterMessageController extends Controller
{
public function __construct()
{
$this->middleware(['auth', 'has.character']);
}
public function index(string $characterId)
{
$character = Character::query()->findOrFail($characterId);
return view('character.message.index', compact('character'));
}
public function store(
string $characterId,
Request $request,
SendMessageCommandMapper $commandMapper,
MessageService $messageService
) {
$sendMessageCommand = $commandMapper->map($request);
$messageService->send($sendMessageCommand);
return redirect()->route('character.message.index', $characterId);
}
}
================================================
FILE: app/Http/Controllers/CharacterStoreController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
class CharacterStoreController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->middleware('has.character');
}
public function index(Request $request, string $characterId): View
{
/** @var Character $customer */
$customer = $request->user()->character;
/** @var Character $trader */
$trader = Character::query()->findOrFail($characterId);
return view('trade.store.index', compact('customer', 'trader'));
}
}
================================================
FILE: app/Http/Controllers/Controller.php
================================================
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
================================================
FILE: app/Http/Controllers/InventoryController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
use App\Modules\Equipment\Application\Services\InventoryService;
use App\Modules\Equipment\UI\Http\CommandMappers\EquipItemCommandMapper;
use App\Modules\Level\Application\Services\LevelService;
use Exception;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class InventoryController extends Controller
{
/**
* @var InventoryService
*/
private $inventoryService;
public function __construct(InventoryService $inventoryService)
{
$this->middleware('auth');
$this->inventoryService = $inventoryService;
}
public function index(Request $request, LevelService $levelService): View
{
/** @var Character $character */
$character = $request->user()->character;
$level = $levelService->getLevel($character->getLevelNumber());
return view('character.inventory.index', ['character' => $character, 'level' => $level]);
}
public function equipItem(Request $request, EquipItemCommandMapper $commandMapper): RedirectResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->inventoryService->equipItem($command);
});
} catch (Exception $exception) {
return redirect()->back()->withErrors([
'message' => 'Error equipping item'
]);
}
return redirect()->back()->with('status', 'Item equipped');
}
public function unEquipItem(Request $request, EquipItemCommandMapper $commandMapper): RedirectResponse
{
$command = $commandMapper->map($request);
try {
DB::transaction(function () use ($command) {
$this->inventoryService->unEquipItem($command);
});
} catch (Exception $exception) {
return redirect()->back()->withErrors([
'message' => 'Error un-equipping item'
]);
}
return redirect()->back()->with('status', 'Item un-equipped');
}
}
================================================
FILE: app/Http/Controllers/ItemCreateController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Http\Requests\CreateItemRequest;
use App\Modules\Equipment\Application\Services\ItemService;
use App\Modules\Equipment\UI\Http\CommandMappers\CreateItemCommandMapper;
use Illuminate\Http\Response;
class ItemCreateController extends Controller
{
/**
* @var ItemService
*/
private $itemService;
public function __construct(ItemService $itemService)
{
$this->middleware('auth');
$this->middleware('has.character');
$this->middleware('is.admin');
$this->itemService = $itemService;
}
public function store(
CreateItemRequest $request,
CreateItemCommandMapper $commandMapper
): Response {
$createItemCommand = $commandMapper->map($request);
$this->itemService->create($createItemCommand);
return redirect()->back();
}
}
================================================
FILE: app/Http/Controllers/LocationController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Location;
class LocationController extends Controller
{
public function __construct()
{
$this->middleware('auth', ['only' => ['show']]);
$this->middleware('has.character', ['only' => ['show']]);
$this->middleware('character.location', ['only' => ['show']]);
}
public function show(string $locationId)
{
/** @var Location $location */
$location = Location::query()
->with('characters.race')
->with('characters.user')
->with('adjacentLocations')
->findOrFail($locationId);
return view('location.show', compact('location'));
}
}
================================================
FILE: app/Http/Controllers/MessageController.php
================================================
<?php
namespace App\Http\Controllers;
use Illuminate\View\View;
class MessageController extends Controller
{
public function __construct()
{
$this->middleware(['auth', 'has.character']);
}
public function index(): View
{
return view('message.index');
}
}
================================================
FILE: app/Http/Controllers/OwnStoreController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Models\Character;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
class OwnStoreController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->middleware('has.character');
}
public function index(Request $request): View
{
/** @var Character $character */
$character = $request->user()->character;
return view('trade.own_store.index', compact('character'));
}
}
================================================
FILE: app/Http/Controllers/ProfilePictureController.php
================================================
<?php
namespace App\Http\Controllers;
use App\Http\Requests\UploadImageRequest;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Image\Application\Services\ProfilePictureService;
use App\Modules\Image\UI\Http\CommandMappers\AddImageCommandMapper;
class ProfilePictureController extends Controller
{
public function __construct()
{
$this->middleware('owns.character');
}
public function store(
string $characterId,
UploadImageRequest $request,
ProfilePictureService $profilePictureService,
AddImageCommandMapper $commandMapper
) {
$addImageCommand = $commandMapper->map($characterId, $request->file('file'));
$profilePictureService->update($addImageCommand);
return back()->with('status', 'Profile picture has been changed');
}
public function destroy(
string $characterId,
ProfilePictureService $profilePictureService
) {
$profilePictureService->delete(CharacterId::fromString($characterId));
return back()->with('status', 'Profile picture has been deleted');
}
}
================================================
FILE: app/Http/Kernel.php
================================================
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'character.location' => \App\Http\Middleware\IsCharacterLocation::class,
'has.character' => \App\Http\Middleware\HasCharacter::class,
'can.move.to.location' => \App\Http\Middleware\CanMoveToLocation::class,
'can.attack' => \App\Http\Middleware\CanAttack::class,
'no.character' => \App\Http\Middleware\NoCharacterYet::class,
'owns.character' => \App\Http\Middleware\UserOwnsCharacter::class,
'is.admin' => \App\Http\Middleware\IsAdmin::class,
];
}
================================================
FILE: app/Http/Middleware/Authenticate.php
================================================
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
================================================
FILE: app/Http/Middleware/CanAttack.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\Character;
use App\Models\User;
use Closure;
use Illuminate\Http\Request;
class CanAttack
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var Character $targetCharacter */
$targetCharacter = Character::query()->findOrFail($request->route('character'));
/** @var User $user */
$user = $request->user();
$currentUserCharacter = $user->getCharacter();
if (!$currentUserCharacter->isAlive()) {
return redirect()->back()->withErrors([
'message' => 'You cannot attack when your character is knocked out',
]);
}
if (!$targetCharacter->isAlive()) {
return redirect()->back()->withErrors([
'message' => 'You cannot attack a knocked out character',
]);
}
if ($targetCharacter->getId() === $currentUserCharacter->getId()) {
return redirect()->back()->withErrors([
'message' => 'You cannot attack yourself',
]);
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/CanMoveToLocation.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\Character;
use App\Models\Location;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CanMoveToLocation
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var Character $character */
$character = Character::query()->findOrFail($request->route('character'));
/** @var Location $location */
$location = Location::query()->findOrFail($request->route('location'));
/** @var Location $characterLocation */
$characterLocation = $character->location;
// if this character does not belong to the logged in user
if (Auth::user()->id !== $character->user->id || !$characterLocation->isAdjacentLocation($location)) {
return redirect()->route('location.show', $location->getId());
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/EncryptCookies.php
================================================
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
================================================
FILE: app/Http/Middleware/HasCharacter.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class HasCharacter
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
if ($user && !$user->hasCharacter()) {
return redirect()->route('character.create');
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/IsAdmin.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class IsAdmin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
if ($user && $user->hasRole('admin')) {
return redirect()->back();
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/IsCharacterLocation.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class IsCharacterLocation
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
$locationId = $user->character->getLocationId();
if ($user && $user->hasCharacter() && $locationId !== $request->route('location')) {
return redirect()->route('location.show', $locationId);
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/NoCharacterYet.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class NoCharacterYet
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
if ($user && $user->hasCharacter()) {
return redirect('/home');
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/PreventRequestsDuringMaintenance.php
================================================
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
================================================
FILE: app/Http/Middleware/RedirectIfAuthenticated.php
================================================
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/TrimStrings.php
================================================
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
================================================
FILE: app/Http/Middleware/TrustHosts.php
================================================
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
================================================
FILE: app/Http/Middleware/TrustProxies.php
================================================
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
}
================================================
FILE: app/Http/Middleware/UpdateLastUserActivity.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\User;
use Closure;
class UpdateLastUserActivity
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
if($user) {
$user->updateLastUserActivity();
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/UserOwnsCharacter.php
================================================
<?php
namespace App\Http\Middleware;
use App\Models\Character;
use App\Models\User;
use Closure;
class UserOwnsCharacter
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var User $user */
$user = $request->user();
/** @var Character $character */
$character = Character::query()->findOrFail($request->route('character'));
if ($user && !$user->hasThisCharacter($character)) {
return redirect()->back();
}
return $next($request);
}
}
================================================
FILE: app/Http/Middleware/VerifyCsrfToken.php
================================================
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Illuminate\Session\TokenMismatchException;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
public function handle($request, Closure $next)
{
try {
return parent::handle($request, $next);
}
catch (TokenMismatchException $exception) {
return redirect()->back()->withErrors([
'message' => 'Your Session have expired. Try again.',
]);
}
}
}
================================================
FILE: app/Http/Requests/CreateCharacterRequest.php
================================================
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateCharacterRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|unique:characters,name|min:2',
'gender' => 'required|in:male,female',
'race_id' => 'required|integer',
];
}
}
================================================
FILE: app/Http/Requests/CreateItemRequest.php
================================================
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateItemRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'item_prototype_id' => 'required',
];
}
}
================================================
FILE: app/Http/Requests/UpdateCharacterAttributeRequest.php
================================================
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCharacterAttributeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'attribute' => 'required|in:strength,agility,constitution,intelligence,charisma',
];
}
}
================================================
FILE: app/Http/Requests/UploadImageRequest.php
================================================
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UploadImageRequest extends FormRequest
{
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'file' => [
'required',
'image',
'mimes:jpeg,png,gif',
'max:' . bytes_to_kilobytes(config('filesystems.max_size_in_bytes'))
],
];
}
}
================================================
FILE: app/Http/ViewComposers/BattlesComposer.php
================================================
<?php
namespace App\Http\ViewComposers;
use App\Models\Battle;
use App\Models\Character;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Arr;
use Illuminate\View\View;
class BattlesComposer
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$data = $view->getData();
/** @var Character $character */
$character = Arr::get($data, 'character');
/** @var Collection $battles */
$battles = Battle::query()->where(function (Builder $query) use ($character) {
$query->where([
'attacker_id' => $character->id,
]);
})->orWhere(function (Builder $query) use ($character) {
$query->where([
'defender_id' => $character->id,
]);
})->orderByDesc('created_at')->paginate(10);
$unseenBattles = $character->defends()->unseenByDefender()->whereIn('id', $battles->pluck('id'));
$unseenBattles->markAsSeenByDefender();
$view->with(compact('character', 'battles'));
}
}
================================================
FILE: app/Http/ViewComposers/CharacterGeneralInfoComposer.php
================================================
<?php
namespace App\Http\ViewComposers;
use App\Models\Character;
use App\Modules\Level\Application\Services\LevelService;
use Illuminate\Support\Arr;
use Illuminate\View\View;
class CharacterGeneralInfoComposer
{
/**
* @var LevelService
*/
private $levelService;
public function __construct(LevelService $levelService)
{
$this->levelService = $levelService;
}
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$data = $view->getData();
/** @var Character $character */
$character = Arr::get($data, 'character');
$level = $this->levelService->getLevel($character->getLevelNumber());
$view->with(compact('character', 'level'));
}
}
================================================
FILE: app/Http/ViewComposers/CharacterMessagesComposer.php
================================================
<?php
namespace App\Http\ViewComposers;
use App\Models\Character;
use App\Models\Message;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class CharacterMessagesComposer
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$data = $view->getData();
/** @var Character $currentCharacter */
/** @var Character $otherCharacter */
$currentCharacter = Auth::user()->character;
$otherCharacter = Arr::get($data, 'character');
$messages = Message::query()->where(function (Builder $query) use ($currentCharacter, $otherCharacter) {
$query->where([
'to_id' => $currentCharacter->id,
'from_id' => $otherCharacter->id,
]);
})->orWhere(function (Builder $query) use ($currentCharacter, $otherCharacter) {
$query->where([
'to_id' => $otherCharacter->id,
'from_id' => $currentCharacter->id,
]);
})->orderByDesc('created_at')->paginate(5);
$otherCharacter->sentMessages()->whereIn('id', $messages->pluck('id'))->markAsRead();
$contentLimit = Message::CONTENT_LIMIT;
$view->with(compact('messages', 'currentCharacter', 'otherCharacter', 'contentLimit'));
}
}
================================================
FILE: app/Http/ViewComposers/MessagesComposer.php
================================================
<?php
namespace App\Http\ViewComposers;
use App\Models\Character;
use App\Models\Message;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\View\View;
class MessagesComposer
{
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
/** @var Character $currentCharacter */
$currentCharacter = Auth::user()->character;
$builder = Message::query()->whereIn('auto_id', function (Builder $query) use ($currentCharacter) {
$query
->select(DB::raw('max(`auto_id`)'))
->from('messages')
->where(function (Builder $query) use ($currentCharacter) {
$query->where([
'to_id' => $currentCharacter->id,
]);
})->orWhere(function (Builder $query) use ($currentCharacter) {
$query->where([
'from_id' => $currentCharacter->id,
]);
})->groupBy(DB::raw('
CASE WHEN from_id = "' . $currentCharacter->id . '"
THEN to_id
ELSE from_id
END'));
})->orderByDesc('auto_id');
$messages = $builder->paginate(5);
$view->with(compact('messages', 'currentCharacter'));
}
}
================================================
FILE: app/Models/Battle.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property Collection rounds
* @property Character attacker
* @property Character defender
* @property int victor_xp_gained
* @property Location location
* @property Character victor
*/
class Battle extends Model
{
use UsesStringId;
protected $guarded = [];
public function rounds(): HasMany
{
return $this->hasMany(BattleRound::class);
}
public function attacker(): BelongsTo
{
return $this->belongsTo(Character::class, 'attacker_id');
}
public function defender(): BelongsTo
{
return $this->belongsTo(Character::class, 'defender_id');
}
public function victor(): BelongsTo
{
return $this->belongsTo(Character::class, 'victor_id');
}
public function location(): BelongsTo
{
return $this->belongsTo(Location::class);
}
/**
* @param $query
* @return mixed
*/
public function scopeUnseenByDefender($query)
{
return $query->where('seen_by_defender', false);
}
/**
* Read the selected Messages
*
* @param $query
* @return mixed
*/
public function scopeMarkAsSeenByDefender($query)
{
return $query->update(['seen_by_defender' => true]);
}
public function getAttacker(): Character
{
return $this->attacker;
}
public function getDefender(): Character
{
return $this->defender;
}
public function isTheVictor(Character $character): bool
{
return $this->victor->id === $character->getId();
}
}
================================================
FILE: app/Models/BattleRound.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class BattleRound extends Model
{
use UsesStringId;
protected $guarded = [];
/**
* @return HasMany
*/
public function turns()
{
return $this->hasMany(BattleTurn::class);
}
}
================================================
FILE: app/Models/BattleTurn.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BattleTurn extends Model
{
use UsesStringId;
protected $guarded = [];
/**
* @return BelongsTo
*/
public function executor()
{
return $this->belongsTo(Character::class, 'executor_id');
}
/**
* @return BelongsTo
*/
public function target()
{
return $this->belongsTo(Character::class, 'target_id');
}
}
================================================
FILE: app/Models/Character.php
================================================
<?php
namespace App\Models;
use App\Modules\Character\Domain\CharacterType;
use App\Modules\Equipment\Domain\ItemStatus;
use App\Modules\Equipment\Domain\ItemType;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* @property User user
* @property Location location
* @property string id
* @property integer hit_points
* @property integer xp
* @property integer available_attribute_points
* @property integer battles_won
* @property integer battles_lost
* @property integer strength
* @property integer agility
* @property integer constitution
* @property integer intelligence
* @property integer charisma
* @property string location_id
* @property Race race
* @property string gender
* @property string type
* @property int total_hit_points
* @property int victor_xp_gained
* @property Image profilePicture
* @property string name
* @property int level_id
* @property string profile_picture_id
* @property Inventory inventory
* @property Store store
* @property integer reputation
*/
class Character extends Model
{
use UsesStringId;
protected $guarded = [];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function race(): BelongsTo
{
return $this->belongsTo(Race::class);
}
public function location(): BelongsTo
{
return $this->belongsTo(Location::class);
}
public function profilePicture(): BelongsTo
{
return $this->belongsTo(Image::class, 'profile_picture_id');
}
public function images(): HasMany
{
return $this->hasMany(Image::class);
}
public function inventory(): HasOne
{
return $this->hasOne(Inventory::class);
}
public function store(): HasOne
{
return $this->hasOne(Store::class);
}
public function receivedMessages(): HasMany
{
return $this->hasMany(Message::class, 'to_id');
}
public function sentMessages(): HasMany
{
return $this->hasMany(Message::class, 'from_id');
}
public function attacks(): HasMany
{
return $this->hasMany(Battle::class, 'attacker_id');
}
public function defends(): HasMany
{
return $this->hasMany(Battle::class, 'defender_id');
}
public function battles(): HasMany
{
return $this->hasMany(Battle::class, 'defender_id');
}
public function sendMessageTo(Character $companion, string $content): Character
{
$this->sentMessages()->create([
'to_id' => $companion->getId(),
'content' => $content,
]);
return $this;
}
public function isYou(): bool
{
return $this->isPlayerCharacter() && $this->user->isCurrentAuthenticatedUser();
}
public function isOwnMerchant(): bool
{
return $this->isMerchant() && $this->user->isCurrentAuthenticatedUser();
}
public function isPlayerCharacter(): bool
{
return $this->type === CharacterType::PLAYER;
}
public function isMerchant(): bool
{
return $this->type === CharacterType::MERCHANT;
}
public function isMonster(): bool
{
return $this->type === CharacterType::MONSTER;
}
public function isNPC(): bool
{
return !$this->isPlayerCharacter();
}
public function hasProfilePicture(): bool
{
return $this->profilePicture()->exists();
}
public function isOnline(): bool
{
if($this->isNPC()) {
return true;
}
return $this->user->isOnline();
}
public function getProfilePicture(): Image
{
return $this->profilePicture;
}
public function getProfilePictureFull(): string
{
if ($this->profilePicture()->exists())
{
/** @var Image $image */
$image = $this->profilePicture()->first();
return $image->getFilePathFull();
}
return $this->race->getImageByGender($this->gender);
}
public function getProfilePictureSmall(): string
{
if ($this->profilePicture()->exists())
{
/** @var Image $image */
$image = $this->profilePicture()->first();
return $image->getFilePathSmall();
}
return 'svg/avatar.svg';
}
public function getProfilePictureId(): ?string
{
return $this->profile_picture_id;
}
public function getRaceName(): string
{
return $this->race->getName();
}
public function getLevelNumber():int
{
return $this->level_id;
}
public function getLocationName():string
{
return $this->location->getName();
}
public function getId(): string
{
return $this->id;
}
public function isAlive(): bool
{
return $this->hit_points > 0;
}
public function getStrength(): int
{
return $this->strength;
}
public function getAgility(): int
{
return $this->agility;
}
public function getConstitution(): int
{
return $this->constitution;
}
public function getIntelligence(): int
{
return $this->intelligence;
}
public function getCharisma(): int
{
return $this->charisma;
}
public function getLocationId(): string
{
return $this->location_id;
}
public function getHitPoints(): int
{
return $this->hit_points;
}
public function getTotalHitPoints(): int
{
return $this->total_hit_points;
}
public function getUserId()
{
return $this->user ? $this->user->getId() : null;
}
public function getName(): string
{
return $this->name;
}
public function getGender(): string
{
return $this->gender;
}
public function getType(): string
{
return $this->type;
}
public function getRaceId(): int
{
return $this->race->getId();
}
public function getXp(): int
{
return $this->xp;
}
public function getAvailableAttributePoints(): int
{
return $this->available_attribute_points;
}
public function getBattlesLost(): int
{
return $this->battles_lost;
}
public function getBattlesWon(): int
{
return $this->battles_won;
}
public function getHeadGearItem()
{
return $this->inventory->items()
->where('type', ItemType::HEAD_GEAR)
->wherePivot('status', ItemStatus::EQUIPPED)
->first()
;
}
public function getBodyArmorItem()
{
return $this->inventory->items()
->where('type', ItemType::BODY_ARMOR)
->wherePivot('status', ItemStatus::EQUIPPED)
->first()
;
}
public function getMainHandItem()
{
return $this->inventory->items()
->where('type', ItemType::MAIN_HAND)
->wherePivot('status', ItemStatus::EQUIPPED)
->first()
;
}
public function getOffHandItem()
{
return $this->inventory->items()
->where('type', ItemType::OFF_HAND)
->wherePivot('status', ItemStatus::EQUIPPED)
->first()
;
}
}
================================================
FILE: app/Models/Image.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
/**
* @property string file_path_full
* @property string file_path_small
* @property string file_path_icon
* @property string id
* @property string character_id
*/
class Image extends Model
{
use UsesStringId;
protected $guarded = [];
public function getId()
{
return $this->id;
}
public function getCharacterId(): string
{
return $this->character_id;
}
public function getFilePathFull(): string
{
return $this->file_path_full;
}
public function getFilePathSmall(): string
{
return $this->file_path_small;
}
public function getFilePathIcon(): string
{
return $this->file_path_icon;
}
}
================================================
FILE: app/Models/Inventory.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property Character character
* @property Collection items
* @property string id
* @property string character_id
* @property int money
*/
class Inventory extends Model
{
use UsesStringId;
protected $casts = [
'money' => 'integer',
];
protected $guarded = [];
public function character(): BelongsTo
{
return $this->belongsTo(Character::class, 'character_id');
}
public function items(): BelongsToMany
{
return $this->belongsToMany(Item::class)->withPivot('inventory_slot_number', 'status');
}
public function getId(): string
{
return $this->id;
}
public function getCharacterId(): string
{
return $this->character_id;
}
public function getMoney(): int
{
return $this->money;
}
}
================================================
FILE: app/Models/Item.php
================================================
<?php
namespace App\Models;
use App\Modules\Equipment\Domain\ItemStatus;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property string id
* @property string name
* @property string $description
* @property string image_file_path
* @property string type
* @property string status
* @property array effects
* @property string prototype_id
* @property string creator_character_id
* @property string owner_character_id
* @property int inventory_slot_number
* @property int price
* @property Inventory inventory
* @property mixed pivot
*/
class Item extends Model
{
use UsesStringId;
protected $guarded = [];
protected $casts = [
'effects' => 'array'
];
public function inventory(): BelongsToMany
{
return $this->belongsToMany(Inventory::class);
}
public function prototype(): BelongsTo
{
return $this->belongsTo(ItemPrototype::class);
}
public function getId(): string
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function getImageFilePath(): string
{
return $this->image_file_path;
}
public function getType(): string
{
return $this->type;
}
public function getStatus(): string
{
return $this->status;
}
public function getEffects(): array
{
return $this->effects;
}
public function getPrice(): int
{
return $this->price;
}
public function getPrototypeId(): string
{
return $this->prototype_id;
}
public function getCreatorCharacterId(): string
{
return $this->creator_character_id;
}
public function isEquipped(): bool
{
return $this->pivot->status === ItemStatus::EQUIPPED;
}
public function getInventorySlotNumber(): int
{
return $this->pivot->inventory_slot_number;
}
}
================================================
FILE: app/Models/ItemPrototype.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
/**
* @property string id
* @property string name
* @property string $description
* @property string image_file_path
* @property string type
* @property array effects
* @property int price
*/
class ItemPrototype extends Model
{
use UsesStringId;
protected $guarded = [];
protected $casts = [
'effects' => 'array'
];
public function getId(): string
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function getImageFilePath(): string
{
return $this->image_file_path;
}
public function getType(): string
{
return $this->type;
}
public function getEffects(): array
{
return $this->effects;
}
public function getPrice(): int
{
return $this->price;
}
}
================================================
FILE: app/Models/Location.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property string id
* @property string name
* @property Collection adjacentLocations
*/
class Location extends Model
{
use UsesStringId;
static protected $oppositeDirections = [
'north' => 'south',
'east' => 'west',
];
/**
* Getting all possible movement directions.
*
* @return array
*/
static public function getDirections()
{
return array_merge(array_keys(Location::$oppositeDirections), array_values(Location::$oppositeDirections));
}
/**
* Getting the opposite direction
*
* @param $direction
*
* @return mixed
*/
static protected function getAppositeDirection($direction)
{
if (array_key_exists ($direction, self::$oppositeDirections)) {
return self::$oppositeDirections[$direction];
}
if (in_array($direction, self::$oppositeDirections)) {
return array_search($direction, self::$oppositeDirections);
}
throw new \InvalidArgumentException('Invalid direction: '.$direction);
}
/**
* @param $direction
*
* @return bool
*/
static protected function isValidDirection($direction)
{
return array_key_exists ($direction, self::$oppositeDirections) || in_array($direction, self::$oppositeDirections);
}
/**
* Get the characters at the location.
*
* @return HasMany
*/
public function characters()
{
return $this->hasMany(Character::class);
}
/**
* @return BelongsToMany
*/
public function adjacentLocations()
{
return $this->belongsToMany(Location::class, 'adjacent_location', 'location_id', 'adjacent_location_id')->withPivot('direction');
}
public function adjacent($type)
{
return $this->adjacentLocations->filter(function (Location $value, $key) use ($type) {
return $value->getOriginal('pivot_direction') === $type;
})->first();
}
public function addAdjacentLocation(Location $adjacent, $direction)
{
if (!self::isValidDirection($direction)) {
throw new \InvalidArgumentException('Invalid adjacent direction type: '.$direction);
}
$this->adjacentLocations()->attach($adjacent, [
'direction' => $direction,
"created_at" => Carbon::now(),
"updated_at" => Carbon::now(),
]); // add adjacent
$adjacent->adjacentLocations()->attach($this, [
'direction' => self::getAppositeDirection($direction),
"created_at" => Carbon::now(),
"updated_at" => Carbon::now(),
]); // add yourself, too
}
public function removeAdjacentLocation(Location $adjacent)
{
$this->adjacentLocations()->detach($adjacent); // remove friend
$adjacent->adjacentLocations()->detach($this); // remove yourself, too
}
public function getName(): string
{
return $this->name;
}
public function isAdjacentLocation(Location $location): bool
{
return (bool)$this->adjacentLocations()->where('id', $location->getId())->first();
}
public function getId(): string
{
return $this->id;
}
}
================================================
FILE: app/Models/Message.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Str;
/**
* @property string state
* @property string from_id
* @property string to_id
* @property string content
* @property string id
*/
class Message extends Model
{
use UsesStringId;
const UNREAD = 'unread';
const READ = 'read';
const CONTENT_LIMIT = 500;
protected $guarded = [];
public $timestamps = true;
/**
* @return BelongsTo
*/
public function sender()
{
return $this->belongsTo(Character::class, 'from_id');
}
/**
* @return BelongsTo
*/
public function recipient()
{
return $this->belongsTo(Character::class, 'to_id');
}
/**
* Get the number of new messages related to this conversation
*
* @param $query
* @return mixed
*/
public function scopeUnread($query)
{
return $query->where('state', Message::UNREAD);
}
/**
* Read the selected Messages
*
* @param $query
* @return mixed
*/
public function scopeMarkAsRead($query)
{
return $query->update(['state' => Message::READ]);
}
/**
* Set the user's first name.
*
* @param string $value
* @return void
*/
public function setContentAttribute($value)
{
$value = str_replace("\r\n", "\n", $value);
$limitedString = Str::limit($value, self::CONTENT_LIMIT, '');
$this->attributes['content'] = nl2br(e($limitedString));
}
public function unseenByRecipient(): bool
{
return (string)$this->getOriginal('state') === self::UNREAD;
}
}
================================================
FILE: app/Models/Race.php
================================================
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property string name
* @property string description
* @property string male_image
* @property string female_image
*/
class Race extends Model
{
const ATTRIBUTE_STRENGTH = 'strength';
const ATTRIBUTE_AGILITY = 'agility';
const ATTRIBUTE_CONSTITUTION = 'constitution';
const ATTRIBUTE_INTELLIGENCE = 'intelligence';
const ATTRIBUTE_CHARISMA = 'charisma';
const ATTRIBUTE_STARTING_LOCATION_ID = 'starting_location_id';
const ATTRIBUTE_NAME = 'name';
public function getImageByGender(string $gender): string
{
return $this->{"{$gender}_image"};
}
public function getId(): int
{
return $this->getKey();
}
public function getStartingLocationId(): string
{
return $this->{self::ATTRIBUTE_STARTING_LOCATION_ID};
}
public function getStrength(): int
{
return $this->{self::ATTRIBUTE_STRENGTH};
}
public function getAgility(): int
{
return $this->{self::ATTRIBUTE_AGILITY};
}
public function getConstitution(): int
{
return $this->{self::ATTRIBUTE_CONSTITUTION};
}
public function getIntelligence(): int
{
return $this->{self::ATTRIBUTE_INTELLIGENCE};
}
public function getCharisma(): int
{
return $this->{self::ATTRIBUTE_CHARISMA};
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function getMaleImage(): string
{
return $this->male_image;
}
public function getFemaleImage(): string
{
return $this->female_image;
}
}
================================================
FILE: app/Models/Store.php
================================================
<?php
namespace App\Models;
use App\Traits\UsesStringId;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* @property Character character
* @property Collection items
* @property string id
* @property string type
* @property string character_id
* @property int money
*/
class Store extends Model
{
use UsesStringId;
protected $casts = [
'money' => 'integer',
];
protected $guarded = [];
public function character(): BelongsTo
{
return $this->belongsTo(Character::class, 'character_id');
}
public function items(): BelongsToMany
{
return $this->belongsToMany(Item::class, 'store_item')
->withPivot('inventory_slot_number', 'price');
}
public function getId(): string
{
return $this->id;
}
public function getType(): string
{
return $this->type;
}
public function getCharacterId(): string
{
return $this->character_id;
}
public function getMoney(): int
{
return $this->money;
}
}
================================================
FILE: app/Models/User.php
================================================
<?php
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
/**
* @property Character character
* @property integer id
*/
class User extends \TCG\Voyager\Models\User
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function character(): HasOne
{
return $this->hasOne(Character::class);
}
public function hasCharacter(): bool
{
return $this->character()->getQuery()->exists();
}
public function getId(): int
{
return $this->id;
}
public function isCurrentAuthenticatedUser(): bool
{
return $this->getId() == Auth::id();
}
public function getCharacter(): Character
{
return $this->character;
}
public function hasThisCharacter(Character $character): bool
{
return $this->character->id === $character->getId();
}
public function updateLastUserActivity(): User
{
$expiresAt = Carbon::now()->addMinutes(5);
Cache::put('last-user-activity-' . $this->id, true, $expiresAt);
return $this;
}
public function isOnline(): bool
{
return Cache::has('last-user-activity-' . $this->id);
}
}
================================================
FILE: app/Modules/Battle/Application/Contracts/BattleRepositoryInterface.php
================================================
<?php
namespace App\Modules\Battle\Application\Contracts;
use App\Modules\Battle\Domain\Battle;
use App\Modules\Battle\Domain\BattleId;
interface BattleRepositoryInterface
{
public function nextIdentity(): BattleId;
public function add(Battle $battle):void;
}
================================================
FILE: app/Modules/Battle/Domain/Battle.php
================================================
<?php
namespace App\Modules\Battle\Domain;
use App\Modules\Character\Domain\Character;
use App\Traits\GeneratesUuid;
class Battle
{
use GeneratesUuid;
/**
* @var BattleId
*/
private $id;
/**
* @var string
*/
private $locationId;
/**
* @var Character
*/
private $attacker;
/**
* @var Character
*/
private $defender;
/**
* @var BattleRounds
*/
private $rounds;
/**
* @var int
*/
private $victorXpGained;
/**
* @var Character|null
*/
private $victor;
public function __construct(
BattleId $id,
string $locationId,
Character $attacker,
Character $defender,
BattleRounds $rounds,
int $victorXpGained,
Character $victor = null
)
{
$this->id = $id;
$this->locationId = $locationId;
$this->attacker = $attacker;
$this->defender = $defender;
$this->rounds = $rounds;
$this->victorXpGained = $victorXpGained;
$this->victor = $victor;
}
public function execute(): void
{
do {
$round = $this->createRound(
$this->getAttacker(),
$this->getDefender()
);
$round->execute();
$this->rounds->push($round);
} while ($round->notLastRound());
$this->victor = $this->attacker->isAlive() ? $this->attacker : $this->defender;
$loser = $this->attacker->isAlive() ? $this->defender : $this->attacker;
$this->victorXpGained = $this->calculateVictorXpGained($loser, $this->victor);
}
private function calculateVictorXpGained(Character $loser, Character $victor): int
{
return max($loser->getLevelNumber() - $victor->getLevelNumber(), 1) * 3;
}
public function getId(): BattleId
{
return $this->id;
}
public function getAttacker(): Character
{
return $this->attacker;
}
public function getDefender(): Character
{
return $this->defender;
}
public function getVictorXpGained(): int
{
return $this->victorXpGained;
}
public function getRounds(): BattleRounds
{
return $this->rounds;
}
public function getVictor(): Character
{
return $this->victor;
}
public function getLoser(): Character
{
return $this->victor->equals($this->attacker) ? $this->defender : $this->attacker;
}
public function getLocationId(): string
{
return $this->locationId;
}
private function createRound(Character $attacker, Character $defender): BattleRound
{
return new BattleRound(
$this->generateUuid(),
$attacker,
$defender,
new BattleTurns()
);
}
}
================================================
FILE: app/Modules/Battle/Domain/BattleId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Battle\Domain;
use App\Modules\Generic\Domain\BaseId;
class BattleId extends BaseId
{
}
================================================
FILE: app/Modules/Battle/Domain/BattleRound.php
================================================
<?php
namespace App\Modules\Battle\Domain;
use App\Modules\Character\Domain\Character;
use App\Traits\GeneratesUuid;
class BattleRound
{
use GeneratesUuid;
/**
* @var string
*/
private $id;
/**
* @var Character
*/
private $attacker;
/**
* @var Character
*/
private $defender;
/**
* @var BattleTurns
*/
private $turns;
public function __construct(
string $id,
Character $attacker,
Character $defender,
BattleTurns $turns
) {
$this->id = $id;
$this->attacker = $attacker;
$this->defender = $defender;
$this->turns = $turns;
}
public function getId(): string
{
return $this->id;
}
public function getTurns(): BattleTurns
{
return $this->turns;
}
public function execute(): void
{
$turn = $this->createTurn($this->attacker, $this->defender);
$turn->execute();
$this->turns->push($turn);
if ($turn->isTargetAlive()) {
$turn = $this->createTurn($this->defender, $this->attacker);
$turn->execute();
$this->turns->push($turn);
}
}
public function notLastRound(): bool
{
/** @var BattleTurn $lastTurn */
$lastTurn = $this->turns->last();
return $lastTurn->isTargetAlive();
}
private function createTurn(Character $owner, Character $target): BattleTurn
{
return new BattleTurn(
$this->generateUuid(),
$owner,
$target,
BattleTurnResult::none()
);
}
}
================================================
FILE: app/Modules/Battle/Domain/BattleRounds.php
================================================
<?php
namespace App\Modules\Battle\Domain;
use Illuminate\Support\Collection;
class BattleRounds extends Collection
{
}
================================================
FILE: app/Modules/Battle/Domain/BattleTurn.php
================================================
<?php
namespace App\Modules\Battle\Domain;
use App\Modules\Character\Domain\Character;
use App\Traits\ThrowsDice;
class BattleTurn
{
use ThrowsDice;
/**
* @var string
*/
private $id;
/**
* @var Character
*/
private $owner;
/**
* @var Character
*/
private $target;
/**
* @var BattleTurnResult
*/
private $result;
public function __construct(string $id, Character $owner, Character $target, BattleTurnResult $result)
{
$this->id = $id;
$this->owner = $owner;
$this->target = $target;
$this->result = $result;
}
public function execute()
{
if (!$this->isTargetHit()) {
$this->result = BattleTurnResult::miss();
}
$forceFactor = $this->owner->generateDamage();
$armorRating = $this->target->getArmorRating();
$isCriticalHit = $this->isCriticalHit();
$forceFactor = $isCriticalHit ? $forceFactor * 3 : $forceFactor;
$damage = max($forceFactor - $armorRating, 0);
$damageAbsorbed = $forceFactor - $damage;
$this->result = $isCriticalHit
? BattleTurnResult::criticalHit($damage, $damageAbsorbed)
: BattleTurnResult::hit($damage, $damageAbsorbed);
$this->target->applyDamage($damage);
}
public function isOwnerAlive(): bool
{
return $this->owner->isAlive();
}
public function isTargetAlive(): bool
{
return $this->target->isAlive();
}
private function isTargetHit(): bool
{
$precision = $this->owner->generatePrecision();
$evasion = $this->target->generateEvasionFactor();
return $precision > $evasion;
}
private function isCriticalHit(): bool
{
$trickery = $this->owner->generateTrickery();
$awareness = $this->target->generateAwareness();
return $trickery > $awareness;
}
public function getId(): string
{
return $this->id;
}
public function getOwner(): Character
{
return $this->owner;
}
public function getTarget(): Character
{
return $this->target;
}
public function getDamageDone(): int
{
return $this->result->getDamageDone();
}
public function getDamageAbsorbed(): int
{
return $this->result->getDamageAbsorbed();
}
public function getResultType(): string
{
return $this->result->getType();
}
}
================================================
FILE: app/Modules/Battle/Domain/BattleTurnResult.php
================================================
<?php
namespace App\Modules\Battle\Domain;
class BattleTurnResult
{
const NONE = 'none';
const MISS = 'miss';
const HIT = 'hit';
const CRITICAL_HIT = 'critical_hit';
const TYPES = [
self::NONE,
self::MISS,
self::HIT,
self::CRITICAL_HIT,
];
/**
* @var string
*/
private $type;
/**
* @var int
*/
private $damageDone;
/**
* @var int
*/
private $damageAbsorbed;
public function __construct(string $type, int $damageDone, int $damageAbsorbed)
{
$this->type = $type;
$this->damageDone = $damageDone;
$this->damageAbsorbed = $damageAbsorbed;
}
public static function none()
{
return new self(self::NONE, 0, 0);
}
public static function miss()
{
return new self(self::MISS, 0, 0);
}
public static function hit(int $damageDone, int $damageAbsorbed)
{
return new self(self::HIT, $damageDone, $damageAbsorbed);
}
public static function criticalHit(int $damageDone, int $damageAbsorbed)
{
return new self(self::CRITICAL_HIT, $damageDone, $damageAbsorbed);
}
public function getType(): string
{
return $this->type;
}
public function getDamageDone(): int
{
return $this->damageDone;
}
public function getDamageAbsorbed(): int
{
return $this->damageAbsorbed;
}
}
================================================
FILE: app/Modules/Battle/Domain/BattleTurns.php
================================================
<?php
namespace App\Modules\Battle\Domain;
use Illuminate\Support\Collection;
class BattleTurns extends Collection
{
}
================================================
FILE: app/Modules/Battle/Infrastructure/Repositories/BattleRepository.php
================================================
<?php
namespace App\Modules\Battle\Infrastructure\Repositories;
use App\Modules\Battle\Application\Contracts\BattleRepositoryInterface;
use App\Modules\Battle\Domain\Battle;
use App\Models\Battle as BattleModel;
use App\Models\BattleRound as BattleRoundModel;
use App\Modules\Battle\Domain\BattleId;
use App\Modules\Battle\Domain\BattleRound;
use App\Modules\Battle\Domain\BattleTurn;
use App\Traits\GeneratesUuid;
use Exception;
class BattleRepository implements BattleRepositoryInterface
{
use GeneratesUuid;
/**
* @return BattleId
*
* @throws Exception
*/
public function nextIdentity(): BattleId
{
return BattleId::fromString($this->generateUuid());
}
public function add(Battle $battle): void
{
/** @var BattleModel $battleModel */
$battleModel = BattleModel::query()->create([
'id' => $battle->getId()->toString(),
'location_id' => $battle->getLocationId(),
'attacker_id' => $battle->getAttacker()->getId()->toString(),
'defender_id' => $battle->getDefender()->getId()->toString(),
'victor_id' => $battle->getVictor()->getId()->toString(),
'victor_xp_gained' => $battle->getVictorXpGained(),
]);
/** @var BattleRound $round */
foreach ($battle->getRounds()->all() as $round) {
/** @var BattleRoundModel $roundModel */
$roundModel = $battleModel->rounds()->create([
'id' => $round->getId(),
]);
/** @var BattleTurn $turn */
foreach ($round->getTurns()->all() as $turn) {
$roundModel->turns()->create([
'id' => $turn->getId(),
'damageDone' => $turn->getDamageDone(),
'damageAbsorbed' => $turn->getDamageAbsorbed(),
'result_type' => $turn->getResultType(),
'executor_id' => $turn->getOwner()->getId()->toString(),
'target_id' => $turn->getTarget()->getId()->toString(),
]);
}
}
}
}
================================================
FILE: app/Modules/Character/Application/Commands/AttackCharacterCommand.php
================================================
<?php
namespace App\Modules\Character\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
class AttackCharacterCommand
{
/**
* @var CharacterId
*/
private $attackerId;
/**
* @var CharacterId
*/
private $defenderId;
public function __construct(CharacterId $attackerId, CharacterId $defenderId)
{
$this->attackerId = $attackerId;
$this->defenderId = $defenderId;
}
public function getAttackerId(): CharacterId
{
return $this->attackerId;
}
public function getDefenderId(): CharacterId
{
return $this->defenderId;
}
}
================================================
FILE: app/Modules/Character/Application/Commands/CreateCharacterCommand.php
================================================
<?php
namespace App\Modules\Character\Application\Commands;
class CreateCharacterCommand
{
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $gender;
/**
* @var string
*/
private $type;
/**
* @var int
*/
private $raceId;
/**
* @var string
*/
private $userId;
public function __construct(string $name, string $gender, string $type, int $raceId, string $userId)
{
$this->name = $name;
$this->gender = $gender;
$this->type = $type;
$this->raceId = $raceId;
$this->userId = $userId;
}
public function getName(): string
{
return $this->name;
}
public function getGender(): string
{
return $this->gender;
}
public function getCharacterType(): string
{
return $this->type;
}
public function getRaceId(): int
{
return $this->raceId;
}
public function getUserId(): string
{
return $this->userId;
}
}
================================================
FILE: app/Modules/Character/Application/Commands/IncreaseAttributeCommand.php
================================================
<?php
namespace App\Modules\Character\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
class IncreaseAttributeCommand
{
/**
* @var CharacterId
*/
private $characterId;
/**
* @var string
*/
private $attribute;
public function __construct(CharacterId $characterId, string $attribute)
{
$this->characterId = $characterId;
$this->attribute = $attribute;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getAttribute(): string
{
return $this->attribute;
}
}
================================================
FILE: app/Modules/Character/Application/Commands/MoveCharacterCommand.php
================================================
<?php
namespace App\Modules\Character\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
class MoveCharacterCommand
{
/**
* @var CharacterId
*/
private $characterId;
/**
* @var string
*/
private $locationId;
public function __construct(CharacterId $characterId, string $locationId)
{
$this->characterId = $characterId;
$this->locationId = $locationId;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getLocationId(): string
{
return $this->locationId;
}
}
================================================
FILE: app/Modules/Character/Application/Contracts/CharacterRepositoryInterface.php
================================================
<?php
namespace App\Modules\Character\Application\Contracts;
use App\Modules\Character\Domain\Character;
use App\Modules\Character\Domain\CharacterId;
interface CharacterRepositoryInterface
{
public function nextIdentity(): CharacterId;
public function add(Character $character): void;
public function getOne(CharacterId $characterId): Character;
public function update(Character $character): void;
}
================================================
FILE: app/Modules/Character/Application/Contracts/LocationRepositoryInterface.php
================================================
<?php
namespace App\Modules\Character\Application\Contracts;
use App\Modules\Character\Domain\LocationId;
interface LocationRepositoryInterface
{
public function nextIdentity(): LocationId;
}
================================================
FILE: app/Modules/Character/Application/Contracts/RaceRepositoryInterface.php
================================================
<?php
namespace App\Modules\Character\Application\Contracts;
use App\Modules\Character\Domain\Race;
interface RaceRepositoryInterface
{
public function getOne(int $raceId): Race;
}
================================================
FILE: app/Modules/Character/Application/Factories/CharacterFactory.php
================================================
<?php
namespace App\Modules\Character\Application\Factories;
use App\Modules\Character\Application\Commands\CreateCharacterCommand;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Character\Domain\CharacterType;
use App\Modules\Character\Domain\Race;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Character\Domain\Statistics;
use App\Modules\Character\Domain\Attributes;
use App\Modules\Character\Domain\Character;
use App\Modules\Character\Domain\Gender;
use App\Modules\Character\Domain\HitPoints;
use App\Modules\Character\Domain\Reputation;
class CharacterFactory
{
public function create(CharacterId $characterId, CreateCharacterCommand $command, Race $race, Inventory $inventory): Character
{
return new Character(
$characterId,
$race->getId(),
1,
$race->getStartingLocationId(),
$command->getName(),
new Gender($command->getGender()),
new CharacterType($command->getCharacterType()),
0,
new Reputation(0),
new Attributes([
'strength' => $race->getStrength(),
'agility' => $race->getAgility(),
'constitution' => $race->getConstitution(),
'intelligence' => $race->getIntelligence(),
'charisma' => $race->getCharisma(),
'unassigned' => 0,
]),
HitPoints::byRace($race),
new Statistics([
'battlesLost' => 0,
'battlesWon' => 0,
]),
$inventory,
$command->getUserId()
);
}
}
================================================
FILE: app/Modules/Character/Application/Services/CharacterService.php
================================================
<?php
namespace App\Modules\Character\Application\Services;
use App\Modules\Battle\Application\Contracts\BattleRepositoryInterface;
use App\Modules\Battle\Domain\Battle;
use App\Modules\Battle\Domain\BattleId;
use App\Modules\Battle\Domain\BattleRounds;
use App\Modules\Character\Application\Contracts\RaceRepositoryInterface;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Character\Application\Contracts\CharacterRepositoryInterface;
use App\Modules\Character\Domain\Character;
use App\Modules\Character\Application\Commands\AttackCharacterCommand;
use App\Modules\Character\Application\Commands\CreateCharacterCommand;
use App\Modules\Character\Application\Commands\IncreaseAttributeCommand;
use App\Modules\Character\Application\Commands\MoveCharacterCommand;
use App\Modules\Character\Application\Factories\CharacterFactory;
use App\Modules\Equipment\Application\Commands\CreateInventoryCommand;
use App\Modules\Equipment\Application\Services\InventoryService;
use App\Modules\Image\Domain\Image;
use App\Modules\Level\Application\Services\LevelService;
use App\Modules\Trade\Application\Commands\CreateStoreCommand;
use App\Modules\Trade\Application\Services\CreateStoreService;
use Illuminate\Support\Facades\DB;
class CharacterService
{
/**
* @var CharacterFactory
*/
private $characterFactory;
/**
* @var CharacterRepositoryInterface
*/
private $characterRepository;
/**
* @var RaceRepositoryInterface
*/
private $raceRepository;
/**
* @var BattleRepositoryInterface
*/
private $battleRepository;
/**
* @var LevelService
*/
private $levelService;
/**
* @var InventoryService
*/
private $inventoryService;
/**
* @var CreateStoreService
*/
private $storeService;
public function __construct(
CharacterFactory $characterFactory,
CharacterRepositoryInterface $characterRepository,
RaceRepositoryInterface $raceRepository,
BattleRepositoryInterface $battleRepository,
LevelService $levelService,
InventoryService $inventoryService,
CreateStoreService $storeService
)
{
$this->characterFactory = $characterFactory;
$this->characterRepository = $characterRepository;
$this->raceRepository = $raceRepository;
$this->battleRepository = $battleRepository;
$this->levelService = $levelService;
$this->inventoryService = $inventoryService;
$this->storeService = $storeService;
}
public function create(CreateCharacterCommand $command): Character
{
$characterId = $this->characterRepository->nextIdentity();
$character = $this->characterFactory->create(
$characterId,
$command,
$this->raceRepository->getOne($command->getRaceId()),
$this->inventoryService->create(new CreateInventoryCommand($characterId))
);
$this->characterRepository->add($character);
$this->storeService->create(new CreateStoreCommand($characterId));
return $character;
}
public function increaseAttribute(IncreaseAttributeCommand $command): void
{
$character = $this->characterRepository->getOne($command->getCharacterId());
$character->applyAttributeIncrease($command->getAttribute());
$this->characterRepository->update($character);
}
public function move(MoveCharacterCommand $command): void
{
$character = $this->characterRepository->getOne($command->getCharacterId());
$character->setLocationId($command->getLocationId());
$this->characterRepository->update($character);
}
public function attack(AttackCharacterCommand $command): BattleId
{
return DB::transaction(function () use ($command) {
$attacker = $this->characterRepository->getOne($command->getAttackerId());
$defender = $this->characterRepository->getOne($command->getDefenderId());
$battleId = $this->battleRepository->nextIdentity();
$battle = new Battle(
$battleId,
$defender->getLocationId(),
$attacker,
$defender,
new BattleRounds(),
0
);
$battle->execute();
$victor = $battle->getVictor();
$loser = $battle->getLoser();
$victor->incrementWonBattles();
$loser->incrementLostBattles();
$victor->addXp($battle->getVictorXpGained());
$newLevel = $this->levelService->getLevelByXp($victor->getXp());
$victor->updateLevel($newLevel->getId());
$this->characterRepository->update($victor);
$this->characterRepository->update($loser);
$this->battleRepository->add($battle);
return $battleId;
});
}
public function updateProfilePicture(Image $picture): void
{
$character = $this->characterRepository->getOne($picture->getCharacterId());
$character->setProfilePictureId($picture->getId());
$this->characterRepository->update($character);
}
public function removeProfilePicture(CharacterId $characterId): void
{
$character = $this->characterRepository->getOne($characterId);
$character->removeProfilePicture();
$this->characterRepository->update($character);
}
}
================================================
FILE: app/Modules/Character/Domain/Attributes.php
================================================
<?php
namespace App\Modules\Character\Domain;
use Illuminate\Support\Collection;
class Attributes
{
/**
* @var Collection
*/
private $collection;
public function __construct($items = [])
{
$this->collection = new Collection($items);
}
public function addAvailablePoints(int $points): Attributes
{
$rawData = $this->collection->all();
$rawData['unassigned'] += $points;
return new static($rawData);
}
public function assignAvailablePoint(string $attribute): Attributes
{
$rawData = $this->collection->all();
$rawData['unassigned']--;
$rawData[$attribute]++;
return new static($rawData);
}
public function hasAvailablePoints(): bool
{
return (bool)$this->collection->get('unassigned');
}
public function getStrength(): int
{
return $this->collection->get('strength');
}
public function getAgility(): int
{
return $this->collection->get('agility');
}
public function getConstitution(): int
{
return $this->collection->get('constitution');
}
public function getIntelligence(): int
{
return $this->collection->get('intelligence');
}
public function getCharisma(): int
{
return $this->collection->get('charisma');
}
public function getUnassignedAttributePoints(): int
{
return $this->collection->get('unassigned');
}
}
================================================
FILE: app/Modules/Character/Domain/Character.php
================================================
<?php
namespace App\Modules\Character\Domain;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Equipment\Domain\Item;
use App\Modules\Equipment\Domain\ItemEffect;
use App\Modules\Equipment\Domain\Money;
use App\Modules\Image\Domain\ImageId;
use App\Traits\ThrowsDice;
class Character
{
use ThrowsDice;
/**
* @var string
*/
private $name;
/**
* @var Gender
*/
private $gender;
/**
* @var CharacterType
*/
private $type;
/**
* @var int
*/
private $levelId;
/**
* @var int
*/
private $raceId;
/**
* @var string
*/
private $locationId;
/**
* @var int
*/
private $xp;
/**
* @var Reputation
*/
private $reputation;
/**
* @var Attributes
*/
private $attributes;
/**
* @var HitPoints
*/
private $hitPoints;
/**
* @var CharacterId
*/
private $id;
/**
* @var Statistics
*/
private $statistics;
/**
* @var Inventory
*/
private $inventory;
/**
* @var int|null
*/
private $userId;
/**
* @var ImageId
*/
private $profilePictureId;
public function __construct(
CharacterId $id,
int $raceId,
int $levelId,
string $locationId,
string $name,
Gender $gender,
CharacterType $type,
int $xp,
Reputation $reputation,
Attributes $attributes,
HitPoints $hitPoints,
Statistics $statistics,
Inventory $inventory,
int $userId = null,
ImageId $profilePictureId = null
) {
$this->id = $id;
$this->name = $name;
$this->gender = $gender;
$this->type = $type;
$this->levelId = $levelId;
$this->raceId = $raceId;
$this->locationId = $locationId;
$this->xp = $xp;
$this->reputation = $reputation;
$this->attributes = $attributes;
$this->hitPoints = $hitPoints;
$this->statistics = $statistics;
$this->inventory = $inventory;
$this->userId = $userId;
$this->profilePictureId = $profilePictureId;
}
public function getLevelNumber(): int
{
return $this->levelId;
}
public function getId(): CharacterId
{
return $this->id;
}
public function generateDamage(): int
{
return self::throwOneDice() + $this->getBaseDamage();
}
public function getBaseDamage(): int
{
return $this->getStrength()
+ $this->inventory->getEquippedItemsEffect(ItemEffect::DAMAGE);
}
public function generatePrecision(): int
{
return self::throwTwoDices() + $this->getBasePrecision();
}
public function getBasePrecision(): int
{
return $this->getAgility()
+ $this->inventory->getEquippedItemsEffect(ItemEffect::PRECISION);
}
public function generateEvasionFactor(): int
{
return self::throwTwoDices() + $this->getBaseEvasion();
}
public function getBaseEvasion(): int
{
return $this->getAgility()
+ $this->inventory->getEquippedItemsEffect(ItemEffect::EVASION);
}
public function generateTrickery(): int
{
return self::throwOneDice() + $this->getBaseTrickery();
}
public function getBaseTrickery(): int
{
return $this->getIntelligence()
+ $this->inventory->getEquippedItemsEffect(ItemEffect::TRICKERY);
}
public function generateAwareness(): int
{
return self::throwTreeDices() + $this->getBaseAwareness();
}
public function getBaseAwareness(): int
{
return $this->getIntelligence() * 2
+ $this->inventory->getEquippedItemsEffect(ItemEffect::AWARENESS);
}
public function getArmorRating(): int
{
return $this->inventory->getEquippedItemsEffect(ItemEffect::ARMOR);
}
public function getStrength(): int
{
return $this->attributes->getStrength();
}
public function getAgility(): int
{
return $this->attributes->getAgility();
}
public function getConstitution(): int
{
return $this->attributes->getConstitution();
}
public function getIntelligence(): int
{
return $this->attributes->getIntelligence();
}
public function getCharisma(): int
{
return $this->attributes->getCharisma();
}
public function getUnassignedAttributePoints(): int
{
return $this->attributes->getUnassignedAttributePoints();
}
public function getLocationId(): string
{
return $this->locationId;
}
public function getHitPoints(): int
{
return $this->hitPoints->getCurrentHitPoints();
}
public function getTotalHitPoints(): int
{
return $this->hitPoints->getMaximumHitPoints();
}
public function equals(Character $other): bool
{
return $this->getId()->equals($other->getId());
}
public function getName(): string
{
return $this->name;
}
public function getUserId(): ?int
{
return $this->userId;
}
public function getGender(): Gender
{
return $this->gender;
}
public function getType(): CharacterType
{
return $this->type;
}
public function getXp(): int
{
return $this->xp;
}
public function getRaceId(): int
{
return $this->raceId;
}
public function getMoney(): Money
{
return $this->inventory->getMoney();
}
public function getReputation(): Reputation
{
return $this->reputation;
}
public function applyAttributeIncrease(string $attribute): void
{
if ($this->attributes->hasAvailablePoints()) {
$this->attributes = $this->attributes->assignAvailablePoint($attribute);
if ($attribute === 'constitution') {
$this->hitPoints = $this->hitPoints->withIncrementedConstitution();
}
}
}
public function addItemToInventory(Item $item): void
{
$this->inventory->add($item);
}
public function setLocationId(string $locationId): void
{
$this->locationId = $locationId;
}
public function isAlive(): bool
{
return $this->hitPoints->getCurrentHitPoints() > 0;
}
public function incrementWonBattles(): void
{
$this->statistics = $this->statistics->withIncreaseWonBattles();
}
public function incrementLostBattles(): void
{
$this->statistics = $this->statistics->withIncreaseLostBattles();
}
public function addXp(int $xp): void
{
$this->xp += $xp;
}
public function getBattlesWon(): int
{
return $this->statistics->getBattlesWon();
}
public function getBattlesLost(): int
{
return $this->statistics->getBattlesLost();
}
public function applyDamage($damageDone): void
{
$this->hitPoints = $this->hitPoints->withUpdatedCurrentValue(-$damageDone);
}
public function updateLevel(int $levelId): void
{
$points = $levelId - $this->levelId;
$this->levelId = $levelId;
$this->attributes = $this->attributes->addAvailablePoints($points);
}
public function setProfilePictureId(ImageId $profilePictureId): void
{
$this->profilePictureId = $profilePictureId;
}
/**
* @return ImageId|null
*/
public function getProfilePictureId(): ?ImageId
{
return $this->profilePictureId;
}
public function removeProfilePicture(): void
{
$this->profilePictureId = null;
}
public function getInventory(): Inventory
{
return $this->inventory;
}
public function isMerchant(): bool
{
return $this->type->isMerchant();
}
}
================================================
FILE: app/Modules/Character/Domain/CharacterId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Character\Domain;
use App\Modules\Generic\Domain\BaseId;
class CharacterId extends BaseId
{
}
================================================
FILE: app/Modules/Character/Domain/CharacterType.php
================================================
<?php
namespace App\Modules\Character\Domain;
use InvalidArgumentException;
class CharacterType
{
public const PLAYER = 'player';
public const MERCHANT = 'merchant';
public const CIVILIAN = 'civilian';
public const MONSTER = 'monster';
public const TYPES = [
self::PLAYER,
self::MERCHANT,
self::CIVILIAN,
self::MONSTER,
];
private $value;
public function __construct(string $value)
{
if (!in_array($value, self::TYPES, true)) {
throw new InvalidArgumentException("$value is not a valid Character Type");
}
$this->value = $value;
}
public function getValue(): string
{
return $this->value;
}
public function isMerchant(): bool
{
return $this->value === self::MERCHANT;
}
}
================================================
FILE: app/Modules/Character/Domain/Gender.php
================================================
<?php
namespace App\Modules\Character\Domain;
class Gender
{
/**
* @var string
*/
private $value;
public function __construct(string $value)
{
$this->value = $value;
}
public function getValue(): string
{
return $this->value;
}
}
================================================
FILE: app/Modules/Character/Domain/HitPoints.php
================================================
<?php
namespace App\Modules\Character\Domain;
use App\Traits\ThrowsDice;
class HitPoints
{
use ThrowsDice;
/**
* @var int
*/
private $currentHitPoints;
/**
* @var int
*/
private $maximumHitPoints;
public static function byRace(Race $race): HitPoints
{
$maximumHitPoints = self::constitutionToHitPoints($race->getConstitution());
return new HitPoints($maximumHitPoints, $maximumHitPoints);
}
public function withIncrementedConstitution(): HitPoints
{
return new HitPoints(
$this->currentHitPoints,
$this->maximumHitPoints + self::constitutionToHitPoints(1)
);
}
public function withUpdatedCurrentValue(int $points): HitPoints
{
return new HitPoints(
$this->currentHitPoints + $points,
$this->maximumHitPoints
);
}
protected static function constitutionToHitPoints(int $constitutionPoints): int
{
return $constitutionPoints * 10 + self::throwTwoDices();
}
public function __construct(int $currentHitPoints, int $maximumHitPoints)
{
$this->currentHitPoints = $currentHitPoints;
$this->maximumHitPoints = $maximumHitPoints;
}
public function getCurrentHitPoints(): int
{
return $this->currentHitPoints;
}
public function getMaximumHitPoints(): int
{
return $this->maximumHitPoints;
}
}
================================================
FILE: app/Modules/Character/Domain/LocationId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Character\Domain;
use App\Modules\Generic\Domain\BaseId;
class LocationId extends BaseId
{
}
================================================
FILE: app/Modules/Character/Domain/Name.php
================================================
<?php
namespace App\Modules\Character\Domain;
class Name
{
/**
* @var string
*/
private $value;
public function __construct(string $value)
{
$this->value = $value;
}
public function getValue(): string
{
return $this->value;
}
public function equals(Name $otherName): bool
{
return $this->value === $otherName->value;
}
}
================================================
FILE: app/Modules/Character/Domain/Race.php
================================================
<?php
namespace App\Modules\Character\Domain;
class Race
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $startingLocationId;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $description;
/**
* @var string
*/
private $maleImage;
/**
* @var string
*/
private $femaleImage;
/**
* @var Attributes
*/
private $attributes;
public function __construct(
int $id,
string $startingLocationId,
string $name,
string $description,
string $maleImage,
string $femaleImage,
Attributes $attributes
) {
$this->id = $id;
$this->startingLocationId = $startingLocationId;
$this->name = $name;
$this->description = $description;
$this->maleImage = $maleImage;
$this->femaleImage = $femaleImage;
$this->attributes = $attributes;
}
public function getId(): int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getImageByGender(string $gender):string
{
return $this->{"{$gender}_image"};
}
public function getStartingLocationId(): string
{
return $this->startingLocationId;
}
public function getStrength(): int
{
return $this->attributes->getStrength();
}
public function getAgility(): int
{
return $this->attributes->getAgility();
}
public function getConstitution(): int
{
return $this->attributes->getConstitution();
}
public function getIntelligence(): int
{
return $this->attributes->getIntelligence();
}
public function getCharisma(): int
{
return $this->attributes->getCharisma();
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @return string
*/
public function getMaleImage(): string
{
return $this->maleImage;
}
/**
* @return string
*/
public function getFemaleImage(): string
{
return $this->femaleImage;
}
}
================================================
FILE: app/Modules/Character/Domain/Reputation.php
================================================
<?php
namespace App\Modules\Character\Domain;
class Reputation
{
/**
* @var int
*/
private $value;
public function __construct(int $value)
{
$this->value = $value;
}
public function getValue(): int
{
return $this->value;
}
}
================================================
FILE: app/Modules/Character/Domain/Statistics.php
================================================
<?php
namespace App\Modules\Character\Domain;
use Illuminate\Support\Collection;
class Statistics
{
private $statistics;
public function __construct($statistics = [])
{
$this->statistics = new Collection($statistics);
}
public function withIncreaseWonBattles(): Statistics
{
$data = $this->statistics->all();
$data['battlesWon']++;
return new self($data);
}
public function withIncreaseLostBattles(): Statistics
{
$data = $this->statistics->all();
$data['battlesLost']++;
return new self($data);
}
public function getBattlesWon(): int
{
return (int)$this->statistics->get('battlesWon');
}
public function getBattlesLost(): int
{
return (int)$this->statistics->get('battlesLost');
}
}
================================================
FILE: app/Modules/Character/Infrastructure/ReconstitutionFactories/CharacterReconstitutionFactory.php
================================================
<?php
namespace App\Modules\Character\Infrastructure\ReconstitutionFactories;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Character\Domain\CharacterType;
use App\Modules\Equipment\Infrastructure\ReconstitutionFactories\InventoryReconstitutionFactory;
use App\Modules\Character\Domain\Attributes;
use App\Modules\Character\Domain\Character;
use App\Modules\Character\Domain\Gender;
use App\Modules\Character\Domain\Statistics;
use App\Modules\Character\Domain\HitPoints;
use App\Modules\Character\Domain\Reputation;
use App\Models\Character as CharacterModel;
use App\Modules\Image\Domain\ImageId;
class CharacterReconstitutionFactory
{
/**
* @var InventoryReconstitutionFactory
*/
private $inventoryReconstitutionFactory;
public function __construct(InventoryReconstitutionFactory $inventoryReconstitutionFactory)
{
$this->inventoryReconstitutionFactory = $inventoryReconstitutionFactory;
}
public function reconstitute(CharacterModel $characterModel): Character
{
$inventory = $this->inventoryReconstitutionFactory->reconstitute($characterModel->inventory);
$profilePictureId = $characterModel->getProfilePictureId();
$character = new Character(
CharacterId::fromString($characterModel->getId()),
$characterModel->getRaceId(),
$characterModel->getLevelNumber(),
$characterModel->getLocationId(),
$characterModel->getName(),
new Gender($characterModel->getGender()),
new CharacterType($characterModel->getType()),
$characterModel->getXp(),
new Reputation(0),
new Attributes([
'strength' => $characterModel->getStrength(),
'agility' => $characterModel->getAgility(),
'constitution' => $characterModel->getConstitution(),
'intelligence' => $characterModel->getIntelligence(),
'charisma' => $characterModel->getCharisma(),
'unassigned' => $characterModel->getAvailableAttributePoints(),
]),
new HitPoints(
$characterModel->getHitPoints(),
$characterModel->getTotalHitPoints()
),
new Statistics([
'battlesLost' => $characterModel->getBattlesLost(),
'battlesWon' => $characterModel->getBattlesWon(),
]),
$inventory,
$characterModel->getUserId(),
$profilePictureId ? ImageId::fromString($profilePictureId) : null
);
return $character;
}
}
================================================
FILE: app/Modules/Character/Infrastructure/Repositories/CharacterRepository.php
================================================
<?php
namespace App\Modules\Character\Infrastructure\Repositories;
use App\Modules\Character\Application\Contracts\CharacterRepositoryInterface;
use App\Modules\Character\Domain\Character;
use App\Models\Character as CharacterModel;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Character\Infrastructure\ReconstitutionFactories\CharacterReconstitutionFactory;
use App\Traits\GeneratesUuid;
use Exception;
class CharacterRepository implements CharacterRepositoryInterface
{
use GeneratesUuid;
/**
* @var CharacterReconstitutionFactory
*/
private $characterReconstitutionFactory;
public function __construct(CharacterReconstitutionFactory $characterReconstitutionFactory)
{
$this->characterReconstitutionFactory = $characterReconstitutionFactory;
}
/**
* @return CharacterId
*
* @throws Exception
*/
public function nextIdentity(): CharacterId
{
return CharacterId::fromString($this->generateUuid());
}
public function add(Character $character): void
{
$profilePictureId = $character->getProfilePictureId();
/** @var CharacterModel $characterModel */
CharacterModel::query()->create([
'id' => $character->getId()->toString(),
'user_id' => $character->getUserId(),
'name' => $character->getName(),
'gender' => $character->getGender()->getValue(),
'type' => $character->getType()->getValue(),
'xp' => $character->getXp(),
'level_id' => $character->getLevelNumber(),
'reputation' => $character->getReputation()->getValue(),
'strength' => $character->getStrength(),
'agility' => $character->getAgility(),
'constitution' => $character->getConstitution(),
'intelligence' => $character->getIntelligence(),
'charisma' => $character->getCharisma(),
'hit_points' => $character->getHitPoints(),
'total_hit_points' => $character->getTotalHitPoints(),
'race_id' => $character->getRaceId(),
'location_id' => $character->getLocationId(),
'battles_won' => $character->getBattlesWon(),
'battles_lost' => $character->getBattlesLost(),
'profile_picture_id' => $profilePictureId ? $profilePictureId->toString() : null,
]);
}
public function getOne(CharacterId $characterId): Character
{
/** @var CharacterModel $characterModel */
$characterModel = CharacterModel::query()->with('inventory')->findOrFail($characterId->toString());
return $this->characterReconstitutionFactory->reconstitute($characterModel);
}
public function update(Character $character): void
{
/** @var CharacterModel $characterModel */
$characterModel = CharacterModel::query()->findOrFail($character->getId()->toString());
$profilePictureId = $character->getProfilePictureId();
$characterModel->update([
'name' => $character->getName(),
'gender' => $character->getGender()->getValue(),
'xp' => $character->getXp(),
'level_id' => $character->getLevelNumber(),
'reputation' => $character->getReputation()->getValue(),
'strength' => $character->getStrength(),
'agility' => $character->getAgility(),
'constitution' => $character->getConstitution(),
'intelligence' => $character->getIntelligence(),
'charisma' => $character->getCharisma(),
'available_attribute_points' => $character->getUnassignedAttributePoints(),
'hit_points' => $character->getHitPoints(),
'total_hit_points' => $character->getTotalHitPoints(),
'battles_won' => $character->getBattlesWon(),
'battles_lost' => $character->getBattlesLost(),
'location_id' => $character->getLocationId(),
'profile_picture_id' => $profilePictureId ? $profilePictureId->toString() : null,
]);
}
}
================================================
FILE: app/Modules/Character/Infrastructure/Repositories/LocationRepository.php
================================================
<?php
namespace App\Modules\Character\Infrastructure\Repositories;
use App\Modules\Character\Application\Contracts\LocationRepositoryInterface;
use App\Modules\Character\Domain\LocationId;
use App\Traits\GeneratesUuid;
use Exception;
class LocationRepository implements LocationRepositoryInterface
{
use GeneratesUuid;
/**
* @return LocationId
*
* @throws Exception
*/
public function nextIdentity(): LocationId
{
return LocationId::fromString($this->generateUuid());
}
}
================================================
FILE: app/Modules/Character/Infrastructure/Repositories/RaceRepository.php
================================================
<?php
namespace App\Modules\Character\Infrastructure\Repositories;
use App\Modules\Character\Application\Contracts\RaceRepositoryInterface;
use App\Modules\Character\Domain\Attributes;
use App\Modules\Character\Domain\Race;
use App\Models\Race as RaceModel;
class RaceRepository implements RaceRepositoryInterface
{
public function getOne(int $raceId): Race
{
/** @var RaceModel $race */
$race = RaceModel::query()->findOrFail($raceId);
return new Race(
$race->getId(),
$race->getStartingLocationId(),
$race->getName(),
$race->getDescription(),
$race->getMaleImage(),
$race->getFemaleImage(),
new Attributes([
'strength' => $race->getStrength(),
'agility' => $race->getAgility(),
'constitution' => $race->getConstitution(),
'intelligence' => $race->getIntelligence(),
'charisma' => $race->getCharisma(),
])
);
}
}
================================================
FILE: app/Modules/Character/UI/Http/CommandMappers/AttackCharacterCommandMapper.php
================================================
<?php
namespace App\Modules\Character\UI\Http\CommandMappers;
use App\Modules\Character\Application\Commands\AttackCharacterCommand;
use App\Modules\Character\Domain\CharacterId;
use App\Models\User as UserModel;
use Illuminate\Http\Request;
class AttackCharacterCommandMapper
{
public function map(Request $request, string $defenderId): AttackCharacterCommand
{
/** @var UserModel $authenticatedUser */
$userModel = $request->user();
return new AttackCharacterCommand(
CharacterId::fromString($userModel->character->getId()),
CharacterId::fromString($defenderId)
);
}
}
================================================
FILE: app/Modules/Character/UI/Http/CommandMappers/CreateCharacterCommandMapper.php
================================================
<?php
namespace App\Modules\Character\UI\Http\CommandMappers;
use App\Modules\Character\Application\Commands\CreateCharacterCommand;
use App\Modules\Character\Domain\CharacterType;
use Illuminate\Http\Request;
use App\Models\User as UserModel;
class CreateCharacterCommandMapper
{
public function map(Request $request): CreateCharacterCommand
{
/** @var UserModel $userModel */
$userModel = $request->user();
return new CreateCharacterCommand(
$request->input('name'),
$request->input('gender'),
CharacterType::PLAYER,
$request->input('race_id'),
$userModel->getId()
);
}
}
================================================
FILE: app/Modules/Character/UI/Http/CommandMappers/IncreaseAttributeCommandMapper.php
================================================
<?php
namespace App\Modules\Character\UI\Http\CommandMappers;
use App\Modules\Character\Application\Commands\IncreaseAttributeCommand;
use App\Modules\Character\Domain\CharacterId;
use Illuminate\Http\Request;
class IncreaseAttributeCommandMapper
{
public function map(string $characterId, Request $request): IncreaseAttributeCommand
{
return new IncreaseAttributeCommand(
CharacterId::fromString($characterId),
$request->input('attribute')
);
}
}
================================================
FILE: app/Modules/Character/UI/Http/CommandMappers/MoveCharacterCommandMapper.php
================================================
<?php
namespace App\Modules\Character\UI\Http\CommandMappers;
use App\Modules\Character\Application\Commands\MoveCharacterCommand;
use App\Modules\Character\Domain\CharacterId;
class MoveCharacterCommandMapper
{
public function map(string $characterId, string $locationId): MoveCharacterCommand
{
return new MoveCharacterCommand(
CharacterId::fromString($characterId),
$locationId
);
}
}
================================================
FILE: app/Modules/Equipment/Application/Commands/AddItemToInventoryCommand.php
================================================
<?php
namespace App\Modules\Equipment\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemId;
class AddItemToInventoryCommand
{
/**
* @var CharacterId
*/
private $characterId;
/**
* @var int
*/
private $slot;
/**
* @var ItemId
*/
private $itemId;
public function __construct(CharacterId $characterId, int $slot, ItemId $itemId)
{
$this->characterId = $characterId;
$this->slot = $slot;
$this->itemId = $itemId;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getSlot(): int
{
return $this->slot;
}
public function getItemId(): ItemId
{
return $this->itemId;
}
}
================================================
FILE: app/Modules/Equipment/Application/Commands/CreateInventoryCommand.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
class CreateInventoryCommand
{
/**
* @var CharacterId
*/
private $characterId;
public function __construct(CharacterId $characterId)
{
$this->characterId = $characterId;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
}
================================================
FILE: app/Modules/Equipment/Application/Commands/CreateItemCommand.php
================================================
<?php
namespace App\Modules\Equipment\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemPrototypeId;
class CreateItemCommand
{
/**
* @var ItemPrototypeId
*/
private $prototypeId;
/**
* @var CharacterId
*/
private $creatorCharacterId;
public function __construct(ItemPrototypeId $prototypeId, CharacterId $creatorCharacterId)
{
$this->prototypeId = $prototypeId;
$this->creatorCharacterId = $creatorCharacterId;
}
public function getPrototypeId(): ItemPrototypeId
{
return $this->prototypeId;
}
public function getCreatorCharacterId(): CharacterId
{
return $this->creatorCharacterId;
}
}
================================================
FILE: app/Modules/Equipment/Application/Commands/EquipItemCommand.php
================================================
<?php
namespace App\Modules\Equipment\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemId;
class EquipItemCommand
{
/**
* @var ItemId
*/
private $itemId;
/**
* @var CharacterId
*/
private $ownerCharacterId;
public function __construct(ItemId $itemId, CharacterId $ownerCharacterId)
{
$this->itemId = $itemId;
$this->ownerCharacterId = $ownerCharacterId;
}
public function getItemId(): ItemId
{
return $this->itemId;
}
public function getOwnerCharacterId(): CharacterId
{
return $this->ownerCharacterId;
}
}
================================================
FILE: app/Modules/Equipment/Application/Contracts/InventoryRepositoryInterface.php
================================================
<?php
namespace App\Modules\Equipment\Application\Contracts;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Equipment\Domain\InventoryId;
interface InventoryRepositoryInterface
{
public function nextIdentity(): InventoryId;
public function add(Inventory $inventory): void;
public function forCharacter(CharacterId $characterId): Inventory;
public function update(Inventory $inventory): void;
}
================================================
FILE: app/Modules/Equipment/Application/Contracts/ItemPrototypeRepositoryInterface.php
================================================
<?php
namespace App\Modules\Equipment\Application\Contracts;
use App\Modules\Equipment\Domain\ItemPrototypeId;
use App\Modules\Equipment\Domain\ItemPrototype;
interface ItemPrototypeRepositoryInterface
{
public function nextIdentity(): ItemPrototypeId;
public function getOne(ItemPrototypeId $itemPrototypeId): ItemPrototype;
}
================================================
FILE: app/Modules/Equipment/Application/Contracts/ItemRepositoryInterface.php
================================================
<?php
namespace App\Modules\Equipment\Application\Contracts;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Domain\Item;
interface ItemRepositoryInterface
{
public function nextIdentity(): ItemId;
public function add(Item $item): void;
public function getOne(ItemId $itemId): Item;
public function update(Item $item): void;
}
================================================
FILE: app/Modules/Equipment/Application/Factories/ItemFactory.php
================================================
<?php
namespace App\Modules\Equipment\Application\Factories;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\Item;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Domain\ItemPrototype;
class ItemFactory
{
public function create(ItemId $itemId, ItemPrototype $itemPrototype, CharacterId $creatorCharacterId): Item
{
return new Item(
$itemId,
$itemPrototype->getName(),
$itemPrototype->getDescription(),
$itemPrototype->getImageFilePath(),
$itemPrototype->getType(),
$itemPrototype->getEffects(),
$itemPrototype->getPrice(),
$itemPrototype->getId(),
$creatorCharacterId
);
}
}
================================================
FILE: app/Modules/Equipment/Application/Services/InventoryService.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Application\Services;
use App\Modules\Equipment\Application\Commands\CreateInventoryCommand;
use App\Modules\Equipment\Application\Commands\EquipItemCommand;
use App\Modules\Equipment\Application\Contracts\InventoryRepositoryInterface;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Equipment\Domain\Money;
use Illuminate\Support\Collection;
class InventoryService
{
/**
* @var InventoryRepositoryInterface
*/
private $inventoryRepository;
public function __construct(InventoryRepositoryInterface $inventoryRepository)
{
$this->inventoryRepository = $inventoryRepository;
}
public function create(CreateInventoryCommand $command):Inventory
{
$id = $this->inventoryRepository->nextIdentity();
$inventory = new Inventory($id, $command->getCharacterId(), Collection::make(), new Money(0));
$this->inventoryRepository->add($inventory);
return $inventory;
}
public function equipItem(EquipItemCommand $command): void
{
$inventory = $this->inventoryRepository->forCharacter($command->getOwnerCharacterId());
$inventory->equip($command->getItemId());
$this->inventoryRepository->update($inventory);
}
public function unEquipItem(EquipItemCommand $command): void
{
$inventory = $this->inventoryRepository->forCharacter($command->getOwnerCharacterId());
$inventory->unEquipItem($command->getItemId());
$this->inventoryRepository->update($inventory);
}
}
================================================
FILE: app/Modules/Equipment/Application/Services/ItemService.php
================================================
<?php
namespace App\Modules\Equipment\Application\Services;
use App\Modules\Character\Application\Contracts\CharacterRepositoryInterface;
use App\Modules\Equipment\Application\Commands\CreateItemCommand;
use App\Modules\Equipment\Application\Contracts\ItemPrototypeRepositoryInterface;
use App\Modules\Equipment\Application\Contracts\ItemRepositoryInterface;
use App\Modules\Equipment\Domain\Item;
use App\Modules\Equipment\Application\Factories\ItemFactory;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Concerns\ValidatesAttributes;
class ItemService
{
/**
* @var ItemRepositoryInterface
*/
private $itemRepository;
/**
* @var ItemFactory
*/
private $itemFactory;
/**
* @var ItemPrototypeRepositoryInterface
*/
private $itemPrototypeRepository;
/**
* @var \App\Modules\Character\Application\Contracts\CharacterRepositoryInterface
*/
private $characterRepository;
public function __construct(
CharacterRepositoryInterface $characterRepository,
ItemRepositoryInterface $itemRepository,
ItemPrototypeRepositoryInterface $itemPrototypeRepository,
ItemFactory $itemFactory
)
{
$this->characterRepository = $characterRepository;
$this->itemRepository = $itemRepository;
$this->itemPrototypeRepository = $itemPrototypeRepository;
$this->itemFactory = $itemFactory;
}
public function create(CreateItemCommand $command): void
{
DB::transaction(function () use ($command) {
$itemPrototype = $this->itemPrototypeRepository->getOne($command->getPrototypeId());
$character = $this->characterRepository->getOne($command->getCreatorCharacterId());
$itemId = $this->itemRepository->nextIdentity();
$item = $this->itemFactory->create($itemId, $itemPrototype, $character->getId());
$character->addItemToInventory($item);
$this->itemRepository->add($item);
$this->characterRepository->update($character);
});
}
}
================================================
FILE: app/Modules/Equipment/Domain/Inventory.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Generic\Domain\Container\ContainerIsFullException;
use App\Modules\Generic\Domain\Container\ItemNotInContainer;
use App\Modules\Generic\Domain\Container\NotEnoughSpaceInContainerException;
use Illuminate\Support\Collection;
use InvalidArgumentException;
class Inventory
{
public const NUMBER_OF_SLOTS = 24;
/**
* @var InventoryId
*/
private $id;
/**
* @var CharacterId
*/
private $characterId;
/**
* @var Collection
*/
private $items;
/**
* @var Money
*/
private $money;
public function __construct(InventoryId $id, CharacterId $characterId, Collection $items, Money $money)
{
if ($items->count() > self::NUMBER_OF_SLOTS) {
throw new NotEnoughSpaceInContainerException(
"Not enough space in the Inventory for {$items->count()} new items"
);
}
$items->each(static function ($item) {
if (!($item instanceof InventoryItem)) {
throw new InvalidArgumentException('Trying to populate inventory with non inventory item');
}
});
$this->id = $id;
$this->characterId = $characterId;
$this->items = $items;
$this->money = $money;
}
public function getId(): InventoryId
{
return $this->id;
}
public function add(Item $item): void
{
$item = new InventoryItem($item, ItemStatus::inBackpack());
$slot = $this->findFreeSlot();
$this->items->put($slot, $item);
}
public function getEquippedItemsEffect(string $itemEffectType): int
{
return (int)$this->getEquippedItems()->reduce(static function ($carry, InventoryItem $item) use ($itemEffectType) {
$itemEffect = $item->getItemEffect($itemEffectType);
return $carry + $itemEffect;
});
}
public function unEquipItem(ItemId $itemId): void
{
$equippedItem = $this->findEquippedItem($itemId);
if ($equippedItem)
{
$equippedItem->unEquip();
}
}
public function equip(ItemId $itemId): void
{
$item = $this->findItem($itemId);
if (!$item) {
throw new ItemNotInContainer('Cannot equip item that is not in the inventory');
}
if ($equippedItem = $this->findEquippedItemOfType($item->getType())) {
$equippedItem->unEquip();
}
$item->equip();
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getItems(): Collection
{
return $this->items;
}
public function takeOut(ItemId $itemId): Item
{
$slot = $this->items->search(static function (InventoryItem $item) use ($itemId) {
return $item->getId()->equals($itemId);
});
if ($slot === false) {
throw new ItemNotInContainer('Cannot take out item from empty slot');
}
/** @var InventoryItem $item */
$item = $this->items->get($slot);
$this->items->forget($slot);
return $item->toBaseItem();
}
public function putMoneyIn(Money $money): void
{
$this->money = $this->money->combine($money);
}
public function takeMoneyOut(Money $money): Money
{
$this->money = $this->money->remove($money);
return $money;
}
public function getMoney(): Money
{
return $this->money;
}
public function findItem(ItemId $itemId):? InventoryItem
{
return $this->items->first(static function (InventoryItem $item) use ($itemId) {
return $item->getId()->equals($itemId);
});
}
private function findFreeSlot(): int
{
for ($slot = 0; $slot < self::NUMBER_OF_SLOTS; $slot++) {
if (!$this->items->has($slot)) {
return $slot;
}
}
throw new ContainerIsFullException('Cannot add to full inventory');
}
private function findEquippedItem(ItemId $itemId):? InventoryItem
{
return $this->items->first(static function (InventoryItem $item) use ($itemId) {
return $item->getId()->equals($itemId) && $item->isEquipped();
});
}
private function findEquippedItemOfType(ItemType $type):? InventoryItem
{
return $this->items->first(static function (InventoryItem $item) use ($type) {
return $item->isOfType($type) && $item->isEquipped();
});
}
private function getEquippedItems(): Collection
{
return $this->items->filter(static function (InventoryItem $item) {
return $item->isEquipped();
});
}
}
================================================
FILE: app/Modules/Equipment/Domain/InventoryId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
use App\Modules\Generic\Domain\BaseId;
class InventoryId extends BaseId
{
}
================================================
FILE: app/Modules/Equipment/Domain/InventoryItem.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
class InventoryItem extends Item
{
/**
* @var ItemStatus
*/
private $status;
public function __construct(Item $item, ItemStatus $status)
{
parent::__construct(
$item->getId(),
$item->getName(),
$item->getDescription(),
$item->getImageFilePath(),
$item->getType(),
$item->getEffects(),
$item->getPrice(),
$item->getPrototypeId(),
$item->getCreatorCharacterId()
);
$this->status = $status;
}
public function getStatus(): ItemStatus
{
return $this->status;
}
public function isEquipped(): bool
{
return $this->status->equals(ItemStatus::equipped());
}
public function equip(): void
{
$this->status = ItemStatus::equipped();
}
public function unEquip(): void
{
$this->status = ItemStatus::inBackpack();
}
}
================================================
FILE: app/Modules/Equipment/Domain/InventorySlot.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
class InventorySlot
{
private $slot;
public static function undefined(): self
{
return new self(-1);
}
public static function defined(int $slot): self
{
return new self($slot);
}
public function __construct(int $slot)
{
$this->slot = $slot;
}
public function getSlot(): int
{
return $this->slot;
}
}
================================================
FILE: app/Modules/Equipment/Domain/Item.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use App\Modules\Character\Domain\CharacterId;
use Illuminate\Support\Collection;
class Item
{
/**
* @var ItemId
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $description;
/**
* @var ItemType
*/
private $type;
/**
* @var Collection
*/
private $effects;
/**
* @var ItemPrototypeId
*/
private $prototypeId;
/**
* @var CharacterId
*/
private $creatorCharacterId;
/**
* @var string
*/
private $imageFilePath;
/**
* @var ItemPrice
*/
private $price;
public function __construct(
ItemId $id,
string $name,
string $description,
string $imageFilePath,
ItemType $type,
Collection $effects,
ItemPrice $price,
ItemPrototypeId $prototypeId,
CharacterId $creatorCharacterId
)
{
$this->id = $id;
$this->name = $name;
$this->description = $description;
$this->imageFilePath = $imageFilePath;
$this->type = $type;
$this->effects = $effects;
$this->price = $price;
$this->prototypeId = $prototypeId;
$this->creatorCharacterId = $creatorCharacterId;
}
public function getId(): ItemId
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function getImageFilePath(): string
{
return $this->imageFilePath;
}
public function getType(): ItemType
{
return $this->type;
}
public function getEffects(): Collection
{
return $this->effects;
}
public function getPrototypeId(): ItemPrototypeId
{
return $this->prototypeId;
}
public function getCreatorCharacterId(): CharacterId
{
return $this->creatorCharacterId;
}
public function getItemEffect(string $itemEffectType): int
{
return (int)$this->getEffectsOfType($itemEffectType)
->reduce(static function ($carry, ItemEffect $itemEffect) {
return $carry + $itemEffect->getQuantity();
});
}
private function getEffectsOfType(string $itemEffectType): Collection
{
return $this->effects->filter(static function (ItemEffect $effect) use ($itemEffectType) {
return $effect->getType() === $itemEffectType;
});
}
public function equals(Item $otherItem): bool
{
return $this->getId()->equals($otherItem->getId());
}
public function isOfType(ItemType $type): bool
{
return $this->getType()->equals($type);
}
public function getPrice(): ItemPrice
{
return $this->price;
}
public function changePrice(ItemPrice $price): self
{
$this->price = $price;
return $this;
}
public function toBaseItem(): Item
{
return new Item(
$this->getId(),
$this->getName(),
$this->getDescription(),
$this->getImageFilePath(),
$this->getType(),
$this->getEffects(),
$this->getPrice(),
$this->getPrototypeId(),
$this->getCreatorCharacterId()
);
}
}
================================================
FILE: app/Modules/Equipment/Domain/ItemEffect.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use InvalidArgumentException;
class ItemEffect
{
public const NONE = 'none';
public const DAMAGE = 'damage';
public const ARMOR = 'armor';
public const PRECISION = 'precision';
public const EVASION = 'evasion';
public const TRICKERY = 'evasion';
public const AWARENESS = 'awareness';
public const TYPES = [
self::NONE,
self::DAMAGE,
self::ARMOR,
self::PRECISION,
self::EVASION,
self::TRICKERY,
self::AWARENESS,
];
/**
* @var int
*/
private $quantity;
/**
* @var string
*/
private $type;
private function __construct(int $quantity, string $type)
{
$this->quantity = $quantity;
$this->type = $type;
}
public static function ofType(int $quantity, string $type): ItemEffect
{
if (!in_array($type, self::TYPES, true)) {
throw new InvalidArgumentException("$type is not a valid Item Effect type");
}
return new self($quantity, $type);
}
public static function damage(int $quantity): ItemEffect
{
return new self($quantity, self::DAMAGE);
}
public static function armor(int $quantity): ItemEffect
{
return new self($quantity, self::ARMOR);
}
public function getQuantity(): int
{
return $this->quantity;
}
public function getType(): string
{
return $this->type;
}
}
================================================
FILE: app/Modules/Equipment/Domain/ItemId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
use App\Modules\Generic\Domain\BaseId;
class ItemId extends BaseId
{
}
================================================
FILE: app/Modules/Equipment/Domain/ItemPrice.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
use Webmozart\Assert\Assert;
class ItemPrice
{
/**
* @var int
*/
private $amount;
private function __construct(int $amount)
{
Assert::greaterThanEq($amount, 0, 'Item price must be greater or equal to 0');
$this->amount = $amount;
}
public static function ofAmount(int $amount): self
{
return new self($amount);
}
public function getAmount(): int
{
return $this->amount;
}
}
================================================
FILE: app/Modules/Equipment/Domain/ItemPrototype.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use Illuminate\Support\Collection;
class ItemPrototype
{
/**
* @var ItemPrototypeId
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $description;
/**
* @var string
*/
private $imageFilePath;
/**
* @var ItemType
*/
private $type;
/**
* @var Collection
*/
private $effects;
/**
* @var ItemPrice
*/
private $price;
public function __construct(
ItemPrototypeId $id,
string $name,
string $description,
string $imageFilePath,
ItemType $type,
Collection $effects,
ItemPrice $price
) {
$this->id = $id;
$this->name = $name;
$this->description = $description;
$this->imageFilePath = $imageFilePath;
$this->type = $type;
$this->effects = $effects;
$this->price = $price;
}
public function getId(): ItemPrototypeId
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function getImageFilePath(): string
{
return $this->imageFilePath;
}
public function getType(): ItemType
{
return $this->type;
}
public function getEffects(): Collection
{
return $this->effects;
}
public function getPrice(): ItemPrice
{
return $this->price;
}
}
================================================
FILE: app/Modules/Equipment/Domain/ItemPrototypeId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
use App\Modules\Generic\Domain\BaseId;
class ItemPrototypeId extends BaseId
{
}
================================================
FILE: app/Modules/Equipment/Domain/ItemStatus.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use InvalidArgumentException;
class ItemStatus
{
public const EQUIPPED = 'equipped';
public const IN_BACKPACK = 'in_backpack';
public const STATUSES = [
self::EQUIPPED,
self::IN_BACKPACK,
];
/**
* @var string
*/
private $type;
private function __construct(string $type)
{
$this->type = $type;
}
public static function ofStatus(string $status): self
{
if (!in_array($status, self::STATUSES, true)) {
throw new InvalidArgumentException("$status is not a valid Item Status");
}
return new self($status);
}
public static function inBackpack(): self
{
return new self(self::IN_BACKPACK);
}
public static function equipped(): self
{
return new self(self::EQUIPPED);
}
public function toString(): string
{
return $this->type;
}
public function equals(self $type): bool
{
return $this->type === $type->toString();
}
}
================================================
FILE: app/Modules/Equipment/Domain/ItemType.php
================================================
<?php
namespace App\Modules\Equipment\Domain;
use InvalidArgumentException;
class ItemType
{
public const MISCELLANEOUS = 'miscellaneous';
public const HEAD_GEAR = 'head_gear';
public const BODY_ARMOR = 'body_armor';
public const MAIN_HAND = 'main_hand';
public const OFF_HAND = 'off_hand';
public const TYPES = [
self::MISCELLANEOUS,
self::HEAD_GEAR,
self::BODY_ARMOR,
self::MAIN_HAND,
self::OFF_HAND,
];
/**
* @var string
*/
private $type;
private function __construct(string $type)
{
$this->type = $type;
}
public static function ofType(string $type): ItemType
{
if (!in_array($type, self::TYPES, true)) {
throw new InvalidArgumentException("$type is not a valid Item Type");
}
return new self($type);
}
public static function headGear(): ItemType
{
return new self(self::HEAD_GEAR);
}
public static function bodyArmor(): ItemType
{
return new self(self::BODY_ARMOR);
}
public static function mainHand(): ItemType
{
return new self(self::MAIN_HAND);
}
public static function offHand(): ItemType
{
return new self(self::OFF_HAND);
}
public function toString(): string
{
return $this->type;
}
public function equals(ItemType $type): bool
{
return $this->type === $type->toString();
}
}
================================================
FILE: app/Modules/Equipment/Domain/Money.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Equipment\Domain;
use App\Modules\Generic\Domain\Container\InvalidMoneyValue;
use App\Modules\Generic\Domain\Container\NotEnoughMoneyToRemove;
class Money
{
/**
* @var int
*/
private $value;
public function __construct(int $value)
{
if ($value < 0)
{
throw new InvalidMoneyValue('Negative money amount not allowed');
}
$this->value = $value;
}
public function getValue(): int
{
return $this->value;
}
public function remove(Money $money): self
{
if ($this->value < $money->getValue()) {
throw new NotEnoughMoneyToRemove('Cannot remove more money than there is');
}
return new self($this->value - $money->getValue());
}
public function combine(Money $money): self
{
return new self($this->value + $money->getValue());
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryItemReconstitutionFactory.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\ReconstitutionFactories;
use App\Models\Item as ItemModel;
use App\Modules\Equipment\Domain\InventoryItem;
use App\Modules\Equipment\Domain\ItemStatus;
class InventoryItemReconstitutionFactory
{
/**
* @var ItemReconstitutionFactory
*/
private $itemReconstitutionFactory;
public function __construct(ItemReconstitutionFactory $itemReconstitutionFactory)
{
$this->itemReconstitutionFactory = $itemReconstitutionFactory;
}
public function reconstitute(ItemModel $model): InventoryItem
{
return new InventoryItem(
$this->itemReconstitutionFactory->reconstitute($model),
ItemStatus::ofStatus($model->pivot->status)
);
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryReconstitutionFactory.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\ReconstitutionFactories;
use App\Models\Item as ItemModel;
use App\Models\Inventory as InventoryModel;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Equipment\Domain\InventoryId;
use App\Modules\Equipment\Domain\Money;
class InventoryReconstitutionFactory
{
/**
* @var InventoryItemReconstitutionFactory
*/
private $inventoryItemReconstitutionFactory;
public function __construct(InventoryItemReconstitutionFactory $inventoryItemReconstitutionFactory)
{
$this->inventoryItemReconstitutionFactory = $inventoryItemReconstitutionFactory;
}
public function reconstitute(InventoryModel $inventoryModel): Inventory
{
$items = $inventoryModel->items->mapWithKeys(function (ItemModel $itemModel) {
$key = $itemModel->getInventorySlotNumber();
$inventoryItem = $this->inventoryItemReconstitutionFactory->reconstitute($itemModel);
return [$key => $inventoryItem];
});
return new Inventory(
InventoryId::fromString($inventoryModel->getId()),
CharacterId::fromString($inventoryModel->getCharacterId()),
$items,
new Money($inventoryModel->getMoney())
);
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemPrototypeReconstitutionFactory.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\ReconstitutionFactories;
use App\Models\ItemPrototype as ItemPrototypeModel;
use App\Modules\Equipment\Domain\ItemPrice;
use App\Modules\Equipment\Domain\ItemPrototype;
use App\Modules\Equipment\Domain\ItemEffect;
use App\Modules\Equipment\Domain\ItemPrototypeId;
use App\Modules\Equipment\Domain\ItemType;
use Illuminate\Support\Collection;
class ItemPrototypeReconstitutionFactory
{
public function reconstitute(ItemPrototypeModel $model): ItemPrototype
{
$effects = Collection::make($model->getEffects())->map(static function (array $effect) {
return ItemEffect::ofType(
$effect['quantity'],
$effect['type']);
});
$itemPrototype = new ItemPrototype(
ItemPrototypeId::fromString($model->getId()),
$model->getName(),
$model->getDescription(),
$model->getImageFilePath(),
ItemType::ofType($model->getType()),
$effects,
ItemPrice::ofAmount($model->getPrice())
);
return $itemPrototype;
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemReconstitutionFactory.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\ReconstitutionFactories;
use App\Models\Item as ItemModel;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\Item;
use App\Modules\Equipment\Domain\ItemEffect;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Domain\ItemPrice;
use App\Modules\Equipment\Domain\ItemPrototypeId;
use App\Modules\Equipment\Domain\ItemType;
use Illuminate\Support\Collection;
class ItemReconstitutionFactory
{
public function reconstitute(ItemModel $model): Item
{
$effects = Collection::make($model->getEffects())->map(static function (array $effect) {
return ItemEffect::ofType(
$effect['quantity'],
$effect['type']
);
});
$item = new Item(
ItemId::fromString($model->getId()),
$model->getName(),
$model->getDescription(),
$model->getImageFilePath(),
ItemType::ofType($model->getType()),
$effects,
ItemPrice::ofAmount($model->getPrice()),
ItemPrototypeId::fromString($model->getPrototypeId()),
CharacterId::fromString($model->getCreatorCharacterId())
);
return $item;
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/Repositories/InventoryRepository.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\Repositories;
use App\Models\Inventory as InventoryModel;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Application\Contracts\InventoryRepositoryInterface;
use App\Modules\Equipment\Domain\Inventory;
use App\Modules\Equipment\Domain\InventoryId;
use App\Modules\Equipment\Domain\InventoryItem;
use App\Modules\Equipment\Infrastructure\ReconstitutionFactories\InventoryReconstitutionFactory;
use App\Traits\GeneratesUuid;
use Exception;
class InventoryRepository implements InventoryRepositoryInterface
{
use GeneratesUuid;
/**
* @var InventoryReconstitutionFactory
*/
private $reconstitutionFactory;
public function __construct(InventoryReconstitutionFactory $reconstitutionFactory)
{
$this->reconstitutionFactory = $reconstitutionFactory;
}
/**
* @return InventoryId
*
* @throws Exception
*/
public function nextIdentity(): InventoryId
{
return InventoryId::fromString($this->generateUuid());
}
public function add(Inventory $inventory): void
{
InventoryModel::query()->create([
'id' => $inventory->getId()->toString(),
'character_id' => $inventory->getCharacterId()->toString(),
'money' => $inventory->getMoney()->getValue(),
]);
}
public function forCharacter(CharacterId $characterId): Inventory
{
/** @var InventoryModel $model */
$model = InventoryModel::query()->where('character_id', $characterId->toString())->firstOrFail();
return $this->reconstitutionFactory->reconstitute($model);
}
public function update(Inventory $inventory): void
{
/** @var InventoryModel $inventoryModel */
$inventoryModel = InventoryModel::query()->findOrFail($inventory->getId()->toString());
$inventoryItems = $inventory->getItems()->mapWithKeys(static function (InventoryItem $item, int $slot) {
$itemId = $item->getId()->toString();
return [
$itemId => [
'item_id' => $itemId,
'status' => $item->getStatus()->toString(),
'inventory_slot_number' => $slot,
],
];
});
$inventoryModel->items()->sync($inventoryItems->all());
$inventoryModel->update([
'money' => $inventory->getMoney()->getValue(),
]);
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/Repositories/ItemPrototypeRepository.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\Repositories;
use App\Models\ItemPrototype as ItemPrototypeModel;
use App\Modules\Equipment\Domain\ItemPrototypeId;
use App\Modules\Equipment\Application\Contracts\ItemPrototypeRepositoryInterface;
use App\Modules\Equipment\Domain\ItemPrototype;
use App\Modules\Equipment\Infrastructure\ReconstitutionFactories\ItemPrototypeReconstitutionFactory;
use App\Traits\GeneratesUuid;
use Exception;
class ItemPrototypeRepository implements ItemPrototypeRepositoryInterface
{
use GeneratesUuid;
/**
* @var ItemPrototypeReconstitutionFactory
*/
private $reconstitutionFactory;
public function __construct(ItemPrototypeReconstitutionFactory $reconstitutionFactory)
{
$this->reconstitutionFactory = $reconstitutionFactory;
}
/**
* @return ItemPrototypeId
*
* @throws Exception
*/
public function nextIdentity(): ItemPrototypeId
{
return ItemPrototypeId::fromString($this->generateUuid());
}
public function getOne(ItemPrototypeId $itemPrototypeId): ItemPrototype
{
/** @var \App\Models\ItemPrototypeModel $model */
$model = ItemPrototypeModel::query()->findOrFail($itemPrototypeId->toString());
return $this->reconstitutionFactory->reconstitute($model);
}
}
================================================
FILE: app/Modules/Equipment/Infrastructure/Repositories/ItemRepository.php
================================================
<?php
namespace App\Modules\Equipment\Infrastructure\Repositories;
use App\Models\Item as ItemModel;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Application\Contracts\ItemRepositoryInterface;
use App\Modules\Equipment\Domain\Item;
use App\Modules\Equipment\Domain\ItemEffect;
use App\Modules\Equipment\Infrastructure\ReconstitutionFactories\ItemReconstitutionFactory;
use App\Traits\GeneratesUuid;
use Exception;
class ItemRepository implements ItemRepositoryInterface
{
use GeneratesUuid;
/**
* @var ItemReconstitutionFactory
*/
private $reconstitutionFactory;
public function __construct(ItemReconstitutionFactory $reconstitutionFactory)
{
$this->reconstitutionFactory = $reconstitutionFactory;
}
/**
* @return ItemId
*
* @throws Exception
*/
public function nextIdentity(): ItemId
{
return ItemId::fromString($this->generateUuid());
}
public function add(Item $item): void
{
$effects = $item->getEffects()->map(static function (ItemEffect $effect) {
return [
'quantity' => $effect->getQuantity(),
'type' => $effect->getType(),
];
})->toJson();
ItemModel::query()->create([
'id' => $item->getId()->toString(),
'prototype_id' => $item->getPrototypeId()->toString(),
'creator_character_id' => $item->getCreatorCharacterId()->toString(),
'name' => $item->getName(),
'description' => $item->getDescription(),
'effects' => $effects,
'price' => $item->getPrice()->getAmount(),
'image_file_path' => $item->getImageFilePath(),
'type' => $item->getType()->toString(),
]);
}
public function getOne(ItemId $itemId): Item
{
/** @var ItemModel $model */
$model = ItemModel::query()->findOrFail($itemId->toString());
return $this->reconstitutionFactory->reconstitute($model);
}
public function update(Item $item): void
{
$effects = $item->getEffects()->map(static function (ItemEffect $effect) {
return [
'quantity' => $effect->getQuantity(),
'type' => $effect->getType(),
];
})->toJson();
ItemModel::query()->where('id', $item->getId()->toString())->update([
'prototype_id' => $item->getPrototypeId()->toString(),
'creator_character_id' => $item->getCreatorCharacterId()->toString(),
'name' => $item->getName(),
'description' => $item->getDescription(),
'effects' => $effects,
'price' => $item->getPrice()->getAmount(),
'image_file_path' => $item->getImageFilePath(),
'type' => $item->getType()->toString(),
]);
}
}
================================================
FILE: app/Modules/Equipment/UI/Http/CommandMappers/AddItemToInventoryCommandMapper.php
================================================
<?php
namespace App\Modules\Equipment\UI\Http\CommandMappers;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Application\Commands\AddItemToInventoryCommand;
use Illuminate\Http\Request;
use App\Models\User as UserModel;
class AddItemToInventoryCommandMapper
{
public function map(Request $request): AddItemToInventoryCommand
{
/** @var UserModel $userModel */
$userModel = $request->user();
return new AddItemToInventoryCommand(
CharacterId::fromString($userModel->character->getId()),
(int)$request->input('inventory_slot'),
ItemId::fromString((string)$request->input('item_id'))
);
}
}
================================================
FILE: app/Modules/Equipment/UI/Http/CommandMappers/CreateItemCommandMapper.php
================================================
<?php
namespace App\Modules\Equipment\UI\Http\CommandMappers;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemPrototypeId;
use App\Modules\Equipment\Application\Commands\CreateItemCommand;
use Illuminate\Http\Request;
use App\Models\User as UserModel;
class CreateItemCommandMapper
{
public function map(Request $request): CreateItemCommand
{
/** @var UserModel $userModel */
$userModel = $request->user();
return new CreateItemCommand(
ItemPrototypeId::fromString($request->input('prototype_item_id')),
CharacterId::fromString($userModel->character->getId())
);
}
}
================================================
FILE: app/Modules/Equipment/UI/Http/CommandMappers/EquipItemCommandMapper.php
================================================
<?php
namespace App\Modules\Equipment\UI\Http\CommandMappers;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemId;
use App\Modules\Equipment\Application\Commands\EquipItemCommand;
use Illuminate\Http\Request;
use App\Models\User as UserModel;
class EquipItemCommandMapper
{
public function map(Request $request): EquipItemCommand
{
/** @var UserModel $userModel */
$userModel = $request->user();
return new EquipItemCommand(
ItemId::fromString((string)$request->route('item')),
CharacterId::fromString($userModel->character->getId())
);
}
}
================================================
FILE: app/Modules/Generic/Domain/BaseId.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain;
abstract class BaseId
{
/**
* @var string
*/
private $id;
private function __construct(string $id)
{
$this->id = $id;
}
/**
* @param string $id
*
* @return static
*/
public static function fromString(string $id)
{
return new static($id);
}
public function toString(): string
{
return $this->id;
}
public function equals(BaseId $otherId): bool
{
return $this->toString() === $otherId->toString();
}
}
================================================
FILE: app/Modules/Generic/Domain/Container/ContainerIsFullException.php
================================================
<?php
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class ContainerIsFullException extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/ContainerSlotIsTakenException.php
================================================
<?php
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class ContainerSlotIsTakenException extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/ContainerSlotOutOfRangeException.php
================================================
<?php
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class ContainerSlotOutOfRangeException extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/InvalidMoneyValue.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class InvalidMoneyValue extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/ItemNotInContainer.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class ItemNotInContainer extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/NotEnoughMoneyToRemove.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class NotEnoughMoneyToRemove extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container/NotEnoughSpaceInContainerException.php
================================================
<?php
namespace App\Modules\Generic\Domain\Container;
use RuntimeException;
class NotEnoughSpaceInContainerException extends RuntimeException
{
}
================================================
FILE: app/Modules/Generic/Domain/Container.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain;
use Illuminate\Support\Collection;
abstract class Container
{
/**
* @var Collection
*/
protected $items;
}
================================================
FILE: app/Modules/Generic/Domain/ContainerType.php
================================================
<?php declare(strict_types=1);
namespace App\Modules\Generic\Domain;
use InvalidArgumentException;
class ContainerType
{
private const VALID_TYPES = [
self::INVENTORY,
self::STORE
];
private const INVENTORY = 'inventory';
private const STORE = 'store';
/**
* @var string
*/
private $type;
public static function fromString(string $type)
{
return new static($type);
}
private function __construct(string $type)
{
if (!in_array($type, self::VALID_TYPES, true)) {
throw new InvalidArgumentException('Invalid showContainer type: ' . $type);
}
$this->type = $type;
}
public function getType(): string
{
return $this->type;
}
public function isStore(): bool
{
return $this->type === self::STORE;
}
}
================================================
FILE: app/Modules/Image/Application/Commands/AddImageCommand.php
================================================
<?php
namespace App\Modules\Image\Application\Commands;
use App\Modules\Character\Domain\CharacterId;
use Illuminate\Http\UploadedFile;
class AddImageCommand
{
/**
* @var CharacterId
*/
private $characterId;
/**
* @var UploadedFile
*/
private $uploadedFile;
public function __construct(CharacterId $characterId, UploadedFile $uploadedFile)
{
$this->characterId = $characterId;
$this->uploadedFile = $uploadedFile;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getUploadedFile(): UploadedFile
{
return $this->uploadedFile;
}
}
================================================
FILE: app/Modules/Image/Application/Contracts/ImageRepositoryInterface.php
================================================
<?php
namespace App\Modules\Image\Application\Contracts;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Image\Domain\Image;
use App\Modules\Image\Domain\ImageId;
use Illuminate\Http\UploadedFile;
interface ImageRepositoryInterface
{
public function nextIdentity(): ImageId;
public function add(Image $image, UploadedFile $uploadedFile): void;
public function delete(CharacterId $characterId): void;
}
================================================
FILE: app/Modules/Image/Application/Factories/ImageFactory.php
================================================
<?php
namespace App\Modules\Image\Application\Factories;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Image\Domain\ImageFile;
use App\Modules\Image\Domain\Image;
use App\Modules\Image\Domain\ImageId;
class ImageFactory
{
public function create(ImageId $imageId, CharacterId $characterId, string $extension): Image
{
$fileName = $imageId->toString() . '.' . $extension;
return new Image(
$imageId,
$characterId,
ImageFile::full('full_' . $fileName),
ImageFile::small('small_' . $fileName),
ImageFile::icon('icon_' . $fileName)
);
}
}
================================================
FILE: app/Modules/Image/Application/Services/ProfilePictureService.php
================================================
<?php
namespace App\Modules\Image\Application\Services;
use App\Modules\Character\Application\Services\CharacterService;
use App\Modules\Character\Domain\CharacterId;
use App\Modules\Image\Application\Contracts\ImageRepositoryInterface;
use App\Modules\Image\Application\Factories\ImageFactory;
use App\Modules\Image\Application\Commands\AddImageCommand;
class ProfilePictureService
{
/**
* @var ImageFactory
*/
private $imageFactory;
/**
* @var ImageRepositoryInterface
*/
private $imageRepository;
/**
* @var CharacterService
*/
private $characterService;
public function __construct(
ImageFactory $imageFactory,
ImageRepositoryInterface $imageRepository,
CharacterService $characterService
) {
$this->imageFactory = $imageFactory;
$this->imageRepository = $imageRepository;
$this->characterService = $characterService;
}
public function update(AddImageCommand $command): void
{
$imageId = $this->imageRepository->nextIdentity();
$profilePicture = $this->imageFactory->create(
$imageId,
$command->getCharacterId(),
$command->getUploadedFile()->getClientOriginalExtension()
);
$this->imageRepository->delete($command->getCharacterId());
$this->imageRepository->add($profilePicture, $command->getUploadedFile());
$this->characterService->updateProfilePicture($profilePicture);
}
public function delete(CharacterId $characterId): void
{
$this->imageRepository->delete($characterId);
$this->characterService->removeProfilePicture($characterId);
}
}
================================================
FILE: app/Modules/Image/Domain/Image.php
================================================
<?php
namespace App\Modules\Image\Domain;
use App\Modules\Character\Domain\CharacterId;
class Image
{
/**
* @var ImageId
*/
private $id;
/**
* @var CharacterId
*/
private $characterId;
/**
* @var ImageFile
*/
private $fullSizeFile;
/**
* @var ImageFile
*/
private $smallSizeFile;
/**
* @var ImageFile
*/
private $iconSizeFile;
public function __construct(
ImageId $id,
CharacterId $characterId,
ImageFile $fullSizeFile,
ImageFile $smallSizeFile,
ImageFile $iconSizeFile
) {
$this->id = $id;
$this->characterId = $characterId;
$this->fullSizeFile = $fullSizeFile;
$this->smallSizeFile = $smallSizeFile;
$this->iconSizeFile = $iconSizeFile;
}
public function getId(): ImageId
{
return $this->id;
}
public function getCharacterId(): CharacterId
{
return $this->characterId;
}
public function getFullSizeFile(): ImageFile
{
return $this->fullSizeFile;
}
public function getSmallSizeFile(): ImageFile
{
return $this->smallSizeFile;
}
public function getIconSizeFile(): ImageFile
{
return $this->iconSizeFile;
}
}
================================================
FILE: app/Modules/Image/Domain/ImageFile.php
================================================
<?php
namespace App\Modules\Image\Domain;
class ImageFile
{
public const IMAGE_WIDTH_FULL = 1000;
public const IMAGE_WIDTH_SMALL = 100;
public const IMAGE_WIDTH_ICON = 20;
/**
* @var string
*/
private $fileName;
/**
* @var int
*/
private $width;
private function __construct(string $fileName, int $width)
{
$this->fileName = $fileName;
$this->width = $width;
}
public static function full(string $fileName): sel
gitextract_b2fve_hr/ ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── app/ │ ├── Console/ │ │ └── Kernel.php │ ├── Exceptions/ │ │ └── Handler.php │ ├── Http/ │ │ ├── Controllers/ │ │ │ ├── Api/ │ │ │ │ ├── ManageInventoryController.php │ │ │ │ ├── ManageStoreController.php │ │ │ │ └── TradeController.php │ │ │ ├── Auth/ │ │ │ │ ├── ConfirmPasswordController.php │ │ │ │ ├── ForgotPasswordController.php │ │ │ │ ├── LoginController.php │ │ │ │ ├── RegisterController.php │ │ │ │ ├── ResetPasswordController.php │ │ │ │ └── VerificationController.php │ │ │ ├── BattleController.php │ │ │ ├── CharacterBattleController.php │ │ │ ├── CharacterController.php │ │ │ ├── CharacterMessageController.php │ │ │ ├── CharacterStoreController.php │ │ │ ├── Controller.php │ │ │ ├── InventoryController.php │ │ │ ├── ItemCreateController.php │ │ │ ├── LocationController.php │ │ │ ├── MessageController.php │ │ │ ├── OwnStoreController.php │ │ │ └── ProfilePictureController.php │ │ ├── Kernel.php │ │ ├── Middleware/ │ │ │ ├── Authenticate.php │ │ │ ├── CanAttack.php │ │ │ ├── CanMoveToLocation.php │ │ │ ├── EncryptCookies.php │ │ │ ├── HasCharacter.php │ │ │ ├── IsAdmin.php │ │ │ ├── IsCharacterLocation.php │ │ │ ├── NoCharacterYet.php │ │ │ ├── PreventRequestsDuringMaintenance.php │ │ │ ├── RedirectIfAuthenticated.php │ │ │ ├── TrimStrings.php │ │ │ ├── TrustHosts.php │ │ │ ├── TrustProxies.php │ │ │ ├── UpdateLastUserActivity.php │ │ │ ├── UserOwnsCharacter.php │ │ │ └── VerifyCsrfToken.php │ │ ├── Requests/ │ │ │ ├── CreateCharacterRequest.php │ │ │ ├── CreateItemRequest.php │ │ │ ├── UpdateCharacterAttributeRequest.php │ │ │ └── UploadImageRequest.php │ │ └── ViewComposers/ │ │ ├── BattlesComposer.php │ │ ├── CharacterGeneralInfoComposer.php │ │ ├── CharacterMessagesComposer.php │ │ └── MessagesComposer.php │ ├── Models/ │ │ ├── Battle.php │ │ ├── BattleRound.php │ │ ├── BattleTurn.php │ │ ├── Character.php │ │ ├── Image.php │ │ ├── Inventory.php │ │ ├── Item.php │ │ ├── ItemPrototype.php │ │ ├── Location.php │ │ ├── Message.php │ │ ├── Race.php │ │ ├── Store.php │ │ └── User.php │ ├── Modules/ │ │ ├── Battle/ │ │ │ ├── Application/ │ │ │ │ └── Contracts/ │ │ │ │ └── BattleRepositoryInterface.php │ │ │ ├── Domain/ │ │ │ │ ├── Battle.php │ │ │ │ ├── BattleId.php │ │ │ │ ├── BattleRound.php │ │ │ │ ├── BattleRounds.php │ │ │ │ ├── BattleTurn.php │ │ │ │ ├── BattleTurnResult.php │ │ │ │ └── BattleTurns.php │ │ │ └── Infrastructure/ │ │ │ └── Repositories/ │ │ │ └── BattleRepository.php │ │ ├── Character/ │ │ │ ├── Application/ │ │ │ │ ├── Commands/ │ │ │ │ │ ├── AttackCharacterCommand.php │ │ │ │ │ ├── CreateCharacterCommand.php │ │ │ │ │ ├── IncreaseAttributeCommand.php │ │ │ │ │ └── MoveCharacterCommand.php │ │ │ │ ├── Contracts/ │ │ │ │ │ ├── CharacterRepositoryInterface.php │ │ │ │ │ ├── LocationRepositoryInterface.php │ │ │ │ │ └── RaceRepositoryInterface.php │ │ │ │ ├── Factories/ │ │ │ │ │ └── CharacterFactory.php │ │ │ │ └── Services/ │ │ │ │ └── CharacterService.php │ │ │ ├── Domain/ │ │ │ │ ├── Attributes.php │ │ │ │ ├── Character.php │ │ │ │ ├── CharacterId.php │ │ │ │ ├── CharacterType.php │ │ │ │ ├── Gender.php │ │ │ │ ├── HitPoints.php │ │ │ │ ├── LocationId.php │ │ │ │ ├── Name.php │ │ │ │ ├── Race.php │ │ │ │ ├── Reputation.php │ │ │ │ └── Statistics.php │ │ │ ├── Infrastructure/ │ │ │ │ ├── ReconstitutionFactories/ │ │ │ │ │ └── CharacterReconstitutionFactory.php │ │ │ │ └── Repositories/ │ │ │ │ ├── CharacterRepository.php │ │ │ │ ├── LocationRepository.php │ │ │ │ └── RaceRepository.php │ │ │ └── UI/ │ │ │ └── Http/ │ │ │ └── CommandMappers/ │ │ │ ├── AttackCharacterCommandMapper.php │ │ │ ├── CreateCharacterCommandMapper.php │ │ │ ├── IncreaseAttributeCommandMapper.php │ │ │ └── MoveCharacterCommandMapper.php │ │ ├── Equipment/ │ │ │ ├── Application/ │ │ │ │ ├── Commands/ │ │ │ │ │ ├── AddItemToInventoryCommand.php │ │ │ │ │ ├── CreateInventoryCommand.php │ │ │ │ │ ├── CreateItemCommand.php │ │ │ │ │ └── EquipItemCommand.php │ │ │ │ ├── Contracts/ │ │ │ │ │ ├── InventoryRepositoryInterface.php │ │ │ │ │ ├── ItemPrototypeRepositoryInterface.php │ │ │ │ │ └── ItemRepositoryInterface.php │ │ │ │ ├── Factories/ │ │ │ │ │ └── ItemFactory.php │ │ │ │ └── Services/ │ │ │ │ ├── InventoryService.php │ │ │ │ └── ItemService.php │ │ │ ├── Domain/ │ │ │ │ ├── Inventory.php │ │ │ │ ├── InventoryId.php │ │ │ │ ├── InventoryItem.php │ │ │ │ ├── InventorySlot.php │ │ │ │ ├── Item.php │ │ │ │ ├── ItemEffect.php │ │ │ │ ├── ItemId.php │ │ │ │ ├── ItemPrice.php │ │ │ │ ├── ItemPrototype.php │ │ │ │ ├── ItemPrototypeId.php │ │ │ │ ├── ItemStatus.php │ │ │ │ ├── ItemType.php │ │ │ │ └── Money.php │ │ │ ├── Infrastructure/ │ │ │ │ ├── ReconstitutionFactories/ │ │ │ │ │ ├── InventoryItemReconstitutionFactory.php │ │ │ │ │ ├── InventoryReconstitutionFactory.php │ │ │ │ │ ├── ItemPrototypeReconstitutionFactory.php │ │ │ │ │ └── ItemReconstitutionFactory.php │ │ │ │ └── Repositories/ │ │ │ │ ├── InventoryRepository.php │ │ │ │ ├── ItemPrototypeRepository.php │ │ │ │ └── ItemRepository.php │ │ │ └── UI/ │ │ │ └── Http/ │ │ │ └── CommandMappers/ │ │ │ ├── AddItemToInventoryCommandMapper.php │ │ │ ├── CreateItemCommandMapper.php │ │ │ └── EquipItemCommandMapper.php │ │ ├── Generic/ │ │ │ └── Domain/ │ │ │ ├── BaseId.php │ │ │ ├── Container/ │ │ │ │ ├── ContainerIsFullException.php │ │ │ │ ├── ContainerSlotIsTakenException.php │ │ │ │ ├── ContainerSlotOutOfRangeException.php │ │ │ │ ├── InvalidMoneyValue.php │ │ │ │ ├── ItemNotInContainer.php │ │ │ │ ├── NotEnoughMoneyToRemove.php │ │ │ │ └── NotEnoughSpaceInContainerException.php │ │ │ ├── Container.php │ │ │ └── ContainerType.php │ │ ├── Image/ │ │ │ ├── Application/ │ │ │ │ ├── Commands/ │ │ │ │ │ └── AddImageCommand.php │ │ │ │ ├── Contracts/ │ │ │ │ │ └── ImageRepositoryInterface.php │ │ │ │ ├── Factories/ │ │ │ │ │ └── ImageFactory.php │ │ │ │ └── Services/ │ │ │ │ └── ProfilePictureService.php │ │ │ ├── Domain/ │ │ │ │ ├── Image.php │ │ │ │ ├── ImageFile.php │ │ │ │ └── ImageId.php │ │ │ ├── Infrastructure/ │ │ │ │ └── Repositories/ │ │ │ │ └── ImageRepository.php │ │ │ └── UI/ │ │ │ └── Http/ │ │ │ └── CommandMappers/ │ │ │ └── AddImageCommandMapper.php │ │ ├── Level/ │ │ │ ├── Application/ │ │ │ │ └── Services/ │ │ │ │ └── LevelService.php │ │ │ └── Domain/ │ │ │ └── Level.php │ │ ├── Message/ │ │ │ ├── Application/ │ │ │ │ ├── Commands/ │ │ │ │ │ └── SendMessageCommand.php │ │ │ │ ├── Contracts/ │ │ │ │ │ └── MessageRepositoryInterface.php │ │ │ │ └── Services/ │ │ │ │ └── MessageService.php │ │ │ ├── Domain/ │ │ │ │ ├── Message.php │ │ │ │ └── MessageId.php │ │ │ ├── Infrastructure/ │ │ │ │ └── Repositories/ │ │ │ │ └── MessageRepository.php │ │ │ └── UI/ │ │ │ └── Http/ │ │ │ └── CommandMappers/ │ │ │ └── SendMessageCommandMapper.php │ │ ├── Trade/ │ │ │ ├── Application/ │ │ │ │ ├── Commands/ │ │ │ │ │ ├── AddItemToStoreCommand.php │ │ │ │ │ ├── BuyItemCommand.php │ │ │ │ │ ├── ChangeItemPriceCommand.php │ │ │ │ │ ├── CreateStoreCommand.php │ │ │ │ │ ├── MoveItemToContainerCommand.php │ │ │ │ │ ├── MoveMoneyToContainerCommand.php │ │ │ │ │ └── SellItemCommand.php │ │ │ │ ├── Contracts/ │ │ │ │ │ └── StoreRepositoryInterface.php │ │ │ │ └── Services/ │ │ │ │ ├── CreateStoreService.php │ │ │ │ ├── ManageStoreService.php │ │ │ │ └── TradeService.php │ │ │ ├── Domain/ │ │ │ │ ├── Exception/ │ │ │ │ │ └── SellPriceIsTooHigh.php │ │ │ │ ├── Store/ │ │ │ │ │ └── StoreDoesNotBuyItems.php │ │ │ │ ├── Store.php │ │ │ │ ├── StoreId.php │ │ │ │ └── StoreType.php │ │ │ ├── Infrastructure/ │ │ │ │ ├── ReconstitutionFactories/ │ │ │ │ │ └── StoreReconstitutionFactory.php │ │ │ │ └── Repositories/ │ │ │ │ └── StoreRepository.php │ │ │ └── UI/ │ │ │ └── Http/ │ │ │ └── CommandMappers/ │ │ │ ├── BuyItemCommandMapper.php │ │ │ ├── ChangeItemPriceCommandMapper.php │ │ │ ├── MoveItemToContainerCommandMapper.php │ │ │ ├── MoveMoneyToContainerCommandMapper.php │ │ │ └── SellItemCommandMapper.php │ │ └── User/ │ │ ├── Application/ │ │ │ ├── Commands/ │ │ │ │ └── CreateUserCommand.php │ │ │ └── Services/ │ │ │ └── UserService.php │ │ └── UI/ │ │ └── Http/ │ │ └── CommandMappers/ │ │ └── CreateUserCommandMapper.php │ ├── Providers/ │ │ ├── AppServiceProvider.php │ │ ├── AuthServiceProvider.php │ │ ├── BroadcastServiceProvider.php │ │ ├── EventServiceProvider.php │ │ ├── RouteServiceProvider.php │ │ └── ViewComposerServiceProvider.php │ ├── Support/ │ │ └── helpers.php │ └── Traits/ │ ├── GeneratesUuid.php │ ├── ThrowsDice.php │ └── UsesStringId.php ├── artisan ├── bootstrap/ │ ├── app.php │ └── cache/ │ └── .gitignore ├── composer.json ├── config/ │ ├── app.php │ ├── auth.php │ ├── broadcasting.php │ ├── cache.php │ ├── cors.php │ ├── database.php │ ├── filesystems.php │ ├── hashing.php │ ├── hooks.php │ ├── image.php │ ├── logging.php │ ├── mail.php │ ├── queue.php │ ├── services.php │ ├── session.php │ ├── view.php │ ├── voyager-hooks.php │ └── voyager.php ├── database/ │ ├── .gitignore │ ├── factories/ │ │ └── UserFactory.php │ ├── migrations/ │ │ ├── 2014_10_12_000000_create_users_table.php │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ ├── 2017_05_14_055744_create_locations_table.php │ │ ├── 2017_05_14_055823_create_races_table.php │ │ ├── 2017_05_14_055844_create_characters_table.php │ │ ├── 2017_05_16_144929_create_battles_table.php │ │ ├── 2017_05_16_181330_create_battle_rounds_table.php │ │ ├── 2017_05_16_181844_create_battle_turns_table.php │ │ ├── 2017_11_26_013050_add_user_role_relationship.php │ │ ├── 2018_06_24_132346_create_messages_table.php │ │ ├── 2018_11_19_202701_create_images.php │ │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ │ ├── 2019_08_31_182034_create_items_table.php │ │ ├── 2020_02_29_205331_create_inventories.php │ │ ├── 2020_02_29_205957_create_inventory_item.php │ │ ├── 2020_03_30_133100_create_stores.php │ │ └── 2020_03_30_133448_create_store_item.php │ └── seeders/ │ ├── CharacterSeeder.php │ ├── DataRowsTableSeeder.php │ ├── DataTypesTableSeeder.php │ ├── DatabaseSeeder.php │ ├── MenuItemsTableSeeder.php │ ├── MenusTableSeeder.php │ ├── PermissionRoleTableSeeder.php │ ├── PermissionsTableSeeder.php │ ├── RolesTableSeeder.php │ ├── SettingsTableSeeder.php │ ├── TranslationsTableSeeder.php │ ├── UserSeeder.php │ ├── VoyagerDatabaseSeeder.php │ └── VoyagerDummyDatabaseSeeder.php ├── docker/ │ ├── cron/ │ │ ├── Dockerfile │ │ └── scheduler │ ├── mysql/ │ │ └── my.cnf │ ├── nginx/ │ │ └── conf.d/ │ │ └── app.conf │ └── php/ │ ├── Dockerfile │ ├── application-init.sh │ └── local.ini ├── docker-compose.yml ├── docs/ │ ├── docker_environment.md │ └── local_environment.md ├── hooks/ │ └── hooks.json ├── package.json ├── phpunit.xml ├── public/ │ ├── .htaccess │ ├── index.php │ ├── js/ │ │ ├── character-create.js │ │ ├── character-update.js │ │ └── vcountdown.js │ ├── robots.txt │ └── web.config ├── readme.md ├── resources/ │ ├── js/ │ │ ├── app.js │ │ ├── bootstrap.js │ │ └── components/ │ │ ├── FlashMessages.vue │ │ ├── InventoryManagement.vue │ │ ├── PopupModal.vue │ │ ├── StoreManagement.vue │ │ └── StoreTrade.vue │ ├── lang/ │ │ └── en/ │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php │ ├── sass/ │ │ ├── _variables.scss │ │ ├── app.scss │ │ └── custom.scss │ └── views/ │ ├── auth/ │ │ ├── login.blade.php │ │ ├── passwords/ │ │ │ ├── email.blade.php │ │ │ └── reset.blade.php │ │ └── register.blade.php │ ├── base.blade.php │ ├── battle/ │ │ ├── partials/ │ │ │ └── no-battles.blade.php │ │ └── show.blade.php │ ├── character/ │ │ ├── battle/ │ │ │ └── index.blade.php │ │ ├── create.blade.php │ │ ├── inventory/ │ │ │ └── index.blade.php │ │ ├── message/ │ │ │ └── index.blade.php │ │ ├── partials/ │ │ │ ├── actions.blade.php │ │ │ ├── attributes.blade.php │ │ │ ├── character-display.blade.php │ │ │ ├── equipment-item-mutable.blade.php │ │ │ ├── equipment-item.blade.php │ │ │ ├── equipment-mutable.blade.php │ │ │ ├── equipment.blade.php │ │ │ ├── general.blade.php │ │ │ ├── inventory.blade.php │ │ │ └── statistics.blade.php │ │ └── show.blade.php │ ├── components/ │ │ ├── increment_attribute_button.blade.php │ │ └── short_character_description.blade.php │ ├── emails/ │ │ └── password.blade.php │ ├── errors/ │ │ └── 503.blade.php │ ├── location/ │ │ ├── partials/ │ │ │ ├── list-character.blade.php │ │ │ └── navigator.blade.php │ │ └── show.blade.php │ ├── message/ │ │ ├── index.blade.php │ │ └── partials/ │ │ ├── conversation-card.blade.php │ │ ├── conversation-message.blade.php │ │ ├── conversation.blade.php │ │ ├── my-message.blade.php │ │ ├── no-messages.blade.php │ │ └── others-message.blade.php │ ├── pages/ │ │ └── index.blade.php │ ├── partials/ │ │ ├── flash-messages.blade.php │ │ └── navbar.blade.php │ ├── trade/ │ │ ├── own_store/ │ │ │ └── index.blade.php │ │ └── store/ │ │ └── index.blade.php │ └── vendor/ │ ├── .gitkeep │ └── pagination/ │ ├── bootstrap-4.blade.php │ ├── default.blade.php │ ├── semantic-ui.blade.php │ ├── simple-bootstrap-4.blade.php │ └── simple-default.blade.php ├── routes/ │ ├── api.php │ ├── channels.php │ ├── console.php │ └── web.php ├── scheduler.bat ├── server.php ├── storage/ │ ├── app/ │ │ └── public/ │ │ └── .gitignore │ ├── debugbar/ │ │ └── .gitignore │ ├── framework/ │ │ ├── .gitignore │ │ ├── cache/ │ │ │ └── .gitignore │ │ ├── sessions/ │ │ │ └── .gitignore │ │ ├── testing/ │ │ │ └── .gitignore │ │ └── views/ │ │ └── .gitignore │ └── logs/ │ └── .gitignore ├── tests/ │ ├── Browser/ │ │ ├── ExampleTest.php │ │ ├── Pages/ │ │ │ ├── HomePage.php │ │ │ └── Page.php │ │ ├── console/ │ │ │ └── .gitignore │ │ └── screenshots/ │ │ └── .gitignore │ ├── CreatesApplication.php │ ├── DuskTestCase.php │ ├── Feature/ │ │ ├── AttackTest.php │ │ ├── CharacterCreationTest.php │ │ └── ExampleTest.php │ ├── TestCase.php │ └── Unit/ │ ├── ExampleTest.php │ └── app/ │ └── Modules/ │ ├── Equipment/ │ │ ├── Application/ │ │ │ └── Services/ │ │ │ └── ItemServiceTest.php │ │ └── Domain/ │ │ └── InventoryTest.php │ └── Level/ │ ├── Application/ │ │ └── Services/ │ │ └── LevelServiceTest.php │ └── Domain/ │ └── Entities/ │ └── LevelTest.php └── webpack.mix.js
SYMBOL INDEX (1017 symbols across 241 files)
FILE: app/Console/Kernel.php
class Kernel (line 9) | class Kernel extends ConsoleKernel
method schedule (line 26) | protected function schedule(Schedule $schedule)
method commands (line 40) | protected function commands()
FILE: app/Exceptions/Handler.php
class Handler (line 10) | class Handler extends ExceptionHandler
method register (line 40) | public function register()
method render (line 56) | public function render($request, Throwable $exception)
method getMaxSizeInKiloBytes (line 69) | private function getMaxSizeInKiloBytes(): float
FILE: app/Http/Controllers/Api/ManageInventoryController.php
class ManageInventoryController (line 13) | class ManageInventoryController extends Controller
method __construct (line 20) | public function __construct(InventoryService $inventoryService)
method equipItem (line 25) | public function equipItem(Request $request, EquipItemCommandMapper $co...
method unEquipItem (line 45) | public function unEquipItem(Request $request, EquipItemCommandMapper $...
FILE: app/Http/Controllers/Api/ManageStoreController.php
class ManageStoreController (line 15) | class ManageStoreController extends Controller
method __construct (line 22) | public function __construct(ManageStoreService $service)
method changeItemPrice (line 27) | public function changeItemPrice(Request $request, ChangeItemPriceComma...
method moveItemToStore (line 47) | public function moveItemToStore(Request $request, MoveItemToContainerC...
method moveItemToInventory (line 67) | public function moveItemToInventory(Request $request, MoveItemToContai...
method moveMoneyToStore (line 87) | public function moveMoneyToStore(Request $request, MoveMoneyToContaine...
method moveMoneyToInventory (line 107) | public function moveMoneyToInventory(Request $request, MoveMoneyToCont...
FILE: app/Http/Controllers/Api/TradeController.php
class TradeController (line 14) | class TradeController extends Controller
method __construct (line 21) | public function __construct(TradeService $service)
method buyItem (line 26) | public function buyItem(Request $request, BuyItemCommandMapper $comman...
method sellItem (line 46) | public function sellItem(Request $request, SellItemCommandMapper $comm...
FILE: app/Http/Controllers/Auth/ConfirmPasswordController.php
class ConfirmPasswordController (line 8) | class ConfirmPasswordController extends Controller
method __construct (line 35) | public function __construct()
FILE: app/Http/Controllers/Auth/ForgotPasswordController.php
class ForgotPasswordController (line 8) | class ForgotPasswordController extends Controller
FILE: app/Http/Controllers/Auth/LoginController.php
class LoginController (line 8) | class LoginController extends Controller
method __construct (line 35) | public function __construct()
FILE: app/Http/Controllers/Auth/RegisterController.php
class RegisterController (line 12) | class RegisterController extends Controller
method __construct (line 49) | public function __construct(UserService $userService, CreateUserComman...
method validator (line 63) | protected function validator(array $data)
method create (line 79) | protected function create(array $data)
FILE: app/Http/Controllers/Auth/ResetPasswordController.php
class ResetPasswordController (line 8) | class ResetPasswordController extends Controller
FILE: app/Http/Controllers/Auth/VerificationController.php
class VerificationController (line 8) | class VerificationController extends Controller
method __construct (line 35) | public function __construct()
FILE: app/Http/Controllers/BattleController.php
class BattleController (line 7) | class BattleController extends Controller
method __construct (line 10) | public function __construct()
method show (line 16) | public function show(string $battleId)
FILE: app/Http/Controllers/CharacterBattleController.php
class CharacterBattleController (line 7) | class CharacterBattleController extends Controller
method index (line 9) | public function index(string $characterId)
FILE: app/Http/Controllers/CharacterController.php
class CharacterController (line 19) | class CharacterController extends Controller
method __construct (line 31) | public function __construct(CharacterService $characterService)
method create (line 43) | public function create(): View
method store (line 51) | public function store(
method show (line 63) | public function show(string $characterId): View
method update (line 70) | public function update(
method move (line 83) | public function move(
method attack (line 95) | public function attack(
FILE: app/Http/Controllers/CharacterMessageController.php
class CharacterMessageController (line 10) | class CharacterMessageController extends Controller
method __construct (line 13) | public function __construct()
method index (line 18) | public function index(string $characterId)
method store (line 25) | public function store(
FILE: app/Http/Controllers/CharacterStoreController.php
class CharacterStoreController (line 9) | class CharacterStoreController extends Controller
method __construct (line 11) | public function __construct()
method index (line 17) | public function index(Request $request, string $characterId): View
FILE: app/Http/Controllers/Controller.php
class Controller (line 10) | class Controller extends BaseController
FILE: app/Http/Controllers/InventoryController.php
class InventoryController (line 15) | class InventoryController extends Controller
method __construct (line 22) | public function __construct(InventoryService $inventoryService)
method index (line 29) | public function index(Request $request, LevelService $levelService): View
method equipItem (line 39) | public function equipItem(Request $request, EquipItemCommandMapper $co...
method unEquipItem (line 59) | public function unEquipItem(Request $request, EquipItemCommandMapper $...
FILE: app/Http/Controllers/ItemCreateController.php
class ItemCreateController (line 10) | class ItemCreateController extends Controller
method __construct (line 17) | public function __construct(ItemService $itemService)
method store (line 26) | public function store(
FILE: app/Http/Controllers/LocationController.php
class LocationController (line 7) | class LocationController extends Controller
method __construct (line 10) | public function __construct()
method show (line 17) | public function show(string $locationId)
FILE: app/Http/Controllers/MessageController.php
class MessageController (line 7) | class MessageController extends Controller
method __construct (line 9) | public function __construct()
method index (line 14) | public function index(): View
FILE: app/Http/Controllers/OwnStoreController.php
class OwnStoreController (line 9) | class OwnStoreController extends Controller
method __construct (line 11) | public function __construct()
method index (line 17) | public function index(Request $request): View
FILE: app/Http/Controllers/ProfilePictureController.php
class ProfilePictureController (line 10) | class ProfilePictureController extends Controller
method __construct (line 12) | public function __construct()
method store (line 17) | public function store(
method destroy (line 30) | public function destroy(
FILE: app/Http/Kernel.php
class Kernel (line 7) | class Kernel extends HttpKernel
FILE: app/Http/Middleware/Authenticate.php
class Authenticate (line 7) | class Authenticate extends Middleware
method redirectTo (line 15) | protected function redirectTo($request)
FILE: app/Http/Middleware/CanAttack.php
class CanAttack (line 10) | class CanAttack
method handle (line 19) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/CanMoveToLocation.php
class CanMoveToLocation (line 11) | class CanMoveToLocation
method handle (line 20) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/EncryptCookies.php
class EncryptCookies (line 7) | class EncryptCookies extends Middleware
FILE: app/Http/Middleware/HasCharacter.php
class HasCharacter (line 8) | class HasCharacter
method handle (line 17) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/IsAdmin.php
class IsAdmin (line 8) | class IsAdmin
method handle (line 17) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/IsCharacterLocation.php
class IsCharacterLocation (line 8) | class IsCharacterLocation
method handle (line 17) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/NoCharacterYet.php
class NoCharacterYet (line 8) | class NoCharacterYet
method handle (line 17) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/PreventRequestsDuringMaintenance.php
class PreventRequestsDuringMaintenance (line 7) | class PreventRequestsDuringMaintenance extends Middleware
FILE: app/Http/Middleware/RedirectIfAuthenticated.php
class RedirectIfAuthenticated (line 10) | class RedirectIfAuthenticated
method handle (line 20) | public function handle(Request $request, Closure $next, ...$guards)
FILE: app/Http/Middleware/TrimStrings.php
class TrimStrings (line 7) | class TrimStrings extends Middleware
FILE: app/Http/Middleware/TrustHosts.php
class TrustHosts (line 7) | class TrustHosts extends Middleware
method hosts (line 14) | public function hosts()
FILE: app/Http/Middleware/TrustProxies.php
class TrustProxies (line 8) | class TrustProxies extends Middleware
FILE: app/Http/Middleware/UpdateLastUserActivity.php
class UpdateLastUserActivity (line 8) | class UpdateLastUserActivity
method handle (line 17) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/UserOwnsCharacter.php
class UserOwnsCharacter (line 9) | class UserOwnsCharacter
method handle (line 18) | public function handle($request, Closure $next)
FILE: app/Http/Middleware/VerifyCsrfToken.php
class VerifyCsrfToken (line 9) | class VerifyCsrfToken extends Middleware
method handle (line 20) | public function handle($request, Closure $next)
FILE: app/Http/Requests/CreateCharacterRequest.php
class CreateCharacterRequest (line 7) | class CreateCharacterRequest extends FormRequest
method authorize (line 14) | public function authorize()
method rules (line 24) | public function rules()
FILE: app/Http/Requests/CreateItemRequest.php
class CreateItemRequest (line 7) | class CreateItemRequest extends FormRequest
method authorize (line 14) | public function authorize()
method rules (line 24) | public function rules()
FILE: app/Http/Requests/UpdateCharacterAttributeRequest.php
class UpdateCharacterAttributeRequest (line 7) | class UpdateCharacterAttributeRequest extends FormRequest
method authorize (line 14) | public function authorize()
method rules (line 24) | public function rules()
FILE: app/Http/Requests/UploadImageRequest.php
class UploadImageRequest (line 7) | class UploadImageRequest extends FormRequest
method authorize (line 9) | public function authorize()
method rules (line 19) | public function rules()
FILE: app/Http/ViewComposers/BattlesComposer.php
class BattlesComposer (line 12) | class BattlesComposer
method compose (line 20) | public function compose(View $view)
FILE: app/Http/ViewComposers/CharacterGeneralInfoComposer.php
class CharacterGeneralInfoComposer (line 10) | class CharacterGeneralInfoComposer
method __construct (line 17) | public function __construct(LevelService $levelService)
method compose (line 28) | public function compose(View $view)
FILE: app/Http/ViewComposers/CharacterMessagesComposer.php
class CharacterMessagesComposer (line 12) | class CharacterMessagesComposer
method compose (line 20) | public function compose(View $view)
FILE: app/Http/ViewComposers/MessagesComposer.php
class MessagesComposer (line 12) | class MessagesComposer
method compose (line 20) | public function compose(View $view)
FILE: app/Models/Battle.php
class Battle (line 19) | class Battle extends Model
method rounds (line 25) | public function rounds(): HasMany
method attacker (line 30) | public function attacker(): BelongsTo
method defender (line 35) | public function defender(): BelongsTo
method victor (line 40) | public function victor(): BelongsTo
method location (line 45) | public function location(): BelongsTo
method scopeUnseenByDefender (line 54) | public function scopeUnseenByDefender($query)
method scopeMarkAsSeenByDefender (line 65) | public function scopeMarkAsSeenByDefender($query)
method getAttacker (line 70) | public function getAttacker(): Character
method getDefender (line 75) | public function getDefender(): Character
method isTheVictor (line 80) | public function isTheVictor(Character $character): bool
FILE: app/Models/BattleRound.php
class BattleRound (line 9) | class BattleRound extends Model
method turns (line 18) | public function turns()
FILE: app/Models/BattleTurn.php
class BattleTurn (line 9) | class BattleTurn extends Model
method executor (line 18) | public function executor()
method target (line 25) | public function target()
FILE: app/Models/Character.php
class Character (line 42) | class Character extends Model
method user (line 48) | public function user(): BelongsTo
method race (line 53) | public function race(): BelongsTo
method location (line 58) | public function location(): BelongsTo
method profilePicture (line 63) | public function profilePicture(): BelongsTo
method images (line 68) | public function images(): HasMany
method inventory (line 73) | public function inventory(): HasOne
method store (line 78) | public function store(): HasOne
method receivedMessages (line 83) | public function receivedMessages(): HasMany
method sentMessages (line 88) | public function sentMessages(): HasMany
method attacks (line 93) | public function attacks(): HasMany
method defends (line 98) | public function defends(): HasMany
method battles (line 103) | public function battles(): HasMany
method sendMessageTo (line 108) | public function sendMessageTo(Character $companion, string $content): ...
method isYou (line 118) | public function isYou(): bool
method isOwnMerchant (line 123) | public function isOwnMerchant(): bool
method isPlayerCharacter (line 128) | public function isPlayerCharacter(): bool
method isMerchant (line 133) | public function isMerchant(): bool
method isMonster (line 138) | public function isMonster(): bool
method isNPC (line 143) | public function isNPC(): bool
method hasProfilePicture (line 148) | public function hasProfilePicture(): bool
method isOnline (line 153) | public function isOnline(): bool
method getProfilePicture (line 162) | public function getProfilePicture(): Image
method getProfilePictureFull (line 167) | public function getProfilePictureFull(): string
method getProfilePictureSmall (line 180) | public function getProfilePictureSmall(): string
method getProfilePictureId (line 193) | public function getProfilePictureId(): ?string
method getRaceName (line 198) | public function getRaceName(): string
method getLevelNumber (line 203) | public function getLevelNumber():int
method getLocationName (line 208) | public function getLocationName():string
method getId (line 213) | public function getId(): string
method isAlive (line 218) | public function isAlive(): bool
method getStrength (line 223) | public function getStrength(): int
method getAgility (line 228) | public function getAgility(): int
method getConstitution (line 233) | public function getConstitution(): int
method getIntelligence (line 238) | public function getIntelligence(): int
method getCharisma (line 243) | public function getCharisma(): int
method getLocationId (line 248) | public function getLocationId(): string
method getHitPoints (line 253) | public function getHitPoints(): int
method getTotalHitPoints (line 258) | public function getTotalHitPoints(): int
method getUserId (line 263) | public function getUserId()
method getName (line 268) | public function getName(): string
method getGender (line 273) | public function getGender(): string
method getType (line 278) | public function getType(): string
method getRaceId (line 283) | public function getRaceId(): int
method getXp (line 288) | public function getXp(): int
method getAvailableAttributePoints (line 293) | public function getAvailableAttributePoints(): int
method getBattlesLost (line 298) | public function getBattlesLost(): int
method getBattlesWon (line 303) | public function getBattlesWon(): int
method getHeadGearItem (line 308) | public function getHeadGearItem()
method getBodyArmorItem (line 317) | public function getBodyArmorItem()
method getMainHandItem (line 326) | public function getMainHandItem()
method getOffHandItem (line 335) | public function getOffHandItem()
FILE: app/Models/Image.php
class Image (line 15) | class Image extends Model
method getId (line 21) | public function getId()
method getCharacterId (line 26) | public function getCharacterId(): string
method getFilePathFull (line 31) | public function getFilePathFull(): string
method getFilePathSmall (line 36) | public function getFilePathSmall(): string
method getFilePathIcon (line 41) | public function getFilePathIcon(): string
FILE: app/Models/Inventory.php
class Inventory (line 18) | class Inventory extends Model
method character (line 28) | public function character(): BelongsTo
method items (line 33) | public function items(): BelongsToMany
method getId (line 38) | public function getId(): string
method getCharacterId (line 43) | public function getCharacterId(): string
method getMoney (line 48) | public function getMoney(): int
FILE: app/Models/Item.php
class Item (line 27) | class Item extends Model
method inventory (line 37) | public function inventory(): BelongsToMany
method prototype (line 42) | public function prototype(): BelongsTo
method getId (line 47) | public function getId(): string
method getName (line 52) | public function getName(): string
method getDescription (line 57) | public function getDescription(): string
method getImageFilePath (line 62) | public function getImageFilePath(): string
method getType (line 67) | public function getType(): string
method getStatus (line 72) | public function getStatus(): string
method getEffects (line 77) | public function getEffects(): array
method getPrice (line 82) | public function getPrice(): int
method getPrototypeId (line 87) | public function getPrototypeId(): string
method getCreatorCharacterId (line 92) | public function getCreatorCharacterId(): string
method isEquipped (line 97) | public function isEquipped(): bool
method getInventorySlotNumber (line 102) | public function getInventorySlotNumber(): int
FILE: app/Models/ItemPrototype.php
class ItemPrototype (line 17) | class ItemPrototype extends Model
method getId (line 27) | public function getId(): string
method getName (line 32) | public function getName(): string
method getDescription (line 37) | public function getDescription(): string
method getImageFilePath (line 42) | public function getImageFilePath(): string
method getType (line 47) | public function getType(): string
method getEffects (line 52) | public function getEffects(): array
method getPrice (line 57) | public function getPrice(): int
FILE: app/Models/Location.php
class Location (line 17) | class Location extends Model
method getDirections (line 31) | static public function getDirections()
method getAppositeDirection (line 43) | static protected function getAppositeDirection($direction)
method isValidDirection (line 61) | static protected function isValidDirection($direction)
method characters (line 71) | public function characters()
method adjacentLocations (line 79) | public function adjacentLocations()
method adjacent (line 84) | public function adjacent($type)
method addAdjacentLocation (line 91) | public function addAdjacentLocation(Location $adjacent, $direction)
method removeAdjacentLocation (line 110) | public function removeAdjacentLocation(Location $adjacent)
method getName (line 116) | public function getName(): string
method isAdjacentLocation (line 121) | public function isAdjacentLocation(Location $location): bool
method getId (line 126) | public function getId(): string
FILE: app/Models/Message.php
class Message (line 17) | class Message extends Model
method sender (line 33) | public function sender()
method recipient (line 41) | public function recipient()
method scopeUnread (line 52) | public function scopeUnread($query)
method scopeMarkAsRead (line 63) | public function scopeMarkAsRead($query)
method setContentAttribute (line 74) | public function setContentAttribute($value)
method unseenByRecipient (line 83) | public function unseenByRecipient(): bool
FILE: app/Models/Race.php
class Race (line 13) | class Race extends Model
method getImageByGender (line 24) | public function getImageByGender(string $gender): string
method getId (line 29) | public function getId(): int
method getStartingLocationId (line 34) | public function getStartingLocationId(): string
method getStrength (line 39) | public function getStrength(): int
method getAgility (line 44) | public function getAgility(): int
method getConstitution (line 49) | public function getConstitution(): int
method getIntelligence (line 54) | public function getIntelligence(): int
method getCharisma (line 59) | public function getCharisma(): int
method getName (line 64) | public function getName(): string
method getDescription (line 69) | public function getDescription(): string
method getMaleImage (line 74) | public function getMaleImage(): string
method getFemaleImage (line 79) | public function getFemaleImage(): string
FILE: app/Models/Store.php
class Store (line 19) | class Store extends Model
method character (line 29) | public function character(): BelongsTo
method items (line 34) | public function items(): BelongsToMany
method getId (line 40) | public function getId(): string
method getType (line 45) | public function getType(): string
method getCharacterId (line 50) | public function getCharacterId(): string
method getMoney (line 55) | public function getMoney(): int
FILE: app/Models/User.php
class User (line 16) | class User extends \TCG\Voyager\Models\User
method character (line 49) | public function character(): HasOne
method hasCharacter (line 54) | public function hasCharacter(): bool
method getId (line 59) | public function getId(): int
method isCurrentAuthenticatedUser (line 64) | public function isCurrentAuthenticatedUser(): bool
method getCharacter (line 69) | public function getCharacter(): Character
method hasThisCharacter (line 74) | public function hasThisCharacter(Character $character): bool
method updateLastUserActivity (line 79) | public function updateLastUserActivity(): User
method isOnline (line 88) | public function isOnline(): bool
FILE: app/Modules/Battle/Application/Contracts/BattleRepositoryInterface.php
type BattleRepositoryInterface (line 8) | interface BattleRepositoryInterface
method nextIdentity (line 10) | public function nextIdentity(): BattleId;
method add (line 12) | public function add(Battle $battle):void;
FILE: app/Modules/Battle/Domain/Battle.php
class Battle (line 8) | class Battle
method __construct (line 47) | public function __construct(
method execute (line 66) | public function execute(): void
method calculateVictorXpGained (line 86) | private function calculateVictorXpGained(Character $loser, Character $...
method getId (line 91) | public function getId(): BattleId
method getAttacker (line 96) | public function getAttacker(): Character
method getDefender (line 101) | public function getDefender(): Character
method getVictorXpGained (line 106) | public function getVictorXpGained(): int
method getRounds (line 111) | public function getRounds(): BattleRounds
method getVictor (line 116) | public function getVictor(): Character
method getLoser (line 121) | public function getLoser(): Character
method getLocationId (line 126) | public function getLocationId(): string
method createRound (line 131) | private function createRound(Character $attacker, Character $defender)...
FILE: app/Modules/Battle/Domain/BattleId.php
class BattleId (line 9) | class BattleId extends BaseId
FILE: app/Modules/Battle/Domain/BattleRound.php
class BattleRound (line 9) | class BattleRound
method __construct (line 33) | public function __construct(
method getId (line 45) | public function getId(): string
method getTurns (line 50) | public function getTurns(): BattleTurns
method execute (line 55) | public function execute(): void
method notLastRound (line 73) | public function notLastRound(): bool
method createTurn (line 81) | private function createTurn(Character $owner, Character $target): Batt...
FILE: app/Modules/Battle/Domain/BattleRounds.php
class BattleRounds (line 9) | class BattleRounds extends Collection
FILE: app/Modules/Battle/Domain/BattleTurn.php
class BattleTurn (line 10) | class BattleTurn
method __construct (line 34) | public function __construct(string $id, Character $owner, Character $t...
method execute (line 42) | public function execute()
method isOwnerAlive (line 65) | public function isOwnerAlive(): bool
method isTargetAlive (line 70) | public function isTargetAlive(): bool
method isTargetHit (line 75) | private function isTargetHit(): bool
method isCriticalHit (line 83) | private function isCriticalHit(): bool
method getId (line 91) | public function getId(): string
method getOwner (line 96) | public function getOwner(): Character
method getTarget (line 101) | public function getTarget(): Character
method getDamageDone (line 106) | public function getDamageDone(): int
method getDamageAbsorbed (line 111) | public function getDamageAbsorbed(): int
method getResultType (line 116) | public function getResultType(): string
FILE: app/Modules/Battle/Domain/BattleTurnResult.php
class BattleTurnResult (line 7) | class BattleTurnResult
method __construct (line 36) | public function __construct(string $type, int $damageDone, int $damage...
method none (line 43) | public static function none()
method miss (line 48) | public static function miss()
method hit (line 53) | public static function hit(int $damageDone, int $damageAbsorbed)
method criticalHit (line 58) | public static function criticalHit(int $damageDone, int $damageAbsorbed)
method getType (line 63) | public function getType(): string
method getDamageDone (line 68) | public function getDamageDone(): int
method getDamageAbsorbed (line 73) | public function getDamageAbsorbed(): int
FILE: app/Modules/Battle/Domain/BattleTurns.php
class BattleTurns (line 9) | class BattleTurns extends Collection
FILE: app/Modules/Battle/Infrastructure/Repositories/BattleRepository.php
class BattleRepository (line 17) | class BattleRepository implements BattleRepositoryInterface
method nextIdentity (line 26) | public function nextIdentity(): BattleId
method add (line 31) | public function add(Battle $battle): void
FILE: app/Modules/Character/Application/Commands/AttackCharacterCommand.php
class AttackCharacterCommand (line 9) | class AttackCharacterCommand
method __construct (line 20) | public function __construct(CharacterId $attackerId, CharacterId $defe...
method getAttackerId (line 26) | public function getAttackerId(): CharacterId
method getDefenderId (line 31) | public function getDefenderId(): CharacterId
FILE: app/Modules/Character/Application/Commands/CreateCharacterCommand.php
class CreateCharacterCommand (line 7) | class CreateCharacterCommand
method __construct (line 32) | public function __construct(string $name, string $gender, string $type...
method getName (line 41) | public function getName(): string
method getGender (line 46) | public function getGender(): string
method getCharacterType (line 51) | public function getCharacterType(): string
method getRaceId (line 56) | public function getRaceId(): int
method getUserId (line 61) | public function getUserId(): string
FILE: app/Modules/Character/Application/Commands/IncreaseAttributeCommand.php
class IncreaseAttributeCommand (line 9) | class IncreaseAttributeCommand
method __construct (line 20) | public function __construct(CharacterId $characterId, string $attribute)
method getCharacterId (line 26) | public function getCharacterId(): CharacterId
method getAttribute (line 31) | public function getAttribute(): string
FILE: app/Modules/Character/Application/Commands/MoveCharacterCommand.php
class MoveCharacterCommand (line 9) | class MoveCharacterCommand
method __construct (line 21) | public function __construct(CharacterId $characterId, string $locationId)
method getCharacterId (line 27) | public function getCharacterId(): CharacterId
method getLocationId (line 32) | public function getLocationId(): string
FILE: app/Modules/Character/Application/Contracts/CharacterRepositoryInterface.php
type CharacterRepositoryInterface (line 8) | interface CharacterRepositoryInterface
method nextIdentity (line 10) | public function nextIdentity(): CharacterId;
method add (line 12) | public function add(Character $character): void;
method getOne (line 14) | public function getOne(CharacterId $characterId): Character;
method update (line 16) | public function update(Character $character): void;
FILE: app/Modules/Character/Application/Contracts/LocationRepositoryInterface.php
type LocationRepositoryInterface (line 7) | interface LocationRepositoryInterface
method nextIdentity (line 9) | public function nextIdentity(): LocationId;
FILE: app/Modules/Character/Application/Contracts/RaceRepositoryInterface.php
type RaceRepositoryInterface (line 7) | interface RaceRepositoryInterface
method getOne (line 9) | public function getOne(int $raceId): Race;
FILE: app/Modules/Character/Application/Factories/CharacterFactory.php
class CharacterFactory (line 19) | class CharacterFactory
method create (line 21) | public function create(CharacterId $characterId, CreateCharacterComman...
FILE: app/Modules/Character/Application/Services/CharacterService.php
class CharacterService (line 28) | class CharacterService
method __construct (line 59) | public function __construct(
method create (line 78) | public function create(CreateCharacterCommand $command): Character
method increaseAttribute (line 96) | public function increaseAttribute(IncreaseAttributeCommand $command): ...
method move (line 105) | public function move(MoveCharacterCommand $command): void
method attack (line 114) | public function attack(AttackCharacterCommand $command): BattleId
method updateProfilePicture (line 154) | public function updateProfilePicture(Image $picture): void
method removeProfilePicture (line 163) | public function removeProfilePicture(CharacterId $characterId): void
FILE: app/Modules/Character/Domain/Attributes.php
class Attributes (line 9) | class Attributes
method __construct (line 16) | public function __construct($items = [])
method addAvailablePoints (line 21) | public function addAvailablePoints(int $points): Attributes
method assignAvailablePoint (line 30) | public function assignAvailablePoint(string $attribute): Attributes
method hasAvailablePoints (line 40) | public function hasAvailablePoints(): bool
method getStrength (line 45) | public function getStrength(): int
method getAgility (line 50) | public function getAgility(): int
method getConstitution (line 55) | public function getConstitution(): int
method getIntelligence (line 60) | public function getIntelligence(): int
method getCharisma (line 65) | public function getCharisma(): int
method getUnassignedAttributePoints (line 70) | public function getUnassignedAttributePoints(): int
FILE: app/Modules/Character/Domain/Character.php
class Character (line 13) | class Character
method __construct (line 78) | public function __construct(
method getLevelNumber (line 112) | public function getLevelNumber(): int
method getId (line 117) | public function getId(): CharacterId
method generateDamage (line 122) | public function generateDamage(): int
method getBaseDamage (line 127) | public function getBaseDamage(): int
method generatePrecision (line 133) | public function generatePrecision(): int
method getBasePrecision (line 138) | public function getBasePrecision(): int
method generateEvasionFactor (line 144) | public function generateEvasionFactor(): int
method getBaseEvasion (line 149) | public function getBaseEvasion(): int
method generateTrickery (line 155) | public function generateTrickery(): int
method getBaseTrickery (line 160) | public function getBaseTrickery(): int
method generateAwareness (line 166) | public function generateAwareness(): int
method getBaseAwareness (line 171) | public function getBaseAwareness(): int
method getArmorRating (line 177) | public function getArmorRating(): int
method getStrength (line 182) | public function getStrength(): int
method getAgility (line 187) | public function getAgility(): int
method getConstitution (line 192) | public function getConstitution(): int
method getIntelligence (line 197) | public function getIntelligence(): int
method getCharisma (line 202) | public function getCharisma(): int
method getUnassignedAttributePoints (line 207) | public function getUnassignedAttributePoints(): int
method getLocationId (line 212) | public function getLocationId(): string
method getHitPoints (line 217) | public function getHitPoints(): int
method getTotalHitPoints (line 222) | public function getTotalHitPoints(): int
method equals (line 227) | public function equals(Character $other): bool
method getName (line 232) | public function getName(): string
method getUserId (line 237) | public function getUserId(): ?int
method getGender (line 242) | public function getGender(): Gender
method getType (line 247) | public function getType(): CharacterType
method getXp (line 252) | public function getXp(): int
method getRaceId (line 257) | public function getRaceId(): int
method getMoney (line 262) | public function getMoney(): Money
method getReputation (line 267) | public function getReputation(): Reputation
method applyAttributeIncrease (line 272) | public function applyAttributeIncrease(string $attribute): void
method addItemToInventory (line 284) | public function addItemToInventory(Item $item): void
method setLocationId (line 289) | public function setLocationId(string $locationId): void
method isAlive (line 294) | public function isAlive(): bool
method incrementWonBattles (line 299) | public function incrementWonBattles(): void
method incrementLostBattles (line 304) | public function incrementLostBattles(): void
method addXp (line 309) | public function addXp(int $xp): void
method getBattlesWon (line 314) | public function getBattlesWon(): int
method getBattlesLost (line 319) | public function getBattlesLost(): int
method applyDamage (line 324) | public function applyDamage($damageDone): void
method updateLevel (line 329) | public function updateLevel(int $levelId): void
method setProfilePictureId (line 338) | public function setProfilePictureId(ImageId $profilePictureId): void
method getProfilePictureId (line 346) | public function getProfilePictureId(): ?ImageId
method removeProfilePicture (line 351) | public function removeProfilePicture(): void
method getInventory (line 356) | public function getInventory(): Inventory
method isMerchant (line 361) | public function isMerchant(): bool
FILE: app/Modules/Character/Domain/CharacterId.php
class CharacterId (line 9) | class CharacterId extends BaseId
FILE: app/Modules/Character/Domain/CharacterType.php
class CharacterType (line 8) | class CharacterType
method __construct (line 24) | public function __construct(string $value)
method getValue (line 33) | public function getValue(): string
method isMerchant (line 38) | public function isMerchant(): bool
FILE: app/Modules/Character/Domain/Gender.php
class Gender (line 7) | class Gender
method __construct (line 14) | public function __construct(string $value)
method getValue (line 19) | public function getValue(): string
FILE: app/Modules/Character/Domain/HitPoints.php
class HitPoints (line 9) | class HitPoints
method byRace (line 23) | public static function byRace(Race $race): HitPoints
method withIncrementedConstitution (line 30) | public function withIncrementedConstitution(): HitPoints
method withUpdatedCurrentValue (line 38) | public function withUpdatedCurrentValue(int $points): HitPoints
method constitutionToHitPoints (line 46) | protected static function constitutionToHitPoints(int $constitutionPoi...
method __construct (line 51) | public function __construct(int $currentHitPoints, int $maximumHitPoints)
method getCurrentHitPoints (line 57) | public function getCurrentHitPoints(): int
method getMaximumHitPoints (line 62) | public function getMaximumHitPoints(): int
FILE: app/Modules/Character/Domain/LocationId.php
class LocationId (line 9) | class LocationId extends BaseId
FILE: app/Modules/Character/Domain/Name.php
class Name (line 7) | class Name
method __construct (line 14) | public function __construct(string $value)
method getValue (line 19) | public function getValue(): string
method equals (line 24) | public function equals(Name $otherName): bool
FILE: app/Modules/Character/Domain/Race.php
class Race (line 6) | class Race
method __construct (line 37) | public function __construct(
method getId (line 55) | public function getId(): int
method getName (line 60) | public function getName(): string
method getImageByGender (line 65) | public function getImageByGender(string $gender):string
method getStartingLocationId (line 70) | public function getStartingLocationId(): string
method getStrength (line 75) | public function getStrength(): int
method getAgility (line 80) | public function getAgility(): int
method getConstitution (line 85) | public function getConstitution(): int
method getIntelligence (line 90) | public function getIntelligence(): int
method getCharisma (line 95) | public function getCharisma(): int
method getDescription (line 103) | public function getDescription(): string
method getMaleImage (line 111) | public function getMaleImage(): string
method getFemaleImage (line 119) | public function getFemaleImage(): string
FILE: app/Modules/Character/Domain/Reputation.php
class Reputation (line 7) | class Reputation
method __construct (line 14) | public function __construct(int $value)
method getValue (line 19) | public function getValue(): int
FILE: app/Modules/Character/Domain/Statistics.php
class Statistics (line 9) | class Statistics
method __construct (line 13) | public function __construct($statistics = [])
method withIncreaseWonBattles (line 18) | public function withIncreaseWonBattles(): Statistics
method withIncreaseLostBattles (line 27) | public function withIncreaseLostBattles(): Statistics
method getBattlesWon (line 36) | public function getBattlesWon(): int
method getBattlesLost (line 41) | public function getBattlesLost(): int
FILE: app/Modules/Character/Infrastructure/ReconstitutionFactories/CharacterReconstitutionFactory.php
class CharacterReconstitutionFactory (line 19) | class CharacterReconstitutionFactory
method __construct (line 26) | public function __construct(InventoryReconstitutionFactory $inventoryR...
method reconstitute (line 31) | public function reconstitute(CharacterModel $characterModel): Character
FILE: app/Modules/Character/Infrastructure/Repositories/CharacterRepository.php
class CharacterRepository (line 13) | class CharacterRepository implements CharacterRepositoryInterface
method __construct (line 22) | public function __construct(CharacterReconstitutionFactory $characterR...
method nextIdentity (line 32) | public function nextIdentity(): CharacterId
method add (line 37) | public function add(Character $character): void
method getOne (line 73) | public function getOne(CharacterId $characterId): Character
method update (line 81) | public function update(Character $character): void
FILE: app/Modules/Character/Infrastructure/Repositories/LocationRepository.php
class LocationRepository (line 10) | class LocationRepository implements LocationRepositoryInterface
method nextIdentity (line 19) | public function nextIdentity(): LocationId
FILE: app/Modules/Character/Infrastructure/Repositories/RaceRepository.php
class RaceRepository (line 10) | class RaceRepository implements RaceRepositoryInterface
method getOne (line 12) | public function getOne(int $raceId): Race
FILE: app/Modules/Character/UI/Http/CommandMappers/AttackCharacterCommandMapper.php
class AttackCharacterCommandMapper (line 11) | class AttackCharacterCommandMapper
method map (line 13) | public function map(Request $request, string $defenderId): AttackChara...
FILE: app/Modules/Character/UI/Http/CommandMappers/CreateCharacterCommandMapper.php
class CreateCharacterCommandMapper (line 11) | class CreateCharacterCommandMapper
method map (line 13) | public function map(Request $request): CreateCharacterCommand
FILE: app/Modules/Character/UI/Http/CommandMappers/IncreaseAttributeCommandMapper.php
class IncreaseAttributeCommandMapper (line 10) | class IncreaseAttributeCommandMapper
method map (line 12) | public function map(string $characterId, Request $request): IncreaseAt...
FILE: app/Modules/Character/UI/Http/CommandMappers/MoveCharacterCommandMapper.php
class MoveCharacterCommandMapper (line 9) | class MoveCharacterCommandMapper
method map (line 11) | public function map(string $characterId, string $locationId): MoveChar...
FILE: app/Modules/Equipment/Application/Commands/AddItemToInventoryCommand.php
class AddItemToInventoryCommand (line 8) | class AddItemToInventoryCommand
method __construct (line 23) | public function __construct(CharacterId $characterId, int $slot, ItemI...
method getCharacterId (line 30) | public function getCharacterId(): CharacterId
method getSlot (line 35) | public function getSlot(): int
method getItemId (line 40) | public function getItemId(): ItemId
FILE: app/Modules/Equipment/Application/Commands/CreateInventoryCommand.php
class CreateInventoryCommand (line 9) | class CreateInventoryCommand
method __construct (line 16) | public function __construct(CharacterId $characterId)
method getCharacterId (line 21) | public function getCharacterId(): CharacterId
FILE: app/Modules/Equipment/Application/Commands/CreateItemCommand.php
class CreateItemCommand (line 8) | class CreateItemCommand
method __construct (line 19) | public function __construct(ItemPrototypeId $prototypeId, CharacterId ...
method getPrototypeId (line 25) | public function getPrototypeId(): ItemPrototypeId
method getCreatorCharacterId (line 30) | public function getCreatorCharacterId(): CharacterId
FILE: app/Modules/Equipment/Application/Commands/EquipItemCommand.php
class EquipItemCommand (line 8) | class EquipItemCommand
method __construct (line 19) | public function __construct(ItemId $itemId, CharacterId $ownerCharacte...
method getItemId (line 25) | public function getItemId(): ItemId
method getOwnerCharacterId (line 30) | public function getOwnerCharacterId(): CharacterId
FILE: app/Modules/Equipment/Application/Contracts/InventoryRepositoryInterface.php
type InventoryRepositoryInterface (line 9) | interface InventoryRepositoryInterface
method nextIdentity (line 11) | public function nextIdentity(): InventoryId;
method add (line 13) | public function add(Inventory $inventory): void;
method forCharacter (line 15) | public function forCharacter(CharacterId $characterId): Inventory;
method update (line 17) | public function update(Inventory $inventory): void;
FILE: app/Modules/Equipment/Application/Contracts/ItemPrototypeRepositoryInterface.php
type ItemPrototypeRepositoryInterface (line 8) | interface ItemPrototypeRepositoryInterface
method nextIdentity (line 10) | public function nextIdentity(): ItemPrototypeId;
method getOne (line 12) | public function getOne(ItemPrototypeId $itemPrototypeId): ItemPrototype;
FILE: app/Modules/Equipment/Application/Contracts/ItemRepositoryInterface.php
type ItemRepositoryInterface (line 8) | interface ItemRepositoryInterface
method nextIdentity (line 10) | public function nextIdentity(): ItemId;
method add (line 12) | public function add(Item $item): void;
method getOne (line 14) | public function getOne(ItemId $itemId): Item;
method update (line 16) | public function update(Item $item): void;
FILE: app/Modules/Equipment/Application/Factories/ItemFactory.php
class ItemFactory (line 11) | class ItemFactory
method create (line 13) | public function create(ItemId $itemId, ItemPrototype $itemPrototype, C...
FILE: app/Modules/Equipment/Application/Services/InventoryService.php
class InventoryService (line 13) | class InventoryService
method __construct (line 20) | public function __construct(InventoryRepositoryInterface $inventoryRep...
method create (line 25) | public function create(CreateInventoryCommand $command):Inventory
method equipItem (line 36) | public function equipItem(EquipItemCommand $command): void
method unEquipItem (line 45) | public function unEquipItem(EquipItemCommand $command): void
FILE: app/Modules/Equipment/Application/Services/ItemService.php
class ItemService (line 14) | class ItemService
method __construct (line 33) | public function __construct(
method create (line 46) | public function create(CreateItemCommand $command): void
FILE: app/Modules/Equipment/Domain/Inventory.php
class Inventory (line 12) | class Inventory
method __construct (line 36) | public function __construct(InventoryId $id, CharacterId $characterId,...
method getId (line 56) | public function getId(): InventoryId
method add (line 61) | public function add(Item $item): void
method getEquippedItemsEffect (line 70) | public function getEquippedItemsEffect(string $itemEffectType): int
method unEquipItem (line 80) | public function unEquipItem(ItemId $itemId): void
method equip (line 90) | public function equip(ItemId $itemId): void
method getCharacterId (line 104) | public function getCharacterId(): CharacterId
method getItems (line 109) | public function getItems(): Collection
method takeOut (line 114) | public function takeOut(ItemId $itemId): Item
method putMoneyIn (line 132) | public function putMoneyIn(Money $money): void
method takeMoneyOut (line 137) | public function takeMoneyOut(Money $money): Money
method getMoney (line 144) | public function getMoney(): Money
method findItem (line 149) | public function findItem(ItemId $itemId):? InventoryItem
method findFreeSlot (line 156) | private function findFreeSlot(): int
method findEquippedItem (line 167) | private function findEquippedItem(ItemId $itemId):? InventoryItem
method findEquippedItemOfType (line 174) | private function findEquippedItemOfType(ItemType $type):? InventoryItem
method getEquippedItems (line 181) | private function getEquippedItems(): Collection
FILE: app/Modules/Equipment/Domain/InventoryId.php
class InventoryId (line 9) | class InventoryId extends BaseId
FILE: app/Modules/Equipment/Domain/InventoryItem.php
class InventoryItem (line 6) | class InventoryItem extends Item
method __construct (line 13) | public function __construct(Item $item, ItemStatus $status)
method getStatus (line 30) | public function getStatus(): ItemStatus
method isEquipped (line 35) | public function isEquipped(): bool
method equip (line 40) | public function equip(): void
method unEquip (line 45) | public function unEquip(): void
FILE: app/Modules/Equipment/Domain/InventorySlot.php
class InventorySlot (line 7) | class InventorySlot
method undefined (line 11) | public static function undefined(): self
method defined (line 16) | public static function defined(int $slot): self
method __construct (line 21) | public function __construct(int $slot)
method getSlot (line 26) | public function getSlot(): int
FILE: app/Modules/Equipment/Domain/Item.php
class Item (line 9) | class Item
method __construct (line 48) | public function __construct(
method getId (line 71) | public function getId(): ItemId
method getName (line 76) | public function getName(): string
method getDescription (line 81) | public function getDescription(): string
method getImageFilePath (line 86) | public function getImageFilePath(): string
method getType (line 91) | public function getType(): ItemType
method getEffects (line 96) | public function getEffects(): Collection
method getPrototypeId (line 101) | public function getPrototypeId(): ItemPrototypeId
method getCreatorCharacterId (line 106) | public function getCreatorCharacterId(): CharacterId
method getItemEffect (line 111) | public function getItemEffect(string $itemEffectType): int
method getEffectsOfType (line 119) | private function getEffectsOfType(string $itemEffectType): Collection
method equals (line 126) | public function equals(Item $otherItem): bool
method isOfType (line 131) | public function isOfType(ItemType $type): bool
method getPrice (line 136) | public function getPrice(): ItemPrice
method changePrice (line 141) | public function changePrice(ItemPrice $price): self
method toBaseItem (line 148) | public function toBaseItem(): Item
FILE: app/Modules/Equipment/Domain/ItemEffect.php
class ItemEffect (line 8) | class ItemEffect
method __construct (line 37) | private function __construct(int $quantity, string $type)
method ofType (line 43) | public static function ofType(int $quantity, string $type): ItemEffect
method damage (line 52) | public static function damage(int $quantity): ItemEffect
method armor (line 57) | public static function armor(int $quantity): ItemEffect
method getQuantity (line 62) | public function getQuantity(): int
method getType (line 67) | public function getType(): string
FILE: app/Modules/Equipment/Domain/ItemId.php
class ItemId (line 9) | class ItemId extends BaseId
FILE: app/Modules/Equipment/Domain/ItemPrice.php
class ItemPrice (line 9) | class ItemPrice
method __construct (line 16) | private function __construct(int $amount)
method ofAmount (line 23) | public static function ofAmount(int $amount): self
method getAmount (line 28) | public function getAmount(): int
FILE: app/Modules/Equipment/Domain/ItemPrototype.php
class ItemPrototype (line 8) | class ItemPrototype
method __construct (line 39) | public function __construct(
method getId (line 57) | public function getId(): ItemPrototypeId
method getName (line 62) | public function getName(): string
method getDescription (line 67) | public function getDescription(): string
method getImageFilePath (line 72) | public function getImageFilePath(): string
method getType (line 77) | public function getType(): ItemType
method getEffects (line 82) | public function getEffects(): Collection
method getPrice (line 87) | public function getPrice(): ItemPrice
FILE: app/Modules/Equipment/Domain/ItemPrototypeId.php
class ItemPrototypeId (line 9) | class ItemPrototypeId extends BaseId
FILE: app/Modules/Equipment/Domain/ItemStatus.php
class ItemStatus (line 7) | class ItemStatus
method __construct (line 22) | private function __construct(string $type)
method ofStatus (line 27) | public static function ofStatus(string $status): self
method inBackpack (line 36) | public static function inBackpack(): self
method equipped (line 41) | public static function equipped(): self
method toString (line 46) | public function toString(): string
method equals (line 51) | public function equals(self $type): bool
FILE: app/Modules/Equipment/Domain/ItemType.php
class ItemType (line 7) | class ItemType
method __construct (line 28) | private function __construct(string $type)
method ofType (line 33) | public static function ofType(string $type): ItemType
method headGear (line 42) | public static function headGear(): ItemType
method bodyArmor (line 47) | public static function bodyArmor(): ItemType
method mainHand (line 52) | public static function mainHand(): ItemType
method offHand (line 57) | public static function offHand(): ItemType
method toString (line 62) | public function toString(): string
method equals (line 67) | public function equals(ItemType $type): bool
FILE: app/Modules/Equipment/Domain/Money.php
class Money (line 10) | class Money
method __construct (line 17) | public function __construct(int $value)
method getValue (line 27) | public function getValue(): int
method remove (line 32) | public function remove(Money $money): self
method combine (line 41) | public function combine(Money $money): self
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryItemReconstitutionFactory.php
class InventoryItemReconstitutionFactory (line 11) | class InventoryItemReconstitutionFactory
method __construct (line 18) | public function __construct(ItemReconstitutionFactory $itemReconstitut...
method reconstitute (line 23) | public function reconstitute(ItemModel $model): InventoryItem
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryReconstitutionFactory.php
class InventoryReconstitutionFactory (line 13) | class InventoryReconstitutionFactory
method __construct (line 20) | public function __construct(InventoryItemReconstitutionFactory $invent...
method reconstitute (line 25) | public function reconstitute(InventoryModel $inventoryModel): Inventory
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemPrototypeReconstitutionFactory.php
class ItemPrototypeReconstitutionFactory (line 15) | class ItemPrototypeReconstitutionFactory
method reconstitute (line 17) | public function reconstitute(ItemPrototypeModel $model): ItemPrototype
FILE: app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemReconstitutionFactory.php
class ItemReconstitutionFactory (line 17) | class ItemReconstitutionFactory
method reconstitute (line 19) | public function reconstitute(ItemModel $model): Item
FILE: app/Modules/Equipment/Infrastructure/Repositories/InventoryRepository.php
class InventoryRepository (line 15) | class InventoryRepository implements InventoryRepositoryInterface
method __construct (line 24) | public function __construct(InventoryReconstitutionFactory $reconstitu...
method nextIdentity (line 34) | public function nextIdentity(): InventoryId
method add (line 39) | public function add(Inventory $inventory): void
method forCharacter (line 48) | public function forCharacter(CharacterId $characterId): Inventory
method update (line 56) | public function update(Inventory $inventory): void
FILE: app/Modules/Equipment/Infrastructure/Repositories/ItemPrototypeRepository.php
class ItemPrototypeRepository (line 13) | class ItemPrototypeRepository implements ItemPrototypeRepositoryInterface
method __construct (line 22) | public function __construct(ItemPrototypeReconstitutionFactory $recons...
method nextIdentity (line 32) | public function nextIdentity(): ItemPrototypeId
method getOne (line 37) | public function getOne(ItemPrototypeId $itemPrototypeId): ItemPrototype
FILE: app/Modules/Equipment/Infrastructure/Repositories/ItemRepository.php
class ItemRepository (line 14) | class ItemRepository implements ItemRepositoryInterface
method __construct (line 23) | public function __construct(ItemReconstitutionFactory $reconstitutionF...
method nextIdentity (line 33) | public function nextIdentity(): ItemId
method add (line 38) | public function add(Item $item): void
method getOne (line 66) | public function getOne(ItemId $itemId): Item
method update (line 74) | public function update(Item $item): void
FILE: app/Modules/Equipment/UI/Http/CommandMappers/AddItemToInventoryCommandMapper.php
class AddItemToInventoryCommandMapper (line 11) | class AddItemToInventoryCommandMapper
method map (line 13) | public function map(Request $request): AddItemToInventoryCommand
FILE: app/Modules/Equipment/UI/Http/CommandMappers/CreateItemCommandMapper.php
class CreateItemCommandMapper (line 11) | class CreateItemCommandMapper
method map (line 13) | public function map(Request $request): CreateItemCommand
FILE: app/Modules/Equipment/UI/Http/CommandMappers/EquipItemCommandMapper.php
class EquipItemCommandMapper (line 11) | class EquipItemCommandMapper
method map (line 13) | public function map(Request $request): EquipItemCommand
FILE: app/Modules/Generic/Domain/BaseId.php
class BaseId (line 5) | abstract class BaseId
method __construct (line 12) | private function __construct(string $id)
method fromString (line 22) | public static function fromString(string $id)
method toString (line 27) | public function toString(): string
method equals (line 32) | public function equals(BaseId $otherId): bool
FILE: app/Modules/Generic/Domain/Container.php
class Container (line 9) | abstract class Container
FILE: app/Modules/Generic/Domain/Container/ContainerIsFullException.php
class ContainerIsFullException (line 7) | class ContainerIsFullException extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/ContainerSlotIsTakenException.php
class ContainerSlotIsTakenException (line 7) | class ContainerSlotIsTakenException extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/ContainerSlotOutOfRangeException.php
class ContainerSlotOutOfRangeException (line 7) | class ContainerSlotOutOfRangeException extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/InvalidMoneyValue.php
class InvalidMoneyValue (line 8) | class InvalidMoneyValue extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/ItemNotInContainer.php
class ItemNotInContainer (line 8) | class ItemNotInContainer extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/NotEnoughMoneyToRemove.php
class NotEnoughMoneyToRemove (line 8) | class NotEnoughMoneyToRemove extends RuntimeException
FILE: app/Modules/Generic/Domain/Container/NotEnoughSpaceInContainerException.php
class NotEnoughSpaceInContainerException (line 7) | class NotEnoughSpaceInContainerException extends RuntimeException
FILE: app/Modules/Generic/Domain/ContainerType.php
class ContainerType (line 9) | class ContainerType
method fromString (line 24) | public static function fromString(string $type)
method __construct (line 29) | private function __construct(string $type)
method getType (line 38) | public function getType(): string
method isStore (line 43) | public function isStore(): bool
FILE: app/Modules/Image/Application/Commands/AddImageCommand.php
class AddImageCommand (line 9) | class AddImageCommand
method __construct (line 21) | public function __construct(CharacterId $characterId, UploadedFile $up...
method getCharacterId (line 27) | public function getCharacterId(): CharacterId
method getUploadedFile (line 32) | public function getUploadedFile(): UploadedFile
FILE: app/Modules/Image/Application/Contracts/ImageRepositoryInterface.php
type ImageRepositoryInterface (line 12) | interface ImageRepositoryInterface
method nextIdentity (line 14) | public function nextIdentity(): ImageId;
method add (line 16) | public function add(Image $image, UploadedFile $uploadedFile): void;
method delete (line 18) | public function delete(CharacterId $characterId): void;
FILE: app/Modules/Image/Application/Factories/ImageFactory.php
class ImageFactory (line 12) | class ImageFactory
method create (line 14) | public function create(ImageId $imageId, CharacterId $characterId, str...
FILE: app/Modules/Image/Application/Services/ProfilePictureService.php
class ProfilePictureService (line 12) | class ProfilePictureService
method __construct (line 27) | public function __construct(
method update (line 37) | public function update(AddImageCommand $command): void
method delete (line 54) | public function delete(CharacterId $characterId): void
FILE: app/Modules/Image/Domain/Image.php
class Image (line 7) | class Image
method __construct (line 30) | public function __construct(
method getId (line 44) | public function getId(): ImageId
method getCharacterId (line 49) | public function getCharacterId(): CharacterId
method getFullSizeFile (line 54) | public function getFullSizeFile(): ImageFile
method getSmallSizeFile (line 59) | public function getSmallSizeFile(): ImageFile
method getIconSizeFile (line 64) | public function getIconSizeFile(): ImageFile
FILE: app/Modules/Image/Domain/ImageFile.php
class ImageFile (line 6) | class ImageFile
method __construct (line 21) | private function __construct(string $fileName, int $width)
method full (line 27) | public static function full(string $fileName): self
method small (line 32) | public static function small(string $fileName): self
method icon (line 37) | public static function icon(string $fileName): self
method getFileName (line 42) | public function getFileName(): string
method getWidth (line 47) | public function getWidth(): int
FILE: app/Modules/Image/Domain/ImageId.php
class ImageId (line 9) | class ImageId extends BaseId
FILE: app/Modules/Image/Infrastructure/Repositories/ImageRepository.php
class ImageRepository (line 19) | class ImageRepository implements ImageRepositoryInterface
method __construct (line 32) | public function __construct(Filesystem $filesystem, ImageManager $imag...
method nextIdentity (line 43) | public function nextIdentity(): ImageId
method add (line 48) | public function add(Image $image, UploadedFile $uploadedFile): void
method delete (line 63) | public function delete(CharacterId $characterId): void
method writeFiles (line 70) | private function writeFiles(Image $image, UploadedFile $uploadedFile):...
method writeFile (line 83) | private function writeFile(
method createFolderIfMissing (line 100) | private function createFolderIfMissing(string $fullFolderPath): bool
method getFolderPath (line 106) | private function getFolderPath(CharacterId $characterId): string
method getUrlPath (line 115) | private function getUrlPath(CharacterId $characterId): string
method getCharacterImageFolder (line 120) | private function getCharacterImageFolder(CharacterId $characterId): st...
FILE: app/Modules/Image/UI/Http/CommandMappers/AddImageCommandMapper.php
class AddImageCommandMapper (line 10) | class AddImageCommandMapper
method map (line 12) | public function map(string $characterId, UploadedFile $uploadedFile): ...
FILE: app/Modules/Level/Application/Services/LevelService.php
class LevelService (line 8) | class LevelService
method getLevelByXp (line 10) | public function getLevelByXp(int $xp): Level
method getLevel (line 21) | public function getLevel(int $levelId): Level
method getLevels (line 26) | public function getLevels(int $limit = 100): array
method getLevelThreshold (line 45) | private function getLevelThreshold(int $levelId): float
FILE: app/Modules/Level/Domain/Level.php
class Level (line 7) | class Level
method __construct (line 22) | public function __construct(int $id, int $currentLevelThreshHold, int ...
method getId (line 29) | public function getId(): int
method getCurrentXpThreshold (line 34) | public function getCurrentXpThreshold(): int
method getNextXpThreshold (line 39) | public function getNextXpThreshold(): int
method getProgress (line 44) | public function getProgress(int $xp):float
FILE: app/Modules/Message/Application/Commands/SendMessageCommand.php
class SendMessageCommand (line 9) | class SendMessageCommand
method __construct (line 24) | public function __construct(CharacterId $senderId, CharacterId $recipi...
method getSenderId (line 31) | public function getSenderId(): CharacterId
method getRecipientId (line 36) | public function getRecipientId(): CharacterId
method getContent (line 41) | public function getContent(): string
FILE: app/Modules/Message/Application/Contracts/MessageRepositoryInterface.php
type MessageRepositoryInterface (line 9) | interface MessageRepositoryInterface
method nextIdentity (line 11) | public function nextIdentity(): MessageId;
method add (line 13) | public function add(Message $message):void;
FILE: app/Modules/Message/Application/Services/MessageService.php
class MessageService (line 11) | class MessageService
method __construct (line 18) | public function __construct(MessageRepositoryInterface $messageReposit...
method send (line 23) | public function send(SendMessageCommand $command): void
FILE: app/Modules/Message/Domain/Message.php
class Message (line 8) | class Message
method __construct (line 34) | public function __construct(
method getId (line 48) | public function getId(): MessageId
method getSenderId (line 53) | public function getSenderId(): CharacterId
method getRecipientId (line 58) | public function getRecipientId(): CharacterId
method getContent (line 63) | public function getContent(): string
method getState (line 68) | public function getState(): string
FILE: app/Modules/Message/Domain/MessageId.php
class MessageId (line 9) | class MessageId extends BaseId
FILE: app/Modules/Message/Infrastructure/Repositories/MessageRepository.php
class MessageRepository (line 12) | class MessageRepository implements MessageRepositoryInterface
method nextIdentity (line 21) | public function nextIdentity(): MessageId
method add (line 26) | public function add(Message $message): void
FILE: app/Modules/Message/UI/Http/CommandMappers/SendMessageCommandMapper.php
class SendMessageCommandMapper (line 11) | class SendMessageCommandMapper
method map (line 13) | public function map(Request $request): SendMessageCommand
FILE: app/Modules/Trade/Application/Commands/AddItemToStoreCommand.php
class AddItemToStoreCommand (line 8) | class AddItemToStoreCommand
method __construct (line 23) | public function __construct(CharacterId $characterId, int $slot, ItemI...
method getCharacterId (line 30) | public function getCharacterId(): CharacterId
method getSlot (line 35) | public function getSlot(): int
method getItemId (line 40) | public function getItemId(): ItemId
FILE: app/Modules/Trade/Application/Commands/BuyItemCommand.php
class BuyItemCommand (line 9) | class BuyItemCommand
method __construct (line 24) | public function __construct(CharacterId $customerId, StoreId $storeId,...
method getCustomerId (line 31) | public function getCustomerId(): CharacterId
method getStoreId (line 36) | public function getStoreId(): StoreId
method getItemId (line 41) | public function getItemId(): ItemId
FILE: app/Modules/Trade/Application/Commands/ChangeItemPriceCommand.php
class ChangeItemPriceCommand (line 10) | class ChangeItemPriceCommand
method __construct (line 29) | public function __construct(
method getItemId (line 41) | public function getItemId(): ItemId
method getItemPrice (line 46) | public function getItemPrice(): ItemPrice
method getCharacterId (line 51) | public function getCharacterId(): CharacterId
method getContainerType (line 56) | public function getContainerType(): ContainerType
FILE: app/Modules/Trade/Application/Commands/CreateStoreCommand.php
class CreateStoreCommand (line 9) | class CreateStoreCommand
method __construct (line 16) | public function __construct(CharacterId $characterId)
method getCharacterId (line 21) | public function getCharacterId(): CharacterId
FILE: app/Modules/Trade/Application/Commands/MoveItemToContainerCommand.php
class MoveItemToContainerCommand (line 8) | class MoveItemToContainerCommand
method __construct (line 19) | public function __construct(ItemId $itemId, CharacterId $characterId)
method getItemId (line 25) | public function getItemId(): ItemId
method getCharacterId (line 30) | public function getCharacterId(): CharacterId
FILE: app/Modules/Trade/Application/Commands/MoveMoneyToContainerCommand.php
class MoveMoneyToContainerCommand (line 8) | class MoveMoneyToContainerCommand
method __construct (line 19) | public function __construct(Money $money, CharacterId $characterId)
method getMoney (line 25) | public function getMoney(): Money
method getCharacterId (line 30) | public function getCharacterId(): CharacterId
FILE: app/Modules/Trade/Application/Commands/SellItemCommand.php
class SellItemCommand (line 9) | class SellItemCommand
method __construct (line 24) | public function __construct(CharacterId $customerId, StoreId $storeId,...
method getCustomerId (line 31) | public function getCustomerId(): CharacterId
method getStoreId (line 36) | public function getStoreId(): StoreId
method getItemId (line 41) | public function getItemId(): ItemId
FILE: app/Modules/Trade/Application/Contracts/StoreRepositoryInterface.php
type StoreRepositoryInterface (line 9) | interface StoreRepositoryInterface
method nextIdentity (line 11) | public function nextIdentity(): StoreId;
method add (line 13) | public function add(Store $store): void;
method getOne (line 15) | public function getOne(StoreId $storeId): Store;
method forCharacter (line 17) | public function forCharacter(CharacterId $characterId): Store;
method update (line 19) | public function update(Store $store): void;
FILE: app/Modules/Trade/Application/Services/CreateStoreService.php
class CreateStoreService (line 13) | class CreateStoreService
method __construct (line 20) | public function __construct(StoreRepositoryInterface $storeRepository)
method create (line 25) | public function create(CreateStoreCommand $command): Store
FILE: app/Modules/Trade/Application/Services/ManageStoreService.php
class ManageStoreService (line 14) | class ManageStoreService
method __construct (line 29) | public function __construct(
method moveItemToStore (line 40) | public function moveItemToStore(MoveItemToContainerCommand $command): ...
method moveItemToInventory (line 52) | public function moveItemToInventory(MoveItemToContainerCommand $comman...
method changeItemPrice (line 64) | public function changeItemPrice(ChangeItemPriceCommand $command): void
method moveMoneyToStore (line 81) | public function moveMoneyToStore(MoveMoneyToContainerCommand $command)...
method moveMoneyToInventory (line 93) | public function moveMoneyToInventory(MoveMoneyToContainerCommand $comm...
FILE: app/Modules/Trade/Application/Services/TradeService.php
class TradeService (line 16) | class TradeService
method __construct (line 35) | public function __construct(
method buyItem (line 48) | public function buyItem(BuyItemCommand $command): void
method sellItem (line 62) | public function sellItem(SellItemCommand $command): void
FILE: app/Modules/Trade/Domain/Exception/SellPriceIsTooHigh.php
class SellPriceIsTooHigh (line 8) | class SellPriceIsTooHigh extends RuntimeException
FILE: app/Modules/Trade/Domain/Store.php
class Store (line 18) | class Store
method __construct (line 47) | public function __construct(StoreId $id, CharacterId $characterId, Sto...
method getId (line 62) | public function getId(): StoreId
method addItemToSlot (line 67) | public function addItemToSlot(int $slot, Item $item): void
method add (line 80) | public function add(Item $item): void
method findFreeSlot (line 87) | private function findFreeSlot(): int
method findItem (line 98) | public function findItem(ItemId $itemId): ?Item
method findItemsOfType (line 105) | public function findItemsOfType(ItemType $type): Collection
method getCharacterId (line 112) | public function getCharacterId(): CharacterId
method getItems (line 117) | public function getItems(): Collection
method takeOut (line 122) | public function takeOut(ItemId $itemId): Item
method putMoneyIn (line 140) | public function putMoneyIn(Money $money): void
method takeMoneyOut (line 145) | public function takeMoneyOut(Money $money): Money
method getMoney (line 156) | public function getMoney(): Money
FILE: app/Modules/Trade/Domain/Store/StoreDoesNotBuyItems.php
class StoreDoesNotBuyItems (line 9) | class StoreDoesNotBuyItems extends RuntimeException
FILE: app/Modules/Trade/Domain/StoreId.php
class StoreId (line 9) | class StoreId extends BaseId
FILE: app/Modules/Trade/Domain/StoreType.php
class StoreType (line 7) | class StoreType
method __construct (line 22) | private function __construct(string $type)
method ofType (line 27) | public static function ofType(string $type): self
method buyAndSell (line 36) | public static function buyAndSell(): self
method sellOnly (line 41) | public static function sellOnly(): self
method toString (line 46) | public function toString(): string
method isSellOnly (line 51) | public function isSellOnly(): bool
FILE: app/Modules/Trade/Infrastructure/ReconstitutionFactories/StoreReconstitutionFactory.php
class StoreReconstitutionFactory (line 15) | class StoreReconstitutionFactory
method __construct (line 22) | public function __construct(ItemReconstitutionFactory $itemReconstitut...
method reconstitute (line 27) | public function reconstitute(StoreModel $storeModel): Store
FILE: app/Modules/Trade/Infrastructure/Repositories/StoreRepository.php
class StoreRepository (line 15) | class StoreRepository implements StoreRepositoryInterface
method __construct (line 24) | public function __construct(StoreReconstitutionFactory $reconstitution...
method nextIdentity (line 34) | public function nextIdentity(): StoreId
method add (line 39) | public function add(Store $store): void
method getOne (line 48) | public function getOne(StoreId $storeId): Store
method forCharacter (line 56) | public function forCharacter(CharacterId $characterId): Store
method update (line 64) | public function update(Store $store): void
FILE: app/Modules/Trade/UI/Http/CommandMappers/BuyItemCommandMapper.php
class BuyItemCommandMapper (line 13) | class BuyItemCommandMapper
method map (line 15) | public function map(Request $request): BuyItemCommand
FILE: app/Modules/Trade/UI/Http/CommandMappers/ChangeItemPriceCommandMapper.php
class ChangeItemPriceCommandMapper (line 13) | class ChangeItemPriceCommandMapper
method map (line 15) | public function map(Request $request): ChangeItemPriceCommand
FILE: app/Modules/Trade/UI/Http/CommandMappers/MoveItemToContainerCommandMapper.php
class MoveItemToContainerCommandMapper (line 11) | class MoveItemToContainerCommandMapper
method map (line 13) | public function map(Request $request): MoveItemToContainerCommand
FILE: app/Modules/Trade/UI/Http/CommandMappers/MoveMoneyToContainerCommandMapper.php
class MoveMoneyToContainerCommandMapper (line 11) | class MoveMoneyToContainerCommandMapper
method map (line 13) | public function map(Request $request): MoveMoneyToContainerCommand
FILE: app/Modules/Trade/UI/Http/CommandMappers/SellItemCommandMapper.php
class SellItemCommandMapper (line 13) | class SellItemCommandMapper
method map (line 15) | public function map(Request $request): SellItemCommand
FILE: app/Modules/User/Application/Commands/CreateUserCommand.php
class CreateUserCommand (line 7) | class CreateUserCommand
method __construct (line 22) | public function __construct(string $name, string $email, string $passw...
method getName (line 32) | public function getName(): string
method getEmail (line 40) | public function getEmail(): string
method getPassword (line 48) | public function getPassword(): string
FILE: app/Modules/User/Application/Services/UserService.php
class UserService (line 9) | class UserService
method create (line 11) | public function create(CreateUserCommand $command): User
FILE: app/Modules/User/UI/Http/CommandMappers/CreateUserCommandMapper.php
class CreateUserCommandMapper (line 9) | class CreateUserCommandMapper
method map (line 11) | public function map(array $data): CreateUserCommand
FILE: app/Providers/AppServiceProvider.php
class AppServiceProvider (line 28) | class AppServiceProvider extends ServiceProvider
method boot (line 35) | public function boot()
method register (line 45) | public function register()
method registerRepositoryInterfaces (line 50) | protected function registerRepositoryInterfaces(): self
FILE: app/Providers/AuthServiceProvider.php
class AuthServiceProvider (line 7) | class AuthServiceProvider extends ServiceProvider
method boot (line 23) | public function boot()
FILE: app/Providers/BroadcastServiceProvider.php
class BroadcastServiceProvider (line 8) | class BroadcastServiceProvider extends ServiceProvider
method boot (line 15) | public function boot()
FILE: app/Providers/EventServiceProvider.php
class EventServiceProvider (line 8) | class EventServiceProvider extends ServiceProvider
method boot (line 26) | public function boot()
FILE: app/Providers/RouteServiceProvider.php
class RouteServiceProvider (line 11) | class RouteServiceProvider extends ServiceProvider
method boot (line 36) | public function boot()
method configureRateLimiting (line 57) | protected function configureRateLimiting()
FILE: app/Providers/ViewComposerServiceProvider.php
class ViewComposerServiceProvider (line 12) | class ViewComposerServiceProvider extends ServiceProvider
method boot (line 19) | public function boot()
method register (line 35) | public function register()
FILE: app/Support/helpers.php
function ini_size_to_kilo_bytes (line 5) | function ini_size_to_kilo_bytes(string $value): float
function ini_size_to_bytes (line 27) | function ini_size_to_bytes(string $value): float
function bytes_to_kilobytes (line 49) | function bytes_to_kilobytes(float $bytes): float
FILE: app/Traits/GeneratesUuid.php
type GeneratesUuid (line 8) | trait GeneratesUuid
method generateUuid (line 10) | protected function generateUuid(): string
FILE: app/Traits/ThrowsDice.php
type ThrowsDice (line 6) | trait ThrowsDice
method throwTwoDices (line 8) | protected static function throwTwoDices(): int
method throwTreeDices (line 13) | protected static function throwTreeDices(): int
method throwOneDice (line 18) | protected static function throwOneDice(): int
FILE: app/Traits/UsesStringId.php
type UsesStringId (line 6) | trait UsesStringId
method getIncrementing (line 8) | public function getIncrementing()
method getKeyType (line 13) | public function getKeyType()
FILE: database/migrations/2014_10_12_000000_create_users_table.php
class CreateUsersTable (line 7) | class CreateUsersTable extends Migration
method up (line 14) | public function up()
method down (line 32) | public function down()
FILE: database/migrations/2014_10_12_100000_create_password_resets_table.php
class CreatePasswordResetsTable (line 7) | class CreatePasswordResetsTable extends Migration
method up (line 14) | public function up()
method down (line 28) | public function down()
FILE: database/migrations/2017_05_14_055744_create_locations_table.php
class CreateLocationsTable (line 9) | class CreateLocationsTable extends Migration
method up (line 16) | public function up()
method down (line 119) | public function down()
FILE: database/migrations/2017_05_14_055823_create_races_table.php
class CreateRacesTable (line 9) | class CreateRacesTable extends Migration
method up (line 16) | public function up()
method down (line 125) | public function down()
FILE: database/migrations/2017_05_14_055844_create_characters_table.php
class CreateCharactersTable (line 7) | class CreateCharactersTable extends Migration
method up (line 14) | public function up()
method down (line 65) | public function down()
FILE: database/migrations/2017_05_16_144929_create_battles_table.php
class CreateBattlesTable (line 7) | class CreateBattlesTable extends Migration
method up (line 14) | public function up()
method down (line 45) | public function down()
FILE: database/migrations/2017_05_16_181330_create_battle_rounds_table.php
class CreateBattleRoundsTable (line 7) | class CreateBattleRoundsTable extends Migration
method up (line 14) | public function up()
method down (line 32) | public function down()
FILE: database/migrations/2017_05_16_181844_create_battle_turns_table.php
class CreateBattleTurnsTable (line 8) | class CreateBattleTurnsTable extends Migration
method up (line 15) | public function up()
method down (line 45) | public function down()
FILE: database/migrations/2017_11_26_013050_add_user_role_relationship.php
class AddUserRoleRelationship (line 8) | class AddUserRoleRelationship extends Migration
method up (line 15) | public function up()
method down (line 28) | public function down()
FILE: database/migrations/2018_06_24_132346_create_messages_table.php
class CreateMessagesTable (line 7) | class CreateMessagesTable extends Migration
method up (line 14) | public function up()
method down (line 39) | public function down()
FILE: database/migrations/2018_11_19_202701_create_images.php
class CreateImages (line 7) | class CreateImages extends Migration
method up (line 14) | public function up()
method down (line 36) | public function down()
FILE: database/migrations/2019_08_19_000000_create_failed_jobs_table.php
class CreateFailedJobsTable (line 7) | class CreateFailedJobsTable extends Migration
method up (line 14) | public function up()
method down (line 32) | public function down()
FILE: database/migrations/2019_08_31_182034_create_items_table.php
class CreateItemsTable (line 12) | class CreateItemsTable extends Migration
method up (line 21) | public function up()
method down (line 72) | public function down()
method createPrototypes (line 82) | private function createPrototypes(): self
FILE: database/migrations/2020_02_29_205331_create_inventories.php
class CreateInventories (line 7) | class CreateInventories extends Migration
method up (line 14) | public function up()
method down (line 35) | public function down()
FILE: database/migrations/2020_02_29_205957_create_inventory_item.php
class CreateInventoryItem (line 8) | class CreateInventoryItem extends Migration
method up (line 15) | public function up()
method down (line 38) | public function down()
FILE: database/migrations/2020_03_30_133100_create_stores.php
class CreateStores (line 8) | class CreateStores extends Migration
method up (line 15) | public function up()
method down (line 37) | public function down()
FILE: database/migrations/2020_03_30_133448_create_store_item.php
class CreateStoreItem (line 7) | class CreateStoreItem extends Migration
method up (line 14) | public function up()
method down (line 37) | public function down()
FILE: database/seeders/CharacterSeeder.php
class CharacterSeeder (line 20) | class CharacterSeeder extends Seeder
method run (line 27) | public function run()
FILE: database/seeders/DataRowsTableSeeder.php
class DataRowsTableSeeder (line 9) | class DataRowsTableSeeder extends Seeder
method run (line 14) | public function run()
method dataRow (line 365) | protected function dataRow($type, $field)
FILE: database/seeders/DataTypesTableSeeder.php
class DataTypesTableSeeder (line 8) | class DataTypesTableSeeder extends Seeder
method run (line 13) | public function run()
method dataType (line 67) | protected function dataType($field, $for)
FILE: database/seeders/DatabaseSeeder.php
class DatabaseSeeder (line 8) | class DatabaseSeeder extends Seeder
method run (line 15) | public function run()
FILE: database/seeders/MenuItemsTableSeeder.php
class MenuItemsTableSeeder (line 9) | class MenuItemsTableSeeder extends Seeder
method run (line 16) | public function run()
FILE: database/seeders/MenusTableSeeder.php
class MenusTableSeeder (line 8) | class MenusTableSeeder extends Seeder
method run (line 15) | public function run()
FILE: database/seeders/PermissionRoleTableSeeder.php
class PermissionRoleTableSeeder (line 9) | class PermissionRoleTableSeeder extends Seeder
method run (line 16) | public function run()
FILE: database/seeders/PermissionsTableSeeder.php
class PermissionsTableSeeder (line 8) | class PermissionsTableSeeder extends Seeder
method run (line 13) | public function run()
FILE: database/seeders/RolesTableSeeder.php
class RolesTableSeeder (line 8) | class RolesTableSeeder extends Seeder
method run (line 13) | public function run()
FILE: database/seeders/SettingsTableSeeder.php
class SettingsTableSeeder (line 8) | class SettingsTableSeeder extends Seeder
method run (line 13) | public function run()
method findSetting (line 143) | protected function findSetting($key)
FILE: database/seeders/TranslationsTableSeeder.php
class TranslationsTableSeeder (line 12) | class TranslationsTableSeeder extends Seeder
method run (line 19) | public function run()
method categoriesTranslations (line 32) | private function categoriesTranslations()
method dataTypesTranslations (line 53) | private function dataTypesTranslations()
method pagesTranslations (line 119) | private function pagesTranslations()
method menusTranslations (line 147) | private function menusTranslations()
method findMenuItem (line 206) | private function findMenuItem($title)
method arr (line 211) | private function arr($par, $id)
method trans (line 220) | private function trans($lang, $keys, $value)
FILE: database/seeders/UserSeeder.php
class UserSeeder (line 9) | class UserSeeder extends Seeder
method run (line 16) | public function run()
FILE: database/seeders/VoyagerDatabaseSeeder.php
class VoyagerDatabaseSeeder (line 8) | class VoyagerDatabaseSeeder extends Seeder
method run (line 19) | public function run()
FILE: database/seeders/VoyagerDummyDatabaseSeeder.php
class VoyagerDummyDatabaseSeeder (line 8) | class VoyagerDummyDatabaseSeeder extends Seeder
method run (line 19) | public function run()
FILE: public/js/character-create.js
function changeRace (line 9) | function changeRace() {
function changeGender (line 16) | function changeGender() {
FILE: tests/Browser/ExampleTest.php
class ExampleTest (line 9) | class ExampleTest extends DuskTestCase
method testBasicExample (line 18) | public function testBasicExample()
FILE: tests/Browser/Pages/HomePage.php
class HomePage (line 7) | class HomePage extends Page
method url (line 14) | public function url()
method assert (line 25) | public function assert(Browser $browser)
method elements (line 35) | public function elements()
FILE: tests/Browser/Pages/Page.php
class Page (line 7) | abstract class Page extends BasePage
method siteElements (line 14) | public static function siteElements()
FILE: tests/CreatesApplication.php
type CreatesApplication (line 7) | trait CreatesApplication
method createApplication (line 14) | public function createApplication()
FILE: tests/DuskTestCase.php
class DuskTestCase (line 10) | abstract class DuskTestCase extends BaseTestCase
method prepare (line 20) | public static function prepare()
method driver (line 30) | protected function driver()
FILE: tests/Feature/AttackTest.php
class AttackTest (line 11) | class AttackTest extends TestCase
method strong_own_character_wins_while_attacking_basic_opponent (line 18) | public function strong_own_character_wins_while_attacking_basic_oppone...
method basic_own_character_looses_while_attacking_strong_opponent (line 52) | public function basic_own_character_looses_while_attacking_strong_oppo...
FILE: tests/Feature/CharacterCreationTest.php
class CharacterCreationTest (line 13) | class CharacterCreationTest extends TestCase
method an_authenticated_user_without_character_record_is_redirected_to_character_create_page (line 20) | public function an_authenticated_user_without_character_record_is_redi...
method an_authenticated_user_with_character_record_is_redirected_to_character_location_page (line 36) | public function an_authenticated_user_with_character_record_is_redirec...
FILE: tests/Feature/ExampleTest.php
class ExampleTest (line 8) | class ExampleTest extends TestCase
method test_example (line 15) | public function test_example()
FILE: tests/TestCase.php
class TestCase (line 7) | abstract class TestCase extends BaseTestCase
FILE: tests/Unit/ExampleTest.php
class ExampleTest (line 7) | class ExampleTest extends TestCase
method test_example (line 14) | public function test_example()
FILE: tests/Unit/app/Modules/Equipment/Application/Services/ItemServiceTest.php
class ItemServiceTest (line 26) | class ItemServiceTest extends TestCase
method setUp (line 43) | protected function setUp(): void
method testCreate (line 60) | public function testCreate(): void
FILE: tests/Unit/app/Modules/Equipment/Domain/InventoryTest.php
class InventoryTest (line 19) | class InventoryTest extends TestCase
method setUp (line 30) | protected function setUp(): void
method testWillThrowExceptionOnTryingToCreateInventoryWithNonInventoryItems (line 39) | public function testWillThrowExceptionOnTryingToCreateInventoryWithNon...
method testWillThrowExceptionOnTryingToCreateInventoryWithTooManyItems (line 53) | public function testWillThrowExceptionOnTryingToCreateInventoryWithToo...
method testCreatingNewInventoryWithMaximumNumberOfItemsWorks (line 67) | public function testCreatingNewInventoryWithMaximumNumberOfItemsWorks(...
method testCreatingNewInventoryWithNoItemsWorks (line 83) | public function testCreatingNewInventoryWithNoItemsWorks(): void
method testRightAmountOfMoneyAfterPuttingMoneyIn (line 95) | public function testRightAmountOfMoneyAfterPuttingMoneyIn(): void
method testRightAmountOfMoneyAfterPuttingMoreMoneyIn (line 112) | public function testRightAmountOfMoneyAfterPuttingMoreMoneyIn(): void
method testRightAmountOfMoneyAfterTakingMoneyOut (line 132) | public function testRightAmountOfMoneyAfterTakingMoneyOut(): void
method testAddingItemSequentially (line 152) | public function testAddingItemSequentially(): void
method generateItems (line 183) | private function generateItems(int $numberOfItems): Collection
FILE: tests/Unit/app/Modules/Level/Application/Services/LevelServiceTest.php
class LevelServiceTest (line 10) | class LevelServiceTest extends TestCase
method setUp (line 15) | protected function setUp():void
method xpForLevelServiceProvider (line 22) | public function xpForLevelServiceProvider()
method testGetLevelByXp (line 45) | public function testGetLevelByXp(int $xp, int $levelId): void
FILE: tests/Unit/app/Modules/Level/Domain/Entities/LevelTest.php
class LevelTest (line 9) | class LevelTest extends TestCase
method testGetProgress (line 11) | public function testGetProgress()
method testGetProgressWithXpNotInRange (line 20) | public function testGetProgressWithXpNotInRange()
Condensed preview — 371 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (599K chars).
[
{
"path": ".editorconfig",
"chars": 219,
"preview": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 4\ntrim_"
},
{
"path": ".gitattributes",
"chars": 302,
"preview": "* text=auto\n*.css linguist-vendored\n*.scss linguist-vendored\n*.js linguist-vendored\nCHANGELOG.md export-ignore\n\n# Files "
},
{
"path": ".gitignore",
"chars": 275,
"preview": "/node_modules\n/public/hot\n/public/storage\n/public/css/app.css\n/public/fonts/\n/public/js/app.js\n/storage/*.key\n/vendor\n/."
},
{
"path": ".styleci.yml",
"chars": 180,
"preview": "php:\n preset: laravel\n disabled:\n - no_unused_imports\n finder:\n not-name:\n - index.php\n - server.php\n"
},
{
"path": ".travis.yml",
"chars": 457,
"preview": "language: php\n\nphp:\n - 7.3\n\naddons:\n chrome: stable\n\ninstall:\n - cp .env.example .env\n - travis_retry composer insta"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 3349,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
},
{
"path": "CONTRIBUTING.md",
"chars": 624,
"preview": "# Contributing\n\nThanks for your interest in the project.\nYour contribution is highly appreciated.\nHere are our guideline"
},
{
"path": "LICENSE",
"chars": 1071,
"preview": "MIT License\n\nCopyright (c) 2017 Michael Chekin\n\nPermission is hereby granted, free of charge, to any person obtaining a "
},
{
"path": "app/Console/Kernel.php",
"chars": 1009,
"preview": "<?php\n\nnamespace App\\Console;\n\nuse App\\Models\\Character;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Illuminate\\Foun"
},
{
"path": "app/Exceptions/Handler.php",
"chars": 1709,
"preview": "<?php\n\nnamespace App\\Exceptions;\n\nuse Exception;\nuse Illuminate\\Foundation\\Exceptions\\Handler as ExceptionHandler;\nuse I"
},
{
"path": "app/Http/Controllers/Api/ManageInventoryController.php",
"chars": 1756,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Api;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Modules\\Equipment\\Application\\S"
},
{
"path": "app/Http/Controllers/Api/ManageStoreController.php",
"chars": 3742,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Api;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Modules\\Trade\\Application\\Servi"
},
{
"path": "app/Http/Controllers/Api/TradeController.php",
"chars": 1710,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Api;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Modules\\Trade\\Application\\Servi"
},
{
"path": "app/Http/Controllers/Auth/ConfirmPasswordController.php",
"chars": 965,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Foundation\\Auth\\Confirm"
},
{
"path": "app/Http/Controllers/Auth/ForgotPasswordController.php",
"chars": 667,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Foundation\\Auth\\SendsPa"
},
{
"path": "app/Http/Controllers/Auth/LoginController.php",
"chars": 943,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Foundation\\Auth\\Authent"
},
{
"path": "app/Http/Controllers/Auth/RegisterController.php",
"chars": 2217,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Modules\\User\\Application\\Services\\UserService;\nuse App\\Modules\\User"
},
{
"path": "app/Http/Controllers/Auth/ResetPasswordController.php",
"chars": 785,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Foundation\\Auth\\ResetsP"
},
{
"path": "app/Http/Controllers/Auth/VerificationController.php",
"chars": 1071,
"preview": "<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse Illuminate\\Foundation\\Auth\\Verifie"
},
{
"path": "app/Http/Controllers/BattleController.php",
"chars": 450,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Battle;\n\nclass BattleController extends Controller\n{\n\n public "
},
{
"path": "app/Http/Controllers/CharacterBattleController.php",
"chars": 318,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\n\nclass CharacterBattleController extends Controller\n{\n"
},
{
"path": "app/Http/Controllers/CharacterController.php",
"chars": 3467,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\nuse App\\Modules\\Character\\Application\\Services\\Charact"
},
{
"path": "app/Http/Controllers/CharacterMessageController.php",
"chars": 960,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\nuse App\\Modules\\Message\\Application\\Services\\MessageSe"
},
{
"path": "app/Http/Controllers/CharacterStoreController.php",
"chars": 661,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\nuse Illuminate\\Contracts\\View\\View;\nuse Illuminate\\Htt"
},
{
"path": "app/Http/Controllers/Controller.php",
"chars": 361,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Foundation\\Bus\\DispatchesJobs;\nuse Illuminate\\Routing\\Controller "
},
{
"path": "app/Http/Controllers/InventoryController.php",
"chars": 2196,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\nuse App\\Modules\\Equipment\\Application\\Services\\Invento"
},
{
"path": "app/Http/Controllers/ItemCreateController.php",
"chars": 884,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Requests\\CreateItemRequest;\nuse App\\Modules\\Equipment\\Application\\S"
},
{
"path": "app/Http/Controllers/LocationController.php",
"chars": 705,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Location;\n\nclass LocationController extends Controller\n{\n\n pub"
},
{
"path": "app/Http/Controllers/MessageController.php",
"chars": 299,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\View\\View;\n\nclass MessageController extends Controller\n{\n publ"
},
{
"path": "app/Http/Controllers/OwnStoreController.php",
"chars": 528,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Models\\Character;\nuse Illuminate\\Contracts\\View\\View;\nuse Illuminate\\Htt"
},
{
"path": "app/Http/Controllers/ProfilePictureController.php",
"chars": 1117,
"preview": "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Requests\\UploadImageRequest;\nuse App\\Modules\\Character\\Domain\\Chara"
},
{
"path": "app/Http/Kernel.php",
"chars": 2892,
"preview": "<?php\n\nnamespace App\\Http;\n\nuse Illuminate\\Foundation\\Http\\Kernel as HttpKernel;\n\nclass Kernel extends HttpKernel\n{\n "
},
{
"path": "app/Http/Middleware/Authenticate.php",
"chars": 464,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Auth\\Middleware\\Authenticate as Middleware;\n\nclass Authenticate ex"
},
{
"path": "app/Http/Middleware/CanAttack.php",
"chars": 1269,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\Character;\nuse App\\Models\\User;\nuse Closure;\nuse Illuminate\\Http\\R"
},
{
"path": "app/Http/Middleware/CanMoveToLocation.php",
"chars": 1045,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\Character;\nuse App\\Models\\Location;\nuse Closure;\nuse Illuminate\\Ht"
},
{
"path": "app/Http/Middleware/EncryptCookies.php",
"chars": 294,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Cookie\\Middleware\\EncryptCookies as Middleware;\n\nclass EncryptCook"
},
{
"path": "app/Http/Middleware/HasCharacter.php",
"chars": 535,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\User;\nuse Closure;\n\nclass HasCharacter\n{\n /**\n * Handle an "
},
{
"path": "app/Http/Middleware/IsAdmin.php",
"chars": 512,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\User;\nuse Closure;\n\nclass IsAdmin\n{\n /**\n * Handle an incom"
},
{
"path": "app/Http/Middleware/IsCharacterLocation.php",
"chars": 653,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\User;\nuse Closure;\n\nclass IsCharacterLocation\n{\n /**\n * Han"
},
{
"path": "app/Http/Middleware/NoCharacterYet.php",
"chars": 516,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\User;\nuse Closure;\n\nclass NoCharacterYet\n{\n /**\n * Handle a"
},
{
"path": "app/Http/Middleware/PreventRequestsDuringMaintenance.php",
"chars": 352,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance as Mid"
},
{
"path": "app/Http/Middleware/RedirectIfAuthenticated.php",
"chars": 733,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Providers\\RouteServiceProvider;\nuse Closure;\nuse Illuminate\\Http\\Request;"
},
{
"path": "app/Http/Middleware/TrimStrings.php",
"chars": 368,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Foundation\\Http\\Middleware\\TrimStrings as Middleware;\n\nclass TrimS"
},
{
"path": "app/Http/Middleware/TrustHosts.php",
"chars": 353,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Illuminate\\Http\\Middleware\\TrustHosts as Middleware;\n\nclass TrustHosts extend"
},
{
"path": "app/Http/Middleware/TrustProxies.php",
"chars": 584,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Fideloper\\Proxy\\TrustProxies as Middleware;\nuse Illuminate\\Http\\Request;\n\ncla"
},
{
"path": "app/Http/Middleware/UpdateLastUserActivity.php",
"chars": 505,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\User;\nuse Closure;\n\nclass UpdateLastUserActivity\n{\n /**\n * "
},
{
"path": "app/Http/Middleware/UserOwnsCharacter.php",
"chars": 686,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse App\\Models\\Character;\nuse App\\Models\\User;\nuse Closure;\n\nclass UserOwnsCharac"
},
{
"path": "app/Http/Middleware/VerifyCsrfToken.php",
"chars": 708,
"preview": "<?php\n\nnamespace App\\Http\\Middleware;\n\nuse Closure;\nuse Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken as Middlew"
},
{
"path": "app/Http/Requests/CreateCharacterRequest.php",
"chars": 639,
"preview": "<?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\n\nclass CreateCharacterRequest extends F"
},
{
"path": "app/Http/Requests/CreateItemRequest.php",
"chars": 522,
"preview": "<?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\n\nclass CreateItemRequest extends FormRe"
},
{
"path": "app/Http/Requests/UpdateCharacterAttributeRequest.php",
"chars": 583,
"preview": "<?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\n\nclass UpdateCharacterAttributeRequest "
},
{
"path": "app/Http/Requests/UploadImageRequest.php",
"chars": 583,
"preview": "<?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\n\nclass UploadImageRequest extends FormR"
},
{
"path": "app/Http/ViewComposers/BattlesComposer.php",
"chars": 1180,
"preview": "<?php\n\nnamespace App\\Http\\ViewComposers;\n\nuse App\\Models\\Battle;\nuse App\\Models\\Character;\nuse Illuminate\\Database\\Eloqu"
},
{
"path": "app/Http/ViewComposers/CharacterGeneralInfoComposer.php",
"chars": 816,
"preview": "<?php\n\nnamespace App\\Http\\ViewComposers;\n\nuse App\\Models\\Character;\nuse App\\Modules\\Level\\Application\\Services\\LevelServ"
},
{
"path": "app/Http/ViewComposers/CharacterMessagesComposer.php",
"chars": 1435,
"preview": "<?php\n\nnamespace App\\Http\\ViewComposers;\n\nuse App\\Models\\Character;\nuse App\\Models\\Message;\nuse Illuminate\\Database\\Eloq"
},
{
"path": "app/Http/ViewComposers/MessagesComposer.php",
"chars": 1424,
"preview": "<?php\n\nnamespace App\\Http\\ViewComposers;\n\nuse App\\Models\\Character;\nuse App\\Models\\Message;\nuse Illuminate\\Database\\Quer"
},
{
"path": "app/Models/Battle.php",
"chars": 1815,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\D"
},
{
"path": "app/Models/BattleRound.php",
"chars": 370,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Databa"
},
{
"path": "app/Models/BattleTurn.php",
"chars": 538,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Databa"
},
{
"path": "app/Models/Character.php",
"chars": 7494,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Modules\\Character\\Domain\\CharacterType;\nuse App\\Modules\\Equipment\\Domain\\ItemStatu"
},
{
"path": "app/Models/Image.php",
"chars": 806,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Model;\n\n/**\n * @property str"
},
{
"path": "app/Models/Inventory.php",
"chars": 1078,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\D"
},
{
"path": "app/Models/Item.php",
"chars": 2165,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Modules\\Equipment\\Domain\\ItemStatus;\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\D"
},
{
"path": "app/Models/ItemPrototype.php",
"chars": 1039,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Model;\n\n/**\n * @property str"
},
{
"path": "app/Models/Location.php",
"chars": 3566,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Carbon\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Collectio"
},
{
"path": "app/Models/Message.php",
"chars": 1756,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Databa"
},
{
"path": "app/Models/Race.php",
"chars": 1763,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\n/**\n * @property string name\n * @property string "
},
{
"path": "app/Models/Store.php",
"chars": 1204,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse App\\Traits\\UsesStringId;\nuse Illuminate\\Database\\Eloquent\\Collection;\nuse Illuminate\\D"
},
{
"path": "app/Models/User.php",
"chars": 1898,
"preview": "<?php\n\nnamespace App\\Models;\n\nuse Carbon\\Carbon;\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\nuse Illuminate\\D"
},
{
"path": "app/Modules/Battle/Application/Contracts/BattleRepositoryInterface.php",
"chars": 272,
"preview": "<?php\n\nnamespace App\\Modules\\Battle\\Application\\Contracts;\n\nuse App\\Modules\\Battle\\Domain\\Battle;\nuse App\\Modules\\Battle"
},
{
"path": "app/Modules/Battle/Domain/Battle.php",
"chars": 2866,
"preview": "<?php\n\nnamespace App\\Modules\\Battle\\Domain;\n\nuse App\\Modules\\Character\\Domain\\Character;\nuse App\\Traits\\GeneratesUuid;\n\n"
},
{
"path": "app/Modules/Battle/Domain/BattleId.php",
"chars": 146,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass Ba"
},
{
"path": "app/Modules/Battle/Domain/BattleRound.php",
"chars": 1653,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\nuse App\\Modules\\Character\\Domain\\Character;\nuse App\\Traits\\GeneratesUuid;\n"
},
{
"path": "app/Modules/Battle/Domain/BattleRounds.php",
"chars": 126,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nclass BattleRounds extends Collection"
},
{
"path": "app/Modules/Battle/Domain/BattleTurn.php",
"chars": 2504,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\nuse App\\Modules\\Character\\Domain\\Character;\nuse App\\Traits\\ThrowsDice;\n\n\nc"
},
{
"path": "app/Modules/Battle/Domain/BattleTurnResult.php",
"chars": 1450,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\n\nclass BattleTurnResult\n{\n const NONE = 'none';\n const MISS = 'miss'"
},
{
"path": "app/Modules/Battle/Domain/BattleTurns.php",
"chars": 125,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nclass BattleTurns extends Collection\n"
},
{
"path": "app/Modules/Battle/Infrastructure/Repositories/BattleRepository.php",
"chars": 2115,
"preview": "<?php\n\n\nnamespace App\\Modules\\Battle\\Infrastructure\\Repositories;\n\n\nuse App\\Modules\\Battle\\Application\\Contracts\\BattleR"
},
{
"path": "app/Modules/Character/Application/Commands/AttackCharacterCommand.php",
"chars": 643,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass Att"
},
{
"path": "app/Modules/Character/Application/Commands/CreateCharacterCommand.php",
"chars": 1060,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Commands;\n\n\nclass CreateCharacterCommand\n{\n\n /**\n * @var stri"
},
{
"path": "app/Modules/Character/Application/Commands/IncreaseAttributeCommand.php",
"chars": 630,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass Inc"
},
{
"path": "app/Modules/Character/Application/Commands/MoveCharacterCommand.php",
"chars": 633,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass Mov"
},
{
"path": "app/Modules/Character/Application/Contracts/CharacterRepositoryInterface.php",
"chars": 423,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Application\\Contracts;\n\nuse App\\Modules\\Character\\Domain\\Character;\nuse App\\Modul"
},
{
"path": "app/Modules/Character/Application/Contracts/LocationRepositoryInterface.php",
"chars": 199,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Application\\Contracts;\n\nuse App\\Modules\\Character\\Domain\\LocationId;\n\ninterface L"
},
{
"path": "app/Modules/Character/Application/Contracts/RaceRepositoryInterface.php",
"chars": 188,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Application\\Contracts;\n\nuse App\\Modules\\Character\\Domain\\Race;\n\ninterface RaceRep"
},
{
"path": "app/Modules/Character/Application/Factories/CharacterFactory.php",
"chars": 1655,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Factories;\n\nuse App\\Modules\\Character\\Application\\Commands\\CreateCha"
},
{
"path": "app/Modules/Character/Application/Services/CharacterService.php",
"chars": 5473,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Application\\Services;\n\n\nuse App\\Modules\\Battle\\Application\\Contracts\\BattleRepos"
},
{
"path": "app/Modules/Character/Domain/Attributes.php",
"chars": 1490,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nclass Attributes\n{\n /**\n * "
},
{
"path": "app/Modules/Character/Domain/Character.php",
"chars": 7955,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\nuse App\\Modules\\Equipment\\Domain\\Inventory;\nuse App\\Modules\\Equipment\\D"
},
{
"path": "app/Modules/Character/Domain/CharacterId.php",
"chars": 152,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass"
},
{
"path": "app/Modules/Character/Domain/CharacterType.php",
"chars": 830,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\nuse InvalidArgumentException;\n\nclass CharacterType\n{\n public const P"
},
{
"path": "app/Modules/Character/Domain/Gender.php",
"chars": 294,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nclass Gender\n{\n /**\n * @var string\n */\n private $value;\n"
},
{
"path": "app/Modules/Character/Domain/HitPoints.php",
"chars": 1457,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nuse App\\Traits\\ThrowsDice;\n\nclass HitPoints\n{\n use ThrowsDice;\n\n "
},
{
"path": "app/Modules/Character/Domain/LocationId.php",
"chars": 151,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass"
},
{
"path": "app/Modules/Character/Domain/Name.php",
"chars": 406,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nclass Name\n{\n /**\n * @var string\n */\n private $value;\n\n "
},
{
"path": "app/Modules/Character/Domain/Race.php",
"chars": 2278,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\nclass Race\n{\n /**\n * @var int\n */\n private $id;\n /**\n "
},
{
"path": "app/Modules/Character/Domain/Reputation.php",
"chars": 289,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nclass Reputation\n{\n /**\n * @var int\n */\n private $value;"
},
{
"path": "app/Modules/Character/Domain/Statistics.php",
"chars": 834,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nclass Statistics\n{\n private $st"
},
{
"path": "app/Modules/Character/Infrastructure/ReconstitutionFactories/CharacterReconstitutionFactory.php",
"chars": 2627,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Modules\\Character\\Domain\\Charac"
},
{
"path": "app/Modules/Character/Infrastructure/Repositories/CharacterRepository.php",
"chars": 4092,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Character\\Application\\Contracts\\Cha"
},
{
"path": "app/Modules/Character/Infrastructure/Repositories/LocationRepository.php",
"chars": 524,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Character\\Application\\Contracts\\Loc"
},
{
"path": "app/Modules/Character/Infrastructure/Repositories/RaceRepository.php",
"chars": 1038,
"preview": "<?php\n\nnamespace App\\Modules\\Character\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Character\\Application\\Contracts\\Rac"
},
{
"path": "app/Modules/Character/UI/Http/CommandMappers/AttackCharacterCommandMapper.php",
"chars": 644,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Application\\Commands\\AttackCh"
},
{
"path": "app/Modules/Character/UI/Http/CommandMappers/CreateCharacterCommandMapper.php",
"chars": 683,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Application\\Commands\\CreateCh"
},
{
"path": "app/Modules/Character/UI/Http/CommandMappers/IncreaseAttributeCommandMapper.php",
"chars": 504,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Application\\Commands\\Increase"
},
{
"path": "app/Modules/Character/UI/Http/CommandMappers/MoveCharacterCommandMapper.php",
"chars": 444,
"preview": "<?php\n\n\nnamespace App\\Modules\\Character\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Application\\Commands\\MoveChar"
},
{
"path": "app/Modules/Equipment/Application/Commands/AddItemToInventoryCommand.php",
"chars": 819,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modu"
},
{
"path": "app/Modules/Equipment/Application/Commands/CreateInventoryCommand.php",
"chars": 447,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domai"
},
{
"path": "app/Modules/Equipment/Application/Commands/CreateItemCommand.php",
"chars": 752,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modu"
},
{
"path": "app/Modules/Equipment/Application/Commands/EquipItemCommand.php",
"chars": 673,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modu"
},
{
"path": "app/Modules/Equipment/Application/Contracts/InventoryRepositoryInterface.php",
"chars": 475,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Contracts;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Mod"
},
{
"path": "app/Modules/Equipment/Application/Contracts/ItemPrototypeRepositoryInterface.php",
"chars": 340,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Contracts;\n\nuse App\\Modules\\Equipment\\Domain\\ItemPrototypeId;\nuse App"
},
{
"path": "app/Modules/Equipment/Application/Contracts/ItemRepositoryInterface.php",
"chars": 368,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Contracts;\n\nuse App\\Modules\\Equipment\\Domain\\ItemId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Equipment/Application/Factories/ItemFactory.php",
"chars": 765,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Factories;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Mod"
},
{
"path": "app/Modules/Equipment/Application/Services/InventoryService.php",
"chars": 1590,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Application\\Services;\n\nuse App\\Modules\\Equipment\\Applic"
},
{
"path": "app/Modules/Equipment/Application/Services/ItemService.php",
"chars": 2083,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Application\\Services;\n\nuse App\\Modules\\Character\\Application\\Contracts\\CharacterR"
},
{
"path": "app/Modules/Equipment/Domain/Inventory.php",
"chars": 4829,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\Generic\\Do"
},
{
"path": "app/Modules/Equipment/Domain/InventoryId.php",
"chars": 152,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass"
},
{
"path": "app/Modules/Equipment/Domain/InventoryItem.php",
"chars": 1000,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nclass InventoryItem extends Item\n{\n /**\n * @var ItemStatus\n "
},
{
"path": "app/Modules/Equipment/Domain/InventorySlot.php",
"chars": 463,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nclass InventorySlot\n{\n private $slot;\n\n "
},
{
"path": "app/Modules/Equipment/Domain/Item.php",
"chars": 3452,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse Illuminate\\Support\\Co"
},
{
"path": "app/Modules/Equipment/Domain/ItemEffect.php",
"chars": 1501,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse InvalidArgumentException;\n\nclass ItemEffect\n{\n public const NONE"
},
{
"path": "app/Modules/Equipment/Domain/ItemId.php",
"chars": 147,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass"
},
{
"path": "app/Modules/Equipment/Domain/ItemPrice.php",
"chars": 540,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse Webmozart\\Assert\\Assert;\n\nclass ItemPrice"
},
{
"path": "app/Modules/Equipment/Domain/ItemPrototype.php",
"chars": 1606,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nclass ItemPrototype\n{\n /**\n "
},
{
"path": "app/Modules/Equipment/Domain/ItemPrototypeId.php",
"chars": 156,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass"
},
{
"path": "app/Modules/Equipment/Domain/ItemStatus.php",
"chars": 1066,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\nuse InvalidArgumentException;\n\nclass ItemStatus\n{\n public const EQUIP"
},
{
"path": "app/Modules/Equipment/Domain/ItemType.php",
"chars": 1475,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Domain;\n\nuse InvalidArgumentException;\n\nclass ItemType\n{\n public const MISCELL"
},
{
"path": "app/Modules/Equipment/Domain/Money.php",
"chars": 946,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Equipment\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\Container\\Inva"
},
{
"path": "app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryItemReconstitutionFactory.php",
"chars": 767,
"preview": "<?php\n\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Models\\Item as ItemModel;\nuse A"
},
{
"path": "app/Modules/Equipment/Infrastructure/ReconstitutionFactories/InventoryReconstitutionFactory.php",
"chars": 1333,
"preview": "<?php\n\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Models\\Item as ItemModel;\nuse A"
},
{
"path": "app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemPrototypeReconstitutionFactory.php",
"chars": 1145,
"preview": "<?php\n\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Models\\ItemPrototype as ItemPro"
},
{
"path": "app/Modules/Equipment/Infrastructure/ReconstitutionFactories/ItemReconstitutionFactory.php",
"chars": 1276,
"preview": "<?php\n\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Models\\Item as ItemModel;\nuse A"
},
{
"path": "app/Modules/Equipment/Infrastructure/Repositories/InventoryRepository.php",
"chars": 2482,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\Repositories;\n\nuse App\\Models\\Inventory as InventoryModel;\nuse App"
},
{
"path": "app/Modules/Equipment/Infrastructure/Repositories/ItemPrototypeRepository.php",
"chars": 1330,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\Repositories;\n\nuse App\\Models\\ItemPrototype as ItemPrototypeModel;"
},
{
"path": "app/Modules/Equipment/Infrastructure/Repositories/ItemRepository.php",
"chars": 2877,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\Infrastructure\\Repositories;\n\nuse App\\Models\\Item as ItemModel;\nuse App\\Modules\\E"
},
{
"path": "app/Modules/Equipment/UI/Http/CommandMappers/AddItemToInventoryCommandMapper.php",
"chars": 738,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Mo"
},
{
"path": "app/Modules/Equipment/UI/Http/CommandMappers/CreateItemCommandMapper.php",
"chars": 674,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Mo"
},
{
"path": "app/Modules/Equipment/UI/Http/CommandMappers/EquipItemCommandMapper.php",
"chars": 647,
"preview": "<?php\n\nnamespace App\\Modules\\Equipment\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Mo"
},
{
"path": "app/Modules/Generic/Domain/BaseId.php",
"chars": 597,
"preview": "<?php declare(strict_types=1);\n\nnamespace App\\Modules\\Generic\\Domain;\n\nabstract class BaseId\n{\n /**\n * @var strin"
},
{
"path": "app/Modules/Generic/Domain/Container/ContainerIsFullException.php",
"chars": 139,
"preview": "<?php\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass ContainerIsFullException extends Ru"
},
{
"path": "app/Modules/Generic/Domain/Container/ContainerSlotIsTakenException.php",
"chars": 144,
"preview": "<?php\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass ContainerSlotIsTakenException exten"
},
{
"path": "app/Modules/Generic/Domain/Container/ContainerSlotOutOfRangeException.php",
"chars": 147,
"preview": "<?php\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass ContainerSlotOutOfRangeException ex"
},
{
"path": "app/Modules/Generic/Domain/Container/InvalidMoneyValue.php",
"chars": 158,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass InvalidMo"
},
{
"path": "app/Modules/Generic/Domain/Container/ItemNotInContainer.php",
"chars": 159,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass ItemNotIn"
},
{
"path": "app/Modules/Generic/Domain/Container/NotEnoughMoneyToRemove.php",
"chars": 163,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass NotEnough"
},
{
"path": "app/Modules/Generic/Domain/Container/NotEnoughSpaceInContainerException.php",
"chars": 149,
"preview": "<?php\n\nnamespace App\\Modules\\Generic\\Domain\\Container;\n\nuse RuntimeException;\n\nclass NotEnoughSpaceInContainerException "
},
{
"path": "app/Modules/Generic/Domain/Container.php",
"chars": 200,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Generic\\Domain;\n\n\nuse Illuminate\\Support\\Collection;\n\nabstract cl"
},
{
"path": "app/Modules/Generic/Domain/ContainerType.php",
"chars": 864,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Generic\\Domain;\n\n\nuse InvalidArgumentException;\n\nclass ContainerT"
},
{
"path": "app/Modules/Image/Application/Commands/AddImageCommand.php",
"chars": 687,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse Illuminate\\"
},
{
"path": "app/Modules/Image/Application/Contracts/ImageRepositoryInterface.php",
"chars": 435,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\Application\\Contracts;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modul"
},
{
"path": "app/Modules/Image/Application/Factories/ImageFactory.php",
"chars": 652,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\Application\\Factories;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modul"
},
{
"path": "app/Modules/Image/Application/Services/ProfilePictureService.php",
"chars": 1697,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\Application\\Services;\n\nuse App\\Modules\\Character\\Application\\Services\\CharacterServi"
},
{
"path": "app/Modules/Image/Domain/Image.php",
"chars": 1299,
"preview": "<?php\n\nnamespace App\\Modules\\Image\\Domain;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass Image\n{\n /**\n * "
},
{
"path": "app/Modules/Image/Domain/ImageFile.php",
"chars": 998,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\Domain;\n\nclass ImageFile\n{\n public const IMAGE_WIDTH_FULL = 1000;\n public cons"
},
{
"path": "app/Modules/Image/Domain/ImageId.php",
"chars": 144,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Image\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass Ima"
},
{
"path": "app/Modules/Image/Infrastructure/Repositories/ImageRepository.php",
"chars": 3915,
"preview": "<?php\n\nnamespace App\\Modules\\Image\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\M"
},
{
"path": "app/Modules/Image/UI/Http/CommandMappers/AddImageCommandMapper.php",
"chars": 460,
"preview": "<?php\n\n\nnamespace App\\Modules\\Image\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modul"
},
{
"path": "app/Modules/Level/Application/Services/LevelService.php",
"chars": 1064,
"preview": "<?php\n\n\nnamespace App\\Modules\\Level\\Application\\Services;\n\nuse App\\Modules\\Level\\Domain\\Level;\n\nclass LevelService\n{\n "
},
{
"path": "app/Modules/Level/Domain/Level.php",
"chars": 1105,
"preview": "<?php\n\n\nnamespace App\\Modules\\Level\\Domain;\n\n\nclass Level\n{\n /**\n * @var int\n */\n private $id;\n /**\n "
},
{
"path": "app/Modules/Message/Application/Commands/SendMessageCommand.php",
"chars": 825,
"preview": "<?php\n\n\nnamespace App\\Modules\\Message\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass SendM"
},
{
"path": "app/Modules/Message/Application/Contracts/MessageRepositoryInterface.php",
"chars": 282,
"preview": "<?php\n\n\nnamespace App\\Modules\\Message\\Application\\Contracts;\n\nuse App\\Modules\\Message\\Domain\\MessageId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Message/Application/Services/MessageService.php",
"chars": 833,
"preview": "<?php\n\n\nnamespace App\\Modules\\Message\\Application\\Services;\n\n\nuse App\\Modules\\Message\\Application\\Contracts\\MessageRepos"
},
{
"path": "app/Modules/Message/Domain/Message.php",
"chars": 1280,
"preview": "<?php\n\n\nnamespace App\\Modules\\Message\\Domain;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\n\nclass Message\n{\n public"
},
{
"path": "app/Modules/Message/Domain/MessageId.php",
"chars": 148,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Message\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass M"
},
{
"path": "app/Modules/Message/Infrastructure/Repositories/MessageRepository.php",
"chars": 973,
"preview": "<?php\n\nnamespace App\\Modules\\Message\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Message\\Domain\\MessageId;\nuse App\\Mod"
},
{
"path": "app/Modules/Message/UI/Http/CommandMappers/SendMessageCommandMapper.php",
"chars": 698,
"preview": "<?php\n\n\nnamespace App\\Modules\\Message\\UI\\Http\\CommandMappers;\n\nuse App\\Models\\Character;\nuse App\\Modules\\Character\\Domai"
},
{
"path": "app/Modules/Trade/Application/Commands/AddItemToStoreCommand.php",
"chars": 811,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/Application/Commands/BuyItemCommand.php",
"chars": 866,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/Application/Commands/ChangeItemPriceCommand.php",
"chars": 1260,
"preview": "<?php declare(strict_types=1);\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\Char"
},
{
"path": "app/Modules/Trade/Application/Commands/CreateStoreCommand.php",
"chars": 439,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\n\nuse App\\Modules\\Character\\Domain\\Ch"
},
{
"path": "app/Modules/Trade/Application/Commands/MoveItemToContainerCommand.php",
"chars": 649,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/Application/Commands/MoveMoneyToContainerCommand.php",
"chars": 640,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/Application/Commands/SellItemCommand.php",
"chars": 867,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Commands;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/Application/Contracts/StoreRepositoryInterface.php",
"chars": 481,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Application\\Contracts;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules"
},
{
"path": "app/Modules/Trade/Application/Services/CreateStoreService.php",
"chars": 939,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Application\\Services;\n\nuse App\\Modules\\Equipment\\Domain\\Mon"
},
{
"path": "app/Modules/Trade/Application/Services/ManageStoreService.php",
"chars": 3666,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Application\\Services;\n\nuse App\\Modules\\Equipment\\Applicatio"
},
{
"path": "app/Modules/Trade/Application/Services/TradeService.php",
"chars": 3253,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Application\\Services;\n\nuse App\\Modules\\Equipment\\Applicatio"
},
{
"path": "app/Modules/Trade/Domain/Exception/SellPriceIsTooHigh.php",
"chars": 157,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Domain\\Exception;\n\nuse RuntimeException;\n\nclass SellPriceIs"
},
{
"path": "app/Modules/Trade/Domain/Store/StoreDoesNotBuyItems.php",
"chars": 156,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Domain\\Store;\n\n\nuse RuntimeException;\n\nclass StoreDoesNotBu"
},
{
"path": "app/Modules/Trade/Domain/Store.php",
"chars": 4022,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Domain;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Modules\\Equipment\\Doma"
},
{
"path": "app/Modules/Trade/Domain/StoreId.php",
"chars": 144,
"preview": "<?php declare(strict_types=1);\n\n\nnamespace App\\Modules\\Trade\\Domain;\n\n\nuse App\\Modules\\Generic\\Domain\\BaseId;\n\nclass Sto"
},
{
"path": "app/Modules/Trade/Domain/StoreType.php",
"chars": 1044,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Domain;\n\nuse InvalidArgumentException;\n\nclass StoreType\n{\n public const SELL_ONLY "
},
{
"path": "app/Modules/Trade/Infrastructure/ReconstitutionFactories/StoreReconstitutionFactory.php",
"chars": 1389,
"preview": "<?php\n\n\nnamespace App\\Modules\\Trade\\Infrastructure\\ReconstitutionFactories;\n\nuse App\\Models\\Item as ItemModel;\nuse App\\M"
},
{
"path": "app/Modules/Trade/Infrastructure/Repositories/StoreRepository.php",
"chars": 2543,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\Infrastructure\\Repositories;\n\nuse App\\Modules\\Equipment\\Domain\\Item;\nuse App\\Modules\\"
},
{
"path": "app/Modules/Trade/UI/Http/CommandMappers/BuyItemCommandMapper.php",
"chars": 757,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\UI\\Http\\CommandMappers;\n\nuse App\\Models\\User;\nuse App\\Modules\\Character\\Domain\\Charac"
},
{
"path": "app/Modules/Trade/UI/Http/CommandMappers/ChangeItemPriceCommandMapper.php",
"chars": 896,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Module"
},
{
"path": "app/Modules/Trade/UI/Http/CommandMappers/MoveItemToContainerCommandMapper.php",
"chars": 679,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Module"
},
{
"path": "app/Modules/Trade/UI/Http/CommandMappers/MoveMoneyToContainerCommandMapper.php",
"chars": 680,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\UI\\Http\\CommandMappers;\n\nuse App\\Modules\\Character\\Domain\\CharacterId;\nuse App\\Module"
},
{
"path": "app/Modules/Trade/UI/Http/CommandMappers/SellItemCommandMapper.php",
"chars": 761,
"preview": "<?php\n\nnamespace App\\Modules\\Trade\\UI\\Http\\CommandMappers;\n\nuse App\\Models\\User;\nuse App\\Modules\\Character\\Domain\\Charac"
},
{
"path": "app/Modules/User/Application/Commands/CreateUserCommand.php",
"chars": 804,
"preview": "<?php\n\n\nnamespace App\\Modules\\User\\Application\\Commands;\n\n\nclass CreateUserCommand\n{\n /**\n * @var string\n */\n"
},
{
"path": "app/Modules/User/Application/Services/UserService.php",
"chars": 482,
"preview": "<?php\n\n\nnamespace App\\Modules\\User\\Application\\Services;\n\nuse App\\Modules\\User\\Application\\Commands\\CreateUserCommand;\nu"
},
{
"path": "app/Modules/User/UI/Http/CommandMappers/CreateUserCommandMapper.php",
"chars": 367,
"preview": "<?php\n\n\nnamespace App\\Modules\\User\\UI\\Http\\CommandMappers;\n\n\nuse App\\Modules\\User\\Application\\Commands\\CreateUserCommand"
},
{
"path": "app/Providers/AppServiceProvider.php",
"chars": 3280,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse App\\Modules\\Battle\\Application\\Contracts\\BattleRepositoryInterface;\nuse App\\Modules"
},
{
"path": "app/Providers/AuthServiceProvider.php",
"chars": 535,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse Illuminate\\Foundation\\Support\\Providers\\AuthServiceProvider as ServiceProvider;\n\ncl"
},
{
"path": "app/Providers/BroadcastServiceProvider.php",
"chars": 380,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse Illuminate\\Support\\ServiceProvider;\nuse Illuminate\\Support\\Facades\\Broadcast;\n\nclas"
},
{
"path": "app/Providers/EventServiceProvider.php",
"chars": 571,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse Illuminate\\Support\\Facades\\Event;\nuse Illuminate\\Foundation\\Support\\Providers\\Event"
},
{
"path": "app/Providers/RouteServiceProvider.php",
"chars": 1677,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse Illuminate\\Cache\\RateLimiting\\Limit;\nuse Illuminate\\Foundation\\Support\\Providers\\Ro"
},
{
"path": "app/Providers/ViewComposerServiceProvider.php",
"chars": 953,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse App\\Http\\ViewComposers\\BattlesComposer;\nuse App\\Http\\ViewComposers\\CharacterGeneral"
},
{
"path": "app/Support/helpers.php",
"chars": 1189,
"preview": "<?php\n\nif (! function_exists('ini_size_to_kilo_bytes')) {\n\n function ini_size_to_kilo_bytes(string $value): float\n "
}
]
// ... and 171 more files (download for full content)
About this extraction
This page contains the full source code of the mchekin/rpg GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 371 files (532.7 KB), approximately 131.6k tokens, and a symbol index with 1017 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.