public function testMonsters() { $frank = new Monster(); $frank->title = 'Dr.'; $frank->name = 'Frankenstein'; $this->assertEquals('Dr. Frankenstein', $frank->render()); $dracula = new Monster(); $dracula->title = 'Count'; $dracula->name = 'Dracula'; $this->assertEquals('Count Dracula', $dracula->render()); }
public function spawnTo(Player $player) { $pk = $this->addEntityDataPacket($player); $pk->type = Creeper::NETWORK_ID; $player->dataPacket($pk); parent::spawnTo($player); }
public function testFindQueryWithMultipleWheres() { $connection = m::mock('juicyORM\\Database\\DbConnection'); $connection->shouldReceive('query')->with('SELECT * FROM "monster" WHERE "species" = ? AND "origin" = ?', array('Jormungandr', 'Norse'))->once()->andReturn(array($this->fake_monster_table[2])); $db = juicyORM\Database\DB::Instance($this->dbConfig, $connection, true); $user_response = Monster::where("species", "=", "Jormungandr")->where("origin", "=", "Norse")->find(); $this->assertEquals(gettype($user_response), 'array'); $this->assertEquals(gettype($user_response[0]), 'object'); $this->assertEquals(get_class($user_response[0]), 'juicyORM\\Database\\ModelRow'); $this->assertEquals($user_response[0]->species, 'Jormungandr'); $this->assertEquals($db->runtime_info(), array(array('sql' => 'SELECT * FROM "monster" WHERE "species" = ? AND "origin" = ?', 'bindings' => array('Jormungandr', 'Norse')))); }
public function spawnTo(Player $player) { $pk = new AddMobPacket(); $pk->eid = $this->getId(); $pk->type = Zombie::NETWORK_ID; $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->metadata = $this->getData(); $player->dataPacket($pk); $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ); parent::spawnTo($player); }
public function spawnTo(Player $player) { $pk = new AddEntityPacket(); $pk->eid = $this->getId(); $pk->type = Zombie::NETWORK_ID; $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->metadata = $this->dataProperties; $player->dataPacket($pk); parent::spawnTo($player); }
public function spawnTo(Player $player) { $pk = new AddEntityPacket(); $pk->eid = $this->getId(); $pk->type = Blaze::NETWORK_ID; $pk->x = $this->x; $pk->y = $this->y + 2; $pk->z = $this->z; $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->metadata = $this->dataProperties; $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING)); $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ); parent::spawnTo($player); }
public function spawnTo(Player $player) { $pk = new AddEntityPacket(); $pk->eid = $this->getId(); $pk->type = PigZombie::NETWORK_ID; $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $pk->yaw = $this->yaw; $pk->pitch = $this->pitch; $pk->metadata = $this->dataProperties; $player->dataPacket($pk); parent::spawnTo($player); $pk = new MobEquipmentPacket(); $pk->eid = $this->getId(); $pk->item = new ItemItem(283); $pk->slot = 0; $pk->selectedSlot = 0; $player->dataPacket($pk); }
public function initialize() { self::$db = new MDB('ar'); }
public function attack(Monster $monster) { $monster->receiveAttack($this->wapen()->ap()); }
public function __construct() { parent::__construct(); $this->createStages(); }
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/Monster.php"; session_start(); if (empty($_SESSION['list_of_monsters'])) { $_SESSION['list_of_monsters'] = array(); } $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('monsters.html.twig', array('monster' => Monster::getAll())); }); $app->post("/add_monster", function () use($app) { $monster = new Monster($_POST['name']); $monster->saveMonster(); return $app['twig']->render('add_monster.html.twig', array('newmonster' => $monster)); }); $app->post("/release_monsters", function () use($app) { Monster::releaseAll(); return $app['twig']->render('release_monsters.html.twig'); }); return $app;
public function present() { $monster = new Monster(); $monster->giveMonster(); }