--- /dev/null
+<?php
+/**
+ * A class for merchants which can trade items
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Merchant extends BaseFrameworkSystem {
+ // Name des Haendlers
+ private $merchantName = "Namenloser Händler";
+
+ // Preislite (Objekte wiedermal!)
+ private $priceList = null;
+
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ // Haendler mit Namen erzeugen
+ public static final function createMerchant ($merchantName, Harbor $harborInstance) {
+ // String absichern
+ $merchantName = (string) $merchantName;
+
+ // Get new instance
+ $merchantInstance = new Merchant();
+
+ // Debug message
+ if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) {
+ $merchantInstance->debugOutput(sprintf("[%s:%d] Ein Händler <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.",
+ __CLASS__,
+ __LINE__,
+ $merchantName,
+ $harborInstance->getHarborName()
+ ));
+ }
+
+ // Haendlernamen setzen
+ $merchantInstance->setMerchantName($merchantName);
+
+ // In dem angegebenen Hafen den Haendler ansiedeln
+ $merchantInstance->setHarborInstance($harborInstance);
+
+ // Preisliste initialisieren
+ $merchantInstance->createPriceList();
+
+ // Instanz zurueckliefern
+ return $merchantInstance;
+ }
+
+ // Initialize pricing list
+ private function createPriceList () {
+ $this->priceList = new FrameworkArrayObject("FakedPriceList");
+ }
+
+ // Setter for merchant name
+ public final function setMerchantName ($merchantName) {
+ // Debug message
+ $this->merchantName = (string) $merchantName;
+ }
+
+ // Getter for merchant name
+ public final function getMerchantName () {
+ return $this->merchantName;
+ }
+
+ // Setter for harbor instance
+ public final function setHarborInstance (Harbor $harborInstance) {
+ $this->harborInstance = $harborInstance;
+ }
+
+ // Getter for harbor instance
+ public final function getHarborInstance () {
+ return $this->harborInstance;
+ }
+
+ // Add new item to merchant's price list
+ public function addItemToPriceList (TradeableItem $itemInstance, $price) {
+ $this->makeDeprecated();
+ }
+
+ // Get a price from the merchant's list
+ public final function getPriceFromList (TradeableItem $itemInstance) {
+ $this->makeDeprecated();
+ }
+}
+
+// [EOF]
+?>