Co jest Z ots dok?adniej z wgrywania Stronki

Gangstabanga

Advanced User
Zarejestrowany
Dołączył
Sierpień 26, 2009
Posty
279
Liczba reakcji
13
Wiek
36
Witam Mam taki problem dawno nie robi?em ots. O teraz zn?w zacze?em robi? ots dalej dzia?a kt?rym aktualnie sie zajmuje tylko ?e mam taki problem gdy wgrywam oboj?tnie jaki accmaker mam b?edy z punktem 6,7 monnster i spells wgrywam i mam takie b?edy i nie mam poj?cia co sie tryka <wtf>
punkt
Kod:
Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\xampp\htdocs\pot\OTS_SpellsList.php on line 97

Fatal error: Call to undefined method domdocument::load() in C:\xampp\htdocs\pot\OTS_SpellsList.php on line 98

Kod:
Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\xampp\htdocs\pot\OTS_MonstersList.php on line 61

Fatal error: Call to undefined method domdocument::load() in C:\xampp\htdocs\pot\OTS_MonstersList.php on line 62
 
Odp: Co jest Z ots dok?adniej z wgrywania Stronki

monsters.php
Kod:
<?php

/**#@+
 * @version 0.0.6
 * @since 0.0.6
 */

/**
 * @package POT
 * @version 0.1.3
 * @author Wrzasq <wrzasq@gmail.com>
 * @copyright 2007 - 2008 (C) by Wrzasq
 * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
 */

/**
 * Wrapper for monsters files DOMDocument.
 * 
 * <p>
 * Note: as this class extends {@link http://www.php.net/manual/en/ref.dom.php DOMDocument class} and contains exacly file XML tree you can work on it as on normal DOM tree.
 * </p>
 * 
 * @package POT
 * @version 0.1.3
 * @property-read string $name Monster name.
 * @property-read string $race Monster race.
 * @property-read int $experience Experience for killing monster.
 * @property-read int $speed Monster speed.
 * @property-read int|bool $manaCost Mana required (false if not possible).
 * @property-read int $health Hit points.
 * @property-read array $flags Flags.
 * @property-read array $voices List of sounds.
 * @property-read array $items List of possible loot.
 * @property-read array $immunities List of immunities.
 * @property-read int $defense Defense rate.
 * @property-read int $armor Armor rate.
 * @property-read array $defenses List of defenses.
 * @property-read array $attacks List of attacks.
 */
