Your browser must have JavaScript enabled in order to view this page.
 >  >
 
Welcome Guest#214 Login/register    Go to Bottom
Go to Top

Source for file freemovement.php

Documentation is available at freemovement.php

  1. <?php
  2. /**
  3.  * The Free Movement Demo page
  4.  *
  5.  * DutchPIPE version 0.4; PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to version 1.0 of the DutchPIPE license.
  8.  * If you did not receive a copy of the DutchPIPE license, you can obtain one at
  9.  * http://dutchpipe.org/license/1_0.txt or by sending a note to
  10.  * license@dutchpipe.org, in which case you will be mailed a copy immediately.
  11.  *
  12.  * @package    DutchPIPE
  13.  * @subpackage dpuniverse_page
  14.  * @author     Lennert Stock <ls@dutchpipe.org>
  15.  * @copyright  2006, 2007 Lennert Stock
  16.  * @license    http://dutchpipe.org/license/1_0.txt  DutchPIPE License
  17.  * @version    Subversion: $Id: freemovement.php 278 2007-08-19 22:52:25Z ls $
  18.  * @link       http://dutchpipe.org/manual/package/DutchPIPE
  19.  * @see        DpPage
  20.  */
  21.  
  22. /**
  23.  * Builts upon the standard DpPage class
  24.  */
  25. inherit(DPUNIVERSE_STD_PATH 'DpPage.php');
  26.  
  27. /**
  28.  * The Free Movement Demo page
  29.  *
  30.  * @package    DutchPIPE
  31.  * @subpackage dpuniverse_page
  32.  * @author     Lennert Stock <ls@dutchpipe.org>
  33.  * @copyright  2006, 2007 Lennert Stock
  34.  * @license    http://dutchpipe.org/license/1_0.txt  DutchPIPE License
  35.  * @version    Release: 0.2.1
  36.  * @link       http://dutchpipe.org/manual/package/DutchPIPE
  37.  * @see        DpPage
  38.  */
  39. final class Freemovement extends DpPage
  40. {
  41.     private $mrFlowerObj NULL;
  42.  
  43.     /**
  44.      * Sets up the page at object creation time
  45.      */
  46.     public function createDpPage()
  47.     {
  48.         // This page has it's own template, but this is not necessary for
  49.         // draggable objects:
  50.         $this->template DPSERVER_TEMPLATE_PATH 'freemovement.tpl';
  51.  
  52.         // Set moving area to 1 or 2 for draggable objects.
  53.         // 1: Only draggable within inventory area; 2: Dragganle on entire page.
  54.         // This is all you have to do:
  55.         $this->isMovingArea 2;
  56.  
  57.         // Standard setup calls:
  58.         $this->title 'Free Movement Demo';
  59.         $this->body =
  60.             dp_text('This is an experiment with draggable objects.<br />
  61. Try it for yourself!<br />
  62. Others on the page see your movements.<br />');
  63.         $this->setNavigationTrail(
  64.             array(DPUNIVERSE_NAVLOGO''),
  65.             array(dp_text('Showcases')DPUNIVERSE_PAGE_PATH 'showcases.php'),
  66.             dp_text('Free Movement Demo'));
  67.  
  68.         // Alternative verbs to go to another page, also used by wandering NPCs:
  69.         $this->addExit('shop'DPUNIVERSE_PAGE_PATH 'shop.php');
  70.     }
  71.  
  72.     /**
  73.      * Called at regular intervals
  74.      */
  75.     public function resetDpPage()
  76.     {
  77.         if (is_null($this->mrFlowerObj)
  78.                 || !$this->isPresent($this->mrFlowerObj)) {
  79.             // Creates a flower based on the standard DpObject, moves it here:
  80.             $this->mrFlowerObj get_current_dpuniverse()->newDpObject(
  81.                 DPUNIVERSE_STD_PATH 'DpObject.php');
  82.             $this->mrFlowerObj->addId(explode('#',
  83.                 dp_text('flower#purple flower')));
  84.             $this->mrFlowerObj->title dp_text('purple flower');
  85.             $this->mrFlowerObj->titleDefinite dp_text('the purple flower');
  86.             $this->mrFlowerObj->titleIndefinite dp_text('a purple flower');
  87.             $this->mrFlowerObj->titleImg DPUNIVERSE_IMAGE_URL 'flower.gif';
  88.             $this->mrFlowerObj->body '<img src="' DPUNIVERSE_IMAGE_URL
  89.                 . 'flower_body.jpg" width="190" height="216" border="0" '
  90.                 . 'alt="" align="left" style="margin-right: 15px; border: solid '
  91.                 . '1px black" />'
  92.                 . dp_text('It is the purple white flower of the Dutchman\'s Pipe.');
  93.             $this->mrFlowerObj->value 20;
  94.  
  95.             if (WEIGHT_TYPE_NONE !== WEIGHT_TYPE{
  96.                 $this->coinherit(DPUNIVERSE_STD_PATH 'mass.php');
  97.                 if (WEIGHT_TYPE_ABSTRACT === WEIGHT_TYPE{
  98.                     $this->weight 1;
  99.                 elseif (WEIGHT_TYPE_METRIC === WEIGHT_TYPE{
  100.                     $this->weight 9/* Grams */
  101.                 elseif (WEIGHT_TYPE_USA === WEIGHT_TYPE{
  102.                     $this->weight 0.3/* Ounces */
  103.                 }
  104.             }
  105.             if (VOLUME_TYPE_NONE !== VOLUME_TYPE{
  106.                 $this->coinherit(DPUNIVERSE_STD_PATH 'mass.php');
  107.                 if (VOLUME_TYPE_ABSTRACT === VOLUME_TYPE{
  108.                     $this->volume 1;
  109.                 elseif (VOLUME_TYPE_METRIC === VOLUME_TYPE{
  110.                     $this->volume 5;
  111.                 elseif (VOLUME_TYPE_USA === VOLUME_TYPE{
  112.                     $this->volume 0.17;
  113.                 }
  114.             }
  115.  
  116.             $this->mrFlowerObj->moveDpObject($this);
  117.         }
  118.  
  119.         if (!($credits $this->isPresent(dp_text('credits')))) {
  120.             $credits get_current_dpuniverse()->newDpObject(DPUNIVERSE_OBJ_PATH
  121.                 . 'credits.php');
  122.             $credits->amount 20;
  123.             $credits->moveDpObject($this);
  124.         }
  125.         elseif ($credits->amount 20{
  126.             $credits->amount 20;
  127.         }
  128.     }
  129. }
  130. ?>

Documentation generated on Mon, 03 Sep 2007 22:21:38 +0200 by phpDocumentor 1.3.0RC6

Click me!
Guest#214
 
 
 
  Go to Top
 
 
Input Field OptionsClose Input Field Go to Top
 
Legal Notices | Copyright © 2006, 2007 Lennert Stock. All rights reserved. Last update: Mon Sep 03 2007, 21:50 CET.