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

Source for file square.php

Documentation is available at square.php

  1. <?php
  2. /**
  3.  * A Village Square
  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: square.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.  * A Village Square
  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 Square extends DpPage
  40. {
  41.     /**
  42.      * Sets up the page at object creation time
  43.      */
  44.     public function createDpPage()
  45.     {
  46.         // Standard setup calls:
  47.         $this->title dp_text('A Village Square');
  48.         $this->setBody('<img src="' DPUNIVERSE_IMAGE_URL 'square.jpg"
  49. width="450" height="330" border="0" usemap="#square_map" alt=""
  50. style="border: solid 1px black; margin-right: 10px" title="" alt=""
  51. align="left" />
  52. <div style="width: 220px; float: left"><br /><b>' dp_text('A Village Square')
  53.             . '</b><br />'
  54.             . sprintf(dp_text('<p align="justify">You\'re on a village square. A
  55. beautiful fountain catches your attention.</p><p align="justify">To the
  56. <a href="%s">north</a> you see a bar where they serve cold beer and to the
  57. <a href="%s">east</a> is a small shop. An alley leads
  58. <a href="%s">northeast</a>, while a darker alley heads off to the
  59. <a href="%s">northwest</a>.</p>'),
  60.             DPSERVER_CLIENT_URL '?location=' DPUNIVERSE_PAGE_PATH
  61.             . 'bar.php',
  62.             DPSERVER_CLIENT_URL '?location=' DPUNIVERSE_PAGE_PATH
  63.             . 'shop.php',
  64.             DPSERVER_CLIENT_URL '?location=' DPUNIVERSE_PAGE_PATH
  65.             . 'alley.php',
  66.             DPSERVER_CLIENT_URL '?location=' DPUNIVERSE_PAGE_PATH
  67.             . 'alley2.php')
  68.             . '</div><br clear="all" />');
  69.         $this->setMapArea('square_map''fountain_area''poly',
  70.             '113,288,113,254,136,248,136,226,148,222,148,205,176,205,176,224,'
  71.             . '187,224,187,249,207,251,212,258,212,282,190,290,140,292,113,'
  72.             . '288');
  73.         $this->addItem(dp_text('fountain'),
  74.             dp_text('A beautiful fountain. ')'getFountainItem',
  75.             'fountain_area');
  76.         $this->addAction(dp_text('search')dp_text('search')'actionSearch',
  77.             'fountain_area',
  78.             dp_text('search fountain'));
  79.         $this->setNavigationTrail(
  80.             array(DPUNIVERSE_NAVLOGO''),
  81.             array(dp_text('Showcases')DPUNIVERSE_PAGE_PATH
  82.             . 'showcases.php'));
  83.         $this->addExit(explode('#'dp_text('n#bar#enter bar')),
  84.             DPUNIVERSE_PAGE_PATH 'bar.php'NULLarray('square_map',
  85.             'bar_area''poly',
  86.             '37,216,37,182,228,179,229,212,177,213,177,203,147,204,147,213,37,'
  87.             . '216')dp_text('enter bar'));
  88.         $this->addExit(explode('#'dp_text('e#shop#enter shop')),
  89.             DPUNIVERSE_PAGE_PATH 'shop.php'NULLarray('square_map',
  90.             'shop_area''poly''435,241,355,213,355,157,437,162,435,241'),
  91.             dp_text('enter shop'));
  92.         $this->addExit(explode('#'dp_text('ne#alley#enter alley')),
  93.             DPUNIVERSE_PAGE_PATH 'alley.php'NULLarray('square_map',
  94.             'alley_area''poly''240,207,240,187,249,187,292,207,240,207'),
  95.             dp_text('enter alley'));
  96.         $this->addExit(explode('#'dp_text('nw#dark alley#enter dark alley')),
  97.             DPUNIVERSE_PAGE_PATH 'alley2.php'NULLarray('square_map',
  98.             'alley2_area''poly''7,226,0,226,0,197,22,197,22,217,7,226'),
  99.             dp_text('enter dark alley'));
  100.  
  101.         $this->fountainSearched new_dp_property(FALSE);
  102.     }
  103.  
  104.     /**
  105.      * Called at regular intervals
  106.      */
  107.     public function resetDpPage()
  108.     {
  109.         $this->fountainSearched FALSE;
  110.     }
  111.  
  112.     public function actionSearch($verb$noun)
  113.     {
  114.         if (!($user get_current_dpobject())) {
  115.             return FALSE;
  116.         }
  117.  
  118.         if (FALSE === in_array($noun,
  119.                 explode('#'dp_text('fountain#the fountain')))) {
  120.             $user->setActionFailure(dp_text('Search what?<br />'));
  121.             return FALSE;
  122.         }
  123.  
  124.         if ($this->fountainSearched{
  125.             $user->tell(
  126.                 dp_text('You search the fountain but find nothing.<br />'));
  127.             $this->tell(ucfirst(sprintf(
  128.                 dp_text("%s searches the fountain but doesn't seem to find anything.<br />"),
  129.                 $user->getTitle(DPUNIVERSE_TITLE_TYPE_DEFINITE)))$user);
  130.                 return TRUE;
  131.         }
  132.  
  133.         $this->fountainSearched TRUE;
  134.         $user->tell(
  135.             dp_text('You search the fountain and find some credits!<br />'));
  136.         $this->tell(ucfirst(sprintf(
  137.             dp_text("%s searches the fountain and finds some credits!<br />"),
  138.             $user->getTitle(DPUNIVERSE_TITLE_TYPE_DEFINITE)))$user);
  139.         $this->credits += 100;
  140.  
  141.         return TRUE;
  142.     }
  143.  
  144.     public function getFountainItem($item)
  145.     {
  146.         return !$this->fountainSearched
  147.             ? dp_text('You can search it.<br />')
  148.             : dp_text('It look like someone just searched it.<br />');
  149.     }
  150. }
  151. ?>

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

Click me!
Guest#215
 
 
 
  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.