class OTS_Monster extends DOMDocument
{
/**
 * Returns monster name.
 * 
 * @return string Name.
 * @throws DOMException On DOM operation error.
 */
    public function getName()
    {
        return $this->documentElement->getAttribute('name');
    }

/**
 * Returns monster race.
 * 
 * @return string Race.
 * @throws DOMException On DOM operation error.
 */
    public function getRace()
    {
        return $this->documentElement->getAttribute('race');
    }

/**
 * Returns amount of experience for killing this monster.
 * 
 * @return int Experience points.
 * @throws DOMException On DOM operation error.
 */
    public function getExperience()
    {
        return (int) $this->documentElement->getAttribute('experience');
    }

/**
 * Returns monster speed.
 * 
 * @return int Speed.
 * @throws DOMException On DOM operation error.
 */
    public function getSpeed()
    {
        return (int) $this->documentElement->getAttribute('speed');
    }

/**
 * Returns amount of mana required to summon this monster.
 * 
 * @return int|bool Mana required (false if not possible).
 * @throws DOMException On DOM operation error.
 */
    public function getManaCost()
    {
        // check if it is possible to summon this monster
        if( $this->documentElement->hasAttribute('manacost') )
        {
            return (int) $this->documentElement->getAttribute('manacost');
        }
        else
        {
            return false;
        }
    }

/**
 * Returns monster HP.
 * 
 * @return int Hit points.
 * @throws DOMException On DOM operation error.
 */
    public function getHealth()
    {
        return (int) $this->documentElement->getElementsByTagName('health')->item(0)->getAttribute('max');
    }

/**
 * Returns all monster flags (in format flagname => value).
 * 
 * @return array Flags.
 * @throws DOMException On DOM operation error.
 */
    public function getFlags()
    {
        $flags = array();

        // read all flags
        foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
        {
            $flag = $flag->attributes->item(0);

            $flags[$flag->nodeName] = (int) $flag->nodeValue;
        }

        return $flags;
    }

/**
 * Returns specified flag value.
 * 
 * @param string $flag Flag.
 * @return int|bool Flag value (false if not set).
 * @throws DOMException On DOM operation error.
 */
    public function getFlag($flag)
    {
        // searches for flag
        foreach( $this->documentElement->getElementsByTagName('flags')->item(0)->getElementsByTagName('flag') as $flag)
        {
            // found
            if( $flag->hasAttribute($flag) )
            {
                return (int) $flag->getAttribute($flag);
            }
        }

        // not found
        return false;
    }

/**
 * Returns voices that monster can sound.
 * 
 * @return array List of voices.
 * @throws DOMException On DOM operation error.
 */
    public function getVoices()
    {
        $voices = array();

        $element = $this->documentElement->getElementsByTagName('voices')->item(0);

        // checks if it has any voices
        if( isset($element) )
        {
            // loads all voices
            foreach( $element->getElementsByTagName('voice') as $voice)
            {
                $voices[] = $voice->getAttribute('sentence');
            }
        }

        return $voices;
    }

/**
 * @return array List of item IDs.
 * @deprecated 0.1.0 Use getItems().
 */
    public function getLoot()
    {
        $loot = array();

        $element = $this->documentElement->getElementsByTagName('loot')->item(0);

        // checks if it has any loot
        if( isset($element) )
        {
            // adds all items
            foreach( $element->getElementsByTagName('item') as $item)
            {
                $id = $item->getAttribute('id');

                // avoid redundancy
                if( !in_array($id, $loot) )
                {
                    $loot[] = $id;
                }
            }
        }

        return $loot;
    }

/**
 * Returns all possible loot.
 * 
 * <p>
 * In order to use this method you have to have global items list loaded.
 * </p>
 * 
 * @version 0.1.0
 * @since 0.1.0
 * @return array List of item types.
 * @throws E_OTS_NotLoaded When there is no items list available in global POT instance.
 * @throws DOMException On DOM operation error.
 */
    public function getItems()
    {
        $loot = array();
        $keys = array();
        $items = POT::getInstance()->getItemsList();

        $element = $this->documentElement->getElementsByTagName('loot')->item(0);

        // checks if it has any loot
        if( isset($element) )
        {
            // adds all items
            foreach( $element->getElementsByTagName('item') as $item)
            {
                $id = $item->getAttribute('id');

                // avoid redundancy
                if( !in_array($id, $keys) )
                {
                    $keys[] = $id;
                    $loot[] = $items->getItemType($id);
                }
            }
        }

        return $loot;
    }

/**
 * Returns all monster immunities.
 * 
 * @return array Immunities.
 * @throws DOMException On DOM operation error.
 */
    public function getImmunities()
    {
        $immunities = array();

        $element = $this->documentElement->getElementsByTagName('immunities')->item(0);

        // checks if it has any immunities
        if( isset($element) )
        {
            // read all immunities
            foreach( $element->getElementsByTagName('immunity') as $immunity)
            {
                $immunity = $immunity->attributes->item(0);

                // checks if immunity is set
                if($immunity->nodeValue > 0)
                {
                    $immunities[] = $immunity->nodeName;
                }
            }
        }

        return $immunities;
    }

/**
 * Checks if monster has given immunity.
 * 
 * @param string $name Immunity to check.
 * @return bool Immunity state.
 * @throws DOMException On DOM operation error.
 */
    public function hasImmunity($name)
    {
        $element = $this->documentElement->getElementsByTagName('immunities')->item(0);

        // if doesn't have any immunities obviously doesn't have this one too
        if( isset($element) )
        {
            // read all immunities
            foreach( $element->getElementsByTagName('immunity') as $immunity)
            {
                // checks if this is what we are searching for
                if( $immunity->hasAttribute($name) )
                {
                    return $immunity->getAttribute($name) > 0;
                }
            }
        }

        return false;
    }

/**
 * Returns monster defense rate.
 * 
 * @return int Defense rate.
 * @throws DOMException On DOM operation error.
 */
    public function getDefense()
    {
        $element = $this->documentElement->getElementsByTagName('defenses')->item(0);

        // checks if defenses element is set
        if( isset($element) )
        {
            return (int) $element->getAttribute('defense');
        }

        return 0;
    }

/**
 * Returns monster armor.
 * 
 * @return int Armor rate.
 * @throws DOMException On DOM operation error.
 */
    public function getArmor()
    {
        $element = $this->documentElement->getElementsByTagName('defenses')->item(0);

        // checks if defenses element is set
        if( isset($element) )
        {
            return (int) $element->getAttribute('armor');
        }

        return 0;
    }

/**
 * Returns list of special defenses.
 * 
 * @return array List of defense effects.
 * @throws DOMException On DOM operation error.
 */
    public function getDefenses()
    {
        $defenses = array();

        $element = $this->documentElement->getElementsByTagName('defenses')->item(0);

        // checks if it has any defenses
        if( isset($element) )
        {
            foreach( $element->getElementsByTagName('defense') as $defense)
            {
                $defenses[] = $defense->getAttribute('name');
            }
        }

        return $defenses;
    }

/**
 * Returns list of monster attacks.
 * 
 * @return array List of attafck effects.
 * @throws DOMException On DOM operation error.
 */
    public function getAttacks()
    {
        $attacks = array();

        $element = $this->documentElement->getElementsByTagName('attacks')->item(0);

        // checks if it has any defenses
        if( isset($element) )
        {
            foreach( $element->getElementsByTagName('attack') as $attack)
            {
                $attacks[] = $attack->getAttribute('name');
            }
        }

        return $attacks;
    }

/**
 * Magic PHP5 method.
 * 
 * @version 0.1.0
 * @since 0.1.0
 * @param string $name Property name.
 * @return mixed Property value.
 * @throws OutOfBoundsException For non-supported properties.
 * @throws DOMException On DOM operation error.
 */
    public function __get($name)
    {
        switch($name)
        {
            case 'name':
                return $this->getName();

            case 'race':
                return $this->getRace();

            case 'experience':
                return $this->getExperience();

            case 'speed':
                return $this->getSpeed();

            case 'manaCost':
                return $this->getManaCost();

            case 'health':
                return $this->getHealth();

            case 'flags':
                return $this->getFlags();

            case 'voices':
                return $this->getVoices();

            case 'items':
                return $this->getItems();

            case 'immunities':
                return $this->getImmunities();

            case 'defense':
                return $this->getDefense();

            case 'armor':
                return $this->getArmor();

            case 'defenses':
                return $this->getDefenses();

            case 'attacks':
                return $this->getAttacks();

            default:
                throw new OutOfBoundsException();
        }
    }

/**
 * Returns string representation of XML.
 * 
 * <p>
 * If any display driver is currently loaded then it uses it's method. Otherwise just returns monster XML content.
 * </p>
 * 
 * @version 0.1.3
 * @since 0.1.0
 * @return string String representation of object.
 */
    public function __toString()
    {
        $ots = POT::getInstance();

        // checks if display driver is loaded
        if( $ots->isDataDisplayDriverLoaded() )
        {
            return $ots->getDataDisplayDriver()->displayMonster($this);
        }

        return $this->saveXML();
    }
}

