Changed character id to uuid
This commit is contained in:
+2
-1
@@ -20,7 +20,8 @@
|
||||
"monolog/monolog": "^1.12",
|
||||
"symfony/console": "^3.0",
|
||||
"symfony/yaml": "^3.0",
|
||||
"d11wtq/boris": "^1.0"
|
||||
"d11wtq/boris": "^1.0",
|
||||
"ramsey/uuid-doctrine": "^1.5"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
||||
Generated
+186
-2
@@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "0419f6d36248a11755819feead450f80",
|
||||
"content-hash": "9663d004ab08338fb0640f807e3c2b94",
|
||||
"hash": "9ce66e946e56f62ed759f6c046f18cae",
|
||||
"content-hash": "5cb12bb017ac481f9d95f41a08ea4a76",
|
||||
"packages": [
|
||||
{
|
||||
"name": "behat/transliterator",
|
||||
@@ -1222,6 +1222,51 @@
|
||||
],
|
||||
"time": "2017-06-19 01:22:40"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.99",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2018-07-02 15:55:56"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
@@ -1269,6 +1314,145 @@
|
||||
],
|
||||
"time": "2016-10-10 12:19:37"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid",
|
||||
"version": "3.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/uuid.git",
|
||||
"reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3",
|
||||
"reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"paragonie/random_compat": "^1.0|^2.0|9.99.99",
|
||||
"php": "^5.4 || ^7.0",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"replace": {
|
||||
"rhumsaa/uuid": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/aspect-mock": "^1.0 | ~2.0.0",
|
||||
"doctrine/annotations": "~1.2.0",
|
||||
"goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0",
|
||||
"ircmaxell/random-lib": "^1.1",
|
||||
"jakub-onderka/php-parallel-lint": "^0.9.0",
|
||||
"mockery/mockery": "^0.9.9",
|
||||
"moontoast/math": "^1.1",
|
||||
"php-mock/php-mock-phpunit": "^0.3|^1.1",
|
||||
"phpunit/phpunit": "^4.7|^5.0|^6.5",
|
||||
"squizlabs/php_codesniffer": "^2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "Provides support for PHP Ctype functions",
|
||||
"ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator",
|
||||
"ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator",
|
||||
"ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
|
||||
"moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).",
|
||||
"ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid",
|
||||
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ramsey\\Uuid\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marijn Huizendveld",
|
||||
"email": "marijn.huizendveld@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Thibaud Fabre",
|
||||
"email": "thibaud@aztech.io"
|
||||
},
|
||||
{
|
||||
"name": "Ben Ramsey",
|
||||
"email": "ben@benramsey.com",
|
||||
"homepage": "https://benramsey.com"
|
||||
}
|
||||
],
|
||||
"description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).",
|
||||
"homepage": "https://github.com/ramsey/uuid",
|
||||
"keywords": [
|
||||
"guid",
|
||||
"identifier",
|
||||
"uuid"
|
||||
],
|
||||
"time": "2018-07-19 23:38:55"
|
||||
},
|
||||
{
|
||||
"name": "ramsey/uuid-doctrine",
|
||||
"version": "1.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ramsey/uuid-doctrine.git",
|
||||
"reference": "2a56db8e68bff487508244f5a2008075279d0255"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ramsey/uuid-doctrine/zipball/2a56db8e68bff487508244f5a2008075279d0255",
|
||||
"reference": "2a56db8e68bff487508244f5a2008075279d0255",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/orm": "^2.5",
|
||||
"php": "^5.4 || ^7.0",
|
||||
"ramsey/uuid": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "^1.0",
|
||||
"mockery/mockery": "^0.9 || ^1.1",
|
||||
"php-coveralls/php-coveralls": "^1.1 || ^2.1",
|
||||
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5",
|
||||
"squizlabs/php_codesniffer": "^3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ramsey\\Uuid\\Doctrine\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marijn Huizendveld",
|
||||
"email": "marijn.huizendveld@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Ben Ramsey",
|
||||
"email": "ben@benramsey.com",
|
||||
"homepage": "http://benramsey.com"
|
||||
}
|
||||
],
|
||||
"description": "Allow the use of a ramsey/uuid UUID as Doctrine field type.",
|
||||
"homepage": "https://github.com/ramsey/uuid-doctrine",
|
||||
"keywords": [
|
||||
"doctrine",
|
||||
"guid",
|
||||
"identifier",
|
||||
"uuid"
|
||||
],
|
||||
"time": "2018-08-11 21:01:22"
|
||||
},
|
||||
{
|
||||
"name": "seld/jsonlint",
|
||||
"version": "1.7.1",
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace LotGD\Core;
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
use Doctrine\Common\EventManager as DoctrineEventManager;
|
||||
use Doctrine\Common\Util\Debug;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\ORM\Events as DoctrineEvents;
|
||||
use Doctrine\ORM\ {
|
||||
EntityManager,
|
||||
@@ -173,6 +174,11 @@ class Bootstrap
|
||||
// Create entity manager
|
||||
$entityManager = EntityManager::create(["pdo" => $pdo], $configuration);
|
||||
|
||||
// Register uuid type
|
||||
try {
|
||||
\Doctrine\DBAL\Types\Type::addType('uuid', 'Ramsey\Uuid\Doctrine\UuidType');
|
||||
} catch (DBALException $e) {}
|
||||
|
||||
// Create Schema and update database if needed
|
||||
$metaData = $entityManager->getMetadataFactory()->getAllMetadata();
|
||||
$schemaTool = new SchemaTool($entityManager);
|
||||
|
||||
@@ -4,13 +4,15 @@ declare(strict_types=1);
|
||||
namespace LotGD\Core\Models;
|
||||
|
||||
use Doctrine\ORM\Mapping\MappedSuperclass;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @MappedSuperclass
|
||||
*/
|
||||
abstract class BasicEnemy implements FighterInterface
|
||||
{
|
||||
/** @Id @Column(type="integer") @GeneratedValue */
|
||||
/** @Id @Column(type="uuid", unique=True) */
|
||||
protected $id;
|
||||
/** @Column(type="string", length=50); */
|
||||
protected $name;
|
||||
@@ -18,12 +20,20 @@ abstract class BasicEnemy implements FighterInterface
|
||||
protected $level;
|
||||
/** @var int */
|
||||
protected $health;
|
||||
|
||||
/**
|
||||
* BasicEnemy constructor. Sets uuid upon creation.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = Uuid::uuid4();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the enemy's id
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
public function getId(): UuidInterface
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ use LotGD\Core\Exceptions\BuffSlotOccupiedException;
|
||||
use LotGD\Core\Tools\Model\{
|
||||
Creator, ExtendableModel, GameAware, PropertyManager, SoftDeletable
|
||||
};
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* Model for a character
|
||||
@@ -32,7 +34,7 @@ class Character implements CharacterInterface, CreateableInterface, GameAwareInt
|
||||
use GameAware;
|
||||
use ExtendableModel;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue */
|
||||
/** @Id @Column(type="uuid", unique=True) */
|
||||
private $id;
|
||||
/** @Column(type="string", length=50); */
|
||||
private $name;
|
||||
@@ -90,6 +92,8 @@ class Character implements CharacterInterface, CreateableInterface, GameAwareInt
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = Uuid::uuid4();
|
||||
|
||||
$this->properties = new ArrayCollection();
|
||||
$this->buffs = new ArrayCollection();
|
||||
$this->messageThreads = new ArrayCollection();
|
||||
@@ -99,7 +103,7 @@ class Character implements CharacterInterface, CreateableInterface, GameAwareInt
|
||||
* Returns the entity's id
|
||||
* @return int The id
|
||||
*/
|
||||
public function getId(): int
|
||||
public function getId(): UuidInterface
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace LotGD\Core\Models;
|
||||
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* Interface for the character model and all objects that mimick such a model.
|
||||
*/
|
||||
interface CharacterInterface extends FighterInterface
|
||||
{
|
||||
public function getId(): int;
|
||||
public function getId(): UuidInterface;
|
||||
public function getName(): string;
|
||||
public function getDisplayName(): string;
|
||||
public function getHealth(): int;
|
||||
|
||||
@@ -10,6 +10,7 @@ use LotGD\Core\{
|
||||
};
|
||||
use LotGD\Core\Exceptions\IsNullException;
|
||||
use LotGD\Core\Models\Viewpoint;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* Provides basic implementation to mock CharacterInterface.
|
||||
@@ -21,7 +22,7 @@ trait MockCharacter
|
||||
throw new IsNullException();
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
public function getId(): UuidInterface
|
||||
{
|
||||
throw new IsNullException();
|
||||
}
|
||||
|
||||
+34
-30
@@ -5,6 +5,7 @@ namespace LotGD\Core\Tests\Models;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
use Doctrine\Common\Util\Debug;
|
||||
use LotGD\Core\{
|
||||
Battle,
|
||||
DiceBag,
|
||||
@@ -25,6 +26,9 @@ use LotGD\Core\Models\BattleEvents\{
|
||||
};
|
||||
|
||||
use LotGD\Core\Tests\CoreModelTestCase;
|
||||
use Ramsey\Uuid\Codec\OrderedTimeCodec;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidFactory;
|
||||
|
||||
class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
@@ -52,8 +56,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$this->assertSame(5, $monster->getLevel());
|
||||
$this->assertSame(52, $monster->getMaxHealth());
|
||||
@@ -69,8 +73,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
@@ -106,8 +110,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
$battle = $battle->serialize();
|
||||
@@ -139,8 +143,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$highLevelPlayer = $em->getRepository(Character::class)->find(2);
|
||||
$lowLevelMonster = $em->getRepository(Monster::class)->find(3);
|
||||
$highLevelPlayer = $em->getRepository(Character::class)->find("4d01c29b-d825-4bc7-9e6e-63525155fd37");
|
||||
$lowLevelMonster = $em->getRepository(Monster::class)->find("c004bcb6-a7c1-4f9a-abc2-1711c64e23a0");
|
||||
|
||||
$battle = new Battle($this->getMockGame($highLevelPlayer), $highLevelPlayer, $lowLevelMonster);
|
||||
|
||||
@@ -172,8 +176,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$lowLevelPlayer = $em->getRepository(Character::class)->find(3);
|
||||
$highLevelMonster = $em->getRepository(Monster::class)->find(2);
|
||||
$lowLevelPlayer = $em->getRepository(Character::class)->find("c3792b61-4e34-4710-9871-65a68ac30bb4");
|
||||
$highLevelMonster = $em->getRepository(Monster::class)->find("b636df29-f72d-4e2d-9850-982e783a9e94");
|
||||
|
||||
$battle = new Battle($this->getMockGame($lowLevelPlayer), $lowLevelPlayer, $highLevelMonster);
|
||||
|
||||
@@ -205,8 +209,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
@@ -220,8 +224,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
@@ -236,8 +240,8 @@ class BattleTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
@@ -257,23 +261,23 @@ class BattleTest extends CoreModelTestCase
|
||||
default:
|
||||
case 0:
|
||||
// Fair Battle
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$monster = $em->getRepository(Monster::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$monster = $em->getRepository(Monster::class)->find("de84c507-9673-44e7-b665-9e43416b9c2f");
|
||||
break;
|
||||
case 1:
|
||||
// very long battle
|
||||
$character = $em->getRepository(Character::class)->find(4);
|
||||
$monster = $em->getRepository(Monster::class)->find(3);
|
||||
$character = $em->getRepository(Character::class)->find("6565b418-55f5-4a6b-8d92-a9ef81329912");
|
||||
$monster = $em->getRepository(Monster::class)->find("c004bcb6-a7c1-4f9a-abc2-1711c64e23a0");
|
||||
break;
|
||||
case 2:
|
||||
// player should win battle
|
||||
$character = $em->getRepository(Character::class)->find(13);
|
||||
$monster = $em->getRepository(Monster::class)->find(11);
|
||||
$character = $em->getRepository(Character::class)->find("1a9f63f2-3006-4e12-b272-4fd6be518a93");
|
||||
$monster = $em->getRepository(Monster::class)->find("7ca9c141-aaf8-44a5-9d04-b6f9923f3c66");
|
||||
break;
|
||||
case 3:
|
||||
// player should lose battle
|
||||
$character = $em->getRepository(Character::class)->find(11);
|
||||
$monster = $em->getRepository(Monster::class)->find(13);
|
||||
$character = $em->getRepository(Character::class)->find("24d71c26-f915-401c-8b3e-1932edf650ce");
|
||||
$monster = $em->getRepository(Monster::class)->find("09540b93-63c9-4d82-8501-f569f63dfc4c");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1331,7 +1335,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistGoodguyAttackModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
@@ -1360,7 +1364,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistGoodguyDefenseModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
@@ -1389,7 +1393,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistGoodguyDamageModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
@@ -1418,7 +1422,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistBadguyAttackModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
@@ -1447,7 +1451,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistBadguyDefenseModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
@@ -1476,7 +1480,7 @@ class BattleTest extends CoreModelTestCase
|
||||
public function testBufflistBadguyDamageModifier()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$player = $em->getRepository(Character::class)->find(1);
|
||||
$player = $em->getRepository(Character::class)->find("d363c077-234a-433d-834e-f1a1d3b281d8");
|
||||
$game = $this->getMockGame($player);
|
||||
|
||||
$player->addBuff(new Buff([
|
||||
|
||||
+9
-9
@@ -128,7 +128,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testSetGetCharacter()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(1);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
$this->g->setCharacter($c);
|
||||
$this->assertEquals($c, $this->g->getCharacter());
|
||||
@@ -136,7 +136,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testGetViewpointException()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(1);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
// There should'nt be any listeners to provide a default scene.
|
||||
@@ -146,7 +146,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testGetViewpointStored()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(2);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
$this->assertNotNull($this->g->getViewpoint());
|
||||
@@ -154,7 +154,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testGetViewpointDefault()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(1);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
$this->g->getEventManager()->subscribe('/h\/lotgd\/core\/default-scene/', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
@@ -176,7 +176,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testTakeActionNonExistant()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(1);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
// For now, I cant seem to serialize a proper ActionGroup to store in
|
||||
@@ -189,7 +189,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public function testTakeActionNavigate()
|
||||
{
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(3);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000003");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
// For now, I cant seem to serialize a proper ActionGroup to store in
|
||||
@@ -210,7 +210,7 @@ class GameTest extends CoreModelTestCase
|
||||
public function testIfActionParametersAreRelayedToEvent()
|
||||
{
|
||||
/* @var $c Character */
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(2);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
// subscribe event
|
||||
@@ -240,7 +240,7 @@ class GameTest extends CoreModelTestCase
|
||||
public function testIfActionParametersTakePriorityToOtherParameters()
|
||||
{
|
||||
/* @var $c Character */
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(2);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
// subscribe event
|
||||
@@ -288,7 +288,7 @@ class GameTest extends CoreModelTestCase
|
||||
return $values;
|
||||
};
|
||||
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find(3);
|
||||
$c = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000003");
|
||||
$this->g->setCharacter($c);
|
||||
|
||||
$v0 = $this->g->getViewpoint();
|
||||
|
||||
@@ -63,6 +63,9 @@ abstract class ModelTestCase extends \PHPUnit_Extensions_Database_TestCase
|
||||
|
||||
self::$em = EntityManager::create(["pdo" => self::$pdo], $configuration);
|
||||
|
||||
// Register uuid type
|
||||
\Doctrine\DBAL\Types\Type::addType('uuid', 'Ramsey\Uuid\Doctrine\UuidType');
|
||||
|
||||
// Create Schema
|
||||
$metaData = self::$em->getMetadataFactory()->getAllMetadata();
|
||||
$schemaTool = new SchemaTool(self::$em);
|
||||
|
||||
@@ -12,6 +12,7 @@ use LotGD\Core\Models\Character;
|
||||
use LotGD\Core\Models\CharacterProperty;
|
||||
use LotGD\Core\Tests\CoreModelTestCase;
|
||||
use LotGD\Core\Models\Repositories\CharacterRepository;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* Tests the management of Characters
|
||||
@@ -26,13 +27,13 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
*/
|
||||
public function testSoftDeletion()
|
||||
{
|
||||
$chars = $this->getEntityManager()->getRepository(Character::class)->find(3);
|
||||
$chars = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000003");
|
||||
$this->assertSame(null, $chars);
|
||||
|
||||
$allChars = $this->getEntityManager()->getRepository(Character::class)->findAll();
|
||||
$this->assertSame(2, count($allChars));
|
||||
|
||||
$char = $this->getEntityManager()->getRepository(Character::class)->find(1);
|
||||
$char = $this->getEntityManager()->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$char->delete($this->getEntityManager());
|
||||
$this->getEntityManager()->flush();
|
||||
$this->getEntityManager()->clear();
|
||||
@@ -101,7 +102,7 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->assertInternalType("int", $characterEntity->getId());
|
||||
$this->assertInstanceOf(UuidInterface::class, $characterEntity->getId());
|
||||
$this->assertSame(16, $characterEntity->getProperty("a property"));
|
||||
|
||||
$em->flush();
|
||||
@@ -142,7 +143,7 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
$rowsBefore = count($em->getRepository(Character::class)->findAll());
|
||||
|
||||
// Delete one row
|
||||
$character = $em->getRepository(Character::class)->find(1);
|
||||
$character = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character->delete($em);
|
||||
|
||||
$em->clear();
|
||||
@@ -163,7 +164,7 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
// test default values
|
||||
$firstCharacter = $em->getRepository(Character::class)->find(1);
|
||||
$firstCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$this->assertSame(5, $firstCharacter->getProperty("dragonkills", 5));
|
||||
$this->assertNotSame(5, $firstCharacter->getProperty("dragonkills", "5"));
|
||||
$this->assertSame("hanniball", $firstCharacter->getProperty("petname", "hanniball"));
|
||||
@@ -226,6 +227,7 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
|
||||
$eventManager->subscribe("#h/lotgd/core/getCharacterAttack#", get_class($detectionClass), "test");
|
||||
$eventManager->subscribe("#h/lotgd/core/getCharacterDefense#", get_class($detectionClass), "test");
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$this->assertSame($level*2, $character1->getAttack());
|
||||
$this->assertSame($level*4, $character2->getDefense());
|
||||
|
||||
@@ -24,8 +24,8 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
$mm=new MessageManager();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(4);
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000004");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2]);
|
||||
$thread2 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character2, $character1]);
|
||||
@@ -42,8 +42,8 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(4);
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000004");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2]);
|
||||
|
||||
@@ -62,10 +62,10 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
$mm=new MessageManager();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
$character3 = $em->getRepository(Character::class)->findWithSoftDeleted(3);
|
||||
$character4 = $em->getRepository(Character::class)->find(4);
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$character3 = $em->getRepository(Character::class)->findWithSoftDeleted("10000000-0000-0000-0000-000000000003");
|
||||
$character4 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000004");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2, $character3, $character4]);
|
||||
$thread2 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character4, $character2, $character1, $character3]);
|
||||
@@ -89,11 +89,11 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$this->assertSame(1, count($character4->getMessageThreads()));
|
||||
|
||||
$em->flush();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
$character3 = $em->getRepository(Character::class)->findWithSoftDeleted(3);
|
||||
$character4 = $em->getRepository(Character::class)->find(4);
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$character3 = $em->getRepository(Character::class)->findWithSoftDeleted("10000000-0000-0000-0000-000000000003");
|
||||
$character4 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000004");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2, $character3, $character4]);
|
||||
|
||||
@@ -111,8 +111,8 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
$mm=new MessageManager();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character1]);
|
||||
$thread2 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character2]);
|
||||
@@ -124,9 +124,9 @@ class MessageModelTest extends CoreModelTestCase
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character1]);
|
||||
$thread2 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character2]);
|
||||
@@ -154,8 +154,8 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
$mm=new MessageManager();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character1, $character2]);
|
||||
$thread2 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2]);
|
||||
@@ -166,9 +166,9 @@ class MessageModelTest extends CoreModelTestCase
|
||||
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find(1);
|
||||
$character2 = $em->getRepository(Character::class)->find(2);
|
||||
|
||||
$character1 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$character2 = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateReadonlyFor([$character1, $character2]);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class MotDModelTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$author = $em->getRepository(Character::class)->find(1);
|
||||
$author = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
// Test normal message
|
||||
$motd1 = $em->getRepository(MotD::class)->find(1);
|
||||
@@ -63,13 +63,13 @@ class MotDModelTest extends CoreModelTestCase
|
||||
{
|
||||
return [
|
||||
[[
|
||||
"author" => 1,
|
||||
"author" => "10000000-0000-0000-0000-000000000001",
|
||||
"title" => "ABC_\"EFG",
|
||||
"body" => "Lorem îpsum etc pp",
|
||||
"systemMessage" => false,
|
||||
]],
|
||||
[[
|
||||
"author" => 1,
|
||||
"author" => "10000000-0000-0000-0000-000000000001",
|
||||
"title" => "AnotherOne",
|
||||
"body" => "Test a Second One",
|
||||
"systemMessage" => true,
|
||||
|
||||
@@ -40,8 +40,8 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
// Test character with a characterScene
|
||||
$testCharacter = $em->getRepository(Character::class)->find(2);
|
||||
$this->assertSame(2, $testCharacter->getId());
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->assertSame("10000000-0000-0000-0000-000000000002", (string)$testCharacter->getId());
|
||||
$characterScene = $testCharacter->getViewpoint();
|
||||
|
||||
$this->assertInstanceOf(Viewpoint::class, $characterScene);
|
||||
@@ -49,8 +49,8 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$this->assertSame("This is the village.", $characterScene->getDescription());
|
||||
|
||||
// Test character without a characterScene
|
||||
$testCharacter = $em->getRepository(Character::class)->find(1);
|
||||
$this->assertSame(1, $testCharacter->getId());
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000001");
|
||||
$this->assertSame("10000000-0000-0000-0000-000000000001", (string)$testCharacter->getId());
|
||||
$characterScene = $testCharacter->getViewpoint();
|
||||
|
||||
$this->assertNull($characterScene);
|
||||
@@ -63,7 +63,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$testCharacter = $em->getRepository(Character::class)->find(2);
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$testScene = $em->getRepository(Scene::class)->find(2);
|
||||
|
||||
@@ -95,13 +95,13 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$ag2
|
||||
];
|
||||
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$input->setActionGroups($actionGroups);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
$output = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$output = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->assertEquals($actionGroups, $output->getActionGroups());
|
||||
|
||||
$this->assertEquals($ag2, $input->findActionGroupById('id2'));
|
||||
@@ -124,13 +124,13 @@ class ViewpointTest extends CoreModelTestCase
|
||||
|
||||
$attachments = [$a1, $a2];
|
||||
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$input->setAttachments($attachments);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
$output = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$output = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$this->assertEquals($attachments, $output->getAttachments());
|
||||
$this->assertEquals('baz', $output->getAttachments()[0]->getFoo());
|
||||
$this->assertEquals('fiz', $output->getAttachments()[1]->getFoo());
|
||||
@@ -160,13 +160,13 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$ag2
|
||||
];
|
||||
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$input->setActionGroups($actionGroups);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
$output = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$output = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
// Not finding the scene ID should change nothing.
|
||||
$output->removeActionsWithSceneId(1000);
|
||||
@@ -189,7 +189,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
public function testChangingSceneDescription()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$testCharacter = $em->getRepository(Character::class)->find(2);
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$characterScene = $testCharacter->getViewpoint();
|
||||
|
||||
$this->assertSame("This is the village.", $characterScene->getDescription());
|
||||
@@ -201,7 +201,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
public function testClearingSceneDescription()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$testCharacter = $em->getRepository(Character::class)->find(2);
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$characterScene = $testCharacter->getViewpoint();
|
||||
|
||||
$characterScene->clearDescription();
|
||||
@@ -235,14 +235,14 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$ag2
|
||||
];
|
||||
|
||||
$input = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$input = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
$input->setActionGroups($actionGroups);
|
||||
$input->save($em);
|
||||
|
||||
$em->clear();
|
||||
|
||||
/** @var Viewpoint $viewpoint */
|
||||
$viewpoint = $em->getRepository(Viewpoint::class)->find(2);
|
||||
$viewpoint = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$actionGroupId1 = $viewpoint->findActionGroupById("id1");
|
||||
$actionGroupId2 = $viewpoint->findActionGroupById("id2");
|
||||
|
||||
+13
-13
@@ -1,48 +1,48 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "d363c077-234a-433d-834e-f1a1d3b281d8"
|
||||
name: "Player"
|
||||
displayName: "The Player"
|
||||
health: 100
|
||||
maxhealth: 100
|
||||
level: 10
|
||||
-
|
||||
id: 2
|
||||
id: "4d01c29b-d825-4bc7-9e6e-63525155fd37"
|
||||
name: "High Level Char"
|
||||
displayName: "High Level Char"
|
||||
health: 1000
|
||||
maxhealth: 1000
|
||||
level: 100
|
||||
-
|
||||
id: 3
|
||||
id: "c3792b61-4e34-4710-9871-65a68ac30bb4"
|
||||
name: "Low Level Char"
|
||||
displayName: "Low Level Char"
|
||||
health: 10
|
||||
maxhealth: 10
|
||||
level: 1
|
||||
-
|
||||
id: 4
|
||||
id: "6565b418-55f5-4a6b-8d92-a9ef81329912"
|
||||
name: "Low Damage Char"
|
||||
displayName: "Low Damage Char"
|
||||
health: 500
|
||||
maxhealth: 500
|
||||
level: 0
|
||||
-
|
||||
id: 10
|
||||
id: "539e4bb0-84d1-49ed-a697-ff449991e9b7"
|
||||
name: "Level 10 Character"
|
||||
displayName: "Level 10 Character"
|
||||
health: 100
|
||||
maxhealth: 100
|
||||
level: 10
|
||||
-
|
||||
id: 11
|
||||
id: "24d71c26-f915-401c-8b3e-1932edf650ce"
|
||||
name: "Level 11 Character"
|
||||
displayName: "Level 11 Character"
|
||||
health: 110
|
||||
maxhealth: 110
|
||||
level: 11
|
||||
-
|
||||
id: 13
|
||||
id: "1a9f63f2-3006-4e12-b272-4fd6be518a93"
|
||||
name: "Level 13 Character"
|
||||
displayName: "Level 13 Character"
|
||||
health: 130
|
||||
@@ -50,26 +50,26 @@ characters:
|
||||
level: 13
|
||||
monsters:
|
||||
-
|
||||
id: 1
|
||||
id: "de84c507-9673-44e7-b665-9e43416b9c2f"
|
||||
name: "Evil Monster"
|
||||
level: 5
|
||||
-
|
||||
id: 2
|
||||
id: "b636df29-f72d-4e2d-9850-982e783a9e94"
|
||||
name: "High Dragon"
|
||||
level: 100
|
||||
-
|
||||
id: 3
|
||||
id: "c004bcb6-a7c1-4f9a-abc2-1711c64e23a0"
|
||||
name: "Stone"
|
||||
level: 1
|
||||
-
|
||||
id: 10
|
||||
id: "f1d1f672-e308-420e-939f-cbb39285b222"
|
||||
name: "Level 10 Monster"
|
||||
level: 10
|
||||
-
|
||||
id: 11
|
||||
id: "7ca9c141-aaf8-44a5-9d04-b6f9923f3c66"
|
||||
name: "Level 11 Monster"
|
||||
level: 11
|
||||
-
|
||||
id: 13
|
||||
id: "09540b93-63c9-4d82-8501-f569f63dfc4c"
|
||||
name: "Level 13 Monster"
|
||||
level: 13
|
||||
@@ -1,18 +1,18 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "10000000-0000-0000-0000-000000000001"
|
||||
name: "Testcharacter 1"
|
||||
displayName: "Testcharacter 1"
|
||||
health: 0
|
||||
maxhealth: 100
|
||||
-
|
||||
id: 2
|
||||
id: "10000000-0000-0000-0000-000000000002"
|
||||
name: "Testcharacter 2"
|
||||
displayName: "Testcharacter 2"
|
||||
health: 90
|
||||
maxhealth: 90
|
||||
-
|
||||
id: 3
|
||||
id: "10000000-0000-0000-0000-000000000003"
|
||||
name: "Testcharacter 3"
|
||||
displayName: "Testcharacter 3 (deleted)"
|
||||
health: 90
|
||||
@@ -20,6 +20,6 @@ characters:
|
||||
deletedAt: "2011-11-11 11:11:11"
|
||||
character_properties:
|
||||
-
|
||||
owner_id: 1
|
||||
owner_id: "10000000-0000-0000-0000-000000000001"
|
||||
propertyName: "test"
|
||||
propertyValue: 's:5:"hallo";'
|
||||
@@ -1,19 +1,19 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "10000000-0000-0000-0000-000000000001"
|
||||
name: "Char without a Scene"
|
||||
displayName: "A"
|
||||
-
|
||||
id: 2
|
||||
id: "10000000-0000-0000-0000-000000000002"
|
||||
name: "Char with a Scene"
|
||||
displayName: "B"
|
||||
-
|
||||
id: 3
|
||||
id: "10000000-0000-0000-0000-000000000003"
|
||||
name: "Char without a Scene"
|
||||
displayName: "C"
|
||||
viewpoints:
|
||||
-
|
||||
owner_id: 2
|
||||
owner_id: "10000000-0000-0000-0000-000000000002"
|
||||
title: "The Village"
|
||||
description: "This is the village."
|
||||
template: "lotgd/tests/village"
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "10000000-0000-0000-0000-000000000001"
|
||||
name: "Testcharacter 1"
|
||||
displayName: "Testcharacter 1"
|
||||
-
|
||||
id: 2
|
||||
id: "10000000-0000-0000-0000-000000000002"
|
||||
name: "Testcharacter 2"
|
||||
displayName: "Testcharacter 2"
|
||||
-
|
||||
id: 3
|
||||
id: "10000000-0000-0000-0000-000000000003"
|
||||
name: "Testcharacter 1"
|
||||
displayName: "Deleted Testcharacter"
|
||||
deletedAt: "2011-11-11 11:11:11"
|
||||
-
|
||||
id: 4
|
||||
id: "10000000-0000-0000-0000-000000000004"
|
||||
name: "Testcharacter 3"
|
||||
displayName: "Testcharacter 3"
|
||||
message_threads:
|
||||
@@ -23,7 +23,7 @@ message_threads:
|
||||
messages:
|
||||
-
|
||||
id: 1
|
||||
author_id: 1
|
||||
author_id: "10000000-0000-0000-0000-000000000001"
|
||||
thread_id: 1
|
||||
message: "Hi!"
|
||||
createdAt: "2000-01-01 00:00:01"
|
||||
@@ -31,7 +31,7 @@ messages:
|
||||
message_threads_x_characters:
|
||||
-
|
||||
messagethread_id: 1
|
||||
character_id: 1
|
||||
character_id: "10000000-0000-0000-0000-000000000001"
|
||||
-
|
||||
messagethread_id: 1
|
||||
character_id: 2
|
||||
character_id: "10000000-0000-0000-0000-000000000002"
|
||||
@@ -1,18 +1,18 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "10000000-0000-0000-0000-000000000001"
|
||||
name: "Testcharacter 1"
|
||||
displayName: "Testcharacter 1"
|
||||
health: 0
|
||||
maxhealth: 100
|
||||
-
|
||||
id: 2
|
||||
id: "10000000-0000-0000-0000-000000000002"
|
||||
name: "Testcharacter 2"
|
||||
displayName: "Testcharacter 2"
|
||||
health: 90
|
||||
maxhealth: 90
|
||||
-
|
||||
id: 3
|
||||
id: "10000000-0000-0000-0000-000000000003"
|
||||
name: "Testcharacter 1"
|
||||
displayName: "Deleted Testcharacter"
|
||||
health: 200
|
||||
@@ -21,21 +21,21 @@ characters:
|
||||
motd:
|
||||
-
|
||||
id: 1
|
||||
author_id: 1
|
||||
author_id: "10000000-0000-0000-0000-000000000001"
|
||||
title: "This is the title"
|
||||
body: "This is the body of the message"
|
||||
creationTime: "2016-05-03 14:19:12"
|
||||
systemMessage: false
|
||||
-
|
||||
id: 2
|
||||
author_id: 1
|
||||
author_id: "10000000-0000-0000-0000-000000000001"
|
||||
title: "This is a system message"
|
||||
body: "This is the body of the system message"
|
||||
creationTime: "2016-05-04 14:19:12"
|
||||
systemMessage: true
|
||||
-
|
||||
id: 3
|
||||
author_id: 3
|
||||
author_id: "10000000-0000-0000-0000-000000000003"
|
||||
title: "This is an old message."
|
||||
body: "This is an old message."
|
||||
creationTime: "2002-12-09 15:13:59"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
characters:
|
||||
-
|
||||
id: 1
|
||||
id: "10000000-0000-0000-0000-000000000001"
|
||||
name: "Char without a Scene"
|
||||
displayName: "A"
|
||||
-
|
||||
id: 2
|
||||
id: "10000000-0000-0000-0000-000000000002"
|
||||
name: "Char with a Scene"
|
||||
displayName: "B"
|
||||
viewpoints:
|
||||
-
|
||||
owner_id: 2
|
||||
owner_id: "10000000-0000-0000-0000-000000000002"
|
||||
title: "The Village"
|
||||
description: "This is the village."
|
||||
template: "lotgd/tests/village"
|
||||
|
||||
Reference in New Issue
Block a user