├── .env.dist ├── .github └── CONTRIBUTING.md ├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── bin └── console ├── composer.json ├── composer.lock ├── config ├── bundles.php ├── doctrine │ └── .gitignore ├── jwt │ └── .gitignore ├── packages │ ├── dev │ │ ├── routing.yaml │ │ ├── swiftmailer.yaml │ │ └── web_profiler.yaml │ ├── doctrine.yaml │ ├── doctrine_migrations.yaml │ ├── framework.yaml │ ├── lexik_jwt_authentication.yaml │ ├── nelmio_cors.yaml │ ├── prod │ │ └── doctrine.yaml │ ├── routing.yaml │ ├── security.yaml │ ├── swiftmailer.yaml │ ├── test │ │ ├── framework.yaml │ │ ├── swiftmailer.yaml │ │ └── web_profiler.yaml │ ├── twig.yaml │ └── validator.yaml ├── routes.yaml ├── routes │ └── dev │ │ └── web_profiler.yaml ├── services.yaml └── services │ ├── commands.yaml │ ├── contrib.yaml │ ├── responder.yaml │ └── security.yaml ├── public └── index.php ├── src ├── Command │ ├── EntityDeleteCommand.php │ ├── UserCreateCommand.php │ ├── UserSetPasswordCommand.php │ └── WorldEventSyncCommand.php ├── Contrib │ ├── ApiErrors │ │ ├── InvalidParameterError.php │ │ └── MissingRequiredFieldsError.php │ ├── BucketManager.php │ └── Transformers │ │ ├── AilmentTransformer.php │ │ ├── ArmorSetBonusTransformer.php │ │ ├── ArmorSetTransformer.php │ │ ├── ArmorTransformer.php │ │ ├── BaseTransformer.php │ │ ├── CharmTransformer.php │ │ ├── DecorationTransformer.php │ │ ├── ItemTransformer.php │ │ ├── LocationTransformer.php │ │ ├── MonsterTransformer.php │ │ ├── MotionValueTransformer.php │ │ ├── SkillTransformer.php │ │ ├── UserTransformer.php │ │ └── WeaponTransformer.php ├── Controller │ ├── .gitignore │ ├── AbstractController.php │ ├── AilmentController.php │ ├── ArmorController.php │ ├── ArmorSetBonusController.php │ ├── ArmorSetsController.php │ ├── AuthenticationController.php │ ├── CharmsController.php │ ├── DecorationsController.php │ ├── EventController.php │ ├── ItemsController.php │ ├── LocationController.php │ ├── MonsterController.php │ ├── MonsterRewardsController.php │ ├── MotionValuesController.php │ ├── SkillsController.php │ ├── UserController.php │ └── WeaponsController.php ├── Entity │ ├── .gitignore │ ├── Ailment.php │ ├── AilmentProtection.php │ ├── AilmentRecovery.php │ ├── Ammo.php │ ├── Armor.php │ ├── ArmorAssets.php │ ├── ArmorCraftingInfo.php │ ├── ArmorDefenseValues.php │ ├── ArmorSet.php │ ├── ArmorSetBonus.php │ ├── ArmorSetBonusRank.php │ ├── ArmorSlot.php │ ├── Asset.php │ ├── AttributableTrait.php │ ├── Camp.php │ ├── Charm.php │ ├── CharmRank.php │ ├── CharmRankCraftingInfo.php │ ├── CraftingMaterialCost.php │ ├── Decoration.php │ ├── EntityTrait.php │ ├── Item.php │ ├── Location.php │ ├── Monster.php │ ├── MonsterResistance.php │ ├── MonsterReward.php │ ├── MonsterWeakness.php │ ├── MotionValue.php │ ├── Phial.php │ ├── Resistances.php │ ├── RewardCondition.php │ ├── Shelling.php │ ├── Skill.php │ ├── SkillRank.php │ ├── Slot.php │ ├── SluggableInterface.php │ ├── SluggableTrait.php │ ├── Strings │ │ ├── AilmentStrings.php │ │ ├── ArmorSetBonusStrings.php │ │ ├── ArmorSetStrings.php │ │ ├── ArmorStrings.php │ │ ├── CampStrings.php │ │ ├── CharmRankStrings.php │ │ ├── CharmStrings.php │ │ ├── DecorationStrings.php │ │ ├── ItemStrings.php │ │ ├── LocationStrings.php │ │ ├── MonsterStrings.php │ │ ├── MonsterWeaknessStrings.php │ │ ├── MotionValueStrings.php │ │ ├── SkillRankStrings.php │ │ ├── SkillStrings.php │ │ ├── WeaponStrings.php │ │ └── WorldEventStrings.php │ ├── User.php │ ├── UserRole.php │ ├── Weapon.php │ ├── WeaponAssets.php │ ├── WeaponAttackValues.php │ ├── WeaponCraftingInfo.php │ ├── WeaponElement.php │ ├── WeaponSharpness.php │ ├── WeaponSlot.php │ └── WorldEvent.php ├── Game │ ├── Ailment.php │ ├── AmmoType.php │ ├── ArmorType.php │ ├── Attribute.php │ ├── AttributeSet.php │ ├── BowCoatingType.php │ ├── BowgunDeviation.php │ ├── BowgunSpecialAmmo.php │ ├── DamageType.php │ ├── Elderseal.php │ ├── Element.php │ ├── Expansion.php │ ├── Gender.php │ ├── InsectGlaiveBoostType.php │ ├── MonsterSpecies.php │ ├── MonsterType.php │ ├── PhialType.php │ ├── PlatformExclusivityType.php │ ├── PlatformType.php │ ├── Rank.php │ ├── RawDamageMultiplier.php │ ├── RewardConditionType.php │ ├── Sharpness.php │ ├── ShellingType.php │ ├── WeaponType.php │ └── WorldEventType.php ├── Kernel.php ├── Localization │ ├── L10nUtil.php │ ├── LanguageTag.php │ ├── QueryLocalizationHelper.php │ ├── StringsEntityInterface.php │ ├── StringsEntityTrait.php │ └── TranslatableEntityInterface.php ├── Migrations │ ├── .gitignore │ ├── Version20180305182815.php │ ├── Version20180305213108.php │ ├── Version20180311004633.php │ ├── Version20180314175357.php │ ├── Version20180319155834.php │ ├── Version20180320200544.php │ ├── Version20180323034352.php │ ├── Version20180324193558.php │ ├── Version20180325041554.php │ ├── Version20180330194208.php │ ├── Version20180401034729.php │ ├── Version20180406032338.php │ ├── Version20180417030407.php │ ├── Version20180420125649.php │ ├── Version20180420144556.php │ ├── Version20180420154806.php │ ├── Version20180420180120.php │ ├── Version20180423145852.php │ ├── Version20180424142246.php │ ├── Version20180424202745.php │ ├── Version20180425142735.php │ ├── Version20180425224813.php │ ├── Version20180426174437.php │ ├── Version20180501002023.php │ ├── Version20180504075817.php │ ├── Version20180508195230.php │ ├── Version20180509025030.php │ ├── Version20180509191153.php │ ├── Version20180510043211.php │ ├── Version20180510213010.php │ ├── Version20180511152554.php │ ├── Version20180512214206.php │ ├── Version20180817042139.php │ ├── Version20180820053757.php │ ├── Version20180820133425.php │ ├── Version20180826231029.php │ ├── Version20180827032437.php │ ├── Version20180829031251.php │ ├── Version20180829235530.php │ ├── Version20180831210258.php │ ├── Version20180901231350.php │ ├── Version20180904043326.php │ ├── Version20180904044221.php │ ├── Version20180906174306.php │ ├── Version20180906174847.php │ ├── Version20180926143130.php │ ├── Version20180926174624.php │ ├── Version20180927205355.php │ ├── Version20180927205623.php │ ├── Version20180927210739.php │ ├── Version20190402180838.php │ ├── Version20190402201320.php │ ├── Version20190416060719.php │ ├── Version20190416135847.php │ ├── Version20190420233255.php │ ├── Version20190421032824.php │ ├── Version20190421062414.php │ ├── Version20190421063540.php │ ├── Version20190712201512.php │ ├── Version20190815181742.php │ ├── Version20190815211202.php │ ├── Version20190819180404.php │ ├── Version20190819182923.php │ ├── Version20190913190444.php │ ├── Version20190916180239.php │ ├── Version20190916211506.php │ ├── Version20191216214009.php │ ├── Version20200102185033.php │ ├── Version20200103060043.php │ ├── Version20200205193214.php │ ├── Version20200205205458.php │ └── Version20200205214957.php ├── QueryDocument │ └── ApiQueryManager.php ├── Repository │ ├── .gitignore │ ├── AilmentProtectionRepository.php │ ├── AilmentRecoveryRepository.php │ ├── ArmorRepository.php │ ├── ArmorSetBonusRankRepository.php │ ├── CharmRankRepository.php │ ├── DecorationRepository.php │ ├── LocationRepository.php │ ├── MonsterRepository.php │ └── WorldEventRepository.php ├── Resources │ ├── data │ │ ├── ailments.json │ │ ├── locations.json │ │ ├── missing-skills.json │ │ └── monsters.json │ └── schemas │ │ ├── ailment.schema.json │ │ ├── armor-set.schema.json │ │ ├── armor.schema.json │ │ ├── asset.schema.json │ │ ├── charm.schema.json │ │ ├── damage-element.schema.json │ │ ├── damage-type.schema.json │ │ ├── decoration.schema.json │ │ ├── element.schema.json │ │ ├── entity-reference.schema.json │ │ ├── item.schema.json │ │ ├── location.schema.json │ │ ├── material-cost.schema.json │ │ ├── monster.schema.json │ │ ├── motion-value.schema.json │ │ ├── nullable-entity-reference.schema.json │ │ ├── skill-rank-shorthand.schema.json │ │ ├── skill.schema.json │ │ ├── slot.schema.json │ │ ├── status-element.schema.json │ │ ├── weapon-type.schema.json │ │ └── weapon.schema.json ├── Response │ ├── AccessDeniedError.php │ ├── BadProjectionObjectError.php │ ├── BadQueryObjectError.php │ ├── BadSearchParametersError.php │ ├── ConstraintViolationError.php │ ├── EmptySearchParametersError.php │ ├── NoContentResponse.php │ ├── SearchError.php │ ├── SlugNotSupportedError.php │ └── UnknownWeaponTypeError.php ├── Security │ ├── AuthenticationFailureListener.php │ ├── CustomizePayloadListener.php │ ├── DisabledUserChecker.php │ └── Role.php ├── Serializer │ └── CustomObjectNormalizer.php ├── Utility │ ├── CommandUtil.php │ ├── EntityUtil.php │ ├── NullObject.php │ ├── ObjectUtil.php │ ├── RomanNumeral.php │ └── StringUtil.php └── WorldEvent │ └── WorldEventReader.php ├── symfony.lock ├── templates ├── .gitignore ├── activation-email.html.twig └── password-reset-email.html.twig └── vagrant └── provision.sh /.env.dist: -------------------------------------------------------------------------------- 1 | # This file is a "template" of which env vars need to be defined for your application 2 | # Copy this file to .env file for development, create environment variables when deploying to production 3 | # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration 4 | 5 | ASSETS_BUCKET_NAME="assets.mhw-db.com" 6 | CONTRIB_DOMAIN="^https?://contrib.mhw-db.com" 7 | 8 | ###> symfony/framework-bundle ### 9 | APP_ENV=dev 10 | APP_SECRET=thisisnotsecretchangeit 11 | #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 12 | #TRUSTED_HOSTS=localhost,example.com 13 | ###< symfony/framework-bundle ### 14 | 15 | ###> doctrine/doctrine-bundle ### 16 | # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url 17 | # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" 18 | # Configure your db driver and server_version in config/packages/doctrine.yaml 19 | DATABASE_URL=mysql://root@127.0.0.1:3306/application 20 | ###< doctrine/doctrine-bundle ### 21 | 22 | ###> lexik/jwt-authentication-bundle ### 23 | JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem 24 | JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem 25 | JWT_PASSPHRASE=thisisnotsecretchangeit 26 | ###< lexik/jwt-authentication-bundle ### 27 | 28 | ###> symfony/swiftmailer-bundle ### 29 | # For Gmail as a transport, use: "gmail://username:password@localhost" 30 | # For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" 31 | # Delivery is disabled by default via "null://localhost" 32 | MAILER_URL=null://localhost 33 | ###< symfony/swiftmailer-bundle ### 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.vagrant 3 | /*-cloudimg-console.log 4 | 5 | # Data Repo 6 | /data 7 | 8 | ###> symfony/framework-bundle ### 9 | .env 10 | /public/bundles/ 11 | /var/ 12 | /vendor/ 13 | ###< symfony/framework-bundle ### 14 | ###> lexik/jwt-authentication-bundle ### 15 | /config/jwt/*.pem 16 | ###< lexik/jwt-authentication-bundle ### 17 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | load(__DIR__ . '/../.env'); 23 | } 24 | 25 | $input = new ArgvInput(); 26 | $env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true); 27 | $debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true); 28 | 29 | if ($debug) { 30 | umask(0000); 31 | 32 | if (class_exists(Debug::class)) 33 | Debug::enable(); 34 | } 35 | 36 | $kernel = new Kernel($env, $debug); 37 | $application = new Application($kernel); 38 | 39 | $application->run($input); 40 | -------------------------------------------------------------------------------- /config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 7 | Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], 8 | Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], 9 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], 10 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], 11 | Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], 12 | Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], 13 | Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], 14 | ]; 15 | -------------------------------------------------------------------------------- /config/doctrine/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LartTyler/MHWDB-API/0ac2a580bac8fde6ae684e66720092c88a9675d5/config/doctrine/.gitignore -------------------------------------------------------------------------------- /config/jwt/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LartTyler/MHWDB-API/0ac2a580bac8fde6ae684e66720092c88a9675d5/config/jwt/.gitignore -------------------------------------------------------------------------------- /config/packages/dev/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /config/packages/dev/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | # See https://symfony.com/doc/current/email/dev_environment.html 2 | swiftmailer: 3 | # send all emails to a specific address 4 | #delivery_addresses: ['me@example.com'] 5 | -------------------------------------------------------------------------------- /config/packages/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: true 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { only_exceptions: false } 7 | -------------------------------------------------------------------------------- /config/packages/doctrine.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # Adds a fallback DATABASE_URL if the env var is not set. 3 | # This allows you to run cache:warmup even if your 4 | # environment variables are not available yet. 5 | # You should not need to change this value. 6 | env(DATABASE_URL): '' 7 | 8 | doctrine: 9 | dbal: 10 | # configure these for your database server 11 | driver: 'pdo_mysql' 12 | server_version: '5.6' 13 | charset: utf8mb4 14 | 15 | # With Symfony 3.3, remove the `resolve:` prefix 16 | url: '%env(resolve:DATABASE_URL)%' 17 | orm: 18 | auto_generate_proxy_classes: '%kernel.debug%' 19 | naming_strategy: doctrine.orm.naming_strategy.underscore 20 | auto_mapping: true 21 | dql: 22 | string_functions: 23 | JSON_EXTRACT: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql\JsonExtract 24 | JSON_UNQUOTE: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql\JsonUnquote 25 | JSON_LENGTH: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Mysql\JsonLength 26 | mappings: 27 | App: 28 | is_bundle: false 29 | type: annotation 30 | dir: '%kernel.project_dir%/src/Entity' 31 | prefix: 'App\Entity' 32 | alias: App 33 | -------------------------------------------------------------------------------- /config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | dir_name: '%kernel.project_dir%/src/Migrations' 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | namespace: DoctrineMigrations 6 | -------------------------------------------------------------------------------- /config/packages/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | secret: '%env(APP_SECRET)%' 3 | default_locale: en 4 | #csrf_protection: true 5 | #http_method_override: true 6 | 7 | # Enables session support. Note that the session will ONLY be started if you read or write from it. 8 | # Remove or comment this section to explicitly disable session support. 9 | session: 10 | handler_id: ~ 11 | 12 | #esi: true 13 | #fragments: true 14 | php_errors: 15 | log: true 16 | 17 | cache: 18 | # Put the unique name of your app here: the prefix seed 19 | # is used to compute stable namespaces for cache keys. 20 | #prefix_seed: your_vendor_name/app_name 21 | 22 | # The app cache caches to the filesystem by default. 23 | # Other options include: 24 | 25 | # Redis 26 | #app: cache.adapter.redis 27 | #default_redis_provider: redis://localhost 28 | 29 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) 30 | #app: cache.adapter.apcu 31 | -------------------------------------------------------------------------------- /config/packages/lexik_jwt_authentication.yaml: -------------------------------------------------------------------------------- 1 | lexik_jwt_authentication: 2 | secret_key: '%env(resolve:JWT_SECRET_KEY)%' 3 | public_key: '%env(resolve:JWT_PUBLIC_KEY)%' 4 | pass_phrase: '%env(JWT_PASSPHRASE)%' 5 | token_ttl: 1800 6 | -------------------------------------------------------------------------------- /config/packages/nelmio_cors.yaml: -------------------------------------------------------------------------------- 1 | nelmio_cors: 2 | defaults: 3 | allow_origin: ['*'] 4 | allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'] 5 | allow_headers: ['Content-Type', 'Authorization'] 6 | max_age: 3600 7 | paths: 8 | '^/auth': 9 | origin_regex: true 10 | allow_origin: ['%env(CONTRIB_DOMAIN)%'] 11 | '^/': ~ 12 | -------------------------------------------------------------------------------- /config/packages/prod/doctrine.yaml: -------------------------------------------------------------------------------- 1 | doctrine: 2 | orm: 3 | metadata_cache_driver: 4 | type: service 5 | id: doctrine.system_cache_provider 6 | query_cache_driver: 7 | type: service 8 | id: doctrine.system_cache_provider 9 | result_cache_driver: 10 | type: service 11 | id: doctrine.result_cache_provider 12 | 13 | services: 14 | doctrine.result_cache_provider: 15 | class: Symfony\Component\Cache\DoctrineProvider 16 | public: false 17 | arguments: 18 | - '@doctrine.result_cache_pool' 19 | doctrine.system_cache_provider: 20 | class: Symfony\Component\Cache\DoctrineProvider 21 | public: false 22 | arguments: 23 | - '@doctrine.system_cache_pool' 24 | 25 | framework: 26 | cache: 27 | pools: 28 | doctrine.result_cache_pool: 29 | adapter: cache.app 30 | doctrine.system_cache_pool: 31 | adapter: cache.system 32 | -------------------------------------------------------------------------------- /config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: ~ 4 | -------------------------------------------------------------------------------- /config/packages/security.yaml: -------------------------------------------------------------------------------- 1 | security: 2 | role_hierarchy: 3 | ROLE_ADMIN: ROLE_EDITOR 4 | ROLE_EDITOR: ROLE_USER 5 | 6 | providers: 7 | doctrine: 8 | entity: 9 | class: App\Entity\User 10 | property: email 11 | 12 | encoders: 13 | App\Entity\User: bcrypt 14 | 15 | firewalls: 16 | dev: 17 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 18 | security: false 19 | 20 | auth_refresh: 21 | pattern: ^/auth/refresh 22 | stateless: true 23 | user_checker: App\Security\DisabledUserChecker 24 | guard: 25 | authenticators: 26 | - lexik_jwt_authentication.jwt_token_authenticator 27 | 28 | auth: 29 | pattern: ^/auth 30 | anonymous: true 31 | stateless: true 32 | user_checker: App\Security\DisabledUserChecker 33 | json_login: 34 | check_path: /auth 35 | success_handler: lexik_jwt_authentication.handler.authentication_success 36 | failure_handler: lexik_jwt_authentication.handler.authentication_failure 37 | 38 | main: 39 | anonymous: true 40 | stateless: true 41 | user_checker: App\Security\DisabledUserChecker 42 | guard: 43 | authenticators: 44 | - lexik_jwt_authentication.jwt_token_authenticator -------------------------------------------------------------------------------- /config/packages/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | url: '%env(MAILER_URL)%' 3 | spool: { type: 'memory' } 4 | -------------------------------------------------------------------------------- /config/packages/test/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | test: true 3 | session: 4 | storage_id: session.storage.mock_file 5 | -------------------------------------------------------------------------------- /config/packages/test/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | disable_delivery: true 3 | -------------------------------------------------------------------------------- /config/packages/test/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: false 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { collect: false } 7 | -------------------------------------------------------------------------------- /config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | debug: '%kernel.debug%' 4 | strict_variables: '%kernel.debug%' 5 | -------------------------------------------------------------------------------- /config/packages/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | email_validation_mode: html5 4 | -------------------------------------------------------------------------------- /config/routes.yaml: -------------------------------------------------------------------------------- 1 | app._annotations: 2 | resource: '../src/Controller/' 3 | type: annotation 4 | prefix: 5 | en: '' 6 | fr: '/fr' 7 | de: '/de' 8 | zh: '/zh' # Used in place of `zh-Hans` 9 | zh-Hant: '/zh-Hant' 10 | defaults: 11 | _format: json 12 | 13 | index: 14 | path: / 15 | controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController 16 | defaults: 17 | path: 'https://docs.mhw-db.com/' 18 | 19 | auth.login: 20 | path: /auth -------------------------------------------------------------------------------- /config/routes/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler_wdt: 2 | resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' 3 | prefix: /_wdt 4 | 5 | web_profiler_profiler: 6 | resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' 7 | prefix: /_profiler 8 | -------------------------------------------------------------------------------- /config/services.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - 3 | resource: './services' 4 | type: 'directory' 5 | 6 | parameters: 7 | 8 | services: 9 | _defaults: 10 | autowire: true 11 | autoconfigure: false 12 | public: false 13 | 14 | App\Controller\: 15 | resource: '../src/Controller' 16 | tags: ['controller.service_arguments'] 17 | 18 | App\QueryDocument\ApiQueryManager: 19 | public: true 20 | arguments: 21 | - '@doctrine.orm.entity_manager' 22 | 23 | DaybreakStudios\DoctrineQueryDocument\QueryManagerInterface: '@App\QueryDocument\ApiQueryManager' 24 | 25 | Aws\Sdk: 26 | arguments: 27 | - 28 | region: 'us-east-2' 29 | version: 'latest' 30 | 31 | App\WorldEvent\WorldEventReader: ~ -------------------------------------------------------------------------------- /config/services/commands.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | autowire: true 4 | autoconfigure: false 5 | public: false 6 | 7 | App\Command\: 8 | resource: '%kernel.project_dir%/src/Command' 9 | tags: 10 | - console.command 11 | 12 | App\Command\EntityDeleteCommand: 13 | tags: 14 | - 15 | name: console.command 16 | command: app:entity:delete 17 | 18 | App\Command\UserCreateCommand: 19 | tags: 20 | - 21 | name: console.command 22 | command: app:user:create 23 | 24 | App\Command\WorldEventSyncCommand: 25 | tags: 26 | - 27 | name: console.command 28 | command: app:events:sync 29 | 30 | App\Command\UserSetPasswordCommand: 31 | tags: 32 | - 33 | name: console.command 34 | command: app:user:set-password -------------------------------------------------------------------------------- /config/services/contrib.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: false 4 | autowire: true 5 | autoconfigure: true 6 | 7 | DaybreakStudios\RestApiCommon\Event\Listeners\ApiErrorExceptionSubscriber: 8 | tags: 9 | - kernel.event_subscriber 10 | 11 | App\Contrib\BucketManager: 12 | bind: 13 | $bucket: '%env(resolve:ASSETS_BUCKET_NAME)%' 14 | 15 | App\Contrib\Transformers\AilmentTransformer: ~ 16 | App\Contrib\Transformers\ArmorTransformer: ~ 17 | App\Contrib\Transformers\ArmorSetTransformer: ~ 18 | App\Contrib\Transformers\ArmorSetBonusTransformer: ~ 19 | App\Contrib\Transformers\CharmTransformer: ~ 20 | App\Contrib\Transformers\DecorationTransformer: ~ 21 | App\Contrib\Transformers\ItemTransformer: ~ 22 | App\Contrib\Transformers\LocationTransformer: ~ 23 | App\Contrib\Transformers\MonsterTransformer: ~ 24 | App\Contrib\Transformers\MotionValueTransformer: ~ 25 | App\Contrib\Transformers\SkillTransformer: ~ 26 | App\Contrib\Transformers\UserTransformer: ~ 27 | App\Contrib\Transformers\WeaponTransformer: ~ 28 | 29 | App\Localization\QueryLocalizationHelper: ~ -------------------------------------------------------------------------------- /config/services/responder.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | autowire: true 4 | autoconfigure: false 5 | public: false 6 | 7 | app.serializer: 8 | class: Symfony\Component\Serializer\Serializer 9 | arguments: 10 | - 11 | - '@serializer.normalizer.datetime' 12 | - '@App\Serializer\CustomObjectNormalizer' 13 | - 14 | - '@serializer.encoder.json' 15 | 16 | App\Serializer\CustomObjectNormalizer: 17 | bind: 18 | $defaultContext: 19 | preserve_empty_objects: true 20 | 21 | DaybreakStudios\RestApiCommon\Responder: 22 | bind: 23 | $serializer: '@app.serializer' 24 | 25 | DaybreakStudios\RestApiCommon\ResponderInterface: '@DaybreakStudios\RestApiCommon\Responder' 26 | 27 | DaybreakStudios\RestApiCommon\ResponderService: ~ 28 | -------------------------------------------------------------------------------- /config/services/security.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | public: false 4 | autowire: true 5 | autoconfigure: true 6 | 7 | DaybreakStudios\RestApiCommon\Event\Listeners\LexikJwtAuthenticationFailureSubscriber: 8 | tags: 9 | - kernel.event_subscriber 10 | 11 | App\Security\CustomizePayloadListener: 12 | tags: 13 | - 14 | name: kernel.event_listener 15 | event: lexik_jwt_authentication.on_jwt_created 16 | method: onJwtCreate 17 | 18 | App\Security\DisabledUserChecker: ~ -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | load(__DIR__ . '/../.env'); 17 | } 18 | 19 | $env = $_SERVER['APP_ENV'] ?? 'dev'; 20 | $debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env); 21 | 22 | if ($debug) { 23 | umask(0000); 24 | 25 | Debug::enable(); 26 | } 27 | 28 | if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) 29 | Request::setTrustedProxies( 30 | explode(',', $trustedProxies), 31 | Request::HEADER_X_FORWARDED_ALL ^ 32 | Request::HEADER_X_FORWARDED_HOST 33 | ); 34 | 35 | if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) 36 | Request::setTrustedHosts(explode(',', $trustedHosts)); 37 | 38 | $kernel = new Kernel($env, $debug); 39 | $request = Request::createFromGlobals(); 40 | $response = $kernel->handle($request); 41 | 42 | $response->send(); 43 | $kernel->terminate($request, $response); 44 | -------------------------------------------------------------------------------- /src/Contrib/ApiErrors/InvalidParameterError.php: -------------------------------------------------------------------------------- 1 | requestStack = $requestStack; 27 | } 28 | 29 | /** 30 | * @return User 31 | */ 32 | protected function getUser(): User { 33 | $user = parent::getUser(); 34 | assert($user instanceof User); 35 | 36 | return $user; 37 | } 38 | 39 | /** 40 | * @param TranslatableEntityInterface $entity 41 | * 42 | * @return NullObject|EntityInterface 43 | */ 44 | protected function getStrings(TranslatableEntityInterface $entity): object { 45 | return NullObject::of( 46 | L10nUtil::findStrings($this->requestStack->getCurrentRequest()->getLocale(), $entity) 47 | ); 48 | } 49 | } -------------------------------------------------------------------------------- /src/Controller/AuthenticationController.php: -------------------------------------------------------------------------------- 1 | $tokenManager->create($this->getUser()), 24 | ] 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Entity/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LartTyler/MHWDB-API/0ac2a580bac8fde6ae684e66720092c88a9675d5/src/Entity/.gitignore -------------------------------------------------------------------------------- /src/Entity/AilmentProtection.php: -------------------------------------------------------------------------------- 1 | ailment = $ailment; 52 | 53 | $this->skills = new ArrayCollection(); 54 | $this->items = new ArrayCollection(); 55 | } 56 | 57 | /** 58 | * @return Ailment 59 | */ 60 | public function getAilment(): Ailment { 61 | return $this->ailment; 62 | } 63 | 64 | /** 65 | * @return Skill[]|Collection|Selectable 66 | */ 67 | public function getSkills() { 68 | return $this->skills; 69 | } 70 | 71 | /** 72 | * @return Item[]|Collection|Selectable 73 | */ 74 | public function getItems() { 75 | return $this->items; 76 | } 77 | } -------------------------------------------------------------------------------- /src/Entity/ArmorAssets.php: -------------------------------------------------------------------------------- 1 | imageMale = $imageMale; 40 | $this->imageFemale = $imageFemale; 41 | } 42 | 43 | /** 44 | * @return Asset|null 45 | */ 46 | public function getImageMale(): ?Asset { 47 | return $this->imageMale; 48 | } 49 | 50 | /** 51 | * @param Asset|null $imageMale 52 | * 53 | * @return $this 54 | */ 55 | public function setImageMale(?Asset $imageMale) { 56 | $this->imageMale = $imageMale; 57 | 58 | return $this; 59 | } 60 | 61 | /** 62 | * @return Asset|null 63 | */ 64 | public function getImageFemale(): ?Asset { 65 | return $this->imageFemale; 66 | } 67 | 68 | /** 69 | * @param Asset|null $imageFemale 70 | * 71 | * @return $this 72 | */ 73 | public function setImageFemale(?Asset $imageFemale) { 74 | $this->imageFemale = $imageFemale; 75 | 76 | return $this; 77 | } 78 | } -------------------------------------------------------------------------------- /src/Entity/ArmorCraftingInfo.php: -------------------------------------------------------------------------------- 1 | materials = new ArrayCollection(); 42 | } 43 | 44 | /** 45 | * @return CraftingMaterialCost[]|Collection|Selectable 46 | */ 47 | public function getMaterials() { 48 | return $this->materials; 49 | } 50 | } -------------------------------------------------------------------------------- /src/Entity/ArmorSlot.php: -------------------------------------------------------------------------------- 1 | armor = $armor; 31 | } 32 | 33 | /** 34 | * @return Armor 35 | */ 36 | public function getArmor(): Armor { 37 | return $this->armor; 38 | } 39 | } -------------------------------------------------------------------------------- /src/Entity/AttributableTrait.php: -------------------------------------------------------------------------------- 1 | attributes; 19 | } 20 | 21 | /** 22 | * @param string $attribute 23 | * @param mixed $def 24 | * 25 | * @return mixed|null 26 | */ 27 | public function getAttribute(string $attribute, $def = null) { 28 | return $this->attributes[$attribute] ?? $def; 29 | } 30 | 31 | /** 32 | * @param array $attributes 33 | * 34 | * @return $this 35 | */ 36 | public function setAttributes(array $attributes) { 37 | $this->attributes = []; 38 | 39 | return $this->addAttributes($attributes); 40 | } 41 | 42 | /** 43 | * @param array $attributes 44 | * 45 | * @return $this 46 | */ 47 | public function addAttributes(array $attributes) { 48 | foreach ($attributes as $key => $value) 49 | $this->setAttribute($key, $value); 50 | 51 | return $this; 52 | } 53 | 54 | /** 55 | * @param string $attribute 56 | * @param mixed|null $value 57 | * 58 | * @return $this 59 | */ 60 | public function setAttribute(string $attribute, $value) { 61 | if ($value === null) 62 | return $this->removeAttribute($attribute); 63 | 64 | $this->attributes[$attribute] = $value; 65 | 66 | return $this; 67 | } 68 | 69 | /** 70 | * @param string $attribute 71 | * 72 | * @return $this 73 | */ 74 | public function removeAttribute(string $attribute) { 75 | unset($this->attributes[$attribute]); 76 | 77 | return $this; 78 | } 79 | } -------------------------------------------------------------------------------- /src/Entity/CharmRankCraftingInfo.php: -------------------------------------------------------------------------------- 1 | craftable = $craftable; 46 | $this->materials = new ArrayCollection(); 47 | } 48 | 49 | /** 50 | * @return bool 51 | */ 52 | public function isCraftable(): bool { 53 | return $this->craftable; 54 | } 55 | 56 | /** 57 | * @param bool $craftable 58 | * 59 | * @return $this 60 | */ 61 | public function setCraftable(bool $craftable) { 62 | $this->craftable = $craftable; 63 | 64 | return $this; 65 | } 66 | 67 | /** 68 | * @return CraftingMaterialCost[]|Collection|Selectable 69 | */ 70 | public function getMaterials() { 71 | return $this->materials; 72 | } 73 | } -------------------------------------------------------------------------------- /src/Entity/CraftingMaterialCost.php: -------------------------------------------------------------------------------- 1 | item = $item; 45 | $this->quantity = $quantity; 46 | } 47 | 48 | /** 49 | * @return Item 50 | */ 51 | public function getItem(): Item { 52 | return $this->item; 53 | } 54 | 55 | /** 56 | * @return int 57 | */ 58 | public function getQuantity(): int { 59 | return $this->quantity; 60 | } 61 | 62 | /** 63 | * @param int $quantity 64 | * 65 | * @return $this 66 | */ 67 | public function setQuantity(int $quantity) { 68 | $this->quantity = $quantity; 69 | return $this; 70 | } 71 | } -------------------------------------------------------------------------------- /src/Entity/EntityTrait.php: -------------------------------------------------------------------------------- 1 | getId()) 30 | throw new \LogicException('Cannot update an entity\'s ID once it has been set'); 31 | 32 | $this->id = $id; 33 | 34 | return $this; 35 | } 36 | } -------------------------------------------------------------------------------- /src/Entity/MonsterResistance.php: -------------------------------------------------------------------------------- 1 | monster = $monster; 54 | $this->element = $element; 55 | } 56 | 57 | /** 58 | * @return Monster 59 | */ 60 | public function getMonster(): Monster { 61 | return $this->monster; 62 | } 63 | 64 | /** 65 | * @return string 66 | */ 67 | public function getElement(): string { 68 | return $this->element; 69 | } 70 | 71 | /** 72 | * @return string|null 73 | */ 74 | public function getCondition(): ?string { 75 | return $this->condition; 76 | } 77 | 78 | /** 79 | * @param null|string $condition 80 | * 81 | * @return $this 82 | */ 83 | public function setCondition(?string $condition) { 84 | $this->condition = $condition; 85 | 86 | return $this; 87 | } 88 | } -------------------------------------------------------------------------------- /src/Entity/Phial.php: -------------------------------------------------------------------------------- 1 | weapon = $weapon; 51 | $this->type = $type; 52 | } 53 | 54 | /** 55 | * @return Weapon 56 | */ 57 | public function getWeapon(): Weapon { 58 | return $this->weapon; 59 | } 60 | 61 | /** 62 | * @return string 63 | * @see PhialType 64 | */ 65 | public function getType(): string { 66 | return $this->type; 67 | } 68 | 69 | /** 70 | * @return int|null 71 | */ 72 | public function getDamage(): ?int { 73 | return $this->damage; 74 | } 75 | 76 | /** 77 | * @param int|null $damage 78 | * 79 | * @return $this 80 | */ 81 | public function setDamage(?int $damage) { 82 | $this->damage = $damage; 83 | 84 | return $this; 85 | } 86 | } -------------------------------------------------------------------------------- /src/Entity/Slot.php: -------------------------------------------------------------------------------- 1 | rank = $rank; 30 | } 31 | 32 | /** 33 | * @return int 34 | */ 35 | public function getRank(): int { 36 | return $this->rank; 37 | } 38 | } -------------------------------------------------------------------------------- /src/Entity/SluggableInterface.php: -------------------------------------------------------------------------------- 1 | slug; 28 | } 29 | 30 | /** 31 | * @param string $slug 32 | * 33 | * @return $this 34 | * @deprecated 35 | */ 36 | public function setSlug(string $slug) { 37 | $this->slug = StringUtil::toSlug($slug); 38 | 39 | return $this; 40 | } 41 | } -------------------------------------------------------------------------------- /src/Entity/Strings/ArmorSetBonusStrings.php: -------------------------------------------------------------------------------- 1 | armorSetBonus = $armorSetBonus; 47 | $this->language = $language; 48 | } 49 | 50 | /** 51 | * @return string 52 | */ 53 | public function getName(): string { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * @param string $name 59 | * 60 | * @return $this 61 | */ 62 | public function setName(string $name) { 63 | $this->name = $name; 64 | 65 | return $this; 66 | } 67 | } -------------------------------------------------------------------------------- /src/Entity/Strings/ArmorSetStrings.php: -------------------------------------------------------------------------------- 1 | armorSet = $armorSet; 47 | $this->language = $language; 48 | } 49 | 50 | /** 51 | * @return string 52 | */ 53 | public function getName(): string { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * @param string $name 59 | * 60 | * @return $this 61 | */ 62 | public function setName(string $name) { 63 | $this->name = $name; 64 | 65 | return $this; 66 | } 67 | } -------------------------------------------------------------------------------- /src/Entity/Strings/ArmorStrings.php: -------------------------------------------------------------------------------- 1 | armor = $armor; 49 | $this->language = $language; 50 | } 51 | 52 | /** 53 | * @return string 54 | */ 55 | public function getName(): string { 56 | return $this->name; 57 | } 58 | 59 | /** 60 | * @param string $name 61 | * 62 | * @return $this 63 | */ 64 | public function setName(string $name) { 65 | $this->name = $name; 66 | 67 | return $this; 68 | } 69 | } -------------------------------------------------------------------------------- /src/Entity/Strings/CampStrings.php: -------------------------------------------------------------------------------- 1 | camp = $camp; 47 | $this->language = $language; 48 | } 49 | 50 | /** 51 | * @return string 52 | */ 53 | public function getName(): string { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * @param string $name 59 | * 60 | * @return $this 61 | */ 62 | public function setName(string $name) { 63 | $this->name = $name; 64 | 65 | return $this; 66 | } 67 | } -------------------------------------------------------------------------------- /src/Entity/Strings/CharmRankStrings.php: -------------------------------------------------------------------------------- 1 | charmRank = $charmRank; 46 | $this->language = $language; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getName(): string { 53 | return $this->name; 54 | } 55 | 56 | /** 57 | * @param string $name 58 | * 59 | * @return $this 60 | */ 61 | public function setName(string $name) { 62 | $this->name = $name; 63 | 64 | return $this; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Entity/Strings/CharmStrings.php: -------------------------------------------------------------------------------- 1 | charm = $charm; 47 | $this->language = $language; 48 | } 49 | 50 | /** 51 | * @return string 52 | */ 53 | public function getName(): string { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * @param string $name 59 | * 60 | * @return $this 61 | */ 62 | public function setName(string $name) { 63 | $this->name = $name; 64 | 65 | return $this; 66 | } 67 | } -------------------------------------------------------------------------------- /src/Entity/Strings/DecorationStrings.php: -------------------------------------------------------------------------------- 1 | decoration = $decoration; 46 | $this->language = $language; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getName(): string { 53 | return $this->name; 54 | } 55 | 56 | /** 57 | * @param string $name 58 | * 59 | * @return $this 60 | */ 61 | public function setName(string $name) { 62 | $this->name = $name; 63 | 64 | return $this; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Entity/Strings/LocationStrings.php: -------------------------------------------------------------------------------- 1 | location = $location; 46 | $this->language = $language; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getName(): string { 53 | return $this->name; 54 | } 55 | 56 | /** 57 | * @param string $name 58 | * 59 | * @return $this 60 | */ 61 | public function setName(string $name) { 62 | $this->name = $name; 63 | 64 | return $this; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Entity/Strings/MonsterWeaknessStrings.php: -------------------------------------------------------------------------------- 1 | monsterWeakness = $monsterWeakness; 42 | $this->language = $language; 43 | } 44 | 45 | /** 46 | * @return string|null 47 | */ 48 | public function getCondition(): ?string { 49 | return $this->condition; 50 | } 51 | 52 | /** 53 | * @param string|null $condition 54 | * 55 | * @return $this 56 | */ 57 | public function setCondition(?string $condition) { 58 | $this->condition = $condition; 59 | 60 | return $this; 61 | } 62 | } -------------------------------------------------------------------------------- /src/Entity/Strings/MotionValueStrings.php: -------------------------------------------------------------------------------- 1 | motionValue = $motionValue; 46 | $this->language = $language; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getName(): string { 53 | return $this->name; 54 | } 55 | 56 | /** 57 | * @param string $name 58 | * 59 | * @return $this 60 | */ 61 | public function setName(string $name) { 62 | $this->name = $name; 63 | 64 | return $this; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Entity/Strings/SkillRankStrings.php: -------------------------------------------------------------------------------- 1 | rank = $rank; 42 | $this->language = $language; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getDescription(): string { 49 | return $this->description; 50 | } 51 | 52 | /** 53 | * @param string $description 54 | * 55 | * @return $this 56 | */ 57 | public function setDescription(string $description) { 58 | $this->description = $description; 59 | 60 | return $this; 61 | } 62 | } -------------------------------------------------------------------------------- /src/Entity/Strings/WeaponStrings.php: -------------------------------------------------------------------------------- 1 | weapon = $weapon; 46 | $this->language = $language; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getName(): string { 53 | return $this->name; 54 | } 55 | 56 | /** 57 | * @param string $name 58 | * 59 | * @return $this 60 | */ 61 | public function setName(string $name) { 62 | $this->name = $name; 63 | 64 | return $this; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Entity/UserRole.php: -------------------------------------------------------------------------------- 1 | user = $user; 47 | $this->name = $name; 48 | } 49 | 50 | /** 51 | * @return User 52 | */ 53 | public function getUser(): User { 54 | return $this->user; 55 | } 56 | 57 | /** 58 | * @return string 59 | */ 60 | public function getRole(): string { 61 | return $this->name; 62 | } 63 | } -------------------------------------------------------------------------------- /src/Entity/WeaponAssets.php: -------------------------------------------------------------------------------- 1 | icon = $icon; 40 | $this->image = $image; 41 | } 42 | 43 | /** 44 | * @return Asset|null 45 | */ 46 | public function getIcon(): ?Asset { 47 | return $this->icon; 48 | } 49 | 50 | /** 51 | * @param Asset|null $icon 52 | * 53 | * @return $this 54 | */ 55 | public function setIcon(?Asset $icon) { 56 | $this->icon = $icon; 57 | 58 | return $this; 59 | } 60 | 61 | /** 62 | * @return Asset|null 63 | */ 64 | public function getImage(): ?Asset { 65 | return $this->image; 66 | } 67 | 68 | /** 69 | * @param Asset|null $image 70 | * 71 | * @return $this 72 | */ 73 | public function setImage(?Asset $image) { 74 | $this->image = $image; 75 | 76 | return $this; 77 | } 78 | } -------------------------------------------------------------------------------- /src/Entity/WeaponAttackValues.php: -------------------------------------------------------------------------------- 1 | display; 46 | } 47 | 48 | /** 49 | * @param int $display 50 | * 51 | * @return $this 52 | */ 53 | public function setDisplay(int $display) { 54 | $this->display = $display; 55 | 56 | return $this; 57 | } 58 | 59 | /** 60 | * @return int 61 | */ 62 | public function getRaw(): int { 63 | return $this->raw; 64 | } 65 | 66 | /** 67 | * @param int $raw 68 | * 69 | * @return $this 70 | */ 71 | public function setRaw(int $raw) { 72 | $this->raw = $raw; 73 | 74 | return $this; 75 | } 76 | 77 | /** 78 | * @param WeaponAttackValues $other 79 | * 80 | * @return $this 81 | */ 82 | public function import(WeaponAttackValues $other) { 83 | $this 84 | ->setDisplay($other->getDisplay()) 85 | ->setRaw($other->getRaw()); 86 | 87 | return $this; 88 | } 89 | } -------------------------------------------------------------------------------- /src/Entity/WeaponSlot.php: -------------------------------------------------------------------------------- 1 | weapon = $weapon; 31 | } 32 | 33 | /** 34 | * @return mixed 35 | */ 36 | public function getWeapon() { 37 | return $this->weapon; 38 | } 39 | } -------------------------------------------------------------------------------- /src/Game/Ailment.php: -------------------------------------------------------------------------------- 1 | getConstants()); 37 | 38 | return self::$ailments; 39 | } 40 | } -------------------------------------------------------------------------------- /src/Game/AmmoType.php: -------------------------------------------------------------------------------- 1 | getConstants()); 43 | 44 | return self::$types; 45 | } 46 | 47 | /** 48 | * @param string $value 49 | * 50 | * @return bool 51 | */ 52 | public static function isValid(string $value): bool { 53 | return in_array($value, self::all()); 54 | } 55 | } -------------------------------------------------------------------------------- /src/Game/ArmorType.php: -------------------------------------------------------------------------------- 1 | getConstants(); 28 | 29 | return self::$types; 30 | } 31 | 32 | /** 33 | * @param string $value 34 | * 35 | * @return bool 36 | */ 37 | public static function isValid(string $value): bool { 38 | return in_array($value, self::all()); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Game/Attribute.php: -------------------------------------------------------------------------------- 1 | setAttributes($attributes); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Game/BowCoatingType.php: -------------------------------------------------------------------------------- 1 | getConstants()); 29 | 30 | return self::$types; 31 | } 32 | 33 | /** 34 | * @param string $value 35 | * 36 | * @return bool 37 | */ 38 | public static function isValid(string $value): bool { 39 | return in_array($value, self::all()); 40 | } 41 | } -------------------------------------------------------------------------------- /src/Game/BowgunDeviation.php: -------------------------------------------------------------------------------- 1 | getConstants()); 27 | 28 | return self::$values; 29 | } 30 | 31 | /** 32 | * @param string $value 33 | * 34 | * @return bool 35 | */ 36 | public static function isValid(string $value): bool { 37 | return in_array($value, self::all()); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Game/BowgunSpecialAmmo.php: -------------------------------------------------------------------------------- 1 | getConstants()); 35 | 36 | return self::$types; 37 | } 38 | } -------------------------------------------------------------------------------- /src/Game/DamageType.php: -------------------------------------------------------------------------------- 1 | self::SEVER, 11 | WeaponType::LONG_SWORD => self::SEVER, 12 | WeaponType::SWORD_AND_SHIELD => self::SEVER, 13 | WeaponType::DUAL_BLADES => self::SEVER, 14 | WeaponType::HAMMER => self::BLUNT, 15 | WeaponType::HUNTING_HORN => self::BLUNT, 16 | WeaponType::LANCE => self::SEVER, 17 | WeaponType::GUNLANCE => self::SEVER, 18 | WeaponType::SWITCH_AXE => self::SEVER, 19 | WeaponType::CHARGE_BLADE => self::SEVER, 20 | WeaponType::INSECT_GLAIVE => self::SEVER, 21 | WeaponType::LIGHT_BOWGUN => self::PROJECTILE, 22 | WeaponType::HEAVY_BOWGUN => self::PROJECTILE, 23 | WeaponType::BOW => self::PROJECTILE, 24 | ]; 25 | 26 | /** 27 | * @var string[] 28 | */ 29 | private static $types = null; 30 | 31 | /** 32 | * DamageType constructor. 33 | */ 34 | private function __construct() { 35 | } 36 | 37 | /** 38 | * @param string $value 39 | * 40 | * @return bool 41 | */ 42 | public static function isValid(string $value): bool { 43 | return in_array($value, self::all()); 44 | } 45 | 46 | /** 47 | * @return string[] 48 | */ 49 | public static function all(): array { 50 | if (self::$types === null) 51 | self::$types = (new \ReflectionClass(self::class))->getConstants(); 52 | 53 | return self::$types; 54 | } 55 | 56 | /** 57 | * @param string $weaponType 58 | * 59 | * @return string 60 | */ 61 | public static function getWeaponDamageType(string $weaponType): string { 62 | return self::WEAPON_TYPE_MAP[$weaponType]; 63 | } 64 | } -------------------------------------------------------------------------------- /src/Game/Elderseal.php: -------------------------------------------------------------------------------- 1 | getConstants()); 29 | 30 | return self::$types; 31 | } 32 | 33 | /** 34 | * @param string $value 35 | * 36 | * @return bool 37 | */ 38 | public static function isValid(string $value): bool { 39 | return in_array($value, self::all()); 40 | } 41 | } -------------------------------------------------------------------------------- /src/Game/MonsterSpecies.php: -------------------------------------------------------------------------------- 1 | getConstants()); 36 | 37 | return self::$species; 38 | } 39 | 40 | /** 41 | * @param string $string 42 | * 43 | * @return bool 44 | */ 45 | public static function isValid(string $string): bool { 46 | return in_array($string, self::all()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Game/MonsterType.php: -------------------------------------------------------------------------------- 1 | getConstants()); 25 | 26 | return self::$types; 27 | } 28 | 29 | /** 30 | * @param string $string 31 | * 32 | * @return bool 33 | */ 34 | public static function isValid(string $string): bool { 35 | return in_array($string, self::all()); 36 | } 37 | } -------------------------------------------------------------------------------- /src/Game/PhialType.php: -------------------------------------------------------------------------------- 1 | getConstants()); 48 | 49 | return self::$types; 50 | } 51 | } -------------------------------------------------------------------------------- /src/Game/PlatformExclusivityType.php: -------------------------------------------------------------------------------- 1 | getConstants(); 26 | 27 | return self::$types; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Game/PlatformType.php: -------------------------------------------------------------------------------- 1 | getConstants(); 25 | 26 | return self::$types; 27 | } 28 | } -------------------------------------------------------------------------------- /src/Game/Rank.php: -------------------------------------------------------------------------------- 1 | getConstants()); 26 | 27 | return self::$ranks; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Game/RawDamageMultiplier.php: -------------------------------------------------------------------------------- 1 | 4.8, 16 | WeaponType::LONG_SWORD => 3.3, 17 | WeaponType::SWORD_AND_SHIELD => 1.4, 18 | WeaponType::DUAL_BLADES => 1.4, 19 | WeaponType::HAMMER => 5.2, 20 | WeaponType::HUNTING_HORN => 4.2, 21 | WeaponType::LANCE => 2.3, 22 | WeaponType::GUNLANCE => 2.3, 23 | WeaponType::SWITCH_AXE => 3.5, 24 | WeaponType::CHARGE_BLADE => 3.6, 25 | WeaponType::INSECT_GLAIVE => 3.1, 26 | WeaponType::LIGHT_BOWGUN => 1.3, 27 | WeaponType::HEAVY_BOWGUN => 1.5, 28 | WeaponType::BOW => 1.2, 29 | ]; 30 | 31 | /** 32 | * RawDamageMultiplier constructor. 33 | */ 34 | private function __construct() { 35 | } 36 | 37 | /** 38 | * @param string $type 39 | * 40 | * @return float 41 | */ 42 | public static function get(string $type): float { 43 | return self::$multipliers[$type]; 44 | } 45 | } -------------------------------------------------------------------------------- /src/Game/RewardConditionType.php: -------------------------------------------------------------------------------- 1 | getConstants(); 34 | 35 | return self::$types; 36 | } 37 | } -------------------------------------------------------------------------------- /src/Game/Sharpness.php: -------------------------------------------------------------------------------- 1 | getConstants()); 26 | 27 | return self::$values; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Game/WorldEventType.php: -------------------------------------------------------------------------------- 1 | getConstants(); 27 | 28 | return self::$types; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Localization/L10nUtil.php: -------------------------------------------------------------------------------- 1 | where(Criteria::expr()->eq('language', $language)) 18 | ->setMaxResults(1); 19 | 20 | return $entity->getStrings()->matching($criteria)->first() ?: null; 21 | } 22 | 23 | /** 24 | * @param string $language 25 | * @param TranslatableEntityInterface $entity 26 | * 27 | * @return EntityInterface 28 | */ 29 | public static function findOrCreateStrings( 30 | string $language, 31 | TranslatableEntityInterface $entity 32 | ): EntityInterface { 33 | return self::findStrings($language, $entity) ?? $entity->addStrings($language); 34 | } 35 | } -------------------------------------------------------------------------------- /src/Localization/LanguageTag.php: -------------------------------------------------------------------------------- 1 | language; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Localization/TranslatableEntityInterface.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 17 | 18 | $this->addSql('ALTER TABLE armor ADD rank VARCHAR(16) NOT NULL, CHANGE attributes attributes JSON NOT NULL'); 19 | $this->addSql('ALTER TABLE skill_ranks CHANGE modifiers modifiers JSON NOT NULL'); 20 | $this->addSql('ALTER TABLE weapons CHANGE attributes attributes JSON NOT NULL'); 21 | } 22 | 23 | public function down(Schema $schema): void 24 | { 25 | // this down() migration is auto-generated, please modify it to your needs 26 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 27 | 28 | $this->addSql('ALTER TABLE armor DROP rank, CHANGE attributes attributes LONGTEXT NOT NULL COLLATE utf8mb4_bin'); 29 | $this->addSql('ALTER TABLE skill_ranks CHANGE modifiers modifiers LONGTEXT NOT NULL COLLATE utf8mb4_bin'); 30 | $this->addSql('ALTER TABLE weapons CHANGE attributes attributes LONGTEXT NOT NULL COLLATE utf8mb4_bin'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Migrations/Version20180311004633.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE decorations (id INT UNSIGNED AUTO_INCREMENT NOT NULL, skill_id INT UNSIGNED NOT NULL, name VARCHAR(64) NOT NULL, slug VARCHAR(64) NOT NULL, rarity SMALLINT UNSIGNED NOT NULL, slot SMALLINT UNSIGNED NOT NULL, UNIQUE INDEX UNIQ_53BB9DDD5E237E06 (name), UNIQUE INDEX UNIQ_53BB9DDD989D9B62 (slug), UNIQUE INDEX UNIQ_53BB9DDD5585C142 (skill_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('ALTER TABLE decorations ADD CONSTRAINT FK_53BB9DDD5585C142 FOREIGN KEY (skill_id) REFERENCES skills (id)'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 23 | 24 | $this->addSql('DROP TABLE decorations'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Migrations/Version20180319155834.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE items (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(64) NOT NULL, description LONGTEXT NOT NULL, rarity SMALLINT UNSIGNED NOT NULL, sell_price INT UNSIGNED NOT NULL, buy_price INT UNSIGNED NOT NULL, carry_limit INT UNSIGNED NOT NULL, UNIQUE INDEX UNIQ_E11EE94D5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 17 | } 18 | 19 | public function down(Schema $schema): void { 20 | // this down() migration is auto-generated, please modify it to your needs 21 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 22 | 23 | $this->addSql('DROP TABLE items'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Migrations/Version20180323034352.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE weapon_crafting_info_upgrade_material_costs (weapon_crafting_info_id INT UNSIGNED NOT NULL, crafting_material_cost_id INT UNSIGNED NOT NULL, INDEX IDX_B0AB8CFDD4C2CCD2 (weapon_crafting_info_id), INDEX IDX_B0AB8CFDDD94392C (crafting_material_cost_id), PRIMARY KEY(weapon_crafting_info_id, crafting_material_cost_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('ALTER TABLE weapon_crafting_info_upgrade_material_costs ADD CONSTRAINT FK_B0AB8CFDD4C2CCD2 FOREIGN KEY (weapon_crafting_info_id) REFERENCES weapon_crafting_info (id)'); 18 | $this->addSql('ALTER TABLE weapon_crafting_info_upgrade_material_costs ADD CONSTRAINT FK_B0AB8CFDDD94392C FOREIGN KEY (crafting_material_cost_id) REFERENCES crafting_material_costs (id)'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('DROP TABLE weapon_crafting_info_upgrade_material_costs'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180324193558.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE armor_sets (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(64) NOT NULL, rank VARCHAR(32) NOT NULL, UNIQUE INDEX UNIQ_7C8A0B105E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('CREATE TABLE armor_sets_armor_pieces (armor_set_id INT UNSIGNED NOT NULL, armor_id INT UNSIGNED NOT NULL, INDEX IDX_1C5D7E9D537E6F87 (armor_set_id), INDEX IDX_1C5D7E9DF5AA3663 (armor_id), PRIMARY KEY(armor_set_id, armor_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE armor_sets_armor_pieces ADD CONSTRAINT FK_1C5D7E9D537E6F87 FOREIGN KEY (armor_set_id) REFERENCES armor_sets (id)'); 19 | $this->addSql('ALTER TABLE armor_sets_armor_pieces ADD CONSTRAINT FK_1C5D7E9DF5AA3663 FOREIGN KEY (armor_id) REFERENCES armor (id)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 25 | 26 | $this->addSql('ALTER TABLE armor_sets_armor_pieces DROP FOREIGN KEY FK_1C5D7E9D537E6F87'); 27 | $this->addSql('DROP TABLE armor_sets'); 28 | $this->addSql('DROP TABLE armor_sets_armor_pieces'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20180330194208.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('ALTER TABLE skills ADD description LONGTEXT DEFAULT NULL'); 17 | } 18 | 19 | public function down(Schema $schema): void { 20 | // this down() migration is auto-generated, please modify it to your needs 21 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 22 | 23 | $this->addSql('ALTER TABLE skills DROP description'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Migrations/Version20180401034729.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('ALTER TABLE armor ADD rarity SMALLINT DEFAULT NULL'); 17 | $this->addSql('UPDATE armor SET rarity = 0 WHERE rarity IS NULL'); 18 | $this->addSql('ALTER TABLE armor CHANGE rarity rarity SMALLINT NOT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE armor DROP rarity'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180420125649.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE armor_slots (armor_id INT UNSIGNED NOT NULL, slot_id INT UNSIGNED NOT NULL, INDEX IDX_24FFC0B8F5AA3663 (armor_id), INDEX IDX_24FFC0B859E5119C (slot_id), PRIMARY KEY(armor_id, slot_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('CREATE TABLE slots (id INT UNSIGNED AUTO_INCREMENT NOT NULL, rank SMALLINT UNSIGNED NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE armor_slots ADD CONSTRAINT FK_24FFC0B8F5AA3663 FOREIGN KEY (armor_id) REFERENCES armor (id)'); 20 | $this->addSql('ALTER TABLE armor_slots ADD CONSTRAINT FK_24FFC0B859E5119C FOREIGN KEY (slot_id) REFERENCES slots (id)'); 21 | } 22 | 23 | public function down(Schema $schema): void { 24 | // this down() migration is auto-generated, please modify it to your needs 25 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 26 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 27 | 28 | $this->addSql('ALTER TABLE armor_slots DROP FOREIGN KEY FK_24FFC0B859E5119C'); 29 | $this->addSql('DROP TABLE armor_slots'); 30 | $this->addSql('DROP TABLE slots'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Migrations/Version20180420144556.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE weapon_slots (weapon_id INT UNSIGNED NOT NULL, slot_id INT UNSIGNED NOT NULL, INDEX IDX_E5CEC5B595B82273 (weapon_id), INDEX IDX_E5CEC5B559E5119C (slot_id), PRIMARY KEY(weapon_id, slot_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE weapon_slots ADD CONSTRAINT FK_E5CEC5B595B82273 FOREIGN KEY (weapon_id) REFERENCES weapons (id)'); 19 | $this->addSql('ALTER TABLE weapon_slots ADD CONSTRAINT FK_E5CEC5B559E5119C FOREIGN KEY (slot_id) REFERENCES slots (id)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 25 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('DROP TABLE weapon_slots'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Migrations/Version20180420154806.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE armor ADD resist_fire INT NOT NULL, ADD resist_water INT NOT NULL, ADD resist_ice INT NOT NULL, ADD resist_thunder INT NOT NULL, ADD resist_dragon INT NOT NULL, CHANGE armor_set_id armor_set_id INT UNSIGNED DEFAULT NULL, CHANGE assets_id assets_id INT UNSIGNED DEFAULT NULL, CHANGE attributes attributes JSON NOT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE armor DROP resist_fire, DROP resist_water, DROP resist_ice, DROP resist_thunder, DROP resist_dragon, CHANGE assets_id assets_id INT UNSIGNED DEFAULT NULL, CHANGE armor_set_id armor_set_id INT UNSIGNED DEFAULT NULL, CHANGE attributes attributes LONGTEXT NOT NULL COLLATE utf8mb4_bin'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180420180120.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE armor ADD defense_base INT UNSIGNED NOT NULL, ADD defense_max INT UNSIGNED NOT NULL, ADD defense_augmented INT UNSIGNED NOT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE armor DROP defense_base, DROP defense_max, DROP defense_augmented'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180424142246.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE weapon_elements (id INT UNSIGNED AUTO_INCREMENT NOT NULL, weapon_id INT UNSIGNED NOT NULL, type VARCHAR(16) NOT NULL, damage SMALLINT UNSIGNED NOT NULL, hidden TINYINT(1) NOT NULL, INDEX IDX_355EB59495B82273 (weapon_id), UNIQUE INDEX element_idx (weapon_id, type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE weapon_elements ADD CONSTRAINT FK_355EB59495B82273 FOREIGN KEY (weapon_id) REFERENCES weapons (id)'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 24 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 25 | 26 | $this->addSql('DROP TABLE weapon_elements'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Migrations/Version20180424202745.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE decorations_skill_ranks (decoration_id INT UNSIGNED NOT NULL, skill_rank_id INT UNSIGNED NOT NULL, INDEX IDX_5D2A04FA3446DFC4 (decoration_id), INDEX IDX_5D2A04FA6CE3F9A6 (skill_rank_id), PRIMARY KEY(decoration_id, skill_rank_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE decorations_skill_ranks ADD CONSTRAINT FK_5D2A04FA3446DFC4 FOREIGN KEY (decoration_id) REFERENCES decorations (id)'); 19 | $this->addSql('ALTER TABLE decorations_skill_ranks ADD CONSTRAINT FK_5D2A04FA6CE3F9A6 FOREIGN KEY (skill_rank_id) REFERENCES skill_ranks (id)'); 20 | 21 | $stmt = $this->connection->createQueryBuilder() 22 | ->from('decorations', 'd') 23 | ->select('d.id', 'd.skill_id') 24 | ->execute(); 25 | 26 | while ($deco = $stmt->fetch(\PDO::FETCH_OBJ)) 27 | $this->addSql('INSERT INTO decorations_skill_ranks (decoration_id, skill_rank_id) VALUES (?, ?)', [ 28 | (int)$deco->id, 29 | (int)$deco->skill_id, 30 | ], [ 31 | \PDO::PARAM_INT, 32 | \PDO::PARAM_INT, 33 | ]); 34 | } 35 | 36 | public function down(Schema $schema): void { 37 | // this down() migration is auto-generated, please modify it to your needs 38 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 39 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 40 | 41 | $this->addSql('DROP TABLE decorations_skill_ranks'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Migrations/Version20180425142735.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE charm_ranks (id INT UNSIGNED AUTO_INCREMENT NOT NULL, charm_id INT UNSIGNED NOT NULL, name VARCHAR(64) NOT NULL, level SMALLINT NOT NULL, INDEX IDX_DF91C65593E9261F (charm_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('CREATE TABLE charm_ranks_skill_ranks (charm_rank_id INT UNSIGNED NOT NULL, skill_rank_id INT UNSIGNED NOT NULL, INDEX IDX_B86027C63BA5C9D1 (charm_rank_id), INDEX IDX_B86027C66CE3F9A6 (skill_rank_id), PRIMARY KEY(charm_rank_id, skill_rank_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE charm_ranks ADD CONSTRAINT FK_DF91C65593E9261F FOREIGN KEY (charm_id) REFERENCES charms (id)'); 20 | $this->addSql('ALTER TABLE charm_ranks_skill_ranks ADD CONSTRAINT FK_B86027C63BA5C9D1 FOREIGN KEY (charm_rank_id) REFERENCES charm_ranks (id)'); 21 | $this->addSql('ALTER TABLE charm_ranks_skill_ranks ADD CONSTRAINT FK_B86027C66CE3F9A6 FOREIGN KEY (skill_rank_id) REFERENCES skill_ranks (id)'); 22 | $this->addSql('DROP TABLE charms_skill_ranks'); 23 | 24 | $this->addSql('DELETE FROM charms'); 25 | } 26 | 27 | public function down(Schema $schema): void { 28 | /** @noinspection PhpUnhandledExceptionInspection */ 29 | $this->throwIrreversibleMigrationException(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Migrations/Version20180426174437.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE charm_ranks ADD rarity SMALLINT UNSIGNED NULL'); 18 | $this->addSql('UPDATE charm_ranks SET rarity = 0'); 19 | $this->addSql('ALTER TABLE charm_ranks CHANGE rarity rarity SMALLINT UNSIGNED NOT NULL'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 25 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('ALTER TABLE charm_ranks DROP rarity'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Migrations/Version20180501002023.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE weapon_sharpnesses ADD white INT UNSIGNED NOT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE weapon_sharpnesses DROP white'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180508195230.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE weapon_assets DROP INDEX UNIQ_442452A954B9D732, ADD INDEX IDX_442452A954B9D732 (icon_id)'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE weapon_assets DROP INDEX IDX_442452A954B9D732, ADD UNIQUE INDEX UNIQ_442452A954B9D732 (icon_id)'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180509025030.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE weapon_assets DROP INDEX UNIQ_442452A93DA5256D, ADD INDEX IDX_442452A93DA5256D (image_id)'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE weapon_assets DROP INDEX IDX_442452A93DA5256D, ADD UNIQUE INDEX UNIQ_442452A93DA5256D (image_id)'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180509191153.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE weapons ADD attack_display SMALLINT UNSIGNED NOT NULL DEFAULT 0, ADD attack_raw SMALLINT UNSIGNED NOT NULL DEFAULT 0'); 18 | $this->addSql('UPDATE weapons SET attack_raw = 0'); 19 | $this->addSql('UPDATE weapons SET attack_display = JSON_UNQUOTE(JSON_EXTRACT(attributes, "$.attack"))'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 25 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('ALTER TABLE weapons DROP attack_display, DROP attack_raw'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Migrations/Version20180510043211.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE motion_values (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(64) NOT NULL, weapon_type VARCHAR(32) NOT NULL, damage_type VARCHAR(32) DEFAULT NULL, stun_potency SMALLINT UNSIGNED DEFAULT NULL, exhaust_potency SMALLINT UNSIGNED DEFAULT NULL, hits JSON NOT NULL, UNIQUE INDEX name_weapon_type_idx (weapon_type, name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('DROP TABLE motion_values'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180511152554.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE decorations DROP FOREIGN KEY FK_53BB9DDD5585C142'); 18 | $this->addSql('DROP INDEX UNIQ_53BB9DDD5585C142 ON decorations'); 19 | $this->addSql('ALTER TABLE decorations DROP skill_id'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | $this->throwIrreversibleMigrationException(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Migrations/Version20180512214206.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE motion_values ADD hits_length INT UNSIGNED DEFAULT 0 NOT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE motion_values DROP hits_length'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180817042139.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE items ADD _value INT UNSIGNED NOT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE items DROP _value'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Migrations/Version20180820053757.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('CREATE TABLE weapon_durability (weapon_id INT UNSIGNED NOT NULL, sharpness_id INT UNSIGNED NOT NULL, INDEX IDX_F83322FA95B82273 (weapon_id), INDEX IDX_F83322FA537ED785 (sharpness_id), PRIMARY KEY(weapon_id, sharpness_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE weapon_durability ADD CONSTRAINT FK_F83322FA95B82273 FOREIGN KEY (weapon_id) REFERENCES weapons (id)'); 19 | $this->addSql('ALTER TABLE weapon_durability ADD CONSTRAINT FK_F83322FA537ED785 FOREIGN KEY (sharpness_id) REFERENCES weapon_sharpnesses (id)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 25 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('DROP TABLE weapon_durability'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Migrations/Version20180820133425.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 15 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 16 | 17 | $this->addSql('ALTER TABLE weapons DROP durability_length'); 18 | } 19 | 20 | public function up(Schema $schema): void { 21 | // this up() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE weapons ADD durability_length INT UNSIGNED DEFAULT 0 NOT NULL'); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Migrations/Version20180827032437.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE camps (id INT UNSIGNED AUTO_INCREMENT NOT NULL, location_id INT UNSIGNED DEFAULT NULL, name VARCHAR(255) NOT NULL, zone SMALLINT UNSIGNED NOT NULL, INDEX IDX_3D166BE564D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('CREATE TABLE locations (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(32) NOT NULL, zone_count SMALLINT UNSIGNED NOT NULL, UNIQUE INDEX UNIQ_17E64ABA5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE camps ADD CONSTRAINT FK_3D166BE564D218E FOREIGN KEY (location_id) REFERENCES locations (id)'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 24 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 25 | 26 | $this->addSql('ALTER TABLE camps DROP FOREIGN KEY FK_3D166BE564D218E'); 27 | $this->addSql('DROP TABLE camps'); 28 | $this->addSql('DROP TABLE locations'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20180831210258.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('DROP TABLE monster_resistances'); 17 | } 18 | 19 | public function up(Schema $schema): void { 20 | // this up() migration is auto-generated, please modify it to your needs 21 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 22 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 23 | 24 | $this->addSql('CREATE TABLE monster_resistances (id INT UNSIGNED AUTO_INCREMENT NOT NULL, monster_id INT UNSIGNED NOT NULL, element VARCHAR(32) NOT NULL, `condition` LONGTEXT NOT NULL, INDEX IDX_7DE8A429C5FF1223 (monster_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Migrations/Version20180901231350.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT NOT NULL, email VARCHAR(254) NOT NULL, username VARCHAR(32) NOT NULL, password VARCHAR(64) NOT NULL, UNIQUE INDEX UNIQ_1483A5E9E7927C74 (email), UNIQUE INDEX UNIQ_1483A5E9F85E0677 (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('CREATE TABLE user_roles (id INT UNSIGNED AUTO_INCREMENT NOT NULL, user_id INT UNSIGNED NOT NULL, INDEX IDX_54FCD59FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 18 | $this->addSql('ALTER TABLE user_roles ADD CONSTRAINT FK_54FCD59FA76ED395 FOREIGN KEY (user_id) REFERENCES users (id)'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 24 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 25 | 26 | $this->addSql('ALTER TABLE user_roles DROP FOREIGN KEY FK_54FCD59FA76ED395'); 27 | $this->addSql('DROP TABLE users'); 28 | $this->addSql('DROP TABLE user_roles'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20180904043326.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('CREATE TABLE monster_weaknesses (id INT UNSIGNED AUTO_INCREMENT NOT NULL, monster_id INT UNSIGNED NOT NULL, element VARCHAR(32) NOT NULL, stars SMALLINT UNSIGNED NOT NULL, INDEX IDX_1D01676C5FF1223 (monster_id), UNIQUE INDEX UNIQ_1D01676C5FF122341405E39 (monster_id, element), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 17 | $this->addSql('ALTER TABLE monster_weaknesses ADD CONSTRAINT FK_1D01676C5FF1223 FOREIGN KEY (monster_id) REFERENCES monsters (id)'); 18 | $this->addSql('ALTER TABLE monster_resistances ADD CONSTRAINT FK_7DE8A429C5FF1223 FOREIGN KEY (monster_id) REFERENCES monsters (id)'); 19 | $this->addSql('CREATE UNIQUE INDEX UNIQ_7DE8A429C5FF122341405E39 ON monster_resistances (monster_id, element)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 25 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('DROP TABLE monster_weaknesses'); 28 | $this->addSql('ALTER TABLE monster_resistances DROP FOREIGN KEY FK_7DE8A429C5FF1223'); 29 | $this->addSql('DROP INDEX UNIQ_7DE8A429C5FF122341405E39 ON monster_resistances'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Migrations/Version20180904044221.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('ALTER TABLE monster_resistances CHANGE `condition` `condition` LONGTEXT DEFAULT NULL'); 17 | $this->addSql('ALTER TABLE monster_weaknesses ADD `condition` LONGTEXT DEFAULT NULL'); 18 | } 19 | 20 | public function down(Schema $schema): void { 21 | // this down() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE monster_resistances CHANGE `condition` `condition` LONGTEXT NOT NULL COLLATE utf8mb4_unicode_ci'); 26 | $this->addSql('ALTER TABLE monster_weaknesses DROP `condition`'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Migrations/Version20180906174306.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('DROP INDEX UNIQ_1483A5E9D5499347 ON users'); 17 | $this->addSql('ALTER TABLE users CHANGE display_name username VARCHAR(32) NOT NULL COLLATE utf8mb4_unicode_ci'); 18 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1483A5E9F85E0677 ON users (username)'); 19 | } 20 | 21 | public function up(Schema $schema): void { 22 | // this up() migration is auto-generated, please modify it to your needs 23 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 24 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 25 | 26 | $this->addSql('DROP INDEX UNIQ_1483A5E9F85E0677 ON users'); 27 | $this->addSql('ALTER TABLE users CHANGE username display_name VARCHAR(32) NOT NULL'); 28 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1483A5E9D5499347 ON users (display_name)'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20180906174847.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 14 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 15 | 16 | $this->addSql('DROP INDEX UNIQ_54FCD59FA76ED3955E237E06 ON user_roles'); 17 | $this->addSql('ALTER TABLE user_roles DROP name'); 18 | } 19 | 20 | public function up(Schema $schema): void { 21 | // this up() migration is auto-generated, please modify it to your needs 22 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 23 | 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 24 | 25 | $this->addSql('ALTER TABLE user_roles ADD name VARCHAR(32) NOT NULL'); 26 | $this->addSql('CREATE UNIQUE INDEX UNIQ_54FCD59FA76ED3955E237E06 ON user_roles (user_id, name)'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Migrations/Version20180927205355.php: -------------------------------------------------------------------------------- 1 | abortIf( 15 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 16 | 'Migration can only be executed safely on \'mysql\'.' 17 | ); 18 | 19 | $this->addSql('DROP INDEX UNIQ_1D01676C5FF122341405E39 ON monster_weaknesses'); 20 | $this->addSql('DROP INDEX UNIQ_7DE8A429C5FF122341405E39 ON monster_resistances'); 21 | } 22 | 23 | public function down(Schema $schema): void { 24 | // this down() migration is auto-generated, please modify it to your needs 25 | $this->abortIf( 26 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 27 | 'Migration can only be executed safely on \'mysql\'.' 28 | ); 29 | 30 | $this->addSql('CREATE UNIQUE INDEX UNIQ_7DE8A429C5FF122341405E39 ON monster_resistances (monster_id, element)'); 31 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1D01676C5FF122341405E39 ON monster_weaknesses (monster_id, element)'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Migrations/Version20180927210739.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 14 | 15 | $this->addSql('ALTER TABLE monster_weaknesses ADD _condition LONGTEXT DEFAULT NULL'); 16 | $this->addSql('UPDATE monster_weaknesses SET _condition = `condition`'); 17 | $this->addSql('ALTER TABLE monster_weaknesses DROP `condition`'); 18 | $this->addSql('ALTER TABLE monster_resistances ADD _condition LONGTEXT DEFAULT NULL'); 19 | $this->addSql('UPDATE monster_resistances SET _condition = `condition`'); 20 | $this->addSql('ALTER TABLE monster_resistances DROP `condition`'); 21 | } 22 | 23 | public function down(Schema $schema): void { 24 | // this down() migration is auto-generated, please modify it to your needs 25 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('ALTER TABLE monster_resistances ADD `condition` LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); 28 | $this->addSql('UPDATE monster_resistances SET `condition` = _condition'); 29 | $this->addSql('ALTER TABLE monster_resistances DROP _condition'); 30 | $this->addSql('ALTER TABLE monster_weaknesses ADD `condition` LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci'); 31 | $this->addSql('UPDATE monster_weaknesses SET `condition` = _condition'); 32 | $this->addSql('ALTER TABLE monster_weaknesses DROP _condition'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Migrations/Version20190402180838.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE users ADD created_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD disabled TINYINT(1) NOT NULL, CHANGE password password VARCHAR(64) DEFAULT NULL'); 19 | 20 | $this->addSql( 21 | 'UPDATE users SET created_date = ? WHERE created_date IS NULL', 22 | [ 23 | date('Y-m-d G:i:s'), 24 | ], 25 | [ 26 | \PDO::PARAM_STR, 27 | ] 28 | ); 29 | } 30 | 31 | public function down(Schema $schema): void { 32 | // this down() migration is auto-generated, please modify it to your needs 33 | $this->abortIf( 34 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 35 | 'Migration can only be executed safely on \'mysql\'.' 36 | ); 37 | 38 | $this->addSql('ALTER TABLE users DROP created_date, DROP disabled, CHANGE password password VARCHAR(64) NOT NULL COLLATE utf8mb4_unicode_ci'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Migrations/Version20190402201320.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE users ADD activation_code VARCHAR(64) DEFAULT NULL, ADD password_reset_code VARCHAR(64) DEFAULT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE users DROP activation_code, DROP password_reset_code'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190416060719.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('CREATE TABLE world_events (id INT UNSIGNED AUTO_INCREMENT NOT NULL, location_id INT UNSIGNED NOT NULL, name VARCHAR(128) NOT NULL, type VARCHAR(128) NOT NULL, platform VARCHAR(16) NOT NULL, start_timestamp DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_timestamp DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', quest_rank SMALLINT UNSIGNED NOT NULL, description LONGTEXT DEFAULT NULL, requirements LONGTEXT DEFAULT NULL, success_conditions LONGTEXT DEFAULT NULL, exclusive VARCHAR(16) DEFAULT NULL, INDEX IDX_C3B92A0964D218E (location_id), UNIQUE INDEX UNIQ_C3B92A093952D0CB5E237E066D1E9DF8 (platform, name, start_timestamp), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE world_events ADD CONSTRAINT FK_C3B92A0964D218E FOREIGN KEY (location_id) REFERENCES locations (id)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf( 25 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 26 | 'Migration can only be executed safely on \'mysql\'.' 27 | ); 28 | 29 | $this->addSql('DROP TABLE world_events'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Migrations/Version20190416135847.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE locations ADD camps_length INT UNSIGNED DEFAULT 0 NOT NULL'); 19 | $this->addSql('ALTER TABLE monsters ADD ailments_length INT UNSIGNED DEFAULT 0 NOT NULL, ADD locations_length INT UNSIGNED DEFAULT 0 NOT NULL, ADD elements_length INT UNSIGNED DEFAULT 0 NOT NULL'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf( 25 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 26 | 'Migration can only be executed safely on \'mysql\'.' 27 | ); 28 | 29 | $this->addSql('ALTER TABLE locations DROP camps_length'); 30 | $this->addSql('ALTER TABLE monsters DROP ailments_length, DROP locations_length, DROP elements_length'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Migrations/Version20190421032824.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE monsters ADD rewards_length INT UNSIGNED DEFAULT 0 NOT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE monsters DROP rewards_length'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190421062414.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('CREATE UNIQUE INDEX UNIQ_4B43AF08C5FF1223126F525E ON monster_rewards (monster_id, item_id)'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('DROP INDEX UNIQ_4B43AF08C5FF1223126F525E ON monster_rewards'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190421063540.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE reward_conditions CHANGE stack_size quantity SMALLINT UNSIGNED NOT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE reward_conditions CHANGE quantity stack_size SMALLINT UNSIGNED NOT NULL'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190712201512.php: -------------------------------------------------------------------------------- 1 | abortIf( 15 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 16 | 'Migration can only be executed safely on \'mysql\'.' 17 | ); 18 | 19 | $this->addSql('ALTER TABLE weapons ADD elderseal VARCHAR(16) DEFAULT NULL'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf( 25 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 26 | 'Migration can only be executed safely on \'mysql\'.' 27 | ); 28 | 29 | $this->addSql('ALTER TABLE weapons DROP elderseal'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Migrations/Version20190815181742.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('CREATE TABLE weapon_phials (id INT UNSIGNED AUTO_INCREMENT NOT NULL, type VARCHAR(32) NOT NULL, damage SMALLINT UNSIGNED DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE weapons ADD phial_id INT UNSIGNED DEFAULT NULL'); 20 | $this->addSql('ALTER TABLE weapons ADD CONSTRAINT FK_520EBBE11272188D FOREIGN KEY (phial_id) REFERENCES weapon_phials (id)'); 21 | $this->addSql('CREATE UNIQUE INDEX UNIQ_520EBBE11272188D ON weapons (phial_id)'); 22 | } 23 | 24 | public function down(Schema $schema): void { 25 | // this down() migration is auto-generated, please modify it to your needs 26 | $this->abortIf( 27 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 28 | 'Migration can only be executed safely on \'mysql\'.' 29 | ); 30 | 31 | $this->addSql('ALTER TABLE weapons DROP FOREIGN KEY FK_520EBBE11272188D'); 32 | $this->addSql('DROP TABLE weapon_phials'); 33 | $this->addSql('DROP INDEX UNIQ_520EBBE11272188D ON weapons'); 34 | $this->addSql('ALTER TABLE weapons DROP phial_id'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Migrations/Version20190815211202.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('CREATE TABLE weapon_ammo (id INT UNSIGNED AUTO_INCREMENT NOT NULL, weapon_id INT UNSIGNED NOT NULL, type VARCHAR(32) NOT NULL, capacities LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', INDEX IDX_579096D595B82273 (weapon_id), INDEX IDX_579096D58CDE5729 (type), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE weapon_ammo ADD CONSTRAINT FK_579096D595B82273 FOREIGN KEY (weapon_id) REFERENCES weapons (id)'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf( 25 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 26 | 'Migration can only be executed safely on \'mysql\'.' 27 | ); 28 | 29 | $this->addSql('DROP TABLE weapon_ammo'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Migrations/Version20190819180404.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE weapons ADD coatings LONGTEXT NOT NULL DEFAULT "[]" COMMENT \'(DC2Type:json)\''); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE weapons DROP coatings'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190819182923.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE weapons ADD ammo_length INT UNSIGNED DEFAULT 0 NOT NULL, ADD coatings_length INT UNSIGNED DEFAULT 0 NOT NULL'); 19 | $this->addSql('ALTER TABLE weapon_ammo ADD capacities_length INT UNSIGNED DEFAULT 0 NOT NULL'); 20 | } 21 | 22 | public function down(Schema $schema): void { 23 | // this down() migration is auto-generated, please modify it to your needs 24 | $this->abortIf( 25 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 26 | 'Migration can only be executed safely on \'mysql\'.' 27 | ); 28 | 29 | $this->addSql('ALTER TABLE weapon_ammo DROP capacities_length'); 30 | $this->addSql('ALTER TABLE weapons DROP ammo_length, DROP coatings_length'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Migrations/Version20190913190444.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE weapons ADD special_ammo VARCHAR(32) DEFAULT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE weapons DROP special_ammo'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190916180239.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('ALTER TABLE weapons ADD deviation VARCHAR(32) DEFAULT NULL'); 19 | } 20 | 21 | public function down(Schema $schema): void { 22 | // this down() migration is auto-generated, please modify it to your needs 23 | $this->abortIf( 24 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 25 | 'Migration can only be executed safely on \'mysql\'.' 26 | ); 27 | 28 | $this->addSql('ALTER TABLE weapons DROP deviation'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Migrations/Version20190916211506.php: -------------------------------------------------------------------------------- 1 | abortIf( 14 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 15 | 'Migration can only be executed safely on \'mysql\'.' 16 | ); 17 | 18 | $this->addSql('CREATE TABLE weapon_shelling (id INT UNSIGNED AUTO_INCREMENT NOT NULL, weapon_id INT UNSIGNED NOT NULL, type VARCHAR(16) NOT NULL, level SMALLINT UNSIGNED NOT NULL, UNIQUE INDEX UNIQ_9415F73295B82273 (weapon_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('ALTER TABLE weapon_shelling ADD CONSTRAINT FK_9415F73295B82273 FOREIGN KEY (weapon_id) REFERENCES weapons (id)'); 20 | $this->addSql('ALTER TABLE weapons ADD boost_type VARCHAR(32) DEFAULT NULL, ADD damage_type VARCHAR(32) DEFAULT NULL'); 21 | } 22 | 23 | public function down(Schema $schema): void { 24 | // this down() migration is auto-generated, please modify it to your needs 25 | $this->abortIf( 26 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 27 | 'Migration can only be executed safely on \'mysql\'.' 28 | ); 29 | 30 | $this->addSql('DROP TABLE weapon_shelling'); 31 | $this->addSql('ALTER TABLE weapons DROP boost_type, DROP damage_type'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Migrations/Version20191216214009.php: -------------------------------------------------------------------------------- 1 | abortIf( 20 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 21 | 'Migration can only be executed safely on \'mysql\'.' 22 | ); 23 | 24 | $this->addSql('DROP INDEX UNIQ_C3B92A093952D0CB5E237E066D1E9DF8 ON world_events'); 25 | $this->addSql('ALTER TABLE world_events ADD expansion VARCHAR(32) NOT NULL DEFAULT "base", ADD master_rank TINYINT(1) NOT NULL DEFAULT "0"'); 26 | $this->addSql('CREATE UNIQUE INDEX UNIQ_C3B92A093952D0CB5E237E06F0695B726D1E9DF8 ON world_events (platform, name, expansion, start_timestamp)'); 27 | } 28 | 29 | public function down(Schema $schema): void { 30 | // this down() migration is auto-generated, please modify it to your needs 31 | $this->abortIf( 32 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 33 | 'Migration can only be executed safely on \'mysql\'.' 34 | ); 35 | 36 | $this->addSql('DROP INDEX UNIQ_C3B92A093952D0CB5E237E06F0695B726D1E9DF8 ON world_events'); 37 | $this->addSql('ALTER TABLE world_events DROP expansion'); 38 | $this->addSql('CREATE UNIQUE INDEX UNIQ_C3B92A093952D0CB5E237E066D1E9DF8 ON world_events (platform, name, start_timestamp)'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Migrations/Version20200205193214.php: -------------------------------------------------------------------------------- 1 | abortIf( 20 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 21 | 'Migration can only be executed safely on \'mysql\'.' 22 | ); 23 | 24 | $this->addSql('CREATE TABLE charm_rank_strings (id INT UNSIGNED AUTO_INCREMENT NOT NULL, charm_rank_id INT UNSIGNED NOT NULL, name VARCHAR(64) NOT NULL, language VARCHAR(7) NOT NULL, UNIQUE INDEX UNIQ_3E4E813A5E237E06 (name), INDEX IDX_3E4E813A3BA5C9D1 (charm_rank_id), UNIQUE INDEX UNIQ_3E4E813A3BA5C9D1D4DB71B5 (charm_rank_id, language), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); 25 | $this->addSql('ALTER TABLE charm_rank_strings ADD CONSTRAINT FK_3E4E813A3BA5C9D1 FOREIGN KEY (charm_rank_id) REFERENCES charm_ranks (id)'); 26 | $this->addSql('INSERT INTO charm_rank_strings (charm_rank_id, language, name) SELECT id, "en", name FROM charm_ranks'); 27 | $this->addSql('DROP INDEX UNIQ_DF91C6555E237E06 ON charm_ranks'); 28 | $this->addSql('ALTER TABLE charm_ranks DROP name'); 29 | } 30 | 31 | public function down(Schema $schema): void { 32 | $this->throwIrreversibleMigrationException(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Migrations/Version20200205205458.php: -------------------------------------------------------------------------------- 1 | abortIf( 20 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 21 | 'Migration can only be executed safely on \'mysql\'.' 22 | ); 23 | 24 | $this->addSql('ALTER TABLE reward_conditions ADD subtype VARCHAR(128) DEFAULT NULL'); 25 | $this->addSql('UPDATE reward_conditions r LEFT JOIN reward_condition_strings s ON r.id = s.reward_condition_id AND s.language = "en" SET r.subtype = s.subtype'); 26 | $this->addSql('DROP TABLE reward_condition_strings'); 27 | } 28 | 29 | public function down(Schema $schema): void { 30 | $this->throwIrreversibleMigrationException(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Migrations/Version20200205214957.php: -------------------------------------------------------------------------------- 1 | abortIf( 20 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 21 | 'Migration can only be executed safely on \'mysql\'.' 22 | ); 23 | 24 | $this->addSql('ALTER TABLE weapon_sharpnesses ADD purple INT UNSIGNED NOT NULL DEFAULT 0'); 25 | } 26 | 27 | public function down(Schema $schema): void { 28 | // this down() migration is auto-generated, please modify it to your needs 29 | $this->abortIf( 30 | $this->connection->getDatabasePlatform()->getName() !== 'mysql', 31 | 'Migration can only be executed safely on \'mysql\'.' 32 | ); 33 | 34 | $this->addSql('ALTER TABLE weapon_sharpnesses DROP purple'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Repository/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LartTyler/MHWDB-API/0ac2a580bac8fde6ae684e66720092c88a9675d5/src/Repository/.gitignore -------------------------------------------------------------------------------- /src/Repository/AilmentProtectionRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(AilmentProtection::class, 'p') 18 | ->select('p') 19 | ->where(':item MEMBER OF p.items') 20 | ->setParameter('item', $item) 21 | ->getQuery() 22 | ->getResult(); 23 | } 24 | 25 | /** 26 | * @param Skill $skill 27 | * 28 | * @return AilmentProtection[] 29 | */ 30 | public function findBySkill(Skill $skill): array { 31 | return $this->getEntityManager()->createQueryBuilder() 32 | ->from(AilmentProtection::class, 'p') 33 | ->select('p') 34 | ->where(':skill MEMBER OF p.skills') 35 | ->setParameter('skill', $skill) 36 | ->getQuery() 37 | ->getResult(); 38 | } 39 | } -------------------------------------------------------------------------------- /src/Repository/AilmentRecoveryRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 16 | ->from(AilmentRecovery::class, 'r') 17 | ->select('r') 18 | ->where(':item MEMBER OF r.items') 19 | ->setParameter('item', $item) 20 | ->getQuery() 21 | ->getResult(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Repository/ArmorRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(Armor::class, 'a') 18 | ->leftJoin('a.skills', 's') 19 | ->select('a') 20 | ->where('s.skill = :skill') 21 | ->setParameter('skill', $skill) 22 | ->getQuery() 23 | ->getResult(); 24 | } 25 | 26 | /** 27 | * @param SkillRank $rank 28 | * 29 | * @return int 30 | */ 31 | public function countBySkillRank(SkillRank $rank): int { 32 | return (int)$this->getEntityManager()->createQueryBuilder() 33 | ->from(Armor::class, 'a') 34 | ->select('COUNT(a)') 35 | ->where(':rank MEMBER OF a.skills') 36 | ->setParameter('rank', $rank) 37 | ->getQuery() 38 | ->getSingleScalarResult(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Repository/ArmorSetBonusRankRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(ArmorSetBonusRank::class, 'b') 18 | ->leftJoin('b.skill', 's') 19 | ->select('b') 20 | ->where('s.skill = :skill') 21 | ->setParameter('skill', $skill) 22 | ->getQuery() 23 | ->getResult(); 24 | } 25 | 26 | /** 27 | * @param SkillRank $rank 28 | * 29 | * @return int 30 | */ 31 | public function countBySkillRank(SkillRank $rank): int { 32 | return (int)$this->getEntityManager()->createQueryBuilder() 33 | ->from(ArmorSetBonusRank::class, 'b') 34 | ->select('COUNT(b)') 35 | ->where('b.skill = :rank') 36 | ->setParameter('rank', $rank) 37 | ->getQuery() 38 | ->getSingleScalarResult(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Repository/CharmRankRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(CharmRank::class, 'c') 18 | ->leftJoin('c.skills', 's') 19 | ->select('c') 20 | ->where('s.skill = :skill') 21 | ->setParameter('skill', $skill) 22 | ->getQuery() 23 | ->getResult(); 24 | } 25 | 26 | /** 27 | * @param SkillRank $rank 28 | * 29 | * @return int 30 | */ 31 | public function countBySkillRank(SkillRank $rank): int { 32 | return (int)$this->getEntityManager()->createQueryBuilder() 33 | ->from(CharmRank::class, 'c') 34 | ->select('COUNT(c)') 35 | ->where(':rank MEMBER OF c.skills') 36 | ->setParameter('rank', $rank) 37 | ->getQuery() 38 | ->getSingleScalarResult(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Repository/DecorationRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(Decoration::class, 'd') 18 | ->leftJoin('d.skills', 's') 19 | ->select('d') 20 | ->where('s.skill = :skill') 21 | ->setParameter('skill', $skill) 22 | ->getQuery() 23 | ->getResult(); 24 | } 25 | 26 | /** 27 | * @param SkillRank $rank 28 | * 29 | * @return int 30 | */ 31 | public function countBySkillRank(SkillRank $rank): int { 32 | return (int)$this->getEntityManager()->createQueryBuilder() 33 | ->from(Decoration::class, 'd') 34 | ->select('COUNT(d)') 35 | ->where(':rank MEMBER OF d.skills') 36 | ->setParameter('rank', $rank) 37 | ->getQuery() 38 | ->getSingleScalarResult(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Repository/LocationRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 16 | ->from(Location::class, 'l') 17 | ->leftJoin('l.strings', 's') 18 | ->select('l') 19 | ->where('s.language = :language') 20 | ->andWhere('s.name = :name') 21 | ->setMaxResults(1) 22 | ->setParameter('language', $language) 23 | ->setParameter('name', $name) 24 | ->getQuery() 25 | ->getOneOrNullResult(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Repository/MonsterRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 17 | ->from(Monster::class, 'm') 18 | ->leftJoin('m.ailments', 'a') 19 | ->select('m') 20 | ->where('a.id = :ailment') 21 | ->setParameter('ailment', $ailment) 22 | ->getQuery() 23 | ->getResult(); 24 | } 25 | 26 | /** 27 | * @param Location $location 28 | * 29 | * @return Monster[] 30 | */ 31 | public function findByLocation(Location $location): array { 32 | return $this->getEntityManager()->createQueryBuilder() 33 | ->from(Monster::class, 'm') 34 | ->select('m') 35 | ->where(':location MEMBER OF m.locations') 36 | ->setParameter('location', $location) 37 | ->getQuery() 38 | ->getResult(); 39 | } 40 | } -------------------------------------------------------------------------------- /src/Repository/WorldEventRepository.php: -------------------------------------------------------------------------------- 1 | getEntityManager()->createQueryBuilder() 23 | ->from(WorldEvent::class, 'e') 24 | ->leftJoin('e.strings', 's') 25 | ->select('e') 26 | ->where('s.language = :language') 27 | ->andWhere('s.name = :name') 28 | ->andWhere('e.platform = :platform') 29 | ->andWhere('e.startTimestamp = :start') 30 | ->setMaxResults(1) 31 | ->setParameter('language', $language) 32 | ->setParameter('name', $name) 33 | ->setParameter('platform', $platform) 34 | ->setParameter('start', $startTimestamp) 35 | ->getQuery() 36 | ->getOneOrNullResult(); 37 | } 38 | } -------------------------------------------------------------------------------- /src/Resources/data/missing-skills.json: -------------------------------------------------------------------------------- 1 | { 2 | "Great Luck": { 3 | "description": "High chance of increased quest rewards. (No effect when joining mid-quest.)", 4 | "ranks": [ 5 | { 6 | "level": 1, 7 | "description": "High chance of increased quest rewards. (No effect when joining mid-quest.)" 8 | } 9 | ] 10 | }, 11 | "Carving Master": { 12 | "description": "Lets you carve one additional time. (No effect when joining mid-quest.)", 13 | "ranks": [ 14 | { 15 | "level": 1, 16 | "description": "Lets you carve one additional time. (No effect when joining mid-quest.)" 17 | } 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /src/Resources/data/monsters.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Apceros", 4 | "type": "small", 5 | "species": "herbivore", 6 | "elements": [], 7 | "ailments": [], 8 | "weaknesses": [ 9 | { 10 | "element": "fire", 11 | "magnitude": 1 12 | }, 13 | { 14 | "element": "thunder", 15 | "magnitude": 1 16 | } 17 | ], 18 | "locations": [ 19 | "Wildspire Waste" 20 | ] 21 | }, 22 | { 23 | "name": "Aptonoth", 24 | "type": "small", 25 | "species": "herbivore", 26 | "elements": [], 27 | "ailments": [], 28 | "weaknesses": [ 29 | { 30 | "element": "fire", 31 | "magnitude": 1 32 | }, 33 | { 34 | "element": "water", 35 | "magnitude": 1 36 | }, 37 | { 38 | "element": "thunder", 39 | "magnitude": 1 40 | }, 41 | { 42 | "element": "ice", 43 | "magnitude": 1 44 | } 45 | ], 46 | "locations": [ 47 | "Ancient Forest" 48 | ] 49 | } 50 | ] -------------------------------------------------------------------------------- /src/Resources/schemas/armor-set.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/armor-set", 4 | "title": "Armor Set", 5 | "description": "An armor set", 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "The name of the armor set" 11 | }, 12 | "pieces": { 13 | "type": "array", 14 | "description": "An array of armor pieces that make up the set", 15 | "items": { 16 | "$ref": "https://mhw-db.com/schemas/entity-reference" 17 | } 18 | }, 19 | "rank": { 20 | "type": "string", 21 | "description": "The armor set's rank", 22 | "enum": [ 23 | "low", 24 | "high" 25 | ] 26 | } 27 | }, 28 | "required": [ 29 | "name", 30 | "pieces", 31 | "rank" 32 | ] 33 | } -------------------------------------------------------------------------------- /src/Resources/schemas/asset.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/asset", 4 | "title": "Asset", 5 | "description": "An asset", 6 | "type": ["object", "null"], 7 | "properties": { 8 | "primaryHash": { 9 | "type": "string", 10 | "description": "A SHA-1 hash, used in combination with the secondaryHash to enforce asset uniqueness" 11 | }, 12 | "secondaryHash": { 13 | "type": "string", 14 | "description": "An MD5 hash, used in combination with the primaryHash to enforce asset uniqueness" 15 | }, 16 | "uri": { 17 | "type": "string", 18 | "format": "uri", 19 | "description": "The complete URI to the asset" 20 | } 21 | }, 22 | "required": [ 23 | "primaryHash", 24 | "secondaryHash", 25 | "uri" 26 | ] 27 | } -------------------------------------------------------------------------------- /src/Resources/schemas/damage-element.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/damage-element", 4 | "title": "Damage Element", 5 | "description": "An element that's inflicted solely as damage", 6 | "type": "string", 7 | "enum": [ 8 | "fire", 9 | "water", 10 | "ice", 11 | "thunder", 12 | "dragon" 13 | ] 14 | } -------------------------------------------------------------------------------- /src/Resources/schemas/damage-type.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/damage-type", 4 | "title": "Damage Type", 5 | "type": "string", 6 | "enum": [ 7 | "blunt", 8 | "sever", 9 | "projectile" 10 | ] 11 | } -------------------------------------------------------------------------------- /src/Resources/schemas/decoration.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/decoration", 4 | "title": "Decoration", 5 | "description": "A decoration", 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "The name of the decoration" 11 | }, 12 | "rarity": { 13 | "type": "integer", 14 | "description": "The decoration's rarity", 15 | "minimum": 1, 16 | "maximum": 8 17 | }, 18 | "skills": { 19 | "type": "array", 20 | "description": "An array of skill ranks (in shorthand format) provided by the decoration", 21 | "items": { 22 | "$ref": "https://mhw-db.com/schemas/skill-rank-shorthand" 23 | } 24 | }, 25 | "slot": { 26 | "type": "integer", 27 | "description": "The slot that the decoration fits into", 28 | "minimum": 1, 29 | "maximum": 3 30 | }, 31 | "slug": { 32 | "type": "string", 33 | "description": "The decoratin's unique slug" 34 | } 35 | }, 36 | "required": [ 37 | "name", 38 | "rarity", 39 | "skills", 40 | "slot", 41 | "slug" 42 | ] 43 | } -------------------------------------------------------------------------------- /src/Resources/schemas/element.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/element", 4 | "title": "Element", 5 | "description": "An element (such as thunder or poison)", 6 | "oneOf": [ 7 | { 8 | "$ref": "https://mhw-db.com/schemas/damage-element" 9 | }, 10 | { 11 | "$ref": "https://mhw-db.com/schemas/status-element" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /src/Resources/schemas/entity-reference.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/entity-reference", 4 | "title": "Entity Reference", 5 | "description": "A reference to another entity in the API", 6 | "type": "integer" 7 | } -------------------------------------------------------------------------------- /src/Resources/schemas/item.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/item", 4 | "title": "Item", 5 | "description": "An item", 6 | "type": "object", 7 | "properties": { 8 | "carryLimit": { 9 | "type": "integer", 10 | "description": "The maximum item pouch stack size of the item", 11 | "minimum": 0 12 | }, 13 | "description": { 14 | "type": "string", 15 | "description": "A short description of the item" 16 | }, 17 | "name": { 18 | "type": "string", 19 | "description": "The name of the item" 20 | }, 21 | "rarity": { 22 | "type": "integer", 23 | "description": "The item's rarity", 24 | "minimum": 1, 25 | "maximum": 8 26 | }, 27 | "value": { 28 | "type": "integer", 29 | "description": "The zenny value of the item; zero indicates the value is not known", 30 | "minimum": 0 31 | } 32 | }, 33 | "required": [ 34 | "carryLimit", 35 | "description", 36 | "name", 37 | "rarity", 38 | "value" 39 | ] 40 | } -------------------------------------------------------------------------------- /src/Resources/schemas/location.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/location", 4 | "title": "Location", 5 | "description": "A hunting location", 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "The location's name" 11 | }, 12 | "zoneCount": { 13 | "type": "integer", 14 | "description": "The number of zones in the location" 15 | }, 16 | "camps": { 17 | "type": "array", 18 | "description": "An array of camps available in the location", 19 | "items": { 20 | "type": "object", 21 | "title": "Camp", 22 | "properties": { 23 | "name": { 24 | "type": "string", 25 | "description": "The name of the camp" 26 | }, 27 | "zone": { 28 | "type": "integer", 29 | "description": "The zone where the camp is located" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "zone" 35 | ] 36 | } 37 | } 38 | }, 39 | "required": [ 40 | "name", 41 | "zoneCount", 42 | "camps" 43 | ] 44 | } -------------------------------------------------------------------------------- /src/Resources/schemas/material-cost.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/material-cost", 4 | "title": "Material Cost", 5 | "description": "The material cost as part of an item's crafting recipe", 6 | "type": "object", 7 | "properties": { 8 | "item": { 9 | "$ref": "https://mhw-db.com/schemas/entity-reference", 10 | "description": "A reference to the item used in the craft" 11 | }, 12 | "quantity": { 13 | "type": "integer", 14 | "description": "The required amount of the item for the craft", 15 | "minimum": 1 16 | } 17 | }, 18 | "required": [ 19 | "item", 20 | "quantity" 21 | ] 22 | } -------------------------------------------------------------------------------- /src/Resources/schemas/motion-value.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/motion-value", 4 | "title": "Motion Value", 5 | "type": "object", 6 | "properties": { 7 | "name": { 8 | "type": "string", 9 | "description": "The name of the motion value" 10 | }, 11 | "weaponType": { 12 | "$ref": "https://mhw-db.com/schemas/weapon-type", 13 | "description": "The weapon type that the motion value belongs to" 14 | }, 15 | "damageType": { 16 | "$ref": "https://mhw-db.com/schemas/damage-type", 17 | "description": "The type of damage that the motion value deals" 18 | }, 19 | "stun": { 20 | "type": ["integer", "null"], 21 | "description": "The amount of stun damage the motion value deals" 22 | }, 23 | "exhaust": { 24 | "type": ["integer", "null"], 25 | "description": "The amount of exhaust damage the motion value deals" 26 | }, 27 | "hits": { 28 | "type": "array", 29 | "description": "An array of hits and their damage percentage the motion value deals", 30 | "items": { 31 | "type": "integer", 32 | "minimum": 1 33 | } 34 | } 35 | }, 36 | "required": [ 37 | "name", 38 | "weaponType", 39 | "damageType", 40 | "stun", 41 | "exhaust", 42 | "hits" 43 | ] 44 | } -------------------------------------------------------------------------------- /src/Resources/schemas/nullable-entity-reference.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/nullable-entity-reference", 4 | "title": "Entity Reference (nullable)", 5 | "description": "A reference to another entity in the API, or `null`", 6 | "oneOf": [ 7 | { 8 | "$ref": "https://mhw-db.com/schemas/entity-reference" 9 | }, 10 | { 11 | "type": "null" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /src/Resources/schemas/skill-rank-shorthand.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/skill-rank-shorthand", 4 | "title": "Skill Rank", 5 | "description": "A Skill at a certain rank", 6 | "type": "object", 7 | "properties": { 8 | "skill": { 9 | "$ref": "https://mhw-db.com/schemas/entity-reference", 10 | "description": "A reference to the rank's skill" 11 | }, 12 | "level": { 13 | "type": "integer", 14 | "description": "The rank's level" 15 | } 16 | }, 17 | "required": [ 18 | "skill", 19 | "level" 20 | ] 21 | } -------------------------------------------------------------------------------- /src/Resources/schemas/skill.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/skill", 4 | "title": "Skill", 5 | "type": "object", 6 | "properties": { 7 | "slug": { 8 | "type": "string", 9 | "description": "The skill's unique slug" 10 | }, 11 | "name": { 12 | "type": "string", 13 | "description": "The name of the skill" 14 | }, 15 | "description": { 16 | "type": "string", 17 | "description": "A short description of the skill" 18 | }, 19 | "ranks": { 20 | "type": "array", 21 | "description": "An array of the different ranks of the skill", 22 | "items": { 23 | "type": "object", 24 | "title": "Skill Rank", 25 | "properties": { 26 | "slug": { 27 | "type": "string", 28 | "description": "The skill rank's unique slug" 29 | }, 30 | "name": { 31 | "type": "string", 32 | "description": "The name of the skill rank (usually in the format \" \")" 33 | }, 34 | "level": { 35 | "type": "integer", 36 | "description": "The skill rank's level", 37 | "minimum": 1 38 | }, 39 | "description": { 40 | "type": "string", 41 | "description": "A short description of the skill rank" 42 | }, 43 | "modifiers": { 44 | "type": "object", 45 | "description": "A dictionary of attribute modifiers provided by the skill at this rank" 46 | } 47 | }, 48 | "required": [ 49 | "slug", 50 | "name", 51 | "level", 52 | "description", 53 | "modifiers" 54 | ] 55 | } 56 | } 57 | }, 58 | "required": [ 59 | "slug", 60 | "name", 61 | "description", 62 | "ranks" 63 | ] 64 | } -------------------------------------------------------------------------------- /src/Resources/schemas/slot.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/slot", 4 | "title": "Slot", 5 | "description": "A decoration slot", 6 | "type": "object", 7 | "properties": { 8 | "rank": { 9 | "type": "integer", 10 | "description": "The maximum decoration rank that can be fitted in the slot", 11 | "minimum": 1, 12 | "maximum": 3 13 | } 14 | }, 15 | "required": [ 16 | "rank" 17 | ] 18 | } -------------------------------------------------------------------------------- /src/Resources/schemas/status-element.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/status-element", 4 | "title": "Status Element", 5 | "description": "An element that's inflicted as a status effect", 6 | "type": "string", 7 | "enum": [ 8 | "blast", 9 | "poison", 10 | "sleep", 11 | "paralysis" 12 | ] 13 | } -------------------------------------------------------------------------------- /src/Resources/schemas/weapon-type.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$id": "https://mhw-db.com/schemas/weapon-type", 4 | "title": "Weapon Type", 5 | "type": "string", 6 | "enum": [ 7 | "great-sword", 8 | "long-sword", 9 | "sword-and-shield", 10 | "dual-blades", 11 | "hammer", 12 | "hunting-horn", 13 | "lance", 14 | "gunlance", 15 | "switch-axe", 16 | "charge-blade", 17 | "insect-glaive", 18 | "light-bowgun", 19 | "heavy-bowgun", 20 | "bow" 21 | ] 22 | } -------------------------------------------------------------------------------- /src/Response/AccessDeniedError.php: -------------------------------------------------------------------------------- 1 | getPropertyPath()] = [ 20 | 'code' => $error->getCode(), 21 | 'path' => $error->getPropertyPath(), 22 | 'message' => $error->getMessage(), 23 | ]; 24 | } 25 | 26 | parent::__construct( 27 | 'constraint_violation', 28 | 'One or more fields did not pass validation', 29 | null, 30 | [ 31 | 'violations' => $violations, 32 | ] 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /src/Response/EmptySearchParametersError.php: -------------------------------------------------------------------------------- 1 | getUser(); 15 | 16 | if (!($user instanceof User)) 17 | return; 18 | 19 | $payload = $event->getData(); 20 | 21 | $payload['displayName'] = $user->getDisplayName(); 22 | $payload['roles'] = $user->getRoles(); 23 | 24 | $event->setData($payload); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Security/DisabledUserChecker.php: -------------------------------------------------------------------------------- 1 | isDisabled()) 25 | throw new DisabledException(); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Security/Role.php: -------------------------------------------------------------------------------- 1 | defaultContext[ObjectNormalizer::PRESERVE_EMPTY_OBJECTS]; 14 | 15 | return parent::normalize($object, $format, $context); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Utility/CommandUtil.php: -------------------------------------------------------------------------------- 1 | {$property}) || property_exists($object, $property); 19 | } 20 | 21 | /** 22 | * @param object $object 23 | * @param array $properties 24 | * 25 | * @return string[] 26 | */ 27 | public static function getMissingProperties(object $object, array $properties): array { 28 | $missing = []; 29 | 30 | foreach ($properties as $property) { 31 | if (!ObjectUtil::isset($object, $property)) 32 | $missing[] = $property; 33 | } 34 | 35 | return $missing; 36 | } 37 | } -------------------------------------------------------------------------------- /src/Utility/RomanNumeral.php: -------------------------------------------------------------------------------- 1 | 1, 7 | 'V' => 5, 8 | 'X' => 10, 9 | 'L' => 50, 10 | ]; 11 | 12 | /** 13 | * @param string $numeral 14 | * 15 | * @return int 16 | */ 17 | public static function toDecimal(string $numeral): int { 18 | $numeral = strtoupper($numeral); 19 | 20 | $decimal = 0; 21 | $previous = 0; 22 | 23 | for ($i = strlen($numeral) - 1; $i >= 0; $i--) { 24 | $char = $numeral[$i]; 25 | 26 | if (isset(self::NUMERALS[$char])) 27 | $value = self::NUMERALS[$char]; 28 | else 29 | throw new \InvalidArgumentException($char . ' is not a supported numeral'); 30 | 31 | if ($value < $previous) 32 | $decimal -= $value; 33 | else 34 | $decimal += $value; 35 | } 36 | 37 | return $decimal; 38 | } 39 | 40 | /** 41 | * @param int $decimal 42 | * 43 | * @return string 44 | */ 45 | public static function toNumeral(int $decimal): string { 46 | $numeral = ''; 47 | 48 | foreach (array_reverse(self::NUMERALS, true) as $char => $value) { 49 | $numeral .= str_repeat($char, floor($decimal / $value)); 50 | 51 | $decimal %= $value; 52 | } 53 | 54 | return $numeral; 55 | } 56 | 57 | /** 58 | * RomanNumeral constructor. 59 | */ 60 | private function __construct() { 61 | } 62 | } -------------------------------------------------------------------------------- /templates/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LartTyler/MHWDB-API/0ac2a580bac8fde6ae684e66720092c88a9675d5/templates/.gitignore -------------------------------------------------------------------------------- /templates/activation-email.html.twig: -------------------------------------------------------------------------------- 1 |