/**#@-*/

?>
 
Odp: Co jest Z ots dok?adniej z wgrywania Stronki

ots_spellslist.php
Kod:
<?php

/**#@+
 * @version 0.1.0
 * @since 0.1.0
 */

/**
 * @package POT
 * @version 0.1.5
 * @author Wrzasq <wrzasq@gmail.com>
 * @copyright 2007 - 2008 (C) by Wrzasq
 * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
 */

/**
 * Wrapper for spells list.
 * 
 * <p>
 * Note: Unlike other lists classes this one doesn't implement ArrayAccess interface because it contains three kinds of spells grouped into pararell arrays.
 * </p>
 * 
 * @package POT
 * @version 0.1.5
 * @property-read array $runesList List of rune spells.
 * @property-read array $instantsList List of instant spells.
 * @property-read array $conjuresList List of conjure spells.
 * @tutorial POT/data_directory.pkg#spells
 */
class OTS_SpellsList implements IteratorAggregate, Countable
{
/**
 * Rune spell.
 */
    const SPELL_RUNE = 0;
/**
 * Instant spell.
 */
    const SPELL_INSTANT = 1;
/**
 * Conjure spell.
 */
    const SPELL_CONJURE = 2;

/**
 * Rune spells.
 * 
 * @var array
 */
    private $runes = array();

/**
 * Instant spells.
 * 
 * @var array
 */
    private $instants = array();

/**
 * Conjure spells.
 * 
 * @var array
 */
    private $conjures = array();

/**
 * Magic PHP5 method.
 * 
 * <p>
 * Allows object importing from {@link http://www.php.net/manual/en/function.var-export.php var_export()}.
 * </p>
 * 
 * @param array $properties List of object properties.
 */
    public function __set_state($properties)
    {
        $object = new self();

        // loads properties
        foreach($properties as $name => $value)
        {
            $object->$name = $value;
        }

        return $object;
    }

/**
 * Loads spells list.
 * 
 * @param string $file Spells file name.
 * @throws DOMException On DOM operation error.
 */
    public function __construct($file)
    {
        // loads DOM document
        $spells = new DOMDocument();
        $spells->load($file);

        // loads runes
        foreach( $spells->getElementsByTagName('rune') as $rune)
        {
            $this->runes[ $rune->getAttribute('name') ] = new OTS_Spell(self::SPELL_RUNE, $rune);
        }

        // loads instants
        foreach( $spells->getElementsByTagName('instant') as $instant)
        {
            $this->instants[ $instant->getAttribute('name') ] = new OTS_Spell(self::SPELL_INSTANT, $instant);
        }

        // loads conjures
        foreach( $spells->getElementsByTagName('conjure') as $conjure)
        {
            $this->conjures[ $conjure->getAttribute('name') ] = new OTS_Spell(self::SPELL_CONJURE, $conjure);
        }
    }

/**
 * Returns list of runes.
 * 
 * @return array List of rune names.
 */
    public function getRunesList()
    {
        return array_keys($this->runes);
    }

/**
 * Checks if rune exists.
 * 
 * @version 0.1.3
 * @since 0.1.3
 * @param string $name Rune name.
 * @return bool If rune is set then true.
 */
    public function hasRune($name)
    {
        return isset($this->runes[$name]);
    }

/**
 * Returns given rune spell.
 * 
 * @version 0.1.3
 * @param string $name Rune name.
 * @return OTS_Spell Rune spell wrapper.
 * @throws OutOfBoundsException If rune does not exist.
 */
    public function getRune($name)
    {
        if( isset($this->runes[$name]) )
        {
            return $this->runes[$name];
        }

        throw new OutOfBoundsException();
    }

/**
 * Returns list of instants.
 * 
 * @return array List of instant spells names.
 */
    public function getInstantsList()
    {
        return array_keys($this->instants);
    }

/**
 * Checks if instant exists.
 * 
 * @version 0.1.3
 * @since 0.1.3
 * @param string $name Instant name.
 * @return bool If instant is set then true.
 */
    public function hasInstant($name)
    {
        return isset($this->instants[$name]);
    }

/**
 * Returns given instant spell.
 * 
 * @version 0.1.3
 * @param string $name Spell name.
 * @return OTS_Spell Instant spell wrapper.
 * @throws OutOfBoundsException If instant does not exist.
 */
    public function getInstant($name)
    {
        if( isset($this->instants[$name]) )
        {
            return $this->instants[$name];
        }

        throw new OutOfBoundsException();
    }

/**
 * Returns list of conjure spells.
 * 
 * @return array List of conjure spells names.
 */
    public function getConjuresList()
    {
        return array_keys($this->conjures);
    }

/**
 * Checks if conjure exists.
 * 
 * @version 0.1.3
 * @since 0.1.3
 * @param string $name Conjure name.
 * @return bool If conjure is set then true.
 */
    public function hasConjure($name)
    {
        return isset($this->conjures[$name]);
    }

/**
 * Returns given conjure spell.
 * 
 * @version 0.1.3
 * @param string $name Spell name.
 * @return OTS_Spell Conjure spell wrapper.
 * @throws OutOfBoundsException If conjure does not exist.
 */
    public function getConjure($name)
    {
        if( isset($this->conjures[$name]) )
        {
            return $this->conjures[$name];
        }

        throw new OutOfBoundsException();
    }

/**
 * Magic PHP5 method.
 * 
 * @param string $name Property name.
 * @return mixed Property value.
 * @throws OutOfBoundsException For non-supported properties.
 */
    public function __get($name)
    {
        switch($name)
        {
            case 'runesList':
                return $this->getRunesList();

            case 'instantsList':
                return $this->getInstantsList();

            case 'conjuresList':
                return $this->getConjuresList();

            default:
                throw new OutOfBoundsException();
        }
    }

/**
 * Returns string representation of object.
 * 
 * <p>
 * If any display driver is currently loaded then it uses it's method.
 * </p>
 * 
 * @version 0.1.3
 * @since 0.1.3
 * @return string String representation of object.
 */
    public function __toString()
    {
        $ots = POT::getInstance();

        // checks if display driver is loaded
        if( $ots->isDataDisplayDriverLoaded() )
        {
            return $ots->getDataDisplayDriver()->displaySpellsList($this);
        }

        return (string) $this->count();
    }

/**
 * Iterator for all spells.
 * 
 * <p>
 * Returned object will continousely iterate through all kind of spells.
 * </p>
 * 
 * @version 0.1.5
 * @since 0.1.5
 * @return AppendIterator Iterator for all spells.
 */
    public function getIterator()
    {
        $iterator = new AppendIterator();
        $iterator->append( new ArrayIterator($this->runes) );
        $iterator->append( new ArrayIterator($this->instants) );
        $iterator->append( new ArrayIterator($this->conjures) );
        return $iterator;
    }

/**
 * Number of all loaded spells.
 * 
 * @version 0.1.5
 * @since 0.1.5
 * @return int Amount of all spells.
 */
    public function count()
    {
        return count($this->runes) + count($this->instants) + count($this->conjures);
    }
}

/**#@-*/

?>
 
Odp: Co jest Z ots dok?adniej z wgrywania Stronki

Po zainstalowaniu accmakera zaloguj sie na panel admina i tam przeladuj to jeszcze raz i powinno dzialac .

Mam nadzieje ze pomoglem .

Pozdrawiam Policeman :) :)
 
Back
Do góry