2 | Welcome to the contribution system for the MHWDB project. 3 |

4 | 5 |

6 | In order to finish your registration, please click here, or use the link below. 7 | You will be prompted to fill out a few more details in order to complete your account activation. 8 |

9 | 10 |

11 | {{ activationUrl }} 12 |

-------------------------------------------------------------------------------- /templates/password-reset-email.html.twig: -------------------------------------------------------------------------------- 1 |

2 | To reset your password, click here or follow the link below. If you did not 3 | request a password reset, please disregard this email. 4 |

5 | 6 |

7 | {{ passwordResetUrl }} 8 |

-------------------------------------------------------------------------------- /vagrant/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[client]" > "${HOME}/.my.cnf" 4 | echo "user=root" >> "${HOME}/.my.cnf" 5 | 6 | mysql -e "CREATE SCHEMA IF NOT EXISTS application;" 7 | 8 | echo "[mysql]" >> "${HOME}/.my.cnf" 9 | echo "database=application" >> "${HOME}/.my.cnf" 10 | 11 | wget -qO "${HOME}/install-composer.sh" https://gist.githubusercontent.com/LartTyler/56966b744b9f60ab050e64091d6296dd/raw/e9192ed8149eeb8698b5c1fc862bb9872fc6faf3/install-composer.sh 12 | chmod +x "${HOME}/install-composer.sh" 13 | 14 | mkdir -p "${HOME}/bin" 15 | 16 | "${HOME}/install-composer.sh" --install-dir="${HOME}/bin" --filename=composer 17 | rm "${HOME}/install-composer.sh" 18 | 19 | cp /vagrant/.env.dist /vagrant/.env 20 | 21 | echo 22 | echo "Your box has been provisioned. Please refer to the README for any remaining setup instructions." 23 | echo 24 | echo "Please keep in mind that this configuration is NOT suitable for production." --------------------------------------------------------------------------------